[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio: add retry counter for kio requests

Konstantin Khorenko khorenko at virtuozzo.com
Wed May 29 17:24:47 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.7
------>
commit a5fbf521bfa85bc81f959a12ef294bb810e13690
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Wed May 29 17:24:45 2019 +0300

    fs/fuse kio: add retry counter for kio requests
    
    This counter will be useful for displaying in requests statistics info.
    
    Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
    
    =====================
    Patchset description:
    
    Statistics for vstorage kernel fast-path
    
    Vstorage provides plenty of statistics information via 'vstorage -c cl mnt-top',
    but when it comes kernel fast-path, it doesn't work. All because mnt-top
    command collects information from .vstorage.info directory, where vstorage-mount
    provides a lot of different statistical information in the form of files, but
    it was not implemented for for fast-path.
    
    This patch-set is aimed to implementation of the support of some statistics
    inforamtion files from .vstorage.info:
      cs_stats
      fstat
      fstat_lat
      iostat
      requests
    Which will be located at "/sys/fs/fuse/connections/*mnt_id*/kio_stat/". This
    will be enough to maintain vstorage mnt-top command for fast-path mount points.
    
    https://pmc.acronis.com/browse/VSTOR-20979
    
    Acked-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
    
    Pavel Butsykin (14):
      fs/fuse: add conn_ctl to fuse_conn struct
      fs/fuse kio: create sysfs stat directory
      fs/fuse kio: implement iostat statistics info
      fs/fuse kio: make interface pcs_kio_file_list() for listing kio files
      fs/fuse kio: make interface pcs_kio_req_list() for listing kio reqs
      fs/fuse kio: add retry counter for kio requests
      fs/fuse kio: implement pcs_strerror()
      fs/fuse kio: implement requests statistics info
      fs/fuse kio: implement fstat statistics info
      fs/fuse kio: implement fstat_lat statistics info
      fs/fuse kio: remove useless pcs_cs initialization
      fs/fuse kio: implement cs statistics accounting
      fs/fuse kio: convert rpc state id to string
      fs/fuse kio: implement cs_stats statistics info
---
 fs/fuse/kio/pcs/pcs_cluster.c |  1 +
 fs/fuse/kio/pcs/pcs_cluster.h | 12 +++++++++++-
 fs/fuse/kio/pcs/pcs_map.c     |  1 +
 fs/fuse/kio/pcs/pcs_req.c     |  1 +
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/kio/pcs/pcs_cluster.c b/fs/fuse/kio/pcs/pcs_cluster.c
index a73120c97e5e..082acea9affa 100644
--- a/fs/fuse/kio/pcs/pcs_cluster.c
+++ b/fs/fuse/kio/pcs/pcs_cluster.c
@@ -38,6 +38,7 @@ void pcs_sreq_complete(struct pcs_int_request *sreq)
 			 * and, most likely, resubmit request.
 			 */
 			if (ireq_check_redo(sreq)) {
+				ireq_retry_inc(ireq);
 				if (sreq->type != PCS_IREQ_CUSTOM) {
 					map_notify_soft_error(sreq);
 
diff --git a/fs/fuse/kio/pcs/pcs_cluster.h b/fs/fuse/kio/pcs/pcs_cluster.h
index 73af9359706e..8369f9b00cfa 100644
--- a/fs/fuse/kio/pcs/pcs_cluster.h
+++ b/fs/fuse/kio/pcs/pcs_cluster.h
@@ -18,7 +18,7 @@ struct pcs_fuse_exec_ctx {
 		struct bio_vec inline_bvec[FUSE_MAX_PAGES_PER_REQ];
 	} io;
 	struct {
-		unsigned		retry_cnt;
+		atomic_t		retry_cnt;
 		pcs_error_t		last_err;
 	} ctl;
 };
@@ -29,6 +29,16 @@ struct pcs_fuse_req {
 	struct pcs_fuse_exec_ctx exec;	/* Zero initialized context */
 };
 
+static inline void ireq_retry_inc(struct pcs_int_request *ireq)
+{
+	if (likely(!ireq->completion_data.parent && ireq->completion_data.priv)) {
+		struct pcs_fuse_req *r = ireq->completion_data.priv;
+		atomic_inc(&r->exec.ctl.retry_cnt);
+		return;
+	}
+	WARN_ON_ONCE(1);
+}
+
 struct pcs_fuse_cluster {
 	struct pcs_cluster_core cc;
 	struct fuse_conn *fc;
diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index 7b2adfd4dfc7..fb6e4fa8fdfa 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -2881,6 +2881,7 @@ static void pcs_flushreq_complete(struct pcs_int_request * sreq)
 				sreq->flags &= ~IREQ_F_ONCE;
 			spin_unlock(&m->lock);
 
+			ireq_retry_inc(ireq);
 			map_notify_error(m, sreq, &ioh->map_version, sreq->flushreq.csl);
 			pcs_deaccount_ireq(sreq, &sreq->error);
 			pcs_clear_error(&sreq->error);
diff --git a/fs/fuse/kio/pcs/pcs_req.c b/fs/fuse/kio/pcs/pcs_req.c
index 9e4dc5e7b15d..55fb39e91b93 100644
--- a/fs/fuse/kio/pcs/pcs_req.c
+++ b/fs/fuse/kio/pcs/pcs_req.c
@@ -137,6 +137,7 @@ noinline void pcs_ireq_queue_fail(struct list_head *queue, int error)
 			ireq_on_error(ireq);
 
 			if (!(ireq->flags & IREQ_F_FATAL)) {
+				ireq_retry_inc(ireq);
 				pcs_clear_error(&ireq->error);
 
 				FUSE_KTRACE(ireq->cc->fc, "requeue truncate(%d) %llu@" DENTRY_FMT, ireq->type,



More information about the Devel mailing list