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

move the setting of use_full_md_check flag

from each command to one location in command init.
No functional change.
This commit is contained in:
David Teigland 2019-05-21 11:51:58 -05:00
parent 19ef399ea7
commit 6422b9ddc5
4 changed files with 18 additions and 9 deletions

View File

@ -2766,6 +2766,22 @@ static int _init_lvmlockd(struct cmd_context *cmd)
return 1; return 1;
} }
static void _init_md_checks(struct cmd_context *cmd)
{
/*
* use_full_md_check can also be set later.
* These commands are chosen to always perform
* a full md component check because they initialize
* a new device that could be an md component,
* and they are not run frequently during normal
* operation.
*/
if (!strcmp(cmd->name, "pvcreate") ||
!strcmp(cmd->name, "vgcreate") ||
!strcmp(cmd->name, "vgextend"))
cmd->use_full_md_check = 1;
}
static int _cmd_no_meta_proc(struct cmd_context *cmd) static int _cmd_no_meta_proc(struct cmd_context *cmd)
{ {
return cmd->cname->flags & NO_METADATA_PROCESSING; return cmd->cname->flags & NO_METADATA_PROCESSING;
@ -2979,6 +2995,8 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
} }
} }
_init_md_checks(cmd);
if (!_cmd_no_meta_proc(cmd) && !_init_lvmlockd(cmd)) { if (!_cmd_no_meta_proc(cmd) && !_init_lvmlockd(cmd)) {
ret = ECMD_FAILED; ret = ECMD_FAILED;
goto_out; goto_out;

View File

@ -136,9 +136,6 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
pp.pv_count = argc; pp.pv_count = argc;
pp.pv_names = argv; pp.pv_names = argv;
/* Check for old md signatures at the end of devices. */
cmd->use_full_md_check = 1;
/* Needed to change the set of orphan PVs. */ /* Needed to change the set of orphan PVs. */
if (!lock_global(cmd, "ex")) if (!lock_global(cmd, "ex"))
return_ECMD_FAILED; return_ECMD_FAILED;

View File

@ -63,9 +63,6 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
clear_hint_file(cmd); clear_hint_file(cmd);
/* Check for old md signatures at the end of devices. */
cmd->use_full_md_check = 1;
/* /*
* Check if the VG name already exists. This should be done before * Check if the VG name already exists. This should be done before
* creating PVs on any of the devices. * creating PVs on any of the devices.

View File

@ -154,9 +154,6 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
/* pvcreate within vgextend cannot be forced. */ /* pvcreate within vgextend cannot be forced. */
pp->force = 0; pp->force = 0;
/* Check for old md signatures at the end of devices. */
cmd->use_full_md_check = 1;
if (!lock_global(cmd, "ex")) if (!lock_global(cmd, "ex"))
return_ECMD_FAILED; return_ECMD_FAILED;