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

Konstantin Khorenko khorenko at virtuozzo.com
Wed May 29 17:24:46 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 b668141ff2df3ca5910addea5ac0c7a655e0c449
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Wed May 29 17:24:44 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
    
    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_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 361fa1d12c3b..d974285d0ec8 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -1566,6 +1566,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