]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/bcachefs.h
Update bcachefs sources to 386f00b639 bcachefs: Snapshot creation, deletion
[bcachefs-tools-debian] / libbcachefs / bcachefs.h
index 9975fc173ccb7a3a87030353386f719bdc3bcb0f..0efb1aaa4bf680e0873b76a76422f6367514bfd0 100644 (file)
@@ -380,6 +380,8 @@ enum gc_phase {
        GC_PHASE_BTREE_alloc,
        GC_PHASE_BTREE_quotas,
        GC_PHASE_BTREE_reflink,
+       GC_PHASE_BTREE_subvolumes,
+       GC_PHASE_BTREE_snapshots,
 
        GC_PHASE_PENDING_DELETE,
 };
@@ -563,6 +565,21 @@ struct btree_path_buf {
 
 #define REPLICAS_DELTA_LIST_MAX        (1U << 16)
 
+struct snapshot_t {
+       u32                     parent;
+       u32                     children[2];
+       u32                     subvol; /* Nonzero only if a subvolume points to this node: */
+       u32                     equiv;
+};
+
+typedef struct {
+       u32             subvol;
+       u64             inum;
+} subvol_inum;
+
+#define BCACHEFS_ROOT_SUBVOL_INUM                                      \
+       ((subvol_inum) { BCACHEFS_ROOT_SUBVOL,  BCACHEFS_ROOT_INO })
+
 struct bch_fs {
        struct closure          cl;
 
@@ -634,6 +651,12 @@ struct bch_fs {
        struct closure          sb_write;
        struct mutex            sb_lock;
 
+       /* snapshot.c: */
+       GENRADIX(struct snapshot_t) snapshots;
+       struct bch_snapshot_table __rcu *snapshot_table;
+       struct mutex            snapshot_table_lock;
+       struct work_struct      snapshot_delete_work;
+
        /* BTREE CACHE */
        struct bio_set          btree_bio;
        struct workqueue_struct *io_complete_wq;