1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 18:55:19 +03:00

Support rounding downward for lvcreate and %

If specifying size with % and we are reaching number
of free extents - round downward with stripes.
This commit is contained in:
Zdenek Kabelac 2012-04-11 12:33:34 +00:00
parent 9bdff1ee5c
commit c6f3701a71
2 changed files with 15 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.96 -
================================
For lvcreate with %FREE support rounding downward strip alignment.
Change message severity to log_very_verbose for missing dev info in udev db.
Fix problems when specifying PVs during RAID down-converts.
Fix ability to handle failures in mirrored log (regression intro 2.02.89).

View File

@ -236,6 +236,8 @@ static int _update_extents_params(struct volume_group *vg,
uint32_t pv_extent_count;
struct logical_volume *origin = NULL;
int changed = 0;
uint32_t size_rest;
uint32_t stripesize_extents;
if (lcp->size &&
!(lp->extents = extents_from_size(vg->cmd, lcp->size,
@ -294,6 +296,18 @@ static int _update_extents_params(struct volume_group *vg,
break;
}
if (!(stripesize_extents = lp->stripe_size / vg->extent_size))
stripesize_extents = 1;
if ((lcp->percent != PERCENT_NONE) && lp->stripes &&
(size_rest = lp->extents % (lp->stripes * stripesize_extents)) &&
(vg->free_count < lp->extents - size_rest + (lp->stripes * stripesize_extents))) {
log_print("Rounding size (%d extents) down to stripe boundary "
"size (%d extents)", lp->extents,
lp->extents - size_rest);
lp->extents = lp->extents - size_rest;
}
if (lp->create_thin_pool) {
if (!arg_count(vg->cmd, poolmetadatasize_ARG)) {
/* Defaults to nr_pool_blocks * 64b */