staging: lustre: discard cfs_duration_sec()
authorNeilBrown <neilb@suse.com>
Thu, 29 Mar 2018 04:26:48 +0000 (15:26 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Apr 2018 12:52:52 +0000 (14:52 +0200)
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>
drivers/staging/lustre/include/linux/libcfs/linux/linux-time.h
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
drivers/staging/lustre/lnet/libcfs/debug.c
drivers/staging/lustre/lnet/lnet/router.c
drivers/staging/lustre/lnet/lnet/router_proc.c
drivers/staging/lustre/lustre/ldlm/ldlm_request.c

index ecb2126a9e6f47d3c6a32dffb85f48a275f06bf5..9a353c6cb85a7972e1a2f67a52d737104a69afe1 100644 (file)
  * 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;
index d0ce37d7257197061a1366fe701fedd456473020..959e119384df283162fd1ecd2195f9bf7a472625 100644 (file)
@@ -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",
               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)
index 563ff5c972bf9de5863dbc6b1a7289ba59165c30..b4a182d87ae7c937057867a3c42d038739a0880e 100644 (file)
@@ -3144,7 +3144,7 @@ kiblnd_check_txs_locked(struct kib_conn *conn, struct list_head *txs)
                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;
                }
        }
@@ -3206,8 +3206,7 @@ kiblnd_check_conns(int idx)
                        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);
index 16c1ab0b0bd9e0672d9f4accb974b4992ad48066..79b98cdd0f9daa704ad6a2d4f2ba0218ad185948 100644 (file)
@@ -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(jiffies - last_rcv));
+                      (jiffies - last_rcv) / HZ);
                lnet_finalize(conn->ksnc_peer->ksnp_ni,
                              conn->ksnc_cookie, -EIO);
                break;
@@ -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",
               libcfs_nid2str(nid), peer,
-              last_alive ? cfs_duration_sec(now - last_alive) : -1,
+              last_alive ? (now - last_alive) / HZ : -1,
               connect);
 
        if (!connect)
index 8ead1e02e854b1913ee9a502df3d6df359dbd939..14450fd5957a60fff774ae2af0faf76c5923b8c6 100644 (file)
@@ -751,7 +751,7 @@ ksocknal_find_connectable_route_locked(struct ksock_peer *peer)
                               &route->ksnr_ipaddr,
                               route->ksnr_connected,
                               route->ksnr_retry_interval,
-                              cfs_duration_sec(route->ksnr_timeout - now));
+                              (route->ksnr_timeout - now) / HZ);
                        continue;
                }
 
@@ -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",
                       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);
index 1371224a8cb982ac75b64a0749ae451446e392fc..5862f0730dd0aca98c4bce44c9f9311eb897318d 100644 (file)
@@ -126,7 +126,7 @@ static int param_get_delay(char *buffer, const struct kernel_param *kp)
 {
        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;
index 8baf35d56ca73dc5d7113e1fa16d4e09bcaa0719..6267d5e4bbd6fbdf37dd2b4edd954c9dd2bea9e8 100644 (file)
@@ -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",
                      !ni ? "userspace" : libcfs_nid2str(ni->ni_nid),
                      libcfs_nid2str(nid), alive ? "up" : "down",
-                     cfs_duration_sec(when - now));
+                     (when - now) / HZ);
                return -EINVAL;
        }
 
index e4172311be68625bb6110c20623071dcc1fd1e0a..015dccbc4a58b7b06e214a398edcb822f2d7afbf 100644 (file)
@@ -331,7 +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(now - peer->lp_ping_timestamp);
+                       int last_ping = (now - peer->lp_ping_timestamp) / HZ;
                        int down_ni = 0;
                        struct lnet_route *rtr;
 
@@ -363,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(deadline - now),
+                                             (deadline - now) / HZ,
                                              down_ni, libcfs_nid2str(nid));
                        LASSERT(tmpstr + tmpsiz - s > 0);
                }
@@ -512,7 +512,7 @@ static int proc_lnet_peers(struct ctl_table *table, int write,
                                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
index 187095022fb1287b9112a6c439f18430c5114b1b..f573de9cf45de744825ed8f4395b4aa92917f052 100644 (file)
@@ -1181,7 +1181,7 @@ static enum ldlm_policy_res ldlm_cancel_lrur_policy(struct ldlm_namespace *ns,
 
        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. */