summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-05-01 03:26:37 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-05-08 17:29:23 -0400
commit78e9b548f37b92ef81e1bc8cb4dfd4165c5a97d4 (patch)
treedf191d5d32aa9385b414a69bea2ac8ecaf799f11
parentad897d241b703a3e81fd4785a4b007168471e9e2 (diff)
bcachefs: bch2_dev_bucket_exists() uses bch2_dev_rcu()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/alloc_background.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/bcachefs/alloc_background.h b/fs/bcachefs/alloc_background.h
index a75eba6d9586..5f42dc1e7fcc 100644
--- a/fs/bcachefs/alloc_background.h
+++ b/fs/bcachefs/alloc_background.h
@@ -15,13 +15,11 @@ enum bkey_invalid_flags;
static inline bool bch2_dev_bucket_exists(struct bch_fs *c, struct bpos pos)
{
- struct bch_dev *ca;
-
- if (!bch2_dev_exists(c, pos.inode))
- return false;
-
- ca = bch2_dev_bkey_exists(c, pos.inode);
- return bucket_valid(ca, pos.offset);
+ rcu_read_lock();
+ struct bch_dev *ca = bch2_dev_rcu(c, pos.inode);
+ bool ret = ca && bucket_valid(ca, pos.offset);
+ rcu_read_unlock();
+ return ret;
}
static inline u64 bucket_to_u64(struct bpos bucket)