From 0bbbccb17fea86818e1a058faf5903aefd20b31a Mon Sep 17 00:00:00 2001 From: David Sterba Date: Mon, 25 Jan 2016 17:32:11 +0100 Subject: btrfs: introduce key type for persistent temporary items The number of distinct key types is not that big that we could waste one for something new we want to store in the tree. We'll introduce a new name for an existing key value and use the objectid for further extension. The victim is the BTRFS_BALANCE_ITEM_KEY (248). The nature of the balance status item is a good example of the temporary item. It exists from beginning of the balance, keeps the status until it finishes. Signed-off-by: David Sterba --- fs/btrfs/ctree.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'fs/btrfs/ctree.h') diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index bfe4a337fb4d..e20f40649917 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -2185,8 +2185,24 @@ struct btrfs_ioctl_defrag_range_args { */ #define BTRFS_QGROUP_RELATION_KEY 246 +/* + * Obsolete name, see BTRFS_TEMPORARY_ITEM_KEY. + */ #define BTRFS_BALANCE_ITEM_KEY 248 +/* + * The key type for tree items that are stored persistently, but do not need to + * exist for extended period of time. The items can exist in any tree. + * + * [subtype, BTRFS_TEMPORARY_ITEM_KEY, data] + * + * Existing items: + * + * - balance status item + * (BTRFS_BALANCE_OBJECTID, BTRFS_TEMPORARY_ITEM_KEY, 0) + */ +#define BTRFS_TEMPORARY_ITEM_KEY 248 + /* * Persistantly stores the io stats in the device tree. * One key for all stats, (0, BTRFS_DEV_STATS_KEY, devid). -- cgit v1.2.1 From 50c2d5abe64c1726b48d292a2ab04f60e8238933 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Mon, 25 Jan 2016 17:32:11 +0100 Subject: btrfs: introduce key type for persistent permanent items The number of distinct key types is not that big that we could waste one for something new we want to store in the tree. Similar to the temporary items, we'll introduce a new name for an existing key value and use the objectid for further extension. The victim is the BTRFS_DEV_STATS_KEY (248). The device stats are an example of a permanent item. Signed-off-by: David Sterba --- fs/btrfs/ctree.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'fs/btrfs/ctree.h') diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index e20f40649917..ffc081e11277 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -2204,10 +2204,24 @@ struct btrfs_ioctl_defrag_range_args { #define BTRFS_TEMPORARY_ITEM_KEY 248 /* - * Persistantly stores the io stats in the device tree. - * One key for all stats, (0, BTRFS_DEV_STATS_KEY, devid). + * Obsolete name, see BTRFS_PERSISTENT_ITEM_KEY */ -#define BTRFS_DEV_STATS_KEY 249 +#define BTRFS_DEV_STATS_KEY 249 + +/* + * The key type for tree items that are stored persistently and usually exist + * for a long period, eg. filesystem lifetime. The item kinds can be status + * information, stats or preference values. The item can exist in any tree. + * + * [subtype, BTRFS_PERSISTENT_ITEM_KEY, data] + * + * Existing items: + * + * - device statistics, store IO stats in the device tree, one key for all + * stats + * (0, BTRFS_DEV_STATS_KEY, 0) + */ +#define BTRFS_PERSISTENT_ITEM_KEY 249 /* * Persistantly stores the device replace state in the device tree. -- cgit v1.2.1 From 242e2956e4afde7727fffe21adc0a7b198b77f96 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Mon, 25 Jan 2016 17:51:31 +0100 Subject: btrfs: switch dev stats item to the permanent item key Signed-off-by: David Sterba --- fs/btrfs/ctree.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'fs/btrfs/ctree.h') diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index ffc081e11277..70054ed2bd7b 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -100,6 +100,9 @@ struct btrfs_ordered_sum; /* tracks free space in block groups. */ #define BTRFS_FREE_SPACE_TREE_OBJECTID 10ULL +/* device stats in the device tree */ +#define BTRFS_DEV_STATS_OBJECTID 0ULL + /* for storing balance parameters in the root tree */ #define BTRFS_BALANCE_OBJECTID -4ULL @@ -2219,7 +2222,7 @@ struct btrfs_ioctl_defrag_range_args { * * - device statistics, store IO stats in the device tree, one key for all * stats - * (0, BTRFS_DEV_STATS_KEY, 0) + * (BTRFS_DEV_STATS_OBJECTID, BTRFS_DEV_STATS_KEY, 0) */ #define BTRFS_PERSISTENT_ITEM_KEY 249 -- cgit v1.2.1