Commit c9752536 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba
Browse files

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: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 8ef385bb
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -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);