summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2020-07-16 12:01:44 +0200
committerSimon Rettberg2020-07-16 12:01:44 +0200
commit0762b6f55b6c9416c8c9cddb537728a67c226123 (patch)
treed5a441d774fb6ff2523ea26e1e8ef7cdc6ed05db /src
parent[KERNEL] BLK_MQ_F_SG_MERGE removed in 5.1 (diff)
downloaddnbd3-ng-0762b6f55b6c9416c8c9cddb537728a67c226123.tar.gz
dnbd3-ng-0762b6f55b6c9416c8c9cddb537728a67c226123.tar.xz
dnbd3-ng-0762b6f55b6c9416c8c9cddb537728a67c226123.zip
[KERNEL] do_gettimeofday was removed in 5.0
Diffstat (limited to 'src')
-rw-r--r--src/kernel/net.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/kernel/net.c b/src/kernel/net.c
index e8c7cad..b229164 100644
--- a/src/kernel/net.c
+++ b/src/kernel/net.c
@@ -401,7 +401,7 @@ static void dnbd3_panic_worker(struct work_struct *work)
static int dnbd3_meassure_rtt(struct dnbd3_device *dev,
struct dnbd3_server *server)
{
- struct timeval start, end;
+ u64 start, end;
dnbd3_reply_t reply;
int result;
uint64_t rtt = RTT_UNREACHABLE;
@@ -443,7 +443,7 @@ static int dnbd3_meassure_rtt(struct dnbd3_device *dev,
}
- do_gettimeofday(&start);
+ start = ktime_get_ns();
result = dnbd3_send_request_cmd(&sock, CMD_GET_BLOCK);
if (result <= 0) {
error_sock(&sock, "request test block failed in rtt measurement");
@@ -461,10 +461,9 @@ static int dnbd3_meassure_rtt(struct dnbd3_device *dev,
error_sock(&sock, "receive test block failed in rtt measurement");
goto error;
}
- do_gettimeofday(&end); // end rtt measurement
+ end = ktime_get_ns(); // end rtt measurement
- rtt = (uint64_t)((end.tv_sec - start.tv_sec) * 1000000ull
- + (end.tv_usec - start.tv_usec));
+ rtt = (end - start) / 1000; // ns to us
error: