1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cleanup: move mirror check code closer

Group a bit more code related to mirrors.
This commit is contained in:
Zdenek Kabelac 2013-06-24 11:55:18 +02:00
parent 09dc590b67
commit 19b064a309

View File

@ -771,7 +771,19 @@ static int _lvcreate_params(struct lvcreate_params *lp,
lp->mirrors = 2;
if (arg_count(cmd, mirrors_ARG)) {
if (arg_sign_value(cmd, mirrors_ARG, SIGN_NONE) == SIGN_MINUS) {
log_error("Mirrors argument may not be negative");
return 0;
}
lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0) + 1;
if (lp->mirrors > DEFAULT_MIRROR_MAX_IMAGES) {
log_error("Only up to " DM_TO_STRING(DEFAULT_MIRROR_MAX_IMAGES)
" images in mirror supported currently.");
return 0;
}
if (lp->mirrors == 1) {
if (segtype_is_mirrored(lp->segtype)) {
log_error("--mirrors must be at least 1 with segment type %s.", lp->segtype->name);
@ -790,11 +802,6 @@ static int _lvcreate_params(struct lvcreate_params *lp,
"only 2-way mirroring (i.e. '-m 1')");
return 0;
}
if (arg_sign_value(cmd, mirrors_ARG, SIGN_NONE) == SIGN_MINUS) {
log_error("Mirrors argument may not be negative");
return 0;
}
}
if (lp->snapshot && arg_count(cmd, zero_ARG)) {
@ -880,12 +887,6 @@ static int _lvcreate_params(struct lvcreate_params *lp,
return 0;
}
if (lp->mirrors > DEFAULT_MIRROR_MAX_IMAGES) {
log_error("Only up to " DM_TO_STRING(DEFAULT_MIRROR_MAX_IMAGES)
" images in mirror supported currently.");
return 0;
}
/*
* Allocation parameters
*/