Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=90b94ead12d739a3221e1…
Commit: 90b94ead12d739a3221e179bdcf1c482978f0f0f
Parent: d7054cd28ae6bb2fad216f8756ab030de3e8e65e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Apr 30 14:59:27 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 30 14:59:27 2019 -0500
lvmcache: remove unused flag
The new label scan design is never called recursively,
so we don't need a flag to check for that.
---
lib/cache/lvmcache.c | 9 ---------
1 files changed, 0 insertions(+), 9 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index f0b1d56..7d0c60d 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -66,7 +66,6 @@ static struct dm_hash_table *_vgname_hash = NULL;
static DM_LIST_INIT(_vginfos);
static DM_LIST_INIT(_found_duplicate_devs);
static DM_LIST_INIT(_unused_duplicate_devs);
-static int _scanning_in_progress = 0;
static int _vgs_locked = 0;
static int _found_duplicate_pvs = 0; /* If we never see a duplicate PV we can skip checking for them later. */
static int _found_duplicate_vgnames = 0;
@@ -855,12 +854,6 @@ int lvmcache_label_scan(struct cmd_context *cmd)
log_debug_cache("Finding VG info");
- /* Avoid recursion when a PVID can't be found! */
- if (_scanning_in_progress)
- return 0;
-
- _scanning_in_progress = 1;
-
/* FIXME: can this happen? */
if (!cmd->filter) {
log_error("label scan is missing filter");
@@ -941,8 +934,6 @@ int lvmcache_label_scan(struct cmd_context *cmd)
r = 1;
out:
- _scanning_in_progress = 0;
-
dm_list_iterate_items(vginfo, &_vginfos) {
if (is_orphan_vg(vginfo->vgname))
continue;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d7054cd28ae6bb2fad216…
Commit: d7054cd28ae6bb2fad216f8756ab030de3e8e65e
Parent: 366c1ac15b853fe3efc95472c569efc575f1237f
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Apr 30 14:26:16 2019 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 30 14:26:16 2019 -0500
vgcreate: remove the lvmcache locking workaround
Recent cleanups and simplifications to lvmcache and locking
mean that the odd locking to workaround other issues is now
unnecessary.
---
tools/vgcreate.c | 15 ---------------
1 files changed, 0 insertions(+), 15 deletions(-)
diff --git a/tools/vgcreate.c b/tools/vgcreate.c
index d62925f..626cf15 100644
--- a/tools/vgcreate.c
+++ b/tools/vgcreate.c
@@ -91,15 +91,6 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
return ECMD_FAILED;
}
- /*
- * FIXME: we have to unlock/relock the new VG name around the pvcreate
- * step because pvcreate needs to destroy lvmcache, which doesn't allow
- * any locks to be held. There shouldn't be any reason to require this
- * VG lock to be released, so the lvmcache destroy rule about locks
- * seems to be unwarranted here.
- */
- unlock_vg(cmd, NULL, vp_new.vg_name);
-
if (!(handle = init_processing_handle(cmd, NULL))) {
log_error("Failed to initialize processing handle.");
return ECMD_FAILED;
@@ -110,12 +101,6 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
return_ECMD_FAILED;
}
- /* Relock the new VG name, see comment above. */
- if (!lock_vol(cmd, vp_new.vg_name, LCK_VG_WRITE, NULL)) {
- destroy_processing_handle(cmd, handle);
- return_ECMD_FAILED;
- }
-
if (!(vg = vg_create(cmd, vp_new.vg_name)))
goto_bad;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e79e092f8bd41d3d589be…
Commit: e79e092f8bd41d3d589be0a10ac5addeaa8a3126
Parent: 4729b4af0bee2e742ed4f765dd6dc8d72f808521
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jan 18 22:27:02 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 30 12:24:53 2019 +0200
lv_manip: better work with PERCENT_VG modifier
When using 'lvcreate -l100%VG' and there is big disproportion between
real available space and requested setting - automatically fallback
to 100%FREE.
Difference can be seen when VG is big and already most space was
allocated, so the requestion 100%VG can end (and by spec for % modifier
it's correct) as LV with size of 1%VG. Usually this is not a big
problem - buit in some cases - like cache-pool allocation, this
can result a big difference for chunksize selection.
With this patch it's more closely match common-sense logic without
the need of reitteration of too big changes in lvm2 core ATM.
TODO: in the future there should be allocator solving all allocations
in a single call.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 6 ++++++
tools/lvcreate.c | 6 ++++++
3 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index dc2c4af..4b73ccc 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.185 -
==================================
+ Improve -lXXX%VG modifier which improves cache segment estimation.
Add synchronization with udev before removing cached devices.
Fix missing growth of _pmsmare volume when extending _tmeta volume.
Automatically grow thin metadata, when thin data gets too big.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index f960fad..9e7eff9 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4925,6 +4925,12 @@ static int _lvresize_extents_from_percent(const struct logical_volume *lv,
case PERCENT_VG:
lp->extents = percent_of_extents(lp->extents, vg->extent_count,
(lp->sign != SIGN_MINUS));
+ if ((lp->sign == SIGN_NONE) && (lp->extents > (lv->le_count + vg->free_count))) {
+ lp->extents = lv->le_count + vg->free_count;
+ log_print_unless_silent("Reducing %u%%VG to remaining free space %s in VG.",
+ old_extents,
+ display_size(vg->cmd, (uint64_t)vg->extent_size * lp->extents));
+ }
break;
case PERCENT_FREE:
lp->extents = percent_of_extents(lp->extents, vg->free_count,
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 867cde1..6e8cc90 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -277,6 +277,12 @@ static int _update_extents_params(struct volume_group *vg,
switch (lcp->percent) {
case PERCENT_VG:
extents = percent_of_extents(lp->extents, base_calc_extents = vg->extent_count, 0);
+ if (extents > vg->free_count) {
+ extents = vg->free_count;
+ log_print_unless_silent("Reducing %u%%VG to remaining free space %s in VG.",
+ lp->extents,
+ display_size(vg->cmd, (uint64_t)vg->extent_size * extents));
+ }
break;
case PERCENT_FREE:
extents = percent_of_extents(lp->extents, base_calc_extents = vg->free_count, 0);
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=515867bbad4565b788460…
Commit: 515867bbad4565b788460b1fc8cfe91acd5ade1e
Parent: bcf1aa99e66b7a99f9cddbecffad1b3d65b59a50
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 3 13:01:06 2019 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 30 12:02:49 2019 +0200
thin: resize metadata with data
When data are growing, adapt also size of metadata.
As we get way too many reports from users doing huge growths of
data portion while keep metadata small and avoiding using monitoring.
So to enhance the user-experience in case user requests grown of
thin-pool (without passing PV list for growth) - lvm2 will automaticaly
grown also the metadata part of thin-pool (if possible).
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6457d4c..7949a4a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.185 -
==================================
+ Automatically grow thin metadata, when thin data gets too big.
Add support for vgsplit with cached devices.
Fix signal delivery checking race in libdaemon (lvmetad).
Add missing Before=shutdown.target to LVM2 services to fix shutdown ordering.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index e72a1c9..2ea8eb4 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5518,6 +5518,24 @@ int lv_resize(struct logical_volume *lv,
if (!_lvresize_prepare(&lv, lp, pvh))
return_0;
+ if (lp->resize != LV_REDUCE && !aux_lv && !lp->poolmetadata_size &&
+ &lv->vg->pvs == pvh && lv_is_thin_pool_data(lv)) {
+ /* When thin-pool data part is extended, automatically extend also metadata part
+ * to have the metadata chunks for adressing all data blocks
+ * Do this only when PV list is not defined and --poolmetadatasize is unspecified */
+ aux_lp = *lp;
+ seg = get_only_segment_using_this_lv(lv);
+ aux_lp.size = estimate_thin_pool_metadata_size(lp->extents, lv->vg->extent_size, seg->chunk_size);
+ if (aux_lp.size > seg->metadata_lv->size) {
+ log_verbose("Also going to resize thin-pool metadata to match bigger data.");
+ aux_lv = _lvresize_setup_aux(seg->metadata_lv, &aux_lp);
+ aux_lp.sign = SIGN_NONE;
+ if (!_lvresize_prepare(&aux_lv, &aux_lp, pvh))
+ return_0;
+ } else
+ aux_lp.size = 0;
+ }
+
if (((lp->resize == LV_REDUCE) ||
(aux_lv && aux_lp.resize == LV_REDUCE)) &&
(pvh != &vg->pvs))