]> sourceware.org Git - lvm2.git/commitdiff
pvscan: filter does not need to be checked for symlink names
authorDavid Teigland <teigland@redhat.com>
Wed, 15 Feb 2023 16:08:25 +0000 (10:08 -0600)
committerDavid Teigland <teigland@redhat.com>
Wed, 15 Feb 2023 16:19:57 +0000 (10:19 -0600)
With the recent use of DEVLINKS, there is no longer any real
point in checking the filter for symlink names.  Removing
this check should not change behavior with or without symlinks
in the filter.

lib/filters/filter-regex.c
lib/filters/filter.h
lib/label/label.c
tools/pvscan.c

index ecc32914b0e15ba9cbac5c101cffddf25eddd8ad..5f348674dd5f10329bf92c72f3701826803c6d09 100644 (file)
@@ -253,48 +253,3 @@ struct dev_filter *regex_filter_create(const struct dm_config_value *patterns, i
        dm_pool_destroy(mem);
        return NULL;
 }
-
-static int _filter_contains_symlink(struct cmd_context *cmd, int filter_cfg)
-{
-       const struct dm_config_node *cn;
-       const struct dm_config_value *cv;
-       const char *fname;
-               
-       if ((cn = find_config_tree_array(cmd, filter_cfg, NULL))) {
-               for (cv = cn->v; cv; cv = cv->next) {
-                       if (cv->type != DM_CFG_STRING)
-                               continue;
-                       if (!cv->v.str)
-                               continue;
-                       
-                       fname = cv->v.str;
-               
-                       if (fname[0] != 'a')
-                               continue;
-       
-                       if (strstr(fname, "/dev/disk/"))
-                               return 1;
-                       if (strstr(fname, "/dev/mapper/"))
-                               return 1;
-               
-                       /* In case /dev/disk/by was omitted */
-                       if (strstr(fname, "lvm-pv-uuid"))
-                               return 1;
-                       if (strstr(fname, "dm-uuid"))
-                               return 1;
-                       if (strstr(fname, "wwn-"))
-                               return 1;
-                       if (strstr(fname, "pci-"))
-                               return 1;
-               }
-       }
-
-       return 0;
-}
-
-int regex_filter_contains_symlink(struct cmd_context *cmd)
-{
-       return _filter_contains_symlink(cmd, devices_filter_CFG) ||
-              _filter_contains_symlink(cmd, devices_global_filter_CFG);
-}
-
index 0678e5e112d539dd7c5def4c00ddcfa6a49ab635..4cdfa2c9bd70407ef64319bf054f6d75a352a746 100644 (file)
@@ -64,6 +64,4 @@ struct dev_filter *usable_filter_create(struct cmd_context *cmd, struct dev_type
 #define DEV_FILTERED_DEVICES_LIST      0x00001000
 #define DEV_FILTERED_IS_LV             0x00002000
 
-int regex_filter_contains_symlink(struct cmd_context *cmd);
-
 #endif         /* _LVM_FILTER_H */
index 42d7b6709534f9f5d5f136aa1219de4afcbf08a2..c122a4ebb0e7453040ab18a2304e993723212766 100644 (file)
@@ -1109,10 +1109,7 @@ int label_scan_vg_online(struct cmd_context *cmd, const char *vgname,
         * filter.  We get devs from the pvs_online files, so we inherit the
         * regex filtering from pvscan and don't have to do it ourself.
         */
-       if (!cmd->enable_devices_file &&
-           !cmd->enable_devices_list &&
-           regex_filter_contains_symlink(cmd))
-               cmd->filter_regex_skip = 1;
+       cmd->filter_regex_skip = 1;
 
        cmd->filter_nodata_only = 1;
 
index 8f60b25228ea044be38833b1f9c6a35995224c32..b834dfd4c88f604f2f3d0b388b4ebec0be6023a3 100644 (file)
@@ -1502,8 +1502,7 @@ static int _pvscan_cache_args(struct cmd_context *cmd, int argc, char **argv,
         */
        if ((dm_list_size(&pvscan_devs) == 1) &&
            !cmd->enable_devices_file &&
-           !cmd->enable_devices_list &&
-           regex_filter_contains_symlink(cmd)) {
+           !cmd->enable_devices_list) {
                char *env_str;
                struct dm_list *env_aliases;
                devl = dm_list_item(dm_list_first(&pvscan_devs), struct device_list);
This page took 0.040621 seconds and 5 git commands to generate.