1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-25 10:04:17 +03:00

remove unused full filter

it's the same as cmd->filter
This commit is contained in:
David Teigland 2018-12-04 14:06:46 -06:00
parent 7d13df8cef
commit cb47de4d3e
8 changed files with 22 additions and 25 deletions

View File

@ -857,8 +857,8 @@ int lvmcache_label_scan(struct cmd_context *cmd)
_scanning_in_progress = 1; _scanning_in_progress = 1;
/* FIXME: can this happen? */ /* FIXME: can this happen? */
if (!cmd->full_filter) { if (!cmd->filter) {
log_error("label scan is missing full filter"); log_error("label scan is missing filter");
goto out; goto out;
} }

View File

@ -1181,9 +1181,7 @@ int init_filters(struct cmd_context *cmd, unsigned load_persistent_cache)
goto bad; goto bad;
} }
cmd->filter = filter = pfilter; cmd->filter = pfilter;
cmd->full_filter = filter;
cmd->initialized.filters = 1; cmd->initialized.filters = 1;
return 1; return 1;
@ -1829,9 +1827,9 @@ static void _destroy_dev_types(struct cmd_context *cmd)
static void _destroy_filters(struct cmd_context *cmd) static void _destroy_filters(struct cmd_context *cmd)
{ {
if (cmd->full_filter) { if (cmd->filter) {
cmd->full_filter->destroy(cmd->full_filter); cmd->filter->destroy(cmd->filter);
cmd->filter = cmd->full_filter = NULL; cmd->filter = NULL;
} }
cmd->initialized.filters = 0; cmd->initialized.filters = 0;
} }

View File

