From: tianzy Date: Tue, 21 Apr 2009 09:22:08 +0000 (+0000) Subject: Branch HEAD X-Git-Tag: v1_9_170~41 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=4c98c57e9fe2c30f5401f18f5ab024cdb7cf5b7b;p=fs%2Flustre-release.git Branch HEAD 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/libcfs/include/libcfs/libcfs.h b/libcfs/include/libcfs/libcfs.h index 745f3a0..598276f 100644 --- a/libcfs/include/libcfs/libcfs.h +++ b/libcfs/include/libcfs/libcfs.h @@ -140,8 +140,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/libcfs/libcfs/watchdog.c b/libcfs/libcfs/watchdog.c index 6c1801a..24fb8ee 100644 --- a/libcfs/libcfs/watchdog.c +++ b/libcfs/libcfs/watchdog.c @@ -53,7 +53,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, @@ -255,8 +254,7 @@ 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 " LPPID ": inactive for " - "%lds\n", lcw->lcw_pid, cfs_duration_sec(lcw->lcw_time)); + CDEBUG(D_INFO, "found lcw for pid " LPPID "\n", lcw->lcw_pid); if (lcw->lcw_state != LC_WATCHDOG_DISABLED) lcw->lcw_callback(lcw->lcw_pid, lcw->lcw_data); @@ -312,7 +310,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) { @@ -327,7 +325,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; @@ -343,7 +340,7 @@ struct lc_watchdog *lc_watchdog_add(int timeout_ms, /* Keep this working in case we enable them by default */ if (lcw->lcw_state == LC_WATCHDOG_ENABLED) { lcw->lcw_last_touched = cfs_time_current(); - cfs_timer_arm(&lcw->lcw_timer, lcw->lcw_time + + cfs_timer_arm(&lcw->lcw_timer, cfs_time_seconds(timeout) + cfs_time_current()); } @@ -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); @@ -381,17 +378,10 @@ void lc_watchdog_touch_ms(struct lc_watchdog *lcw, int timeout_ms) lcw->lcw_state = LC_WATCHDOG_ENABLED; cfs_timer_arm(&lcw->lcw_timer, cfs_time_current() + - cfs_time_seconds(timeout_ms) / 1000); + 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, (int)cfs_duration_sec(lcw->lcw_time) * 1000); -} EXPORT_SYMBOL(lc_watchdog_touch); void lc_watchdog_disable(struct lc_watchdog *lcw) @@ -448,7 +438,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 +447,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); diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index b1dcac3..f94116b 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -658,6 +658,10 @@ struct ptlrpc_thread { * put watchdog in the structure per thread b=14840 */ struct lc_watchdog *t_watchdog; + /** + * the svc this thread belonged to b=18582 + */ + struct ptlrpc_service *t_svc; cfs_waitq_t t_ctl_waitq; struct lu_env *t_env; }; diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index f6fe4a7..6237590 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -2260,7 +2260,7 @@ static int ldlm_setup(void) ldlm_state->ldlm_cb_service = ptlrpc_init_svc(LDLM_NBUFS, LDLM_BUFSIZE, LDLM_MAXREQSIZE, LDLM_MAXREPSIZE, LDLM_CB_REQUEST_PORTAL, - LDLM_CB_REPLY_PORTAL, 1800, + LDLM_CB_REPLY_PORTAL, 2, ldlm_callback_handler, "ldlm_cbd", ldlm_svc_proc_dir, NULL, ldlm_min_threads, ldlm_max_threads, @@ -2275,7 +2275,7 @@ static int ldlm_setup(void) ldlm_state->ldlm_cancel_service = ptlrpc_init_svc(LDLM_NBUFS, LDLM_BUFSIZE, LDLM_MAXREQSIZE, LDLM_MAXREPSIZE, LDLM_CANCEL_REQUEST_PORTAL, - LDLM_CANCEL_REPLY_PORTAL, 6000, + LDLM_CANCEL_REPLY_PORTAL, 6, ldlm_cancel_handler, "ldlm_canceld", ldlm_svc_proc_dir, NULL, ldlm_min_threads, ldlm_max_threads, diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 661ad8e..3212962 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -349,7 +349,7 @@ static int mdt_statfs(struct mdt_thread_info *info) /* This will trigger a watchdog timeout */ OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_STATFS_LCW_SLEEP, (MDT_SERVICE_WATCHDOG_FACTOR * - at_get(&svc->srv_at_estimate) / 1000) + 1); + at_get(&svc->srv_at_estimate)) + 1); rc = mdt_check_ucred(info); if (rc) diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 953ede9..aa6c6cc 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -175,7 +175,7 @@ struct mdt_device { #define mdt_client_bitmap_lock mdt_lut.lut_client_bitmap_lock #define mdt_client_bitmap mdt_lut.lut_client_bitmap -#define MDT_SERVICE_WATCHDOG_FACTOR (2000) +#define MDT_SERVICE_WATCHDOG_FACTOR (2) #define MDT_ROCOMPAT_SUPP (OBD_ROCOMPAT_LOVOBJID) #define MDT_INCOMPAT_SUPP (OBD_INCOMPAT_MDT | OBD_INCOMPAT_COMMON_LR) #define MDT_COS_DEFAULT (1) diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index 97878c8..0df7efc 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -250,7 +250,7 @@ static int mgs_setup(struct obd_device *obd, struct lustre_cfg *lcfg) mgs->mgs_service = ptlrpc_init_svc(MGS_NBUFS, MGS_BUFSIZE, MGS_MAXREQSIZE, MGS_MAXREPSIZE, MGS_REQUEST_PORTAL, - MGC_REPLY_PORTAL, 2000, + MGC_REPLY_PORTAL, 2, mgs_handle, LUSTRE_MGS_NAME, obd->obd_proc_entry, target_print_req, MGS_THREADS_AUTO_MIN, MGS_THREADS_AUTO_MAX, diff --git a/lustre/ost/ost_internal.h b/lustre/ost/ost_internal.h index 519bbb3..6775362 100644 --- a/lustre/ost/ost_internal.h +++ b/lustre/ost/ost_internal.h @@ -37,7 +37,7 @@ #ifndef OST_INTERNAL_H #define OST_INTERNAL_H -#define OSS_SERVICE_WATCHDOG_FACTOR 2000 +#define OSS_SERVICE_WATCHDOG_FACTOR 2 /* * tunables for per-thread page pool (bug 5137) diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 35a2eb4..d28db7b 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -1917,10 +1917,7 @@ static int ptlrpc_main(void *arg) */ cfs_waitq_signal(&thread->t_ctl_waitq); - thread->t_watchdog = lc_watchdog_add(max_t(int, obd_timeout, AT_OFF ? 0 : - at_get(&svc->srv_at_estimate)) - * svc->srv_watchdog_factor, - NULL, NULL); + thread->t_watchdog = lc_watchdog_add(GET_TIMEOUT(svc), NULL, NULL); spin_lock(&svc->srv_lock); svc->srv_threads_running++; @@ -1953,10 +1950,7 @@ static int ptlrpc_main(void *arg) svc->srv_at_check, &lwi); - lc_watchdog_touch_ms(thread->t_watchdog, max_t(int, obd_timeout, - AT_OFF ? 0 : - at_get(&svc->srv_at_estimate)) * - svc->srv_watchdog_factor); + lc_watchdog_touch(thread->t_watchdog, GET_TIMEOUT(svc)); ptlrpc_check_rqbd_pool(svc); @@ -2256,6 +2250,7 @@ int ptlrpc_start_thread(struct obd_device *dev, struct ptlrpc_service *svc) id = svc->srv_threads_started++; spin_unlock(&svc->srv_lock); + thread->t_svc = svc; thread->t_id = id; sprintf(name, "%s_%02d", svc->srv_thread_name, id); d.dev = dev; diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index cccc3fd..537f101 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -940,7 +940,8 @@ schedule_dqacq(struct obd_device *obd, struct lustre_quota_ctxt *qctxt, l_wait_event(qctxt->lqc_wait_for_qmaster, check_qm(qctxt), &lwi); CDEBUG(D_QUOTA, "wake up when quota master is back\n"); - lc_watchdog_touch(oti->oti_thread->t_watchdog); + lc_watchdog_touch(oti->oti_thread->t_watchdog, + GET_TIMEOUT(oti->oti_thread->t_svc)); } else { spin_unlock(&qctxt->lqc_lock); } diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c index ef40fd8..16ed64e 100644 --- a/lustre/quota/quota_interface.c +++ b/lustre/quota/quota_interface.c @@ -393,7 +393,8 @@ static int quota_chk_acq_common(struct obd_device *obd, unsigned int uid, l_wait_event(qctxt->lqc_wait_for_qmaster, check_qm(qctxt), &lwi); CDEBUG(D_QUOTA, "wake up when quota master is back\n"); - lc_watchdog_touch(oti->oti_thread->t_watchdog); + lc_watchdog_touch(oti->oti_thread->t_watchdog, + GET_TIMEOUT(oti->oti_thread->t_svc)); } else { spin_unlock(&qctxt->lqc_lock); } @@ -424,7 +425,8 @@ static int quota_chk_acq_common(struct obd_device *obd, unsigned int uid, struct l_wait_info lwi; if (oti && oti->oti_thread && oti->oti_thread->t_watchdog) - lc_watchdog_touch(oti->oti_thread->t_watchdog); + lc_watchdog_touch(oti->oti_thread->t_watchdog, + GET_TIMEOUT(oti->oti_thread->t_svc)); CDEBUG(D_QUOTA, "rc: %d, count_err: %d\n", rc, count_err++);