]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nfsd: remove nfsd_stats, make th_cnt a global counter
authorJosef Bacik <josef@toxicpanda.com>
Thu, 5 Sep 2024 15:31:00 +0000 (11:31 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Sep 2024 09:06:45 +0000 (11:06 +0200)
[ Upstream commit e41ee44cc6a473b1f414031782c3b4283d7f3e5f ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/nfsd.h
fs/nfsd/nfssvc.c
fs/nfsd/stats.c
fs/nfsd/stats.h

index 013bfa24ced21530bc673795d2bcea182dc4f9c4..996f3f62335b257efd3f8f610621a3ae71b2f868 100644 (file)
@@ -69,6 +69,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 a5f33089c7d98490c4e2aefcf4aef1b84600e53a..3f02a9a44c6b8a30e84cd20c0dead4708355d87e 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)
@@ -935,7 +936,7 @@ nfsd(void *vrqstp)
 
        current->fs->umask = 0;
 
-       atomic_inc(&nfsdstats.th_cnt);
+       atomic_inc(&nfsd_th_cnt);
 
        set_freezable();
 
@@ -959,7 +960,7 @@ nfsd(void *vrqstp)
                validate_process_creds();
        }
 
-       atomic_dec(&nfsdstats.th_cnt);
+       atomic_dec(&nfsd_th_cnt);
 
 out:
        /* Release the thread */
index c21dbd7d008641c682f5e545a6a9a2bac3e7c664..6b2135bfb5090b9e2b0d7891f0e38aa766a7126e 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 28f5c720e9b39118c3eed416e55b95bad854aafd..9b22b1ae929fe4d0e81abe9623e8f565167b463f 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);