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