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