[ARM] eliminate NULL test and memset after alloc_bootmem
[linux-2.6/mini2440.git] / fs / nfs / iostat.h
bloba36952810032f8c492acb4e1f4f96c7494250b3f
1 /*
2 * linux/fs/nfs/iostat.h
4 * Declarations for NFS client per-mount statistics
6 * Copyright (C) 2005, 2006 Chuck Lever <cel@netapp.com>
8 */
10 #ifndef _NFS_IOSTAT
11 #define _NFS_IOSTAT
13 #include <linux/percpu.h>
14 #include <linux/cache.h>
15 #include <linux/nfs_iostat.h>
17 struct nfs_iostats {
18 unsigned long long bytes[__NFSIOS_BYTESMAX];
19 unsigned long events[__NFSIOS_COUNTSMAX];
20 } ____cacheline_aligned;
22 static inline void nfs_inc_server_stats(const struct nfs_server *server,
23 enum nfs_stat_eventcounters stat)
25 struct nfs_iostats *iostats;
26 int cpu;
28 cpu = get_cpu();
29 iostats = per_cpu_ptr(server->io_stats, cpu);
30 iostats->events[stat]++;
31 put_cpu_no_resched();
34 static inline void nfs_inc_stats(const struct inode *inode,
35 enum nfs_stat_eventcounters stat)
37 nfs_inc_server_stats(NFS_SERVER(inode), stat);
40 static inline void nfs_add_server_stats(const struct nfs_server *server,
41 enum nfs_stat_bytecounters stat,
42 unsigned long addend)
44 struct nfs_iostats *iostats;
45 int cpu;
47 cpu = get_cpu();
48 iostats = per_cpu_ptr(server->io_stats, cpu);
49 iostats->bytes[stat] += addend;
50 put_cpu_no_resched();
53 static inline void nfs_add_stats(const struct inode *inode,
54 enum nfs_stat_bytecounters stat,
55 unsigned long addend)
57 nfs_add_server_stats(NFS_SERVER(inode), stat, addend);
60 static inline struct nfs_iostats *nfs_alloc_iostats(void)
62 return alloc_percpu(struct nfs_iostats);
65 static inline void nfs_free_iostats(struct nfs_iostats *stats)
67 if (stats != NULL)
68 free_percpu(stats);
71 #endif /* _NFS_IOSTAT */