summaryrefslogtreecommitdiff
path: root/libbcachefs/alloc_foreground.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-05-07 16:40:18 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-05-07 16:41:50 -0400
commit147fb2ac5dc4f08c38c5011ea1a99c2298abb280 (patch)
treee83b4d0b8a980292b18e3ef505a92e28ae2b33c4 /libbcachefs/alloc_foreground.h
parent51315289f249fa5569a776eaa98c7ee557b61077 (diff)
Update bcachefs sources to 17baec961add fixup! bcachefs: opts.rebalance_on_ac_onlynoradtux-debug
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/alloc_foreground.h')
-rw-r--r--libbcachefs/alloc_foreground.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/libbcachefs/alloc_foreground.h b/libbcachefs/alloc_foreground.h
index 19220341..2e01c7b6 100644
--- a/libbcachefs/alloc_foreground.h
+++ b/libbcachefs/alloc_foreground.h
@@ -3,6 +3,7 @@
#define _BCACHEFS_ALLOC_FOREGROUND_H
#include "bcachefs.h"
+#include "buckets.h"
#include "alloc_types.h"
#include "extents.h"
#include "io_write_types.h"
@@ -233,7 +234,19 @@ int bch2_alloc_sectors_start_trans(struct btree_trans *,
struct closure *,
struct write_point **);
-struct bch_extent_ptr bch2_ob_ptr(struct bch_fs *, struct open_bucket *);
+static inline struct bch_extent_ptr bch2_ob_ptr(struct bch_fs *c, struct open_bucket *ob)
+{
+ struct bch_dev *ca = ob_dev(c, ob);
+
+ return (struct bch_extent_ptr) {
+ .type = 1 << BCH_EXTENT_ENTRY_ptr,
+ .gen = ob->gen,
+ .dev = ob->dev,
+ .offset = bucket_to_sector(ca, ob->bucket) +
+ ca->mi.bucket_size -
+ ob->sectors_free,
+ };
+}
/*
* Append pointers to the space we just allocated to @k, and mark @sectors space