]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
btrfs: remove local generation variable from read_block_for_search()
authorFilipe Manana <fdmanana@suse.com>
Wed, 16 Oct 2024 10:13:24 +0000 (11:13 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 11 Nov 2024 13:34:18 +0000 (14:34 +0100)
It's redundant to have the 'gen' variable since we already have the same
value in the local btrfs_tree_parent_check structure. So remove it and
instead use the structure's field.

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/ctree.c

index f68a9b586079b973ef3cc76b3e4da6bf721c786c..148648ea1c8b9513bca44c13a7c6012b3d3a00db 100644 (file)
@@ -1514,7 +1514,6 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,
        struct btrfs_fs_info *fs_info = root->fs_info;
        struct btrfs_tree_parent_check check = { 0 };
        u64 blocknr;
-       u64 gen;
        struct extent_buffer *tmp = NULL;
        int ret = 0;
        int parent_level;
@@ -1524,12 +1523,11 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,
        bool path_released = false;
 
        blocknr = btrfs_node_blockptr(*eb_ret, slot);
-       gen = btrfs_node_ptr_generation(*eb_ret, slot);
        parent_level = btrfs_header_level(*eb_ret);
        btrfs_node_key_to_cpu(*eb_ret, &check.first_key, slot);
        check.has_first_key = true;
        check.level = parent_level - 1;
-       check.transid = gen;
+       check.transid = btrfs_node_ptr_generation(*eb_ret, slot);
        check.owner_root = btrfs_root_id(root);
 
        /*
@@ -1545,7 +1543,7 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,
                        reada_for_search(fs_info, p, parent_level, slot, key->objectid);
 
                /* first we do an atomic uptodate check */
-               if (btrfs_buffer_uptodate(tmp, gen, 1) > 0) {
+               if (btrfs_buffer_uptodate(tmp, check.transid, 1) > 0) {
                        /*
                         * Do extra check for first_key, eb can be stale due to
                         * being cached, read from scrub, or have multiple