Skip to contentSkip to conversation

master - lib: move towards v2 version of VDO format

PATCH Zdenek Kabelac 1 participant 1 message Dec 20, 2018

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3320ab8334794684b4d324bb78d0b293a27287a6
Commit:        3320ab8334794684b4d324bb78d0b293a27287a6
Parent:        9785e40b8d52fd87d7c451ed838f450aee41ba8d
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Thu Dec 20 13:17:30 2018 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Thu Dec 20 13:26:55 2018 +0100

lib: move towards v2 version of VDO format

Drop very old original format of VDO target and focus on V2 version. So some variables were renamed or replaced.
There is no compatibility preserved (with assumption so far this is experimental feature and there is no real user).

Note - version currently VDO calls this version 6.2.

---
 WHATS_NEW                      |    1 +
 device_mapper/all.h            |    1 +
 device_mapper/libdm-deptree.c  |   16 +++++++----
 device_mapper/vdo/target.h     |   15 +++++------
 device_mapper/vdo/vdo_limits.h |    7 +++-
 device_mapper/vdo/vdo_target.c |   20 ++++++++++----
 lib/config/config_settings.h   |   54 +++++++++++++++++++++++-----------------
 lib/config/defaults.h          |    8 +++---
 lib/metadata/vdo_manip.c       |   16 ++++++------
 lib/vdo/vdo.c                  |   44 ++++++++++++++++----------------
 10 files changed, 103 insertions(+), 79 deletions(-)
WHATS_NEW +1 -0
index 0b7f834..38525e3 100644
@@ -1,5 +1,6 @@
 Version 2.03.02 - 
 ===================================
+  Move VDO support towards V2 target (6.2) support.
   Fix missing proper initialization of pv_list struct when adding pv.
   Fix (de)activation of RaidLVs with visible SubLVs
   Prohibit mirrored 'mirror' log via lvcreate and lvconvert
