aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/iostat.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/iostat.h')
-rw-r--r--fs/nfs/iostat.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/fs/nfs/iostat.h b/fs/nfs/iostat.h
index dc080e50ec57..7a7495153317 100644
--- a/fs/nfs/iostat.h
+++ b/fs/nfs/iostat.h
@@ -103,6 +103,7 @@ enum nfs_stat_eventcounters {
103 NFSIOS_SILLYRENAME, 103 NFSIOS_SILLYRENAME,
104 NFSIOS_SHORTREAD, 104 NFSIOS_SHORTREAD,
105 NFSIOS_SHORTWRITE, 105 NFSIOS_SHORTWRITE,
106 NFSIOS_DELAY,
106 __NFSIOS_COUNTSMAX, 107 __NFSIOS_COUNTSMAX,
107}; 108};
108 109
@@ -116,28 +117,38 @@ struct nfs_iostats {
116 unsigned long events[__NFSIOS_COUNTSMAX]; 117 unsigned long events[__NFSIOS_COUNTSMAX];
117} ____cacheline_aligned; 118} ____cacheline_aligned;
118 119
119static inline void nfs_inc_stats(struct inode *inode, enum nfs_stat_eventcounters stat) 120static inline void nfs_inc_server_stats(struct nfs_server *server, enum nfs_stat_eventcounters stat)
120{ 121{
121 struct nfs_iostats *iostats; 122 struct nfs_iostats *iostats;
122 int cpu; 123 int cpu;
123 124
124 cpu = get_cpu(); 125 cpu = get_cpu();
125 iostats = per_cpu_ptr(NFS_SERVER(inode)->io_stats, cpu); 126 iostats = per_cpu_ptr(server->io_stats, cpu);
126 iostats->events[stat] ++; 127 iostats->events[stat] ++;
127 put_cpu_no_resched(); 128 put_cpu_no_resched();
128} 129}
129 130
130static inline void nfs_add_stats(struct inode *inode, enum nfs_stat_bytecounters stat, unsigned long addend) 131static inline void nfs_inc_stats(struct inode *inode, enum nfs_stat_eventcounters stat)
132{
133 nfs_inc_server_stats(NFS_SERVER(inode), stat);
134}
135
136static inline void nfs_add_server_stats(struct nfs_server *server, enum nfs_stat_bytecounters stat, unsigned long addend)
131{ 137{
132 struct nfs_iostats *iostats; 138 struct nfs_iostats *iostats;
133 int cpu; 139 int cpu;
134 140
135 cpu = get_cpu(); 141 cpu = get_cpu();
136 iostats = per_cpu_ptr(NFS_SERVER(inode)->io_stats, cpu); 142 iostats = per_cpu_ptr(server->io_stats, cpu);
137 iostats->bytes[stat] += addend; 143 iostats->bytes[stat] += addend;
138 put_cpu_no_resched(); 144 put_cpu_no_resched();
139} 145}
140 146
147static inline void nfs_add_stats(struct inode *inode, enum nfs_stat_bytecounters stat, unsigned long addend)
148{
149 nfs_add_server_stats(NFS_SERVER(inode), stat, addend);
150}
151
141static inline struct nfs_iostats *nfs_alloc_iostats(void) 152static inline struct nfs_iostats *nfs_alloc_iostats(void)
142{ 153{
143 return alloc_percpu(struct nfs_iostats); 154 return alloc_percpu(struct nfs_iostats);