Blame view

fs/nfs/iostat.h 1.63 KB
d9ef5a8c2   Chuck Lever   NFS: introduce me...
1
2
3
4
5
6
7
  /*
   *  linux/fs/nfs/iostat.h
   *
   *  Declarations for NFS client per-mount statistics
   *
   *  Copyright (C) 2005, 2006 Chuck Lever <cel@netapp.com>
   *
d9ef5a8c2   Chuck Lever   NFS: introduce me...
8
9
10
11
   */
  
  #ifndef _NFS_IOSTAT
  #define _NFS_IOSTAT
d9ef5a8c2   Chuck Lever   NFS: introduce me...
12
13
  #include <linux/percpu.h>
  #include <linux/cache.h>
34e8f9283   Chuck Lever   NFS: Move fs/nfs/...
14
  #include <linux/nfs_iostat.h>
d9ef5a8c2   Chuck Lever   NFS: introduce me...
15
16
17
  
  struct nfs_iostats {
  	unsigned long long	bytes[__NFSIOS_BYTESMAX];
6a51091d0   David Howells   NFS: Add some new...
18
19
20
  #ifdef CONFIG_NFS_FSCACHE
  	unsigned long long	fscache[__NFSIOS_FSCACHEMAX];
  #endif
d9ef5a8c2   Chuck Lever   NFS: introduce me...
21
22
  	unsigned long		events[__NFSIOS_COUNTSMAX];
  } ____cacheline_aligned;
2e96d2867   Trond Myklebust   NFS: Fix a warnin...
23
  static inline void nfs_inc_server_stats(const struct nfs_server *server,
34e8f9283   Chuck Lever   NFS: Move fs/nfs/...
24
  					enum nfs_stat_eventcounters stat)
d9ef5a8c2   Chuck Lever   NFS: introduce me...
25
  {
fce22848a   Christoph Lameter   this_cpu: Use thi...
26
  	this_cpu_inc(server->io_stats->events[stat]);
d9ef5a8c2   Chuck Lever   NFS: introduce me...
27
  }
2e96d2867   Trond Myklebust   NFS: Fix a warnin...
28
  static inline void nfs_inc_stats(const struct inode *inode,
34e8f9283   Chuck Lever   NFS: Move fs/nfs/...
29
  				 enum nfs_stat_eventcounters stat)
006ea73e5   Chuck Lever   NFS: add hooks to...
30
31
32
  {
  	nfs_inc_server_stats(NFS_SERVER(inode), stat);
  }
2e96d2867   Trond Myklebust   NFS: Fix a warnin...
33
  static inline void nfs_add_server_stats(const struct nfs_server *server,
34e8f9283   Chuck Lever   NFS: Move fs/nfs/...
34
  					enum nfs_stat_bytecounters stat,
dfe52c041   Chuck Lever   NFS: Squelch comp...
35
  					long addend)
d9ef5a8c2   Chuck Lever   NFS: introduce me...
36
  {
fce22848a   Christoph Lameter   this_cpu: Use thi...
37
  	this_cpu_add(server->io_stats->bytes[stat], addend);
d9ef5a8c2   Chuck Lever   NFS: introduce me...
38
  }
2e96d2867   Trond Myklebust   NFS: Fix a warnin...
39
  static inline void nfs_add_stats(const struct inode *inode,
34e8f9283   Chuck Lever   NFS: Move fs/nfs/...
40
  				 enum nfs_stat_bytecounters stat,
dfe52c041   Chuck Lever   NFS: Squelch comp...
41
  				 long addend)
006ea73e5   Chuck Lever   NFS: add hooks to...
42
43
44
  {
  	nfs_add_server_stats(NFS_SERVER(inode), stat, addend);
  }
6a51091d0   David Howells   NFS: Add some new...
45
46
47
  #ifdef CONFIG_NFS_FSCACHE
  static inline void nfs_add_fscache_stats(struct inode *inode,
  					 enum nfs_stat_fscachecounters stat,
dfe52c041   Chuck Lever   NFS: Squelch comp...
48
  					 long addend)
6a51091d0   David Howells   NFS: Add some new...
49
  {
fce22848a   Christoph Lameter   this_cpu: Use thi...
50
  	this_cpu_add(NFS_SERVER(inode)->io_stats->fscache[stat], addend);
6a51091d0   David Howells   NFS: Add some new...
51
52
  }
  #endif
003cb608a   Tejun Heo   percpu: add __per...
53
  static inline struct nfs_iostats __percpu *nfs_alloc_iostats(void)
d9ef5a8c2   Chuck Lever   NFS: introduce me...
54
55
56
  {
  	return alloc_percpu(struct nfs_iostats);
  }
003cb608a   Tejun Heo   percpu: add __per...
57
  static inline void nfs_free_iostats(struct nfs_iostats __percpu *stats)
d9ef5a8c2   Chuck Lever   NFS: introduce me...
58
  {
01d0ae8be   Trond Myklebust   NFSv4: Fix an oop...
59
60
  	if (stats != NULL)
  		free_percpu(stats);
d9ef5a8c2   Chuck Lever   NFS: introduce me...
61
  }
34e8f9283   Chuck Lever   NFS: Move fs/nfs/...
62
  #endif /* _NFS_IOSTAT */