summaryrefslogtreecommitdiff
path: root/lib/commands
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2021-12-15 11:45:22 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2021-12-20 16:13:28 +0100
commit04fbffb116eaf5fb1b10785df92966d0083b270f (patch)
treea413bc19386ae583d649d6559120c44a777dbefa /lib/commands
parent0d67bc96fd15b9f3110bdc824749805c8392b04a (diff)
downloadlvm2-04fbffb116eaf5fb1b10785df92966d0083b270f.tar.gz
label: cache dm device list
Since we check for present DM devices - cache result for futher use of checking presence of such device. lvm2 uses cache result for label scan, but also when it tries to activate or deactivate LV - however only simple target 'striped' is reasonably supported. Use disable_dm_devs to be able to control when lv_info() get cache or uncached results. TODO: support more type, however this is getting very complicated.
Diffstat (limited to 'lib/commands')
-rw-r--r--lib/commands/toolcontext.c1
-rw-r--r--lib/commands/toolcontext.h3
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index c772dc6b1..301596482 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -2052,6 +2052,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
if (cmd->cft_def_hash)
dm_hash_destroy(cmd->cft_def_hash);
+ dm_device_list_destroy(&cmd->cache_dm_devs);
#ifndef VALGRIND_POOL
if (cmd->linebuffer) {
/* Reset stream buffering to defaults */
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index 4d7d4630d..f16322d4e 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -203,6 +203,7 @@ struct cmd_context {
unsigned event_activation:1; /* whether event_activation is set */
unsigned udevoutput:1;
unsigned online_vg_file_removed:1;
+ unsigned disable_dm_devs:1; /* temporarily disable use of dm devs cache */
/*
* Devices and filtering.
@@ -214,6 +215,8 @@ struct cmd_context {
const char *devicesfile; /* from --devicesfile option */
struct dm_list deviceslist; /* from --devices option, struct dm_str_list */
+ struct dm_list *cache_dm_devs; /* cache with UUIDs from DM_DEVICE_LIST (when available) */
+
/*
* Configuration.
*/