1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

use refresh_filters only where needed

Filters are changed and need refresh in only one
place (vgimportclone), so avoid doing the refresh
for every other command that doesn't need it.
This commit is contained in:
David Teigland 2020-04-22 14:08:54 -05:00
parent a509776588
commit 4047a32128
2 changed files with 3 additions and 11 deletions

10
lib/cache/lvmcache.c vendored
View File

@ -1032,15 +1032,6 @@ int lvmcache_label_scan(struct cmd_context *cmd)
log_debug_cache("Finding VG info");
/* FIXME: can this happen? */
if (!cmd->filter) {
log_error("label scan is missing filter");
goto out;
}
if (!refresh_filters(cmd))
log_error("Scan failed to refresh device filter.");
/*
* Duplicates found during this label scan are added to _initial_duplicates.
*/
@ -1103,7 +1094,6 @@ int lvmcache_label_scan(struct cmd_context *cmd)
r = 1;
out:
dm_list_iterate_items(vginfo, &_vginfos) {
if (is_orphan_vg(vginfo->vgname))
continue;

View File

@ -315,6 +315,8 @@ retry_name:
goto_out;
log_debug("Using new VG name %s.", vp.new_vgname);
lvmcache_destroy(cmd, 1, 0);
/*
* Create a device filter so that we are only working with the devices
* in arg_import. With the original devs hidden (that arg_import were
@ -325,7 +327,7 @@ retry_name:
init_internal_filtering(1);
dm_list_iterate_items(vd, &vp.arg_import)
internal_filter_allow(cmd->mem, vd->dev);
lvmcache_destroy(cmd, 1, 0);
refresh_filters(cmd);
log_debug("Changing VG %s to %s.", vp.old_vgname, vp.new_vgname);