bf5518d50423706736c495df4e4aed2cf1bb9263
[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(        char,   more_io                 )       
384                 __field(       pgoff_t, writeback_index         )
385         ),
386
387         TP_fast_assign(
388                 __entry->dev            = inode->i_sb->s_dev;
389                 __entry->ino            = inode->i_ino;
390                 __entry->ret            = ret;
391                 __entry->pages_written  = pages_written;
392                 __entry->pages_skipped  = wbc->pages_skipped;
393                 __entry->sync_mode      = wbc->sync_mode;
394                 __entry->more_io        = wbc->more_io;
395                 __entry->writeback_index = inode->i_mapping->writeback_index;
396         ),
397
398         TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld "
399                   " more_io %d sync_mode %d writeback_index %lu",
400                   MAJOR(__entry->dev), MINOR(__entry->dev),
401                   (unsigned long) __entry->ino, __entry->ret,
402                   __entry->pages_written, __entry->pages_skipped,
403                   __entry->more_io, __entry->sync_mode,
404                   (unsigned long) __entry->writeback_index)
405 );
406
407 DECLARE_EVENT_CLASS(ext4__page_op,
408         TP_PROTO(struct page *page),
409
410         TP_ARGS(page),
411
412         TP_STRUCT__entry(
413                 __field(        pgoff_t, index                  )
414                 __field(        ino_t,  ino                     )
415                 __field(        dev_t,  dev                     )
416
417         ),
418
419         TP_fast_assign(
420                 __entry->index  = page->index;
421                 __entry->ino    = page->mapping->host->i_ino;
422                 __entry->dev    = page->mapping->host->i_sb->s_dev;
423         ),
424
425         TP_printk("dev %d,%d ino %lu page_index %lu",
426                   MAJOR(__entry->dev), MINOR(__entry->dev),
427                   (unsigned long) __entry->ino,
428                   (unsigned long) __entry->index)
429 );
430
431 DEFINE_EVENT(ext4__page_op, ext4_writepage,
432
433         TP_PROTO(struct page *page),
434
435         TP_ARGS(page)
436 );
437
438 DEFINE_EVENT(ext4__page_op, ext4_readpage,
439
440         TP_PROTO(struct page *page),
441
442         TP_ARGS(page)
443 );
444
445 DEFINE_EVENT(ext4__page_op, ext4_releasepage,
446
447         TP_PROTO(struct page *page),
448
449         TP_ARGS(page)
450 );
451
452 TRACE_EVENT(ext4_invalidatepage,
453         TP_PROTO(struct page *page, unsigned long offset),
454
455         TP_ARGS(page, offset),
456
457         TP_STRUCT__entry(
458                 __field(        pgoff_t, index                  )
459                 __field(        unsigned long, offset           )
460                 __field(        ino_t,  ino                     )
461                 __field(        dev_t,  dev                     )
462
463         ),
464
465         TP_fast_assign(
466                 __entry->index  = page->index;
467                 __entry->offset = offset;
468                 __entry->ino    = page->mapping->host->i_ino;
469                 __entry->dev    = page->mapping->host->i_sb->s_dev;
470         ),
471
472         TP_printk("dev %d,%d ino %lu page_index %lu offset %lu",
473                   MAJOR(__entry->dev), MINOR(__entry->dev),
474                   (unsigned long) __entry->ino,
475                   (unsigned long) __entry->index, __entry->offset)
476 );
477
478 TRACE_EVENT(ext4_discard_blocks,
479         TP_PROTO(struct super_block *sb, unsigned long long blk,
480                         unsigned long long count),
481
482         TP_ARGS(sb, blk, count),
483
484         TP_STRUCT__entry(
485                 __field(        dev_t,  dev                     )
486                 __field(        __u64,  blk                     )
487                 __field(        __u64,  count                   )
488
489         ),
490
491         TP_fast_assign(
492                 __entry->dev    = sb->s_dev;
493                 __entry->blk    = blk;
494                 __entry->count  = count;
495         ),
496
497         TP_printk("dev %d,%d blk %llu count %llu",
498                   MAJOR(__entry->dev), MINOR(__entry->dev),
499                   __entry->blk, __entry->count)
500 );
501
502 DECLARE_EVENT_CLASS(ext4__mb_new_pa,
503         TP_PROTO(struct ext4_allocation_context *ac,
504                  struct ext4_prealloc_space *pa),
505
506         TP_ARGS(ac, pa),
507
508         TP_STRUCT__entry(
509                 __field(        dev_t,  dev                     )
510                 __field(        ino_t,  ino                     )
511                 __field(        __u64,  pa_pstart               )
512                 __field(        __u32,  pa_len                  )
513                 __field(        __u64,  pa_lstart               )
514
515         ),
516
517         TP_fast_assign(
518                 __entry->dev            = ac->ac_sb->s_dev;
519                 __entry->ino            = ac->ac_inode->i_ino;
520                 __entry->pa_pstart      = pa->pa_pstart;
521                 __entry->pa_len         = pa->pa_len;
522                 __entry->pa_lstart      = pa->pa_lstart;
523         ),
524
525         TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu",
526                   MAJOR(__entry->dev), MINOR(__entry->dev),
527                   (unsigned long) __entry->ino,
528                   __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
529 );
530
531 DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa,
532
533         TP_PROTO(struct ext4_allocation_context *ac,
534                  struct ext4_prealloc_space *pa),
535
536         TP_ARGS(ac, pa)
537 );
538
539 DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_group_pa,
540
541         TP_PROTO(struct ext4_allocation_context *ac,
542                  struct ext4_prealloc_space *pa),
543
544         TP_ARGS(ac, pa)
545 );
546
547 TRACE_EVENT(ext4_mb_release_inode_pa,
548         TP_PROTO(struct ext4_prealloc_space *pa,
549                  unsigned long long block, unsigned int count),
550
551         TP_ARGS(pa, block, count),
552
553         TP_STRUCT__entry(
554                 __field(        dev_t,  dev                     )
555                 __field(        ino_t,  ino                     )
556                 __field(        __u64,  block                   )
557                 __field(        __u32,  count                   )
558
559         ),
560
561         TP_fast_assign(
562                 __entry->dev            = pa->pa_inode->i_sb->s_dev;
563                 __entry->ino            = pa->pa_inode->i_ino;
564                 __entry->block          = block;
565                 __entry->count          = count;
566         ),
567
568         TP_printk("dev %d,%d ino %lu block %llu count %u",
569                   MAJOR(__entry->dev), MINOR(__entry->dev),
570                   (unsigned long) __entry->ino,
571                   __entry->block, __entry->count)
572 );
573
574 TRACE_EVENT(ext4_mb_release_group_pa,
575         TP_PROTO(struct ext4_prealloc_space *pa),
576
577         TP_ARGS(pa),
578
579         TP_STRUCT__entry(
580                 __field(        dev_t,  dev                     )
581                 __field(        __u64,  pa_pstart               )
582                 __field(        __u32,  pa_len                  )
583
584         ),
585
586         TP_fast_assign(
587                 __entry->dev            = pa->pa_inode->i_sb->s_dev;
588                 __entry->pa_pstart      = pa->pa_pstart;
589                 __entry->pa_len         = pa->pa_len;
590         ),
591
592         TP_printk("dev %d,%d pstart %llu len %u",
593                   MAJOR(__entry->dev), MINOR(__entry->dev),
594                   __entry->pa_pstart, __entry->pa_len)
595 );
596
597 TRACE_EVENT(ext4_discard_preallocations,
598         TP_PROTO(struct inode *inode),
599
600         TP_ARGS(inode),
601
602         TP_STRUCT__entry(
603                 __field(        dev_t,  dev                     )
604                 __field(        ino_t,  ino                     )
605
606         ),
607
608         TP_fast_assign(
609                 __entry->dev    = inode->i_sb->s_dev;
610                 __entry->ino    = inode->i_ino;
611         ),
612
613         TP_printk("dev %d,%d ino %lu",
614                   MAJOR(__entry->dev), MINOR(__entry->dev),
615                   (unsigned long) __entry->ino)
616 );
617
618 TRACE_EVENT(ext4_mb_discard_preallocations,
619         TP_PROTO(struct super_block *sb, int needed),
620
621         TP_ARGS(sb, needed),
622
623         TP_STRUCT__entry(
624                 __field(        dev_t,  dev                     )
625                 __field(        int,    needed                  )
626
627         ),
628
629         TP_fast_assign(
630                 __entry->dev    = sb->s_dev;
631                 __entry->needed = needed;
632         ),
633
634         TP_printk("dev %d,%d needed %d",
635                   MAJOR(__entry->dev), MINOR(__entry->dev),
636                   __entry->needed)
637 );
638
639 TRACE_EVENT(ext4_request_blocks,
640         TP_PROTO(struct ext4_allocation_request *ar),
641
642         TP_ARGS(ar),
643
644         TP_STRUCT__entry(
645                 __field(        dev_t,  dev                     )
646                 __field(        ino_t,  ino                     )
647                 __field(        unsigned int, flags             )
648                 __field(        unsigned int, len               )
649                 __field(        __u32,  logical                 )
650                 __field(        __u32,  lleft                   )
651                 __field(        __u32,  lright                  )
652                 __field(        __u64,  goal                    )
653                 __field(        __u64,  pleft                   )
654                 __field(        __u64,  pright                  )
655         ),
656
657         TP_fast_assign(
658                 __entry->dev    = ar->inode->i_sb->s_dev;
659                 __entry->ino    = ar->inode->i_ino;
660                 __entry->flags  = ar->flags;
661                 __entry->len    = ar->len;
662                 __entry->logical = ar->logical;
663                 __entry->goal   = ar->goal;
664                 __entry->lleft  = ar->lleft;
665                 __entry->lright = ar->lright;
666                 __entry->pleft  = ar->pleft;
667                 __entry->pright = ar->pright;
668         ),
669
670         TP_printk("dev %d,%d ino %lu flags %u len %u lblk %u goal %llu "
671                   "lleft %u lright %u pleft %llu pright %llu ",
672                   MAJOR(__entry->dev), MINOR(__entry->dev),
673                   (unsigned long) __entry->ino, __entry->flags,
674                   __entry->len, __entry->logical, __entry->goal,
675                   __entry->lleft, __entry->lright, __entry->pleft,
676                   __entry->pright)
677 );
678
679 TRACE_EVENT(ext4_allocate_blocks,
680         TP_PROTO(struct ext4_allocation_request *ar, unsigned long long block),
681
682         TP_ARGS(ar, block),
683
684         TP_STRUCT__entry(
685                 __field(        dev_t,  dev                     )
686                 __field(        ino_t,  ino                     )
687                 __field(        __u64,  block                   )
688                 __field(        unsigned int, flags             )
689                 __field(        unsigned int, len               )
690                 __field(        __u32,  logical                 )
691                 __field(        __u32,  lleft                   )
692                 __field(        __u32,  lright                  )
693                 __field(        __u64,  goal                    )
694                 __field(        __u64,  pleft                   )
695                 __field(        __u64,  pright                  )
696         ),
697
698         TP_fast_assign(
699                 __entry->dev    = ar->inode->i_sb->s_dev;
700                 __entry->ino    = ar->inode->i_ino;
701                 __entry->block  = block;
702                 __entry->flags  = ar->flags;
703                 __entry->len    = ar->len;
704                 __entry->logical = ar->logical;
705                 __entry->goal   = ar->goal;
706                 __entry->lleft  = ar->lleft;
707                 __entry->lright = ar->lright;
708                 __entry->pleft  = ar->pleft;
709                 __entry->pright = ar->pright;
710         ),
711
712         TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %u "
713                   "goal %llu lleft %u lright %u pleft %llu pright %llu",
714                   MAJOR(__entry->dev), MINOR(__entry->dev),
715                   (unsigned long) __entry->ino, __entry->flags,
716                   __entry->len, __entry->block, __entry->logical,
717                   __entry->goal,  __entry->lleft, __entry->lright,
718                   __entry->pleft, __entry->pright)
719 );
720
721 TRACE_EVENT(ext4_free_blocks,
722         TP_PROTO(struct inode *inode, __u64 block, unsigned long count,
723                  int flags),
724
725         TP_ARGS(inode, block, count, flags),
726
727         TP_STRUCT__entry(
728                 __field(        dev_t,  dev                     )
729                 __field(        ino_t,  ino                     )
730                 __field(        __u16,  mode                    )
731                 __field(        __u64,  block                   )
732                 __field(        unsigned long,  count           )
733                 __field(        int,    flags                   )
734         ),
735
736         TP_fast_assign(
737                 __entry->dev            = inode->i_sb->s_dev;
738                 __entry->ino            = inode->i_ino;
739                 __entry->mode           = inode->i_mode;
740                 __entry->block          = block;
741                 __entry->count          = count;
742                 __entry->flags          = flags;
743         ),
744
745         TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %d",
746                   MAJOR(__entry->dev), MINOR(__entry->dev),
747                   (unsigned long) __entry->ino,
748                   __entry->mode, __entry->block, __entry->count,
749                   __entry->flags)
750 );
751
752 TRACE_EVENT(ext4_sync_file_enter,
753         TP_PROTO(struct file *file, int datasync),
754
755         TP_ARGS(file, datasync),
756
757         TP_STRUCT__entry(
758                 __field(        dev_t,  dev                     )
759                 __field(        ino_t,  ino                     )
760                 __field(        ino_t,  parent                  )
761                 __field(        int,    datasync                )
762         ),
763
764         TP_fast_assign(
765                 struct dentry *dentry = file->f_path.dentry;
766
767                 __entry->dev            = dentry->d_inode->i_sb->s_dev;
768                 __entry->ino            = dentry->d_inode->i_ino;
769                 __entry->datasync       = datasync;
770                 __entry->parent         = dentry->d_parent->d_inode->i_ino;
771         ),
772
773         TP_printk("dev %d,%d ino %lu parent %lu datasync %d ",
774                   MAJOR(__entry->dev), MINOR(__entry->dev),
775                   (unsigned long) __entry->ino,
776                   (unsigned long) __entry->parent, __entry->datasync)
777 );
778
779 TRACE_EVENT(ext4_sync_file_exit,
780         TP_PROTO(struct inode *inode, int ret),
781
782         TP_ARGS(inode, ret),
783
784         TP_STRUCT__entry(
785                 __field(        int,    ret                     )
786                 __field(        ino_t,  ino                     )
787                 __field(        dev_t,  dev                     )
788         ),
789
790         TP_fast_assign(
791                 __entry->ret            = ret;
792                 __entry->ino            = inode->i_ino;
793                 __entry->dev            = inode->i_sb->s_dev;
794         ),
795
796         TP_printk("dev %d,%d ino %lu ret %d",
797                   MAJOR(__entry->dev), MINOR(__entry->dev),
798                   (unsigned long) __entry->ino,
799                   __entry->ret)
800 );
801
802 TRACE_EVENT(ext4_sync_fs,
803         TP_PROTO(struct super_block *sb, int wait),
804
805         TP_ARGS(sb, wait),
806
807         TP_STRUCT__entry(
808                 __field(        dev_t,  dev                     )
809                 __field(        int,    wait                    )
810
811         ),
812
813         TP_fast_assign(
814                 __entry->dev    = sb->s_dev;
815                 __entry->wait   = wait;
816         ),
817
818         TP_printk("dev %d,%d wait %d",
819                   MAJOR(__entry->dev), MINOR(__entry->dev),
820                   __entry->wait)
821 );
822
823 TRACE_EVENT(ext4_alloc_da_blocks,
824         TP_PROTO(struct inode *inode),
825
826         TP_ARGS(inode),
827
828         TP_STRUCT__entry(
829                 __field(        dev_t,  dev                     )
830                 __field(        ino_t,  ino                     )
831                 __field( unsigned int,  data_blocks     )
832                 __field( unsigned int,  meta_blocks     )
833         ),
834
835         TP_fast_assign(
836                 __entry->dev    = inode->i_sb->s_dev;
837                 __entry->ino    = inode->i_ino;
838                 __entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
839                 __entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
840         ),
841
842         TP_printk("dev %d,%d ino %lu data_blocks %u meta_blocks %u",
843                   MAJOR(__entry->dev), MINOR(__entry->dev),
844                   (unsigned long) __entry->ino,
845                   __entry->data_blocks, __entry->meta_blocks)
846 );
847
848 TRACE_EVENT(ext4_mballoc_alloc,
849         TP_PROTO(struct ext4_allocation_context *ac),
850
851         TP_ARGS(ac),
852
853         TP_STRUCT__entry(
854                 __field(        dev_t,  dev                     )
855                 __field(        ino_t,  ino                     )
856                 __field(        __u16,  found                   )
857                 __field(        __u16,  groups                  )
858                 __field(        __u16,  buddy                   )
859                 __field(        __u16,  flags                   )
860                 __field(        __u16,  tail                    )
861                 __field(        __u8,   cr                      )
862                 __field(        __u32,  orig_logical            )
863                 __field(          int,  orig_start              )
864                 __field(        __u32,  orig_group              )
865                 __field(          int,  orig_len                )
866                 __field(        __u32,  goal_logical            )
867                 __field(          int,  goal_start              )
868                 __field(        __u32,  goal_group              )
869                 __field(          int,  goal_len                )
870                 __field(        __u32,  result_logical          )
871                 __field(          int,  result_start            )
872                 __field(        __u32,  result_group            )
873                 __field(          int,  result_len              )
874         ),
875
876         TP_fast_assign(
877                 __entry->dev            = ac->ac_inode->i_sb->s_dev;
878                 __entry->ino            = ac->ac_inode->i_ino;
879                 __entry->found          = ac->ac_found;
880                 __entry->flags          = ac->ac_flags;
881                 __entry->groups         = ac->ac_groups_scanned;
882                 __entry->buddy          = ac->ac_buddy;
883                 __entry->tail           = ac->ac_tail;
884                 __entry->cr             = ac->ac_criteria;
885                 __entry->orig_logical   = ac->ac_o_ex.fe_logical;
886                 __entry->orig_start     = ac->ac_o_ex.fe_start;
887                 __entry->orig_group     = ac->ac_o_ex.fe_group;
888                 __entry->orig_len       = ac->ac_o_ex.fe_len;
889                 __entry->goal_logical   = ac->ac_g_ex.fe_logical;
890                 __entry->goal_start     = ac->ac_g_ex.fe_start;
891                 __entry->goal_group     = ac->ac_g_ex.fe_group;
892                 __entry->goal_len       = ac->ac_g_ex.fe_len;
893                 __entry->result_logical = ac->ac_f_ex.fe_logical;
894                 __entry->result_start   = ac->ac_f_ex.fe_start;
895                 __entry->result_group   = ac->ac_f_ex.fe_group;
896                 __entry->result_len     = ac->ac_f_ex.fe_len;
897         ),
898
899         TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
900                   "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x "
901                   "tail %u broken %u",
902                   MAJOR(__entry->dev), MINOR(__entry->dev),
903                   (unsigned long) __entry->ino,
904                   __entry->orig_group, __entry->orig_start,
905                   __entry->orig_len, __entry->orig_logical,
906                   __entry->goal_group, __entry->goal_start,
907                   __entry->goal_len, __entry->goal_logical,
908                   __entry->result_group, __entry->result_start,
909                   __entry->result_len, __entry->result_logical,
910                   __entry->found, __entry->groups, __entry->cr,
911                   __entry->flags, __entry->tail,
912                   __entry->buddy ? 1 << __entry->buddy : 0)
913 );
914
915 TRACE_EVENT(ext4_mballoc_prealloc,
916         TP_PROTO(struct ext4_allocation_context *ac),
917
918         TP_ARGS(ac),
919
920         TP_STRUCT__entry(
921                 __field(        dev_t,  dev                     )
922                 __field(        ino_t,  ino                     )
923                 __field(        __u32,  orig_logical            )
924                 __field(          int,  orig_start              )
925                 __field(        __u32,  orig_group              )
926                 __field(          int,  orig_len                )
927                 __field(        __u32,  result_logical          )
928                 __field(          int,  result_start            )
929                 __field(        __u32,  result_group            )
930                 __field(          int,  result_len              )
931         ),
932
933         TP_fast_assign(
934                 __entry->dev            = ac->ac_inode->i_sb->s_dev;
935                 __entry->ino            = ac->ac_inode->i_ino;
936                 __entry->orig_logical   = ac->ac_o_ex.fe_logical;
937                 __entry->orig_start     = ac->ac_o_ex.fe_start;
938                 __entry->orig_group     = ac->ac_o_ex.fe_group;
939                 __entry->orig_len       = ac->ac_o_ex.fe_len;
940                 __entry->result_logical = ac->ac_b_ex.fe_logical;
941                 __entry->result_start   = ac->ac_b_ex.fe_start;
942                 __entry->result_group   = ac->ac_b_ex.fe_group;
943                 __entry->result_len     = ac->ac_b_ex.fe_len;
944         ),
945
946         TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
947                   MAJOR(__entry->dev), MINOR(__entry->dev),
948                   (unsigned long) __entry->ino,
949                   __entry->orig_group, __entry->orig_start,
950                   __entry->orig_len, __entry->orig_logical,
951                   __entry->result_group, __entry->result_start,
952                   __entry->result_len, __entry->result_logical)
953 );
954
955 DECLARE_EVENT_CLASS(ext4__mballoc,
956         TP_PROTO(struct super_block *sb,
957                  struct inode *inode,
958                  ext4_group_t group,
959                  ext4_grpblk_t start,
960                  ext4_grpblk_t len),
961
962         TP_ARGS(sb, inode, group, start, len),
963
964         TP_STRUCT__entry(
965                 __field(        dev_t,  dev                     )
966                 __field(        ino_t,  ino                     )
967                 __field(          int,  result_start            )
968                 __field(        __u32,  result_group            )
969                 __field(          int,  result_len              )
970         ),
971
972         TP_fast_assign(
973                 __entry->dev            = sb->s_dev;
974                 __entry->ino            = inode ? inode->i_ino : 0;
975                 __entry->result_start   = start;
976                 __entry->result_group   = group;
977                 __entry->result_len     = len;
978         ),
979
980         TP_printk("dev %d,%d inode %lu extent %u/%d/%d ",
981                   MAJOR(__entry->dev), MINOR(__entry->dev),
982                   (unsigned long) __entry->ino,
983                   __entry->result_group, __entry->result_start,
984                   __entry->result_len)
985 );
986
987 DEFINE_EVENT(ext4__mballoc, ext4_mballoc_discard,
988
989         TP_PROTO(struct super_block *sb,
990                  struct inode *inode,
991                  ext4_group_t group,
992                  ext4_grpblk_t start,
993                  ext4_grpblk_t len),
994
995         TP_ARGS(sb, inode, group, start, len)
996 );
997
998 DEFINE_EVENT(ext4__mballoc, ext4_mballoc_free,
999
1000         TP_PROTO(struct super_block *sb,
1001                  struct inode *inode,
1002                  ext4_group_t group,
1003                  ext4_grpblk_t start,
1004                  ext4_grpblk_t len),
1005
1006         TP_ARGS(sb, inode, group, start, len)
1007 );
1008
1009 TRACE_EVENT(ext4_forget,
1010         TP_PROTO(struct inode *inode, int is_metadata, __u64 block),
1011
1012         TP_ARGS(inode, is_metadata, block),
1013
1014         TP_STRUCT__entry(
1015                 __field(        dev_t,  dev                     )
1016                 __field(        ino_t,  ino                     )
1017                 __field(        __u16,  mode                    )
1018                 __field(        int,    is_metadata             )
1019                 __field(        __u64,  block                   )
1020         ),
1021
1022         TP_fast_assign(
1023                 __entry->dev    = inode->i_sb->s_dev;
1024                 __entry->ino    = inode->i_ino;
1025                 __entry->mode   = inode->i_mode;
1026                 __entry->is_metadata = is_metadata;
1027                 __entry->block  = block;
1028         ),
1029
1030         TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu",
1031                   MAJOR(__entry->dev), MINOR(__entry->dev),
1032                   (unsigned long) __entry->ino,
1033                   __entry->mode, __entry->is_metadata, __entry->block)
1034 );
1035
1036 TRACE_EVENT(ext4_da_update_reserve_space,
1037         TP_PROTO(struct inode *inode, int used_blocks),
1038
1039         TP_ARGS(inode, used_blocks),
1040
1041         TP_STRUCT__entry(
1042                 __field(        dev_t,  dev                     )
1043                 __field(        ino_t,  ino                     )
1044                 __field(        __u16,  mode                    )
1045                 __field(        __u64,  i_blocks                )
1046                 __field(        int,    used_blocks             )
1047                 __field(        int,    reserved_data_blocks    )
1048                 __field(        int,    reserved_meta_blocks    )
1049                 __field(        int,    allocated_meta_blocks   )
1050         ),
1051
1052         TP_fast_assign(
1053                 __entry->dev    = inode->i_sb->s_dev;
1054                 __entry->ino    = inode->i_ino;
1055                 __entry->mode   = inode->i_mode;
1056                 __entry->i_blocks = inode->i_blocks;
1057                 __entry->used_blocks = used_blocks;
1058                 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1059                 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1060                 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
1061         ),
1062
1063         TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d "
1064                   "reserved_data_blocks %d reserved_meta_blocks %d "
1065                   "allocated_meta_blocks %d",
1066                   MAJOR(__entry->dev), MINOR(__entry->dev),
1067                   (unsigned long) __entry->ino,
1068                   __entry->mode, __entry->i_blocks,
1069                   __entry->used_blocks, __entry->reserved_data_blocks,
1070                   __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
1071 );
1072
1073 TRACE_EVENT(ext4_da_reserve_space,
1074         TP_PROTO(struct inode *inode, int md_needed),
1075
1076         TP_ARGS(inode, md_needed),
1077
1078         TP_STRUCT__entry(
1079                 __field(        dev_t,  dev                     )
1080                 __field(        ino_t,  ino                     )
1081                 __field(        __u16,  mode                    )
1082                 __field(        __u64,  i_blocks                )
1083                 __field(        int,    md_needed               )
1084                 __field(        int,    reserved_data_blocks    )
1085                 __field(        int,    reserved_meta_blocks    )
1086         ),
1087
1088         TP_fast_assign(
1089                 __entry->dev    = inode->i_sb->s_dev;
1090                 __entry->ino    = inode->i_ino;
1091                 __entry->mode   = inode->i_mode;
1092                 __entry->i_blocks = inode->i_blocks;
1093                 __entry->md_needed = md_needed;
1094                 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1095                 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1096         ),
1097
1098         TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu md_needed %d "
1099                   "reserved_data_blocks %d reserved_meta_blocks %d",
1100                   MAJOR(__entry->dev), MINOR(__entry->dev),
1101                   (unsigned long) __entry->ino,
1102                   __entry->mode, __entry->i_blocks,
1103                   __entry->md_needed, __entry->reserved_data_blocks,
1104                   __entry->reserved_meta_blocks)
1105 );
1106
1107 TRACE_EVENT(ext4_da_release_space,
1108         TP_PROTO(struct inode *inode, int freed_blocks),
1109
1110         TP_ARGS(inode, freed_blocks),
1111
1112         TP_STRUCT__entry(
1113                 __field(        dev_t,  dev                     )
1114                 __field(        ino_t,  ino                     )
1115                 __field(        __u16,  mode                    )
1116                 __field(        __u64,  i_blocks                )
1117                 __field(        int,    freed_blocks            )
1118                 __field(        int,    reserved_data_blocks    )
1119                 __field(        int,    reserved_meta_blocks    )
1120                 __field(        int,    allocated_meta_blocks   )
1121         ),
1122
1123         TP_fast_assign(
1124                 __entry->dev    = inode->i_sb->s_dev;
1125                 __entry->ino    = inode->i_ino;
1126                 __entry->mode   = inode->i_mode;
1127                 __entry->i_blocks = inode->i_blocks;
1128                 __entry->freed_blocks = freed_blocks;
1129                 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1130                 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1131                 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
1132         ),
1133
1134         TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d "
1135                   "reserved_data_blocks %d reserved_meta_blocks %d "
1136                   "allocated_meta_blocks %d",
1137                   MAJOR(__entry->dev), MINOR(__entry->dev),
1138                   (unsigned long) __entry->ino,
1139                   __entry->mode, __entry->i_blocks,
1140                   __entry->freed_blocks, __entry->reserved_data_blocks,
1141                   __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
1142 );
1143
1144 DECLARE_EVENT_CLASS(ext4__bitmap_load,
1145         TP_PROTO(struct super_block *sb, unsigned long group),
1146
1147         TP_ARGS(sb, group),
1148
1149         TP_STRUCT__entry(
1150                 __field(        dev_t,  dev                     )
1151                 __field(        __u32,  group                   )
1152
1153         ),
1154
1155         TP_fast_assign(
1156                 __entry->dev    = sb->s_dev;
1157                 __entry->group  = group;
1158         ),
1159
1160         TP_printk("dev %d,%d group %u",
1161                   MAJOR(__entry->dev), MINOR(__entry->dev),
1162                   __entry->group)
1163 );
1164
1165 DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load,
1166
1167         TP_PROTO(struct super_block *sb, unsigned long group),
1168
1169         TP_ARGS(sb, group)
1170 );
1171
1172 DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
1173
1174         TP_PROTO(struct super_block *sb, unsigned long group),
1175
1176         TP_ARGS(sb, group)
1177 );
1178
1179 DEFINE_EVENT(ext4__bitmap_load, ext4_read_block_bitmap_load,
1180
1181         TP_PROTO(struct super_block *sb, unsigned long group),
1182
1183         TP_ARGS(sb, group)
1184 );
1185
1186 DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
1187
1188         TP_PROTO(struct super_block *sb, unsigned long group),
1189
1190         TP_ARGS(sb, group)
1191 );
1192
1193 TRACE_EVENT(ext4_direct_IO_enter,
1194         TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
1195
1196         TP_ARGS(inode, offset, len, rw),
1197
1198         TP_STRUCT__entry(
1199                 __field(        ino_t,  ino                     )
1200                 __field(        dev_t,  dev                     )
1201                 __field(        loff_t, pos                     )
1202                 __field(        unsigned long,  len             )
1203                 __field(        int,    rw                      )
1204         ),
1205
1206         TP_fast_assign(
1207                 __entry->ino    = inode->i_ino;
1208                 __entry->dev    = inode->i_sb->s_dev;
1209                 __entry->pos    = offset;
1210                 __entry->len    = len;
1211                 __entry->rw     = rw;
1212         ),
1213
1214         TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d",
1215                   MAJOR(__entry->dev), MINOR(__entry->dev),
1216                   (unsigned long) __entry->ino,
1217                   __entry->pos, __entry->len, __entry->rw)
1218 );
1219
1220 TRACE_EVENT(ext4_direct_IO_exit,
1221         TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
1222                  int rw, int ret),
1223
1224         TP_ARGS(inode, offset, len, rw, ret),
1225
1226         TP_STRUCT__entry(
1227                 __field(        ino_t,  ino                     )
1228                 __field(        dev_t,  dev                     )
1229                 __field(        loff_t, pos                     )
1230                 __field(        unsigned long,  len             )
1231                 __field(        int,    rw                      )
1232                 __field(        int,    ret                     )
1233         ),
1234
1235         TP_fast_assign(
1236                 __entry->ino    = inode->i_ino;
1237                 __entry->dev    = inode->i_sb->s_dev;
1238                 __entry->pos    = offset;
1239                 __entry->len    = len;
1240                 __entry->rw     = rw;
1241                 __entry->ret    = ret;
1242         ),
1243
1244         TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d ret %d",
1245                   MAJOR(__entry->dev), MINOR(__entry->dev),
1246                   (unsigned long) __entry->ino,
1247                   __entry->pos, __entry->len,
1248                   __entry->rw, __entry->ret)
1249 );
1250
1251 TRACE_EVENT(ext4_fallocate_enter,
1252         TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1253
1254         TP_ARGS(inode, offset, len, mode),
1255
1256         TP_STRUCT__entry(
1257                 __field(        ino_t,  ino                     )
1258                 __field(        dev_t,  dev                     )
1259                 __field(        loff_t, pos                     )
1260                 __field(        loff_t, len                     )
1261                 __field(        int,    mode                    )
1262         ),
1263
1264         TP_fast_assign(
1265                 __entry->ino    = inode->i_ino;
1266                 __entry->dev    = inode->i_sb->s_dev;
1267                 __entry->pos    = offset;
1268                 __entry->len    = len;
1269                 __entry->mode   = mode;
1270         ),
1271
1272         TP_printk("dev %d,%d ino %lu pos %lld len %lld mode %d",
1273                   MAJOR(__entry->dev), MINOR(__entry->dev),
1274                   (unsigned long) __entry->ino, __entry->pos,
1275                   __entry->len, __entry->mode)
1276 );
1277
1278 TRACE_EVENT(ext4_fallocate_exit,
1279         TP_PROTO(struct inode *inode, loff_t offset,
1280                  unsigned int max_blocks, int ret),
1281
1282         TP_ARGS(inode, offset, max_blocks, ret),
1283
1284         TP_STRUCT__entry(
1285                 __field(        ino_t,  ino                     )
1286                 __field(        dev_t,  dev                     )
1287                 __field(        loff_t, pos                     )
1288                 __field(        unsigned int,   blocks          )
1289                 __field(        int,    ret                     )
1290         ),
1291
1292         TP_fast_assign(
1293                 __entry->ino    = inode->i_ino;
1294                 __entry->dev    = inode->i_sb->s_dev;
1295                 __entry->pos    = offset;
1296                 __entry->blocks = max_blocks;
1297                 __entry->ret    = ret;
1298         ),
1299
1300         TP_printk("dev %d,%d ino %lu pos %lld blocks %u ret %d",
1301                   MAJOR(__entry->dev), MINOR(__entry->dev),
1302                   (unsigned long) __entry->ino,
1303                   __entry->pos, __entry->blocks,
1304                   __entry->ret)
1305 );
1306
1307 TRACE_EVENT(ext4_unlink_enter,
1308         TP_PROTO(struct inode *parent, struct dentry *dentry),
1309
1310         TP_ARGS(parent, dentry),
1311
1312         TP_STRUCT__entry(
1313                 __field(        ino_t,  parent                  )
1314                 __field(        ino_t,  ino                     )
1315                 __field(        loff_t, size                    )
1316                 __field(        dev_t,  dev                     )
1317         ),
1318
1319         TP_fast_assign(
1320                 __entry->parent         = parent->i_ino;
1321                 __entry->ino            = dentry->d_inode->i_ino;
1322                 __entry->size           = dentry->d_inode->i_size;
1323                 __entry->dev            = dentry->d_inode->i_sb->s_dev;
1324         ),
1325
1326         TP_printk("dev %d,%d ino %lu size %lld parent %lu",
1327                   MAJOR(__entry->dev), MINOR(__entry->dev),
1328                   (unsigned long) __entry->ino, __entry->size,
1329                   (unsigned long) __entry->parent)
1330 );
1331
1332 TRACE_EVENT(ext4_unlink_exit,
1333         TP_PROTO(struct dentry *dentry, int ret),
1334
1335         TP_ARGS(dentry, ret),
1336
1337         TP_STRUCT__entry(
1338                 __field(        ino_t,  ino                     )
1339                 __field(        dev_t,  dev                     )
1340                 __field(        int,    ret                     )
1341         ),
1342
1343         TP_fast_assign(
1344                 __entry->ino            = dentry->d_inode->i_ino;
1345                 __entry->dev            = dentry->d_inode->i_sb->s_dev;
1346                 __entry->ret            = ret;
1347         ),
1348
1349         TP_printk("dev %d,%d ino %lu ret %d",
1350                   MAJOR(__entry->dev), MINOR(__entry->dev),
1351                   (unsigned long) __entry->ino,
1352                   __entry->ret)
1353 );
1354
1355 DECLARE_EVENT_CLASS(ext4__truncate,
1356         TP_PROTO(struct inode *inode),
1357
1358         TP_ARGS(inode),
1359
1360         TP_STRUCT__entry(
1361                 __field(        ino_t,          ino             )
1362                 __field(        dev_t,          dev             )
1363                 __field(        __u64,          blocks          )
1364         ),
1365
1366         TP_fast_assign(
1367                 __entry->ino    = inode->i_ino;
1368                 __entry->dev    = inode->i_sb->s_dev;
1369                 __entry->blocks = inode->i_blocks;
1370         ),
1371
1372         TP_printk("dev %d,%d ino %lu blocks %llu",
1373                   MAJOR(__entry->dev), MINOR(__entry->dev),
1374                   (unsigned long) __entry->ino, __entry->blocks)
1375 );
1376
1377 DEFINE_EVENT(ext4__truncate, ext4_truncate_enter,
1378
1379         TP_PROTO(struct inode *inode),
1380
1381         TP_ARGS(inode)
1382 );
1383
1384 DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,
1385
1386         TP_PROTO(struct inode *inode),
1387
1388         TP_ARGS(inode)
1389 );
1390
1391 DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
1392         TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1393                  unsigned int len, unsigned int flags),
1394
1395         TP_ARGS(inode, lblk, len, flags),
1396
1397         TP_STRUCT__entry(
1398                 __field(        ino_t,          ino             )
1399                 __field(        dev_t,          dev             )
1400                 __field(        ext4_lblk_t,    lblk            )
1401                 __field(        unsigned int,   len             )
1402                 __field(        unsigned int,   flags           )
1403         ),
1404
1405         TP_fast_assign(
1406                 __entry->ino    = inode->i_ino;
1407                 __entry->dev    = inode->i_sb->s_dev;
1408                 __entry->lblk   = lblk;
1409                 __entry->len    = len;
1410                 __entry->flags  = flags;
1411         ),
1412
1413         TP_printk("dev %d,%d ino %lu lblk %u len %u flags %u",
1414                   MAJOR(__entry->dev), MINOR(__entry->dev),
1415                   (unsigned long) __entry->ino,
1416                   __entry->lblk, __entry->len, __entry->flags)
1417 );
1418
1419 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter,
1420         TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1421                  unsigned len, unsigned flags),
1422
1423         TP_ARGS(inode, lblk, len, flags)
1424 );
1425
1426 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
1427         TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1428                  unsigned len, unsigned flags),
1429
1430         TP_ARGS(inode, lblk, len, flags)
1431 );
1432
1433 DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1434         TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1435                  ext4_fsblk_t pblk, unsigned int len, int ret),
1436
1437         TP_ARGS(inode, lblk, pblk, len, ret),
1438
1439         TP_STRUCT__entry(
1440                 __field(        ino_t,          ino             )
1441                 __field(        dev_t,          dev             )
1442                 __field(        ext4_lblk_t,    lblk            )
1443                 __field(        ext4_fsblk_t,   pblk            )
1444                 __field(        unsigned int,   len             )
1445                 __field(        int,            ret             )
1446         ),
1447
1448         TP_fast_assign(
1449                 __entry->ino    = inode->i_ino;
1450                 __entry->dev    = inode->i_sb->s_dev;
1451                 __entry->lblk   = lblk;
1452                 __entry->pblk   = pblk;
1453                 __entry->len    = len;
1454                 __entry->ret    = ret;
1455         ),
1456
1457         TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u ret %d",
1458                   MAJOR(__entry->dev), MINOR(__entry->dev),
1459                   (unsigned long) __entry->ino,
1460                   __entry->lblk, __entry->pblk,
1461                   __entry->len, __entry->ret)
1462 );
1463
1464 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1465         TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1466                  ext4_fsblk_t pblk, unsigned len, int ret),
1467
1468         TP_ARGS(inode, lblk, pblk, len, ret)
1469 );
1470
1471 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1472         TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1473                  ext4_fsblk_t pblk, unsigned len, int ret),
1474
1475         TP_ARGS(inode, lblk, pblk, len, ret)
1476 );
1477
1478 TRACE_EVENT(ext4_ext_load_extent,
1479         TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk),
1480
1481         TP_ARGS(inode, lblk, pblk),
1482
1483         TP_STRUCT__entry(
1484                 __field(        ino_t,          ino             )
1485                 __field(        dev_t,          dev             )
1486                 __field(        ext4_lblk_t,    lblk            )
1487                 __field(        ext4_fsblk_t,   pblk            )
1488         ),
1489
1490         TP_fast_assign(
1491                 __entry->ino    = inode->i_ino;
1492                 __entry->dev    = inode->i_sb->s_dev;
1493                 __entry->lblk   = lblk;
1494                 __entry->pblk   = pblk;
1495         ),
1496
1497         TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
1498                   MAJOR(__entry->dev), MINOR(__entry->dev),
1499                   (unsigned long) __entry->ino,
1500                   __entry->lblk, __entry->pblk)
1501 );
1502
1503 TRACE_EVENT(ext4_load_inode,
1504         TP_PROTO(struct inode *inode),
1505
1506         TP_ARGS(inode),
1507
1508         TP_STRUCT__entry(
1509                 __field(        ino_t,  ino             )
1510                 __field(        dev_t,  dev             )
1511         ),
1512
1513         TP_fast_assign(
1514                 __entry->ino            = inode->i_ino;
1515                 __entry->dev            = inode->i_sb->s_dev;
1516         ),
1517
1518         TP_printk("dev %d,%d ino %ld",
1519                   MAJOR(__entry->dev), MINOR(__entry->dev),
1520                   (unsigned long) __entry->ino)
1521 );
1522
1523 TRACE_EVENT(ext4_journal_start,
1524         TP_PROTO(struct super_block *sb, int nblocks, unsigned long IP),
1525
1526         TP_ARGS(sb, nblocks, IP),
1527
1528         TP_STRUCT__entry(
1529                 __field(        dev_t,  dev                     )
1530                 __field(          int,  nblocks                 )
1531                 __field(unsigned long,  ip                      )
1532         ),
1533
1534         TP_fast_assign(
1535                 __entry->dev     = sb->s_dev;
1536                 __entry->nblocks = nblocks;
1537                 __entry->ip      = IP;
1538         ),
1539
1540         TP_printk("dev %d,%d nblocks %d caller %pF",
1541                   MAJOR(__entry->dev), MINOR(__entry->dev),
1542                   __entry->nblocks, (void *)__entry->ip)
1543 );
1544
1545 DECLARE_EVENT_CLASS(ext4__trim,
1546         TP_PROTO(struct super_block *sb,
1547                  ext4_group_t group,
1548                  ext4_grpblk_t start,
1549                  ext4_grpblk_t len),
1550
1551         TP_ARGS(sb, group, start, len),
1552
1553         TP_STRUCT__entry(
1554                 __field(        int,    dev_major               )
1555                 __field(        int,    dev_minor               )
1556                 __field(        __u32,  group                   )
1557                 __field(        int,    start                   )
1558                 __field(        int,    len                     )
1559         ),
1560
1561         TP_fast_assign(
1562                 __entry->dev_major      = MAJOR(sb->s_dev);
1563                 __entry->dev_minor      = MINOR(sb->s_dev);
1564                 __entry->group          = group;
1565                 __entry->start          = start;
1566                 __entry->len            = len;
1567         ),
1568
1569         TP_printk("dev %d,%d group %u, start %d, len %d",
1570                   __entry->dev_major, __entry->dev_minor,
1571                   __entry->group, __entry->start, __entry->len)
1572 );
1573
1574 DEFINE_EVENT(ext4__trim, ext4_trim_extent,
1575
1576         TP_PROTO(struct super_block *sb,
1577                  ext4_group_t group,
1578                  ext4_grpblk_t start,
1579                  ext4_grpblk_t len),
1580
1581         TP_ARGS(sb, group, start, len)
1582 );
1583
1584 DEFINE_EVENT(ext4__trim, ext4_trim_all_free,
1585
1586         TP_PROTO(struct super_block *sb,
1587                  ext4_group_t group,
1588                  ext4_grpblk_t start,
1589                  ext4_grpblk_t len),
1590
1591         TP_ARGS(sb, group, start, len)
1592 );
1593
1594 #endif /* _TRACE_EXT4_H */
1595
1596 /* This part must be outside protection */
1597 #include <trace/define_trace.h>