cfs_duration_sec() simply divides by HZ.
It is mostly used to report durations in debug messages.
Remove and just use X/HZ.
Signed-off-by: NeilBrown <neilb@suse.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Generic kernel stuff
*/
-static inline long cfs_duration_sec(long d)
-{
- return d / msecs_to_jiffies(MSEC_PER_SEC);
-}
-
static inline int cfs_time_before_64(u64 t1, u64 t2)
{
return (__s64)t2 - (__s64)t1 > 0;
CDEBUG(D_NET, "Peer %s %p, alive %ld secs ago\n",
libcfs_nid2str(nid), peer,
- last_alive ? cfs_duration_sec(now - last_alive) : -1);
+ last_alive ? (now - last_alive) / HZ : -1);
}
static void kiblnd_free_pages(struct kib_pages *p)
if (time_after_eq(jiffies, tx->tx_deadline)) {
CERROR("Timed out tx: %s, %lu seconds\n",
kiblnd_queue2str(conn, txs),
- cfs_duration_sec(jiffies - tx->tx_deadline));
+ (jiffies - tx->tx_deadline) / HZ);
return 1;
}
}
if (timedout) {
CERROR("Timed out RDMA with %s (%lu): c: %u, oc: %u, rc: %u\n",
libcfs_nid2str(peer->ibp_nid),
- cfs_duration_sec(jiffies -
- peer->ibp_last_alive),
+ (jiffies - peer->ibp_last_alive) / HZ,
conn->ibc_credits,
conn->ibc_outstanding_credits,
conn->ibc_reserved_credits);
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(jiffies - last_rcv));
+ (jiffies - last_rcv) / HZ);
lnet_finalize(conn->ksnc_peer->ksnp_ni,
conn->ksnc_cookie, -EIO);
break;
CDEBUG(D_NET, "Peer %s %p, alive %ld secs ago, connect %d\n",
libcfs_nid2str(nid), peer,
- last_alive ? cfs_duration_sec(now - last_alive) : -1,
+ last_alive ? (now - last_alive) / HZ : -1,
connect);
if (!connect)
&route->ksnr_ipaddr,
route->ksnr_connected,
route->ksnr_retry_interval,
- cfs_duration_sec(route->ksnr_timeout - now));
+ (route->ksnr_timeout - now) / HZ);
continue;
}
CERROR("Total %d stale ZC_REQs for peer %s detected; the oldest(%p) timed out %ld secs ago, resid: %d, wmem: %d\n",
n, libcfs_nid2str(peer->ksnp_id.nid), tx_stale,
- cfs_duration_sec(jiffies - deadline),
+ (jiffies - deadline) / HZ,
resid, conn->ksnc_sock->sk->sk_wmem_queued);
ksocknal_close_conn_and_siblings(conn, -ETIMEDOUT);
{
unsigned int d = *(unsigned int *)kp->arg;
- return sprintf(buffer, "%u", (unsigned int)cfs_duration_sec(d * 100));
+ return sprintf(buffer, "%u", (unsigned int)(d * 100) / HZ);
}
unsigned int libcfs_console_max_delay;
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(when - now));
+ (when - now) / HZ);
return -EINVAL;
}
int alive_cnt = peer->lp_alive_count;
int alive = peer->lp_alive;
int pingsent = !peer->lp_ping_notsent;
- int last_ping = cfs_duration_sec(now - peer->lp_ping_timestamp);
+ int last_ping = (now - peer->lp_ping_timestamp) / HZ;
int down_ni = 0;
struct lnet_route *rtr;
nrefs, nrtrrefs, alive_cnt,
alive ? "up" : "down", last_ping,
pingsent,
- cfs_duration_sec(deadline - now),
+ (deadline - now) / HZ,
down_ni, libcfs_nid2str(nid));
LASSERT(tmpstr + tmpsiz - s > 0);
}
long delta;
delta = now - peer->lp_last_alive;
- lastalive = cfs_duration_sec(delta);
+ lastalive = (delta) / HZ;
/* No need to mess up peers contents with
* arbitrarily long integers - it suffices to
slv = ldlm_pool_get_slv(pl);
lvf = ldlm_pool_get_lvf(pl);
- la = cfs_duration_sec(cur - lock->l_last_used);
+ la = (cur - lock->l_last_used) / HZ;
lv = lvf * la * unused;
/* Inform pool about current CLV to see it via debugfs. */