void *data);
/* Enables a watchdog and resets its timer. */
-void lc_watchdog_touch_ms(struct lc_watchdog *lcw, int timeout_ms);
-void lc_watchdog_touch(struct lc_watchdog *lcw);
+void lc_watchdog_touch(struct lc_watchdog *lcw, int timeout);
+#define GET_TIMEOUT(svc) (max_t(int, obd_timeout, \
+ AT_OFF ? 0 : at_get(&svc->srv_at_estimate)) * \
+ svc->srv_watchdog_factor)
/* Disable a watchdog; touch it to restart it. */
void lc_watchdog_disable(struct lc_watchdog *lcw);
void *lcw_data;
pid_t lcw_pid;
- cfs_duration_t lcw_time; /* time until watchdog fires, jiffies */
enum {
LC_WATCHDOG_DISABLED,
list_del_init(&lcw->lcw_list);
spin_unlock_bh(&lcw_pending_timers_lock);
- CDEBUG(D_INFO, "found lcw for pid %d: inactive for "
- "%lds\n", (int)lcw->lcw_pid,
- cfs_duration_sec(lcw->lcw_time));
+ CDEBUG(D_INFO, "found lcw for pid %d\n",
+ (int)lcw->lcw_pid);
if (lcw->lcw_state != LC_WATCHDOG_DISABLED)
lcw->lcw_callback(lcw->lcw_pid, lcw->lcw_data);
EXIT;
}
-struct lc_watchdog *lc_watchdog_add(int timeout_ms,
+struct lc_watchdog *lc_watchdog_add(int timeout,
void (*callback)(pid_t, void *),
void *data)
{
lcw->lcw_task = cfs_current();
lcw->lcw_pid = cfs_curproc_pid();
- lcw->lcw_time = cfs_time_seconds(timeout_ms) / 1000;
lcw->lcw_callback = (callback != NULL) ? callback : lc_watchdog_dumplog;
lcw->lcw_data = data;
lcw->lcw_state = LC_WATCHDOG_DISABLED;
lcw->lcw_timer.function = lcw_cb;
lcw->lcw_timer.data = (unsigned long)lcw;
- lcw->lcw_timer.expires = jiffies + lcw->lcw_time;
+ lcw->lcw_timer.expires = jiffies + cfs_time_seconds(timeout);
init_timer(&lcw->lcw_timer);
down(&lcw_refcount_sem);
lcw->lcw_last_touched = newtime;
}
-void lc_watchdog_touch_ms(struct lc_watchdog *lcw, int timeout_ms)
+void lc_watchdog_touch(struct lc_watchdog *lcw, int timeout)
{
ENTRY;
LASSERT(lcw != NULL);
lcw_update_time(lcw, "touched");
lcw->lcw_state = LC_WATCHDOG_ENABLED;
- mod_timer(&lcw->lcw_timer, jiffies +
- cfs_time_seconds(timeout_ms) / 1000);
+ mod_timer(&lcw->lcw_timer, jiffies + cfs_time_seconds(timeout));
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)
#else /* !defined(WITH_WATCHDOG) */
-struct lc_watchdog *lc_watchdog_add(int timeout_ms,
+struct lc_watchdog *lc_watchdog_add(int timeout,
void (*callback)(pid_t pid, void *),
void *data)
{
}
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)
+void lc_watchdog_touch(struct lc_watchdog *lcw, int timeout)
{
}
EXPORT_SYMBOL(lc_watchdog_touch);