]> sourceware.org Git - lvm2.git/commitdiff
toollib: process_each_pv: fix commit d38d047e which worked for processing "all device...
authorPeter Rajnoha <prajnoha@redhat.com>
Thu, 12 Feb 2015 13:14:45 +0000 (14:14 +0100)
committerPeter Rajnoha <prajnoha@redhat.com>
Thu, 12 Feb 2015 13:14:45 +0000 (14:14 +0100)
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.

tools/toollib.c

index 6452605611e1570a46bfa4bd12ce842208a39449..43c7fc1005a4aa8b7f775b575c46e5e60e14daaf 100644 (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;
        }
This page took 0.047395 seconds and 5 git commands to generate.