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