xref: /openbmc/linux/include/trace/events/ext4.h (revision e2bd6bad)
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 DECLARE_EVENT_CLASS(ext4__fallocate_mode,
1362 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1363 
1364 	TP_ARGS(inode, offset, len, mode),
1365 
1366 	TP_STRUCT__entry(
1367 		__field(	dev_t,	dev			)
1368 		__field(	ino_t,	ino			)
1369 		__field(	loff_t,	offset			)
1370 		__field(	loff_t, len			)
1371 		__field(	int,	mode			)
1372 	),
1373 
1374 	TP_fast_assign(
1375 		__entry->dev	= inode->i_sb->s_dev;
1376 		__entry->ino	= inode->i_ino;
1377 		__entry->offset	= offset;
1378 		__entry->len	= len;
1379 		__entry->mode	= mode;
1380 	),
1381 
1382 	TP_printk("dev %d,%d ino %lu offset %lld len %lld mode %s",
1383 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1384 		  (unsigned long) __entry->ino,
1385 		  __entry->offset, __entry->len,
1386 		  show_falloc_mode(__entry->mode))
1387 );
1388 
1389 DEFINE_EVENT(ext4__fallocate_mode, ext4_fallocate_enter,
1390 
1391 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1392 
1393 	TP_ARGS(inode, offset, len, mode)
1394 );
1395 
1396 DEFINE_EVENT(ext4__fallocate_mode, ext4_punch_hole,
1397 
1398 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1399 
1400 	TP_ARGS(inode, offset, len, mode)
1401 );
1402 
1403 DEFINE_EVENT(ext4__fallocate_mode, ext4_zero_range,
1404 
1405 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1406 
1407 	TP_ARGS(inode, offset, len, mode)
1408 );
1409 
1410 TRACE_EVENT(ext4_fallocate_exit,
1411 	TP_PROTO(struct inode *inode, loff_t offset,
1412 		 unsigned int max_blocks, int ret),
1413 
1414 	TP_ARGS(inode, offset, max_blocks, ret),
1415 
1416 	TP_STRUCT__entry(
1417 		__field(	dev_t,	dev			)
1418 		__field(	ino_t,	ino			)
1419 		__field(	loff_t,	pos			)
1420 		__field(	unsigned int,	blocks		)
1421 		__field(	int, 	ret			)
1422 	),
1423 
1424 	TP_fast_assign(
1425 		__entry->dev	= inode->i_sb->s_dev;
1426 		__entry->ino	= inode->i_ino;
1427 		__entry->pos	= offset;
1428 		__entry->blocks	= max_blocks;
1429 		__entry->ret	= ret;
1430 	),
1431 
1432 	TP_printk("dev %d,%d ino %lu pos %lld blocks %u ret %d",
1433 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1434 		  (unsigned long) __entry->ino,
1435 		  __entry->pos, __entry->blocks,
1436 		  __entry->ret)
1437 );
1438 
1439 TRACE_EVENT(ext4_unlink_enter,
1440 	TP_PROTO(struct inode *parent, struct dentry *dentry),
1441 
1442 	TP_ARGS(parent, dentry),
1443 
1444 	TP_STRUCT__entry(
1445 		__field(	dev_t,	dev			)
1446 		__field(	ino_t,	ino			)
1447 		__field(	ino_t,	parent			)
1448 		__field(	loff_t,	size			)
1449 	),
1450 
1451 	TP_fast_assign(
1452 		__entry->dev		= dentry->d_sb->s_dev;
1453 		__entry->ino		= d_inode(dentry)->i_ino;
1454 		__entry->parent		= parent->i_ino;
1455 		__entry->size		= d_inode(dentry)->i_size;
1456 	),
1457 
1458 	TP_printk("dev %d,%d ino %lu size %lld parent %lu",
1459 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1460 		  (unsigned long) __entry->ino, __entry->size,
1461 		  (unsigned long) __entry->parent)
1462 );
1463 
1464 TRACE_EVENT(ext4_unlink_exit,
1465 	TP_PROTO(struct dentry *dentry, int ret),
1466 
1467 	TP_ARGS(dentry, ret),
1468 
1469 	TP_STRUCT__entry(
1470 		__field(	dev_t,	dev			)
1471 		__field(	ino_t,	ino			)
1472 		__field(	int,	ret			)
1473 	),
1474 
1475 	TP_fast_assign(
1476 		__entry->dev		= dentry->d_sb->s_dev;
1477 		__entry->ino		= d_inode(dentry)->i_ino;
1478 		__entry->ret		= ret;
1479 	),
1480 
1481 	TP_printk("dev %d,%d ino %lu ret %d",
1482 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1483 		  (unsigned long) __entry->ino,
1484 		  __entry->ret)
1485 );
1486 
1487 DECLARE_EVENT_CLASS(ext4__truncate,
1488 	TP_PROTO(struct inode *inode),
1489 
1490 	TP_ARGS(inode),
1491 
1492 	TP_STRUCT__entry(
1493 		__field(	dev_t,		dev		)
1494 		__field(	ino_t,		ino		)
1495 		__field(	__u64,		blocks		)
1496 	),
1497 
1498 	TP_fast_assign(
1499 		__entry->dev    = inode->i_sb->s_dev;
1500 		__entry->ino    = inode->i_ino;
1501 		__entry->blocks	= inode->i_blocks;
1502 	),
1503 
1504 	TP_printk("dev %d,%d ino %lu blocks %llu",
1505 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1506 		  (unsigned long) __entry->ino, __entry->blocks)
1507 );
1508 
1509 DEFINE_EVENT(ext4__truncate, ext4_truncate_enter,
1510 
1511 	TP_PROTO(struct inode *inode),
1512 
1513 	TP_ARGS(inode)
1514 );
1515 
1516 DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,
1517 
1518 	TP_PROTO(struct inode *inode),
1519 
1520 	TP_ARGS(inode)
1521 );
1522 
1523 /* 'ux' is the unwritten extent. */
1524 TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1525 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1526 		 struct ext4_extent *ux),
1527 
1528 	TP_ARGS(inode, map, ux),
1529 
1530 	TP_STRUCT__entry(
1531 		__field(	dev_t,		dev	)
1532 		__field(	ino_t,		ino	)
1533 		__field(	ext4_lblk_t,	m_lblk	)
1534 		__field(	unsigned,	m_len	)
1535 		__field(	ext4_lblk_t,	u_lblk	)
1536 		__field(	unsigned,	u_len	)
1537 		__field(	ext4_fsblk_t,	u_pblk	)
1538 	),
1539 
1540 	TP_fast_assign(
1541 		__entry->dev		= inode->i_sb->s_dev;
1542 		__entry->ino		= inode->i_ino;
1543 		__entry->m_lblk		= map->m_lblk;
1544 		__entry->m_len		= map->m_len;
1545 		__entry->u_lblk		= le32_to_cpu(ux->ee_block);
1546 		__entry->u_len		= ext4_ext_get_actual_len(ux);
1547 		__entry->u_pblk		= ext4_ext_pblock(ux);
1548 	),
1549 
1550 	TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u u_lblk %u u_len %u "
1551 		  "u_pblk %llu",
1552 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1553 		  (unsigned long) __entry->ino,
1554 		  __entry->m_lblk, __entry->m_len,
1555 		  __entry->u_lblk, __entry->u_len, __entry->u_pblk)
1556 );
1557 
1558 /*
1559  * 'ux' is the unwritten extent.
1560  * 'ix' is the initialized extent to which blocks are transferred.
1561  */
1562 TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
1563 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1564 		 struct ext4_extent *ux, struct ext4_extent *ix),
1565 
1566 	TP_ARGS(inode, map, ux, ix),
1567 
1568 	TP_STRUCT__entry(
1569 		__field(	dev_t,		dev	)
1570 		__field(	ino_t,		ino	)
1571 		__field(	ext4_lblk_t,	m_lblk	)
1572 		__field(	unsigned,	m_len	)
1573 		__field(	ext4_lblk_t,	u_lblk	)
1574 		__field(	unsigned,	u_len	)
1575 		__field(	ext4_fsblk_t,	u_pblk	)
1576 		__field(	ext4_lblk_t,	i_lblk	)
1577 		__field(	unsigned,	i_len	)
1578 		__field(	ext4_fsblk_t,	i_pblk	)
1579 	),
1580 
1581 	TP_fast_assign(
1582 		__entry->dev		= inode->i_sb->s_dev;
1583 		__entry->ino		= inode->i_ino;
1584 		__entry->m_lblk		= map->m_lblk;
1585 		__entry->m_len		= map->m_len;
1586 		__entry->u_lblk		= le32_to_cpu(ux->ee_block);
1587 		__entry->u_len		= ext4_ext_get_actual_len(ux);
1588 		__entry->u_pblk		= ext4_ext_pblock(ux);
1589 		__entry->i_lblk		= le32_to_cpu(ix->ee_block);
1590 		__entry->i_len		= ext4_ext_get_actual_len(ix);
1591 		__entry->i_pblk		= ext4_ext_pblock(ix);
1592 	),
1593 
1594 	TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u "
1595 		  "u_lblk %u u_len %u u_pblk %llu "
1596 		  "i_lblk %u i_len %u i_pblk %llu ",
1597 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1598 		  (unsigned long) __entry->ino,
1599 		  __entry->m_lblk, __entry->m_len,
1600 		  __entry->u_lblk, __entry->u_len, __entry->u_pblk,
1601 		  __entry->i_lblk, __entry->i_len, __entry->i_pblk)
1602 );
1603 
1604 DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
1605 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1606 		 unsigned int len, unsigned int flags),
1607 
1608 	TP_ARGS(inode, lblk, len, flags),
1609 
1610 	TP_STRUCT__entry(
1611 		__field(	dev_t,		dev		)
1612 		__field(	ino_t,		ino		)
1613 		__field(	ext4_lblk_t,	lblk		)
1614 		__field(	unsigned int,	len		)
1615 		__field(	unsigned int,	flags		)
1616 	),
1617 
1618 	TP_fast_assign(
1619 		__entry->dev    = inode->i_sb->s_dev;
1620 		__entry->ino    = inode->i_ino;
1621 		__entry->lblk	= lblk;
1622 		__entry->len	= len;
1623 		__entry->flags	= flags;
1624 	),
1625 
1626 	TP_printk("dev %d,%d ino %lu lblk %u len %u flags %s",
1627 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1628 		  (unsigned long) __entry->ino,
1629 		  __entry->lblk, __entry->len, show_map_flags(__entry->flags))
1630 );
1631 
1632 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter,
1633 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1634 		 unsigned len, unsigned flags),
1635 
1636 	TP_ARGS(inode, lblk, len, flags)
1637 );
1638 
1639 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
1640 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1641 		 unsigned len, unsigned flags),
1642 
1643 	TP_ARGS(inode, lblk, len, flags)
1644 );
1645 
1646 DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1647 	TP_PROTO(struct inode *inode, unsigned flags, struct ext4_map_blocks *map,
1648 		 int ret),
1649 
1650 	TP_ARGS(inode, flags, map, ret),
1651 
1652 	TP_STRUCT__entry(
1653 		__field(	dev_t,		dev		)
1654 		__field(	ino_t,		ino		)
1655 		__field(	unsigned int,	flags		)
1656 		__field(	ext4_fsblk_t,	pblk		)
1657 		__field(	ext4_lblk_t,	lblk		)
1658 		__field(	unsigned int,	len		)
1659 		__field(	unsigned int,	mflags		)
1660 		__field(	int,		ret		)
1661 	),
1662 
1663 	TP_fast_assign(
1664 		__entry->dev    = inode->i_sb->s_dev;
1665 		__entry->ino    = inode->i_ino;
1666 		__entry->flags	= flags;
1667 		__entry->pblk	= map->m_pblk;
1668 		__entry->lblk	= map->m_lblk;
1669 		__entry->len	= map->m_len;
1670 		__entry->mflags	= map->m_flags;
1671 		__entry->ret	= ret;
1672 	),
1673 
1674 	TP_printk("dev %d,%d ino %lu flags %s lblk %u pblk %llu len %u "
1675 		  "mflags %s ret %d",
1676 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1677 		  (unsigned long) __entry->ino,
1678 		  show_map_flags(__entry->flags), __entry->lblk, __entry->pblk,
1679 		  __entry->len, show_mflags(__entry->mflags), __entry->ret)
1680 );
1681 
1682 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1683 	TP_PROTO(struct inode *inode, unsigned flags,
1684 		 struct ext4_map_blocks *map, int ret),
1685 
1686 	TP_ARGS(inode, flags, map, ret)
1687 );
1688 
1689 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1690 	TP_PROTO(struct inode *inode, unsigned flags,
1691 		 struct ext4_map_blocks *map, int ret),
1692 
1693 	TP_ARGS(inode, flags, map, ret)
1694 );
1695 
1696 TRACE_EVENT(ext4_ext_load_extent,
1697 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk),
1698 
1699 	TP_ARGS(inode, lblk, pblk),
1700 
1701 	TP_STRUCT__entry(
1702 		__field(	dev_t,		dev		)
1703 		__field(	ino_t,		ino		)
1704 		__field(	ext4_fsblk_t,	pblk		)
1705 		__field(	ext4_lblk_t,	lblk		)
1706 	),
1707 
1708 	TP_fast_assign(
1709 		__entry->dev    = inode->i_sb->s_dev;
1710 		__entry->ino    = inode->i_ino;
1711 		__entry->pblk	= pblk;
1712 		__entry->lblk	= lblk;
1713 	),
1714 
1715 	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
1716 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1717 		  (unsigned long) __entry->ino,
1718 		  __entry->lblk, __entry->pblk)
1719 );
1720 
1721 TRACE_EVENT(ext4_load_inode,
1722 	TP_PROTO(struct super_block *sb, unsigned long ino),
1723 
1724 	TP_ARGS(sb, ino),
1725 
1726 	TP_STRUCT__entry(
1727 		__field(	dev_t,	dev		)
1728 		__field(	ino_t,	ino		)
1729 	),
1730 
1731 	TP_fast_assign(
1732 		__entry->dev		= sb->s_dev;
1733 		__entry->ino		= ino;
1734 	),
1735 
1736 	TP_printk("dev %d,%d ino %ld",
1737 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1738 		  (unsigned long) __entry->ino)
1739 );
1740 
1741 TRACE_EVENT(ext4_journal_start,
1742 	TP_PROTO(struct super_block *sb, int blocks, int rsv_blocks,
1743 		 int revoke_creds, unsigned long IP),
1744 
1745 	TP_ARGS(sb, blocks, rsv_blocks, revoke_creds, IP),
1746 
1747 	TP_STRUCT__entry(
1748 		__field(	dev_t,	dev			)
1749 		__field(unsigned long,	ip			)
1750 		__field(	  int,	blocks			)
1751 		__field(	  int,	rsv_blocks		)
1752 		__field(	  int,	revoke_creds		)
1753 	),
1754 
1755 	TP_fast_assign(
1756 		__entry->dev		 = sb->s_dev;
1757 		__entry->ip		 = IP;
1758 		__entry->blocks		 = blocks;
1759 		__entry->rsv_blocks	 = rsv_blocks;
1760 		__entry->revoke_creds	 = revoke_creds;
1761 	),
1762 
1763 	TP_printk("dev %d,%d blocks %d, rsv_blocks %d, revoke_creds %d, "
1764 		  "caller %pS", MAJOR(__entry->dev), MINOR(__entry->dev),
1765 		  __entry->blocks, __entry->rsv_blocks, __entry->revoke_creds,
1766 		  (void *)__entry->ip)
1767 );
1768 
1769 TRACE_EVENT(ext4_journal_start_reserved,
1770 	TP_PROTO(struct super_block *sb, int blocks, unsigned long IP),
1771 
1772 	TP_ARGS(sb, blocks, IP),
1773 
1774 	TP_STRUCT__entry(
1775 		__field(	dev_t,	dev			)
1776 		__field(unsigned long,	ip			)
1777 		__field(	  int,	blocks			)
1778 	),
1779 
1780 	TP_fast_assign(
1781 		__entry->dev		 = sb->s_dev;
1782 		__entry->ip		 = IP;
1783 		__entry->blocks		 = blocks;
1784 	),
1785 
1786 	TP_printk("dev %d,%d blocks, %d caller %pS",
1787 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1788 		  __entry->blocks, (void *)__entry->ip)
1789 );
1790 
1791 DECLARE_EVENT_CLASS(ext4__trim,
1792 	TP_PROTO(struct super_block *sb,
1793 		 ext4_group_t group,
1794 		 ext4_grpblk_t start,
1795 		 ext4_grpblk_t len),
1796 
1797 	TP_ARGS(sb, group, start, len),
1798 
1799 	TP_STRUCT__entry(
1800 		__field(	int,	dev_major		)
1801 		__field(	int,	dev_minor		)
1802 		__field(	__u32, 	group			)
1803 		__field(	int,	start			)
1804 		__field(	int,	len			)
1805 	),
1806 
1807 	TP_fast_assign(
1808 		__entry->dev_major	= MAJOR(sb->s_dev);
1809 		__entry->dev_minor	= MINOR(sb->s_dev);
1810 		__entry->group		= group;
1811 		__entry->start		= start;
1812 		__entry->len		= len;
1813 	),
1814 
1815 	TP_printk("dev %d,%d group %u, start %d, len %d",
1816 		  __entry->dev_major, __entry->dev_minor,
1817 		  __entry->group, __entry->start, __entry->len)
1818 );
1819 
1820 DEFINE_EVENT(ext4__trim, ext4_trim_extent,
1821 
1822 	TP_PROTO(struct super_block *sb,
1823 		 ext4_group_t group,
1824 		 ext4_grpblk_t start,
1825 		 ext4_grpblk_t len),
1826 
1827 	TP_ARGS(sb, group, start, len)
1828 );
1829 
1830 DEFINE_EVENT(ext4__trim, ext4_trim_all_free,
1831 
1832 	TP_PROTO(struct super_block *sb,
1833 		 ext4_group_t group,
1834 		 ext4_grpblk_t start,
1835 		 ext4_grpblk_t len),
1836 
1837 	TP_ARGS(sb, group, start, len)
1838 );
1839 
1840 TRACE_EVENT(ext4_ext_handle_unwritten_extents,
1841 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1842 		 unsigned int allocated, ext4_fsblk_t newblock),
1843 
1844 	TP_ARGS(inode, map, flags, allocated, newblock),
1845 
1846 	TP_STRUCT__entry(
1847 		__field(	dev_t,		dev		)
1848 		__field(	ino_t,		ino		)
1849 		__field(	int,		flags		)
1850 		__field(	ext4_lblk_t,	lblk		)
1851 		__field(	ext4_fsblk_t,	pblk		)
1852 		__field(	unsigned int,	len		)
1853 		__field(	unsigned int,	allocated	)
1854 		__field(	ext4_fsblk_t,	newblk		)
1855 	),
1856 
1857 	TP_fast_assign(
1858 		__entry->dev		= inode->i_sb->s_dev;
1859 		__entry->ino		= inode->i_ino;
1860 		__entry->flags		= flags;
1861 		__entry->lblk		= map->m_lblk;
1862 		__entry->pblk		= map->m_pblk;
1863 		__entry->len		= map->m_len;
1864 		__entry->allocated	= allocated;
1865 		__entry->newblk		= newblock;
1866 	),
1867 
1868 	TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %s "
1869 		  "allocated %d newblock %llu",
1870 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1871 		  (unsigned long) __entry->ino,
1872 		  (unsigned) __entry->lblk, (unsigned long long) __entry->pblk,
1873 		  __entry->len, show_map_flags(__entry->flags),
1874 		  (unsigned int) __entry->allocated,
1875 		  (unsigned long long) __entry->newblk)
1876 );
1877 
1878 TRACE_EVENT(ext4_get_implied_cluster_alloc_exit,
1879 	TP_PROTO(struct super_block *sb, struct ext4_map_blocks *map, int ret),
1880 
1881 	TP_ARGS(sb, map, ret),
1882 
1883 	TP_STRUCT__entry(
1884 		__field(	dev_t,		dev	)
1885 		__field(	unsigned int,	flags	)
1886 		__field(	ext4_lblk_t,	lblk	)
1887 		__field(	ext4_fsblk_t,	pblk	)
1888 		__field(	unsigned int,	len	)
1889 		__field(	int,		ret	)
1890 	),
1891 
1892 	TP_fast_assign(
1893 		__entry->dev	= sb->s_dev;
1894 		__entry->flags	= map->m_flags;
1895 		__entry->lblk	= map->m_lblk;
1896 		__entry->pblk	= map->m_pblk;
1897 		__entry->len	= map->m_len;
1898 		__entry->ret	= ret;
1899 	),
1900 
1901 	TP_printk("dev %d,%d m_lblk %u m_pblk %llu m_len %u m_flags %s ret %d",
1902 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1903 		  __entry->lblk, (unsigned long long) __entry->pblk,
1904 		  __entry->len, show_mflags(__entry->flags), __entry->ret)
1905 );
1906 
1907 TRACE_EVENT(ext4_ext_show_extent,
1908 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk,
1909 		 unsigned short len),
1910 
1911 	TP_ARGS(inode, lblk, pblk, len),
1912 
1913 	TP_STRUCT__entry(
1914 		__field(	dev_t,		dev	)
1915 		__field(	ino_t,		ino	)
1916 		__field(	ext4_fsblk_t,	pblk	)
1917 		__field(	ext4_lblk_t,	lblk	)
1918 		__field(	unsigned short,	len	)
1919 	),
1920 
1921 	TP_fast_assign(
1922 		__entry->dev	= inode->i_sb->s_dev;
1923 		__entry->ino	= inode->i_ino;
1924 		__entry->pblk	= pblk;
1925 		__entry->lblk	= lblk;
1926 		__entry->len	= len;
1927 	),
1928 
1929 	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u",
1930 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1931 		  (unsigned long) __entry->ino,
1932 		  (unsigned) __entry->lblk,
1933 		  (unsigned long long) __entry->pblk,
1934 		  (unsigned short) __entry->len)
1935 );
1936 
1937 TRACE_EVENT(ext4_remove_blocks,
1938 	TP_PROTO(struct inode *inode, struct ext4_extent *ex,
1939 		 ext4_lblk_t from, ext4_fsblk_t to,
1940 		 struct partial_cluster *pc),
1941 
1942 	TP_ARGS(inode, ex, from, to, pc),
1943 
1944 	TP_STRUCT__entry(
1945 		__field(	dev_t,		dev	)
1946 		__field(	ino_t,		ino	)
1947 		__field(	ext4_lblk_t,	from	)
1948 		__field(	ext4_lblk_t,	to	)
1949 		__field(	ext4_fsblk_t,	ee_pblk	)
1950 		__field(	ext4_lblk_t,	ee_lblk	)
1951 		__field(	unsigned short,	ee_len	)
1952 		__field(	ext4_fsblk_t,	pc_pclu	)
1953 		__field(	ext4_lblk_t,	pc_lblk	)
1954 		__field(	int,		pc_state)
1955 	),
1956 
1957 	TP_fast_assign(
1958 		__entry->dev		= inode->i_sb->s_dev;
1959 		__entry->ino		= inode->i_ino;
1960 		__entry->from		= from;
1961 		__entry->to		= to;
1962 		__entry->ee_pblk	= ext4_ext_pblock(ex);
1963 		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
1964 		__entry->ee_len		= ext4_ext_get_actual_len(ex);
1965 		__entry->pc_pclu	= pc->pclu;
1966 		__entry->pc_lblk	= pc->lblk;
1967 		__entry->pc_state	= pc->state;
1968 	),
1969 
1970 	TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]"
1971 		  "from %u to %u partial [pclu %lld lblk %u state %d]",
1972 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1973 		  (unsigned long) __entry->ino,
1974 		  (unsigned) __entry->ee_lblk,
1975 		  (unsigned long long) __entry->ee_pblk,
1976 		  (unsigned short) __entry->ee_len,
1977 		  (unsigned) __entry->from,
1978 		  (unsigned) __entry->to,
1979 		  (long long) __entry->pc_pclu,
1980 		  (unsigned int) __entry->pc_lblk,
1981 		  (int) __entry->pc_state)
1982 );
1983 
1984 TRACE_EVENT(ext4_ext_rm_leaf,
1985 	TP_PROTO(struct inode *inode, ext4_lblk_t start,
1986 		 struct ext4_extent *ex,
1987 		 struct partial_cluster *pc),
1988 
1989 	TP_ARGS(inode, start, ex, pc),
1990 
1991 	TP_STRUCT__entry(
1992 		__field(	dev_t,		dev	)
1993 		__field(	ino_t,		ino	)
1994 		__field(	ext4_lblk_t,	start	)
1995 		__field(	ext4_lblk_t,	ee_lblk	)
1996 		__field(	ext4_fsblk_t,	ee_pblk	)
1997 		__field(	short,		ee_len	)
1998 		__field(	ext4_fsblk_t,	pc_pclu	)
1999 		__field(	ext4_lblk_t,	pc_lblk	)
2000 		__field(	int,		pc_state)
2001 	),
2002 
2003 	TP_fast_assign(
2004 		__entry->dev		= inode->i_sb->s_dev;
2005 		__entry->ino		= inode->i_ino;
2006 		__entry->start		= start;
2007 		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
2008 		__entry->ee_pblk	= ext4_ext_pblock(ex);
2009 		__entry->ee_len		= ext4_ext_get_actual_len(ex);
2010 		__entry->pc_pclu	= pc->pclu;
2011 		__entry->pc_lblk	= pc->lblk;
2012 		__entry->pc_state	= pc->state;
2013 	),
2014 
2015 	TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]"
2016 		  "partial [pclu %lld lblk %u state %d]",
2017 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2018 		  (unsigned long) __entry->ino,
2019 		  (unsigned) __entry->start,
2020 		  (unsigned) __entry->ee_lblk,
2021 		  (unsigned long long) __entry->ee_pblk,
2022 		  (unsigned short) __entry->ee_len,
2023 		  (long long) __entry->pc_pclu,
2024 		  (unsigned int) __entry->pc_lblk,
2025 		  (int) __entry->pc_state)
2026 );
2027 
2028 TRACE_EVENT(ext4_ext_rm_idx,
2029 	TP_PROTO(struct inode *inode, ext4_fsblk_t pblk),
2030 
2031 	TP_ARGS(inode, pblk),
2032 
2033 	TP_STRUCT__entry(
2034 		__field(	dev_t,		dev	)
2035 		__field(	ino_t,		ino	)
2036 		__field(	ext4_fsblk_t,	pblk	)
2037 	),
2038 
2039 	TP_fast_assign(
2040 		__entry->dev	= inode->i_sb->s_dev;
2041 		__entry->ino	= inode->i_ino;
2042 		__entry->pblk	= pblk;
2043 	),
2044 
2045 	TP_printk("dev %d,%d ino %lu index_pblk %llu",
2046 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2047 		  (unsigned long) __entry->ino,
2048 		  (unsigned long long) __entry->pblk)
2049 );
2050 
2051 TRACE_EVENT(ext4_ext_remove_space,
2052 	TP_PROTO(struct inode *inode, ext4_lblk_t start,
2053 		 ext4_lblk_t end, int depth),
2054 
2055 	TP_ARGS(inode, start, end, depth),
2056 
2057 	TP_STRUCT__entry(
2058 		__field(	dev_t,		dev	)
2059 		__field(	ino_t,		ino	)
2060 		__field(	ext4_lblk_t,	start	)
2061 		__field(	ext4_lblk_t,	end	)
2062 		__field(	int,		depth	)
2063 	),
2064 
2065 	TP_fast_assign(
2066 		__entry->dev	= inode->i_sb->s_dev;
2067 		__entry->ino	= inode->i_ino;
2068 		__entry->start	= start;
2069 		__entry->end	= end;
2070 		__entry->depth	= depth;
2071 	),
2072 
2073 	TP_printk("dev %d,%d ino %lu since %u end %u depth %d",
2074 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2075 		  (unsigned long) __entry->ino,
2076 		  (unsigned) __entry->start,
2077 		  (unsigned) __entry->end,
2078 		  __entry->depth)
2079 );
2080 
2081 TRACE_EVENT(ext4_ext_remove_space_done,
2082 	TP_PROTO(struct inode *inode, ext4_lblk_t start, ext4_lblk_t end,
2083 		 int depth, struct partial_cluster *pc, __le16 eh_entries),
2084 
2085 	TP_ARGS(inode, start, end, depth, pc, eh_entries),
2086 
2087 	TP_STRUCT__entry(
2088 		__field(	dev_t,		dev		)
2089 		__field(	ino_t,		ino		)
2090 		__field(	ext4_lblk_t,	start		)
2091 		__field(	ext4_lblk_t,	end		)
2092 		__field(	int,		depth		)
2093 		__field(	ext4_fsblk_t,	pc_pclu		)
2094 		__field(	ext4_lblk_t,	pc_lblk		)
2095 		__field(	int,		pc_state	)
2096 		__field(	unsigned short,	eh_entries	)
2097 	),
2098 
2099 	TP_fast_assign(
2100 		__entry->dev		= inode->i_sb->s_dev;
2101 		__entry->ino		= inode->i_ino;
2102 		__entry->start		= start;
2103 		__entry->end		= end;
2104 		__entry->depth		= depth;
2105 		__entry->pc_pclu	= pc->pclu;
2106 		__entry->pc_lblk	= pc->lblk;
2107 		__entry->pc_state	= pc->state;
2108 		__entry->eh_entries	= le16_to_cpu(eh_entries);
2109 	),
2110 
2111 	TP_printk("dev %d,%d ino %lu since %u end %u depth %d "
2112 		  "partial [pclu %lld lblk %u state %d] "
2113 		  "remaining_entries %u",
2114 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2115 		  (unsigned long) __entry->ino,
2116 		  (unsigned) __entry->start,
2117 		  (unsigned) __entry->end,
2118 		  __entry->depth,
2119 		  (long long) __entry->pc_pclu,
2120 		  (unsigned int) __entry->pc_lblk,
2121 		  (int) __entry->pc_state,
2122 		  (unsigned short) __entry->eh_entries)
2123 );
2124 
2125 DECLARE_EVENT_CLASS(ext4__es_extent,
2126 	TP_PROTO(struct inode *inode, struct extent_status *es),
2127 
2128 	TP_ARGS(inode, es),
2129 
2130 	TP_STRUCT__entry(
2131 		__field(	dev_t,		dev		)
2132 		__field(	ino_t,		ino		)
2133 		__field(	ext4_lblk_t,	lblk		)
2134 		__field(	ext4_lblk_t,	len		)
2135 		__field(	ext4_fsblk_t,	pblk		)
2136 		__field(	char, status	)
2137 	),
2138 
2139 	TP_fast_assign(
2140 		__entry->dev	= inode->i_sb->s_dev;
2141 		__entry->ino	= inode->i_ino;
2142 		__entry->lblk	= es->es_lblk;
2143 		__entry->len	= es->es_len;
2144 		__entry->pblk	= ext4_es_show_pblock(es);
2145 		__entry->status	= ext4_es_status(es);
2146 	),
2147 
2148 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2149 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2150 		  (unsigned long) __entry->ino,
2151 		  __entry->lblk, __entry->len,
2152 		  __entry->pblk, show_extent_status(__entry->status))
2153 );
2154 
2155 DEFINE_EVENT(ext4__es_extent, ext4_es_insert_extent,
2156 	TP_PROTO(struct inode *inode, struct extent_status *es),
2157 
2158 	TP_ARGS(inode, es)
2159 );
2160 
2161 DEFINE_EVENT(ext4__es_extent, ext4_es_cache_extent,
2162 	TP_PROTO(struct inode *inode, struct extent_status *es),
2163 
2164 	TP_ARGS(inode, es)
2165 );
2166 
2167 TRACE_EVENT(ext4_es_remove_extent,
2168 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t len),
2169 
2170 	TP_ARGS(inode, lblk, len),
2171 
2172 	TP_STRUCT__entry(
2173 		__field(	dev_t,	dev			)
2174 		__field(	ino_t,	ino			)
2175 		__field(	loff_t,	lblk			)
2176 		__field(	loff_t,	len			)
2177 	),
2178 
2179 	TP_fast_assign(
2180 		__entry->dev	= inode->i_sb->s_dev;
2181 		__entry->ino	= inode->i_ino;
2182 		__entry->lblk	= lblk;
2183 		__entry->len	= len;
2184 	),
2185 
2186 	TP_printk("dev %d,%d ino %lu es [%lld/%lld)",
2187 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2188 		  (unsigned long) __entry->ino,
2189 		  __entry->lblk, __entry->len)
2190 );
2191 
2192 TRACE_EVENT(ext4_es_find_extent_range_enter,
2193 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2194 
2195 	TP_ARGS(inode, lblk),
2196 
2197 	TP_STRUCT__entry(
2198 		__field(	dev_t,		dev		)
2199 		__field(	ino_t,		ino		)
2200 		__field(	ext4_lblk_t,	lblk		)
2201 	),
2202 
2203 	TP_fast_assign(
2204 		__entry->dev	= inode->i_sb->s_dev;
2205 		__entry->ino	= inode->i_ino;
2206 		__entry->lblk	= lblk;
2207 	),
2208 
2209 	TP_printk("dev %d,%d ino %lu lblk %u",
2210 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2211 		  (unsigned long) __entry->ino, __entry->lblk)
2212 );
2213 
2214 TRACE_EVENT(ext4_es_find_extent_range_exit,
2215 	TP_PROTO(struct inode *inode, struct extent_status *es),
2216 
2217 	TP_ARGS(inode, es),
2218 
2219 	TP_STRUCT__entry(
2220 		__field(	dev_t,		dev		)
2221 		__field(	ino_t,		ino		)
2222 		__field(	ext4_lblk_t,	lblk		)
2223 		__field(	ext4_lblk_t,	len		)
2224 		__field(	ext4_fsblk_t,	pblk		)
2225 		__field(	char, status	)
2226 	),
2227 
2228 	TP_fast_assign(
2229 		__entry->dev	= inode->i_sb->s_dev;
2230 		__entry->ino	= inode->i_ino;
2231 		__entry->lblk	= es->es_lblk;
2232 		__entry->len	= es->es_len;
2233 		__entry->pblk	= ext4_es_show_pblock(es);
2234 		__entry->status	= ext4_es_status(es);
2235 	),
2236 
2237 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2238 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2239 		  (unsigned long) __entry->ino,
2240 		  __entry->lblk, __entry->len,
2241 		  __entry->pblk, show_extent_status(__entry->status))
2242 );
2243 
2244 TRACE_EVENT(ext4_es_lookup_extent_enter,
2245 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2246 
2247 	TP_ARGS(inode, lblk),
2248 
2249 	TP_STRUCT__entry(
2250 		__field(	dev_t,		dev		)
2251 		__field(	ino_t,		ino		)
2252 		__field(	ext4_lblk_t,	lblk		)
2253 	),
2254 
2255 	TP_fast_assign(
2256 		__entry->dev	= inode->i_sb->s_dev;
2257 		__entry->ino	= inode->i_ino;
2258 		__entry->lblk	= lblk;
2259 	),
2260 
2261 	TP_printk("dev %d,%d ino %lu lblk %u",
2262 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2263 		  (unsigned long) __entry->ino, __entry->lblk)
2264 );
2265 
2266 TRACE_EVENT(ext4_es_lookup_extent_exit,
2267 	TP_PROTO(struct inode *inode, struct extent_status *es,
2268 		 int found),
2269 
2270 	TP_ARGS(inode, es, found),
2271 
2272 	TP_STRUCT__entry(
2273 		__field(	dev_t,		dev		)
2274 		__field(	ino_t,		ino		)
2275 		__field(	ext4_lblk_t,	lblk		)
2276 		__field(	ext4_lblk_t,	len		)
2277 		__field(	ext4_fsblk_t,	pblk		)
2278 		__field(	char,		status		)
2279 		__field(	int,		found		)
2280 	),
2281 
2282 	TP_fast_assign(
2283 		__entry->dev	= inode->i_sb->s_dev;
2284 		__entry->ino	= inode->i_ino;
2285 		__entry->lblk	= es->es_lblk;
2286 		__entry->len	= es->es_len;
2287 		__entry->pblk	= ext4_es_show_pblock(es);
2288 		__entry->status	= ext4_es_status(es);
2289 		__entry->found	= found;
2290 	),
2291 
2292 	TP_printk("dev %d,%d ino %lu found %d [%u/%u) %llu %s",
2293 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2294 		  (unsigned long) __entry->ino, __entry->found,
2295 		  __entry->lblk, __entry->len,
2296 		  __entry->found ? __entry->pblk : 0,
2297 		  show_extent_status(__entry->found ? __entry->status : 0))
2298 );
2299 
2300 DECLARE_EVENT_CLASS(ext4__es_shrink_enter,
2301 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2302 
2303 	TP_ARGS(sb, nr_to_scan, cache_cnt),
2304 
2305 	TP_STRUCT__entry(
2306 		__field(	dev_t,	dev			)
2307 		__field(	int,	nr_to_scan		)
2308 		__field(	int,	cache_cnt		)
2309 	),
2310 
2311 	TP_fast_assign(
2312 		__entry->dev		= sb->s_dev;
2313 		__entry->nr_to_scan	= nr_to_scan;
2314 		__entry->cache_cnt	= cache_cnt;
2315 	),
2316 
2317 	TP_printk("dev %d,%d nr_to_scan %d cache_cnt %d",
2318 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2319 		  __entry->nr_to_scan, __entry->cache_cnt)
2320 );
2321 
2322 DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_count,
2323 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2324 
2325 	TP_ARGS(sb, nr_to_scan, cache_cnt)
2326 );
2327 
2328 DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_scan_enter,
2329 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2330 
2331 	TP_ARGS(sb, nr_to_scan, cache_cnt)
2332 );
2333 
2334 TRACE_EVENT(ext4_es_shrink_scan_exit,
2335 	TP_PROTO(struct super_block *sb, int nr_shrunk, int cache_cnt),
2336 
2337 	TP_ARGS(sb, nr_shrunk, cache_cnt),
2338 
2339 	TP_STRUCT__entry(
2340 		__field(	dev_t,	dev			)
2341 		__field(	int,	nr_shrunk		)
2342 		__field(	int,	cache_cnt		)
2343 	),
2344 
2345 	TP_fast_assign(
2346 		__entry->dev		= sb->s_dev;
2347 		__entry->nr_shrunk	= nr_shrunk;
2348 		__entry->cache_cnt	= cache_cnt;
2349 	),
2350 
2351 	TP_printk("dev %d,%d nr_shrunk %d cache_cnt %d",
2352 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2353 		  __entry->nr_shrunk, __entry->cache_cnt)
2354 );
2355 
2356 TRACE_EVENT(ext4_collapse_range,
2357 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2358 
2359 	TP_ARGS(inode, offset, len),
2360 
2361 	TP_STRUCT__entry(
2362 		__field(dev_t,	dev)
2363 		__field(ino_t,	ino)
2364 		__field(loff_t,	offset)
2365 		__field(loff_t, len)
2366 	),
2367 
2368 	TP_fast_assign(
2369 		__entry->dev	= inode->i_sb->s_dev;
2370 		__entry->ino	= inode->i_ino;
2371 		__entry->offset	= offset;
2372 		__entry->len	= len;
2373 	),
2374 
2375 	TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2376 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2377 		  (unsigned long) __entry->ino,
2378 		  __entry->offset, __entry->len)
2379 );
2380 
2381 TRACE_EVENT(ext4_insert_range,
2382 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2383 
2384 	TP_ARGS(inode, offset, len),
2385 
2386 	TP_STRUCT__entry(
2387 		__field(dev_t,	dev)
2388 		__field(ino_t,	ino)
2389 		__field(loff_t,	offset)
2390 		__field(loff_t, len)
2391 	),
2392 
2393 	TP_fast_assign(
2394 		__entry->dev	= inode->i_sb->s_dev;
2395 		__entry->ino	= inode->i_ino;
2396 		__entry->offset	= offset;
2397 		__entry->len	= len;
2398 	),
2399 
2400 	TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2401 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2402 		  (unsigned long) __entry->ino,
2403 		  __entry->offset, __entry->len)
2404 );
2405 
2406 TRACE_EVENT(ext4_es_shrink,
2407 	TP_PROTO(struct super_block *sb, int nr_shrunk, u64 scan_time,
2408 		 int nr_skipped, int retried),
2409 
2410 	TP_ARGS(sb, nr_shrunk, scan_time, nr_skipped, retried),
2411 
2412 	TP_STRUCT__entry(
2413 		__field(	dev_t,		dev		)
2414 		__field(	int,		nr_shrunk	)
2415 		__field(	unsigned long long, scan_time	)
2416 		__field(	int,		nr_skipped	)
2417 		__field(	int,		retried		)
2418 	),
2419 
2420 	TP_fast_assign(
2421 		__entry->dev		= sb->s_dev;
2422 		__entry->nr_shrunk	= nr_shrunk;
2423 		__entry->scan_time	= div_u64(scan_time, 1000);
2424 		__entry->nr_skipped	= nr_skipped;
2425 		__entry->retried	= retried;
2426 	),
2427 
2428 	TP_printk("dev %d,%d nr_shrunk %d, scan_time %llu "
2429 		  "nr_skipped %d retried %d",
2430 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->nr_shrunk,
2431 		  __entry->scan_time, __entry->nr_skipped, __entry->retried)
2432 );
2433 
2434 TRACE_EVENT(ext4_es_insert_delayed_block,
2435 	TP_PROTO(struct inode *inode, struct extent_status *es,
2436 		 bool allocated),
2437 
2438 	TP_ARGS(inode, es, allocated),
2439 
2440 	TP_STRUCT__entry(
2441 		__field(	dev_t,		dev		)
2442 		__field(	ino_t,		ino		)
2443 		__field(	ext4_lblk_t,	lblk		)
2444 		__field(	ext4_lblk_t,	len		)
2445 		__field(	ext4_fsblk_t,	pblk		)
2446 		__field(	char,		status		)
2447 		__field(	bool,		allocated	)
2448 	),
2449 
2450 	TP_fast_assign(
2451 		__entry->dev		= inode->i_sb->s_dev;
2452 		__entry->ino		= inode->i_ino;
2453 		__entry->lblk		= es->es_lblk;
2454 		__entry->len		= es->es_len;
2455 		__entry->pblk		= ext4_es_show_pblock(es);
2456 		__entry->status		= ext4_es_status(es);
2457 		__entry->allocated	= allocated;
2458 	),
2459 
2460 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s "
2461 		  "allocated %d",
2462 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2463 		  (unsigned long) __entry->ino,
2464 		  __entry->lblk, __entry->len,
2465 		  __entry->pblk, show_extent_status(__entry->status),
2466 		  __entry->allocated)
2467 );
2468 
2469 /* fsmap traces */
2470 DECLARE_EVENT_CLASS(ext4_fsmap_class,
2471 	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len,
2472 		 u64 owner),
2473 	TP_ARGS(sb, keydev, agno, bno, len, owner),
2474 	TP_STRUCT__entry(
2475 		__field(dev_t, dev)
2476 		__field(dev_t, keydev)
2477 		__field(u32, agno)
2478 		__field(u64, bno)
2479 		__field(u64, len)
2480 		__field(u64, owner)
2481 	),
2482 	TP_fast_assign(
2483 		__entry->dev = sb->s_bdev->bd_dev;
2484 		__entry->keydev = new_decode_dev(keydev);
2485 		__entry->agno = agno;
2486 		__entry->bno = bno;
2487 		__entry->len = len;
2488 		__entry->owner = owner;
2489 	),
2490 	TP_printk("dev %d:%d keydev %d:%d agno %u bno %llu len %llu owner %lld\n",
2491 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2492 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
2493 		  __entry->agno,
2494 		  __entry->bno,
2495 		  __entry->len,
2496 		  __entry->owner)
2497 )
2498 #define DEFINE_FSMAP_EVENT(name) \
2499 DEFINE_EVENT(ext4_fsmap_class, name, \
2500 	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len, \
2501 		 u64 owner), \
2502 	TP_ARGS(sb, keydev, agno, bno, len, owner))
2503 DEFINE_FSMAP_EVENT(ext4_fsmap_low_key);
2504 DEFINE_FSMAP_EVENT(ext4_fsmap_high_key);
2505 DEFINE_FSMAP_EVENT(ext4_fsmap_mapping);
2506 
2507 DECLARE_EVENT_CLASS(ext4_getfsmap_class,
2508 	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap),
2509 	TP_ARGS(sb, fsmap),
2510 	TP_STRUCT__entry(
2511 		__field(dev_t, dev)
2512 		__field(dev_t, keydev)
2513 		__field(u64, block)
2514 		__field(u64, len)
2515 		__field(u64, owner)
2516 		__field(u64, flags)
2517 	),
2518 	TP_fast_assign(
2519 		__entry->dev = sb->s_bdev->bd_dev;
2520 		__entry->keydev = new_decode_dev(fsmap->fmr_device);
2521 		__entry->block = fsmap->fmr_physical;
2522 		__entry->len = fsmap->fmr_length;
2523 		__entry->owner = fsmap->fmr_owner;
2524 		__entry->flags = fsmap->fmr_flags;
2525 	),
2526 	TP_printk("dev %d:%d keydev %d:%d block %llu len %llu owner %lld flags 0x%llx\n",
2527 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2528 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
2529 		  __entry->block,
2530 		  __entry->len,
2531 		  __entry->owner,
2532 		  __entry->flags)
2533 )
2534 #define DEFINE_GETFSMAP_EVENT(name) \
2535 DEFINE_EVENT(ext4_getfsmap_class, name, \
2536 	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap), \
2537 	TP_ARGS(sb, fsmap))
2538 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_low_key);
2539 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_high_key);
2540 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_mapping);
2541 
2542 TRACE_EVENT(ext4_shutdown,
2543 	TP_PROTO(struct super_block *sb, unsigned long flags),
2544 
2545 	TP_ARGS(sb, flags),
2546 
2547 	TP_STRUCT__entry(
2548 		__field(	dev_t,	dev			)
2549 		__field(     unsigned,	flags			)
2550 	),
2551 
2552 	TP_fast_assign(
2553 		__entry->dev	= sb->s_dev;
2554 		__entry->flags	= flags;
2555 	),
2556 
2557 	TP_printk("dev %d,%d flags %u",
2558 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2559 		  __entry->flags)
2560 );
2561 
2562 TRACE_EVENT(ext4_error,
2563 	TP_PROTO(struct super_block *sb, const char *function,
2564 		 unsigned int line),
2565 
2566 	TP_ARGS(sb, function, line),
2567 
2568 	TP_STRUCT__entry(
2569 		__field(	dev_t,	dev			)
2570 		__field( const char *,	function		)
2571 		__field(     unsigned,	line			)
2572 	),
2573 
2574 	TP_fast_assign(
2575 		__entry->dev	= sb->s_dev;
2576 		__entry->function = function;
2577 		__entry->line	= line;
2578 	),
2579 
2580 	TP_printk("dev %d,%d function %s line %u",
2581 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2582 		  __entry->function, __entry->line)
2583 );
2584 
2585 TRACE_EVENT(ext4_prefetch_bitmaps,
2586 	    TP_PROTO(struct super_block *sb, ext4_group_t group,
2587 		     ext4_group_t next, unsigned int prefetch_ios),
2588 
2589 	TP_ARGS(sb, group, next, prefetch_ios),
2590 
2591 	TP_STRUCT__entry(
2592 		__field(	dev_t,	dev			)
2593 		__field(	__u32,	group			)
2594 		__field(	__u32,	next			)
2595 		__field(	__u32,	ios			)
2596 	),
2597 
2598 	TP_fast_assign(
2599 		__entry->dev	= sb->s_dev;
2600 		__entry->group	= group;
2601 		__entry->next	= next;
2602 		__entry->ios	= prefetch_ios;
2603 	),
2604 
2605 	TP_printk("dev %d,%d group %u next %u ios %u",
2606 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2607 		  __entry->group, __entry->next, __entry->ios)
2608 );
2609 
2610 TRACE_EVENT(ext4_lazy_itable_init,
2611 	    TP_PROTO(struct super_block *sb, ext4_group_t group),
2612 
2613 	TP_ARGS(sb, group),
2614 
2615 	TP_STRUCT__entry(
2616 		__field(	dev_t,	dev			)
2617 		__field(	__u32,	group			)
2618 	),
2619 
2620 	TP_fast_assign(
2621 		__entry->dev	= sb->s_dev;
2622 		__entry->group	= group;
2623 	),
2624 
2625 	TP_printk("dev %d,%d group %u",
2626 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->group)
2627 );
2628 
2629 TRACE_EVENT(ext4_fc_replay_scan,
2630 	TP_PROTO(struct super_block *sb, int error, int off),
2631 
2632 	TP_ARGS(sb, error, off),
2633 
2634 	TP_STRUCT__entry(
2635 		__field(dev_t, dev)
2636 		__field(int, error)
2637 		__field(int, off)
2638 	),
2639 
2640 	TP_fast_assign(
2641 		__entry->dev = sb->s_dev;
2642 		__entry->error = error;
2643 		__entry->off = off;
2644 	),
2645 
2646 	TP_printk("FC scan pass on dev %d,%d: error %d, off %d",
2647 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2648 		  __entry->error, __entry->off)
2649 );
2650 
2651 TRACE_EVENT(ext4_fc_replay,
2652 	TP_PROTO(struct super_block *sb, int tag, int ino, int priv1, int priv2),
2653 
2654 	TP_ARGS(sb, tag, ino, priv1, priv2),
2655 
2656 	TP_STRUCT__entry(
2657 		__field(dev_t, dev)
2658 		__field(int, tag)
2659 		__field(int, ino)
2660 		__field(int, priv1)
2661 		__field(int, priv2)
2662 	),
2663 
2664 	TP_fast_assign(
2665 		__entry->dev = sb->s_dev;
2666 		__entry->tag = tag;
2667 		__entry->ino = ino;
2668 		__entry->priv1 = priv1;
2669 		__entry->priv2 = priv2;
2670 	),
2671 
2672 	TP_printk("FC Replay %d,%d: tag %d, ino %d, data1 %d, data2 %d",
2673 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2674 		  __entry->tag, __entry->ino, __entry->priv1, __entry->priv2)
2675 );
2676 
2677 TRACE_EVENT(ext4_fc_commit_start,
2678 	TP_PROTO(struct super_block *sb),
2679 
2680 	TP_ARGS(sb),
2681 
2682 	TP_STRUCT__entry(
2683 		__field(dev_t, dev)
2684 	),
2685 
2686 	TP_fast_assign(
2687 		__entry->dev = sb->s_dev;
2688 	),
2689 
2690 	TP_printk("fast_commit started on dev %d,%d",
2691 		  MAJOR(__entry->dev), MINOR(__entry->dev))
2692 );
2693 
2694 TRACE_EVENT(ext4_fc_commit_stop,
2695 	    TP_PROTO(struct super_block *sb, int nblks, int reason),
2696 
2697 	TP_ARGS(sb, nblks, reason),
2698 
2699 	TP_STRUCT__entry(
2700 		__field(dev_t, dev)
2701 		__field(int, nblks)
2702 		__field(int, reason)
2703 		__field(int, num_fc)
2704 		__field(int, num_fc_ineligible)
2705 		__field(int, nblks_agg)
2706 	),
2707 
2708 	TP_fast_assign(
2709 		__entry->dev = sb->s_dev;
2710 		__entry->nblks = nblks;
2711 		__entry->reason = reason;
2712 		__entry->num_fc = EXT4_SB(sb)->s_fc_stats.fc_num_commits;
2713 		__entry->num_fc_ineligible =
2714 			EXT4_SB(sb)->s_fc_stats.fc_ineligible_commits;
2715 		__entry->nblks_agg = EXT4_SB(sb)->s_fc_stats.fc_numblks;
2716 	),
2717 
2718 	TP_printk("fc on [%d,%d] nblks %d, reason %d, fc = %d, ineligible = %d, agg_nblks %d",
2719 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2720 		  __entry->nblks, __entry->reason, __entry->num_fc,
2721 		  __entry->num_fc_ineligible, __entry->nblks_agg)
2722 );
2723 
2724 #define FC_REASON_NAME_STAT(reason)					\
2725 	show_fc_reason(reason),						\
2726 	__entry->sbi->s_fc_stats.fc_ineligible_reason_count[reason]
2727 
2728 TRACE_EVENT(ext4_fc_stats,
2729 	    TP_PROTO(struct super_block *sb),
2730 
2731 	    TP_ARGS(sb),
2732 
2733 	    TP_STRUCT__entry(
2734 		    __field(dev_t, dev)
2735 		    __field(struct ext4_sb_info *, sbi)
2736 		    __field(int, count)
2737 		    ),
2738 
2739 	    TP_fast_assign(
2740 		    __entry->dev = sb->s_dev;
2741 		    __entry->sbi = EXT4_SB(sb);
2742 		    ),
2743 
2744 	    TP_printk("dev %d:%d fc ineligible reasons:\n"
2745 		      "%s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d, %s:%d; "
2746 		      "num_commits:%ld, ineligible: %ld, numblks: %ld",
2747 		      MAJOR(__entry->dev), MINOR(__entry->dev),
2748 		      FC_REASON_NAME_STAT(EXT4_FC_REASON_XATTR),
2749 		      FC_REASON_NAME_STAT(EXT4_FC_REASON_CROSS_RENAME),
2750 		      FC_REASON_NAME_STAT(EXT4_FC_REASON_JOURNAL_FLAG_CHANGE),
2751 		      FC_REASON_NAME_STAT(EXT4_FC_REASON_NOMEM),
2752 		      FC_REASON_NAME_STAT(EXT4_FC_REASON_SWAP_BOOT),
2753 		      FC_REASON_NAME_STAT(EXT4_FC_REASON_RESIZE),
2754 		      FC_REASON_NAME_STAT(EXT4_FC_REASON_RENAME_DIR),
2755 		      FC_REASON_NAME_STAT(EXT4_FC_REASON_FALLOC_RANGE),
2756 		      FC_REASON_NAME_STAT(EXT4_FC_REASON_INODE_JOURNAL_DATA),
2757 		      __entry->sbi->s_fc_stats.fc_num_commits,
2758 		      __entry->sbi->s_fc_stats.fc_ineligible_commits,
2759 		      __entry->sbi->s_fc_stats.fc_numblks)
2760 
2761 );
2762 
2763 #define DEFINE_TRACE_DENTRY_EVENT(__type)				\
2764 	TRACE_EVENT(ext4_fc_track_##__type,				\
2765 	    TP_PROTO(struct inode *inode, struct dentry *dentry, int ret), \
2766 									\
2767 	    TP_ARGS(inode, dentry, ret),				\
2768 									\
2769 	    TP_STRUCT__entry(						\
2770 		    __field(dev_t, dev)					\
2771 		    __field(int, ino)					\
2772 		    __field(int, error)					\
2773 		    ),							\
2774 									\
2775 	    TP_fast_assign(						\
2776 		    __entry->dev = inode->i_sb->s_dev;			\
2777 		    __entry->ino = inode->i_ino;			\
2778 		    __entry->error = ret;				\
2779 		    ),							\
2780 									\
2781 	    TP_printk("dev %d:%d, inode %d, error %d, fc_%s",		\
2782 		      MAJOR(__entry->dev), MINOR(__entry->dev),		\
2783 		      __entry->ino, __entry->error,			\
2784 		      #__type)						\
2785 	)
2786 
2787 DEFINE_TRACE_DENTRY_EVENT(create);
2788 DEFINE_TRACE_DENTRY_EVENT(link);
2789 DEFINE_TRACE_DENTRY_EVENT(unlink);
2790 
2791 TRACE_EVENT(ext4_fc_track_inode,
2792 	    TP_PROTO(struct inode *inode, int ret),
2793 
2794 	    TP_ARGS(inode, ret),
2795 
2796 	    TP_STRUCT__entry(
2797 		    __field(dev_t, dev)
2798 		    __field(int, ino)
2799 		    __field(int, error)
2800 		    ),
2801 
2802 	    TP_fast_assign(
2803 		    __entry->dev = inode->i_sb->s_dev;
2804 		    __entry->ino = inode->i_ino;
2805 		    __entry->error = ret;
2806 		    ),
2807 
2808 	    TP_printk("dev %d:%d, inode %d, error %d",
2809 		      MAJOR(__entry->dev), MINOR(__entry->dev),
2810 		      __entry->ino, __entry->error)
2811 	);
2812 
2813 TRACE_EVENT(ext4_fc_track_range,
2814 	    TP_PROTO(struct inode *inode, long start, long end, int ret),
2815 
2816 	    TP_ARGS(inode, start, end, ret),
2817 
2818 	    TP_STRUCT__entry(
2819 		    __field(dev_t, dev)
2820 		    __field(int, ino)
2821 		    __field(long, start)
2822 		    __field(long, end)
2823 		    __field(int, error)
2824 		    ),
2825 
2826 	    TP_fast_assign(
2827 		    __entry->dev = inode->i_sb->s_dev;
2828 		    __entry->ino = inode->i_ino;
2829 		    __entry->start = start;
2830 		    __entry->end = end;
2831 		    __entry->error = ret;
2832 		    ),
2833 
2834 	    TP_printk("dev %d:%d, inode %d, error %d, start %ld, end %ld",
2835 		      MAJOR(__entry->dev), MINOR(__entry->dev),
2836 		      __entry->ino, __entry->error, __entry->start,
2837 		      __entry->end)
2838 	);
2839 
2840 #endif /* _TRACE_EXT4_H */
2841 
2842 /* This part must be outside protection */
2843 #include <trace/define_trace.h>
2844