From 5e8a779f5c8b9f79a5483d29aa2927ce26688ddb Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 5 Nov 2021 16:40:29 -0400 Subject: [PATCH] btrfs-progs: add on disk pointers to global tree ids We are going to start creating multiple sets of global trees, which at the moment are the free space tree, csum tree, and extent tree. Generally we will assign these at block group creation time, but Dave would like to be able to have them per-subvolume at some point, so reserve a slot for that as well. Signed-off-by: Josef Bacik Signed-off-by: David Sterba --- kernel-shared/ctree.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h index eb815b2d..6ca49c09 100644 --- a/kernel-shared/ctree.h +++ b/kernel-shared/ctree.h @@ -830,7 +830,13 @@ struct btrfs_root_item { struct btrfs_timespec otime; struct btrfs_timespec stime; struct btrfs_timespec rtime; - __le64 reserved[8]; /* for future */ + + /* + * If we want to use a specific set of fst/checksum/extent roots for + * this root. + */ + __le64 global_tree_id; + __le64 reserved[7]; /* for future */ } __attribute__ ((__packed__)); /* @@ -1717,6 +1723,12 @@ BTRFS_SETGET_FUNCS(block_group_flags, BTRFS_SETGET_STACK_FUNCS(stack_block_group_flags, struct btrfs_block_group_item, flags, 64); +/* extent tree v2 uses chunk_objectid for the global tree id. */ +BTRFS_SETGET_STACK_FUNCS(stack_block_group_global_tree_id, + struct btrfs_block_group_item, chunk_objectid, 64); +BTRFS_SETGET_FUNCS(block_group_global_tree_id, struct btrfs_block_group_item, + chunk_objectid, 64); + /* struct btrfs_free_space_info */ BTRFS_SETGET_FUNCS(free_space_extent_count, struct btrfs_free_space_info, extent_count, 32);