Merge tag 'x86-urgent-2025-01-28' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / fs / nfsd / stats.h
blob04aacb6c36e2576ba231ee481e3a3e9e9f255a61
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Statistics for NFS server.
5 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
6 */
7 #ifndef _NFSD_STATS_H
8 #define _NFSD_STATS_H
10 #include <uapi/linux/nfsd/stats.h>
11 #include <linux/percpu_counter.h>
13 void nfsd_proc_stat_init(struct net *net);
14 void nfsd_proc_stat_shutdown(struct net *net);
16 static inline void nfsd_stats_rc_hits_inc(struct nfsd_net *nn)
18 percpu_counter_inc(&nn->counter[NFSD_STATS_RC_HITS]);
21 static inline void nfsd_stats_rc_misses_inc(struct nfsd_net *nn)
23 percpu_counter_inc(&nn->counter[NFSD_STATS_RC_MISSES]);
26 static inline void nfsd_stats_rc_nocache_inc(struct nfsd_net *nn)
28 percpu_counter_inc(&nn->counter[NFSD_STATS_RC_NOCACHE]);
31 static inline void nfsd_stats_fh_stale_inc(struct nfsd_net *nn,
32 struct svc_export *exp)
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]);
39 static inline void nfsd_stats_io_read_add(struct nfsd_net *nn,
40 struct svc_export *exp, s64 amount)
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);
47 static inline void nfsd_stats_io_write_add(struct nfsd_net *nn,
48 struct svc_export *exp, s64 amount)
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);
55 static inline void nfsd_stats_payload_misses_inc(struct nfsd_net *nn)
57 percpu_counter_inc(&nn->counter[NFSD_STATS_PAYLOAD_MISSES]);
60 static inline void nfsd_stats_drc_mem_usage_add(struct nfsd_net *nn, s64 amount)
62 percpu_counter_add(&nn->counter[NFSD_STATS_DRC_MEM_USAGE], amount);
65 static inline void nfsd_stats_drc_mem_usage_sub(struct nfsd_net *nn, s64 amount)
67 percpu_counter_sub(&nn->counter[NFSD_STATS_DRC_MEM_USAGE], amount);
70 #ifdef CONFIG_NFSD_V4
71 static inline void nfsd_stats_wdeleg_getattr_inc(struct nfsd_net *nn)
73 percpu_counter_inc(&nn->counter[NFSD_STATS_WDELEG_GETATTR]);
75 #endif
76 #endif /* _NFSD_STATS_H */