Skip to contentSkip to conversation

master - libdm: tunning cache API

PATCH Zdenek Kabelac 1 participant 1 message Nov 10, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=824019531cbba02c722cb0bf0957ac84eccef3b9
Commit:        824019531cbba02c722cb0bf0957ac84eccef3b9
Parent:        3dbcd2a1c9027c08faab726a1f1a24085046f0df
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Sat Nov 8 23:20:25 2014 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Mon Nov 10 22:05:48 2014 +0100

libdm: tunning cache API

Support new PASSTHROUGH 'feature' flag.

Add dm_config_node to pass in policy args.

Really use origin_uuid instead of using extra call to pass seg_areas.

Switch to 64bit feature flag bit set so there is
enough space in future for new bits...

---
 WHATS_NEW_DM              |    1 +
 lib/cache_segtype/cache.c |    9 +---
 libdm/libdevmapper.h      |   30 ++++++++++---
 libdm/libdm-deptree.c     |  103 +++++++++++++++++++++++----------------------
 4 files changed, 79 insertions(+), 64 deletions(-)
WHATS_NEW_DM +1 -0
index 0305077..f4148bc 100644
@@ -1,5 +1,6 @@
 Version 1.02.91 - 
 ====================================
+  Update API for cache creation and dm_config_node to pass policy.
   Allow activation of any thin-pool with passed transaction_id == 0.
   Don't print uninitialized stack bytes when non-root uses dm_check_version().
   Fix selection criteria to not match reserved values when using >, <, >=, <.
lib/cache_segtype/cache.c +3 -6
index e5512bf..ea480de 100644
@@ -332,16 +332,13 @@ static int _cache_add_target_line(struct dev_manager *dm,
 		return_0;
 
 	if (!dm_tree_node_add_cache_target(node, len,
+					   cache_pool_seg->feature_flags,
 					   metadata_uuid,
 					   data_uuid,
 					   origin_uuid,
-					   cache_pool_seg->chunk_size,
-					   cache_pool_seg->feature_flags,
-					   cache_pool_seg->core_argc,
-					   cache_pool_seg->core_argv,
+					   NULL,
 					   cache_pool_seg->policy_name,
-					   cache_pool_seg->policy_argc,
-					   cache_pool_seg->policy_argv))
+					   cache_pool_seg->chunk_size))
 		return_0;
 
 	return add_areas_line(dm, seg, node, 0u, seg->area_count);
libdm/libdevmapper.h +23 -7
index 76c4eee..62a5941 100644
@@ -320,7 +320,7 @@ struct dm_status_cache {
 	uint64_t demotions;
 	uint64_t promotions;
 
-	uint32_t feature_flags;
+	uint64_t feature_flags;
 
 	int core_argc;
 	char **core_argv;
@@ -774,19 +774,35 @@ int dm_tree_node_add_raid_target_with_params(struct dm_tree_node *node,
 /* Cache feature_flags */
 #define DM_CACHE_FEATURE_WRITEBACK    0x00000001
 #define DM_CACHE_FEATURE_WRITETHROUGH 0x00000002
+#define DM_CACHE_FEATURE_PASSTHROUGH  0x00000004
 
+struct dm_config_node;
+/*
+ * Use for passing cache policy and all its args e.g.:
+ *
+ *   mq {
+ *	migration_threshold=2048
+ *	sequention_threashold=100
+ *	...
+ *   }
+ *
+ * For policy without any parameters simply specify policy_name.
+ */
 int dm_tree_node_add_cache_target(struct dm_tree_node *node,
 				  uint64_t size,
+				  uint64_t feature_flags, /* DM_CACHE_FEATURE_* */
 				  const char *metadata_uuid,
 				  const char *data_uuid,
 				  const char *origin_uuid,
-				  uint32_t chunk_size,
-				  uint32_t feature_flags, /* DM_CACHE_FEATURE_* */
-				  unsigned core_argc,
-				  const char *const *core_argv,
+				  const struct dm_config_node *policy,
 				  const char *policy_name,
-				  unsigned policy_argc,
-				  const char *const *policy_argv);
+				  uint32_t chunk_size);
+
+/*
+ * TODO: Add individual cache policy pairs  <key> = value, like:
+ *int dm_tree_node_add_cache_policy_arg(struct dm_tree_node *dnode,
+ *				      const char *key, uint64_t value);
+ */
 
 /*
  * Replicator operation mode
libdm/libdm-deptree.c +52 -51

157 lines not on this page · raw message