summaryrefslogtreecommitdiff
path: root/libbcachefs/subvolume.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-02-17 17:51:22 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-02-17 17:51:22 -0500
commit46a6b9210c927ab46fd1227cb6f641be0b4a7505 (patch)
treec7aea129fe8213eaefe90ac34090835d59598c7e /libbcachefs/subvolume.h
parentc1677df62edb8be05caf7a6862b599f8e74c404f (diff)
Update bcachefs sources to 1b14994029 bcachefs: Fragmentation LRUv0.27
Diffstat (limited to 'libbcachefs/subvolume.h')
-rw-r--r--libbcachefs/subvolume.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/libbcachefs/subvolume.h b/libbcachefs/subvolume.h
index b6740eab..7c488c3d 100644
--- a/libbcachefs/subvolume.h
+++ b/libbcachefs/subvolume.h
@@ -8,15 +8,15 @@
void bch2_snapshot_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
int bch2_snapshot_invalid(const struct bch_fs *, struct bkey_s_c,
unsigned, struct printbuf *);
+int bch2_mark_snapshot(struct btree_trans *, struct bkey_s_c,
+ struct bkey_s_c, unsigned);
#define bch2_bkey_ops_snapshot ((struct bkey_ops) { \
.key_invalid = bch2_snapshot_invalid, \
.val_to_text = bch2_snapshot_to_text, \
+ .atomic_trigger = bch2_mark_snapshot, \
})
-int bch2_mark_snapshot(struct btree_trans *, struct bkey_s_c,
- struct bkey_s_c, unsigned);
-
static inline struct snapshot_t *snapshot_t(struct bch_fs *c, u32 id)
{
return genradix_ptr(&c->snapshots, U32_MAX - id);
@@ -68,6 +68,13 @@ static inline bool bch2_snapshot_is_ancestor(struct bch_fs *c, u32 id, u32 ances
return id == ancestor;
}
+static inline bool bch2_snapshot_has_children(struct bch_fs *c, u32 id)
+{
+ struct snapshot_t *t = snapshot_t(c, id);
+
+ return (t->children[0]|t->children[1]) != 0;
+}
+
static inline bool snapshot_list_has_id(snapshot_id_list *s, u32 id)
{
u32 *i;