Skip to contentSkip to conversation

master - cache: Code changes to allow creation of cache pools

PATCH Jonathan Brassow 1 participant 1 message Feb 4, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=97be8b3482a0c566d5fa529321bd035526974c96
Commit:        97be8b3482a0c566d5fa529321bd035526974c96
Parent:        013cf27bff2d46f273505d6ee437085ad9cab5f2
Author:        Jonathan Brassow <[email protected]>
AuthorDate:    Tue Feb 4 11:57:08 2014 -0600
Committer:     Jonathan Brassow <[email protected]>
CommitterDate: Tue Feb 4 11:57:08 2014 -0600

cache: Code changes to allow creation of cache pools

This patch allows the creation and removal of cache pools. Users are not yet able to create cache LVs. They are only able to define the space used for the cache and its characteristics (chunk_size and cache mode ATM) by creating the cache pool.

---
 lib/config/defaults.h            |    2 +-
 lib/format_text/flags.c          |    4 ++
 lib/metadata/lv_manip.c          |   73 +++++++++++++++++++++++++-------------
 lib/metadata/merge.c             |   49 ++++++++++++++++++-------
 lib/metadata/metadata-exported.h |    2 +
 tools/args.h                     |    1 +
 tools/commands.h                 |    7 ++--
 tools/lvcreate.c                 |   42 ++++++++++++++++++++--
 8 files changed, 135 insertions(+), 45 deletions(-)
lib/config/defaults.h +1 -1
index 437cec7..6820def 100644
@@ -77,7 +77,7 @@
 #define DEFAULT_THIN_POOL_CHUNK_SIZE_PERFORMANCE 512 /* KB */
 #define DEFAULT_THIN_POOL_DISCARDS "passdown"
 #define DEFAULT_THIN_POOL_ZERO 1
-#define DEFAULT_POOL_METADATA_SPARE 1
+#define DEFAULT_POOL_METADATA_SPARE 1 /* thin + cache */
 
 #define DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
 #define DEFAULT_CACHE_POOL_CHUNK_SIZE 64 /* KB */
lib/format_text/flags.c +4 -0
index e31429e..bc48952 100644
@@ -83,6 +83,10 @@ static const struct flag _lv_flags[] = {
 	{THIN_POOL, NULL, 0},
 	{THIN_POOL_DATA, NULL, 0},
 	{THIN_POOL_METADATA, NULL, 0},
+	{CACHE, NULL, 0},
+	{CACHE_POOL, NULL, 0},
+	{CACHE_POOL_DATA, NULL, 0},
+	{CACHE_POOL_METADATA, NULL, 0},
 	{0, NULL, 0}
 };
 
lib/metadata/lv_manip.c +48 -25

165 lines not on this page · raw message

lib/metadata/merge.c +36 -13

67 lines not on this page · raw message

lib/metadata/metadata-exported.h +2 -0
index b37d91a..1e16c34 100644
@@ -794,6 +794,8 @@ struct lvcreate_params {
 	uint32_t min_recovery_rate; /* RAID */
 	uint32_t max_recovery_rate; /* RAID */
 
+	uint32_t feature_flags; /* cache */
+
 	const struct segment_type *segtype; /* all */
 	unsigned target_attr; /* all */
 
tools/args.h +1 -0
index 1207189..5f26511 100644
@@ -62,6 +62,7 @@ arg(monitor_ARG, '\0', "monitor", yes_no_arg, 0)
 arg(config_ARG, '\0', "config", string_arg, 0)
 arg(trustcache_ARG, '\0', "trustcache", NULL, 0)
 arg(cache_ARG, '\0', "cache", NULL, 0)
+arg(cachemode_ARG, '\0', "cachemode", string_arg, 0)
 arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0)
 arg(nameprefixes_ARG, '\0', "nameprefixes", NULL, 0)
 arg(unquoted_ARG, '\0', "unquoted", NULL, 0)
tools/commands.h +4 -3
index b4ae6de..dce5929 100644
@@ -230,6 +230,7 @@ xx(lvcreate,
    "\t[-a|--activate [a|e|l]{y|n}]\n"
    "\t[--addtag Tag]\n"
    "\t[--alloc AllocationPolicy]\n"
+   "\t[--cachemode CacheMode]\n"
    "\t[-C|--contiguous {y|n}]\n"
    "\t[-d|--debug]\n"
    "\t[-h|-?|--help]\n"
@@ -296,9 +297,9 @@ xx(lvcreate,
    "\t[PhysicalVolumePath...]\n\n",
 
    addtag_ARG, alloc_ARG, autobackup_ARG, activate_ARG, available_ARG,
-   chunksize_ARG, contiguous_ARG, corelog_ARG, discards_ARG, extents_ARG,
-   ignoreactivationskip_ARG, ignoremonitoring_ARG, major_ARG, minor_ARG,
-   mirrorlog_ARG, mirrors_ARG, monitor_ARG, minrecoveryrate_ARG,
+   cachemode_ARG, chunksize_ARG, contiguous_ARG, corelog_ARG, discards_ARG,
+   extents_ARG, ignoreactivationskip_ARG, ignoremonitoring_ARG, major_ARG,
+   minor_ARG, mirrorlog_ARG, mirrors_ARG, monitor_ARG, minrecoveryrate_ARG,
    maxrecoveryrate_ARG, name_ARG, nosync_ARG, noudevsync_ARG,
    permission_ARG, persistent_ARG, poolmetadatasize_ARG, poolmetadataspare_ARG,
    raidminrecoveryrate_ARG, raidmaxrecoveryrate_ARG, readahead_ARG,
tools/lvcreate.c +39 -3

65 lines not on this page · raw message