[Devel] [PATCH] fs/fuse kio: fix latency time count

Pavel Butsykin pbutsykin at virtuozzo.com
Fri May 24 19:15:18 MSK 2019


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 at 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(-)

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;
-- 
2.15.1



More information about the Devel mailing list