xref: /linux/include/trace/events/ext4.h (revision cf4cebcec619d963fa7496018f03cb0ff00dc257)
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, int nr_resv),
1250 
1251 	TP_ARGS(inode, nr_resv),
1252 
1253 	TP_STRUCT__entry(
1254 		__field(	dev_t,	dev			)
1255 		__field(	ino_t,	ino			)
1256 		__field(	__u64,	i_blocks		)
1257 		__field(	int,	reserve_blocks		)
1258 		__field(	int,	reserved_data_blocks	)
1259 		__field(	__u16,  mode			)
1260 	),
1261 
1262 	TP_fast_assign(
1263 		__entry->dev	= inode->i_sb->s_dev;
1264 		__entry->ino	= inode->i_ino;
1265 		__entry->i_blocks = inode->i_blocks;
1266 		__entry->reserve_blocks = nr_resv;
1267 		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1268 		__entry->mode	= inode->i_mode;
1269 	),
1270 
1271 	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu reserve_blocks %d"
1272 		  "reserved_data_blocks %d",
1273 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1274 		  (unsigned long) __entry->ino,
1275 		  __entry->mode, __entry->i_blocks,
1276 		  __entry->reserve_blocks, __entry->reserved_data_blocks)
1277 );
1278 
1279 TRACE_EVENT(ext4_da_release_space,
1280 	TP_PROTO(struct inode *inode, int freed_blocks),
1281 
1282 	TP_ARGS(inode, freed_blocks),
1283 
1284 	TP_STRUCT__entry(
1285 		__field(	dev_t,	dev			)
1286 		__field(	ino_t,	ino			)
1287 		__field(	__u64,	i_blocks		)
1288 		__field(	int,	freed_blocks		)
1289 		__field(	int,	reserved_data_blocks	)
1290 		__field(	__u16,  mode			)
1291 	),
1292 
1293 	TP_fast_assign(
1294 		__entry->dev	= inode->i_sb->s_dev;
1295 		__entry->ino	= inode->i_ino;
1296 		__entry->i_blocks = inode->i_blocks;
1297 		__entry->freed_blocks = freed_blocks;
1298 		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1299 		__entry->mode	= inode->i_mode;
1300 	),
1301 
1302 	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d "
1303 		  "reserved_data_blocks %d",
1304 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1305 		  (unsigned long) __entry->ino,
1306 		  __entry->mode, __entry->i_blocks,
1307 		  __entry->freed_blocks, __entry->reserved_data_blocks)
1308 );
1309 
1310 DECLARE_EVENT_CLASS(ext4__bitmap_load,
1311 	TP_PROTO(struct super_block *sb, unsigned long group),
1312 
1313 	TP_ARGS(sb, group),
1314 
1315 	TP_STRUCT__entry(
1316 		__field(	dev_t,	dev			)
1317 		__field(	__u32,	group			)
1318 
1319 	),
1320 
1321 	TP_fast_assign(
1322 		__entry->dev	= sb->s_dev;
1323 		__entry->group	= group;
1324 	),
1325 
1326 	TP_printk("dev %d,%d group %u",
1327 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1328 		  __entry->group)
1329 );
1330 
1331 DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load,
1332 
1333 	TP_PROTO(struct super_block *sb, unsigned long group),
1334 
1335 	TP_ARGS(sb, group)
1336 );
1337 
1338 DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
1339 
1340 	TP_PROTO(struct super_block *sb, unsigned long group),
1341 
1342 	TP_ARGS(sb, group)
1343 );
1344 
1345 DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
1346 
1347 	TP_PROTO(struct super_block *sb, unsigned long group),
1348 
1349 	TP_ARGS(sb, group)
1350 );
1351 
1352 TRACE_EVENT(ext4_read_block_bitmap_load,
1353 	TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
1354 
1355 	TP_ARGS(sb, group, prefetch),
1356 
1357 	TP_STRUCT__entry(
1358 		__field(	dev_t,	dev			)
1359 		__field(	__u32,	group			)
1360 		__field(	bool,	prefetch		)
1361 
1362 	),
1363 
1364 	TP_fast_assign(
1365 		__entry->dev	= sb->s_dev;
1366 		__entry->group	= group;
1367 		__entry->prefetch = prefetch;
1368 	),
1369 
1370 	TP_printk("dev %d,%d group %u prefetch %d",
1371 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1372 		  __entry->group, __entry->prefetch)
1373 );
1374 
1375 DECLARE_EVENT_CLASS(ext4__fallocate_mode,
1376 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1377 
1378 	TP_ARGS(inode, offset, len, mode),
1379 
1380 	TP_STRUCT__entry(
1381 		__field(	dev_t,	dev			)
1382 		__field(	ino_t,	ino			)
1383 		__field(	loff_t,	offset			)
1384 		__field(	loff_t, len			)
1385 		__field(	int,	mode			)
1386 	),
1387 
1388 	TP_fast_assign(
1389 		__entry->dev	= inode->i_sb->s_dev;
1390 		__entry->ino	= inode->i_ino;
1391 		__entry->offset	= offset;
1392 		__entry->len	= len;
1393 		__entry->mode	= mode;
1394 	),
1395 
1396 	TP_printk("dev %d,%d ino %lu offset %lld len %lld mode %s",
1397 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1398 		  (unsigned long) __entry->ino,
1399 		  __entry->offset, __entry->len,
1400 		  show_falloc_mode(__entry->mode))
1401 );
1402 
1403 DEFINE_EVENT(ext4__fallocate_mode, ext4_fallocate_enter,
1404 
1405 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1406 
1407 	TP_ARGS(inode, offset, len, mode)
1408 );
1409 
1410 DEFINE_EVENT(ext4__fallocate_mode, ext4_punch_hole,
1411 
1412 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1413 
1414 	TP_ARGS(inode, offset, len, mode)
1415 );
1416 
1417 DEFINE_EVENT(ext4__fallocate_mode, ext4_zero_range,
1418 
1419 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1420 
1421 	TP_ARGS(inode, offset, len, mode)
1422 );
1423 
1424 TRACE_EVENT(ext4_fallocate_exit,
1425 	TP_PROTO(struct inode *inode, loff_t offset,
1426 		 unsigned int max_blocks, int ret),
1427 
1428 	TP_ARGS(inode, offset, max_blocks, ret),
1429 
1430 	TP_STRUCT__entry(
1431 		__field(	dev_t,	dev			)
1432 		__field(	ino_t,	ino			)
1433 		__field(	loff_t,	pos			)
1434 		__field(	unsigned int,	blocks		)
1435 		__field(	int, 	ret			)
1436 	),
1437 
1438 	TP_fast_assign(
1439 		__entry->dev	= inode->i_sb->s_dev;
1440 		__entry->ino	= inode->i_ino;
1441 		__entry->pos	= offset;
1442 		__entry->blocks	= max_blocks;
1443 		__entry->ret	= ret;
1444 	),
1445 
1446 	TP_printk("dev %d,%d ino %lu pos %lld blocks %u ret %d",
1447 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1448 		  (unsigned long) __entry->ino,
1449 		  __entry->pos, __entry->blocks,
1450 		  __entry->ret)
1451 );
1452 
1453 TRACE_EVENT(ext4_unlink_enter,
1454 	TP_PROTO(struct inode *parent, struct dentry *dentry),
1455 
1456 	TP_ARGS(parent, dentry),
1457 
1458 	TP_STRUCT__entry(
1459 		__field(	dev_t,	dev			)
1460 		__field(	ino_t,	ino			)
1461 		__field(	ino_t,	parent			)
1462 		__field(	loff_t,	size			)
1463 	),
1464 
1465 	TP_fast_assign(
1466 		__entry->dev		= dentry->d_sb->s_dev;
1467 		__entry->ino		= d_inode(dentry)->i_ino;
1468 		__entry->parent		= parent->i_ino;
1469 		__entry->size		= d_inode(dentry)->i_size;
1470 	),
1471 
1472 	TP_printk("dev %d,%d ino %lu size %lld parent %lu",
1473 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1474 		  (unsigned long) __entry->ino, __entry->size,
1475 		  (unsigned long) __entry->parent)
1476 );
1477 
1478 TRACE_EVENT(ext4_unlink_exit,
1479 	TP_PROTO(struct dentry *dentry, int ret),
1480 
1481 	TP_ARGS(dentry, ret),
1482 
1483 	TP_STRUCT__entry(
1484 		__field(	dev_t,	dev			)
1485 		__field(	ino_t,	ino			)
1486 		__field(	int,	ret			)
1487 	),
1488 
1489 	TP_fast_assign(
1490 		__entry->dev		= dentry->d_sb->s_dev;
1491 		__entry->ino		= d_inode(dentry)->i_ino;
1492 		__entry->ret		= ret;
1493 	),
1494 
1495 	TP_printk("dev %d,%d ino %lu ret %d",
1496 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1497 		  (unsigned long) __entry->ino,
1498 		  __entry->ret)
1499 );
1500 
1501 DECLARE_EVENT_CLASS(ext4__truncate,
1502 	TP_PROTO(struct inode *inode),
1503 
1504 	TP_ARGS(inode),
1505 
1506 	TP_STRUCT__entry(
1507 		__field(	dev_t,		dev		)
1508 		__field(	ino_t,		ino		)
1509 		__field(	__u64,		blocks		)
1510 	),
1511 
1512 	TP_fast_assign(
1513 		__entry->dev    = inode->i_sb->s_dev;
1514 		__entry->ino    = inode->i_ino;
1515 		__entry->blocks	= inode->i_blocks;
1516 	),
1517 
1518 	TP_printk("dev %d,%d ino %lu blocks %llu",
1519 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1520 		  (unsigned long) __entry->ino, __entry->blocks)
1521 );
1522 
1523 DEFINE_EVENT(ext4__truncate, ext4_truncate_enter,
1524 
1525 	TP_PROTO(struct inode *inode),
1526 
1527 	TP_ARGS(inode)
1528 );
1529 
1530 DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,
1531 
1532 	TP_PROTO(struct inode *inode),
1533 
1534 	TP_ARGS(inode)
1535 );
1536 
1537 /* 'ux' is the unwritten extent. */
1538 TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1539 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1540 		 struct ext4_extent *ux),
1541 
1542 	TP_ARGS(inode, map, ux),
1543 
1544 	TP_STRUCT__entry(
1545 		__field(	dev_t,		dev	)
1546 		__field(	ino_t,		ino	)
1547 		__field(	ext4_lblk_t,	m_lblk	)
1548 		__field(	unsigned,	m_len	)
1549 		__field(	ext4_lblk_t,	u_lblk	)
1550 		__field(	unsigned,	u_len	)
1551 		__field(	ext4_fsblk_t,	u_pblk	)
1552 	),
1553 
1554 	TP_fast_assign(
1555 		__entry->dev		= inode->i_sb->s_dev;
1556 		__entry->ino		= inode->i_ino;
1557 		__entry->m_lblk		= map->m_lblk;
1558 		__entry->m_len		= map->m_len;
1559 		__entry->u_lblk		= le32_to_cpu(ux->ee_block);
1560 		__entry->u_len		= ext4_ext_get_actual_len(ux);
1561 		__entry->u_pblk		= ext4_ext_pblock(ux);
1562 	),
1563 
1564 	TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u u_lblk %u u_len %u "
1565 		  "u_pblk %llu",
1566 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1567 		  (unsigned long) __entry->ino,
1568 		  __entry->m_lblk, __entry->m_len,
1569 		  __entry->u_lblk, __entry->u_len, __entry->u_pblk)
1570 );
1571 
1572 /*
1573  * 'ux' is the unwritten extent.
1574  * 'ix' is the initialized extent to which blocks are transferred.
1575  */
1576 TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
1577 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1578 		 struct ext4_extent *ux, struct ext4_extent *ix),
1579 
1580 	TP_ARGS(inode, map, ux, ix),
1581 
1582 	TP_STRUCT__entry(
1583 		__field(	dev_t,		dev	)
1584 		__field(	ino_t,		ino	)
1585 		__field(	ext4_lblk_t,	m_lblk	)
1586 		__field(	unsigned,	m_len	)
1587 		__field(	ext4_lblk_t,	u_lblk	)
1588 		__field(	unsigned,	u_len	)
1589 		__field(	ext4_fsblk_t,	u_pblk	)
1590 		__field(	ext4_lblk_t,	i_lblk	)
1591 		__field(	unsigned,	i_len	)
1592 		__field(	ext4_fsblk_t,	i_pblk	)
1593 	),
1594 
1595 	TP_fast_assign(
1596 		__entry->dev		= inode->i_sb->s_dev;
1597 		__entry->ino		= inode->i_ino;
1598 		__entry->m_lblk		= map->m_lblk;
1599 		__entry->m_len		= map->m_len;
1600 		__entry->u_lblk		= le32_to_cpu(ux->ee_block);
1601 		__entry->u_len		= ext4_ext_get_actual_len(ux);
1602 		__entry->u_pblk		= ext4_ext_pblock(ux);
1603 		__entry->i_lblk		= le32_to_cpu(ix->ee_block);
1604 		__entry->i_len		= ext4_ext_get_actual_len(ix);
1605 		__entry->i_pblk		= ext4_ext_pblock(ix);
1606 	),
1607 
1608 	TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u "
1609 		  "u_lblk %u u_len %u u_pblk %llu "
1610 		  "i_lblk %u i_len %u i_pblk %llu ",
1611 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1612 		  (unsigned long) __entry->ino,
1613 		  __entry->m_lblk, __entry->m_len,
1614 		  __entry->u_lblk, __entry->u_len, __entry->u_pblk,
1615 		  __entry->i_lblk, __entry->i_len, __entry->i_pblk)
1616 );
1617 
1618 DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
1619 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1620 		 unsigned int len, unsigned int flags),
1621 
1622 	TP_ARGS(inode, lblk, len, flags),
1623 
1624 	TP_STRUCT__entry(
1625 		__field(	dev_t,		dev		)
1626 		__field(	ino_t,		ino		)
1627 		__field(	ext4_lblk_t,	lblk		)
1628 		__field(	unsigned int,	len		)
1629 		__field(	unsigned int,	flags		)
1630 	),
1631 
1632 	TP_fast_assign(
1633 		__entry->dev    = inode->i_sb->s_dev;
1634 		__entry->ino    = inode->i_ino;
1635 		__entry->lblk	= lblk;
1636 		__entry->len	= len;
1637 		__entry->flags	= flags;
1638 	),
1639 
1640 	TP_printk("dev %d,%d ino %lu lblk %u len %u flags %s",
1641 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1642 		  (unsigned long) __entry->ino,
1643 		  __entry->lblk, __entry->len, show_map_flags(__entry->flags))
1644 );
1645 
1646 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter,
1647 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1648 		 unsigned len, unsigned flags),
1649 
1650 	TP_ARGS(inode, lblk, len, flags)
1651 );
1652 
1653 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
1654 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1655 		 unsigned len, unsigned flags),
1656 
1657 	TP_ARGS(inode, lblk, len, flags)
1658 );
1659 
1660 DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1661 	TP_PROTO(struct inode *inode, unsigned flags, struct ext4_map_blocks *map,
1662 		 int ret),
1663 
1664 	TP_ARGS(inode, flags, map, ret),
1665 
1666 	TP_STRUCT__entry(
1667 		__field(	dev_t,		dev		)
1668 		__field(	ino_t,		ino		)
1669 		__field(	unsigned int,	flags		)
1670 		__field(	ext4_fsblk_t,	pblk		)
1671 		__field(	ext4_lblk_t,	lblk		)
1672 		__field(	unsigned int,	len		)
1673 		__field(	unsigned int,	mflags		)
1674 		__field(	int,		ret		)
1675 	),
1676 
1677 	TP_fast_assign(
1678 		__entry->dev    = inode->i_sb->s_dev;
1679 		__entry->ino    = inode->i_ino;
1680 		__entry->flags	= flags;
1681 		__entry->pblk	= map->m_pblk;
1682 		__entry->lblk	= map->m_lblk;
1683 		__entry->len	= map->m_len;
1684 		__entry->mflags	= map->m_flags;
1685 		__entry->ret	= ret;
1686 	),
1687 
1688 	TP_printk("dev %d,%d ino %lu flags %s lblk %u pblk %llu len %u "
1689 		  "mflags %s ret %d",
1690 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1691 		  (unsigned long) __entry->ino,
1692 		  show_map_flags(__entry->flags), __entry->lblk, __entry->pblk,
1693 		  __entry->len, show_mflags(__entry->mflags), __entry->ret)
1694 );
1695 
1696 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1697 	TP_PROTO(struct inode *inode, unsigned flags,
1698 		 struct ext4_map_blocks *map, int ret),
1699 
1700 	TP_ARGS(inode, flags, map, ret)
1701 );
1702 
1703 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1704 	TP_PROTO(struct inode *inode, unsigned flags,
1705 		 struct ext4_map_blocks *map, int ret),
1706 
1707 	TP_ARGS(inode, flags, map, ret)
1708 );
1709 
1710 TRACE_EVENT(ext4_ext_load_extent,
1711 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk),
1712 
1713 	TP_ARGS(inode, lblk, pblk),
1714 
1715 	TP_STRUCT__entry(
1716 		__field(	dev_t,		dev		)
1717 		__field(	ino_t,		ino		)
1718 		__field(	ext4_fsblk_t,	pblk		)
1719 		__field(	ext4_lblk_t,	lblk		)
1720 	),
1721 
1722 	TP_fast_assign(
1723 		__entry->dev    = inode->i_sb->s_dev;
1724 		__entry->ino    = inode->i_ino;
1725 		__entry->pblk	= pblk;
1726 		__entry->lblk	= lblk;
1727 	),
1728 
1729 	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
1730 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1731 		  (unsigned long) __entry->ino,
1732 		  __entry->lblk, __entry->pblk)
1733 );
1734 
1735 TRACE_EVENT(ext4_load_inode,
1736 	TP_PROTO(struct super_block *sb, unsigned long ino),
1737 
1738 	TP_ARGS(sb, ino),
1739 
1740 	TP_STRUCT__entry(
1741 		__field(	dev_t,	dev		)
1742 		__field(	ino_t,	ino		)
1743 	),
1744 
1745 	TP_fast_assign(
1746 		__entry->dev		= sb->s_dev;
1747 		__entry->ino		= ino;
1748 	),
1749 
1750 	TP_printk("dev %d,%d ino %ld",
1751 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1752 		  (unsigned long) __entry->ino)
1753 );
1754 
1755 TRACE_EVENT(ext4_journal_start_sb,
1756 	TP_PROTO(struct super_block *sb, int blocks, int rsv_blocks,
1757 		 int revoke_creds, int type, unsigned long IP),
1758 
1759 	TP_ARGS(sb, blocks, rsv_blocks, revoke_creds, type, IP),
1760 
1761 	TP_STRUCT__entry(
1762 		__field(	dev_t,		dev		)
1763 		__field(	unsigned long,	ip		)
1764 		__field(	int,		blocks		)
1765 		__field(	int,		rsv_blocks	)
1766 		__field(	int,		revoke_creds	)
1767 		__field(	int,		type		)
1768 	),
1769 
1770 	TP_fast_assign(
1771 		__entry->dev		 = sb->s_dev;
1772 		__entry->ip		 = IP;
1773 		__entry->blocks		 = blocks;
1774 		__entry->rsv_blocks	 = rsv_blocks;
1775 		__entry->revoke_creds	 = revoke_creds;
1776 		__entry->type		 = type;
1777 	),
1778 
1779 	TP_printk("dev %d,%d blocks %d, rsv_blocks %d, revoke_creds %d,"
1780 		  " type %d, caller %pS", MAJOR(__entry->dev),
1781 		  MINOR(__entry->dev), __entry->blocks, __entry->rsv_blocks,
1782 		  __entry->revoke_creds, __entry->type, (void *)__entry->ip)
1783 );
1784 
1785 TRACE_EVENT(ext4_journal_start_inode,
1786 	TP_PROTO(struct inode *inode, int blocks, int rsv_blocks,
1787 		 int revoke_creds, int type, unsigned long IP),
1788 
1789 	TP_ARGS(inode, blocks, rsv_blocks, revoke_creds, type, IP),
1790 
1791 	TP_STRUCT__entry(
1792 		__field(	unsigned long,	ino		)
1793 		__field(	dev_t,		dev		)
1794 		__field(	unsigned long,	ip		)
1795 		__field(	int,		blocks		)
1796 		__field(	int,		rsv_blocks	)
1797 		__field(	int,		revoke_creds	)
1798 		__field(	int,		type		)
1799 	),
1800 
1801 	TP_fast_assign(
1802 		__entry->dev		 = inode->i_sb->s_dev;
1803 		__entry->ip		 = IP;
1804 		__entry->blocks		 = blocks;
1805 		__entry->rsv_blocks	 = rsv_blocks;
1806 		__entry->revoke_creds	 = revoke_creds;
1807 		__entry->type		 = type;
1808 		__entry->ino		 = inode->i_ino;
1809 	),
1810 
1811 	TP_printk("dev %d,%d blocks %d, rsv_blocks %d, revoke_creds %d,"
1812 		  " type %d, ino %lu, caller %pS", MAJOR(__entry->dev),
1813 		  MINOR(__entry->dev), __entry->blocks, __entry->rsv_blocks,
1814 		  __entry->revoke_creds, __entry->type, __entry->ino,
1815 		  (void *)__entry->ip)
1816 );
1817 
1818 TRACE_EVENT(ext4_journal_start_reserved,
1819 	TP_PROTO(struct super_block *sb, int blocks, unsigned long IP),
1820 
1821 	TP_ARGS(sb, blocks, IP),
1822 
1823 	TP_STRUCT__entry(
1824 		__field(	dev_t,	dev			)
1825 		__field(unsigned long,	ip			)
1826 		__field(	  int,	blocks			)
1827 	),
1828 
1829 	TP_fast_assign(
1830 		__entry->dev		 = sb->s_dev;
1831 		__entry->ip		 = IP;
1832 		__entry->blocks		 = blocks;
1833 	),
1834 
1835 	TP_printk("dev %d,%d blocks, %d caller %pS",
1836 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1837 		  __entry->blocks, (void *)__entry->ip)
1838 );
1839 
1840 DECLARE_EVENT_CLASS(ext4__trim,
1841 	TP_PROTO(struct super_block *sb,
1842 		 ext4_group_t group,
1843 		 ext4_grpblk_t start,
1844 		 ext4_grpblk_t len),
1845 
1846 	TP_ARGS(sb, group, start, len),
1847 
1848 	TP_STRUCT__entry(
1849 		__field(	int,	dev_major		)
1850 		__field(	int,	dev_minor		)
1851 		__field(	__u32, 	group			)
1852 		__field(	int,	start			)
1853 		__field(	int,	len			)
1854 	),
1855 
1856 	TP_fast_assign(
1857 		__entry->dev_major	= MAJOR(sb->s_dev);
1858 		__entry->dev_minor	= MINOR(sb->s_dev);
1859 		__entry->group		= group;
1860 		__entry->start		= start;
1861 		__entry->len		= len;
1862 	),
1863 
1864 	TP_printk("dev %d,%d group %u, start %d, len %d",
1865 		  __entry->dev_major, __entry->dev_minor,
1866 		  __entry->group, __entry->start, __entry->len)
1867 );
1868 
1869 DEFINE_EVENT(ext4__trim, ext4_trim_extent,
1870 
1871 	TP_PROTO(struct super_block *sb,
1872 		 ext4_group_t group,
1873 		 ext4_grpblk_t start,
1874 		 ext4_grpblk_t len),
1875 
1876 	TP_ARGS(sb, group, start, len)
1877 );
1878 
1879 DEFINE_EVENT(ext4__trim, ext4_trim_all_free,
1880 
1881 	TP_PROTO(struct super_block *sb,
1882 		 ext4_group_t group,
1883 		 ext4_grpblk_t start,
1884 		 ext4_grpblk_t len),
1885 
1886 	TP_ARGS(sb, group, start, len)
1887 );
1888 
1889 TRACE_EVENT(ext4_ext_handle_unwritten_extents,
1890 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1891 		 unsigned int allocated, ext4_fsblk_t newblock),
1892 
1893 	TP_ARGS(inode, map, flags, allocated, newblock),
1894 
1895 	TP_STRUCT__entry(
1896 		__field(	dev_t,		dev		)
1897 		__field(	ino_t,		ino		)
1898 		__field(	int,		flags		)
1899 		__field(	ext4_lblk_t,	lblk		)
1900 		__field(	ext4_fsblk_t,	pblk		)
1901 		__field(	unsigned int,	len		)
1902 		__field(	unsigned int,	allocated	)
1903 		__field(	ext4_fsblk_t,	newblk		)
1904 	),
1905 
1906 	TP_fast_assign(
1907 		__entry->dev		= inode->i_sb->s_dev;
1908 		__entry->ino		= inode->i_ino;
1909 		__entry->flags		= flags;
1910 		__entry->lblk		= map->m_lblk;
1911 		__entry->pblk		= map->m_pblk;
1912 		__entry->len		= map->m_len;
1913 		__entry->allocated	= allocated;
1914 		__entry->newblk		= newblock;
1915 	),
1916 
1917 	TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %s "
1918 		  "allocated %d newblock %llu",
1919 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1920 		  (unsigned long) __entry->ino,
1921 		  (unsigned) __entry->lblk, (unsigned long long) __entry->pblk,
1922 		  __entry->len, show_map_flags(__entry->flags),
1923 		  (unsigned int) __entry->allocated,
1924 		  (unsigned long long) __entry->newblk)
1925 );
1926 
1927 TRACE_EVENT(ext4_get_implied_cluster_alloc_exit,
1928 	TP_PROTO(struct super_block *sb, struct ext4_map_blocks *map, int ret),
1929 
1930 	TP_ARGS(sb, map, ret),
1931 
1932 	TP_STRUCT__entry(
1933 		__field(	dev_t,		dev	)
1934 		__field(	unsigned int,	flags	)
1935 		__field(	ext4_lblk_t,	lblk	)
1936 		__field(	ext4_fsblk_t,	pblk	)
1937 		__field(	unsigned int,	len	)
1938 		__field(	int,		ret	)
1939 	),
1940 
1941 	TP_fast_assign(
1942 		__entry->dev	= sb->s_dev;
1943 		__entry->flags	= map->m_flags;
1944 		__entry->lblk	= map->m_lblk;
1945 		__entry->pblk	= map->m_pblk;
1946 		__entry->len	= map->m_len;
1947 		__entry->ret	= ret;
1948 	),
1949 
1950 	TP_printk("dev %d,%d m_lblk %u m_pblk %llu m_len %u m_flags %s ret %d",
1951 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1952 		  __entry->lblk, (unsigned long long) __entry->pblk,
1953 		  __entry->len, show_mflags(__entry->flags), __entry->ret)
1954 );
1955 
1956 TRACE_EVENT(ext4_ext_show_extent,
1957 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk,
1958 		 unsigned short len),
1959 
1960 	TP_ARGS(inode, lblk, pblk, len),
1961 
1962 	TP_STRUCT__entry(
1963 		__field(	dev_t,		dev	)
1964 		__field(	ino_t,		ino	)
1965 		__field(	ext4_fsblk_t,	pblk	)
1966 		__field(	ext4_lblk_t,	lblk	)
1967 		__field(	unsigned short,	len	)
1968 	),
1969 
1970 	TP_fast_assign(
1971 		__entry->dev	= inode->i_sb->s_dev;
1972 		__entry->ino	= inode->i_ino;
1973 		__entry->pblk	= pblk;
1974 		__entry->lblk	= lblk;
1975 		__entry->len	= len;
1976 	),
1977 
1978 	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u",
1979 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1980 		  (unsigned long) __entry->ino,
1981 		  (unsigned) __entry->lblk,
1982 		  (unsigned long long) __entry->pblk,
1983 		  (unsigned short) __entry->len)
1984 );
1985 
1986 TRACE_EVENT(ext4_remove_blocks,
1987 	TP_PROTO(struct inode *inode, struct ext4_extent *ex,
1988 		 ext4_lblk_t from, ext4_fsblk_t to,
1989 		 struct partial_cluster *pc),
1990 
1991 	TP_ARGS(inode, ex, from, to, pc),
1992 
1993 	TP_STRUCT__entry(
1994 		__field(	dev_t,		dev	)
1995 		__field(	ino_t,		ino	)
1996 		__field(	ext4_lblk_t,	from	)
1997 		__field(	ext4_lblk_t,	to	)
1998 		__field(	ext4_fsblk_t,	ee_pblk	)
1999 		__field(	ext4_lblk_t,	ee_lblk	)
2000 		__field(	unsigned short,	ee_len	)
2001 		__field(	ext4_fsblk_t,	pc_pclu	)
2002 		__field(	ext4_lblk_t,	pc_lblk	)
2003 		__field(	int,		pc_state)
2004 	),
2005 
2006 	TP_fast_assign(
2007 		__entry->dev		= inode->i_sb->s_dev;
2008 		__entry->ino		= inode->i_ino;
2009 		__entry->from		= from;
2010 		__entry->to		= to;
2011 		__entry->ee_pblk	= ext4_ext_pblock(ex);
2012 		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
2013 		__entry->ee_len		= ext4_ext_get_actual_len(ex);
2014 		__entry->pc_pclu	= pc->pclu;
2015 		__entry->pc_lblk	= pc->lblk;
2016 		__entry->pc_state	= pc->state;
2017 	),
2018 
2019 	TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]"
2020 		  "from %u to %u partial [pclu %lld lblk %u state %d]",
2021 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2022 		  (unsigned long) __entry->ino,
2023 		  (unsigned) __entry->ee_lblk,
2024 		  (unsigned long long) __entry->ee_pblk,
2025 		  (unsigned short) __entry->ee_len,
2026 		  (unsigned) __entry->from,
2027 		  (unsigned) __entry->to,
2028 		  (long long) __entry->pc_pclu,
2029 		  (unsigned int) __entry->pc_lblk,
2030 		  (int) __entry->pc_state)
2031 );
2032 
2033 TRACE_EVENT(ext4_ext_rm_leaf,
2034 	TP_PROTO(struct inode *inode, ext4_lblk_t start,
2035 		 struct ext4_extent *ex,
2036 		 struct partial_cluster *pc),
2037 
2038 	TP_ARGS(inode, start, ex, pc),
2039 
2040 	TP_STRUCT__entry(
2041 		__field(	dev_t,		dev	)
2042 		__field(	ino_t,		ino	)
2043 		__field(	ext4_lblk_t,	start	)
2044 		__field(	ext4_lblk_t,	ee_lblk	)
2045 		__field(	ext4_fsblk_t,	ee_pblk	)
2046 		__field(	short,		ee_len	)
2047 		__field(	ext4_fsblk_t,	pc_pclu	)
2048 		__field(	ext4_lblk_t,	pc_lblk	)
2049 		__field(	int,		pc_state)
2050 	),
2051 
2052 	TP_fast_assign(
2053 		__entry->dev		= inode->i_sb->s_dev;
2054 		__entry->ino		= inode->i_ino;
2055 		__entry->start		= start;
2056 		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
2057 		__entry->ee_pblk	= ext4_ext_pblock(ex);
2058 		__entry->ee_len		= ext4_ext_get_actual_len(ex);
2059 		__entry->pc_pclu	= pc->pclu;
2060 		__entry->pc_lblk	= pc->lblk;
2061 		__entry->pc_state	= pc->state;
2062 	),
2063 
2064 	TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]"
2065 		  "partial [pclu %lld lblk %u state %d]",
2066 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2067 		  (unsigned long) __entry->ino,
2068 		  (unsigned) __entry->start,
2069 		  (unsigned) __entry->ee_lblk,
2070 		  (unsigned long long) __entry->ee_pblk,
2071 		  (unsigned short) __entry->ee_len,
2072 		  (long long) __entry->pc_pclu,
2073 		  (unsigned int) __entry->pc_lblk,
2074 		  (int) __entry->pc_state)
2075 );
2076 
2077 TRACE_EVENT(ext4_ext_rm_idx,
2078 	TP_PROTO(struct inode *inode, ext4_fsblk_t pblk),
2079 
2080 	TP_ARGS(inode, pblk),
2081 
2082 	TP_STRUCT__entry(
2083 		__field(	dev_t,		dev	)
2084 		__field(	ino_t,		ino	)
2085 		__field(	ext4_fsblk_t,	pblk	)
2086 	),
2087 
2088 	TP_fast_assign(
2089 		__entry->dev	= inode->i_sb->s_dev;
2090 		__entry->ino	= inode->i_ino;
2091 		__entry->pblk	= pblk;
2092 	),
2093 
2094 	TP_printk("dev %d,%d ino %lu index_pblk %llu",
2095 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2096 		  (unsigned long) __entry->ino,
2097 		  (unsigned long long) __entry->pblk)
2098 );
2099 
2100 TRACE_EVENT(ext4_ext_remove_space,
2101 	TP_PROTO(struct inode *inode, ext4_lblk_t start,
2102 		 ext4_lblk_t end, int depth),
2103 
2104 	TP_ARGS(inode, start, end, depth),
2105 
2106 	TP_STRUCT__entry(
2107 		__field(	dev_t,		dev	)
2108 		__field(	ino_t,		ino	)
2109 		__field(	ext4_lblk_t,	start	)
2110 		__field(	ext4_lblk_t,	end	)
2111 		__field(	int,		depth	)
2112 	),
2113 
2114 	TP_fast_assign(
2115 		__entry->dev	= inode->i_sb->s_dev;
2116 		__entry->ino	= inode->i_ino;
2117 		__entry->start	= start;
2118 		__entry->end	= end;
2119 		__entry->depth	= depth;
2120 	),
2121 
2122 	TP_printk("dev %d,%d ino %lu since %u end %u depth %d",
2123 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2124 		  (unsigned long) __entry->ino,
2125 		  (unsigned) __entry->start,
2126 		  (unsigned) __entry->end,
2127 		  __entry->depth)
2128 );
2129 
2130 TRACE_EVENT(ext4_ext_remove_space_done,
2131 	TP_PROTO(struct inode *inode, ext4_lblk_t start, ext4_lblk_t end,
2132 		 int depth, struct partial_cluster *pc, __le16 eh_entries),
2133 
2134 	TP_ARGS(inode, start, end, depth, pc, eh_entries),
2135 
2136 	TP_STRUCT__entry(
2137 		__field(	dev_t,		dev		)
2138 		__field(	ino_t,		ino		)
2139 		__field(	ext4_lblk_t,	start		)
2140 		__field(	ext4_lblk_t,	end		)
2141 		__field(	int,		depth		)
2142 		__field(	ext4_fsblk_t,	pc_pclu		)
2143 		__field(	ext4_lblk_t,	pc_lblk		)
2144 		__field(	int,		pc_state	)
2145 		__field(	unsigned short,	eh_entries	)
2146 	),
2147 
2148 	TP_fast_assign(
2149 		__entry->dev		= inode->i_sb->s_dev;
2150 		__entry->ino		= inode->i_ino;
2151 		__entry->start		= start;
2152 		__entry->end		= end;
2153 		__entry->depth		= depth;
2154 		__entry->pc_pclu	= pc->pclu;
2155 		__entry->pc_lblk	= pc->lblk;
2156 		__entry->pc_state	= pc->state;
2157 		__entry->eh_entries	= le16_to_cpu(eh_entries);
2158 	),
2159 
2160 	TP_printk("dev %d,%d ino %lu since %u end %u depth %d "
2161 		  "partial [pclu %lld lblk %u state %d] "
2162 		  "remaining_entries %u",
2163 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2164 		  (unsigned long) __entry->ino,
2165 		  (unsigned) __entry->start,
2166 		  (unsigned) __entry->end,
2167 		  __entry->depth,
2168 		  (long long) __entry->pc_pclu,
2169 		  (unsigned int) __entry->pc_lblk,
2170 		  (int) __entry->pc_state,
2171 		  (unsigned short) __entry->eh_entries)
2172 );
2173 
2174 DECLARE_EVENT_CLASS(ext4__es_extent,
2175 	TP_PROTO(struct inode *inode, struct extent_status *es),
2176 
2177 	TP_ARGS(inode, es),
2178 
2179 	TP_STRUCT__entry(
2180 		__field(	dev_t,		dev		)
2181 		__field(	ino_t,		ino		)
2182 		__field(	ext4_lblk_t,	lblk		)
2183 		__field(	ext4_lblk_t,	len		)
2184 		__field(	ext4_fsblk_t,	pblk		)
2185 		__field(	char, status	)
2186 	),
2187 
2188 	TP_fast_assign(
2189 		__entry->dev	= inode->i_sb->s_dev;
2190 		__entry->ino	= inode->i_ino;
2191 		__entry->lblk	= es->es_lblk;
2192 		__entry->len	= es->es_len;
2193 		__entry->pblk	= ext4_es_show_pblock(es);
2194 		__entry->status	= ext4_es_status(es);
2195 	),
2196 
2197 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2198 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2199 		  (unsigned long) __entry->ino,
2200 		  __entry->lblk, __entry->len,
2201 		  __entry->pblk, show_extent_status(__entry->status))
2202 );
2203 
2204 DEFINE_EVENT(ext4__es_extent, ext4_es_insert_extent,
2205 	TP_PROTO(struct inode *inode, struct extent_status *es),
2206 
2207 	TP_ARGS(inode, es)
2208 );
2209 
2210 DEFINE_EVENT(ext4__es_extent, ext4_es_cache_extent,
2211 	TP_PROTO(struct inode *inode, struct extent_status *es),
2212 
2213 	TP_ARGS(inode, es)
2214 );
2215 
2216 TRACE_EVENT(ext4_es_remove_extent,
2217 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t len),
2218 
2219 	TP_ARGS(inode, lblk, len),
2220 
2221 	TP_STRUCT__entry(
2222 		__field(	dev_t,	dev			)
2223 		__field(	ino_t,	ino			)
2224 		__field(	loff_t,	lblk			)
2225 		__field(	loff_t,	len			)
2226 	),
2227 
2228 	TP_fast_assign(
2229 		__entry->dev	= inode->i_sb->s_dev;
2230 		__entry->ino	= inode->i_ino;
2231 		__entry->lblk	= lblk;
2232 		__entry->len	= len;
2233 	),
2234 
2235 	TP_printk("dev %d,%d ino %lu es [%lld/%lld)",
2236 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2237 		  (unsigned long) __entry->ino,
2238 		  __entry->lblk, __entry->len)
2239 );
2240 
2241 TRACE_EVENT(ext4_es_find_extent_range_enter,
2242 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2243 
2244 	TP_ARGS(inode, lblk),
2245 
2246 	TP_STRUCT__entry(
2247 		__field(	dev_t,		dev		)
2248 		__field(	ino_t,		ino		)
2249 		__field(	ext4_lblk_t,	lblk		)
2250 	),
2251 
2252 	TP_fast_assign(
2253 		__entry->dev	= inode->i_sb->s_dev;
2254 		__entry->ino	= inode->i_ino;
2255 		__entry->lblk	= lblk;
2256 	),
2257 
2258 	TP_printk("dev %d,%d ino %lu lblk %u",
2259 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2260 		  (unsigned long) __entry->ino, __entry->lblk)
2261 );
2262 
2263 TRACE_EVENT(ext4_es_find_extent_range_exit,
2264 	TP_PROTO(struct inode *inode, struct extent_status *es),
2265 
2266 	TP_ARGS(inode, es),
2267 
2268 	TP_STRUCT__entry(
2269 		__field(	dev_t,		dev		)
2270 		__field(	ino_t,		ino		)
2271 		__field(	ext4_lblk_t,	lblk		)
2272 		__field(	ext4_lblk_t,	len		)
2273 		__field(	ext4_fsblk_t,	pblk		)
2274 		__field(	char, status	)
2275 	),
2276 
2277 	TP_fast_assign(
2278 		__entry->dev	= inode->i_sb->s_dev;
2279 		__entry->ino	= inode->i_ino;
2280 		__entry->lblk	= es->es_lblk;
2281 		__entry->len	= es->es_len;
2282 		__entry->pblk	= ext4_es_show_pblock(es);
2283 		__entry->status	= ext4_es_status(es);
2284 	),
2285 
2286 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2287 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2288 		  (unsigned long) __entry->ino,
2289 		  __entry->lblk, __entry->len,
2290 		  __entry->pblk, show_extent_status(__entry->status))
2291 );
2292 
2293 TRACE_EVENT(ext4_es_lookup_extent_enter,
2294 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2295 
2296 	TP_ARGS(inode, lblk),
2297 
2298 	TP_STRUCT__entry(
2299 		__field(	dev_t,		dev		)
2300 		__field(	ino_t,		ino		)
2301 		__field(	ext4_lblk_t,	lblk		)
2302 	),
2303 
2304 	TP_fast_assign(
2305 		__entry->dev	= inode->i_sb->s_dev;
2306 		__entry->ino	= inode->i_ino;
2307 		__entry->lblk	= lblk;
2308 	),
2309 
2310 	TP_printk("dev %d,%d ino %lu lblk %u",
2311 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2312 		  (unsigned long) __entry->ino, __entry->lblk)
2313 );
2314 
2315 TRACE_EVENT(ext4_es_lookup_extent_exit,
2316 	TP_PROTO(struct inode *inode, struct extent_status *es,
2317 		 int found),
2318 
2319 	TP_ARGS(inode, es, found),
2320 
2321 	TP_STRUCT__entry(
2322 		__field(	dev_t,		dev		)
2323 		__field(	ino_t,		ino		)
2324 		__field(	ext4_lblk_t,	lblk		)
2325 		__field(	ext4_lblk_t,	len		)
2326 		__field(	ext4_fsblk_t,	pblk		)
2327 		__field(	char,		status		)
2328 		__field(	int,		found		)
2329 	),
2330 
2331 	TP_fast_assign(
2332 		__entry->dev	= inode->i_sb->s_dev;
2333 		__entry->ino	= inode->i_ino;
2334 		__entry->lblk	= es->es_lblk;
2335 		__entry->len	= es->es_len;
2336 		__entry->pblk	= ext4_es_show_pblock(es);
2337 		__entry->status	= ext4_es_status(es);
2338 		__entry->found	= found;
2339 	),
2340 
2341 	TP_printk("dev %d,%d ino %lu found %d [%u/%u) %llu %s",
2342 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2343 		  (unsigned long) __entry->ino, __entry->found,
2344 		  __entry->lblk, __entry->len,
2345 		  __entry->found ? __entry->pblk : 0,
2346 		  show_extent_status(__entry->found ? __entry->status : 0))
2347 );
2348 
2349 DECLARE_EVENT_CLASS(ext4__es_shrink_enter,
2350 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2351 
2352 	TP_ARGS(sb, nr_to_scan, cache_cnt),
2353 
2354 	TP_STRUCT__entry(
2355 		__field(	dev_t,	dev			)
2356 		__field(	int,	nr_to_scan		)
2357 		__field(	int,	cache_cnt		)
2358 	),
2359 
2360 	TP_fast_assign(
2361 		__entry->dev		= sb->s_dev;
2362 		__entry->nr_to_scan	= nr_to_scan;
2363 		__entry->cache_cnt	= cache_cnt;
2364 	),
2365 
2366 	TP_printk("dev %d,%d nr_to_scan %d cache_cnt %d",
2367 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2368 		  __entry->nr_to_scan, __entry->cache_cnt)
2369 );
2370 
2371 DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_count,
2372 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2373 
2374 	TP_ARGS(sb, nr_to_scan, cache_cnt)
2375 );
2376 
2377 DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_scan_enter,
2378 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2379 
2380 	TP_ARGS(sb, nr_to_scan, cache_cnt)
2381 );
2382 
2383 TRACE_EVENT(ext4_es_shrink_scan_exit,
2384 	TP_PROTO(struct super_block *sb, int nr_shrunk, int cache_cnt),
2385 
2386 	TP_ARGS(sb, nr_shrunk, cache_cnt),
2387 
2388 	TP_STRUCT__entry(
2389 		__field(	dev_t,	dev			)
2390 		__field(	int,	nr_shrunk		)
2391 		__field(	int,	cache_cnt		)
2392 	),
2393 
2394 	TP_fast_assign(
2395 		__entry->dev		= sb->s_dev;
2396 		__entry->nr_shrunk	= nr_shrunk;
2397 		__entry->cache_cnt	= cache_cnt;
2398 	),
2399 
2400 	TP_printk("dev %d,%d nr_shrunk %d cache_cnt %d",
2401 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2402 		  __entry->nr_shrunk, __entry->cache_cnt)
2403 );
2404 
2405 TRACE_EVENT(ext4_collapse_range,
2406 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2407 
2408 	TP_ARGS(inode, offset, len),
2409 
2410 	TP_STRUCT__entry(
2411 		__field(dev_t,	dev)
2412 		__field(ino_t,	ino)
2413 		__field(loff_t,	offset)
2414 		__field(loff_t, len)
2415 	),
2416 
2417 	TP_fast_assign(
2418 		__entry->dev	= inode->i_sb->s_dev;
2419 		__entry->ino	= inode->i_ino;
2420 		__entry->offset	= offset;
2421 		__entry->len	= len;
2422 	),
2423 
2424 	TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2425 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2426 		  (unsigned long) __entry->ino,
2427 		  __entry->offset, __entry->len)
2428 );
2429 
2430 TRACE_EVENT(ext4_insert_range,
2431 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2432 
2433 	TP_ARGS(inode, offset, len),
2434 
2435 	TP_STRUCT__entry(
2436 		__field(dev_t,	dev)
2437 		__field(ino_t,	ino)
2438 		__field(loff_t,	offset)
2439 		__field(loff_t, len)
2440 	),
2441 
2442 	TP_fast_assign(
2443 		__entry->dev	= inode->i_sb->s_dev;
2444 		__entry->ino	= inode->i_ino;
2445 		__entry->offset	= offset;
2446 		__entry->len	= len;
2447 	),
2448 
2449 	TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2450 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2451 		  (unsigned long) __entry->ino,
2452 		  __entry->offset, __entry->len)
2453 );
2454 
2455 TRACE_EVENT(ext4_es_shrink,
2456 	TP_PROTO(struct super_block *sb, int nr_shrunk, u64 scan_time,
2457 		 int nr_skipped, int retried),
2458 
2459 	TP_ARGS(sb, nr_shrunk, scan_time, nr_skipped, retried),
2460 
2461 	TP_STRUCT__entry(
2462 		__field(	dev_t,		dev		)
2463 		__field(	int,		nr_shrunk	)
2464 		__field(	unsigned long long, scan_time	)
2465 		__field(	int,		nr_skipped	)
2466 		__field(	int,		retried		)
2467 	),
2468 
2469 	TP_fast_assign(
2470 		__entry->dev		= sb->s_dev;
2471 		__entry->nr_shrunk	= nr_shrunk;
2472 		__entry->scan_time	= div_u64(scan_time, 1000);
2473 		__entry->nr_skipped	= nr_skipped;
2474 		__entry->retried	= retried;
2475 	),
2476 
2477 	TP_printk("dev %d,%d nr_shrunk %d, scan_time %llu "
2478 		  "nr_skipped %d retried %d",
2479 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->nr_shrunk,
2480 		  __entry->scan_time, __entry->nr_skipped, __entry->retried)
2481 );
2482 
2483 TRACE_EVENT(ext4_es_insert_delayed_extent,
2484 	TP_PROTO(struct inode *inode, struct extent_status *es,
2485 		 bool lclu_allocated, bool end_allocated),
2486 
2487 	TP_ARGS(inode, es, lclu_allocated, end_allocated),
2488 
2489 	TP_STRUCT__entry(
2490 		__field(	dev_t,		dev		)
2491 		__field(	ino_t,		ino		)
2492 		__field(	ext4_lblk_t,	lblk		)
2493 		__field(	ext4_lblk_t,	len		)
2494 		__field(	ext4_fsblk_t,	pblk		)
2495 		__field(	char,		status		)
2496 		__field(	bool,		lclu_allocated	)
2497 		__field(	bool,		end_allocated	)
2498 	),
2499 
2500 	TP_fast_assign(
2501 		__entry->dev		= inode->i_sb->s_dev;
2502 		__entry->ino		= inode->i_ino;
2503 		__entry->lblk		= es->es_lblk;
2504 		__entry->len		= es->es_len;
2505 		__entry->pblk		= ext4_es_show_pblock(es);
2506 		__entry->status		= ext4_es_status(es);
2507 		__entry->lclu_allocated	= lclu_allocated;
2508 		__entry->end_allocated	= end_allocated;
2509 	),
2510 
2511 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s "
2512 		  "allocated %d %d",
2513 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2514 		  (unsigned long) __entry->ino,
2515 		  __entry->lblk, __entry->len,
2516 		  __entry->pblk, show_extent_status(__entry->status),
2517 		  __entry->lclu_allocated, __entry->end_allocated)
2518 );
2519 
2520 /* fsmap traces */
2521 DECLARE_EVENT_CLASS(ext4_fsmap_class,
2522 	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len,
2523 		 u64 owner),
2524 	TP_ARGS(sb, keydev, agno, bno, len, owner),
2525 	TP_STRUCT__entry(
2526 		__field(dev_t, dev)
2527 		__field(dev_t, keydev)
2528 		__field(u32, agno)
2529 		__field(u64, bno)
2530 		__field(u64, len)
2531 		__field(u64, owner)
2532 	),
2533 	TP_fast_assign(
2534 		__entry->dev = sb->s_bdev->bd_dev;
2535 		__entry->keydev = new_decode_dev(keydev);
2536 		__entry->agno = agno;
2537 		__entry->bno = bno;
2538 		__entry->len = len;
2539 		__entry->owner = owner;
2540 	),
2541 	TP_printk("dev %d:%d keydev %d:%d agno %u bno %llu len %llu owner %lld\n",
2542 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2543 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
2544 		  __entry->agno,
2545 		  __entry->bno,
2546 		  __entry->len,
2547 		  __entry->owner)
2548 )
2549 #define DEFINE_FSMAP_EVENT(name) \
2550 DEFINE_EVENT(ext4_fsmap_class, name, \
2551 	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len, \
2552 		 u64 owner), \
2553 	TP_ARGS(sb, keydev, agno, bno, len, owner))
2554 DEFINE_FSMAP_EVENT(ext4_fsmap_low_key);
2555 DEFINE_FSMAP_EVENT(ext4_fsmap_high_key);
2556 DEFINE_FSMAP_EVENT(ext4_fsmap_mapping);
2557 
2558 DECLARE_EVENT_CLASS(ext4_getfsmap_class,
2559 	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap),
2560 	TP_ARGS(sb, fsmap),
2561 	TP_STRUCT__entry(
2562 		__field(dev_t, dev)
2563 		__field(dev_t, keydev)
2564 		__field(u64, block)
2565 		__field(u64, len)
2566 		__field(u64, owner)
2567 		__field(u64, flags)
2568 	),
2569 	TP_fast_assign(
2570 		__entry->dev = sb->s_bdev->bd_dev;
2571 		__entry->keydev = new_decode_dev(fsmap->fmr_device);
2572 		__entry->block = fsmap->fmr_physical;
2573 		__entry->len = fsmap->fmr_length;
2574 		__entry->owner = fsmap->fmr_owner;
2575 		__entry->flags = fsmap->fmr_flags;
2576 	),
2577 	TP_printk("dev %d:%d keydev %d:%d block %llu len %llu owner %lld flags 0x%llx\n",
2578 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2579 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
2580 		  __entry->block,
2581 		  __entry->len,
2582 		  __entry->owner,
2583 		  __entry->flags)
2584 )
2585 #define DEFINE_GETFSMAP_EVENT(name) \
2586 DEFINE_EVENT(ext4_getfsmap_class, name, \
2587 	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap), \
2588 	TP_ARGS(sb, fsmap))
2589 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_low_key);
2590 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_high_key);
2591 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_mapping);
2592 
2593 TRACE_EVENT(ext4_shutdown,
2594 	TP_PROTO(struct super_block *sb, unsigned long flags),
2595 
2596 	TP_ARGS(sb, flags),
2597 
2598 	TP_STRUCT__entry(
2599 		__field(	dev_t,	dev			)
2600 		__field(     unsigned,	flags			)
2601 	),
2602 
2603 	TP_fast_assign(
2604 		__entry->dev	= sb->s_dev;
2605 		__entry->flags	= flags;
2606 	),
2607 
2608 	TP_printk("dev %d,%d flags %u",
2609 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2610 		  __entry->flags)
2611 );
2612 
2613 TRACE_EVENT(ext4_error,
2614 	TP_PROTO(struct super_block *sb, const char *function,
2615 		 unsigned int line),
2616 
2617 	TP_ARGS(sb, function, line),
2618 
2619 	TP_STRUCT__entry(
2620 		__field(	dev_t,	dev			)
2621 		__field( const char *,	function		)
2622 		__field(     unsigned,	line			)
2623 	),
2624 
2625 	TP_fast_assign(
2626 		__entry->dev	= sb->s_dev;
2627 		__entry->function = function;
2628 		__entry->line	= line;
2629 	),
2630 
2631 	TP_printk("dev %d,%d function %s line %u",
2632 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2633 		  __entry->function, __entry->line)
2634 );
2635 
2636 TRACE_EVENT(ext4_prefetch_bitmaps,
2637 	    TP_PROTO(struct super_block *sb, ext4_group_t group,
2638 		     ext4_group_t next, unsigned int prefetch_ios),
2639 
2640 	TP_ARGS(sb, group, next, prefetch_ios),
2641 
2642 	TP_STRUCT__entry(
2643 		__field(	dev_t,	dev			)
2644 		__field(	__u32,	group			)
2645 		__field(	__u32,	next			)
2646 		__field(	__u32,	ios			)
2647 	),
2648 
2649 	TP_fast_assign(
2650 		__entry->dev	= sb->s_dev;
2651 		__entry->group	= group;
2652 		__entry->next	= next;
2653 		__entry->ios	= prefetch_ios;
2654 	),
2655 
2656 	TP_printk("dev %d,%d group %u next %u ios %u",
2657 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2658 		  __entry->group, __entry->next, __entry->ios)
2659 );
2660 
2661 TRACE_EVENT(ext4_lazy_itable_init,
2662 	    TP_PROTO(struct super_block *sb, ext4_group_t group),
2663 
2664 	TP_ARGS(sb, group),
2665 
2666 	TP_STRUCT__entry(
2667 		__field(	dev_t,	dev			)
2668 		__field(	__u32,	group			)
2669 	),
2670 
2671 	TP_fast_assign(
2672 		__entry->dev	= sb->s_dev;
2673 		__entry->group	= group;
2674 	),
2675 
2676 	TP_printk("dev %d,%d group %u",
2677 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->group)
2678 );
2679 
2680 TRACE_EVENT(ext4_fc_replay_scan,
2681 	TP_PROTO(struct super_block *sb, int error, int off),
2682 
2683 	TP_ARGS(sb, error, off),
2684 
2685 	TP_STRUCT__entry(
2686 		__field(dev_t, dev)
2687 		__field(int, error)
2688 		__field(int, off)
2689 	),
2690 
2691 	TP_fast_assign(
2692 		__entry->dev = sb->s_dev;
2693 		__entry->error = error;
2694 		__entry->off = off;
2695 	),
2696 
2697 	TP_printk("dev %d,%d error %d, off %d",
2698 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2699 		  __entry->error, __entry->off)
2700 );
2701 
2702 TRACE_EVENT(ext4_fc_replay,
2703 	TP_PROTO(struct super_block *sb, int tag, int ino, int priv1, int priv2),
2704 
2705 	TP_ARGS(sb, tag, ino, priv1, priv2),
2706 
2707 	TP_STRUCT__entry(
2708 		__field(dev_t, dev)
2709 		__field(int, tag)
2710 		__field(int, ino)
2711 		__field(int, priv1)
2712 		__field(int, priv2)
2713 	),
2714 
2715 	TP_fast_assign(
2716 		__entry->dev = sb->s_dev;
2717 		__entry->tag = tag;
2718 		__entry->ino = ino;
2719 		__entry->priv1 = priv1;
2720 		__entry->priv2 = priv2;
2721 	),
2722 
2723 	TP_printk("dev %d,%d: tag %d, ino %d, data1 %d, data2 %d",
2724 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2725 		  __entry->tag, __entry->ino, __entry->priv1, __entry->priv2)
2726 );
2727 
2728 TRACE_EVENT(ext4_fc_commit_start,
2729 	TP_PROTO(struct super_block *sb, tid_t commit_tid),
2730 
2731 	TP_ARGS(sb, commit_tid),
2732 
2733 	TP_STRUCT__entry(
2734 		__field(dev_t, dev)
2735 		__field(tid_t, tid)
2736 	),
2737 
2738 	TP_fast_assign(
2739 		__entry->dev = sb->s_dev;
2740 		__entry->tid = commit_tid;
2741 	),
2742 
2743 	TP_printk("dev %d,%d tid %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2744 		  __entry->tid)
2745 );
2746 
2747 TRACE_EVENT(ext4_fc_commit_stop,
2748 	    TP_PROTO(struct super_block *sb, int nblks, int reason,
2749 		     tid_t commit_tid),
2750 
2751 	TP_ARGS(sb, nblks, reason, commit_tid),
2752 
2753 	TP_STRUCT__entry(
2754 		__field(dev_t, dev)
2755 		__field(int, nblks)
2756 		__field(int, reason)
2757 		__field(int, num_fc)
2758 		__field(int, num_fc_ineligible)
2759 		__field(int, nblks_agg)
2760 		__field(tid_t, tid)
2761 	),
2762 
2763 	TP_fast_assign(
2764 		__entry->dev = sb->s_dev;
2765 		__entry->nblks = nblks;
2766 		__entry->reason = reason;
2767 		__entry->num_fc = EXT4_SB(sb)->s_fc_stats.fc_num_commits;
2768 		__entry->num_fc_ineligible =
2769 			EXT4_SB(sb)->s_fc_stats.fc_ineligible_commits;
2770 		__entry->nblks_agg = EXT4_SB(sb)->s_fc_stats.fc_numblks;
2771 		__entry->tid = commit_tid;
2772 	),
2773 
2774 	TP_printk("dev %d,%d nblks %d, reason %d, fc = %d, ineligible = %d, agg_nblks %d, tid %u",
2775 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2776 		  __entry->nblks, __entry->reason, __entry->num_fc,
2777 		  __entry->num_fc_ineligible, __entry->nblks_agg, __entry->tid)
2778 );
2779 
2780 #define FC_REASON_NAME_STAT(reason)					\
2781 	show_fc_reason(reason),						\
2782 	__entry->fc_ineligible_rc[reason]
2783 
2784 TRACE_EVENT(ext4_fc_stats,
2785 	TP_PROTO(struct super_block *sb),
2786 
2787 	TP_ARGS(sb),
2788 
2789 	TP_STRUCT__entry(
2790 		__field(dev_t, dev)
2791 		__array(unsigned int, fc_ineligible_rc, EXT4_FC_REASON_MAX)
2792 		__field(unsigned long, fc_commits)
2793 		__field(unsigned long, fc_ineligible_commits)
2794 		__field(unsigned long, fc_numblks)
2795 	),
2796 
2797 	TP_fast_assign(
2798 		int i;
2799 
2800 		__entry->dev = sb->s_dev;
2801 		for (i = 0; i < EXT4_FC_REASON_MAX; i++) {
2802 			__entry->fc_ineligible_rc[i] =
2803 				EXT4_SB(sb)->s_fc_stats.fc_ineligible_reason_count[i];
2804 		}
2805 		__entry->fc_commits = EXT4_SB(sb)->s_fc_stats.fc_num_commits;
2806 		__entry->fc_ineligible_commits =
2807 			EXT4_SB(sb)->s_fc_stats.fc_ineligible_commits;
2808 		__entry->fc_numblks = EXT4_SB(sb)->s_fc_stats.fc_numblks;
2809 	),
2810 
2811 	TP_printk("dev %d,%d fc ineligible reasons:\n"
2812 		  "%s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u"
2813 		  "num_commits:%lu, ineligible: %lu, numblks: %lu",
2814 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2815 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_XATTR),
2816 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_CROSS_RENAME),
2817 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_JOURNAL_FLAG_CHANGE),
2818 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_NOMEM),
2819 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_SWAP_BOOT),
2820 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_RESIZE),
2821 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_RENAME_DIR),
2822 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_FALLOC_RANGE),
2823 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_INODE_JOURNAL_DATA),
2824 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_ENCRYPTED_FILENAME),
2825 		  __entry->fc_commits, __entry->fc_ineligible_commits,
2826 		  __entry->fc_numblks)
2827 );
2828 
2829 DECLARE_EVENT_CLASS(ext4_fc_track_dentry,
2830 
2831 	TP_PROTO(handle_t *handle, struct inode *inode,
2832 		 struct dentry *dentry, int ret),
2833 
2834 	TP_ARGS(handle, inode, dentry, ret),
2835 
2836 	TP_STRUCT__entry(
2837 		__field(dev_t, dev)
2838 		__field(tid_t, t_tid)
2839 		__field(ino_t, i_ino)
2840 		__field(tid_t, i_sync_tid)
2841 		__field(int, error)
2842 	),
2843 
2844 	TP_fast_assign(
2845 		struct ext4_inode_info *ei = EXT4_I(inode);
2846 
2847 		__entry->dev = inode->i_sb->s_dev;
2848 		__entry->t_tid = handle->h_transaction->t_tid;
2849 		__entry->i_ino = inode->i_ino;
2850 		__entry->i_sync_tid = ei->i_sync_tid;
2851 		__entry->error = ret;
2852 	),
2853 
2854 	TP_printk("dev %d,%d, t_tid %u, ino %lu, i_sync_tid %u, error %d",
2855 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2856 		  __entry->t_tid, __entry->i_ino, __entry->i_sync_tid,
2857 		  __entry->error
2858 	)
2859 );
2860 
2861 #define DEFINE_EVENT_CLASS_DENTRY(__type)				\
2862 DEFINE_EVENT(ext4_fc_track_dentry, ext4_fc_track_##__type,		\
2863 	TP_PROTO(handle_t *handle, struct inode *inode,			\
2864 		 struct dentry *dentry, int ret),			\
2865 	TP_ARGS(handle, inode, dentry, ret)				\
2866 )
2867 
2868 DEFINE_EVENT_CLASS_DENTRY(create);
2869 DEFINE_EVENT_CLASS_DENTRY(link);
2870 DEFINE_EVENT_CLASS_DENTRY(unlink);
2871 
2872 TRACE_EVENT(ext4_fc_track_inode,
2873 	TP_PROTO(handle_t *handle, struct inode *inode, int ret),
2874 
2875 	TP_ARGS(handle, inode, ret),
2876 
2877 	TP_STRUCT__entry(
2878 		__field(dev_t, dev)
2879 		__field(tid_t, t_tid)
2880 		__field(ino_t, i_ino)
2881 		__field(tid_t, i_sync_tid)
2882 		__field(int, error)
2883 	),
2884 
2885 	TP_fast_assign(
2886 		struct ext4_inode_info *ei = EXT4_I(inode);
2887 
2888 		__entry->dev = inode->i_sb->s_dev;
2889 		__entry->t_tid = handle->h_transaction->t_tid;
2890 		__entry->i_ino = inode->i_ino;
2891 		__entry->i_sync_tid = ei->i_sync_tid;
2892 		__entry->error = ret;
2893 	),
2894 
2895 	TP_printk("dev %d:%d, t_tid %u, inode %lu, i_sync_tid %u, error %d",
2896 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2897 		  __entry->t_tid, __entry->i_ino, __entry->i_sync_tid,
2898 		  __entry->error)
2899 	);
2900 
2901 TRACE_EVENT(ext4_fc_track_range,
2902 	TP_PROTO(handle_t *handle, struct inode *inode,
2903 		 long start, long end, int ret),
2904 
2905 	TP_ARGS(handle, inode, start, end, ret),
2906 
2907 	TP_STRUCT__entry(
2908 		__field(dev_t, dev)
2909 		__field(tid_t, t_tid)
2910 		__field(ino_t, i_ino)
2911 		__field(tid_t, i_sync_tid)
2912 		__field(long, start)
2913 		__field(long, end)
2914 		__field(int, error)
2915 	),
2916 
2917 	TP_fast_assign(
2918 		struct ext4_inode_info *ei = EXT4_I(inode);
2919 
2920 		__entry->dev = inode->i_sb->s_dev;
2921 		__entry->t_tid = handle->h_transaction->t_tid;
2922 		__entry->i_ino = inode->i_ino;
2923 		__entry->i_sync_tid = ei->i_sync_tid;
2924 		__entry->start = start;
2925 		__entry->end = end;
2926 		__entry->error = ret;
2927 	),
2928 
2929 	TP_printk("dev %d:%d, t_tid %u, inode %lu, i_sync_tid %u, error %d, start %ld, end %ld",
2930 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2931 		  __entry->t_tid, __entry->i_ino, __entry->i_sync_tid,
2932 		  __entry->error, __entry->start, __entry->end)
2933 	);
2934 
2935 TRACE_EVENT(ext4_fc_cleanup,
2936 	TP_PROTO(journal_t *journal, int full, tid_t tid),
2937 
2938 	TP_ARGS(journal, full, tid),
2939 
2940 	TP_STRUCT__entry(
2941 		__field(dev_t, dev)
2942 		__field(int, j_fc_off)
2943 		__field(int, full)
2944 		__field(tid_t, tid)
2945 	),
2946 
2947 	TP_fast_assign(
2948 		struct super_block *sb = journal->j_private;
2949 
2950 		__entry->dev = sb->s_dev;
2951 		__entry->j_fc_off = journal->j_fc_off;
2952 		__entry->full = full;
2953 		__entry->tid = tid;
2954 	),
2955 
2956 	TP_printk("dev %d,%d, j_fc_off %d, full %d, tid %u",
2957 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2958 		  __entry->j_fc_off, __entry->full, __entry->tid)
2959 	);
2960 
2961 TRACE_EVENT(ext4_update_sb,
2962 	TP_PROTO(struct super_block *sb, ext4_fsblk_t fsblk,
2963 		 unsigned int flags),
2964 
2965 	TP_ARGS(sb, fsblk, flags),
2966 
2967 	TP_STRUCT__entry(
2968 		__field(dev_t,		dev)
2969 		__field(ext4_fsblk_t,	fsblk)
2970 		__field(unsigned int,	flags)
2971 	),
2972 
2973 	TP_fast_assign(
2974 		__entry->dev	= sb->s_dev;
2975 		__entry->fsblk	= fsblk;
2976 		__entry->flags	= flags;
2977 	),
2978 
2979 	TP_printk("dev %d,%d fsblk %llu flags %u",
2980 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2981 		  __entry->fsblk, __entry->flags)
2982 );
2983 
2984 #endif /* _TRACE_EXT4_H */
2985 
2986 /* This part must be outside protection */
2987 #include <trace/define_trace.h>
2988