summaryrefslogtreecommitdiff
path: root/libbcachefs/bset.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-02-09 18:34:08 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-02-09 18:36:24 -0500
commita104f0407b7f5de54972389ef10e11dd8c525a96 (patch)
tree07c993aeedb4bfe4a52d6725a689a6b018d2b483 /libbcachefs/bset.h
parentabe1c3bc8e116879a258bff2316cfb0586f15fec (diff)
Update bcachefs sources to ea93c26e98 fixup! bcachefs: We can handle missing btree roots for all alloc btrees
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/bset.h')
-rw-r--r--libbcachefs/bset.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libbcachefs/bset.h b/libbcachefs/bset.h
index acef1430..fd2915a1 100644
--- a/libbcachefs/bset.h
+++ b/libbcachefs/bset.h
@@ -291,6 +291,21 @@ static inline int bkey_cmp_p_or_unp(const struct btree *b,
return __bch2_bkey_cmp_left_packed_format_checked(b, l, r);
}
+static inline struct bset_tree *
+bch2_bkey_to_bset_inlined(struct btree *b, struct bkey_packed *k)
+{
+ unsigned offset = __btree_node_key_to_offset(b, k);
+ struct bset_tree *t;
+
+ for_each_bset(b, t)
+ if (offset <= t->end_offset) {
+ EBUG_ON(offset < btree_bkey_first_offset(t));
+ return t;
+ }
+
+ BUG();
+}
+
struct bset_tree *bch2_bkey_to_bset(struct btree *, struct bkey_packed *);
struct bkey_packed *bch2_bkey_prev_filter(struct btree *, struct bset_tree *,