From: tianzy Date: Tue, 21 Apr 2009 09:21:18 +0000 (+0000) Subject: Branch b1_6 X-Git-Tag: GIT_EPOCH_B_RELEASE_1_8_1~2^4~2 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=ba69671791607c779950631eef099cfc07d4238c;p=fs%2Flustre-release.git Branch b1_6 1. delete the lc_watchdog_touch_ms() 2. changing to seconds instead of ms 3. delete lcw_time in lc_watchdog b=18582 i=nathan i=johann --- diff --git a/lnet/include/libcfs/libcfs.h b/lnet/include/libcfs/libcfs.h index 9c056d0..d25c3b0 100644 --- a/lnet/include/libcfs/libcfs.h +++ b/lnet/include/libcfs/libcfs.h @@ -408,8 +408,10 @@ struct lc_watchdog *lc_watchdog_add(int time, 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); diff --git a/lnet/libcfs/watchdog.c b/lnet/libcfs/watchdog.c index 9d9df75..19eb915 100644 --- a/lnet/libcfs/watchdog.c +++ b/lnet/libcfs/watchdog.c @@ -54,7 +54,6 @@ struct lc_watchdog { void *lcw_data; pid_t lcw_pid; - cfs_duration_t lcw_time; /* time until watchdog fires, jiffies */ enum { LC_WATCHDOG_DISABLED, @@ -251,9 +250,8 @@ 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 " - "%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); @@ -309,7 +307,7 @@ static void lcw_dispatch_stop(void) 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) { @@ -324,7 +322,6 @@ struct lc_watchdog *lc_watchdog_add(int timeout_ms, 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; @@ -333,7 +330,7 @@ struct lc_watchdog *lc_watchdog_add(int timeout_ms, 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); @@ -368,7 +365,7 @@ static void lcw_update_time(struct lc_watchdog *lcw, const char *message) 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); @@ -380,18 +377,10 @@ void lc_watchdog_touch_ms(struct lc_watchdog *lcw, int timeout_ms) 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) @@ -448,7 +437,7 @@ EXPORT_SYMBOL(lc_watchdog_dumplog); #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) { @@ -457,12 +446,7 @@ 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) +void lc_watchdog_touch(struct lc_watchdog *lcw, int timeout) { } EXPORT_SYMBOL(lc_watchdog_touch);