@@ -2414,6 +2414,8 @@ BTRFS_SETGET_STACK_FUNCS(root_rtransid, struct btrfs_root_item,
rtransid, 64);
BTRFS_SETGET_STACK_FUNCS(root_global_tree_id, struct btrfs_root_item,
global_tree_id, 64);
+BTRFS_SETGET_STACK_FUNCS(root_snapshot_id, struct btrfs_root_item,
+ snapshot_id, 64);
static inline bool btrfs_root_readonly(const struct btrfs_root *root)
{
@@ -686,7 +686,13 @@ struct btrfs_root_item {
/* If we want to use a specific set of global roots for this root. */
__le64 global_tree_id;
- __le64 reserved[7]; /* for future */
+ /*
+ * The current snapshot id of this root, increases every time we are
+ * snapshotted.
+ */
+ __le64 snapshot_id;
+
+ __le64 reserved[6]; /* for future */
} __attribute__ ((__packed__));
/*
This will be incremented on every snapshot in order to keep track of which blocks belong to which snapshots. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/ctree.h | 2 ++ include/uapi/linux/btrfs_tree.h | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-)