device_mapper/all.h +1 -0
index 8c17c09..9539442 100644
@@ -976,6 +976,7 @@ int dm_tree_node_add_writecache_target(struct dm_tree_node *node,
 int dm_tree_node_add_vdo_target(struct dm_tree_node *node,
 				uint64_t size,
 				const char *data_uuid,
+				uint64_t data_size,
 				const struct dm_vdo_target_params *param);
 
 /*
device_mapper/libdm-deptree.c +10 -6
index 7a7239e..91ccdd4 100644
@@ -214,6 +214,7 @@ struct load_segment {
 	struct dm_tree_node *vdo_data;  /* VDO */
 	struct dm_vdo_target_params vdo_params; /* VDO */
 	const char *vdo_name;           /* VDO - device name is ALSO passed as table arg */
+	uint64_t vdo_data_size;		/* VDO - size of data storage device */
 
 	struct dm_tree_node *writecache_node;		/* writecache */
 	int writecache_pmem;				/* writecache, 1 if pmem, 0 if ssd */
@@ -2745,17 +2746,18 @@ static int _vdo_emit_segment_line(struct dm_task *dmt,
 		return 0;
 	}
 
-	EMIT_PARAMS(pos, "%s %u %s " FMTu64 " " FMTu64 " %u on %s %s "
-		    "ack=%u,bio=%u,bioRotationInterval=%u,cpu=%u,hash=%u,logical=%u,physical=%u",
+	EMIT_PARAMS(pos, "V2 %s " FMTu64 " %u " FMTu64 " %u %s %s %s "
+		    "maxDiscard %u ack %u bio %u bioRotationInterval %u cpu %u hash %u logical %u physical %u",
 		    data_dev,
-		    (seg->vdo_params.emulate_512_sectors == 0) ? 4096 : 512,
-		    seg->vdo_params.use_read_cache ? "enabled" : "disabled",
-		    seg->vdo_params.read_cache_size_mb * UINT64_C(256),		// 1MiB -> 4KiB units
+		    seg->vdo_data_size / 8, // this parameter is in 4K units
+		    seg->vdo_params.minimum_io_size,
 		    seg->vdo_params.block_map_cache_size_mb * UINT64_C(256),	// 1MiB -> 4KiB units
-		    seg->vdo_params.block_map_period,
+		    seg->vdo_params.block_map_era_length,
+		    seg->vdo_params.use_metadata_hints ? "on" : "off" ,
 		    (seg->vdo_params.write_policy == DM_VDO_WRITE_POLICY_SYNC) ? "sync" :
 			(seg->vdo_params.write_policy == DM_VDO_WRITE_POLICY_ASYNC) ? "async" : "auto", // policy
 		    seg->vdo_name,
+		    seg->vdo_params.max_discard,
 		    seg->vdo_params.ack_threads,
 		    seg->vdo_params.bio_threads,
 		    seg->vdo_params.bio_rotation,
@@ -4185,6 +4187,7 @@ int dm_tree_node_add_cache_target_base(struct dm_tree_node *node,
 int dm_tree_node_add_vdo_target(struct dm_tree_node *node,
 				uint64_t size,
 				const char *data_uuid,
+				uint64_t data_size,
 				const struct dm_vdo_target_params *vtp)
 {
 	struct load_segment *seg;
@@ -4205,6 +4208,7 @@ int dm_tree_node_add_vdo_target(struct dm_tree_node *node,
 
 	seg->vdo_params = *vtp;
 	seg->vdo_name = node->name;
+	seg->vdo_data_size = data_size;
 
 	node->props.send_messages = 2;
 
device_mapper/vdo/target.h +7 -8
index c597491..f83cffd 100644
@@ -74,16 +74,16 @@ enum dm_vdo_write_policy {
 
 // FIXME: review whether we should use the createParams from the userlib
 struct dm_vdo_target_params {
+	uint32_t minimum_io_size;
 	uint32_t block_map_cache_size_mb;
-	uint32_t block_map_period;
+	uint32_t block_map_era_length;	// format period
 
 	uint32_t check_point_frequency;
-	uint32_t index_memory_size_mb;
+	uint32_t index_memory_size_mb;  // format
 
-	uint32_t read_cache_size_mb;
-
-	uint32_t slab_size_mb;
+	uint32_t slab_size_mb;          // format
 
+	uint32_t max_discard;
 	// threads
 	uint32_t ack_threads;
 	uint32_t bio_threads;
@@ -95,9 +95,8 @@ struct dm_vdo_target_params {
 
 	bool use_compression;
 	bool use_deduplication;
-	bool emulate_512_sectors;
-	bool use_sparse_index;
-	bool use_read_cache;
+	bool use_metadata_hints;
+	bool use_sparse_index;          // format
 
 	// write policy
 	enum dm_vdo_write_policy write_policy;
device_mapper/vdo/vdo_limits.h +5 -2
index 40cf204..e145100 100644
@@ -21,8 +21,8 @@
 #define DM_VDO_BLOCK_MAP_CACHE_SIZE_MAXIMUM_MB	(16 * 1024 * 1024 - 1)	// 16TiB - 1
 #define DM_VDO_BLOCK_MAP_CACHE_SIZE_MINIMUM_PER_LOGICAL_THREAD  (4096 * DM_VDO_BLOCK_SIZE_KB)
 
-#define DM_VDO_BLOCK_MAP_PERIOD_MINIMUM		1
-#define DM_VDO_BLOCK_MAP_PERIOD_MAXIMUM		(16380)
+#define DM_VDO_BLOCK_MAP_ERA_LENGTH_MINIMUM	(1)
+#define DM_VDO_BLOCK_MAP_ERA_LENGTH_MAXIMUM	(16380)
 
 #define DM_VDO_INDEX_MEMORY_SIZE_MINIMUM_MB	(256)			// 0.25 GiB
 #define DM_VDO_INDEX_MEMORY_SIZE_MAXIMUM_MB	(1024 * 1024 * 1024)	// 1TiB
@@ -57,4 +57,7 @@
 //#define DM_VDO_PHYSICAL_THREADS_MINIMUM	(0)
 #define DM_VDO_PHYSICAL_THREADS_MAXIMUM		(16)
 
+#define DM_VDO_MAX_DISCARD_MINIMUM		(1)
+#define DM_VDO_MAX_DISCARD_MAXIMUM		(UINT32_MAX / 4096)
+
 #endif // DEVICE_MAPPER_VDO_LIMITS_H
device_mapper/vdo/vdo_target.c +14 -6
index c488023..976d71a 100644
@@ -23,6 +23,13 @@ bool dm_vdo_validate_target_params(const struct dm_vdo_target_params *vtp,
 {
 	bool valid = true;
 
+	if ((vtp->minimum_io_size != 512) &&
+	    (vtp->minimum_io_size != 4096)) {
+		log_error("VDO minimum io size %u is unsupported.",
+			  vtp->minimum_io_size);
+		valid = false;
+	}
+
 	if ((vtp->block_map_cache_size_mb < DM_VDO_BLOCK_MAP_CACHE_SIZE_MINIMUM_MB) ||
 	    (vtp->block_map_cache_size_mb > DM_VDO_BLOCK_MAP_CACHE_SIZE_MAXIMUM_MB)) {
 		log_error("VDO block map cache size %u out of range.",
@@ -37,12 +44,6 @@ bool dm_vdo_validate_target_params(const struct dm_vdo_target_params *vtp,
 		valid = false;
 	}
 
-	if (vtp->read_cache_size_mb > DM_VDO_READ_CACHE_SIZE_MAXIMUM_MB) {
-		log_error("VDO read cache size %u out of range.",
-			  vtp->read_cache_size_mb);
-		valid = false;
-	}
-
 	if ((vtp->slab_size_mb < DM_VDO_SLAB_SIZE_MINIMUM_MB) ||
 	    (vtp->slab_size_mb > DM_VDO_SLAB_SIZE_MAXIMUM_MB)) {
 		log_error("VDO slab size %u out of range.",
@@ -50,6 +51,13 @@ bool dm_vdo_validate_target_params(const struct dm_vdo_target_params *vtp,
 		valid = false;
 	}
 
+	if ((vtp->max_discard < DM_VDO_MAX_DISCARD_MINIMUM) ||
+	    (vtp->max_discard > DM_VDO_MAX_DISCARD_MAXIMUM)) {
+		log_error("VDO max discard %u out of range.",
+			  vtp->max_discard);
+		valid = false;
+	}
+
 	if (vtp->ack_threads > DM_VDO_ACK_THREADS_MAXIMUM) {
 		log_error("VDO ack threads %u out of range.", vtp->ack_threads);
 		valid = false;
lib/config/config_settings.h +31 -23

88 lines not on this page · raw message

lib/config/defaults.h +4 -4
index fc12626..b45324b 100644
@@ -153,14 +153,13 @@
 /* VDO defaults */
 #define DEFAULT_VDO_USE_COMPRESSION	(true)
 #define DEFAULT_VDO_USE_DEDUPLICATION	(true)
-#define DEFAULT_VDO_EMULATE_512_SECTORS	(false)
+#define DEFAULT_VDO_USE_METADATA_HINTS	(true)
+#define DEFAULT_VDO_MINIMUM_IO_SIZE	(4096)
 #define DEFAULT_VDO_BLOCK_MAP_CACHE_SIZE_MB	(DM_VDO_BLOCK_MAP_CACHE_SIZE_MINIMUM_MB)
-#define DEFAULT_VDO_BLOCK_MAP_PERIOD	(DM_VDO_BLOCK_MAP_PERIOD_MAXIMUM)
+#define DEFAULT_VDO_BLOCK_MAP_ERA_LENGTH (DM_VDO_BLOCK_MAP_ERA_LENGTH_MAXIMUM)
 #define DEFAULT_VDO_USE_SPARSE_INDEX	(false)
 #define DEFAULT_VDO_CHECK_POINT_FREQUENCY	(0)
 #define DEFAULT_VDO_INDEX_MEMORY_SIZE_MB	(DM_VDO_INDEX_MEMORY_SIZE_MINIMUM_MB)
-#define DEFAULT_VDO_USE_READ_CACHE	(false)
-#define DEFAULT_VDO_READ_CACHE_SIZE_MB	(0)
 #define DEFAULT_VDO_SLAB_SIZE_MB	(2 * 1024)  // 2GiB ... 19 slabbits
 #define DEFAULT_VDO_ACK_THREADS		(1)
 #define DEFAULT_VDO_BIO_THREADS		(1)
@@ -170,6 +169,7 @@
 #define DEFAULT_VDO_LOGICAL_THREADS	(1)
 #define DEFAULT_VDO_PHYSICAL_THREADS	(1)
 #define DEFAULT_VDO_WRITE_POLICY	"auto"
+#define DEFAULT_VDO_MAX_DISCARD		(DM_VDO_MAX_DISCARD_MINIMUM)
 
 #define DEFAULT_VDO_FORMAT_OPTIONS_CONFIG "#S" ""
 /*
lib/metadata/vdo_manip.c +8 -8
index b5bbbe2..04ab1ab 100644
@@ -416,22 +416,20 @@ int fill_vdo_target_params(struct cmd_context *cmd,
 		find_config_tree_int(cmd, allocation_vdo_use_compression_CFG, profile);
 	vtp->use_deduplication =
 		find_config_tree_int(cmd, allocation_vdo_use_deduplication_CFG, profile);
-	vtp->emulate_512_sectors =
-		find_config_tree_int(cmd, allocation_vdo_emulate_512_sectors_CFG, profile);
+	vtp->use_metadata_hints =
+		find_config_tree_int(cmd, allocation_vdo_use_metadata_hints_CFG, profile);
+	vtp->minimum_io_size =
+		find_config_tree_int(cmd, allocation_vdo_minimum_io_size_CFG, profile);
 	vtp->block_map_cache_size_mb =
 		find_config_tree_int64(cmd, allocation_vdo_block_map_cache_size_mb_CFG, profile);
-	vtp->block_map_period =
-		find_config_tree_int(cmd, allocation_vdo_block_map_period_CFG, profile);
+	vtp->block_map_era_length =
+		find_config_tree_int(cmd, allocation_vdo_block_map_era_length_CFG, profile);
 	vtp->check_point_frequency =
 		find_config_tree_int(cmd, allocation_vdo_check_point_frequency_CFG, profile);
 	vtp->use_sparse_index =
 		find_config_tree_int(cmd, allocation_vdo_use_sparse_index_CFG, profile);
 	vtp->index_memory_size_mb =
 		find_config_tree_int64(cmd, allocation_vdo_index_memory_size_mb_CFG, profile);
-	vtp->use_read_cache =
-		find_config_tree_int(cmd, allocation_vdo_use_read_cache_CFG, profile);
-	vtp->read_cache_size_mb =
-		find_config_tree_int64(cmd, allocation_vdo_read_cache_size_mb_CFG, profile);
 	vtp->slab_size_mb =
 		find_config_tree_int(cmd, allocation_vdo_slab_size_mb_CFG, profile);
 	vtp->ack_threads =
@@ -448,6 +446,8 @@ int fill_vdo_target_params(struct cmd_context *cmd,
 		find_config_tree_int(cmd, allocation_vdo_logical_threads_CFG, profile);
 	vtp->physical_threads =
 		find_config_tree_int(cmd, allocation_vdo_physical_threads_CFG, profile);
+	vtp->max_discard =
+		find_config_tree_int(cmd, allocation_vdo_max_discard_CFG, profile);
 
 	policy = find_config_tree_str(cmd, allocation_vdo_write_policy_CFG, profile);
 	if (!get_vdo_write_policy(&vtp->write_policy, policy))
lib/vdo/vdo.c +22 -22

104 lines not on this page · raw message