xfs: pass xfsstats structures to handlers and macros
[deliverable/linux.git] / fs / xfs / xfs_stats.h
1 /*
2 * Copyright (c) 2000,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 #ifndef __XFS_STATS_H__
19 #define __XFS_STATS_H__
20
21 #if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
22
23 #include <linux/percpu.h>
24
25 /*
26 * XFS global statistics
27 */
28 struct xfsstats {
29 # define XFSSTAT_END_EXTENT_ALLOC 4
30 __uint32_t xs_allocx;
31 __uint32_t xs_allocb;
32 __uint32_t xs_freex;
33 __uint32_t xs_freeb;
34 # define XFSSTAT_END_ALLOC_BTREE (XFSSTAT_END_EXTENT_ALLOC+4)
35 __uint32_t xs_abt_lookup;
36 __uint32_t xs_abt_compare;
37 __uint32_t xs_abt_insrec;
38 __uint32_t xs_abt_delrec;
39 # define XFSSTAT_END_BLOCK_MAPPING (XFSSTAT_END_ALLOC_BTREE+7)
40 __uint32_t xs_blk_mapr;
41 __uint32_t xs_blk_mapw;
42 __uint32_t xs_blk_unmap;
43 __uint32_t xs_add_exlist;
44 __uint32_t xs_del_exlist;
45 __uint32_t xs_look_exlist;
46 __uint32_t xs_cmp_exlist;
47 # define XFSSTAT_END_BLOCK_MAP_BTREE (XFSSTAT_END_BLOCK_MAPPING+4)
48 __uint32_t xs_bmbt_lookup;
49 __uint32_t xs_bmbt_compare;
50 __uint32_t xs_bmbt_insrec;
51 __uint32_t xs_bmbt_delrec;
52 # define XFSSTAT_END_DIRECTORY_OPS (XFSSTAT_END_BLOCK_MAP_BTREE+4)
53 __uint32_t xs_dir_lookup;
54 __uint32_t xs_dir_create;
55 __uint32_t xs_dir_remove;
56 __uint32_t xs_dir_getdents;
57 # define XFSSTAT_END_TRANSACTIONS (XFSSTAT_END_DIRECTORY_OPS+3)
58 __uint32_t xs_trans_sync;
59 __uint32_t xs_trans_async;
60 __uint32_t xs_trans_empty;
61 # define XFSSTAT_END_INODE_OPS (XFSSTAT_END_TRANSACTIONS+7)
62 __uint32_t xs_ig_attempts;
63 __uint32_t xs_ig_found;
64 __uint32_t xs_ig_frecycle;
65 __uint32_t xs_ig_missed;
66 __uint32_t xs_ig_dup;
67 __uint32_t xs_ig_reclaims;
68 __uint32_t xs_ig_attrchg;
69 # define XFSSTAT_END_LOG_OPS (XFSSTAT_END_INODE_OPS+5)
70 __uint32_t xs_log_writes;
71 __uint32_t xs_log_blocks;
72 __uint32_t xs_log_noiclogs;
73 __uint32_t xs_log_force;
74 __uint32_t xs_log_force_sleep;
75 # define XFSSTAT_END_TAIL_PUSHING (XFSSTAT_END_LOG_OPS+10)
76 __uint32_t xs_try_logspace;
77 __uint32_t xs_sleep_logspace;
78 __uint32_t xs_push_ail;
79 __uint32_t xs_push_ail_success;
80 __uint32_t xs_push_ail_pushbuf;
81 __uint32_t xs_push_ail_pinned;
82 __uint32_t xs_push_ail_locked;
83 __uint32_t xs_push_ail_flushing;
84 __uint32_t xs_push_ail_restarts;
85 __uint32_t xs_push_ail_flush;
86 # define XFSSTAT_END_WRITE_CONVERT (XFSSTAT_END_TAIL_PUSHING+2)
87 __uint32_t xs_xstrat_quick;
88 __uint32_t xs_xstrat_split;
89 # define XFSSTAT_END_READ_WRITE_OPS (XFSSTAT_END_WRITE_CONVERT+2)
90 __uint32_t xs_write_calls;
91 __uint32_t xs_read_calls;
92 # define XFSSTAT_END_ATTRIBUTE_OPS (XFSSTAT_END_READ_WRITE_OPS+4)
93 __uint32_t xs_attr_get;
94 __uint32_t xs_attr_set;
95 __uint32_t xs_attr_remove;
96 __uint32_t xs_attr_list;
97 # define XFSSTAT_END_INODE_CLUSTER (XFSSTAT_END_ATTRIBUTE_OPS+3)
98 __uint32_t xs_iflush_count;
99 __uint32_t xs_icluster_flushcnt;
100 __uint32_t xs_icluster_flushinode;
101 # define XFSSTAT_END_VNODE_OPS (XFSSTAT_END_INODE_CLUSTER+8)
102 __uint32_t vn_active; /* # vnodes not on free lists */
103 __uint32_t vn_alloc; /* # times vn_alloc called */
104 __uint32_t vn_get; /* # times vn_get called */
105 __uint32_t vn_hold; /* # times vn_hold called */
106 __uint32_t vn_rele; /* # times vn_rele called */
107 __uint32_t vn_reclaim; /* # times vn_reclaim called */
108 __uint32_t vn_remove; /* # times vn_remove called */
109 __uint32_t vn_free; /* # times vn_free called */
110 #define XFSSTAT_END_BUF (XFSSTAT_END_VNODE_OPS+9)
111 __uint32_t xb_get;
112 __uint32_t xb_create;
113 __uint32_t xb_get_locked;
114 __uint32_t xb_get_locked_waited;
115 __uint32_t xb_busy_locked;
116 __uint32_t xb_miss_locked;
117 __uint32_t xb_page_retries;
118 __uint32_t xb_page_found;
119 __uint32_t xb_get_read;
120 /* Version 2 btree counters */
121 #define XFSSTAT_END_ABTB_V2 (XFSSTAT_END_BUF+15)
122 __uint32_t xs_abtb_2_lookup;
123 __uint32_t xs_abtb_2_compare;
124 __uint32_t xs_abtb_2_insrec;
125 __uint32_t xs_abtb_2_delrec;
126 __uint32_t xs_abtb_2_newroot;
127 __uint32_t xs_abtb_2_killroot;
128 __uint32_t xs_abtb_2_increment;
129 __uint32_t xs_abtb_2_decrement;
130 __uint32_t xs_abtb_2_lshift;
131 __uint32_t xs_abtb_2_rshift;
132 __uint32_t xs_abtb_2_split;
133 __uint32_t xs_abtb_2_join;
134 __uint32_t xs_abtb_2_alloc;
135 __uint32_t xs_abtb_2_free;
136 __uint32_t xs_abtb_2_moves;
137 #define XFSSTAT_END_ABTC_V2 (XFSSTAT_END_ABTB_V2+15)
138 __uint32_t xs_abtc_2_lookup;
139 __uint32_t xs_abtc_2_compare;
140 __uint32_t xs_abtc_2_insrec;
141 __uint32_t xs_abtc_2_delrec;
142 __uint32_t xs_abtc_2_newroot;
143 __uint32_t xs_abtc_2_killroot;
144 __uint32_t xs_abtc_2_increment;
145 __uint32_t xs_abtc_2_decrement;
146 __uint32_t xs_abtc_2_lshift;
147 __uint32_t xs_abtc_2_rshift;
148 __uint32_t xs_abtc_2_split;
149 __uint32_t xs_abtc_2_join;
150 __uint32_t xs_abtc_2_alloc;
151 __uint32_t xs_abtc_2_free;
152 __uint32_t xs_abtc_2_moves;
153 #define XFSSTAT_END_BMBT_V2 (XFSSTAT_END_ABTC_V2+15)
154 __uint32_t xs_bmbt_2_lookup;
155 __uint32_t xs_bmbt_2_compare;
156 __uint32_t xs_bmbt_2_insrec;
157 __uint32_t xs_bmbt_2_delrec;
158 __uint32_t xs_bmbt_2_newroot;
159 __uint32_t xs_bmbt_2_killroot;
160 __uint32_t xs_bmbt_2_increment;
161 __uint32_t xs_bmbt_2_decrement;
162 __uint32_t xs_bmbt_2_lshift;
163 __uint32_t xs_bmbt_2_rshift;
164 __uint32_t xs_bmbt_2_split;
165 __uint32_t xs_bmbt_2_join;
166 __uint32_t xs_bmbt_2_alloc;
167 __uint32_t xs_bmbt_2_free;
168 __uint32_t xs_bmbt_2_moves;
169 #define XFSSTAT_END_IBT_V2 (XFSSTAT_END_BMBT_V2+15)
170 __uint32_t xs_ibt_2_lookup;
171 __uint32_t xs_ibt_2_compare;
172 __uint32_t xs_ibt_2_insrec;
173 __uint32_t xs_ibt_2_delrec;
174 __uint32_t xs_ibt_2_newroot;
175 __uint32_t xs_ibt_2_killroot;
176 __uint32_t xs_ibt_2_increment;
177 __uint32_t xs_ibt_2_decrement;
178 __uint32_t xs_ibt_2_lshift;
179 __uint32_t xs_ibt_2_rshift;
180 __uint32_t xs_ibt_2_split;
181 __uint32_t xs_ibt_2_join;
182 __uint32_t xs_ibt_2_alloc;
183 __uint32_t xs_ibt_2_free;
184 __uint32_t xs_ibt_2_moves;
185 #define XFSSTAT_END_FIBT_V2 (XFSSTAT_END_IBT_V2+15)
186 __uint32_t xs_fibt_2_lookup;
187 __uint32_t xs_fibt_2_compare;
188 __uint32_t xs_fibt_2_insrec;
189 __uint32_t xs_fibt_2_delrec;
190 __uint32_t xs_fibt_2_newroot;
191 __uint32_t xs_fibt_2_killroot;
192 __uint32_t xs_fibt_2_increment;
193 __uint32_t xs_fibt_2_decrement;
194 __uint32_t xs_fibt_2_lshift;
195 __uint32_t xs_fibt_2_rshift;
196 __uint32_t xs_fibt_2_split;
197 __uint32_t xs_fibt_2_join;
198 __uint32_t xs_fibt_2_alloc;
199 __uint32_t xs_fibt_2_free;
200 __uint32_t xs_fibt_2_moves;
201 #define XFSSTAT_END_XQMSTAT (XFSSTAT_END_FIBT_V2+6)
202 __uint32_t xs_qm_dqreclaims;
203 __uint32_t xs_qm_dqreclaim_misses;
204 __uint32_t xs_qm_dquot_dups;
205 __uint32_t xs_qm_dqcachemisses;
206 __uint32_t xs_qm_dqcachehits;
207 __uint32_t xs_qm_dqwants;
208 #define XFSSTAT_END_QM (XFSSTAT_END_XQMSTAT+2)
209 __uint32_t xs_qm_dquot;
210 __uint32_t xs_qm_dquot_unused;
211 /* Extra precision counters */
212 __uint64_t xs_xstrat_bytes;
213 __uint64_t xs_write_bytes;
214 __uint64_t xs_read_bytes;
215 };
216
217 int xfs_stats_format(struct xfsstats __percpu *stats, char *buf);
218 void xfs_stats_clearall(struct xfsstats __percpu *stats);
219 extern struct xstats xfsstats;
220
221 #define XFS_STATS_INC(v) \
222 (per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v++)
223
224 #define XFS_STATS_DEC(v) \
225 (per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v--)
226
227 #define XFS_STATS_ADD(v, inc) \
228 (per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v += (inc))
229
230 extern int xfs_init_procfs(void);
231 extern void xfs_cleanup_procfs(void);
232
233
234 #else /* !CONFIG_PROC_FS */
235
236 # define XFS_STATS_INC(count)
237 # define XFS_STATS_DEC(count)
238 # define XFS_STATS_ADD(count, inc)
239
240 static inline int xfs_init_procfs(void)
241 {
242 return 0;
243 }
244
245 static inline void xfs_cleanup_procfs(void)
246 {
247 }
248
249 #endif /* !CONFIG_PROC_FS */
250
251 #endif /* __XFS_STATS_H__ */
This page took 0.0354910000000001 seconds and 6 git commands to generate.