diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-13 19:21:13 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-13 19:21:13 -0400 |
commit | 3765483ff0cf9abd0243fcafe11aebd0f9beb03d (patch) | |
tree | 232ba4c4c17b2c2579782b01422ae68994c9b5bf /libbcachefs/alloc_foreground.h | |
parent | d34e731082d8fcd710c2af6377a3b7fa927c8451 (diff) |
Update bcachefs sources to f05b3c1af9 bcachefs: Improve bucket_alloc_fail tracepoint
Diffstat (limited to 'libbcachefs/alloc_foreground.h')
-rw-r--r-- | libbcachefs/alloc_foreground.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libbcachefs/alloc_foreground.h b/libbcachefs/alloc_foreground.h index d466bda..f51cec5 100644 --- a/libbcachefs/alloc_foreground.h +++ b/libbcachefs/alloc_foreground.h @@ -115,6 +115,20 @@ static inline bool bch2_bucket_is_open(struct bch_fs *c, unsigned dev, u64 bucke return false; } +static inline bool bch2_bucket_is_open_safe(struct bch_fs *c, unsigned dev, u64 bucket) +{ + bool ret; + + if (bch2_bucket_is_open(c, dev, bucket)) + return true; + + spin_lock(&c->freelist_lock); + ret = bch2_bucket_is_open(c, dev, bucket); + spin_unlock(&c->freelist_lock); + + return ret; +} + int bch2_bucket_alloc_set(struct bch_fs *, struct open_buckets *, struct dev_stripe_state *, struct bch_devs_mask *, unsigned, unsigned *, bool *, enum alloc_reserve, |