xref: /openbmc/linux/include/trace/events/ext4.h (revision 82df5b73)
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),
750 
751 	TP_ARGS(inode),
752 
753 	TP_STRUCT__entry(
754 		__field(	dev_t,	dev			)
755 		__field(	ino_t,	ino			)
756 
757 	),
758 
759 	TP_fast_assign(
760 		__entry->dev	= inode->i_sb->s_dev;
761 		__entry->ino	= inode->i_ino;
762 	),
763 
764 	TP_printk("dev %d,%d ino %lu",
765 		  MAJOR(__entry->dev), MINOR(__entry->dev),
766 		  (unsigned long) __entry->ino)
767 );
768 
769 TRACE_EVENT(ext4_mb_discard_preallocations,
770 	TP_PROTO(struct super_block *sb, int needed),
771 
772 	TP_ARGS(sb, needed),
773 
774 	TP_STRUCT__entry(
775 		__field(	dev_t,	dev			)
776 		__field(	int,	needed			)
777 
778 	),
779 
780 	TP_fast_assign(
781 		__entry->dev	= sb->s_dev;
782 		__entry->needed	= needed;
783 	),
784 
785 	TP_printk("dev %d,%d needed %d",
786 		  MAJOR(__entry->dev), MINOR(__entry->dev),
787 		  __entry->needed)
788 );
789 
790 TRACE_EVENT(ext4_request_blocks,
791 	TP_PROTO(struct ext4_allocation_request *ar),
792 
793 	TP_ARGS(ar),
794 
795 	TP_STRUCT__entry(
796 		__field(	dev_t,	dev			)
797 		__field(	ino_t,	ino			)
798 		__field(	unsigned int, len		)
799 		__field(	__u32,  logical			)
800 		__field(	__u32,	lleft			)
801 		__field(	__u32,	lright			)
802 		__field(	__u64,	goal			)
803 		__field(	__u64,	pleft			)
804 		__field(	__u64,	pright			)
805 		__field(	unsigned int, flags		)
806 	),
807 
808 	TP_fast_assign(
809 		__entry->dev	= ar->inode->i_sb->s_dev;
810 		__entry->ino	= ar->inode->i_ino;
811 		__entry->len	= ar->len;
812 		__entry->logical = ar->logical;
813 		__entry->goal	= ar->goal;
814 		__entry->lleft	= ar->lleft;
815 		__entry->lright	= ar->lright;
816 		__entry->pleft	= ar->pleft;
817 		__entry->pright	= ar->pright;
818 		__entry->flags	= ar->flags;
819 	),
820 
821 	TP_printk("dev %d,%d ino %lu flags %s len %u lblk %u goal %llu "
822 		  "lleft %u lright %u pleft %llu pright %llu ",
823 		  MAJOR(__entry->dev), MINOR(__entry->dev),
824 		  (unsigned long) __entry->ino, show_mballoc_flags(__entry->flags),
825 		  __entry->len, __entry->logical, __entry->goal,
826 		  __entry->lleft, __entry->lright, __entry->pleft,
827 		  __entry->pright)
828 );
829 
830 TRACE_EVENT(ext4_allocate_blocks,
831 	TP_PROTO(struct ext4_allocation_request *ar, unsigned long long block),
832 
833 	TP_ARGS(ar, block),
834 
835 	TP_STRUCT__entry(
836 		__field(	dev_t,	dev			)
837 		__field(	ino_t,	ino			)
838 		__field(	__u64,	block			)
839 		__field(	unsigned int, len		)
840 		__field(	__u32,  logical			)
841 		__field(	__u32,	lleft			)
842 		__field(	__u32,	lright			)
843 		__field(	__u64,	goal			)
844 		__field(	__u64,	pleft			)
845 		__field(	__u64,	pright			)
846 		__field(	unsigned int, flags		)
847 	),
848 
849 	TP_fast_assign(
850 		__entry->dev	= ar->inode->i_sb->s_dev;
851 		__entry->ino	= ar->inode->i_ino;
852 		__entry->block	= block;
853 		__entry->len	= ar->len;
854 		__entry->logical = ar->logical;
855 		__entry->goal	= ar->goal;
856 		__entry->lleft	= ar->lleft;
857 		__entry->lright	= ar->lright;
858 		__entry->pleft	= ar->pleft;
859 		__entry->pright	= ar->pright;
860 		__entry->flags	= ar->flags;
861 	),
862 
863 	TP_printk("dev %d,%d ino %lu flags %s len %u block %llu lblk %u "
864 		  "goal %llu lleft %u lright %u pleft %llu pright %llu",
865 		  MAJOR(__entry->dev), MINOR(__entry->dev),
866 		  (unsigned long) __entry->ino, show_mballoc_flags(__entry->flags),
867 		  __entry->len, __entry->block, __entry->logical,
868 		  __entry->goal,  __entry->lleft, __entry->lright,
869 		  __entry->pleft, __entry->pright)
870 );
871 
872 TRACE_EVENT(ext4_free_blocks,
873 	TP_PROTO(struct inode *inode, __u64 block, unsigned long count,
874 		 int flags),
875 
876 	TP_ARGS(inode, block, count, flags),
877 
878 	TP_STRUCT__entry(
879 		__field(	dev_t,	dev			)
880 		__field(	ino_t,	ino			)
881 		__field(	__u64,	block			)
882 		__field(	unsigned long,	count		)
883 		__field(	int,	flags			)
884 		__field(	__u16,	mode			)
885 	),
886 
887 	TP_fast_assign(
888 		__entry->dev		= inode->i_sb->s_dev;
889 		__entry->ino		= inode->i_ino;
890 		__entry->block		= block;
891 		__entry->count		= count;
892 		__entry->flags		= flags;
893 		__entry->mode		= inode->i_mode;
894 	),
895 
896 	TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %s",
897 		  MAJOR(__entry->dev), MINOR(__entry->dev),
898 		  (unsigned long) __entry->ino,
899 		  __entry->mode, __entry->block, __entry->count,
900 		  show_free_flags(__entry->flags))
901 );
902 
903 TRACE_EVENT(ext4_sync_file_enter,
904 	TP_PROTO(struct file *file, int datasync),
905 
906 	TP_ARGS(file, datasync),
907 
908 	TP_STRUCT__entry(
909 		__field(	dev_t,	dev			)
910 		__field(	ino_t,	ino			)
911 		__field(	ino_t,	parent			)
912 		__field(	int,	datasync		)
913 	),
914 
915 	TP_fast_assign(
916 		struct dentry *dentry = file->f_path.dentry;
917 
918 		__entry->dev		= dentry->d_sb->s_dev;
919 		__entry->ino		= d_inode(dentry)->i_ino;
920 		__entry->datasync	= datasync;
921 		__entry->parent		= d_inode(dentry->d_parent)->i_ino;
922 	),
923 
924 	TP_printk("dev %d,%d ino %lu parent %lu datasync %d ",
925 		  MAJOR(__entry->dev), MINOR(__entry->dev),
926 		  (unsigned long) __entry->ino,
927 		  (unsigned long) __entry->parent, __entry->datasync)
928 );
929 
930 TRACE_EVENT(ext4_sync_file_exit,
931 	TP_PROTO(struct inode *inode, int ret),
932 
933 	TP_ARGS(inode, ret),
934 
935 	TP_STRUCT__entry(
936 		__field(	dev_t,	dev			)
937 		__field(	ino_t,	ino			)
938 		__field(	int,	ret			)
939 	),
940 
941 	TP_fast_assign(
942 		__entry->dev		= inode->i_sb->s_dev;
943 		__entry->ino		= inode->i_ino;
944 		__entry->ret		= ret;
945 	),
946 
947 	TP_printk("dev %d,%d ino %lu ret %d",
948 		  MAJOR(__entry->dev), MINOR(__entry->dev),
949 		  (unsigned long) __entry->ino,
950 		  __entry->ret)
951 );
952 
953 TRACE_EVENT(ext4_sync_fs,
954 	TP_PROTO(struct super_block *sb, int wait),
955 
956 	TP_ARGS(sb, wait),
957 
958 	TP_STRUCT__entry(
959 		__field(	dev_t,	dev			)
960 		__field(	int,	wait			)
961 
962 	),
963 
964 	TP_fast_assign(
965 		__entry->dev	= sb->s_dev;
966 		__entry->wait	= wait;
967 	),
968 
969 	TP_printk("dev %d,%d wait %d",
970 		  MAJOR(__entry->dev), MINOR(__entry->dev),
971 		  __entry->wait)
972 );
973 
974 TRACE_EVENT(ext4_alloc_da_blocks,
975 	TP_PROTO(struct inode *inode),
976 
977 	TP_ARGS(inode),
978 
979 	TP_STRUCT__entry(
980 		__field(	dev_t,	dev			)
981 		__field(	ino_t,	ino			)
982 		__field( unsigned int,	data_blocks		)
983 	),
984 
985 	TP_fast_assign(
986 		__entry->dev	= inode->i_sb->s_dev;
987 		__entry->ino	= inode->i_ino;
988 		__entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
989 	),
990 
991 	TP_printk("dev %d,%d ino %lu reserved_data_blocks %u",
992 		  MAJOR(__entry->dev), MINOR(__entry->dev),
993 		  (unsigned long) __entry->ino,
994 		  __entry->data_blocks)
995 );
996 
997 TRACE_EVENT(ext4_mballoc_alloc,
998 	TP_PROTO(struct ext4_allocation_context *ac),
999 
1000 	TP_ARGS(ac),
1001 
1002 	TP_STRUCT__entry(
1003 		__field(	dev_t,	dev			)
1004 		__field(	ino_t,	ino			)
1005 		__field(	__u32, 	orig_logical		)
1006 		__field(	  int,	orig_start		)
1007 		__field(	__u32, 	orig_group		)
1008 		__field(	  int,	orig_len		)
1009 		__field(	__u32, 	goal_logical		)
1010 		__field(	  int,	goal_start		)
1011 		__field(	__u32, 	goal_group		)
1012 		__field(	  int,	goal_len		)
1013 		__field(	__u32, 	result_logical		)
1014 		__field(	  int,	result_start		)
1015 		__field(	__u32, 	result_group		)
1016 		__field(	  int,	result_len		)
1017 		__field(	__u16,	found			)
1018 		__field(	__u16,	groups			)
1019 		__field(	__u16,	buddy			)
1020 		__field(	__u16,	flags			)
1021 		__field(	__u16,	tail			)
1022 		__field(	__u8,	cr			)
1023 	),
1024 
1025 	TP_fast_assign(
1026 		__entry->dev		= ac->ac_inode->i_sb->s_dev;
1027 		__entry->ino		= ac->ac_inode->i_ino;
1028 		__entry->orig_logical	= ac->ac_o_ex.fe_logical;
1029 		__entry->orig_start	= ac->ac_o_ex.fe_start;
1030 		__entry->orig_group	= ac->ac_o_ex.fe_group;
1031 		__entry->orig_len	= ac->ac_o_ex.fe_len;
1032 		__entry->goal_logical	= ac->ac_g_ex.fe_logical;
1033 		__entry->goal_start	= ac->ac_g_ex.fe_start;
1034 		__entry->goal_group	= ac->ac_g_ex.fe_group;
1035 		__entry->goal_len	= ac->ac_g_ex.fe_len;
1036 		__entry->result_logical	= ac->ac_f_ex.fe_logical;
1037 		__entry->result_start	= ac->ac_f_ex.fe_start;
1038 		__entry->result_group	= ac->ac_f_ex.fe_group;
1039 		__entry->result_len	= ac->ac_f_ex.fe_len;
1040 		__entry->found		= ac->ac_found;
1041 		__entry->flags		= ac->ac_flags;
1042 		__entry->groups		= ac->ac_groups_scanned;
1043 		__entry->buddy		= ac->ac_buddy;
1044 		__entry->tail		= ac->ac_tail;
1045 		__entry->cr		= ac->ac_criteria;
1046 	),
1047 
1048 	TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
1049 		  "result %u/%d/%u@%u blks %u grps %u cr %u flags %s "
1050 		  "tail %u broken %u",
1051 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1052 		  (unsigned long) __entry->ino,
1053 		  __entry->orig_group, __entry->orig_start,
1054 		  __entry->orig_len, __entry->orig_logical,
1055 		  __entry->goal_group, __entry->goal_start,
1056 		  __entry->goal_len, __entry->goal_logical,
1057 		  __entry->result_group, __entry->result_start,
1058 		  __entry->result_len, __entry->result_logical,
1059 		  __entry->found, __entry->groups, __entry->cr,
1060 		  show_mballoc_flags(__entry->flags), __entry->tail,
1061 		  __entry->buddy ? 1 << __entry->buddy : 0)
1062 );
1063 
1064 TRACE_EVENT(ext4_mballoc_prealloc,
1065 	TP_PROTO(struct ext4_allocation_context *ac),
1066 
1067 	TP_ARGS(ac),
1068 
1069 	TP_STRUCT__entry(
1070 		__field(	dev_t,	dev			)
1071 		__field(	ino_t,	ino			)
1072 		__field(	__u32, 	orig_logical		)
1073 		__field(	  int,	orig_start		)
1074 		__field(	__u32, 	orig_group		)
1075 		__field(	  int,	orig_len		)
1076 		__field(	__u32, 	result_logical		)
1077 		__field(	  int,	result_start		)
1078 		__field(	__u32, 	result_group		)
1079 		__field(	  int,	result_len		)
1080 	),
1081 
1082 	TP_fast_assign(
1083 		__entry->dev		= ac->ac_inode->i_sb->s_dev;
1084 		__entry->ino		= ac->ac_inode->i_ino;
1085 		__entry->orig_logical	= ac->ac_o_ex.fe_logical;
1086 		__entry->orig_start	= ac->ac_o_ex.fe_start;
1087 		__entry->orig_group	= ac->ac_o_ex.fe_group;
1088 		__entry->orig_len	= ac->ac_o_ex.fe_len;
1089 		__entry->result_logical	= ac->ac_b_ex.fe_logical;
1090 		__entry->result_start	= ac->ac_b_ex.fe_start;
1091 		__entry->result_group	= ac->ac_b_ex.fe_group;
1092 		__entry->result_len	= ac->ac_b_ex.fe_len;
1093 	),
1094 
1095 	TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
1096 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1097 		  (unsigned long) __entry->ino,
1098 		  __entry->orig_group, __entry->orig_start,
1099 		  __entry->orig_len, __entry->orig_logical,
1100 		  __entry->result_group, __entry->result_start,
1101 		  __entry->result_len, __entry->result_logical)
1102 );
1103 
1104 DECLARE_EVENT_CLASS(ext4__mballoc,
1105 	TP_PROTO(struct super_block *sb,
1106 		 struct inode *inode,
1107 		 ext4_group_t group,
1108 		 ext4_grpblk_t start,
1109 		 ext4_grpblk_t len),
1110 
1111 	TP_ARGS(sb, inode, group, start, len),
1112 
1113 	TP_STRUCT__entry(
1114 		__field(	dev_t,	dev			)
1115 		__field(	ino_t,	ino			)
1116 		__field(	  int,	result_start		)
1117 		__field(	__u32, 	result_group		)
1118 		__field(	  int,	result_len		)
1119 	),
1120 
1121 	TP_fast_assign(
1122 		__entry->dev		= sb->s_dev;
1123 		__entry->ino		= inode ? inode->i_ino : 0;
1124 		__entry->result_start	= start;
1125 		__entry->result_group	= group;
1126 		__entry->result_len	= len;
1127 	),
1128 
1129 	TP_printk("dev %d,%d inode %lu extent %u/%d/%d ",
1130 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1131 		  (unsigned long) __entry->ino,
1132 		  __entry->result_group, __entry->result_start,
1133 		  __entry->result_len)
1134 );
1135 
1136 DEFINE_EVENT(ext4__mballoc, ext4_mballoc_discard,
1137 
1138 	TP_PROTO(struct super_block *sb,
1139 		 struct inode *inode,
1140 		 ext4_group_t group,
1141 		 ext4_grpblk_t start,
1142 		 ext4_grpblk_t len),
1143 
1144 	TP_ARGS(sb, inode, group, start, len)
1145 );
1146 
1147 DEFINE_EVENT(ext4__mballoc, ext4_mballoc_free,
1148 
1149 	TP_PROTO(struct super_block *sb,
1150 		 struct inode *inode,
1151 		 ext4_group_t group,
1152 		 ext4_grpblk_t start,
1153 		 ext4_grpblk_t len),
1154 
1155 	TP_ARGS(sb, inode, group, start, len)
1156 );
1157 
1158 TRACE_EVENT(ext4_forget,
1159 	TP_PROTO(struct inode *inode, int is_metadata, __u64 block),
1160 
1161 	TP_ARGS(inode, is_metadata, block),
1162 
1163 	TP_STRUCT__entry(
1164 		__field(	dev_t,	dev			)
1165 		__field(	ino_t,	ino			)
1166 		__field(	__u64,	block			)
1167 		__field(	int,	is_metadata		)
1168 		__field(	__u16,	mode			)
1169 	),
1170 
1171 	TP_fast_assign(
1172 		__entry->dev	= inode->i_sb->s_dev;
1173 		__entry->ino	= inode->i_ino;
1174 		__entry->block	= block;
1175 		__entry->is_metadata = is_metadata;
1176 		__entry->mode	= inode->i_mode;
1177 	),
1178 
1179 	TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu",
1180 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1181 		  (unsigned long) __entry->ino,
1182 		  __entry->mode, __entry->is_metadata, __entry->block)
1183 );
1184 
1185 TRACE_EVENT(ext4_da_update_reserve_space,
1186 	TP_PROTO(struct inode *inode, int used_blocks, int quota_claim),
1187 
1188 	TP_ARGS(inode, used_blocks, quota_claim),
1189 
1190 	TP_STRUCT__entry(
1191 		__field(	dev_t,	dev			)
1192 		__field(	ino_t,	ino			)
1193 		__field(	__u64,	i_blocks		)
1194 		__field(	int,	used_blocks		)
1195 		__field(	int,	reserved_data_blocks	)
1196 		__field(	int,	quota_claim		)
1197 		__field(	__u16,	mode			)
1198 	),
1199 
1200 	TP_fast_assign(
1201 		__entry->dev	= inode->i_sb->s_dev;
1202 		__entry->ino	= inode->i_ino;
1203 		__entry->i_blocks = inode->i_blocks;
1204 		__entry->used_blocks = used_blocks;
1205 		__entry->reserved_data_blocks =
1206 				EXT4_I(inode)->i_reserved_data_blocks;
1207 		__entry->quota_claim = quota_claim;
1208 		__entry->mode	= inode->i_mode;
1209 	),
1210 
1211 	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d "
1212 		  "reserved_data_blocks %d quota_claim %d",
1213 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1214 		  (unsigned long) __entry->ino,
1215 		  __entry->mode, __entry->i_blocks,
1216 		  __entry->used_blocks, __entry->reserved_data_blocks,
1217 		  __entry->quota_claim)
1218 );
1219 
1220 TRACE_EVENT(ext4_da_reserve_space,
1221 	TP_PROTO(struct inode *inode),
1222 
1223 	TP_ARGS(inode),
1224 
1225 	TP_STRUCT__entry(
1226 		__field(	dev_t,	dev			)
1227 		__field(	ino_t,	ino			)
1228 		__field(	__u64,	i_blocks		)
1229 		__field(	int,	reserved_data_blocks	)
1230 		__field(	__u16,  mode			)
1231 	),
1232 
1233 	TP_fast_assign(
1234 		__entry->dev	= inode->i_sb->s_dev;
1235 		__entry->ino	= inode->i_ino;
1236 		__entry->i_blocks = inode->i_blocks;
1237 		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1238 		__entry->mode	= inode->i_mode;
1239 	),
1240 
1241 	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu "
1242 		  "reserved_data_blocks %d",
1243 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1244 		  (unsigned long) __entry->ino,
1245 		  __entry->mode, __entry->i_blocks,
1246 		  __entry->reserved_data_blocks)
1247 );
1248 
1249 TRACE_EVENT(ext4_da_release_space,
1250 	TP_PROTO(struct inode *inode, int freed_blocks),
1251 
1252 	TP_ARGS(inode, freed_blocks),
1253 
1254 	TP_STRUCT__entry(
1255 		__field(	dev_t,	dev			)
1256 		__field(	ino_t,	ino			)
1257 		__field(	__u64,	i_blocks		)
1258 		__field(	int,	freed_blocks		)
1259 		__field(	int,	reserved_data_blocks	)
1260 		__field(	__u16,  mode			)
1261 	),
1262 
1263 	TP_fast_assign(
1264 		__entry->dev	= inode->i_sb->s_dev;
1265 		__entry->ino	= inode->i_ino;
1266 		__entry->i_blocks = inode->i_blocks;
1267 		__entry->freed_blocks = freed_blocks;
1268 		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1269 		__entry->mode	= inode->i_mode;
1270 	),
1271 
1272 	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d "
1273 		  "reserved_data_blocks %d",
1274 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1275 		  (unsigned long) __entry->ino,
1276 		  __entry->mode, __entry->i_blocks,
1277 		  __entry->freed_blocks, __entry->reserved_data_blocks)
1278 );
1279 
1280 DECLARE_EVENT_CLASS(ext4__bitmap_load,
1281 	TP_PROTO(struct super_block *sb, unsigned long group),
1282 
1283 	TP_ARGS(sb, group),
1284 
1285 	TP_STRUCT__entry(
1286 		__field(	dev_t,	dev			)
1287 		__field(	__u32,	group			)
1288 
1289 	),
1290 
1291 	TP_fast_assign(
1292 		__entry->dev	= sb->s_dev;
1293 		__entry->group	= group;
1294 	),
1295 
1296 	TP_printk("dev %d,%d group %u",
1297 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1298 		  __entry->group)
1299 );
1300 
1301 DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load,
1302 
1303 	TP_PROTO(struct super_block *sb, unsigned long group),
1304 
1305 	TP_ARGS(sb, group)
1306 );
1307 
1308 DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
1309 
1310 	TP_PROTO(struct super_block *sb, unsigned long group),
1311 
1312 	TP_ARGS(sb, group)
1313 );
1314 
1315 DEFINE_EVENT(ext4__bitmap_load, ext4_read_block_bitmap_load,
1316 
1317 	TP_PROTO(struct super_block *sb, unsigned long group),
1318 
1319 	TP_ARGS(sb, group)
1320 );
1321 
1322 DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,
1323 
1324 	TP_PROTO(struct super_block *sb, unsigned long group),
1325 
1326 	TP_ARGS(sb, group)
1327 );
1328 
1329 TRACE_EVENT(ext4_direct_IO_enter,
1330 	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),
1331 
1332 	TP_ARGS(inode, offset, len, rw),
1333 
1334 	TP_STRUCT__entry(
1335 		__field(	dev_t,	dev			)
1336 		__field(	ino_t,	ino			)
1337 		__field(	loff_t,	pos			)
1338 		__field(	unsigned long,	len		)
1339 		__field(	int,	rw			)
1340 	),
1341 
1342 	TP_fast_assign(
1343 		__entry->dev	= inode->i_sb->s_dev;
1344 		__entry->ino	= inode->i_ino;
1345 		__entry->pos	= offset;
1346 		__entry->len	= len;
1347 		__entry->rw	= rw;
1348 	),
1349 
1350 	TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d",
1351 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1352 		  (unsigned long) __entry->ino,
1353 		  __entry->pos, __entry->len, __entry->rw)
1354 );
1355 
1356 TRACE_EVENT(ext4_direct_IO_exit,
1357 	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
1358 		 int rw, int ret),
1359 
1360 	TP_ARGS(inode, offset, len, rw, ret),
1361 
1362 	TP_STRUCT__entry(
1363 		__field(	dev_t,	dev			)
1364 		__field(	ino_t,	ino			)
1365 		__field(	loff_t,	pos			)
1366 		__field(	unsigned long,	len		)
1367 		__field(	int,	rw			)
1368 		__field(	int,	ret			)
1369 	),
1370 
1371 	TP_fast_assign(
1372 		__entry->dev	= inode->i_sb->s_dev;
1373 		__entry->ino	= inode->i_ino;
1374 		__entry->pos	= offset;
1375 		__entry->len	= len;
1376 		__entry->rw	= rw;
1377 		__entry->ret	= ret;
1378 	),
1379 
1380 	TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d ret %d",
1381 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1382 		  (unsigned long) __entry->ino,
1383 		  __entry->pos, __entry->len,
1384 		  __entry->rw, __entry->ret)
1385 );
1386 
1387 DECLARE_EVENT_CLASS(ext4__fallocate_mode,
1388 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1389 
1390 	TP_ARGS(inode, offset, len, mode),
1391 
1392 	TP_STRUCT__entry(
1393 		__field(	dev_t,	dev			)
1394 		__field(	ino_t,	ino			)
1395 		__field(	loff_t,	offset			)
1396 		__field(	loff_t, len			)
1397 		__field(	int,	mode			)
1398 	),
1399 
1400 	TP_fast_assign(
1401 		__entry->dev	= inode->i_sb->s_dev;
1402 		__entry->ino	= inode->i_ino;
1403 		__entry->offset	= offset;
1404 		__entry->len	= len;
1405 		__entry->mode	= mode;
1406 	),
1407 
1408 	TP_printk("dev %d,%d ino %lu offset %lld len %lld mode %s",
1409 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1410 		  (unsigned long) __entry->ino,
1411 		  __entry->offset, __entry->len,
1412 		  show_falloc_mode(__entry->mode))
1413 );
1414 
1415 DEFINE_EVENT(ext4__fallocate_mode, ext4_fallocate_enter,
1416 
1417 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1418 
1419 	TP_ARGS(inode, offset, len, mode)
1420 );
1421 
1422 DEFINE_EVENT(ext4__fallocate_mode, ext4_punch_hole,
1423 
1424 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1425 
1426 	TP_ARGS(inode, offset, len, mode)
1427 );
1428 
1429 DEFINE_EVENT(ext4__fallocate_mode, ext4_zero_range,
1430 
1431 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),
1432 
1433 	TP_ARGS(inode, offset, len, mode)
1434 );
1435 
1436 TRACE_EVENT(ext4_fallocate_exit,
1437 	TP_PROTO(struct inode *inode, loff_t offset,
1438 		 unsigned int max_blocks, int ret),
1439 
1440 	TP_ARGS(inode, offset, max_blocks, ret),
1441 
1442 	TP_STRUCT__entry(
1443 		__field(	dev_t,	dev			)
1444 		__field(	ino_t,	ino			)
1445 		__field(	loff_t,	pos			)
1446 		__field(	unsigned int,	blocks		)
1447 		__field(	int, 	ret			)
1448 	),
1449 
1450 	TP_fast_assign(
1451 		__entry->dev	= inode->i_sb->s_dev;
1452 		__entry->ino	= inode->i_ino;
1453 		__entry->pos	= offset;
1454 		__entry->blocks	= max_blocks;
1455 		__entry->ret	= ret;
1456 	),
1457 
1458 	TP_printk("dev %d,%d ino %lu pos %lld blocks %u ret %d",
1459 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1460 		  (unsigned long) __entry->ino,
1461 		  __entry->pos, __entry->blocks,
1462 		  __entry->ret)
1463 );
1464 
1465 TRACE_EVENT(ext4_unlink_enter,
1466 	TP_PROTO(struct inode *parent, struct dentry *dentry),
1467 
1468 	TP_ARGS(parent, dentry),
1469 
1470 	TP_STRUCT__entry(
1471 		__field(	dev_t,	dev			)
1472 		__field(	ino_t,	ino			)
1473 		__field(	ino_t,	parent			)
1474 		__field(	loff_t,	size			)
1475 	),
1476 
1477 	TP_fast_assign(
1478 		__entry->dev		= dentry->d_sb->s_dev;
1479 		__entry->ino		= d_inode(dentry)->i_ino;
1480 		__entry->parent		= parent->i_ino;
1481 		__entry->size		= d_inode(dentry)->i_size;
1482 	),
1483 
1484 	TP_printk("dev %d,%d ino %lu size %lld parent %lu",
1485 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1486 		  (unsigned long) __entry->ino, __entry->size,
1487 		  (unsigned long) __entry->parent)
1488 );
1489 
1490 TRACE_EVENT(ext4_unlink_exit,
1491 	TP_PROTO(struct dentry *dentry, int ret),
1492 
1493 	TP_ARGS(dentry, ret),
1494 
1495 	TP_STRUCT__entry(
1496 		__field(	dev_t,	dev			)
1497 		__field(	ino_t,	ino			)
1498 		__field(	int,	ret			)
1499 	),
1500 
1501 	TP_fast_assign(
1502 		__entry->dev		= dentry->d_sb->s_dev;
1503 		__entry->ino		= d_inode(dentry)->i_ino;
1504 		__entry->ret		= ret;
1505 	),
1506 
1507 	TP_printk("dev %d,%d ino %lu ret %d",
1508 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1509 		  (unsigned long) __entry->ino,
1510 		  __entry->ret)
1511 );
1512 
1513 DECLARE_EVENT_CLASS(ext4__truncate,
1514 	TP_PROTO(struct inode *inode),
1515 
1516 	TP_ARGS(inode),
1517 
1518 	TP_STRUCT__entry(
1519 		__field(	dev_t,		dev		)
1520 		__field(	ino_t,		ino		)
1521 		__field(	__u64,		blocks		)
1522 	),
1523 
1524 	TP_fast_assign(
1525 		__entry->dev    = inode->i_sb->s_dev;
1526 		__entry->ino    = inode->i_ino;
1527 		__entry->blocks	= inode->i_blocks;
1528 	),
1529 
1530 	TP_printk("dev %d,%d ino %lu blocks %llu",
1531 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1532 		  (unsigned long) __entry->ino, __entry->blocks)
1533 );
1534 
1535 DEFINE_EVENT(ext4__truncate, ext4_truncate_enter,
1536 
1537 	TP_PROTO(struct inode *inode),
1538 
1539 	TP_ARGS(inode)
1540 );
1541 
1542 DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,
1543 
1544 	TP_PROTO(struct inode *inode),
1545 
1546 	TP_ARGS(inode)
1547 );
1548 
1549 /* 'ux' is the unwritten extent. */
1550 TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
1551 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1552 		 struct ext4_extent *ux),
1553 
1554 	TP_ARGS(inode, map, ux),
1555 
1556 	TP_STRUCT__entry(
1557 		__field(	dev_t,		dev	)
1558 		__field(	ino_t,		ino	)
1559 		__field(	ext4_lblk_t,	m_lblk	)
1560 		__field(	unsigned,	m_len	)
1561 		__field(	ext4_lblk_t,	u_lblk	)
1562 		__field(	unsigned,	u_len	)
1563 		__field(	ext4_fsblk_t,	u_pblk	)
1564 	),
1565 
1566 	TP_fast_assign(
1567 		__entry->dev		= inode->i_sb->s_dev;
1568 		__entry->ino		= inode->i_ino;
1569 		__entry->m_lblk		= map->m_lblk;
1570 		__entry->m_len		= map->m_len;
1571 		__entry->u_lblk		= le32_to_cpu(ux->ee_block);
1572 		__entry->u_len		= ext4_ext_get_actual_len(ux);
1573 		__entry->u_pblk		= ext4_ext_pblock(ux);
1574 	),
1575 
1576 	TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u u_lblk %u u_len %u "
1577 		  "u_pblk %llu",
1578 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1579 		  (unsigned long) __entry->ino,
1580 		  __entry->m_lblk, __entry->m_len,
1581 		  __entry->u_lblk, __entry->u_len, __entry->u_pblk)
1582 );
1583 
1584 /*
1585  * 'ux' is the unwritten extent.
1586  * 'ix' is the initialized extent to which blocks are transferred.
1587  */
1588 TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
1589 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
1590 		 struct ext4_extent *ux, struct ext4_extent *ix),
1591 
1592 	TP_ARGS(inode, map, ux, ix),
1593 
1594 	TP_STRUCT__entry(
1595 		__field(	dev_t,		dev	)
1596 		__field(	ino_t,		ino	)
1597 		__field(	ext4_lblk_t,	m_lblk	)
1598 		__field(	unsigned,	m_len	)
1599 		__field(	ext4_lblk_t,	u_lblk	)
1600 		__field(	unsigned,	u_len	)
1601 		__field(	ext4_fsblk_t,	u_pblk	)
1602 		__field(	ext4_lblk_t,	i_lblk	)
1603 		__field(	unsigned,	i_len	)
1604 		__field(	ext4_fsblk_t,	i_pblk	)
1605 	),
1606 
1607 	TP_fast_assign(
1608 		__entry->dev		= inode->i_sb->s_dev;
1609 		__entry->ino		= inode->i_ino;
1610 		__entry->m_lblk		= map->m_lblk;
1611 		__entry->m_len		= map->m_len;
1612 		__entry->u_lblk		= le32_to_cpu(ux->ee_block);
1613 		__entry->u_len		= ext4_ext_get_actual_len(ux);
1614 		__entry->u_pblk		= ext4_ext_pblock(ux);
1615 		__entry->i_lblk		= le32_to_cpu(ix->ee_block);
1616 		__entry->i_len		= ext4_ext_get_actual_len(ix);
1617 		__entry->i_pblk		= ext4_ext_pblock(ix);
1618 	),
1619 
1620 	TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u "
1621 		  "u_lblk %u u_len %u u_pblk %llu "
1622 		  "i_lblk %u i_len %u i_pblk %llu ",
1623 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1624 		  (unsigned long) __entry->ino,
1625 		  __entry->m_lblk, __entry->m_len,
1626 		  __entry->u_lblk, __entry->u_len, __entry->u_pblk,
1627 		  __entry->i_lblk, __entry->i_len, __entry->i_pblk)
1628 );
1629 
1630 DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
1631 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1632 		 unsigned int len, unsigned int flags),
1633 
1634 	TP_ARGS(inode, lblk, len, flags),
1635 
1636 	TP_STRUCT__entry(
1637 		__field(	dev_t,		dev		)
1638 		__field(	ino_t,		ino		)
1639 		__field(	ext4_lblk_t,	lblk		)
1640 		__field(	unsigned int,	len		)
1641 		__field(	unsigned int,	flags		)
1642 	),
1643 
1644 	TP_fast_assign(
1645 		__entry->dev    = inode->i_sb->s_dev;
1646 		__entry->ino    = inode->i_ino;
1647 		__entry->lblk	= lblk;
1648 		__entry->len	= len;
1649 		__entry->flags	= flags;
1650 	),
1651 
1652 	TP_printk("dev %d,%d ino %lu lblk %u len %u flags %s",
1653 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1654 		  (unsigned long) __entry->ino,
1655 		  __entry->lblk, __entry->len, show_map_flags(__entry->flags))
1656 );
1657 
1658 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter,
1659 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1660 		 unsigned len, unsigned flags),
1661 
1662 	TP_ARGS(inode, lblk, len, flags)
1663 );
1664 
1665 DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
1666 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
1667 		 unsigned len, unsigned flags),
1668 
1669 	TP_ARGS(inode, lblk, len, flags)
1670 );
1671 
1672 DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1673 	TP_PROTO(struct inode *inode, unsigned flags, struct ext4_map_blocks *map,
1674 		 int ret),
1675 
1676 	TP_ARGS(inode, flags, map, ret),
1677 
1678 	TP_STRUCT__entry(
1679 		__field(	dev_t,		dev		)
1680 		__field(	ino_t,		ino		)
1681 		__field(	unsigned int,	flags		)
1682 		__field(	ext4_fsblk_t,	pblk		)
1683 		__field(	ext4_lblk_t,	lblk		)
1684 		__field(	unsigned int,	len		)
1685 		__field(	unsigned int,	mflags		)
1686 		__field(	int,		ret		)
1687 	),
1688 
1689 	TP_fast_assign(
1690 		__entry->dev    = inode->i_sb->s_dev;
1691 		__entry->ino    = inode->i_ino;
1692 		__entry->flags	= flags;
1693 		__entry->pblk	= map->m_pblk;
1694 		__entry->lblk	= map->m_lblk;
1695 		__entry->len	= map->m_len;
1696 		__entry->mflags	= map->m_flags;
1697 		__entry->ret	= ret;
1698 	),
1699 
1700 	TP_printk("dev %d,%d ino %lu flags %s lblk %u pblk %llu len %u "
1701 		  "mflags %s ret %d",
1702 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1703 		  (unsigned long) __entry->ino,
1704 		  show_map_flags(__entry->flags), __entry->lblk, __entry->pblk,
1705 		  __entry->len, show_mflags(__entry->mflags), __entry->ret)
1706 );
1707 
1708 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1709 	TP_PROTO(struct inode *inode, unsigned flags,
1710 		 struct ext4_map_blocks *map, int ret),
1711 
1712 	TP_ARGS(inode, flags, map, ret)
1713 );
1714 
1715 DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1716 	TP_PROTO(struct inode *inode, unsigned flags,
1717 		 struct ext4_map_blocks *map, int ret),
1718 
1719 	TP_ARGS(inode, flags, map, ret)
1720 );
1721 
1722 TRACE_EVENT(ext4_ext_load_extent,
1723 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk),
1724 
1725 	TP_ARGS(inode, lblk, pblk),
1726 
1727 	TP_STRUCT__entry(
1728 		__field(	dev_t,		dev		)
1729 		__field(	ino_t,		ino		)
1730 		__field(	ext4_fsblk_t,	pblk		)
1731 		__field(	ext4_lblk_t,	lblk		)
1732 	),
1733 
1734 	TP_fast_assign(
1735 		__entry->dev    = inode->i_sb->s_dev;
1736 		__entry->ino    = inode->i_ino;
1737 		__entry->pblk	= pblk;
1738 		__entry->lblk	= lblk;
1739 	),
1740 
1741 	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
1742 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1743 		  (unsigned long) __entry->ino,
1744 		  __entry->lblk, __entry->pblk)
1745 );
1746 
1747 TRACE_EVENT(ext4_load_inode,
1748 	TP_PROTO(struct inode *inode),
1749 
1750 	TP_ARGS(inode),
1751 
1752 	TP_STRUCT__entry(
1753 		__field(	dev_t,	dev		)
1754 		__field(	ino_t,	ino		)
1755 	),
1756 
1757 	TP_fast_assign(
1758 		__entry->dev		= inode->i_sb->s_dev;
1759 		__entry->ino		= inode->i_ino;
1760 	),
1761 
1762 	TP_printk("dev %d,%d ino %ld",
1763 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1764 		  (unsigned long) __entry->ino)
1765 );
1766 
1767 TRACE_EVENT(ext4_journal_start,
1768 	TP_PROTO(struct super_block *sb, int blocks, int rsv_blocks,
1769 		 int revoke_creds, unsigned long IP),
1770 
1771 	TP_ARGS(sb, blocks, rsv_blocks, revoke_creds, IP),
1772 
1773 	TP_STRUCT__entry(
1774 		__field(	dev_t,	dev			)
1775 		__field(unsigned long,	ip			)
1776 		__field(	  int,	blocks			)
1777 		__field(	  int,	rsv_blocks		)
1778 		__field(	  int,	revoke_creds		)
1779 	),
1780 
1781 	TP_fast_assign(
1782 		__entry->dev		 = sb->s_dev;
1783 		__entry->ip		 = IP;
1784 		__entry->blocks		 = blocks;
1785 		__entry->rsv_blocks	 = rsv_blocks;
1786 		__entry->revoke_creds	 = revoke_creds;
1787 	),
1788 
1789 	TP_printk("dev %d,%d blocks %d, rsv_blocks %d, revoke_creds %d, "
1790 		  "caller %pS", MAJOR(__entry->dev), MINOR(__entry->dev),
1791 		  __entry->blocks, __entry->rsv_blocks, __entry->revoke_creds,
1792 		  (void *)__entry->ip)
1793 );
1794 
1795 TRACE_EVENT(ext4_journal_start_reserved,
1796 	TP_PROTO(struct super_block *sb, int blocks, unsigned long IP),
1797 
1798 	TP_ARGS(sb, blocks, IP),
1799 
1800 	TP_STRUCT__entry(
1801 		__field(	dev_t,	dev			)
1802 		__field(unsigned long,	ip			)
1803 		__field(	  int,	blocks			)
1804 	),
1805 
1806 	TP_fast_assign(
1807 		__entry->dev		 = sb->s_dev;
1808 		__entry->ip		 = IP;
1809 		__entry->blocks		 = blocks;
1810 	),
1811 
1812 	TP_printk("dev %d,%d blocks, %d caller %pS",
1813 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1814 		  __entry->blocks, (void *)__entry->ip)
1815 );
1816 
1817 DECLARE_EVENT_CLASS(ext4__trim,
1818 	TP_PROTO(struct super_block *sb,
1819 		 ext4_group_t group,
1820 		 ext4_grpblk_t start,
1821 		 ext4_grpblk_t len),
1822 
1823 	TP_ARGS(sb, group, start, len),
1824 
1825 	TP_STRUCT__entry(
1826 		__field(	int,	dev_major		)
1827 		__field(	int,	dev_minor		)
1828 		__field(	__u32, 	group			)
1829 		__field(	int,	start			)
1830 		__field(	int,	len			)
1831 	),
1832 
1833 	TP_fast_assign(
1834 		__entry->dev_major	= MAJOR(sb->s_dev);
1835 		__entry->dev_minor	= MINOR(sb->s_dev);
1836 		__entry->group		= group;
1837 		__entry->start		= start;
1838 		__entry->len		= len;
1839 	),
1840 
1841 	TP_printk("dev %d,%d group %u, start %d, len %d",
1842 		  __entry->dev_major, __entry->dev_minor,
1843 		  __entry->group, __entry->start, __entry->len)
1844 );
1845 
1846 DEFINE_EVENT(ext4__trim, ext4_trim_extent,
1847 
1848 	TP_PROTO(struct super_block *sb,
1849 		 ext4_group_t group,
1850 		 ext4_grpblk_t start,
1851 		 ext4_grpblk_t len),
1852 
1853 	TP_ARGS(sb, group, start, len)
1854 );
1855 
1856 DEFINE_EVENT(ext4__trim, ext4_trim_all_free,
1857 
1858 	TP_PROTO(struct super_block *sb,
1859 		 ext4_group_t group,
1860 		 ext4_grpblk_t start,
1861 		 ext4_grpblk_t len),
1862 
1863 	TP_ARGS(sb, group, start, len)
1864 );
1865 
1866 TRACE_EVENT(ext4_ext_handle_unwritten_extents,
1867 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1868 		 unsigned int allocated, ext4_fsblk_t newblock),
1869 
1870 	TP_ARGS(inode, map, flags, allocated, newblock),
1871 
1872 	TP_STRUCT__entry(
1873 		__field(	dev_t,		dev		)
1874 		__field(	ino_t,		ino		)
1875 		__field(	int,		flags		)
1876 		__field(	ext4_lblk_t,	lblk		)
1877 		__field(	ext4_fsblk_t,	pblk		)
1878 		__field(	unsigned int,	len		)
1879 		__field(	unsigned int,	allocated	)
1880 		__field(	ext4_fsblk_t,	newblk		)
1881 	),
1882 
1883 	TP_fast_assign(
1884 		__entry->dev		= inode->i_sb->s_dev;
1885 		__entry->ino		= inode->i_ino;
1886 		__entry->flags		= flags;
1887 		__entry->lblk		= map->m_lblk;
1888 		__entry->pblk		= map->m_pblk;
1889 		__entry->len		= map->m_len;
1890 		__entry->allocated	= allocated;
1891 		__entry->newblk		= newblock;
1892 	),
1893 
1894 	TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %s "
1895 		  "allocated %d newblock %llu",
1896 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1897 		  (unsigned long) __entry->ino,
1898 		  (unsigned) __entry->lblk, (unsigned long long) __entry->pblk,
1899 		  __entry->len, show_map_flags(__entry->flags),
1900 		  (unsigned int) __entry->allocated,
1901 		  (unsigned long long) __entry->newblk)
1902 );
1903 
1904 TRACE_EVENT(ext4_get_implied_cluster_alloc_exit,
1905 	TP_PROTO(struct super_block *sb, struct ext4_map_blocks *map, int ret),
1906 
1907 	TP_ARGS(sb, map, ret),
1908 
1909 	TP_STRUCT__entry(
1910 		__field(	dev_t,		dev	)
1911 		__field(	unsigned int,	flags	)
1912 		__field(	ext4_lblk_t,	lblk	)
1913 		__field(	ext4_fsblk_t,	pblk	)
1914 		__field(	unsigned int,	len	)
1915 		__field(	int,		ret	)
1916 	),
1917 
1918 	TP_fast_assign(
1919 		__entry->dev	= sb->s_dev;
1920 		__entry->flags	= map->m_flags;
1921 		__entry->lblk	= map->m_lblk;
1922 		__entry->pblk	= map->m_pblk;
1923 		__entry->len	= map->m_len;
1924 		__entry->ret	= ret;
1925 	),
1926 
1927 	TP_printk("dev %d,%d m_lblk %u m_pblk %llu m_len %u m_flags %s ret %d",
1928 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1929 		  __entry->lblk, (unsigned long long) __entry->pblk,
1930 		  __entry->len, show_mflags(__entry->flags), __entry->ret)
1931 );
1932 
1933 TRACE_EVENT(ext4_ext_put_in_cache,
1934 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, unsigned int len,
1935 		 ext4_fsblk_t start),
1936 
1937 	TP_ARGS(inode, lblk, len, start),
1938 
1939 	TP_STRUCT__entry(
1940 		__field(	dev_t,		dev	)
1941 		__field(	ino_t,		ino	)
1942 		__field(	ext4_lblk_t,	lblk	)
1943 		__field(	unsigned int,	len	)
1944 		__field(	ext4_fsblk_t,	start	)
1945 	),
1946 
1947 	TP_fast_assign(
1948 		__entry->dev	= inode->i_sb->s_dev;
1949 		__entry->ino	= inode->i_ino;
1950 		__entry->lblk	= lblk;
1951 		__entry->len	= len;
1952 		__entry->start	= start;
1953 	),
1954 
1955 	TP_printk("dev %d,%d ino %lu lblk %u len %u start %llu",
1956 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1957 		  (unsigned long) __entry->ino,
1958 		  (unsigned) __entry->lblk,
1959 		  __entry->len,
1960 		  (unsigned long long) __entry->start)
1961 );
1962 
1963 TRACE_EVENT(ext4_ext_in_cache,
1964 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, int ret),
1965 
1966 	TP_ARGS(inode, lblk, ret),
1967 
1968 	TP_STRUCT__entry(
1969 		__field(	dev_t,		dev	)
1970 		__field(	ino_t,		ino	)
1971 		__field(	ext4_lblk_t,	lblk	)
1972 		__field(	int,		ret	)
1973 	),
1974 
1975 	TP_fast_assign(
1976 		__entry->dev	= inode->i_sb->s_dev;
1977 		__entry->ino	= inode->i_ino;
1978 		__entry->lblk	= lblk;
1979 		__entry->ret	= ret;
1980 	),
1981 
1982 	TP_printk("dev %d,%d ino %lu lblk %u ret %d",
1983 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1984 		  (unsigned long) __entry->ino,
1985 		  (unsigned) __entry->lblk,
1986 		  __entry->ret)
1987 
1988 );
1989 
1990 TRACE_EVENT(ext4_find_delalloc_range,
1991 	TP_PROTO(struct inode *inode, ext4_lblk_t from, ext4_lblk_t to,
1992 		int reverse, int found, ext4_lblk_t found_blk),
1993 
1994 	TP_ARGS(inode, from, to, reverse, found, found_blk),
1995 
1996 	TP_STRUCT__entry(
1997 		__field(	dev_t,		dev		)
1998 		__field(	ino_t,		ino		)
1999 		__field(	ext4_lblk_t,	from		)
2000 		__field(	ext4_lblk_t,	to		)
2001 		__field(	int,		reverse		)
2002 		__field(	int,		found		)
2003 		__field(	ext4_lblk_t,	found_blk	)
2004 	),
2005 
2006 	TP_fast_assign(
2007 		__entry->dev		= inode->i_sb->s_dev;
2008 		__entry->ino		= inode->i_ino;
2009 		__entry->from		= from;
2010 		__entry->to		= to;
2011 		__entry->reverse	= reverse;
2012 		__entry->found		= found;
2013 		__entry->found_blk	= found_blk;
2014 	),
2015 
2016 	TP_printk("dev %d,%d ino %lu from %u to %u reverse %d found %d "
2017 		  "(blk = %u)",
2018 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2019 		  (unsigned long) __entry->ino,
2020 		  (unsigned) __entry->from, (unsigned) __entry->to,
2021 		  __entry->reverse, __entry->found,
2022 		  (unsigned) __entry->found_blk)
2023 );
2024 
2025 TRACE_EVENT(ext4_get_reserved_cluster_alloc,
2026 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, unsigned int len),
2027 
2028 	TP_ARGS(inode, lblk, len),
2029 
2030 	TP_STRUCT__entry(
2031 		__field(	dev_t,		dev	)
2032 		__field(	ino_t,		ino	)
2033 		__field(	ext4_lblk_t,	lblk	)
2034 		__field(	unsigned int,	len	)
2035 	),
2036 
2037 	TP_fast_assign(
2038 		__entry->dev	= inode->i_sb->s_dev;
2039 		__entry->ino	= inode->i_ino;
2040 		__entry->lblk	= lblk;
2041 		__entry->len	= len;
2042 	),
2043 
2044 	TP_printk("dev %d,%d ino %lu lblk %u len %u",
2045 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2046 		  (unsigned long) __entry->ino,
2047 		  (unsigned) __entry->lblk,
2048 		  __entry->len)
2049 );
2050 
2051 TRACE_EVENT(ext4_ext_show_extent,
2052 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk,
2053 		 unsigned short len),
2054 
2055 	TP_ARGS(inode, lblk, pblk, len),
2056 
2057 	TP_STRUCT__entry(
2058 		__field(	dev_t,		dev	)
2059 		__field(	ino_t,		ino	)
2060 		__field(	ext4_fsblk_t,	pblk	)
2061 		__field(	ext4_lblk_t,	lblk	)
2062 		__field(	unsigned short,	len	)
2063 	),
2064 
2065 	TP_fast_assign(
2066 		__entry->dev	= inode->i_sb->s_dev;
2067 		__entry->ino	= inode->i_ino;
2068 		__entry->pblk	= pblk;
2069 		__entry->lblk	= lblk;
2070 		__entry->len	= len;
2071 	),
2072 
2073 	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u",
2074 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2075 		  (unsigned long) __entry->ino,
2076 		  (unsigned) __entry->lblk,
2077 		  (unsigned long long) __entry->pblk,
2078 		  (unsigned short) __entry->len)
2079 );
2080 
2081 TRACE_EVENT(ext4_remove_blocks,
2082 	TP_PROTO(struct inode *inode, struct ext4_extent *ex,
2083 		 ext4_lblk_t from, ext4_fsblk_t to,
2084 		 struct partial_cluster *pc),
2085 
2086 	TP_ARGS(inode, ex, from, to, pc),
2087 
2088 	TP_STRUCT__entry(
2089 		__field(	dev_t,		dev	)
2090 		__field(	ino_t,		ino	)
2091 		__field(	ext4_lblk_t,	from	)
2092 		__field(	ext4_lblk_t,	to	)
2093 		__field(	ext4_fsblk_t,	ee_pblk	)
2094 		__field(	ext4_lblk_t,	ee_lblk	)
2095 		__field(	unsigned short,	ee_len	)
2096 		__field(	ext4_fsblk_t,	pc_pclu	)
2097 		__field(	ext4_lblk_t,	pc_lblk	)
2098 		__field(	int,		pc_state)
2099 	),
2100 
2101 	TP_fast_assign(
2102 		__entry->dev		= inode->i_sb->s_dev;
2103 		__entry->ino		= inode->i_ino;
2104 		__entry->from		= from;
2105 		__entry->to		= to;
2106 		__entry->ee_pblk	= ext4_ext_pblock(ex);
2107 		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
2108 		__entry->ee_len		= ext4_ext_get_actual_len(ex);
2109 		__entry->pc_pclu	= pc->pclu;
2110 		__entry->pc_lblk	= pc->lblk;
2111 		__entry->pc_state	= pc->state;
2112 	),
2113 
2114 	TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]"
2115 		  "from %u to %u partial [pclu %lld lblk %u state %d]",
2116 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2117 		  (unsigned long) __entry->ino,
2118 		  (unsigned) __entry->ee_lblk,
2119 		  (unsigned long long) __entry->ee_pblk,
2120 		  (unsigned short) __entry->ee_len,
2121 		  (unsigned) __entry->from,
2122 		  (unsigned) __entry->to,
2123 		  (long long) __entry->pc_pclu,
2124 		  (unsigned int) __entry->pc_lblk,
2125 		  (int) __entry->pc_state)
2126 );
2127 
2128 TRACE_EVENT(ext4_ext_rm_leaf,
2129 	TP_PROTO(struct inode *inode, ext4_lblk_t start,
2130 		 struct ext4_extent *ex,
2131 		 struct partial_cluster *pc),
2132 
2133 	TP_ARGS(inode, start, ex, pc),
2134 
2135 	TP_STRUCT__entry(
2136 		__field(	dev_t,		dev	)
2137 		__field(	ino_t,		ino	)
2138 		__field(	ext4_lblk_t,	start	)
2139 		__field(	ext4_lblk_t,	ee_lblk	)
2140 		__field(	ext4_fsblk_t,	ee_pblk	)
2141 		__field(	short,		ee_len	)
2142 		__field(	ext4_fsblk_t,	pc_pclu	)
2143 		__field(	ext4_lblk_t,	pc_lblk	)
2144 		__field(	int,		pc_state)
2145 	),
2146 
2147 	TP_fast_assign(
2148 		__entry->dev		= inode->i_sb->s_dev;
2149 		__entry->ino		= inode->i_ino;
2150 		__entry->start		= start;
2151 		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
2152 		__entry->ee_pblk	= ext4_ext_pblock(ex);
2153 		__entry->ee_len		= ext4_ext_get_actual_len(ex);
2154 		__entry->pc_pclu	= pc->pclu;
2155 		__entry->pc_lblk	= pc->lblk;
2156 		__entry->pc_state	= pc->state;
2157 	),
2158 
2159 	TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]"
2160 		  "partial [pclu %lld lblk %u state %d]",
2161 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2162 		  (unsigned long) __entry->ino,
2163 		  (unsigned) __entry->start,
2164 		  (unsigned) __entry->ee_lblk,
2165 		  (unsigned long long) __entry->ee_pblk,
2166 		  (unsigned short) __entry->ee_len,
2167 		  (long long) __entry->pc_pclu,
2168 		  (unsigned int) __entry->pc_lblk,
2169 		  (int) __entry->pc_state)
2170 );
2171 
2172 TRACE_EVENT(ext4_ext_rm_idx,
2173 	TP_PROTO(struct inode *inode, ext4_fsblk_t pblk),
2174 
2175 	TP_ARGS(inode, pblk),
2176 
2177 	TP_STRUCT__entry(
2178 		__field(	dev_t,		dev	)
2179 		__field(	ino_t,		ino	)
2180 		__field(	ext4_fsblk_t,	pblk	)
2181 	),
2182 
2183 	TP_fast_assign(
2184 		__entry->dev	= inode->i_sb->s_dev;
2185 		__entry->ino	= inode->i_ino;
2186 		__entry->pblk	= pblk;
2187 	),
2188 
2189 	TP_printk("dev %d,%d ino %lu index_pblk %llu",
2190 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2191 		  (unsigned long) __entry->ino,
2192 		  (unsigned long long) __entry->pblk)
2193 );
2194 
2195 TRACE_EVENT(ext4_ext_remove_space,
2196 	TP_PROTO(struct inode *inode, ext4_lblk_t start,
2197 		 ext4_lblk_t end, int depth),
2198 
2199 	TP_ARGS(inode, start, end, depth),
2200 
2201 	TP_STRUCT__entry(
2202 		__field(	dev_t,		dev	)
2203 		__field(	ino_t,		ino	)
2204 		__field(	ext4_lblk_t,	start	)
2205 		__field(	ext4_lblk_t,	end	)
2206 		__field(	int,		depth	)
2207 	),
2208 
2209 	TP_fast_assign(
2210 		__entry->dev	= inode->i_sb->s_dev;
2211 		__entry->ino	= inode->i_ino;
2212 		__entry->start	= start;
2213 		__entry->end	= end;
2214 		__entry->depth	= depth;
2215 	),
2216 
2217 	TP_printk("dev %d,%d ino %lu since %u end %u depth %d",
2218 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2219 		  (unsigned long) __entry->ino,
2220 		  (unsigned) __entry->start,
2221 		  (unsigned) __entry->end,
2222 		  __entry->depth)
2223 );
2224 
2225 TRACE_EVENT(ext4_ext_remove_space_done,
2226 	TP_PROTO(struct inode *inode, ext4_lblk_t start, ext4_lblk_t end,
2227 		 int depth, struct partial_cluster *pc, __le16 eh_entries),
2228 
2229 	TP_ARGS(inode, start, end, depth, pc, eh_entries),
2230 
2231 	TP_STRUCT__entry(
2232 		__field(	dev_t,		dev		)
2233 		__field(	ino_t,		ino		)
2234 		__field(	ext4_lblk_t,	start		)
2235 		__field(	ext4_lblk_t,	end		)
2236 		__field(	int,		depth		)
2237 		__field(	ext4_fsblk_t,	pc_pclu		)
2238 		__field(	ext4_lblk_t,	pc_lblk		)
2239 		__field(	int,		pc_state	)
2240 		__field(	unsigned short,	eh_entries	)
2241 	),
2242 
2243 	TP_fast_assign(
2244 		__entry->dev		= inode->i_sb->s_dev;
2245 		__entry->ino		= inode->i_ino;
2246 		__entry->start		= start;
2247 		__entry->end		= end;
2248 		__entry->depth		= depth;
2249 		__entry->pc_pclu	= pc->pclu;
2250 		__entry->pc_lblk	= pc->lblk;
2251 		__entry->pc_state	= pc->state;
2252 		__entry->eh_entries	= le16_to_cpu(eh_entries);
2253 	),
2254 
2255 	TP_printk("dev %d,%d ino %lu since %u end %u depth %d "
2256 		  "partial [pclu %lld lblk %u state %d] "
2257 		  "remaining_entries %u",
2258 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2259 		  (unsigned long) __entry->ino,
2260 		  (unsigned) __entry->start,
2261 		  (unsigned) __entry->end,
2262 		  __entry->depth,
2263 		  (long long) __entry->pc_pclu,
2264 		  (unsigned int) __entry->pc_lblk,
2265 		  (int) __entry->pc_state,
2266 		  (unsigned short) __entry->eh_entries)
2267 );
2268 
2269 DECLARE_EVENT_CLASS(ext4__es_extent,
2270 	TP_PROTO(struct inode *inode, struct extent_status *es),
2271 
2272 	TP_ARGS(inode, es),
2273 
2274 	TP_STRUCT__entry(
2275 		__field(	dev_t,		dev		)
2276 		__field(	ino_t,		ino		)
2277 		__field(	ext4_lblk_t,	lblk		)
2278 		__field(	ext4_lblk_t,	len		)
2279 		__field(	ext4_fsblk_t,	pblk		)
2280 		__field(	char, status	)
2281 	),
2282 
2283 	TP_fast_assign(
2284 		__entry->dev	= inode->i_sb->s_dev;
2285 		__entry->ino	= inode->i_ino;
2286 		__entry->lblk	= es->es_lblk;
2287 		__entry->len	= es->es_len;
2288 		__entry->pblk	= ext4_es_show_pblock(es);
2289 		__entry->status	= ext4_es_status(es);
2290 	),
2291 
2292 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2293 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2294 		  (unsigned long) __entry->ino,
2295 		  __entry->lblk, __entry->len,
2296 		  __entry->pblk, show_extent_status(__entry->status))
2297 );
2298 
2299 DEFINE_EVENT(ext4__es_extent, ext4_es_insert_extent,
2300 	TP_PROTO(struct inode *inode, struct extent_status *es),
2301 
2302 	TP_ARGS(inode, es)
2303 );
2304 
2305 DEFINE_EVENT(ext4__es_extent, ext4_es_cache_extent,
2306 	TP_PROTO(struct inode *inode, struct extent_status *es),
2307 
2308 	TP_ARGS(inode, es)
2309 );
2310 
2311 TRACE_EVENT(ext4_es_remove_extent,
2312 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t len),
2313 
2314 	TP_ARGS(inode, lblk, len),
2315 
2316 	TP_STRUCT__entry(
2317 		__field(	dev_t,	dev			)
2318 		__field(	ino_t,	ino			)
2319 		__field(	loff_t,	lblk			)
2320 		__field(	loff_t,	len			)
2321 	),
2322 
2323 	TP_fast_assign(
2324 		__entry->dev	= inode->i_sb->s_dev;
2325 		__entry->ino	= inode->i_ino;
2326 		__entry->lblk	= lblk;
2327 		__entry->len	= len;
2328 	),
2329 
2330 	TP_printk("dev %d,%d ino %lu es [%lld/%lld)",
2331 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2332 		  (unsigned long) __entry->ino,
2333 		  __entry->lblk, __entry->len)
2334 );
2335 
2336 TRACE_EVENT(ext4_es_find_extent_range_enter,
2337 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2338 
2339 	TP_ARGS(inode, lblk),
2340 
2341 	TP_STRUCT__entry(
2342 		__field(	dev_t,		dev		)
2343 		__field(	ino_t,		ino		)
2344 		__field(	ext4_lblk_t,	lblk		)
2345 	),
2346 
2347 	TP_fast_assign(
2348 		__entry->dev	= inode->i_sb->s_dev;
2349 		__entry->ino	= inode->i_ino;
2350 		__entry->lblk	= lblk;
2351 	),
2352 
2353 	TP_printk("dev %d,%d ino %lu lblk %u",
2354 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2355 		  (unsigned long) __entry->ino, __entry->lblk)
2356 );
2357 
2358 TRACE_EVENT(ext4_es_find_extent_range_exit,
2359 	TP_PROTO(struct inode *inode, struct extent_status *es),
2360 
2361 	TP_ARGS(inode, es),
2362 
2363 	TP_STRUCT__entry(
2364 		__field(	dev_t,		dev		)
2365 		__field(	ino_t,		ino		)
2366 		__field(	ext4_lblk_t,	lblk		)
2367 		__field(	ext4_lblk_t,	len		)
2368 		__field(	ext4_fsblk_t,	pblk		)
2369 		__field(	char, status	)
2370 	),
2371 
2372 	TP_fast_assign(
2373 		__entry->dev	= inode->i_sb->s_dev;
2374 		__entry->ino	= inode->i_ino;
2375 		__entry->lblk	= es->es_lblk;
2376 		__entry->len	= es->es_len;
2377 		__entry->pblk	= ext4_es_show_pblock(es);
2378 		__entry->status	= ext4_es_status(es);
2379 	),
2380 
2381 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2382 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2383 		  (unsigned long) __entry->ino,
2384 		  __entry->lblk, __entry->len,
2385 		  __entry->pblk, show_extent_status(__entry->status))
2386 );
2387 
2388 TRACE_EVENT(ext4_es_lookup_extent_enter,
2389 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2390 
2391 	TP_ARGS(inode, lblk),
2392 
2393 	TP_STRUCT__entry(
2394 		__field(	dev_t,		dev		)
2395 		__field(	ino_t,		ino		)
2396 		__field(	ext4_lblk_t,	lblk		)
2397 	),
2398 
2399 	TP_fast_assign(
2400 		__entry->dev	= inode->i_sb->s_dev;
2401 		__entry->ino	= inode->i_ino;
2402 		__entry->lblk	= lblk;
2403 	),
2404 
2405 	TP_printk("dev %d,%d ino %lu lblk %u",
2406 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2407 		  (unsigned long) __entry->ino, __entry->lblk)
2408 );
2409 
2410 TRACE_EVENT(ext4_es_lookup_extent_exit,
2411 	TP_PROTO(struct inode *inode, struct extent_status *es,
2412 		 int found),
2413 
2414 	TP_ARGS(inode, es, found),
2415 
2416 	TP_STRUCT__entry(
2417 		__field(	dev_t,		dev		)
2418 		__field(	ino_t,		ino		)
2419 		__field(	ext4_lblk_t,	lblk		)
2420 		__field(	ext4_lblk_t,	len		)
2421 		__field(	ext4_fsblk_t,	pblk		)
2422 		__field(	char,		status		)
2423 		__field(	int,		found		)
2424 	),
2425 
2426 	TP_fast_assign(
2427 		__entry->dev	= inode->i_sb->s_dev;
2428 		__entry->ino	= inode->i_ino;
2429 		__entry->lblk	= es->es_lblk;
2430 		__entry->len	= es->es_len;
2431 		__entry->pblk	= ext4_es_show_pblock(es);
2432 		__entry->status	= ext4_es_status(es);
2433 		__entry->found	= found;
2434 	),
2435 
2436 	TP_printk("dev %d,%d ino %lu found %d [%u/%u) %llu %s",
2437 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2438 		  (unsigned long) __entry->ino, __entry->found,
2439 		  __entry->lblk, __entry->len,
2440 		  __entry->found ? __entry->pblk : 0,
2441 		  show_extent_status(__entry->found ? __entry->status : 0))
2442 );
2443 
2444 DECLARE_EVENT_CLASS(ext4__es_shrink_enter,
2445 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2446 
2447 	TP_ARGS(sb, nr_to_scan, cache_cnt),
2448 
2449 	TP_STRUCT__entry(
2450 		__field(	dev_t,	dev			)
2451 		__field(	int,	nr_to_scan		)
2452 		__field(	int,	cache_cnt		)
2453 	),
2454 
2455 	TP_fast_assign(
2456 		__entry->dev		= sb->s_dev;
2457 		__entry->nr_to_scan	= nr_to_scan;
2458 		__entry->cache_cnt	= cache_cnt;
2459 	),
2460 
2461 	TP_printk("dev %d,%d nr_to_scan %d cache_cnt %d",
2462 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2463 		  __entry->nr_to_scan, __entry->cache_cnt)
2464 );
2465 
2466 DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_count,
2467 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2468 
2469 	TP_ARGS(sb, nr_to_scan, cache_cnt)
2470 );
2471 
2472 DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_scan_enter,
2473 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2474 
2475 	TP_ARGS(sb, nr_to_scan, cache_cnt)
2476 );
2477 
2478 TRACE_EVENT(ext4_es_shrink_scan_exit,
2479 	TP_PROTO(struct super_block *sb, int nr_shrunk, int cache_cnt),
2480 
2481 	TP_ARGS(sb, nr_shrunk, cache_cnt),
2482 
2483 	TP_STRUCT__entry(
2484 		__field(	dev_t,	dev			)
2485 		__field(	int,	nr_shrunk		)
2486 		__field(	int,	cache_cnt		)
2487 	),
2488 
2489 	TP_fast_assign(
2490 		__entry->dev		= sb->s_dev;
2491 		__entry->nr_shrunk	= nr_shrunk;
2492 		__entry->cache_cnt	= cache_cnt;
2493 	),
2494 
2495 	TP_printk("dev %d,%d nr_shrunk %d cache_cnt %d",
2496 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2497 		  __entry->nr_shrunk, __entry->cache_cnt)
2498 );
2499 
2500 TRACE_EVENT(ext4_collapse_range,
2501 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2502 
2503 	TP_ARGS(inode, offset, len),
2504 
2505 	TP_STRUCT__entry(
2506 		__field(dev_t,	dev)
2507 		__field(ino_t,	ino)
2508 		__field(loff_t,	offset)
2509 		__field(loff_t, len)
2510 	),
2511 
2512 	TP_fast_assign(
2513 		__entry->dev	= inode->i_sb->s_dev;
2514 		__entry->ino	= inode->i_ino;
2515 		__entry->offset	= offset;
2516 		__entry->len	= len;
2517 	),
2518 
2519 	TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2520 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2521 		  (unsigned long) __entry->ino,
2522 		  __entry->offset, __entry->len)
2523 );
2524 
2525 TRACE_EVENT(ext4_insert_range,
2526 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2527 
2528 	TP_ARGS(inode, offset, len),
2529 
2530 	TP_STRUCT__entry(
2531 		__field(dev_t,	dev)
2532 		__field(ino_t,	ino)
2533 		__field(loff_t,	offset)
2534 		__field(loff_t, len)
2535 	),
2536 
2537 	TP_fast_assign(
2538 		__entry->dev	= inode->i_sb->s_dev;
2539 		__entry->ino	= inode->i_ino;
2540 		__entry->offset	= offset;
2541 		__entry->len	= len;
2542 	),
2543 
2544 	TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2545 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2546 		  (unsigned long) __entry->ino,
2547 		  __entry->offset, __entry->len)
2548 );
2549 
2550 TRACE_EVENT(ext4_es_shrink,
2551 	TP_PROTO(struct super_block *sb, int nr_shrunk, u64 scan_time,
2552 		 int nr_skipped, int retried),
2553 
2554 	TP_ARGS(sb, nr_shrunk, scan_time, nr_skipped, retried),
2555 
2556 	TP_STRUCT__entry(
2557 		__field(	dev_t,		dev		)
2558 		__field(	int,		nr_shrunk	)
2559 		__field(	unsigned long long, scan_time	)
2560 		__field(	int,		nr_skipped	)
2561 		__field(	int,		retried		)
2562 	),
2563 
2564 	TP_fast_assign(
2565 		__entry->dev		= sb->s_dev;
2566 		__entry->nr_shrunk	= nr_shrunk;
2567 		__entry->scan_time	= div_u64(scan_time, 1000);
2568 		__entry->nr_skipped	= nr_skipped;
2569 		__entry->retried	= retried;
2570 	),
2571 
2572 	TP_printk("dev %d,%d nr_shrunk %d, scan_time %llu "
2573 		  "nr_skipped %d retried %d",
2574 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->nr_shrunk,
2575 		  __entry->scan_time, __entry->nr_skipped, __entry->retried)
2576 );
2577 
2578 TRACE_EVENT(ext4_es_insert_delayed_block,
2579 	TP_PROTO(struct inode *inode, struct extent_status *es,
2580 		 bool allocated),
2581 
2582 	TP_ARGS(inode, es, allocated),
2583 
2584 	TP_STRUCT__entry(
2585 		__field(	dev_t,		dev		)
2586 		__field(	ino_t,		ino		)
2587 		__field(	ext4_lblk_t,	lblk		)
2588 		__field(	ext4_lblk_t,	len		)
2589 		__field(	ext4_fsblk_t,	pblk		)
2590 		__field(	char,		status		)
2591 		__field(	bool,		allocated	)
2592 	),
2593 
2594 	TP_fast_assign(
2595 		__entry->dev		= inode->i_sb->s_dev;
2596 		__entry->ino		= inode->i_ino;
2597 		__entry->lblk		= es->es_lblk;
2598 		__entry->len		= es->es_len;
2599 		__entry->pblk		= ext4_es_show_pblock(es);
2600 		__entry->status		= ext4_es_status(es);
2601 		__entry->allocated	= allocated;
2602 	),
2603 
2604 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s "
2605 		  "allocated %d",
2606 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2607 		  (unsigned long) __entry->ino,
2608 		  __entry->lblk, __entry->len,
2609 		  __entry->pblk, show_extent_status(__entry->status),
2610 		  __entry->allocated)
2611 );
2612 
2613 /* fsmap traces */
2614 DECLARE_EVENT_CLASS(ext4_fsmap_class,
2615 	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len,
2616 		 u64 owner),
2617 	TP_ARGS(sb, keydev, agno, bno, len, owner),
2618 	TP_STRUCT__entry(
2619 		__field(dev_t, dev)
2620 		__field(dev_t, keydev)
2621 		__field(u32, agno)
2622 		__field(u64, bno)
2623 		__field(u64, len)
2624 		__field(u64, owner)
2625 	),
2626 	TP_fast_assign(
2627 		__entry->dev = sb->s_bdev->bd_dev;
2628 		__entry->keydev = new_decode_dev(keydev);
2629 		__entry->agno = agno;
2630 		__entry->bno = bno;
2631 		__entry->len = len;
2632 		__entry->owner = owner;
2633 	),
2634 	TP_printk("dev %d:%d keydev %d:%d agno %u bno %llu len %llu owner %lld\n",
2635 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2636 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
2637 		  __entry->agno,
2638 		  __entry->bno,
2639 		  __entry->len,
2640 		  __entry->owner)
2641 )
2642 #define DEFINE_FSMAP_EVENT(name) \
2643 DEFINE_EVENT(ext4_fsmap_class, name, \
2644 	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len, \
2645 		 u64 owner), \
2646 	TP_ARGS(sb, keydev, agno, bno, len, owner))
2647 DEFINE_FSMAP_EVENT(ext4_fsmap_low_key);
2648 DEFINE_FSMAP_EVENT(ext4_fsmap_high_key);
2649 DEFINE_FSMAP_EVENT(ext4_fsmap_mapping);
2650 
2651 DECLARE_EVENT_CLASS(ext4_getfsmap_class,
2652 	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap),
2653 	TP_ARGS(sb, fsmap),
2654 	TP_STRUCT__entry(
2655 		__field(dev_t, dev)
2656 		__field(dev_t, keydev)
2657 		__field(u64, block)
2658 		__field(u64, len)
2659 		__field(u64, owner)
2660 		__field(u64, flags)
2661 	),
2662 	TP_fast_assign(
2663 		__entry->dev = sb->s_bdev->bd_dev;
2664 		__entry->keydev = new_decode_dev(fsmap->fmr_device);
2665 		__entry->block = fsmap->fmr_physical;
2666 		__entry->len = fsmap->fmr_length;
2667 		__entry->owner = fsmap->fmr_owner;
2668 		__entry->flags = fsmap->fmr_flags;
2669 	),
2670 	TP_printk("dev %d:%d keydev %d:%d block %llu len %llu owner %lld flags 0x%llx\n",
2671 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2672 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
2673 		  __entry->block,
2674 		  __entry->len,
2675 		  __entry->owner,
2676 		  __entry->flags)
2677 )
2678 #define DEFINE_GETFSMAP_EVENT(name) \
2679 DEFINE_EVENT(ext4_getfsmap_class, name, \
2680 	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap), \
2681 	TP_ARGS(sb, fsmap))
2682 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_low_key);
2683 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_high_key);
2684 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_mapping);
2685 
2686 TRACE_EVENT(ext4_shutdown,
2687 	TP_PROTO(struct super_block *sb, unsigned long flags),
2688 
2689 	TP_ARGS(sb, flags),
2690 
2691 	TP_STRUCT__entry(
2692 		__field(	dev_t,	dev			)
2693 		__field(     unsigned,	flags			)
2694 	),
2695 
2696 	TP_fast_assign(
2697 		__entry->dev	= sb->s_dev;
2698 		__entry->flags	= flags;
2699 	),
2700 
2701 	TP_printk("dev %d,%d flags %u",
2702 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2703 		  __entry->flags)
2704 );
2705 
2706 TRACE_EVENT(ext4_error,
2707 	TP_PROTO(struct super_block *sb, const char *function,
2708 		 unsigned int line),
2709 
2710 	TP_ARGS(sb, function, line),
2711 
2712 	TP_STRUCT__entry(
2713 		__field(	dev_t,	dev			)
2714 		__field( const char *,	function		)
2715 		__field(     unsigned,	line			)
2716 	),
2717 
2718 	TP_fast_assign(
2719 		__entry->dev	= sb->s_dev;
2720 		__entry->function = function;
2721 		__entry->line	= line;
2722 	),
2723 
2724 	TP_printk("dev %d,%d function %s line %u",
2725 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2726 		  __entry->function, __entry->line)
2727 );
2728 
2729 #endif /* _TRACE_EXT4_H */
2730 
2731 /* This part must be outside protection */
2732 #include <trace/define_trace.h>
2733