[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio: make interface pcs_kio_req_list() for listing kio reqs

Konstantin Khorenko khorenko at virtuozzo.com
Tue May 21 18:47:43 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.1
------>
commit ba2e64e8cadc103132ab5d727fe0a7a868191819
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Tue May 21 18:47:41 2019 +0300

    fs/fuse kio: make interface pcs_kio_req_list() for listing kio reqs
    
    This is preparation patch that implements common interface pcs_kio_req_list(),
    which will be needed to collect kio requests statistics.
    
    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
    
    Pavel Butsykin (15):
      fs/fuse: add conn_ctl to fuse_conn struct
      fs/fuse kio: create sysfs stat directory
      fs/fuse kio: implement iostat
      fs/fuse kio: make common interface pcs_kio_file_list() for listing kio files
      fs/fuse kio: make common 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
      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: add locked cs_get_avg_in_flight()
---
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 27 +++++++++++++++++++++++++++
 fs/fuse/kio/pcs/pcs_req.h          |  3 +++
 2 files changed, 30 insertions(+)

diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 2d3d7c6138cd..d837bf3051ed 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -1539,6 +1539,33 @@ void pcs_kio_file_list(struct fuse_conn *fc, kio_file_itr kfile_cb, void *ctx)
 	}
 }
 
+struct kreq_list_ctx {
+	kio_req_itr cb;
+	void *ctx;
+};
+
+static void kpcs_req_list_itr(struct fuse_file *ff, struct pcs_dentry_info *di,
+			      void *ctx)
+{
+	struct fuse_req *req;
+	struct kreq_list_ctx *kreq_ctx = ctx;
+
+	spin_lock(&di->kq_lock);
+	list_for_each_entry(req, &di->kq, list) {
+		kreq_ctx->cb(ff, req, kreq_ctx->ctx);
+	}
+	spin_unlock(&di->kq_lock);
+}
+
+void pcs_kio_req_list(struct fuse_conn *fc, kio_req_itr kreq_cb, void *ctx)
+{
+	struct kreq_list_ctx kreq_ctx = {
+		.cb = kreq_cb,
+		.ctx = ctx,
+	};
+	pcs_kio_file_list(fc, kpcs_req_list_itr, &kreq_ctx);
+}
+
 static void kpcs_kill_lreq_itr(struct fuse_file *ff, struct pcs_dentry_info *di,
 			       void *ctx)
 {
diff --git a/fs/fuse/kio/pcs/pcs_req.h b/fs/fuse/kio/pcs/pcs_req.h
index 0bb3b9144cae..3f26aa3489ff 100644
--- a/fs/fuse/kio/pcs/pcs_req.h
+++ b/fs/fuse/kio/pcs/pcs_req.h
@@ -331,5 +331,8 @@ void pcs_ireq_queue_fail(struct list_head *queue, int error);
 typedef void (*kio_file_itr)(struct fuse_file *ff, struct pcs_dentry_info *di,
 			     void *ctx);
 void pcs_kio_file_list(struct fuse_conn *fc, kio_file_itr kfile_cb, void *ctx);
+typedef void (*kio_req_itr)(struct fuse_file *ff, struct fuse_req *req,
+			    void *ctx);
+void pcs_kio_req_list(struct fuse_conn *fc, kio_req_itr kreq_cb, void *ctx);
 
 #endif /* _PCS_REQ_H_ */



More information about the Devel mailing list