diff options
author | David Teigland <teigland@redhat.com> | 2019-05-21 11:51:58 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2019-05-21 11:51:58 -0500 |
commit | 6422b9ddc5c46968e2bef6ced12cd38e0b44c49d (patch) | |
tree | 4e9b6731e7ff55dd4649a482010523c4cf70133b | |
parent | 19ef399ea781c2c74d0bc8de92f673648d190016 (diff) | |
download | lvm2-6422b9ddc5c46968e2bef6ced12cd38e0b44c49d.tar.gz |
move the setting of use_full_md_check flag
from each command to one location in command init.
No functional change.
-rw-r--r-- | tools/lvmcmdline.c | 18 | ||||
-rw-r--r-- | tools/pvcreate.c | 3 | ||||
-rw-r--r-- | tools/vgcreate.c | 3 | ||||
-rw-r--r-- | tools/vgextend.c | 3 |
4 files changed, 18 insertions, 9 deletions
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 04226132a..79de85bfb 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -2766,6 +2766,22 @@ static int _init_lvmlockd(struct cmd_context *cmd) 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) { 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)) { ret = ECMD_FAILED; goto_out; diff --git a/tools/pvcreate.c b/tools/pvcreate.c index 5b59a79b5..29ae0fa2e 100644 --- a/tools/pvcreate.c +++ b/tools/pvcreate.c @@ -136,9 +136,6 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv) pp.pv_count = argc; 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. */ if (!lock_global(cmd, "ex")) return_ECMD_FAILED; diff --git a/tools/vgcreate.c b/tools/vgcreate.c index 626cf1558..6640b8eeb 100644 --- a/tools/vgcreate.c +++ b/tools/vgcreate.c @@ -63,9 +63,6 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv) 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 * creating PVs on any of the devices. diff --git a/tools/vgextend.c b/tools/vgextend.c index 785be3fa3..e50a8182d 100644 --- a/tools/vgextend.c +++ b/tools/vgextend.c @@ -154,9 +154,6 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv) /* pvcreate within vgextend cannot be forced. */ pp->force = 0; - /* Check for old md signatures at the end of devices. */ - cmd->use_full_md_check = 1; - if (!lock_global(cmd, "ex")) return_ECMD_FAILED; |