Whamcloud - gitweb
Branch b1_6
[fs/lustre-release.git] / lnet / libcfs / watchdog.c
index 3000e8f..89d757c 100644 (file)
@@ -36,7 +36,7 @@ struct lc_watchdog {
         void             *lcw_data;
 
         pid_t             lcw_pid;
-        int               lcw_time; /* time until watchdog fires, in ms */
+        cfs_duration_t    lcw_time; /* time until watchdog fires, jiffies */
 
         enum {
                 LC_WATCHDOG_DISABLED,
@@ -126,8 +126,8 @@ static void lcw_cb(unsigned long data)
         /* NB this warning should appear on the console, but may not get into
          * the logs since we're running in a softirq handler */
 
-        CWARN("Watchdog triggered for pid %d: it was inactive for %ldms\n",
-              (int)lcw->lcw_pid, cfs_duration_sec(lcw->lcw_time) * 1000);
+        CWARN("Watchdog triggered for pid %d: it was inactive for %lds\n",
+              (int)lcw->lcw_pid, cfs_duration_sec(lcw->lcw_time));
         lcw_dump(lcw);
 
         spin_lock_bh(&lcw_pending_timers_lock);
@@ -197,8 +197,9 @@ static int lcw_dispatch_main(void *data)
                         list_del_init(&lcw->lcw_list);
                         spin_unlock_bh(&lcw_pending_timers_lock);
 
-                        CDEBUG(D_INFO, "found lcw for pid %d: inactive for %ldms\n", 
-                               (int)lcw->lcw_pid, cfs_duration_sec(lcw->lcw_time) * 1000);
+                        CDEBUG(D_INFO, "found lcw for pid %d: inactive for "
+                               "%lds\n", (int)lcw->lcw_pid,
+                               cfs_duration_sec(lcw->lcw_time));
 
                         if (lcw->lcw_state != LC_WATCHDOG_DISABLED)
                                 lcw->lcw_callback(lcw->lcw_pid, lcw->lcw_data);
@@ -313,7 +314,7 @@ static void lcw_update_time(struct lc_watchdog *lcw, const char *message)
         lcw->lcw_last_touched = newtime;
 }
 
-void lc_watchdog_touch(struct lc_watchdog *lcw)
+void lc_watchdog_touch_ms(struct lc_watchdog *lcw, int timeout_ms)
 {
         ENTRY;
         LASSERT(lcw != NULL);
@@ -325,10 +326,18 @@ void lc_watchdog_touch(struct lc_watchdog *lcw)
         lcw_update_time(lcw, "touched");
         lcw->lcw_state = LC_WATCHDOG_ENABLED;
 
-        mod_timer(&lcw->lcw_timer, jiffies + lcw->lcw_time);
+        mod_timer(&lcw->lcw_timer, jiffies +
+                  cfs_time_seconds(timeout_ms) / 1000);
 
         EXIT;
 }
+EXPORT_SYMBOL(lc_watchdog_touch_ms);
+
+/* deprecated - use above instead */
+void lc_watchdog_touch(struct lc_watchdog *lcw)
+{
+        lc_watchdog_touch_ms(lcw, cfs_duration_sec(lcw->lcw_time) * 1000);
+}
 EXPORT_SYMBOL(lc_watchdog_touch);
 
 void lc_watchdog_disable(struct lc_watchdog *lcw)
@@ -394,6 +403,11 @@ struct lc_watchdog *lc_watchdog_add(int timeout_ms,
 }
 EXPORT_SYMBOL(lc_watchdog_add);
 
+void lc_watchdog_touch_ms(struct lc_watchdog *lcw, int timeout_ms)
+{
+}
+EXPORT_SYMBOL(lc_watchdog_touch_ms);
+
 void lc_watchdog_touch(struct lc_watchdog *lcw)
 {
 }