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

Submitted by Konstantin Khorenko on May 29, 2019, 2:24 p.m.

Details

Message ID 201905291424.x4TEOhvB009570@finist-ce7.sw.ru
State New
Series "Statistics for vstorage kernel fast-path"
Headers show

Commit Message

Konstantin Khorenko May 29, 2019, 2:24 p.m.
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 484eb37e8ebb3133fdda5773a7dcce02bfa7d2ae
Author: Pavel Butsykin <pbutsykin@virtuozzo.com>
Date:   Wed May 29 17:24:43 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@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@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 | 22 +++++++++++++++++-----
 fs/fuse/kio/pcs/pcs_req.h          |  5 +++++
 2 files changed, 22 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 51e45911d6b8..361fa1d12c3b 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -1544,7 +1544,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;
 
@@ -1562,13 +1562,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_ */