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