Received: by 10.213.65.68 with SMTP id h4csp619923imn; Fri, 30 Mar 2018 12:02:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/QDjpik4i0NeYHj60FQZTrZrtXAwWwK2C9XmvOq7Cd2KbU4fERwL0rQnrFuv2mAnJCRQcA X-Received: by 2002:a17:902:143:: with SMTP id 61-v6mr167453plb.345.1522436529044; Fri, 30 Mar 2018 12:02:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522436529; cv=none; d=google.com; s=arc-20160816; b=fO2vXfQF+Mav4BTImgnJDFkBnBoDr+LR/p4cm8U9YMdjUMvBJOwkMK4JHpoadjDJB5 lTOdljPWK1I6nWzRVFSSnnWPb3yRFpFfwozumZUYHgohRoy4V4LP6LUVIbxyl0CTLS/v m6+a1AN05P2vf386DpV9DUjbPTN6SqzNgWQZe3gzhcEZKj1JaOlPoUcy+/JTVdrYdCMh SmNKXdy1Y0QRmP4x4ukNbmreFvL0zR7FEx4aS5o2r/9hLg9VGqw+DY9oZJIfoCJVNy9N EkQufbzmOlURtJ1eyQ1br7JPaC1+qFqeBdXmgGaypqgG6HT+yajVY2mshmlxwc7QmIFL nyxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=ZwAV/oYlrvz0LaKy/+ChWfusCKWacggjAvYmu3AVc+U=; b=gPCb5DF0nR+iL2fW7ekyKFd1Ri0eJIJtc3nclj1kNK/F4GOOj99r/dwfJwAhzvinm+ X2coTXZk5+ROfLWKJ1o/MBIGuciqZOL5HKsVa1DKLi2QLZA1uStA9+dpghiJsw1txs2X S5Z/1+8yTCzSzHmQcFJiFL+TVkKGM1+Dy3fzeCtACwhoj8uXPOnIKjyVcLLsQrdhgoKU 0PuR91ATujSO7ZcbpcMS3W1mObWFrCf1k8bKggbu1htIr0Q4jYHhk3TYktwApejZb6xc XvkBC4woRy6Vk6xWLSizNJ15ghHh5exTlH5KBhkTTlCuqxQYx9OUqDKKe9m2zzIx5M3K 6T2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=abOuAz/F; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14-v6si1848580pll.116.2018.03.30.12.01.55; Fri, 30 Mar 2018 12:02:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=abOuAz/F; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752600AbeC3TAi (ORCPT + 99 others); Fri, 30 Mar 2018 15:00:38 -0400 Received: from casper.infradead.org ([85.118.1.10]:46312 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752210AbeC3TAg (ORCPT ); Fri, 30 Mar 2018 15:00:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Message-ID:In-Reply-To:Subject:cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZwAV/oYlrvz0LaKy/+ChWfusCKWacggjAvYmu3AVc+U=; b=abOuAz/FxqfERTV4VzEczIWo2 PwVeCUlCCUTUPsFoh0pwzpeYZkKxn+yILYwXD0rewDB5uXfKRV0U6EFCS7M33FJn8wNgv2XfUh6k8 HxXpbXDGam/Kd0vVPjMa9w+X/2207Ao9VTg80CC5U6lFPbQxNoCAmv43Fs3UmFPFd+KYdsmM6PfxT yR1vK0jzTr8TPOKj1jUca7wPQGV2YdOUpwXxnSSe5tc0RlM5H1HEaS3DFTur4gMzKpRJ2dTaOTYVX EXWNbK/4X14lz2oYNRrCjEVO2m5qafUNTu0zMZTWNJhv34Weg8siFKf8XfiIKuJUjHzmxpA8wE4Zl 9y4JIo07w==; Received: from jsimmons (helo=localhost) by casper.infradead.org with local-esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f1zGI-0002iV-ED; Fri, 30 Mar 2018 19:00:32 +0000 Date: Fri, 30 Mar 2018 20:00:30 +0100 (BST) From: James Simmons To: NeilBrown cc: Oleg Drokin , Greg Kroah-Hartman , Andreas Dilger , Linux Kernel Mailing List , Lustre Development List Subject: Re: [PATCH 10/17] staging: lustre: libcfs: discard cfs_time_add/sub In-Reply-To: <152229760858.27689.1121127347892062619.stgit@noble> Message-ID: References: <152229732768.27689.4800156943561963977.stgit@noble> <152229760858.27689.1121127347892062619.stgit@noble> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180330_200030_478296_2074C49D X-CRM114-Status: GOOD ( 28.03 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 NO_RELAYS Informational: message was not relayed via SMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > cfs_time_add adds its arguments. > cfs_time_sub subtracts finds the difference. > Discard these and use '+' and '-' directly. > > This change highlighted a type error. The structure field > cr_queued_time was used to store jiffies, but was declared > as time_t (meant for seconds). So the time is changed to > "unsigned long". Reviewed-by: James Simmons > Signed-off-by: NeilBrown > --- > .../lustre/include/linux/libcfs/libcfs_time.h | 12 +--------- > .../lustre/include/linux/libcfs/linux/linux-time.h | 8 +------ > .../staging/lustre/lnet/klnds/socklnd/socklnd.c | 2 +- > .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 23 +++++++------------- > drivers/staging/lustre/lnet/lnet/lib-move.c | 6 ++--- > drivers/staging/lustre/lnet/lnet/router.c | 5 ++-- > drivers/staging/lustre/lnet/lnet/router_proc.c | 7 +++--- > drivers/staging/lustre/lnet/selftest/conrpc.c | 4 ++- > drivers/staging/lustre/lnet/selftest/timer.c | 2 +- > drivers/staging/lustre/lustre/include/lustre_net.h | 5 ++-- > drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 3 +-- > drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 8 +++---- > drivers/staging/lustre/lustre/osc/osc_object.c | 3 +-- > drivers/staging/lustre/lustre/ptlrpc/pinger.c | 9 +++----- > drivers/staging/lustre/lustre/ptlrpc/service.c | 2 +- > 15 files changed, 32 insertions(+), 67 deletions(-) > > diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_time.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_time.h > index df7a3f13f3b3..7b41a129f041 100644 > --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_time.h > +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_time.h > @@ -40,16 +40,6 @@ > * generic time manipulation functions. > */ > > -static inline unsigned long cfs_time_add(unsigned long t, long d) > -{ > - return (unsigned long)(t + d); > -} > - > -static inline unsigned long cfs_time_sub(unsigned long t1, unsigned long t2) > -{ > - return (unsigned long)(t1 - t2); > -} > - > static inline int cfs_time_after(unsigned long t1, unsigned long t2) > { > return time_before(t2, t1); > @@ -62,7 +52,7 @@ static inline int cfs_time_aftereq(unsigned long t1, unsigned long t2) > > static inline unsigned long cfs_time_shift(int seconds) > { > - return cfs_time_add(jiffies, seconds * HZ); > + return jiffies + seconds * HZ; > } > > /* > diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-time.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-time.h > index ba115e8c820f..b3a80531bd71 100644 > --- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-time.h > +++ b/drivers/staging/lustre/include/linux/libcfs/linux/linux-time.h > @@ -65,15 +65,9 @@ static inline long cfs_duration_sec(long d) > return d / msecs_to_jiffies(MSEC_PER_SEC); > } > > -static inline u64 cfs_time_add_64(u64 t, u64 d) > -{ > - return t + d; > -} > - > static inline u64 cfs_time_shift_64(int seconds) > { > - return cfs_time_add_64(get_jiffies_64(), > - seconds * HZ); > + return get_jiffies_64() + (u64)seconds * HZ; > } > > static inline int cfs_time_before_64(u64 t1, u64 t2) > diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c > index 0efde0009a15..4546618c1c12 100644 > --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c > +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c > @@ -1682,7 +1682,7 @@ ksocknal_destroy_conn(struct ksock_conn *conn) > libcfs_id2str(conn->ksnc_peer->ksnp_id), conn->ksnc_type, > &conn->ksnc_ipaddr, conn->ksnc_port, > iov_iter_count(&conn->ksnc_rx_to), conn->ksnc_rx_nob_left, > - cfs_duration_sec(cfs_time_sub(jiffies, last_rcv))); > + cfs_duration_sec(jiffies - last_rcv)); > lnet_finalize(conn->ksnc_peer->ksnp_ni, > conn->ksnc_cookie, -EIO); > break; > diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c > index f97da4540b51..5b34c7c030ad 100644 > --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c > +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c > @@ -481,8 +481,7 @@ ksocknal_process_transmit(struct ksock_conn *conn, struct ksock_tx *tx) > LASSERT(conn->ksnc_tx_scheduled); > list_add_tail(&conn->ksnc_tx_list, > &ksocknal_data.ksnd_enomem_conns); > - if (!cfs_time_aftereq(cfs_time_add(jiffies, > - SOCKNAL_ENOMEM_RETRY), > + if (!cfs_time_aftereq(jiffies + SOCKNAL_ENOMEM_RETRY, > ksocknal_data.ksnd_reaper_waketime)) > wake_up(&ksocknal_data.ksnd_reaper_waitq); > > @@ -1777,8 +1776,7 @@ ksocknal_connect(struct ksock_route *route) > int retry_later = 0; > int rc = 0; > > - deadline = cfs_time_add(jiffies, > - *ksocknal_tunables.ksnd_timeout * HZ); > + deadline = jiffies + *ksocknal_tunables.ksnd_timeout * HZ; > > write_lock_bh(&ksocknal_data.ksnd_global_lock); > > @@ -1877,8 +1875,7 @@ ksocknal_connect(struct ksock_route *route) > */ > route->ksnr_retry_interval = > *ksocknal_tunables.ksnd_min_reconnectms * HZ / 1000; > - route->ksnr_timeout = cfs_time_add(jiffies, > - route->ksnr_retry_interval); > + route->ksnr_timeout = jiffies + route->ksnr_retry_interval; > } > > ksocknal_launch_connection_locked(route); > @@ -1903,8 +1900,7 @@ ksocknal_connect(struct ksock_route *route) > (long)*ksocknal_tunables.ksnd_max_reconnectms * HZ / 1000); > > LASSERT(route->ksnr_retry_interval); > - route->ksnr_timeout = cfs_time_add(jiffies, > - route->ksnr_retry_interval); > + route->ksnr_timeout = jiffies + route->ksnr_retry_interval; > > if (!list_empty(&peer->ksnp_tx_queue) && > !peer->ksnp_accepting && > @@ -2302,8 +2298,7 @@ ksocknal_send_keepalive_locked(struct ksock_peer *peer) > > if (*ksocknal_tunables.ksnd_keepalive <= 0 || > time_before(jiffies, > - cfs_time_add(peer->ksnp_last_alive, > - *ksocknal_tunables.ksnd_keepalive * HZ))) > + peer->ksnp_last_alive + *ksocknal_tunables.ksnd_keepalive * HZ)) > return 0; > > if (time_before(jiffies, peer->ksnp_send_keepalive)) > @@ -2531,8 +2526,7 @@ ksocknal_reaper(void *arg) > } > > /* careful with the jiffy wrap... */ > - while ((timeout = cfs_time_sub(deadline, > - jiffies)) <= 0) { > + while ((timeout = deadline - jiffies) <= 0) { > const int n = 4; > const int p = 1; > int chunk = ksocknal_data.ksnd_peer_hash_size; > @@ -2557,7 +2551,7 @@ ksocknal_reaper(void *arg) > ksocknal_data.ksnd_peer_hash_size; > } > > - deadline = cfs_time_add(deadline, p * HZ); > + deadline = deadline + p * HZ; > } > > if (nenomem_conns) { > @@ -2568,8 +2562,7 @@ ksocknal_reaper(void *arg) > */ > timeout = SOCKNAL_ENOMEM_RETRY; > } > - ksocknal_data.ksnd_reaper_waketime = > - cfs_time_add(jiffies, timeout); > + ksocknal_data.ksnd_reaper_waketime = jiffies + timeout; > > set_current_state(TASK_INTERRUPTIBLE); > add_wait_queue(&ksocknal_data.ksnd_reaper_waitq, &wait); > diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c > index 289ed876bd81..5574d2148c9d 100644 > --- a/drivers/staging/lustre/lnet/lnet/lib-move.c > +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c > @@ -523,8 +523,7 @@ lnet_peer_is_alive(struct lnet_peer *lp, unsigned long now) > cfs_time_aftereq(lp->lp_timestamp, lp->lp_last_alive)) > return 0; > > - deadline = cfs_time_add(lp->lp_last_alive, > - lp->lp_ni->ni_peertimeout * HZ); > + deadline = lp->lp_last_alive + lp->lp_ni->ni_peertimeout * HZ; > alive = cfs_time_after(deadline, now); > > /* Update obsolete lp_alive except for routers assumed to be dead > @@ -561,8 +560,7 @@ lnet_peer_alive_locked(struct lnet_peer *lp) > static const int lnet_queryinterval = 1; > > unsigned long next_query = > - cfs_time_add(lp->lp_last_query, > - lnet_queryinterval * HZ); > + lp->lp_last_query + lnet_queryinterval * HZ; > > if (time_before(now, next_query)) { > if (lp->lp_alive) > diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c > index ac9b392a0afa..4595a7ad4336 100644 > --- a/drivers/staging/lustre/lnet/lnet/router.c > +++ b/drivers/staging/lustre/lnet/lnet/router.c > @@ -1010,8 +1010,7 @@ lnet_ping_router_locked(struct lnet_peer *rtr) > rtr->lp_alive, rtr->lp_alive_count, rtr->lp_ping_timestamp); > > if (secs && !rtr->lp_ping_notsent && > - cfs_time_after(now, cfs_time_add(rtr->lp_ping_timestamp, > - secs * HZ))) { > + cfs_time_after(now, rtr->lp_ping_timestamp + secs * HZ)) { > int rc; > struct lnet_process_id id; > struct lnet_handle_md mdh; > @@ -1753,7 +1752,7 @@ lnet_notify(struct lnet_ni *ni, lnet_nid_t nid, int alive, unsigned long when) > CWARN("Ignoring prediction from %s of %s %s %ld seconds in the future\n", > !ni ? "userspace" : libcfs_nid2str(ni->ni_nid), > libcfs_nid2str(nid), alive ? "up" : "down", > - cfs_duration_sec(cfs_time_sub(when, now))); > + cfs_duration_sec(when - now)); > return -EINVAL; > } > > diff --git a/drivers/staging/lustre/lnet/lnet/router_proc.c b/drivers/staging/lustre/lnet/lnet/router_proc.c > index 315d067540c0..e4172311be68 100644 > --- a/drivers/staging/lustre/lnet/lnet/router_proc.c > +++ b/drivers/staging/lustre/lnet/lnet/router_proc.c > @@ -331,8 +331,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write, > int alive_cnt = peer->lp_alive_count; > int alive = peer->lp_alive; > int pingsent = !peer->lp_ping_notsent; > - int last_ping = cfs_duration_sec(cfs_time_sub(now, > - peer->lp_ping_timestamp)); > + int last_ping = cfs_duration_sec(now - peer->lp_ping_timestamp); > int down_ni = 0; > struct lnet_route *rtr; > > @@ -364,7 +363,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write, > nrefs, nrtrrefs, alive_cnt, > alive ? "up" : "down", last_ping, > pingsent, > - cfs_duration_sec(cfs_time_sub(deadline, now)), > + cfs_duration_sec(deadline - now), > down_ni, libcfs_nid2str(nid)); > LASSERT(tmpstr + tmpsiz - s > 0); > } > @@ -512,7 +511,7 @@ static int proc_lnet_peers(struct ctl_table *table, int write, > unsigned long now = jiffies; > long delta; > > - delta = cfs_time_sub(now, peer->lp_last_alive); > + delta = now - peer->lp_last_alive; > lastalive = cfs_duration_sec(delta); > > /* No need to mess up peers contents with > diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c > index 68e06e06857d..ea4944b9108b 100644 > --- a/drivers/staging/lustre/lnet/selftest/conrpc.c > +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c > @@ -500,8 +500,8 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans, > > nd = crpc->crp_node; > > - dur = (long)cfs_time_sub(crpc->crp_stamp, > - (unsigned long)console_session.ses_id.ses_stamp); > + dur = (long)(crpc->crp_stamp - > + (unsigned long)console_session.ses_id.ses_stamp); > jiffies_to_timeval(dur, &tv); > > if (copy_to_user(&ent->rpe_peer, &nd->nd_id, > diff --git a/drivers/staging/lustre/lnet/selftest/timer.c b/drivers/staging/lustre/lnet/selftest/timer.c > index 1b2c5fc81358..1f9d5487e2f5 100644 > --- a/drivers/staging/lustre/lnet/selftest/timer.c > +++ b/drivers/staging/lustre/lnet/selftest/timer.c > @@ -157,7 +157,7 @@ stt_check_timers(unsigned long *last) > > while (cfs_time_aftereq(this_slot, *last)) { > expired += stt_expire_list(STTIMER_SLOT(this_slot), now); > - this_slot = cfs_time_sub(this_slot, STTIMER_SLOTTIME); > + this_slot = this_slot - STTIMER_SLOTTIME; > } > > *last = now & STTIMER_SLOTTIMEMASK; > diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h > index f4824d8ec741..d13db55b7242 100644 > --- a/drivers/staging/lustre/lustre/include/lustre_net.h > +++ b/drivers/staging/lustre/lustre/include/lustre_net.h > @@ -556,7 +556,7 @@ struct ptlrpc_cli_req { > /** optional time limit for send attempts */ > long cr_delay_limit; > /** time request was first queued */ > - time_t cr_queued_time; > + unsigned long cr_queued_time; > /** request sent timeval */ > struct timespec64 cr_sent_tv; > /** time for request really sent out */ > @@ -2253,8 +2253,7 @@ static inline int ptlrpc_req_get_repsize(struct ptlrpc_request *req) > static inline int ptlrpc_send_limit_expired(struct ptlrpc_request *req) > { > if (req->rq_delay_limit != 0 && > - time_before(cfs_time_add(req->rq_queued_time, > - req->rq_delay_limit * HZ), > + time_before(req->rq_queued_time + req->rq_delay_limit * HZ, > jiffies)) { > return 1; > } > diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c > index ab4dd15c8dd4..150e78c9eb68 100644 > --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c > +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c > @@ -326,8 +326,7 @@ static void ldlm_handle_gl_callback(struct ptlrpc_request *req, > if (lock->l_granted_mode == LCK_PW && > !lock->l_readers && !lock->l_writers && > cfs_time_after(jiffies, > - cfs_time_add(lock->l_last_used, > - 10 * HZ))) { > + lock->l_last_used + 10 * HZ)) { > unlock_res_and_lock(lock); > if (ldlm_bl_to_thread_lock(ns, NULL, lock)) > ldlm_handle_bl_callback(ns, NULL, lock); > diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c > index 0e1b21c1f06d..6eb42f16040d 100644 > --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c > +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c > @@ -1176,13 +1176,12 @@ static enum ldlm_policy_res ldlm_cancel_lrur_policy(struct ldlm_namespace *ns, > * Despite of the LV, It doesn't make sense to keep the lock which > * is unused for ns_max_age time. > */ > - if (cfs_time_after(jiffies, > - cfs_time_add(lock->l_last_used, ns->ns_max_age))) > + if (cfs_time_after(jiffies, lock->l_last_used + ns->ns_max_age)) > return LDLM_POLICY_CANCEL_LOCK; > > slv = ldlm_pool_get_slv(pl); > lvf = ldlm_pool_get_lvf(pl); > - la = cfs_duration_sec(cfs_time_sub(cur, lock->l_last_used)); > + la = cfs_duration_sec(cur - lock->l_last_used); > lv = lvf * la * unused; > > /* Inform pool about current CLV to see it via debugfs. */ > @@ -1233,8 +1232,7 @@ static enum ldlm_policy_res ldlm_cancel_aged_policy(struct ldlm_namespace *ns, > int count) > { > if ((added >= count) && > - time_before(jiffies, > - cfs_time_add(lock->l_last_used, ns->ns_max_age))) > + time_before(jiffies, lock->l_last_used + ns->ns_max_age)) > return LDLM_POLICY_KEEP_LOCK; > > return LDLM_POLICY_CANCEL_LOCK; > diff --git a/drivers/staging/lustre/lustre/osc/osc_object.c b/drivers/staging/lustre/lustre/osc/osc_object.c > index c5dc894a4c1b..154d1721636e 100644 > --- a/drivers/staging/lustre/lustre/osc/osc_object.c > +++ b/drivers/staging/lustre/lustre/osc/osc_object.c > @@ -327,8 +327,7 @@ int osc_object_is_contended(struct osc_object *obj) > * I like copy-paste. the code is copied from > * ll_file_is_contended. > */ > - retry_time = cfs_time_add(obj->oo_contention_time, > - osc_contention_time * HZ); > + retry_time = obj->oo_contention_time + osc_contention_time * HZ; > if (cfs_time_after(cur_time, retry_time)) { > osc_object_clear_contended(obj); > return 0; > diff --git a/drivers/staging/lustre/lustre/ptlrpc/pinger.c b/drivers/staging/lustre/lustre/ptlrpc/pinger.c > index 57c7db47e249..e836591c5936 100644 > --- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c > +++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c > @@ -141,8 +141,7 @@ static long pinger_check_timeout(unsigned long time) > } > mutex_unlock(&pinger_mutex); > > - return cfs_time_sub(cfs_time_add(time, timeout * HZ), > - jiffies); > + return time + timeout * HZ - jiffies; > } > > static bool ir_up; > @@ -238,8 +237,7 @@ static void ptlrpc_pinger_main(struct work_struct *ws) > /* obd_timeout might have changed */ > if (imp->imp_pingable && imp->imp_next_ping && > cfs_time_after(imp->imp_next_ping, > - cfs_time_add(this_ping, > - PING_INTERVAL * HZ))) > + this_ping + PING_INTERVAL * HZ)) > ptlrpc_update_next_ping(imp, 0); > } > mutex_unlock(&pinger_mutex); > @@ -255,8 +253,7 @@ static void ptlrpc_pinger_main(struct work_struct *ws) > */ > CDEBUG(D_INFO, "next wakeup in " CFS_DURATION_T " (%ld)\n", > time_to_next_wake, > - cfs_time_add(this_ping, > - PING_INTERVAL * HZ)); > + this_ping + PING_INTERVAL * HZ); > } while (time_to_next_wake <= 0); > > queue_delayed_work(pinger_wq, &ping_work, > diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c > index fc29efbd9914..e71046db28e5 100644 > --- a/drivers/staging/lustre/lustre/ptlrpc/service.c > +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c > @@ -1153,7 +1153,7 @@ static void ptlrpc_at_check_timed(struct ptlrpc_service_part *svcpt) > spin_unlock(&svcpt->scp_at_lock); > return; > } > - delay = cfs_time_sub(jiffies, svcpt->scp_at_checktime); > + delay = jiffies - svcpt->scp_at_checktime; > svcpt->scp_at_check = 0; > > if (array->paa_count == 0) { > > >