@@ -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);
}
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(-)