From 47ac34ec988f01e1e0d00a5281abe0812bad4fcc Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sat, 25 Dec 2021 22:37:19 -0500 Subject: bcachefs: Separate out gc_bucket() Since the main in memory bucket array is going away, we don't want to be calling bucket() or __bucket() when what we want is the GC in-memory bucket. Signed-off-by: Kent Overstreet --- fs/bcachefs/buckets.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'fs/bcachefs/buckets.h') diff --git a/fs/bcachefs/buckets.h b/fs/bcachefs/buckets.h index afa29d6c5a73..61baaa66b6b5 100644 --- a/fs/bcachefs/buckets.h +++ b/fs/bcachefs/buckets.h @@ -53,6 +53,11 @@ static inline struct bucket *__bucket(struct bch_dev *ca, size_t b, bool gc) return buckets->b + b; } +static inline struct bucket *gc_bucket(struct bch_dev *ca, size_t b) +{ + return __bucket(ca, b, true); +} + static inline struct bucket *bucket(struct bch_dev *ca, size_t b) { return __bucket(ca, b, false); @@ -75,10 +80,15 @@ static inline size_t PTR_BUCKET_NR(const struct bch_dev *ca, } static inline struct bucket *PTR_BUCKET(struct bch_dev *ca, - const struct bch_extent_ptr *ptr, - bool gc) + const struct bch_extent_ptr *ptr) +{ + return bucket(ca, PTR_BUCKET_NR(ca, ptr)); +} + +static inline struct bucket *PTR_GC_BUCKET(struct bch_dev *ca, + const struct bch_extent_ptr *ptr) { - return __bucket(ca, PTR_BUCKET_NR(ca, ptr), gc); + return gc_bucket(ca, PTR_BUCKET_NR(ca, ptr)); } static inline enum bch_data_type ptr_data_type(const struct bkey *k, @@ -113,7 +123,7 @@ static inline u8 ptr_stale(struct bch_dev *ca, u8 ret; rcu_read_lock(); - ret = gen_after(PTR_BUCKET(ca, ptr, 0)->mark.gen, ptr->gen); + ret = gen_after(PTR_BUCKET(ca, ptr)->mark.gen, ptr->gen); rcu_read_unlock(); return ret; -- cgit v1.2.3