All of lore.kernel.org
 help / color / mirror / Atom feed
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 17/26] libmultipath: use 'struct config' as argument for pathinfo()
Date: Mon,  4 Jul 2016 09:08:37 +0200	[thread overview]
Message-ID: <1467616126-10036-18-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1467616126-10036-1-git-send-email-hare@suse.de>

pathinfo() requires access to the entire configuration, not just
hwtable. So don't pretend this is the case.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 libmpathpersist/mpath_persist.c |  6 +++---
 libmultipath/configure.c        |  8 ++++----
 libmultipath/discovery.c        | 24 ++++++++++++------------
 libmultipath/discovery.h        |  8 ++++----
 libmultipath/structs_vec.c      |  2 +-
 multipath/main.c                |  6 +++---
 multipathd/cli_handlers.c       |  2 +-
 multipathd/main.c               | 16 ++++++++--------
 8 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index dc11d4f..d557da3 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -94,16 +94,16 @@ updatepaths (struct multipath * mpp)
 					continue;
 				}
 				pp->mpp = mpp;
-				pathinfo(pp, conf->hwtable, DI_ALL);
+				pathinfo(pp, conf, DI_ALL);
 				continue;
 			}
 			pp->mpp = mpp;
 			if (pp->state == PATH_UNCHECKED ||
 					pp->state == PATH_WILD)
-				pathinfo(pp, conf->hwtable, DI_CHECKER);
+				pathinfo(pp, conf, DI_CHECKER);
 
 			if (pp->priority == PRIO_UNDEF)
-				pathinfo(pp, conf->hwtable, DI_PRIO);
+				pathinfo(pp, conf, DI_PRIO);
 		}
 	}
 	return 0;
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 54fcde2..53d89b0 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -959,7 +959,7 @@ get_refwwid (enum mpath_cmds cmd, char * dev, enum devtypes dev_type,
 				condlog(2, "%s: can't get udev device", buff);
 				return 1;
 			}
