diff options
author | Jeff Mahoney | 2016-06-21 21:16:51 -0400 |
---|---|---|
committer | David Sterba | 2016-12-06 16:06:57 +0100 |
commit | 6bccf3ab1e1f0913268bfcd1c09cadb1f4f2857d (patch) | |
tree | a7eae4bb4dec1cd2f7b21f5010549bfaa9aaa08c /fs/btrfs/extent-tree.c | |
parent | 5b4aacefb8fbfc996e68b9b083d30f8bc0972449 (diff) |
btrfs: call functions that always use the same root with fs_info instead
There are many functions that are always called with the same root
argument. Rather than passing the same root every time, we can
pass an fs_info pointer instead and have the function get the root
pointer itself.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 13ef5d53943b..e4b3fc07f162 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -9514,8 +9514,9 @@ void btrfs_dec_block_group_ro(struct btrfs_root *root, * @return - -1 if it's not a good idea to relocate this block group, 0 if its * ok to go ahead and try. */ -int btrfs_can_relocate(struct btrfs_root *root, u64 bytenr) +int btrfs_can_relocate(struct btrfs_fs_info *fs_info, u64 bytenr) { + struct btrfs_root *root = fs_info->extent_root; struct btrfs_block_group_cache *block_group; struct btrfs_space_info *space_info; struct btrfs_fs_devices *fs_devices = root->fs_info->fs_devices; @@ -9659,9 +9660,11 @@ out: return ret; } -static int find_first_block_group(struct btrfs_root *root, - struct btrfs_path *path, struct btrfs_key *key) +static int find_first_block_group(struct btrfs_fs_info *fs_info, + struct btrfs_path *path, + struct btrfs_key *key) { + struct btrfs_root *root = fs_info->extent_root; int ret = 0; struct btrfs_key found_key; struct extent_buffer *leaf; @@ -9961,7 +9964,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info) need_clear = 1; while (1) { - ret = find_first_block_group(root, path, &key); + ret = find_first_block_group(info, path, &key); if (ret > 0) break; if (ret != 0) @@ -10140,7 +10143,7 @@ void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans, sizeof(item)); if (ret) btrfs_abort_transaction(trans, ret); - ret = btrfs_finish_chunk_alloc(trans, extent_root, + ret = btrfs_finish_chunk_alloc(trans, extent_root->fs_info, key.objectid, key.offset); if (ret) btrfs_abort_transaction(trans, ret); @@ -10263,9 +10266,10 @@ static void clear_avail_alloc_bits(struct btrfs_fs_info *fs_info, u64 flags) } int btrfs_remove_block_group(struct btrfs_trans_handle *trans, - struct btrfs_root *root, u64 group_start, + struct btrfs_fs_info *fs_info, u64 group_start, struct extent_map *em) { + struct btrfs_root *root = fs_info->extent_root; struct btrfs_path *path; struct btrfs_block_group_cache *block_group; struct btrfs_free_cluster *cluster; @@ -10279,9 +10283,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, struct btrfs_caching_control *caching_ctl = NULL; bool remove_em; - root = root->fs_info->extent_root; - - block_group = btrfs_lookup_block_group(root->fs_info, group_start); + block_group = btrfs_lookup_block_group(fs_info, group_start); BUG_ON(!block_group); BUG_ON(!block_group->ro); |