summaryrefslogtreecommitdiffstats
path: root/include/linux/fscache-cache.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2021-10-20 23:06:16 +0100
committerDavid Howells <dhowells@redhat.com>2022-01-07 09:22:19 +0000
commit8e7a867bb7309fbf47e8c2a68798b919fc02523f (patch)
tree8b8f3580cb0008126c6492f168750b75d9824d1c /include/linux/fscache-cache.h
parentcdf262f29488e6c3432911ec487ea41918fcbcd7 (diff)
downloadlinux-8e7a867bb7309fbf47e8c2a68798b919fc02523f.tar.bz2
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@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/163819609532.215744.10821082637727410554.stgit@warthog.procyon.org.uk/ # v1 Link: https://lore.kernel.org/r/163906912598.143852.12960327989649429069.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/163967113830.1823006.3222957649202368162.stgit@warthog.procyon.org.uk/ # v3 Link: https://lore.kernel.org/r/164021517502.640689.6077928311710357342.stgit@warthog.procyon.org.uk/ # v4
Diffstat (limited to 'include/linux/fscache-cache.h')
-rw-r--r--include/linux/fscache-cache.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index 337335d7a5e2..796c8b5c5305 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -179,4 +179,14 @@ static inline void fscache_wait_for_objects(struct fscache_cache *cache)
atomic_read(&cache->object_count) == 0);
}
+#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
+
#endif /* _LINUX_FSCACHE_CACHE_H */