btrfs-progs: Replace root parameter using fs_info for reada_for_search()

As the @root parameter is only used to get @fs_info, use fs_info
directly instead.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2018-09-05 13:58:34 +08:00 committed by David Sterba
parent 3e1d9cf022
commit 65c3665811
3 changed files with 9 additions and 10 deletions

View File

@ -259,7 +259,7 @@ again:
} }
if (path->reada) if (path->reada)
reada_for_search(root, path, level, slot, 0); reada_for_search(fs_info, path, level, slot, 0);
next = read_node_slot(fs_info, c, slot); next = read_node_slot(fs_info, c, slot);
if (extent_buffer_uptodate(next)) if (extent_buffer_uptodate(next))
@ -276,7 +276,7 @@ again:
if (!level) if (!level)
break; break;
if (path->reada) if (path->reada)
reada_for_search(root, path, level, 0, 0); reada_for_search(fs_info, path, level, 0, 0);
next = read_node_slot(fs_info, next, 0); next = read_node_slot(fs_info, next, 0);
if (!extent_buffer_uptodate(next)) if (!extent_buffer_uptodate(next))
goto again; goto again;

11
ctree.c
View File

@ -1001,10 +1001,9 @@ static int noinline push_nodes_for_insert(struct btrfs_trans_handle *trans,
/* /*
* readahead one full node of leaves * readahead one full node of leaves
*/ */
void reada_for_search(struct btrfs_root *root, struct btrfs_path *path, void reada_for_search(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
int level, int slot, u64 objectid) int level, int slot, u64 objectid)
{ {
struct btrfs_fs_info *fs_info = root->fs_info;
struct extent_buffer *node; struct extent_buffer *node;
struct btrfs_disk_key disk_key; struct btrfs_disk_key disk_key;
u32 nritems; u32 nritems;
@ -1204,7 +1203,7 @@ again:
break; break;
if (should_reada) if (should_reada)
reada_for_search(root, p, level, slot, reada_for_search(fs_info, p, level, slot,
key->objectid); key->objectid);
b = read_node_slot(fs_info, b, slot); b = read_node_slot(fs_info, b, slot);
@ -2977,7 +2976,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
} }
if (path->reada) if (path->reada)
reada_for_search(root, path, level, slot, 0); reada_for_search(fs_info, path, level, slot, 0);
next = read_node_slot(fs_info, c, slot); next = read_node_slot(fs_info, c, slot);
if (!extent_buffer_uptodate(next)) if (!extent_buffer_uptodate(next))
@ -2994,7 +2993,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
if (!level) if (!level)
break; break;
if (path->reada) if (path->reada)
reada_for_search(root, path, level, 0, 0); reada_for_search(fs_info, path, level, 0, 0);
next = read_node_slot(fs_info, next, 0); next = read_node_slot(fs_info, next, 0);
if (!extent_buffer_uptodate(next)) if (!extent_buffer_uptodate(next))
return -EIO; return -EIO;

View File

@ -2572,8 +2572,8 @@ btrfs_check_node(struct btrfs_root *root, struct btrfs_disk_key *parent_key,
enum btrfs_tree_block_status enum btrfs_tree_block_status
btrfs_check_leaf(struct btrfs_root *root, struct btrfs_disk_key *parent_key, btrfs_check_leaf(struct btrfs_root *root, struct btrfs_disk_key *parent_key,
struct extent_buffer *buf); struct extent_buffer *buf);
void reada_for_search(struct btrfs_root *root, struct btrfs_path *path, void reada_for_search(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
int level, int slot, u64 objectid); int level, int slot, u64 objectid);
struct extent_buffer *read_node_slot(struct btrfs_fs_info *fs_info, struct extent_buffer *read_node_slot(struct btrfs_fs_info *fs_info,
struct extent_buffer *parent, int slot); struct extent_buffer *parent, int slot);
int btrfs_previous_item(struct btrfs_root *root, int btrfs_previous_item(struct btrfs_root *root,