main - vgchange autoactivation: lock vg early to avoid second label scan
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0e0faf30e01f78828b7e240f57217755b62650bb Commit: 0e0faf30e01f78828b7e240f57217755b62650bb Parent: 92e741eda060b4712fab5b37e0bee2cc5e155a57 Author: David Teigland <[email protected]> AuthorDate: Wed Nov 10 16:43:21 2021 -0600 Committer: David Teigland <[email protected]> CommitterDate: Wed Nov 10 16:50:50 2021 -0600
vgchange autoactivation: lock vg early to avoid second label scan
Copy another optimization from pvscan -aay to vgchange -aay. When using the optimized label scan for only one VG, acquire the VG lock prior to the scan. This allows vg_read to then skip the repeated label scan that normally happens after locking the vg.
--- lib/label/label.c | 4 --- test/shell/vgchange-pvs-online.sh | 4 ++- tools/vgchange.c | 58 +++++++++++++++++++++------------------ 3 files changed, 35 insertions(+), 31 deletions(-)
lib/label/label.c +0 -4
@@ -1044,10 +1044,6 @@ int label_scan_vg_online(struct cmd_context *cmd, const char *vgname,log_debug_devs ("Finding online devices to scan" ); -/* reads devices file, does not populate dev-cache */ -if (!setup_devices_for_online_autoactivation (cmd)) -return 0 ; -/* * First attempt to use /run/lvm/pvs_lookup/vgname which should be * used in cases where all PVs in a VG do not contain metadata.
test/shell/vgchange-pvs-online.sh +3 -1
@@ -56,13 +56,14 @@ check lv_field $vg2/$lv1 lv_active "active" # Count io to check the pvs_online optimization # is working to limit scanning. +if which strace; then vgchange -an _clear_online_files pvscan --cache "$dev1" pvscan --cache "$dev2" strace -e io_submit vgchange -aay --autoactivation event $vg1 2>&1|tee trace.out -test "$(grep io_submit trace.out | wc -l)" -eq 4 +test "$(grep io_submit trace.out | wc -l)" -eq 3 rm trace.out strace -e io_submit pvscan --cache "$dev3" 2>&1|tee trace.out
@@ -72,6 +73,7 @@ rm trace.out strace -e io_submit vgchange -aay --autoactivation event $vg2 2>&1|tee trace.out test "$(grep io_submit trace.out | wc -l)" -eq 2 rm trace.out +fi # non-standard usage: no VG name arg, vgchange will only used pvs_online files
tools/vgchange.c +32 -26
82 lines not on this page · raw message