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

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 27 19:04:22 MSK 2019


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



More information about the Devel mailing list