xref: /openbmc/linux/include/trace/events/ext4.h (revision 2a598d0b)
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, unsigned int needed),
776 
777 	TP_ARGS(inode, len, needed),
778 
779 	TP_STRUCT__entry(
780 		__field(	dev_t,		dev		)
781 		__field(	ino_t,		ino		)
782 		__field(	unsigned int,	len		)
783 		__field(	unsigned int,	needed		)
784 
785 	),
786 
787 	TP_fast_assign(
788 		__entry->dev	= inode->i_sb->s_dev;
789 		__entry->ino	= inode->i_ino;
790 		__entry->len	= len;
791 		__entry->needed	= needed;
792 	),
793 
794 	TP_printk("dev %d,%d ino %lu len: %u needed %u",
795 		  MAJOR(__entry->dev), MINOR(__entry->dev),
796 		  (unsigned long) __entry->ino, __entry->len,
797 		  __entry->needed)
798 );
799 
800 TRACE_EVENT(ext4_mb_discard_preallocations,
801 	TP_PROTO(struct super_block *sb, int needed),
802 
803 	TP_ARGS(sb, needed),
804 
805 	TP_STRUCT__entry(
806 		__field(	dev_t,	dev			)
807 		__field(	int,	needed			)
808 
809 	),
810 
811 	TP_fast_assign(
812 		__entry->dev	= sb->s_dev;
813 		__entry->needed	= needed;
814 	),
815 
816 	TP_printk("dev %d,%d needed %d",
817 		  MAJOR(__entry->dev), MINOR(__entry->dev),
818 		  __entry->needed)
819 );
820 
821 TRACE_EVENT(ext4_request_blocks,
822 	TP_PROTO(struct ext4_allocation_request *ar),
823 
824 	TP_ARGS(ar),
825 
826 	TP_STRUCT__entry(
827 		__field(	dev_t,	dev			)
828 		__field(	ino_t,	ino			)
829 		__field(	unsigned int, len		)
830 		__field(	__u32,  logical			)
831 		__field(	__u32,	lleft			)
832 		__field(	__u32,	lright			)
833 		__field(	__u64,	goal			)
834 		__field(	__u64,	pleft			)
835 		__field(	__u64,	pright			)
836 		__field(	unsigned int, flags		)
837 	),
838 
839 	TP_fast_assign(
840 		__entry->dev	= ar->inode->i_sb->s_dev;
841 		__entry->ino	= ar->inode->i_ino;
842 		__entry->len	= ar->len;
843 		__entry->logical = ar->logical;
844 		__entry->goal	= ar->goal;
845 		__entry->lleft	= ar->lleft;
846 		__entry->lright	= ar->lright;
847 		__entry->pleft	= ar->pleft;
848 		__entry->pright	= ar->pright;
849 		__entry->flags	= ar->flags;
850 	),
851 
852 	TP_printk("dev %d,%d ino %lu flags %s len %u lblk %u goal %llu "
853 		  "lleft %u lright %u pleft %llu pright %llu ",
854 		  MAJOR(__entry->dev), MINOR(__entry->dev),
855 		  (unsigned long) __entry->ino, show_mballoc_flags(__entry->flags),
856 		  __entry->len, __entry->logical, __entry->goal,
857 		  __entry->lleft, __entry->lright, __entry->pleft,
858 		  __entry->pright)
859 );
860 
861 TRACE_EVENT(ext4_allocate_blocks,
862 	TP_PROTO(struct ext4_allocation_request *ar, unsigned long long block),
863 
864 	TP_ARGS(ar, block),
865 
866 	TP_STRUCT__entry(
867 		__field(	dev_t,	dev			)
868 		__field(	ino_t,	ino			)
869 		__field(	__u64,	block			)
870 		__field(	unsigned int, len		)
871 		__field(	__u32,  logical			)
872 		__field(	__u32,	lleft			)
873 		__field(	__u32,	lright			)
874 		__field(	__u64,	goal			)
875 		__field(	__u64,	pleft			)
876 		__field(	__u64,	pright			)
877 		__field(	unsigned int, flags		)
878 	),
879 
880 	TP_fast_assign(
881 		__entry->dev	= ar->inode->i_sb->s_dev;
882 		__entry->ino	= ar->inode->i_ino;
883 		__entry->block	= block;
884 		__entry->len	= ar->len;
885 		__entry->logical = ar->logical;
886 		__entry->goal	= ar->goal;
887 		__entry->lleft	= ar->lleft;
888 		__entry->lright	= ar->lright;
889 		__entry->pleft	= ar->pleft;
890 		__entry->pright	= ar->pright;
891 		__entry->flags	= ar->flags;
892 	),
893 
894 	TP_printk("dev %d,%d ino %lu flags %s len %u block %llu lblk %u "
895 		  "goal %llu lleft %u lright %u pleft %llu pright %llu",
896 		  MAJOR(__entry->dev), MINOR(__entry->dev),
897 		  (unsigned long) __entry->ino, show_mballoc_flags(__entry->flags),
898 		  __entry->len, __entry->block, __entry->logical,
899 		  __entry->goal,  __entry->lleft, __entry->lright,
900 		  __entry->pleft, __entry->pright)
901 );
902 
903 TRACE_EVENT(ext4_free_blocks,
904 	TP_PROTO(struct inode *inode, __u64 block, unsigned long count,
905 		 int flags),
906 
907 	TP_ARGS(inode, block, count, flags),
908 
909 	TP_STRUCT__entry(
910 		__field(	dev_t,	dev			)
911 		__field(	ino_t,	ino			)
912 		__field(	__u64,	block			)
913 		__field(	unsigned long,	count		)
914 		__field(	int,	flags			)
915 		__field(	__u16,	mode			)
916 	),
917 
918 	TP_fast_assign(
919 		__entry->dev		= inode->i_sb->s_dev;
920 		__entry->ino		= inode->i_ino;
921 		__entry->block		= block;
922 		__entry->count		= count;
923 		__entry->flags		= flags;
924 		__entry->mode		= inode->i_mode;
925 	),
926 
927 	TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %s",
928 		  MAJOR(__entry->dev), MINOR(__entry->dev),
929 		  (unsigned long) __entry->ino,
930 		  __entry->mode, __entry->block, __entry->count,
931 		  show_free_flags(__entry->flags))
932 );
933 
934 TRACE_EVENT(ext4_sync_file_enter,
935 	TP_PROTO(struct file *file, int datasync),
936 
937 	TP_ARGS(file, datasync),
938 
939 	TP_STRUCT__entry(
940 		__field(	dev_t,	dev			)
941 		__field(	ino_t,	ino			)
942 		__field(	ino_t,	parent			)
943 		__field(	int,	datasync		)
944 	),
945 
946 	TP_fast_assign(
947 		struct dentry *dentry = file->f_path.dentry;
948 
949 		__entry->dev		= dentry->d_sb->s_dev;
950 		__entry->ino		= d_inode(dentry)->i_ino;
951 		__entry->datasync	= datasync;
952 		__entry->parent		= d_inode(dentry->d_parent)->i_ino;
953 	),
954 
955 	TP_printk("dev %d,%d ino %lu parent %lu datasync %d ",
956 		  MAJOR(__entry->dev), MINOR(__entry->dev),
957 		  (unsigned long) __entry->ino,
958 		  (unsigned long) __entry->parent, __entry->datasync)
959 );
960 
961 TRACE_EVENT(ext4_sync_file_exit,
962 	TP_PROTO(struct inode *inode, int ret),
963 
964 	TP_ARGS(inode, ret),
965 
966 	TP_STRUCT__entry(
967 		__field(	dev_t,	dev			)
968 		__field(	ino_t,	ino			)
969 		__field(	int,	ret			)
970 	),
971 
972 	TP_fast_assign(
973 		__entry->dev		= inode->i_sb->s_dev;
974 		__entry->ino		= inode->i_ino;
975 		__entry->ret		= ret;
976 	),
977 
978 	TP_printk("dev %d,%d ino %lu ret %d",
979 		  MAJOR(__entry->dev), MINOR(__entry->dev),
980 		  (unsigned long) __entry->ino,
981 		  __entry->ret)
982 );
983 
984 TRACE_EVENT(ext4_sync_fs,
985 	TP_PROTO(struct super_block *sb, int wait),
986 
987 	TP_ARGS(sb, wait),
988 
989 	TP_STRUCT__entry(
990 		__field(	dev_t,	dev			)
991 		__field(	int,	wait			)
992 
993 	),
994 
995 	TP_fast_assign(
996 		__entry->dev	= sb->s_dev;
997 		__entry->wait	= wait;
998 	),
999 
1000 	TP_printk("dev %d,%d wait %d",
1001 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1002 		  __entry->wait)
1003 );
1004 
1005 TRACE_EVENT(ext4_alloc_da_blocks,
1006 	TP_PROTO(struct inode *inode),
1007 
1008 	TP_ARGS(inode),
1009 
1010 	TP_STRUCT__entry(
1011 		__field(	dev_t,	dev			)
1012 		__field(	ino_t,	ino			)
1013 		__field( unsigned int,	data_blocks		)
1014 	),
1015 
1016 	TP_fast_assign(
1017 		__entry->dev	= inode->i_sb->s_dev;
1018 		__entry->ino	= inode->i_ino;
1019 		__entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1020 	),
1021 
1022 	TP_printk("dev %d,%d ino %lu reserved_data_blocks %u",
1023 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1024 		  (unsigned long) __entry->ino,
1025 		  __entry->data_blocks)
1026 );
1027 
1028 TRACE_EVENT(ext4_mballoc_alloc,
1029 	TP_PROTO(struct ext4_allocation_context *ac),
1030 
1031 	TP_ARGS(ac),
1032 
1033 	TP_STRUCT__entry(
1034 		__field(	dev_t,	dev			)
1035 		__field(	ino_t,	ino			)
1036 		__field(	__u32, 	orig_logical		)
1037 		__field(	  int,	orig_start		)
1038 		__field(	__u32, 	orig_group		)
1039 		__field(	  int,	orig_len		)
1040 		__field(	__u32, 	goal_logical		)
1041 		__field(	  int,	goal_start		)
1042 		__field(	__u32, 	goal_group		)
1043 		__field(	  int,	goal_len		)
1044 		__field(	__u32, 	result_logical		)
1045 		__field(	  int,	result_start		)
1046 		__field(	__u32, 	result_group		)
1047 		__field(	  int,	result_len		)
1048 		__field(	__u16,	found			)
1049 		__field(	__u16,	groups			)
1050 		__field(	__u16,	buddy			)
1051 		__field(	__u16,	flags			)
1052 		__field(	__u16,	tail			)
1053 		__field(	__u8,	cr			)
1054 	),
1055 
1056 	TP_fast_assign(
1057 		__entry->dev		= ac->ac_inode->i_sb->s_dev;
1058 		__entry->ino		= ac->ac_inode->i_ino;
1059 		__entry->orig_logical	= ac->ac_o_ex.fe_logical;
1060 		__entry->orig_start	= ac->ac_o_ex.fe_start;
1061 		__entry->orig_group	= ac->ac_o_ex.fe_group;
1062 		__entry->orig_len	= ac->ac_o_ex.fe_len;
1063 		__entry->goal_logical	= ac->ac_g_ex.fe_logical;
1064 		__entry->goal_start	= ac->ac_g_ex.fe_start;
1065 		__entry->goal_group	= ac->ac_g_ex.fe_group;
1066 		__entry->goal_len	= ac->ac_g_ex.fe_len;
1067 		__entry->result_logical	= ac->ac_f_ex.fe_logical;
1068 		__entry->result_start	= ac->ac_f_ex.fe_start;
1069 		__entry->result_group	= ac->ac_f_ex.fe_group;
1070 		__entry->result_len	= ac->ac_f_ex.fe_len;
1071 		__entry->found		= ac->ac_found;
1072 		__entry->flags		= ac->ac_flags;
1073 		__entry->groups		= ac->ac_groups_scanned;
1074 		__entry->buddy		= ac->ac_buddy;
1075 		__entry->tail		= ac->ac_tail;
1076 		__entry->cr		= ac->ac_criteria;
1077 	),
1078 
1079 	TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
1080 		  "result %u/%d/%u@%u blks %u grps %u cr %s flags %s "
1081 		  "tail %u broken %u",
1082 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1083 		  (unsigned long) __entry->ino,
1084 		  __entry->orig_group, __entry->orig_start,
1085 		  __entry->orig_len, __entry->orig_logical,
1086 		  __entry->goal_group, __entry->goal_start,
1087 		  __entry->goal_len, __entry->goal_logical,
1088 		  __entry->result_group, __entry->result_start,
1089 		  __entry->result_len, __entry->result_logical,
1090 		  __entry->found, __entry->groups, show_criteria(__entry->cr),
1091 		  show_mballoc_flags(__entry->flags), __entry->tail,
1092 		  __entry->buddy ? 1 << __entry->buddy : 0)
1093 );
1094 
1095 TRACE_EVENT(ext4_mballoc_prealloc,
1096 	TP_PROTO(struct ext4_allocation_context *ac),
1097 
1098 	TP_ARGS(ac),
1099 
1100 	TP_STRUCT__entry(
1101 		__field(	dev_t,	dev			)
1102 		__field(	ino_t,	ino			)
1103 		__field(	__u32, 	orig_logical		)
1104 		__field(	  int,	orig_start		)
1105 		__field(	__u32, 	orig_group		)
1106 		__field(	  int,	orig_len		)
1107 		__field(	__u32, 	result_logical		)
1108 		__field(	  int,	result_start		)
1109 		__field(	__u32, 	result_group		)
1110 		__field(	  int,	result_len		)
1111 	),
1112 
1113 	TP_fast_assign(
1114 		__entry->dev		= ac->ac_inode->i_sb->s_dev;
1115 		__entry->ino		= ac->ac_inode->i_ino;
1116 		__entry->orig_logical	= ac->ac_o_ex.fe_logical;
1117 		__entry->orig_start	= ac->ac_o_ex.fe_start;
1118 		__entry->orig_group	= ac->ac_o_ex.fe_group;
1119 		__entry->orig_len	= ac->ac_o_ex.fe_len;
1120 		__entry->result_logical	= ac->ac_b_ex.fe_logical;
1121 		__entry->result_start	= ac->ac_b_ex.fe_start;
1122 		__entry->result_group	= ac->ac_b_ex.fe_group;
1123 		__entry->result_len	= ac->ac_b_ex.fe_len;
1124 	),
1125 
1126 	TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
1127 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1128 		  (unsigned long) __entry->ino,
1129 		  __entry->orig_group, __entry->orig_start,
1130 		  __entry->orig_len, __entry->orig_logical,
1131 		  __entry->result_group, __entry->result_start,
1132 		  __entry->result_len, __entry->result_logical)
1133 );
1134 
1135 DECLARE_EVENT_CLASS(ext4__mballoc,
1136 	TP_PROTO(struct super_block *sb,
1137 		 struct inode *inode,
1138 		 ext4_group_t group,
1139 		 ext4_grpblk_t start,
1140 		 ext4_grpblk_t len),
1141 
1142 	TP_ARGS(sb, inode, group, start, len),
1143 
1144 	TP_STRUCT__entry(
1145 		__field(	dev_t,	dev			)
1146 		__field(	ino_t,	ino			)
1147 		__field(	  int,	result_start		)
1148 		__field(	__u32, 	result_group		)
1149 		__field(	  int,	result_len		)
1150 	),
1151 
1152 	TP_fast_assign(
1153 		__entry->dev		= sb->s_dev;
1154 		__entry->ino		= inode ? inode->i_ino : 0;
1155 		__entry->result_start	= start;
1156 		__entry->result_group	= group;
1157 		__entry->result_len	= len;
1158 	),
1159 
1160 	TP_printk("dev %d,%d inode %lu extent %u/%d/%d ",
1161 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1162 		  (unsigned long) __entry->ino,
1163 		  __entry->result_group, __entry->result_start,
1164 		  __entry->result_len)
1165 );
1166 
1167 DEFINE_EVENT(ext4__mballoc, ext4_mballoc_discard,
1168 
1169 	TP_PROTO(struct super_block *sb,
1170 		 struct inode *inode,
1171 		 ext4_group_t group,
1172 		 ext4_grpblk_t start,
1173 		 ext4_grpblk_t len),
1174 
1175 	TP_ARGS(sb, inode, group, start, len)
1176 );
1177 
1178 DEFINE_EVENT(ext4__mballoc, ext4_mballoc_free,
1179 
1180 	TP_PROTO(struct super_block *sb,
1181 		 struct inode *inode,
1182 		 ext4_group_t group,
1183 		 ext4_grpblk_t start,
1184 		 ext4_grpblk_t len),
1185 
1186 	TP_ARGS(sb, inode, group, start, len)
1187 );
1188 
1189 TRACE_EVENT(ext4_forget,
1190 	TP_PROTO(struct inode *inode, int is_metadata, __u64 block),
1191 
1192 	TP_ARGS(inode, is_metadata, block),
1193 
1194 	TP_STRUCT__entry(
1195 		__field(	dev_t,	dev			)
1196 		__field(	ino_t,	ino			)
1197 		__field(	__u64,	block			)
1198 		__field(	int,	is_metadata		)
1199 		__field(	__u16,	mode			)
1200 	),
1201 
1202 	TP_fast_assign(
1203 		__entry->dev	= inode->i_sb->s_dev;
1204 		__entry->ino	= inode->i_ino;
1205 		__entry->block	= block;
1206 		__entry->is_metadata = is_metadata;
1207 		__entry->mode	= inode->i_mode;
1208 	),
1209 
1210 	TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu",
1211 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1212 		  (unsigned long) __entry->ino,
1213 		  __entry->mode, __entry->is_metadata, __entry->block)
1214 );
1215 
1216 TRACE_EVENT(ext4_da_update_reserve_space,
1217 	TP_PROTO(struct inode *inode, int used_blocks, int quota_claim),
1218 
1219 	TP_ARGS(inode, used_blocks, quota_claim),
1220 
1221 	TP_STRUCT__entry(
1222 		__field(	dev_t,	dev			)
1223 		__field(	ino_t,	ino			)
1224 		__field(	__u64,	i_blocks		)
1225 		__field(	int,	used_blocks		)
1226 		__field(	int,	reserved_data_blocks	)
1227 		__field(	int,	quota_claim		)
1228 		__field(	__u16,	mode			)
1229 	),
1230 
1231 	TP_fast_assign(
1232 		__entry->dev	= inode->i_sb->s_dev;
1233 		__entry->ino	= inode->i_ino;
1234 		__entry->i_blocks = inode->i_blocks;
1235 		__entry->used_blocks = used_blocks;
1236 		__entry->reserved_data_blocks =
1237 				EXT4_I(inode)->i_reserved_data_blocks;
1238 		__entry->quota_claim = quota_claim;
1239 		__entry->mode	= inode->i_mode;
1240 	),
1241 
1242 	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d "
1243 		  "reserved_data_blocks %d quota_claim %d",
1244 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1245 		  (unsigned long) __entry->ino,
1246 		  __entry->mode, __entry->i_blocks,
1247 		  __entry->used_blocks, __entry->reserved_data_blocks,
1248 		  __entry->quota_claim)
1249 );
1250 
1251 TRACE_EVENT(ext4_da_reserve_space,
1252 	TP_PROTO(struct inode *inode),
1253 
1254 	TP_ARGS(inode),
1255 
1256 	TP_STRUCT__entry(
1257 		__field(	dev_t,	dev			)
1258 		__field(	ino_t,	ino			)
1259 		__field(	__u64,	i_blocks		)
1260 		__field(	int,	reserved_data_blocks	)
1261 		__field(	__u16,  mode			)
1262 	),
1263 
1264 	TP_fast_assign(
1265 		__entry->dev	= inode->i_sb->s_dev;
1266 		__entry->ino	= inode->i_ino;
1267 		__entry->i_blocks = inode->i_blocks;
1268 		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1269 		__entry->mode	= inode->i_mode;
1270 	),
1271 
1272 	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu "
1273 		  "reserved_data_blocks %d",
1274 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1275 		  (unsigned long) __entry->ino,
1276 		  __entry->mode, __entry->i_blocks,
1277 		  __entry->reserved_data_blocks)
1278 );
1279 
1280 TRACE_EVENT(ext4_da_release_space,
1281 	TP_PROTO(struct inode *inode, int freed_blocks),
1282 
1283 	TP_ARGS(inode, freed_blocks),
1284 
1285 	TP_STRUCT__entry(
1286 		__field(	dev_t,	dev			)
1287 		__field(	ino_t,	ino			)
1288 		__field(	__u64,	i_blocks		)
1289 		__field(	int,	freed_blocks		)
1290 		__field(	int,	reserved_data_blocks	)
1291 		__field(	__u16,  mode			)
1292 	),
1293 
1294 	TP_fast_assign(
1295 		__entry->dev	= inode->i_sb->s_dev;
1296 		__entry->ino	= inode->i_ino;
1297 		__entry->i_blocks = inode->i_blocks;
1298 		__entry->freed_blocks = freed_blocks;
1299 		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1300 		__entry->mode	= inode->i_mode;
1301 	),
1302 
1303 	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d "
1304 		  "reserved_data_blocks %d",
1305 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1306 		  (unsigned long) __entry->ino,
1307 		  __entry->mode, __entry->i_blocks,
1308 		  __entry->freed_blocks, __entry->reserved_data_blocks)
1309 );
1310 
1311 DECLARE_EVENT_CLASS(ext4__bitmap_load,
1312 	TP_PROTO(struct super_block *sb, unsigned long group),
1313 
1314 	TP_ARGS(sb, group),
1315 
1316 	TP_STRUCT__entry(
1317 		__field(	dev_t,	dev			)
1318 		__field(	__u32,	group			)
1319 
1320 	),
1321 
1322 	TP_fast_assign(
1323 		__entry->dev	= sb->s_dev;
1324 		__entry->group	= group;
1325 	),
1326 
1327 	TP_printk("dev %d,%d group %u",
1328 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1329 		  __entry->group)
1330 );
1331 
1332 DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load,
1333 
1334 	TP_PROTO(struct super_block *sb, unsigned long group),
1335 
1336 	TP_ARGS(sb, group)
1337 );
1338 
1339 DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
1340 
1341 	TP_PROTO(struct super_block *sb, unsigned long group),
1342 
1343 	TP_ARGS(sb, group)
1344 );
1345 
1346 DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
1347 
1348 	TP_PROTO(struct super_block *sb, unsigned long group),
1349 
1350 	TP_ARGS(sb, group)
1351 );
1352 
1353 TRACE_EVENT(ext4_read_block_bitmap_load,
1354 	TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
1355 
1356 	TP_ARGS(sb, group, prefetch),
1357 
1358 	TP_STRUCT__entry(
1359 		__field(	dev_t,	dev			)
1360 		__field(	__u32,	group			)
1361 		__field(	bool,	prefetch		)
1362 
1363 	),
1364 
1365 	TP_fast_assign(
1366 		__entry->dev	= sb->s_dev;
1367 		__entry->group	= group;
1368 		__entry->prefetch = prefetch;
1369 	),
1370 
1371 	TP_printk("dev %d,%d group %u prefetch %d",
1372 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1373 		  __entry->group, __entry->prefetch)
1374 );
1375 
1376 DECLARE_EVENT_CLASS(ext4__fallocate_mode,
1377 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1378 
1379 	TP_ARGS(inode, offset, len, mode),
1380 
1381 	TP_STRUCT__entry(
1382 		__field(	dev_t,	dev			)
1383 		__field(	ino_t,	ino			)
1384 		__field(	loff_t,	offset			)
1385 		__field(	loff_t, len			)
1386 		__field(	int,	mode			)
1387 	),
1388 
1389 	TP_fast_assign(
1390 		__entry->dev	= inode->i_sb->s_dev;
1391 		__entry->ino	= inode->i_ino;
1392 		__entry->offset	= offset;
1393 		__entry->len	= len;
1394 		__entry->mode	= mode;
1395 	),
1396 
1397 	TP_printk("dev %d,%d ino %lu offset %lld len %lld mode %s",
1398 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1399 		  (unsigned long) __entry->ino,
1400 		  __entry->offset, __entry->len,
1401 		  show_falloc_mode(__entry->mode))
1402 );
1403 
1404 DEFINE_EVENT(ext4__fallocate_mode, ext4_fallocate_enter,
1405 
1406 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1407 
1408 	TP_ARGS(inode, offset, len, mode)
1409 );
1410 
1411 DEFINE_EVENT(ext4__fallocate_mode, ext4_punch_hole,
1412 
1413 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1414 
1415 	TP_ARGS(inode, offset, len, mode)
1416 );
1417 
1418 DEFINE_EVENT(ext4__fallocate_mode, ext4_zero_range,
1419 
1420 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1421 
1422 	TP_ARGS(inode, offset, len, mode)
1423 );
1424 
1425 TRACE_EVENT(ext4_fallocate_exit,
1426 	TP_PROTO(struct inode *inode, loff_t offset,
1427 		 unsigned int max_blocks, int ret),
1428 
1429 	TP_ARGS(inode, offset, max_blocks, ret),
1430 
1431 	TP_STRUCT__entry(
1432 		__field(	dev_t,	dev			)
1433 		__field(	ino_t,	ino			)
1434 		__field(	loff_t,	pos			)
1435 		__field(	unsigned int,	blocks		)
1436 		__field(	int, 	ret			)
1437 	),
1438 
1439 	TP_fast_assign(
1440 		__entry->dev	= inode->i_sb->s_dev;
1441 		__entry->ino	= inode->i_ino;
1442 		__entry->pos	= offset;
1443 		__entry->blocks	= max_blocks;
1444 		__entry->ret	= ret;
1445 	),
1446 
1447 	TP_printk("dev %d,%d ino %lu pos %lld blocks %u ret %d",
1448 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1449 		  (unsigned long) __entry->ino,
1450 		  __entry->pos, __entry->blocks,
1451 		  __entry->ret)
1452 );
1453 
1454 TRACE_EVENT(ext4_unlink_enter,
1455 	TP_PROTO(struct inode *parent, struct dentry *dentry),
1456 
1457 	TP_ARGS(parent, dentry),
1458 
1459 	TP_STRUCT__entry(
1460 		__field(	dev_t,	dev			)
1461 		__field(	ino_t,	ino			)
1462 		__field(	ino_t,	parent			)
1463 		__field(	loff_t,	size			)
1464 	),
1465 
1466 	TP_fast_assign(
1467 		__entry->dev		= dentry->d_sb->s_dev;
1468 		__entry->ino		= d_inode(dentry)->i_ino;
1469 		__entry->parent		= parent->i_ino;
1470 		__entry->size		= d_inode(dentry)->i_size;
1471 	),
1472 
1473 	TP_printk("dev %d,%d ino %lu size %lld parent %lu",
1474 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1475 		  (unsigned long) __entry->ino, __entry->size,
1476 		  (unsigned long) __entry->parent)
1477 );
1478 
1479 TRACE_EVENT(ext4_unlink_exit,
1480 	TP_PROTO(struct dentry *dentry, int ret),
1481 
1482 	TP_ARGS(dentry, ret),
1483 
1484 	TP_STRUCT__entry(
1485 		__field(	dev_t,	dev			)
1486 		__field(	ino_t,	ino			)
1487 		__field(	int,	ret			)
1488 	),
1489 
1490 	TP_fast_assign(
1491 		__entry->dev		= dentry->d_sb->s_dev;
1492 		__entry->ino		= d_inode(dentry)->i_ino;
1493 		__entry->ret		= ret;
1494 	),
1495 
1496 	TP_printk("dev %d,%d ino %lu ret %d",
1497 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1498 		  (unsigned long) __entry->ino,
1499 		  __entry->ret)
1500 );
1501 
1502 DECLARE_EVENT_CLASS(ext4__truncate,
1503 	TP_PROTO(struct inode *inode),
1504 
1505 	TP_ARGS(inode),
1506 
1507 	TP_STRUCT__entry(
1508 		__field(	dev_t,		dev		)
1509 		__field(	ino_t,		ino		)
1510 		__field(	__u64,		blocks		)
1511 	),
1512 
1513 	TP_fast_assign(
1514 		__entry->dev    = inode->i_sb->s_dev;
1515 		__entry->ino    = inode->i_ino;
1516 		__entry->blocks	= inode->i_blocks;
1517 	),
1518 
1519 	TP_printk("dev %d,%d ino %lu blocks %llu",
1520 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1521 		  (unsigned long) __entry->ino, __entry->blocks)
1522 );
1523 
1524 DEFINE_EVENT(ext4__truncate, ext4_truncate_enter,
1525 
1526 	TP_PROTO(struct inode *inode),
1527 
1528 	TP_ARGS(inode)
1529 );
1530 
1531 DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,
1532 
1533 	TP_PROTO(struct inode *inode),
1534 
1535 	TP_ARGS(inode)
1536 );
1537 
1538 /* 'ux' is the unwritten extent. */
1539 TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1540 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1541 		 struct ext4_extent *ux),
1542 
1543 	TP_ARGS(inode, map, ux),
1544 
1545 	TP_STRUCT__entry(
1546 		__field(	dev_t,		dev	)
1547 		__field(	ino_t,		ino	)
1548 		__field(	ext4_lblk_t,	m_lblk	)
1549 		__field(	unsigned,	m_len	)
1550 		__field(	ext4_lblk_t,	u_lblk	)
1551 		__field(	unsigned,	u_len	)
1552 		__field(	ext4_fsblk_t,	u_pblk	)
1553 	),
1554 
1555 	TP_fast_assign(
1556 		__entry->dev		= inode->i_sb->s_dev;
1557 		__entry->ino		= inode->i_ino;
1558 		__entry->m_lblk		= map->m_lblk;
1559 		__entry->m_len		= map->m_len;
1560 		__entry->u_lblk		= le32_to_cpu(ux->ee_block);
1561 		__entry->u_len		= ext4_ext_get_actual_len(ux);
1562 		__entry->u_pblk		= ext4_ext_pblock(ux);
1563 	),
1564 
1565 	TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u u_lblk %u u_len %u "
1566 		  "u_pblk %llu",
1567 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1568 		  (unsigned long) __entry->ino,
1569 		  __entry->m_lblk, __entry->m_len,
1570 		  __entry->u_lblk, __entry->u_len, __entry->u_pblk)
1571 );
1572 
1573 /*
1574  * 'ux' is the unwritten extent.
1575  * 'ix' is the initialized extent to which blocks are transferred.
1576  */
1577 TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
1578 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1579 		 struct ext4_extent *ux, struct ext4_extent *ix),
1580 
1581 	TP_ARGS(inode, map, ux, ix),
1582 
1583 	TP_STRUCT__entry(
1584 		__field(	dev_t,		dev	)
1585 		__field(	ino_t,		ino	)
1586 		__field(	ext4_lblk_t,	m_lblk	)
1587 		__field(	unsigned,	m_len	)
1588 		__field(	ext4_lblk_t,	u_lblk	)
1589 		__field(	unsigned,	u_len	)
1590 		__field(	ext4_fsblk_t,	u_pblk	)
1591 		__field(	ext4_lblk_t,	i_lblk	)
1592 		__field(	unsigned,	i_len	)
1593 		__field(	ext4_fsblk_t,	i_pblk	)
1594 	),
1595 
1596 	TP_fast_assign(
1597 		__entry->dev		= inode->i_sb->s_dev;
1598 		__entry->ino		= inode->i_ino;
1599 		__entry->m_lblk		= map->m_lblk;
1600 		__entry->m_len		= map->m_len;
1601 		__entry->u_lblk		= le32_to_cpu(ux->ee_block);
1602 		__entry->u_len		= ext4_ext_get_actual_len(ux);
1603 		__entry->u_pblk		= ext4_ext_pblock(ux);
1604 		__entry->i_lblk		= le32_to_cpu(ix->ee_block);
1605 		__entry->i_len		= ext4_ext_get_actual_len(ix);
1606 		__entry->i_pblk		= ext4_ext_pblock(ix);
1607 	),
1608 
1609 	TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u "
1610 		  "u_lblk %u u_len %u u_pblk %llu "
1611 		  "i_lblk %u i_len %u i_pblk %llu ",
1612 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1613 		  (unsigned long) __entry->ino,
1614 		  __entry->m_lblk, __entry->m_len,
1615 		  __entry->u_lblk, __entry->u_len, __entry->u_pblk,
1616 		  __entry->i_lblk, __entry->i_len, __entry->i_pblk)
1617 );
1618 
1619 DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
1620 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1621 		 unsigned int len, unsigned int flags),
1622 
1623 	TP_ARGS(inode, lblk, len, flags),
1624 
1625 	TP_STRUCT__entry(
1626 		__field(	dev_t,		dev		)
1627 		__field(	ino_t,		ino		)
1628 		__field(	ext4_lblk_t,	lblk		)
1629 		__field(	unsigned int,	len		)
1630 		__field(	unsigned int,	flags		)
1631 	),
1632 
1633 	TP_fast_assign(
1634 		__entry->dev    = inode->i_sb->s_dev;
1635 		__entry->ino    = inode->i_ino;
1636 		__entry->lblk	= lblk;
1637 		__entry->len	= len;
1638 		__entry->flags	= flags;
1639 	),
1640 
1641 	TP_printk("dev %d,%d ino %lu lblk %u len %u flags %s",
1642 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1643 		  (unsigned long) __entry->ino,
1644 		  __entry->lblk, __entry->len, show_map_flags(__entry->flags))
1645 );
1646 
1647 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter,
1648 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1649 		 unsigned len, unsigned flags),
1650 
1651 	TP_ARGS(inode, lblk, len, flags)
1652 );
1653 
1654 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
1655 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1656 		 unsigned len, unsigned flags),
1657 
1658 	TP_ARGS(inode, lblk, len, flags)
1659 );
1660 
1661 DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1662 	TP_PROTO(struct inode *inode, unsigned flags, struct ext4_map_blocks *map,
1663 		 int ret),
1664 
1665 	TP_ARGS(inode, flags, map, ret),
1666 
1667 	TP_STRUCT__entry(
1668 		__field(	dev_t,		dev		)
1669 		__field(	ino_t,		ino		)
1670 		__field(	unsigned int,	flags		)
1671 		__field(	ext4_fsblk_t,	pblk		)
1672 		__field(	ext4_lblk_t,	lblk		)
1673 		__field(	unsigned int,	len		)
1674 		__field(	unsigned int,	mflags		)
1675 		__field(	int,		ret		)
1676 	),
1677 
1678 	TP_fast_assign(
1679 		__entry->dev    = inode->i_sb->s_dev;
1680 		__entry->ino    = inode->i_ino;
1681 		__entry->flags	= flags;
1682 		__entry->pblk	= map->m_pblk;
1683 		__entry->lblk	= map->m_lblk;
1684 		__entry->len	= map->m_len;
1685 		__entry->mflags	= map->m_flags;
1686 		__entry->ret	= ret;
1687 	),
1688 
1689 	TP_printk("dev %d,%d ino %lu flags %s lblk %u pblk %llu len %u "
1690 		  "mflags %s ret %d",
1691 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1692 		  (unsigned long) __entry->ino,
1693 		  show_map_flags(__entry->flags), __entry->lblk, __entry->pblk,
1694 		  __entry->len, show_mflags(__entry->mflags), __entry->ret)
1695 );
1696 
1697 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1698 	TP_PROTO(struct inode *inode, unsigned flags,
1699 		 struct ext4_map_blocks *map, int ret),
1700 
1701 	TP_ARGS(inode, flags, map, ret)
1702 );
1703 
1704 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1705 	TP_PROTO(struct inode *inode, unsigned flags,
1706 		 struct ext4_map_blocks *map, int ret),
1707 
1708 	TP_ARGS(inode, flags, map, ret)
1709 );
1710 
1711 TRACE_EVENT(ext4_ext_load_extent,
1712 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk),
1713 
1714 	TP_ARGS(inode, lblk, pblk),
1715 
1716 	TP_STRUCT__entry(
1717 		__field(	dev_t,		dev		)
1718 		__field(	ino_t,		ino		)
1719 		__field(	ext4_fsblk_t,	pblk		)
1720 		__field(	ext4_lblk_t,	lblk		)
1721 	),
1722 
1723 	TP_fast_assign(
1724 		__entry->dev    = inode->i_sb->s_dev;
1725 		__entry->ino    = inode->i_ino;
1726 		__entry->pblk	= pblk;
1727 		__entry->lblk	= lblk;
1728 	),
1729 
1730 	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
1731 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1732 		  (unsigned long) __entry->ino,
1733 		  __entry->lblk, __entry->pblk)
1734 );
1735 
1736 TRACE_EVENT(ext4_load_inode,
1737 	TP_PROTO(struct super_block *sb, unsigned long ino),
1738 
1739 	TP_ARGS(sb, ino),
1740 
1741 	TP_STRUCT__entry(
1742 		__field(	dev_t,	dev		)
1743 		__field(	ino_t,	ino		)
1744 	),
1745 
1746 	TP_fast_assign(
1747 		__entry->dev		= sb->s_dev;
1748 		__entry->ino		= ino;
1749 	),
1750 
1751 	TP_printk("dev %d,%d ino %ld",
1752 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1753 		  (unsigned long) __entry->ino)
1754 );
1755 
1756 TRACE_EVENT(ext4_journal_start_sb,
1757 	TP_PROTO(struct super_block *sb, int blocks, int rsv_blocks,
1758 		 int revoke_creds, int type, unsigned long IP),
1759 
1760 	TP_ARGS(sb, blocks, rsv_blocks, revoke_creds, type, IP),
1761 
1762 	TP_STRUCT__entry(
1763 		__field(	dev_t,		dev		)
1764 		__field(	unsigned long,	ip		)
1765 		__field(	int,		blocks		)
1766 		__field(	int,		rsv_blocks	)
1767 		__field(	int,		revoke_creds	)
1768 		__field(	int,		type		)
1769 	),
1770 
1771 	TP_fast_assign(
1772 		__entry->dev		 = sb->s_dev;
1773 		__entry->ip		 = IP;
1774 		__entry->blocks		 = blocks;
1775 		__entry->rsv_blocks	 = rsv_blocks;
1776 		__entry->revoke_creds	 = revoke_creds;
1777 		__entry->type		 = type;
1778 	),
1779 
1780 	TP_printk("dev %d,%d blocks %d, rsv_blocks %d, revoke_creds %d,"
1781 		  " type %d, caller %pS", MAJOR(__entry->dev),
1782 		  MINOR(__entry->dev), __entry->blocks, __entry->rsv_blocks,
1783 		  __entry->revoke_creds, __entry->type, (void *)__entry->ip)
1784 );
1785 
1786 TRACE_EVENT(ext4_journal_start_inode,
1787 	TP_PROTO(struct inode *inode, int blocks, int rsv_blocks,
1788 		 int revoke_creds, int type, unsigned long IP),
1789 
1790 	TP_ARGS(inode, blocks, rsv_blocks, revoke_creds, type, IP),
1791 
1792 	TP_STRUCT__entry(
1793 		__field(	unsigned long,	ino		)
1794 		__field(	dev_t,		dev		)
1795 		__field(	unsigned long,	ip		)
1796 		__field(	int,		blocks		)
1797 		__field(	int,		rsv_blocks	)
1798 		__field(	int,		revoke_creds	)
1799 		__field(	int,		type		)
1800 	),
1801 
1802 	TP_fast_assign(
1803 		__entry->dev		 = inode->i_sb->s_dev;
1804 		__entry->ip		 = IP;
1805 		__entry->blocks		 = blocks;
1806 		__entry->rsv_blocks	 = rsv_blocks;
1807 		__entry->revoke_creds	 = revoke_creds;
1808 		__entry->type		 = type;
1809 		__entry->ino		 = inode->i_ino;
1810 	),
1811 
1812 	TP_printk("dev %d,%d blocks %d, rsv_blocks %d, revoke_creds %d,"
1813 		  " type %d, ino %lu, caller %pS", MAJOR(__entry->dev),
1814 		  MINOR(__entry->dev), __entry->blocks, __entry->rsv_blocks,
1815 		  __entry->revoke_creds, __entry->type, __entry->ino,
1816 		  (void *)__entry->ip)
1817 );
1818 
1819 TRACE_EVENT(ext4_journal_start_reserved,
1820 	TP_PROTO(struct super_block *sb, int blocks, unsigned long IP),
1821 
1822 	TP_ARGS(sb, blocks, IP),
1823 
1824 	TP_STRUCT__entry(
1825 		__field(	dev_t,	dev			)
1826 		__field(unsigned long,	ip			)
1827 		__field(	  int,	blocks			)
1828 	),
1829 
1830 	TP_fast_assign(
1831 		__entry->dev		 = sb->s_dev;
1832 		__entry->ip		 = IP;
1833 		__entry->blocks		 = blocks;
1834 	),
1835 
1836 	TP_printk("dev %d,%d blocks, %d caller %pS",
1837 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1838 		  __entry->blocks, (void *)__entry->ip)
1839 );
1840 
1841 DECLARE_EVENT_CLASS(ext4__trim,
1842 	TP_PROTO(struct super_block *sb,
1843 		 ext4_group_t group,
1844 		 ext4_grpblk_t start,
1845 		 ext4_grpblk_t len),
1846 
1847 	TP_ARGS(sb, group, start, len),
1848 
1849 	TP_STRUCT__entry(
1850 		__field(	int,	dev_major		)
1851 		__field(	int,	dev_minor		)
1852 		__field(	__u32, 	group			)
1853 		__field(	int,	start			)
1854 		__field(	int,	len			)
1855 	),
1856 
1857 	TP_fast_assign(
1858 		__entry->dev_major	= MAJOR(sb->s_dev);
1859 		__entry->dev_minor	= MINOR(sb->s_dev);
1860 		__entry->group		= group;
1861 		__entry->start		= start;
1862 		__entry->len		= len;
1863 	),
1864 
1865 	TP_printk("dev %d,%d group %u, start %d, len %d",
1866 		  __entry->dev_major, __entry->dev_minor,
1867 		  __entry->group, __entry->start, __entry->len)
1868 );
1869 
1870 DEFINE_EVENT(ext4__trim, ext4_trim_extent,
1871 
1872 	TP_PROTO(struct super_block *sb,
1873 		 ext4_group_t group,
1874 		 ext4_grpblk_t start,
1875 		 ext4_grpblk_t len),
1876 
1877 	TP_ARGS(sb, group, start, len)
1878 );
1879 
1880 DEFINE_EVENT(ext4__trim, ext4_trim_all_free,
1881 
1882 	TP_PROTO(struct super_block *sb,
1883 		 ext4_group_t group,
1884 		 ext4_grpblk_t start,
1885 		 ext4_grpblk_t len),
1886 
1887 	TP_ARGS(sb, group, start, len)
1888 );
1889 
1890 TRACE_EVENT(ext4_ext_handle_unwritten_extents,
1891 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1892 		 unsigned int allocated, ext4_fsblk_t newblock),
1893 
1894 	TP_ARGS(inode, map, flags, allocated, newblock),
1895 
1896 	TP_STRUCT__entry(
1897 		__field(	dev_t,		dev		)
1898 		__field(	ino_t,		ino		)
1899 		__field(	int,		flags		)
1900 		__field(	ext4_lblk_t,	lblk		)
1901 		__field(	ext4_fsblk_t,	pblk		)
1902 		__field(	unsigned int,	len		)
1903 		__field(	unsigned int,	allocated	)
1904 		__field(	ext4_fsblk_t,	newblk		)
1905 	),
1906 
1907 	TP_fast_assign(
1908 		__entry->dev		= inode->i_sb->s_dev;
1909 		__entry->ino		= inode->i_ino;
1910 		__entry->flags		= flags;
1911 		__entry->lblk		= map->m_lblk;
1912 		__entry->pblk		= map->m_pblk;
1913 		__entry->len		= map->m_len;
1914 		__entry->allocated	= allocated;
1915 		__entry->newblk		= newblock;
1916 	),
1917 
1918 	TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %s "
1919 		  "allocated %d newblock %llu",
1920 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1921 		  (unsigned long) __entry->ino,
1922 		  (unsigned) __entry->lblk, (unsigned long long) __entry->pblk,
1923 		  __entry->len, show_map_flags(__entry->flags),
1924 		  (unsigned int) __entry->allocated,
1925 		  (unsigned long long) __entry->newblk)
1926 );
1927 
1928 TRACE_EVENT(ext4_get_implied_cluster_alloc_exit,
1929 	TP_PROTO(struct super_block *sb, struct ext4_map_blocks *map, int ret),
1930 
1931 	TP_ARGS(sb, map, ret),
1932 
1933 	TP_STRUCT__entry(
1934 		__field(	dev_t,		dev	)
1935 		__field(	unsigned int,	flags	)
1936 		__field(	ext4_lblk_t,	lblk	)
1937 		__field(	ext4_fsblk_t,	pblk	)
1938 		__field(	unsigned int,	len	)
1939 		__field(	int,		ret	)
1940 	),
1941 
1942 	TP_fast_assign(
1943 		__entry->dev	= sb->s_dev;
1944 		__entry->flags	= map->m_flags;
1945 		__entry->lblk	= map->m_lblk;
1946 		__entry->pblk	= map->m_pblk;
1947 		__entry->len	= map->m_len;
1948 		__entry->ret	= ret;
1949 	),
1950 
1951 	TP_printk("dev %d,%d m_lblk %u m_pblk %llu m_len %u m_flags %s ret %d",
1952 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1953 		  __entry->lblk, (unsigned long long) __entry->pblk,
1954 		  __entry->len, show_mflags(__entry->flags), __entry->ret)
1955 );
1956 
1957 TRACE_EVENT(ext4_ext_show_extent,
1958 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk,
1959 		 unsigned short len),
1960 
1961 	TP_ARGS(inode, lblk, pblk, len),
1962 
1963 	TP_STRUCT__entry(
1964 		__field(	dev_t,		dev	)
1965 		__field(	ino_t,		ino	)
1966 		__field(	ext4_fsblk_t,	pblk	)
1967 		__field(	ext4_lblk_t,	lblk	)
1968 		__field(	unsigned short,	len	)
1969 	),
1970 
1971 	TP_fast_assign(
1972 		__entry->dev	= inode->i_sb->s_dev;
1973 		__entry->ino	= inode->i_ino;
1974 		__entry->pblk	= pblk;
1975 		__entry->lblk	= lblk;
1976 		__entry->len	= len;
1977 	),
1978 
1979 	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u",
1980 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1981 		  (unsigned long) __entry->ino,
1982 		  (unsigned) __entry->lblk,
1983 		  (unsigned long long) __entry->pblk,
1984 		  (unsigned short) __entry->len)
1985 );
1986 
1987 TRACE_EVENT(ext4_remove_blocks,
1988 	TP_PROTO(struct inode *inode, struct ext4_extent *ex,
1989 		 ext4_lblk_t from, ext4_fsblk_t to,
1990 		 struct partial_cluster *pc),
1991 
1992 	TP_ARGS(inode, ex, from, to, pc),
1993 
1994 	TP_STRUCT__entry(
1995 		__field(	dev_t,		dev	)
1996 		__field(	ino_t,		ino	)
1997 		__field(	ext4_lblk_t,	from	)
1998 		__field(	ext4_lblk_t,	to	)
1999 		__field(	ext4_fsblk_t,	ee_pblk	)
2000 		__field(	ext4_lblk_t,	ee_lblk	)
2001 		__field(	unsigned short,	ee_len	)
2002 		__field(	ext4_fsblk_t,	pc_pclu	)
2003 		__field(	ext4_lblk_t,	pc_lblk	)
2004 		__field(	int,		pc_state)
2005 	),
2006 
2007 	TP_fast_assign(
2008 		__entry->dev		= inode->i_sb->s_dev;
2009 		__entry->ino		= inode->i_ino;
2010 		__entry->from		= from;
2011 		__entry->to		= to;
2012 		__entry->ee_pblk	= ext4_ext_pblock(ex);
2013 		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
2014 		__entry->ee_len		= ext4_ext_get_actual_len(ex);
2015 		__entry->pc_pclu	= pc->pclu;
2016 		__entry->pc_lblk	= pc->lblk;
2017 		__entry->pc_state	= pc->state;
2018 	),
2019 
2020 	TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]"
2021 		  "from %u to %u partial [pclu %lld lblk %u state %d]",
2022 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2023 		  (unsigned long) __entry->ino,
2024 		  (unsigned) __entry->ee_lblk,
2025 		  (unsigned long long) __entry->ee_pblk,
2026 		  (unsigned short) __entry->ee_len,
2027 		  (unsigned) __entry->from,
2028 		  (unsigned) __entry->to,
2029 		  (long long) __entry->pc_pclu,
2030 		  (unsigned int) __entry->pc_lblk,
2031 		  (int) __entry->pc_state)
2032 );
2033 
2034 TRACE_EVENT(ext4_ext_rm_leaf,
2035 	TP_PROTO(struct inode *inode, ext4_lblk_t start,
2036 		 struct ext4_extent *ex,
2037 		 struct partial_cluster *pc),
2038 
2039 	TP_ARGS(inode, start, ex, pc),
2040 
2041 	TP_STRUCT__entry(
2042 		__field(	dev_t,		dev	)
2043 		__field(	ino_t,		ino	)
2044 		__field(	ext4_lblk_t,	start	)
2045 		__field(	ext4_lblk_t,	ee_lblk	)
2046 		__field(	ext4_fsblk_t,	ee_pblk	)
2047 		__field(	short,		ee_len	)
2048 		__field(	ext4_fsblk_t,	pc_pclu	)
2049 		__field(	ext4_lblk_t,	pc_lblk	)
2050 		__field(	int,		pc_state)
2051 	),
2052 
2053 	TP_fast_assign(
2054 		__entry->dev		= inode->i_sb->s_dev;
2055 		__entry->ino		= inode->i_ino;
2056 		__entry->start		= start;
2057 		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
2058 		__entry->ee_pblk	= ext4_ext_pblock(ex);
2059 		__entry->ee_len		= ext4_ext_get_actual_len(ex);
2060 		__entry->pc_pclu	= pc->pclu;
2061 		__entry->pc_lblk	= pc->lblk;
2062 		__entry->pc_state	= pc->state;
2063 	),
2064 
2065 	TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]"
2066 		  "partial [pclu %lld lblk %u state %d]",
2067 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2068 		  (unsigned long) __entry->ino,
2069 		  (unsigned) __entry->start,
2070 		  (unsigned) __entry->ee_lblk,
2071 		  (unsigned long long) __entry->ee_pblk,
2072 		  (unsigned short) __entry->ee_len,
2073 		  (long long) __entry->pc_pclu,
2074 		  (unsigned int) __entry->pc_lblk,
2075 		  (int) __entry->pc_state)
2076 );
2077 
2078 TRACE_EVENT(ext4_ext_rm_idx,
2079 	TP_PROTO(struct inode *inode, ext4_fsblk_t pblk),
2080 
2081 	TP_ARGS(inode, pblk),
2082 
2083 	TP_STRUCT__entry(
2084 		__field(	dev_t,		dev	)
2085 		__field(	ino_t,		ino	)
2086 		__field(	ext4_fsblk_t,	pblk	)
2087 	),
2088 
2089 	TP_fast_assign(
2090 		__entry->dev	= inode->i_sb->s_dev;
2091 		__entry->ino	= inode->i_ino;
2092 		__entry->pblk	= pblk;
2093 	),
2094 
2095 	TP_printk("dev %d,%d ino %lu index_pblk %llu",
2096 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2097 		  (unsigned long) __entry->ino,
2098 		  (unsigned long long) __entry->pblk)
2099 );
2100 
2101 TRACE_EVENT(ext4_ext_remove_space,
2102 	TP_PROTO(struct inode *inode, ext4_lblk_t start,
2103 		 ext4_lblk_t end, int depth),
2104 
2105 	TP_ARGS(inode, start, end, depth),
2106 
2107 	TP_STRUCT__entry(
2108 		__field(	dev_t,		dev	)
2109 		__field(	ino_t,		ino	)
2110 		__field(	ext4_lblk_t,	start	)
2111 		__field(	ext4_lblk_t,	end	)
2112 		__field(	int,		depth	)
2113 	),
2114 
2115 	TP_fast_assign(
2116 		__entry->dev	= inode->i_sb->s_dev;
2117 		__entry->ino	= inode->i_ino;
2118 		__entry->start	= start;
2119 		__entry->end	= end;
2120 		__entry->depth	= depth;
2121 	),
2122 
2123 	TP_printk("dev %d,%d ino %lu since %u end %u depth %d",
2124 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2125 		  (unsigned long) __entry->ino,
2126 		  (unsigned) __entry->start,
2127 		  (unsigned) __entry->end,
2128 		  __entry->depth)
2129 );
2130 
2131 TRACE_EVENT(ext4_ext_remove_space_done,
2132 	TP_PROTO(struct inode *inode, ext4_lblk_t start, ext4_lblk_t end,
2133 		 int depth, struct partial_cluster *pc, __le16 eh_entries),
2134 
2135 	TP_ARGS(inode, start, end, depth, pc, eh_entries),
2136 
2137 	TP_STRUCT__entry(
2138 		__field(	dev_t,		dev		)
2139 		__field(	ino_t,		ino		)
2140 		__field(	ext4_lblk_t,	start		)
2141 		__field(	ext4_lblk_t,	end		)
2142 		__field(	int,		depth		)
2143 		__field(	ext4_fsblk_t,	pc_pclu		)
2144 		__field(	ext4_lblk_t,	pc_lblk		)
2145 		__field(	int,		pc_state	)
2146 		__field(	unsigned short,	eh_entries	)
2147 	),
2148 
2149 	TP_fast_assign(
2150 		__entry->dev		= inode->i_sb->s_dev;
2151 		__entry->ino		= inode->i_ino;
2152 		__entry->start		= start;
2153 		__entry->end		= end;
2154 		__entry->depth		= depth;
2155 		__entry->pc_pclu	= pc->pclu;
2156 		__entry->pc_lblk	= pc->lblk;
2157 		__entry->pc_state	= pc->state;
2158 		__entry->eh_entries	= le16_to_cpu(eh_entries);
2159 	),
2160 
2161 	TP_printk("dev %d,%d ino %lu since %u end %u depth %d "
2162 		  "partial [pclu %lld lblk %u state %d] "
2163 		  "remaining_entries %u",
2164 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2165 		  (unsigned long) __entry->ino,
2166 		  (unsigned) __entry->start,
2167 		  (unsigned) __entry->end,
2168 		  __entry->depth,
2169 		  (long long) __entry->pc_pclu,
2170 		  (unsigned int) __entry->pc_lblk,
2171 		  (int) __entry->pc_state,
2172 		  (unsigned short) __entry->eh_entries)
2173 );
2174 
2175 DECLARE_EVENT_CLASS(ext4__es_extent,
2176 	TP_PROTO(struct inode *inode, struct extent_status *es),
2177 
2178 	TP_ARGS(inode, es),
2179 
2180 	TP_STRUCT__entry(
2181 		__field(	dev_t,		dev		)
2182 		__field(	ino_t,		ino		)
2183 		__field(	ext4_lblk_t,	lblk		)
2184 		__field(	ext4_lblk_t,	len		)
2185 		__field(	ext4_fsblk_t,	pblk		)
2186 		__field(	char, status	)
2187 	),
2188 
2189 	TP_fast_assign(
2190 		__entry->dev	= inode->i_sb->s_dev;
2191 		__entry->ino	= inode->i_ino;
2192 		__entry->lblk	= es->es_lblk;
2193 		__entry->len	= es->es_len;
2194 		__entry->pblk	= ext4_es_show_pblock(es);
2195 		__entry->status	= ext4_es_status(es);
2196 	),
2197 
2198 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2199 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2200 		  (unsigned long) __entry->ino,
2201 		  __entry->lblk, __entry->len,
2202 		  __entry->pblk, show_extent_status(__entry->status))
2203 );
2204 
2205 DEFINE_EVENT(ext4__es_extent, ext4_es_insert_extent,
2206 	TP_PROTO(struct inode *inode, struct extent_status *es),
2207 
2208 	TP_ARGS(inode, es)
2209 );
2210 
2211 DEFINE_EVENT(ext4__es_extent, ext4_es_cache_extent,
2212 	TP_PROTO(struct inode *inode, struct extent_status *es),
2213 
2214 	TP_ARGS(inode, es)
2215 );
2216 
2217 TRACE_EVENT(ext4_es_remove_extent,
2218 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t len),
2219 
2220 	TP_ARGS(inode, lblk, len),
2221 
2222 	TP_STRUCT__entry(
2223 		__field(	dev_t,	dev			)
2224 		__field(	ino_t,	ino			)
2225 		__field(	loff_t,	lblk			)
2226 		__field(	loff_t,	len			)
2227 	),
2228 
2229 	TP_fast_assign(
2230 		__entry->dev	= inode->i_sb->s_dev;
2231 		__entry->ino	= inode->i_ino;
2232 		__entry->lblk	= lblk;
2233 		__entry->len	= len;
2234 	),
2235 
2236 	TP_printk("dev %d,%d ino %lu es [%lld/%lld)",
2237 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2238 		  (unsigned long) __entry->ino,
2239 		  __entry->lblk, __entry->len)
2240 );
2241 
2242 TRACE_EVENT(ext4_es_find_extent_range_enter,
2243 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2244 
2245 	TP_ARGS(inode, lblk),
2246 
2247 	TP_STRUCT__entry(
2248 		__field(	dev_t,		dev		)
2249 		__field(	ino_t,		ino		)
2250 		__field(	ext4_lblk_t,	lblk		)
2251 	),
2252 
2253 	TP_fast_assign(
2254 		__entry->dev	= inode->i_sb->s_dev;
2255 		__entry->ino	= inode->i_ino;
2256 		__entry->lblk	= lblk;
2257 	),
2258 
2259 	TP_printk("dev %d,%d ino %lu lblk %u",
2260 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2261 		  (unsigned long) __entry->ino, __entry->lblk)
2262 );
2263 
2264 TRACE_EVENT(ext4_es_find_extent_range_exit,
2265 	TP_PROTO(struct inode *inode, struct extent_status *es),
2266 
2267 	TP_ARGS(inode, es),
2268 
2269 	TP_STRUCT__entry(
2270 		__field(	dev_t,		dev		)
2271 		__field(	ino_t,		ino		)
2272 		__field(	ext4_lblk_t,	lblk		)
2273 		__field(	ext4_lblk_t,	len		)
2274 		__field(	ext4_fsblk_t,	pblk		)
2275 		__field(	char, status	)
2276 	),
2277 
2278 	TP_fast_assign(
2279 		__entry->dev	= inode->i_sb->s_dev;
2280 		__entry->ino	= inode->i_ino;
2281 		__entry->lblk	= es->es_lblk;
2282 		__entry->len	= es->es_len;
2283 		__entry->pblk	= ext4_es_show_pblock(es);
2284 		__entry->status	= ext4_es_status(es);
2285 	),
2286 
2287 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2288 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2289 		  (unsigned long) __entry->ino,
2290 		  __entry->lblk, __entry->len,
2291 		  __entry->pblk, show_extent_status(__entry->status))
2292 );
2293 
2294 TRACE_EVENT(ext4_es_lookup_extent_enter,
2295 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2296 
2297 	TP_ARGS(inode, lblk),
2298 
2299 	TP_STRUCT__entry(
2300 		__field(	dev_t,		dev		)
2301 		__field(	ino_t,		ino		)
2302 		__field(	ext4_lblk_t,	lblk		)
2303 	),
2304 
2305 	TP_fast_assign(
2306 		__entry->dev	= inode->i_sb->s_dev;
2307 		__entry->ino	= inode->i_ino;
2308 		__entry->lblk	= lblk;
2309 	),
2310 
2311 	TP_printk("dev %d,%d ino %lu lblk %u",
2312 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2313 		  (unsigned long) __entry->ino, __entry->lblk)
2314 );
2315 
2316 TRACE_EVENT(ext4_es_lookup_extent_exit,
2317 	TP_PROTO(struct inode *inode, struct extent_status *es,
2318 		 int found),
2319 
2320 	TP_ARGS(inode, es, found),
2321 
2322 	TP_STRUCT__entry(
2323 		__field(	dev_t,		dev		)
2324 		__field(	ino_t,		ino		)
2325 		__field(	ext4_lblk_t,	lblk		)
2326 		__field(	ext4_lblk_t,	len		)
2327 		__field(	ext4_fsblk_t,	pblk		)
2328 		__field(	char,		status		)
2329 		__field(	int,		found		)
2330 	),
2331 
2332 	TP_fast_assign(
2333 		__entry->dev	= inode->i_sb->s_dev;
2334 		__entry->ino	= inode->i_ino;
2335 		__entry->lblk	= es->es_lblk;
2336 		__entry->len	= es->es_len;
2337 		__entry->pblk	= ext4_es_show_pblock(es);
2338 		__entry->status	= ext4_es_status(es);
2339 		__entry->found	= found;
2340 	),
2341 
2342 	TP_printk("dev %d,%d ino %lu found %d [%u/%u) %llu %s",
2343 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2344 		  (unsigned long) __entry->ino, __entry->found,
2345 		  __entry->lblk, __entry->len,
2346 		  __entry->found ? __entry->pblk : 0,
2347 		  show_extent_status(__entry->found ? __entry->status : 0))
2348 );
2349 
2350 DECLARE_EVENT_CLASS(ext4__es_shrink_enter,
2351 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2352 
2353 	TP_ARGS(sb, nr_to_scan, cache_cnt),
2354 
2355 	TP_STRUCT__entry(
2356 		__field(	dev_t,	dev			)
2357 		__field(	int,	nr_to_scan		)
2358 		__field(	int,	cache_cnt		)
2359 	),
2360 
2361 	TP_fast_assign(
2362 		__entry->dev		= sb->s_dev;
2363 		__entry->nr_to_scan	= nr_to_scan;
2364 		__entry->cache_cnt	= cache_cnt;
2365 	),
2366 
2367 	TP_printk("dev %d,%d nr_to_scan %d cache_cnt %d",
2368 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2369 		  __entry->nr_to_scan, __entry->cache_cnt)
2370 );
2371 
2372 DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_count,
2373 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2374 
2375 	TP_ARGS(sb, nr_to_scan, cache_cnt)
2376 );
2377 
2378 DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_scan_enter,
2379 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2380 
2381 	TP_ARGS(sb, nr_to_scan, cache_cnt)
2382 );
2383 
2384 TRACE_EVENT(ext4_es_shrink_scan_exit,
2385 	TP_PROTO(struct super_block *sb, int nr_shrunk, int cache_cnt),
2386 
2387 	TP_ARGS(sb, nr_shrunk, cache_cnt),
2388 
2389 	TP_STRUCT__entry(
2390 		__field(	dev_t,	dev			)
2391 		__field(	int,	nr_shrunk		)
2392 		__field(	int,	cache_cnt		)
2393 	),
2394 
2395 	TP_fast_assign(
2396 		__entry->dev		= sb->s_dev;
2397 		__entry->nr_shrunk	= nr_shrunk;
2398 		__entry->cache_cnt	= cache_cnt;
2399 	),
2400 
2401 	TP_printk("dev %d,%d nr_shrunk %d cache_cnt %d",
2402 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2403 		  __entry->nr_shrunk, __entry->cache_cnt)
2404 );
2405 
2406 TRACE_EVENT(ext4_collapse_range,
2407 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2408 
2409 	TP_ARGS(inode, offset, len),
2410 
2411 	TP_STRUCT__entry(
2412 		__field(dev_t,	dev)
2413 		__field(ino_t,	ino)
2414 		__field(loff_t,	offset)
2415 		__field(loff_t, len)
2416 	),
2417 
2418 	TP_fast_assign(
2419 		__entry->dev	= inode->i_sb->s_dev;
2420 		__entry->ino	= inode->i_ino;
2421 		__entry->offset	= offset;
2422 		__entry->len	= len;
2423 	),
2424 
2425 	TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2426 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2427 		  (unsigned long) __entry->ino,
2428 		  __entry->offset, __entry->len)
2429 );
2430 
2431 TRACE_EVENT(ext4_insert_range,
2432 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2433 
2434 	TP_ARGS(inode, offset, len),
2435 
2436 	TP_STRUCT__entry(
2437 		__field(dev_t,	dev)
2438 		__field(ino_t,	ino)
2439 		__field(loff_t,	offset)
2440 		__field(loff_t, len)
2441 	),
2442 
2443 	TP_fast_assign(
2444 		__entry->dev	= inode->i_sb->s_dev;
2445 		__entry->ino	= inode->i_ino;
2446 		__entry->offset	= offset;
2447 		__entry->len	= len;
2448 	),
2449 
2450 	TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2451 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2452 		  (unsigned long) __entry->ino,
2453 		  __entry->offset, __entry->len)
2454 );
2455 
2456 TRACE_EVENT(ext4_es_shrink,
2457 	TP_PROTO(struct super_block *sb, int nr_shrunk, u64 scan_time,
2458 		 int nr_skipped, int retried),
2459 
2460 	TP_ARGS(sb, nr_shrunk, scan_time, nr_skipped, retried),
2461 
2462 	TP_STRUCT__entry(
2463 		__field(	dev_t,		dev		)
2464 		__field(	int,		nr_shrunk	)
2465 		__field(	unsigned long long, scan_time	)
2466 		__field(	int,		nr_skipped	)
2467 		__field(	int,		retried		)
2468 	),
2469 
2470 	TP_fast_assign(
2471 		__entry->dev		= sb->s_dev;
2472 		__entry->nr_shrunk	= nr_shrunk;
2473 		__entry->scan_time	= div_u64(scan_time, 1000);
2474 		__entry->nr_skipped	= nr_skipped;
2475 		__entry->retried	= retried;
2476 	),
2477 
2478 	TP_printk("dev %d,%d nr_shrunk %d, scan_time %llu "
2479 		  "nr_skipped %d retried %d",
2480 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->nr_shrunk,
2481 		  __entry->scan_time, __entry->nr_skipped, __entry->retried)
2482 );
2483 
2484 TRACE_EVENT(ext4_es_insert_delayed_block,
2485 	TP_PROTO(struct inode *inode, struct extent_status *es,
2486 		 bool allocated),
2487 
2488 	TP_ARGS(inode, es, allocated),
2489 
2490 	TP_STRUCT__entry(
2491 		__field(	dev_t,		dev		)
2492 		__field(	ino_t,		ino		)
2493 		__field(	ext4_lblk_t,	lblk		)
2494 		__field(	ext4_lblk_t,	len		)
2495 		__field(	ext4_fsblk_t,	pblk		)
2496 		__field(	char,		status		)
2497 		__field(	bool,		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->allocated	= allocated;
2508 	),
2509 
2510 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s "
2511 		  "allocated %d",
2512 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2513 		  (unsigned long) __entry->ino,
2514 		  __entry->lblk, __entry->len,
2515 		  __entry->pblk, show_extent_status(__entry->status),
2516 		  __entry->allocated)
2517 );
2518 
2519 /* fsmap traces */
2520 DECLARE_EVENT_CLASS(ext4_fsmap_class,
2521 	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len,
2522 		 u64 owner),
2523 	TP_ARGS(sb, keydev, agno, bno, len, owner),
2524 	TP_STRUCT__entry(
2525 		__field(dev_t, dev)
2526 		__field(dev_t, keydev)
2527 		__field(u32, agno)
2528 		__field(u64, bno)
2529 		__field(u64, len)
2530 		__field(u64, owner)
2531 	),
2532 	TP_fast_assign(
2533 		__entry->dev = sb->s_bdev->bd_dev;
2534 		__entry->keydev = new_decode_dev(keydev);
2535 		__entry->agno = agno;
2536 		__entry->bno = bno;
2537 		__entry->len = len;
2538 		__entry->owner = owner;
2539 	),
2540 	TP_printk("dev %d:%d keydev %d:%d agno %u bno %llu len %llu owner %lld\n",
2541 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2542 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
2543 		  __entry->agno,
2544 		  __entry->bno,
2545 		  __entry->len,
2546 		  __entry->owner)
2547 )
2548 #define DEFINE_FSMAP_EVENT(name) \
2549 DEFINE_EVENT(ext4_fsmap_class, name, \
2550 	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len, \
2551 		 u64 owner), \
2552 	TP_ARGS(sb, keydev, agno, bno, len, owner))
2553 DEFINE_FSMAP_EVENT(ext4_fsmap_low_key);
2554 DEFINE_FSMAP_EVENT(ext4_fsmap_high_key);
2555 DEFINE_FSMAP_EVENT(ext4_fsmap_mapping);
2556 
2557 DECLARE_EVENT_CLASS(ext4_getfsmap_class,
2558 	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap),
2559 	TP_ARGS(sb, fsmap),
2560 	TP_STRUCT__entry(
2561 		__field(dev_t, dev)
2562 		__field(dev_t, keydev)
2563 		__field(u64, block)
2564 		__field(u64, len)
2565 		__field(u64, owner)
2566 		__field(u64, flags)
2567 	),
2568 	TP_fast_assign(
2569 		__entry->dev = sb->s_bdev->bd_dev;
2570 		__entry->keydev = new_decode_dev(fsmap->fmr_device);
2571 		__entry->block = fsmap->fmr_physical;
2572 		__entry->len = fsmap->fmr_length;
2573 		__entry->owner = fsmap->fmr_owner;
2574 		__entry->flags = fsmap->fmr_flags;
2575 	),
2576 	TP_printk("dev %d:%d keydev %d:%d block %llu len %llu owner %lld flags 0x%llx\n",
2577 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2578 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
2579 		  __entry->block,
2580 		  __entry->len,
2581 		  __entry->owner,
2582 		  __entry->flags)
2583 )
2584 #define DEFINE_GETFSMAP_EVENT(name) \
2585 DEFINE_EVENT(ext4_getfsmap_class, name, \
2586 	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap), \
2587 	TP_ARGS(sb, fsmap))
2588 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_low_key);
2589 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_high_key);
2590 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_mapping);
2591 
2592 TRACE_EVENT(ext4_shutdown,
2593 	TP_PROTO(struct super_block *sb, unsigned long flags),
2594 
2595 	TP_ARGS(sb, flags),
2596 
2597 	TP_STRUCT__entry(
2598 		__field(	dev_t,	dev			)
2599 		__field(     unsigned,	flags			)
2600 	),
2601 
2602 	TP_fast_assign(
2603 		__entry->dev	= sb->s_dev;
2604 		__entry->flags	= flags;
2605 	),
2606 
2607 	TP_printk("dev %d,%d flags %u",
2608 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2609 		  __entry->flags)
2610 );
2611 
2612 TRACE_EVENT(ext4_error,
2613 	TP_PROTO(struct super_block *sb, const char *function,
2614 		 unsigned int line),
2615 
2616 	TP_ARGS(sb, function, line),
2617 
2618 	TP_STRUCT__entry(
2619 		__field(	dev_t,	dev			)
2620 		__field( const char *,	function		)
2621 		__field(     unsigned,	line			)
2622 	),
2623 
2624 	TP_fast_assign(
2625 		__entry->dev	= sb->s_dev;
2626 		__entry->function = function;
2627 		__entry->line	= line;
2628 	),
2629 
2630 	TP_printk("dev %d,%d function %s line %u",
2631 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2632 		  __entry->function, __entry->line)
2633 );
2634 
2635 TRACE_EVENT(ext4_prefetch_bitmaps,
2636 	    TP_PROTO(struct super_block *sb, ext4_group_t group,
2637 		     ext4_group_t next, unsigned int prefetch_ios),
2638 
2639 	TP_ARGS(sb, group, next, prefetch_ios),
2640 
2641 	TP_STRUCT__entry(
2642 		__field(	dev_t,	dev			)
2643 		__field(	__u32,	group			)
2644 		__field(	__u32,	next			)
2645 		__field(	__u32,	ios			)
2646 	),
2647 
2648 	TP_fast_assign(
2649 		__entry->dev	= sb->s_dev;
2650 		__entry->group	= group;
2651 		__entry->next	= next;
2652 		__entry->ios	= prefetch_ios;
2653 	),
2654 
2655 	TP_printk("dev %d,%d group %u next %u ios %u",
2656 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2657 		  __entry->group, __entry->next, __entry->ios)
2658 );
2659 
2660 TRACE_EVENT(ext4_lazy_itable_init,
2661 	    TP_PROTO(struct super_block *sb, ext4_group_t group),
2662 
2663 	TP_ARGS(sb, group),
2664 
2665 	TP_STRUCT__entry(
2666 		__field(	dev_t,	dev			)
2667 		__field(	__u32,	group			)
2668 	),
2669 
2670 	TP_fast_assign(
2671 		__entry->dev	= sb->s_dev;
2672 		__entry->group	= group;
2673 	),
2674 
2675 	TP_printk("dev %d,%d group %u",
2676 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->group)
2677 );
2678 
2679 TRACE_EVENT(ext4_fc_replay_scan,
2680 	TP_PROTO(struct super_block *sb, int error, int off),
2681 
2682 	TP_ARGS(sb, error, off),
2683 
2684 	TP_STRUCT__entry(
2685 		__field(dev_t, dev)
2686 		__field(int, error)
2687 		__field(int, off)
2688 	),
2689 
2690 	TP_fast_assign(
2691 		__entry->dev = sb->s_dev;
2692 		__entry->error = error;
2693 		__entry->off = off;
2694 	),
2695 
2696 	TP_printk("dev %d,%d error %d, off %d",
2697 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2698 		  __entry->error, __entry->off)
2699 );
2700 
2701 TRACE_EVENT(ext4_fc_replay,
2702 	TP_PROTO(struct super_block *sb, int tag, int ino, int priv1, int priv2),
2703 
2704 	TP_ARGS(sb, tag, ino, priv1, priv2),
2705 
2706 	TP_STRUCT__entry(
2707 		__field(dev_t, dev)
2708 		__field(int, tag)
2709 		__field(int, ino)
2710 		__field(int, priv1)
2711 		__field(int, priv2)
2712 	),
2713 
2714 	TP_fast_assign(
2715 		__entry->dev = sb->s_dev;
2716 		__entry->tag = tag;
2717 		__entry->ino = ino;
2718 		__entry->priv1 = priv1;
2719 		__entry->priv2 = priv2;
2720 	),
2721 
2722 	TP_printk("dev %d,%d: tag %d, ino %d, data1 %d, data2 %d",
2723 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2724 		  __entry->tag, __entry->ino, __entry->priv1, __entry->priv2)
2725 );
2726 
2727 TRACE_EVENT(ext4_fc_commit_start,
2728 	TP_PROTO(struct super_block *sb, tid_t commit_tid),
2729 
2730 	TP_ARGS(sb, commit_tid),
2731 
2732 	TP_STRUCT__entry(
2733 		__field(dev_t, dev)
2734 		__field(tid_t, tid)
2735 	),
2736 
2737 	TP_fast_assign(
2738 		__entry->dev = sb->s_dev;
2739 		__entry->tid = commit_tid;
2740 	),
2741 
2742 	TP_printk("dev %d,%d tid %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2743 		  __entry->tid)
2744 );
2745 
2746 TRACE_EVENT(ext4_fc_commit_stop,
2747 	    TP_PROTO(struct super_block *sb, int nblks, int reason,
2748 		     tid_t commit_tid),
2749 
2750 	TP_ARGS(sb, nblks, reason, commit_tid),
2751 
2752 	TP_STRUCT__entry(
2753 		__field(dev_t, dev)
2754 		__field(int, nblks)
2755 		__field(int, reason)
2756 		__field(int, num_fc)
2757 		__field(int, num_fc_ineligible)
2758 		__field(int, nblks_agg)
2759 		__field(tid_t, tid)
2760 	),
2761 
2762 	TP_fast_assign(
2763 		__entry->dev = sb->s_dev;
2764 		__entry->nblks = nblks;
2765 		__entry->reason = reason;
2766 		__entry->num_fc = EXT4_SB(sb)->s_fc_stats.fc_num_commits;
2767 		__entry->num_fc_ineligible =
2768 			EXT4_SB(sb)->s_fc_stats.fc_ineligible_commits;
2769 		__entry->nblks_agg = EXT4_SB(sb)->s_fc_stats.fc_numblks;
2770 		__entry->tid = commit_tid;
2771 	),
2772 
2773 	TP_printk("dev %d,%d nblks %d, reason %d, fc = %d, ineligible = %d, agg_nblks %d, tid %u",
2774 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2775 		  __entry->nblks, __entry->reason, __entry->num_fc,
2776 		  __entry->num_fc_ineligible, __entry->nblks_agg, __entry->tid)
2777 );
2778 
2779 #define FC_REASON_NAME_STAT(reason)					\
2780 	show_fc_reason(reason),						\
2781 	__entry->fc_ineligible_rc[reason]
2782 
2783 TRACE_EVENT(ext4_fc_stats,
2784 	TP_PROTO(struct super_block *sb),
2785 
2786 	TP_ARGS(sb),
2787 
2788 	TP_STRUCT__entry(
2789 		__field(dev_t, dev)
2790 		__array(unsigned int, fc_ineligible_rc, EXT4_FC_REASON_MAX)
2791 		__field(unsigned long, fc_commits)
2792 		__field(unsigned long, fc_ineligible_commits)
2793 		__field(unsigned long, fc_numblks)
2794 	),
2795 
2796 	TP_fast_assign(
2797 		int i;
2798 
2799 		__entry->dev = sb->s_dev;
2800 		for (i = 0; i < EXT4_FC_REASON_MAX; i++) {
2801 			__entry->fc_ineligible_rc[i] =
2802 				EXT4_SB(sb)->s_fc_stats.fc_ineligible_reason_count[i];
2803 		}
2804 		__entry->fc_commits = EXT4_SB(sb)->s_fc_stats.fc_num_commits;
2805 		__entry->fc_ineligible_commits =
2806 			EXT4_SB(sb)->s_fc_stats.fc_ineligible_commits;
2807 		__entry->fc_numblks = EXT4_SB(sb)->s_fc_stats.fc_numblks;
2808 	),
2809 
2810 	TP_printk("dev %d,%d fc ineligible reasons:\n"
2811 		  "%s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u, %s:%u"
2812 		  "num_commits:%lu, ineligible: %lu, numblks: %lu",
2813 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2814 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_XATTR),
2815 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_CROSS_RENAME),
2816 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_JOURNAL_FLAG_CHANGE),
2817 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_NOMEM),
2818 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_SWAP_BOOT),
2819 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_RESIZE),
2820 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_RENAME_DIR),
2821 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_FALLOC_RANGE),
2822 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_INODE_JOURNAL_DATA),
2823 		  FC_REASON_NAME_STAT(EXT4_FC_REASON_ENCRYPTED_FILENAME),
2824 		  __entry->fc_commits, __entry->fc_ineligible_commits,
2825 		  __entry->fc_numblks)
2826 );
2827 
2828 DECLARE_EVENT_CLASS(ext4_fc_track_dentry,
2829 
2830 	TP_PROTO(handle_t *handle, struct inode *inode,
2831 		 struct dentry *dentry, int ret),
2832 
2833 	TP_ARGS(handle, inode, dentry, ret),
2834 
2835 	TP_STRUCT__entry(
2836 		__field(dev_t, dev)
2837 		__field(tid_t, t_tid)
2838 		__field(ino_t, i_ino)
2839 		__field(tid_t, i_sync_tid)
2840 		__field(int, error)
2841 	),
2842 
2843 	TP_fast_assign(
2844 		struct ext4_inode_info *ei = EXT4_I(inode);
2845 
2846 		__entry->dev = inode->i_sb->s_dev;
2847 		__entry->t_tid = handle->h_transaction->t_tid;
2848 		__entry->i_ino = inode->i_ino;
2849 		__entry->i_sync_tid = ei->i_sync_tid;
2850 		__entry->error = ret;
2851 	),
2852 
2853 	TP_printk("dev %d,%d, t_tid %u, ino %lu, i_sync_tid %u, error %d",
2854 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2855 		  __entry->t_tid, __entry->i_ino, __entry->i_sync_tid,
2856 		  __entry->error
2857 	)
2858 );
2859 
2860 #define DEFINE_EVENT_CLASS_DENTRY(__type)				\
2861 DEFINE_EVENT(ext4_fc_track_dentry, ext4_fc_track_##__type,		\
2862 	TP_PROTO(handle_t *handle, struct inode *inode,			\
2863 		 struct dentry *dentry, int ret),			\
2864 	TP_ARGS(handle, inode, dentry, ret)				\
2865 )
2866 
2867 DEFINE_EVENT_CLASS_DENTRY(create);
2868 DEFINE_EVENT_CLASS_DENTRY(link);
2869 DEFINE_EVENT_CLASS_DENTRY(unlink);
2870 
2871 TRACE_EVENT(ext4_fc_track_inode,
2872 	TP_PROTO(handle_t *handle, struct inode *inode, int ret),
2873 
2874 	TP_ARGS(handle, inode, ret),
2875 
2876 	TP_STRUCT__entry(
2877 		__field(dev_t, dev)
2878 		__field(tid_t, t_tid)
2879 		__field(ino_t, i_ino)
2880 		__field(tid_t, i_sync_tid)
2881 		__field(int, error)
2882 	),
2883 
2884 	TP_fast_assign(
2885 		struct ext4_inode_info *ei = EXT4_I(inode);
2886 
2887 		__entry->dev = inode->i_sb->s_dev;
2888 		__entry->t_tid = handle->h_transaction->t_tid;
2889 		__entry->i_ino = inode->i_ino;
2890 		__entry->i_sync_tid = ei->i_sync_tid;
2891 		__entry->error = ret;
2892 	),
2893 
2894 	TP_printk("dev %d:%d, t_tid %u, inode %lu, i_sync_tid %u, error %d",
2895 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2896 		  __entry->t_tid, __entry->i_ino, __entry->i_sync_tid,
2897 		  __entry->error)
2898 	);
2899 
2900 TRACE_EVENT(ext4_fc_track_range,
2901 	TP_PROTO(handle_t *handle, struct inode *inode,
2902 		 long start, long end, int ret),
2903 
2904 	TP_ARGS(handle, inode, start, end, ret),
2905 
2906 	TP_STRUCT__entry(
2907 		__field(dev_t, dev)
2908 		__field(tid_t, t_tid)
2909 		__field(ino_t, i_ino)
2910 		__field(tid_t, i_sync_tid)
2911 		__field(long, start)
2912 		__field(long, end)
2913 		__field(int, error)
2914 	),
2915 
2916 	TP_fast_assign(
2917 		struct ext4_inode_info *ei = EXT4_I(inode);
2918 
2919 		__entry->dev = inode->i_sb->s_dev;
2920 		__entry->t_tid = handle->h_transaction->t_tid;
2921 		__entry->i_ino = inode->i_ino;
2922 		__entry->i_sync_tid = ei->i_sync_tid;
2923 		__entry->start = start;
2924 		__entry->end = end;
2925 		__entry->error = ret;
2926 	),
2927 
2928 	TP_printk("dev %d:%d, t_tid %u, inode %lu, i_sync_tid %u, error %d, start %ld, end %ld",
2929 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2930 		  __entry->t_tid, __entry->i_ino, __entry->i_sync_tid,
2931 		  __entry->error, __entry->start, __entry->end)
2932 	);
2933 
2934 TRACE_EVENT(ext4_fc_cleanup,
2935 	TP_PROTO(journal_t *journal, int full, tid_t tid),
2936 
2937 	TP_ARGS(journal, full, tid),
2938 
2939 	TP_STRUCT__entry(
2940 		__field(dev_t, dev)
2941 		__field(int, j_fc_off)
2942 		__field(int, full)
2943 		__field(tid_t, tid)
2944 	),
2945 
2946 	TP_fast_assign(
2947 		struct super_block *sb = journal->j_private;
2948 
2949 		__entry->dev = sb->s_dev;
2950 		__entry->j_fc_off = journal->j_fc_off;
2951 		__entry->full = full;
2952 		__entry->tid = tid;
2953 	),
2954 
2955 	TP_printk("dev %d,%d, j_fc_off %d, full %d, tid %u",
2956 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2957 		  __entry->j_fc_off, __entry->full, __entry->tid)
2958 	);
2959 
2960 TRACE_EVENT(ext4_update_sb,
2961 	TP_PROTO(struct super_block *sb, ext4_fsblk_t fsblk,
2962 		 unsigned int flags),
2963 
2964 	TP_ARGS(sb, fsblk, flags),
2965 
2966 	TP_STRUCT__entry(
2967 		__field(dev_t,		dev)
2968 		__field(ext4_fsblk_t,	fsblk)
2969 		__field(unsigned int,	flags)
2970 	),
2971 
2972 	TP_fast_assign(
2973 		__entry->dev	= sb->s_dev;
2974 		__entry->fsblk	= fsblk;
2975 		__entry->flags	= flags;
2976 	),
2977 
2978 	TP_printk("dev %d,%d fsblk %llu flags %u",
2979 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2980 		  __entry->fsblk, __entry->flags)
2981 );
2982 
2983 #endif /* _TRACE_EXT4_H */
2984 
2985 /* This part must be outside protection */
2986 #include <trace/define_trace.h>
2987