Skip to content

Commit 78e9b54

Browse files
author
Kent Overstreet
committed
bcachefs: bch2_dev_bucket_exists() uses bch2_dev_rcu()
Signed-off-by: Kent Overstreet <[email protected]>
1 parent ad897d2 commit 78e9b54

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

fs/bcachefs/alloc_background.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ enum bkey_invalid_flags;
1515

1616
static inline bool bch2_dev_bucket_exists(struct bch_fs *c, struct bpos pos)
1717
{
18-
struct bch_dev *ca;
19-
20-
if (!bch2_dev_exists(c, pos.inode))
21-
return false;
22-
23-
ca = bch2_dev_bkey_exists(c, pos.inode);
24-
return bucket_valid(ca, pos.offset);
18+
rcu_read_lock();
19+
struct bch_dev *ca = bch2_dev_rcu(c, pos.inode);
20+
bool ret = ca && bucket_valid(ca, pos.offset);
21+
rcu_read_unlock();
22+
return ret;
2523
}
2624

2725
static inline u64 bucket_to_u64(struct bpos bucket)

0 commit comments

Comments
 (0)