b50a54736242ca21d19a814ab37b27783216397a
[linux-2.6.git] / include / trace / events / ext4.h
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM ext4
3
4 #if !defined(_TRACE_EXT4_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_EXT4_H
6
7 #include <linux/writeback.h>
8 #include <linux/tracepoint.h>
9
10 struct ext4_allocation_context;
11 struct ext4_allocation_request;
12 struct ext4_prealloc_space;
13 struct ext4_inode_info;
14 struct mpage_da_data;
15
16 #define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode))
17
18 TRACE_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(        __u16, mode                     )
27                 __field(        uid_t,  uid                     )
28                 __field(        gid_t,  gid                     )
29                 __field(        __u64, 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
41         TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu",
42                   MAJOR(__entry->dev), MINOR(__entry->dev),
43                   (unsigned long) __entry->ino, __entry->mode,
44                   __entry->uid, __entry->gid, __entry->blocks)
45 );
46
47 TRACE_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(        __u16, 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
64         TP_printk("dev %d,%d dir %lu mode 0%o",
65                   MAJOR(__entry->dev), MINOR(__entry->dev),
66                   (unsigned long) __entry->dir, __entry->mode)
67 );
68
69 TRACE_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(        __u16,  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
88         TP_printk("dev %d,%d ino %lu dir %lu mode 0%o",
89                   MAJOR(__entry->dev), MINOR(__entry->dev),
90                   (unsigned long) __entry->ino,
91                   (unsigned long) __entry->dir, __entry->mode)
92 );
93
94 TRACE_EVENT(ext4_evict_inode,
95         TP_PROTO(struct inode *inode),
96
97         TP_ARGS(inode),
98
99         TP_STRUCT__entry(
100                 __field(        dev_t,  dev                     )
101                 __field(        ino_t,  ino                     )
102                 __field(        int,    nlink                   )
103         ),
104
105         TP_fast_assign(
106                 __entry->dev    = inode->i_sb->s_dev;
107                 __entry->ino    = inode->i_ino;
108                 __entry->nlink  = inode->i_nlink;
109         ),
110
111         TP_printk("dev %d,%d ino %lu nlink %d",
112                   MAJOR(__entry->dev), MINOR(__entry->dev),
113                   (unsigned long) __entry->ino, __entry->nlink)
114 );
115
116 TRACE_EVENT(ext4_drop_inode,
117         TP_PROTO(struct inode *inode, int drop),
118
119         TP_ARGS(inode, drop),
120
121         TP_STRUCT__entry(
122                 __field(        dev_t,  dev                     )
123                 __field(        ino_t,  ino                     )
124                 __field(        int,    drop                    )
125         ),
126
127         TP_fast_assign(
128                 __entry->dev    = inode->i_sb->s_dev;
129                 __entry->ino    = inode->i_ino;
130                 __entry->drop   = drop;
131         ),
132
133         TP_printk("dev %d,%d ino %lu drop %d",
134                   MAJOR(__entry->dev), MINOR(__entry->dev),
135                   (unsigned long) __entry->ino, __entry->drop)
136 );
137
138 TRACE_EVENT(ext4_mark_inode_dirty,
139         TP_PROTO(struct inode *inode, unsigned long IP),
140
141         TP_ARGS(inode, IP),
142
143         TP_STRUCT__entry(
144                 __field(        dev_t,  dev                     )
145                 __field(        ino_t,  ino                     )
146                 __field(unsigned long,  ip                      )
147         ),
148
149         TP_fast_assign(
150                 __entry->dev    = inode->i_sb->s_dev;
151                 __entry->ino    = inode->i_ino;
152                 __entry->ip     = IP;
153         ),
154
155         TP_printk("dev %d,%d ino %lu caller %pF",
156                   MAJOR(__entry->dev), MINOR(__entry->dev),
157                   (unsigned long) __entry->ino, (void *)__entry->ip)
158 );
159
160 TRACE_EVENT(ext4_begin_ordered_truncate,
161         TP_PROTO(struct inode *inode, loff_t new_size),
162
163         TP_ARGS(inode, new_size),
164
165         TP_STRUCT__entry(
166                 __field(        dev_t,  dev                     )
167                 __field(        ino_t,  ino                     )
168                 __field(        loff_t, new_size                )
169         ),
170
171         TP_fast_assign(
172                 __entry->dev            = inode->i_sb->s_dev;
173                 __entry->ino            = inode->i_ino;
174                 __entry->new_size       = new_size;
175         ),
176
177         TP_printk("dev %d,%d ino %lu new_size %lld",
178                   MAJOR(__entry->dev), MINOR(__entry->dev),
179                   (unsigned long) __entry->ino,
180                   __entry->new_size)
181 );
182
183 DECLARE_EVENT_CLASS(ext4__write_begin,
184
185         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
186                  unsigned int flags),
187
188         TP_ARGS(inode, pos, len, flags),
189
190         TP_STRUCT__entry(
191                 __field(        dev_t,  dev                     )
192                 __field(        ino_t,  ino                     )
193                 __field(        loff_t, pos                     )
194                 __field(        unsigned int, len               )
195                 __field(        unsigned int, flags             )
196         ),
197
198         TP_fast_assign(
199                 __entry->dev    = inode->i_sb->s_dev;
200                 __entry->ino    = inode->i_ino;
201                 __entry->pos    = pos;
202                 __entry->len    = len;
203                 __entry->flags  = flags;
204         ),
205
206         TP_printk("dev %d,%d ino %lu pos %lld len %u flags %u",
207                   MAJOR(__entry->dev), MINOR(__entry->dev),
208                   (unsigned long) __entry->ino,
209                   __entry->pos, __entry->len, __entry->flags)
210 );
211
212 DEFINE_EVENT(ext4__write_begin, ext4_write_begin,
213
214         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
215                  unsigned int flags),
216
217         TP_ARGS(inode, pos, len, flags)
218 );
219
220 DEFINE_EVENT(ext4__write_begin, ext4_da_write_begin,
221
222         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
223                  unsigned int flags),
224
225         TP_ARGS(inode, pos, len, flags)
226 );
227
228 DECLARE_EVENT_CLASS(ext4__write_end,
229         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
230                         unsigned int copied),
231
232         TP_ARGS(inode, pos, len, copied),
233
234         TP_STRUCT__entry(
235                 __field(        dev_t,  dev                     )
236                 __field(        ino_t,  ino                     )
237                 __field(        loff_t, pos                     )
238                 __field(        unsigned int, len               )
239                 __field(        unsigned int, copied            )
240         ),
241
242         TP_fast_assign(
243                 __entry->dev    = inode->i_sb->s_dev;
244                 __entry->ino    = inode->i_ino;
245                 __entry->pos    = pos;
246                 __entry->len    = len;
247                 __entry->copied = copied;
248         ),
249
250         TP_printk("dev %d,%d ino %lu pos %lld len %u copied %u",
251                   MAJOR(__entry->dev), MINOR(__entry->dev),
252                   (unsigned long) __entry->ino,
253                   __entry->pos, __entry->len, __entry->copied)
254 );
255
256 DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end,
257
258         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
259                  unsigned int copied),
260
261         TP_ARGS(inode, pos, len, copied)
262 );
263
264 DEFINE_EVENT(ext4__write_end, ext4_writeback_write_end,
265
266         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
267                  unsigned int copied),
268
269         TP_ARGS(inode, pos, len, copied)
270 );
271
272 DEFINE_EVENT(ext4__write_end, ext4_journalled_write_end,
273
274         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
275                  unsigned int copied),
276
277         TP_ARGS(inode, pos, len, copied)
278 );
279
280 DEFINE_EVENT(ext4__write_end, ext4_da_write_end,
281
282         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
283                  unsigned int copied),
284
285         TP_ARGS(inode, pos, len, copied)
286 );
287
288 TRACE_EVENT(ext4_da_writepages,
289         TP_PROTO(struct inode *inode, struct writeback_control *wbc),
290
291         TP_ARGS(inode, wbc),
292
293         TP_STRUCT__entry(
294                 __field(        dev_t,  dev                     )
295                 __field(        ino_t,  ino                     )
296                 __field(        long,   nr_to_write             )
297                 __field(        long,   pages_skipped           )
298                 __field(        loff_t, range_start             )
299                 __field(        loff_t, range_end               )
300                 __field(        int,    sync_mode               )
301                 __field(        char,   for_kupdate             )
302                 __field(        char,   range_cyclic            )
303                 __field(       pgoff_t, writeback_index         )
304         ),
305
306         TP_fast_assign(
307                 __entry->dev            = inode->i_sb->s_dev;
308                 __entry->ino            = inode->i_ino;
309                 __entry->nr_to_write    = wbc->nr_to_write;
310                 __entry->pages_skipped  = wbc->pages_skipped;
311                 __entry->range_start    = wbc->range_start;
312                 __entry->range_end      = wbc->range_end;
313                 __entry->sync_mode      = wbc->sync_mode;
314                 __entry->for_kupdate    = wbc->for_kupdate;
315                 __entry->range_cyclic   = wbc->range_cyclic;
316                 __entry->writeback_index = inode->i_mapping->writeback_index;
317         ),
318
319         TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld "
320                   "range_start %lld range_end %lld sync_mode %d"
321                   "for_kupdate %d range_cyclic %d writeback_index %lu",
322                   MAJOR(__entry->dev), MINOR(__entry->dev),
323                   (unsigned long) __entry->ino, __entry->nr_to_write,
324                   __entry->pages_skipped, __entry->range_start,
325                   __entry->range_end, __entry->sync_mode,
326                   __entry->for_kupdate, __entry->range_cyclic,
327                   (unsigned long) __entry->writeback_index)
328 );
329
330 TRACE_EVENT(ext4_da_write_pages,
331         TP_PROTO(struct inode *inode, struct mpage_da_data *mpd),
332
333         TP_ARGS(inode, mpd),
334
335         TP_STRUCT__entry(
336                 __field(        dev_t,  dev                     )
337                 __field(        ino_t,  ino                     )
338                 __field(        __u64,  b_blocknr               )
339                 __field(        __u32,  b_size                  )
340                 __field(        __u32,  b_state                 )
341                 __field(        unsigned long,  first_page      )
342                 __field(        int,    io_done                 )
343                 __field(        int,    pages_written           )
344                 __field(        int,    sync_mode               )
345         ),
346
347         TP_fast_assign(
348                 __entry->dev            = inode->i_sb->s_dev;
349                 __entry->ino            = inode->i_ino;
350                 __entry->b_blocknr      = mpd->b_blocknr;
351                 __entry->b_size         = mpd->b_size;
352                 __entry->b_state        = mpd->b_state;
353                 __entry->first_page     = mpd->first_page;
354                 __entry->io_done        = mpd->io_done;
355                 __entry->pages_written  = mpd->pages_written;
356                 __entry->sync_mode      = mpd->wbc->sync_mode;
357         ),
358
359         TP_printk("dev %d,%d ino %lu b_blocknr %llu b_size %u b_state 0x%04x "
360                   "first_page %lu io_done %d pages_written %d sync_mode %d",
361                   MAJOR(__entry->dev), MINOR(__entry->dev),
362                   (unsigned long) __entry->ino,
363                   __entry->b_blocknr, __entry->b_size,
364                   __entry->b_state, __entry->first_page,
365                   __entry->io_done, __entry->pages_written,
366                   __entry->sync_mode
367                   )
368 );
369
370 TRACE_EVENT(ext4_da_writepages_result,
371         TP_PROTO(struct inode *inode, struct writeback_control *wbc,
372                         int ret, int pages_written),
373
374         TP_ARGS(inode, wbc, ret, pages_written),
375
376         TP_STRUCT__entry(
377                 __field(        dev_t,  dev                     )
378                 __field(        ino_t,  ino                     )
379                 __field(        int,    ret                     )
380                 __field(        int,    pages_written           )
381                 __field(        long,   pages_skipped           )
382                 __field(        int,    sync_mode               )
383                 __field(       pgoff_t, writeback_index         )
384         ),
385
386         TP_fast_assign(
387                 __entry->dev            = inode->i_sb->s_dev;
388                 __entry->ino            = inode->i_ino;
389                 __entry->ret            = ret;
390                 __entry->pages_written  = pages_written;
391                 __entry->pages_skipped  = wbc->pages_skipped;
392                 __entry->sync_mode      = wbc->sync_mode;
393                 __entry->writeback_index = inode->i_mapping->writeback_index;
394         ),
395
396         TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld "
397                   "sync_mode %d writeback_index %lu",
398                   MAJOR(__entry->dev), MINOR(__entry->dev),
399                   (unsigned long) __entry->ino, __entry->ret,
400                   __entry->pages_written, __entry->pages_skipped,
401                   __entry->sync_mode,
402                   (unsigned long) __entry->writeback_index)
403 );
404
405 DECLARE_EVENT_CLASS(ext4__page_op,
406         TP_PROTO(struct page *page),
407
408         TP_ARGS(page),
409
410         TP_STRUCT__entry(
411                 __field(        pgoff_t, index                  )
412                 __field(        ino_t,  ino                     )
413                 __field(        dev_t,  dev                     )
414
415         ),
416
417         TP_fast_assign(
418                 __entry->index  = page->index;
419                 __entry->ino    = page->mapping->host->i_ino;
420                 __entry->dev    = page->mapping->host->i_sb->s_dev;
421         ),
422
423         TP_printk("dev %d,%d ino %lu page_index %lu",
424                   MAJOR(__entry->dev), MINOR(__entry->dev),
425                   (unsigned long) __entry->ino,
426                   (unsigned long) __entry->index)
427 );
428
429 DEFINE_EVENT(ext4__page_op, ext4_writepage,
430
431         TP_PROTO(struct page *page),
432
433         TP_ARGS(page)
434 );
435
436 DEFINE_EVENT(ext4__page_op, ext4_readpage,
437
438         TP_PROTO(struct page *page),
439
440         TP_ARGS(page)
441 );
442
443 DEFINE_EVENT(ext4__page_op, ext4_releasepage,
444
445         TP_PROTO(struct page *page),
446
447         TP_ARGS(page)
448 );
449
450 TRACE_EVENT(ext4_invalidatepage,
451         TP_PROTO(struct page *page, unsigned long offset),
452
453         TP_ARGS(page, offset),
454
455         TP_STRUCT__entry(
456                 __field(        pgoff_t, index                  )
457                 __field(        unsigned long, offset           )
458                 __field(        ino_t,  ino                     )
459                 __field(        dev_t,  dev                     )
460
461         ),
462
463         TP_fast_assign(
464                 __entry->index  = page->index;
465                 __entry->offset = offset;
466                 __entry->ino    = page->mapping->host->i_ino;
467                 __entry->dev    = page->mapping->host->i_sb->s_dev;
468         ),
469
470         TP_printk("dev %d,%d ino %lu page_index %lu offset %lu",
471                   MAJOR(__entry->dev), MINOR(__entry->dev),
472                   (unsigned long) __entry->ino,
473                   (unsigned long) __entry->index, __entry->offset)
474 );
475
476 TRACE_EVENT(ext4_discard_blocks,
477         TP_PROTO(struct super_block *sb, unsigned long long blk,
478                         unsigned long long count),
479
480         TP_ARGS(sb, blk, count),
481
482         TP_STRUCT__entry(
483                 __field(        dev_t,  dev                     )
484                 __field(        __u64,  blk                     )
485                 __field(        __u64,  count                   )
486
487         ),
488
489         TP_fast_assign(
490                 __entry->dev    = sb->s_dev;
491                 __entry->blk    = blk;
492                 __entry->count  = count;
493         ),
494
495         TP_printk("dev %d,%d blk %llu count %llu",
496                   MAJOR(__entry->dev), MINOR(__entry->dev),
497                   __entry->blk, __entry->count)
498 );
499
500 DECLARE_EVENT_CLASS(ext4__mb_new_pa,
501         TP_PROTO(struct ext4_allocation_context *ac,
502                  struct ext4_prealloc_space *pa),
503
504         TP_ARGS(ac, pa),
505
506         TP_STRUCT__entry(
507                 __field(        dev_t,  dev                     )
508                 __field(        ino_t,  ino                     )
509                 __field(        __u64,  pa_pstart               )
510                 __field(        __u32,  pa_len                  )
511                 __field(        __u64,  pa_lstart               )
512
513         ),
514
515         TP_fast_assign(
516                 __entry->dev            = ac->ac_sb->s_dev;
517                 __entry->ino            = ac->ac_inode->i_ino;
518                 __entry->pa_pstart      = pa->pa_pstart;
519                 __entry->pa_len         = pa->pa_len;
520                 __entry->pa_lstart      = pa->pa_lstart;
521         ),
522
523         TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu",
524                   MAJOR(__entry->dev), MINOR(__entry->dev),
525                   (unsigned long) __entry->ino,
526                   __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
527 );
528
529 DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa,
530
531         TP_PROTO(struct ext4_allocation_context *ac,
532                  struct ext4_prealloc_space *pa),
533
534         TP_ARGS(ac, pa)
535 );
536
537 DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_group_pa,
538
539         TP_PROTO(struct ext4_allocation_context *ac,
540                  struct ext4_prealloc_space *pa),
541
542         TP_ARGS(ac, pa)
543 );
544
545 TRACE_EVENT(ext4_mb_release_inode_pa,
546         TP_PROTO(struct ext4_prealloc_space *pa,
547                  unsigned long long block, unsigned int count),
548
549         TP_ARGS(pa, block, count),
550
551         TP_STRUCT__entry(
552                 __field(        dev_t,  dev                     )
553                 __field(        ino_t,  ino                     )
554                 __field(        __u64,  block                   )
555                 __field(        __u32,  count                   )
556
557         ),
558
559         TP_fast_assign(
560                 __entry->dev            = pa->pa_inode->i_sb->s_dev;
561                 __entry->ino            = pa->pa_inode->i_ino;
562                 __entry->block          = block;
563                 __entry->count          = count;
564         ),
565
566         TP_printk("dev %d,%d ino %lu block %llu count %u",
567                   MAJOR(__entry->dev), MINOR(__entry->dev),
568                   (unsigned long) __entry->ino,
569                   __entry->block, __entry->count)
570 );
571
572 TRACE_EVENT(ext4_mb_release_group_pa,
573         TP_PROTO(struct ext4_prealloc_space *pa),
574
575         TP_ARGS(pa),
576
577         TP_STRUCT__entry(
578                 __field(        dev_t,  dev                     )
579                 __field(        __u64,  pa_pstart               )
580                 __field(        __u32,  pa_len                  )
581
582         ),
583
584         TP_fast_assign(
585                 __entry->dev            = pa->pa_inode->i_sb->s_dev;
586                 __entry->pa_pstart      = pa->pa_pstart;
587                 __entry->pa_len         = pa->pa_len;
588         ),
589
590         TP_printk("dev %d,%d pstart %llu len %u",
591                   MAJOR(__entry->dev), MINOR(__entry->dev),
592                   __entry->pa_pstart, __entry->pa_len)
593 );
594
595 TRACE_EVENT(ext4_discard_preallocations,
596         TP_PROTO(struct inode *inode),
597
598         TP_ARGS(inode),
599
600         TP_STRUCT__entry(
601                 __field(        dev_t,  dev                     )
602                 __field(        ino_t,  ino                     )
603
604         ),
605
606         TP_fast_assign(
607                 __entry->dev    = inode->i_sb->s_dev;
608                 __entry->ino    = inode->i_ino;
609         ),
610
611         TP_printk("dev %d,%d ino %lu",
612                   MAJOR(__entry->dev), MINOR(__entry->dev),
613                   (unsigned long) __entry->ino)
614 );
615
616 TRACE_EVENT(ext4_mb_discard_preallocations,
617         TP_PROTO(struct super_block *sb, int needed),
618
619         TP_ARGS(sb, needed),
620
621         TP_STRUCT__entry(
622                 __field(        dev_t,  dev                     )
623                 __field(        int,    needed                  )
624
625         ),
626
627         TP_fast_assign(
628                 __entry->dev    = sb->s_dev;
629                 __entry->needed = needed;
630         ),
631
632         TP_printk("dev %d,%d needed %d",
633                   MAJOR(__entry->dev), MINOR(__entry->dev),
634                   __entry->needed)
635 );
636
637 TRACE_EVENT(ext4_request_blocks,
638         TP_PROTO(struct ext4_allocation_request *ar),
639
640         TP_ARGS(ar),
641
642         TP_STRUCT__entry(
643                 __field(        dev_t,  dev                     )
644                 __field(        ino_t,  ino                     )
645                 __field(        unsigned int, flags             )
646                 __field(        unsigned int, len               )
647                 __field(        __u32,  logical                 )
648                 __field(        __u32,  lleft                   )
649                 __field(        __u32,  lright                  )
650                 __field(        __u64,  goal                    )
651                 __field(        __u64,  pleft                   )
652                 __field(        __u64,  pright                  )
653         ),
654
655         TP_fast_assign(
656                 __entry->dev    = ar->inode->i_sb->s_dev;
657                 __entry->ino    = ar->inode->i_ino;
658                 __entry->flags  = ar->flags;
659                 __entry->len    = ar->len;
660                 __entry->logical = ar->logical;
661                 __entry->goal   = ar->goal;
662                 __entry->lleft  = ar->lleft;
663                 __entry->lright = ar->lright;
664                 __entry->pleft  = ar->pleft;
665                 __entry->pright = ar->pright;
666         ),
667
668         TP_printk("dev %d,%d ino %lu flags %u len %u lblk %u goal %llu "
669                   "lleft %u lright %u pleft %llu pright %llu ",
670                   MAJOR(__entry->dev), MINOR(__entry->dev),
671                   (unsigned long) __entry->ino, __entry->flags,
672                   __entry->len, __entry->logical, __entry->goal,
673                   __entry->lleft, __entry->lright, __entry->pleft,
674                   __entry->pright)
675 );
676
677 TRACE_EVENT(ext4_allocate_blocks,
678         TP_PROTO(struct ext4_allocation_request *ar, unsigned long long block),
679
680         TP_ARGS(ar, block),
681
682         TP_STRUCT__entry(
683                 __field(        dev_t,  dev                     )
684                 __field(        ino_t,  ino                     )
685                 __field(        __u64,  block                   )
686                 __field(        unsigned int, flags             )
687                 __field(        unsigned int, len               )
688                 __field(        __u32,  logical                 )
689                 __field(        __u32,  lleft                   )
690                 __field(        __u32,  lright                  )
691                 __field(        __u64,  goal                    )
692                 __field(        __u64,  pleft                   )
693                 __field(        __u64,  pright                  )
694         ),
695
696         TP_fast_assign(
697                 __entry->dev    = ar->inode->i_sb->s_dev;
698                 __entry->ino    = ar->inode->i_ino;
699                 __entry->block  = block;
700                 __entry->flags  = ar->flags;
701                 __entry->len    = ar->len;
702                 __entry->logical = ar->logical;
703                 __entry->goal   = ar->goal;
704                 __entry->lleft  = ar->lleft;
705                 __entry->lright = ar->lright;
706                 __entry->pleft  = ar->pleft;
707                 __entry->pright = ar->pright;
708         ),
709
710         TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %u "
711                   "goal %llu lleft %u lright %u pleft %llu pright %llu",
712                   MAJOR(__entry->dev), MINOR(__entry->dev),
713                   (unsigned long) __entry->ino, __entry->flags,
714                   __entry->len, __entry->block, __entry->logical,
715                   __entry->goal,  __entry->lleft, __entry->lright,
716                   __entry->pleft, __entry->pright)
717 );
718
719 TRACE_EVENT(ext4_free_blocks,
720         TP_PROTO(struct inode *inode, __u64 block, unsigned long count,
721                  int flags),
722
723         TP_ARGS(inode, block, count, flags),
724
725         TP_STRUCT__entry(
726                 __field(        dev_t,  dev                     )
727                 __field(        ino_t,  ino                     )
728                 __field(        __u16,  mode                    )
729                 __field(        __u64,  block                   )
730                 __field(        unsigned long,  count           )
731                 __field(        int,    flags                   )
732         ),
733
734         TP_fast_assign(
735                 __entry->dev            = inode->i_sb->s_dev;
736                 __entry->ino            = inode->i_ino;
737                 __entry->mode           = inode->i_mode;
738                 __entry->block          = block;
739                 __entry->count          = count;
740                 __entry->flags          = flags;
741         ),
742
743         TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %d",
744                   MAJOR(__entry->dev), MINOR(__entry->dev),
745                   (unsigned long) __entry->ino,
746                   __entry->mode, __entry->block, __entry->count,
747                   __entry->flags)
748 );
749
750 TRACE_EVENT(ext4_sync_file_enter,
751         TP_PROTO(struct file *file, int datasync),
752
753         TP_ARGS(file, datasync),
754
755         TP_STRUCT__entry(
756                 __field(        dev_t,  dev                     )
757                 __field(        ino_t,  ino                     )
758                 __field(        ino_t,  parent                  )
759                 __field(        int,    datasync                )
760         ),
761
762         TP_fast_assign(
763                 struct dentry *dentry = file->f_path.dentry;
764
765                 __entry->dev            = dentry->d_inode->i_sb->s_dev;
766                 __entry->ino            = dentry->d_inode->i_ino;
767                 __entry->datasync       = datasync;
768                 __entry->parent         = dentry->d_parent->d_inode->i_ino;
769         ),
770
771         TP_printk("dev %d,%d ino %lu parent %lu datasync %d ",
772                   MAJOR(__entry->dev), MINOR(__entry->dev),
773                   (unsigned long) __entry->ino,
774                   (unsigned long) __entry->parent, __entry->datasync)
775 );
776
777 TRACE_EVENT(ext4_sync_file_exit,
778         TP_PROTO(struct inode *inode, int ret),
779
780         TP_ARGS(inode, ret),
781
782         TP_STRUCT__entry(
783                 __field(        int,    ret                     )
784                 __field(        ino_t,  ino                     )
785                 __field(        dev_t,  dev                     )
786         ),
787
788         TP_fast_assign(
789                 __entry->ret            = ret;
790                 __entry->ino            = inode->i_ino;
791                 __entry->dev            = inode->i_sb->s_dev;
792         ),
793
794         TP_printk("dev %d,%d ino %lu ret %d",
795                   MAJOR(__entry->dev), MINOR(__entry->dev),
796                   (unsigned long) __entry->ino,
797                   __entry->ret)
798 );
799
800 TRACE_EVENT(ext4_sync_fs,
801         TP_PROTO(struct super_block *sb, int wait),
802
803         TP_ARGS(sb, wait),
804
805         TP_STRUCT__entry(
806                 __field(        dev_t,  dev                     )
807                 __field(        int,    wait                    )
808
809         ),
810
811         TP_fast_assign(
812                 __entry->dev    = sb->s_dev;
813                 __entry->wait   = wait;
814         ),
815
816         TP_printk("dev %d,%d wait %d",
817                   MAJOR(__entry->dev), MINOR(__entry->dev),
818                   __entry->wait)
819 );
820
821 TRACE_EVENT(ext4_alloc_da_blocks,
822         TP_PROTO(struct inode *inode),
823
824         TP_ARGS(inode),
825
826         TP_STRUCT__entry(
827                 __field(        dev_t,  dev                     )
828                 __field(        ino_t,  ino                     )
829                 __field( unsigned int,  data_blocks     )
830                 __field( unsigned int,  meta_blocks     )
831         ),
832
833         TP_fast_assign(
834                 __entry->dev    = inode->i_sb->s_dev;
835                 __entry->ino    = inode->i_ino;
836                 __entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
837                 __entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
838         ),
839
840         TP_printk("dev %d,%d ino %lu data_blocks %u meta_blocks %u",
841                   MAJOR(__entry->dev), MINOR(__entry->dev),
842                   (unsigned long) __entry->ino,
843                   __entry->data_blocks, __entry->meta_blocks)
844 );
845
846 TRACE_EVENT(ext4_mballoc_alloc,
847         TP_PROTO(struct ext4_allocation_context *ac),
848
849         TP_ARGS(ac),
850
851         TP_STRUCT__entry(
852                 __field(        dev_t,  dev                     )
853                 __field(        ino_t,  ino                     )
854                 __field(        __u16,  found                   )
855                 __field(        __u16,  groups                  )
856                 __field(        __u16,  buddy                   )
857                 __field(        __u16,  flags                   )
858                 __field(        __u16,  tail                    )
859                 __field(        __u8,   cr                      )
860                 __field(        __u32,  orig_logical            )
861                 __field(          int,  orig_start              )
862                 __field(        __u32,  orig_group              )
863                 __field(          int,  orig_len                )
864                 __field(        __u32,  goal_logical            )
865                 __field(          int,  goal_start              )
866                 __field(        __u32,  goal_group              )
867                 __field(          int,  goal_len                )
868                 __field(        __u32,  result_logical          )
869                 __field(          int,  result_start            )
870                 __field(        __u32,  result_group            )
871                 __field(          int,  result_len              )
872         ),
873
874         TP_fast_assign(
875                 __entry->dev            = ac->ac_inode->i_sb->s_dev;
876                 __entry->ino            = ac->ac_inode->i_ino;
877                 __entry->found          = ac->ac_found;
878                 __entry->flags          = ac->ac_flags;
879                 __entry->groups         = ac->ac_groups_scanned;
880                 __entry->buddy          = ac->ac_buddy;
881                 __entry->tail           = ac->ac_tail;
882                 __entry->cr             = ac->ac_criteria;
883                 __entry->orig_logical   = ac->ac_o_ex.fe_logical;
884                 __entry->orig_start     = ac->ac_o_ex.fe_start;
885                 __entry->orig_group     = ac->ac_o_ex.fe_group;
886                 __entry->orig_len       = ac->ac_o_ex.fe_len;
887                 __entry->goal_logical   = ac->ac_g_ex.fe_logical;
888                 __entry->goal_start     = ac->ac_g_ex.fe_start;
889                 __entry->goal_group     = ac->ac_g_ex.fe_group;
890                 __entry->goal_len       = ac->ac_g_ex.fe_len;
891                 __entry->result_logical = ac->ac_f_ex.fe_logical;
892                 __entry->result_start   = ac->ac_f_ex.fe_start;
893                 __entry->result_group   = ac->ac_f_ex.fe_group;
894                 __entry->result_len     = ac->ac_f_ex.fe_len;
895         ),
896
897         TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
898                   "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x "
899                   "tail %u broken %u",
900                   MAJOR(__entry->dev), MINOR(__entry->dev),
901                   (unsigned long) __entry->ino,
902                   __entry->orig_group, __entry->orig_start,
903                   __entry->orig_len, __entry->orig_logical,
904                   __entry->goal_group, __entry->goal_start,
905                   __entry->goal_len, __entry->goal_logical,
906                   __entry->result_group, __entry->result_start,
907                   __entry->result_len, __entry->result_logical,
908                   __entry->found, __entry->groups, __entry->cr,
909                   __entry->flags, __entry->tail,
910                   __entry->buddy ? 1 << __entry->buddy : 0)
911 );
912
913 TRACE_EVENT(ext4_mballoc_prealloc,
914         TP_PROTO(struct ext4_allocation_context *ac),
915
916         TP_ARGS(ac),
917
918         TP_STRUCT__entry(
919                 __field(        dev_t,  dev                     )
920                 __field(        ino_t,  ino                     )
921                 __field(        __u32,  orig_logical            )
922                 __field(          int,  orig_start              )
923                 __field(        __u32,  orig_group              )
924                 __field(          int,  orig_len                )
925                 __field(        __u32,  result_logical          )
926                 __field(          int,  result_start            )
927                 __field(        __u32,  result_group            )
928                 __field(          int,  result_len              )
929         ),
930
931         TP_fast_assign(
932                 __entry->dev            = ac->ac_inode->i_sb->s_dev;
933                 __entry->ino            = ac->ac_inode->i_ino;
934                 __entry->orig_logical   = ac->ac_o_ex.fe_logical;
935                 __entry->orig_start     = ac->ac_o_ex.fe_start;
936                 __entry->orig_group     = ac->ac_o_ex.fe_group;
937                 __entry->orig_len       = ac->ac_o_ex.fe_len;
938                 __entry->result_logical = ac->ac_b_ex.fe_logical;
939                 __entry->result_start   = ac->ac_b_ex.fe_start;
940                 __entry->result_group   = ac->ac_b_ex.fe_group;
941                 __entry->result_len     = ac->ac_b_ex.fe_len;
942         ),
943
944         TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
945                   MAJOR(__entry->dev), MINOR(__entry->dev),
946                   (unsigned long) __entry->ino,
947                   __entry->orig_group, __entry->orig_start,
948                   __entry->orig_len, __entry->orig_logical,
949                   __entry->result_group, __entry->result_start,
950                   __entry->result_len, __entry->result_logical)
951 );
952
953 DECLARE_EVENT_CLASS(ext4__mballoc,
954         TP_PROTO(struct super_block *sb,
955                  struct inode *inode,
956                  ext4_group_t group,
957                  ext4_grpblk_t start,
958                  ext4_grpblk_t len),
959
960         TP_ARGS(sb, inode, group, start, len),
961
962         TP_STRUCT__entry(
963                 __field(        dev_t,  dev                     )
964                 __field(        ino_t,  ino                     )
965                 __field(          int,  result_start            )
966                 __field(        __u32,  result_group            )
967                 __field(          int,  result_len              )
968         ),
969
970         TP_fast_assign(
971                 __entry->dev            = sb->s_dev;
972                 __entry->ino            = inode ? inode->i_ino : 0;
973                 __entry->result_start   = start;
974                 __entry->result_group   = group;
975                 __entry->result_len     = len;
976         ),
977
978         TP_printk("dev %d,%d inode %lu extent %u/%d/%d ",
979                   MAJOR(__entry->dev), MINOR(__entry->dev),
980                   (unsigned long) __entry->ino,
981                   __entry->result_group, __entry->result_start,
982                   __entry->result_len)
983 );
984
985 DEFINE_EVENT(ext4__mballoc, ext4_mballoc_discard,
986
987         TP_PROTO(struct super_block *sb,
988                  struct inode *inode,
989                  ext4_group_t group,
990                  ext4_grpblk_t start,
991                  ext4_grpblk_t len),
992
993         TP_ARGS(sb, inode, group, start, len)
994 );
995
996 DEFINE_EVENT(ext4__mballoc, ext4_mballoc_free,
997
998         TP_PROTO(struct super_block *sb,
999                  struct inode *inode,
1000                  ext4_group_t group,
1001                  ext4_grpblk_t start,
1002                  ext4_grpblk_t len),
1003
1004         TP_ARGS(sb, inode, group, start, len)
1005 );
1006
1007 TRACE_EVENT(ext4_forget,
1008         TP_PROTO(struct inode *inode, int is_metadata, __u64 block),
1009
1010         TP_ARGS(inode, is_metadata, block),
1011
1012         TP_STRUCT__entry(
1013                 __field(        dev_t,  dev                     )
1014                 __field(        ino_t,  ino                     )
1015                 __field(        __u16,  mode                    )
1016                 __field(        int,    is_metadata             )
1017                 __field(        __u64,  block                   )
1018         ),
1019
1020         TP_fast_assign(
1021                 __entry->dev    = inode->i_sb->s_dev;
1022                 __entry->ino    = inode->i_ino;
1023                 __entry->mode   = inode->i_mode;
1024                 __entry->is_metadata = is_metadata;
1025                 __entry->block  = block;
1026         ),
1027
1028         TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu",
1029                   MAJOR(__entry->dev), MINOR(__entry->dev),
1030                   (unsigned long) __entry->ino,
1031                   __entry->mode, __entry->is_metadata, __entry->block)
1032 );
1033
1034 TRACE_EVENT(ext4_da_update_reserve_space,
1035         TP_PROTO(struct inode *inode, int used_blocks),
1036
1037         TP_ARGS(inode, used_blocks),
1038
1039         TP_STRUCT__entry(
1040                 __field(        dev_t,  dev                     )
1041                 __field(        ino_t,  ino                     )
1042                 __field(        __u16,  mode                    )
1043                 __field(        __u64,  i_blocks                )
1044                 __field(        int,    used_blocks             )
1045                 __field(        int,    reserved_data_blocks    )
1046                 __field(        int,    reserved_meta_blocks    )
1047                 __field(        int,    allocated_meta_blocks   )
1048         ),
1049
1050         TP_fast_assign(
1051                 __entry->dev    = inode->i_sb->s_dev;
1052                 __entry->ino    = inode->i_ino;
1053                 __entry->mode   = inode->i_mode;
1054                 __entry->i_blocks = inode->i_blocks;
1055                 __entry->used_blocks = used_blocks;
1056                 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1057                 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1058                 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
1059         ),
1060
1061         TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d "
1062                   "reserved_data_blocks %d reserved_meta_blocks %d "
1063                   "allocated_meta_blocks %d",
1064                   MAJOR(__entry->dev), MINOR(__entry->dev),
1065                   (unsigned long) __entry->ino,
1066                   __entry->mode, __entry->i_blocks,
1067                   __entry->used_blocks, __entry->reserved_data_blocks,
1068                   __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
1069 );
1070
1071 TRACE_EVENT(ext4_da_reserve_space,
1072         TP_PROTO(struct inode *inode, int md_needed),
1073
1074         TP_ARGS(inode, md_needed),
1075
1076         TP_STRUCT__entry(
1077                 __field(        dev_t,  dev                     )
1078                 __field(        ino_t,  ino                     )
1079                 __field(        __u16,  mode                    )
1080                 __field(        __u64,  i_blocks                )
1081                 __field(        int,    md_needed               )
1082                 __field(        int,    reserved_data_blocks    )
1083                 __field(        int,    reserved_meta_blocks    )
1084         ),
1085
1086         TP_fast_assign(
1087                 __entry->dev    = inode->i_sb->s_dev;
1088                 __entry->ino    = inode->i_ino;
1089                 __entry->mode   = inode->i_mode;
1090                 __entry->i_blocks = inode->i_blocks;
1091                 __entry->md_needed = md_needed;
1092                 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1093                 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1094         ),
1095
1096         TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu md_needed %d "
1097                   "reserved_data_blocks %d reserved_meta_blocks %d",
1098                   MAJOR(__entry->dev), MINOR(__entry->dev),
1099                   (unsigned long) __entry->ino,
1100                   __entry->mode, __entry->i_blocks,
1101                   __entry->md_needed, __entry->reserved_data_blocks,
1102                   __entry->reserved_meta_blocks)
1103 );
1104
1105 TRACE_EVENT(ext4_da_release_space,
1106         TP_PROTO(struct inode *inode, int freed_blocks),
1107
1108         TP_ARGS(inode, freed_blocks),
1109
1110         TP_STRUCT__entry(
1111                 __field(        dev_t,  dev                     )
1112                 __field(        ino_t,  ino                     )
1113                 __field(        __u16,  mode                    )
1114                 __field(        __u64,  i_blocks                )
1115                 __field(        int,    freed_blocks            )
1116                 __field(        int,    reserved_data_blocks    )
1117                 __field(        int,    reserved_meta_blocks    )
1118                 __field(        int,    allocated_meta_blocks   )
1119         ),
1120
1121         TP_fast_assign(
1122                 __entry->dev    = inode->i_sb->s_dev;
1123                 __entry->ino    = inode->i_ino;
1124                 __entry->mode   = inode->i_mode;
1125                 __entry->i_blocks = inode->i_blocks;
1126                 __entry->freed_blocks = freed_blocks;
1127                 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1128                 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1129                 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
1130         ),
1131
1132         TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d "
1133                   "reserved_data_blocks %d reserved_meta_blocks %d "
1134                   "allocated_meta_blocks %d",
1135                   MAJOR(__entry->dev), MINOR(__entry->dev),
1136                   (unsigned long) __entry->ino,
1137                   __entry->mode, __entry->i_blocks,
1138                   __entry->freed_blocks, __entry->reserved_data_blocks,
1139                   __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
1140 );
1141
1142 DECLARE_EVENT_CLASS(ext4__bitmap_load,
1143         TP_PROTO(struct super_block *sb, unsigned long group),
1144
1145         TP_ARGS(sb, group),
1146
1147         TP_STRUCT__entry(
1148                 __field(        dev_t,  dev                     )
1149                 __field(        __u32,  group                   )
1150
1151         ),
1152
1153         TP_fast_assign(
1154                 __entry->dev    = sb->s_dev;
1155                 __entry->group  = group;
1156         ),
1157
1158         TP_printk("dev %d,%d group %u",
1159                   MAJOR(__entry->dev), MINOR(__entry->dev),
1160                   __entry->group)
1161 );
1162
1163 DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load,
1164
1165         TP_PROTO(struct super_block *sb, unsigned long group),
1166
1167         TP_ARGS(sb, group)
1168 );
1169
1170 DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
1171
1172         TP_PROTO(struct super_block *sb, unsigned long group),
1173
1174         TP_ARGS(sb, group)
1175 );
1176
1177 DEFINE_EVENT(ext4__bitmap_load, ext4_read_block_bitmap_load,
1178
1179         TP_PROTO(struct super_block *sb, unsigned long group),
1180
1181         TP_ARGS(sb, group)
1182 );
1183
1184 DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
1185
1186         TP_PROTO(struct super_block *sb, unsigned long group),
1187
1188         TP_ARGS(sb, group)
1189 );
1190
1191 TRACE_EVENT(ext4_direct_IO_enter,
1192         TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
1193
1194         TP_ARGS(inode, offset, len, rw),
1195
1196         TP_STRUCT__entry(
1197                 __field(        ino_t,  ino                     )
1198                 __field(        dev_t,  dev                     )
1199                 __field(        loff_t, pos                     )
1200                 __field(        unsigned long,  len             )
1201                 __field(        int,    rw                      )
1202         ),
1203
1204         TP_fast_assign(
1205                 __entry->ino    = inode->i_ino;
1206                 __entry->dev    = inode->i_sb->s_dev;
1207                 __entry->pos    = offset;
1208                 __entry->len    = len;
1209                 __entry->rw     = rw;
1210         ),
1211
1212         TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d",
1213                   MAJOR(__entry->dev), MINOR(__entry->dev),
1214                   (unsigned long) __entry->ino,
1215                   __entry->pos, __entry->len, __entry->rw)
1216 );
1217
1218 TRACE_EVENT(ext4_direct_IO_exit,
1219         TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
1220                  int rw, int ret),
1221
1222         TP_ARGS(inode, offset, len, rw, ret),
1223
1224         TP_STRUCT__entry(
1225                 __field(        ino_t,  ino                     )
1226                 __field(        dev_t,  dev                     )
1227                 __field(        loff_t, pos                     )
1228                 __field(        unsigned long,  len             )
1229                 __field(        int,    rw                      )
1230                 __field(        int,    ret                     )
1231         ),
1232
1233         TP_fast_assign(
1234                 __entry->ino    = inode->i_ino;
1235                 __entry->dev    = inode->i_sb->s_dev;
1236                 __entry->pos    = offset;
1237                 __entry->len    = len;
1238                 __entry->rw     = rw;
1239                 __entry->ret    = ret;
1240         ),
1241
1242         TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d ret %d",
1243                   MAJOR(__entry->dev), MINOR(__entry->dev),
1244                   (unsigned long) __entry->ino,
1245                   __entry->pos, __entry->len,
1246                   __entry->rw, __entry->ret)
1247 );
1248
1249 TRACE_EVENT(ext4_fallocate_enter,
1250         TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1251
1252         TP_ARGS(inode, offset, len, mode),
1253
1254         TP_STRUCT__entry(
1255                 __field(        ino_t,  ino                     )
1256                 __field(        dev_t,  dev                     )
1257                 __field(        loff_t, pos                     )
1258                 __field(        loff_t, len                     )
1259                 __field(        int,    mode                    )
1260         ),
1261
1262         TP_fast_assign(
1263                 __entry->ino    = inode->i_ino;
1264                 __entry->dev    = inode->i_sb->s_dev;
1265                 __entry->pos    = offset;
1266                 __entry->len    = len;
1267                 __entry->mode   = mode;
1268         ),
1269
1270         TP_printk("dev %d,%d ino %lu pos %lld len %lld mode %d",
1271                   MAJOR(__entry->dev), MINOR(__entry->dev),
1272                   (unsigned long) __entry->ino, __entry->pos,
1273                   __entry->len, __entry->mode)
1274 );
1275
1276 TRACE_EVENT(ext4_fallocate_exit,
1277         TP_PROTO(struct inode *inode, loff_t offset,
1278                  unsigned int max_blocks, int ret),
1279
1280         TP_ARGS(inode, offset, max_blocks, ret),
1281
1282         TP_STRUCT__entry(
1283                 __field(        ino_t,  ino                     )
1284                 __field(        dev_t,  dev                     )
1285                 __field(        loff_t, pos                     )
1286                 __field(        unsigned int,   blocks          )
1287                 __field(        int,    ret                     )
1288         ),
1289
1290         TP_fast_assign(
1291                 __entry->ino    = inode->i_ino;
1292                 __entry->dev    = inode->i_sb->s_dev;
1293                 __entry->pos    = offset;
1294                 __entry->blocks = max_blocks;
1295                 __entry->ret    = ret;
1296         ),
1297
1298         TP_printk("dev %d,%d ino %lu pos %lld blocks %u ret %d",
1299                   MAJOR(__entry->dev), MINOR(__entry->dev),
1300                   (unsigned long) __entry->ino,
1301                   __entry->pos, __entry->blocks,
1302                   __entry->ret)
1303 );
1304
1305 TRACE_EVENT(ext4_unlink_enter,
1306         TP_PROTO(struct inode *parent, struct dentry *dentry),
1307
1308         TP_ARGS(parent, dentry),
1309
1310         TP_STRUCT__entry(
1311                 __field(        ino_t,  parent                  )
1312                 __field(        ino_t,  ino                     )
1313                 __field(        loff_t, size                    )
1314                 __field(        dev_t,  dev                     )
1315         ),
1316
1317         TP_fast_assign(
1318                 __entry->parent         = parent->i_ino;
1319                 __entry->ino            = dentry->d_inode->i_ino;
1320                 __entry->size           = dentry->d_inode->i_size;
1321                 __entry->dev            = dentry->d_inode->i_sb->s_dev;
1322         ),
1323
1324         TP_printk("dev %d,%d ino %lu size %lld parent %lu",
1325                   MAJOR(__entry->dev), MINOR(__entry->dev),
1326                   (unsigned long) __entry->ino, __entry->size,
1327                   (unsigned long) __entry->parent)
1328 );
1329
1330 TRACE_EVENT(ext4_unlink_exit,
1331         TP_PROTO(struct dentry *dentry, int ret),
1332
1333         TP_ARGS(dentry, ret),
1334
1335         TP_STRUCT__entry(
1336                 __field(        ino_t,  ino                     )
1337                 __field(        dev_t,  dev                     )
1338                 __field(        int,    ret                     )
1339         ),
1340
1341         TP_fast_assign(
1342                 __entry->ino            = dentry->d_inode->i_ino;
1343                 __entry->dev            = dentry->d_inode->i_sb->s_dev;
1344                 __entry->ret            = ret;
1345         ),
1346
1347         TP_printk("dev %d,%d ino %lu ret %d",
1348                   MAJOR(__entry->dev), MINOR(__entry->dev),
1349                   (unsigned long) __entry->ino,
1350                   __entry->ret)
1351 );
1352
1353 DECLARE_EVENT_CLASS(ext4__truncate,
1354         TP_PROTO(struct inode *inode),
1355
1356         TP_ARGS(inode),
1357
1358         TP_STRUCT__entry(
1359                 __field(        ino_t,          ino             )
1360                 __field(        dev_t,          dev             )
1361                 __field(        __u64,          blocks          )
1362         ),
1363
1364         TP_fast_assign(
1365                 __entry->ino    = inode->i_ino;
1366                 __entry->dev    = inode->i_sb->s_dev;
1367                 __entry->blocks = inode->i_blocks;
1368         ),
1369
1370         TP_printk("dev %d,%d ino %lu blocks %llu",
1371                   MAJOR(__entry->dev), MINOR(__entry->dev),
1372                   (unsigned long) __entry->ino, __entry->blocks)
1373 );
1374
1375 DEFINE_EVENT(ext4__truncate, ext4_truncate_enter,
1376
1377         TP_PROTO(struct inode *inode),
1378
1379         TP_ARGS(inode)
1380 );
1381
1382 DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,
1383
1384         TP_PROTO(struct inode *inode),
1385
1386         TP_ARGS(inode)
1387 );
1388
1389 DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
1390         TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1391                  unsigned int len, unsigned int flags),
1392
1393         TP_ARGS(inode, lblk, len, flags),
1394
1395         TP_STRUCT__entry(
1396                 __field(        ino_t,          ino             )
1397                 __field(        dev_t,          dev             )
1398                 __field(        ext4_lblk_t,    lblk            )
1399                 __field(        unsigned int,   len             )
1400                 __field(        unsigned int,   flags           )
1401         ),
1402
1403         TP_fast_assign(
1404                 __entry->ino    = inode->i_ino;
1405                 __entry->dev    = inode->i_sb->s_dev;
1406                 __entry->lblk   = lblk;
1407                 __entry->len    = len;
1408                 __entry->flags  = flags;
1409         ),
1410
1411         TP_printk("dev %d,%d ino %lu lblk %u len %u flags %u",
1412                   MAJOR(__entry->dev), MINOR(__entry->dev),
1413                   (unsigned long) __entry->ino,
1414                   __entry->lblk, __entry->len, __entry->flags)
1415 );
1416
1417 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter,
1418         TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1419                  unsigned len, unsigned flags),
1420
1421         TP_ARGS(inode, lblk, len, flags)
1422 );
1423
1424 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
1425         TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1426                  unsigned len, unsigned flags),
1427
1428         TP_ARGS(inode, lblk, len, flags)
1429 );
1430
1431 DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1432         TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1433                  ext4_fsblk_t pblk, unsigned int len, int ret),
1434
1435         TP_ARGS(inode, lblk, pblk, len, ret),
1436
1437         TP_STRUCT__entry(
1438                 __field(        ino_t,          ino             )
1439                 __field(        dev_t,          dev             )
1440                 __field(        ext4_lblk_t,    lblk            )
1441                 __field(        ext4_fsblk_t,   pblk            )
1442                 __field(        unsigned int,   len             )
1443                 __field(        int,            ret             )
1444         ),
1445
1446         TP_fast_assign(
1447                 __entry->ino    = inode->i_ino;
1448                 __entry->dev    = inode->i_sb->s_dev;
1449                 __entry->lblk   = lblk;
1450                 __entry->pblk   = pblk;
1451                 __entry->len    = len;
1452                 __entry->ret    = ret;
1453         ),
1454
1455         TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u ret %d",
1456                   MAJOR(__entry->dev), MINOR(__entry->dev),
1457                   (unsigned long) __entry->ino,
1458                   __entry->lblk, __entry->pblk,
1459                   __entry->len, __entry->ret)
1460 );
1461
1462 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1463         TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1464                  ext4_fsblk_t pblk, unsigned len, int ret),
1465
1466         TP_ARGS(inode, lblk, pblk, len, ret)
1467 );
1468
1469 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1470         TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1471                  ext4_fsblk_t pblk, unsigned len, int ret),
1472
1473         TP_ARGS(inode, lblk, pblk, len, ret)
1474 );
1475
1476 TRACE_EVENT(ext4_ext_load_extent,
1477         TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk),
1478
1479         TP_ARGS(inode, lblk, pblk),
1480
1481         TP_STRUCT__entry(
1482                 __field(        ino_t,          ino             )
1483                 __field(        dev_t,          dev             )
1484                 __field(        ext4_lblk_t,    lblk            )
1485                 __field(        ext4_fsblk_t,   pblk            )
1486         ),
1487
1488         TP_fast_assign(
1489                 __entry->ino    = inode->i_ino;
1490                 __entry->dev    = inode->i_sb->s_dev;
1491                 __entry->lblk   = lblk;
1492                 __entry->pblk   = pblk;
1493         ),
1494
1495         TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
1496                   MAJOR(__entry->dev), MINOR(__entry->dev),
1497                   (unsigned long) __entry->ino,
1498                   __entry->lblk, __entry->pblk)
1499 );
1500
1501 TRACE_EVENT(ext4_load_inode,
1502         TP_PROTO(struct inode *inode),
1503
1504         TP_ARGS(inode),
1505
1506         TP_STRUCT__entry(
1507                 __field(        ino_t,  ino             )
1508                 __field(        dev_t,  dev             )
1509         ),
1510
1511         TP_fast_assign(
1512                 __entry->ino            = inode->i_ino;
1513                 __entry->dev            = inode->i_sb->s_dev;
1514         ),
1515
1516         TP_printk("dev %d,%d ino %ld",
1517                   MAJOR(__entry->dev), MINOR(__entry->dev),
1518                   (unsigned long) __entry->ino)
1519 );
1520
1521 TRACE_EVENT(ext4_journal_start,
1522         TP_PROTO(struct super_block *sb, int nblocks, unsigned long IP),
1523
1524         TP_ARGS(sb, nblocks, IP),
1525
1526         TP_STRUCT__entry(
1527                 __field(        dev_t,  dev                     )
1528                 __field(          int,  nblocks                 )
1529                 __field(unsigned long,  ip                      )
1530         ),
1531
1532         TP_fast_assign(
1533                 __entry->dev     = sb->s_dev;
1534                 __entry->nblocks = nblocks;
1535                 __entry->ip      = IP;
1536         ),
1537
1538         TP_printk("dev %d,%d nblocks %d caller %pF",
1539                   MAJOR(__entry->dev), MINOR(__entry->dev),
1540                   __entry->nblocks, (void *)__entry->ip)
1541 );
1542
1543 DECLARE_EVENT_CLASS(ext4__trim,
1544         TP_PROTO(struct super_block *sb,
1545                  ext4_group_t group,
1546                  ext4_grpblk_t start,
1547                  ext4_grpblk_t len),
1548
1549         TP_ARGS(sb, group, start, len),
1550
1551         TP_STRUCT__entry(
1552                 __field(        int,    dev_major               )
1553                 __field(        int,    dev_minor               )
1554                 __field(        __u32,  group                   )
1555                 __field(        int,    start                   )
1556                 __field(        int,    len                     )
1557         ),
1558
1559         TP_fast_assign(
1560                 __entry->dev_major      = MAJOR(sb->s_dev);
1561                 __entry->dev_minor      = MINOR(sb->s_dev);
1562                 __entry->group          = group;
1563                 __entry->start          = start;
1564                 __entry->len            = len;
1565         ),
1566
1567         TP_printk("dev %d,%d group %u, start %d, len %d",
1568                   __entry->dev_major, __entry->dev_minor,
1569                   __entry->group, __entry->start, __entry->len)
1570 );
1571
1572 DEFINE_EVENT(ext4__trim, ext4_trim_extent,
1573
1574         TP_PROTO(struct super_block *sb,
1575                  ext4_group_t group,
1576                  ext4_grpblk_t start,
1577                  ext4_grpblk_t len),
1578
1579         TP_ARGS(sb, group, start, len)
1580 );
1581
1582 DEFINE_EVENT(ext4__trim, ext4_trim_all_free,
1583
1584         TP_PROTO(struct super_block *sb,
1585                  ext4_group_t group,
1586                  ext4_grpblk_t start,
1587                  ext4_grpblk_t len),
1588
1589         TP_ARGS(sb, group, start, len)
1590 );
1591
1592 #endif /* _TRACE_EXT4_H */
1593
1594 /* This part must be outside protection */
1595 #include <trace/define_trace.h>