[RHEL7,COMMIT] fs/fuse kio: fix latency time count

Submitted by Konstantin Khorenko on May 27, 2019, 4:04 p.m.

Details

Message ID 201905271604.x4RG4Lpv010293@finist-ce7.sw.ru
State New
Series "fs/fuse kio: fix latency time count"
Headers show

Commit Message

Konstantin Khorenko May 27, 2019, 4:04 p.m.
The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.2.vz7.96.5
------>
commit 8ee5cf610a9cc587363cfd9dc70f4bbf3ab34d4d
Author: Pavel Butsykin <pbutsykin@virtuozzo.com>
Date:   Mon May 27 19:04:21 2019 +0300

    fs/fuse kio: fix latency time count
    
    All protocol structures store time in microseconds, also requests have
    timestamps in microseconds, but for some reason vstorage kernel client
    calculates the time in milliseconds. Fix that.
    
    Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_cs.c  | 2 +-
 fs/fuse/kio/pcs/pcs_map.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
index dc7d01387beb..16992eb50e8d 100644
--- a/fs/fuse/kio/pcs/pcs_cs.c
+++ b/fs/fuse/kio/pcs/pcs_cs.c
@@ -661,7 +661,7 @@  static void cs_keep_waiting(struct pcs_rpc *ep, struct pcs_msg *req, struct pcs_
 		struct pcs_int_request *ireq = req->private2;
 		abs_time_t lat = 0; /* GCC bug */
 		if (ireq) {
-			lat = ktime_to_ms(ktime_sub(ktime_get(), ireq->ts_sent));
+			lat = ktime_to_us(ktime_sub(ktime_get(), ireq->ts_sent));
 			cs_update_io_latency(who, lat);
 
 			ireq->wait_origin = h->xid.origin;
diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index 0d50250e6496..fb9e4ddae8a2 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -1397,7 +1397,7 @@  static int worth_to_grow(struct pcs_int_request *ireq, struct pcs_cs * cs)
 	if (ireq->type == PCS_IREQ_FLUSH)
 		return 0;
 
-	return ktime_to_ms(ktime_sub(ktime_get(), ireq->ts_sent)) < cc_from_csset(cs->css)->netlat_cutoff;
+	return ktime_to_us(ktime_sub(ktime_get(), ireq->ts_sent)) < cc_from_csset(cs->css)->netlat_cutoff;
 }
 
 static void pcs_cs_deaccount(struct pcs_int_request *ireq, struct pcs_cs * cs, int error)
@@ -2669,7 +2669,7 @@  static inline u32 calc_latency(ktime_t start)
 	ktime_t now = ktime_get();
 
 	if (ktime_compare(now, start) > 0) {
-		u64 elapsed = ktime_to_ms(ktime_sub(now, start));
+		u64 elapsed = ktime_to_us(ktime_sub(now, start));
 		return elapsed > ~0U ? ~0U : elapsed;
 	} else {
 		return 0;