]> Git Repo - linux.git/blob - fs/nfsd/stats.h
bnxt: fix crashes when reducing ring count with active RSS contexts
[linux.git] / fs / nfsd / stats.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Statistics for NFS server.
4  *
5  * Copyright (C) 1995, 1996 Olaf Kirch <[email protected]>
6  */
7 #ifndef _NFSD_STATS_H
8 #define _NFSD_STATS_H
9
10 #include <uapi/linux/nfsd/stats.h>
11 #include <linux/percpu_counter.h>
12
13 void nfsd_proc_stat_init(struct net *net);
14 void nfsd_proc_stat_shutdown(struct net *net);
15
16 static inline void nfsd_stats_rc_hits_inc(struct nfsd_net *nn)
17 {
18         percpu_counter_inc(&nn->counter[NFSD_STATS_RC_HITS]);
19 }
20
21 static inline void nfsd_stats_rc_misses_inc(struct nfsd_net *nn)
22 {
23         percpu_counter_inc(&nn->counter[NFSD_STATS_RC_MISSES]);
24 }
25
26 static inline void nfsd_stats_rc_nocache_inc(struct nfsd_net *nn)
27 {
28         percpu_counter_inc(&nn->counter[NFSD_STATS_RC_NOCACHE]);
29 }
30
31 static inline void nfsd_stats_fh_stale_inc(struct nfsd_net *nn,
32                                            struct svc_export *exp)
33 {
34         percpu_counter_inc(&nn->counter[NFSD_STATS_FH_STALE]);
35         if (exp && exp->ex_stats)
36                 percpu_counter_inc(&exp->ex_stats->counter[EXP_STATS_FH_STALE]);
37 }
38
39 static inline void nfsd_stats_io_read_add(struct nfsd_net *nn,
40                                           struct svc_export *exp, s64 amount)
41 {
42         percpu_counter_add(&nn->counter[NFSD_STATS_IO_READ], amount);
43         if (exp && exp->ex_stats)
44                 percpu_counter_add(&exp->ex_stats->counter[EXP_STATS_IO_READ], amount);
45 }
46
47 static inline void nfsd_stats_io_write_add(struct nfsd_net *nn,
48                                            struct svc_export *exp, s64 amount)
49 {
50         percpu_counter_add(&nn->counter[NFSD_STATS_IO_WRITE], amount);
51         if (exp && exp->ex_stats)
52                 percpu_counter_add(&exp->ex_stats->counter[EXP_STATS_IO_WRITE], amount);
53 }
54
55 static inline void nfsd_stats_payload_misses_inc(struct nfsd_net *nn)
56 {
57         percpu_counter_inc(&nn->counter[NFSD_STATS_PAYLOAD_MISSES]);
58 }
59
60 static inline void nfsd_stats_drc_mem_usage_add(struct nfsd_net *nn, s64 amount)
61 {
62         percpu_counter_add(&nn->counter[NFSD_STATS_DRC_MEM_USAGE], amount);
63 }
64
65 static inline void nfsd_stats_drc_mem_usage_sub(struct nfsd_net *nn, s64 amount)
66 {
67         percpu_counter_sub(&nn->counter[NFSD_STATS_DRC_MEM_USAGE], amount);
68 }
69
70 #ifdef CONFIG_NFSD_V4
71 static inline void nfsd_stats_wdeleg_getattr_inc(struct nfsd_net *nn)
72 {
73         percpu_counter_inc(&nn->counter[NFSD_STATS_WDELEG_GETATTR]);
74 }
75 #endif
76 #endif /* _NFSD_STATS_H */
This page took 0.035191 seconds and 4 git commands to generate.