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