summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/buckets.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-12-25 22:37:19 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:20 -0400
commit47ac34ec988f01e1e0d00a5281abe0812bad4fcc (patch)
treedcec93647828a6cccffdec4b265f1ac67b26a735 /fs/bcachefs/buckets.h
parent9ddffaf83b5ac7cf79917cfe9a1435cc07d071b6 (diff)
downloadlinux-47ac34ec988f01e1e0d00a5281abe0812bad4fcc.tar.gz
linux-47ac34ec988f01e1e0d00a5281abe0812bad4fcc.tar.bz2
linux-47ac34ec988f01e1e0d00a5281abe0812bad4fcc.zip
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 <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/buckets.h')
-rw-r--r--fs/bcachefs/buckets.h18
1 files changed, 14 insertions, 4 deletions
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;