mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
cache: allow to specify cachemetadataformat
OO_LVCREATE_CACHE accepts --cachemetadataformat. Support new option --cachemetadataformat auto|1|2 for caching. Word 'auto' can be also be given as '0'.
This commit is contained in:
parent
0a9b52f7a4
commit
7b748b7cb8
@ -102,6 +102,9 @@ arg(cache_long_ARG, '\0', "cache", 0, 0, 0,
|
||||
"#lvscan\n"
|
||||
"Scan the devices used by an LV and send the metadata to lvmetad.\n")
|
||||
|
||||
arg(cachemetadataformat_ARG, '\0', "cachemetadataformat", cachemetadataformat_VAL, 0, 0,
|
||||
"Specifies the cache metadata format used by cache target.\n")
|
||||
|
||||
arg(cachemode_ARG, '\0', "cachemode", cachemode_VAL, 0, 0,
|
||||
"Specifies when writes to a cache LV should be considered complete.\n"
|
||||
"\\fBwriteback\\fP considers a write complete as soon as it is\n"
|
||||
|
@ -311,7 +311,8 @@ OO_LVCONVERT_POOL: --poolmetadata LV, --poolmetadatasize SizeMB,
|
||||
--poolmetadataspare Bool, --readahead Readahead, --chunksize SizeKB,
|
||||
--zero Bool, --metadataprofile String
|
||||
|
||||
OO_LVCONVERT_CACHE: --cachemode CacheMode, --cachepolicy String,
|
||||
OO_LVCONVERT_CACHE: --cachemetadataformat CacheMetadataFormat,
|
||||
--cachemode CacheMode, --cachepolicy String,
|
||||
--cachesettings String, --zero Bool
|
||||
|
||||
OO_LVCONVERT: --alloc Alloc, --background, --force, --noudevsync
|
||||
@ -702,7 +703,7 @@ OO_LVCREATE: --addtag Tag, --alloc Alloc, --autobackup Bool, --activate Active,
|
||||
--zero Bool
|
||||
|
||||
OO_LVCREATE_CACHE: --cachemode CacheMode, --cachepolicy String, --cachesettings String,
|
||||
--chunksize SizeKB
|
||||
--chunksize SizeKB, --cachemetadataformat CacheMetadataFormat
|
||||
|
||||
OO_LVCREATE_POOL: --poolmetadatasize SizeMB, --poolmetadataspare Bool, --chunksize SizeKB
|
||||
|
||||
|
@ -70,6 +70,7 @@ struct arg_values;
|
||||
/* needed to include args.h */
|
||||
static inline int yes_no_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
||||
static inline int activation_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
||||
static inline int cachemetadataformat_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
||||
static inline int cachemode_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
||||
static inline int discards_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
||||
static inline int mirrorlog_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
||||
|
@ -421,6 +421,25 @@ int cachemode_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_va
|
||||
return 1;
|
||||
}
|
||||
|
||||
int cachemetadataformat_arg(struct cmd_context *cmd, struct arg_values *av)
|
||||
{
|
||||
if (!strcmp(av->value, "auto")) {
|
||||
av->i_value = CACHE_METADATA_FORMAT_UNSELECTED;
|
||||
av->ui_value = CACHE_METADATA_FORMAT_UNSELECTED;
|
||||
} else if (!int_arg(cmd, av))
|
||||
return_0;
|
||||
|
||||
switch (av->i_value) {
|
||||
case CACHE_METADATA_FORMAT_UNSELECTED:
|
||||
case CACHE_METADATA_FORMAT_1:
|
||||
case CACHE_METADATA_FORMAT_2:
|
||||
return 1;
|
||||
}
|
||||
|
||||
log_error("Selected cache metadata format %d is not supported.", av->i_value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int discards_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av)
|
||||
{
|
||||
thin_discards_t discards;
|
||||
|
@ -144,6 +144,7 @@ void usage(const char *name);
|
||||
/* the argument verify/normalise functions */
|
||||
int yes_no_arg(struct cmd_context *cmd, struct arg_values *av);
|
||||
int activation_arg(struct cmd_context *cmd, struct arg_values *av);
|
||||
int cachemetadataformat_arg(struct cmd_context *cmd, struct arg_values *av);
|
||||
int cachemode_arg(struct cmd_context *cmd, struct arg_values *av);
|
||||
int discards_arg(struct cmd_context *cmd, struct arg_values *av);
|
||||
int mirrorlog_arg(struct cmd_context *cmd, struct arg_values *av);
|
||||
|
@ -108,6 +108,7 @@ val(tag_VAL, tag_arg, "Tag", NULL)
|
||||
val(select_VAL, NULL, "Select", NULL) /* used only for command defs */
|
||||
val(activationmode_VAL, string_arg, "ActivationMode", "partial|degraded|complete")
|
||||
val(activation_VAL, activation_arg, "Active", "y|n|ay")
|
||||
val(cachemetadataformat_VAL, cachemetadataformat_arg, "CacheMetadataFormat", "auto|1|2")
|
||||
val(cachemode_VAL, cachemode_arg, "CacheMode", "writethrough|writeback|passthrough")
|
||||
val(discards_VAL, discards_arg, "Discards", "passdown|nopassdown|ignore")
|
||||
val(mirrorlog_VAL, mirrorlog_arg, "MirrorLog", "core|disk")
|
||||
|
Loading…
Reference in New Issue
Block a user