aboutsummaryrefslogtreecommitdiff
path: root/fs/bcachefs/alloc_background.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-04-30 02:10:57 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-05-08 17:29:21 -0400
commitbe11ae16c4907fc9ede68cf5589d0bdd2b195d01 (patch)
treeb8d59cb6d79e4d5a533fde57368729de1c80786d /fs/bcachefs/alloc_background.h
parentc02eb9e89184bd016d3c907d1287d05430b2016b (diff)
bcachefs: __mark_pointer now takes bch_alloc_v4
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/alloc_background.h')
-rw-r--r--fs/bcachefs/alloc_background.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/fs/bcachefs/alloc_background.h b/fs/bcachefs/alloc_background.h
index 7d747ad0de66..fe72e8a53bdb 100644
--- a/fs/bcachefs/alloc_background.h
+++ b/fs/bcachefs/alloc_background.h
@@ -39,13 +39,22 @@ static inline u8 alloc_gc_gen(struct bch_alloc_v4 a)
return a.gen - a.oldest_gen;
}
-static inline void __bucket_m_to_alloc(struct bch_alloc_v4 *dst, struct bucket b)
+static inline void alloc_to_bucket(struct bucket *dst, struct bch_alloc_v4 src)
{
- dst->gen = b.gen;
- dst->data_type = b.data_type;
- dst->dirty_sectors = b.dirty_sectors;
- dst->cached_sectors = b.cached_sectors;
- dst->stripe = b.stripe;
+ dst->gen = src.gen;
+ dst->data_type = src.data_type;
+ dst->dirty_sectors = src.dirty_sectors;
+ dst->cached_sectors = src.cached_sectors;
+ dst->stripe = src.stripe;
+}
+
+static inline void __bucket_m_to_alloc(struct bch_alloc_v4 *dst, struct bucket src)
+{
+ dst->gen = src.gen;
+ dst->data_type = src.data_type;
+ dst->dirty_sectors = src.dirty_sectors;
+ dst->cached_sectors = src.cached_sectors;
+ dst->stripe = src.stripe;
}
static inline struct bch_alloc_v4 bucket_m_to_alloc(struct bucket b)
@@ -73,7 +82,7 @@ static inline bool bucket_data_type_mismatch(enum bch_data_type bucket,
bucket_data_type(bucket) != bucket_data_type(ptr);
}
-static inline unsigned bch2_bucket_sectors(struct bch_alloc_v4 a)
+static inline unsigned bch2_bucket_sectors_total(struct bch_alloc_v4 a)
{
return a.dirty_sectors + a.cached_sectors;
}