[dm-devel] [PATCH 2/3] libmultipath: simplify out __set_no_path_retry()

Benjamin Marzinski bmarzins at redhat.com
Thu Dec 23 01:32:34 UTC 2021


The only caller of __set_no_path_retry() is set_no_path_retry(), so
remove the define and the unneeded arguments from the function.

Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>
---
 libmultipath/libmultipath.version |  2 +-
 libmultipath/structs_vec.c        | 11 +++++------
 libmultipath/structs_vec.h        |  3 +--
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version
index 7cdce9fc..2d0c9f26 100644
--- a/libmultipath/libmultipath.version
+++ b/libmultipath/libmultipath.version
@@ -176,7 +176,7 @@ global:
 	select_reservation_key;
 	send_packet;
 	set_max_fds;
-	__set_no_path_retry;
+	set_no_path_retry;
 	set_path_removed;
 	set_prkey;
 	setup_map;
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index cb0ebae6..f1031f61 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -588,23 +588,22 @@ static void leave_recovery_mode(struct multipath *mpp)
 	}
 }
 
-void __set_no_path_retry(struct multipath *mpp, bool check_features)
+void set_no_path_retry(struct multipath *mpp)
 {
 	bool is_queueing = false; /* assign a value to make gcc happy */
 
-	check_features = check_features && mpp->features != NULL;
-	if (check_features)
+	if (mpp->features)
 		is_queueing = strstr(mpp->features, "queue_if_no_path");
 
 	switch (mpp->no_path_retry) {
 	case NO_PATH_RETRY_UNDEF:
 		break;
 	case NO_PATH_RETRY_FAIL:
-		if (!check_features || is_queueing)
+		if (!mpp->features || is_queueing)
 			dm_queue_if_no_path(mpp->alias, 0);
 		break;
 	case NO_PATH_RETRY_QUEUE:
-		if (!check_features || !is_queueing)
+		if (!mpp->features || !is_queueing)
 			dm_queue_if_no_path(mpp->alias, 1);
 		break;
 	default:
@@ -613,7 +612,7 @@ void __set_no_path_retry(struct multipath *mpp, bool check_features)
 			 * If in_recovery is set, leave_recovery_mode() takes
 			 * care of dm_queue_if_no_path. Otherwise, do it here.
 			 */
-			if ((!check_features || !is_queueing) &&
+			if ((!mpp->features || !is_queueing) &&
 			    !mpp->in_recovery)
 				dm_queue_if_no_path(mpp->alias, 1);
 			leave_recovery_mode(mpp);
diff --git a/libmultipath/structs_vec.h b/libmultipath/structs_vec.h
index d33fe984..3253f1bb 100644
--- a/libmultipath/structs_vec.h
+++ b/libmultipath/structs_vec.h
@@ -11,8 +11,7 @@ struct vectors {
 	struct mutex_lock lock; /* defined in lock.h */
 };
 
-void __set_no_path_retry(struct multipath *mpp, bool check_features);
-#define set_no_path_retry(mpp) __set_no_path_retry(mpp, true)
+void set_no_path_retry(struct multipath *mpp);
 
 int adopt_paths (vector pathvec, struct multipath * mpp);
 void orphan_path (struct path * pp, const char *reason);
-- 
2.17.2




More information about the dm-devel mailing list