master - cleanup: use matching flags for permissions
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9a6758e953a83a...
Commit: 9a6758e953a83aeb1d384df97c6f18b542c569a2
Parent: 37bd12e7ba60e5e6654d7edd912d011328401a21
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 24 13:07:02 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 24 16:39:31 2014 +0200
cleanup: use matching flags for permissions
Since our status bits are 64b - use uint64_t for permissions.
---
lib/metadata/metadata-exported.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 1af9cbf..cfc0ce2 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -856,7 +856,7 @@ struct lvcreate_params {
uint64_t pool_metadata_size; /* pools */
struct dm_list *pvh; /* all */
- uint32_t permission; /* all */
+ uint64_t permission; /* all */
uint32_t read_ahead; /* all */
int approx_alloc; /* all */
alloc_policy_t alloc; /* all */
8 years, 7 months
master - cleanup: lv_manip drops duplicated internal error
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=37bd12e7ba60e5...
Commit: 37bd12e7ba60e5e6654d7edd912d011328401a21
Parent: 958cae8fd8e03a1b3d060c07d49953bbdc419b9c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 23 12:40:15 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 24 16:39:31 2014 +0200
cleanup: lv_manip drops duplicated internal error
No reason to check the same condition twice with internal error.
---
lib/metadata/lv_manip.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 54fc6a8..fe0eead 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3717,11 +3717,6 @@ int lv_extend(struct logical_volume *lv,
new_extents -= ah->log_len * ah->area_multiple;
if (segtype_is_thin_pool(segtype) || segtype_is_cache_pool(segtype)) {
- if (lv->le_count) {
- /* lv_resize abstracts properly _tdata */
- log_error(INTERNAL_ERROR "Cannot lv_extend() the existing %s segment.", segtype->name);
- return 0;
- }
if (!(r = create_pool(lv, segtype, ah, stripes, stripe_size)))
stack;
} else if (!segtype_is_mirrored(segtype) && !segtype_is_raid(segtype)) {
8 years, 7 months
master - cleanup: use arg_is_set
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=958cae8fd8e03a...
Commit: 958cae8fd8e03a1b3d060c07d49953bbdc419b9c
Parent: f2ea8904239752df231023a4a3aad704ed8edc73
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 21 12:03:07 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 24 16:39:31 2014 +0200
cleanup: use arg_is_set
---
tools/lvcreate.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 8b3255c..7ccd9aa 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -790,13 +790,13 @@ static int _read_activation_params(struct lvcreate_params *lp,
return 0;
}
- if (arg_count(cmd, setactivationskip_ARG)) {
+ if (arg_is_set(cmd, setactivationskip_ARG)) {
lp->activation_skip |= ACTIVATION_SKIP_SET;
if (arg_int_value(cmd, setactivationskip_ARG, 0))
lp->activation_skip |= ACTIVATION_SKIP_SET_ENABLED;
}
- if (arg_count(cmd, ignoreactivationskip_ARG))
+ if (arg_is_set(cmd, ignoreactivationskip_ARG))
lp->activation_skip |= ACTIVATION_SKIP_IGNORE;
if (lp->zero && (lp->activation_skip & ACTIVATION_SKIP_SET_ENABLED)
8 years, 7 months
master - cleanup: don't backup twice
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f2ea8904239752...
Commit: f2ea8904239752df231023a4a3aad704ed8edc73
Parent: a4788b4994f4cbd5bccd411683704b2badf026d7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Oct 20 21:49:07 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 24 16:39:31 2014 +0200
cleanup: don't backup twice
---
lib/metadata/lv_manip.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index df696e9..54fc6a8 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -7052,8 +7052,9 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
stack;
goto revert_new_lv;
}
-
- backup(vg);
+ /* When change is activating, don't duplicate backup call */
+ if (!is_change_activating(lp->activate))
+ backup(vg);
}
if (is_change_activating(lp->activate)) {
/* Send message so that table preload knows new thin */
8 years, 7 months
master - cleanup: move code for checking vg features
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a4788b4994f4cb...
Commit: a4788b4994f4cbd5bccd411683704b2badf026d7
Parent: b726003b859a5e2f7580855c10fe201f67e1dc06
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Oct 21 11:23:33 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 24 16:39:31 2014 +0200
cleanup: move code for checking vg features
Move code that checks for needed VG features into separate
smaller function.
---
lib/metadata/lv_manip.c | 89 ++++++++++++++++++++++++++---------------------
1 files changed, 49 insertions(+), 40 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 3d6bb26..df696e9 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6549,6 +6549,53 @@ static int _should_wipe_lv(struct lvcreate_params *lp,
return 0;
}
+/* Check if VG metadata supports needed features */
+static int _vg_check_features(struct volume_group *vg,
+ struct lvcreate_params *lp)
+{
+ uint32_t features = vg->fid->fmt->features;
+
+ if (vg_max_lv_reached(vg)) {
+ log_error("Maximum number of logical volumes (%u) reached "
+ "in volume group %s", vg->max_lv, vg->name);
+ return 0;
+ }
+
+ if (!(features & FMT_SEGMENTS) &&
+ (seg_is_cache(lp) ||
+ seg_is_cache_pool(lp) ||
+ seg_is_mirrored(lp) ||
+ seg_is_raid(lp) ||
+ seg_is_thin(lp))) {
+ log_error("Metadata does not support %s segments.",
+ lp->segtype->name);
+ return 0;
+ }
+
+ if (!(features & FMT_TAGS) && !dm_list_empty(&lp->tags)) {
+ log_error("Volume group %s does not support tags.", vg->name);
+ return 0;
+ }
+
+ if ((features & FMT_RESTRICTED_READAHEAD) &&
+ lp->read_ahead != DM_READ_AHEAD_AUTO &&
+ lp->read_ahead != DM_READ_AHEAD_NONE &&
+ (lp->read_ahead < 2 || lp->read_ahead > 120)) {
+ log_error("Metadata only supports readahead values between 2 and 120.");
+ return 0;
+ }
+
+ /* Need to check the vg's format to verify this - the cmd format isn't setup properly yet */
+ if (!(features & FMT_UNLIMITED_STRIPESIZE) &&
+ (lp->stripes > 1) && (lp->stripe_size > STRIPE_SIZE_MAX)) {
+ log_error("Stripe size may not exceed %s.",
+ display_size(vg->cmd, (uint64_t) STRIPE_SIZE_MAX));
+ return 0;
+ }
+
+ return 1;
+}
+
/* Thin notes:
* If lp->thin OR lp->activate is AY*, activate the pool if not already active.
* If lp->thin, create thin LV within the pool - as a snapshot if lp->snapshot.
@@ -6573,29 +6620,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
return NULL;
}
- if (vg_max_lv_reached(vg)) {
- log_error("Maximum number of logical volumes (%u) reached "
- "in volume group %s", vg->max_lv, vg->name);
- return NULL;
- }
-
- if (!(vg->fid->fmt->features & FMT_SEGMENTS) &&
- (segtype_is_mirrored(lp->segtype) ||
- segtype_is_raid(lp->segtype) ||
- segtype_is_thin(lp->segtype) ||
- segtype_is_cache(lp->segtype))) {
- log_error("Metadata does not support %s segments.",
- lp->segtype->name);
- return NULL;
- }
-
- if (lp->read_ahead != DM_READ_AHEAD_AUTO &&
- lp->read_ahead != DM_READ_AHEAD_NONE &&
- (vg->fid->fmt->features & FMT_RESTRICTED_READAHEAD) &&
- (lp->read_ahead < 2 || lp->read_ahead > 120)) {
- log_error("Metadata only supports readahead values between 2 and 120.");
- return NULL;
- }
+ if (!_vg_check_features(vg, lp))
+ return_NULL;
if (!activation()) {
if (seg_is_cache(lp) ||
@@ -6644,15 +6670,6 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
lp->stripe_size = vg->extent_size;
}
- /* Need to check the vg's format to verify this - the cmd format isn't setup properly yet */
- if (lp->stripes > 1 &&
- !(vg->fid->fmt->features & FMT_UNLIMITED_STRIPESIZE) &&
- (lp->stripe_size > STRIPE_SIZE_MAX)) {
- log_error("Stripe size may not exceed %s",
- display_size(cmd, (uint64_t) STRIPE_SIZE_MAX));
- return NULL;
- }
-
if ((size_rest = lp->extents % lp->stripes)) {
log_print_unless_silent("Rounding size (%d extents) up to stripe boundary "
"size (%d extents).", lp->extents,
@@ -6798,14 +6815,6 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
!(lp->segtype = get_segtype_from_string(cmd, "striped")))
return_NULL;
- if (!dm_list_empty(&lp->tags)) {
- if (!(vg->fid->fmt->features & FMT_TAGS)) {
- log_error("Volume group %s does not support tags",
- vg->name);
- return NULL;
- }
- }
-
if (!archive(vg))
return_NULL;
8 years, 7 months
master - cleanup: simplier lv name construction
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b726003b859a5e...
Commit: b726003b859a5e2f7580855c10fe201f67e1dc06
Parent: 9e85dbbfd0d965215a9fce55c29cfb967d0d6103
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 24 14:22:13 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 24 16:39:31 2014 +0200
cleanup: simplier lv name construction
Using NAME_LEN max lv name size.
---
lib/metadata/lv_manip.c | 24 ++++++------------------
1 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 244db1b..3d6bb26 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6053,8 +6053,7 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
{
static const char _suffixes[][8] = { "_tdata", "_cdata", "_corig" };
int r;
- char *name;
- size_t len;
+ char name[NAME_LEN];
struct dm_str_list *sl;
struct logical_volume *layer_lv;
struct segment_type *segtype;
@@ -6063,16 +6062,8 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
unsigned exclusive = 0;
/* create an empty layer LV */
- len = strlen(lv_where->name) + 32;
- if (!(name = alloca(len))) {
- log_error("layer name allocation failed. "
- "Remove new LV and retry.");
- return NULL;
- }
-
- if (dm_snprintf(name, len, "%s%s", lv_where->name, layer_suffix) < 0) {
- log_error("layer name allocation failed. "
- "Remove new LV and retry.");
+ if (dm_snprintf(name, sizeof(name), "%s%s", lv_where->name, layer_suffix) < 0) {
+ log_error("Layered name is too long. Please use shorter LV name.");
return NULL;
}
@@ -6453,8 +6444,7 @@ static struct logical_volume *_create_virtual_origin(struct cmd_context *cmd,
uint64_t voriginextents)
{
const struct segment_type *segtype;
- size_t len;
- char *vorigin_name;
+ char vorigin_name[NAME_LEN];
struct logical_volume *lv;
if (!(segtype = get_segtype_from_string(cmd, "zero"))) {
@@ -6462,10 +6452,8 @@ static struct logical_volume *_create_virtual_origin(struct cmd_context *cmd,
return NULL;
}
- len = strlen(lv_name) + 32;
- if (!(vorigin_name = alloca(len)) ||
- dm_snprintf(vorigin_name, len, "%s_vorigin", lv_name) < 0) {
- log_error("Virtual origin name allocation failed.");
+ if (dm_snprintf(vorigin_name, sizeof(vorigin_name), "%s_vorigin", lv_name) < 0) {
+ log_error("Virtual origin name is too long.");
return NULL;
}
8 years, 7 months
master - cleanup: sort args alphabetically
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9e85dbbfd0d965...
Commit: 9e85dbbfd0d965215a9fce55c29cfb967d0d6103
Parent: cf674142a2c1504d5652a5dd5479041272fd34ec
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Oct 19 13:00:48 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 24 16:39:31 2014 +0200
cleanup: sort args alphabetically
Give it some order for easier human lookup for options we do support.
---
tools/args.h | 179 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 89 insertions(+), 90 deletions(-)
diff --git a/tools/args.h b/tools/args.h
index 531148c..492eb28 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2013 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -17,109 +17,108 @@
* Put all long args that don't have a corresponding short option first.
*/
/* *INDENT-OFF* */
-arg(version_ARG, '\0', "version", NULL, 0)
-arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_mb_arg, 0)
-arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0)
-arg(nolocking_ARG, '\0', "nolocking", NULL, 0)
-arg(pvmetadatacopies_ARG, '\0', "pvmetadatacopies", int_arg, 0)
-arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_arg, 0)
-arg(metadatacopies_ARG, '\0', "metadatacopies", metadatacopies_arg, 0)
-arg(metadatasize_ARG, '\0', "metadatasize", size_mb_arg, 0)
-arg(metadataignore_ARG, '\0', "metadataignore", yes_no_arg, 0)
-arg(bootloaderareasize_ARG, '\0', "bootloaderareasize", size_mb_arg, 0)
-arg(norestorefile_ARG, '\0', "norestorefile", NULL, 0)
-arg(restorefile_ARG, '\0', "restorefile", string_arg, 0)
-arg(labelsector_ARG, '\0', "labelsector", int_arg, 0)
-arg(driverloaded_ARG, '\0', "driverloaded", yes_no_arg, 0)
-arg(aligned_ARG, '\0', "aligned", NULL, 0)
-arg(binary_ARG, '\0', "binary", NULL, 0)
-arg(unbuffered_ARG, '\0', "unbuffered", NULL, 0)
-arg(noheadings_ARG, '\0', "noheadings", NULL, 0)
-arg(segments_ARG, '\0', "segments", NULL, 0)
-arg(units_ARG, '\0', "units", string_arg, 0)
-arg(nosuffix_ARG, '\0', "nosuffix", NULL, 0)
-arg(removemissing_ARG, '\0', "removemissing", NULL, 0)
-arg(restoremissing_ARG, '\0', "restoremissing", NULL, 0)
arg(abort_ARG, '\0', "abort", NULL, 0)
+arg(activationmode_ARG, '\0', "activationmode", string_arg, 0)
arg(addtag_ARG, '\0', "addtag", tag_arg, ARG_GROUPABLE)
-arg(deltag_ARG, '\0', "deltag", tag_arg, ARG_GROUPABLE)
-arg(refresh_ARG, '\0', "refresh", NULL, 0)
-arg(mknodes_ARG, '\0', "mknodes", NULL, 0)
-arg(minor_ARG, '\0', "minor", int_arg, ARG_GROUPABLE)
-arg(type_ARG, '\0', "type", segtype_arg, 0)
+arg(aligned_ARG, '\0', "aligned", NULL, 0)
arg(alloc_ARG, '\0', "alloc", alloc_arg, 0)
-arg(separator_ARG, '\0', "separator", string_arg, 0)
-arg(mirrorsonly_ARG, '\0', "mirrorsonly", NULL, 0)
-arg(nosync_ARG, '\0', "nosync", NULL, 0)
-arg(resync_ARG, '\0', "resync", NULL, 0)
-arg(corelog_ARG, '\0', "corelog", NULL, 0)
-arg(mirrorlog_ARG, '\0', "mirrorlog", string_arg, 0)
-arg(splitmirrors_ARG, '\0', "splitmirrors", int_arg, 0)
-arg(trackchanges_ARG, '\0', "trackchanges", NULL, 0)
-arg(replace_ARG, '\0', "replace", string_arg, ARG_GROUPABLE)
-arg(repair_ARG, '\0', "repair", NULL, 0)
-arg(use_policies_ARG, '\0', "use-policies", NULL, 0)
-arg(merge_ARG, '\0', "merge", NULL, 0)
-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(atomic_ARG, '\0', "atomic", NULL, 0)
+arg(atversion_ARG, '\0', "atversion", string_arg, 0)
+arg(binary_ARG, '\0', "binary", NULL, 0)
+arg(bootloaderareasize_ARG, '\0', "bootloaderareasize", size_mb_arg, 0)
arg(cache_long_ARG, '\0', "cache", NULL, 0)
arg(cachemode_ARG, '\0', "cachemode", string_arg, 0)
arg(cachepool_ARG, '\0', "cachepool", string_arg, 0)
-arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0)
-arg(nameprefixes_ARG, '\0', "nameprefixes", NULL, 0)
-arg(unquoted_ARG, '\0', "unquoted", NULL, 0)
-arg(rows_ARG, '\0', "rows", NULL, 0)
+arg(commandprofile_ARG, '\0', "commandprofile", string_arg, 0)
+arg(config_ARG, '\0', "config", string_arg, 0)
+arg(configtype_ARG, '\0', "type", string_arg, 0)
+arg(corelog_ARG, '\0', "corelog", NULL, 0)
arg(dataalignment_ARG, '\0', "dataalignment", size_kb_arg, 0)
arg(dataalignmentoffset_ARG, '\0', "dataalignmentoffset", size_kb_arg, 0)
-arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", size_mb_arg, 0)
+arg(deltag_ARG, '\0', "deltag", tag_arg, ARG_GROUPABLE)
+arg(detachprofile_ARG, '\0', "detachprofile", NULL, 0)
+arg(discards_ARG, '\0', "discards", discards_arg, 0)
+arg(driverloaded_ARG, '\0', "driverloaded", yes_no_arg, 0)
+arg(force_long_ARG, '\0', "force", NULL, ARG_COUNTABLE)
+arg(ignoreadvanced_ARG, '\0', "ignoreadvanced", NULL, 0)
+arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0)
+arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0)
+arg(ignoreskippedcluster_ARG, '\0', "ignoreskippedcluster", NULL, 0)
+arg(ignoreunsupported_ARG, '\0', "ignoreunsupported", NULL, 0)
+arg(labelsector_ARG, '\0', "labelsector", int_arg, 0)
+arg(maxrecoveryrate_ARG, '\0', "maxrecoveryrate", size_kb_arg, 0)
+arg(merge_ARG, '\0', "merge", NULL, 0)
+arg(mergedconfig_ARG, '\0', "mergedconfig", NULL, 0)
+arg(metadatacopies_ARG, '\0', "metadatacopies", metadatacopies_arg, 0)
+arg(metadataignore_ARG, '\0', "metadataignore", yes_no_arg, 0)
+arg(metadataprofile_ARG, '\0', "metadataprofile", string_arg, 0)
+arg(metadatasize_ARG, '\0', "metadatasize", size_mb_arg, 0)
+arg(minor_ARG, '\0', "minor", int_arg, ARG_GROUPABLE)
+arg(minrecoveryrate_ARG, '\0', "minrecoveryrate", size_kb_arg, 0)
+arg(mirrorlog_ARG, '\0', "mirrorlog", string_arg, 0)
+arg(mirrorsonly_ARG, '\0', "mirrorsonly", NULL, 0)
+arg(mknodes_ARG, '\0', "mknodes", NULL, 0)
+arg(monitor_ARG, '\0', "monitor", yes_no_arg, 0)
+arg(nameprefixes_ARG, '\0', "nameprefixes", NULL, 0)
+arg(noheadings_ARG, '\0', "noheadings", NULL, 0)
+arg(nolocking_ARG, '\0', "nolocking", NULL, 0)
+arg(norestorefile_ARG, '\0', "norestorefile", NULL, 0)
+arg(nosuffix_ARG, '\0', "nosuffix", NULL, 0)
+arg(nosync_ARG, '\0', "nosync", NULL, 0)
arg(noudevsync_ARG, '\0', "noudevsync", NULL, 0)
arg(originname_ARG, '\0', "originname", string_arg, 0)
+arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_mb_arg, 0)
arg(poll_ARG, '\0', "poll", yes_no_arg, 0)
arg(poolmetadata_ARG, '\0', "poolmetadata", string_arg, 0)
arg(poolmetadatasize_ARG, '\0', "poolmetadatasize", size_mb_arg, 0)
arg(poolmetadataspare_ARG, '\0', "poolmetadataspare", yes_no_arg, 0)
-arg(discards_ARG, '\0', "discards", discards_arg, 0)
-arg(force_long_ARG, '\0', "force", NULL, ARG_COUNTABLE)
+arg(profile_ARG, '\0', "profile", string_arg, 0)
+arg(pvmetadatacopies_ARG, '\0', "pvmetadatacopies", int_arg, 0)
+arg(raidmaxrecoveryrate_ARG, '\0', "raidmaxrecoveryrate", size_kb_arg, 0)
+arg(raidminrecoveryrate_ARG, '\0', "raidminrecoveryrate", size_kb_arg, 0)
+arg(raidsyncaction_ARG, '\0', "raidsyncaction", string_arg, 0)
+arg(raidwritebehind_ARG, '\0', "raidwritebehind", int_arg, 0)
+arg(raidwritemostly_ARG, '\0', "raidwritemostly", string_arg, ARG_GROUPABLE)
+arg(readonly_ARG, '\0', "readonly", NULL, 0)
+arg(refresh_ARG, '\0', "refresh", NULL, 0)
+arg(removemissing_ARG, '\0', "removemissing", NULL, 0)
+arg(repair_ARG, '\0', "repair", NULL, 0)
+arg(replace_ARG, '\0', "replace", string_arg, ARG_GROUPABLE)
+arg(restorefile_ARG, '\0', "restorefile", string_arg, 0)
+arg(restoremissing_ARG, '\0', "restoremissing", NULL, 0)
+arg(resync_ARG, '\0', "resync", NULL, 0)
+arg(rows_ARG, '\0', "rows", NULL, 0)
+arg(segments_ARG, '\0', "segments", NULL, 0)
+arg(separator_ARG, '\0', "separator", string_arg, 0)
+arg(split_ARG, '\0', "split", NULL, 0)
+arg(splitcache_ARG, '\0', "splitcache", NULL, 0)
+arg(splitmirrors_ARG, '\0', "splitmirrors", int_arg, 0)
+arg(splitsnapshot_ARG, '\0', "splitsnapshot", NULL, 0)
arg(stripes_long_ARG, '\0', "stripes", int_arg, 0)
+arg(syncaction_ARG, '\0', "syncaction", string_arg, 0) /* FIXME Use custom validation fn */
arg(sysinit_ARG, '\0', "sysinit", NULL, 0)
arg(thinpool_ARG, '\0', "thinpool", string_arg, 0)
-arg(configtype_ARG, '\0', "type", string_arg, 0)
+arg(trackchanges_ARG, '\0', "trackchanges", NULL, 0)
+arg(trustcache_ARG, '\0', "trustcache", NULL, 0)
+arg(type_ARG, '\0', "type", segtype_arg, 0)
+arg(unbuffered_ARG, '\0', "unbuffered", NULL, 0)
+arg(uncache_ARG, '\0', "uncache", NULL, 0)
+arg(units_ARG, '\0', "units", string_arg, 0)
+arg(unquoted_ARG, '\0', "unquoted", NULL, 0)
+arg(use_policies_ARG, '\0', "use-policies", NULL, 0)
+arg(validate_ARG, '\0', "validate", NULL, 0)
+arg(version_ARG, '\0', "version", NULL, 0)
+arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_arg, 0)
+arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", size_mb_arg, 0)
arg(withcomments_ARG, '\0', "withcomments", NULL, 0)
arg(withversions_ARG, '\0', "withversions", NULL, 0)
-arg(ignoreadvanced_ARG, '\0', "ignoreadvanced", NULL, 0)
-arg(ignoreunsupported_ARG, '\0', "ignoreunsupported", NULL, 0)
-arg(atversion_ARG, '\0', "atversion", string_arg, 0)
-arg(validate_ARG, '\0', "validate", NULL, 0)
-arg(syncaction_ARG, '\0', "syncaction", string_arg, 0) /* FIXME Use custom validation fn */
-arg(raidsyncaction_ARG, '\0', "raidsyncaction", string_arg, 0)
-arg(writemostly_ARG, '\0', "writemostly", string_arg, ARG_GROUPABLE)
-arg(raidwritemostly_ARG, '\0', "raidwritemostly", string_arg, ARG_GROUPABLE)
arg(writebehind_ARG, '\0', "writebehind", int_arg, 0)
-arg(raidwritebehind_ARG, '\0', "raidwritebehind", int_arg, 0)
-arg(minrecoveryrate_ARG, '\0', "minrecoveryrate", size_kb_arg, 0)
-arg(raidminrecoveryrate_ARG, '\0', "raidminrecoveryrate", size_kb_arg, 0)
-arg(maxrecoveryrate_ARG, '\0', "maxrecoveryrate", size_kb_arg, 0)
-arg(raidmaxrecoveryrate_ARG, '\0', "raidmaxrecoveryrate", size_kb_arg, 0)
-arg(commandprofile_ARG, '\0', "commandprofile", string_arg, 0)
-arg(metadataprofile_ARG, '\0', "metadataprofile", string_arg, 0)
-arg(profile_ARG, '\0', "profile", string_arg, 0)
-arg(detachprofile_ARG, '\0', "detachprofile", NULL, 0)
-arg(mergedconfig_ARG, '\0', "mergedconfig", NULL, 0)
-arg(ignoreskippedcluster_ARG, '\0', "ignoreskippedcluster", NULL, 0)
-arg(splitsnapshot_ARG, '\0', "splitsnapshot", NULL, 0)
-arg(splitcache_ARG, '\0', "splitcache", NULL, 0)
-arg(uncache_ARG, '\0', "uncache", NULL, 0)
-arg(split_ARG, '\0', "split", NULL, 0)
-arg(readonly_ARG, '\0', "readonly", NULL, 0)
-arg(atomic_ARG, '\0', "atomic", NULL, 0)
-arg(activationmode_ARG, '\0', "activationmode", string_arg, 0)
-
+arg(writemostly_ARG, '\0', "writemostly", string_arg, ARG_GROUPABLE)
/* Allow some variations */
-arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)
arg(allocation_ARG, '\0', "allocation", yes_no_arg, 0)
arg(available_ARG, '\0', "available", activation_arg, 0)
+arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)
/*
* ... and now the short args.
@@ -145,32 +144,32 @@ arg(full_ARG, 'f', "full", NULL, 0)
arg(help_ARG, 'h', "help", NULL, 0)
arg(cache_ARG, 'H', "cache", NULL, 0)
arg(help2_ARG, '?', "", NULL, 0)
-arg(stripesize_ARG, 'I', "stripesize", size_kb_arg, 0)
-arg(stripes_ARG, 'i', "stripes", int_arg, 0)
arg(interval_ARG, 'i', "interval", int_arg, 0)
arg(iop_version_ARG, 'i', "iop_version", NULL, 0)
+arg(stripes_ARG, 'i', "stripes", int_arg, 0)
+arg(stripesize_ARG, 'I', "stripesize", size_kb_arg, 0)
arg(logicalvolume_ARG, 'l', "logicalvolume", int_arg, 0)
arg(maxlogicalvolumes_ARG, 'l', "maxlogicalvolumes", int_arg, 0)
arg(extents_ARG, 'l', "extents", int_arg_with_sign_and_percent, 0)
-arg(lvmpartition_ARG, 'l', "lvmpartition", NULL, 0)
arg(list_ARG, 'l', "list", NULL, 0)
-arg(size_ARG, 'L', "size", size_mb_arg, 0)
+arg(lvmpartition_ARG, 'l', "lvmpartition", NULL, 0)
arg(logicalextent_ARG, 'L', "logicalextent", int_arg_with_sign, 0)
+arg(size_ARG, 'L', "size", size_mb_arg, 0)
arg(persistent_ARG, 'M', "persistent", yes_no_arg, 0)
arg(major_ARG, 'j', "major", int_arg, ARG_GROUPABLE)
arg(setactivationskip_ARG, 'k', "setactivationskip", yes_no_arg, 0)
arg(ignoreactivationskip_ARG, 'K', "ignoreactivationskip", NULL, 0)
+arg(maps_ARG, 'm', "maps", NULL, 0)
arg(mirrors_ARG, 'm', "mirrors", int_arg_with_sign, 0)
arg(metadatatype_ARG, 'M', "metadatatype", metadatatype_arg, 0)
-arg(maps_ARG, 'm', "maps", NULL, 0)
arg(name_ARG, 'n', "name", string_arg, 0)
-arg(oldpath_ARG, 'n', "oldpath", NULL, 0)
arg(nofsck_ARG, 'n', "nofsck", NULL, 0)
arg(novolumegroup_ARG, 'n', "novolumegroup", NULL, 0)
+arg(oldpath_ARG, 'n', "oldpath", NULL, 0)
arg(options_ARG, 'o', "options", string_arg, 0)
arg(sort_ARG, 'O', "sort", string_arg, 0)
-arg(permission_ARG, 'p', "permission", permission_arg, 0)
arg(maxphysicalvolumes_ARG, 'p', "maxphysicalvolumes", int_arg, 0)
+arg(permission_ARG, 'p', "permission", permission_arg, 0)
arg(partial_ARG, 'P', "partial", NULL, 0)
arg(physicalvolume_ARG, 'P', "physicalvolume", NULL, 0)
arg(quiet_ARG, 'q', "quiet", NULL, ARG_COUNTABLE)
@@ -179,12 +178,12 @@ arg(resizefs_ARG, 'r', "resizefs", NULL, 0)
arg(reset_ARG, 'R', "reset", NULL, 0)
arg(regionsize_ARG, 'R', "regionsize", size_mb_arg, 0)
arg(physicalextentsize_ARG, 's', "physicalextentsize", size_mb_arg, 0)
-arg(stdin_ARG, 's', "stdin", NULL, 0)
arg(snapshot_ARG, 's', "snapshot", NULL, 0)
arg(short_ARG, 's', "short", NULL, 0)
+arg(stdin_ARG, 's', "stdin", NULL, 0)
arg(select_ARG, 'S', "select", string_arg, 0)
-arg(thin_ARG, 'T', "thin", NULL, 0)
arg(test_ARG, 't', "test", NULL, 0)
+arg(thin_ARG, 'T', "thin", NULL, 0)
arg(uuid_ARG, 'u', "uuid", NULL, 0)
arg(uuidstr_ARG, 'u', "uuid", string_arg, 0)
arg(uuidlist_ARG, 'U', "uuidlist", NULL, 0)
8 years, 7 months
master - cleanup: move code
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cf674142a2c150...
Commit: cf674142a2c1504d5652a5dd5479041272fd34ec
Parent: 4f8ed25a999821cd37cc1e2c0051e60e8a63e371
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Oct 18 11:01:34 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 24 16:39:31 2014 +0200
cleanup: move code
---
lib/metadata/lv_manip.c | 10 ++++------
tools/lvcreate.c | 5 ++---
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index ec09b41..244db1b 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6573,7 +6573,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
{
struct cmd_context *cmd = vg->cmd;
uint32_t size_rest;
- uint64_t status = UINT64_C(0);
+ uint64_t status = lp->permission | VISIBLE_LV;
struct logical_volume *lv, *origin_lv = NULL;
struct logical_volume *pool_lv;
struct logical_volume *tmp_lv;
@@ -6672,8 +6672,6 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
lp->extents = lp->extents - size_rest + lp->stripes;
}
- status |= lp->permission | VISIBLE_LV;
-
if (seg_is_cache(lp)) {
if (!lp->pool_name) {
log_error(INTERNAL_ERROR "Cannot create thin volume without thin pool.");
@@ -6900,6 +6898,9 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
if (!recalculate_pool_chunk_size_with_dev_hints(lv, lp->passed_args,
THIN_CHUNK_SIZE_CALC_METHOD_GENERIC))
return_NULL;
+ } else if (seg_is_raid(lp)) {
+ first_seg(lv)->min_recovery_rate = lp->min_recovery_rate;
+ first_seg(lv)->max_recovery_rate = lp->max_recovery_rate;
} else if (seg_is_thin_pool(lp)) {
first_seg(lv)->chunk_size = lp->chunk_size;
first_seg(lv)->zero_new_blocks = lp->zero ? 1 : 0;
@@ -6936,9 +6937,6 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
if (!attach_pool_message(first_seg(pool_lv),
DM_THIN_MESSAGE_CREATE_THIN, lv, 0, 0))
return_NULL;
- } else if (seg_is_raid(lp)) {
- first_seg(lv)->min_recovery_rate = lp->min_recovery_rate;
- first_seg(lv)->max_recovery_rate = lp->max_recovery_rate;
}
/* FIXME Log allocation and attachment should have happened inside lv_extend. */
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 7573a2e..8b3255c 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -806,9 +806,6 @@ static int _read_activation_params(struct lvcreate_params *lp,
return 0;
}
- lp->yes = arg_count(cmd, yes_ARG);
- lp->force = (force_t) arg_count(cmd, force_ARG);
-
return 1;
}
@@ -825,6 +822,8 @@ static int _lvcreate_params(struct lvcreate_params *lp,
memset(lcp, 0, sizeof(*lcp));
dm_list_init(&lp->tags);
lp->target_attr = ~0;
+ lp->yes = arg_count(cmd, yes_ARG);
+ lp->force = (force_t) arg_count(cmd, force_ARG);
/* Set default segtype - remember, '-m 0' implies stripe. */
if (arg_count(cmd, mirrors_ARG) &&
8 years, 7 months
master - cleanup: indent
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4f8ed25a999821...
Commit: 4f8ed25a999821cd37cc1e2c0051e60e8a63e371
Parent: c6456bd6390f6d99dd975f671c5730b0438c4c89
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Oct 18 11:01:29 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 24 16:39:31 2014 +0200
cleanup: indent
Various indents and tiny error message improvements.
---
lib/metadata/lv_manip.c | 45 ++++++++++++++++---------------------
lib/metadata/metadata-exported.h | 4 +-
lib/metadata/pool_manip.c | 2 +-
tools/lvcreate.c | 30 +++++++++----------------
4 files changed, 34 insertions(+), 47 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 6240f14..ec09b41 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6032,7 +6032,8 @@ int remove_layer_from_lv(struct logical_volume *lv,
return_0;
/* Replace the empty layer with error segment */
- segtype = get_segtype_from_string(lv->vg->cmd, "error");
+ if (!(segtype = get_segtype_from_string(lv->vg->cmd, "error")))
+ return_0;
if (!lv_add_virtual_segment(layer_lv, 0, parent->le_count, segtype, NULL))
return_0;
@@ -6050,7 +6051,7 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
uint64_t status,
const char *layer_suffix)
{
- static char _suffixes[][8] = { "_tdata", "_cdata", "_corig" };
+ static const char _suffixes[][8] = { "_tdata", "_cdata", "_corig" };
int r;
char *name;
size_t len;
@@ -6129,7 +6130,6 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
/* Remove the temporary tags */
dm_list_iterate_items(sl, &lv_where->tags)
str_list_del(&layer_lv->tags, sl->str);
-
}
log_very_verbose("Inserting layer %s for %s",
@@ -6166,7 +6166,7 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
lv_names.old = lv_where->name;
lv_names.new = layer_lv->name;
if (!for_each_sub_lv(layer_lv, _rename_cb, (void *) &lv_names))
- return 0;
+ return_NULL;
break;
}
@@ -6635,8 +6635,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
if (lp->stripe_size > vg->extent_size) {
- if (segtype_is_raid(lp->segtype) &&
- (vg->extent_size < STRIPE_SIZE_MIN)) {
+ if (seg_is_raid(lp) && (vg->extent_size < STRIPE_SIZE_MIN)) {
/*
* FIXME: RAID will simply fail to load the table if
* this is the case, but we should probably
@@ -6677,13 +6676,12 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
if (seg_is_cache(lp)) {
if (!lp->pool_name) {
- log_error(INTERNAL_ERROR "Cannot create cached volume without cache pool.");
- return NULL;
+ log_error(INTERNAL_ERROR "Cannot create thin volume without thin pool.");
+ return NULL;
}
- /* We have the cache_pool, create the origin with cache */
if (!(pool_lv = find_lv(vg, lp->pool_name))) {
- log_error("Couldn't find cache pool volume %s in "
- "volume group %s.", lp->pool_name, vg->name);
+ log_error("Couldn't find volume %s in Volume group %s.",
+ lp->pool_name, vg->name);
return NULL;
}
@@ -6744,8 +6742,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
return NULL;
}
if (lv_is_locked(origin_lv)) {
- log_error("Snapshots of locked devices are not "
- "supported yet");
+ log_error("Snapshots of locked devices are not supported.");
return NULL;
}
if (lv_is_merging_origin(origin_lv)) {
@@ -6871,16 +6868,16 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
return_NULL;
if (lp->read_ahead != lv->read_ahead) {
- log_verbose("Setting read ahead sectors");
lv->read_ahead = lp->read_ahead;
+ log_debug_metadata("Setting read ahead sectors %u.", lv->read_ahead);
}
if (!seg_is_thin_pool(lp) && lp->minor >= 0) {
lv->major = lp->major;
lv->minor = lp->minor;
lv->status |= FIXED_MINOR;
- log_verbose("Setting device number to (%d, %d)", lv->major,
- lv->minor);
+ log_debug_metadata("Setting device number to (%d, %d).",
+ lv->major, lv->minor);
}
dm_list_splice(&lv->tags, &lp->tags);
@@ -6963,8 +6960,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
* it just as if CHANGE_AY was used, CHANGE_AN otherwise.
*/
if (lp->activate == CHANGE_AAY)
- lp->activate = lv_passes_auto_activation_filter(cmd, lv) ?
- CHANGE_ALY : CHANGE_ALN;
+ lp->activate = lv_passes_auto_activation_filter(cmd, lv)
+ ? CHANGE_ALY : CHANGE_ALN;
if (lv_activation_skip(lv, lp->activate, lp->activation_skip & ACTIVATION_SKIP_IGNORE))
lp->activate = CHANGE_AN;
@@ -7100,9 +7097,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
.yes = lp->yes,
.force = lp->force
})) {
- log_error("Aborting. Failed to wipe %s.",
- lp->snapshot ? "snapshot exception store" :
- "start of new LV");
+ log_error("Aborting. Failed to wipe %s.", lp->snapshot
+ ? "snapshot exception store" : "start of new LV");
goto deactivate_and_revert_new_lv;
}
}
@@ -7120,8 +7116,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
if ((vg_is_clustered(vg) ||
(!lp->voriginsize && !lv_is_active(origin_lv))) &&
!deactivate_lv(cmd, lv)) {
- log_error("Aborting. Couldn't deactivate snapshot "
- "COW area. Manual intervention required.");
+ log_error("Aborting. Couldn't deactivate snapshot COW area. "
+ "Manual intervention required.");
return NULL;
}
@@ -7150,9 +7146,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
/* store vg on disk(s) */
if (!lv_update_and_reload(origin_lv))
- return_0;
+ return_NULL;
}
-
out:
return lv;
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index bf6f1c1..1af9cbf 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -783,7 +783,7 @@ int is_mirror_image_removable(struct logical_volume *mimage_lv, void *baton);
typedef enum activation_change {
CHANGE_AY = 0, /* activate */
CHANGE_AN = 1, /* deactivate */
- CHANGE_AEY = 2, /* activate exclusively */
+ CHANGE_AEY = 2, /* activate exclusively */
CHANGE_ALY = 3, /* activate locally */
CHANGE_ALN = 4, /* deactivate locally */
CHANGE_AAY = 5 /* automatic activation */
@@ -801,7 +801,7 @@ struct lvcreate_params {
int cache;
int snapshot; /* snap */
int thin; /* thin */
- int create_pool; /* thin */
+ int create_pool; /* pools */
int zero; /* all */
int wipe_signatures; /* all */
int32_t major; /* all */
diff --git a/lib/metadata/pool_manip.c b/lib/metadata/pool_manip.c
index 2fbadea..02a82bd 100644
--- a/lib/metadata/pool_manip.c
+++ b/lib/metadata/pool_manip.c
@@ -433,7 +433,7 @@ int create_pool(struct logical_volume *pool_lv,
*/
pool_lv->status |= LV_TEMPORARY;
if (!activate_lv_local(pool_lv->vg->cmd, pool_lv) ||
- /* Clear 4KB of metadata device for new thin-pool. */
+ /* Clear 4KB of pool metadata device. */
!wipe_lv(pool_lv, (struct wipe_params) { .do_zero = 1 })) {
log_error("Aborting. Failed to wipe pool metadata %s.",
pool_lv->name);
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 5a91627..7573a2e 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -390,8 +390,8 @@ static int _update_extents_params(struct volume_group *vg,
extents = percent_of_extents(lp->extents, vg->extent_count, 0);
break;
case PERCENT_LV:
- log_error("Please express size as %s%%VG, %%PVS, "
- "or %%FREE.", (lp->snapshot) ? "%ORIGIN, " : "");
+ log_error("Please express size as %%FREE%s, %%PVS or %%VG.",
+ (lp->snapshot) ? ", %ORIGIN" : "");
return 0;
case PERCENT_ORIGIN:
if (lp->snapshot && lp->origin_name &&
@@ -667,8 +667,7 @@ static int _read_raid_params(struct lvcreate_params *lp,
/*
* RAID1 does not take a stripe arg
*/
- if ((lp->stripes > 1) &&
- segtype_is_mirrored(lp->segtype) &&
+ if ((lp->stripes > 1) && seg_is_mirrored(lp) &&
strcmp(lp->segtype->name, SEG_TYPE_NAME_RAID10)) {
log_error("Stripe argument cannot be used with segment type, %s",
lp->segtype->name);
@@ -713,11 +712,10 @@ static int _read_cache_pool_params(struct lvcreate_params *lp,
{
const char *cachemode;
- if (!segtype_is_cache_pool(lp->segtype))
+ if (!seg_is_cache(lp) && !seg_is_cache_pool(lp))
return 1;
- cachemode = arg_str_value(cmd, cachemode_ARG, NULL);
- if (!cachemode)
+ if (!(cachemode = arg_str_value(cmd, cachemode_ARG, NULL)))
cachemode = find_config_tree_str(cmd, allocation_cache_pool_cachemode_CFG, NULL);
if (!get_cache_mode(cachemode, &lp->feature_flags))
@@ -748,9 +746,7 @@ static int _read_activation_params(struct lvcreate_params *lp,
lp->zero = 0;
}
- /*
- * Read ahead.
- */
+ /* Read ahead */
lp->read_ahead = arg_uint_value(cmd, readahead_ARG,
cmd->default_settings.read_ahead);
pagesize = lvm_getpagesize() >> SECTOR_SHIFT;
@@ -765,9 +761,7 @@ static int _read_activation_params(struct lvcreate_params *lp,
"of %uK page size.", lp->read_ahead, pagesize >> 1);
}
- /*
- * Permissions.
- */
+ /* Permissions */
lp->permission = arg_uint_value(cmd, permission_ARG,
LVM_READ | LVM_WRITE);
@@ -790,7 +784,7 @@ static int _read_activation_params(struct lvcreate_params *lp,
if (!get_and_validate_major_minor(cmd, vg->fid->fmt,
&lp->major, &lp->minor))
- return_0;
+ return_0;
} else if (arg_is_set(cmd, major_ARG) || arg_is_set(cmd, minor_ARG)) {
log_error("--major and --minor require -My.");
return 0;
@@ -1048,13 +1042,11 @@ static int _lvcreate_params(struct lvcreate_params *lp,
* Allocation parameters
*/
contiguous = arg_int_value(cmd, contiguous_ARG, 0);
-
lp->alloc = contiguous ? ALLOC_CONTIGUOUS : ALLOC_INHERIT;
-
lp->alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, lp->alloc);
if (contiguous && (lp->alloc != ALLOC_CONTIGUOUS)) {
- log_error("Conflicting contiguous and alloc arguments");
+ log_error("Conflicting contiguous and alloc arguments.");
return 0;
}
@@ -1063,12 +1055,12 @@ static int _lvcreate_params(struct lvcreate_params *lp,
continue;
if (!(tag = grouped_arg_str_value(current_group->arg_values, addtag_ARG, NULL))) {
- log_error("Failed to get tag");
+ log_error("Failed to get tag.");
return 0;
}
if (!str_list_add(cmd->mem, &lp->tags, tag)) {
- log_error("Unable to allocate memory for tag %s", tag);
+ log_error("Unable to allocate memory for tag %s.", tag);
return 0;
}
}
8 years, 7 months
master - cleanup: commands.h update descriptions
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c6456bd6390f6d...
Commit: c6456bd6390f6d99dd975f671c5730b0438c4c89
Parent: df933c2ac92203c7352be2e7062ca8c01777cb51
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Oct 22 22:43:42 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 24 16:39:31 2014 +0200
cleanup: commands.h update descriptions
---
tools/commands.h | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/tools/commands.h b/tools/commands.h
index 524297d..eb0d248 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -121,7 +121,7 @@ xx(lvchange,
"\t[--monitor {y|n}]\n"
"\t[--poll {y|n}]\n"
"\t[--noudevsync]\n"
- "\t[-M|--persistent y|n] [--major major] [--minor minor]\n"
+ "\t[-M|--persistent y|n] [-j|--major major] [--minor minor]\n"
"\t[--metadataprofile ProfileName]\n"
"\t[-P|--partial]\n"
"\t[-p|--permission r|rw]\n"
@@ -221,25 +221,25 @@ xx(lvconvert,
"\t[--chunksize size]\n"
"\t[--discards {ignore|nopassdown|passdown}]\n"
"\t[--poolmetadataspare {y|n}]\n"
- "\t[--poolmetadata ThinMetadataLogicalVolume[Path] |\n"
- "\t [--poolmetadatasize size]\n"
- "\t [-r|--readahead ReadAheadSectors|auto|none]\n"
- "\t [--stripes Stripes [-I|--stripesize StripeSize]]]\n"
+ "\t[{--poolmetadata ThinMetadataLogicalVolume[Path] |\n"
+ "\t --poolmetadatasize size}]\n"
+ "\t[-r|--readahead ReadAheadSectors|auto|none]\n"
+ "\t[--stripes Stripes [-I|--stripesize StripeSize]]]\n"
"\t[--originname NewExternalOriginVolumeName]]\n"
"\t[-Z|--zero {y|n}]\n"
COMMON_OPTS
- "\t[ExternalOrigin|ThinDataPool]LogicalVolume[Path]\n\n"
+ "\t[ExternalOrigin|ThinDataPool]LogicalVolume[Path] [PhysicalVolumePath...]\n\n"
"lvconvert "
- "[--type cache[-pool]|--cache]\n"
+ "[--type cache[-pool]|-H|--cache]\n"
"\t[--cachepool CacheDataLogicalVolume[Path]]\n"
"\t[--cachemode CacheMode]\n"
"\t[--chunksize size]\n"
"\t[--poolmetadataspare {y|n}]]\n"
- "\t[--poolmetadata CacheMetadataLogicalVolume[Path] |\n"
- "\t [--poolmetadatasize size]\n"
+ "\t[{--poolmetadata CacheMetadataLogicalVolume[Path] |\n"
+ "\t --poolmetadatasize size}]\n"
COMMON_OPTS
- "\t[Cache|CacheDataPool]LogicalVolume[Path]\n\n",
+ "\t[Cache|CacheDataPool]LogicalVolume[Path] [PhysicalVolumePath...]\n\n",
alloc_ARG, background_ARG, cache_ARG, cachemode_ARG, cachepool_ARG, chunksize_ARG,
corelog_ARG, discards_ARG, force_ARG, interval_ARG, merge_ARG, mirrorlog_ARG,
@@ -273,9 +273,10 @@ xx(lvcreate,
"\t[-K|--ignoreactivationskip]\n"
"\t{-l|--extents LogicalExtentsNumber[%{VG|PVS|FREE}] |\n"
"\t -L|--size LogicalVolumeSize[bBsSkKmMgGtTpPeE]}\n"
- "\t[-M|--persistent {y|n}] [--major major] [--minor minor]\n"
+ "\t[-M|--persistent {y|n}] [-j|--major major] [--minor minor]\n"
"\t[--metadataprofile ProfileName]\n"
- "\t[-m|--mirrors Mirrors [--nosync] [{--mirrorlog {disk|core|mirrored}|--corelog}]]\n"
+ "\t[-m|--mirrors Mirrors [--nosync]\n"
+ "\t [{--mirrorlog {disk|core|mirrored}|--corelog}]]\n"
"\t[-n|--name LogicalVolumeName]\n"
"\t[--noudevsync]\n"
"\t[-p|--permission {r|rw}]\n"
@@ -283,7 +284,7 @@ xx(lvcreate,
"\t[--poolmetadataspare {y|n}]]\n"
"\t[--[raid]minrecoveryrate Rate]\n"
"\t[--[raid]maxrecoveryrate Rate]\n"
- "\t[-r|--readahead ReadAheadSectors|auto|none]\n"
+ "\t[-r|--readahead {ReadAheadSectors|auto|none}]\n"
"\t[-R|--regionsize MirrorLogRegionSize]\n"
"\t[-T|--thin\n"
"\t [--discards {ignore|nopassdown|passdown}]\n"
@@ -319,7 +320,7 @@ xx(lvcreate,
"\t{-l|--extents LogicalExtentsNumber[%{VG|FREE|ORIGIN}] |\n"
"\t -L|--size LogicalVolumeSize[bBsSkKmMgGtTpPeE]}\n"
"\t[--poolmetadatasize MetadataVolumeSize[bBsSkKmMgG]]\n"
- "\t[-M|--persistent {y|n}] [--major major] [--minor minor]\n"
+ "\t[-M|--persistent {y|n}] [-j|--major major] [--minor minor]\n"
"\t[--metadataprofile ProfileName]\n"
"\t[-n|--name LogicalVolumeName]\n"
"\t[--noudevsync]\n"
@@ -848,7 +849,7 @@ xx(pvscan,
PERMITTED_READ_ONLY,
"pvscan\n"
"\t[-b|--background]\n"
- "\t[--cache [-a|--activate ay] [ DevicePath | --major major --minor minor]...]\n"
+ "\t[--cache [-a|--activate ay] [ DevicePath | -j|--major major --minor minor]...]\n"
"\t[--commandprofile ProfileName]\n"
"\t[-d|--debug]\n"
"\t{-e|--exported | -n|--novolumegroup}\n"
8 years, 7 months