From: Anand Jain Date: Wed, 3 Jun 2020 10:10:20 +0000 (+0800) Subject: btrfs: use helper btrfs_get_block_group X-Git-Tag: v5.15~2817^2~176 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5790d51809b3b0b5f0d012fa667b4e6cafd676e;p=platform%2Fkernel%2Flinux-starfive.git btrfs: use helper btrfs_get_block_group Use the helper function where it is open coded to increment the block_group reference count As btrfs_get_block_group() is a one-liner we could have open-coded it, but its partner function btrfs_put_block_group() isn't one-liner which does the free part in it. Reviewed-by: Nikolay Borisov Reviewed-by: Johannes Thumshirn Signed-off-by: Anand Jain Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 5442b6e..6943bdd 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -2924,7 +2924,7 @@ void btrfs_return_cluster_to_free_space( spin_unlock(&cluster->lock); return; } - atomic_inc(&block_group->count); + btrfs_get_block_group(block_group); spin_unlock(&cluster->lock); ctl = block_group->free_space_ctl; @@ -3354,7 +3354,7 @@ int btrfs_find_space_cluster(struct btrfs_block_group *block_group, list_del_init(&entry->list); if (!ret) { - atomic_inc(&block_group->count); + btrfs_get_block_group(block_group); list_add_tail(&cluster->block_group_list, &block_group->cluster_list); cluster->block_group = block_group;