summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2016-06-24 00:24:26 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2016-06-24 00:39:14 +0200
commit1bb7a155d169c3fc115533658206c242f43bdd0c (patch)
treef3295cd665b21cf9e09dbf1902ac9b34d5c29087
parente99a31c9502a2081c6608a831b601081008cc3b0 (diff)
downloadlvm2-1bb7a155d169c3fc115533658206c242f43bdd0c.tar.gz
lvresize: fixes for recent commit
Merging process and patch rework missed some bits - fix them.
-rw-r--r--lib/metadata/lv_manip.c7
-rw-r--r--tools/lvresize.c6
2 files changed, 6 insertions, 7 deletions
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 8f0726775..40c1c1a8f 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4452,7 +4452,7 @@ static uint32_t _adjust_amount(dm_percent_t percent, int policy_threshold, int p
percent = (percent / policy_threshold + (DM_PERCENT_1 - 1) / 100) / (DM_PERCENT_1 / 100) - 100;
/* Use it if current policy amount is smaller */
- return (policy_amount < percent) ? (uint32_t) policy_amount : (uint32_t) percent;
+ return (policy_amount < percent) ? (uint32_t) percent : (uint32_t) policy_amount;
}
static int _lvresize_adjust_policy(const struct logical_volume *lv,
@@ -5241,7 +5241,10 @@ int lv_resize(struct logical_volume *lv,
return_0;
if (lp->use_policies) {
- lp->percent = SIGN_PLUS;
+ lp->extents = 0;
+ lp->sign = SIGN_PLUS;
+ lp->percent = PERCENT_LV;
+
aux_lp = *lp;
if (!_lvresize_adjust_policy(lv, &lp->extents, &aux_lp.extents))
return_0;
diff --git a/tools/lvresize.c b/tools/lvresize.c
index 45d355883..35b70446f 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -34,11 +34,7 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv,
lp->sign = lp->poolmetadata_sign = SIGN_NONE;
if ((lp->use_policies = arg_is_set(cmd, usepolicies_ARG))) {
- /* do nothing; _lvresize will handle --use-policies itself */
- lp->extents = 0;
- lp->sign = SIGN_PLUS;
- lp->percent = PERCENT_LV;
-
+ /* do nothing; lv_resize will handle --use-policies itself */
if (arg_from_list_is_set(cmd, NULL,
chunksize_ARG, extents_ARG,
poolmetadatasize_ARG,