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