From: Josef Bacik Date: Thu, 5 Nov 2020 15:45:12 +0000 (-0500) Subject: btrfs: use btrfs_read_node_slot in do_relocation X-Git-Tag: accepted/tizen/unified/20230118.172025~7911^2~137 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c975253682e049a3a98e9ce27d19c923f1d1d776;p=platform%2Fkernel%2Flinux-rpi.git btrfs: use btrfs_read_node_slot in do_relocation We're open coding btrfs_read_node_slot in do_relocation, replace this with the proper helper. Reviewed-by: Filipe Manana Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 91ed88e..57efb90 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -2191,7 +2191,6 @@ static int do_relocation(struct btrfs_trans_handle *trans, struct btrfs_key *key, struct btrfs_path *path, int lowest) { - struct btrfs_fs_info *fs_info = rc->extent_root->fs_info; struct btrfs_backref_node *upper; struct btrfs_backref_edge *edge; struct btrfs_backref_edge *edges[BTRFS_MAX_LEVEL - 1]; @@ -2199,7 +2198,6 @@ static int do_relocation(struct btrfs_trans_handle *trans, struct extent_buffer *eb; u32 blocksize; u64 bytenr; - u64 generation; int slot; int ret; int err = 0; @@ -2209,7 +2207,6 @@ static int do_relocation(struct btrfs_trans_handle *trans, path->lowest_level = node->level + 1; rc->backref_cache.path[node->level] = node; list_for_each_entry(edge, &node->upper, list[LOWER]) { - struct btrfs_key first_key; struct btrfs_ref ref = { 0 }; cond_resched(); @@ -2282,17 +2279,10 @@ static int do_relocation(struct btrfs_trans_handle *trans, } blocksize = root->fs_info->nodesize; - generation = btrfs_node_ptr_generation(upper->eb, slot); - btrfs_node_key_to_cpu(upper->eb, &first_key, slot); - eb = read_tree_block(fs_info, bytenr, generation, - upper->level - 1, &first_key); + eb = btrfs_read_node_slot(upper->eb, slot); if (IS_ERR(eb)) { err = PTR_ERR(eb); goto next; - } else if (!extent_buffer_uptodate(eb)) { - free_extent_buffer(eb); - err = -EIO; - goto next; } btrfs_tree_lock(eb);