[dm-devel] [PATCH v2 1/5] multipathd: move set_no_path_retry() back to libmultipath

Martin Wilck Martin.Wilck at suse.com
Wed Nov 20 12:55:01 UTC 2019


From: Martin Wilck <mwilck at suse.com>

This function is useful elsewhere, too. No code changes except
for changing the linkage.

Reviewed-by: Benjamin Marzinski <bmarzins at redhat.com>
Signed-off-by: Martin Wilck <mwilck at suse.com>
---
 libmultipath/structs_vec.c | 30 ++++++++++++++++++++++++++++++
 libmultipath/structs_vec.h |  1 +
 multipathd/main.c          | 30 ------------------------------
 3 files changed, 31 insertions(+), 30 deletions(-)

diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 6991f9ac..fbe97662 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -308,6 +308,36 @@ void enter_recovery_mode(struct multipath *mpp)
 		mpp->alias, mpp->no_path_retry);
 }
 
+void set_no_path_retry(struct multipath *mpp)
+{
+	char is_queueing = 0;
+
+	mpp->nr_active = pathcount(mpp, PATH_UP) + pathcount(mpp, PATH_GHOST);
+	if (mpp->features && strstr(mpp->features, "queue_if_no_path"))
+		is_queueing = 1;
+
+	switch (mpp->no_path_retry) {
+	case NO_PATH_RETRY_UNDEF:
+		break;
+	case NO_PATH_RETRY_FAIL:
+		if (is_queueing)
+			dm_queue_if_no_path(mpp->alias, 0);
+		break;
+	case NO_PATH_RETRY_QUEUE:
+		if (!is_queueing)
+			dm_queue_if_no_path(mpp->alias, 1);
+		break;
+	default:
+		if (mpp->nr_active > 0) {
+			mpp->retry_tick = 0;
+			if (!is_queueing)
+				dm_queue_if_no_path(mpp->alias, 1);
+		} else if (is_queueing && mpp->retry_tick == 0)
+			enter_recovery_mode(mpp);
+		break;
+	}
+}
+
 void
 sync_map_state(struct multipath *mpp)
 {
diff --git a/libmultipath/structs_vec.h b/libmultipath/structs_vec.h
index f8b9f63e..d3219278 100644
--- a/libmultipath/structs_vec.h
+++ b/libmultipath/structs_vec.h
@@ -11,6 +11,7 @@ struct vectors {
 	vector mpvec;
 };
 
+void set_no_path_retry(struct multipath *mpp);
 void enter_recovery_mode(struct multipath *mpp);
 
 int adopt_paths (vector pathvec, struct multipath * mpp);
diff --git a/multipathd/main.c b/multipathd/main.c
index bb5c1f1d..a21d96e4 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -409,36 +409,6 @@ set_multipath_wwid (struct multipath * mpp)
 	dm_get_uuid(mpp->alias, mpp->wwid, WWID_SIZE);
 }
 
-static void set_no_path_retry(struct multipath *mpp)
-{
-	char is_queueing = 0;
-
-	mpp->nr_active = pathcount(mpp, PATH_UP) + pathcount(mpp, PATH_GHOST);
-	if (mpp->features && strstr(mpp->features, "queue_if_no_path"))
-		is_queueing = 1;
-
-	switch (mpp->no_path_retry) {
-	case NO_PATH_RETRY_UNDEF:
-		break;
-	case NO_PATH_RETRY_FAIL:
-		if (is_queueing)
-			dm_queue_if_no_path(mpp->alias, 0);
-		break;
-	case NO_PATH_RETRY_QUEUE:
-		if (!is_queueing)
-			dm_queue_if_no_path(mpp->alias, 1);
-		break;
-	default:
-		if (mpp->nr_active > 0) {
-			mpp->retry_tick = 0;
-			if (!is_queueing)
-				dm_queue_if_no_path(mpp->alias, 1);
-		} else if (is_queueing && mpp->retry_tick == 0)
-			enter_recovery_mode(mpp);
-		break;
-	}
-}
-
 int __setup_multipath(struct vectors *vecs, struct multipath *mpp,
 		      int reset)
 {
-- 
2.24.0





More information about the dm-devel mailing list