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