[dm-devel] [PATCH 5/9] libmultipath: check the hwentry pctable for path variables

Benjamin Marzinski bmarzins at redhat.com
Tue Apr 12 01:59:55 UTC 2022


For the config values that exist in the proctol subsection of the device
configs, paths will now also check the pctable when checking a hwentry
for a value. Values in a matching pcentry will be used in preference to
values in that hwentry.

Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>
---
 libmultipath/propsel.c | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index d2d70090..762b7fcb 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -73,6 +73,8 @@ do {									\
 static const char default_origin[] = "(setting: multipath internal)";
 static const char hwe_origin[] =
 	"(setting: storage device configuration)";
+static const char hwe_pce_origin[] =
+	"(setting: storage device procotol section)";
 static const char multipaths_origin[] =
 	"(setting: multipath.conf multipaths section)";
 static const char conf_origin[] =
@@ -146,6 +148,28 @@ do {									\
 	}								\
 } while (0)
 
+#define pp_set_hwe_pce(var)						\
+do {									\
+	struct hwentry *_hwe;						\
+	struct pcentry *_pce;						\
+	int _i, _j;							\
+									\
+	vector_foreach_slot(pp->hwe, _hwe, _i) {			\
+		vector_foreach_slot(_hwe->pctable, _pce, _j) {		\
+			if (_pce->type == (int)bus_protocol_id(pp) && _pce->var) {	\
+				pp->var = _pce->var;			\
+				origin = hwe_pce_origin;		\
+				goto out;				\
+			}						\
+		}							\
+		if (_hwe->var) {					\
+			pp->var = _hwe->var;				\
+			origin = hwe_origin;				\
+			goto out;					\
+		}							\
+	}								\
+} while (0)
+
 int select_mode(struct config *conf, struct multipath *mp)
 {
 	const char *origin;
@@ -775,7 +799,7 @@ int select_fast_io_fail(struct config *conf, struct path *pp)
 	STRBUF_ON_STACK(buff);
 
 	pp_set_ovr(fast_io_fail);
-	pp_set_hwe(fast_io_fail);
+	pp_set_hwe_pce(fast_io_fail);
 	pp_set_conf(fast_io_fail);
 	pp_set_default(fast_io_fail, DEFAULT_FAST_IO_FAIL);
 out:
@@ -791,7 +815,7 @@ int select_dev_loss(struct config *conf, struct path *pp)
 	STRBUF_ON_STACK(buff);
 
 	pp_set_ovr(dev_loss);
-	pp_set_hwe(dev_loss);
+	pp_set_hwe_pce(dev_loss);
 	pp_set_conf(dev_loss);
 	pp->dev_loss = DEV_LOSS_TMO_UNSET;
 	return 0;
@@ -808,7 +832,7 @@ int select_eh_deadline(struct config *conf, struct path *pp)
 	STRBUF_ON_STACK(buff);
 
 	pp_set_ovr(eh_deadline);
-	pp_set_hwe(eh_deadline);
+	pp_set_hwe_pce(eh_deadline);
 	pp_set_conf(eh_deadline);
 	pp->eh_deadline = EH_DEADLINE_UNSET;
 	/* not changing sysfs in default cause, so don't print anything */
-- 
2.17.2



More information about the dm-devel mailing list