From 699503bcabbf79b1e3914df7e2bd67034469f92c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 12 Jul 2014 01:03:41 -0700 Subject: [PATCH] staging: lustre: remove cfs_time_before() Just call time_before() instead. Cc: Andreas Dilger Cc: Oleg Drokin Cc: hpdd-discuss Signed-off-by: Greg Kroah-Hartman --- .../lustre/include/linux/libcfs/libcfs_time.h | 2 +- .../include/linux/libcfs/linux/linux-time.h | 30 ------------------- .../lustre/lnet/klnds/o2iblnd/o2iblnd.c | 4 +-- .../lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 4 +-- .../lustre/lnet/klnds/socklnd/socklnd_cb.c | 9 +++--- drivers/staging/lustre/lnet/lnet/lib-move.c | 2 +- drivers/staging/lustre/lnet/lnet/router.c | 2 +- .../lustre/include/linux/lustre_fsfilt.h | 6 ++-- .../lustre/lustre/include/lustre_export.h | 4 +-- .../lustre/lustre/include/lustre_net.h | 6 ++-- .../staging/lustre/lustre/ldlm/ldlm_request.c | 5 ++-- .../lustre/lustre/ldlm/ldlm_resource.c | 2 +- .../lustre/lustre/libcfs/upcall_cache.c | 5 ++-- .../staging/lustre/lustre/llite/llite_capa.c | 2 +- .../staging/lustre/lustre/llite/statahead.c | 2 +- drivers/staging/lustre/lustre/obdclass/capa.c | 6 ++-- drivers/staging/lustre/lustre/ptlrpc/client.c | 2 +- 17 files changed, 30 insertions(+), 63 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_time.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_time.h index 3371e9e0bb43..1344139c46c3 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_time.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_time.h @@ -55,7 +55,7 @@ static inline unsigned long cfs_time_sub(unsigned long t1, unsigned long t2) static inline int cfs_time_after(unsigned long t1, unsigned long t2) { - return cfs_time_before(t2, t1); + return time_before(t2, t1); } static inline int cfs_time_aftereq(unsigned long t1, unsigned long t2) 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 b64dfc51287f..1158a3112bcc 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-time.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/linux-time.h @@ -45,31 +45,6 @@ #error Do not #include this file directly. #include instead #endif -/* Portable time API */ - -/* - * Platform provides three opaque data-types: - * - * unsigned long cfs_time_current(void); - * unsigned long cfs_time_add (unsigned long, long); - * long cfs_time_sub (unsigned long, unsigned long); - * int cfs_impl_time_before (unsigned long, unsigned long); - * int cfs_impl_time_before_eq(unsigned long, unsigned long); - * - * long cfs_duration_build(int64_t); - * - * time_t cfs_duration_sec (long); - * void cfs_duration_usec(long, struct timeval *); - * - * void cfs_fs_time_current(struct timespec *); - * time_t cfs_fs_time_sec (struct timespec *); - * void cfs_fs_time_usec (struct timespec *, struct timeval *); - * - * CFS_TIME_FORMAT - * CFS_DURATION_FORMAT - * - */ - #define ONE_BILLION ((u_int64_t)1000000000) #define ONE_MILLION 1000000 @@ -97,11 +72,6 @@ static inline void cfs_fs_time_usec(struct timespec *t, struct timeval *v) * Generic kernel stuff */ -static inline int cfs_time_before(unsigned long t1, unsigned long t2) -{ - return time_before(t1, t2); -} - static inline unsigned long cfs_time_current(void) { return jiffies; diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 0cdcd5a0521c..7a47144787d6 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -1606,7 +1606,7 @@ kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages, } - if (cfs_time_before(cfs_time_current(), fps->fps_next_retry)) { + if (time_before(cfs_time_current(), fps->fps_next_retry)) { /* someone failed recently */ spin_unlock(&fps->fps_lock); return -EAGAIN; @@ -1808,7 +1808,7 @@ kiblnd_pool_alloc_node(kib_poolset_t *ps) goto again; } - if (cfs_time_before(cfs_time_current(), ps->ps_next_retry)) { + if (time_before(cfs_time_current(), ps->ps_next_retry)) { /* someone failed recently */ spin_unlock(&ps->ps_lock); return NULL; diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 14f3decb77f1..21cd02c369dd 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -3465,8 +3465,8 @@ kiblnd_failover_thread(void *arg) list_for_each_entry(dev, &kiblnd_data.kib_failed_devs, ibd_fail_list) { - if (cfs_time_before(cfs_time_current(), - dev->ibd_next_failover)) + if (time_before(cfs_time_current(), + dev->ibd_next_failover)) continue; do_failover = 1; break; diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c index 804a6345f2bd..873c5e72a2b5 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c @@ -2368,13 +2368,12 @@ ksocknal_send_keepalive_locked(ksock_peer_t *peer) return 0; if (*ksocknal_tunables.ksnd_keepalive <= 0 || - cfs_time_before(cfs_time_current(), - cfs_time_add(peer->ksnp_last_alive, - cfs_time_seconds(*ksocknal_tunables.ksnd_keepalive)))) + time_before(cfs_time_current(), + cfs_time_add(peer->ksnp_last_alive, + cfs_time_seconds(*ksocknal_tunables.ksnd_keepalive)))) return 0; - if (cfs_time_before(cfs_time_current(), - peer->ksnp_send_keepalive)) + if (time_before(cfs_time_current(), peer->ksnp_send_keepalive)) return 0; /* retry 10 secs later, so we wouldn't put pressure diff --git a/drivers/staging/lustre/lnet/lnet/lib-move.c b/drivers/staging/lustre/lnet/lnet/lib-move.c index 45412a5444c2..4ceec131d1a4 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-move.c +++ b/drivers/staging/lustre/lnet/lnet/lib-move.c @@ -751,7 +751,7 @@ lnet_peer_alive_locked(lnet_peer_t *lp) cfs_time_add(lp->lp_last_query, cfs_time_seconds(lnet_queryinterval)); - if (cfs_time_before(now, next_query)) { + if (time_before(now, next_query)) { if (lp->lp_alive) CWARN("Unexpected aliveness of peer %s: " "%d < %d (%d/%d)\n", diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 6b19f8707c47..ac38ad271071 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -109,7 +109,7 @@ lnet_peers_start_down(void) void lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, unsigned long when) { - if (cfs_time_before(when, lp->lp_timestamp)) { /* out of date information */ + if (time_before(when, lp->lp_timestamp)) { /* out of date information */ CDEBUG(D_NET, "Out of date\n"); return; } diff --git a/drivers/staging/lustre/lustre/include/linux/lustre_fsfilt.h b/drivers/staging/lustre/lustre/include/linux/lustre_fsfilt.h index 75cc32c02eb5..d5c97beb66f5 100644 --- a/drivers/staging/lustre/lustre/include/linux/lustre_fsfilt.h +++ b/drivers/staging/lustre/lustre/include/linux/lustre_fsfilt.h @@ -90,12 +90,12 @@ static inline char *fsfilt_get_label(struct obd_device *obd, #define __fsfilt_check_slow(obd, start, msg) \ do { \ - if (cfs_time_before(jiffies, start + 15 * HZ)) \ + if (time_before(jiffies, start + 15 * HZ)) \ break; \ - else if (cfs_time_before(jiffies, start + 30 * HZ)) \ + else if (time_before(jiffies, start + 30 * HZ)) \ CDEBUG(D_VFSTRACE, "%s: slow %s %lus\n", obd->obd_name, \ msg, (jiffies-start) / HZ); \ - else if (cfs_time_before(jiffies, start + DISK_TIMEOUT * HZ)) \ + else if (time_before(jiffies, start + DISK_TIMEOUT * HZ)) \ CWARN("%s: slow %s %lus\n", obd->obd_name, msg, \ (jiffies - start) / HZ); \ else \ diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h index 4482d61ff7ab..e5f8e86cd887 100644 --- a/drivers/staging/lustre/lustre/include/lustre_export.h +++ b/drivers/staging/lustre/lustre/include/lustre_export.h @@ -297,8 +297,8 @@ static inline int exp_connect_multibulk(struct obd_export *exp) static inline int exp_expired(struct obd_export *exp, long age) { LASSERT(exp->exp_delayed); - return cfs_time_before(cfs_time_add(exp->exp_last_request_time, age), - get_seconds()); + return time_before(cfs_time_add(exp->exp_last_request_time, age), + get_seconds()); } static inline int exp_connect_cancelset(struct obd_export *exp) diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 92b88f5d9c3d..229fdac5ebd4 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -3100,9 +3100,9 @@ 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 && - cfs_time_before(cfs_time_add(req->rq_queued_time, - cfs_time_seconds(req->rq_delay_limit)), - cfs_time_current())) { + time_before(cfs_time_add(req->rq_queued_time, + cfs_time_seconds(req->rq_delay_limit)), + cfs_time_current())) { return 1; } return 0; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c index 14b80a8d1cd5..589ebaf30cce 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c @@ -1508,9 +1508,8 @@ static ldlm_policy_res_t ldlm_cancel_aged_policy(struct ldlm_namespace *ns, { /* Stop LRU processing if young lock is found and we reach past count */ return ((added >= count) && - cfs_time_before(cfs_time_current(), - cfs_time_add(lock->l_last_used, - ns->ns_max_age))) ? + time_before(cfs_time_current(), + cfs_time_add(lock->l_last_used, ns->ns_max_age))) ? LDLM_POLICY_KEEP_LOCK : LDLM_POLICY_CANCEL_LOCK; } diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c index eb166a708be7..344b63e7bf5b 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c @@ -1369,7 +1369,7 @@ void ldlm_namespace_dump(int level, struct ldlm_namespace *ns) ldlm_ns_name(ns), atomic_read(&ns->ns_bref), ns_is_client(ns) ? "client" : "server"); - if (cfs_time_before(cfs_time_current(), ns->ns_next_dump)) + if (time_before(cfs_time_current(), ns->ns_next_dump)) return; cfs_hash_for_each_nolock(ns->ns_rs_hash, diff --git a/drivers/staging/lustre/lustre/libcfs/upcall_cache.c b/drivers/staging/lustre/lustre/libcfs/upcall_cache.c index ab3a1b4c3d30..452227da2cb3 100644 --- a/drivers/staging/lustre/lustre/libcfs/upcall_cache.c +++ b/drivers/staging/lustre/lustre/libcfs/upcall_cache.c @@ -117,13 +117,12 @@ static int check_unlink_entry(struct upcall_cache *cache, struct upcall_cache_entry *entry) { if (UC_CACHE_IS_VALID(entry) && - cfs_time_before(cfs_time_current(), entry->ue_expire)) + time_before(cfs_time_current(), entry->ue_expire)) return 0; if (UC_CACHE_IS_ACQUIRING(entry)) { if (entry->ue_acquire_expire == 0 || - cfs_time_before(cfs_time_current(), - entry->ue_acquire_expire)) + time_before(cfs_time_current(), entry->ue_acquire_expire)) return 0; UC_CACHE_SET_EXPIRED(entry); diff --git a/drivers/staging/lustre/lustre/llite/llite_capa.c b/drivers/staging/lustre/lustre/llite/llite_capa.c index 2ec55bb4c8d1..ade58e8a41e3 100644 --- a/drivers/staging/lustre/lustre/llite/llite_capa.c +++ b/drivers/staging/lustre/lustre/llite/llite_capa.c @@ -72,7 +72,7 @@ static int ll_update_capa(struct obd_capa *ocapa, struct lustre_capa *capa); static inline void update_capa_timer(struct obd_capa *ocapa, unsigned long expiry) { - if (cfs_time_before(expiry, ll_capa_timer.expires) || + if (time_before(expiry, ll_capa_timer.expires) || !timer_pending(&ll_capa_timer)) { mod_timer(&ll_capa_timer, expiry); DEBUG_CAPA(D_SEC, &ocapa->c_capa, diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index 31d92cbe520b..bad8a84f8c2f 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -587,7 +587,7 @@ static void ll_agl_trigger(struct inode *inode, struct ll_statahead_info *sai) * affect the performance. */ if (lli->lli_glimpse_time != 0 && - cfs_time_before(cfs_time_shift(-1), lli->lli_glimpse_time)) { + time_before(cfs_time_shift(-1), lli->lli_glimpse_time)) { up_write(&lli->lli_glimpse_sem); lli->lli_agl_index = 0; iput(inode); diff --git a/drivers/staging/lustre/lustre/obdclass/capa.c b/drivers/staging/lustre/lustre/obdclass/capa.c index 8465fde05140..de9347f93634 100644 --- a/drivers/staging/lustre/lustre/obdclass/capa.c +++ b/drivers/staging/lustre/lustre/obdclass/capa.c @@ -143,9 +143,9 @@ static inline int capa_hashfn(struct lu_fid *fid) * client renew right after obtaining it. */ static inline int capa_is_to_expire(struct obd_capa *oc) { - return cfs_time_before(cfs_time_sub(oc->c_expiry, - cfs_time_seconds(oc->c_capa.lc_timeout)*2/3), - cfs_time_current()); + return time_before(cfs_time_sub(oc->c_expiry, + cfs_time_seconds(oc->c_capa.lc_timeout)*2/3), + cfs_time_current()); } static struct obd_capa *find_capa(struct lustre_capa *capa, diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 1a1f87e7502a..07cd3edc4345 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1894,7 +1894,7 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink) "/real "CFS_DURATION_T"]", req->rq_net_err ? "failed due to network error" : ((req->rq_real_sent == 0 || - cfs_time_before(req->rq_real_sent, req->rq_sent) || + time_before((unsigned long)req->rq_real_sent, (unsigned long)req->rq_sent) || cfs_time_aftereq(req->rq_real_sent, req->rq_deadline)) ? "timed out for sent delay" : "timed out for slow reply"), req->rq_sent, req->rq_real_sent); -- 2.34.1