@ -176,8 +176,7 @@ struct cmd_context {
/* /*
* Filtering. * Filtering.
*/ */
struct dev_filter *filter; /* post-lvmetad filter chain */ struct dev_filter *filter;
struct dev_filter *full_filter; /* lvmetad_filter + filter */
/* /*
* Configuration. * Configuration.

View File

@ -855,7 +855,7 @@ int label_scan(struct cmd_context *cmd)
*/ */
dev_cache_scan(); dev_cache_scan();
if (!(iter = dev_iter_create(cmd->full_filter, 0))) { if (!(iter = dev_iter_create(cmd->filter, 0))) {
log_error("Scanning failed to get devices."); log_error("Scanning failed to get devices.");
return 0; return 0;
} }
@ -898,7 +898,7 @@ int label_scan(struct cmd_context *cmd)
return 0; return 0;
} }
_scan_list(cmd, cmd->full_filter, &all_devs, NULL); _scan_list(cmd, cmd->filter, &all_devs, NULL);
dm_list_iterate_items_safe(devl, devl2, &all_devs) { dm_list_iterate_items_safe(devl, devl2, &all_devs) {
dm_list_del(&devl->list); dm_list_del(&devl->list);

View File

@ -100,9 +100,9 @@ int lvmdiskscan(struct cmd_context *cmd, int argc __attribute__((unused)),
/* Call before using dev_iter which uses filters which want bcache data. */ /* Call before using dev_iter which uses filters which want bcache data. */
label_scan(cmd); label_scan(cmd);
max_len = _get_max_dev_name_len(cmd, cmd->full_filter); max_len = _get_max_dev_name_len(cmd, cmd->filter);
if (!(iter = dev_iter_create(cmd->full_filter, 0))) { if (!(iter = dev_iter_create(cmd->filter, 0))) {
log_error("dev_iter_create failed"); log_error("dev_iter_create failed");
return ECMD_FAILED; return ECMD_FAILED;
} }

View File

@ -539,7 +539,7 @@ static void _online_pvscan_all_devs(struct cmd_context *cmd,
label_scan(cmd); label_scan(cmd);
if (!(iter = dev_iter_create(cmd->full_filter, 1))) { if (!(iter = dev_iter_create(cmd->filter, 1))) {
log_error("dev_iter creation failed"); log_error("dev_iter creation failed");
return; return;
} }
@ -680,7 +680,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
while (argc--) { while (argc--) {
pv_name = *argv++; pv_name = *argv++;
if (pv_name[0] == '/') { if (pv_name[0] == '/') {
if (!(dev = dev_cache_get(cmd, pv_name, cmd->full_filter))) { if (!(dev = dev_cache_get(cmd, pv_name, cmd->filter))) {
log_debug("pvscan arg %s not found.", pv_name); log_debug("pvscan arg %s not found.", pv_name);
if ((dev = dev_cache_get(cmd, pv_name, NULL))) { if ((dev = dev_cache_get(cmd, pv_name, NULL))) {
/* nothing to do for this dev name */ /* nothing to do for this dev name */
@ -707,7 +707,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
} }
devno = MKDEV(major, minor); devno = MKDEV(major, minor);
if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->full_filter))) { if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->filter))) {
log_debug("pvscan arg %d:%d not found.", major, minor); log_debug("pvscan arg %d:%d not found.", major, minor);
_online_pvid_file_remove_devno(major, minor); _online_pvid_file_remove_devno(major, minor);
} else { } else {
@ -731,7 +731,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
} }
if (!dm_list_empty(&single_devs)) { if (!dm_list_empty(&single_devs)) {
label_scan_devs(cmd, cmd->full_filter, &single_devs); label_scan_devs(cmd, cmd->filter, &single_devs);
dm_list_iterate_items(devl, &single_devs) { dm_list_iterate_items(devl, &single_devs) {
dev = devl->dev; dev = devl->dev;
@ -763,7 +763,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
devno = MKDEV(major, minor); devno = MKDEV(major, minor);
if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->full_filter))) { if (!(dev = dev_cache_get_by_devt(cmd, devno, cmd->filter))) {
log_debug("pvscan arg %d:%d not found.", major, minor); log_debug("pvscan arg %d:%d not found.", major, minor);
_online_pvid_file_remove_devno(major, minor); _online_pvid_file_remove_devno(major, minor);
} else { } else {
@ -782,7 +782,7 @@ int pvscan_cache_cmd(struct cmd_context *cmd, int argc, char **argv)
} }
if (!dm_list_empty(&single_devs)) { if (!dm_list_empty(&single_devs)) {
label_scan_devs(cmd, cmd->full_filter, &single_devs); label_scan_devs(cmd, cmd->filter, &single_devs);
dm_list_iterate_items(devl, &single_devs) { dm_list_iterate_items(devl, &single_devs) {
dev = devl->dev; dev = devl->dev;

View File

@ -719,7 +719,7 @@ static void _check_pv_list(struct cmd_context *cmd, struct report_args *args, st
if (single_args->args_are_pvs && args->argc) { if (single_args->args_are_pvs && args->argc) {
for (i = 0; i < args->argc; i++) { for (i = 0; i < args->argc; i++) {
if (!rescan_done && !dev_cache_get(cmd, args->argv[i], cmd->full_filter)) { if (!rescan_done && !dev_cache_get(cmd, args->argv[i], cmd->filter)) {
cmd->filter->wipe(cmd->filter); cmd->filter->wipe(cmd->filter);
/* FIXME scan only one device */ /* FIXME scan only one device */
lvmcache_label_scan(cmd); lvmcache_label_scan(cmd);

View File

@ -1477,7 +1477,7 @@ int process_each_label(struct cmd_context *cmd, int argc, char **argv,
if (argc) { if (argc) {
for (; opt < argc; opt++) { for (; opt < argc; opt++) {
if (!(dev = dev_cache_get(cmd, argv[opt], cmd->full_filter))) { if (!(dev = dev_cache_get(cmd, argv[opt], cmd->filter))) {
log_error("Failed to find device " log_error("Failed to find device "
"\"%s\".", argv[opt]); "\"%s\".", argv[opt]);
ret_max = ECMD_FAILED; ret_max = ECMD_FAILED;
@ -1548,7 +1548,7 @@ int process_each_label(struct cmd_context *cmd, int argc, char **argv,
goto out; goto out;
} }
if (!(iter = dev_iter_create(cmd->full_filter, 1))) { if (!(iter = dev_iter_create(cmd->filter, 1))) {
log_error("dev_iter creation failed."); log_error("dev_iter creation failed.");
ret_max = ECMD_FAILED; ret_max = ECMD_FAILED;
goto out; goto out;
@ -3908,7 +3908,7 @@ static int _get_all_devices(struct cmd_context *cmd, struct dm_list *all_devices
log_debug("Getting list of all devices"); log_debug("Getting list of all devices");
if (!(iter = dev_iter_create(cmd->full_filter, 1))) { if (!(iter = dev_iter_create(cmd->filter, 1))) {
log_error("dev_iter creation failed."); log_error("dev_iter creation failed.");
return ECMD_FAILED; return ECMD_FAILED;
} }
@ -5412,7 +5412,7 @@ int pvcreate_each_device(struct cmd_context *cmd,
* Translate arg names into struct device's. * Translate arg names into struct device's.
*/ */
dm_list_iterate_items(pd, &pp->arg_devices) dm_list_iterate_items(pd, &pp->arg_devices)
pd->dev = dev_cache_get(cmd, pd->name, cmd->full_filter); pd->dev = dev_cache_get(cmd, pd->name, cmd->filter);
/* /*
* Use process_each_pv to search all existing PVs and devices. * Use process_each_pv to search all existing PVs and devices.