]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
fscache: Provide read/write stat counters for the cache
authorDavid Howells <dhowells@redhat.com>
Wed, 20 Oct 2021 22:06:16 +0000 (23:06 +0100)
committerDavid Howells <dhowells@redhat.com>
Fri, 26 Nov 2021 14:28:53 +0000 (14:28 +0000)
Provide read/write stat counters for the cache backend to use.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-cachefs@redhat.com

fs/fscache/stats.c
include/linux/fscache-cache.h

index cdbb672a274f834d76aadfe94219c6ddbec106df..db42beb1ba3fc41abd00751034f61a8e7d5adb35 100644 (file)
@@ -35,6 +35,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
  */
@@ -72,6 +77,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;
 }
index 5525df0568778a1d31086d8252be1c82eaa8bfca..1398b71539aed9a269febb060bbadfa843eb087a 100644 (file)
@@ -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 */