Revert "nfsd: remove nfsd_stats, make th_cnt a global counter"

This reverts commit 32028a262e.
This commit is contained in:
Ksawlii 2024-11-24 00:23:43 +01:00
parent d494229215
commit e7983f03a7
4 changed files with 10 additions and 5 deletions

View file

@ -69,7 +69,6 @@ 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;

View file

@ -34,7 +34,6 @@
#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)
@ -936,7 +935,7 @@ nfsd(void *vrqstp)
current->fs->umask = 0;
atomic_inc(&nfsd_th_cnt);
atomic_inc(&nfsdstats.th_cnt);
set_freezable();
@ -960,7 +959,7 @@ nfsd(void *vrqstp)
validate_process_creds();
}
atomic_dec(&nfsd_th_cnt);
atomic_dec(&nfsdstats.th_cnt);
out:
/* Release the thread */

View file

@ -27,6 +27,7 @@
#include "nfsd.h"
struct nfsd_stats nfsdstats;
struct svc_stat nfsd_svcstats = {
.program = &nfsd_program,
};
@ -46,7 +47,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(&nfsd_th_cnt));
seq_printf(seq, "th %u 0", atomic_read(&nfsdstats.th_cnt));
/* deprecated thread usage histogram stats */
for (i = 0; i < 10; i++)

View file

@ -10,6 +10,12 @@
#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);