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);