aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre/lnet/selftest/ping_test.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2015-09-27 16:45:16 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-09-29 04:03:36 +0200
commit1f8c37a4e29bb4794950228d2d9571029f277d7b (patch)
treebd4090bf6fa748029557293cbf6a3df69fc7fefd /drivers/staging/lustre/lnet/selftest/ping_test.c
parentstaging/lustre: use 64-bit computation in s2dhms() (diff)
downloadlinux-dev-1f8c37a4e29bb4794950228d2d9571029f277d7b.tar.xz
linux-dev-1f8c37a4e29bb4794950228d2d9571029f277d7b.zip
staging/lustre: use 64-bit timestamps for selftest
The wire protocol for the ping uses a 64-bit seconds/microseconds pair, but this won't work when one side uses a 32-bit timeval to look up the current time beyond 2038. This changes the code to use ktime_get_real_ts64() to create a timestamp that has the right format on all machines. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lnet/selftest/ping_test.c')
-rw-r--r--drivers/staging/lustre/lnet/selftest/ping_test.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/staging/lustre/lnet/selftest/ping_test.c b/drivers/staging/lustre/lnet/selftest/ping_test.c
index 1dab9984c58e..d42653654fa8 100644
--- a/drivers/staging/lustre/lnet/selftest/ping_test.c
+++ b/drivers/staging/lustre/lnet/selftest/ping_test.c
@@ -92,7 +92,7 @@ ping_client_prep_rpc(sfw_test_unit_t *tsu,
srpc_ping_reqst_t *req;
sfw_test_instance_t *tsi = tsu->tsu_instance;
sfw_session_t *sn = tsi->tsi_batch->bat_session;
- struct timeval tv;
+ struct timespec64 ts;
int rc;
LASSERT(sn != NULL);
@@ -110,9 +110,9 @@ ping_client_prep_rpc(sfw_test_unit_t *tsu,
req->pnr_seq = lst_ping_data.pnd_counter++;
spin_unlock(&lst_ping_data.pnd_lock);
- cfs_fs_timeval(&tv);
- req->pnr_time_sec = tv.tv_sec;
- req->pnr_time_usec = tv.tv_usec;
+ ktime_get_real_ts64(&ts);
+ req->pnr_time_sec = ts.tv_sec;
+ req->pnr_time_usec = ts.tv_nsec / NSEC_PER_USEC;
return rc;
}
@@ -124,7 +124,7 @@ ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)
sfw_session_t *sn = tsi->tsi_batch->bat_session;
srpc_ping_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.ping_reqst;
srpc_ping_reply_t *reply = &rpc->crpc_replymsg.msg_body.ping_reply;
- struct timeval tv;
+ struct timespec64 ts;
LASSERT(sn != NULL);
@@ -161,10 +161,10 @@ ping_client_done_rpc(sfw_test_unit_t *tsu, srpc_client_rpc_t *rpc)
return;
}
- cfs_fs_timeval(&tv);
+ ktime_get_real_ts64(&ts);
CDEBUG(D_NET, "%d reply in %u usec\n", reply->pnr_seq,
- (unsigned)((tv.tv_sec - (unsigned)reqst->pnr_time_sec) * 1000000
- + (tv.tv_usec - reqst->pnr_time_usec)));
+ (unsigned)((ts.tv_sec - reqst->pnr_time_sec) * 1000000 +
+ (ts.tv_nsec / NSEC_PER_USEC - reqst->pnr_time_usec)));
return;
}