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