|
|
146ac4 |
From afb4290111b67b5abb2cb75e543f3605f605b92b Mon Sep 17 00:00:00 2001
|
|
|
146ac4 |
From: Zdenek Kabelac <zkabelac@redhat.com>
|
|
|
146ac4 |
Date: Fri, 18 Jan 2019 22:27:02 +0100
|
|
|
146ac4 |
Subject: [PATCH 01/17] lv_manip: better work with PERCENT_VG modifier
|
|
|
146ac4 |
|
|
|
146ac4 |
When using 'lvcreate -l100%VG' and there is big disproportion between
|
|
|
146ac4 |
real available space and requested setting - automatically fallback
|
|
|
146ac4 |
to 100%FREE.
|
|
|
146ac4 |
|
|
|
146ac4 |
Difference can be seen when VG is big and already most space was
|
|
|
146ac4 |
allocated, so the requestion 100%VG can end (and by spec for % modifier
|
|
|
146ac4 |
it's correct) as LV with size of 1%VG. Usually this is not a big
|
|
|
146ac4 |
problem - buit in some cases - like cache-pool allocation, this
|
|
|
146ac4 |
can result a big difference for chunksize selection.
|
|
|
146ac4 |
|
|
|
146ac4 |
With this patch it's more closely match common-sense logic without
|
|
|
146ac4 |
the need of reitteration of too big changes in lvm2 core ATM.
|
|
|
146ac4 |
|
|
|
146ac4 |
TODO: in the future there should be allocator solving all allocations
|
|
|
146ac4 |
in a single call.
|
|
|
146ac4 |
|
|
|
146ac4 |
(cherry picked from commit 022ebb0cfebee4ac8fdbe4e0c61e85db1038a115)
|
|
|
146ac4 |
|
|
|
146ac4 |
Conflicts:
|
|
|
146ac4 |
WHATS_NEW
|
|
|
146ac4 |
---
|
|
|
146ac4 |
WHATS_NEW | 1 +
|
|
|
146ac4 |
lib/metadata/lv_manip.c | 6 ++++++
|
|
|
146ac4 |
tools/lvcreate.c | 6 ++++++
|
|
|
146ac4 |
3 files changed, 13 insertions(+)
|
|
|
146ac4 |
|
|
|
146ac4 |
diff --git a/WHATS_NEW b/WHATS_NEW
|
|
|
146ac4 |
index f429d27..152fa5e 100644
|
|
|
146ac4 |
--- a/WHATS_NEW
|
|
|
146ac4 |
+++ b/WHATS_NEW
|
|
|
146ac4 |
@@ -1,5 +1,6 @@
|
|
|
146ac4 |
Version 2.03.03 -
|
|
|
146ac4 |
====================================
|
|
|
146ac4 |
+ Improve -lXXX%VG modifier which improves cache segment estimation.
|
|
|
146ac4 |
Ensure migration_threshold for cache is at least 8 chunks.
|
|
|
146ac4 |
Move VDO support towards V2 target (6.2) support.
|
|
|
146ac4 |
|
|
|
146ac4 |
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
|
|
|
146ac4 |
index 9794074..0c54b2c 100644
|
|
|
146ac4 |
--- a/lib/metadata/lv_manip.c
|
|
|
146ac4 |
+++ b/lib/metadata/lv_manip.c
|
|
|
146ac4 |
@@ -5022,6 +5022,12 @@ static int _lvresize_extents_from_percent(const struct logical_volume *lv,
|
|
|
146ac4 |
case PERCENT_VG:
|
|
|
146ac4 |
lp->extents = percent_of_extents(lp->extents, vg->extent_count,
|
|
|
146ac4 |
(lp->sign != SIGN_MINUS));
|
|
|
146ac4 |
+ if (lp->sign == SIGN_NONE && lp->extents > vg->free_count) {
|
|
|
146ac4 |
+ lp->extents = vg->free_count;
|
|
|
146ac4 |
+ log_print_unless_silent("Reducing %u%%VG to remaining free space %s in VG.",
|
|
|
146ac4 |
+ old_extents,
|
|
|
146ac4 |
+ display_size(vg->cmd, (uint64_t)vg->extent_size * lp->extents));
|
|
|
146ac4 |
+ }
|
|
|
146ac4 |
break;
|
|
|
146ac4 |
case PERCENT_FREE:
|
|
|
146ac4 |
lp->extents = percent_of_extents(lp->extents, vg->free_count,
|
|
|
146ac4 |
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
|
|
|
146ac4 |
index 3c22794..ebe51d9 100644
|
|
|
146ac4 |
--- a/tools/lvcreate.c
|
|
|
146ac4 |
+++ b/tools/lvcreate.c
|
|
|
146ac4 |
@@ -278,6 +278,12 @@ static int _update_extents_params(struct volume_group *vg,
|
|
|
146ac4 |
switch (lcp->percent) {
|
|
|
146ac4 |
case PERCENT_VG:
|
|
|
146ac4 |
extents = percent_of_extents(lp->extents, base_calc_extents = vg->extent_count, 0);
|
|
|
146ac4 |
+ if (extents > vg->free_count) {
|
|
|
146ac4 |
+ extents = vg->free_count;
|
|
|
146ac4 |
+ log_print_unless_silent("Reducing %u%%VG to remaining free space %s in VG.",
|
|
|
146ac4 |
+ lp->extents,
|
|
|
146ac4 |
+ display_size(vg->cmd, (uint64_t)vg->extent_size * extents));
|
|
|
146ac4 |
+ }
|
|
|
146ac4 |
break;
|
|
|
146ac4 |
case PERCENT_FREE:
|
|
|
146ac4 |
extents = percent_of_extents(lp->extents, base_calc_extents = vg->free_count, 0);
|
|
|
146ac4 |
--
|
|
|
146ac4 |
1.8.3.1
|
|
|
146ac4 |
|