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 <pbutsy...@virtuozzo.com>
---
 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 2060ef3b1fc4..796d8db05aba 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -1533,6 +1533,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 a1c7e372f297..ce73fe45bd86 100644
--- a/fs/fuse/kio/pcs/pcs_req.h
+++ b/fs/fuse/kio/pcs/pcs_req.h
@@ -332,5 +332,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_ */
-- 
2.15.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to