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