From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 3/3] btrfs: use helper btrfs_get_block_group
Date: Wed, 3 Jun 2020 18:10:20 +0800 [thread overview]
Message-ID: <20200603101020.143372-4-anand.jain@oracle.com> (raw)
In-Reply-To: <20200603101020.143372-1-anand.jain@oracle.com>
Use the helper function where it is open coded to increment the
block_group reference count 'bg_count' so that it is less confusing
while reviewing the code. 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.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
fs/btrfs/free-space-cache.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 169b1117c1a3..867204b48ccf 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -2925,7 +2925,7 @@ void btrfs_return_cluster_to_free_space(
spin_unlock(&cluster->lock);
return;
}
- atomic_inc(&block_group->bg_count);
+ btrfs_get_block_group(block_group);
spin_unlock(&cluster->lock);
ctl = block_group->free_space_ctl;
@@ -3355,7 +3355,7 @@ int btrfs_find_space_cluster(struct btrfs_block_group *block_group,
list_del_init(&entry->list);
if (!ret) {
- atomic_inc(&block_group->bg_count);
+ btrfs_get_block_group(block_group);
list_add_tail(&cluster->block_group_list,
&block_group->cluster_list);
cluster->block_group = block_group;
--
2.25.1
next prev parent reply other threads:[~2020-06-03 10:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-03 10:10 [PATCH 0/3] btrfs: minor block group cleanups Anand Jain
2020-06-03 10:10 ` [PATCH 1/3] btrfs: fix btrfs_return_cluster_to_free_space() return Anand Jain
2020-06-03 10:17 ` Nikolay Borisov
2020-06-03 10:33 ` Johannes Thumshirn
2020-06-03 10:10 ` [PATCH 2/3] btrfs: rename btrfs_block_group::count Anand Jain
2020-06-03 10:19 ` Filipe Manana
2020-06-03 10:43 ` Anand Jain
2020-06-03 10:49 ` Filipe Manana
2020-06-03 11:38 ` Anand Jain
2020-06-03 11:54 ` Filipe Manana
2020-06-03 10:23 ` Nikolay Borisov
2020-06-03 10:10 ` Anand Jain [this message]
2020-06-03 10:24 ` [PATCH 3/3] btrfs: use helper btrfs_get_block_group Nikolay Borisov
2020-06-03 10:34 ` Johannes Thumshirn
2020-06-04 16:56 ` [PATCH 0/3] btrfs: minor block group cleanups David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200603101020.143372-4-anand.jain@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox