nfsd: remove nfsd_stats, make th_cnt a global counter
authorJosef Bacik <josef@toxicpanda.com>
Fri, 26 Jan 2024 15:39:48 +0000 (10:39 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Fri, 1 Mar 2024 14:12:11 +0000 (09:12 -0500)
This is the last global stat, take it out of the nfsd_stats struct and
make it a global part of nfsd, report it the same as always.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfsd.h
fs/nfsd/nfssvc.c
fs/nfsd/stats.c
fs/nfsd/stats.h

index 304e9728b929a0d74613c1607ca8eea67318b5bc..be2ea3d6d2a28935416860932a2f70f195f5a8cf 100644 (file)
@@ -86,6 +86,7 @@ extern struct mutex           nfsd_mutex;
 extern spinlock_t              nfsd_drc_lock;
 extern unsigned long           nfsd_drc_max_mem;
 extern unsigned long           nfsd_drc_mem_used;
+extern atomic_t                        nfsd_th_cnt;            /* number of available threads */
 
 extern const struct seq_operations nfs_exports_op;
 
index d98a6abad99010dc300dc1867a4f2d39dd9dd94e..fdb59189643044448ce2ddba89db8d3c2d27399f 100644 (file)
@@ -34,6 +34,7 @@
 
 #define NFSDDBG_FACILITY       NFSDDBG_SVC
 
+atomic_t                       nfsd_th_cnt = ATOMIC_INIT(0);
 extern struct svc_program      nfsd_program;
 static int                     nfsd(void *vrqstp);
 #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
@@ -924,7 +925,7 @@ nfsd(void *vrqstp)
 
        current->fs->umask = 0;
 
-       atomic_inc(&nfsdstats.th_cnt);
+       atomic_inc(&nfsd_th_cnt);
 
        set_freezable();
 
@@ -940,7 +941,7 @@ nfsd(void *vrqstp)
                nfsd_file_net_dispose(nn);
        }
 
-       atomic_dec(&nfsdstats.th_cnt);
+       atomic_dec(&nfsd_th_cnt);
 
 out:
        /* Release the thread */
index 44e275324b06e50b68ec47cd0c6d2a026d05007b..3a7f791c30528d2862a46d5df7f453764e376cac 100644 (file)
@@ -27,7 +27,6 @@
 
 #include "nfsd.h"
 
-struct nfsd_stats      nfsdstats;
 struct svc_stat                nfsd_svcstats = {
        .program        = &nfsd_program,
 };
@@ -47,7 +46,7 @@ static int nfsd_show(struct seq_file *seq, void *v)
                   percpu_counter_sum_positive(&nn->counter[NFSD_STATS_IO_WRITE]));
 
        /* thread usage: */
-       seq_printf(seq, "th %u 0", atomic_read(&nfsdstats.th_cnt));
+       seq_printf(seq, "th %u 0", atomic_read(&nfsd_th_cnt));
 
        /* deprecated thread usage histogram stats */
        for (i = 0; i < 10; i++)
index c24be4ddbe7d7076f627c313922f11bdb1390242..5675d283a53730e2cd01aec6f82ea26b26aca49c 100644 (file)
 #include <uapi/linux/nfsd/stats.h>
 #include <linux/percpu_counter.h>
 
-struct nfsd_stats {
-       atomic_t        th_cnt;         /* number of available threads */
-};
-
-extern struct nfsd_stats       nfsdstats;
-
 extern struct svc_stat         nfsd_svcstats;
 
 int nfsd_percpu_counters_init(struct percpu_counter *counters, int num);