diff options
author | Alasdair Kergon <agk@redhat.com> | 2012-04-12 15:11:21 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2012-04-12 15:11:21 +0000 |
commit | e38e9e588ef725e2fb5cc86d13e8da6046d428fe (patch) | |
tree | e880d304f589b0817fb406c3450ee0e0f5463a14 /tools/lvresize.c | |
parent | a7feae8a6ee1d72b625274bfe90bd1be7938da7a (diff) | |
download | lvm2-e38e9e588ef725e2fb5cc86d13e8da6046d428fe.tar.gz lvm2-e38e9e588ef725e2fb5cc86d13e8da6046d428fe.tar.xz lvm2-e38e9e588ef725e2fb5cc86d13e8da6046d428fe.zip |
Remove 'up' from rounding message that sometimes rounds down.
Detect reduction of 0 after rounding for stripes and avoid warning of potential data loss.
Diffstat (limited to 'tools/lvresize.c')
-rw-r--r-- | tools/lvresize.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/lvresize.c b/tools/lvresize.c index 4acdda22..9662eb9d 100644 --- a/tools/lvresize.c +++ b/tools/lvresize.c @@ -454,6 +454,12 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg, alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, lv->alloc); + /* + * First adjust to an exact multiple of extent size. + * When extending by a relative amount we round that amount up. + * When reducing by a relative amount we remove at most that amount. + * When changing to an absolute size, we round that size up. + */ if (lp->size) { if (lp->size % vg->extent_size) { if (lp->sign == SIGN_MINUS) @@ -462,7 +468,7 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg, lp->size += vg->extent_size - (lp->size % vg->extent_size); - log_print("Rounding up size to full physical extent %s", + log_print("Rounding size to boundary between physical extents: %s", display_size(cmd, lp->size)); } @@ -714,6 +720,15 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg, return EINVALID_CMD_LINE; } lp->resize = LV_EXTEND; + } else if (lp->extents == lv->le_count) { + if (use_policy) + return ECMD_PROCESSED; /* Nothing to do. */ + if (!lp->resizefs) { + log_error("New size (%d extents) matches existing size " + "(%d extents)", lp->extents, lv->le_count); + return EINVALID_CMD_LINE; + } + lp->resize = LV_EXTEND; } if (lv_is_origin(lv)) { |