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