Commit 699503bc authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

staging: lustre: remove cfs_time_before()

Just call time_before() instead.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: hpdd-discuss <hpdd-discuss@lists.01.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 88c03eae
...@@ -55,7 +55,7 @@ static inline unsigned long cfs_time_sub(unsigned long t1, unsigned long t2) ...@@ -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) 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) static inline int cfs_time_aftereq(unsigned long t1, unsigned long t2)
......
...@@ -45,31 +45,6 @@ ...@@ -45,31 +45,6 @@
#error Do not #include this file directly. #include <linux/libcfs/libcfs.h> instead #error Do not #include this file directly. #include <linux/libcfs/libcfs.h> instead
#endif #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_BILLION ((u_int64_t)1000000000)
#define ONE_MILLION 1000000 #define ONE_MILLION 1000000
...@@ -97,11 +72,6 @@ static inline void cfs_fs_time_usec(struct timespec *t, struct timeval *v) ...@@ -97,11 +72,6 @@ static inline void cfs_fs_time_usec(struct timespec *t, struct timeval *v)
* Generic kernel stuff * 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) static inline unsigned long cfs_time_current(void)
{ {
return jiffies; return jiffies;
......
...@@ -1606,7 +1606,7 @@ kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages, ...@@ -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 */ /* someone failed recently */
spin_unlock(&fps->fps_lock); spin_unlock(&fps->fps_lock);
return -EAGAIN; return -EAGAIN;
...@@ -1808,7 +1808,7 @@ kiblnd_pool_alloc_node(kib_poolset_t *ps) ...@@ -1808,7 +1808,7 @@ kiblnd_pool_alloc_node(kib_poolset_t *ps)
goto again; 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 */ /* someone failed recently */
spin_unlock(&ps->ps_lock); spin_unlock(&ps->ps_lock);
return NULL; return NULL;
......
...@@ -3465,8 +3465,8 @@ kiblnd_failover_thread(void *arg) ...@@ -3465,8 +3465,8 @@ kiblnd_failover_thread(void *arg)
list_for_each_entry(dev, &kiblnd_data.kib_failed_devs, list_for_each_entry(dev, &kiblnd_data.kib_failed_devs,
ibd_fail_list) { ibd_fail_list) {
if (cfs_time_before(cfs_time_current(), if (time_before(cfs_time_current(),
dev->ibd_next_failover)) dev->ibd_next_failover))
continue; continue;
do_failover = 1; do_failover = 1;
break; break;
......
...@@ -2368,13 +2368,12 @@ ksocknal_send_keepalive_locked(ksock_peer_t *peer) ...@@ -2368,13 +2368,12 @@ ksocknal_send_keepalive_locked(ksock_peer_t *peer)
return 0; return 0;
if (*ksocknal_tunables.ksnd_keepalive <= 0 || if (*ksocknal_tunables.ksnd_keepalive <= 0 ||
cfs_time_before(cfs_time_current(), time_before(cfs_time_current(),
cfs_time_add(peer->ksnp_last_alive, cfs_time_add(peer->ksnp_last_alive,
cfs_time_seconds(*ksocknal_tunables.ksnd_keepalive)))) cfs_time_seconds(*ksocknal_tunables.ksnd_keepalive))))
return 0; return 0;
if (cfs_time_before(cfs_time_current(), if (time_before(cfs_time_current(), peer->ksnp_send_keepalive))
peer->ksnp_send_keepalive))
return 0; return 0;
/* retry 10 secs later, so we wouldn't put pressure /* retry 10 secs later, so we wouldn't put pressure
......
...@@ -751,7 +751,7 @@ lnet_peer_alive_locked(lnet_peer_t *lp) ...@@ -751,7 +751,7 @@ lnet_peer_alive_locked(lnet_peer_t *lp)
cfs_time_add(lp->lp_last_query, cfs_time_add(lp->lp_last_query,
cfs_time_seconds(lnet_queryinterval)); cfs_time_seconds(lnet_queryinterval));
if (cfs_time_before(now, next_query)) { if (time_before(now, next_query)) {
if (lp->lp_alive) if (lp->lp_alive)
CWARN("Unexpected aliveness of peer %s: " CWARN("Unexpected aliveness of peer %s: "
"%d < %d (%d/%d)\n", "%d < %d (%d/%d)\n",
......
...@@ -109,7 +109,7 @@ lnet_peers_start_down(void) ...@@ -109,7 +109,7 @@ lnet_peers_start_down(void)
void void
lnet_notify_locked(lnet_peer_t *lp, int notifylnd, int alive, unsigned long when) 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"); CDEBUG(D_NET, "Out of date\n");
return; return;
} }
......
...@@ -90,12 +90,12 @@ static inline char *fsfilt_get_label(struct obd_device *obd, ...@@ -90,12 +90,12 @@ static inline char *fsfilt_get_label(struct obd_device *obd,
#define __fsfilt_check_slow(obd, start, msg) \ #define __fsfilt_check_slow(obd, start, msg) \
do { \ do { \
if (cfs_time_before(jiffies, start + 15 * HZ)) \ if (time_before(jiffies, start + 15 * HZ)) \
break; \ 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, \ CDEBUG(D_VFSTRACE, "%s: slow %s %lus\n", obd->obd_name, \
msg, (jiffies-start) / HZ); \ 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, \ CWARN("%s: slow %s %lus\n", obd->obd_name, msg, \
(jiffies - start) / HZ); \ (jiffies - start) / HZ); \
else \ else \
......
...@@ -297,8 +297,8 @@ static inline int exp_connect_multibulk(struct obd_export *exp) ...@@ -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) static inline int exp_expired(struct obd_export *exp, long age)
{ {
LASSERT(exp->exp_delayed); LASSERT(exp->exp_delayed);
return cfs_time_before(cfs_time_add(exp->exp_last_request_time, age), return time_before(cfs_time_add(exp->exp_last_request_time, age),
get_seconds()); get_seconds());
} }
static inline int exp_connect_cancelset(struct obd_export *exp) static inline int exp_connect_cancelset(struct obd_export *exp)
......
...@@ -3100,9 +3100,9 @@ static inline int ptlrpc_req_get_repsize(struct ptlrpc_request *req) ...@@ -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) static inline int ptlrpc_send_limit_expired(struct ptlrpc_request *req)
{ {
if (req->rq_delay_limit != 0 && if (req->rq_delay_limit != 0 &&
cfs_time_before(cfs_time_add(req->rq_queued_time, time_before(cfs_time_add(req->rq_queued_time,
cfs_time_seconds(req->rq_delay_limit)), cfs_time_seconds(req->rq_delay_limit)),
cfs_time_current())) { cfs_time_current())) {
return 1; return 1;
} }
return 0; return 0;
......
...@@ -1508,9 +1508,8 @@ static ldlm_policy_res_t ldlm_cancel_aged_policy(struct ldlm_namespace *ns, ...@@ -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 */ /* Stop LRU processing if young lock is found and we reach past count */
return ((added >= count) && return ((added >= count) &&
cfs_time_before(cfs_time_current(), time_before(cfs_time_current(),
cfs_time_add(lock->l_last_used, cfs_time_add(lock->l_last_used, ns->ns_max_age))) ?
ns->ns_max_age))) ?
LDLM_POLICY_KEEP_LOCK : LDLM_POLICY_CANCEL_LOCK; LDLM_POLICY_KEEP_LOCK : LDLM_POLICY_CANCEL_LOCK;
} }
......
...@@ -1369,7 +1369,7 @@ void ldlm_namespace_dump(int level, struct ldlm_namespace *ns) ...@@ -1369,7 +1369,7 @@ void ldlm_namespace_dump(int level, struct ldlm_namespace *ns)
ldlm_ns_name(ns), atomic_read(&ns->ns_bref), ldlm_ns_name(ns), atomic_read(&ns->ns_bref),
ns_is_client(ns) ? "client" : "server"); 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; return;
cfs_hash_for_each_nolock(ns->ns_rs_hash, cfs_hash_for_each_nolock(ns->ns_rs_hash,
......
...@@ -117,13 +117,12 @@ static int check_unlink_entry(struct upcall_cache *cache, ...@@ -117,13 +117,12 @@ static int check_unlink_entry(struct upcall_cache *cache,
struct upcall_cache_entry *entry) struct upcall_cache_entry *entry)
{ {
if (UC_CACHE_IS_VALID(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; return 0;
if (UC_CACHE_IS_ACQUIRING(entry)) { if (UC_CACHE_IS_ACQUIRING(entry)) {
if (entry->ue_acquire_expire == 0 || if (entry->ue_acquire_expire == 0 ||
cfs_time_before(cfs_time_current(), time_before(cfs_time_current(), entry->ue_acquire_expire))
entry->ue_acquire_expire))
return 0; return 0;
UC_CACHE_SET_EXPIRED(entry); UC_CACHE_SET_EXPIRED(entry);
......
...@@ -72,7 +72,7 @@ static int ll_update_capa(struct obd_capa *ocapa, struct lustre_capa *capa); ...@@ -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) 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)) { !timer_pending(&ll_capa_timer)) {
mod_timer(&ll_capa_timer, expiry); mod_timer(&ll_capa_timer, expiry);
DEBUG_CAPA(D_SEC, &ocapa->c_capa, DEBUG_CAPA(D_SEC, &ocapa->c_capa,
......
...@@ -587,7 +587,7 @@ static void ll_agl_trigger(struct inode *inode, struct ll_statahead_info *sai) ...@@ -587,7 +587,7 @@ static void ll_agl_trigger(struct inode *inode, struct ll_statahead_info *sai)
* affect the performance. * affect the performance.
*/ */
if (lli->lli_glimpse_time != 0 && 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); up_write(&lli->lli_glimpse_sem);
lli->lli_agl_index = 0; lli->lli_agl_index = 0;
iput(inode); iput(inode);
......
...@@ -143,9 +143,9 @@ static inline int capa_hashfn(struct lu_fid *fid) ...@@ -143,9 +143,9 @@ static inline int capa_hashfn(struct lu_fid *fid)
* client renew right after obtaining it. */ * client renew right after obtaining it. */
static inline int capa_is_to_expire(struct obd_capa *oc) static inline int capa_is_to_expire(struct obd_capa *oc)
{ {
return cfs_time_before(cfs_time_sub(oc->c_expiry, return time_before(cfs_time_sub(oc->c_expiry,
cfs_time_seconds(oc->c_capa.lc_timeout)*2/3), cfs_time_seconds(oc->c_capa.lc_timeout)*2/3),
cfs_time_current()); cfs_time_current());
} }
static struct obd_capa *find_capa(struct lustre_capa *capa, static struct obd_capa *find_capa(struct lustre_capa *capa,
......
...@@ -1894,7 +1894,7 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink) ...@@ -1894,7 +1894,7 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink)
"/real "CFS_DURATION_T"]", "/real "CFS_DURATION_T"]",
req->rq_net_err ? "failed due to network error" : req->rq_net_err ? "failed due to network error" :
((req->rq_real_sent == 0 || ((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)) ? cfs_time_aftereq(req->rq_real_sent, req->rq_deadline)) ?
"timed out for sent delay" : "timed out for slow reply"), "timed out for sent delay" : "timed out for slow reply"),
req->rq_sent, req->rq_real_sent); req->rq_sent, req->rq_real_sent);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment