blob: f5b1ba90e952f71535d13b8c0a7d9a68782d5a07 [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 )
309 __field( char, no_nrwrite_index_update )
Theodore Ts'o55138e02009-09-29 13:31:31 -0400310 __field( pgoff_t, writeback_index )
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400311 ),
312
313 TP_fast_assign(
314 __entry->dev = inode->i_sb->s_dev;
315 __entry->ino = inode->i_ino;
316 __entry->ret = ret;
317 __entry->pages_written = pages_written;
318 __entry->pages_skipped = wbc->pages_skipped;
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400319 __entry->more_io = wbc->more_io;
320 __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update;
Theodore Ts'o55138e02009-09-29 13:31:31 -0400321 __entry->writeback_index = inode->i_mapping->writeback_index;
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400322 ),
323
Wu Fengguangb4d72412009-11-24 11:15:08 -0500324 TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld more_io %d no_nrwrite_index_update %d writeback_index %lu",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400325 jbd2_dev_to_name(__entry->dev),
326 (unsigned long) __entry->ino, __entry->ret,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400327 __entry->pages_written, __entry->pages_skipped,
Wu Fengguangb4d72412009-11-24 11:15:08 -0500328 __entry->more_io,
Theodore Ts'o55138e02009-09-29 13:31:31 -0400329 __entry->no_nrwrite_index_update,
330 (unsigned long) __entry->writeback_index)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400331);
332
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400333TRACE_EVENT(ext4_discard_blocks,
334 TP_PROTO(struct super_block *sb, unsigned long long blk,
335 unsigned long long count),
336
337 TP_ARGS(sb, blk, count),
338
339 TP_STRUCT__entry(
340 __field( dev_t, dev )
341 __field( __u64, blk )
342 __field( __u64, count )
343
344 ),
345
346 TP_fast_assign(
347 __entry->dev = sb->s_dev;
348 __entry->blk = blk;
349 __entry->count = count;
350 ),
351
352 TP_printk("dev %s blk %llu count %llu",
353 jbd2_dev_to_name(__entry->dev), __entry->blk, __entry->count)
354);
355
Li Zefanf084db92010-05-17 04:00:00 -0400356DECLARE_EVENT_CLASS(ext4__mb_new_pa,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400357 TP_PROTO(struct ext4_allocation_context *ac,
358 struct ext4_prealloc_space *pa),
359
360 TP_ARGS(ac, pa),
361
362 TP_STRUCT__entry(
363 __field( dev_t, dev )
364 __field( ino_t, ino )
365 __field( __u64, pa_pstart )
366 __field( __u32, pa_len )
367 __field( __u64, pa_lstart )
368
369 ),
370
371 TP_fast_assign(
372 __entry->dev = ac->ac_sb->s_dev;
373 __entry->ino = ac->ac_inode->i_ino;
374 __entry->pa_pstart = pa->pa_pstart;
375 __entry->pa_len = pa->pa_len;
376 __entry->pa_lstart = pa->pa_lstart;
377 ),
378
379 TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400380 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
381 __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400382);
383
Li Zefanf084db92010-05-17 04:00:00 -0400384DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa,
385
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400386 TP_PROTO(struct ext4_allocation_context *ac,
387 struct ext4_prealloc_space *pa),
388
Li Zefanf084db92010-05-17 04:00:00 -0400389 TP_ARGS(ac, pa)
390);
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400391
Li Zefanf084db92010-05-17 04:00:00 -0400392DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_group_pa,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400393
Li Zefanf084db92010-05-17 04:00:00 -0400394 TP_PROTO(struct ext4_allocation_context *ac,
395 struct ext4_prealloc_space *pa),
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400396
Li Zefanf084db92010-05-17 04:00:00 -0400397 TP_ARGS(ac, pa)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400398);
399
400TRACE_EVENT(ext4_mb_release_inode_pa,
401 TP_PROTO(struct ext4_allocation_context *ac,
402 struct ext4_prealloc_space *pa,
403 unsigned long long block, unsigned int count),
404
405 TP_ARGS(ac, pa, block, count),
406
407 TP_STRUCT__entry(
408 __field( dev_t, dev )
409 __field( ino_t, ino )
410 __field( __u64, block )
411 __field( __u32, count )
412
413 ),
414
415 TP_fast_assign(
416 __entry->dev = ac->ac_sb->s_dev;
417 __entry->ino = ac->ac_inode->i_ino;
418 __entry->block = block;
419 __entry->count = count;
420 ),
421
422 TP_printk("dev %s ino %lu block %llu count %u",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400423 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
424 __entry->block, __entry->count)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400425);
426
427TRACE_EVENT(ext4_mb_release_group_pa,
428 TP_PROTO(struct ext4_allocation_context *ac,
429 struct ext4_prealloc_space *pa),
430
431 TP_ARGS(ac, pa),
432
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(
442 __entry->dev = ac->ac_sb->s_dev;
443 __entry->ino = ac->ac_inode->i_ino;
444 __entry->pa_pstart = pa->pa_pstart;
445 __entry->pa_len = pa->pa_len;
446 ),
447
448 TP_printk("dev %s pstart %llu len %u",
449 jbd2_dev_to_name(__entry->dev), __entry->pa_pstart, __entry->pa_len)
450);
451
452TRACE_EVENT(ext4_discard_preallocations,
453 TP_PROTO(struct inode *inode),
454
455 TP_ARGS(inode),
456
457 TP_STRUCT__entry(
458 __field( dev_t, dev )
459 __field( ino_t, ino )
460
461 ),
462
463 TP_fast_assign(
464 __entry->dev = inode->i_sb->s_dev;
465 __entry->ino = inode->i_ino;
466 ),
467
468 TP_printk("dev %s ino %lu",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400469 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400470);
471
472TRACE_EVENT(ext4_mb_discard_preallocations,
473 TP_PROTO(struct super_block *sb, int needed),
474
475 TP_ARGS(sb, needed),
476
477 TP_STRUCT__entry(
478 __field( dev_t, dev )
479 __field( int, needed )
480
481 ),
482
483 TP_fast_assign(
484 __entry->dev = sb->s_dev;
485 __entry->needed = needed;
486 ),
487
488 TP_printk("dev %s needed %d",
489 jbd2_dev_to_name(__entry->dev), __entry->needed)
490);
491
492TRACE_EVENT(ext4_request_blocks,
493 TP_PROTO(struct ext4_allocation_request *ar),
494
495 TP_ARGS(ar),
496
497 TP_STRUCT__entry(
498 __field( dev_t, dev )
499 __field( ino_t, ino )
500 __field( unsigned int, flags )
501 __field( unsigned int, len )
502 __field( __u64, logical )
503 __field( __u64, goal )
504 __field( __u64, lleft )
505 __field( __u64, lright )
506 __field( __u64, pleft )
507 __field( __u64, pright )
508 ),
509
510 TP_fast_assign(
511 __entry->dev = ar->inode->i_sb->s_dev;
512 __entry->ino = ar->inode->i_ino;
513 __entry->flags = ar->flags;
514 __entry->len = ar->len;
515 __entry->logical = ar->logical;
516 __entry->goal = ar->goal;
517 __entry->lleft = ar->lleft;
518 __entry->lright = ar->lright;
519 __entry->pleft = ar->pleft;
520 __entry->pright = ar->pright;
521 ),
522
523 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 -0400524 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
525 __entry->flags, __entry->len,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400526 (unsigned long long) __entry->logical,
527 (unsigned long long) __entry->goal,
528 (unsigned long long) __entry->lleft,
529 (unsigned long long) __entry->lright,
530 (unsigned long long) __entry->pleft,
531 (unsigned long long) __entry->pright)
532);
533
534TRACE_EVENT(ext4_allocate_blocks,
535 TP_PROTO(struct ext4_allocation_request *ar, unsigned long long block),
536
537 TP_ARGS(ar, block),
538
539 TP_STRUCT__entry(
540 __field( dev_t, dev )
541 __field( ino_t, ino )
542 __field( __u64, block )
543 __field( unsigned int, flags )
544 __field( unsigned int, len )
545 __field( __u64, logical )
546 __field( __u64, goal )
547 __field( __u64, lleft )
548 __field( __u64, lright )
549 __field( __u64, pleft )
550 __field( __u64, pright )
551 ),
552
553 TP_fast_assign(
554 __entry->dev = ar->inode->i_sb->s_dev;
555 __entry->ino = ar->inode->i_ino;
556 __entry->block = block;
557 __entry->flags = ar->flags;
558 __entry->len = ar->len;
559 __entry->logical = ar->logical;
560 __entry->goal = ar->goal;
561 __entry->lleft = ar->lleft;
562 __entry->lright = ar->lright;
563 __entry->pleft = ar->pleft;
564 __entry->pright = ar->pright;
565 ),
566
567 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 -0400568 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
569 __entry->flags, __entry->len, __entry->block,
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400570 (unsigned long long) __entry->logical,
571 (unsigned long long) __entry->goal,
572 (unsigned long long) __entry->lleft,
573 (unsigned long long) __entry->lright,
574 (unsigned long long) __entry->pleft,
575 (unsigned long long) __entry->pright)
576);
577
578TRACE_EVENT(ext4_free_blocks,
579 TP_PROTO(struct inode *inode, __u64 block, unsigned long count,
Theodore Ts'oe6362602009-11-23 07:17:05 -0500580 int flags),
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400581
Theodore Ts'oe6362602009-11-23 07:17:05 -0500582 TP_ARGS(inode, block, count, flags),
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400583
584 TP_STRUCT__entry(
585 __field( dev_t, dev )
586 __field( ino_t, ino )
Theodore Ts'oe6362602009-11-23 07:17:05 -0500587 __field( umode_t, mode )
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400588 __field( __u64, block )
589 __field( unsigned long, count )
Theodore Ts'oe6362602009-11-23 07:17:05 -0500590 __field( int, flags )
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400591 ),
592
593 TP_fast_assign(
594 __entry->dev = inode->i_sb->s_dev;
595 __entry->ino = inode->i_ino;
Theodore Ts'oe6362602009-11-23 07:17:05 -0500596 __entry->mode = inode->i_mode;
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400597 __entry->block = block;
598 __entry->count = count;
Theodore Ts'oe6362602009-11-23 07:17:05 -0500599 __entry->flags = flags;
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400600 ),
601
Theodore Ts'oe6362602009-11-23 07:17:05 -0500602 TP_printk("dev %s ino %lu mode 0%o block %llu count %lu flags %d",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400603 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
Theodore Ts'oe6362602009-11-23 07:17:05 -0500604 __entry->mode, __entry->block, __entry->count,
605 __entry->flags)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400606);
607
608TRACE_EVENT(ext4_sync_file,
Christoph Hellwig7ea80852010-05-26 17:53:25 +0200609 TP_PROTO(struct file *file, int datasync),
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400610
Christoph Hellwig7ea80852010-05-26 17:53:25 +0200611 TP_ARGS(file, datasync),
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400612
613 TP_STRUCT__entry(
614 __field( dev_t, dev )
615 __field( ino_t, ino )
616 __field( ino_t, parent )
617 __field( int, datasync )
618 ),
619
620 TP_fast_assign(
Christoph Hellwig7ea80852010-05-26 17:53:25 +0200621 struct dentry *dentry = file->f_path.dentry;
622
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400623 __entry->dev = dentry->d_inode->i_sb->s_dev;
624 __entry->ino = dentry->d_inode->i_ino;
625 __entry->datasync = datasync;
626 __entry->parent = dentry->d_parent->d_inode->i_ino;
627 ),
628
629 TP_printk("dev %s ino %ld parent %ld datasync %d ",
Theodore Ts'oa3710fd2009-09-17 08:50:18 -0400630 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
631 (unsigned long) __entry->parent, __entry->datasync)
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400632);
633
634TRACE_EVENT(ext4_sync_fs,
635 TP_PROTO(struct super_block *sb, int wait),
636
637 TP_ARGS(sb, wait),
638
639 TP_STRUCT__entry(
640 __field( dev_t, dev )
641 __field( int, wait )
642
643 ),
644
645 TP_fast_assign(
646 __entry->dev = sb->s_dev;
647 __entry->wait = wait;
648 ),
649
650 TP_printk("dev %s wait %d", jbd2_dev_to_name(__entry->dev),
651 __entry->wait)
652);
653
Theodore Ts'ofb40ba02009-09-16 19:30:40 -0400654TRACE_EVENT(ext4_alloc_da_blocks,
655 TP_PROTO(struct inode *inode),
656
657 TP_ARGS(inode),
658
659 TP_STRUCT__entry(
660 __field( dev_t, dev )
661 __field( ino_t, ino )
662 __field( unsigned int, data_blocks )
663 __field( unsigned int, meta_blocks )
664 ),
665
666 TP_fast_assign(
667 __entry->dev = inode->i_sb->s_dev;
668 __entry->ino = inode->i_ino;
669 __entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
670 __entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
671 ),
672
673 TP_printk("dev %s ino %lu data_blocks %u meta_blocks %u",
674 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
675 __entry->data_blocks, __entry->meta_blocks)
676);
677
Theodore Ts'o296c3552009-09-30 00:32:42 -0400678TRACE_EVENT(ext4_mballoc_alloc,
679 TP_PROTO(struct ext4_allocation_context *ac),
680
681 TP_ARGS(ac),
682
683 TP_STRUCT__entry(
684 __field( dev_t, dev )
685 __field( ino_t, ino )
686 __field( __u16, found )
687 __field( __u16, groups )
688 __field( __u16, buddy )
689 __field( __u16, flags )
690 __field( __u16, tail )
691 __field( __u8, cr )
692 __field( __u32, orig_logical )
693 __field( int, orig_start )
694 __field( __u32, orig_group )
695 __field( int, orig_len )
696 __field( __u32, goal_logical )
697 __field( int, goal_start )
698 __field( __u32, goal_group )
699 __field( int, goal_len )
700 __field( __u32, result_logical )
701 __field( int, result_start )
702 __field( __u32, result_group )
703 __field( int, result_len )
704 ),
705
706 TP_fast_assign(
707 __entry->dev = ac->ac_inode->i_sb->s_dev;
708 __entry->ino = ac->ac_inode->i_ino;
709 __entry->found = ac->ac_found;
710 __entry->flags = ac->ac_flags;
711 __entry->groups = ac->ac_groups_scanned;
712 __entry->buddy = ac->ac_buddy;
713 __entry->tail = ac->ac_tail;
714 __entry->cr = ac->ac_criteria;
715 __entry->orig_logical = ac->ac_o_ex.fe_logical;
716 __entry->orig_start = ac->ac_o_ex.fe_start;
717 __entry->orig_group = ac->ac_o_ex.fe_group;
718 __entry->orig_len = ac->ac_o_ex.fe_len;
719 __entry->goal_logical = ac->ac_g_ex.fe_logical;
720 __entry->goal_start = ac->ac_g_ex.fe_start;
721 __entry->goal_group = ac->ac_g_ex.fe_group;
722 __entry->goal_len = ac->ac_g_ex.fe_len;
723 __entry->result_logical = ac->ac_f_ex.fe_logical;
724 __entry->result_start = ac->ac_f_ex.fe_start;
725 __entry->result_group = ac->ac_f_ex.fe_group;
726 __entry->result_len = ac->ac_f_ex.fe_len;
727 ),
728
729 TP_printk("dev %s inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
730 "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x "
731 "tail %u broken %u",
732 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
733 __entry->orig_group, __entry->orig_start,
734 __entry->orig_len, __entry->orig_logical,
735 __entry->goal_group, __entry->goal_start,
736 __entry->goal_len, __entry->goal_logical,
737 __entry->result_group, __entry->result_start,
738 __entry->result_len, __entry->result_logical,
739 __entry->found, __entry->groups, __entry->cr,
740 __entry->flags, __entry->tail,
741 __entry->buddy ? 1 << __entry->buddy : 0)
742);
743
744TRACE_EVENT(ext4_mballoc_prealloc,
745 TP_PROTO(struct ext4_allocation_context *ac),
746
747 TP_ARGS(ac),
748
749 TP_STRUCT__entry(
750 __field( dev_t, dev )
751 __field( ino_t, ino )
752 __field( __u32, orig_logical )
753 __field( int, orig_start )
754 __field( __u32, orig_group )
755 __field( int, orig_len )
756 __field( __u32, result_logical )
757 __field( int, result_start )
758 __field( __u32, result_group )
759 __field( int, result_len )
760 ),
761
762 TP_fast_assign(
763 __entry->dev = ac->ac_inode->i_sb->s_dev;
764 __entry->ino = ac->ac_inode->i_ino;
765 __entry->orig_logical = ac->ac_o_ex.fe_logical;
766 __entry->orig_start = ac->ac_o_ex.fe_start;
767 __entry->orig_group = ac->ac_o_ex.fe_group;
768 __entry->orig_len = ac->ac_o_ex.fe_len;
769 __entry->result_logical = ac->ac_b_ex.fe_logical;
770 __entry->result_start = ac->ac_b_ex.fe_start;
771 __entry->result_group = ac->ac_b_ex.fe_group;
772 __entry->result_len = ac->ac_b_ex.fe_len;
773 ),
774
775 TP_printk("dev %s inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
776 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
777 __entry->orig_group, __entry->orig_start,
778 __entry->orig_len, __entry->orig_logical,
779 __entry->result_group, __entry->result_start,
780 __entry->result_len, __entry->result_logical)
781);
782
Li Zefanf084db92010-05-17 04:00:00 -0400783DECLARE_EVENT_CLASS(ext4__mballoc,
Theodore Ts'o296c3552009-09-30 00:32:42 -0400784 TP_PROTO(struct ext4_allocation_context *ac),
785
786 TP_ARGS(ac),
787
788 TP_STRUCT__entry(
789 __field( dev_t, dev )
790 __field( ino_t, ino )
791 __field( __u32, result_logical )
792 __field( int, result_start )
793 __field( __u32, result_group )
794 __field( int, result_len )
795 ),
796
797 TP_fast_assign(
798 __entry->dev = ac->ac_inode->i_sb->s_dev;
799 __entry->ino = ac->ac_inode->i_ino;
800 __entry->result_logical = ac->ac_b_ex.fe_logical;
801 __entry->result_start = ac->ac_b_ex.fe_start;
802 __entry->result_group = ac->ac_b_ex.fe_group;
803 __entry->result_len = ac->ac_b_ex.fe_len;
804 ),
805
806 TP_printk("dev %s inode %lu extent %u/%d/%u@%u ",
807 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
808 __entry->result_group, __entry->result_start,
809 __entry->result_len, __entry->result_logical)
810);
811
Li Zefanf084db92010-05-17 04:00:00 -0400812DEFINE_EVENT(ext4__mballoc, ext4_mballoc_discard,
813
Theodore Ts'o296c3552009-09-30 00:32:42 -0400814 TP_PROTO(struct ext4_allocation_context *ac),
815
Li Zefanf084db92010-05-17 04:00:00 -0400816 TP_ARGS(ac)
817);
Theodore Ts'o296c3552009-09-30 00:32:42 -0400818
Li Zefanf084db92010-05-17 04:00:00 -0400819DEFINE_EVENT(ext4__mballoc, ext4_mballoc_free,
Theodore Ts'o296c3552009-09-30 00:32:42 -0400820
Li Zefanf084db92010-05-17 04:00:00 -0400821 TP_PROTO(struct ext4_allocation_context *ac),
Theodore Ts'o296c3552009-09-30 00:32:42 -0400822
Li Zefanf084db92010-05-17 04:00:00 -0400823 TP_ARGS(ac)
Theodore Ts'o296c3552009-09-30 00:32:42 -0400824);
825
Theodore Ts'obeac2da2009-11-23 07:25:08 -0500826TRACE_EVENT(ext4_forget,
827 TP_PROTO(struct inode *inode, int is_metadata, __u64 block),
828
829 TP_ARGS(inode, is_metadata, block),
830
831 TP_STRUCT__entry(
832 __field( dev_t, dev )
833 __field( ino_t, ino )
834 __field( umode_t, mode )
835 __field( int, is_metadata )
836 __field( __u64, block )
837 ),
838
839 TP_fast_assign(
840 __entry->dev = inode->i_sb->s_dev;
841 __entry->ino = inode->i_ino;
842 __entry->mode = inode->i_mode;
843 __entry->is_metadata = is_metadata;
844 __entry->block = block;
845 ),
846
Theodore Ts'o6eebee62009-11-22 20:23:31 -0500847 TP_printk("dev %s ino %lu mode 0%o is_metadata %d block %llu",
Theodore Ts'obeac2da2009-11-23 07:25:08 -0500848 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
849 __entry->mode, __entry->is_metadata, __entry->block)
850);
851
Theodore Ts'of8ec9d682010-01-01 01:00:21 -0500852TRACE_EVENT(ext4_da_update_reserve_space,
853 TP_PROTO(struct inode *inode, int used_blocks),
854
855 TP_ARGS(inode, used_blocks),
856
857 TP_STRUCT__entry(
858 __field( dev_t, dev )
859 __field( ino_t, ino )
860 __field( umode_t, mode )
861 __field( __u64, i_blocks )
862 __field( int, used_blocks )
863 __field( int, reserved_data_blocks )
864 __field( int, reserved_meta_blocks )
865 __field( int, allocated_meta_blocks )
866 ),
867
868 TP_fast_assign(
869 __entry->dev = inode->i_sb->s_dev;
870 __entry->ino = inode->i_ino;
871 __entry->mode = inode->i_mode;
872 __entry->i_blocks = inode->i_blocks;
873 __entry->used_blocks = used_blocks;
874 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
875 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
876 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
877 ),
878
879 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",
880 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
881 __entry->mode, (unsigned long long) __entry->i_blocks,
882 __entry->used_blocks, __entry->reserved_data_blocks,
883 __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
884);
885
886TRACE_EVENT(ext4_da_reserve_space,
887 TP_PROTO(struct inode *inode, int md_needed),
888
889 TP_ARGS(inode, md_needed),
890
891 TP_STRUCT__entry(
892 __field( dev_t, dev )
893 __field( ino_t, ino )
894 __field( umode_t, mode )
895 __field( __u64, i_blocks )
896 __field( int, md_needed )
897 __field( int, reserved_data_blocks )
898 __field( int, reserved_meta_blocks )
899 ),
900
901 TP_fast_assign(
902 __entry->dev = inode->i_sb->s_dev;
903 __entry->ino = inode->i_ino;
904 __entry->mode = inode->i_mode;
905 __entry->i_blocks = inode->i_blocks;
906 __entry->md_needed = md_needed;
907 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
908 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
909 ),
910
911 TP_printk("dev %s ino %lu mode 0%o i_blocks %llu md_needed %d reserved_data_blocks %d reserved_meta_blocks %d",
912 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
913 __entry->mode, (unsigned long long) __entry->i_blocks,
914 __entry->md_needed, __entry->reserved_data_blocks,
915 __entry->reserved_meta_blocks)
916);
917
918TRACE_EVENT(ext4_da_release_space,
919 TP_PROTO(struct inode *inode, int freed_blocks),
920
921 TP_ARGS(inode, freed_blocks),
922
923 TP_STRUCT__entry(
924 __field( dev_t, dev )
925 __field( ino_t, ino )
926 __field( umode_t, mode )
927 __field( __u64, i_blocks )
928 __field( int, freed_blocks )
929 __field( int, reserved_data_blocks )
930 __field( int, reserved_meta_blocks )
931 __field( int, allocated_meta_blocks )
932 ),
933
934 TP_fast_assign(
935 __entry->dev = inode->i_sb->s_dev;
936 __entry->ino = inode->i_ino;
937 __entry->mode = inode->i_mode;
938 __entry->i_blocks = inode->i_blocks;
939 __entry->freed_blocks = freed_blocks;
940 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
941 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
942 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
943 ),
944
945 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",
946 jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
947 __entry->mode, (unsigned long long) __entry->i_blocks,
948 __entry->freed_blocks, __entry->reserved_data_blocks,
949 __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
950);
951
Theodore Ts'of3073332010-05-17 03:00:00 -0400952DECLARE_EVENT_CLASS(ext4__bitmap_load,
953 TP_PROTO(struct super_block *sb, unsigned long group),
954
955 TP_ARGS(sb, group),
956
957 TP_STRUCT__entry(
958 __field( dev_t, dev )
959 __field( __u32, group )
960
961 ),
962
963 TP_fast_assign(
964 __entry->dev = sb->s_dev;
965 __entry->group = group;
966 ),
967
968 TP_printk("dev %s group %u",
969 jbd2_dev_to_name(__entry->dev), __entry->group)
970);
971
972DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load,
973
974 TP_PROTO(struct super_block *sb, unsigned long group),
975
976 TP_ARGS(sb, group)
977);
978
979DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
980
981 TP_PROTO(struct super_block *sb, unsigned long group),
982
983 TP_ARGS(sb, group)
984);
Theodore Ts'of8ec9d682010-01-01 01:00:21 -0500985
Theodore Ts'o9bffad12009-06-17 11:48:11 -0400986#endif /* _TRACE_EXT4_H */
987
988/* This part must be outside protection */
989#include <trace/define_trace.h>