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