diff options
author | David Teigland <teigland@redhat.com> | 2021-11-05 12:19:35 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2021-11-05 12:19:35 -0500 |
commit | 62533ae3fad9fece6f27e3fae7b56e40c66438fa (patch) | |
tree | f5c6fd8912c055e2e45fd8cc16a91d33e08fd564 /lib/cache | |
parent | 5f7cb977438891a073227d75029f61970b1710bd (diff) | |
download | lvm2-62533ae3fad9fece6f27e3fae7b56e40c66438fa.tar.gz |
vgchange -aay: optimize device list using pvs_online files
Port another optimization from pvscan -aay to vgchange -aay:
"pvscan: only add device args to dev cache"
This optimization avoids doing a full dev_cache_scan, and
instead populates dev-cache with only the devices in the
VG being activated.
This involves shifting the use of pvs_online files from
the hints interface up to the higher level label_scan
interface. This specialized label_scan is structured
around creating a list of devices from the pvs_online
files. Previously, a list of all devices was created
first, and then reduced based on the pvs_online files.
The initial step of listing all devices was slow when
thousands of devices are present on the system.
This optimization extends the previous optimization that
used pvs_online files to limit the devices that were
actually scanned (i.e. reading to identify the device):
"vgchange -aay: optimize device scan using pvs_online files"
Diffstat (limited to 'lib/cache')
-rw-r--r-- | lib/cache/lvmcache.c | 10 | ||||
-rw-r--r-- | lib/cache/lvmcache.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index bee63ebb4..81b9b0ec9 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -572,6 +572,16 @@ static const char *_get_pvsummary_device_id(const char *pvid_arg, const char **d return NULL; } +int lvmcache_pvsummary_count(const char *vgname) +{ + struct lvmcache_vginfo *vginfo; + + if (!(vginfo = lvmcache_vginfo_from_vgname(vgname, NULL))) + return_0; + + return dm_list_size(&vginfo->pvsummaries); +} + /* * Check if any PVs in vg->pvs have the same PVID as any * entries in _unused_duplicates. diff --git a/lib/cache/lvmcache.h b/lib/cache/lvmcache.h index 9511bb9e9..4c4903136 100644 --- a/lib/cache/lvmcache.h +++ b/lib/cache/lvmcache.h @@ -229,4 +229,6 @@ void lvmcache_extra_md_component_checks(struct cmd_context *cmd); unsigned int lvmcache_vg_info_count(void); +int lvmcache_pvsummary_count(const char *vgname); + #endif |