]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: remove NULL transaction support for btrfs_lookup_extent_info()
authorFilipe Manana <fdmanana@suse.com>
Tue, 18 Jun 2024 07:28:30 +0000 (08:28 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 11 Jul 2024 13:33:26 +0000 (15:33 +0200)
There are no callers of btrfs_lookup_extent_info() that pass a NULL value
for the transaction handle argument, so there's no point in having special
logic to deal with the NULL. The last caller that passed a NULL value was
removed in commit 19b546d7a1b2 ("btrfs: relocation:
Use btrfs_find_all_leafs to locate data extent parent tree leaves").

So remove the NULL handling from btrfs_lookup_extent_info().

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c

index 58a72a57414a85f3d46b3bb3cdde8f9ecb74cc45..21d123d392c009361b1c29ada437535704ef3b2a 100644 (file)
@@ -126,11 +126,6 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,
        if (!path)
                return -ENOMEM;
 
-       if (!trans) {
-               path->skip_locking = 1;
-               path->search_commit_root = 1;
-       }
-
 search_again:
        key.objectid = bytenr;
        key.offset = offset;
@@ -171,11 +166,7 @@ search_again:
                        btrfs_err(fs_info,
                        "unexpected extent item size, has %u expect >= %zu",
                                  item_size, sizeof(*ei));
-                       if (trans)
-                               btrfs_abort_transaction(trans, ret);
-                       else
-                               btrfs_handle_fs_error(fs_info, ret, NULL);
-
+                       btrfs_abort_transaction(trans, ret);
                        goto out_free;
                }
 
@@ -186,9 +177,6 @@ search_again:
                ret = 0;
        }
 
-       if (!trans)
-               goto out;
-
        delayed_refs = &trans->transaction->delayed_refs;
        spin_lock(&delayed_refs->lock);
        head = btrfs_find_delayed_ref_head(delayed_refs, bytenr);
@@ -219,7 +207,7 @@ search_again:
                mutex_unlock(&head->mutex);
        }
        spin_unlock(&delayed_refs->lock);
-out:
+
        WARN_ON(num_refs == 0);
        if (refs)
                *refs = num_refs;