diff options
Diffstat (limited to 'tools/lvcreate.c')
-rw-r--r-- | tools/lvcreate.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/lvcreate.c b/tools/lvcreate.c index aa2d8075..28d4dbff 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -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 */ |