Skip to content

Commit e41ee44

Browse files
josefbacikchucklever
authored andcommitted
nfsd: remove nfsd_stats, make th_cnt a global counter
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>
1 parent 4b14885 commit e41ee44

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

fs/nfsd/nfsd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ extern struct mutex nfsd_mutex;
8686
extern spinlock_t nfsd_drc_lock;
8787
extern unsigned long nfsd_drc_max_mem;
8888
extern unsigned long nfsd_drc_mem_used;
89+
extern atomic_t nfsd_th_cnt; /* number of available threads */
8990

9091
extern const struct seq_operations nfs_exports_op;
9192

fs/nfsd/nfssvc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
#define NFSDDBG_FACILITY NFSDDBG_SVC
3636

37+
atomic_t nfsd_th_cnt = ATOMIC_INIT(0);
3738
extern struct svc_program nfsd_program;
3839
static int nfsd(void *vrqstp);
3940
#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
@@ -924,7 +925,7 @@ nfsd(void *vrqstp)
924925

925926
current->fs->umask = 0;
926927

927-
atomic_inc(&nfsdstats.th_cnt);
928+
atomic_inc(&nfsd_th_cnt);
928929

929930
set_freezable();
930931

@@ -940,7 +941,7 @@ nfsd(void *vrqstp)
940941
nfsd_file_net_dispose(nn);
941942
}
942943

943-
atomic_dec(&nfsdstats.th_cnt);
944+
atomic_dec(&nfsd_th_cnt);
944945

945946
out:
946947
/* Release the thread */

fs/nfsd/stats.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
#include "nfsd.h"
2929

30-
struct nfsd_stats nfsdstats;
3130
struct svc_stat nfsd_svcstats = {
3231
.program = &nfsd_program,
3332
};
@@ -47,7 +46,7 @@ static int nfsd_show(struct seq_file *seq, void *v)
4746
percpu_counter_sum_positive(&nn->counter[NFSD_STATS_IO_WRITE]));
4847

4948
/* thread usage: */
50-
seq_printf(seq, "th %u 0", atomic_read(&nfsdstats.th_cnt));
49+
seq_printf(seq, "th %u 0", atomic_read(&nfsd_th_cnt));
5150

5251
/* deprecated thread usage histogram stats */
5352
for (i = 0; i < 10; i++)

fs/nfsd/stats.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
#include <uapi/linux/nfsd/stats.h>
1111
#include <linux/percpu_counter.h>
1212

13-
struct nfsd_stats {
14-
atomic_t th_cnt; /* number of available threads */
15-
};
16-
17-
extern struct nfsd_stats nfsdstats;
18-
1913
extern struct svc_stat nfsd_svcstats;
2014

2115
int nfsd_percpu_counters_init(struct percpu_counter *counters, int num);

0 commit comments

Comments
 (0)