blob: 01e9e0076a92c68682fa513e1f4a862e291fb9ae [file] [log] [blame]
Theodore Ts'o9bffad12009-06-17 11:48:11 -04001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM ext4
3
Li Zefand0b6e042009-07-13 10:33:21 +08004#if !defined(_TRACE_EXT4_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_EXT4_H
6
Theodore Ts'o9bffad12009-06-17 11:48:11 -04007#include <linux/writeback.h>
Theodore Ts'o9bffad12009-06-17 11:48:11 -04008#include <linux/tracepoint.h>
9
Theodore Ts'o3661d282009-09-14 22:59:50 -040010struct ext4_allocation_context;
11struct ext4_allocation_request;
12struct ext4_prealloc_space;
Theodore Ts'ofb40ba02009-09-16 19:30:40 -040013struct ext4_inode_info;
Josh Stone0ef12242009-09-30 00:51:22 -040014struct mpage_da_data;
Theodore Ts'ofb40ba02009-09-16 19:30:40 -040015
16#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode))
Theodore Ts'o3661d282009-09-14 22:59:50 -040017
Theodore Ts'o9bffad12009-06-17 11:48:11 -040018TRACE_EVENT(ext4_free_inode,
19 TP_PROTO(struct inode *inode),
20
21 TP_ARGS(inode),
22
23 TP_STRUCT__entry(
24 __field( dev_t, dev )
25 __field( ino_t, ino )
26 __field( umode_t, mode )
27 __field( uid_t, uid )
28 __field( gid_t, gid )
29 __field( blkcnt_t, blocks )
30 ),
31
32 TP_fast_assign(
33 __entry->dev = inode->i_sb->s_dev;
34 __entry->ino = inode->i_ino;
35 __entry->mode = inode->i_mode;
36 __entry->uid = inode->i_uid;
37 __entry->gid = inode->i_gid;
38 __entry->blocks = inode->i_blocks;
39 ),
40
Theodore Ts'o6eebee62009-11-22 20:23:31 -050041 TP_printk("dev %s ino %lu mode 0%o uid %u gid %u blocks %llu",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -040042 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
43 __entry->mode, __entry->uid, __entry->gid,
Theodore Ts'o627ad9f2009-06-20 23:21:41 -040044 (unsigned long long) __entry->blocks)
Theodore Ts'o9bffad12009-06-17 11:48:11 -040045);
46
47TRACE_EVENT(ext4_request_inode,
48 TP_PROTO(struct inode *dir, int mode),
49
50 TP_ARGS(dir, mode),
51
52 TP_STRUCT__entry(
53 __field( dev_t, dev )
54 __field( ino_t, dir )
55 __field( umode_t, mode )
56 ),
57
58 TP_fast_assign(
59 __entry->dev = dir->i_sb->s_dev;
60 __entry->dir = dir->i_ino;
61 __entry->mode = mode;
62 ),
63
Theodore Ts'o6eebee62009-11-22 20:23:31 -050064 TP_printk("dev %s dir %lu mode 0%o",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -040065 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->dir,
66 __entry->mode)
Theodore Ts'o9bffad12009-06-17 11:48:11 -040067);
68
69TRACE_EVENT(ext4_allocate_inode,
70 TP_PROTO(struct inode *inode, struct inode *dir, int mode),
71
72 TP_ARGS(inode, dir, mode),
73
74 TP_STRUCT__entry(
75 __field( dev_t, dev )
76 __field( ino_t, ino )
77 __field( ino_t, dir )
78 __field( umode_t, mode )
79 ),
80
81 TP_fast_assign(
82 __entry->dev = inode->i_sb->s_dev;
83 __entry->ino = inode->i_ino;
84 __entry->dir = dir->i_ino;
85 __entry->mode = mode;
86 ),
87
Theodore Ts'o6eebee62009-11-22 20:23:31 -050088 TP_printk("dev %s ino %lu dir %lu mode 0%o",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -040089 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
90 (unsigned long) __entry->dir, __entry->mode)
Theodore Ts'o9bffad12009-06-17 11:48:11 -040091);
92
Li Zefanb5eb34c2009-11-26 15:07:36 +080093DECLARE_EVENT_CLASS(ext4__write_begin,
Theodore Ts'o9bffad12009-06-17 11:48:11 -040094
95 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
96 unsigned int flags),
97
98 TP_ARGS(inode, pos, len, flags),
99
100 TP_STRUCT__entry(
101 __field( dev_t, dev )
102 __field( ino_t, ino )
103 __field( loff_t, pos )
104 __field( unsigned int, len )
105 __field( unsigned int, flags )
106 ),
107
108 TP_fast_assign(
109 __entry->dev = inode->i_sb->s_dev;
110 __entry->ino = inode->i_ino;
111 __entry->pos = pos;
112 __entry->len = len;
113 __entry->flags = flags;
114 ),
115
116 TP_printk("dev %s ino %lu pos %llu len %u flags %u",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400117 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
118 __entry->pos, __entry->len, __entry->flags)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400119);
120
Li Zefanb5eb34c2009-11-26 15:07:36 +0800121DEFINE_EVENT(ext4__write_begin, ext4_write_begin,
122
123 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
124 unsigned int flags),
125
126 TP_ARGS(inode, pos, len, flags)
127);
128
129DEFINE_EVENT(ext4__write_begin, ext4_da_write_begin,
130
131 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
132 unsigned int flags),
133
134 TP_ARGS(inode, pos, len, flags)
135);
136
137DECLARE_EVENT_CLASS(ext4__write_end,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400138 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
139 unsigned int copied),
140
141 TP_ARGS(inode, pos, len, copied),
142
143 TP_STRUCT__entry(
144 __field( dev_t, dev )
145 __field( ino_t, ino )
146 __field( loff_t, pos )
147 __field( unsigned int, len )
148 __field( unsigned int, copied )
149 ),
150
151 TP_fast_assign(
152 __entry->dev = inode->i_sb->s_dev;
153 __entry->ino = inode->i_ino;
154 __entry->pos = pos;
155 __entry->len = len;
156 __entry->copied = copied;
157 ),
158
159 TP_printk("dev %s ino %lu pos %llu len %u copied %u",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400160 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
161 __entry->pos, __entry->len, __entry->copied)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400162);
163
Li Zefanb5eb34c2009-11-26 15:07:36 +0800164DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end,
165
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400166 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
167 unsigned int copied),
168
Li Zefanb5eb34c2009-11-26 15:07:36 +0800169 TP_ARGS(inode, pos, len, copied)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400170);
171
Li Zefanb5eb34c2009-11-26 15:07:36 +0800172DEFINE_EVENT(ext4__write_end, ext4_writeback_write_end,
173
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400174 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
175 unsigned int copied),
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400176
Li Zefanb5eb34c2009-11-26 15:07:36 +0800177 TP_ARGS(inode, pos, len, copied)
178);
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400179
Li Zefanb5eb34c2009-11-26 15:07:36 +0800180DEFINE_EVENT(ext4__write_end, ext4_journalled_write_end,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400181
Li Zefanb5eb34c2009-11-26 15:07:36 +0800182 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
183 unsigned int copied),
184
185 TP_ARGS(inode, pos, len, copied)
186);
187
188DEFINE_EVENT(ext4__write_end, ext4_da_write_end,
189
190 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
191 unsigned int copied),
192
193 TP_ARGS(inode, pos, len, copied)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400194);
195
Aneesh Kumar K.V43ce1d22009-06-14 17:58:45 -0400196TRACE_EVENT(ext4_writepage,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400197 TP_PROTO(struct inode *inode, struct page *page),
198
199 TP_ARGS(inode, page),
200
201 TP_STRUCT__entry(
202 __field( dev_t, dev )
203 __field( ino_t, ino )
204 __field( pgoff_t, index )
205
206 ),
207
208 TP_fast_assign(
209 __entry->dev = inode->i_sb->s_dev;
210 __entry->ino = inode->i_ino;
211 __entry->index = page->index;
212 ),
213
214 TP_printk("dev %s ino %lu page_index %lu",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400215 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
216 __entry->index)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400217);
218
219TRACE_EVENT(ext4_da_writepages,
220 TP_PROTO(struct inode *inode, struct writeback_control *wbc),
221
222 TP_ARGS(inode, wbc),
223
224 TP_STRUCT__entry(
225 __field( dev_t, dev )
226 __field( ino_t, ino )
227 __field( long, nr_to_write )
228 __field( long, pages_skipped )
229 __field( loff_t, range_start )
230 __field( loff_t, range_end )
231 __field( char, nonblocking )
232 __field( char, for_kupdate )
233 __field( char, for_reclaim )
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400234 __field( char, range_cyclic )
Theodore Ts'o55138e02009-09-29 13:31:31 -0400235 __field( pgoff_t, writeback_index )
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400236 ),
237
238 TP_fast_assign(
239 __entry->dev = inode->i_sb->s_dev;
240 __entry->ino = inode->i_ino;
241 __entry->nr_to_write = wbc->nr_to_write;
242 __entry->pages_skipped = wbc->pages_skipped;
243 __entry->range_start = wbc->range_start;
244 __entry->range_end = wbc->range_end;
245 __entry->nonblocking = wbc->nonblocking;
246 __entry->for_kupdate = wbc->for_kupdate;
247 __entry->for_reclaim = wbc->for_reclaim;
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400248 __entry->range_cyclic = wbc->range_cyclic;
Theodore Ts'o55138e02009-09-29 13:31:31 -0400249 __entry->writeback_index = inode->i_mapping->writeback_index;
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400250 ),
251
Theodore Ts'o55138e02009-09-29 13:31:31 -0400252 TP_printk("dev %s ino %lu nr_to_write %ld pages_skipped %ld range_start %llu range_end %llu nonblocking %d for_kupdate %d for_reclaim %d range_cyclic %d writeback_index %lu",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400253 jbd2_dev_to_name(__entry->dev),
254 (unsigned long) __entry->ino, __entry->nr_to_write,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400255 __entry->pages_skipped, __entry->range_start,
256 __entry->range_end, __entry->nonblocking,
257 __entry->for_kupdate, __entry->for_reclaim,
Theodore Ts'o55138e02009-09-29 13:31:31 -0400258 __entry->range_cyclic,
259 (unsigned long) __entry->writeback_index)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400260);
261
Theodore Ts'ob3a3ca82009-08-31 23:13:11 -0400262TRACE_EVENT(ext4_da_write_pages,
263 TP_PROTO(struct inode *inode, struct mpage_da_data *mpd),
264
265 TP_ARGS(inode, mpd),
266
267 TP_STRUCT__entry(
268 __field( dev_t, dev )
269 __field( ino_t, ino )
270 __field( __u64, b_blocknr )
271 __field( __u32, b_size )
272 __field( __u32, b_state )
273 __field( unsigned long, first_page )
274 __field( int, io_done )
275 __field( int, pages_written )
276 ),
277
278 TP_fast_assign(
279 __entry->dev = inode->i_sb->s_dev;
280 __entry->ino = inode->i_ino;
281 __entry->b_blocknr = mpd->b_blocknr;
282 __entry->b_size = mpd->b_size;
283 __entry->b_state = mpd->b_state;
284 __entry->first_page = mpd->first_page;
285 __entry->io_done = mpd->io_done;
286 __entry->pages_written = mpd->pages_written;
287 ),
288
289 TP_printk("dev %s ino %lu b_blocknr %llu b_size %u b_state 0x%04x first_page %lu io_done %d pages_written %d",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400290 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
Theodore Ts'ob3a3ca82009-08-31 23:13:11 -0400291 __entry->b_blocknr, __entry->b_size,
292 __entry->b_state, __entry->first_page,
293 __entry->io_done, __entry->pages_written)
294);
295
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400296TRACE_EVENT(ext4_da_writepages_result,
297 TP_PROTO(struct inode *inode, struct writeback_control *wbc,
298 int ret, int pages_written),
299
300 TP_ARGS(inode, wbc, ret, pages_written),
301
302 TP_STRUCT__entry(
303 __field( dev_t, dev )
304 __field( ino_t, ino )
305 __field( int, ret )
306 __field( int, pages_written )
307 __field( long, pages_skipped )
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400308 __field( char, more_io )
Theodore Ts'o55138e02009-09-29 13:31:31 -0400309 __field( pgoff_t, writeback_index )
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400310 ),
311
312 TP_fast_assign(
313 __entry->dev = inode->i_sb->s_dev;
314 __entry->ino = inode->i_ino;
315 __entry->ret = ret;
316 __entry->pages_written = pages_written;
317 __entry->pages_skipped = wbc->pages_skipped;
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400318 __entry->more_io = wbc->more_io;
Theodore Ts'o55138e02009-09-29 13:31:31 -0400319 __entry->writeback_index = inode->i_mapping->writeback_index;
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400320 ),
321
Dave Chinner0b564922010-06-09 10:37:18 +1000322 TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld more_io %d writeback_index %lu",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400323 jbd2_dev_to_name(__entry->dev),
324 (unsigned long) __entry->ino, __entry->ret,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400325 __entry->pages_written, __entry->pages_skipped,
Wu Fengguangb4d72412009-11-24 11:15:08 -0500326 __entry->more_io,
Theodore Ts'o55138e02009-09-29 13:31:31 -0400327 (unsigned long) __entry->writeback_index)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400328);
329
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400330TRACE_EVENT(ext4_discard_blocks,
331 TP_PROTO(struct super_block *sb, unsigned long long blk,
332 unsigned long long count),
333
334 TP_ARGS(sb, blk, count),
335
336 TP_STRUCT__entry(
337 __field( dev_t, dev )
338 __field( __u64, blk )
339 __field( __u64, count )
340
341 ),
342
343 TP_fast_assign(
344 __entry->dev = sb->s_dev;
345 __entry->blk = blk;
346 __entry->count = count;
347 ),
348
349 TP_printk("dev %s blk %llu count %llu",
350 jbd2_dev_to_name(__entry->dev), __entry->blk, __entry->count)
351);
352
Li Zefanf084db92010-05-17 04:00:00 -0400353DECLARE_EVENT_CLASS(ext4__mb_new_pa,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400354 TP_PROTO(struct ext4_allocation_context *ac,
355 struct ext4_prealloc_space *pa),
356
357 TP_ARGS(ac, pa),
358
359 TP_STRUCT__entry(
360 __field( dev_t, dev )
361 __field( ino_t, ino )
362 __field( __u64, pa_pstart )
363 __field( __u32, pa_len )
364 __field( __u64, pa_lstart )
365
366 ),
367
368 TP_fast_assign(
369 __entry->dev = ac->ac_sb->s_dev;
370 __entry->ino = ac->ac_inode->i_ino;
371 __entry->pa_pstart = pa->pa_pstart;
372 __entry->pa_len = pa->pa_len;
373 __entry->pa_lstart = pa->pa_lstart;
374 ),
375
376 TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400377 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
378 __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400379);
380
Li Zefanf084db92010-05-17 04:00:00 -0400381DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa,
382
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400383 TP_PROTO(struct ext4_allocation_context *ac,
384 struct ext4_prealloc_space *pa),
385
Li Zefanf084db92010-05-17 04:00:00 -0400386 TP_ARGS(ac, pa)
387);
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400388
Li Zefanf084db92010-05-17 04:00:00 -0400389DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_group_pa,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400390
Li Zefanf084db92010-05-17 04:00:00 -0400391 TP_PROTO(struct ext4_allocation_context *ac,
392 struct ext4_prealloc_space *pa),
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400393
Li Zefanf084db92010-05-17 04:00:00 -0400394 TP_ARGS(ac, pa)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400395);
396
397TRACE_EVENT(ext4_mb_release_inode_pa,
Theodore Ts'oe5880d72010-07-27 11:56:04 -0400398 TP_PROTO(struct super_block *sb,
399 struct ext4_allocation_context *ac,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400400 struct ext4_prealloc_space *pa,
401 unsigned long long block, unsigned int count),
402
Theodore Ts'oe5880d72010-07-27 11:56:04 -0400403 TP_ARGS(sb, ac, pa, block, count),
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400404
405 TP_STRUCT__entry(
406 __field( dev_t, dev )
407 __field( ino_t, ino )
408 __field( __u64, block )
409 __field( __u32, count )
410
411 ),
412
413 TP_fast_assign(
Theodore Ts'oe5880d72010-07-27 11:56:04 -0400414 __entry->dev = sb->s_dev;
415 __entry->ino = (ac && ac->ac_inode) ?
416 ac->ac_inode->i_ino : 0;
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400417 __entry->block = block;
418 __entry->count = count;
419 ),
420
421 TP_printk("dev %s ino %lu block %llu count %u",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400422 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
423 __entry->block, __entry->count)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400424);
425
426TRACE_EVENT(ext4_mb_release_group_pa,
Theodore Ts'oe5880d72010-07-27 11:56:04 -0400427 TP_PROTO(struct super_block *sb,
428 struct ext4_allocation_context *ac,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400429 struct ext4_prealloc_space *pa),
430
Theodore Ts'oe5880d72010-07-27 11:56:04 -0400431 TP_ARGS(sb, ac, pa),
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400432
433 TP_STRUCT__entry(
434 __field( dev_t, dev )
435 __field( ino_t, ino )
436 __field( __u64, pa_pstart )
437 __field( __u32, pa_len )
438
439 ),
440
441 TP_fast_assign(
Theodore Ts'oe5880d72010-07-27 11:56:04 -0400442 __entry->dev = sb->s_dev;
443 __entry->ino = (ac && ac->ac_inode) ?
444 ac->ac_inode->i_ino : 0;
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400445 __entry->pa_pstart = pa->pa_pstart;
446 __entry->pa_len = pa->pa_len;
447 ),
448
449 TP_printk("dev %s pstart %llu len %u",
450 jbd2_dev_to_name(__entry->dev), __entry->pa_pstart, __entry->pa_len)
451);
452
453TRACE_EVENT(ext4_discard_preallocations,
454 TP_PROTO(struct inode *inode),
455
456 TP_ARGS(inode),
457
458 TP_STRUCT__entry(
459 __field( dev_t, dev )
460 __field( ino_t, ino )
461
462 ),
463
464 TP_fast_assign(
465 __entry->dev = inode->i_sb->s_dev;
466 __entry->ino = inode->i_ino;
467 ),
468
469 TP_printk("dev %s ino %lu",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400470 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400471);
472
473TRACE_EVENT(ext4_mb_discard_preallocations,
474 TP_PROTO(struct super_block *sb, int needed),
475
476 TP_ARGS(sb, needed),
477
478 TP_STRUCT__entry(
479 __field( dev_t, dev )
480 __field( int, needed )
481
482 ),
483
484 TP_fast_assign(
485 __entry->dev = sb->s_dev;
486 __entry->needed = needed;
487 ),
488
489 TP_printk("dev %s needed %d",
490 jbd2_dev_to_name(__entry->dev), __entry->needed)
491);
492
493TRACE_EVENT(ext4_request_blocks,
494 TP_PROTO(struct ext4_allocation_request *ar),
495
496 TP_ARGS(ar),
497
498 TP_STRUCT__entry(
499 __field( dev_t, dev )
500 __field( ino_t, ino )
501 __field( unsigned int, flags )
502 __field( unsigned int, len )
503 __field( __u64, logical )
504 __field( __u64, goal )
505 __field( __u64, lleft )
506 __field( __u64, lright )
507 __field( __u64, pleft )
508 __field( __u64, pright )
509 ),
510
511 TP_fast_assign(
512 __entry->dev = ar->inode->i_sb->s_dev;
513 __entry->ino = ar->inode->i_ino;
514 __entry->flags = ar->flags;
515 __entry->len = ar->len;
516 __entry->logical = ar->logical;
517 __entry->goal = ar->goal;
518 __entry->lleft = ar->lleft;
519 __entry->lright = ar->lright;
520 __entry->pleft = ar->pleft;
521 __entry->pright = ar->pright;
522 ),
523
524 TP_printk("dev %s ino %lu flags %u len %u lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400525 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
526 __entry->flags, __entry->len,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400527 (unsigned long long) __entry->logical,
528 (unsigned long long) __entry->goal,
529 (unsigned long long) __entry->lleft,
530 (unsigned long long) __entry->lright,
531 (unsigned long long) __entry->pleft,
532 (unsigned long long) __entry->pright)
533);
534
535TRACE_EVENT(ext4_allocate_blocks,
536 TP_PROTO(struct ext4_allocation_request *ar, unsigned long long block),
537
538 TP_ARGS(ar, block),
539
540 TP_STRUCT__entry(
541 __field( dev_t, dev )
542 __field( ino_t, ino )
543 __field( __u64, block )
544 __field( unsigned int, flags )
545 __field( unsigned int, len )
546 __field( __u64, logical )
547 __field( __u64, goal )
548 __field( __u64, lleft )
549 __field( __u64, lright )
550 __field( __u64, pleft )
551 __field( __u64, pright )
552 ),
553
554 TP_fast_assign(
555 __entry->dev = ar->inode->i_sb->s_dev;
556 __entry->ino = ar->inode->i_ino;
557 __entry->block = block;
558 __entry->flags = ar->flags;
559 __entry->len = ar->len;
560 __entry->logical = ar->logical;
561 __entry->goal = ar->goal;
562 __entry->lleft = ar->lleft;
563 __entry->lright = ar->lright;
564 __entry->pleft = ar->pleft;
565 __entry->pright = ar->pright;
566 ),
567
568 TP_printk("dev %s ino %lu flags %u len %u block %llu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400569 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
570 __entry->flags, __entry->len, __entry->block,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400571 (unsigned long long) __entry->logical,
572 (unsigned long long) __entry->goal,
573 (unsigned long long) __entry->lleft,
574 (unsigned long long) __entry->lright,
575 (unsigned long long) __entry->pleft,
576 (unsigned long long) __entry->pright)
577);
578
579TRACE_EVENT(ext4_free_blocks,
580 TP_PROTO(struct inode *inode, __u64 block, unsigned long count,
Theodore Ts'oe6362602009-11-23 07:17:05 -0500581 int flags),
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400582
Theodore Ts'oe6362602009-11-23 07:17:05 -0500583 TP_ARGS(inode, block, count, flags),
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400584
585 TP_STRUCT__entry(
586 __field( dev_t, dev )
587 __field( ino_t, ino )
Theodore Ts'oe6362602009-11-23 07:17:05 -0500588 __field( umode_t, mode )
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400589 __field( __u64, block )
590 __field( unsigned long, count )
Theodore Ts'oe6362602009-11-23 07:17:05 -0500591 __field( int, flags )
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400592 ),
593
594 TP_fast_assign(
595 __entry->dev = inode->i_sb->s_dev;
596 __entry->ino = inode->i_ino;
Theodore Ts'oe6362602009-11-23 07:17:05 -0500597 __entry->mode = inode->i_mode;
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400598 __entry->block = block;
599 __entry->count = count;
Theodore Ts'oe6362602009-11-23 07:17:05 -0500600 __entry->flags = flags;
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400601 ),
602
Theodore Ts'oe6362602009-11-23 07:17:05 -0500603 TP_printk("dev %s ino %lu mode 0%o block %llu count %lu flags %d",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400604 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
Theodore Ts'oe6362602009-11-23 07:17:05 -0500605 __entry->mode, __entry->block, __entry->count,
606 __entry->flags)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400607);
608
609TRACE_EVENT(ext4_sync_file,
Christoph Hellwig7ea80852010-05-26 17:53:25 +0200610 TP_PROTO(struct file *file, int datasync),
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400611
Christoph Hellwig7ea80852010-05-26 17:53:25 +0200612 TP_ARGS(file, datasync),
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400613
614 TP_STRUCT__entry(
615 __field( dev_t, dev )
616 __field( ino_t, ino )
617 __field( ino_t, parent )
618 __field( int, datasync )
619 ),
620
621 TP_fast_assign(
Christoph Hellwig7ea80852010-05-26 17:53:25 +0200622 struct dentry *dentry = file->f_path.dentry;
623
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400624 __entry->dev = dentry->d_inode->i_sb->s_dev;
625 __entry->ino = dentry->d_inode->i_ino;
626 __entry->datasync = datasync;
627 __entry->parent = dentry->d_parent->d_inode->i_ino;
628 ),
629
630 TP_printk("dev %s ino %ld parent %ld datasync %d ",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400631 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
632 (unsigned long) __entry->parent, __entry->datasync)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400633);
634
635TRACE_EVENT(ext4_sync_fs,
636 TP_PROTO(struct super_block *sb, int wait),
637
638 TP_ARGS(sb, wait),
639
640 TP_STRUCT__entry(
641 __field( dev_t, dev )
642 __field( int, wait )
643
644 ),
645
646 TP_fast_assign(
647 __entry->dev = sb->s_dev;
648 __entry->wait = wait;
649 ),
650
651 TP_printk("dev %s wait %d", jbd2_dev_to_name(__entry->dev),
652 __entry->wait)
653);
654
Theodore Ts'ofb40ba02009-09-16 19:30:40 -0400655TRACE_EVENT(ext4_alloc_da_blocks,
656 TP_PROTO(struct inode *inode),
657
658 TP_ARGS(inode),
659
660 TP_STRUCT__entry(
661 __field( dev_t, dev )
662 __field( ino_t, ino )
663 __field( unsigned int, data_blocks )
664 __field( unsigned int, meta_blocks )
665 ),
666
667 TP_fast_assign(
668 __entry->dev = inode->i_sb->s_dev;
669 __entry->ino = inode->i_ino;
670 __entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
671 __entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
672 ),
673
674 TP_printk("dev %s ino %lu data_blocks %u meta_blocks %u",
675 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
676 __entry->data_blocks, __entry->meta_blocks)
677);
678
Theodore Ts'o296c3552009-09-30 00:32:42 -0400679TRACE_EVENT(ext4_mballoc_alloc,
680 TP_PROTO(struct ext4_allocation_context *ac),
681
682 TP_ARGS(ac),
683
684 TP_STRUCT__entry(
685 __field( dev_t, dev )
686 __field( ino_t, ino )
687 __field( __u16, found )
688 __field( __u16, groups )
689 __field( __u16, buddy )
690 __field( __u16, flags )
691 __field( __u16, tail )
692 __field( __u8, cr )
693 __field( __u32, orig_logical )
694 __field( int, orig_start )
695 __field( __u32, orig_group )
696 __field( int, orig_len )
697 __field( __u32, goal_logical )
698 __field( int, goal_start )
699 __field( __u32, goal_group )
700 __field( int, goal_len )
701 __field( __u32, result_logical )
702 __field( int, result_start )
703 __field( __u32, result_group )
704 __field( int, result_len )
705 ),
706
707 TP_fast_assign(
708 __entry->dev = ac->ac_inode->i_sb->s_dev;
709 __entry->ino = ac->ac_inode->i_ino;
710 __entry->found = ac->ac_found;
711 __entry->flags = ac->ac_flags;
712 __entry->groups = ac->ac_groups_scanned;
713 __entry->buddy = ac->ac_buddy;
714 __entry->tail = ac->ac_tail;
715 __entry->cr = ac->ac_criteria;
716 __entry->orig_logical = ac->ac_o_ex.fe_logical;
717 __entry->orig_start = ac->ac_o_ex.fe_start;
718 __entry->orig_group = ac->ac_o_ex.fe_group;
719 __entry->orig_len = ac->ac_o_ex.fe_len;
720 __entry->goal_logical = ac->ac_g_ex.fe_logical;
721 __entry->goal_start = ac->ac_g_ex.fe_start;
722 __entry->goal_group = ac->ac_g_ex.fe_group;
723 __entry->goal_len = ac->ac_g_ex.fe_len;
724 __entry->result_logical = ac->ac_f_ex.fe_logical;
725 __entry->result_start = ac->ac_f_ex.fe_start;
726 __entry->result_group = ac->ac_f_ex.fe_group;
727 __entry->result_len = ac->ac_f_ex.fe_len;
728 ),
729
730 TP_printk("dev %s inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
731 "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x "
732 "tail %u broken %u",
733 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
734 __entry->orig_group, __entry->orig_start,
735 __entry->orig_len, __entry->orig_logical,
736 __entry->goal_group, __entry->goal_start,
737 __entry->goal_len, __entry->goal_logical,
738 __entry->result_group, __entry->result_start,
739 __entry->result_len, __entry->result_logical,
740 __entry->found, __entry->groups, __entry->cr,
741 __entry->flags, __entry->tail,
742 __entry->buddy ? 1 << __entry->buddy : 0)
743);
744
745TRACE_EVENT(ext4_mballoc_prealloc,
746 TP_PROTO(struct ext4_allocation_context *ac),
747
748 TP_ARGS(ac),
749
750 TP_STRUCT__entry(
751 __field( dev_t, dev )
752 __field( ino_t, ino )
753 __field( __u32, orig_logical )
754 __field( int, orig_start )
755 __field( __u32, orig_group )
756 __field( int, orig_len )
757 __field( __u32, result_logical )
758 __field( int, result_start )
759 __field( __u32, result_group )
760 __field( int, result_len )
761 ),
762
763 TP_fast_assign(
764 __entry->dev = ac->ac_inode->i_sb->s_dev;
765 __entry->ino = ac->ac_inode->i_ino;
766 __entry->orig_logical = ac->ac_o_ex.fe_logical;
767 __entry->orig_start = ac->ac_o_ex.fe_start;
768 __entry->orig_group = ac->ac_o_ex.fe_group;
769 __entry->orig_len = ac->ac_o_ex.fe_len;
770 __entry->result_logical = ac->ac_b_ex.fe_logical;
771 __entry->result_start = ac->ac_b_ex.fe_start;
772 __entry->result_group = ac->ac_b_ex.fe_group;
773 __entry->result_len = ac->ac_b_ex.fe_len;
774 ),
775
776 TP_printk("dev %s inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
777 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
778 __entry->orig_group, __entry->orig_start,
779 __entry->orig_len, __entry->orig_logical,
780 __entry->result_group, __entry->result_start,
781 __entry->result_len, __entry->result_logical)
782);
783
Li Zefanf084db92010-05-17 04:00:00 -0400784DECLARE_EVENT_CLASS(ext4__mballoc,
Theodore Ts'o296c3552009-09-30 00:32:42 -0400785 TP_PROTO(struct ext4_allocation_context *ac),
786
787 TP_ARGS(ac),
788
789 TP_STRUCT__entry(
790 __field( dev_t, dev )
791 __field( ino_t, ino )
792 __field( __u32, result_logical )
793 __field( int, result_start )
794 __field( __u32, result_group )
795 __field( int, result_len )
796 ),
797
798 TP_fast_assign(
799 __entry->dev = ac->ac_inode->i_sb->s_dev;
800 __entry->ino = ac->ac_inode->i_ino;
801 __entry->result_logical = ac->ac_b_ex.fe_logical;
802 __entry->result_start = ac->ac_b_ex.fe_start;
803 __entry->result_group = ac->ac_b_ex.fe_group;
804 __entry->result_len = ac->ac_b_ex.fe_len;
805 ),
806
807 TP_printk("dev %s inode %lu extent %u/%d/%u@%u ",
808 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
809 __entry->result_group, __entry->result_start,
810 __entry->result_len, __entry->result_logical)
811);
812
Li Zefanf084db92010-05-17 04:00:00 -0400813DEFINE_EVENT(ext4__mballoc, ext4_mballoc_discard,
814
Theodore Ts'o296c3552009-09-30 00:32:42 -0400815 TP_PROTO(struct ext4_allocation_context *ac),
816
Li Zefanf084db92010-05-17 04:00:00 -0400817 TP_ARGS(ac)
818);
Theodore Ts'o296c3552009-09-30 00:32:42 -0400819
Li Zefanf084db92010-05-17 04:00:00 -0400820DEFINE_EVENT(ext4__mballoc, ext4_mballoc_free,
Theodore Ts'o296c3552009-09-30 00:32:42 -0400821
Li Zefanf084db92010-05-17 04:00:00 -0400822 TP_PROTO(struct ext4_allocation_context *ac),
Theodore Ts'o296c3552009-09-30 00:32:42 -0400823
Li Zefanf084db92010-05-17 04:00:00 -0400824 TP_ARGS(ac)
Theodore Ts'o296c3552009-09-30 00:32:42 -0400825);
826
Theodore Ts'obeac2da2009-11-23 07:25:08 -0500827TRACE_EVENT(ext4_forget,
828 TP_PROTO(struct inode *inode, int is_metadata, __u64 block),
829
830 TP_ARGS(inode, is_metadata, block),
831
832 TP_STRUCT__entry(
833 __field( dev_t, dev )
834 __field( ino_t, ino )
835 __field( umode_t, mode )
836 __field( int, is_metadata )
837 __field( __u64, block )
838 ),
839
840 TP_fast_assign(
841 __entry->dev = inode->i_sb->s_dev;
842 __entry->ino = inode->i_ino;
843 __entry->mode = inode->i_mode;
844 __entry->is_metadata = is_metadata;
845 __entry->block = block;
846 ),
847
Theodore Ts'o6eebee62009-11-22 20:23:31 -0500848 TP_printk("dev %s ino %lu mode 0%o is_metadata %d block %llu",
Theodore Ts'obeac2da2009-11-23 07:25:08 -0500849 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
850 __entry->mode, __entry->is_metadata, __entry->block)
851);
852
Theodore Ts'of8ec9d62010-01-01 01:00:21 -0500853TRACE_EVENT(ext4_da_update_reserve_space,
854 TP_PROTO(struct inode *inode, int used_blocks),
855
856 TP_ARGS(inode, used_blocks),
857
858 TP_STRUCT__entry(
859 __field( dev_t, dev )
860 __field( ino_t, ino )
861 __field( umode_t, mode )
862 __field( __u64, i_blocks )
863 __field( int, used_blocks )
864 __field( int, reserved_data_blocks )
865 __field( int, reserved_meta_blocks )
866 __field( int, allocated_meta_blocks )
867 ),
868
869 TP_fast_assign(
870 __entry->dev = inode->i_sb->s_dev;
871 __entry->ino = inode->i_ino;
872 __entry->mode = inode->i_mode;
873 __entry->i_blocks = inode->i_blocks;
874 __entry->used_blocks = used_blocks;
875 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
876 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
877 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
878 ),
879
880 TP_printk("dev %s ino %lu mode 0%o i_blocks %llu used_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d",
881 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
882 __entry->mode, (unsigned long long) __entry->i_blocks,
883 __entry->used_blocks, __entry->reserved_data_blocks,
884 __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
885);
886
887TRACE_EVENT(ext4_da_reserve_space,
888 TP_PROTO(struct inode *inode, int md_needed),
889
890 TP_ARGS(inode, md_needed),
891
892 TP_STRUCT__entry(
893 __field( dev_t, dev )
894 __field( ino_t, ino )
895 __field( umode_t, mode )
896 __field( __u64, i_blocks )
897 __field( int, md_needed )
898 __field( int, reserved_data_blocks )
899 __field( int, reserved_meta_blocks )
900 ),
901
902 TP_fast_assign(
903 __entry->dev = inode->i_sb->s_dev;
904 __entry->ino = inode->i_ino;
905 __entry->mode = inode->i_mode;
906 __entry->i_blocks = inode->i_blocks;
907 __entry->md_needed = md_needed;
908 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
909 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
910 ),
911
912 TP_printk("dev %s ino %lu mode 0%o i_blocks %llu md_needed %d reserved_data_blocks %d reserved_meta_blocks %d",
913 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
914 __entry->mode, (unsigned long long) __entry->i_blocks,
915 __entry->md_needed, __entry->reserved_data_blocks,
916 __entry->reserved_meta_blocks)
917);
918
919TRACE_EVENT(ext4_da_release_space,
920 TP_PROTO(struct inode *inode, int freed_blocks),
921
922 TP_ARGS(inode, freed_blocks),
923
924 TP_STRUCT__entry(
925 __field( dev_t, dev )
926 __field( ino_t, ino )
927 __field( umode_t, mode )
928 __field( __u64, i_blocks )
929 __field( int, freed_blocks )
930 __field( int, reserved_data_blocks )
931 __field( int, reserved_meta_blocks )
932 __field( int, allocated_meta_blocks )
933 ),
934
935 TP_fast_assign(
936 __entry->dev = inode->i_sb->s_dev;
937 __entry->ino = inode->i_ino;
938 __entry->mode = inode->i_mode;
939 __entry->i_blocks = inode->i_blocks;
940 __entry->freed_blocks = freed_blocks;
941 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
942 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
943 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
944 ),
945
946 TP_printk("dev %s ino %lu mode 0%o i_blocks %llu freed_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d",
947 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
948 __entry->mode, (unsigned long long) __entry->i_blocks,
949 __entry->freed_blocks, __entry->reserved_data_blocks,
950 __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
951);
952
Theodore Ts'of3073332010-05-17 03:00:00 -0400953DECLARE_EVENT_CLASS(ext4__bitmap_load,
954 TP_PROTO(struct super_block *sb, unsigned long group),
955
956 TP_ARGS(sb, group),
957
958 TP_STRUCT__entry(
959 __field( dev_t, dev )
960 __field( __u32, group )
961
962 ),
963
964 TP_fast_assign(
965 __entry->dev = sb->s_dev;
966 __entry->group = group;
967 ),
968
969 TP_printk("dev %s group %u",
970 jbd2_dev_to_name(__entry->dev), __entry->group)
971);
972
973DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load,
974
975 TP_PROTO(struct super_block *sb, unsigned long group),
976
977 TP_ARGS(sb, group)
978);
979
980DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
981
982 TP_PROTO(struct super_block *sb, unsigned long group),
983
984 TP_ARGS(sb, group)
985);
Theodore Ts'of8ec9d62010-01-01 01:00:21 -0500986
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400987#endif /* _TRACE_EXT4_H */
988
989/* This part must be outside protection */
990#include <trace/define_trace.h>