]> bbs.cooldavid.org Git - net-next-2.6.git/blame - fs/nfs/iostat.h
a couple of open-coded ihold() introduced by nfs merge
[net-next-2.6.git] / fs / nfs / iostat.h
CommitLineData
d9ef5a8c
CL
1/*
2 * linux/fs/nfs/iostat.h
3 *
4 * Declarations for NFS client per-mount statistics
5 *
6 * Copyright (C) 2005, 2006 Chuck Lever <cel@netapp.com>
7 *
d9ef5a8c
CL
8 */
9
10#ifndef _NFS_IOSTAT
11#define _NFS_IOSTAT
12
d9ef5a8c
CL
13#include <linux/percpu.h>
14#include <linux/cache.h>
34e8f928 15#include <linux/nfs_iostat.h>
d9ef5a8c
CL
16
17struct nfs_iostats {
18 unsigned long long bytes[__NFSIOS_BYTESMAX];
6a51091d
DH
19#ifdef CONFIG_NFS_FSCACHE
20 unsigned long long fscache[__NFSIOS_FSCACHEMAX];
21#endif
d9ef5a8c
CL
22 unsigned long events[__NFSIOS_COUNTSMAX];
23} ____cacheline_aligned;
24
2e96d286 25static inline void nfs_inc_server_stats(const struct nfs_server *server,
34e8f928 26 enum nfs_stat_eventcounters stat)
d9ef5a8c 27{
fce22848 28 this_cpu_inc(server->io_stats->events[stat]);
d9ef5a8c
CL
29}
30
2e96d286 31static inline void nfs_inc_stats(const struct inode *inode,
34e8f928 32 enum nfs_stat_eventcounters stat)
006ea73e
CL
33{
34 nfs_inc_server_stats(NFS_SERVER(inode), stat);
35}
36
2e96d286 37static inline void nfs_add_server_stats(const struct nfs_server *server,
34e8f928 38 enum nfs_stat_bytecounters stat,
dfe52c04 39 long addend)
d9ef5a8c 40{
fce22848 41 this_cpu_add(server->io_stats->bytes[stat], addend);
d9ef5a8c
CL
42}
43
2e96d286 44static inline void nfs_add_stats(const struct inode *inode,
34e8f928 45 enum nfs_stat_bytecounters stat,
dfe52c04 46 long addend)
006ea73e
CL
47{
48 nfs_add_server_stats(NFS_SERVER(inode), stat, addend);
49}
50
6a51091d
DH
51#ifdef CONFIG_NFS_FSCACHE
52static inline void nfs_add_fscache_stats(struct inode *inode,
53 enum nfs_stat_fscachecounters stat,
dfe52c04 54 long addend)
6a51091d 55{
fce22848 56 this_cpu_add(NFS_SERVER(inode)->io_stats->fscache[stat], addend);
6a51091d
DH
57}
58#endif
59
003cb608 60static inline struct nfs_iostats __percpu *nfs_alloc_iostats(void)
d9ef5a8c
CL
61{
62 return alloc_percpu(struct nfs_iostats);
63}
64
003cb608 65static inline void nfs_free_iostats(struct nfs_iostats __percpu *stats)
d9ef5a8c 66{
01d0ae8b
TM
67 if (stats != NULL)
68 free_percpu(stats);
d9ef5a8c
CL
69}
70
34e8f928 71#endif /* _NFS_IOSTAT */