xref: /openbmc/linux/include/trace/events/ext4.h (revision 5a158981)
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 		 int revoke_creds, unsigned long IP),
1750 
1751 	TP_ARGS(sb, blocks, rsv_blocks, revoke_creds, 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 		__field(	  int,	revoke_creds		)
1759 	),
1760 
1761 	TP_fast_assign(
1762 		__entry->dev		 = sb->s_dev;
1763 		__entry->ip		 = IP;
1764 		__entry->blocks		 = blocks;
1765 		__entry->rsv_blocks	 = rsv_blocks;
1766 		__entry->revoke_creds	 = revoke_creds;
1767 	),
1768 
1769 	TP_printk("dev %d,%d blocks %d, rsv_blocks %d, revoke_creds %d, "
1770 		  "caller %pS", MAJOR(__entry->dev), MINOR(__entry->dev),
1771 		  __entry->blocks, __entry->rsv_blocks, __entry->revoke_creds,
1772 		  (void *)__entry->ip)
1773 );
1774 
1775 TRACE_EVENT(ext4_journal_start_reserved,
1776 	TP_PROTO(struct super_block *sb, int blocks, unsigned long IP),
1777 
1778 	TP_ARGS(sb, blocks, IP),
1779 
1780 	TP_STRUCT__entry(
1781 		__field(	dev_t,	dev			)
1782 		__field(unsigned long,	ip			)
1783 		__field(	  int,	blocks			)
1784 	),
1785 
1786 	TP_fast_assign(
1787 		__entry->dev		 = sb->s_dev;
1788 		__entry->ip		 = IP;
1789 		__entry->blocks		 = blocks;
1790 	),
1791 
1792 	TP_printk("dev %d,%d blocks, %d caller %pS",
1793 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1794 		  __entry->blocks, (void *)__entry->ip)
1795 );
1796 
1797 DECLARE_EVENT_CLASS(ext4__trim,
1798 	TP_PROTO(struct super_block *sb,
1799 		 ext4_group_t group,
1800 		 ext4_grpblk_t start,
1801 		 ext4_grpblk_t len),
1802 
1803 	TP_ARGS(sb, group, start, len),
1804 
1805 	TP_STRUCT__entry(
1806 		__field(	int,	dev_major		)
1807 		__field(	int,	dev_minor		)
1808 		__field(	__u32, 	group			)
1809 		__field(	int,	start			)
1810 		__field(	int,	len			)
1811 	),
1812 
1813 	TP_fast_assign(
1814 		__entry->dev_major	= MAJOR(sb->s_dev);
1815 		__entry->dev_minor	= MINOR(sb->s_dev);
1816 		__entry->group		= group;
1817 		__entry->start		= start;
1818 		__entry->len		= len;
1819 	),
1820 
1821 	TP_printk("dev %d,%d group %u, start %d, len %d",
1822 		  __entry->dev_major, __entry->dev_minor,
1823 		  __entry->group, __entry->start, __entry->len)
1824 );
1825 
1826 DEFINE_EVENT(ext4__trim, ext4_trim_extent,
1827 
1828 	TP_PROTO(struct super_block *sb,
1829 		 ext4_group_t group,
1830 		 ext4_grpblk_t start,
1831 		 ext4_grpblk_t len),
1832 
1833 	TP_ARGS(sb, group, start, len)
1834 );
1835 
1836 DEFINE_EVENT(ext4__trim, ext4_trim_all_free,
1837 
1838 	TP_PROTO(struct super_block *sb,
1839 		 ext4_group_t group,
1840 		 ext4_grpblk_t start,
1841 		 ext4_grpblk_t len),
1842 
1843 	TP_ARGS(sb, group, start, len)
1844 );
1845 
1846 TRACE_EVENT(ext4_ext_handle_unwritten_extents,
1847 	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1848 		 unsigned int allocated, ext4_fsblk_t newblock),
1849 
1850 	TP_ARGS(inode, map, flags, allocated, newblock),
1851 
1852 	TP_STRUCT__entry(
1853 		__field(	dev_t,		dev		)
1854 		__field(	ino_t,		ino		)
1855 		__field(	int,		flags		)
1856 		__field(	ext4_lblk_t,	lblk		)
1857 		__field(	ext4_fsblk_t,	pblk		)
1858 		__field(	unsigned int,	len		)
1859 		__field(	unsigned int,	allocated	)
1860 		__field(	ext4_fsblk_t,	newblk		)
1861 	),
1862 
1863 	TP_fast_assign(
1864 		__entry->dev		= inode->i_sb->s_dev;
1865 		__entry->ino		= inode->i_ino;
1866 		__entry->flags		= flags;
1867 		__entry->lblk		= map->m_lblk;
1868 		__entry->pblk		= map->m_pblk;
1869 		__entry->len		= map->m_len;
1870 		__entry->allocated	= allocated;
1871 		__entry->newblk		= newblock;
1872 	),
1873 
1874 	TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %s "
1875 		  "allocated %d newblock %llu",
1876 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1877 		  (unsigned long) __entry->ino,
1878 		  (unsigned) __entry->lblk, (unsigned long long) __entry->pblk,
1879 		  __entry->len, show_map_flags(__entry->flags),
1880 		  (unsigned int) __entry->allocated,
1881 		  (unsigned long long) __entry->newblk)
1882 );
1883 
1884 TRACE_EVENT(ext4_get_implied_cluster_alloc_exit,
1885 	TP_PROTO(struct super_block *sb, struct ext4_map_blocks *map, int ret),
1886 
1887 	TP_ARGS(sb, map, ret),
1888 
1889 	TP_STRUCT__entry(
1890 		__field(	dev_t,		dev	)
1891 		__field(	unsigned int,	flags	)
1892 		__field(	ext4_lblk_t,	lblk	)
1893 		__field(	ext4_fsblk_t,	pblk	)
1894 		__field(	unsigned int,	len	)
1895 		__field(	int,		ret	)
1896 	),
1897 
1898 	TP_fast_assign(
1899 		__entry->dev	= sb->s_dev;
1900 		__entry->flags	= map->m_flags;
1901 		__entry->lblk	= map->m_lblk;
1902 		__entry->pblk	= map->m_pblk;
1903 		__entry->len	= map->m_len;
1904 		__entry->ret	= ret;
1905 	),
1906 
1907 	TP_printk("dev %d,%d m_lblk %u m_pblk %llu m_len %u m_flags %s ret %d",
1908 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1909 		  __entry->lblk, (unsigned long long) __entry->pblk,
1910 		  __entry->len, show_mflags(__entry->flags), __entry->ret)
1911 );
1912 
1913 TRACE_EVENT(ext4_ext_put_in_cache,
1914 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, unsigned int len,
1915 		 ext4_fsblk_t start),
1916 
1917 	TP_ARGS(inode, lblk, len, start),
1918 
1919 	TP_STRUCT__entry(
1920 		__field(	dev_t,		dev	)
1921 		__field(	ino_t,		ino	)
1922 		__field(	ext4_lblk_t,	lblk	)
1923 		__field(	unsigned int,	len	)
1924 		__field(	ext4_fsblk_t,	start	)
1925 	),
1926 
1927 	TP_fast_assign(
1928 		__entry->dev	= inode->i_sb->s_dev;
1929 		__entry->ino	= inode->i_ino;
1930 		__entry->lblk	= lblk;
1931 		__entry->len	= len;
1932 		__entry->start	= start;
1933 	),
1934 
1935 	TP_printk("dev %d,%d ino %lu lblk %u len %u start %llu",
1936 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1937 		  (unsigned long) __entry->ino,
1938 		  (unsigned) __entry->lblk,
1939 		  __entry->len,
1940 		  (unsigned long long) __entry->start)
1941 );
1942 
1943 TRACE_EVENT(ext4_ext_in_cache,
1944 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, int ret),
1945 
1946 	TP_ARGS(inode, lblk, ret),
1947 
1948 	TP_STRUCT__entry(
1949 		__field(	dev_t,		dev	)
1950 		__field(	ino_t,		ino	)
1951 		__field(	ext4_lblk_t,	lblk	)
1952 		__field(	int,		ret	)
1953 	),
1954 
1955 	TP_fast_assign(
1956 		__entry->dev	= inode->i_sb->s_dev;
1957 		__entry->ino	= inode->i_ino;
1958 		__entry->lblk	= lblk;
1959 		__entry->ret	= ret;
1960 	),
1961 
1962 	TP_printk("dev %d,%d ino %lu lblk %u ret %d",
1963 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1964 		  (unsigned long) __entry->ino,
1965 		  (unsigned) __entry->lblk,
1966 		  __entry->ret)
1967 
1968 );
1969 
1970 TRACE_EVENT(ext4_find_delalloc_range,
1971 	TP_PROTO(struct inode *inode, ext4_lblk_t from, ext4_lblk_t to,
1972 		int reverse, int found, ext4_lblk_t found_blk),
1973 
1974 	TP_ARGS(inode, from, to, reverse, found, found_blk),
1975 
1976 	TP_STRUCT__entry(
1977 		__field(	dev_t,		dev		)
1978 		__field(	ino_t,		ino		)
1979 		__field(	ext4_lblk_t,	from		)
1980 		__field(	ext4_lblk_t,	to		)
1981 		__field(	int,		reverse		)
1982 		__field(	int,		found		)
1983 		__field(	ext4_lblk_t,	found_blk	)
1984 	),
1985 
1986 	TP_fast_assign(
1987 		__entry->dev		= inode->i_sb->s_dev;
1988 		__entry->ino		= inode->i_ino;
1989 		__entry->from		= from;
1990 		__entry->to		= to;
1991 		__entry->reverse	= reverse;
1992 		__entry->found		= found;
1993 		__entry->found_blk	= found_blk;
1994 	),
1995 
1996 	TP_printk("dev %d,%d ino %lu from %u to %u reverse %d found %d "
1997 		  "(blk = %u)",
1998 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1999 		  (unsigned long) __entry->ino,
2000 		  (unsigned) __entry->from, (unsigned) __entry->to,
2001 		  __entry->reverse, __entry->found,
2002 		  (unsigned) __entry->found_blk)
2003 );
2004 
2005 TRACE_EVENT(ext4_get_reserved_cluster_alloc,
2006 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, unsigned int len),
2007 
2008 	TP_ARGS(inode, lblk, len),
2009 
2010 	TP_STRUCT__entry(
2011 		__field(	dev_t,		dev	)
2012 		__field(	ino_t,		ino	)
2013 		__field(	ext4_lblk_t,	lblk	)
2014 		__field(	unsigned int,	len	)
2015 	),
2016 
2017 	TP_fast_assign(
2018 		__entry->dev	= inode->i_sb->s_dev;
2019 		__entry->ino	= inode->i_ino;
2020 		__entry->lblk	= lblk;
2021 		__entry->len	= len;
2022 	),
2023 
2024 	TP_printk("dev %d,%d ino %lu lblk %u len %u",
2025 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2026 		  (unsigned long) __entry->ino,
2027 		  (unsigned) __entry->lblk,
2028 		  __entry->len)
2029 );
2030 
2031 TRACE_EVENT(ext4_ext_show_extent,
2032 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk,
2033 		 unsigned short len),
2034 
2035 	TP_ARGS(inode, lblk, pblk, len),
2036 
2037 	TP_STRUCT__entry(
2038 		__field(	dev_t,		dev	)
2039 		__field(	ino_t,		ino	)
2040 		__field(	ext4_fsblk_t,	pblk	)
2041 		__field(	ext4_lblk_t,	lblk	)
2042 		__field(	unsigned short,	len	)
2043 	),
2044 
2045 	TP_fast_assign(
2046 		__entry->dev	= inode->i_sb->s_dev;
2047 		__entry->ino	= inode->i_ino;
2048 		__entry->pblk	= pblk;
2049 		__entry->lblk	= lblk;
2050 		__entry->len	= len;
2051 	),
2052 
2053 	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u",
2054 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2055 		  (unsigned long) __entry->ino,
2056 		  (unsigned) __entry->lblk,
2057 		  (unsigned long long) __entry->pblk,
2058 		  (unsigned short) __entry->len)
2059 );
2060 
2061 TRACE_EVENT(ext4_remove_blocks,
2062 	TP_PROTO(struct inode *inode, struct ext4_extent *ex,
2063 		 ext4_lblk_t from, ext4_fsblk_t to,
2064 		 struct partial_cluster *pc),
2065 
2066 	TP_ARGS(inode, ex, from, to, pc),
2067 
2068 	TP_STRUCT__entry(
2069 		__field(	dev_t,		dev	)
2070 		__field(	ino_t,		ino	)
2071 		__field(	ext4_lblk_t,	from	)
2072 		__field(	ext4_lblk_t,	to	)
2073 		__field(	ext4_fsblk_t,	ee_pblk	)
2074 		__field(	ext4_lblk_t,	ee_lblk	)
2075 		__field(	unsigned short,	ee_len	)
2076 		__field(	ext4_fsblk_t,	pc_pclu	)
2077 		__field(	ext4_lblk_t,	pc_lblk	)
2078 		__field(	int,		pc_state)
2079 	),
2080 
2081 	TP_fast_assign(
2082 		__entry->dev		= inode->i_sb->s_dev;
2083 		__entry->ino		= inode->i_ino;
2084 		__entry->from		= from;
2085 		__entry->to		= to;
2086 		__entry->ee_pblk	= ext4_ext_pblock(ex);
2087 		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
2088 		__entry->ee_len		= ext4_ext_get_actual_len(ex);
2089 		__entry->pc_pclu	= pc->pclu;
2090 		__entry->pc_lblk	= pc->lblk;
2091 		__entry->pc_state	= pc->state;
2092 	),
2093 
2094 	TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]"
2095 		  "from %u to %u partial [pclu %lld lblk %u state %d]",
2096 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2097 		  (unsigned long) __entry->ino,
2098 		  (unsigned) __entry->ee_lblk,
2099 		  (unsigned long long) __entry->ee_pblk,
2100 		  (unsigned short) __entry->ee_len,
2101 		  (unsigned) __entry->from,
2102 		  (unsigned) __entry->to,
2103 		  (long long) __entry->pc_pclu,
2104 		  (unsigned int) __entry->pc_lblk,
2105 		  (int) __entry->pc_state)
2106 );
2107 
2108 TRACE_EVENT(ext4_ext_rm_leaf,
2109 	TP_PROTO(struct inode *inode, ext4_lblk_t start,
2110 		 struct ext4_extent *ex,
2111 		 struct partial_cluster *pc),
2112 
2113 	TP_ARGS(inode, start, ex, pc),
2114 
2115 	TP_STRUCT__entry(
2116 		__field(	dev_t,		dev	)
2117 		__field(	ino_t,		ino	)
2118 		__field(	ext4_lblk_t,	start	)
2119 		__field(	ext4_lblk_t,	ee_lblk	)
2120 		__field(	ext4_fsblk_t,	ee_pblk	)
2121 		__field(	short,		ee_len	)
2122 		__field(	ext4_fsblk_t,	pc_pclu	)
2123 		__field(	ext4_lblk_t,	pc_lblk	)
2124 		__field(	int,		pc_state)
2125 	),
2126 
2127 	TP_fast_assign(
2128 		__entry->dev		= inode->i_sb->s_dev;
2129 		__entry->ino		= inode->i_ino;
2130 		__entry->start		= start;
2131 		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
2132 		__entry->ee_pblk	= ext4_ext_pblock(ex);
2133 		__entry->ee_len		= ext4_ext_get_actual_len(ex);
2134 		__entry->pc_pclu	= pc->pclu;
2135 		__entry->pc_lblk	= pc->lblk;
2136 		__entry->pc_state	= pc->state;
2137 	),
2138 
2139 	TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]"
2140 		  "partial [pclu %lld lblk %u state %d]",
2141 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2142 		  (unsigned long) __entry->ino,
2143 		  (unsigned) __entry->start,
2144 		  (unsigned) __entry->ee_lblk,
2145 		  (unsigned long long) __entry->ee_pblk,
2146 		  (unsigned short) __entry->ee_len,
2147 		  (long long) __entry->pc_pclu,
2148 		  (unsigned int) __entry->pc_lblk,
2149 		  (int) __entry->pc_state)
2150 );
2151 
2152 TRACE_EVENT(ext4_ext_rm_idx,
2153 	TP_PROTO(struct inode *inode, ext4_fsblk_t pblk),
2154 
2155 	TP_ARGS(inode, pblk),
2156 
2157 	TP_STRUCT__entry(
2158 		__field(	dev_t,		dev	)
2159 		__field(	ino_t,		ino	)
2160 		__field(	ext4_fsblk_t,	pblk	)
2161 	),
2162 
2163 	TP_fast_assign(
2164 		__entry->dev	= inode->i_sb->s_dev;
2165 		__entry->ino	= inode->i_ino;
2166 		__entry->pblk	= pblk;
2167 	),
2168 
2169 	TP_printk("dev %d,%d ino %lu index_pblk %llu",
2170 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2171 		  (unsigned long) __entry->ino,
2172 		  (unsigned long long) __entry->pblk)
2173 );
2174 
2175 TRACE_EVENT(ext4_ext_remove_space,
2176 	TP_PROTO(struct inode *inode, ext4_lblk_t start,
2177 		 ext4_lblk_t end, int depth),
2178 
2179 	TP_ARGS(inode, start, end, depth),
2180 
2181 	TP_STRUCT__entry(
2182 		__field(	dev_t,		dev	)
2183 		__field(	ino_t,		ino	)
2184 		__field(	ext4_lblk_t,	start	)
2185 		__field(	ext4_lblk_t,	end	)
2186 		__field(	int,		depth	)
2187 	),
2188 
2189 	TP_fast_assign(
2190 		__entry->dev	= inode->i_sb->s_dev;
2191 		__entry->ino	= inode->i_ino;
2192 		__entry->start	= start;
2193 		__entry->end	= end;
2194 		__entry->depth	= depth;
2195 	),
2196 
2197 	TP_printk("dev %d,%d ino %lu since %u end %u depth %d",
2198 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2199 		  (unsigned long) __entry->ino,
2200 		  (unsigned) __entry->start,
2201 		  (unsigned) __entry->end,
2202 		  __entry->depth)
2203 );
2204 
2205 TRACE_EVENT(ext4_ext_remove_space_done,
2206 	TP_PROTO(struct inode *inode, ext4_lblk_t start, ext4_lblk_t end,
2207 		 int depth, struct partial_cluster *pc, __le16 eh_entries),
2208 
2209 	TP_ARGS(inode, start, end, depth, pc, eh_entries),
2210 
2211 	TP_STRUCT__entry(
2212 		__field(	dev_t,		dev		)
2213 		__field(	ino_t,		ino		)
2214 		__field(	ext4_lblk_t,	start		)
2215 		__field(	ext4_lblk_t,	end		)
2216 		__field(	int,		depth		)
2217 		__field(	ext4_fsblk_t,	pc_pclu		)
2218 		__field(	ext4_lblk_t,	pc_lblk		)
2219 		__field(	int,		pc_state	)
2220 		__field(	unsigned short,	eh_entries	)
2221 	),
2222 
2223 	TP_fast_assign(
2224 		__entry->dev		= inode->i_sb->s_dev;
2225 		__entry->ino		= inode->i_ino;
2226 		__entry->start		= start;
2227 		__entry->end		= end;
2228 		__entry->depth		= depth;
2229 		__entry->pc_pclu	= pc->pclu;
2230 		__entry->pc_lblk	= pc->lblk;
2231 		__entry->pc_state	= pc->state;
2232 		__entry->eh_entries	= le16_to_cpu(eh_entries);
2233 	),
2234 
2235 	TP_printk("dev %d,%d ino %lu since %u end %u depth %d "
2236 		  "partial [pclu %lld lblk %u state %d] "
2237 		  "remaining_entries %u",
2238 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2239 		  (unsigned long) __entry->ino,
2240 		  (unsigned) __entry->start,
2241 		  (unsigned) __entry->end,
2242 		  __entry->depth,
2243 		  (long long) __entry->pc_pclu,
2244 		  (unsigned int) __entry->pc_lblk,
2245 		  (int) __entry->pc_state,
2246 		  (unsigned short) __entry->eh_entries)
2247 );
2248 
2249 DECLARE_EVENT_CLASS(ext4__es_extent,
2250 	TP_PROTO(struct inode *inode, struct extent_status *es),
2251 
2252 	TP_ARGS(inode, es),
2253 
2254 	TP_STRUCT__entry(
2255 		__field(	dev_t,		dev		)
2256 		__field(	ino_t,		ino		)
2257 		__field(	ext4_lblk_t,	lblk		)
2258 		__field(	ext4_lblk_t,	len		)
2259 		__field(	ext4_fsblk_t,	pblk		)
2260 		__field(	char, status	)
2261 	),
2262 
2263 	TP_fast_assign(
2264 		__entry->dev	= inode->i_sb->s_dev;
2265 		__entry->ino	= inode->i_ino;
2266 		__entry->lblk	= es->es_lblk;
2267 		__entry->len	= es->es_len;
2268 		__entry->pblk	= ext4_es_pblock(es);
2269 		__entry->status	= ext4_es_status(es);
2270 	),
2271 
2272 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2273 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2274 		  (unsigned long) __entry->ino,
2275 		  __entry->lblk, __entry->len,
2276 		  __entry->pblk, show_extent_status(__entry->status))
2277 );
2278 
2279 DEFINE_EVENT(ext4__es_extent, ext4_es_insert_extent,
2280 	TP_PROTO(struct inode *inode, struct extent_status *es),
2281 
2282 	TP_ARGS(inode, es)
2283 );
2284 
2285 DEFINE_EVENT(ext4__es_extent, ext4_es_cache_extent,
2286 	TP_PROTO(struct inode *inode, struct extent_status *es),
2287 
2288 	TP_ARGS(inode, es)
2289 );
2290 
2291 TRACE_EVENT(ext4_es_remove_extent,
2292 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t len),
2293 
2294 	TP_ARGS(inode, lblk, len),
2295 
2296 	TP_STRUCT__entry(
2297 		__field(	dev_t,	dev			)
2298 		__field(	ino_t,	ino			)
2299 		__field(	loff_t,	lblk			)
2300 		__field(	loff_t,	len			)
2301 	),
2302 
2303 	TP_fast_assign(
2304 		__entry->dev	= inode->i_sb->s_dev;
2305 		__entry->ino	= inode->i_ino;
2306 		__entry->lblk	= lblk;
2307 		__entry->len	= len;
2308 	),
2309 
2310 	TP_printk("dev %d,%d ino %lu es [%lld/%lld)",
2311 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2312 		  (unsigned long) __entry->ino,
2313 		  __entry->lblk, __entry->len)
2314 );
2315 
2316 TRACE_EVENT(ext4_es_find_extent_range_enter,
2317 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2318 
2319 	TP_ARGS(inode, lblk),
2320 
2321 	TP_STRUCT__entry(
2322 		__field(	dev_t,		dev		)
2323 		__field(	ino_t,		ino		)
2324 		__field(	ext4_lblk_t,	lblk		)
2325 	),
2326 
2327 	TP_fast_assign(
2328 		__entry->dev	= inode->i_sb->s_dev;
2329 		__entry->ino	= inode->i_ino;
2330 		__entry->lblk	= lblk;
2331 	),
2332 
2333 	TP_printk("dev %d,%d ino %lu lblk %u",
2334 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2335 		  (unsigned long) __entry->ino, __entry->lblk)
2336 );
2337 
2338 TRACE_EVENT(ext4_es_find_extent_range_exit,
2339 	TP_PROTO(struct inode *inode, struct extent_status *es),
2340 
2341 	TP_ARGS(inode, es),
2342 
2343 	TP_STRUCT__entry(
2344 		__field(	dev_t,		dev		)
2345 		__field(	ino_t,		ino		)
2346 		__field(	ext4_lblk_t,	lblk		)
2347 		__field(	ext4_lblk_t,	len		)
2348 		__field(	ext4_fsblk_t,	pblk		)
2349 		__field(	char, status	)
2350 	),
2351 
2352 	TP_fast_assign(
2353 		__entry->dev	= inode->i_sb->s_dev;
2354 		__entry->ino	= inode->i_ino;
2355 		__entry->lblk	= es->es_lblk;
2356 		__entry->len	= es->es_len;
2357 		__entry->pblk	= ext4_es_pblock(es);
2358 		__entry->status	= ext4_es_status(es);
2359 	),
2360 
2361 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2362 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2363 		  (unsigned long) __entry->ino,
2364 		  __entry->lblk, __entry->len,
2365 		  __entry->pblk, show_extent_status(__entry->status))
2366 );
2367 
2368 TRACE_EVENT(ext4_es_lookup_extent_enter,
2369 	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2370 
2371 	TP_ARGS(inode, lblk),
2372 
2373 	TP_STRUCT__entry(
2374 		__field(	dev_t,		dev		)
2375 		__field(	ino_t,		ino		)
2376 		__field(	ext4_lblk_t,	lblk		)
2377 	),
2378 
2379 	TP_fast_assign(
2380 		__entry->dev	= inode->i_sb->s_dev;
2381 		__entry->ino	= inode->i_ino;
2382 		__entry->lblk	= lblk;
2383 	),
2384 
2385 	TP_printk("dev %d,%d ino %lu lblk %u",
2386 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2387 		  (unsigned long) __entry->ino, __entry->lblk)
2388 );
2389 
2390 TRACE_EVENT(ext4_es_lookup_extent_exit,
2391 	TP_PROTO(struct inode *inode, struct extent_status *es,
2392 		 int found),
2393 
2394 	TP_ARGS(inode, es, found),
2395 
2396 	TP_STRUCT__entry(
2397 		__field(	dev_t,		dev		)
2398 		__field(	ino_t,		ino		)
2399 		__field(	ext4_lblk_t,	lblk		)
2400 		__field(	ext4_lblk_t,	len		)
2401 		__field(	ext4_fsblk_t,	pblk		)
2402 		__field(	char,		status		)
2403 		__field(	int,		found		)
2404 	),
2405 
2406 	TP_fast_assign(
2407 		__entry->dev	= inode->i_sb->s_dev;
2408 		__entry->ino	= inode->i_ino;
2409 		__entry->lblk	= es->es_lblk;
2410 		__entry->len	= es->es_len;
2411 		__entry->pblk	= ext4_es_pblock(es);
2412 		__entry->status	= ext4_es_status(es);
2413 		__entry->found	= found;
2414 	),
2415 
2416 	TP_printk("dev %d,%d ino %lu found %d [%u/%u) %llu %s",
2417 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2418 		  (unsigned long) __entry->ino, __entry->found,
2419 		  __entry->lblk, __entry->len,
2420 		  __entry->found ? __entry->pblk : 0,
2421 		  show_extent_status(__entry->found ? __entry->status : 0))
2422 );
2423 
2424 DECLARE_EVENT_CLASS(ext4__es_shrink_enter,
2425 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2426 
2427 	TP_ARGS(sb, nr_to_scan, cache_cnt),
2428 
2429 	TP_STRUCT__entry(
2430 		__field(	dev_t,	dev			)
2431 		__field(	int,	nr_to_scan		)
2432 		__field(	int,	cache_cnt		)
2433 	),
2434 
2435 	TP_fast_assign(
2436 		__entry->dev		= sb->s_dev;
2437 		__entry->nr_to_scan	= nr_to_scan;
2438 		__entry->cache_cnt	= cache_cnt;
2439 	),
2440 
2441 	TP_printk("dev %d,%d nr_to_scan %d cache_cnt %d",
2442 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2443 		  __entry->nr_to_scan, __entry->cache_cnt)
2444 );
2445 
2446 DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_count,
2447 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2448 
2449 	TP_ARGS(sb, nr_to_scan, cache_cnt)
2450 );
2451 
2452 DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_scan_enter,
2453 	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2454 
2455 	TP_ARGS(sb, nr_to_scan, cache_cnt)
2456 );
2457 
2458 TRACE_EVENT(ext4_es_shrink_scan_exit,
2459 	TP_PROTO(struct super_block *sb, int nr_shrunk, int cache_cnt),
2460 
2461 	TP_ARGS(sb, nr_shrunk, cache_cnt),
2462 
2463 	TP_STRUCT__entry(
2464 		__field(	dev_t,	dev			)
2465 		__field(	int,	nr_shrunk		)
2466 		__field(	int,	cache_cnt		)
2467 	),
2468 
2469 	TP_fast_assign(
2470 		__entry->dev		= sb->s_dev;
2471 		__entry->nr_shrunk	= nr_shrunk;
2472 		__entry->cache_cnt	= cache_cnt;
2473 	),
2474 
2475 	TP_printk("dev %d,%d nr_shrunk %d cache_cnt %d",
2476 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2477 		  __entry->nr_shrunk, __entry->cache_cnt)
2478 );
2479 
2480 TRACE_EVENT(ext4_collapse_range,
2481 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2482 
2483 	TP_ARGS(inode, offset, len),
2484 
2485 	TP_STRUCT__entry(
2486 		__field(dev_t,	dev)
2487 		__field(ino_t,	ino)
2488 		__field(loff_t,	offset)
2489 		__field(loff_t, len)
2490 	),
2491 
2492 	TP_fast_assign(
2493 		__entry->dev	= inode->i_sb->s_dev;
2494 		__entry->ino	= inode->i_ino;
2495 		__entry->offset	= offset;
2496 		__entry->len	= len;
2497 	),
2498 
2499 	TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2500 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2501 		  (unsigned long) __entry->ino,
2502 		  __entry->offset, __entry->len)
2503 );
2504 
2505 TRACE_EVENT(ext4_insert_range,
2506 	TP_PROTO(struct inode *inode, loff_t offset, loff_t len),
2507 
2508 	TP_ARGS(inode, offset, len),
2509 
2510 	TP_STRUCT__entry(
2511 		__field(dev_t,	dev)
2512 		__field(ino_t,	ino)
2513 		__field(loff_t,	offset)
2514 		__field(loff_t, len)
2515 	),
2516 
2517 	TP_fast_assign(
2518 		__entry->dev	= inode->i_sb->s_dev;
2519 		__entry->ino	= inode->i_ino;
2520 		__entry->offset	= offset;
2521 		__entry->len	= len;
2522 	),
2523 
2524 	TP_printk("dev %d,%d ino %lu offset %lld len %lld",
2525 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2526 		  (unsigned long) __entry->ino,
2527 		  __entry->offset, __entry->len)
2528 );
2529 
2530 TRACE_EVENT(ext4_es_shrink,
2531 	TP_PROTO(struct super_block *sb, int nr_shrunk, u64 scan_time,
2532 		 int nr_skipped, int retried),
2533 
2534 	TP_ARGS(sb, nr_shrunk, scan_time, nr_skipped, retried),
2535 
2536 	TP_STRUCT__entry(
2537 		__field(	dev_t,		dev		)
2538 		__field(	int,		nr_shrunk	)
2539 		__field(	unsigned long long, scan_time	)
2540 		__field(	int,		nr_skipped	)
2541 		__field(	int,		retried		)
2542 	),
2543 
2544 	TP_fast_assign(
2545 		__entry->dev		= sb->s_dev;
2546 		__entry->nr_shrunk	= nr_shrunk;
2547 		__entry->scan_time	= div_u64(scan_time, 1000);
2548 		__entry->nr_skipped	= nr_skipped;
2549 		__entry->retried	= retried;
2550 	),
2551 
2552 	TP_printk("dev %d,%d nr_shrunk %d, scan_time %llu "
2553 		  "nr_skipped %d retried %d",
2554 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->nr_shrunk,
2555 		  __entry->scan_time, __entry->nr_skipped, __entry->retried)
2556 );
2557 
2558 TRACE_EVENT(ext4_es_insert_delayed_block,
2559 	TP_PROTO(struct inode *inode, struct extent_status *es,
2560 		 bool allocated),
2561 
2562 	TP_ARGS(inode, es, allocated),
2563 
2564 	TP_STRUCT__entry(
2565 		__field(	dev_t,		dev		)
2566 		__field(	ino_t,		ino		)
2567 		__field(	ext4_lblk_t,	lblk		)
2568 		__field(	ext4_lblk_t,	len		)
2569 		__field(	ext4_fsblk_t,	pblk		)
2570 		__field(	char,		status		)
2571 		__field(	bool,		allocated	)
2572 	),
2573 
2574 	TP_fast_assign(
2575 		__entry->dev		= inode->i_sb->s_dev;
2576 		__entry->ino		= inode->i_ino;
2577 		__entry->lblk		= es->es_lblk;
2578 		__entry->len		= es->es_len;
2579 		__entry->pblk		= ext4_es_pblock(es);
2580 		__entry->status		= ext4_es_status(es);
2581 		__entry->allocated	= allocated;
2582 	),
2583 
2584 	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s "
2585 		  "allocated %d",
2586 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2587 		  (unsigned long) __entry->ino,
2588 		  __entry->lblk, __entry->len,
2589 		  __entry->pblk, show_extent_status(__entry->status),
2590 		  __entry->allocated)
2591 );
2592 
2593 /* fsmap traces */
2594 DECLARE_EVENT_CLASS(ext4_fsmap_class,
2595 	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len,
2596 		 u64 owner),
2597 	TP_ARGS(sb, keydev, agno, bno, len, owner),
2598 	TP_STRUCT__entry(
2599 		__field(dev_t, dev)
2600 		__field(dev_t, keydev)
2601 		__field(u32, agno)
2602 		__field(u64, bno)
2603 		__field(u64, len)
2604 		__field(u64, owner)
2605 	),
2606 	TP_fast_assign(
2607 		__entry->dev = sb->s_bdev->bd_dev;
2608 		__entry->keydev = new_decode_dev(keydev);
2609 		__entry->agno = agno;
2610 		__entry->bno = bno;
2611 		__entry->len = len;
2612 		__entry->owner = owner;
2613 	),
2614 	TP_printk("dev %d:%d keydev %d:%d agno %u bno %llu len %llu owner %lld\n",
2615 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2616 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
2617 		  __entry->agno,
2618 		  __entry->bno,
2619 		  __entry->len,
2620 		  __entry->owner)
2621 )
2622 #define DEFINE_FSMAP_EVENT(name) \
2623 DEFINE_EVENT(ext4_fsmap_class, name, \
2624 	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len, \
2625 		 u64 owner), \
2626 	TP_ARGS(sb, keydev, agno, bno, len, owner))
2627 DEFINE_FSMAP_EVENT(ext4_fsmap_low_key);
2628 DEFINE_FSMAP_EVENT(ext4_fsmap_high_key);
2629 DEFINE_FSMAP_EVENT(ext4_fsmap_mapping);
2630 
2631 DECLARE_EVENT_CLASS(ext4_getfsmap_class,
2632 	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap),
2633 	TP_ARGS(sb, fsmap),
2634 	TP_STRUCT__entry(
2635 		__field(dev_t, dev)
2636 		__field(dev_t, keydev)
2637 		__field(u64, block)
2638 		__field(u64, len)
2639 		__field(u64, owner)
2640 		__field(u64, flags)
2641 	),
2642 	TP_fast_assign(
2643 		__entry->dev = sb->s_bdev->bd_dev;
2644 		__entry->keydev = new_decode_dev(fsmap->fmr_device);
2645 		__entry->block = fsmap->fmr_physical;
2646 		__entry->len = fsmap->fmr_length;
2647 		__entry->owner = fsmap->fmr_owner;
2648 		__entry->flags = fsmap->fmr_flags;
2649 	),
2650 	TP_printk("dev %d:%d keydev %d:%d block %llu len %llu owner %lld flags 0x%llx\n",
2651 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2652 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
2653 		  __entry->block,
2654 		  __entry->len,
2655 		  __entry->owner,
2656 		  __entry->flags)
2657 )
2658 #define DEFINE_GETFSMAP_EVENT(name) \
2659 DEFINE_EVENT(ext4_getfsmap_class, name, \
2660 	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap), \
2661 	TP_ARGS(sb, fsmap))
2662 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_low_key);
2663 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_high_key);
2664 DEFINE_GETFSMAP_EVENT(ext4_getfsmap_mapping);
2665 
2666 TRACE_EVENT(ext4_shutdown,
2667 	TP_PROTO(struct super_block *sb, unsigned long flags),
2668 
2669 	TP_ARGS(sb, flags),
2670 
2671 	TP_STRUCT__entry(
2672 		__field(	dev_t,	dev			)
2673 		__field(     unsigned,	flags			)
2674 	),
2675 
2676 	TP_fast_assign(
2677 		__entry->dev	= sb->s_dev;
2678 		__entry->flags	= flags;
2679 	),
2680 
2681 	TP_printk("dev %d,%d flags %u",
2682 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2683 		  __entry->flags)
2684 );
2685 
2686 TRACE_EVENT(ext4_error,
2687 	TP_PROTO(struct super_block *sb, const char *function,
2688 		 unsigned int line),
2689 
2690 	TP_ARGS(sb, function, line),
2691 
2692 	TP_STRUCT__entry(
2693 		__field(	dev_t,	dev			)
2694 		__field( const char *,	function		)
2695 		__field(     unsigned,	line			)
2696 	),
2697 
2698 	TP_fast_assign(
2699 		__entry->dev	= sb->s_dev;
2700 		__entry->function = function;
2701 		__entry->line	= line;
2702 	),
2703 
2704 	TP_printk("dev %d,%d function %s line %u",
2705 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2706 		  __entry->function, __entry->line)
2707 );
2708 
2709 #endif /* _TRACE_EXT4_H */
2710 
2711 /* This part must be outside protection */
2712 #include <trace/define_trace.h>
2713