Whamcloud - gitweb
LU-10467 lustre: convert most users of LWI_TIMEOUT_INTERVAL()
[fs/lustre-release.git] / lustre / lfsck / lfsck_engine.c
index a1763a6..914ad83 100644 (file)
@@ -634,7 +634,6 @@ static int lfsck_double_scan(const struct lu_env *env,
 {
        struct lfsck_component *com;
        struct lfsck_component *next;
-       struct l_wait_info      lwi = { 0 };
        int                     rc  = 0;
        int                     rc1 = 0;
 
@@ -644,9 +643,8 @@ static int lfsck_double_scan(const struct lu_env *env,
                        rc1 = rc;
        }
 
-       l_wait_event(lfsck->li_thread.t_ctl_waitq,
-                    atomic_read(&lfsck->li_double_scan_count) == 0,
-                    &lwi);
+       wait_event_idle(lfsck->li_thread.t_ctl_waitq,
+                       atomic_read(&lfsck->li_double_scan_count) == 0);
 
        if (lfsck->li_status != LS_PAUSED &&
            lfsck->li_status != LS_CO_PAUSED) {
@@ -1026,7 +1024,6 @@ int lfsck_master_engine(void *args)
        struct dt_object         *oit_obj  = lfsck->li_obj_oit;
        const struct dt_it_ops   *oit_iops = &oit_obj->do_index_ops->dio_it;
        struct dt_it             *oit_di;
-       struct l_wait_info        lwi      = { 0 };
        int                       rc;
        ENTRY;
 
@@ -1086,10 +1083,9 @@ int lfsck_master_engine(void *args)
        spin_unlock(&lfsck->li_lock);
        wake_up_all(&thread->t_ctl_waitq);
 
-       l_wait_event(thread->t_ctl_waitq,
-                    lfsck->li_start_unplug ||
-                    !thread_is_running(thread),
-                    &lwi);
+       wait_event_idle(thread->t_ctl_waitq,
+                       lfsck->li_start_unplug ||
+                       !thread_is_running(thread));
        if (!thread_is_running(thread))
                GOTO(fini_oit, rc = 0);
 
@@ -1715,6 +1711,8 @@ int lfsck_assistant_engine(void *args)
                                GOTO(cleanup, rc = 0);
 
                        while (test_bit(LAD_IN_DOUBLE_SCAN, &lad->lad_flags)) {
+                               int seconds = 30;
+
                                rc = lfsck_assistant_query_others(env, com);
                                if (lfsck_phase2_next_ready(lad))
                                        goto p2_next;
@@ -1724,26 +1722,24 @@ int lfsck_assistant_engine(void *args)
 
                                /* Pull LFSCK status on related targets once
                                 * per 30 seconds if we are not notified. */
-                               lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(30),
-                                                          cfs_time_seconds(1),
-                                                          NULL, NULL);
-                               rc = l_wait_event(athread->t_ctl_waitq,
-                                       lfsck_phase2_next_ready(lad) ||
-                                       test_bit(LAD_EXIT, &lad->lad_flags) ||
-                                       !thread_is_running(mthread),
-                                       &lwi);
+                               while (seconds > 0 &&
+                                      wait_event_idle_timeout(
+                                              athread->t_ctl_waitq,
+                                              lfsck_phase2_next_ready(lad) ||
+                                              test_bit(LAD_EXIT,
+                                                       &lad->lad_flags) ||
+                                              !thread_is_running(mthread),
+                                              cfs_time_seconds(1)) == 0)
+                                       seconds -= 1;
 
                                if (unlikely(
                                        test_bit(LAD_EXIT, &lad->lad_flags) ||
                                        !thread_is_running(mthread)))
                                        GOTO(cleanup, rc = 0);
 
-                               if (rc == -ETIMEDOUT)
+                               if (seconds == 0)
                                        continue;
 
-                               if (rc < 0)
-                                       GOTO(cleanup, rc);
-
 p2_next:
                                rc = lao->la_handler_p2(env, com);
                                if (rc != 0)