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