diff mbox series

[06/13] multipathd: add checker_finished()

Message ID 20241206233617.382200-7-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: Benjamin Marzinski
Headers show
Series multipathd: More map reload handling, and checkerloop work | expand

Commit Message

Martin Wilck Dec. 6, 2024, 11:36 p.m. UTC
Move the code that handles the checker_state == CHECKER_FINISHED state
into a separate function for better readability. Subsequent patches will
add code to this function.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 multipathd/main.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/multipathd/main.c b/multipathd/main.c
index 5f16094..354fadf 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2978,6 +2978,20 @@  update_paths(struct vectors *vecs, int *num_paths_p, time_t start_secs)
 	return CHECKER_FINISHED;
 }
 
+static void checker_finished(struct vectors *vecs)
+{
+	struct multipath *mpp;
+	int i;
+
+	vector_foreach_slot(vecs->mpvec, mpp, i) {
+		if ((update_mpp_prio(mpp) ||
+		     (mpp->need_reload && mpp->synced_count > 0)) &&
+		    reload_and_sync_map(mpp, vecs) == 2)
+			/* multipath device deleted */
+			i--;
+	}
+}
+
 static void *
 checkerloop (void *ap)
 {
@@ -3050,15 +3064,8 @@  checkerloop (void *ap)
 			if (checker_state == CHECKER_UPDATING_PATHS)
 				checker_state = update_paths(vecs, &num_paths,
 							     start_time.tv_sec);
-			if (checker_state == CHECKER_FINISHED) {
-				vector_foreach_slot(vecs->mpvec, mpp, i) {
-					if ((update_mpp_prio(mpp) ||
-					     (mpp->need_reload && mpp->synced_count > 0)) &&
-					    reload_and_sync_map(mpp, vecs) == 2)
-						/* multipath device deleted */
-						i--;
-				}
-			}
+			if (checker_state == CHECKER_FINISHED)
+				checker_finished(vecs);
 			lock_cleanup_pop(vecs->lock);
 		}