mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
toollib: Reorder process_each_pv initialisation.
Perform cheaper command line-based validation before more-expensive processing and scanning.
This commit is contained in:
parent
5bf74f2997
commit
19c3851d9c
@ -2785,15 +2785,6 @@ int process_each_pv(struct cmd_context *cmd,
|
||||
dm_list_init(&all_vgnameids);
|
||||
dm_list_init(&all_devices);
|
||||
|
||||
/*
|
||||
* Read all the vgs first because this has the effect of initializing
|
||||
* other device/lvmcache info that is needed when creating device lists.
|
||||
*/
|
||||
if ((ret = _get_vgnameids_on_system(cmd, &all_vgnameids, only_this_vgname, 1) != ECMD_PROCESSED)) {
|
||||
stack;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create two lists from argv:
|
||||
* arg_pvnames: pvs explicitly named in argv
|
||||
@ -2809,14 +2800,8 @@ int process_each_pv(struct cmd_context *cmd,
|
||||
|
||||
process_all_pvs = dm_list_empty(&arg_pvnames) && dm_list_empty(&arg_tags);
|
||||
|
||||
process_all_devices = process_all_pvs &&
|
||||
(cmd->command->flags & ENABLE_ALL_DEVS) &&
|
||||
arg_count(cmd, all_ARG);
|
||||
|
||||
if ((ret = _get_arg_devices(cmd, &arg_pvnames, &arg_devices) != ECMD_PROCESSED)) {
|
||||
/* get_arg_devices reports the error for any PV names not found. */
|
||||
ret_max = ECMD_FAILED;
|
||||
}
|
||||
process_all_devices = process_all_pvs && (cmd->command->flags & ENABLE_ALL_DEVS) &&
|
||||
arg_count(cmd, all_ARG);
|
||||
|
||||
/*
|
||||
* If the caller wants to process all devices (not just PVs), then all PVs
|
||||
@ -2828,6 +2813,19 @@ int process_each_pv(struct cmd_context *cmd,
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((ret = _get_arg_devices(cmd, &arg_pvnames, &arg_devices) != ECMD_PROCESSED))
|
||||
/* get_arg_devices reports the error for any PV names not found. */
|
||||
ret_max = ECMD_FAILED;
|
||||
|
||||
/*
|
||||
* Read all the vgs first because this has the effect of initializing
|
||||
* other device/lvmcache info that is needed when creating device lists.
|
||||
*/
|
||||
if ((ret = _get_vgnameids_on_system(cmd, &all_vgnameids, only_this_vgname, 1) != ECMD_PROCESSED)) {
|
||||
stack;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = _process_pvs_in_vgs(cmd, flags, &all_vgnameids, &all_devices,
|
||||
&arg_devices, &arg_tags,
|
||||
process_all_pvs, process_all_devices,
|
||||
|
Loading…
Reference in New Issue
Block a user