From: Hannes Reinecke <hare@suse.de>
To: Christophe Varoqui <christophe.varoqui@gmail.com>
Cc: Hannes Reinecke <hare@suse.com>, dm-devel@redhat.com
Subject: [PATCH 09/26] libmultipath: add 'cmd' as argument for get_refwwid()
Date: Mon, 4 Jul 2016 09:08:29 +0200 [thread overview]
Message-ID: <1467616126-10036-10-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1467616126-10036-1-git-send-email-hare@suse.de>
This patch adds an 'cmd' argument to get_refwwid(). This allows
store_pathvec() to be simplified and avoids accesses to conf->cmd.
Signed-off-by: Hannes Reinecke <hare@suse.com>
---
libmultipath/configure.c | 13 +++++++++----
libmultipath/configure.h | 3 ++-
libmultipath/discovery.c | 4 +---
multipath/main.c | 4 ++--
multipathd/cli_handlers.c | 4 ++--
multipathd/main.c | 2 +-
6 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index a111f6e..ab53af2 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -925,12 +925,14 @@ coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, int force_r
* 2 - blacklist
*/
extern int
-get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid)
+get_refwwid (enum mpath_cmds cmd, char * dev, enum devtypes dev_type,
+ vector pathvec, char **wwid)
{
int ret = 1;
struct path * pp;
char buff[FILE_NAME_SIZE];
char * refwwid = NULL, tmpwwid[WWID_SIZE];
+ int flags = DI_SYSFS | DI_WWID;
if (!wwid)
return 1;
@@ -939,6 +941,9 @@ get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid)
if (dev_type == DEV_NONE)
return 1;
+ if (cmd != CMD_REMOVE_WWID)
+ flags |= DI_BLACKLIST;
+
if (dev_type == DEV_DEVNODE) {
if (basenamecpy(dev, buff, FILE_NAME_SIZE) == 0) {
condlog(1, "basename failed for '%s' (%s)",
@@ -955,7 +960,7 @@ get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid)
return 1;
}
ret = store_pathinfo(pathvec, conf->hwtable, udevice,
- DI_SYSFS | DI_WWID, &pp);
+ flags, &pp);
udev_device_unref(udevice);
if (!pp) {
if (ret == 1)
@@ -987,7 +992,7 @@ get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid)
return 1;
}
ret = store_pathinfo(pathvec, conf->hwtable, udevice,
- DI_SYSFS | DI_WWID, &pp);
+ flags, &pp);
udev_device_unref(udevice);
if (!pp) {
if (ret == 1)
@@ -1012,7 +1017,7 @@ get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid)
return 1;
}
ret = store_pathinfo(pathvec, conf->hwtable, udevice,
- DI_SYSFS | DI_WWID, &pp);
+ flags, &pp);
udev_device_unref(udevice);
if (!pp) {
if (ret == 1)
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
index 8d474ea..442c956 100644
--- a/libmultipath/configure.h
+++ b/libmultipath/configure.h
@@ -29,6 +29,7 @@ int setup_map (struct multipath * mpp, char * params, int params_size );
int domap (struct multipath * mpp, char * params, int is_daemon);
int reinstate_paths (struct multipath *mpp);
int coalesce_paths (struct vectors *vecs, vector curmp, char * refwwid, int force_reload, enum mpath_cmds cmd);
-int get_refwwid (char * dev, enum devtypes dev_type, vector pathvec, char **wwid);
+int get_refwwid (enum mpath_cmds cmd, char * dev, enum devtypes dev_type,
+ vector pathvec, char **wwid);
int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh, int is_daemon);
int sysfs_get_host_adapter_name(struct path *pp, char *adapter_name);
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 126a54f..6fc2e8f 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -90,9 +90,7 @@ store_pathinfo (vector pathvec, vector hwtable, struct udev_device *udevice,
goto out;
}
pp->udev = udev_device_ref(udevice);
- err = pathinfo(pp, hwtable,
- (conf->cmd == CMD_REMOVE_WWID)? flag :
- (flag | DI_BLACKLIST));
+ err = pathinfo(pp, hwtable, flag);
if (err)
goto out;
diff --git a/multipath/main.c b/multipath/main.c
index e16c6cc..bf2fd31 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -281,8 +281,8 @@ configure (void)
* failing the translation is fatal (by policy)
*/
if (conf->dev) {
- int failed = get_refwwid(conf->dev, conf->dev_type, pathvec,
- &refwwid);
+ int failed = get_refwwid(conf->cmd, conf->dev, conf->dev_type,
+ pathvec, &refwwid);
if (!refwwid) {
condlog(4, "%s: failed to get wwid", conf->dev);
if (failed == 2 && conf->cmd == CMD_VALID_PATH)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index eaeaa74..05dcb41 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -708,8 +708,8 @@ cli_add_map (void * v, char ** reply, int * len, void * data)
if (!alias && !count) {
condlog(2, "%s: mapname not found for %d:%d",
param, major, minor);
- rc = get_refwwid(param, DEV_DEVMAP, vecs->pathvec,
- &refwwid);
+ rc = get_refwwid(CMD_NONE, param, DEV_DEVMAP,
+ vecs->pathvec, &refwwid);
if (refwwid) {
if (coalesce_paths(vecs, NULL, refwwid, 0, 1))
condlog(2, "%s: coalesce_paths failed",
diff --git a/multipathd/main.c b/multipathd/main.c
index 036872c..6230798 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -484,7 +484,7 @@ ev_add_map (char * dev, char * alias, struct vectors * vecs)
return 1;
}
}
- r = get_refwwid(dev, DEV_DEVMAP, vecs->pathvec, &refwwid);
+ r = get_refwwid(CMD_NONE, dev, DEV_DEVMAP, vecs->pathvec, &refwwid);
if (refwwid) {
r = coalesce_paths(vecs, NULL, refwwid, 0, CMD_NONE);
--
2.6.6
next prev parent reply other threads:[~2016-07-04 7:08 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-04 7:08 [PATCHv2 00/26] Userspace-RCU for config accesses Hannes Reinecke
2016-07-04 7:08 ` [PATCH 01/26] Revert patch 'move filter_devnode() under vector lock' Hannes Reinecke
2016-07-04 7:08 ` [PATCH 02/26] Use 'mptable' as argument for find_mpe() and get_mpe_wwid() Hannes Reinecke
2016-07-04 7:08 ` [PATCH 03/26] config: set 'deferred_remove' defaults at correct call Hannes Reinecke
2016-07-04 7:08 ` [PATCH 04/26] devmapper: explicit config settings Hannes Reinecke
2016-07-04 7:08 ` [PATCH 05/26] dmparser: use 'is_daemon' as argument for disassemble_map() Hannes Reinecke
2016-07-04 7:08 ` [PATCH 06/26] libmultipath: use 'is_daemon' as argument for domap() etc Hannes Reinecke
2016-07-04 7:08 ` [PATCH 07/26] libmultipath: drop 'daemon' configuration setting Hannes Reinecke
2016-07-04 7:08 ` [PATCH 08/26] libmultipath: Do not access 'conf->cmd' in domap() Hannes Reinecke
2016-07-04 7:08 ` Hannes Reinecke [this message]
2016-07-04 7:08 ` [PATCH 10/26] libmultipath: fallback to checking environment variable in get_udev_uid() Hannes Reinecke
2016-07-04 7:08 ` [PATCH 11/26] multipath: make 'cmd' internal to multipath program Hannes Reinecke
2016-07-04 7:08 ` [PATCH 12/26] multipath: make 'dev_type' internal to the " Hannes Reinecke
2016-07-04 7:08 ` [PATCH 13/26] multipath: make 'dev' " Hannes Reinecke
2016-07-04 7:08 ` [PATCH 14/26] libmultipath: separate out 'udev' config entry Hannes Reinecke
2016-07-04 7:08 ` [PATCH 15/26] libmultipath: use 'checkint' as argument for sysfs_set_scsi_tmo() Hannes Reinecke
2016-07-04 7:08 ` [PATCH 16/26] discovery: Pass in 'hwtable' for get_state() and scsi_sysfs_discovery() Hannes Reinecke
2016-07-04 7:08 ` [PATCH 17/26] libmultipath: use 'struct config' as argument for pathinfo() Hannes Reinecke
2016-07-04 7:08 ` [PATCH 18/26] checkers: use 'multipath_dir' as argument Hannes Reinecke
2016-07-04 7:08 ` [PATCH 19/26] prio: " Hannes Reinecke
2016-07-04 7:08 ` [PATCH 20/26] libmultipath: use 'timeout' as argument for getprio() Hannes Reinecke
2016-07-04 7:08 ` [PATCH 21/26] libmultipath: use explicit 'config' argument for configuration file parsing Hannes Reinecke
2016-07-04 7:08 ` [PATCH 22/26] libmultipath: use (get, put)_multipath_config() accessors Hannes Reinecke
2016-07-04 7:08 ` [PATCH 23/26] multipathd: Fixup commandline argument handling Hannes Reinecke
2016-07-04 7:08 ` [PATCH 24/26] multipath: make 'struct config' a local variable Hannes Reinecke
2016-07-04 7:08 ` [PATCH 25/26] multipathd: use userspace RCU to access configuration Hannes Reinecke
2016-07-04 7:08 ` [PATCH 26/26] libmultipath: Allocate keywords directly Hannes Reinecke
2016-07-08 5:53 ` [PATCHv2 00/26] Userspace-RCU for config accesses Christophe Varoqui
-- strict thread matches above, loose matches on Subject: below --
2016-06-20 8:08 [PATCH " Hannes Reinecke
2016-06-20 8:08 ` [PATCH 09/26] libmultipath: add 'cmd' as argument for get_refwwid() Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1467616126-10036-10-git-send-email-hare@suse.de \
--to=hare@suse.de \
--cc=christophe.varoqui@gmail.com \
--cc=dm-devel@redhat.com \
--cc=hare@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).