@@ -537,8 +537,8 @@ struct ptlrpc_cli_req {
long cr_delay_limit;
/** time request was first queued */
unsigned long cr_queued_time;
- /** request sent timeval */
- struct timespec64 cr_sent_tv;
+ /** request sent in nanosseconds */
+ ktime_t cr_sent_ns;
/** time for request really sent out */
time64_t cr_sent_out;
/** when req reply unlink must finish. */
@@ -600,7 +600,7 @@ struct ptlrpc_cli_req {
#define rq_bulk rq_cli.cr_bulk
#define rq_delay_limit rq_cli.cr_delay_limit
#define rq_queued_time rq_cli.cr_queued_time
-#define rq_sent_tv rq_cli.cr_sent_tv
+#define rq_sent_ns rq_cli.cr_sent_ns
#define rq_real_sent rq_cli.cr_sent_out
#define rq_reply_deadline rq_cli.cr_reply_deadline
#define rq_bulk_deadline rq_cli.cr_bulk_deadline
@@ -1325,8 +1325,8 @@ static int after_reply(struct ptlrpc_request *req)
struct obd_import *imp = req->rq_import;
struct obd_device *obd = req->rq_import->imp_obd;
int rc;
- struct timespec64 work_start;
- long timediff;
+ ktime_t work_start;
+ s64 timediff;
u64 committed;
LASSERT(obd);
@@ -1355,10 +1355,9 @@ static int after_reply(struct ptlrpc_request *req)
return 0;
}
- ktime_get_real_ts64(&work_start);
- timediff = (work_start.tv_sec - req->rq_sent_tv.tv_sec) * USEC_PER_SEC +
- (work_start.tv_nsec - req->rq_sent_tv.tv_nsec) /
- NSEC_PER_USEC;
+ work_start = ktime_get_real();
+ timediff = ktime_us_delta(work_start, req->rq_sent_ns);
+
/*
* NB Until this point, the whole of the incoming message,
* including buflens, status etc is in the sender's byte order.
@@ -684,7 +684,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)
OBD_FAIL_TIMEOUT(OBD_FAIL_PTLRPC_DELAY_SEND, request->rq_timeout + 5);
- ktime_get_real_ts64(&request->rq_sent_tv);
+ request->rq_sent_ns = ktime_get_real();
request->rq_sent = ktime_get_real_seconds();
/* We give the server rq_timeout secs to process the req, and
* add the network latency for our local timeout.
@@ -1649,12 +1649,11 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt,
{
struct ptlrpc_service *svc = svcpt->scp_service;
struct ptlrpc_request *request;
- struct timespec64 work_start;
- struct timespec64 work_end;
- struct timespec64 timediff;
- struct timespec64 arrived;
- unsigned long timediff_usecs;
- unsigned long arrived_usecs;
+ ktime_t work_start;
+ ktime_t work_end;
+ ktime_t arrived;
+ s64 timediff_usecs;
+ s64 arrived_usecs;
int fail_opc = 0;
request = ptlrpc_server_request_get(svcpt, false);
@@ -1676,10 +1675,9 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt,
if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_DUMP_LOG))
libcfs_debug_dumplog();
- ktime_get_real_ts64(&work_start);
- timediff = timespec64_sub(work_start, request->rq_arrival_time);
- timediff_usecs = timediff.tv_sec * USEC_PER_SEC +
- timediff.tv_nsec / NSEC_PER_USEC;
+ work_start = ktime_get_real();
+ arrived = timespec64_to_ktime(request->rq_arrival_time);
+ timediff_usecs = ktime_us_delta(work_start, arrived);
if (likely(svc->srv_stats)) {
lprocfs_counter_add(svc->srv_stats, PTLRPC_REQWAIT_CNTR,
timediff_usecs);
@@ -1746,15 +1744,11 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt,
(s64)ktime_get_real_seconds() - request->rq_deadline);
}
- ktime_get_real_ts64(&work_end);
- timediff = timespec64_sub(work_end, work_start);
- timediff_usecs = timediff.tv_sec * USEC_PER_SEC +
- timediff.tv_nsec / NSEC_PER_USEC;
- arrived = timespec64_sub(work_end, request->rq_arrival_time);
- arrived_usecs = arrived.tv_sec * USEC_PER_SEC +
- arrived.tv_nsec / NSEC_PER_USEC;
+ work_end = ktime_get_real();
+ timediff_usecs = ktime_us_delta(work_end, work_start);
+ arrived_usecs = ktime_us_delta(work_end, arrived);
CDEBUG(D_RPCTRACE,
- "Handled RPC pname:cluuid+ref:pid:xid:nid:opc %s:%s+%d:%d:x%llu:%s:%d Request processed in %ldus (%ldus total) trans %llu rc %d/%d\n",
+ "Handled RPC pname:cluuid+ref:pid:xid:nid:opc %s:%s+%d:%d:x%llu:%s:%d Request processed in %lldus (%lldus total) trans %llu rc %d/%d\n",
current->comm,
(request->rq_export ?
(char *)request->rq_export->exp_client_uuid.uuid : "0"),
@@ -1787,8 +1781,7 @@ static bool ptlrpc_server_normal_pending(struct ptlrpc_service_part *svcpt,
DEBUG_REQ(D_ADAPTTO, request,
"sent %d early replies before finishing in %llds",
request->rq_early_count,
- (s64)work_end.tv_sec -
- request->rq_arrival_time.tv_sec);
+ arrived_usecs / USEC_PER_SEC);
}
ptlrpc_server_finish_active_request(svcpt, request);