[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <163492945090.1038219.9027971867494708379.stgit@warthog.procyon.org.uk>
Date: Fri, 22 Oct 2021 20:04:10 +0100
From: David Howells <dhowells@...hat.com>
To: linux-cachefs@...hat.com
Cc: dhowells@...hat.com, Trond Myklebust <trondmy@...merspace.com>,
Anna Schumaker <anna.schumaker@...app.com>,
Steve French <sfrench@...ba.org>,
Dominique Martinet <asmadeus@...ewreck.org>,
Jeff Layton <jlayton@...nel.com>,
Matthew Wilcox <willy@...radead.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Omar Sandoval <osandov@...ndov.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
linux-afs@...ts.infradead.org, linux-nfs@...r.kernel.org,
linux-cifs@...r.kernel.org, ceph-devel@...r.kernel.org,
v9fs-developer@...ts.sourceforge.net,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v2 22/53] fscache: Provide read/write stat counters for the
cache
Provide read/write stat counters for the cache backend to use.
Signed-off-by: David Howells <dhowells@...hat.com>
cc: linux-cachefs@...hat.com
---
fs/fscache/stats.c | 9 +++++++++
include/linux/fscache-cache.h | 10 ++++++++++
2 files changed, 19 insertions(+)
diff --git a/fs/fscache/stats.c b/fs/fscache/stats.c
index 45b7636c7737..8d5ad6771498 100644
--- a/fs/fscache/stats.c
+++ b/fs/fscache/stats.c
@@ -37,6 +37,11 @@ atomic_t fscache_n_relinquishes;
atomic_t fscache_n_relinquishes_retire;
atomic_t fscache_n_relinquishes_dropped;
+atomic_t fscache_n_read;
+EXPORT_SYMBOL(fscache_n_read);
+atomic_t fscache_n_write;
+EXPORT_SYMBOL(fscache_n_write);
+
/*
* display the general statistics
*/
@@ -76,6 +81,10 @@ int fscache_stats_show(struct seq_file *m, void *v)
atomic_read(&fscache_n_relinquishes_retire),
atomic_read(&fscache_n_relinquishes_dropped));
+ seq_printf(m, "IO : rd=%u wr=%u\n",
+ atomic_read(&fscache_n_read),
+ atomic_read(&fscache_n_write));
+
netfs_stats_show(m);
return 0;
}
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index 2d57b85cfde3..6830f91ebaf4 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -172,6 +172,16 @@ void fscache_end_operation(struct netfs_cache_resources *cres)
ops->end_operation(cres);
}
+#ifdef CONFIG_FSCACHE_STATS
+extern atomic_t fscache_n_read;
+extern atomic_t fscache_n_write;
+#define fscache_count_read() atomic_inc(&fscache_n_read)
+#define fscache_count_write() atomic_inc(&fscache_n_write)
+#else
+#define fscache_count_read() do {} while(0)
+#define fscache_count_write() do {} while(0)
+#endif
+
extern struct workqueue_struct *fscache_wq;
#endif /* _LINUX_FSCACHE_CACHE_H */
Powered by blists - more mailing lists