[Devel] [PATCH 06/15] fs/fuse kio: add retry counter for kio requests
Pavel Butsykin
pbutsykin at virtuozzo.com
Fri May 17 16:20:39 MSK 2019
This counter will be useful for displaying in requests statistics info.
Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
fs/fuse/kio/pcs/pcs_cluster.c | 1 +
fs/fuse/kio/pcs/pcs_cluster.h | 12 +++++++++++-
fs/fuse/kio/pcs/pcs_map.c | 1 +
fs/fuse/kio/pcs/pcs_req.c | 1 +
4 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/fs/fuse/kio/pcs/pcs_cluster.c b/fs/fuse/kio/pcs/pcs_cluster.c
index 5df263f01f98..1625e3d0a6c6 100644
--- a/fs/fuse/kio/pcs/pcs_cluster.c
+++ b/fs/fuse/kio/pcs/pcs_cluster.c
@@ -38,6 +38,7 @@ void pcs_sreq_complete(struct pcs_int_request *sreq)
* and, most likely, resubmit request.
*/
if (ireq_check_redo(sreq)) {
+ ireq_retry_inc(ireq);
if (sreq->type != PCS_IREQ_CUSTOM) {
map_notify_soft_error(sreq);
diff --git a/fs/fuse/kio/pcs/pcs_cluster.h b/fs/fuse/kio/pcs/pcs_cluster.h
index 73af9359706e..8369f9b00cfa 100644
--- a/fs/fuse/kio/pcs/pcs_cluster.h
+++ b/fs/fuse/kio/pcs/pcs_cluster.h
@@ -18,7 +18,7 @@ struct pcs_fuse_exec_ctx {
struct bio_vec inline_bvec[FUSE_MAX_PAGES_PER_REQ];
} io;
struct {
- unsigned retry_cnt;
+ atomic_t retry_cnt;
pcs_error_t last_err;
} ctl;
};
@@ -29,6 +29,16 @@ struct pcs_fuse_req {
struct pcs_fuse_exec_ctx exec; /* Zero initialized context */
};
+static inline void ireq_retry_inc(struct pcs_int_request *ireq)
+{
+ if (likely(!ireq->completion_data.parent && ireq->completion_data.priv)) {
+ struct pcs_fuse_req *r = ireq->completion_data.priv;
+ atomic_inc(&r->exec.ctl.retry_cnt);
+ return;
+ }
+ WARN_ON_ONCE(1);
+}
+
struct pcs_fuse_cluster {
struct pcs_cluster_core cc;
struct fuse_conn *fc;
diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c
index b795a45cc376..5ef2efe44090 100644
--- a/fs/fuse/kio/pcs/pcs_map.c
+++ b/fs/fuse/kio/pcs/pcs_map.c
@@ -2871,6 +2871,7 @@ static void pcs_flushreq_complete(struct pcs_int_request * sreq)
sreq->flags &= ~IREQ_F_ONCE;
spin_unlock(&m->lock);
+ ireq_retry_inc(ireq);
map_notify_error(m, sreq, &ioh->map_version, sreq->flushreq.csl);
pcs_deaccount_ireq(sreq, &sreq->error);
pcs_clear_error(&sreq->error);
diff --git a/fs/fuse/kio/pcs/pcs_req.c b/fs/fuse/kio/pcs/pcs_req.c
index 9e4dc5e7b15d..55fb39e91b93 100644
--- a/fs/fuse/kio/pcs/pcs_req.c
+++ b/fs/fuse/kio/pcs/pcs_req.c
@@ -137,6 +137,7 @@ noinline void pcs_ireq_queue_fail(struct list_head *queue, int error)
ireq_on_error(ireq);
if (!(ireq->flags & IREQ_F_FATAL)) {
+ ireq_retry_inc(ireq);
pcs_clear_error(&ireq->error);
FUSE_KTRACE(ireq->cc->fc, "requeue truncate(%d) %llu@" DENTRY_FMT, ireq->type,
--
2.15.1
More information about the Devel
mailing list