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