btrfs: remove unnecessary fs_info argument from btrfs_add_block_group_cache()
The fs_info can be taken from the given block group, so there is no need to pass it as an argument. Also rename the local variable from 'info' to 'fs_info' which is more widely used, more clear and to be more consistent. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
20faaab2c3
commit
f378b4c3e3
@@ -191,21 +191,21 @@ static int btrfs_bg_start_cmp(const struct rb_node *new,
|
||||
/*
|
||||
* This adds the block group to the fs_info rb tree for the block group cache
|
||||
*/
|
||||
static int btrfs_add_block_group_cache(struct btrfs_fs_info *info,
|
||||
struct btrfs_block_group *block_group)
|
||||
static int btrfs_add_block_group_cache(struct btrfs_block_group *block_group)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = block_group->fs_info;
|
||||
struct rb_node *exist;
|
||||
int ret = 0;
|
||||
|
||||
ASSERT(block_group->length != 0);
|
||||
|
||||
write_lock(&info->block_group_cache_lock);
|
||||
write_lock(&fs_info->block_group_cache_lock);
|
||||
|
||||
exist = rb_find_add_cached(&block_group->cache_node,
|
||||
&info->block_group_cache_tree, btrfs_bg_start_cmp);
|
||||
&fs_info->block_group_cache_tree, btrfs_bg_start_cmp);
|
||||
if (exist)
|
||||
ret = -EEXIST;
|
||||
write_unlock(&info->block_group_cache_lock);
|
||||
write_unlock(&fs_info->block_group_cache_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -2438,7 +2438,7 @@ static int read_one_block_group(struct btrfs_fs_info *info,
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = btrfs_add_block_group_cache(info, cache);
|
||||
ret = btrfs_add_block_group_cache(cache);
|
||||
if (ret) {
|
||||
btrfs_remove_free_space_cache(cache);
|
||||
goto error;
|
||||
@@ -2487,7 +2487,7 @@ static int fill_dummy_bgs(struct btrfs_fs_info *fs_info)
|
||||
bg->cached = BTRFS_CACHE_FINISHED;
|
||||
bg->used = map->chunk_len;
|
||||
bg->flags = map->type;
|
||||
ret = btrfs_add_block_group_cache(fs_info, bg);
|
||||
ret = btrfs_add_block_group_cache(bg);
|
||||
/*
|
||||
* We may have some valid block group cache added already, in
|
||||
* that case we skip to the next one.
|
||||
@@ -2914,7 +2914,7 @@ struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *tran
|
||||
cache->space_info = btrfs_find_space_info(fs_info, cache->flags);
|
||||
ASSERT(cache->space_info);
|
||||
|
||||
ret = btrfs_add_block_group_cache(fs_info, cache);
|
||||
ret = btrfs_add_block_group_cache(cache);
|
||||
if (ret) {
|
||||
btrfs_remove_free_space_cache(cache);
|
||||
btrfs_put_block_group(cache);
|
||||
|
||||
Reference in New Issue
Block a user