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