mirror of
https://github.com/torvalds/linux.git
synced 2024-12-03 17:41:22 +00:00
btrfs: use btrfs_read_node_slot in walk_down_reloc_tree
We do not need to call read_tree_block() here, simply use the btrfs_read_node_slot helper. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
206983b72a
commit
8ef385bbf0
@ -1415,10 +1415,8 @@ static noinline_for_stack
|
||||
int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path,
|
||||
int *level)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
struct extent_buffer *eb = NULL;
|
||||
int i;
|
||||
u64 bytenr;
|
||||
u64 ptr_gen = 0;
|
||||
u64 last_snapshot;
|
||||
u32 nritems;
|
||||
@ -1426,8 +1424,6 @@ int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path,
|
||||
last_snapshot = btrfs_root_last_snapshot(&root->root_item);
|
||||
|
||||
for (i = *level; i > 0; i--) {
|
||||
struct btrfs_key first_key;
|
||||
|
||||
eb = path->nodes[i];
|
||||
nritems = btrfs_header_nritems(eb);
|
||||
while (path->slots[i] < nritems) {
|
||||
@ -1447,16 +1443,9 @@ int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path,
|
||||
return 0;
|
||||
}
|
||||
|
||||
bytenr = btrfs_node_blockptr(eb, path->slots[i]);
|
||||
btrfs_node_key_to_cpu(eb, &first_key, path->slots[i]);
|
||||
eb = read_tree_block(fs_info, bytenr, ptr_gen, i - 1,
|
||||
&first_key);
|
||||
if (IS_ERR(eb)) {
|
||||
eb = btrfs_read_node_slot(eb, path->slots[i]);
|
||||
if (IS_ERR(eb))
|
||||
return PTR_ERR(eb);
|
||||
} else if (!extent_buffer_uptodate(eb)) {
|
||||
free_extent_buffer(eb);
|
||||
return -EIO;
|
||||
}
|
||||
BUG_ON(btrfs_header_level(eb) != i - 1);
|
||||
path->nodes[i - 1] = eb;
|
||||
path->slots[i - 1] = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user