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