summaryrefslogtreecommitdiff
path: root/fs/bcachefs/subvolume.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-07-14 02:34:48 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:35 -0400
commit597dee1cd67d591cd5aeba184fdb69d0da0ceb78 (patch)
tree9d922948f1e07843ec08d3b21aae2aeab83eb645 /fs/bcachefs/subvolume.h
parent416cc426c0d79c65d85de52d3548a32de06ab3e8 (diff)
bcachefs: Switch data_update path to snapshot_id_list
snapshots_seen is becoming private to fsck, and snapshot_id_list is actually what the data update path needs. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/subvolume.h')
-rw-r--r--fs/bcachefs/subvolume.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/bcachefs/subvolume.h b/fs/bcachefs/subvolume.h
index b1739d29c7d4..28dbd0968f3d 100644
--- a/fs/bcachefs/subvolume.h
+++ b/fs/bcachefs/subvolume.h
@@ -93,6 +93,27 @@ static inline bool snapshot_list_has_id(snapshot_id_list *s, u32 id)
return false;
}
+static inline bool snapshot_list_has_ancestor(struct bch_fs *c, snapshot_id_list *s, u32 id)
+{
+ u32 *i;
+
+ darray_for_each(*s, i)
+ if (bch2_snapshot_is_ancestor(c, id, *i))
+ return true;
+ return false;
+}
+
+static inline int snapshot_list_add(struct bch_fs *c, snapshot_id_list *s, u32 id)
+{
+ int ret;
+
+ BUG_ON(snapshot_list_has_id(s, id));
+ ret = darray_push(s, id);
+ if (ret)
+ bch_err(c, "error reallocating snapshot_id_list (size %zu)", s->size);
+ return ret;
+}
+
int bch2_fs_snapshots_check(struct bch_fs *);
void bch2_fs_snapshots_exit(struct bch_fs *);
int bch2_fs_snapshots_start(struct bch_fs *);