[Devel] [PATCH RHEL8 COMMIT] fs/fuse kio: calculate network latency properly

Konstantin Khorenko khorenko at virtuozzo.com
Thu Sep 24 11:28:25 MSK 2020


The commit is pushed to "branch-rh8-4.18.0-193.6.3.vz8.4.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-193.6.3.vz8.4.7
------>
commit c252f230e0d024cae42b1706bc92fc09bc6f050a
Author: Ildar Ismagilov <Ildar.Ismagilov at acronis.com>
Date:   Thu Aug 6 09:49:53 2020 +0300

    fs/fuse kio: calculate network latency properly
    
    Fix incorrect calculation of network latency in case of more than
    one replica.
    
    For example, in case of 3 replicas the network latency should be
    calculated like this:
    net_lat = lat - max(CS[0].ts_net, CS[0].ts_io) +
              CS[0].ts_net - max(CS[1].ts_net, CS[1].ts_io) +
              CS[1].ts_net - max(CS[2].ts_net, CS[2].ts_io);
    
    Signed-off-by: Ildar Ismagilov <Ildar.Ismagilov at acronis.com>
    Acked-by: Alexey Kuznetsov <Alexey.Kuznetsov at acronis.com>
    Acked-by: Andrey Zaitsev <azaitsev at virtuozzo.com>
    
    (cherry picked from commit 2f2214db166266b307afa607d50cb70b8c51e2d5)
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_map.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index c39ae34a5f51..0244ff54c473 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -2683,8 +2683,12 @@ static int commit_sync_info(struct pcs_int_request *req,
 	struct pcs_cs_iohdr *h = (struct pcs_cs_iohdr *)resp->_inline_buffer;
 	int err = 0;
 	unsigned int max_iolat, lat = calc_latency(req->ts_sent);
+	unsigned int net_lat;
+	u32 max_lat;
 
 	err |= commit_one_record(m, resp->rpc->peer_id, &h->sync, lat, h->hdr.type);
+	max_lat = max_t(u32, h->sync.ts_net, h->sync.ts_io);
+	net_lat = lat < max_lat ? 0 : lat - max_lat;
 
 	/* Network latency is updated only for the first CS in chain.
 	 * The results for anothers are ignored, which looks sad, because we lose
@@ -2706,12 +2710,14 @@ static int commit_sync_info(struct pcs_int_request *req,
 		     (void*)(srec + 1) <= (void*)h + h->hdr.len;
 		     srec++) {
 			err |= commit_one_record(m, srec->cs_id, &srec->sync, lat, h->hdr.type);
+			max_lat = max_t(u32, srec->sync.ts_net, srec->sync.ts_io);
+			net_lat += lat < max_lat ? 0 : lat - max_lat;
 			lat  = srec->sync.ts_net;
 			if (max_iolat < srec->sync.ts_io)
 				max_iolat = srec->sync.ts_io;
 		}
 	}
-	pcs_fuse_stat_io_count(req, resp, max_iolat, lat - max_iolat);
+	pcs_fuse_stat_io_count(req, resp, max_iolat, net_lat);
 	cs_log_io_times(req, resp, max_iolat);
 
 	evaluate_dirty_status(m);


More information about the Devel mailing list