fs/fuse kio: fix latency time count

Submitted by Pavel Butsykin on May 24, 2019, 4:15 p.m.

Details

Message ID 20190524161518.8567-1-pbutsykin@virtuozzo.com
State New
Series "fs/fuse kio: fix latency time count"
Headers show

Commit Message

Pavel Butsykin May 24, 2019, 4:15 p.m.
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;