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

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

    fs/fuse kio: make interface pcs_kio_file_list() for listing kio files
    
    This is a preparation patch that implements common interface
    pcs_kio_file_list(), which will be needed to collect kio files 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 | 22 +++++++++++++++++-----
 fs/fuse/kio/pcs/pcs_req.h          |  5 +++++
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index f231ef0bdcef..2d3d7c6138cd 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -1517,7 +1517,7 @@ void __kfuse_trace(struct fuse_conn * fc, unsigned long ip, const char * fmt, ..
 	put_cpu();
 }
 
-static void kpcs_kill_requests(struct fuse_conn *fc, struct inode *inode)
+void pcs_kio_file_list(struct fuse_conn *fc, kio_file_itr kfile_cb, void *ctx)
 {
 	struct fuse_file *ff;
 
@@ -1535,13 +1535,25 @@ static void kpcs_kill_requests(struct fuse_conn *fc, struct inode *inode)
 			continue;
 
 		di = pcs_inode_from_fuse(fi);
-
-		spin_lock(&di->kq_lock);
-		fuse_kill_requests(fc, inode, &di->kq);
-		spin_unlock(&di->kq_lock);
+		kfile_cb(ff, di, ctx);
 	}
 }
 
+static void kpcs_kill_lreq_itr(struct fuse_file *ff, struct pcs_dentry_info *di,
+			       void *ctx)
+{
+	struct inode *inode = ctx;
+
+	spin_lock(&di->kq_lock);
+	fuse_kill_requests(ff->fc, inode, &di->kq);
+	spin_unlock(&di->kq_lock);
+}
+
+static void kpcs_kill_requests(struct fuse_conn *fc, struct inode *inode)
+{
+	pcs_kio_file_list(fc, kpcs_kill_lreq_itr, inode);
+}
+
 static struct fuse_kio_ops kio_pcs_ops = {
 	.name		= "pcs",
 	.owner		= THIS_MODULE,
diff --git a/fs/fuse/kio/pcs/pcs_req.h b/fs/fuse/kio/pcs/pcs_req.h
index c32177603130..0bb3b9144cae 100644
--- a/fs/fuse/kio/pcs/pcs_req.h
+++ b/fs/fuse/kio/pcs/pcs_req.h
@@ -9,6 +9,7 @@
 #include "pcs_rpc.h"
 #include "pcs_cs.h"
 #include "fuse_stat.h"
+#include "../../fuse_i.h"
 
 ///////////////////////////
 
@@ -327,4 +328,8 @@ void pcs_process_ireq(struct pcs_int_request *ireq);
 
 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);
+
 #endif /* _PCS_REQ_H_ */



More information about the Devel mailing list