btrfs: take an fs_info directly when the root is not used otherwise
There are loads of functions in btrfs that accept a root parameter but only use it to obtain an fs_info pointer. Let's convert those to just accept an fs_info pointer directly. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:

committed by
David Sterba

parent
afdb571890
commit
2ff7e61e0d
@@ -161,9 +161,8 @@ static void print_uuid_item(struct extent_buffer *l, unsigned long offset,
|
||||
}
|
||||
}
|
||||
|
||||
void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
|
||||
void btrfs_print_leaf(struct btrfs_fs_info *fs_info, struct extent_buffer *l)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
int i;
|
||||
u32 type, nr;
|
||||
struct btrfs_item *item;
|
||||
@@ -184,7 +183,8 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
|
||||
nr = btrfs_header_nritems(l);
|
||||
|
||||
btrfs_info(fs_info, "leaf %llu total ptrs %d free space %d",
|
||||
btrfs_header_bytenr(l), nr, btrfs_leaf_free_space(root, l));
|
||||
btrfs_header_bytenr(l), nr,
|
||||
btrfs_leaf_free_space(fs_info, l));
|
||||
for (i = 0 ; i < nr ; i++) {
|
||||
item = btrfs_item_nr(i);
|
||||
btrfs_item_key_to_cpu(l, &key, i);
|
||||
@@ -315,9 +315,8 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l)
|
||||
}
|
||||
}
|
||||
|
||||
void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c)
|
||||
void btrfs_print_tree(struct btrfs_fs_info *fs_info, struct extent_buffer *c)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
int i; u32 nr;
|
||||
struct btrfs_key key;
|
||||
int level;
|
||||
@@ -327,7 +326,7 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c)
|
||||
nr = btrfs_header_nritems(c);
|
||||
level = btrfs_header_level(c);
|
||||
if (level == 0) {
|
||||
btrfs_print_leaf(root, c);
|
||||
btrfs_print_leaf(fs_info, c);
|
||||
return;
|
||||
}
|
||||
btrfs_info(fs_info,
|
||||
@@ -341,7 +340,7 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c)
|
||||
btrfs_node_blockptr(c, i));
|
||||
}
|
||||
for (i = 0; i < nr; i++) {
|
||||
struct extent_buffer *next = read_tree_block(root,
|
||||
struct extent_buffer *next = read_tree_block(fs_info,
|
||||
btrfs_node_blockptr(c, i),
|
||||
btrfs_node_ptr_generation(c, i));
|
||||
if (IS_ERR(next)) {
|
||||
@@ -357,7 +356,7 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c)
|
||||
if (btrfs_header_level(next) !=
|
||||
level - 1)
|
||||
BUG();
|
||||
btrfs_print_tree(root, next);
|
||||
btrfs_print_tree(fs_info, next);
|
||||
free_extent_buffer(next);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user