summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/bcachefs/alloc.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/bcachefs/alloc.c b/fs/bcachefs/alloc.c
index ec02adc0d20c..0c239212d427 100644
--- a/fs/bcachefs/alloc.c
+++ b/fs/bcachefs/alloc.c
@@ -1065,13 +1065,9 @@ static long bch2_bucket_alloc_startup(struct bch_fs *c, struct bch_dev *ca)
return -1;
}
- spin_unlock(&c->freelist_lock);
-
- down_read(&ca->bucket_lock);
+ rcu_read_lock();
buckets = bucket_array(ca);
- spin_lock(&c->freelist_lock);
-
for (b = ca->mi.first_bucket; b < ca->mi.nbuckets; b++)
if (is_startup_available_bucket(buckets->b[b].mark) &&
bch2_mark_alloc_bucket_startup(c, ca, b)) {
@@ -1080,7 +1076,7 @@ static long bch2_bucket_alloc_startup(struct bch_fs *c, struct bch_dev *ca)
}
b = -1;
success:
- up_read(&ca->bucket_lock);
+ rcu_read_unlock();
up_read(&c->gc_lock);
return b;
}