Whamcloud - gitweb
LU-4423 lnet: use 64-bit time for selftest
[fs/lustre-release.git] / lnet / selftest / conrpc.c
index 86fc4aa..014fe58 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2014, Intel Corporation.
+ * Copyright (c) 2011, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -44,7 +44,7 @@
 #include "console.h"
 
 void lstcon_rpc_stat_reply(lstcon_rpc_trans_t *, srpc_msg_t *,
-                          lstcon_node_t *, lstcon_trans_stat_t *);
+                          lstcon_node_t *, struct lstcon_trans_stat *);
 
 static void
 lstcon_rpc_done(srpc_client_rpc_t *rpc)
@@ -418,7 +418,7 @@ lstcon_rpc_get_reply(lstcon_rpc_t *crpc, srpc_msg_t **msgpp)
 }
 
 void
-lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, lstcon_trans_stat_t *stat)
+lstcon_rpc_trans_stat(lstcon_rpc_trans_t *trans, struct lstcon_trans_stat *stat)
 {
        lstcon_rpc_t    *crpc;
        srpc_msg_t      *rep;
@@ -470,7 +470,7 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
 {
        struct list_head      tmp;
        struct list_head     __user *next;
-        lstcon_rpc_ent_t     *ent;
+       struct lstcon_rpc_ent     *ent;
         srpc_generic_reply_t *rep;
         lstcon_rpc_t         *crpc;
         srpc_msg_t           *msg;
@@ -493,7 +493,7 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
 
                next = tmp.next;
 
-               ent = list_entry(next, lstcon_rpc_ent_t, rpe_link);
+               ent = list_entry(next, struct lstcon_rpc_ent, rpe_link);
 
                LASSERT(crpc->crp_stamp != 0);
 
@@ -521,7 +521,7 @@ lstcon_rpc_trans_interpreter(lstcon_rpc_trans_t *trans,
                rep = (srpc_generic_reply_t *)&msg->msg_body.reply;
 
                if (copy_to_user(&ent->rpe_sid,
-                                &rep->sid, sizeof(lst_sid_t)) ||
+                                &rep->sid, sizeof(rep->sid)) ||
                    copy_to_user(&ent->rpe_fwk_errno,
                                 &rep->status, sizeof(rep->status)))
                        return -EFAULT;
@@ -769,7 +769,7 @@ lstcon_dstnodes_prep(lstcon_group_t *grp, int idx,
 }
 
 static int
-lstcon_pingrpc_prep(lst_test_ping_param_t *param, srpc_test_reqst_t *req)
+lstcon_pingrpc_prep(struct lst_test_ping_param *param, srpc_test_reqst_t *req)
 {
         test_ping_req_t *prq = &req->tsr_u.ping;
 
@@ -780,7 +780,7 @@ lstcon_pingrpc_prep(lst_test_ping_param_t *param, srpc_test_reqst_t *req)
 }
 
 static int
-lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req)
+lstcon_bulkrpc_v0_prep(struct lst_test_bulk_param *param, srpc_test_reqst_t *req)
 {
        test_bulk_req_t *brq = &req->tsr_u.bulk_v0;
 
@@ -793,7 +793,7 @@ lstcon_bulkrpc_v0_prep(lst_test_bulk_param_t *param, srpc_test_reqst_t *req)
 }
 
 static int
-lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, bool is_client,
+lstcon_bulkrpc_v1_prep(struct lst_test_bulk_param *param, bool is_client,
                       srpc_test_reqst_t *req)
 {
        test_bulk_req_v1_t *brq = &req->tsr_u.bulk_v1;
@@ -890,17 +890,17 @@ lstcon_testrpc_prep(lstcon_node_t *nd, int transop, unsigned feats,
         switch (test->tes_type) {
         case LST_TEST_PING:
                 trq->tsr_service = SRPC_SERVICE_PING;
-               rc = lstcon_pingrpc_prep((lst_test_ping_param_t *)
+               rc = lstcon_pingrpc_prep((struct lst_test_ping_param *)
                                         &test->tes_param[0], trq);
                break;
 
        case LST_TEST_BULK:
                trq->tsr_service = SRPC_SERVICE_BRW;
                if ((feats & LST_FEAT_BULK_LEN) == 0) {
-                       rc = lstcon_bulkrpc_v0_prep((lst_test_bulk_param_t *)
+                       rc = lstcon_bulkrpc_v0_prep((struct lst_test_bulk_param *)
                                                    &test->tes_param[0], trq);
                } else {
-                       rc = lstcon_bulkrpc_v1_prep((lst_test_bulk_param_t *)
+                       rc = lstcon_bulkrpc_v1_prep((struct lst_test_bulk_param *)
                                                    &test->tes_param[0],
                                                    trq->tsr_is_client, trq);
                }
@@ -963,7 +963,7 @@ lstcon_sesnew_stat_reply(lstcon_rpc_trans_t *trans,
 
 void
 lstcon_rpc_stat_reply(lstcon_rpc_trans_t *trans, srpc_msg_t *msg,
-                      lstcon_node_t *nd, lstcon_trans_stat_t *stat)
+                     lstcon_node_t *nd, struct lstcon_trans_stat *stat)
 {
         srpc_rmsn_reply_t  *rmsn_rep;
         srpc_debug_reply_t *dbg_rep;
@@ -1176,7 +1176,7 @@ lstcon_rpc_pinger(void *arg)
         srpc_debug_reqst_t *drq;
         lstcon_ndlink_t    *ndl;
         lstcon_node_t      *nd;
-        time_t              intv;
+       int intv;
         int                 count = 0;
         int                 rc;
 
@@ -1190,10 +1190,10 @@ lstcon_rpc_pinger(void *arg)
                 return;
         }
 
-        if (!console_session.ses_expired &&
-            cfs_time_current_sec() - console_session.ses_laststamp >
-            (time_t)console_session.ses_timeout)
-                console_session.ses_expired = 1;
+       if (!console_session.ses_expired &&
+           ktime_get_real_seconds() - console_session.ses_laststamp >
+           (time64_t)console_session.ses_timeout)
+               console_session.ses_expired = 1;
 
        trans = console_session.ses_ping;
 
@@ -1248,9 +1248,8 @@ lstcon_rpc_pinger(void *arg)
                 if (nd->nd_state != LST_NODE_ACTIVE)
                         continue;
 
-                intv = cfs_duration_sec(cfs_time_sub(cfs_time_current(),
-                                                     nd->nd_stamp));
-                if (intv < (time_t)nd->nd_timeout / 2)
+               intv = cfs_duration_sec(jiffies - nd->nd_stamp);
+               if (intv < nd->nd_timeout / 2)
                         continue;
 
                rc = lstcon_rpc_init(nd, SRPC_SERVICE_DEBUG,
@@ -1278,8 +1277,8 @@ lstcon_rpc_pinger(void *arg)
 
         CDEBUG(D_NET, "Ping %d nodes in session\n", count);
 
-        ptimer->stt_expires = (cfs_time_t)(cfs_time_current_sec() + LST_PING_INTERVAL);
-        stt_add_timer(ptimer);
+       ptimer->stt_expires = ktime_get_real_seconds() + LST_PING_INTERVAL;
+       stt_add_timer(ptimer);
 
        mutex_unlock(&console_session.ses_mutex);
 }
@@ -1300,10 +1299,10 @@ lstcon_rpc_pinger_start(void)
                 return rc;
         }
 
-        ptimer = &console_session.ses_ping_timer;
-        ptimer->stt_expires = (cfs_time_t)(cfs_time_current_sec() + LST_PING_INTERVAL);
+       ptimer = &console_session.ses_ping_timer;
+       ptimer->stt_expires = ktime_get_real_seconds() + LST_PING_INTERVAL;
 
-        stt_add_timer(ptimer);
+       stt_add_timer(ptimer);
 
         return 0;
 }
@@ -1319,7 +1318,7 @@ lstcon_rpc_pinger_stop(void)
         lstcon_rpc_trans_stat(console_session.ses_ping, lstcon_trans_stat());
         lstcon_rpc_trans_destroy(console_session.ses_ping);
 
-        memset(lstcon_trans_stat(), 0, sizeof(lstcon_trans_stat_t));
+       memset(lstcon_trans_stat(), 0, sizeof(struct lstcon_trans_stat));
 
         console_session.ses_ping = NULL;
 }