1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

toollib: process_each_pv: fix commit d38d047e which worked for processing "all devices", but didn't work for "all PVs"

We still need to get the list as the calls underneath process_each_pv
rely on this list. But still keep the change related to the filters -
if we're processing all devices, we need to use cmd->full_filter.
If we're processing only PVs, we can use cmd->filter only to save
some time which would be spent in filtering code.
This commit is contained in:
Peter Rajnoha 2015-02-12 14:14:45 +01:00
parent e52c998c49
commit d95c6154ff

View File

@ -2330,7 +2330,8 @@ static int _get_arg_devices(struct cmd_context *cmd,
return ret_max;
}
static int _get_all_devices(struct cmd_context *cmd, struct dm_list *all_devices)
static int _get_all_devices(struct cmd_context *cmd, struct dm_list *all_devices,
int use_full_filter)
{
struct dev_iter *iter;
struct device *dev;
@ -2339,7 +2340,7 @@ static int _get_all_devices(struct cmd_context *cmd, struct dm_list *all_devices
lvmcache_seed_infos_from_lvmetad(cmd);
if (!(iter = dev_iter_create(cmd->full_filter, 1))) {
if (!(iter = dev_iter_create(use_full_filter ? cmd->full_filter : cmd->filter, 1))) {
log_error("dev_iter creation failed.");
return ECMD_FAILED;
}
@ -2736,8 +2737,7 @@ int process_each_pv(struct cmd_context *cmd,
* from all VGs are processed first, removing them from all_devices. Then
* any devs remaining in all_devices are processed.
*/
if (process_all_devices &&
(ret = _get_all_devices(cmd, &all_devices) != ECMD_PROCESSED)) {
if ((ret = _get_all_devices(cmd, &all_devices, process_all_devices) != ECMD_PROCESSED)) {
stack;
return ret;
}