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