1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

lvresize: check for max snapshot size

As for lvcreate, lvresize also doesn't need to grow bigger then needed.
This commit is contained in:
Zdenek Kabelac 2013-05-29 21:23:02 +02:00
parent bd3ece0128
commit 3ced1bf694
2 changed files with 11 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
Detect maximum usable size for snapshot for lvresize.
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.

View File

@ -527,6 +527,16 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
return EINVALID_CMD_LINE;
}
lp->extents += lv->le_count;
if (lv_is_cow(lv)) {
extents_used = cow_max_extents(origin_from_cow(lv), find_cow(lv)->chunk_size);
if (extents_used < lp->extents) {
log_print_unless_silent("Reached maximum COW size %s.",
display_size(vg->cmd, (uint64_t) vg->extent_size * extents_used));
lp->extents = extents_used;
if (lp->extents == lv->le_count)
return ECMD_PROCESSED;
}
}
}
if (lp->sign == SIGN_MINUS) {