Commit 2d44d958 authored by NeilBrown's avatar NeilBrown Committed by Greg Kroah-Hartman

staging: lustre: discard cfs_duration_sec()

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: default avatarNeilBrown <neilb@suse.com>
Reviewed-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 46357c56
...@@ -60,11 +60,6 @@ ...@@ -60,11 +60,6 @@
* Generic kernel stuff * 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) static inline int cfs_time_before_64(u64 t1, u64 t2)
{ {
return (__s64)t2 - (__s64)t1 > 0; return (__s64)t2 - (__s64)t1 > 0;
......
...@@ -1068,7 +1068,7 @@ static void kiblnd_query(struct lnet_ni *ni, lnet_nid_t nid, ...@@ -1068,7 +1068,7 @@ static void kiblnd_query(struct lnet_ni *ni, lnet_nid_t nid,
CDEBUG(D_NET, "Peer %s %p, alive %ld secs ago\n", CDEBUG(D_NET, "Peer %s %p, alive %ld secs ago\n",
libcfs_nid2str(nid), peer, 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) static void kiblnd_free_pages(struct kib_pages *p)
......
...@@ -3144,7 +3144,7 @@ kiblnd_check_txs_locked(struct kib_conn *conn, struct list_head *txs) ...@@ -3144,7 +3144,7 @@ kiblnd_check_txs_locked(struct kib_conn *conn, struct list_head *txs)
if (time_after_eq(jiffies, tx->tx_deadline)) { if (time_after_eq(jiffies, tx->tx_deadline)) {
CERROR("Timed out tx: %s, %lu seconds\n", CERROR("Timed out tx: %s, %lu seconds\n",
kiblnd_queue2str(conn, txs), kiblnd_queue2str(conn, txs),
cfs_duration_sec(jiffies - tx->tx_deadline)); (jiffies - tx->tx_deadline) / HZ);
return 1; return 1;
} }
} }
...@@ -3206,8 +3206,7 @@ kiblnd_check_conns(int idx) ...@@ -3206,8 +3206,7 @@ kiblnd_check_conns(int idx)
if (timedout) { if (timedout) {
CERROR("Timed out RDMA with %s (%lu): c: %u, oc: %u, rc: %u\n", CERROR("Timed out RDMA with %s (%lu): c: %u, oc: %u, rc: %u\n",
libcfs_nid2str(peer->ibp_nid), libcfs_nid2str(peer->ibp_nid),
cfs_duration_sec(jiffies - (jiffies - peer->ibp_last_alive) / HZ,
peer->ibp_last_alive),
conn->ibc_credits, conn->ibc_credits,
conn->ibc_outstanding_credits, conn->ibc_outstanding_credits,
conn->ibc_reserved_credits); conn->ibc_reserved_credits);
......
...@@ -1682,7 +1682,7 @@ ksocknal_destroy_conn(struct ksock_conn *conn) ...@@ -1682,7 +1682,7 @@ ksocknal_destroy_conn(struct ksock_conn *conn)
libcfs_id2str(conn->ksnc_peer->ksnp_id), conn->ksnc_type, libcfs_id2str(conn->ksnc_peer->ksnp_id), conn->ksnc_type,
&conn->ksnc_ipaddr, conn->ksnc_port, &conn->ksnc_ipaddr, conn->ksnc_port,
iov_iter_count(&conn->ksnc_rx_to), conn->ksnc_rx_nob_left, 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, lnet_finalize(conn->ksnc_peer->ksnp_ni,
conn->ksnc_cookie, -EIO); conn->ksnc_cookie, -EIO);
break; break;
...@@ -1870,7 +1870,7 @@ ksocknal_query(struct lnet_ni *ni, lnet_nid_t nid, unsigned long *when) ...@@ -1870,7 +1870,7 @@ ksocknal_query(struct lnet_ni *ni, lnet_nid_t nid, unsigned long *when)
CDEBUG(D_NET, "Peer %s %p, alive %ld secs ago, connect %d\n", CDEBUG(D_NET, "Peer %s %p, alive %ld secs ago, connect %d\n",
libcfs_nid2str(nid), peer, libcfs_nid2str(nid), peer,
last_alive ? cfs_duration_sec(now - last_alive) : -1, last_alive ? (now - last_alive) / HZ : -1,
connect); connect);
if (!connect) if (!connect)
......
...@@ -751,7 +751,7 @@ ksocknal_find_connectable_route_locked(struct ksock_peer *peer) ...@@ -751,7 +751,7 @@ ksocknal_find_connectable_route_locked(struct ksock_peer *peer)
&route->ksnr_ipaddr, &route->ksnr_ipaddr,
route->ksnr_connected, route->ksnr_connected,
route->ksnr_retry_interval, route->ksnr_retry_interval,
cfs_duration_sec(route->ksnr_timeout - now)); (route->ksnr_timeout - now) / HZ);
continue; continue;
} }
...@@ -2439,7 +2439,7 @@ ksocknal_check_peer_timeouts(int idx) ...@@ -2439,7 +2439,7 @@ ksocknal_check_peer_timeouts(int idx)
CERROR("Total %d stale ZC_REQs for peer %s detected; the oldest(%p) timed out %ld secs ago, resid: %d, wmem: %d\n", 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, 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); resid, conn->ksnc_sock->sk->sk_wmem_queued);
ksocknal_close_conn_and_siblings(conn, -ETIMEDOUT); ksocknal_close_conn_and_siblings(conn, -ETIMEDOUT);
......
...@@ -126,7 +126,7 @@ static int param_get_delay(char *buffer, const struct kernel_param *kp) ...@@ -126,7 +126,7 @@ static int param_get_delay(char *buffer, const struct kernel_param *kp)
{ {
unsigned int d = *(unsigned int *)kp->arg; 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; unsigned int libcfs_console_max_delay;
......
...@@ -1752,7 +1752,7 @@ lnet_notify(struct lnet_ni *ni, lnet_nid_t nid, int alive, unsigned long when) ...@@ -1752,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", CWARN("Ignoring prediction from %s of %s %s %ld seconds in the future\n",
!ni ? "userspace" : libcfs_nid2str(ni->ni_nid), !ni ? "userspace" : libcfs_nid2str(ni->ni_nid),
libcfs_nid2str(nid), alive ? "up" : "down", libcfs_nid2str(nid), alive ? "up" : "down",
cfs_duration_sec(when - now)); (when - now) / HZ);
return -EINVAL; return -EINVAL;
} }
......
...@@ -331,7 +331,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write, ...@@ -331,7 +331,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write,
int alive_cnt = peer->lp_alive_count; int alive_cnt = peer->lp_alive_count;
int alive = peer->lp_alive; int alive = peer->lp_alive;
int pingsent = !peer->lp_ping_notsent; 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; int down_ni = 0;
struct lnet_route *rtr; struct lnet_route *rtr;
...@@ -363,7 +363,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write, ...@@ -363,7 +363,7 @@ static int proc_lnet_routers(struct ctl_table *table, int write,
nrefs, nrtrrefs, alive_cnt, nrefs, nrtrrefs, alive_cnt,
alive ? "up" : "down", last_ping, alive ? "up" : "down", last_ping,
pingsent, pingsent,
cfs_duration_sec(deadline - now), (deadline - now) / HZ,
down_ni, libcfs_nid2str(nid)); down_ni, libcfs_nid2str(nid));
LASSERT(tmpstr + tmpsiz - s > 0); LASSERT(tmpstr + tmpsiz - s > 0);
} }
...@@ -512,7 +512,7 @@ static int proc_lnet_peers(struct ctl_table *table, int write, ...@@ -512,7 +512,7 @@ static int proc_lnet_peers(struct ctl_table *table, int write,
long delta; long delta;
delta = now - peer->lp_last_alive; delta = now - peer->lp_last_alive;
lastalive = cfs_duration_sec(delta); lastalive = (delta) / HZ;
/* No need to mess up peers contents with /* No need to mess up peers contents with
* arbitrarily long integers - it suffices to * arbitrarily long integers - it suffices to
......
...@@ -1181,7 +1181,7 @@ static enum ldlm_policy_res ldlm_cancel_lrur_policy(struct ldlm_namespace *ns, ...@@ -1181,7 +1181,7 @@ static enum ldlm_policy_res ldlm_cancel_lrur_policy(struct ldlm_namespace *ns,
slv = ldlm_pool_get_slv(pl); slv = ldlm_pool_get_slv(pl);
lvf = ldlm_pool_get_lvf(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; lv = lvf * la * unused;
/* Inform pool about current CLV to see it via debugfs. */ /* Inform pool about current CLV to see it via debugfs. */
......
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