Whamcloud - gitweb
LU-10805 libcfs: timer_setup() API changes
[fs/lustre-release.git] / libcfs / libcfs / watchdog.c
index 0b2c736..4c437ab 100644 (file)
 #include <libcfs/libcfs.h>
 #include "tracefile.h"
 
+#ifndef WITH_WATCHDOG
+#define WITH_WATCHDOG
+#endif
+
 struct lc_watchdog {
        spinlock_t              lcw_lock;       /* check or change lcw_list */
        int                     lcw_refcount;   /* must hold lcw_pending_timers_lock */
@@ -114,9 +118,9 @@ lcw_dump(struct lc_watchdog *lcw)
         EXIT;
 }
 
-static void lcw_cb(uintptr_t data)
+static void lcw_cb(cfs_timer_cb_arg_t data)
 {
-        struct lc_watchdog *lcw = (struct lc_watchdog *)data;
+       struct lc_watchdog *lcw = cfs_from_timer(lcw, data, lcw_timer);
         ENTRY;
 
         if (lcw->lcw_state != LC_WATCHDOG_ENABLED) {
@@ -331,6 +335,7 @@ static void lcw_dispatch_stop(void)
        wake_up(&lcw_event_waitq);
 
        wait_for_completion(&lcw_stop_completion);
+       clear_bit(LCW_FLAG_STOP, &lcw_flags);
 
        CDEBUG(D_INFO, "watchdog dispatcher has shut down.\n");
 
@@ -359,7 +364,7 @@ struct lc_watchdog *lc_watchdog_add(int timeout,
        lcw->lcw_state    = LC_WATCHDOG_DISABLED;
 
        INIT_LIST_HEAD(&lcw->lcw_list);
-       setup_timer(&lcw->lcw_timer, lcw_cb, (unsigned long)lcw);
+       cfs_timer_setup(&lcw->lcw_timer, lcw_cb, (unsigned long)lcw, 0);
 
        mutex_lock(&lcw_refcount_mutex);
        if (++lcw_refcount == 1)