Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
[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(        umode_t, mode                   )
27                 __field(        uid_t,  uid                     )
28                 __field(        gid_t,  gid                     )
29                 __field(        blkcnt_t, blocks                )
30         ),
31
32         TP_fast_assign(
33                 __entry->dev    = inode->i_sb->s_dev;
34                 __entry->ino    = inode->i_ino;
35                 __entry->mode   = inode->i_mode;
36                 __entry->uid    = inode->i_uid;
37                 __entry->gid    = inode->i_gid;
38                 __entry->blocks = inode->i_blocks;
39         ),
40
41         TP_printk("dev %s ino %lu mode 0%o uid %u gid %u blocks %llu",
42                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
43                   __entry->mode, __entry->uid, __entry->gid,
44                   (unsigned long long) __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(        umode_t, mode                   )
56         ),
57
58         TP_fast_assign(
59                 __entry->dev    = dir->i_sb->s_dev;
60                 __entry->dir    = dir->i_ino;
61                 __entry->mode   = mode;
62         ),
63
64         TP_printk("dev %s dir %lu mode 0%o",
65                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->dir,
66                   __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(        umode_t, mode                   )
79         ),
80
81         TP_fast_assign(
82                 __entry->dev    = inode->i_sb->s_dev;
83                 __entry->ino    = inode->i_ino;
84                 __entry->dir    = dir->i_ino;
85                 __entry->mode   = mode;
86         ),
87
88         TP_printk("dev %s ino %lu dir %lu mode 0%o",
89                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
90                   (unsigned long) __entry->dir, __entry->mode)
91 );
92
93 DECLARE_EVENT_CLASS(ext4__write_begin,
94
95         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
96                  unsigned int flags),
97
98         TP_ARGS(inode, pos, len, flags),
99
100         TP_STRUCT__entry(
101                 __field(        dev_t,  dev                     )
102                 __field(        ino_t,  ino                     )
103                 __field(        loff_t, pos                     )
104                 __field(        unsigned int, len               )
105                 __field(        unsigned int, flags             )
106         ),
107
108         TP_fast_assign(
109                 __entry->dev    = inode->i_sb->s_dev;
110                 __entry->ino    = inode->i_ino;
111                 __entry->pos    = pos;
112                 __entry->len    = len;
113                 __entry->flags  = flags;
114         ),
115
116         TP_printk("dev %s ino %lu pos %llu len %u flags %u",
117                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
118                   __entry->pos, __entry->len, __entry->flags)
119 );
120
121 DEFINE_EVENT(ext4__write_begin, ext4_write_begin,
122
123         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
124                  unsigned int flags),
125
126         TP_ARGS(inode, pos, len, flags)
127 );
128
129 DEFINE_EVENT(ext4__write_begin, ext4_da_write_begin,
130
131         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
132                  unsigned int flags),
133
134         TP_ARGS(inode, pos, len, flags)
135 );
136
137 DECLARE_EVENT_CLASS(ext4__write_end,
138         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
139                         unsigned int copied),
140
141         TP_ARGS(inode, pos, len, copied),
142
143         TP_STRUCT__entry(
144                 __field(        dev_t,  dev                     )
145                 __field(        ino_t,  ino                     )
146                 __field(        loff_t, pos                     )
147                 __field(        unsigned int, len               )
148                 __field(        unsigned int, copied            )
149         ),
150
151         TP_fast_assign(
152                 __entry->dev    = inode->i_sb->s_dev;
153                 __entry->ino    = inode->i_ino;
154                 __entry->pos    = pos;
155                 __entry->len    = len;
156                 __entry->copied = copied;
157         ),
158
159         TP_printk("dev %s ino %lu pos %llu len %u copied %u",
160                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
161                   __entry->pos, __entry->len, __entry->copied)
162 );
163
164 DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end,
165
166         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
167                  unsigned int copied),
168
169         TP_ARGS(inode, pos, len, copied)
170 );
171
172 DEFINE_EVENT(ext4__write_end, ext4_writeback_write_end,
173
174         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
175                  unsigned int copied),
176
177         TP_ARGS(inode, pos, len, copied)
178 );
179
180 DEFINE_EVENT(ext4__write_end, ext4_journalled_write_end,
181
182         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
183                  unsigned int copied),
184
185         TP_ARGS(inode, pos, len, copied)
186 );
187
188 DEFINE_EVENT(ext4__write_end, ext4_da_write_end,
189
190         TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
191                  unsigned int copied),
192
193         TP_ARGS(inode, pos, len, copied)
194 );
195
196 TRACE_EVENT(ext4_writepage,
197         TP_PROTO(struct inode *inode, struct page *page),
198
199         TP_ARGS(inode, page),
200
201         TP_STRUCT__entry(
202                 __field(        dev_t,  dev                     )
203                 __field(        ino_t,  ino                     )
204                 __field(        pgoff_t, index                  )
205
206         ),
207
208         TP_fast_assign(
209                 __entry->dev    = inode->i_sb->s_dev;
210                 __entry->ino    = inode->i_ino;
211                 __entry->index  = page->index;
212         ),
213
214         TP_printk("dev %s ino %lu page_index %lu",
215                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
216                   __entry->index)
217 );
218
219 TRACE_EVENT(ext4_da_writepages,
220         TP_PROTO(struct inode *inode, struct writeback_control *wbc),
221
222         TP_ARGS(inode, wbc),
223
224         TP_STRUCT__entry(
225                 __field(        dev_t,  dev                     )
226                 __field(        ino_t,  ino                     )
227                 __field(        long,   nr_to_write             )
228                 __field(        long,   pages_skipped           )
229                 __field(        loff_t, range_start             )
230                 __field(        loff_t, range_end               )
231                 __field(        char,   nonblocking             )
232                 __field(        char,   for_kupdate             )
233                 __field(        char,   for_reclaim             )
234                 __field(        char,   range_cyclic            )
235                 __field(       pgoff_t, writeback_index         )
236         ),
237
238         TP_fast_assign(
239                 __entry->dev            = inode->i_sb->s_dev;
240                 __entry->ino            = inode->i_ino;
241                 __entry->nr_to_write    = wbc->nr_to_write;
242                 __entry->pages_skipped  = wbc->pages_skipped;
243                 __entry->range_start    = wbc->range_start;
244                 __entry->range_end      = wbc->range_end;
245                 __entry->nonblocking    = wbc->nonblocking;
246                 __entry->for_kupdate    = wbc->for_kupdate;
247                 __entry->for_reclaim    = wbc->for_reclaim;
248                 __entry->range_cyclic   = wbc->range_cyclic;
249                 __entry->writeback_index = inode->i_mapping->writeback_index;
250         ),
251
252         TP_printk("dev %s ino %lu nr_to_write %ld pages_skipped %ld range_start %llu range_end %llu nonblocking %d for_kupdate %d for_reclaim %d range_cyclic %d writeback_index %lu",
253                   jbd2_dev_to_name(__entry->dev),
254                   (unsigned long) __entry->ino, __entry->nr_to_write,
255                   __entry->pages_skipped, __entry->range_start,
256                   __entry->range_end, __entry->nonblocking,
257                   __entry->for_kupdate, __entry->for_reclaim,
258                   __entry->range_cyclic,
259                   (unsigned long) __entry->writeback_index)
260 );
261
262 TRACE_EVENT(ext4_da_write_pages,
263         TP_PROTO(struct inode *inode, struct mpage_da_data *mpd),
264
265         TP_ARGS(inode, mpd),
266
267         TP_STRUCT__entry(
268                 __field(        dev_t,  dev                     )
269                 __field(        ino_t,  ino                     )
270                 __field(        __u64,  b_blocknr               )
271                 __field(        __u32,  b_size                  )
272                 __field(        __u32,  b_state                 )
273                 __field(        unsigned long,  first_page      )
274                 __field(        int,    io_done                 )
275                 __field(        int,    pages_written           )
276         ),
277
278         TP_fast_assign(
279                 __entry->dev            = inode->i_sb->s_dev;
280                 __entry->ino            = inode->i_ino;
281                 __entry->b_blocknr      = mpd->b_blocknr;
282                 __entry->b_size         = mpd->b_size;
283                 __entry->b_state        = mpd->b_state;
284                 __entry->first_page     = mpd->first_page;
285                 __entry->io_done        = mpd->io_done;
286                 __entry->pages_written  = mpd->pages_written;
287         ),
288
289         TP_printk("dev %s ino %lu b_blocknr %llu b_size %u b_state 0x%04x first_page %lu io_done %d pages_written %d",
290                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
291                   __entry->b_blocknr, __entry->b_size,
292                   __entry->b_state, __entry->first_page,
293                   __entry->io_done, __entry->pages_written)
294 );
295
296 TRACE_EVENT(ext4_da_writepages_result,
297         TP_PROTO(struct inode *inode, struct writeback_control *wbc,
298                         int ret, int pages_written),
299
300         TP_ARGS(inode, wbc, ret, pages_written),
301
302         TP_STRUCT__entry(
303                 __field(        dev_t,  dev                     )
304                 __field(        ino_t,  ino                     )
305                 __field(        int,    ret                     )
306                 __field(        int,    pages_written           )
307                 __field(        long,   pages_skipped           )
308                 __field(        char,   more_io                 )       
309                 __field(        char,   no_nrwrite_index_update )
310                 __field(       pgoff_t, writeback_index         )
311         ),
312
313         TP_fast_assign(
314                 __entry->dev            = inode->i_sb->s_dev;
315                 __entry->ino            = inode->i_ino;
316                 __entry->ret            = ret;
317                 __entry->pages_written  = pages_written;
318                 __entry->pages_skipped  = wbc->pages_skipped;
319                 __entry->more_io        = wbc->more_io;
320                 __entry->no_nrwrite_index_update = wbc->no_nrwrite_index_update;
321                 __entry->writeback_index = inode->i_mapping->writeback_index;
322         ),
323
324         TP_printk("dev %s ino %lu ret %d pages_written %d pages_skipped %ld more_io %d no_nrwrite_index_update %d writeback_index %lu",
325                   jbd2_dev_to_name(__entry->dev),
326                   (unsigned long) __entry->ino, __entry->ret,
327                   __entry->pages_written, __entry->pages_skipped,
328                   __entry->more_io,
329                   __entry->no_nrwrite_index_update,
330                   (unsigned long) __entry->writeback_index)
331 );
332
333 TRACE_EVENT(ext4_discard_blocks,
334         TP_PROTO(struct super_block *sb, unsigned long long blk,
335                         unsigned long long count),
336
337         TP_ARGS(sb, blk, count),
338
339         TP_STRUCT__entry(
340                 __field(        dev_t,  dev                     )
341                 __field(        __u64,  blk                     )
342                 __field(        __u64,  count                   )
343
344         ),
345
346         TP_fast_assign(
347                 __entry->dev    = sb->s_dev;
348                 __entry->blk    = blk;
349                 __entry->count  = count;
350         ),
351
352         TP_printk("dev %s blk %llu count %llu",
353                   jbd2_dev_to_name(__entry->dev), __entry->blk, __entry->count)
354 );
355
356 TRACE_EVENT(ext4_mb_new_inode_pa,
357         TP_PROTO(struct ext4_allocation_context *ac,
358                  struct ext4_prealloc_space *pa),
359
360         TP_ARGS(ac, pa),
361
362         TP_STRUCT__entry(
363                 __field(        dev_t,  dev                     )
364                 __field(        ino_t,  ino                     )
365                 __field(        __u64,  pa_pstart               )
366                 __field(        __u32,  pa_len                  )
367                 __field(        __u64,  pa_lstart               )
368
369         ),
370
371         TP_fast_assign(
372                 __entry->dev            = ac->ac_sb->s_dev;
373                 __entry->ino            = ac->ac_inode->i_ino;
374                 __entry->pa_pstart      = pa->pa_pstart;
375                 __entry->pa_len         = pa->pa_len;
376                 __entry->pa_lstart      = pa->pa_lstart;
377         ),
378
379         TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu",
380                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
381                   __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
382 );
383
384 TRACE_EVENT(ext4_mb_new_group_pa,
385         TP_PROTO(struct ext4_allocation_context *ac,
386                  struct ext4_prealloc_space *pa),
387
388         TP_ARGS(ac, pa),
389
390         TP_STRUCT__entry(
391                 __field(        dev_t,  dev                     )
392                 __field(        ino_t,  ino                     )
393                 __field(        __u64,  pa_pstart               )
394                 __field(        __u32,  pa_len                  )
395                 __field(        __u64,  pa_lstart               )
396
397         ),
398
399         TP_fast_assign(
400                 __entry->dev            = ac->ac_sb->s_dev;
401                 __entry->ino            = ac->ac_inode->i_ino;
402                 __entry->pa_pstart      = pa->pa_pstart;
403                 __entry->pa_len         = pa->pa_len;
404                 __entry->pa_lstart      = pa->pa_lstart;
405         ),
406
407         TP_printk("dev %s ino %lu pstart %llu len %u lstart %llu",
408                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
409                   __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
410 );
411
412 TRACE_EVENT(ext4_mb_release_inode_pa,
413         TP_PROTO(struct ext4_allocation_context *ac,
414                  struct ext4_prealloc_space *pa,
415                  unsigned long long block, unsigned int count),
416
417         TP_ARGS(ac, pa, block, count),
418
419         TP_STRUCT__entry(
420                 __field(        dev_t,  dev                     )
421                 __field(        ino_t,  ino                     )
422                 __field(        __u64,  block                   )
423                 __field(        __u32,  count                   )
424
425         ),
426
427         TP_fast_assign(
428                 __entry->dev            = ac->ac_sb->s_dev;
429                 __entry->ino            = ac->ac_inode->i_ino;
430                 __entry->block          = block;
431                 __entry->count          = count;
432         ),
433
434         TP_printk("dev %s ino %lu block %llu count %u",
435                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
436                   __entry->block, __entry->count)
437 );
438
439 TRACE_EVENT(ext4_mb_release_group_pa,
440         TP_PROTO(struct ext4_allocation_context *ac,
441                  struct ext4_prealloc_space *pa),
442
443         TP_ARGS(ac, pa),
444
445         TP_STRUCT__entry(
446                 __field(        dev_t,  dev                     )
447                 __field(        ino_t,  ino                     )
448                 __field(        __u64,  pa_pstart               )
449                 __field(        __u32,  pa_len                  )
450
451         ),
452
453         TP_fast_assign(
454                 __entry->dev            = ac->ac_sb->s_dev;
455                 __entry->ino            = ac->ac_inode->i_ino;
456                 __entry->pa_pstart      = pa->pa_pstart;
457                 __entry->pa_len         = pa->pa_len;
458         ),
459
460         TP_printk("dev %s pstart %llu len %u",
461                   jbd2_dev_to_name(__entry->dev), __entry->pa_pstart, __entry->pa_len)
462 );
463
464 TRACE_EVENT(ext4_discard_preallocations,
465         TP_PROTO(struct inode *inode),
466
467         TP_ARGS(inode),
468
469         TP_STRUCT__entry(
470                 __field(        dev_t,  dev                     )
471                 __field(        ino_t,  ino                     )
472
473         ),
474
475         TP_fast_assign(
476                 __entry->dev    = inode->i_sb->s_dev;
477                 __entry->ino    = inode->i_ino;
478         ),
479
480         TP_printk("dev %s ino %lu",
481                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino)
482 );
483
484 TRACE_EVENT(ext4_mb_discard_preallocations,
485         TP_PROTO(struct super_block *sb, int needed),
486
487         TP_ARGS(sb, needed),
488
489         TP_STRUCT__entry(
490                 __field(        dev_t,  dev                     )
491                 __field(        int,    needed                  )
492
493         ),
494
495         TP_fast_assign(
496                 __entry->dev    = sb->s_dev;
497                 __entry->needed = needed;
498         ),
499
500         TP_printk("dev %s needed %d",
501                   jbd2_dev_to_name(__entry->dev), __entry->needed)
502 );
503
504 TRACE_EVENT(ext4_request_blocks,
505         TP_PROTO(struct ext4_allocation_request *ar),
506
507         TP_ARGS(ar),
508
509         TP_STRUCT__entry(
510                 __field(        dev_t,  dev                     )
511                 __field(        ino_t,  ino                     )
512                 __field(        unsigned int, flags             )
513                 __field(        unsigned int, len               )
514                 __field(        __u64,  logical                 )
515                 __field(        __u64,  goal                    )
516                 __field(        __u64,  lleft                   )
517                 __field(        __u64,  lright                  )
518                 __field(        __u64,  pleft                   )
519                 __field(        __u64,  pright                  )
520         ),
521
522         TP_fast_assign(
523                 __entry->dev    = ar->inode->i_sb->s_dev;
524                 __entry->ino    = ar->inode->i_ino;
525                 __entry->flags  = ar->flags;
526                 __entry->len    = ar->len;
527                 __entry->logical = ar->logical;
528                 __entry->goal   = ar->goal;
529                 __entry->lleft  = ar->lleft;
530                 __entry->lright = ar->lright;
531                 __entry->pleft  = ar->pleft;
532                 __entry->pright = ar->pright;
533         ),
534
535         TP_printk("dev %s ino %lu flags %u len %u lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ",
536                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
537                   __entry->flags, __entry->len,
538                   (unsigned long long) __entry->logical,
539                   (unsigned long long) __entry->goal,
540                   (unsigned long long) __entry->lleft,
541                   (unsigned long long) __entry->lright,
542                   (unsigned long long) __entry->pleft,
543                   (unsigned long long) __entry->pright)
544 );
545
546 TRACE_EVENT(ext4_allocate_blocks,
547         TP_PROTO(struct ext4_allocation_request *ar, unsigned long long block),
548
549         TP_ARGS(ar, block),
550
551         TP_STRUCT__entry(
552                 __field(        dev_t,  dev                     )
553                 __field(        ino_t,  ino                     )
554                 __field(        __u64,  block                   )
555                 __field(        unsigned int, flags             )
556                 __field(        unsigned int, len               )
557                 __field(        __u64,  logical                 )
558                 __field(        __u64,  goal                    )
559                 __field(        __u64,  lleft                   )
560                 __field(        __u64,  lright                  )
561                 __field(        __u64,  pleft                   )
562                 __field(        __u64,  pright                  )
563         ),
564
565         TP_fast_assign(
566                 __entry->dev    = ar->inode->i_sb->s_dev;
567                 __entry->ino    = ar->inode->i_ino;
568                 __entry->block  = block;
569                 __entry->flags  = ar->flags;
570                 __entry->len    = ar->len;
571                 __entry->logical = ar->logical;
572                 __entry->goal   = ar->goal;
573                 __entry->lleft  = ar->lleft;
574                 __entry->lright = ar->lright;
575                 __entry->pleft  = ar->pleft;
576                 __entry->pright = ar->pright;
577         ),
578
579         TP_printk("dev %s ino %lu flags %u len %u block %llu lblk %llu goal %llu lleft %llu lright %llu pleft %llu pright %llu ",
580                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
581                   __entry->flags, __entry->len, __entry->block,
582                   (unsigned long long) __entry->logical,
583                   (unsigned long long) __entry->goal,
584                   (unsigned long long) __entry->lleft,
585                   (unsigned long long) __entry->lright,
586                   (unsigned long long) __entry->pleft,
587                   (unsigned long long) __entry->pright)
588 );
589
590 TRACE_EVENT(ext4_free_blocks,
591         TP_PROTO(struct inode *inode, __u64 block, unsigned long count,
592                  int flags),
593
594         TP_ARGS(inode, block, count, flags),
595
596         TP_STRUCT__entry(
597                 __field(        dev_t,  dev                     )
598                 __field(        ino_t,  ino                     )
599                 __field(      umode_t, mode                     )
600                 __field(        __u64,  block                   )
601                 __field(        unsigned long,  count           )
602                 __field(         int,   flags                   )
603         ),
604
605         TP_fast_assign(
606                 __entry->dev            = inode->i_sb->s_dev;
607                 __entry->ino            = inode->i_ino;
608                 __entry->mode           = inode->i_mode;
609                 __entry->block          = block;
610                 __entry->count          = count;
611                 __entry->flags          = flags;
612         ),
613
614         TP_printk("dev %s ino %lu mode 0%o block %llu count %lu flags %d",
615                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
616                   __entry->mode, __entry->block, __entry->count,
617                   __entry->flags)
618 );
619
620 TRACE_EVENT(ext4_sync_file,
621         TP_PROTO(struct file *file, struct dentry *dentry, int datasync),
622
623         TP_ARGS(file, dentry, datasync),
624
625         TP_STRUCT__entry(
626                 __field(        dev_t,  dev                     )
627                 __field(        ino_t,  ino                     )
628                 __field(        ino_t,  parent                  )
629                 __field(        int,    datasync                )
630         ),
631
632         TP_fast_assign(
633                 __entry->dev            = dentry->d_inode->i_sb->s_dev;
634                 __entry->ino            = dentry->d_inode->i_ino;
635                 __entry->datasync       = datasync;
636                 __entry->parent         = dentry->d_parent->d_inode->i_ino;
637         ),
638
639         TP_printk("dev %s ino %ld parent %ld datasync %d ",
640                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
641                   (unsigned long) __entry->parent, __entry->datasync)
642 );
643
644 TRACE_EVENT(ext4_sync_fs,
645         TP_PROTO(struct super_block *sb, int wait),
646
647         TP_ARGS(sb, wait),
648
649         TP_STRUCT__entry(
650                 __field(        dev_t,  dev                     )
651                 __field(        int,    wait                    )
652
653         ),
654
655         TP_fast_assign(
656                 __entry->dev    = sb->s_dev;
657                 __entry->wait   = wait;
658         ),
659
660         TP_printk("dev %s wait %d", jbd2_dev_to_name(__entry->dev),
661                   __entry->wait)
662 );
663
664 TRACE_EVENT(ext4_alloc_da_blocks,
665         TP_PROTO(struct inode *inode),
666
667         TP_ARGS(inode),
668
669         TP_STRUCT__entry(
670                 __field(        dev_t,  dev                     )
671                 __field(        ino_t,  ino                     )
672                 __field( unsigned int,  data_blocks     )
673                 __field( unsigned int,  meta_blocks     )
674         ),
675
676         TP_fast_assign(
677                 __entry->dev    = inode->i_sb->s_dev;
678                 __entry->ino    = inode->i_ino;
679                 __entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
680                 __entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
681         ),
682
683         TP_printk("dev %s ino %lu data_blocks %u meta_blocks %u",
684                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
685                   __entry->data_blocks, __entry->meta_blocks)
686 );
687
688 TRACE_EVENT(ext4_mballoc_alloc,
689         TP_PROTO(struct ext4_allocation_context *ac),
690
691         TP_ARGS(ac),
692
693         TP_STRUCT__entry(
694                 __field(        dev_t,  dev                     )
695                 __field(        ino_t,  ino                     )
696                 __field(        __u16,  found                   )
697                 __field(        __u16,  groups                  )
698                 __field(        __u16,  buddy                   )
699                 __field(        __u16,  flags                   )
700                 __field(        __u16,  tail                    )
701                 __field(        __u8,   cr                      )
702                 __field(        __u32,  orig_logical            )
703                 __field(          int,  orig_start              )
704                 __field(        __u32,  orig_group              )
705                 __field(          int,  orig_len                )
706                 __field(        __u32,  goal_logical            )
707                 __field(          int,  goal_start              )
708                 __field(        __u32,  goal_group              )
709                 __field(          int,  goal_len                )
710                 __field(        __u32,  result_logical          )
711                 __field(          int,  result_start            )
712                 __field(        __u32,  result_group            )
713                 __field(          int,  result_len              )
714         ),
715
716         TP_fast_assign(
717                 __entry->dev            = ac->ac_inode->i_sb->s_dev;
718                 __entry->ino            = ac->ac_inode->i_ino;
719                 __entry->found          = ac->ac_found;
720                 __entry->flags          = ac->ac_flags;
721                 __entry->groups         = ac->ac_groups_scanned;
722                 __entry->buddy          = ac->ac_buddy;
723                 __entry->tail           = ac->ac_tail;
724                 __entry->cr             = ac->ac_criteria;
725                 __entry->orig_logical   = ac->ac_o_ex.fe_logical;
726                 __entry->orig_start     = ac->ac_o_ex.fe_start;
727                 __entry->orig_group     = ac->ac_o_ex.fe_group;
728                 __entry->orig_len       = ac->ac_o_ex.fe_len;
729                 __entry->goal_logical   = ac->ac_g_ex.fe_logical;
730                 __entry->goal_start     = ac->ac_g_ex.fe_start;
731                 __entry->goal_group     = ac->ac_g_ex.fe_group;
732                 __entry->goal_len       = ac->ac_g_ex.fe_len;
733                 __entry->result_logical = ac->ac_f_ex.fe_logical;
734                 __entry->result_start   = ac->ac_f_ex.fe_start;
735                 __entry->result_group   = ac->ac_f_ex.fe_group;
736                 __entry->result_len     = ac->ac_f_ex.fe_len;
737         ),
738
739         TP_printk("dev %s inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
740                   "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x "
741                   "tail %u broken %u",
742                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
743                   __entry->orig_group, __entry->orig_start,
744                   __entry->orig_len, __entry->orig_logical,
745                   __entry->goal_group, __entry->goal_start,
746                   __entry->goal_len, __entry->goal_logical,
747                   __entry->result_group, __entry->result_start,
748                   __entry->result_len, __entry->result_logical,
749                   __entry->found, __entry->groups, __entry->cr,
750                   __entry->flags, __entry->tail,
751                   __entry->buddy ? 1 << __entry->buddy : 0)
752 );
753
754 TRACE_EVENT(ext4_mballoc_prealloc,
755         TP_PROTO(struct ext4_allocation_context *ac),
756
757         TP_ARGS(ac),
758
759         TP_STRUCT__entry(
760                 __field(        dev_t,  dev                     )
761                 __field(        ino_t,  ino                     )
762                 __field(        __u32,  orig_logical            )
763                 __field(          int,  orig_start              )
764                 __field(        __u32,  orig_group              )
765                 __field(          int,  orig_len                )
766                 __field(        __u32,  result_logical          )
767                 __field(          int,  result_start            )
768                 __field(        __u32,  result_group            )
769                 __field(          int,  result_len              )
770         ),
771
772         TP_fast_assign(
773                 __entry->dev            = ac->ac_inode->i_sb->s_dev;
774                 __entry->ino            = ac->ac_inode->i_ino;
775                 __entry->orig_logical   = ac->ac_o_ex.fe_logical;
776                 __entry->orig_start     = ac->ac_o_ex.fe_start;
777                 __entry->orig_group     = ac->ac_o_ex.fe_group;
778                 __entry->orig_len       = ac->ac_o_ex.fe_len;
779                 __entry->result_logical = ac->ac_b_ex.fe_logical;
780                 __entry->result_start   = ac->ac_b_ex.fe_start;
781                 __entry->result_group   = ac->ac_b_ex.fe_group;
782                 __entry->result_len     = ac->ac_b_ex.fe_len;
783         ),
784
785         TP_printk("dev %s inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
786                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
787                   __entry->orig_group, __entry->orig_start,
788                   __entry->orig_len, __entry->orig_logical,
789                   __entry->result_group, __entry->result_start,
790                   __entry->result_len, __entry->result_logical)
791 );
792
793 TRACE_EVENT(ext4_mballoc_discard,
794         TP_PROTO(struct ext4_allocation_context *ac),
795
796         TP_ARGS(ac),
797
798         TP_STRUCT__entry(
799                 __field(        dev_t,  dev                     )
800                 __field(        ino_t,  ino                     )
801                 __field(        __u32,  result_logical          )
802                 __field(          int,  result_start            )
803                 __field(        __u32,  result_group            )
804                 __field(          int,  result_len              )
805         ),
806
807         TP_fast_assign(
808                 __entry->dev            = ac->ac_inode->i_sb->s_dev;
809                 __entry->ino            = ac->ac_inode->i_ino;
810                 __entry->result_logical = ac->ac_b_ex.fe_logical;
811                 __entry->result_start   = ac->ac_b_ex.fe_start;
812                 __entry->result_group   = ac->ac_b_ex.fe_group;
813                 __entry->result_len     = ac->ac_b_ex.fe_len;
814         ),
815
816         TP_printk("dev %s inode %lu extent %u/%d/%u@%u ",
817                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
818                   __entry->result_group, __entry->result_start,
819                   __entry->result_len, __entry->result_logical)
820 );
821
822 TRACE_EVENT(ext4_mballoc_free,
823         TP_PROTO(struct ext4_allocation_context *ac),
824
825         TP_ARGS(ac),
826
827         TP_STRUCT__entry(
828                 __field(        dev_t,  dev                     )
829                 __field(        ino_t,  ino                     )
830                 __field(        __u32,  result_logical          )
831                 __field(          int,  result_start            )
832                 __field(        __u32,  result_group            )
833                 __field(          int,  result_len              )
834         ),
835
836         TP_fast_assign(
837                 __entry->dev            = ac->ac_inode->i_sb->s_dev;
838                 __entry->ino            = ac->ac_inode->i_ino;
839                 __entry->result_logical = ac->ac_b_ex.fe_logical;
840                 __entry->result_start   = ac->ac_b_ex.fe_start;
841                 __entry->result_group   = ac->ac_b_ex.fe_group;
842                 __entry->result_len     = ac->ac_b_ex.fe_len;
843         ),
844
845         TP_printk("dev %s inode %lu extent %u/%d/%u@%u ",
846                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
847                   __entry->result_group, __entry->result_start,
848                   __entry->result_len, __entry->result_logical)
849 );
850
851 TRACE_EVENT(ext4_forget,
852         TP_PROTO(struct inode *inode, int is_metadata, __u64 block),
853
854         TP_ARGS(inode, is_metadata, block),
855
856         TP_STRUCT__entry(
857                 __field(        dev_t,  dev                     )
858                 __field(        ino_t,  ino                     )
859                 __field(        umode_t, mode                   )
860                 __field(        int,    is_metadata             )
861                 __field(        __u64,  block                   )
862         ),
863
864         TP_fast_assign(
865                 __entry->dev    = inode->i_sb->s_dev;
866                 __entry->ino    = inode->i_ino;
867                 __entry->mode   = inode->i_mode;
868                 __entry->is_metadata = is_metadata;
869                 __entry->block  = block;
870         ),
871
872         TP_printk("dev %s ino %lu mode 0%o is_metadata %d block %llu",
873                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
874                   __entry->mode, __entry->is_metadata, __entry->block)
875 );
876
877 TRACE_EVENT(ext4_da_update_reserve_space,
878         TP_PROTO(struct inode *inode, int used_blocks),
879
880         TP_ARGS(inode, used_blocks),
881
882         TP_STRUCT__entry(
883                 __field(        dev_t,  dev                     )
884                 __field(        ino_t,  ino                     )
885                 __field(        umode_t, mode                   )
886                 __field(        __u64,  i_blocks                )
887                 __field(        int,    used_blocks             )
888                 __field(        int,    reserved_data_blocks    )
889                 __field(        int,    reserved_meta_blocks    )
890                 __field(        int,    allocated_meta_blocks   )
891         ),
892
893         TP_fast_assign(
894                 __entry->dev    = inode->i_sb->s_dev;
895                 __entry->ino    = inode->i_ino;
896                 __entry->mode   = inode->i_mode;
897                 __entry->i_blocks = inode->i_blocks;
898                 __entry->used_blocks = used_blocks;
899                 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
900                 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
901                 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
902         ),
903
904         TP_printk("dev %s ino %lu mode 0%o i_blocks %llu used_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d",
905                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
906                   __entry->mode,  (unsigned long long) __entry->i_blocks,
907                   __entry->used_blocks, __entry->reserved_data_blocks,
908                   __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
909 );
910
911 TRACE_EVENT(ext4_da_reserve_space,
912         TP_PROTO(struct inode *inode, int md_needed),
913
914         TP_ARGS(inode, md_needed),
915
916         TP_STRUCT__entry(
917                 __field(        dev_t,  dev                     )
918                 __field(        ino_t,  ino                     )
919                 __field(        umode_t, mode                   )
920                 __field(        __u64,  i_blocks                )
921                 __field(        int,    md_needed               )
922                 __field(        int,    reserved_data_blocks    )
923                 __field(        int,    reserved_meta_blocks    )
924         ),
925
926         TP_fast_assign(
927                 __entry->dev    = inode->i_sb->s_dev;
928                 __entry->ino    = inode->i_ino;
929                 __entry->mode   = inode->i_mode;
930                 __entry->i_blocks = inode->i_blocks;
931                 __entry->md_needed = md_needed;
932                 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
933                 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
934         ),
935
936         TP_printk("dev %s ino %lu mode 0%o i_blocks %llu md_needed %d reserved_data_blocks %d reserved_meta_blocks %d",
937                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
938                   __entry->mode, (unsigned long long) __entry->i_blocks,
939                   __entry->md_needed, __entry->reserved_data_blocks,
940                   __entry->reserved_meta_blocks)
941 );
942
943 TRACE_EVENT(ext4_da_release_space,
944         TP_PROTO(struct inode *inode, int freed_blocks),
945
946         TP_ARGS(inode, freed_blocks),
947
948         TP_STRUCT__entry(
949                 __field(        dev_t,  dev                     )
950                 __field(        ino_t,  ino                     )
951                 __field(        umode_t, mode                   )
952                 __field(        __u64,  i_blocks                )
953                 __field(        int,    freed_blocks            )
954                 __field(        int,    reserved_data_blocks    )
955                 __field(        int,    reserved_meta_blocks    )
956                 __field(        int,    allocated_meta_blocks   )
957         ),
958
959         TP_fast_assign(
960                 __entry->dev    = inode->i_sb->s_dev;
961                 __entry->ino    = inode->i_ino;
962                 __entry->mode   = inode->i_mode;
963                 __entry->i_blocks = inode->i_blocks;
964                 __entry->freed_blocks = freed_blocks;
965                 __entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
966                 __entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
967                 __entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
968         ),
969
970         TP_printk("dev %s ino %lu mode 0%o i_blocks %llu freed_blocks %d reserved_data_blocks %d reserved_meta_blocks %d allocated_meta_blocks %d",
971                   jbd2_dev_to_name(__entry->dev), (unsigned long) __entry->ino,
972                   __entry->mode, (unsigned long long) __entry->i_blocks,
973                   __entry->freed_blocks, __entry->reserved_data_blocks,
974                   __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
975 );
976
977
978 #endif /* _TRACE_EXT4_H */
979
980 /* This part must be outside protection */
981 #include <trace/define_trace.h>