Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
filesystems
lustre_2_12
0013-LU-9019-obd-express-timeouts-in-timeout_t....
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0013-LU-9019-obd-express-timeouts-in-timeout_t.patch of Package lustre_2_12
From 74ddaa2dd1258f9ddc3d39c77c1e993420634731 Mon Sep 17 00:00:00 2001 From: James Simmons <jsimmons@infradead.org> Date: Wed, 22 Apr 2020 10:13:45 -0400 Subject: [PATCH 13/35] LU-9019 obd: express timeouts in timeout_t In the latest kernels time_t has been removed since time_t has been a 64 bit value just like time64_t so no need for it anymore. To avoid confusion between timestamps and timeout values Lustre has a timeout_t typedef which is in seconds and is a s32 since timeouts are generally short. This helps to avoid errors that has happens in the past with certain math operation between timeouts and timestamps that lead to overflow and underflow cases. Change-Id: I4524456d514561e145201079a420ff89fa829602 Signed-off-by: James Simmons <jsimmons@infradead.org> Reviewed-on: https://review.whamcloud.com/31576 Tested-by: jenkins <devops@whamcloud.com> Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com> Tested-by: Maloo <maloo@whamcloud.com> Reviewed-by: Andreas Dilger <adilger@whamcloud.com> --- lustre/include/lustre_dlm.h | 10 +-- lustre/include/lustre_import.h | 68 +++++++++++++------- lustre/include/lustre_net.h | 30 ++++++++- lustre/include/obd.h | 9 ++- lustre/ldlm/ldlm_extent.c | 8 +-- lustre/ldlm/ldlm_lib.c | 22 ++++--- lustre/ldlm/ldlm_lock.c | 12 ++-- lustre/ldlm/ldlm_lockd.c | 49 ++++++++------- lustre/ldlm/ldlm_request.c | 30 +++++---- lustre/ldlm/ldlm_resource.c | 6 +- lustre/mdd/mdd_trans.c | 11 ++-- lustre/mdt/mdt_internal.h | 6 +- lustre/mdt/mdt_io.c | 17 ----- lustre/obdclass/lprocfs_status.c | 32 ++++++---- lustre/obdclass/lprocfs_status_server.c | 4 +- lustre/ofd/ofd_dev.c | 23 ------- lustre/ptlrpc/client.c | 55 +++++++++------- lustre/ptlrpc/import.c | 84 ++++++++++++++----------- lustre/ptlrpc/lproc_ptlrpc.c | 23 +++---- lustre/ptlrpc/niobuf.c | 11 ++-- lustre/ptlrpc/service.c | 26 ++++---- lustre/quota/qmt_handler.c | 2 +- 22 files changed, 295 insertions(+), 243 deletions(-) diff --git a/lustre/include/lustre_dlm.h b/lustre/include/lustre_dlm.h index c6291b62f425..11739395588c 100644 --- a/lustre/include/lustre_dlm.h +++ b/lustre/include/lustre_dlm.h @@ -504,7 +504,7 @@ struct ldlm_namespace { * The resources in this namespace remember contended state during * \a ns_contention_time, in seconds. */ - time64_t ns_contention_time; + timeout_t ns_contention_time; /** * Limit size of contended extent locks, in bytes. @@ -925,7 +925,7 @@ struct ldlm_lock { * under this lock. * \see ost_rw_prolong_locks */ - time64_t l_callback_timeout; + time64_t l_callback_timestamp; /** Local PID of process which created this lock. */ __u32 l_pid; @@ -1362,7 +1362,7 @@ struct ldlm_prolong_args { struct ldlm_res_id lpa_resid; struct ldlm_extent lpa_extent; enum ldlm_mode lpa_mode; - time64_t lpa_timeout; + timeout_t lpa_timeout; int lpa_locks_cnt; int lpa_blocks_cnt; }; @@ -1408,10 +1408,10 @@ int ldlm_request_cancel(struct ptlrpc_request *req, /** @} ldlm_handlers */ void ldlm_revoke_export_locks(struct obd_export *exp); -time64_t ldlm_bl_timeout(struct ldlm_lock *lock); +timeout_t ldlm_bl_timeout(struct ldlm_lock *lock); #endif int ldlm_del_waiting_lock(struct ldlm_lock *lock); -int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, time64_t timeout); +int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, timeout_t timeout); int ldlm_get_ref(void); void ldlm_put_ref(void); int ldlm_init_export(struct obd_export *exp); diff --git a/lustre/include/lustre_import.h b/lustre/include/lustre_import.h index 430fde2e9273..35474e29ad03 100644 --- a/lustre/include/lustre_import.h +++ b/lustre/include/lustre_import.h @@ -65,9 +65,13 @@ struct adaptive_timeout { time64_t at_binstart; /* bin start time */ unsigned int at_hist[AT_BINS]; /* timeout history bins */ unsigned int at_flags; - unsigned int at_current; /* current timeout value */ - unsigned int at_worst_ever; /* worst-ever timeout value */ - time64_t at_worst_time; /* worst-ever timeout timestamp */ + timeout_t at_current_timeout; /* current timeout value */ + timeout_t at_worst_timeout_ever; /* worst-ever timeout delta + * value + */ + time64_t at_worst_timestamp; /* worst-ever timeout + * timestamp + */ spinlock_t at_lock; }; @@ -335,11 +339,23 @@ struct obd_import { time64_t imp_last_reply_time; /* for health check */ }; -/* import.c */ -static inline unsigned int at_est2timeout(unsigned int val) +/* import.c : adaptive timeout handling. + * + * Lustre tracks how long RPCs take to complete. This information is reported + * back to clients who utilize the information to estimate the time needed + * for future requests and set appropriate RPC timeouts. Minimum and maximum + * service times can be configured via the at_min and at_max kernel module + * parameters, respectively. + * + * Since this information is transmitted between nodes the timeouts are in + * seconds not jiffies which can vary from node to node. To avoid confusion + * the timeout is handled in timeout_t (s32) instead of time64_t or + * long (jiffies). + */ +static inline timeout_t at_est2timeout(timeout_t timeout) { - /* add an arbitrary minimum: 125% +5 sec */ - return (val + (val >> 2) + 5); + /* add an arbitrary minimum: 125% +5 sec */ + return timeout + (timeout >> 2) + 5; } static inline timeout_t at_timeout2est(timeout_t timeout) @@ -349,46 +365,54 @@ static inline timeout_t at_timeout2est(timeout_t timeout) return max((timeout << 2) / 5, 5) - 4; } -static inline void at_reset_nolock(struct adaptive_timeout *at, int val) +static inline void at_reset_nolock(struct adaptive_timeout *at, + timeout_t timeout) { - at->at_current = val; - at->at_worst_ever = val; - at->at_worst_time = ktime_get_real_seconds(); + at->at_current_timeout = timeout; + at->at_worst_timeout_ever = timeout; + at->at_worst_timestamp = ktime_get_real_seconds(); } -static inline void at_reset(struct adaptive_timeout *at, int val) +static inline void at_reset(struct adaptive_timeout *at, timeout_t timeout) { spin_lock(&at->at_lock); - at_reset_nolock(at, val); + at_reset_nolock(at, timeout); spin_unlock(&at->at_lock); } -static inline void at_init(struct adaptive_timeout *at, int val, int flags) { +static inline void at_init(struct adaptive_timeout *at, timeout_t timeout, + int flags) +{ memset(at, 0, sizeof(*at)); spin_lock_init(&at->at_lock); at->at_flags = flags; - at_reset(at, val); + at_reset(at, timeout); } -static inline void at_reinit(struct adaptive_timeout *at, int val, int flags) +static inline void at_reinit(struct adaptive_timeout *at, timeout_t timeout, + int flags) { spin_lock(&at->at_lock); at->at_binstart = 0; memset(at->at_hist, 0, sizeof(at->at_hist)); at->at_flags = flags; - at_reset_nolock(at, val); + at_reset_nolock(at, timeout); spin_unlock(&at->at_lock); } extern unsigned int at_min; -static inline int at_get(struct adaptive_timeout *at) { - return (at->at_current > at_min) ? at->at_current : at_min; -} -int at_measured(struct adaptive_timeout *at, unsigned int val); -int import_at_get_index(struct obd_import *imp, int portal); extern unsigned int at_max; #define AT_OFF (at_max == 0) +static inline timeout_t at_get(struct adaptive_timeout *at) +{ + return (at->at_current_timeout > at_min) ? + at->at_current_timeout : at_min; +} + +timeout_t at_measured(struct adaptive_timeout *at, timeout_t timeout); +int import_at_get_index(struct obd_import *imp, int portal); + /* genops.c */ struct obd_export; extern struct obd_import *class_exp2cliimp(struct obd_export *); diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index 3a94a921e11d..cf4365b2aa81 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -773,8 +773,10 @@ struct ptlrpc_hpreq_ops { struct ptlrpc_cli_req { /** For bulk requests on client only: bulk descriptor */ struct ptlrpc_bulk_desc *cr_bulk; - /** optional time limit for send attempts */ - time64_t cr_delay_limit; + /** optional time limit for send attempts. This is a timeout + * not a timestamp so timeout_t (s32) is used instead of time64_t + */ + timeout_t cr_delay_limit; /** time request was first queued */ time64_t cr_queued_time; /** request sent in nanoseconds */ @@ -2643,6 +2645,30 @@ ptlrpc_server_get_timeout(struct ptlrpc_service_part *svcpt) max_t(int, at, obd_timeout); } +/** + * Calculate the amount of time for lock prolongation. + * + * This is helper function to get the timeout extra time. + * + * @req current request + * + * Return: amount of time to extend the timeout with + */ +static inline timeout_t prolong_timeout(struct ptlrpc_request *req) +{ + struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt; + timeout_t req_timeout = 0; + + if (AT_OFF) + return obd_timeout / 2; + + if (req->rq_deadline > req->rq_arrival_time.tv_sec) + req_timeout = req->rq_deadline - req->rq_arrival_time.tv_sec; + + return max(req_timeout, + at_est2timeout(at_get(&svcpt->scp_at_estimate))); +} + static inline struct ptlrpc_service * ptlrpc_req2svc(struct ptlrpc_request *req) { diff --git a/lustre/include/obd.h b/lustre/include/obd.h index e4534a8f4ef0..011686532e9c 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -693,9 +693,12 @@ struct obd_device { time64_t obd_recovery_start; /* seconds, for lprocfs_status */ time64_t obd_recovery_end; - time64_t obd_recovery_time_hard; - time64_t obd_recovery_timeout; - int obd_recovery_ir_factor; + /* To tell timeouts from time stamps Lustre uses timeout_t + * instead of time64_t. + */ + timeout_t obd_recovery_time_hard; + timeout_t obd_recovery_timeout; + int obd_recovery_ir_factor; /* new recovery stuff from CMD2 */ int obd_replayed_locks; diff --git a/lustre/ldlm/ldlm_extent.c b/lustre/ldlm/ldlm_extent.c index 59d1302a3651..a6cf9c661b78 100644 --- a/lustre/ldlm/ldlm_extent.c +++ b/lustre/ldlm/ldlm_extent.c @@ -308,13 +308,13 @@ static void ldlm_extent_policy(struct ldlm_resource *res, } } -static int ldlm_check_contention(struct ldlm_lock *lock, int contended_locks) +static bool ldlm_check_contention(struct ldlm_lock *lock, int contended_locks) { struct ldlm_resource *res = lock->l_resource; time64_t now = ktime_get_seconds(); if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_SET_CONTENTION)) - return 1; + return true; CDEBUG(D_DLMTRACE, "contended locks = %d\n", contended_locks); if (contended_locks > ldlm_res_to_ns(res)->ns_contended_locks) @@ -676,7 +676,7 @@ destroylock: void ldlm_lock_prolong_one(struct ldlm_lock *lock, struct ldlm_prolong_args *arg) { - time64_t timeout; + timeout_t timeout; OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_PROLONG_PAUSE, 3); @@ -696,7 +696,7 @@ void ldlm_lock_prolong_one(struct ldlm_lock *lock, */ timeout = arg->lpa_timeout + (ldlm_bl_timeout(lock) >> 1); - LDLM_DEBUG(lock, "refreshed to %llds.\n", timeout); + LDLM_DEBUG(lock, "refreshed to %ds.\n", timeout); arg->lpa_blocks_cnt++; diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 11bcd71f5853..d7cc59566d36 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -1611,7 +1611,7 @@ static void target_finish_recovery(struct lu_target *lut) elapsed_time = max_t(time64_t, now - obd->obd_recovery_start, 1); LCONSOLE_INFO("%s: Recovery over after %lld:%.02lld, of %d clients " "%d recovered and %d %s evicted.\n", obd->obd_name, - (s64)elapsed_time / 60, (s64)elapsed_time % 60, + elapsed_time / 60, elapsed_time % 60, atomic_read(&obd->obd_max_recoverable_clients), atomic_read(&obd->obd_connected_clients), obd->obd_stale_clients, @@ -1771,7 +1771,7 @@ static void target_start_recovery_timer(struct obd_device *obd) hrtimer_start(&obd->obd_recovery_timer, delay, HRTIMER_MODE_ABS); spin_unlock(&obd->obd_dev_lock); - LCONSOLE_WARN("%s: Will be in recovery for at least %llu:%02llu, or until %d client%s reconnect%s\n", + LCONSOLE_WARN("%s: Will be in recovery for at least %u:%02u, or until %d client%s reconnect%s\n", obd->obd_name, obd->obd_recovery_timeout / 60, obd->obd_recovery_timeout % 60, @@ -1789,12 +1789,12 @@ static void target_start_recovery_timer(struct obd_device *obd) * at least; otherwise, make sure the recovery timeout value is not less * than @dr_timeout. */ -static void extend_recovery_timer(struct obd_device *obd, time_t dr_timeout, +static void extend_recovery_timer(struct obd_device *obd, timeout_t dr_timeout, bool extend) { ktime_t left_ns; - time_t timeout; - time_t left; + timeout_t timeout; + timeout_t left; spin_lock(&obd->obd_dev_lock); if (!obd->obd_recovering || obd->obd_abort_recovery) { @@ -1814,16 +1814,17 @@ static void extend_recovery_timer(struct obd_device *obd, time_t dr_timeout, */ if (dr_timeout > left) { timeout += dr_timeout - left; - timeout = min_t(time_t, obd->obd_recovery_time_hard, + timeout = min_t(timeout_t, obd->obd_recovery_time_hard, timeout); } } else { - timeout = clamp_t(time_t, dr_timeout, obd->obd_recovery_timeout, + timeout = clamp_t(timeout_t, dr_timeout, + obd->obd_recovery_timeout, obd->obd_recovery_time_hard); } if (timeout == obd->obd_recovery_time_hard) - CWARN("%s: extended recovery timer reached hard limit: %ld, extend: %d\n", + CWARN("%s: extended recovery timer reached hard limit: %d, extend: %d\n", obd->obd_name, timeout, extend); if (obd->obd_recovery_timeout < timeout) { @@ -1838,7 +1839,7 @@ static void extend_recovery_timer(struct obd_device *obd, time_t dr_timeout, } spin_unlock(&obd->obd_dev_lock); - CDEBUG(D_HA, "%s: recovery timer will expire in %ld seconds\n", + CDEBUG(D_HA, "%s: recovery timer will expire in %d seconds\n", obd->obd_name, left); } @@ -2306,7 +2307,8 @@ static int check_for_recovery_ready(struct lu_target *lut) * timer expired, and some clients got evicted */ extend_recovery_timer(obd, obd->obd_recovery_timeout, true); - CDEBUG(D_HA, "%s update recovery is not ready, extend recovery %llu\n", + CDEBUG(D_HA, + "%s update recovery is not ready, extend recovery %d\n", obd->obd_name, obd->obd_recovery_timeout); return 0; } diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 42eccaf9cf86..b5b12e61af46 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -502,7 +502,7 @@ static struct ldlm_lock *ldlm_lock_new(struct ldlm_resource *resource) lu_ref_init(&lock->l_reference); lu_ref_add(&lock->l_reference, "hash", lock); - lock->l_callback_timeout = 0; + lock->l_callback_timestamp = 0; lock->l_activity = 0; #if LUSTRE_TRACKS_LOCK_EXP_REFS @@ -2766,7 +2766,7 @@ void _ldlm_lock_debug(struct ldlm_lock *lock, ldlm_lockname[lock->l_req_mode], lock->l_flags, nid, lock->l_remote_handle.cookie, exp ? atomic_read(&exp->exp_refcount) : -99, - lock->l_pid, lock->l_callback_timeout, lock->l_lvb_type); + lock->l_pid, lock->l_callback_timestamp, lock->l_lvb_type); va_end(args); return; } @@ -2791,7 +2791,7 @@ void _ldlm_lock_debug(struct ldlm_lock *lock, lock->l_req_extent.start, lock->l_req_extent.end, lock->l_flags, nid, lock->l_remote_handle.cookie, exp ? atomic_read(&exp->exp_refcount) : -99, - lock->l_pid, lock->l_callback_timeout, + lock->l_pid, lock->l_callback_timestamp, lock->l_lvb_type); break; @@ -2814,7 +2814,7 @@ void _ldlm_lock_debug(struct ldlm_lock *lock, lock->l_policy_data.l_flock.end, lock->l_flags, nid, lock->l_remote_handle.cookie, exp ? atomic_read(&exp->exp_refcount) : -99, - lock->l_pid, lock->l_callback_timeout); + lock->l_pid, lock->l_callback_timestamp); break; case LDLM_IBITS: @@ -2836,7 +2836,7 @@ void _ldlm_lock_debug(struct ldlm_lock *lock, ldlm_typename[resource->lr_type], lock->l_flags, nid, lock->l_remote_handle.cookie, exp ? atomic_read(&exp->exp_refcount) : -99, - lock->l_pid, lock->l_callback_timeout, + lock->l_pid, lock->l_callback_timestamp, lock->l_lvb_type); break; @@ -2857,7 +2857,7 @@ void _ldlm_lock_debug(struct ldlm_lock *lock, ldlm_typename[resource->lr_type], lock->l_flags, nid, lock->l_remote_handle.cookie, exp ? atomic_read(&exp->exp_refcount) : -99, - lock->l_pid, lock->l_callback_timeout, + lock->l_pid, lock->l_callback_timestamp, lock->l_lvb_type); break; } diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index ac7a9910e4d4..4584803803a5 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -151,8 +151,8 @@ static int expired_lock_dump; static LIST_HEAD(expired_lock_list); static int ldlm_lock_busy(struct ldlm_lock *lock); -static int ldlm_add_waiting_lock(struct ldlm_lock *lock, time64_t timeout); -static int __ldlm_add_waiting_lock(struct ldlm_lock *lock, time64_t seconds); +static int ldlm_add_waiting_lock(struct ldlm_lock *lock, timeout_t timeout); +static int __ldlm_add_waiting_lock(struct ldlm_lock *lock, timeout_t timeout); static inline int have_expired_locks(void) { @@ -237,7 +237,7 @@ static int expired_lock_main(void *arg) /* Check if we need to prolong timeout */ if (!OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_HPREQ_TIMEOUT) && - lock->l_callback_timeout != 0 && /* not AST error */ + lock->l_callback_timestamp != 0 && /* not AST error */ ldlm_lock_busy(lock)) { LDLM_DEBUG(lock, "prolong the busy lock"); lock_res_and_lock(lock); @@ -317,7 +317,7 @@ static void waiting_locks_callback(TIMER_DATA_TYPE unused) while (!list_empty(&waiting_locks_list)) { lock = list_entry(waiting_locks_list.next, struct ldlm_lock, l_pending_chain); - if (lock->l_callback_timeout > ktime_get_seconds() || + if (lock->l_callback_timestamp > ktime_get_seconds() || lock->l_req_mode == LCK_GROUP) break; @@ -363,20 +363,20 @@ static void waiting_locks_callback(TIMER_DATA_TYPE unused) * * Called with the namespace lock held. */ -static int __ldlm_add_waiting_lock(struct ldlm_lock *lock, time64_t seconds) +static int __ldlm_add_waiting_lock(struct ldlm_lock *lock, timeout_t delay) { unsigned long timeout_jiffies; - time64_t timeout; + timeout_t timeout; if (!list_empty(&lock->l_pending_chain)) return 0; if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_HPREQ_NOTIMEOUT) || OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_HPREQ_TIMEOUT)) - seconds = 1; + delay = 1; - timeout = ktime_get_seconds() + seconds; - if (likely(timeout > lock->l_callback_timeout)) + timeout = ktime_get_seconds() + delay; + if (likely(timeout > lock->l_callback_timestamp)) lock->l_callback_timeout = timeout; timeout_jiffies = cfs_time_seconds(lock->l_callback_timeout); @@ -415,7 +415,7 @@ static void ldlm_add_blocked_lock(struct ldlm_lock *lock) obd_stale_export_adjust(lock->l_export); } -static int ldlm_add_waiting_lock(struct ldlm_lock *lock, time64_t timeout) +static int ldlm_add_waiting_lock(struct ldlm_lock *lock, timeout_t timeout) { int ret; @@ -460,7 +460,7 @@ static int ldlm_add_waiting_lock(struct ldlm_lock *lock, time64_t timeout) if (ret) ldlm_add_blocked_lock(lock); - LDLM_DEBUG(lock, "%sadding to wait list(timeout: %lld, AT: %s)", + LDLM_DEBUG(lock, "%sadding to wait list(timeout: %d, AT: %s)", ret == 0 ? "not re-" : "", timeout, AT_OFF ? "off" : "on"); return ret; @@ -494,7 +494,7 @@ static int __ldlm_del_waiting_lock(struct ldlm_lock *lock) next = list_entry(list_next, struct ldlm_lock, l_pending_chain); mod_timer(&waiting_locks_timer, - cfs_time_seconds(next->l_callback_timeout)); + cfs_time_seconds(next->l_callback_timestamp)); } } list_del_init(&lock->l_pending_chain); @@ -537,7 +537,7 @@ int ldlm_del_waiting_lock(struct ldlm_lock *lock) * * Called with namespace lock held. */ -int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, time64_t timeout) +int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, timeout_t timeout) { if (lock->l_export == NULL) { /* We don't have a "waiting locks list" on clients. */ @@ -577,7 +577,7 @@ int ldlm_del_waiting_lock(struct ldlm_lock *lock) RETURN(0); } -int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, time64_t timeout) +int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, timeout_t timeout) { RETURN(0); } @@ -595,9 +595,9 @@ int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, time64_t timeout) * * \retval timeout in seconds to wait for the client reply */ -time64_t ldlm_bl_timeout(struct ldlm_lock *lock) +timeout_t ldlm_bl_timeout(struct ldlm_lock *lock) { - time64_t timeout; + timeout_t timeout; if (AT_OFF) return obd_timeout / 2; @@ -607,7 +607,8 @@ time64_t ldlm_bl_timeout(struct ldlm_lock *lock) * It would be nice to have some kind of "early reply" mechanism for * lock callbacks too... */ timeout = at_get(&lock->l_export->exp_bl_lock_at); - return max(timeout + (timeout >> 1), (time64_t)ldlm_enqueue_min); + return max_t(timeout_t, timeout + (timeout >> 1), + (timeout_t)ldlm_enqueue_min); } EXPORT_SYMBOL(ldlm_bl_timeout); @@ -629,7 +630,8 @@ static void ldlm_failed_ast(struct ldlm_lock *lock, int rc, /* the lock was not in any list, grab an extra ref before adding * the lock to the expired list */ LDLM_LOCK_GET(lock); - lock->l_callback_timeout = 0; /* differentiate it from expired locks */ + /* differentiate it from expired locks */ + lock->l_callback_timestamp = 0; list_add(&lock->l_pending_chain, &expired_lock_list); wake_up(&expired_lock_wait_queue); spin_unlock_bh(&waiting_locks_spinlock); @@ -1666,10 +1668,13 @@ int ldlm_request_cancel(struct ptlrpc_request *req, if ((flags & LATF_STATS) && ldlm_is_ast_sent(lock) && lock->l_blast_sent != 0) { - time64_t delay = ktime_get_real_seconds() - - lock->l_blast_sent; - LDLM_DEBUG(lock, "server cancels blocked lock after %llds", - (s64)delay); + timeout_t delay = 0; + + if (ktime_get_real_seconds() > lock->l_blast_sent) + delay = ktime_get_real_seconds() - + lock->l_blast_sent; + LDLM_DEBUG(lock, "server cancels blocked lock after %ds", + delay); at_measured(&lock->l_export->exp_bl_lock_at, delay); } ldlm_lock_cancel(lock); diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 0bc4df685525..6f7b7bb8a744 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -125,9 +125,8 @@ int ldlm_expired_completion_wait(void *data) LDLM_ERROR(lock, "lock timed out (enqueued at %lld, %llds ago); " "not entering recovery in server code, just going back to sleep", - (s64)lock->l_activity, - (s64)(ktime_get_real_seconds() - - lock->l_activity)); + lock->l_activity, + ktime_get_real_seconds() - lock->l_activity); if (ktime_get_seconds() > next_dump) { last_dump = next_dump; next_dump = ktime_get_seconds() + 300; @@ -143,8 +142,8 @@ int ldlm_expired_completion_wait(void *data) imp = obd->u.cli.cl_import; ptlrpc_fail_import(imp, lwd->lwd_conn_cnt); LDLM_ERROR(lock, "lock timed out (enqueued at %lld, %llds ago), entering recovery for %s@%s", - (s64)lock->l_activity, - (s64)(ktime_get_real_seconds() - lock->l_activity), + lock->l_activity, + ktime_get_real_seconds() - lock->l_activity, obd2cli_tgt(obd), imp->imp_connection->c_remote_uuid.uuid); RETURN(0); @@ -175,9 +174,9 @@ EXPORT_SYMBOL(is_granted_or_cancelled_nolock); /* We use the same basis for both server side and client side functions from a single node. */ -static time64_t ldlm_cp_timeout(struct ldlm_lock *lock) +static timeout_t ldlm_cp_timeout(struct ldlm_lock *lock) { - time64_t timeout; + timeout_t timeout; if (AT_OFF) return obd_timeout; @@ -186,7 +185,7 @@ static time64_t ldlm_cp_timeout(struct ldlm_lock *lock) * lock from another client. Server will evict the other client if it * doesn't respond reasonably, and then give us the lock. */ timeout = at_get(ldlm_lock_to_ns_at(lock)); - return max(3 * timeout, (time64_t) ldlm_enqueue_min); + return max(3 * timeout, (timeout_t)ldlm_enqueue_min); } /** @@ -195,7 +194,6 @@ static time64_t ldlm_cp_timeout(struct ldlm_lock *lock) */ static int ldlm_completion_tail(struct ldlm_lock *lock, void *data) { - time64_t delay; int result = 0; if (ldlm_is_destroyed(lock) || ldlm_is_failed(lock)) { @@ -205,10 +203,16 @@ static int ldlm_completion_tail(struct ldlm_lock *lock, void *data) LDLM_DEBUG(lock, "client-side enqueue: granted"); } else { /* Take into AT only CP RPC, not immediately granted locks */ - delay = ktime_get_real_seconds() - lock->l_activity; - LDLM_DEBUG(lock, "client-side enqueue: granted after %llds", - (s64)delay); + timeout_t delay = 0; + /* Discard negative timeouts. We should also limit the + * maximum value of the timeout + */ + if (ktime_get_real_seconds() > lock->l_activity) + delay = ktime_get_real_seconds() - lock->l_activity; + + LDLM_DEBUG(lock, "client-side enqueue: granted after %ds", + delay); /* Update our time estimate */ at_measured(ldlm_lock_to_ns_at(lock), delay); } @@ -267,7 +271,7 @@ int ldlm_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data) struct obd_device *obd; struct obd_import *imp = NULL; struct l_wait_info lwi; - time64_t timeout; + timeout_t timeout; int rc = 0; ENTRY; diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c index 835790ff3bdc..f260d7e622d4 100644 --- a/lustre/ldlm/ldlm_resource.c +++ b/lustre/ldlm/ldlm_resource.c @@ -578,7 +578,7 @@ static ssize_t contention_seconds_show(struct kobject *kobj, struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace, ns_kobj); - return sprintf(buf, "%llu\n", ns->ns_contention_time); + return scnprintf(buf, PAGE_SIZE, "%d\n", ns->ns_contention_time); } static ssize_t contention_seconds_store(struct kobject *kobj, @@ -587,9 +587,9 @@ static ssize_t contention_seconds_store(struct kobject *kobj, { struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace, ns_kobj); - unsigned long long tmp; + unsigned int tmp; - if (kstrtoull(buffer, 10, &tmp)) + if (kstrtouint(buffer, 10, &tmp)) return -EINVAL; ns->ns_contention_time = tmp; diff --git a/lustre/mdd/mdd_trans.c b/lustre/mdd/mdd_trans.c index 075110d819b0..8fe93616bc74 100644 --- a/lustre/mdd/mdd_trans.c +++ b/lustre/mdd/mdd_trans.c @@ -104,10 +104,13 @@ static int mdd_changelog_gc_cb(const struct lu_env *env, * first as we assume they could be idle since longer */ if (rec->cur_time != 0) { - __u32 time_now = (__u32)ktime_get_real_seconds(); - __u32 time_out = rec->cur_time + - mdd->mdd_changelog_max_idle_time; - __u32 idle_time = time_now - rec->cur_time; + /* FIXME !!!! cur_time is a timestamp but only 32 bit in + * in size. This is not 2038 safe !!!! + */ + u32 time_now = (u32)ktime_get_real_seconds(); + timeout_t time_out = rec->cur_time + + mdd->mdd_changelog_max_idle_time; + timeout_t idle_time = time_now - rec->cur_time; /* treat oldest idle user first, and if no old format user * has been already selected diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 27344c9b8e3a..a1967532fd79 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -145,10 +145,10 @@ struct coordinator { * list */ struct mutex cdt_restore_lock; /**< protect restore * list */ - time64_t cdt_loop_period; /**< llog scan period */ - time64_t cdt_grace_delay; /**< request grace + timeout_t cdt_loop_period; /**< llog scan period */ + timeout_t cdt_grace_delay; /**< request grace * delay */ - time64_t cdt_active_req_timeout; /**< request timeout */ + timeout_t cdt_active_req_timeout; /**< request timeout */ __u32 cdt_default_archive_id; /**< archive id used * when none are * specified */ diff --git a/lustre/mdt/mdt_io.c b/lustre/mdt/mdt_io.c index edd6175a63e2..a9fa64f2ce6f 100644 --- a/lustre/mdt/mdt_io.c +++ b/lustre/mdt/mdt_io.c @@ -61,23 +61,6 @@ static inline void mdt_dom_write_unlock(struct mdt_object *mo) up_write(&mo->mot_dom_sem); } -/** - * Lock prolongation for Data-on-MDT. - * This is similar to OFD code but for DOM ibits lock. - */ -static inline time64_t prolong_timeout(struct ptlrpc_request *req) -{ - struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt; - time64_t req_timeout; - - if (AT_OFF) - return obd_timeout / 2; - - req_timeout = req->rq_deadline - req->rq_arrival_time.tv_sec; - return max_t(time64_t, at_est2timeout(at_get(&svcpt->scp_at_estimate)), - req_timeout); -} - static void mdt_dom_resource_prolong(struct ldlm_prolong_args *arg) { struct ldlm_resource *res; diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 111d880f6d3d..308a3a042b74 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -1018,7 +1018,7 @@ int lprocfs_import_seq_show(struct seq_file *m, void *data) } seq_printf(m, " service_estimates:\n" " services: %u sec\n" - " network: %u sec\n", + " network: %d sec\n", k, at_get(&imp->imp_at.iat_net_latency)); @@ -1112,8 +1112,8 @@ int lprocfs_timeouts_seq_show(struct seq_file *m, void *data) { struct obd_device *obd = (struct obd_device *)data; struct obd_import *imp; - unsigned int cur, worst; - time64_t now, worstt; + timeout_t cur_timeout, worst_timeout; + time64_t now, worst_timestamp; int i; LASSERT(obd != NULL); @@ -1127,23 +1127,29 @@ int lprocfs_timeouts_seq_show(struct seq_file *m, void *data) "last reply", (s64)imp->imp_last_reply_time, (s64)(now - imp->imp_last_reply_time)); - cur = at_get(&imp->imp_at.iat_net_latency); - worst = imp->imp_at.iat_net_latency.at_worst_ever; - worstt = imp->imp_at.iat_net_latency.at_worst_time; + cur_timeout = at_get(&imp->imp_at.iat_net_latency); + worst_timeout = imp->imp_at.iat_net_latency.at_worst_timeout_ever; + worst_timestamp = imp->imp_at.iat_net_latency.at_worst_timestamp; seq_printf(m, "%-10s : cur %3u worst %3u (at %lld, %llds ago) ", - "network", cur, worst, (s64)worstt, (s64)(now - worstt)); + "network", cur_timeout, worst_timeout, worst_timestamp, + now - worst_timestamp); lprocfs_at_hist_helper(m, &imp->imp_at.iat_net_latency); for(i = 0; i < IMP_AT_MAX_PORTALS; i++) { + struct adaptive_timeout *service_est; + if (imp->imp_at.iat_portal[i] == 0) break; - cur = at_get(&imp->imp_at.iat_service_estimate[i]); - worst = imp->imp_at.iat_service_estimate[i].at_worst_ever; - worstt = imp->imp_at.iat_service_estimate[i].at_worst_time; + + service_est = &imp->imp_at.iat_service_estimate[i]; + cur_timeout = at_get(service_est); + worst_timeout = service_est->at_worst_timeout_ever; + worst_timestamp = service_est->at_worst_timestamp; seq_printf(m, "portal %-2d : cur %3u worst %3u (at %lld, %llds ago) ", - imp->imp_at.iat_portal[i], cur, worst, (s64)worstt, - (s64)(now - worstt)); - lprocfs_at_hist_helper(m, &imp->imp_at.iat_service_estimate[i]); + imp->imp_at.iat_portal[i], cur_timeout, + worst_timeout, worst_timestamp, + now - worst_timestamp); + lprocfs_at_hist_helper(m, service_est); } LPROCFS_CLIMP_EXIT(obd); diff --git a/lustre/obdclass/lprocfs_status_server.c b/lustre/obdclass/lprocfs_status_server.c index 18dc9df07aa4..d2810beeb0cf 100644 --- a/lustre/obdclass/lprocfs_status_server.c +++ b/lustre/obdclass/lprocfs_status_server.c @@ -844,7 +844,7 @@ int lprocfs_recovery_time_soft_seq_show(struct seq_file *m, void *data) struct obd_device *obd = m->private; LASSERT(obd != NULL); - seq_printf(m, "%llu\n", obd->obd_recovery_timeout); + seq_printf(m, "%d\n", obd->obd_recovery_timeout); return 0; } EXPORT_SYMBOL(lprocfs_recovery_time_soft_seq_show); @@ -874,7 +874,7 @@ int lprocfs_recovery_time_hard_seq_show(struct seq_file *m, void *data) struct obd_device *obd = m->private; LASSERT(obd != NULL); - seq_printf(m, "%lld\n", obd->obd_recovery_time_hard); + seq_printf(m, "%d\n", obd->obd_recovery_time_hard); return 0; } EXPORT_SYMBOL(lprocfs_recovery_time_hard_seq_show); diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 452f3fdb1e0b..636dcc63e405 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -2290,29 +2290,6 @@ static int ofd_quotactl(struct tgt_session_info *tsi) RETURN(rc); } -/** - * Calculate the amount of time for lock prolongation. - * - * This is helper for ofd_prolong_extent_locks() function to get - * the timeout extra time. - * - * \param[in] req current request - * - * \retval amount of time to extend the timeout with - */ -static inline time64_t prolong_timeout(struct ptlrpc_request *req) -{ - struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt; - time64_t req_timeout; - - if (AT_OFF) - return obd_timeout / 2; - - req_timeout = req->rq_deadline - req->rq_arrival_time.tv_sec; - return max_t(time64_t, at_est2timeout(at_get(&svcpt->scp_at_estimate)), - req_timeout); -} - /** * Prolong lock timeout for the given extent. * diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index a9ce1544b322..2ac78716942a 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -314,10 +314,6 @@ EXPORT_SYMBOL(ptlrpc_free_bulk); */ void ptlrpc_at_set_req_timeout(struct ptlrpc_request *req) { - __u32 serv_est; - int idx; - struct imp_at *at; - LASSERT(req->rq_import); if (AT_OFF) { @@ -331,28 +327,39 @@ void ptlrpc_at_set_req_timeout(struct ptlrpc_request *req) */ req->rq_timeout = req->rq_import->imp_server_timeout ? obd_timeout / 2 : obd_timeout; - } else { - at = &req->rq_import->imp_at; - idx = import_at_get_index(req->rq_import, - req->rq_request_portal); - serv_est = at_get(&at->iat_service_estimate[idx]); - req->rq_timeout = at_est2timeout(serv_est); - } - /* We could get even fancier here, using history to predict increased - loading... */ + } else { + struct imp_at *at = &req->rq_import->imp_at; + timeout_t serv_est; + int idx; - /* Let the server know what this RPC timeout is by putting it in the - reqmsg*/ + idx = import_at_get_index(req->rq_import, + req->rq_request_portal); + serv_est = at_get(&at->iat_service_estimate[idx]); + /* + * Currently a 32 bit value is sent over the + * wire for rq_timeout so please don't change this + * to time64_t. The work for LU-1158 will in time + * replace rq_timeout with a 64 bit nanosecond value + */ + req->rq_timeout = at_est2timeout(serv_est); + } + /* + * We could get even fancier here, using history to predict increased + * loading... + * + * Let the server know what this RPC timeout is by putting it in the + * reqmsg + */ lustre_msg_set_timeout(req->rq_reqmsg, req->rq_timeout); } EXPORT_SYMBOL(ptlrpc_at_set_req_timeout); /* Adjust max service estimate based on server value */ static void ptlrpc_at_adj_service(struct ptlrpc_request *req, - unsigned int serv_est) + timeout_t serv_est) { int idx; - unsigned int oldse; + timeout_t oldse; struct imp_at *at; LASSERT(req->rq_import); @@ -379,9 +386,10 @@ int ptlrpc_at_get_net_latency(struct ptlrpc_request *req) void ptlrpc_at_adj_net_latency(struct ptlrpc_request *req, timeout_t service_timeout) { - unsigned int nl, oldnl; + time64_t now = ktime_get_real_seconds(); struct imp_at *at; - time64_t now = ktime_get_real_seconds(); + timeout_t oldnl; + timeout_t nl; LASSERT(req->rq_import); @@ -400,9 +408,10 @@ void ptlrpc_at_adj_net_latency(struct ptlrpc_request *req, return; } - /* Network latency is total time less server processing time */ - nl = max_t(int, now - req->rq_sent - - service_timeout, 0) + 1; /* st rounding */ + /* Network latency is total time less server processing time, + * st rounding + */ + nl = max_t(timeout_t, now - req->rq_sent - service_timeout, 0) + 1; at = &req->rq_import->imp_at; oldnl = at_measured(&at->iat_net_latency, nl); @@ -2167,7 +2176,7 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink) req->rq_real_sent < req->rq_sent || req->rq_real_sent >= req->rq_deadline) ? "timed out for sent delay" : "timed out for slow reply"), - (s64)req->rq_sent, (s64)req->rq_real_sent); + req->rq_sent, req->rq_real_sent); if (imp != NULL && obd_debug_peer_on_timeout) LNetDebugPeer(imp->imp_connection->c_peer); diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 46d92bf4ed2d..1d5a0d02a051 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -575,14 +575,16 @@ static int import_select_connection(struct obd_import *imp) trying to reconnect on it.) */ if (tried_all && (imp->imp_conn_list.next == &imp_conn->oic_item)) { struct adaptive_timeout *at = &imp->imp_at.iat_net_latency; + if (at_get(at) < CONNECTION_SWITCH_MAX) { at_measured(at, at_get(at) + CONNECTION_SWITCH_INC); if (at_get(at) > CONNECTION_SWITCH_MAX) at_reset(at, CONNECTION_SWITCH_MAX); } LASSERT(imp_conn->oic_last_attempt); - CDEBUG(D_HA, "%s: tried all connections, increasing latency " - "to %ds\n", imp->imp_obd->obd_name, at_get(at)); + CDEBUG(D_HA, + "%s: tried all connections, increasing latency to %ds\n", + imp->imp_obd->obd_name, at_get(at)); } imp_conn->oic_last_attempt = ktime_get_seconds(); @@ -1877,45 +1879,48 @@ void ptlrpc_cleanup_imp(struct obd_import *imp) /* Adaptive Timeout utils */ extern unsigned int at_min, at_max, at_history; -/* Update at_current with the specified value (bounded by at_min and at_max), - * as well as the AT history "bins". +/* Update at_current_timeout with the specified value (bounded by at_min and + * at_max), as well as the AT history "bins". * - Bin into timeslices using AT_BINS bins. * - This gives us a max of the last at_history seconds without the storage, * but still smoothing out a return to normalcy from a slow response. * - (E.g. remember the maximum latency in each minute of the last 4 minutes.) */ -int at_measured(struct adaptive_timeout *at, unsigned int val) +timeout_t at_measured(struct adaptive_timeout *at, timeout_t timeout) { - unsigned int old = at->at_current; + timeout_t old_timeout = at->at_current_timeout; time64_t now = ktime_get_real_seconds(); long binlimit = max_t(long, at_history / AT_BINS, 1); LASSERT(at); - CDEBUG(D_OTHER, "add %u to %p time=%lu v=%u (%u %u %u %u)\n", - val, at, (long)(now - at->at_binstart), at->at_current, + CDEBUG(D_OTHER, "add %u to %p time=%lld v=%u (%u %u %u %u)\n", + timeout, at, now - at->at_binstart, at->at_current_timeout, at->at_hist[0], at->at_hist[1], at->at_hist[2], at->at_hist[3]); - if (val == 0) - /* 0's don't count, because we never want our timeout to - drop to 0, and because 0 could mean an error */ + if (timeout <= 0) + /* Negative timeouts and 0's don't count, because we never + * want our timeout to drop to 0 or below, and because 0 could + * mean an error + */ return 0; spin_lock(&at->at_lock); if (unlikely(at->at_binstart == 0)) { /* Special case to remove default from history */ - at->at_current = val; - at->at_worst_ever = val; - at->at_worst_time = now; - at->at_hist[0] = val; + at->at_current_timeout = timeout; + at->at_worst_timeout_ever = timeout; + at->at_worst_timestamp = now; + at->at_hist[0] = timeout; at->at_binstart = now; } else if (now - at->at_binstart < binlimit ) { /* in bin 0 */ - at->at_hist[0] = max(val, at->at_hist[0]); - at->at_current = max(val, at->at_current); + at->at_hist[0] = max_t(timeout_t, timeout, at->at_hist[0]); + at->at_current_timeout = max_t(timeout_t, timeout, + at->at_current_timeout); } else { int i, shift; - unsigned int maxv = val; + timeout_t maxv = timeout; /* move bins over */ shift = (u32)(now - at->at_binstart) / binlimit; @@ -1923,42 +1928,45 @@ int at_measured(struct adaptive_timeout *at, unsigned int val) for(i = AT_BINS - 1; i >= 0; i--) { if (i >= shift) { at->at_hist[i] = at->at_hist[i - shift]; - maxv = max(maxv, at->at_hist[i]); + maxv = max_t(timeout_t, maxv, at->at_hist[i]); } else { at->at_hist[i] = 0; } } - at->at_hist[0] = val; - at->at_current = maxv; + at->at_hist[0] = timeout; + at->at_current_timeout = maxv; at->at_binstart += shift * binlimit; } - if (at->at_current > at->at_worst_ever) { - at->at_worst_ever = at->at_current; - at->at_worst_time = now; - } + if (at->at_current_timeout > at->at_worst_timeout_ever) { + at->at_worst_timeout_ever = at->at_current_timeout; + at->at_worst_timestamp = now; + } - if (at->at_flags & AT_FLG_NOHIST) + if (at->at_flags & AT_FLG_NOHIST) /* Only keep last reported val; keeping the rest of the history - for proc only */ - at->at_current = val; + * for debugfs only + */ + at->at_current_timeout = timeout; if (at_max > 0) - at->at_current = min(at->at_current, at_max); - at->at_current = max(at->at_current, at_min); - - if (at->at_current != old) - CDEBUG(D_OTHER, "AT %p change: old=%u new=%u delta=%d " - "(val=%u) hist %u %u %u %u\n", at, - old, at->at_current, at->at_current - old, val, + at->at_current_timeout = min_t(timeout_t, + at->at_current_timeout, at_max); + at->at_current_timeout = max_t(timeout_t, at->at_current_timeout, + at_min); + if (at->at_current_timeout != old_timeout) + CDEBUG(D_OTHER, + "AT %p change: old=%u new=%u delta=%d (val=%d) hist %u %u %u %u\n", + at, old_timeout, at->at_current_timeout, + at->at_current_timeout - old_timeout, timeout, at->at_hist[0], at->at_hist[1], at->at_hist[2], at->at_hist[3]); - /* if we changed, report the old value */ - old = (at->at_current != old) ? old : 0; + /* if we changed, report the old timeout value */ + old_timeout = (at->at_current_timeout != old_timeout) ? old_timeout : 0; spin_unlock(&at->at_lock); - return old; + return old_timeout; } /* Find the imp_at index for a given portal; assign if space available */ diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 659462a9787a..8ab01b52efa6 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -1111,12 +1111,12 @@ ptlrpc_lprocfs_svc_req_history_open(struct inode *inode, struct file *file) /* See also lprocfs_rd_timeouts */ static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n) { - struct ptlrpc_service *svc = m->private; - struct ptlrpc_service_part *svcpt; - time64_t worstt; - unsigned int cur; - unsigned int worst; - int i; + struct ptlrpc_service *svc = m->private; + struct ptlrpc_service_part *svcpt; + time64_t worst_timestamp; + timeout_t cur_timeout; + timeout_t worst_timeout; + int i; if (AT_OFF) { seq_printf(m, "adaptive timeouts off, using obd_timeout %u\n", @@ -1125,13 +1125,14 @@ static int ptlrpc_lprocfs_timeouts_seq_show(struct seq_file *m, void *n) } ptlrpc_service_for_each_part(svcpt, i, svc) { - cur = at_get(&svcpt->scp_at_estimate); - worst = svcpt->scp_at_estimate.at_worst_ever; - worstt = svcpt->scp_at_estimate.at_worst_time; + cur_timeout = at_get(&svcpt->scp_at_estimate); + worst_timeout = svcpt->scp_at_estimate.at_worst_timeout_ever; + worst_timestamp = svcpt->scp_at_estimate.at_worst_timestamp; seq_printf(m, "%10s : cur %3u worst %3u (at %lld, %llds ago) ", - "service", cur, worst, (s64)worstt, - (s64)(ktime_get_real_seconds() - worstt)); + "service", cur_timeout, worst_timeout, + worst_timestamp, + ktime_get_real_seconds() - worst_timestamp); lprocfs_at_hist_helper(m, &svcpt->scp_at_estimate); } diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index f6e0f57e2c78..de4f2daeb91e 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -510,9 +510,10 @@ static void ptlrpc_at_set_reply(struct ptlrpc_request *req, int flags) (MSG_RESENT | MSG_REPLAY | MSG_REQ_REPLAY_DONE | MSG_LOCK_REPLAY_DONE))) { /* early replies, errors and recovery requests don't count - * toward our service time estimate */ - int oldse = at_measured(&svcpt->scp_at_estimate, - service_timeout); + * toward our service time estimate + */ + timeout_t oldse = at_measured(&svcpt->scp_at_estimate, + service_timeout); if (oldse != 0) { DEBUG_REQ(D_ADAPTTO, req, @@ -532,7 +533,7 @@ static void ptlrpc_at_set_reply(struct ptlrpc_request *req, int flags) req->rq_export->exp_obd->obd_recovering)) { lustre_msg_set_timeout(req->rq_repmsg, 0); } else { - time64_t timeout; + timeout_t timeout; if (req->rq_export && req->rq_reqmsg != NULL && (flags & PTLRPC_REPLY_EARLY) && @@ -542,7 +543,7 @@ static void ptlrpc_at_set_reply(struct ptlrpc_request *req, int flags) timeout = ktime_get_real_seconds() - req->rq_arrival_time.tv_sec + - min_t(time64_t, at_extra, + min_t(timeout_t, at_extra, exp_obd->obd_recovery_timeout / 4); } else { timeout = at_get(&svcpt->scp_at_estimate); diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 6373c36865f3..fae979072485 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -1295,7 +1295,7 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req) struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt; struct ptlrpc_request *reqcopy; struct lustre_msg *reqmsg; - time64_t olddl = req->rq_deadline - ktime_get_real_seconds(); + timeout_t olddl = req->rq_deadline - ktime_get_real_seconds(); time64_t newdl; int rc; @@ -1309,18 +1309,18 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req) /* deadline is when the client expects us to reply, margin is the difference between clients' and servers' expectations */ DEBUG_REQ(D_ADAPTTO, req, - "%ssending early reply (deadline %+llds, margin %+llds) for " + "%ssending early reply (deadline %+ds, margin %+ds) for " "%d+%d", AT_OFF ? "AT off - not " : "", - (s64)olddl, (s64)(olddl - at_get(&svcpt->scp_at_estimate)), + olddl, olddl - at_get(&svcpt->scp_at_estimate), at_get(&svcpt->scp_at_estimate), at_extra); if (AT_OFF) RETURN(0); if (olddl < 0) { - DEBUG_REQ(D_WARNING, req, "Already past deadline (%+llds), " + DEBUG_REQ(D_WARNING, req, "Already past deadline (%+ds), " "not sending early reply. Consider increasing " - "at_early_margin (%d)?", (s64)olddl, at_early_margin); + "at_early_margin (%d)?", olddl, at_early_margin); /* Return an error so we're not re-added to the timed list. */ RETURN(-ETIMEDOUT); @@ -1369,8 +1369,8 @@ static int ptlrpc_at_send_early_reply(struct ptlrpc_request *req) /* Check to see if we've actually increased the deadline - * we may be past adaptive_max */ if (req->rq_deadline >= newdl) { - DEBUG_REQ(D_WARNING, req, "Couldn't add any time (%lld/%lld), not sending early reply\n", - (s64)olddl, (s64)(newdl - ktime_get_real_seconds())); + DEBUG_REQ(D_WARNING, req, "Couldn't add any time (%d/%lld), not sending early reply\n", + olddl, newdl - ktime_get_real_seconds()); RETURN(-ETIMEDOUT); } @@ -1459,7 +1459,7 @@ static int ptlrpc_at_check_timed(struct ptlrpc_service_part *svcpt) __u32 index, count; time64_t deadline; time64_t now = ktime_get_real_seconds(); - s64 delay; + s64 delay_ms; int first, counter = 0; ENTRY; @@ -1468,7 +1468,7 @@ static int ptlrpc_at_check_timed(struct ptlrpc_service_part *svcpt) spin_unlock(&svcpt->scp_at_lock); RETURN(0); } - delay = ktime_ms_delta(ktime_get(), svcpt->scp_at_checktime); + delay_ms = ktime_ms_delta(ktime_get(), svcpt->scp_at_checktime); svcpt->scp_at_check = 0; if (array->paa_count == 0) { @@ -1536,10 +1536,10 @@ static int ptlrpc_at_check_timed(struct ptlrpc_service_part *svcpt) LCONSOLE_WARN("%s: This server is not able to keep up with " "request traffic (cpu-bound).\n", svcpt->scp_service->srv_name); - CWARN("earlyQ=%d reqQ=%d recA=%d, svcEst=%d, delay=%lld\n", + CWARN("earlyQ=%d reqQ=%d recA=%d, svcEst=%d, delay=%lldms\n", counter, svcpt->scp_nreqs_incoming, svcpt->scp_nreqs_active, - at_get(&svcpt->scp_at_estimate), delay); + at_get(&svcpt->scp_at_estimate), delay_ms); } /* we took additional refcount so entries can't be deleted from list, no @@ -2011,8 +2011,8 @@ ptlrpc_server_handle_req_in(struct ptlrpc_service_part *svcpt, /* req_in handling should/must be fast */ if (ktime_get_real_seconds() - req->rq_arrival_time.tv_sec > 5) DEBUG_REQ(D_WARNING, req, "Slow req_in handling %llds", - (s64)(ktime_get_real_seconds() - - req->rq_arrival_time.tv_sec)); + ktime_get_real_seconds() - + req->rq_arrival_time.tv_sec); /* Set rpc server deadline and add it to the timed list */ deadline = (lustre_msghdr_get_flags(req->rq_reqmsg) & diff --git a/lustre/quota/qmt_handler.c b/lustre/quota/qmt_handler.c index 784fdab870a4..d5dfbc85570c 100644 --- a/lustre/quota/qmt_handler.c +++ b/lustre/quota/qmt_handler.c @@ -734,7 +734,7 @@ static int qmt_dqacq(const struct lu_env *env, struct lu_device *ld, if (ldlm_is_ast_sent(lock)) { struct ptlrpc_service_part *svc; - time64_t timeout; + timeout_t timeout; svc = req->rq_rqbd->rqbd_svcpt; timeout = at_est2timeout(at_get(&svc->scp_at_estimate)); -- 2.41.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor