From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 6/7] btrfs: make btrfs_cleanup_fs_roots use the fs_roots_radix_lock
Date: Tue, 17 Dec 2019 10:44:03 -0500 [thread overview]
Message-ID: <20191217154404.44831-7-josef@toxicpanda.com> (raw)
In-Reply-To: <20191217154404.44831-1-josef@toxicpanda.com>
The radix root is primarily protected by the fs_roots_radix_lock, so use
that to lookup and get a ref on all of our fs roots in
btrfs_cleanup_fs_roots.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
fs/btrfs/disk-io.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index b99eab5381bf..9a0b74b4e7f9 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3922,15 +3922,14 @@ int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info)
int i = 0;
int err = 0;
unsigned int ret = 0;
- int index;
while (1) {
- index = srcu_read_lock(&fs_info->subvol_srcu);
+ spin_lock(&fs_info->fs_roots_radix_lock);
ret = radix_tree_gang_lookup(&fs_info->fs_roots_radix,
(void **)gang, root_objectid,
ARRAY_SIZE(gang));
if (!ret) {
- srcu_read_unlock(&fs_info->subvol_srcu, index);
+ spin_unlock(&fs_info->fs_roots_radix_lock);
break;
}
root_objectid = gang[ret - 1]->root_key.objectid + 1;
@@ -3944,7 +3943,7 @@ int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info)
/* grab all the search result for later use */
gang[i] = btrfs_grab_root(gang[i]);
}
- srcu_read_unlock(&fs_info->subvol_srcu, index);
+ spin_unlock(&fs_info->fs_roots_radix_lock);
for (i = 0; i < ret; i++) {
if (!gang[i])
--
2.23.0
next prev parent reply other threads:[~2019-12-17 15:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 15:43 [PATCH 0/7] Cleanup how we handle root refs, part 2 Josef Bacik
2019-12-17 15:43 ` [PATCH 1/7] btrfs: make the extent buffer leak check per fs info Josef Bacik
2019-12-17 15:43 ` [PATCH 2/7] btrfs: move the root freeing stuff into btrfs_put_root Josef Bacik
2019-12-17 15:44 ` [PATCH 3/7] btrfs: make inodes hold a ref on their roots Josef Bacik
2019-12-17 15:44 ` [PATCH 4/7] btrfs: hold a ref on the root on the dead roots list Josef Bacik
2019-12-17 15:44 ` [PATCH 5/7] btrfs: don't take an extra root ref at allocation time Josef Bacik
2019-12-17 15:44 ` Josef Bacik [this message]
2019-12-17 15:44 ` [PATCH 7/7] btrfs: kill the subvol_srcu Josef Bacik
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=20191217154404.44831-7-josef@toxicpanda.com \
--to=josef@toxicpanda.com \
--cc=kernel-team@fb.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