mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvcreate: reduce too large cow
Detect maximum usable size of snapshot COW device, and do not waste more space for such LV then needed.
This commit is contained in:
parent
eb7e206a73
commit
bd3ece0128
@ -1,5 +1,6 @@
|
||||
Version 2.02.99 -
|
||||
===================================
|
||||
Creation of snapshot takes at most 100% origin coverage.
|
||||
Add cow_max_extents() to calc extents for 100% origin coverage.
|
||||
For creation of snapshot require size for at least 3 chunks.
|
||||
Fix lvresize --use-policies of VALID but 100% full snapshot.
|
||||
|
@ -241,6 +241,7 @@ static int _update_extents_params(struct volume_group *vg,
|
||||
struct logical_volume *origin = NULL;
|
||||
uint32_t size_rest;
|
||||
uint32_t stripesize_extents;
|
||||
uint32_t extents;
|
||||
|
||||
if (lcp->size &&
|
||||
!(lp->extents = extents_from_size(vg->cmd, lcp->size,
|
||||
@ -299,6 +300,23 @@ static int _update_extents_params(struct volume_group *vg,
|
||||
break;
|
||||
}
|
||||
|
||||
if (lp->snapshot && lp->origin) {
|
||||
if (!origin && !(origin = find_lv(vg, lp->origin))) {
|
||||
log_error("Couldn't find origin volume '%s'.",
|
||||
lp->origin);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extents = cow_max_extents(origin, lp->chunk_size);
|
||||
|
||||
if (extents < lp->extents) {
|
||||
log_print_unless_silent("Reducing COW size %s down to maximum usable size %s.",
|
||||
display_size(vg->cmd, (uint64_t) vg->extent_size * lp->extents),
|
||||
display_size(vg->cmd, (uint64_t) vg->extent_size * extents));
|
||||
lp->extents = extents;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(stripesize_extents = lp->stripe_size / vg->extent_size))
|
||||
stripesize_extents = 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user