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