xref: /openbmc/linux/include/trace/events/ext4.h (revision d4295e12)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM ext4
4 
5 #if !defined(_TRACE_EXT4_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_EXT4_H
7 
8 #include <linux/writeback.h>
9 #include <linux/tracepoint.h>
10 
11 struct ext4_allocation_context;
12 struct ext4_allocation_request;
13 struct ext4_extent;
14 struct ext4_prealloc_space;
15 struct ext4_inode_info;
16 struct mpage_da_data;
17 struct ext4_map_blocks;
18 struct extent_status;
19 struct ext4_fsmap;
20 struct partial_cluster;
21 
22 #define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode))
23 
24 #define show_mballoc_flags(flags) __print_flags(flags, "|",	\
25 	{ EXT4_MB_HINT_MERGE,		"HINT_MERGE" },		\
26 	{ EXT4_MB_HINT_RESERVED,	"HINT_RESV" },		\
27 	{ EXT4_MB_HINT_METADATA,	"HINT_MDATA" },		\
28 	{ EXT4_MB_HINT_FIRST,		"HINT_FIRST" },		\
29 	{ EXT4_MB_HINT_BEST,		"HINT_BEST" },		\
30 	{ EXT4_MB_HINT_DATA,		"HINT_DATA" },		\
31 	{ EXT4_MB_HINT_NOPREALLOC,	"HINT_NOPREALLOC" },	\
32 	{ EXT4_MB_HINT_GROUP_ALLOC,	"HINT_GRP_ALLOC" },	\
33 	{ EXT4_MB_HINT_GOAL_ONLY,	"HINT_GOAL_ONLY" },	\
34 	{ EXT4_MB_HINT_TRY_GOAL,	"HINT_TRY_GOAL" },	\
35 	{ EXT4_MB_DELALLOC_RESERVED,	"DELALLOC_RESV" },	\
36 	{ EXT4_MB_STREAM_ALLOC,		"STREAM_ALLOC" },	\
37 	{ EXT4_MB_USE_ROOT_BLOCKS,	"USE_ROOT_BLKS" },	\
38 	{ EXT4_MB_USE_RESERVED,		"USE_RESV" })
39 
40 #define show_map_flags(flags) __print_flags(flags, "|",			\
41 	{ EXT4_GET_BLOCKS_CREATE,		"CREATE" },		\
42 	{ EXT4_GET_BLOCKS_UNWRIT_EXT,		"UNWRIT" },		\
43 	{ EXT4_GET_BLOCKS_DELALLOC_RESERVE,	"DELALLOC" },		\
44 	{ EXT4_GET_BLOCKS_PRE_IO,		"PRE_IO" },		\
45 	{ EXT4_GET_BLOCKS_CONVERT,		"CONVERT" },		\
46 	{ EXT4_GET_BLOCKS_METADATA_NOFAIL,	"METADATA_NOFAIL" },	\
47 	{ EXT4_GET_BLOCKS_NO_NORMALIZE,		"NO_NORMALIZE" },	\
48 	{ EXT4_GET_BLOCKS_KEEP_SIZE,		"KEEP_SIZE" },		\
49 	{ EXT4_GET_BLOCKS_ZERO,			"ZERO" })
50 
51 #define show_mflags(flags) __print_flags(flags, "",	\
52 	{ EXT4_MAP_NEW,		"N" },			\
53 	{ EXT4_MAP_MAPPED,	"M" },			\
54 	{ EXT4_MAP_UNWRITTEN,	"U" },			\
55 	{ EXT4_MAP_BOUNDARY,	"B" })
56 
57 #define show_free_flags(flags) __print_flags(flags, "|",	\
58 	{ EXT4_FREE_BLOCKS_METADATA,		"METADATA" },	\
59 	{ EXT4_FREE_BLOCKS_FORGET,		"FORGET" },	\
60 	{ EXT4_FREE_BLOCKS_VALIDATED,		"VALIDATED" },	\
61 	{ EXT4_FREE_BLOCKS_NO_QUOT_UPDATE,	"NO_QUOTA" },	\
62 	{ EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER,"1ST_CLUSTER" },\
63 	{ EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER,	"LAST_CLUSTER" })
64 
65 #define show_extent_status(status) __print_flags(status, "",	\
66 	{ EXTENT_STATUS_WRITTEN,	"W" },			\
67 	{ EXTENT_STATUS_UNWRITTEN,	"U" },			\
68 	{ EXTENT_STATUS_DELAYED,	"D" },			\
69 	{ EXTENT_STATUS_HOLE,		"H" })
70 
71 #define show_falloc_mode(mode) __print_flags(mode, "|",		\
72 	{ FALLOC_FL_KEEP_SIZE,		"KEEP_SIZE"},		\
73 	{ FALLOC_FL_PUNCH_HOLE,		"PUNCH_HOLE"},		\
74 	{ FALLOC_FL_NO_HIDE_STALE,	"NO_HIDE_STALE"},	\
75 	{ FALLOC_FL_COLLAPSE_RANGE,	"COLLAPSE_RANGE"},	\
76 	{ FALLOC_FL_ZERO_RANGE,		"ZERO_RANGE"})
77 
78 
79 TRACE_EVENT(ext4_other_inode_update_time,
80 	TP_PROTO(struct inode *inode, ino_t orig_ino),
81 
82 	TP_ARGS(inode, orig_ino),
83 
84 	TP_STRUCT__entry(
85 		__field(	dev_t,	dev			)
86 		__field(	ino_t,	ino			)
87 		__field(	ino_t,	orig_ino		)
88 		__field(	uid_t,	uid			)
89 		__field(	gid_t,	gid			)
90 		__field(	__u16, mode			)
91 	),
92 
93 	TP_fast_assign(
94 		__entry->orig_ino = orig_ino;
95 		__entry->dev	= inode->i_sb->s_dev;
96 		__entry->ino	= inode->i_ino;
97 		__entry->uid	= i_uid_read(inode);
98 		__entry->gid	= i_gid_read(inode);
99 		__entry->mode	= inode->i_mode;
100 	),
101 
102 	TP_printk("dev %d,%d orig_ino %lu ino %lu mode 0%o uid %u gid %u",
103 		  MAJOR(__entry->dev), MINOR(__entry->dev),
104 		  (unsigned long) __entry->orig_ino,
105 		  (unsigned long) __entry->ino, __entry->mode,
106 		  __entry->uid, __entry->gid)
107 );
108 
109 TRACE_EVENT(ext4_free_inode,
110 	TP_PROTO(struct inode *inode),
111 
112 	TP_ARGS(inode),
113 
114 	TP_STRUCT__entry(
115 		__field(	dev_t,	dev			)
116 		__field(	ino_t,	ino			)
117 		__field(	uid_t,	uid			)
118 		__field(	gid_t,	gid			)
119 		__field(	__u64, blocks			)
120 		__field(	__u16, mode			)
121 	),
122 
123 	TP_fast_assign(
124 		__entry->dev	= inode->i_sb->s_dev;
125 		__entry->ino	= inode->i_ino;
126 		__entry->uid	= i_uid_read(inode);
127 		__entry->gid	= i_gid_read(inode);
128 		__entry->blocks	= inode->i_blocks;
129 		__entry->mode	= inode->i_mode;
130 	),
131 
132 	TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu",
133 		  MAJOR(__entry->dev), MINOR(__entry->dev),
134 		  (unsigned long) __entry->ino, __entry->mode,
135 		  __entry->uid, __entry->gid, __entry->blocks)
136 );
137 
138 TRACE_EVENT(ext4_request_inode,
139 	TP_PROTO(struct inode *dir, int mode),
140 
141 	TP_ARGS(dir, mode),
142 
143 	TP_STRUCT__entry(
144 		__field(	dev_t,	dev			)
145 		__field(	ino_t,	dir			)
146 		__field(	__u16, mode			)
147 	),
148 
149 	TP_fast_assign(
150 		__entry->dev	= dir->i_sb->s_dev;
151 		__entry->dir	= dir->i_ino;
152 		__entry->mode	= mode;
153 	),
154 
155 	TP_printk("dev %d,%d dir %lu mode 0%o",
156 		  MAJOR(__entry->dev), MINOR(__entry->dev),
157 		  (unsigned long) __entry->dir, __entry->mode)
158 );
159 
160 TRACE_EVENT(ext4_allocate_inode,
161 	TP_PROTO(struct inode *inode, struct inode *dir, int mode),
162 
163 	TP_ARGS(inode, dir, mode),
164 
165 	TP_STRUCT__entry(
166 		__field(	dev_t,	dev			)
167 		__field(	ino_t,	ino			)
168 		__field(	ino_t,	dir			)
169 		__field(	__u16,	mode			)
170 	),
171 
172 	TP_fast_assign(
173 		__entry->dev	= inode->i_sb->s_dev;
174 		__entry->ino	= inode->i_ino;
175 		__entry->dir	= dir->i_ino;
176 		__entry->mode	= mode;
177 	),
178 
179 	TP_printk("dev %d,%d ino %lu dir %lu mode 0%o",
180 		  MAJOR(__entry->dev), MINOR(__entry->dev),
181 		  (unsigned long) __entry->ino,
182 		  (unsigned long) __entry->dir, __entry->mode)
183 );
184 
185 TRACE_EVENT(ext4_evict_inode,
186 	TP_PROTO(struct inode *inode),
187 
188 	TP_ARGS(inode),
189 
190 	TP_STRUCT__entry(
191 		__field(	dev_t,	dev			)
192 		__field(	ino_t,	ino			)
193 		__field(	int,	nlink			)
194 	),
195 
196 	TP_fast_assign(
197 		__entry->dev	= inode->i_sb->s_dev;
198 		__entry->ino	= inode->i_ino;
199 		__entry->nlink	= inode->i_nlink;
200 	),
201 
202 	TP_printk("dev %d,%d ino %lu nlink %d",
203 		  MAJOR(__entry->dev), MINOR(__entry->dev),
204 		  (unsigned long) __entry->ino, __entry->nlink)
205 );
206 
207 TRACE_EVENT(ext4_drop_inode,
208 	TP_PROTO(struct inode *inode, int drop),
209 
210 	TP_ARGS(inode, drop),
211 
212 	TP_STRUCT__entry(
213 		__field(	dev_t,	dev			)
214 		__field(	ino_t,	ino			)
215 		__field(	int,	drop			)
216 	),
217 
218 	TP_fast_assign(
219 		__entry->dev	= inode->i_sb->s_dev;
220 		__entry->ino	= inode->i_ino;
221 		__entry->drop	= drop;
222 	),
223 
224 	TP_printk("dev %d,%d ino %lu drop %d",
225 		  MAJOR(__entry->dev), MINOR(__entry->dev),
226 		  (unsigned long) __entry->ino, __entry->drop)
227 );
228 
229 TRACE_EVENT(ext4_mark_inode_dirty,
230 	TP_PROTO(struct inode *inode, unsigned long IP),
231 
232 	TP_ARGS(inode, IP),
233 
234 	TP_STRUCT__entry(
235 		__field(	dev_t,	dev			)
236 		__field(	ino_t,	ino			)
237 		__field(unsigned long,	ip			)
238 	),
239 
240 	TP_fast_assign(
241 		__entry->dev	= inode->i_sb->s_dev;
242 		__entry->ino	= inode->i_ino;
243 		__entry->ip	= IP;
244 	),
245 
246 	TP_printk("dev %d,%d ino %lu caller %pS",
247 		  MAJOR(__entry->dev), MINOR(__entry->dev),
248 		  (unsigned long) __entry->ino, (void *)__entry->ip)
249 );
250 
251 TRACE_EVENT(ext4_begin_ordered_truncate,
252 	TP_PROTO(struct inode *inode, loff_t new_size),
253 
254 	TP_ARGS(inode, new_size),
255 
256 	TP_STRUCT__entry(
257 		__field(	dev_t,	dev			)
258 		__field(	ino_t,	ino			)
259 		__field(	loff_t,	new_size		)
260 	),
261 
262 	TP_fast_assign(
263 		__entry->dev		= inode->i_sb->s_dev;
264 		__entry->ino		= inode->i_ino;
265 		__entry->new_size	= new_size;
266 	),
267 
268 	TP_printk("dev %d,%d ino %lu new_size %lld",
269 		  MAJOR(__entry->dev), MINOR(__entry->dev),
270 		  (unsigned long) __entry->ino,
271 		  __entry->new_size)
272 );
273 
274 DECLARE_EVENT_CLASS(ext4__write_begin,
275 
276 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
277 		 unsigned int flags),
278 
279 	TP_ARGS(inode, pos, len, flags),
280 
281 	TP_STRUCT__entry(
282 		__field(	dev_t,	dev			)
283 		__field(	ino_t,	ino			)
284 		__field(	loff_t,	pos			)
285 		__field(	unsigned int, len		)
286 		__field(	unsigned int, flags		)
287 	),
288 
289 	TP_fast_assign(
290 		__entry->dev	= inode->i_sb->s_dev;
291 		__entry->ino	= inode->i_ino;
292 		__entry->pos	= pos;
293 		__entry->len	= len;
294 		__entry->flags	= flags;
295 	),
296 
297 	TP_printk("dev %d,%d ino %lu pos %lld len %u flags %u",
298 		  MAJOR(__entry->dev), MINOR(__entry->dev),
299 		  (unsigned long) __entry->ino,
300 		  __entry->pos, __entry->len, __entry->flags)
301 );
302 
303 DEFINE_EVENT(ext4__write_begin, ext4_write_begin,
304 
305 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
306 		 unsigned int flags),
307 
308 	TP_ARGS(inode, pos, len, flags)
309 );
310 
311 DEFINE_EVENT(ext4__write_begin, ext4_da_write_begin,
312 
313 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
314 		 unsigned int flags),
315 
316 	TP_ARGS(inode, pos, len, flags)
317 );
318 
319 DECLARE_EVENT_CLASS(ext4__write_end,
320 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
321 			unsigned int copied),
322 
323 	TP_ARGS(inode, pos, len, copied),
324 
325 	TP_STRUCT__entry(
326 		__field(	dev_t,	dev			)
327 		__field(	ino_t,	ino			)
328 		__field(	loff_t,	pos			)
329 		__field(	unsigned int, len		)
330 		__field(	unsigned int, copied		)
331 	),
332 
333 	TP_fast_assign(
334 		__entry->dev	= inode->i_sb->s_dev;
335 		__entry->ino	= inode->i_ino;
336 		__entry->pos	= pos;
337 		__entry->len	= len;
338 		__entry->copied	= copied;
339 	),
340 
341 	TP_printk("dev %d,%d ino %lu pos %lld len %u copied %u",
342 		  MAJOR(__entry->dev), MINOR(__entry->dev),
343 		  (unsigned long) __entry->ino,
344 		  __entry->pos, __entry->len, __entry->copied)
345 );
346 
347 DEFINE_EVENT(ext4__write_end, ext4_write_end,
348 
349 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
350 		 unsigned int copied),
351 
352 	TP_ARGS(inode, pos, len, copied)
353 );
354 
355 DEFINE_EVENT(ext4__write_end, ext4_journalled_write_end,
356 
357 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
358 		 unsigned int copied),
359 
360 	TP_ARGS(inode, pos, len, copied)
361 );
362 
363 DEFINE_EVENT(ext4__write_end, ext4_da_write_end,
364 
365 	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
366 		 unsigned int copied),
367 
368 	TP_ARGS(inode, pos, len, copied)
369 );
370 
371 TRACE_EVENT(ext4_writepages,
372 	TP_PROTO(struct inode *inode, struct writeback_control *wbc),
373 
374 	TP_ARGS(inode, wbc),
375 
376 	TP_STRUCT__entry(
377 		__field(	dev_t,	dev			)
378 		__field(	ino_t,	ino			)
379 		__field(	long,	nr_to_write		)
380 		__field(	long,	pages_skipped		)
381 		__field(	loff_t,	range_start		)
382 		__field(	loff_t,	range_end		)
383 		__field(       pgoff_t,	writeback_index		)
384 		__field(	int,	sync_mode		)
385 		__field(	char,	for_kupdate		)
386 		__field(	char,	range_cyclic		)
387 	),
388 
389 	TP_fast_assign(
390 		__entry->dev		= inode->i_sb->s_dev;
391 		__entry->ino		= inode->i_ino;
392 		__entry->nr_to_write	= wbc->nr_to_write;
393 		__entry->pages_skipped	= wbc->pages_skipped;
394 		__entry->range_start	= wbc->range_start;
395 		__entry->range_end	= wbc->range_end;
396 		__entry->writeback_index = inode->i_mapping->writeback_index;
397 		__entry->sync_mode	= wbc->sync_mode;
398 		__entry->for_kupdate	= wbc->for_kupdate;
399 		__entry->range_cyclic	= wbc->range_cyclic;
400 	),
401 
402 	TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld "
403 		  "range_start %lld range_end %lld sync_mode %d "
404 		  "for_kupdate %d range_cyclic %d writeback_index %lu",
405 		  MAJOR(__entry->dev), MINOR(__entry->dev),
406 		  (unsigned long) __entry->ino, __entry->nr_to_write,
407 		  __entry->pages_skipped, __entry->range_start,
408 		  __entry->range_end, __entry->sync_mode,
409 		  __entry->for_kupdate, __entry->range_cyclic,
410 		  (unsigned long) __entry->writeback_index)
411 );
412 
413 TRACE_EVENT(ext4_da_write_pages,
414 	TP_PROTO(struct inode *inode, pgoff_t first_page,
415 		 struct writeback_control *wbc),
416 
417 	TP_ARGS(inode, first_page, wbc),
418 
419 	TP_STRUCT__entry(
420 		__field(	dev_t,	dev			)
421 		__field(	ino_t,	ino			)
422 		__field(      pgoff_t,	first_page		)
423 		__field(	 long,	nr_to_write		)
424 		__field(	  int,	sync_mode		)
425 	),
426 
427 	TP_fast_assign(
428 		__entry->dev		= inode->i_sb->s_dev;
429 		__entry->ino		= inode->i_ino;
430 		__entry->first_page	= first_page;
431 		__entry->nr_to_write	= wbc->nr_to_write;
432 		__entry->sync_mode	= wbc->sync_mode;
433 	),
434 
435 	TP_printk("dev %d,%d ino %lu first_page %lu nr_to_write %ld "
436 		  "sync_mode %d",
437 		  MAJOR(__entry->dev), MINOR(__entry->dev),
438 		  (unsigned long) __entry->ino, __entry->first_page,
439 		  __entry->nr_to_write, __entry->sync_mode)
440 );
441 
442 TRACE_EVENT(ext4_da_write_pages_extent,
443 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map),
444 
445 	TP_ARGS(inode, map),
446 
447 	TP_STRUCT__entry(
448 		__field(	dev_t,	dev			)
449 		__field(	ino_t,	ino			)
450 		__field(	__u64,	lblk			)
451 		__field(	__u32,	len			)
452 		__field(	__u32,	flags			)
453 	),
454 
455 	TP_fast_assign(
456 		__entry->dev		= inode->i_sb->s_dev;
457 		__entry->ino		= inode->i_ino;
458 		__entry->lblk		= map->m_lblk;
459 		__entry->len		= map->m_len;
460 		__entry->flags		= map->m_flags;
461 	),
462 
463 	TP_printk("dev %d,%d ino %lu lblk %llu len %u flags %s",
464 		  MAJOR(__entry->dev), MINOR(__entry->dev),
465 		  (unsigned long) __entry->ino, __entry->lblk, __entry->len,
466 		  show_mflags(__entry->flags))
467 );
468 
469 TRACE_EVENT(ext4_writepages_result,
470 	TP_PROTO(struct inode *inode, struct writeback_control *wbc,
471 			int ret, int pages_written),
472 
473 	TP_ARGS(inode, wbc, ret, pages_written),
474 
475 	TP_STRUCT__entry(
476 		__field(	dev_t,	dev			)
477 		__field(	ino_t,	ino			)
478 		__field(	int,	ret			)
479 		__field(	int,	pages_written		)
480 		__field(	long,	pages_skipped		)
481 		__field(       pgoff_t,	writeback_index		)
482 		__field(	int,	sync_mode		)
483 	),
484 
485 	TP_fast_assign(
486 		__entry->dev		= inode->i_sb->s_dev;
487 		__entry->ino		= inode->i_ino;
488 		__entry->ret		= ret;
489 		__entry->pages_written	= pages_written;
490 		__entry->pages_skipped	= wbc->pages_skipped;
491 		__entry->writeback_index = inode->i_mapping->writeback_index;
492 		__entry->sync_mode	= wbc->sync_mode;
493 	),
494 
495 	TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld "
496 		  "sync_mode %d writeback_index %lu",
497 		  MAJOR(__entry->dev), MINOR(__entry->dev),
498 		  (unsigned long) __entry->ino, __entry->ret,
499 		  __entry->pages_written, __entry->pages_skipped,
500 		  __entry->sync_mode,
501 		  (unsigned long) __entry->writeback_index)
502 );
503 
504 DECLARE_EVENT_CLASS(ext4__page_op,
505 	TP_PROTO(struct page *page),
506 
507 	TP_ARGS(page),
508 
509 	TP_STRUCT__entry(
510 		__field(	dev_t,	dev			)
511 		__field(	ino_t,	ino			)
512 		__field(	pgoff_t, index			)
513 
514 	),
515 
516 	TP_fast_assign(
517 		__entry->dev	= page->mapping->host->i_sb->s_dev;
518 		__entry->ino	= page->mapping->host->i_ino;
519 		__entry->index	= page->index;
520 	),
521 
522 	TP_printk("dev %d,%d ino %lu page_index %lu",
523 		  MAJOR(__entry->dev), MINOR(__entry->dev),
524 		  (unsigned long) __entry->ino,
525 		  (unsigned long) __entry->index)
526 );
527 
528 DEFINE_EVENT(ext4__page_op, ext4_writepage,
529 
530 	TP_PROTO(struct page *page),
531 
532 	TP_ARGS(page)
533 );
534 
535 DEFINE_EVENT(ext4__page_op, ext4_readpage,
536 
537 	TP_PROTO(struct page *page),
538 
539 	TP_ARGS(page)
540 );
541 
542 DEFINE_EVENT(ext4__page_op, ext4_releasepage,
543 
544 	TP_PROTO(struct page *page),
545 
546 	TP_ARGS(page)
547 );
548 
549 DECLARE_EVENT_CLASS(ext4_invalidatepage_op,
550 	TP_PROTO(struct page *page, unsigned int offset, unsigned int length),
551 
552 	TP_ARGS(page, offset, length),
553 
554 	TP_STRUCT__entry(
555 		__field(	dev_t,	dev			)
556 		__field(	ino_t,	ino			)
557 		__field(	pgoff_t, index			)
558 		__field(	unsigned int, offset		)
559 		__field(	unsigned int, length		)
560 	),
561 
562 	TP_fast_assign(
563 		__entry->dev	= page->mapping->host->i_sb->s_dev;
564 		__entry->ino	= page->mapping->host->i_ino;
565 		__entry->index	= page->index;
566 		__entry->offset	= offset;
567 		__entry->length	= length;
568 	),
569 
570 	TP_printk("dev %d,%d ino %lu page_index %lu offset %u length %u",
571 		  MAJOR(__entry->dev), MINOR(__entry->dev),
572 		  (unsigned long) __entry->ino,
573 		  (unsigned long) __entry->index,
574 		  __entry->offset, __entry->length)
575 );
576 
577 DEFINE_EVENT(ext4_invalidatepage_op, ext4_invalidatepage,
578 	TP_PROTO(struct page *page, unsigned int offset, unsigned int length),
579 
580 	TP_ARGS(page, offset, length)
581 );
582 
583 DEFINE_EVENT(ext4_invalidatepage_op, ext4_journalled_invalidatepage,
584 	TP_PROTO(struct page *page, unsigned int offset, unsigned int length),
585 
586 	TP_ARGS(page, offset, length)
587 );
588 
589 TRACE_EVENT(ext4_discard_blocks,
590 	TP_PROTO(struct super_block *sb, unsigned long long blk,
591 			unsigned long long count),
592 
593 	TP_ARGS(sb, blk, count),
594 
595 	TP_STRUCT__entry(
596 		__field(	dev_t,	dev			)
597 		__field(	__u64,	blk			)
598 		__field(	__u64,	count			)
599 
600 	),
601 
602 	TP_fast_assign(
603 		__entry->dev	= sb->s_dev;
604 		__entry->blk	= blk;
605 		__entry->count	= count;
606 	),
607 
608 	TP_printk("dev %d,%d blk %llu count %llu",
609 		  MAJOR(__entry->dev), MINOR(__entry->dev),
610 		  __entry->blk, __entry->count)
611 );
612 
613 DECLARE_EVENT_CLASS(ext4__mb_new_pa,
614 	TP_PROTO(struct ext4_allocation_context *ac,
615 		 struct ext4_prealloc_space *pa),
616 
617 	TP_ARGS(ac, pa),
618 
619 	TP_STRUCT__entry(
620 		__field(	dev_t,	dev			)
621 		__field(	ino_t,	ino			)
622 		__field(	__u64,	pa_pstart		)
623 		__field(	__u64,	pa_lstart		)
624 		__field(	__u32,	pa_len			)
625 
626 	),
627 
628 	TP_fast_assign(
629 		__entry->dev		= ac->ac_sb->s_dev;
630 		__entry->ino		= ac->ac_inode->i_ino;
631 		__entry->pa_pstart	= pa->pa_pstart;
632 		__entry->pa_lstart	= pa->pa_lstart;
633 		__entry->pa_len		= pa->pa_len;
634 	),
635 
636 	TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu",
637 		  MAJOR(__entry->dev), MINOR(__entry->dev),
638 		  (unsigned long) __entry->ino,
639 		  __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
640 );
641 
642 DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa,
643 
644 	TP_PROTO(struct ext4_allocation_context *ac,
645 		 struct ext4_prealloc_space *pa),
646 
647 	TP_ARGS(ac, pa)
648 );
649 
650 DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_group_pa,
651 
652 	TP_PROTO(struct ext4_allocation_context *ac,
653 		 struct ext4_prealloc_space *pa),
654 
655 	TP_ARGS(ac, pa)
656 );
657 
658 TRACE_EVENT(ext4_mb_release_inode_pa,
659 	TP_PROTO(struct ext4_prealloc_space *pa,
660 		 unsigned long long block, unsigned int count),
661 
662 	TP_ARGS(pa, block, count),
663 
664 	TP_STRUCT__entry(
665 		__field(	dev_t,	dev			)
666 		__field(	ino_t,	ino			)
667 		__field(	__u64,	block			)
668 		__field(	__u32,	count			)
669 
670 	),
671 
672 	TP_fast_assign(
673 		__entry->dev		= pa->pa_inode->i_sb->s_dev;
674 		__entry->ino		= pa->pa_inode->i_ino;
675 		__entry->block		= block;
676 		__entry->count		= count;
677 	),
678 
679 	TP_printk("dev %d,%d ino %lu block %llu count %u",
680 		  MAJOR(__entry->dev), MINOR(__entry->dev),
681 		  (unsigned long) __entry->ino,
682 		  __entry->block, __entry->count)
683 );
684 
685 TRACE_EVENT(ext4_mb_release_group_pa,
686 	TP_PROTO(struct super_block *sb, struct ext4_prealloc_space *pa),
687 
688 	TP_ARGS(sb, pa),
689 
690 	TP_STRUCT__entry(
691 		__field(	dev_t,	dev			)
692 		__field(	__u64,	pa_pstart		)
693 		__field(	__u32,	pa_len			)
694 
695 	),
696 
697 	TP_fast_assign(
698 		__entry->dev		= sb->s_dev;
699 		__entry->pa_pstart	= pa->pa_pstart;
700 		__entry->pa_len		= pa->pa_len;
701 	),
702 
703 	TP_printk("dev %d,%d pstart %llu len %u",
704 		  MAJOR(__entry->dev), MINOR(__entry->dev),
705 		  __entry->pa_pstart, __entry->pa_len)
706 );
707 
708 TRACE_EVENT(ext4_discard_preallocations,
709 	TP_PROTO(struct inode *inode),
710 
711 	TP_ARGS(inode),
712 
713 	TP_STRUCT__entry(
714 		__field(	dev_t,	dev			)
715 		__field(	ino_t,	ino			)
716 
717 	),
718 
719 	TP_fast_assign(
720 		__entry->dev	= inode->i_sb->s_dev;
721 		__entry->ino	= inode->i_ino;
722 	),
723 
724 	TP_printk("dev %d,%d ino %lu",
725 		  MAJOR(__entry->dev), MINOR(__entry->dev),
726 		  (unsigned long) __entry->ino)
727 );
728 
729 TRACE_EVENT(ext4_mb_discard_preallocations,
730 	TP_PROTO(struct super_block *sb, int needed),
731 
732 	TP_ARGS(sb, needed),
733 
734 	TP_STRUCT__entry(
735 		__field(	dev_t,	dev			)
736 		__field(	int,	needed			)
737 
738 	),
739 
740 	TP_fast_assign(
741 		__entry->dev	= sb->s_dev;
742 		__entry->needed	= needed;
743 	),
744 
745 	TP_printk("dev %d,%d needed %d",
746 		  MAJOR(__entry->dev), MINOR(__entry->dev),
747 		  __entry->needed)
748 );
749 
750 TRACE_EVENT(ext4_request_blocks,
751 	TP_PROTO(struct ext4_allocation_request *ar),
752 
753 	TP_ARGS(ar),
754 
755 	TP_STRUCT__entry(
756 		__field(	dev_t,	dev			)
757 		__field(	ino_t,	ino			)
758 		__field(	unsigned int, len		)
759 		__field(	__u32,  logical			)
760 		__field(	__u32,	lleft			)
761 		__field(	__u32,	lright			)
762 		__field(	__u64,	goal			)
763 		__field(	__u64,	pleft			)
764 		__field(	__u64,	pright			)
765 		__field(	unsigned int, flags		)
766 	),
767 
768 	TP_fast_assign(
769 		__entry->dev	= ar->inode->i_sb->s_dev;
770 		__entry->ino	= ar->inode->i_ino;
771 		__entry->len	= ar->len;
772 		__entry->logical = ar->logical;
773 		__entry->goal	= ar->goal;
774 		__entry->lleft	= ar->lleft;
775 		__entry->lright	= ar->lright;
776 		__entry->pleft	= ar->pleft;
777 		__entry->pright	= ar->pright;
778 		__entry->flags	= ar->flags;
779 	),
780 
781 	TP_printk("dev %d,%d ino %lu flags %s len %u lblk %u goal %llu "
782 		  "lleft %u lright %u pleft %llu pright %llu ",
783 		  MAJOR(__entry->dev), MINOR(__entry->dev),
784 		  (unsigned long) __entry->ino, show_mballoc_flags(__entry->flags),
785 		  __entry->len, __entry->logical, __entry->goal,
786 		  __entry->lleft, __entry->lright, __entry->pleft,
787 		  __entry->pright)
788 );
789 
790 TRACE_EVENT(ext4_allocate_blocks,
791 	TP_PROTO(struct ext4_allocation_request *ar, unsigned long long block),
792 
793 	TP_ARGS(ar, block),
794 
795 	TP_STRUCT__entry(
796 		__field(	dev_t,	dev			)
797 		__field(	ino_t,	ino			)
798 		__field(	__u64,	block			)
799 		__field(	unsigned int, len		)
800 		__field(	__u32,  logical			)
801 		__field(	__u32,	lleft			)
802 		__field(	__u32,	lright			)
803 		__field(	__u64,	goal			)
804 		__field(	__u64,	pleft			)
805 		__field(	__u64,	pright			)
806 		__field(	unsigned int, flags		)
807 	),
808 
809 	TP_fast_assign(
810 		__entry->dev	= ar->inode->i_sb->s_dev;
811 		__entry->ino	= ar->inode->i_ino;
812 		__entry->block	= block;
813 		__entry->len	= ar->len;
814 		__entry->logical = ar->logical;
815 		__entry->goal	= ar->goal;
816 		__entry->lleft	= ar->lleft;
817 		__entry->lright	= ar->lright;
818 		__entry->pleft	= ar->pleft;
819 		__entry->pright	= ar->pright;
820 		__entry->flags	= ar->flags;
821 	),
822 
823 	TP_printk("dev %d,%d ino %lu flags %s len %u block %llu lblk %u "
824 		  "goal %llu lleft %u lright %u pleft %llu pright %llu",
825 		  MAJOR(__entry->dev), MINOR(__entry->dev),
826 		  (unsigned long) __entry->ino, show_mballoc_flags(__entry->flags),
827 		  __entry->len, __entry->block, __entry->logical,
828 		  __entry->goal,  __entry->lleft, __entry->lright,
829 		  __entry->pleft, __entry->pright)
830 );
831 
832 TRACE_EVENT(ext4_free_blocks,
833 	TP_PROTO(struct inode *inode, __u64 block, unsigned long count,
834 		 int flags),
835 
836 	TP_ARGS(inode, block, count, flags),
837 
838 	TP_STRUCT__entry(
839 		__field(	dev_t,	dev			)
840 		__field(	ino_t,	ino			)
841 		__field(	__u64,	block			)
842 		__field(	unsigned long,	count		)
843 		__field(	int,	flags			)
844 		__field(	__u16,	mode			)
845 	),
846 
847 	TP_fast_assign(
848 		__entry->dev		= inode->i_sb->s_dev;
849 		__entry->ino		= inode->i_ino;
850 		__entry->block		= block;
851 		__entry->count		= count;
852 		__entry->flags		= flags;
853 		__entry->mode		= inode->i_mode;
854 	),
855 
856 	TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %s",
857 		  MAJOR(__entry->dev), MINOR(__entry->dev),
858 		  (unsigned long) __entry->ino,
859 		  __entry->mode, __entry->block, __entry->count,
860 		  show_free_flags(__entry->flags))
861 );
862 
863 TRACE_EVENT(ext4_sync_file_enter,
864 	TP_PROTO(struct file *file, int datasync),
865 
866 	TP_ARGS(file, datasync),
867 
868 	TP_STRUCT__entry(
869 		__field(	dev_t,	dev			)
870 		__field(	ino_t,	ino			)
871 		__field(	ino_t,	parent			)
872 		__field(	int,	datasync		)
873 	),
874 
875 	TP_fast_assign(
876 		struct dentry *dentry = file->f_path.dentry;
877 
878 		__entry->dev		= dentry->d_sb->s_dev;
879 		__entry->ino		= d_inode(dentry)->i_ino;
880 		__entry->datasync	= datasync;
881 		__entry->parent		= d_inode(dentry->d_parent)->i_ino;
882 	),
883 
884 	TP_printk("dev %d,%d ino %lu parent %lu datasync %d ",
885 		  MAJOR(__entry->dev), MINOR(__entry->dev),
886 		  (unsigned long) __entry->ino,
887 		  (unsigned long) __entry->parent, __entry->datasync)
888 );
889 
890 TRACE_EVENT(ext4_sync_file_exit,
891 	TP_PROTO(struct inode *inode, int ret),
892 
893 	TP_ARGS(inode, ret),
894 
895 	TP_STRUCT__entry(
896 		__field(	dev_t,	dev			)
897 		__field(	ino_t,	ino			)
898 		__field(	int,	ret			)
899 	),
900 
901 	TP_fast_assign(
902 		__entry->dev		= inode->i_sb->s_dev;
903 		__entry->ino		= inode->i_ino;
904 		__entry->ret		= ret;
905 	),
906 
907 	TP_printk("dev %d,%d ino %lu ret %d",
908 		  MAJOR(__entry->dev), MINOR(__entry->dev),
909 		  (unsigned long) __entry->ino,
910 		  __entry->ret)
911 );
912 
913 TRACE_EVENT(ext4_sync_fs,
914 	TP_PROTO(struct super_block *sb, int wait),
915 
916 	TP_ARGS(sb, wait),
917 
918 	TP_STRUCT__entry(
919 		__field(	dev_t,	dev			)
920 		__field(	int,	wait			)
921 
922 	),
923 
924 	TP_fast_assign(
925 		__entry->dev	= sb->s_dev;
926 		__entry->wait	= wait;
927 	),
928 
929 	TP_printk("dev %d,%d wait %d",
930 		  MAJOR(__entry->dev), MINOR(__entry->dev),
931 		  __entry->wait)
932 );
933 
934 TRACE_EVENT(ext4_alloc_da_blocks,
935 	TP_PROTO(struct inode *inode),
936 
937 	TP_ARGS(inode),
938 
939 	TP_STRUCT__entry(
940 		__field(	dev_t,	dev			)
941 		__field(	ino_t,	ino			)
942 		__field( unsigned int,	data_blocks		)
943 	),
944 
945 	TP_fast_assign(
946 		__entry->dev	= inode->i_sb->s_dev;
947 		__entry->ino	= inode->i_ino;
948 		__entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
949 	),
950 
951 	TP_printk("dev %d,%d ino %lu reserved_data_blocks %u",
952 		  MAJOR(__entry->dev), MINOR(__entry->dev),
953 		  (unsigned long) __entry->ino,
954 		  __entry->data_blocks)
955 );
956 
957 TRACE_EVENT(ext4_mballoc_alloc,
958 	TP_PROTO(struct ext4_allocation_context *ac),
959 
960 	TP_ARGS(ac),
961 
962 	TP_STRUCT__entry(
963 		__field(	dev_t,	dev			)
964 		__field(	ino_t,	ino			)
965 		__field(	__u32, 	orig_logical		)
966 		__field(	  int,	orig_start		)
967 		__field(	__u32, 	orig_group		)
968 		__field(	  int,	orig_len		)
969 		__field(	__u32, 	goal_logical		)
970 		__field(	  int,	goal_start		)
971 		__field(	__u32, 	goal_group		)
972 		__field(	  int,	goal_len		)
973 		__field(	__u32, 	result_logical		)
974 		__field(	  int,	result_start		)
975 		__field(	__u32, 	result_group		)
976 		__field(	  int,	result_len		)
977 		__field(	__u16,	found			)
978 		__field(	__u16,	groups			)
979 		__field(	__u16,	buddy			)
980 		__field(	__u16,	flags			)
981 		__field(	__u16,	tail			)
982 		__field(	__u8,	cr			)
983 	),
984 
985 	TP_fast_assign(
986 		__entry->dev		= ac->ac_inode->i_sb->s_dev;
987 		__entry->ino		= ac->ac_inode->i_ino;
988 		__entry->orig_logical	= ac->ac_o_ex.fe_logical;
989 		__entry->orig_start	= ac->ac_o_ex.fe_start;
990 		__entry->orig_group	= ac->ac_o_ex.fe_group;
991 		__entry->orig_len	= ac->ac_o_ex.fe_len;
992 		__entry->goal_logical	= ac->ac_g_ex.fe_logical;
993 		__entry->goal_start	= ac->ac_g_ex.fe_start;
994 		__entry->goal_group	= ac->ac_g_ex.fe_group;
995 		__entry->goal_len	= ac->ac_g_ex.fe_len;
996 		__entry->result_logical	= ac->ac_f_ex.fe_logical;
997 		__entry->result_start	= ac->ac_f_ex.fe_start;
998 		__entry->result_group	= ac->ac_f_ex.fe_group;
999 		__entry->result_len	= ac->ac_f_ex.fe_len;
1000 		__entry->found		= ac->ac_found;
1001 		__entry->flags		= ac->ac_flags;
1002 		__entry->groups		= ac->ac_groups_scanned;
1003 		__entry->buddy		= ac->ac_buddy;
1004 		__entry->tail		= ac->ac_tail;
1005 		__entry->cr		= ac->ac_criteria;
1006 	),
1007 
1008 	TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
1009 		  "result %u/%d/%u@%u blks %u grps %u cr %u flags %s "
1010 		  "tail %u broken %u",
1011 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1012 		  (unsigned long) __entry->ino,
1013 		  __entry->orig_group, __entry->orig_start,
1014 		  __entry->orig_len, __entry->orig_logical,
1015 		  __entry->goal_group, __entry->goal_start,
1016 		  __entry->goal_len, __entry->goal_logical,
1017 		  __entry->result_group, __entry->result_start,
1018 		  __entry->result_len, __entry->result_logical,
1019 		  __entry->found, __entry->groups, __entry->cr,
1020 		  show_mballoc_flags(__entry->flags), __entry->tail,
1021 		  __entry->buddy ? 1 << __entry->buddy : 0)
1022 );
1023 
1024 TRACE_EVENT(ext4_mballoc_prealloc,
1025 	TP_PROTO(struct ext4_allocation_context *ac),
1026 
1027 	TP_ARGS(ac),
1028 
1029 	TP_STRUCT__entry(
1030 		__field(	dev_t,	dev			)
1031 		__field(	ino_t,	ino			)
1032 		__field(	__u32, 	orig_logical		)
1033 		__field(	  int,	orig_start		)
1034 		__field(	__u32, 	orig_group		)
1035 		__field(	  int,	orig_len		)
1036 		__field(	__u32, 	result_logical		)
1037 		__field(	  int,	result_start		)
1038 		__field(	__u32, 	result_group		)
1039 		__field(	  int,	result_len		)
1040 	),
1041 
1042 	TP_fast_assign(
1043 		__entry->dev		= ac->ac_inode->i_sb->s_dev;
1044 		__entry->ino		= ac->ac_inode->i_ino;
1045 		__entry->orig_logical	= ac->ac_o_ex.fe_logical;
1046 		__entry->orig_start	= ac->ac_o_ex.fe_start;
1047 		__entry->orig_group	= ac->ac_o_ex.fe_group;
1048 		__entry->orig_len	= ac->ac_o_ex.fe_len;
1049 		__entry->result_logical	= ac->ac_b_ex.fe_logical;
1050 		__entry->result_start	= ac->ac_b_ex.fe_start;
1051 		__entry->result_group	= ac->ac_b_ex.fe_group;
1052 		__entry->result_len	= ac->ac_b_ex.fe_len;
1053 	),
1054 
1055 	TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
1056 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1057 		  (unsigned long) __entry->ino,
1058 		  __entry->orig_group, __entry->orig_start,
1059 		  __entry->orig_len, __entry->orig_logical,
1060 		  __entry->result_group, __entry->result_start,
1061 		  __entry->result_len, __entry->result_logical)
1062 );
1063 
1064 DECLARE_EVENT_CLASS(ext4__mballoc,
1065 	TP_PROTO(struct super_block *sb,
1066 		 struct inode *inode,
1067 		 ext4_group_t group,
1068 		 ext4_grpblk_t start,
1069 		 ext4_grpblk_t len),
1070 
1071 	TP_ARGS(sb, inode, group, start, len),
1072 
1073 	TP_STRUCT__entry(
1074 		__field(	dev_t,	dev			)
1075 		__field(	ino_t,	ino			)
1076 		__field(	  int,	result_start		)
1077 		__field(	__u32, 	result_group		)
1078 		__field(	  int,	result_len		)
1079 	),
1080 
1081 	TP_fast_assign(
1082 		__entry->dev		= sb->s_dev;
1083 		__entry->ino		= inode ? inode->i_ino : 0;
1084 		__entry->result_start	= start;
1085 		__entry->result_group	= group;
1086 		__entry->result_len	= len;
1087 	),
1088 
1089 	TP_printk("dev %d,%d inode %lu extent %u/%d/%d ",
1090 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1091 		  (unsigned long) __entry->ino,
1092 		  __entry->result_group, __entry->result_start,
1093 		  __entry->result_len)
1094 );
1095 
1096 DEFINE_EVENT(ext4__mballoc, ext4_mballoc_discard,
1097 
1098 	TP_PROTO(struct super_block *sb,
1099 		 struct inode *inode,
1100 		 ext4_group_t group,
1101 		 ext4_grpblk_t start,
1102 		 ext4_grpblk_t len),
1103 
1104 	TP_ARGS(sb, inode, group, start, len)
1105 );
1106 
1107 DEFINE_EVENT(ext4__mballoc, ext4_mballoc_free,
1108 
1109 	TP_PROTO(struct super_block *sb,
1110 		 struct inode *inode,
1111 		 ext4_group_t group,
1112 		 ext4_grpblk_t start,
1113 		 ext4_grpblk_t len),
1114 
1115 	TP_ARGS(sb, inode, group, start, len)
1116 );
1117 
1118 TRACE_EVENT(ext4_forget,
1119 	TP_PROTO(struct inode *inode, int is_metadata, __u64 block),
1120 
1121 	TP_ARGS(inode, is_metadata, block),
1122 
1123 	TP_STRUCT__entry(
1124 		__field(	dev_t,	dev			)
1125 		__field(	ino_t,	ino			)
1126 		__field(	__u64,	block			)
1127 		__field(	int,	is_metadata		)
1128 		__field(	__u16,	mode			)
1129 	),
1130 
1131 	TP_fast_assign(
1132 		__entry->dev	= inode->i_sb->s_dev;
1133 		__entry->ino	= inode->i_ino;
1134 		__entry->block	= block;
1135 		__entry->is_metadata = is_metadata;
1136 		__entry->mode	= inode->i_mode;
1137 	),
1138 
1139 	TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu",
1140 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1141 		  (unsigned long) __entry->ino,
1142 		  __entry->mode, __entry->is_metadata, __entry->block)
1143 );
1144 
1145 TRACE_EVENT(ext4_da_update_reserve_space,
1146 	TP_PROTO(struct inode *inode, int used_blocks, int quota_claim),
1147 
1148 	TP_ARGS(inode, used_blocks, quota_claim),
1149 
1150 	TP_STRUCT__entry(
1151 		__field(	dev_t,	dev			)
1152 		__field(	ino_t,	ino			)
1153 		__field(	__u64,	i_blocks		)
1154 		__field(	int,	used_blocks		)
1155 		__field(	int,	reserved_data_blocks	)
1156 		__field(	int,	quota_claim		)
1157 		__field(	__u16,	mode			)
1158 	),
1159 
1160 	TP_fast_assign(
1161 		__entry->dev	= inode->i_sb->s_dev;
1162 		__entry->ino	= inode->i_ino;
1163 		__entry->i_blocks = inode->i_blocks;
1164 		__entry->used_blocks = used_blocks;
1165 		__entry->reserved_data_blocks =
1166 				EXT4_I(inode)->i_reserved_data_blocks;
1167 		__entry->quota_claim = quota_claim;
1168 		__entry->mode	= inode->i_mode;
1169 	),
1170 
1171 	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d "
1172 		  "reserved_data_blocks %d quota_claim %d",
1173 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1174 		  (unsigned long) __entry->ino,
1175 		  __entry->mode, __entry->i_blocks,
1176 		  __entry->used_blocks, __entry->reserved_data_blocks,
1177 		  __entry->quota_claim)
1178 );
1179 
1180 TRACE_EVENT(ext4_da_reserve_space,
1181 	TP_PROTO(struct inode *inode),
1182 
1183 	TP_ARGS(inode),
1184 
1185 	TP_STRUCT__entry(
1186 		__field(	dev_t,	dev			)
1187 		__field(	ino_t,	ino			)
1188 		__field(	__u64,	i_blocks		)
1189 		__field(	int,	reserved_data_blocks	)
1190 		__field(	__u16,  mode			)
1191 	),
1192 
1193 	TP_fast_assign(
1194 		__entry->dev	= inode->i_sb->s_dev;
1195 		__entry->ino	= inode->i_ino;
1196 		__entry->i_blocks = inode->i_blocks;
1197 		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1198 		__entry->mode	= inode->i_mode;
1199 	),
1200 
1201 	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu "
1202 		  "reserved_data_blocks %d",
1203 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1204 		  (unsigned long) __entry->ino,
1205 		  __entry->mode, __entry->i_blocks,
1206 		  __entry->reserved_data_blocks)
1207 );
1208 
1209 TRACE_EVENT(ext4_da_release_space,
1210 	TP_PROTO(struct inode *inode, int freed_blocks),
1211 
1212 	TP_ARGS(inode, freed_blocks),
1213 
1214 	TP_STRUCT__entry(
1215 		__field(	dev_t,	dev			)
1216 		__field(	ino_t,	ino			)
1217 		__field(	__u64,	i_blocks		)
1218 		__field(	int,	freed_blocks		)
1219 		__field(	int,	reserved_data_blocks	)
1220 		__field(	__u16,  mode			)
1221 	),
1222 
1223 	TP_fast_assign(
1224 		__entry->dev	= inode->i_sb->s_dev;
1225 		__entry->ino	= inode->i_ino;
1226 		__entry->i_blocks = inode->i_blocks;
1227 		__entry->freed_blocks = freed_blocks;
1228 		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1229 		__entry->mode	= inode->i_mode;
1230 	),
1231 
1232 	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d "
1233 		  "reserved_data_blocks %d",
1234 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1235 		  (unsigned long) __entry->ino,
1236 		  __entry->mode, __entry->i_blocks,
1237 		  __entry->freed_blocks, __entry->reserved_data_blocks)
1238 );
1239 
1240 DECLARE_EVENT_CLASS(ext4__bitmap_load,
1241 	TP_PROTO(struct super_block *sb, unsigned long group),
1242 
1243 	TP_ARGS(sb, group),
1244 
1245 	TP_STRUCT__entry(
1246 		__field(	dev_t,	dev			)
1247 		__field(	__u32,	group			)
1248 
1249 	),
1250 
1251 	TP_fast_assign(
1252 		__entry->dev	= sb->s_dev;
1253 		__entry->group	= group;
1254 	),
1255 
1256 	TP_printk("dev %d,%d group %u",
1257 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1258 		  __entry->group)
1259 );
1260 
1261 DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load,
1262 
1263 	TP_PROTO(struct super_block *sb, unsigned long group),
1264 
1265 	TP_ARGS(sb, group)
1266 );
1267 
1268 DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
1269 
1270 	TP_PROTO(struct super_block *sb, unsigned long group),
1271 
1272 	TP_ARGS(sb, group)
1273 );
1274 
1275 DEFINE_EVENT(ext4__bitmap_load, ext4_read_block_bitmap_load,
1276 
1277 	TP_PROTO(struct super_block *sb, unsigned long group),
1278 
1279 	TP_ARGS(sb, group)
1280 );
1281 
1282 DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
1283 
1284 	TP_PROTO(struct super_block *sb, unsigned long group),
1285 
1286 	TP_ARGS(sb, group)
1287 );
1288 
1289 TRACE_EVENT(ext4_direct_IO_enter,
1290 	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
1291 
1292 	TP_ARGS(inode, offset, len, rw),
1293 
1294 	TP_STRUCT__entry(
1295 		__field(	dev_t,	dev			)
1296 		__field(	ino_t,	ino			)
1297 		__field(	loff_t,	pos			)
1298 		__field(	unsigned long,	len		)
1299 		__field(	int,	rw			)
1300 	),
1301 
1302 	TP_fast_assign(
1303 		__entry->dev	= inode->i_sb->s_dev;
1304 		__entry->ino	= inode->i_ino;
1305 		__entry->pos	= offset;
1306 		__entry->len	= len;
1307 		__entry->rw	= rw;
1308 	),
1309 
1310 	TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d",
1311 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1312 		  (unsigned long) __entry->ino,
1313 		  __entry->pos, __entry->len, __entry->rw)
1314 );
1315 
1316 TRACE_EVENT(ext4_direct_IO_exit,
1317 	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
1318 		 int rw, int ret),
1319 
1320 	TP_ARGS(inode, offset, len, rw, ret),
1321 
1322 	TP_STRUCT__entry(
1323 		__field(	dev_t,	dev			)
1324 		__field(	ino_t,	ino			)
1325 		__field(	loff_t,	pos			)
1326 		__field(	unsigned long,	len		)
1327 		__field(	int,	rw			)
1328 		__field(	int,	ret			)
1329 	),
1330 
1331 	TP_fast_assign(
1332 		__entry->dev	= inode->i_sb->s_dev;
1333 		__entry->ino	= inode->i_ino;
1334 		__entry->pos	= offset;
1335 		__entry->len	= len;
1336 		__entry->rw	= rw;
1337 		__entry->ret	= ret;
1338 	),
1339 
1340 	TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d ret %d",
1341 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1342 		  (unsigned long) __entry->ino,
1343 		  __entry->pos, __entry->len,
1344 		  __entry->rw, __entry->ret)
1345 );
1346 
1347 DECLARE_EVENT_CLASS(ext4__fallocate_mode,
1348 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1349 
1350 	TP_ARGS(inode, offset, len, mode),
1351 
1352 	TP_STRUCT__entry(
1353 		__field(	dev_t,	dev			)
1354 		__field(	ino_t,	ino			)
1355 		__field(	loff_t,	offset			)
1356 		__field(	loff_t, len			)
1357 		__field(	int,	mode			)
1358 	),
1359 
1360 	TP_fast_assign(
1361 		__entry->dev	= inode->i_sb->s_dev;
1362 		__entry->ino	= inode->i_ino;
1363 		__entry->offset	= offset;
1364 		__entry->len	= len;
1365 		__entry->mode	= mode;
1366 	),
1367 
1368 	TP_printk("dev %d,%d ino %lu offset %lld len %lld mode %s",
1369 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1370 		  (unsigned long) __entry->ino,
1371 		  __entry->offset, __entry->len,
1372 		  show_falloc_mode(__entry->mode))
1373 );
1374 
1375 DEFINE_EVENT(ext4__fallocate_mode, ext4_fallocate_enter,
1376 
1377 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1378 
1379 	TP_ARGS(inode, offset, len, mode)
1380 );
1381 
1382 DEFINE_EVENT(ext4__fallocate_mode, ext4_punch_hole,
1383 
1384 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1385 
1386 	TP_ARGS(inode, offset, len, mode)
1387 );
1388 
1389 DEFINE_EVENT(ext4__fallocate_mode, ext4_zero_range,
1390 
1391 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1392 
1393 	TP_ARGS(inode, offset, len, mode)
1394 );
1395 
1396 TRACE_EVENT(ext4_fallocate_exit,
1397 	TP_PROTO(struct inode *inode, loff_t offset,
1398 		 unsigned int max_blocks, int ret),
1399 
1400 	TP_ARGS(inode, offset, max_blocks, ret),
1401 
1402 	TP_STRUCT__entry(
1403 		__field(	dev_t,	dev			)
1404 		__field(	ino_t,	ino			)
1405 		__field(	loff_t,	pos			)
1406 		__field(	unsigned int,	blocks		)
1407 		__field(	int, 	ret			)
1408 	),
1409 
1410 	TP_fast_assign(
1411 		__entry->dev	= inode->i_sb->s_dev;
1412 		__entry->ino	= inode->i_ino;
1413 		__entry->pos	= offset;
1414 		__entry->blocks	= max_blocks;
1415 		__entry->ret	= ret;
1416 	),
1417 
1418 	TP_printk("dev %d,%d ino %lu pos %lld blocks %u ret %d",
1419 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1420 		  (unsigned long) __entry->ino,
1421 		  __entry->pos, __entry->blocks,
1422 		  __entry->ret)
1423 );
1424 
1425 TRACE_EVENT(ext4_unlink_enter,
1426 	TP_PROTO(struct inode *parent, struct dentry *dentry),
1427 
1428 	TP_ARGS(parent, dentry),
1429 
1430 	TP_STRUCT__entry(
1431 		__field(	dev_t,	dev			)
1432 		__field(	ino_t,	ino			)
1433 		__field(	ino_t,	parent			)
1434 		__field(	loff_t,	size			)
1435 	),
1436 
1437 	TP_fast_assign(
1438 		__entry->dev		= dentry->d_sb->s_dev;
1439 		__entry->ino		= d_inode(dentry)->i_ino;
1440 		__entry->parent		= parent->i_ino;
1441 		__entry->size		= d_inode(dentry)->i_size;
1442 	),
1443 
1444 	TP_printk("dev %d,%d ino %lu size %lld parent %lu",
1445 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1446 		  (unsigned long) __entry->ino, __entry->size,
1447 		  (unsigned long) __entry->parent)
1448 );
1449 
1450 TRACE_EVENT(ext4_unlink_exit,
1451 	TP_PROTO(struct dentry *dentry, int ret),
1452 
1453 	TP_ARGS(dentry, ret),
1454 
1455 	TP_STRUCT__entry(
1456 		__field(	dev_t,	dev			)
1457 		__field(	ino_t,	ino			)
1458 		__field(	int,	ret			)
1459 	),
1460 
1461 	TP_fast_assign(
1462 		__entry->dev		= dentry->d_sb->s_dev;
1463 		__entry->ino		= d_inode(dentry)->i_ino;
1464 		__entry->ret		= ret;
1465 	),
1466 
1467 	TP_printk("dev %d,%d ino %lu ret %d",
1468 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1469 		  (unsigned long) __entry->ino,
1470 		  __entry->ret)
1471 );
1472 
1473 DECLARE_EVENT_CLASS(ext4__truncate,
1474 	TP_PROTO(struct inode *inode),
1475 
1476 	TP_ARGS(inode),
1477 
1478 	TP_STRUCT__entry(
1479 		__field(	dev_t,		dev		)
1480 		__field(	ino_t,		ino		)
1481 		__field(	__u64,		blocks		)
1482 	),
1483 
1484 	TP_fast_assign(
1485 		__entry->dev    = inode->i_sb->s_dev;
1486 		__entry->ino    = inode->i_ino;
1487 		__entry->blocks	= inode->i_blocks;
1488 	),
1489 
1490 	TP_printk("dev %d,%d ino %lu blocks %llu",
1491 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1492 		  (unsigned long) __entry->ino, __entry->blocks)
1493 );
1494 
1495 DEFINE_EVENT(ext4__truncate, ext4_truncate_enter,
1496 
1497 	TP_PROTO(struct inode *inode),
1498 
1499 	TP_ARGS(inode)
1500 );
1501 
1502 DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,
1503 
1504 	TP_PROTO(struct inode *inode),
1505 
1506 	TP_ARGS(inode)
1507 );
1508 
1509 /* 'ux' is the unwritten extent. */
1510 TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1511 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1512 		 struct ext4_extent *ux),
1513 
1514 	TP_ARGS(inode, map, ux),
1515 
1516 	TP_STRUCT__entry(
1517 		__field(	dev_t,		dev	)
1518 		__field(	ino_t,		ino	)
1519 		__field(	ext4_lblk_t,	m_lblk	)
1520 		__field(	unsigned,	m_len	)
1521 		__field(	ext4_lblk_t,	u_lblk	)
1522 		__field(	unsigned,	u_len	)
1523 		__field(	ext4_fsblk_t,	u_pblk	)
1524 	),
1525 
1526 	TP_fast_assign(
1527 		__entry->dev		= inode->i_sb->s_dev;
1528 		__entry->ino		= inode->i_ino;
1529 		__entry->m_lblk		= map->m_lblk;
1530 		__entry->m_len		= map->m_len;
1531 		__entry->u_lblk		= le32_to_cpu(ux->ee_block);
1532 		__entry->u_len		= ext4_ext_get_actual_len(ux);
1533 		__entry->u_pblk		= ext4_ext_pblock(ux);
1534 	),
1535 
1536 	TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u u_lblk %u u_len %u "
1537 		  "u_pblk %llu",
1538 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1539 		  (unsigned long) __entry->ino,
1540 		  __entry->m_lblk, __entry->m_len,
1541 		  __entry->u_lblk, __entry->u_len, __entry->u_pblk)
1542 );
1543 
1544 /*
1545  * 'ux' is the unwritten extent.
1546  * 'ix' is the initialized extent to which blocks are transferred.
1547  */
1548 TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
1549 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1550 		 struct ext4_extent *ux, struct ext4_extent *ix),
1551 
1552 	TP_ARGS(inode, map, ux, ix),
1553 
1554 	TP_STRUCT__entry(
1555 		__field(	dev_t,		dev	)
1556 		__field(	ino_t,		ino	)
1557 		__field(	ext4_lblk_t,	m_lblk	)
1558 		__field(	unsigned,	m_len	)
1559 		__field(	ext4_lblk_t,	u_lblk	)
1560 		__field(	unsigned,	u_len	)
1561 		__field(	ext4_fsblk_t,	u_pblk	)
1562 		__field(	ext4_lblk_t,	i_lblk	)
1563 		__field(	unsigned,	i_len	)
1564 		__field(	ext4_fsblk_t,	i_pblk	)
1565 	),
1566 
1567 	TP_fast_assign(
1568 		__entry->dev		= inode->i_sb->s_dev;
1569 		__entry->ino		= inode->i_ino;
1570 		__entry->m_lblk		= map->m_lblk;
1571 		__entry->m_len		= map->m_len;
1572 		__entry->u_lblk		= le32_to_cpu(ux->ee_block);
1573 		__entry->u_len		= ext4_ext_get_actual_len(ux);
1574 		__entry->u_pblk		= ext4_ext_pblock(ux);
1575 		__entry->i_lblk		= le32_to_cpu(ix->ee_block);
1576 		__entry->i_len		= ext4_ext_get_actual_len(ix);
1577 		__entry->i_pblk		= ext4_ext_pblock(ix);
1578 	),
1579 
1580 	TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u "
1581 		  "u_lblk %u u_len %u u_pblk %llu "
1582 		  "i_lblk %u i_len %u i_pblk %llu ",
1583 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1584 		  (unsigned long) __entry->ino,
1585 		  __entry->m_lblk, __entry->m_len,
1586 		  __entry->u_lblk, __entry->u_len, __entry->u_pblk,
1587 		  __entry->i_lblk, __entry->i_len, __entry->i_pblk)
1588 );
1589 
1590 DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
1591 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1592 		 unsigned int len, unsigned int flags),
1593 
1594 	TP_ARGS(inode, lblk, len, flags),
1595 
1596 	TP_STRUCT__entry(
1597 		__field(	dev_t,		dev		)
1598 		__field(	ino_t,		ino		)
1599 		__field(	ext4_lblk_t,	lblk		)
1600 		__field(	unsigned int,	len		)
1601 		__field(	unsigned int,	flags		)
1602 	),
1603 
1604 	TP_fast_assign(
1605 		__entry->dev    = inode->i_sb->s_dev;
1606 		__entry->ino    = inode->i_ino;
1607 		__entry->lblk	= lblk;
1608 		__entry->len	= len;
1609 		__entry->flags	= flags;
1610 	),
1611 
1612 	TP_printk("dev %d,%d ino %lu lblk %u len %u flags %s",
1613 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1614 		  (unsigned long) __entry->ino,
1615 		  __entry->lblk, __entry->len, show_map_flags(__entry->flags))
1616 );
1617 
1618 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter,
1619 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1620 		 unsigned len, unsigned flags),
1621 
1622 	TP_ARGS(inode, lblk, len, flags)
1623 );
1624 
1625 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
1626 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1627 		 unsigned len, unsigned flags),
1628 
1629 	TP_ARGS(inode, lblk, len, flags)
1630 );
1631 
1632 DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1633 	TP_PROTO(struct inode *inode, unsigned flags, struct ext4_map_blocks *map,
1634 		 int ret),
1635 
1636 	TP_ARGS(inode, flags, map, ret),
1637 
1638 	TP_STRUCT__entry(
1639 		__field(	dev_t,		dev		)
1640 		__field(	ino_t,		ino		)
1641 		__field(	unsigned int,	flags		)
1642 		__field(	ext4_fsblk_t,	pblk		)
1643 		__field(	ext4_lblk_t,	lblk		)
1644 		__field(	unsigned int,	len		)
1645 		__field(	unsigned int,	mflags		)
1646 		__field(	int,		ret		)
1647 	),
1648 
1649 	TP_fast_assign(
1650 		__entry->dev    = inode->i_sb->s_dev;
1651 		__entry->ino    = inode->i_ino;
1652 		__entry->flags	= flags;
1653 		__entry->pblk	= map->m_pblk;
1654 		__entry->lblk	= map->m_lblk;
1655 		__entry->len	= map->m_len;
1656 		__entry->mflags	= map->m_flags;
1657 		__entry->ret	= ret;
1658 	),
1659 
1660 	TP_printk("dev %d,%d ino %lu flags %s lblk %u pblk %llu len %u "
1661 		  "mflags %s ret %d",
1662 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1663 		  (unsigned long) __entry->ino,
1664 		  show_map_flags(__entry->flags), __entry->lblk, __entry->pblk,
1665 		  __entry->len, show_mflags(__entry->mflags), __entry->ret)
1666 );
1667 
1668 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1669 	TP_PROTO(struct inode *inode, unsigned flags,
1670 		 struct ext4_map_blocks *map, int ret),
1671 
1672 	TP_ARGS(inode, flags, map, ret)
1673 );
1674 
1675 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1676 	TP_PROTO(struct inode *inode, unsigned flags,
1677 		 struct ext4_map_blocks *map, int ret),
1678 
1679 	TP_ARGS(inode, flags, map, ret)
1680 );
1681 
1682 TRACE_EVENT(ext4_ext_load_extent,
1683 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk),
1684 
1685 	TP_ARGS(inode, lblk, pblk),
1686 
1687 	TP_STRUCT__entry(
1688 		__field(	dev_t,		dev		)
1689 		__field(	ino_t,		ino		)
1690 		__field(	ext4_fsblk_t,	pblk		)
1691 		__field(	ext4_lblk_t,	lblk		)
1692 	),
1693 
1694 	TP_fast_assign(
1695 		__entry->dev    = inode->i_sb->s_dev;
1696 		__entry->ino    = inode->i_ino;
1697 		__entry->pblk	= pblk;
1698 		__entry->lblk	= lblk;
1699 	),
1700 
1701 	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
1702 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1703 		  (unsigned long) __entry->ino,
1704 		  __entry->lblk, __entry->pblk)
1705 );
1706 
1707 TRACE_EVENT(ext4_load_inode,
1708 	TP_PROTO(struct inode *inode),
1709 
1710 	TP_ARGS(inode),
1711 
1712 	TP_STRUCT__entry(
1713 		__field(	dev_t,	dev		)
1714 		__field(	ino_t,	ino		)
1715 	),
1716 
1717 	TP_fast_assign(
1718 		__entry->dev		= inode->i_sb->s_dev;
1719 		__entry->ino		= inode->i_ino;
1720 	),
1721 
1722 	TP_printk("dev %d,%d ino %ld",
1723 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1724 		  (unsigned long) __entry->ino)
1725 );
1726 
1727 TRACE_EVENT(ext4_journal_start,
1728 	TP_PROTO(struct super_block *sb, int blocks, int rsv_blocks,
1729 		 unsigned long IP),
1730 
1731 	TP_ARGS(sb, blocks, rsv_blocks, IP),
1732 
1733 	TP_STRUCT__entry(
1734 		__field(	dev_t,	dev			)
1735 		__field(unsigned long,	ip			)
1736 		__field(	  int,	blocks			)
1737 		__field(	  int,	rsv_blocks		)
1738 	),
1739 
1740 	TP_fast_assign(
1741 		__entry->dev		 = sb->s_dev;
1742 		__entry->ip		 = IP;
1743 		__entry->blocks		 = blocks;
1744 		__entry->rsv_blocks	 = rsv_blocks;
1745 	),
1746 
1747 	TP_printk("dev %d,%d blocks, %d rsv_blocks, %d caller %pS",
1748 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1749 		  __entry->blocks, __entry->rsv_blocks, (void *)__entry->ip)
1750 );
1751 
1752 TRACE_EVENT(ext4_journal_start_reserved,
1753 	TP_PROTO(struct super_block *sb, int blocks, unsigned long IP),
1754 
1755 	TP_ARGS(sb, blocks, IP),
1756 
1757 	TP_STRUCT__entry(
1758 		__field(	dev_t,	dev			)
1759 		__field(unsigned long,	ip			)
1760 		__field(	  int,	blocks			)
1761 	),
1762 
1763 	TP_fast_assign(
1764 		__entry->dev		 = sb->s_dev;
1765 		__entry->ip		 = IP;
1766 		__entry->blocks		 = blocks;
1767 	),
1768 
1769 	TP_printk("dev %d,%d blocks, %d caller %pS",
1770 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1771 		  __entry->blocks, (void *)__entry->ip)
1772 );
1773 
1774 DECLARE_EVENT_CLASS(ext4__trim,
1775 	TP_PROTO(struct super_block *sb,
1776 		 ext4_group_t group,
1777 		 ext4_grpblk_t start,
1778 		 ext4_grpblk_t len),
1779 
1780 	TP_ARGS(sb, group, start, len),
1781 
1782 	TP_STRUCT__entry(
1783 		__field(	int,	dev_major		)
1784 		__field(	int,	dev_minor		)
1785 		__field(	__u32, 	group			)
1786 		__field(	int,	start			)
1787 		__field(	int,	len			)
1788 	),
1789 
1790 	TP_fast_assign(
1791 		__entry->dev_major	= MAJOR(sb->s_dev);
1792 		__entry->dev_minor	= MINOR(sb->s_dev);
1793 		__entry->group		= group;
1794 		__entry->start		= start;
1795 		__entry->len		= len;
1796 	),
1797 
1798 	TP_printk("dev %d,%d group %u, start %d, len %d",
1799 		  __entry->dev_major, __entry->dev_minor,
1800 		  __entry->group, __entry->start, __entry->len)
1801 );
1802 
1803 DEFINE_EVENT(ext4__trim, ext4_trim_extent,
1804 
1805 	TP_PROTO(struct super_block *sb,
1806 		 ext4_group_t group,
1807 		 ext4_grpblk_t start,
1808 		 ext4_grpblk_t len),
1809 
1810 	TP_ARGS(sb, group, start, len)
1811 );
1812 
1813 DEFINE_EVENT(ext4__trim, ext4_trim_all_free,
1814 
1815 	TP_PROTO(struct super_block *sb,
1816 		 ext4_group_t group,
1817 		 ext4_grpblk_t start,
1818 		 ext4_grpblk_t len),
1819 
1820 	TP_ARGS(sb, group, start, len)
1821 );
1822 
1823 TRACE_EVENT(ext4_ext_handle_unwritten_extents,
1824 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1825 		 unsigned int allocated, ext4_fsblk_t newblock),
1826 
1827 	TP_ARGS(inode, map, flags, allocated, newblock),
1828 
1829 	TP_STRUCT__entry(
1830 		__field(	dev_t,		dev		)
1831 		__field(	ino_t,		ino		)
1832 		__field(	int,		flags		)
1833 		__field(	ext4_lblk_t,	lblk		)
1834 		__field(	ext4_fsblk_t,	pblk		)
1835 		__field(	unsigned int,	len		)
1836 		__field(	unsigned int,	allocated	)
1837 		__field(	ext4_fsblk_t,	newblk		)
1838 	),
1839 
1840 	TP_fast_assign(
1841 		__entry->dev		= inode->i_sb->s_dev;
1842 		__entry->ino		= inode->i_ino;
1843 		__entry->flags		= flags;
1844 		__entry->lblk		= map->m_lblk;
1845 		__entry->pblk		= map->m_pblk;
1846 		__entry->len		= map->m_len;
1847 		__entry->allocated	= allocated;
1848 		__entry->newblk		= newblock;
1849 	),
1850 
1851 	TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %s "
1852 		  "allocated %d newblock %llu",
1853 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1854 		  (unsigned long) __entry->ino,
1855 		  (unsigned) __entry->lblk, (unsigned long long) __entry->pblk,
1856 		  __entry->len, show_map_flags(__entry->flags),
1857 		  (unsigned int) __entry->allocated,
1858 		  (unsigned long long) __entry->newblk)
1859 );
1860 
1861 TRACE_EVENT(ext4_get_implied_cluster_alloc_exit,
1862 	TP_PROTO(struct super_block *sb, struct ext4_map_blocks *map, int ret),
1863 
1864 	TP_ARGS(sb, map, ret),
1865 
1866 	TP_STRUCT__entry(
1867 		__field(	dev_t,		dev	)
1868 		__field(	unsigned int,	flags	)
1869 		__field(	ext4_lblk_t,	lblk	)
1870 		__field(	ext4_fsblk_t,	pblk	)
1871 		__field(	unsigned int,	len	)
1872 		__field(	int,		ret	)
1873 	),
1874 
1875 	TP_fast_assign(
1876 		__entry->dev	= sb->s_dev;
1877 		__entry->flags	= map->m_flags;
1878 		__entry->lblk	= map->m_lblk;
1879 		__entry->pblk	= map->m_pblk;
1880 		__entry->len	= map->m_len;
1881 		__entry->ret	= ret;
1882 	),
1883 
1884 	TP_printk("dev %d,%d m_lblk %u m_pblk %llu m_len %u m_flags %s ret %d",
1885 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1886 		  __entry->lblk, (unsigned long long) __entry->pblk,
1887 		  __entry->len, show_mflags(__entry->flags), __entry->ret)
1888 );
1889 
1890 TRACE_EVENT(ext4_ext_put_in_cache,
1891 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, unsigned int len,
1892 		 ext4_fsblk_t start),
1893 
1894 	TP_ARGS(inode, lblk, len, start),
1895 
1896 	TP_STRUCT__entry(
1897 		__field(	dev_t,		dev	)
1898 		__field(	ino_t,		ino	)
1899 		__field(	ext4_lblk_t,	lblk	)
1900 		__field(	unsigned int,	len	)
1901 		__field(	ext4_fsblk_t,	start	)
1902 	),
1903 
1904 	TP_fast_assign(
1905 		__entry->dev	= inode->i_sb->s_dev;
1906 		__entry->ino	= inode->i_ino;
1907 		__entry->lblk	= lblk;
1908 		__entry->len	= len;
1909 		__entry->start	= start;
1910 	),
1911 
1912 	TP_printk("dev %d,%d ino %lu lblk %u len %u start %llu",
1913 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1914 		  (unsigned long) __entry->ino,
1915 		  (unsigned) __entry->lblk,
1916 		  __entry->len,
1917 		  (unsigned long long) __entry->start)
1918 );
1919 
1920 TRACE_EVENT(ext4_ext_in_cache,
1921 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, int ret),
1922 
1923 	TP_ARGS(inode, lblk, ret),
1924 
1925 	TP_STRUCT__entry(
1926 		__field(	dev_t,		dev	)
1927 		__field(	ino_t,		ino	)
1928 		__field(	ext4_lblk_t,	lblk	)
1929 		__field(	int,		ret	)
1930 	),
1931 
1932 	TP_fast_assign(
1933 		__entry->dev	= inode->i_sb->s_dev;
1934 		__entry->ino	= inode->i_ino;
1935 		__entry->lblk	= lblk;
1936 		__entry->ret	= ret;
1937 	),
1938 
1939 	TP_printk("dev %d,%d ino %lu lblk %u ret %d",
1940 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1941 		  (unsigned long) __entry->ino,
1942 		  (unsigned) __entry->lblk,
1943 		  __entry->ret)
1944 
1945 );
1946 
1947 TRACE_EVENT(ext4_find_delalloc_range,
1948 	TP_PROTO(struct inode *inode, ext4_lblk_t from, ext4_lblk_t to,
1949 		int reverse, int found, ext4_lblk_t found_blk),
1950 
1951 	TP_ARGS(inode, from, to, reverse, found, found_blk),
1952 
1953 	TP_STRUCT__entry(
1954 		__field(	dev_t,		dev		)
1955 		__field(	ino_t,		ino		)
1956 		__field(	ext4_lblk_t,	from		)
1957 		__field(	ext4_lblk_t,	to		)
1958 		__field(	int,		reverse		)
1959 		__field(	int,		found		)
1960 		__field(	ext4_lblk_t,	found_blk	)
1961 	),
1962 
1963 	TP_fast_assign(
1964 		__entry->dev		= inode->i_sb->s_dev;
1965 		__entry->ino		= inode->i_ino;
1966 		__entry->from		= from;
1967 		__entry->to		= to;
1968 		__entry->reverse	= reverse;
1969 		__entry->found		= found;
1970 		__entry->found_blk	= found_blk;
1971 	),
1972 
1973 	TP_printk("dev %d,%d ino %lu from %u to %u reverse %d found %d "
1974 		  "(blk = %u)",
1975 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1976 		  (unsigned long) __entry->ino,
1977 		  (unsigned) __entry->from, (unsigned) __entry->to,
1978 		  __entry->reverse, __entry->found,
1979 		  (unsigned) __entry->found_blk)
1980 );
1981 
1982 TRACE_EVENT(ext4_get_reserved_cluster_alloc,
1983 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, unsigned int len),
1984 
1985 	TP_ARGS(inode, lblk, len),
1986 
1987 	TP_STRUCT__entry(
1988 		__field(	dev_t,		dev	)
1989 		__field(	ino_t,		ino	)
1990 		__field(	ext4_lblk_t,	lblk	)
1991 		__field(	unsigned int,	len	)
1992 	),
1993 
1994 	TP_fast_assign(
1995 		__entry->dev	= inode->i_sb->s_dev;
1996 		__entry->ino	= inode->i_ino;
1997 		__entry->lblk	= lblk;
1998 		__entry->len	= len;
1999 	),
2000 
2001 	TP_printk("dev %d,%d ino %lu lblk %u len %u",
2002 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2003 		  (unsigned long) __entry->ino,
2004 		  (unsigned) __entry->lblk,
2005 		  __entry->len)
2006 );
2007 
2008 TRACE_EVENT(ext4_ext_show_extent,
2009 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk,
2010 		 unsigned short len),
2011 
2012 	TP_ARGS(inode, lblk, pblk, len),
2013 
2014 	TP_STRUCT__entry(
2015 		__field(	dev_t,		dev	)
2016 		__field(	ino_t,		ino	)
2017 		__field(	ext4_fsblk_t,	pblk	)
2018 		__field(	ext4_lblk_t,	lblk	)
2019 		__field(	unsigned short,	len	)
2020 	),
2021 
2022 	TP_fast_assign(
2023 		__entry->dev	= inode->i_sb->s_dev;
2024 		__entry->ino	= inode->i_ino;
2025 		__entry->pblk	= pblk;
2026 		__entry->lblk	= lblk;
2027 		__entry->len	= len;
2028 	),
2029 
2030 	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u",
2031 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2032 		  (unsigned long) __entry->ino,
2033 		  (unsigned) __entry->lblk,
2034 		  (unsigned long long) __entry->pblk,
2035 		  (unsigned short) __entry->len)
2036 );
2037 
2038 TRACE_EVENT(ext4_remove_blocks,
2039 	TP_PROTO(struct inode *inode, struct ext4_extent *ex,
2040 		 ext4_lblk_t from, ext4_fsblk_t to,
2041 		 struct partial_cluster *pc),
2042 
2043 	TP_ARGS(inode, ex, from, to, pc),
2044 
2045 	TP_STRUCT__entry(
2046 		__field(	dev_t,		dev	)
2047 		__field(	ino_t,		ino	)
2048 		__field(	ext4_lblk_t,	from	)
2049 		__field(	ext4_lblk_t,	to	)
2050 		__field(	ext4_fsblk_t,	ee_pblk	)
2051 		__field(	ext4_lblk_t,	ee_lblk	)
2052 		__field(	unsigned short,	ee_len	)
2053 		__field(	ext4_fsblk_t,	pc_pclu	)
2054 		__field(	ext4_lblk_t,	pc_lblk	)
2055 		__field(	int,		pc_state)
2056 	),
2057 
2058 	TP_fast_assign(
2059 		__entry->dev		= inode->i_sb->s_dev;
2060 		__entry->ino		= inode->i_ino;
2061 		__entry->from		= from;
2062 		__entry->to		= to;
2063 		__entry->ee_pblk	= ext4_ext_pblock(ex);
2064 		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
2065 		__entry->ee_len		= ext4_ext_get_actual_len(ex);
2066 		__entry->pc_pclu	= pc->pclu;
2067 		__entry->pc_lblk	= pc->lblk;
2068 		__entry->pc_state	= pc->state;
2069 	),
2070 
2071 	TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]"
2072 		  "from %u to %u partial [pclu %lld lblk %u state %d]",
2073 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2074 		  (unsigned long) __entry->ino,
2075 		  (unsigned) __entry->ee_lblk,
2076 		  (unsigned long long) __entry->ee_pblk,
2077 		  (unsigned short) __entry->ee_len,
2078 		  (unsigned) __entry->from,
2079 		  (unsigned) __entry->to,
2080 		  (long long) __entry->pc_pclu,
2081 		  (unsigned int) __entry->pc_lblk,
2082 		  (int) __entry->pc_state)
2083 );
2084 
2085 TRACE_EVENT(ext4_ext_rm_leaf,
2086 	TP_PROTO(struct inode *inode, ext4_lblk_t start,
2087 		 struct ext4_extent *ex,
2088 		 struct partial_cluster *pc),
2089 
2090 	TP_ARGS(inode, start, ex, pc),
2091 
2092 	TP_STRUCT__entry(
2093 		__field(	dev_t,		dev	)
2094 		__field(	ino_t,		ino	)
2095 		__field(	ext4_lblk_t,	start	)
2096 		__field(	ext4_lblk_t,	ee_lblk	)
2097 		__field(	ext4_fsblk_t,	ee_pblk	)
2098 		__field(	short,		ee_len	)
2099 		__field(	ext4_fsblk_t,	pc_pclu	)
2100 		__field(	ext4_lblk_t,	pc_lblk	)
2101 		__field(	int,		pc_state)
2102 	),
2103 
2104 	TP_fast_assign(
2105 		__entry->dev		= inode->i_sb->s_dev;
2106 		__entry->ino		= inode->i_ino;
2107 		__entry->start		= start;
2108 		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
2109 		__entry->ee_pblk	= ext4_ext_pblock(ex);
2110 		__entry->ee_len		= ext4_ext_get_actual_len(ex);
2111 		__entry->pc_pclu	= pc->pclu;
2112 		__entry->pc_lblk	= pc->lblk;
2113 		__entry->pc_state	= pc->state;
2114 	),
2115 
2116 	TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]"
2117 		  "partial [pclu %lld lblk %u state %d]",
2118 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2119 		  (unsigned long) __entry->ino,
2120 		  (unsigned) __entry->start,
2121 		  (unsigned) __entry->ee_lblk,
2122 		  (unsigned long long) __entry->ee_pblk,
2123 		  (unsigned short) __entry->ee_len,
2124 		  (long long) __entry->pc_pclu,
2125 		  (unsigned int) __entry->pc_lblk,
2126 		  (int) __entry->pc_state)
2127 );
2128 
2129 TRACE_EVENT(ext4_ext_rm_idx,
2130 	TP_PROTO(struct inode *inode, ext4_fsblk_t pblk),
2131 
2132 	TP_ARGS(inode, pblk),
2133 
2134 	TP_STRUCT__entry(
2135 		__field(	dev_t,		dev	)
2136 		__field(	ino_t,		ino	)
2137 		__field(	ext4_fsblk_t,	pblk	)
2138 	),
2139 
2140 	TP_fast_assign(
2141 		__entry->dev	= inode->i_sb->s_dev;
2142 		__entry->ino	= inode->i_ino;
2143 		__entry->pblk	= pblk;
2144 	),
2145 
2146 	TP_printk("dev %d,%d ino %lu index_pblk %llu",
2147 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2148 		  (unsigned long) __entry->ino,
2149 		  (unsigned long long) __entry->pblk)
2150 );
2151 
2152 TRACE_EVENT(ext4_ext_remove_space,
2153 	TP_PROTO(struct inode *inode, ext4_lblk_t start,
2154 		 ext4_lblk_t end, int depth),
2155 
2156 	TP_ARGS(inode, start, end, depth),
2157 
2158 	TP_STRUCT__entry(
2159 		__field(	dev_t,		dev	)
2160 		__field(	ino_t,		ino	)
2161 		__field(	ext4_lblk_t,	start	)
2162 		__field(	ext4_lblk_t,	end	)
2163 		__field(	int,		depth	)
2164 	),
2165 
2166 	TP_fast_assign(
2167 		__entry->dev	= inode->i_sb->s_dev;
2168 		__entry->ino	= inode->i_ino;
2169 		__entry->start	= start;
2170 		__entry->end	= end;
2171 		__entry->depth	= depth;
2172 	),
2173 
2174 	TP_printk("dev %d,%d ino %lu since %u end %u depth %d",
2175 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2176 		  (unsigned long) __entry->ino,
2177 		  (unsigned) __entry->start,
2178 		  (unsigned) __entry->end,
2179 		  __entry->depth)
2180 );
2181 
2182 TRACE_EVENT(ext4_ext_remove_space_done,
2183 	TP_PROTO(struct inode *inode, ext4_lblk_t start, ext4_lblk_t end,
2184 		 int depth, struct partial_cluster *pc, __le16 eh_entries),
2185 
2186 	TP_ARGS(inode, start, end, depth, pc, eh_entries),
2187 
2188 	TP_STRUCT__entry(
2189 		__field(	dev_t,		dev		)
2190 		__field(	ino_t,		ino		)
2191 		__field(	ext4_lblk_t,	start		)
2192 		__field(	ext4_lblk_t,	end		)
2193 		__field(	int,		depth		)
2194 		__field(	ext4_fsblk_t,	pc_pclu		)
2195 		__field(	ext4_lblk_t,	pc_lblk		)
2196 		__field(	int,		pc_state	)
2197 		__field(	unsigned short,	eh_entries	)
2198 	),
2199 
2200 	TP_fast_assign(
2201 		__entry->dev		= inode->i_sb->s_dev;
2202 		__entry->ino		= inode->i_ino;
2203 		__entry->start		= start;
2204 		__entry->end		= end;
2205 		__entry->depth		= depth;
2206 		__entry->pc_pclu	= pc->pclu;
2207 		__entry->pc_lblk	= pc->lblk;
2208 		__entry->pc_state	= pc->state;
2209 		__entry->eh_entries	= le16_to_cpu(eh_entries);
2210 	),
2211 
2212 	TP_printk("dev %d,%d ino %lu since %u end %u depth %d "
2213 		  "partial [pclu %lld lblk %u state %d] "
2214 		  "remaining_entries %u",
2215 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2216 		  (unsigned long) __entry->ino,
2217 		  (unsigned) __entry->start,
2218 		  (unsigned) __entry->end,
2219 		  __entry->depth,
2220 		  (long long) __entry->pc_pclu,
2221 		  (unsigned int) __entry->pc_lblk,
2222 		  (int) __entry->pc_state,
2223 		  (unsigned short) __entry->eh_entries)
2224 );
2225 
2226 DECLARE_EVENT_CLASS(ext4__es_extent,
2227 	TP_PROTO(struct inode *inode, struct extent_status *es),
2228 
2229 	TP_ARGS(inode, es),
2230 
2231 	TP_STRUCT__entry(
2232 		__field(	dev_t,		dev		)
2233 		__field(	ino_t,		ino		)
2234 		__field(	ext4_lblk_t,	lblk		)
2235 		__field(	ext4_lblk_t,	len		)
2236 		__field(	ext4_fsblk_t,	pblk		)
2237 		__field(	char, status	)
2238 	),
2239 
2240 	TP_fast_assign(
2241 		__entry->dev	= inode->i_sb->s_dev;
2242 		__entry->ino	= inode->i_ino;
2243 		__entry->lblk	= es->es_lblk;
2244 		__entry->len	= es->es_len;
2245 		__entry->pblk	= ext4_es_pblock(es);
2246 		__entry->status	= ext4_es_status(es);
2247 	),
2248 
2249 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2250 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2251 		  (unsigned long) __entry->ino,
2252 		  __entry->lblk, __entry->len,
2253 		  __entry->pblk, show_extent_status(__entry->status))
2254 );
2255 
2256 DEFINE_EVENT(ext4__es_extent, ext4_es_insert_extent,
2257 	TP_PROTO(struct inode *inode, struct extent_status *es),
2258 
2259 	TP_ARGS(inode, es)
2260 );
2261 
2262 DEFINE_EVENT(ext4__es_extent, ext4_es_cache_extent,
2263 	TP_PROTO(struct inode *inode, struct extent_status *es),
2264 
2265 	TP_ARGS(inode, es)
2266 );
2267 
2268 TRACE_EVENT(ext4_es_remove_extent,
2269 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t len),
2270 
2271 	TP_ARGS(inode, lblk, len),
2272 
2273 	TP_STRUCT__entry(
2274 		__field(	dev_t,	dev			)
2275 		__field(	ino_t,	ino			)
2276 		__field(	loff_t,	lblk			)
2277 		__field(	loff_t,	len			)
2278 	),
2279 
2280 	TP_fast_assign(
2281 		__entry->dev	= inode->i_sb->s_dev;
2282 		__entry->ino	= inode->i_ino;
2283 		__entry->lblk	= lblk;
2284 		__entry->len	= len;
2285 	),
2286 
2287 	TP_printk("dev %d,%d ino %lu es [%lld/%lld)",
2288 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2289 		  (unsigned long) __entry->ino,
2290 		  __entry->lblk, __entry->len)
2291 );
2292 
2293 TRACE_EVENT(ext4_es_find_extent_range_enter,
2294 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2295 
2296 	TP_ARGS(inode, lblk),
2297 
2298 	TP_STRUCT__entry(
2299 		__field(	dev_t,		dev		)
2300 		__field(	ino_t,		ino		)
2301 		__field(	ext4_lblk_t,	lblk		)
2302 	),
2303 
2304 	TP_fast_assign(
2305 		__entry->dev	= inode->i_sb->s_dev;
2306 		__entry->ino	= inode->i_ino;
2307 		__entry->lblk	= lblk;
2308 	),
2309 
2310 	TP_printk("dev %d,%d ino %lu lblk %u",
2311 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2312 		  (unsigned long) __entry->ino, __entry->lblk)
2313 );
2314 
2315 TRACE_EVENT(ext4_es_find_extent_range_exit,
2316 	TP_PROTO(struct inode *inode, struct extent_status *es),
2317 
2318 	TP_ARGS(inode, es),
2319 
2320 	TP_STRUCT__entry(
2321 		__field(	dev_t,		dev		)
2322 		__field(	ino_t,		ino		)
2323 		__field(	ext4_lblk_t,	lblk		)
2324 		__field(	ext4_lblk_t,	len		)
2325 		__field(	ext4_fsblk_t,	pblk		)
2326 		__field(	char, status	)
2327 	),
2328 
2329 	TP_fast_assign(
2330 		__entry->dev	= inode->i_sb->s_dev;
2331 		__entry->ino	= inode->i_ino;
2332 		__entry->lblk	= es->es_lblk;
2333 		__entry->len	= es->es_len;
2334 		__entry->pblk	= ext4_es_pblock(es);
2335 		__entry->status	= ext4_es_status(es);
2336 	),
2337 
2338 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2339 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2340 		  (unsigned long) __entry->ino,
2341 		  __entry->lblk, __entry->len,
2342 		  __entry->pblk, show_extent_status(__entry->status))
2343 );
2344 
2345 TRACE_EVENT(ext4_es_lookup_extent_enter,
2346 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2347 
2348 	TP_ARGS(inode, lblk),
2349 
2350 	TP_STRUCT__entry(
2351 		__field(	dev_t,		dev		)
2352 		__field(	ino_t,		ino		)
2353 		__field(	ext4_lblk_t,	lblk		)
2354 	),
2355 
2356 	TP_fast_assign(
2357 		__entry->dev	= inode->i_sb->s_dev;
2358 		__entry->ino	= inode->i_ino;
2359 		__entry->lblk	= lblk;
2360 	),
2361 
2362 	TP_printk("dev %d,%d ino %lu lblk %u",
2363 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2364 		  (unsigned long) __entry->ino, __entry->lblk)
2365 );
2366 
2367 TRACE_EVENT(ext4_es_lookup_extent_exit,
2368 	TP_PROTO(struct inode *inode, struct extent_status *es,
2369 		 int found),
2370 
2371 	TP_ARGS(inode, es, found),
2372 
2373 	TP_STRUCT__entry(
2374 		__field(	dev_t,		dev		)
2375 		__field(	ino_t,		ino		)
2376 		__field(	ext4_lblk_t,	lblk		)
2377 		__field(	ext4_lblk_t,	len		)
2378 		__field(	ext4_fsblk_t,	pblk		)
2379 		__field(	char,		status		)
2380 		__field(	int,		found		)
2381 	),
2382 
2383 	TP_fast_assign(
2384 		__entry->dev	= inode->i_sb->s_dev;
2385 		__entry->ino	= inode->i_ino;
2386 		__entry->lblk	= es->es_lblk;
2387 		__entry->len	= es->es_len;
2388 		__entry->pblk	= ext4_es_pblock(es);
2389 		__entry->status	= ext4_es_status(es);
2390 		__entry->found	= found;
2391 	),
2392 
2393 	TP_printk("dev %d,%d ino %lu found %d [%u/%u) %llu %s",
2394 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2395 		  (unsigned long) __entry->ino, __entry->found,
2396 		  __entry->lblk, __entry->len,
2397 		  __entry->found ? __entry->pblk : 0,
2398 		  show_extent_status(__entry->found ? __entry->status : 0))
2399 );
2400 
2401 DECLARE_EVENT_CLASS(ext4__es_shrink_enter,
2402 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2403 
2404 	TP_ARGS(sb, nr_to_scan, cache_cnt),
2405 
2406 	TP_STRUCT__entry(
2407 		__field(	dev_t,	dev			)
2408 		__field(	int,	nr_to_scan		)
2409 		__field(	int,	cache_cnt		)
2410 	),
2411 
2412 	TP_fast_assign(
2413 		__entry->dev		= sb->s_dev;
2414 		__entry->nr_to_scan	= nr_to_scan;
2415 		__entry->cache_cnt	= cache_cnt;
2416 	),
2417 
2418 	TP_printk("dev %d,%d nr_to_scan %d cache_cnt %d",
2419 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2420 		  __entry->nr_to_scan, __entry->cache_cnt)
2421 );
2422 
2423 DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_count,
2424 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2425 
2426 	TP_ARGS(sb, nr_to_scan, cache_cnt)
2427 );
2428 
2429 DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_scan_enter,
2430 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2431 
2432 	TP_ARGS(sb, nr_to_scan, cache_cnt)
2433 );
2434 
2435 TRACE_EVENT(ext4_es_shrink_scan_exit,
2436 	TP_PROTO(struct super_block *sb, int nr_shrunk, int cache_cnt),
2437 
2438 	TP_ARGS(sb, nr_shrunk, cache_cnt),
2439 
2440 	TP_STRUCT__entry(
2441 		__field(	dev_t,	dev			)
2442 		__field(	int,	nr_shrunk		)
2443 		__field(	int,	cache_cnt		)
2444 	),
2445 
2446 	TP_fast_assign(
2447 		__entry->dev		= sb->s_dev;
2448 		__entry->nr_shrunk	= nr_shrunk;
2449 		__entry->cache_cnt	= cache_cnt;
2450 	),
2451 
2452 	TP_printk("dev %d,%d nr_shrunk %d cache_cnt %d",
2453 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2454 		  __entry->nr_shrunk, __entry->cache_cnt)
2455 );
2456 
2457 TRACE_EVENT(ext4_collapse_range,
2458 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2459 
2460 	TP_ARGS(inode, offset, len),
2461 
2462 	TP_STRUCT__entry(
2463 		__field(dev_t,	dev)
2464 		__field(ino_t,	ino)
2465 		__field(loff_t,	offset)
2466 		__field(loff_t, len)
2467 	),
2468 
2469 	TP_fast_assign(
2470 		__entry->dev	= inode->i_sb->s_dev;
2471 		__entry->ino	= inode->i_ino;
2472 		__entry->offset	= offset;
2473 		__entry->len	= len;
2474 	),
2475 
2476 	TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2477 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2478 		  (unsigned long) __entry->ino,
2479 		  __entry->offset, __entry->len)
2480 );
2481 
2482 TRACE_EVENT(ext4_insert_range,
2483 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2484 
2485 	TP_ARGS(inode, offset, len),
2486 
2487 	TP_STRUCT__entry(
2488 		__field(dev_t,	dev)
2489 		__field(ino_t,	ino)
2490 		__field(loff_t,	offset)
2491 		__field(loff_t, len)
2492 	),
2493 
2494 	TP_fast_assign(
2495 		__entry->dev	= inode->i_sb->s_dev;
2496 		__entry->ino	= inode->i_ino;
2497 		__entry->offset	= offset;
2498 		__entry->len	= len;
2499 	),
2500 
2501 	TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2502 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2503 		  (unsigned long) __entry->ino,
2504 		  __entry->offset, __entry->len)
2505 );
2506 
2507 TRACE_EVENT(ext4_es_shrink,
2508 	TP_PROTO(struct super_block *sb, int nr_shrunk, u64 scan_time,
2509 		 int nr_skipped, int retried),
2510 
2511 	TP_ARGS(sb, nr_shrunk, scan_time, nr_skipped, retried),
2512 
2513 	TP_STRUCT__entry(
2514 		__field(	dev_t,		dev		)
2515 		__field(	int,		nr_shrunk	)
2516 		__field(	unsigned long long, scan_time	)
2517 		__field(	int,		nr_skipped	)
2518 		__field(	int,		retried		)
2519 	),
2520 
2521 	TP_fast_assign(
2522 		__entry->dev		= sb->s_dev;
2523 		__entry->nr_shrunk	= nr_shrunk;
2524 		__entry->scan_time	= div_u64(scan_time, 1000);
2525 		__entry->nr_skipped	= nr_skipped;
2526 		__entry->retried	= retried;
2527 	),
2528 
2529 	TP_printk("dev %d,%d nr_shrunk %d, scan_time %llu "
2530 		  "nr_skipped %d retried %d",
2531 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->nr_shrunk,
2532 		  __entry->scan_time, __entry->nr_skipped, __entry->retried)
2533 );
2534 
2535 TRACE_EVENT(ext4_es_insert_delayed_block,
2536 	TP_PROTO(struct inode *inode, struct extent_status *es,
2537 		 bool allocated),
2538 
2539 	TP_ARGS(inode, es, allocated),
2540 
2541 	TP_STRUCT__entry(
2542 		__field(	dev_t,		dev		)
2543 		__field(	ino_t,		ino		)
2544 		__field(	ext4_lblk_t,	lblk		)
2545 		__field(	ext4_lblk_t,	len		)
2546 		__field(	ext4_fsblk_t,	pblk		)
2547 		__field(	char,		status		)
2548 		__field(	bool,		allocated	)
2549 	),
2550 
2551 	TP_fast_assign(
2552 		__entry->dev		= inode->i_sb->s_dev;
2553 		__entry->ino		= inode->i_ino;
2554 		__entry->lblk		= es->es_lblk;
2555 		__entry->len		= es->es_len;
2556 		__entry->pblk		= ext4_es_pblock(es);
2557 		__entry->status		= ext4_es_status(es);
2558 		__entry->allocated	= allocated;
2559 	),
2560 
2561 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s "
2562 		  "allocated %d",
2563 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2564 		  (unsigned long) __entry->ino,
2565 		  __entry->lblk, __entry->len,
2566 		  __entry->pblk, show_extent_status(__entry->status),
2567 		  __entry->allocated)
2568 );
2569 
2570 /* fsmap traces */
2571 DECLARE_EVENT_CLASS(ext4_fsmap_class,
2572 	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len,
2573 		 u64 owner),
2574 	TP_ARGS(sb, keydev, agno, bno, len, owner),
2575 	TP_STRUCT__entry(
2576 		__field(dev_t, dev)
2577 		__field(dev_t, keydev)
2578 		__field(u32, agno)
2579 		__field(u64, bno)
2580 		__field(u64, len)
2581 		__field(u64, owner)
2582 	),
2583 	TP_fast_assign(
2584 		__entry->dev = sb->s_bdev->bd_dev;
2585 		__entry->keydev = new_decode_dev(keydev);
2586 		__entry->agno = agno;
2587 		__entry->bno = bno;
2588 		__entry->len = len;
2589 		__entry->owner = owner;
2590 	),
2591 	TP_printk("dev %d:%d keydev %d:%d agno %u bno %llu len %llu owner %lld\n",
2592 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2593 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
2594 		  __entry->agno,
2595 		  __entry->bno,
2596 		  __entry->len,
2597 		  __entry->owner)
2598 )
2599 #define DEFINE_FSMAP_EVENT(name) \
2600 DEFINE_EVENT(ext4_fsmap_class, name, \
2601 	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len, \
2602 		 u64 owner), \
2603 	TP_ARGS(sb, keydev, agno, bno, len, owner))
2604 DEFINE_FSMAP_EVENT(ext4_fsmap_low_key);
2605 DEFINE_FSMAP_EVENT(ext4_fsmap_high_key);
2606 DEFINE_FSMAP_EVENT(ext4_fsmap_mapping);
2607 
2608 DECLARE_EVENT_CLASS(ext4_getfsmap_class,
2609 	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap),
2610 	TP_ARGS(sb, fsmap),
2611 	TP_STRUCT__entry(
2612 		__field(dev_t, dev)
2613 		__field(dev_t, keydev)
2614 		__field(u64, block)
2615 		__field(u64, len)
2616 		__field(u64, owner)
2617 		__field(u64, flags)
2618 	),
2619 	TP_fast_assign(
2620 		__entry->dev = sb->s_bdev->bd_dev;
2621 		__entry->keydev = new_decode_dev(fsmap->fmr_device);
2622 		__entry->block = fsmap->fmr_physical;
2623 		__entry->len = fsmap->fmr_length;
2624 		__entry->owner = fsmap->fmr_owner;
2625 		__entry->flags = fsmap->fmr_flags;
2626 	),
2627 	TP_printk("dev %d:%d keydev %d:%d block %llu len %llu owner %lld flags 0x%llx\n",
2628 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2629 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
2630 		  __entry->block,
2631 		  __entry->len,
2632 		  __entry->owner,
2633 		  __entry->flags)
2634 )
2635 #define DEFINE_GETFSMAP_EVENT(name) \
2636 DEFINE_EVENT(ext4_getfsmap_class, name, \
2637 	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap), \
2638 	TP_ARGS(sb, fsmap))
2639 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_low_key);
2640 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_high_key);
2641 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_mapping);
2642 
2643 TRACE_EVENT(ext4_shutdown,
2644 	TP_PROTO(struct super_block *sb, unsigned long flags),
2645 
2646 	TP_ARGS(sb, flags),
2647 
2648 	TP_STRUCT__entry(
2649 		__field(	dev_t,	dev			)
2650 		__field(     unsigned,	flags			)
2651 	),
2652 
2653 	TP_fast_assign(
2654 		__entry->dev	= sb->s_dev;
2655 		__entry->flags	= flags;
2656 	),
2657 
2658 	TP_printk("dev %d,%d flags %u",
2659 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2660 		  __entry->flags)
2661 );
2662 
2663 TRACE_EVENT(ext4_error,
2664 	TP_PROTO(struct super_block *sb, const char *function,
2665 		 unsigned int line),
2666 
2667 	TP_ARGS(sb, function, line),
2668 
2669 	TP_STRUCT__entry(
2670 		__field(	dev_t,	dev			)
2671 		__field( const char *,	function		)
2672 		__field(     unsigned,	line			)
2673 	),
2674 
2675 	TP_fast_assign(
2676 		__entry->dev	= sb->s_dev;
2677 		__entry->function = function;
2678 		__entry->line	= line;
2679 	),
2680 
2681 	TP_printk("dev %d,%d function %s line %u",
2682 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2683 		  __entry->function, __entry->line)
2684 );
2685 
2686 #endif /* _TRACE_EXT4_H */
2687 
2688 /* This part must be outside protection */
2689 #include <trace/define_trace.h>
2690