summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/extents.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-08-05 17:46:41 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:09 -0400
commite2d9912c6f25301923783e7e785870f821d31c40 (patch)
treeac38181623d4dd6763103e6cff5f2cbd0fe538b7 /fs/bcachefs/extents.h
parent581edb634140fe3da0bc3c8430116e735ebff897 (diff)
downloadlinux-stable-e2d9912c6f25301923783e7e785870f821d31c40.tar.gz
linux-stable-e2d9912c6f25301923783e7e785870f821d31c40.tar.bz2
linux-stable-e2d9912c6f25301923783e7e785870f821d31c40.zip
bcachefs: bch2_extent_trim_atomic()
Prep work for extents insert hook removal Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/extents.h')
-rw-r--r--fs/bcachefs/extents.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/bcachefs/extents.h b/fs/bcachefs/extents.h
index fddf25c3fa4b..0721d1829f98 100644
--- a/fs/bcachefs/extents.h
+++ b/fs/bcachefs/extents.h
@@ -62,6 +62,17 @@ int bch2_extent_pick_ptr(struct bch_fs *, struct bkey_s_c,
struct bch_devs_mask *,
struct extent_pick_ptr *);
+void bch2_extent_trim_atomic(struct bkey_i *, struct btree_iter *);
+
+static inline bool bch2_extent_is_atomic(struct bkey *k,
+ struct btree_iter *iter)
+{
+ struct btree *b = iter->l[0].b;
+
+ return bkey_cmp(k->p, b->key.k.p) <= 0 &&
+ bkey_cmp(bkey_start_pos(k), b->data->min_key) >= 0;
+}
+
enum btree_insert_ret
bch2_extent_can_insert(struct btree_insert *, struct btree_insert_entry *,
unsigned *);