-			ret = store_pathinfo(pathvec, conf->hwtable, udevice,
+			ret = store_pathinfo(pathvec, conf, udevice,
 					     flags, &pp);
 			udev_device_unref(udevice);
 			if (!pp) {
@@ -991,7 +991,7 @@ get_refwwid (enum mpath_cmds cmd, char * dev, enum devtypes dev_type,
 				condlog(2, "%s: can't get udev device", dev);
 				return 1;
 			}
-			ret = store_pathinfo(pathvec, conf->hwtable, udevice,
+			ret = store_pathinfo(pathvec, conf, udevice,
 					     flags, &pp);
 			udev_device_unref(udevice);
 			if (!pp) {
@@ -1016,7 +1016,7 @@ get_refwwid (enum mpath_cmds cmd, char * dev, enum devtypes dev_type,
 			condlog(2, "%s: can't get udev device", dev);
 			return 1;
 		}
-		ret = store_pathinfo(pathvec, conf->hwtable, udevice,
+		ret = store_pathinfo(pathvec, conf, udevice,
 				     flags, &pp);
 		udev_device_unref(udevice);
 		if (!pp) {
@@ -1085,7 +1085,7 @@ extern int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh,
 	update_mpp_paths(mpp, vecs->pathvec);
 	if (refresh) {
 		vector_foreach_slot (mpp->paths, pp, i) {
-			r = pathinfo(pp, conf->hwtable, DI_PRIO);
+			r = pathinfo(pp, conf, DI_PRIO);
 			if (r) {
 				condlog(2, "%s: failed to refresh pathinfo",
 					mpp->alias);
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index e598337..ffd26a6 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -32,7 +32,7 @@
 #include "defaults.h"
 
 int
-alloc_path_with_pathinfo (vector hwtable, struct udev_device *udevice,
+alloc_path_with_pathinfo (struct config *conf, struct udev_device *udevice,
 			  int flag, struct path **pp_ptr)
 {
 	int err = PATHINFO_FAILED;
@@ -55,7 +55,7 @@ alloc_path_with_pathinfo (vector hwtable, struct udev_device *udevice,
 		condlog(0, "pp->dev too small");
 	} else {
 		pp->udev = udev_device_ref(udevice);
-		err = pathinfo(pp, hwtable, flag | DI_BLACKLIST);
+		err = pathinfo(pp, conf, flag | DI_BLACKLIST);
 	}
 
 	if (err)
@@ -66,8 +66,8 @@ alloc_path_with_pathinfo (vector hwtable, struct udev_device *udevice,
 }
 
 int
-store_pathinfo (vector pathvec, vector hwtable, struct udev_device *udevice,
-		int flag, struct path **pp_ptr)
+store_pathinfo (vector pathvec, struct config *conf,
+		struct udev_device *udevice, int flag, struct path **pp_ptr)
 {
 	int err = PATHINFO_FAILED;
 	struct path * pp;
@@ -90,7 +90,7 @@ store_pathinfo (vector pathvec, vector hwtable, struct udev_device *udevice,
 		goto out;
 	}
 	pp->udev = udev_device_ref(udevice);
-	err = pathinfo(pp, hwtable, flag);
+	err = pathinfo(pp, conf, flag);
 	if (err)
 		goto out;
 
@@ -126,10 +126,10 @@ path_discover (vector pathvec, struct config * conf,
 
 	pp = find_path_by_dev(pathvec, (char *)devname);
 	if (!pp) {
-		return store_pathinfo(pathvec, conf->hwtable,
+		return store_pathinfo(pathvec, conf,
 				      udevice, flag, NULL);
 	}
-	return pathinfo(pp, conf->hwtable, flag);
+	return pathinfo(pp, conf, flag);
 }
 
 int
@@ -1397,7 +1397,7 @@ cciss_ioctl_pathinfo (struct path * pp, int mask)
 }
 
 int
-get_state (struct path * pp, vector hwtable, int daemon)
+get_state (struct path * pp, struct config *conf, int daemon)
 {
 	struct checker * c = &pp->checker;
 	int state;
@@ -1406,7 +1406,7 @@ get_state (struct path * pp, vector hwtable, int daemon)
 
 	if (!checker_selected(c)) {
 		if (daemon) {
-			if (pathinfo(pp, hwtable, DI_SYSFS) != PATHINFO_OK) {
+			if (pathinfo(pp, conf, DI_SYSFS) != PATHINFO_OK) {
 				condlog(3, "%s: couldn't get sysfs pathinfo",
 					pp->dev);
 				return PATH_UNCHECKED;
@@ -1588,7 +1588,7 @@ get_uid (struct path * pp, int path_state)
 }
 
 extern int
-pathinfo (struct path *pp, vector hwtable, int mask)
+pathinfo (struct path *pp, struct config *conf, int mask)
 {
 	int path_state;
 
@@ -1610,7 +1610,7 @@ pathinfo (struct path *pp, vector hwtable, int mask)
 	/*
 	 * fetch info available in sysfs
 	 */
-	if (mask & DI_SYSFS && sysfs_pathinfo(pp, hwtable))
+	if (mask & DI_SYSFS && sysfs_pathinfo(pp, conf->hwtable))
 		return PATHINFO_FAILED;
 
 	if (mask & DI_BLACKLIST && mask & DI_SYSFS) {
@@ -1649,7 +1649,7 @@ pathinfo (struct path *pp, vector hwtable, int mask)
 
 	if (mask & DI_CHECKER) {
 		if (path_state == PATH_UP) {
-			pp->chkrstate = pp->state = get_state(pp, hwtable, 0);
+			pp->chkrstate = pp->state = get_state(pp, conf, 0);
 			if (pp->state == PATH_UNCHECKED ||
 			    pp->state == PATH_WILD)
 				goto blank;
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index 2619015..fca9637 100644
--- a/libmultipath/discovery.h
+++ b/libmultipath/discovery.h
@@ -34,11 +34,11 @@ int path_discovery (vector pathvec, struct config * conf, int flag);
 
 int do_tur (char *);
 int path_offline (struct path *);
-int get_state (struct path * pp, vector hwtable, int daemon);
-int pathinfo (struct path *, vector hwtable, int mask);
-int alloc_path_with_pathinfo (vector hwtable, struct udev_device *udevice,
+int get_state (struct path * pp, struct config * conf, int daemon);
+int pathinfo (struct path * pp, struct config * conf, int mask);
+int alloc_path_with_pathinfo (struct config *conf, struct udev_device *udevice,
 			      int flag, struct path **pp_ptr);
-int store_pathinfo (vector pathvec, vector hwtable,
+int store_pathinfo (vector pathvec, struct config *conf,
 		    struct udev_device *udevice, int flag,
 		    struct path **pp_ptr);
 int sysfs_set_scsi_tmo (struct multipath *mpp, int checkint);
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 8ddc292..dee6447 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -69,7 +69,7 @@ adopt_paths (vector pathvec, struct multipath * mpp)
 			if (!find_path_by_dev(mpp->paths, pp->dev) &&
 			    store_path(mpp->paths, pp))
 					return 1;
-			if (pathinfo(pp, conf->hwtable,
+			if (pathinfo(pp, conf,
 				     DI_PRIO | DI_CHECKER))
 				return 1;
 		}
diff --git a/multipath/main.c b/multipath/main.c
index df6a7ca..ca4c1f5 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -156,19 +156,19 @@ update_paths (struct multipath * mpp)
 					continue;
 				}
 				pp->mpp = mpp;
-				if (pathinfo(pp, conf->hwtable, DI_ALL))
+				if (pathinfo(pp, conf, DI_ALL))
 					pp->state = PATH_UNCHECKED;
 				continue;
 			}
 			pp->mpp = mpp;
 			if (pp->state == PATH_UNCHECKED ||
 			    pp->state == PATH_WILD) {
-				if (pathinfo(pp, conf->hwtable, DI_CHECKER))
+				if (pathinfo(pp, conf, DI_CHECKER))
 					pp->state = PATH_UNCHECKED;
 			}
 
 			if (pp->priority == PRIO_UNDEF) {
-				if (pathinfo(pp, conf->hwtable, DI_PRIO))
+				if (pathinfo(pp, conf, DI_PRIO))
 					pp->priority = PRIO_UNDEF;
 			}
 		}
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index c8c712a..90259ae 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -640,7 +640,7 @@ cli_add_path (void * v, char ** reply, int * len, void * data)
 		udevice = udev_device_new_from_subsystem_sysname(udev,
 								 "block",
 								 param);
-		r = store_pathinfo(vecs->pathvec, conf->hwtable,
+		r = store_pathinfo(vecs->pathvec, conf,
 				   udevice, DI_ALL, &pp);
 		udev_device_unref(udevice);
 		if (!pp) {
diff --git a/multipathd/main.c b/multipathd/main.c
index fe80d1a..61ef2e6 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -213,7 +213,7 @@ need_switch_pathgroup (struct multipath * mpp, int refresh)
 	if (refresh)
 		vector_foreach_slot (mpp->pg, pgp, i)
 			vector_foreach_slot (pgp->paths, pp, j)
-				pathinfo(pp, conf->hwtable, DI_PRIO);
+				pathinfo(pp, conf, DI_PRIO);
 
 	if (!mpp->pg || VECTOR_SIZE(mpp->paths) == 0)
 		return 0;
@@ -590,7 +590,7 @@ uev_add_path (struct uevent *uev, struct vectors * vecs)
 			condlog(3, "%s: reinitialize path", uev->kernel);
 			udev_device_unref(pp->udev);
 			pp->udev = udev_device_ref(uev->udev);
-			r = pathinfo(pp, conf->hwtable,
+			r = pathinfo(pp, conf,
 				     DI_ALL | DI_BLACKLIST);
 			if (r == PATHINFO_OK)
 				ret = ev_add_path(pp, vecs);
@@ -615,7 +615,7 @@ uev_add_path (struct uevent *uev, struct vectors * vecs)
 	/*
 	 * get path vital state
 	 */
-	ret = alloc_path_with_pathinfo(conf->hwtable, uev->udev,
+	ret = alloc_path_with_pathinfo(conf, uev->udev,
 				       DI_ALL, &pp);
 	if (!pp) {
 		if (ret == PATHINFO_SKIPPED)
@@ -1344,7 +1344,7 @@ int update_prio(struct path *pp, int refresh_all)
 		vector_foreach_slot (pp->mpp->pg, pgp, i) {
 			vector_foreach_slot (pgp->paths, pp1, j) {
 				oldpriority = pp1->priority;
-				pathinfo(pp1, conf->hwtable, DI_PRIO);
+				pathinfo(pp1, conf, DI_PRIO);
 				if (pp1->priority != oldpriority)
 					changed = 1;
 			}
@@ -1352,7 +1352,7 @@ int update_prio(struct path *pp, int refresh_all)
 		return changed;
 	}
 	oldpriority = pp->priority;
-	pathinfo(pp, conf->hwtable, DI_PRIO);
+	pathinfo(pp, conf, DI_PRIO);
 
 	if (pp->priority == oldpriority)
 		return 0;
@@ -1421,20 +1421,20 @@ check_path (struct vectors * vecs, struct path * pp, int ticks)
 		newstate = PATH_DOWN;
 
 	if (newstate == PATH_UP)
-		newstate = get_state(pp, conf->hwtable, 1);
+		newstate = get_state(pp, conf, 1);
 	else
 		checker_clear_message(&pp->checker);
 
 	if (newstate == PATH_WILD || newstate == PATH_UNCHECKED) {
 		condlog(2, "%s: unusable path", pp->dev);
-		pathinfo(pp, conf->hwtable, 0);
+		pathinfo(pp, conf, 0);
 		return 1;
 	}
 	if (!pp->mpp) {
 		if (!strlen(pp->wwid) && pp->initialized != INIT_MISSING_UDEV &&
 		    (newstate == PATH_UP || newstate == PATH_GHOST)) {
 			condlog(2, "%s: add missing path", pp->dev);
-			if (pathinfo(pp, conf->hwtable, DI_ALL) == 0) {
+			if (pathinfo(pp, conf, DI_ALL) == 0) {
 				ev_add_path(pp, vecs);
 				pp->tick = 1;
 			}
-- 
2.6.6

  parent reply	other threads:[~2016-07-04  7:08 UTC|newest]

Thread overview: 31+ 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 ` [PATCH 09/26] libmultipath: add 'cmd' as argument for get_refwwid() Hannes Reinecke
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 ` Hannes Reinecke [this message]
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:09 ` [PATCH 17/26] libmultipath: use 'struct config' as argument for pathinfo() Hannes Reinecke
2016-07-01 20:25   ` Benjamin Marzinski
2016-07-04  5:49     ` 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-18-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.