]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFSD: Report filecache LRU size
authorChuck Lever <chuck.lever@oracle.com>
Fri, 8 Jul 2022 18:23:52 +0000 (14:23 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:19:08 +0000 (16:19 +0200)
[ Upstream commit 0fd244c115f0321fc5e34ad2291f2a572508e3f7 ]

Surface the NFSD filecache's LRU list length to help field
troubleshooters monitor filecache issues.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/filecache.c

index 1d3d13b78be0e331496a5041f4b33a228dd304fc..377d8211200ff2a3e8abd6847a9769aa7470dc71 100644 (file)
@@ -1047,7 +1047,7 @@ nfsd_file_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
 static int nfsd_file_cache_stats_show(struct seq_file *m, void *v)
 {
        unsigned int i, count = 0, longest = 0;
-       unsigned long hits = 0;
+       unsigned long lru = 0, hits = 0;
 
        /*
         * No need for spinlocks here since we're not terribly interested in
@@ -1060,6 +1060,7 @@ static int nfsd_file_cache_stats_show(struct seq_file *m, void *v)
                        count += nfsd_file_hashtbl[i].nfb_count;
                        longest = max(longest, nfsd_file_hashtbl[i].nfb_count);
                }
+               lru = list_lru_count(&nfsd_file_lru);
        }
        mutex_unlock(&nfsd_mutex);
 
@@ -1068,6 +1069,7 @@ static int nfsd_file_cache_stats_show(struct seq_file *m, void *v)
 
        seq_printf(m, "total entries: %u\n", count);
        seq_printf(m, "longest chain: %u\n", longest);
+       seq_printf(m, "lru entries:   %lu\n", lru);
        seq_printf(m, "cache hits:    %lu\n", hits);
        return 0;
 }