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