[PATCH 06/13] multipathd: add checker_finished()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 multipathd/main.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

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);
 		}
 
-- 
2.47.0





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux