ext4.h 59.9 KB
Newer Older
1 2 3
#undef TRACE_SYSTEM
#define TRACE_SYSTEM ext4

4 5 6
#if !defined(_TRACE_EXT4_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_EXT4_H

7 8 9
#include <linux/writeback.h>
#include <linux/tracepoint.h>

10 11
struct ext4_allocation_context;
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 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
#define show_mballoc_flags(flags) __print_flags(flags, "|",	\
	{ EXT4_MB_HINT_MERGE,		"HINT_MERGE" },		\
	{ EXT4_MB_HINT_RESERVED,	"HINT_RESV" },		\
	{ EXT4_MB_HINT_METADATA,	"HINT_MDATA" },		\
	{ EXT4_MB_HINT_FIRST,		"HINT_FIRST" },		\
	{ EXT4_MB_HINT_BEST,		"HINT_BEST" },		\
	{ EXT4_MB_HINT_DATA,		"HINT_DATA" },		\
	{ EXT4_MB_HINT_NOPREALLOC,	"HINT_NOPREALLOC" },	\
	{ EXT4_MB_HINT_GROUP_ALLOC,	"HINT_GRP_ALLOC" },	\
	{ EXT4_MB_HINT_GOAL_ONLY,	"HINT_GOAL_ONLY" },	\
	{ EXT4_MB_HINT_TRY_GOAL,	"HINT_TRY_GOAL" },	\
	{ EXT4_MB_DELALLOC_RESERVED,	"DELALLOC_RESV" },	\
	{ EXT4_MB_STREAM_ALLOC,		"STREAM_ALLOC" },	\
	{ EXT4_MB_USE_ROOT_BLOCKS,	"USE_ROOT_BLKS" },	\
	{ EXT4_MB_USE_RESERVED,		"USE_RESV" })

#define show_map_flags(flags) __print_flags(flags, "|",			\
	{ EXT4_GET_BLOCKS_CREATE,		"CREATE" },		\
	{ EXT4_GET_BLOCKS_UNINIT_EXT,		"UNINIT" },		\
	{ EXT4_GET_BLOCKS_DELALLOC_RESERVE,	"DELALLOC" },		\
	{ EXT4_GET_BLOCKS_PRE_IO,		"PRE_IO" },		\
	{ EXT4_GET_BLOCKS_CONVERT,		"CONVERT" },		\
	{ EXT4_GET_BLOCKS_METADATA_NOFAIL,	"METADATA_NOFAIL" },	\
	{ EXT4_GET_BLOCKS_NO_NORMALIZE,		"NO_NORMALIZE" },	\
	{ EXT4_GET_BLOCKS_KEEP_SIZE,		"KEEP_SIZE" },		\
	{ EXT4_GET_BLOCKS_NO_LOCK,		"NO_LOCK" },		\
	{ EXT4_GET_BLOCKS_NO_PUT_HOLE,		"NO_PUT_HOLE" })

#define show_mflags(flags) __print_flags(flags, "",	\
	{ EXT4_MAP_NEW,		"N" },			\
	{ EXT4_MAP_MAPPED,	"M" },			\
	{ EXT4_MAP_UNWRITTEN,	"U" },			\
	{ EXT4_MAP_BOUNDARY,	"B" },			\
	{ EXT4_MAP_UNINIT,	"u" },			\
	{ EXT4_MAP_FROM_CLUSTER, "C" })

#define show_free_flags(flags) __print_flags(flags, "|",	\
	{ EXT4_FREE_BLOCKS_METADATA,		"METADATA" },	\
	{ EXT4_FREE_BLOCKS_FORGET,		"FORGET" },	\
	{ EXT4_FREE_BLOCKS_VALIDATED,		"VALIDATED" },	\
	{ EXT4_FREE_BLOCKS_NO_QUOT_UPDATE,	"NO_QUOTA" },	\
	{ EXT4_FREE_BLOCKS_NOFREE_FIRST_CLUSTER,"1ST_CLUSTER" },\
	{ EXT4_FREE_BLOCKS_NOFREE_LAST_CLUSTER,	"LAST_CLUSTER" })

#define show_extent_status(status) __print_flags(status, "",	\
66 67 68 69
	{ EXTENT_STATUS_WRITTEN,	"W" },			\
	{ EXTENT_STATUS_UNWRITTEN,	"U" },			\
	{ EXTENT_STATUS_DELAYED,	"D" },			\
	{ EXTENT_STATUS_HOLE,		"H" })
70 71


72 73 74 75 76 77
TRACE_EVENT(ext4_free_inode,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
78
		__field(	dev_t,	dev			)
79 80 81
		__field(	ino_t,	ino			)
		__field(	uid_t,	uid			)
		__field(	gid_t,	gid			)
L
Lukas Czerner 已提交
82
		__field(	__u64, blocks			)
83
		__field(	__u16, mode			)
84 85 86
	),

	TP_fast_assign(
87
		__entry->dev	= inode->i_sb->s_dev;
88
		__entry->ino	= inode->i_ino;
89 90
		__entry->uid	= i_uid_read(inode);
		__entry->gid	= i_gid_read(inode);
91
		__entry->blocks	= inode->i_blocks;
92
		__entry->mode	= inode->i_mode;
93 94
	),

95
	TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu",
96
		  MAJOR(__entry->dev), MINOR(__entry->dev),
L
Lukas Czerner 已提交
97 98
		  (unsigned long) __entry->ino, __entry->mode,
		  __entry->uid, __entry->gid, __entry->blocks)
99 100 101 102 103 104 105 106
);

TRACE_EVENT(ext4_request_inode,
	TP_PROTO(struct inode *dir, int mode),

	TP_ARGS(dir, mode),

	TP_STRUCT__entry(
107
		__field(	dev_t,	dev			)
108
		__field(	ino_t,	dir			)
109
		__field(	__u16, mode			)
110 111 112
	),

	TP_fast_assign(
113
		__entry->dev	= dir->i_sb->s_dev;
114 115 116 117
		__entry->dir	= dir->i_ino;
		__entry->mode	= mode;
	),

118
	TP_printk("dev %d,%d dir %lu mode 0%o",
119
		  MAJOR(__entry->dev), MINOR(__entry->dev),
120
		  (unsigned long) __entry->dir, __entry->mode)
121 122 123 124 125 126 127 128
);

TRACE_EVENT(ext4_allocate_inode,
	TP_PROTO(struct inode *inode, struct inode *dir, int mode),

	TP_ARGS(inode, dir, mode),

	TP_STRUCT__entry(
129
		__field(	dev_t,	dev			)
130 131
		__field(	ino_t,	ino			)
		__field(	ino_t,	dir			)
132
		__field(	__u16,	mode			)
133 134 135
	),

	TP_fast_assign(
136
		__entry->dev	= inode->i_sb->s_dev;
137 138 139 140 141
		__entry->ino	= inode->i_ino;
		__entry->dir	= dir->i_ino;
		__entry->mode	= mode;
	),

142
	TP_printk("dev %d,%d ino %lu dir %lu mode 0%o",
143
		  MAJOR(__entry->dev), MINOR(__entry->dev),
144
		  (unsigned long) __entry->ino,
145
		  (unsigned long) __entry->dir, __entry->mode)
146 147
);

148 149 150 151 152 153
TRACE_EVENT(ext4_evict_inode,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
154
		__field(	dev_t,	dev			)
155 156 157 158 159
		__field(	ino_t,	ino			)
		__field(	int,	nlink			)
	),

	TP_fast_assign(
160
		__entry->dev	= inode->i_sb->s_dev;
161 162 163 164 165
		__entry->ino	= inode->i_ino;
		__entry->nlink	= inode->i_nlink;
	),

	TP_printk("dev %d,%d ino %lu nlink %d",
166
		  MAJOR(__entry->dev), MINOR(__entry->dev),
167 168 169 170 171 172 173 174 175
		  (unsigned long) __entry->ino, __entry->nlink)
);

TRACE_EVENT(ext4_drop_inode,
	TP_PROTO(struct inode *inode, int drop),

	TP_ARGS(inode, drop),

	TP_STRUCT__entry(
176
		__field(	dev_t,	dev			)
177 178 179 180 181
		__field(	ino_t,	ino			)
		__field(	int,	drop			)
	),

	TP_fast_assign(
182
		__entry->dev	= inode->i_sb->s_dev;
183 184 185 186 187
		__entry->ino	= inode->i_ino;
		__entry->drop	= drop;
	),

	TP_printk("dev %d,%d ino %lu drop %d",
188
		  MAJOR(__entry->dev), MINOR(__entry->dev),
189 190 191 192 193 194 195 196 197
		  (unsigned long) __entry->ino, __entry->drop)
);

TRACE_EVENT(ext4_mark_inode_dirty,
	TP_PROTO(struct inode *inode, unsigned long IP),

	TP_ARGS(inode, IP),

	TP_STRUCT__entry(
198
		__field(	dev_t,	dev			)
199 200 201 202 203
		__field(	ino_t,	ino			)
		__field(unsigned long,	ip			)
	),

	TP_fast_assign(
204
		__entry->dev	= inode->i_sb->s_dev;
205 206 207 208 209
		__entry->ino	= inode->i_ino;
		__entry->ip	= IP;
	),

	TP_printk("dev %d,%d ino %lu caller %pF",
210
		  MAJOR(__entry->dev), MINOR(__entry->dev),
211 212 213 214 215 216 217 218 219
		  (unsigned long) __entry->ino, (void *)__entry->ip)
);

TRACE_EVENT(ext4_begin_ordered_truncate,
	TP_PROTO(struct inode *inode, loff_t new_size),

	TP_ARGS(inode, new_size),

	TP_STRUCT__entry(
220
		__field(	dev_t,	dev			)
221 222 223 224 225
		__field(	ino_t,	ino			)
		__field(	loff_t,	new_size		)
	),

	TP_fast_assign(
226
		__entry->dev		= inode->i_sb->s_dev;
227 228 229 230 231
		__entry->ino		= inode->i_ino;
		__entry->new_size	= new_size;
	),

	TP_printk("dev %d,%d ino %lu new_size %lld",
232
		  MAJOR(__entry->dev), MINOR(__entry->dev),
233
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
234
		  __entry->new_size)
235 236
);

237
DECLARE_EVENT_CLASS(ext4__write_begin,
238 239 240 241 242 243 244

	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int flags),

	TP_ARGS(inode, pos, len, flags),

	TP_STRUCT__entry(
245
		__field(	dev_t,	dev			)
246 247 248 249 250 251 252
		__field(	ino_t,	ino			)
		__field(	loff_t,	pos			)
		__field(	unsigned int, len		)
		__field(	unsigned int, flags		)
	),

	TP_fast_assign(
253
		__entry->dev	= inode->i_sb->s_dev;
254 255 256 257 258 259
		__entry->ino	= inode->i_ino;
		__entry->pos	= pos;
		__entry->len	= len;
		__entry->flags	= flags;
	),

L
Lukas Czerner 已提交
260
	TP_printk("dev %d,%d ino %lu pos %lld len %u flags %u",
261
		  MAJOR(__entry->dev), MINOR(__entry->dev),
262
		  (unsigned long) __entry->ino,
263
		  __entry->pos, __entry->len, __entry->flags)
264 265
);

266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
DEFINE_EVENT(ext4__write_begin, ext4_write_begin,

	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int flags),

	TP_ARGS(inode, pos, len, flags)
);

DEFINE_EVENT(ext4__write_begin, ext4_da_write_begin,

	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int flags),

	TP_ARGS(inode, pos, len, flags)
);

DECLARE_EVENT_CLASS(ext4__write_end,
283 284 285 286 287 288
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
			unsigned int copied),

	TP_ARGS(inode, pos, len, copied),

	TP_STRUCT__entry(
289
		__field(	dev_t,	dev			)
290 291 292 293 294 295 296
		__field(	ino_t,	ino			)
		__field(	loff_t,	pos			)
		__field(	unsigned int, len		)
		__field(	unsigned int, copied		)
	),

	TP_fast_assign(
297
		__entry->dev	= inode->i_sb->s_dev;
298 299 300 301 302 303
		__entry->ino	= inode->i_ino;
		__entry->pos	= pos;
		__entry->len	= len;
		__entry->copied	= copied;
	),

L
Lukas Czerner 已提交
304
	TP_printk("dev %d,%d ino %lu pos %lld len %u copied %u",
305 306 307
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->pos, __entry->len, __entry->copied)
308 309
);

310
DEFINE_EVENT(ext4__write_end, ext4_write_end,
311

312 313
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),
314

315
	TP_ARGS(inode, pos, len, copied)
316 317
);

318 319
DEFINE_EVENT(ext4__write_end, ext4_journalled_write_end,

320 321 322
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),

323 324
	TP_ARGS(inode, pos, len, copied)
);
325

326
DEFINE_EVENT(ext4__write_end, ext4_da_write_end,
327

328 329 330 331
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),

	TP_ARGS(inode, pos, len, copied)
332 333
);

334
TRACE_EVENT(ext4_writepages,
335 336 337 338 339
	TP_PROTO(struct inode *inode, struct writeback_control *wbc),

	TP_ARGS(inode, wbc),

	TP_STRUCT__entry(
340
		__field(	dev_t,	dev			)
341 342 343 344 345
		__field(	ino_t,	ino			)
		__field(	long,	nr_to_write		)
		__field(	long,	pages_skipped		)
		__field(	loff_t,	range_start		)
		__field(	loff_t,	range_end		)
346
		__field(       pgoff_t,	writeback_index		)
347
		__field(	int,	sync_mode		)
348 349 350 351 352
		__field(	char,	for_kupdate		)
		__field(	char,	range_cyclic		)
	),

	TP_fast_assign(
353
		__entry->dev		= inode->i_sb->s_dev;
354 355 356 357 358
		__entry->ino		= inode->i_ino;
		__entry->nr_to_write	= wbc->nr_to_write;
		__entry->pages_skipped	= wbc->pages_skipped;
		__entry->range_start	= wbc->range_start;
		__entry->range_end	= wbc->range_end;
359
		__entry->writeback_index = inode->i_mapping->writeback_index;
360
		__entry->sync_mode	= wbc->sync_mode;
361 362 363 364
		__entry->for_kupdate	= wbc->for_kupdate;
		__entry->range_cyclic	= wbc->range_cyclic;
	),

365
	TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld "
366
		  "range_start %lld range_end %lld sync_mode %d "
367 368
		  "for_kupdate %d range_cyclic %d writeback_index %lu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
369
		  (unsigned long) __entry->ino, __entry->nr_to_write,
370
		  __entry->pages_skipped, __entry->range_start,
371 372
		  __entry->range_end, __entry->sync_mode,
		  __entry->for_kupdate, __entry->range_cyclic,
373
		  (unsigned long) __entry->writeback_index)
374 375
);

376
TRACE_EVENT(ext4_da_write_pages,
J
Jan Kara 已提交
377 378
	TP_PROTO(struct inode *inode, pgoff_t first_page,
		 struct writeback_control *wbc),
379

J
Jan Kara 已提交
380
	TP_ARGS(inode, first_page, wbc),
381 382

	TP_STRUCT__entry(
383
		__field(	dev_t,	dev			)
384
		__field(	ino_t,	ino			)
J
Jan Kara 已提交
385 386 387
		__field(      pgoff_t,	first_page		)
		__field(	 long,	nr_to_write		)
		__field(	  int,	sync_mode		)
388 389 390
	),

	TP_fast_assign(
391
		__entry->dev		= inode->i_sb->s_dev;
392
		__entry->ino		= inode->i_ino;
J
Jan Kara 已提交
393 394 395
		__entry->first_page	= first_page;
		__entry->nr_to_write	= wbc->nr_to_write;
		__entry->sync_mode	= wbc->sync_mode;
396 397
	),

J
Jan Kara 已提交
398 399
	TP_printk("dev %d,%d ino %lu first_page %lu nr_to_write %ld "
		  "sync_mode %d",
400
		  MAJOR(__entry->dev), MINOR(__entry->dev),
J
Jan Kara 已提交
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
		  (unsigned long) __entry->ino, __entry->first_page,
		  __entry->nr_to_write, __entry->sync_mode)
);

TRACE_EVENT(ext4_da_write_pages_extent,
	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map),

	TP_ARGS(inode, map),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
		__field(	ino_t,	ino			)
		__field(	__u64,	lblk			)
		__field(	__u32,	len			)
		__field(	__u32,	flags			)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
		__entry->ino		= inode->i_ino;
		__entry->lblk		= map->m_lblk;
		__entry->len		= map->m_len;
		__entry->flags		= map->m_flags;
	),

426
	TP_printk("dev %d,%d ino %lu lblk %llu len %u flags %s",
J
Jan Kara 已提交
427 428
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino, __entry->lblk, __entry->len,
429
		  show_mflags(__entry->flags))
430 431
);

432
TRACE_EVENT(ext4_writepages_result,
433 434 435 436 437 438
	TP_PROTO(struct inode *inode, struct writeback_control *wbc,
			int ret, int pages_written),

	TP_ARGS(inode, wbc, ret, pages_written),

	TP_STRUCT__entry(
439
		__field(	dev_t,	dev			)
440 441 442 443
		__field(	ino_t,	ino			)
		__field(	int,	ret			)
		__field(	int,	pages_written		)
		__field(	long,	pages_skipped		)
444
		__field(       pgoff_t,	writeback_index		)
445
		__field(	int,	sync_mode		)
446 447 448
	),

	TP_fast_assign(
449
		__entry->dev		= inode->i_sb->s_dev;
450 451 452 453
		__entry->ino		= inode->i_ino;
		__entry->ret		= ret;
		__entry->pages_written	= pages_written;
		__entry->pages_skipped	= wbc->pages_skipped;
454
		__entry->writeback_index = inode->i_mapping->writeback_index;
455
		__entry->sync_mode	= wbc->sync_mode;
456 457
	),

458
	TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld "
459
		  "sync_mode %d writeback_index %lu",
460
		  MAJOR(__entry->dev), MINOR(__entry->dev),
461
		  (unsigned long) __entry->ino, __entry->ret,
462
		  __entry->pages_written, __entry->pages_skipped,
463
		  __entry->sync_mode,
464
		  (unsigned long) __entry->writeback_index)
465 466
);

467 468 469 470 471 472 473
DECLARE_EVENT_CLASS(ext4__page_op,
	TP_PROTO(struct page *page),

	TP_ARGS(page),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
474 475
		__field(	ino_t,	ino			)
		__field(	pgoff_t, index			)
476 477 478 479 480

	),

	TP_fast_assign(
		__entry->dev	= page->mapping->host->i_sb->s_dev;
481 482
		__entry->ino	= page->mapping->host->i_ino;
		__entry->index	= page->index;
483 484 485 486 487
	),

	TP_printk("dev %d,%d ino %lu page_index %lu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
488 489 490 491 492 493 494 495
		  (unsigned long) __entry->index)
);

DEFINE_EVENT(ext4__page_op, ext4_writepage,

	TP_PROTO(struct page *page),

	TP_ARGS(page)
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511
);

DEFINE_EVENT(ext4__page_op, ext4_readpage,

	TP_PROTO(struct page *page),

	TP_ARGS(page)
);

DEFINE_EVENT(ext4__page_op, ext4_releasepage,

	TP_PROTO(struct page *page),

	TP_ARGS(page)
);

512
DECLARE_EVENT_CLASS(ext4_invalidatepage_op,
513
	TP_PROTO(struct page *page, unsigned int offset, unsigned int length),
514

515
	TP_ARGS(page, offset, length),
516 517

	TP_STRUCT__entry(
518 519
		__field(	dev_t,	dev			)
		__field(	ino_t,	ino			)
520
		__field(	pgoff_t, index			)
521 522
		__field(	unsigned int, offset		)
		__field(	unsigned int, length		)
523 524 525
	),

	TP_fast_assign(
526 527
		__entry->dev	= page->mapping->host->i_sb->s_dev;
		__entry->ino	= page->mapping->host->i_ino;
528 529
		__entry->index	= page->index;
		__entry->offset	= offset;
530
		__entry->length	= length;
531 532
	),

533
	TP_printk("dev %d,%d ino %lu page_index %lu offset %u length %u",
534 535
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
536 537
		  (unsigned long) __entry->index,
		  __entry->offset, __entry->length)
538 539
);

540
DEFINE_EVENT(ext4_invalidatepage_op, ext4_invalidatepage,
541
	TP_PROTO(struct page *page, unsigned int offset, unsigned int length),
542

543
	TP_ARGS(page, offset, length)
544 545 546
);

DEFINE_EVENT(ext4_invalidatepage_op, ext4_journalled_invalidatepage,
547
	TP_PROTO(struct page *page, unsigned int offset, unsigned int length),
548

549
	TP_ARGS(page, offset, length)
550 551
);

552 553 554 555 556 557 558
TRACE_EVENT(ext4_discard_blocks,
	TP_PROTO(struct super_block *sb, unsigned long long blk,
			unsigned long long count),

	TP_ARGS(sb, blk, count),

	TP_STRUCT__entry(
559
		__field(	dev_t,	dev			)
560 561 562 563 564 565
		__field(	__u64,	blk			)
		__field(	__u64,	count			)

	),

	TP_fast_assign(
566
		__entry->dev	= sb->s_dev;
567 568 569 570
		__entry->blk	= blk;
		__entry->count	= count;
	),

571
	TP_printk("dev %d,%d blk %llu count %llu",
572
		  MAJOR(__entry->dev), MINOR(__entry->dev),
573
		  __entry->blk, __entry->count)
574 575
);

576
DECLARE_EVENT_CLASS(ext4__mb_new_pa,
577 578 579 580 581 582
	TP_PROTO(struct ext4_allocation_context *ac,
		 struct ext4_prealloc_space *pa),

	TP_ARGS(ac, pa),

	TP_STRUCT__entry(
583
		__field(	dev_t,	dev			)
584 585 586
		__field(	ino_t,	ino			)
		__field(	__u64,	pa_pstart		)
		__field(	__u64,	pa_lstart		)
587
		__field(	__u32,	pa_len			)
588 589 590 591

	),

	TP_fast_assign(
592
		__entry->dev		= ac->ac_sb->s_dev;
593 594 595
		__entry->ino		= ac->ac_inode->i_ino;
		__entry->pa_pstart	= pa->pa_pstart;
		__entry->pa_lstart	= pa->pa_lstart;
596
		__entry->pa_len		= pa->pa_len;
597 598
	),

599
	TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu",
600 601 602
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
603 604
);

605 606
DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa,

607 608 609
	TP_PROTO(struct ext4_allocation_context *ac,
		 struct ext4_prealloc_space *pa),

610 611
	TP_ARGS(ac, pa)
);
612

613
DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_group_pa,
614

615 616
	TP_PROTO(struct ext4_allocation_context *ac,
		 struct ext4_prealloc_space *pa),
617

618
	TP_ARGS(ac, pa)
619 620 621
);

TRACE_EVENT(ext4_mb_release_inode_pa,
L
Lukas Czerner 已提交
622
	TP_PROTO(struct ext4_prealloc_space *pa,
623 624
		 unsigned long long block, unsigned int count),

L
Lukas Czerner 已提交
625
	TP_ARGS(pa, block, count),
626 627

	TP_STRUCT__entry(
628
		__field(	dev_t,	dev			)
629 630 631 632 633 634 635
		__field(	ino_t,	ino			)
		__field(	__u64,	block			)
		__field(	__u32,	count			)

	),

	TP_fast_assign(
L
Lukas Czerner 已提交
636 637
		__entry->dev		= pa->pa_inode->i_sb->s_dev;
		__entry->ino		= pa->pa_inode->i_ino;
638 639 640 641
		__entry->block		= block;
		__entry->count		= count;
	),

642
	TP_printk("dev %d,%d ino %lu block %llu count %u",
643 644 645
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->block, __entry->count)
646 647 648
);

TRACE_EVENT(ext4_mb_release_group_pa,
649
	TP_PROTO(struct super_block *sb, struct ext4_prealloc_space *pa),
650

651
	TP_ARGS(sb, pa),
652 653

	TP_STRUCT__entry(
654
		__field(	dev_t,	dev			)
655 656 657 658 659 660
		__field(	__u64,	pa_pstart		)
		__field(	__u32,	pa_len			)

	),

	TP_fast_assign(
661
		__entry->dev		= sb->s_dev;
662 663 664 665
		__entry->pa_pstart	= pa->pa_pstart;
		__entry->pa_len		= pa->pa_len;
	),

666
	TP_printk("dev %d,%d pstart %llu len %u",
667
		  MAJOR(__entry->dev), MINOR(__entry->dev),
668
		  __entry->pa_pstart, __entry->pa_len)
669 670 671 672 673 674 675 676
);

TRACE_EVENT(ext4_discard_preallocations,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
677
		__field(	dev_t,	dev			)
678 679 680 681 682
		__field(	ino_t,	ino			)

	),

	TP_fast_assign(
683
		__entry->dev	= inode->i_sb->s_dev;
684 685 686
		__entry->ino	= inode->i_ino;
	),

687
	TP_printk("dev %d,%d ino %lu",
688
		  MAJOR(__entry->dev), MINOR(__entry->dev),
689
		  (unsigned long) __entry->ino)
690 691 692 693 694 695 696 697
);

TRACE_EVENT(ext4_mb_discard_preallocations,
	TP_PROTO(struct super_block *sb, int needed),

	TP_ARGS(sb, needed),

	TP_STRUCT__entry(
698
		__field(	dev_t,	dev			)
699 700 701 702 703
		__field(	int,	needed			)

	),

	TP_fast_assign(
704
		__entry->dev	= sb->s_dev;
705 706 707
		__entry->needed	= needed;
	),

708
	TP_printk("dev %d,%d needed %d",
709 710
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->needed)
711 712 713 714 715 716 717 718
);

TRACE_EVENT(ext4_request_blocks,
	TP_PROTO(struct ext4_allocation_request *ar),

	TP_ARGS(ar),

	TP_STRUCT__entry(
719
		__field(	dev_t,	dev			)
720 721
		__field(	ino_t,	ino			)
		__field(	unsigned int, len		)
L
Lukas Czerner 已提交
722 723 724
		__field(	__u32,  logical			)
		__field(	__u32,	lleft			)
		__field(	__u32,	lright			)
725 726 727
		__field(	__u64,	goal			)
		__field(	__u64,	pleft			)
		__field(	__u64,	pright			)
728
		__field(	unsigned int, flags		)
729 730 731
	),

	TP_fast_assign(
732
		__entry->dev	= ar->inode->i_sb->s_dev;
733 734 735 736 737 738 739 740
		__entry->ino	= ar->inode->i_ino;
		__entry->len	= ar->len;
		__entry->logical = ar->logical;
		__entry->goal	= ar->goal;
		__entry->lleft	= ar->lleft;
		__entry->lright	= ar->lright;
		__entry->pleft	= ar->pleft;
		__entry->pright	= ar->pright;
741
		__entry->flags	= ar->flags;
742 743
	),

744
	TP_printk("dev %d,%d ino %lu flags %s len %u lblk %u goal %llu "
L
Lukas Czerner 已提交
745
		  "lleft %u lright %u pleft %llu pright %llu ",
746
		  MAJOR(__entry->dev), MINOR(__entry->dev),
747
		  (unsigned long) __entry->ino, show_mballoc_flags(__entry->flags),
L
Lukas Czerner 已提交
748 749 750
		  __entry->len, __entry->logical, __entry->goal,
		  __entry->lleft, __entry->lright, __entry->pleft,
		  __entry->pright)
751 752 753 754 755 756 757 758
);

TRACE_EVENT(ext4_allocate_blocks,
	TP_PROTO(struct ext4_allocation_request *ar, unsigned long long block),

	TP_ARGS(ar, block),

	TP_STRUCT__entry(
759
		__field(	dev_t,	dev			)
760 761 762
		__field(	ino_t,	ino			)
		__field(	__u64,	block			)
		__field(	unsigned int, len		)
L
Lukas Czerner 已提交
763 764 765
		__field(	__u32,  logical			)
		__field(	__u32,	lleft			)
		__field(	__u32,	lright			)
766 767 768
		__field(	__u64,	goal			)
		__field(	__u64,	pleft			)
		__field(	__u64,	pright			)
769
		__field(	unsigned int, flags		)
770 771 772
	),

	TP_fast_assign(
773
		__entry->dev	= ar->inode->i_sb->s_dev;
774 775 776 777 778 779 780 781 782
		__entry->ino	= ar->inode->i_ino;
		__entry->block	= block;
		__entry->len	= ar->len;
		__entry->logical = ar->logical;
		__entry->goal	= ar->goal;
		__entry->lleft	= ar->lleft;
		__entry->lright	= ar->lright;
		__entry->pleft	= ar->pleft;
		__entry->pright	= ar->pright;
783
		__entry->flags	= ar->flags;
784 785
	),

786
	TP_printk("dev %d,%d ino %lu flags %s len %u block %llu lblk %u "
L
Lukas Czerner 已提交
787
		  "goal %llu lleft %u lright %u pleft %llu pright %llu",
788
		  MAJOR(__entry->dev), MINOR(__entry->dev),
789
		  (unsigned long) __entry->ino, show_mballoc_flags(__entry->flags),
L
Lukas Czerner 已提交
790 791 792
		  __entry->len, __entry->block, __entry->logical,
		  __entry->goal,  __entry->lleft, __entry->lright,
		  __entry->pleft, __entry->pright)
793 794 795 796
);

TRACE_EVENT(ext4_free_blocks,
	TP_PROTO(struct inode *inode, __u64 block, unsigned long count,
797
		 int flags),
798

799
	TP_ARGS(inode, block, count, flags),
800 801

	TP_STRUCT__entry(
802
		__field(	dev_t,	dev			)
803 804 805
		__field(	ino_t,	ino			)
		__field(	__u64,	block			)
		__field(	unsigned long,	count		)
L
Lukas Czerner 已提交
806
		__field(	int,	flags			)
807
		__field(	__u16,	mode			)
808 809 810
	),

	TP_fast_assign(
811
		__entry->dev		= inode->i_sb->s_dev;
812 813 814
		__entry->ino		= inode->i_ino;
		__entry->block		= block;
		__entry->count		= count;
815
		__entry->flags		= flags;
816
		__entry->mode		= inode->i_mode;
817 818
	),

819
	TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %s",
820
		  MAJOR(__entry->dev), MINOR(__entry->dev),
821
		  (unsigned long) __entry->ino,
822
		  __entry->mode, __entry->block, __entry->count,
823
		  show_free_flags(__entry->flags))
824 825
);

826
TRACE_EVENT(ext4_sync_file_enter,
827
	TP_PROTO(struct file *file, int datasync),
828

829
	TP_ARGS(file, datasync),
830 831

	TP_STRUCT__entry(
832
		__field(	dev_t,	dev			)
833 834 835 836 837 838
		__field(	ino_t,	ino			)
		__field(	ino_t,	parent			)
		__field(	int,	datasync		)
	),

	TP_fast_assign(
839 840
		struct dentry *dentry = file->f_path.dentry;

841
		__entry->dev		= dentry->d_inode->i_sb->s_dev;
842 843 844 845 846
		__entry->ino		= dentry->d_inode->i_ino;
		__entry->datasync	= datasync;
		__entry->parent		= dentry->d_parent->d_inode->i_ino;
	),

L
Lukas Czerner 已提交
847
	TP_printk("dev %d,%d ino %lu parent %lu datasync %d ",
848
		  MAJOR(__entry->dev), MINOR(__entry->dev),
849
		  (unsigned long) __entry->ino,
850
		  (unsigned long) __entry->parent, __entry->datasync)
851 852
);

853 854 855 856 857 858 859
TRACE_EVENT(ext4_sync_file_exit,
	TP_PROTO(struct inode *inode, int ret),

	TP_ARGS(inode, ret),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
860 861
		__field(	ino_t,	ino			)
		__field(	int,	ret			)
862 863 864 865
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
866 867
		__entry->ino		= inode->i_ino;
		__entry->ret		= ret;
868 869
	),

L
Lukas Czerner 已提交
870
	TP_printk("dev %d,%d ino %lu ret %d",
871 872 873 874 875
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->ret)
);

876 877 878 879 880 881
TRACE_EVENT(ext4_sync_fs,
	TP_PROTO(struct super_block *sb, int wait),

	TP_ARGS(sb, wait),

	TP_STRUCT__entry(
882
		__field(	dev_t,	dev			)
883 884 885 886 887
		__field(	int,	wait			)

	),

	TP_fast_assign(
888
		__entry->dev	= sb->s_dev;
889 890 891
		__entry->wait	= wait;
	),

892 893 894
	TP_printk("dev %d,%d wait %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->wait)
895 896
);

897 898 899 900 901 902
TRACE_EVENT(ext4_alloc_da_blocks,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
903
		__field(	dev_t,	dev			)
904 905 906 907 908 909
		__field(	ino_t,	ino			)
		__field( unsigned int,	data_blocks	)
		__field( unsigned int,	meta_blocks	)
	),

	TP_fast_assign(
910
		__entry->dev	= inode->i_sb->s_dev;
911 912 913 914 915
		__entry->ino	= inode->i_ino;
		__entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
		__entry->meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
	),

916
	TP_printk("dev %d,%d ino %lu data_blocks %u meta_blocks %u",
917
		  MAJOR(__entry->dev), MINOR(__entry->dev),
918
		  (unsigned long) __entry->ino,
919 920 921
		  __entry->data_blocks, __entry->meta_blocks)
);

922 923 924 925 926 927
TRACE_EVENT(ext4_mballoc_alloc,
	TP_PROTO(struct ext4_allocation_context *ac),

	TP_ARGS(ac),

	TP_STRUCT__entry(
928
		__field(	dev_t,	dev			)
929 930 931 932 933 934 935 936 937 938 939 940 941
		__field(	ino_t,	ino			)
		__field(	__u32, 	orig_logical		)
		__field(	  int,	orig_start		)
		__field(	__u32, 	orig_group		)
		__field(	  int,	orig_len		)
		__field(	__u32, 	goal_logical		)
		__field(	  int,	goal_start		)
		__field(	__u32, 	goal_group		)
		__field(	  int,	goal_len		)
		__field(	__u32, 	result_logical		)
		__field(	  int,	result_start		)
		__field(	__u32, 	result_group		)
		__field(	  int,	result_len		)
942 943 944 945 946 947
		__field(	__u16,	found			)
		__field(	__u16,	groups			)
		__field(	__u16,	buddy			)
		__field(	__u16,	flags			)
		__field(	__u16,	tail			)
		__field(	__u8,	cr			)
948 949 950
	),

	TP_fast_assign(
951
		__entry->dev		= ac->ac_inode->i_sb->s_dev;
952 953 954 955 956 957 958 959 960 961 962 963 964
		__entry->ino		= ac->ac_inode->i_ino;
		__entry->orig_logical	= ac->ac_o_ex.fe_logical;
		__entry->orig_start	= ac->ac_o_ex.fe_start;
		__entry->orig_group	= ac->ac_o_ex.fe_group;
		__entry->orig_len	= ac->ac_o_ex.fe_len;
		__entry->goal_logical	= ac->ac_g_ex.fe_logical;
		__entry->goal_start	= ac->ac_g_ex.fe_start;
		__entry->goal_group	= ac->ac_g_ex.fe_group;
		__entry->goal_len	= ac->ac_g_ex.fe_len;
		__entry->result_logical	= ac->ac_f_ex.fe_logical;
		__entry->result_start	= ac->ac_f_ex.fe_start;
		__entry->result_group	= ac->ac_f_ex.fe_group;
		__entry->result_len	= ac->ac_f_ex.fe_len;
965 966 967 968 969 970
		__entry->found		= ac->ac_found;
		__entry->flags		= ac->ac_flags;
		__entry->groups		= ac->ac_groups_scanned;
		__entry->buddy		= ac->ac_buddy;
		__entry->tail		= ac->ac_tail;
		__entry->cr		= ac->ac_criteria;
971 972
	),

973
	TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
974
		  "result %u/%d/%u@%u blks %u grps %u cr %u flags %s "
975
		  "tail %u broken %u",
976
		  MAJOR(__entry->dev), MINOR(__entry->dev),
977
		  (unsigned long) __entry->ino,
978 979 980 981 982 983 984
		  __entry->orig_group, __entry->orig_start,
		  __entry->orig_len, __entry->orig_logical,
		  __entry->goal_group, __entry->goal_start,
		  __entry->goal_len, __entry->goal_logical,
		  __entry->result_group, __entry->result_start,
		  __entry->result_len, __entry->result_logical,
		  __entry->found, __entry->groups, __entry->cr,
985
		  show_mballoc_flags(__entry->flags), __entry->tail,
986 987 988 989 990 991 992 993 994
		  __entry->buddy ? 1 << __entry->buddy : 0)
);

TRACE_EVENT(ext4_mballoc_prealloc,
	TP_PROTO(struct ext4_allocation_context *ac),

	TP_ARGS(ac),

	TP_STRUCT__entry(
995
		__field(	dev_t,	dev			)
996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007
		__field(	ino_t,	ino			)
		__field(	__u32, 	orig_logical		)
		__field(	  int,	orig_start		)
		__field(	__u32, 	orig_group		)
		__field(	  int,	orig_len		)
		__field(	__u32, 	result_logical		)
		__field(	  int,	result_start		)
		__field(	__u32, 	result_group		)
		__field(	  int,	result_len		)
	),

	TP_fast_assign(
1008
		__entry->dev		= ac->ac_inode->i_sb->s_dev;
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019
		__entry->ino		= ac->ac_inode->i_ino;
		__entry->orig_logical	= ac->ac_o_ex.fe_logical;
		__entry->orig_start	= ac->ac_o_ex.fe_start;
		__entry->orig_group	= ac->ac_o_ex.fe_group;
		__entry->orig_len	= ac->ac_o_ex.fe_len;
		__entry->result_logical	= ac->ac_b_ex.fe_logical;
		__entry->result_start	= ac->ac_b_ex.fe_start;
		__entry->result_group	= ac->ac_b_ex.fe_group;
		__entry->result_len	= ac->ac_b_ex.fe_len;
	),

1020
	TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
1021
		  MAJOR(__entry->dev), MINOR(__entry->dev),
1022
		  (unsigned long) __entry->ino,
1023 1024 1025 1026 1027 1028
		  __entry->orig_group, __entry->orig_start,
		  __entry->orig_len, __entry->orig_logical,
		  __entry->result_group, __entry->result_start,
		  __entry->result_len, __entry->result_logical)
);

1029
DECLARE_EVENT_CLASS(ext4__mballoc,
1030 1031 1032 1033 1034
	TP_PROTO(struct super_block *sb,
		 struct inode *inode,
		 ext4_group_t group,
		 ext4_grpblk_t start,
		 ext4_grpblk_t len),
1035

1036
	TP_ARGS(sb, inode, group, start, len),
1037 1038

	TP_STRUCT__entry(
1039
		__field(	dev_t,	dev			)
1040 1041 1042 1043 1044 1045 1046
		__field(	ino_t,	ino			)
		__field(	  int,	result_start		)
		__field(	__u32, 	result_group		)
		__field(	  int,	result_len		)
	),

	TP_fast_assign(
1047
		__entry->dev		= sb->s_dev;
1048 1049 1050 1051
		__entry->ino		= inode ? inode->i_ino : 0;
		__entry->result_start	= start;
		__entry->result_group	= group;
		__entry->result_len	= len;
1052 1053
	),

L
Lukas Czerner 已提交
1054
	TP_printk("dev %d,%d inode %lu extent %u/%d/%d ",
1055
		  MAJOR(__entry->dev), MINOR(__entry->dev),
1056
		  (unsigned long) __entry->ino,
1057
		  __entry->result_group, __entry->result_start,
1058
		  __entry->result_len)
1059 1060
);

1061 1062
DEFINE_EVENT(ext4__mballoc, ext4_mballoc_discard,

1063 1064 1065 1066 1067
	TP_PROTO(struct super_block *sb,
		 struct inode *inode,
		 ext4_group_t group,
		 ext4_grpblk_t start,
		 ext4_grpblk_t len),
1068

1069
	TP_ARGS(sb, inode, group, start, len)
1070
);
1071

1072
DEFINE_EVENT(ext4__mballoc, ext4_mballoc_free,
1073

1074 1075 1076 1077 1078
	TP_PROTO(struct super_block *sb,
		 struct inode *inode,
		 ext4_group_t group,
		 ext4_grpblk_t start,
		 ext4_grpblk_t len),
1079

1080
	TP_ARGS(sb, inode, group, start, len)
1081 1082
);

1083 1084 1085 1086 1087 1088
TRACE_EVENT(ext4_forget,
	TP_PROTO(struct inode *inode, int is_metadata, __u64 block),

	TP_ARGS(inode, is_metadata, block),

	TP_STRUCT__entry(
1089
		__field(	dev_t,	dev			)
1090 1091
		__field(	ino_t,	ino			)
		__field(	__u64,	block			)
1092 1093
		__field(	int,	is_metadata		)
		__field(	__u16,	mode			)
1094 1095 1096
	),

	TP_fast_assign(
1097
		__entry->dev	= inode->i_sb->s_dev;
1098 1099
		__entry->ino	= inode->i_ino;
		__entry->block	= block;
1100 1101
		__entry->is_metadata = is_metadata;
		__entry->mode	= inode->i_mode;
1102 1103
	),

1104
	TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu",
1105 1106 1107
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->mode, __entry->is_metadata, __entry->block)
1108 1109
);

1110
TRACE_EVENT(ext4_da_update_reserve_space,
1111
	TP_PROTO(struct inode *inode, int used_blocks, int quota_claim),
1112

1113
	TP_ARGS(inode, used_blocks, quota_claim),
1114 1115

	TP_STRUCT__entry(
1116
		__field(	dev_t,	dev			)
1117 1118 1119 1120 1121 1122
		__field(	ino_t,	ino			)
		__field(	__u64,	i_blocks		)
		__field(	int,	used_blocks		)
		__field(	int,	reserved_data_blocks	)
		__field(	int,	reserved_meta_blocks	)
		__field(	int,	allocated_meta_blocks	)
1123
		__field(	int,	quota_claim		)
1124
		__field(	__u16,	mode			)
1125 1126 1127
	),

	TP_fast_assign(
1128
		__entry->dev	= inode->i_sb->s_dev;
1129 1130 1131
		__entry->ino	= inode->i_ino;
		__entry->i_blocks = inode->i_blocks;
		__entry->used_blocks = used_blocks;
1132 1133 1134 1135 1136 1137 1138
		__entry->reserved_data_blocks =
				EXT4_I(inode)->i_reserved_data_blocks;
		__entry->reserved_meta_blocks =
				EXT4_I(inode)->i_reserved_meta_blocks;
		__entry->allocated_meta_blocks =
				EXT4_I(inode)->i_allocated_meta_blocks;
		__entry->quota_claim = quota_claim;
1139
		__entry->mode	= inode->i_mode;
1140 1141
	),

1142 1143
	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d "
		  "reserved_data_blocks %d reserved_meta_blocks %d "
1144
		  "allocated_meta_blocks %d quota_claim %d",
1145 1146
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1147
		  __entry->mode, __entry->i_blocks,
1148
		  __entry->used_blocks, __entry->reserved_data_blocks,
1149 1150
		  __entry->reserved_meta_blocks, __entry->allocated_meta_blocks,
		  __entry->quota_claim)
1151 1152 1153 1154 1155 1156 1157 1158
);

TRACE_EVENT(ext4_da_reserve_space,
	TP_PROTO(struct inode *inode, int md_needed),

	TP_ARGS(inode, md_needed),

	TP_STRUCT__entry(
1159
		__field(	dev_t,	dev			)
1160 1161 1162 1163 1164
		__field(	ino_t,	ino			)
		__field(	__u64,	i_blocks		)
		__field(	int,	md_needed		)
		__field(	int,	reserved_data_blocks	)
		__field(	int,	reserved_meta_blocks	)
1165
		__field(	__u16,  mode			)
1166 1167 1168
	),

	TP_fast_assign(
1169
		__entry->dev	= inode->i_sb->s_dev;
1170 1171 1172 1173 1174
		__entry->ino	= inode->i_ino;
		__entry->i_blocks = inode->i_blocks;
		__entry->md_needed = md_needed;
		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
		__entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1175
		__entry->mode	= inode->i_mode;
1176 1177
	),

1178 1179 1180
	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu md_needed %d "
		  "reserved_data_blocks %d reserved_meta_blocks %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
1181
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1182
		  __entry->mode, __entry->i_blocks,
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192
		  __entry->md_needed, __entry->reserved_data_blocks,
		  __entry->reserved_meta_blocks)
);

TRACE_EVENT(ext4_da_release_space,
	TP_PROTO(struct inode *inode, int freed_blocks),

	TP_ARGS(inode, freed_blocks),

	TP_STRUCT__entry(
1193
		__field(	dev_t,	dev			)
1194 1195 1196 1197 1198 1199
		__field(	ino_t,	ino			)
		__field(	__u64,	i_blocks		)
		__field(	int,	freed_blocks		)
		__field(	int,	reserved_data_blocks	)
		__field(	int,	reserved_meta_blocks	)
		__field(	int,	allocated_meta_blocks	)
1200
		__field(	__u16,  mode			)
1201 1202 1203
	),

	TP_fast_assign(
1204
		__entry->dev	= inode->i_sb->s_dev;
1205 1206 1207 1208 1209 1210
		__entry->ino	= inode->i_ino;
		__entry->i_blocks = inode->i_blocks;
		__entry->freed_blocks = freed_blocks;
		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
		__entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
		__entry->allocated_meta_blocks = EXT4_I(inode)->i_allocated_meta_blocks;
1211
		__entry->mode	= inode->i_mode;
1212 1213
	),

1214 1215 1216 1217
	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d "
		  "reserved_data_blocks %d reserved_meta_blocks %d "
		  "allocated_meta_blocks %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
1218
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1219
		  __entry->mode, __entry->i_blocks,
1220 1221 1222 1223
		  __entry->freed_blocks, __entry->reserved_data_blocks,
		  __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
);

1224 1225 1226 1227 1228 1229
DECLARE_EVENT_CLASS(ext4__bitmap_load,
	TP_PROTO(struct super_block *sb, unsigned long group),

	TP_ARGS(sb, group),

	TP_STRUCT__entry(
1230
		__field(	dev_t,	dev			)
1231 1232 1233 1234 1235
		__field(	__u32,	group			)

	),

	TP_fast_assign(
1236
		__entry->dev	= sb->s_dev;
1237 1238 1239
		__entry->group	= group;
	),

1240
	TP_printk("dev %d,%d group %u",
1241 1242
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->group)
1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257
);

DEFINE_EVENT(ext4__bitmap_load, ext4_mb_bitmap_load,

	TP_PROTO(struct super_block *sb, unsigned long group),

	TP_ARGS(sb, group)
);

DEFINE_EVENT(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,

	TP_PROTO(struct super_block *sb, unsigned long group),

	TP_ARGS(sb, group)
);
1258

1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279
DEFINE_EVENT(ext4__bitmap_load, ext4_read_block_bitmap_load,

	TP_PROTO(struct super_block *sb, unsigned long group),

	TP_ARGS(sb, group)
);

DEFINE_EVENT(ext4__bitmap_load, ext4_load_inode_bitmap,

	TP_PROTO(struct super_block *sb, unsigned long group),

	TP_ARGS(sb, group)
);

TRACE_EVENT(ext4_direct_IO_enter,
	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw),

	TP_ARGS(inode, offset, len, rw),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
1280
		__field(	ino_t,	ino			)
1281 1282 1283 1284 1285 1286 1287
		__field(	loff_t,	pos			)
		__field(	unsigned long,	len		)
		__field(	int,	rw			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1288
		__entry->ino	= inode->i_ino;
1289 1290 1291 1292 1293
		__entry->pos	= offset;
		__entry->len	= len;
		__entry->rw	= rw;
	),

L
Lukas Czerner 已提交
1294
	TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d",
1295 1296
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1297
		  __entry->pos, __entry->len, __entry->rw)
1298 1299 1300
);

TRACE_EVENT(ext4_direct_IO_exit,
L
Lukas Czerner 已提交
1301 1302
	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
		 int rw, int ret),
1303 1304 1305 1306 1307

	TP_ARGS(inode, offset, len, rw, ret),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
1308
		__field(	ino_t,	ino			)
1309 1310 1311 1312 1313 1314 1315 1316
		__field(	loff_t,	pos			)
		__field(	unsigned long,	len		)
		__field(	int,	rw			)
		__field(	int,	ret			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1317
		__entry->ino	= inode->i_ino;
1318 1319 1320 1321 1322 1323
		__entry->pos	= offset;
		__entry->len	= len;
		__entry->rw	= rw;
		__entry->ret	= ret;
	),

L
Lukas Czerner 已提交
1324
	TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d ret %d",
1325 1326
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1327
		  __entry->pos, __entry->len,
1328 1329 1330 1331 1332 1333 1334 1335 1336 1337
		  __entry->rw, __entry->ret)
);

TRACE_EVENT(ext4_fallocate_enter,
	TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode),

	TP_ARGS(inode, offset, len, mode),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
1338
		__field(	ino_t,	ino			)
1339 1340 1341 1342 1343 1344 1345
		__field(	loff_t,	pos			)
		__field(	loff_t,	len			)
		__field(	int,	mode			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1346
		__entry->ino	= inode->i_ino;
1347 1348 1349 1350 1351
		__entry->pos	= offset;
		__entry->len	= len;
		__entry->mode	= mode;
	),

L
Lukas Czerner 已提交
1352
	TP_printk("dev %d,%d ino %lu pos %lld len %lld mode %d",
1353
		  MAJOR(__entry->dev), MINOR(__entry->dev),
L
Lukas Czerner 已提交
1354 1355
		  (unsigned long) __entry->ino, __entry->pos,
		  __entry->len, __entry->mode)
1356 1357 1358
);

TRACE_EVENT(ext4_fallocate_exit,
L
Lukas Czerner 已提交
1359 1360
	TP_PROTO(struct inode *inode, loff_t offset,
		 unsigned int max_blocks, int ret),
1361 1362 1363 1364 1365

	TP_ARGS(inode, offset, max_blocks, ret),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
1366
		__field(	ino_t,	ino			)
1367
		__field(	loff_t,	pos			)
L
Lukas Czerner 已提交
1368
		__field(	unsigned int,	blocks		)
1369 1370 1371 1372 1373
		__field(	int, 	ret			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1374
		__entry->ino	= inode->i_ino;
1375 1376 1377 1378 1379
		__entry->pos	= offset;
		__entry->blocks	= max_blocks;
		__entry->ret	= ret;
	),

L
Lukas Czerner 已提交
1380
	TP_printk("dev %d,%d ino %lu pos %lld blocks %u ret %d",
1381 1382
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1383
		  __entry->pos, __entry->blocks,
1384 1385 1386
		  __entry->ret)
);

1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411
TRACE_EVENT(ext4_punch_hole,
	TP_PROTO(struct inode *inode, loff_t offset, loff_t len),

	TP_ARGS(inode, offset, len),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
		__field(	ino_t,	ino			)
		__field(	loff_t,	offset			)
		__field(	loff_t, len			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->offset	= offset;
		__entry->len	= len;
	),

	TP_printk("dev %d,%d ino %lu offset %lld len %lld",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->offset, __entry->len)
);

1412 1413 1414 1415 1416 1417
TRACE_EVENT(ext4_unlink_enter,
	TP_PROTO(struct inode *parent, struct dentry *dentry),

	TP_ARGS(parent, dentry),

	TP_STRUCT__entry(
1418
		__field(	dev_t,	dev			)
1419
		__field(	ino_t,	ino			)
1420
		__field(	ino_t,	parent			)
1421 1422 1423 1424
		__field(	loff_t,	size			)
	),

	TP_fast_assign(
1425
		__entry->dev		= dentry->d_inode->i_sb->s_dev;
1426
		__entry->ino		= dentry->d_inode->i_ino;
1427
		__entry->parent		= parent->i_ino;
1428 1429 1430
		__entry->size		= dentry->d_inode->i_size;
	),

L
Lukas Czerner 已提交
1431
	TP_printk("dev %d,%d ino %lu size %lld parent %lu",
1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino, __entry->size,
		  (unsigned long) __entry->parent)
);

TRACE_EVENT(ext4_unlink_exit,
	TP_PROTO(struct dentry *dentry, int ret),

	TP_ARGS(dentry, ret),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
1444
		__field(	ino_t,	ino			)
1445 1446 1447 1448 1449
		__field(	int,	ret			)
	),

	TP_fast_assign(
		__entry->dev		= dentry->d_inode->i_sb->s_dev;
1450
		__entry->ino		= dentry->d_inode->i_ino;
1451 1452 1453
		__entry->ret		= ret;
	),

L
Lukas Czerner 已提交
1454
	TP_printk("dev %d,%d ino %lu ret %d",
1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->ret)
);

DECLARE_EVENT_CLASS(ext4__truncate,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
1466 1467
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
L
Lukas Czerner 已提交
1468
		__field(	__u64,		blocks		)
1469 1470 1471 1472
	),

	TP_fast_assign(
		__entry->dev    = inode->i_sb->s_dev;
1473
		__entry->ino    = inode->i_ino;
1474 1475 1476
		__entry->blocks	= inode->i_blocks;
	),

L
Lukas Czerner 已提交
1477
	TP_printk("dev %d,%d ino %lu blocks %llu",
1478
		  MAJOR(__entry->dev), MINOR(__entry->dev),
L
Lukas Czerner 已提交
1479
		  (unsigned long) __entry->ino, __entry->blocks)
1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495
);

DEFINE_EVENT(ext4__truncate, ext4_truncate_enter,

	TP_PROTO(struct inode *inode),

	TP_ARGS(inode)
);

DEFINE_EVENT(ext4__truncate, ext4_truncate_exit,

	TP_PROTO(struct inode *inode),

	TP_ARGS(inode)
);

1496 1497 1498 1499 1500 1501 1502 1503 1504
/* 'ux' is the uninitialized extent. */
TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
		 struct ext4_extent *ux),

	TP_ARGS(inode, map, ux),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
1505
		__field(	ino_t,		ino	)
1506 1507 1508 1509 1510 1511 1512 1513 1514
		__field(	ext4_lblk_t,	m_lblk	)
		__field(	unsigned,	m_len	)
		__field(	ext4_lblk_t,	u_lblk	)
		__field(	unsigned,	u_len	)
		__field(	ext4_fsblk_t,	u_pblk	)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
1515
		__entry->ino		= inode->i_ino;
1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542
		__entry->m_lblk		= map->m_lblk;
		__entry->m_len		= map->m_len;
		__entry->u_lblk		= le32_to_cpu(ux->ee_block);
		__entry->u_len		= ext4_ext_get_actual_len(ux);
		__entry->u_pblk		= ext4_ext_pblock(ux);
	),

	TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u u_lblk %u u_len %u "
		  "u_pblk %llu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->m_lblk, __entry->m_len,
		  __entry->u_lblk, __entry->u_len, __entry->u_pblk)
);

/*
 * 'ux' is the uninitialized extent.
 * 'ix' is the initialized extent to which blocks are transferred.
 */
TRACE_EVENT(ext4_ext_convert_to_initialized_fastpath,
	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
		 struct ext4_extent *ux, struct ext4_extent *ix),

	TP_ARGS(inode, map, ux, ix),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
1543
		__field(	ino_t,		ino	)
1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555
		__field(	ext4_lblk_t,	m_lblk	)
		__field(	unsigned,	m_len	)
		__field(	ext4_lblk_t,	u_lblk	)
		__field(	unsigned,	u_len	)
		__field(	ext4_fsblk_t,	u_pblk	)
		__field(	ext4_lblk_t,	i_lblk	)
		__field(	unsigned,	i_len	)
		__field(	ext4_fsblk_t,	i_pblk	)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
1556
		__entry->ino		= inode->i_ino;
1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576
		__entry->m_lblk		= map->m_lblk;
		__entry->m_len		= map->m_len;
		__entry->u_lblk		= le32_to_cpu(ux->ee_block);
		__entry->u_len		= ext4_ext_get_actual_len(ux);
		__entry->u_pblk		= ext4_ext_pblock(ux);
		__entry->i_lblk		= le32_to_cpu(ix->ee_block);
		__entry->i_len		= ext4_ext_get_actual_len(ix);
		__entry->i_pblk		= ext4_ext_pblock(ix);
	),

	TP_printk("dev %d,%d ino %lu m_lblk %u m_len %u "
		  "u_lblk %u u_len %u u_pblk %llu "
		  "i_lblk %u i_len %u i_pblk %llu ",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->m_lblk, __entry->m_len,
		  __entry->u_lblk, __entry->u_len, __entry->u_pblk,
		  __entry->i_lblk, __entry->i_len, __entry->i_pblk)
);

1577 1578
DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
L
Lukas Czerner 已提交
1579
		 unsigned int len, unsigned int flags),
1580 1581 1582 1583

	TP_ARGS(inode, lblk, len, flags),

	TP_STRUCT__entry(
1584 1585
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
1586
		__field(	ext4_lblk_t,	lblk		)
L
Lukas Czerner 已提交
1587 1588
		__field(	unsigned int,	len		)
		__field(	unsigned int,	flags		)
1589 1590 1591 1592
	),

	TP_fast_assign(
		__entry->dev    = inode->i_sb->s_dev;
1593
		__entry->ino    = inode->i_ino;
1594 1595 1596 1597 1598
		__entry->lblk	= lblk;
		__entry->len	= len;
		__entry->flags	= flags;
	),

1599
	TP_printk("dev %d,%d ino %lu lblk %u len %u flags %s",
1600 1601
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
1602
		  __entry->lblk, __entry->len, show_map_flags(__entry->flags))
1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619
);

DEFINE_EVENT(ext4__map_blocks_enter, ext4_ext_map_blocks_enter,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
		 unsigned len, unsigned flags),

	TP_ARGS(inode, lblk, len, flags)
);

DEFINE_EVENT(ext4__map_blocks_enter, ext4_ind_map_blocks_enter,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
		 unsigned len, unsigned flags),

	TP_ARGS(inode, lblk, len, flags)
);

DECLARE_EVENT_CLASS(ext4__map_blocks_exit,
1620 1621
	TP_PROTO(struct inode *inode, unsigned flags, struct ext4_map_blocks *map,
		 int ret),
1622

1623
	TP_ARGS(inode, flags, map, ret),
1624 1625 1626

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
1627
		__field(	ino_t,		ino		)
1628
		__field(	unsigned int,	flags		)
1629
		__field(	ext4_fsblk_t,	pblk		)
1630
		__field(	ext4_lblk_t,	lblk		)
L
Lukas Czerner 已提交
1631
		__field(	unsigned int,	len		)
1632
		__field(	unsigned int,	mflags		)
1633 1634 1635 1636 1637
		__field(	int,		ret		)
	),

	TP_fast_assign(
		__entry->dev    = inode->i_sb->s_dev;
1638
		__entry->ino    = inode->i_ino;
1639
		__entry->flags	= flags;
1640 1641 1642
		__entry->pblk	= map->m_pblk;
		__entry->lblk	= map->m_lblk;
		__entry->len	= map->m_len;
1643
		__entry->mflags	= map->m_flags;
1644 1645 1646
		__entry->ret	= ret;
	),

1647 1648
	TP_printk("dev %d,%d ino %lu flags %s lblk %u pblk %llu len %u "
		  "mflags %s ret %d",
1649 1650
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
1651 1652
		  show_map_flags(__entry->flags), __entry->lblk, __entry->pblk,
		  __entry->len, show_mflags(__entry->mflags), __entry->ret)
1653 1654 1655
);

DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1656 1657
	TP_PROTO(struct inode *inode, unsigned flags,
		 struct ext4_map_blocks *map, int ret),
1658

1659
	TP_ARGS(inode, flags, map, ret)
1660 1661 1662
);

DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1663 1664
	TP_PROTO(struct inode *inode, unsigned flags,
		 struct ext4_map_blocks *map, int ret),
1665

1666
	TP_ARGS(inode, flags, map, ret)
1667 1668 1669 1670 1671 1672 1673 1674 1675
);

TRACE_EVENT(ext4_ext_load_extent,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk),

	TP_ARGS(inode, lblk, pblk),

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
1676
		__field(	ino_t,		ino		)
1677
		__field(	ext4_fsblk_t,	pblk		)
1678
		__field(	ext4_lblk_t,	lblk		)
1679 1680 1681 1682
	),

	TP_fast_assign(
		__entry->dev    = inode->i_sb->s_dev;
1683
		__entry->ino    = inode->i_ino;
1684
		__entry->pblk	= pblk;
1685
		__entry->lblk	= lblk;
1686 1687 1688 1689 1690
	),

	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1691
		  __entry->lblk, __entry->pblk)
1692 1693 1694 1695 1696 1697 1698 1699 1700
);

TRACE_EVENT(ext4_load_inode,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
		__field(	dev_t,	dev		)
1701
		__field(	ino_t,	ino		)
1702 1703 1704 1705
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
1706
		__entry->ino		= inode->i_ino;
1707 1708 1709 1710 1711 1712 1713
	),

	TP_printk("dev %d,%d ino %ld",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino)
);

1714
TRACE_EVENT(ext4_journal_start,
1715 1716
	TP_PROTO(struct super_block *sb, int blocks, int rsv_blocks,
		 unsigned long IP),
1717

1718
	TP_ARGS(sb, blocks, rsv_blocks, IP),
1719 1720 1721 1722

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
		__field(unsigned long,	ip			)
1723 1724
		__field(	  int,	blocks			)
		__field(	  int,	rsv_blocks		)
1725 1726 1727
	),

	TP_fast_assign(
1728 1729 1730 1731
		__entry->dev		 = sb->s_dev;
		__entry->ip		 = IP;
		__entry->blocks		 = blocks;
		__entry->rsv_blocks	 = rsv_blocks;
1732 1733
	),

1734
	TP_printk("dev %d,%d blocks, %d rsv_blocks, %d caller %pF",
1735
		  MAJOR(__entry->dev), MINOR(__entry->dev),
1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758
		  __entry->blocks, __entry->rsv_blocks, (void *)__entry->ip)
);

TRACE_EVENT(ext4_journal_start_reserved,
	TP_PROTO(struct super_block *sb, int blocks, unsigned long IP),

	TP_ARGS(sb, blocks, IP),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
		__field(unsigned long,	ip			)
		__field(	  int,	blocks			)
	),

	TP_fast_assign(
		__entry->dev		 = sb->s_dev;
		__entry->ip		 = IP;
		__entry->blocks		 = blocks;
	),

	TP_printk("dev %d,%d blocks, %d caller %pF",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->blocks, (void *)__entry->ip)
1759 1760
);

T
Tao Ma 已提交
1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809
DECLARE_EVENT_CLASS(ext4__trim,
	TP_PROTO(struct super_block *sb,
		 ext4_group_t group,
		 ext4_grpblk_t start,
		 ext4_grpblk_t len),

	TP_ARGS(sb, group, start, len),

	TP_STRUCT__entry(
		__field(	int,	dev_major		)
		__field(	int,	dev_minor		)
		__field(	__u32, 	group			)
		__field(	int,	start			)
		__field(	int,	len			)
	),

	TP_fast_assign(
		__entry->dev_major	= MAJOR(sb->s_dev);
		__entry->dev_minor	= MINOR(sb->s_dev);
		__entry->group		= group;
		__entry->start		= start;
		__entry->len		= len;
	),

	TP_printk("dev %d,%d group %u, start %d, len %d",
		  __entry->dev_major, __entry->dev_minor,
		  __entry->group, __entry->start, __entry->len)
);

DEFINE_EVENT(ext4__trim, ext4_trim_extent,

	TP_PROTO(struct super_block *sb,
		 ext4_group_t group,
		 ext4_grpblk_t start,
		 ext4_grpblk_t len),

	TP_ARGS(sb, group, start, len)
);

DEFINE_EVENT(ext4__trim, ext4_trim_all_free,

	TP_PROTO(struct super_block *sb,
		 ext4_group_t group,
		 ext4_grpblk_t start,
		 ext4_grpblk_t len),

	TP_ARGS(sb, group, start, len)
);

1810
TRACE_EVENT(ext4_ext_handle_uninitialized_extents,
1811
	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1812 1813
		 unsigned int allocated, ext4_fsblk_t newblock),

1814
	TP_ARGS(inode, map, flags, allocated, newblock),
1815 1816 1817

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
1818 1819
		__field(	ino_t,		ino		)
		__field(	int,		flags		)
1820 1821 1822 1823 1824 1825 1826 1827 1828
		__field(	ext4_lblk_t,	lblk		)
		__field(	ext4_fsblk_t,	pblk		)
		__field(	unsigned int,	len		)
		__field(	unsigned int,	allocated	)
		__field(	ext4_fsblk_t,	newblk		)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
1829
		__entry->ino		= inode->i_ino;
1830
		__entry->flags		= flags;
1831 1832 1833 1834 1835 1836 1837
		__entry->lblk		= map->m_lblk;
		__entry->pblk		= map->m_pblk;
		__entry->len		= map->m_len;
		__entry->allocated	= allocated;
		__entry->newblk		= newblock;
	),

1838
	TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %s "
1839 1840 1841 1842
		  "allocated %d newblock %llu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->lblk, (unsigned long long) __entry->pblk,
1843
		  __entry->len, show_map_flags(__entry->flags),
1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854
		  (unsigned int) __entry->allocated,
		  (unsigned long long) __entry->newblk)
);

TRACE_EVENT(ext4_get_implied_cluster_alloc_exit,
	TP_PROTO(struct super_block *sb, struct ext4_map_blocks *map, int ret),

	TP_ARGS(sb, map, ret),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
1855
		__field(	unsigned int,	flags	)
1856 1857 1858 1859 1860 1861 1862 1863
		__field(	ext4_lblk_t,	lblk	)
		__field(	ext4_fsblk_t,	pblk	)
		__field(	unsigned int,	len	)
		__field(	int,		ret	)
	),

	TP_fast_assign(
		__entry->dev	= sb->s_dev;
1864
		__entry->flags	= map->m_flags;
1865 1866 1867 1868 1869 1870
		__entry->lblk	= map->m_lblk;
		__entry->pblk	= map->m_pblk;
		__entry->len	= map->m_len;
		__entry->ret	= ret;
	),

1871
	TP_printk("dev %d,%d m_lblk %u m_pblk %llu m_len %u m_flags %s ret %d",
1872 1873
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->lblk, (unsigned long long) __entry->pblk,
1874
		  __entry->len, show_mflags(__entry->flags), __entry->ret)
1875 1876 1877 1878 1879 1880 1881 1882 1883 1884
);

TRACE_EVENT(ext4_ext_put_in_cache,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, unsigned int len,
		 ext4_fsblk_t start),

	TP_ARGS(inode, lblk, len, start),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
1885
		__field(	ino_t,		ino	)
1886 1887 1888 1889 1890 1891 1892
		__field(	ext4_lblk_t,	lblk	)
		__field(	unsigned int,	len	)
		__field(	ext4_fsblk_t,	start	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1893
		__entry->ino	= inode->i_ino;
1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913
		__entry->lblk	= lblk;
		__entry->len	= len;
		__entry->start	= start;
	),

	TP_printk("dev %d,%d ino %lu lblk %u len %u start %llu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->lblk,
		  __entry->len,
		  (unsigned long long) __entry->start)
);

TRACE_EVENT(ext4_ext_in_cache,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, int ret),

	TP_ARGS(inode, lblk, ret),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
1914
		__field(	ino_t,		ino	)
1915 1916 1917 1918 1919 1920
		__field(	ext4_lblk_t,	lblk	)
		__field(	int,		ret	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1921
		__entry->ino	= inode->i_ino;
1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941
		__entry->lblk	= lblk;
		__entry->ret	= ret;
	),

	TP_printk("dev %d,%d ino %lu lblk %u ret %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->lblk,
		  __entry->ret)

);

TRACE_EVENT(ext4_find_delalloc_range,
	TP_PROTO(struct inode *inode, ext4_lblk_t from, ext4_lblk_t to,
		int reverse, int found, ext4_lblk_t found_blk),

	TP_ARGS(inode, from, to, reverse, found, found_blk),

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
1942
		__field(	ino_t,		ino		)
1943 1944 1945 1946 1947 1948 1949 1950 1951
		__field(	ext4_lblk_t,	from		)
		__field(	ext4_lblk_t,	to		)
		__field(	int,		reverse		)
		__field(	int,		found		)
		__field(	ext4_lblk_t,	found_blk	)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
1952
		__entry->ino		= inode->i_ino;
1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975
		__entry->from		= from;
		__entry->to		= to;
		__entry->reverse	= reverse;
		__entry->found		= found;
		__entry->found_blk	= found_blk;
	),

	TP_printk("dev %d,%d ino %lu from %u to %u reverse %d found %d "
		  "(blk = %u)",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->from, (unsigned) __entry->to,
		  __entry->reverse, __entry->found,
		  (unsigned) __entry->found_blk)
);

TRACE_EVENT(ext4_get_reserved_cluster_alloc,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, unsigned int len),

	TP_ARGS(inode, lblk, len),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
1976
		__field(	ino_t,		ino	)
1977 1978 1979 1980 1981 1982
		__field(	ext4_lblk_t,	lblk	)
		__field(	unsigned int,	len	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1983
		__entry->ino	= inode->i_ino;
1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002
		__entry->lblk	= lblk;
		__entry->len	= len;
	),

	TP_printk("dev %d,%d ino %lu lblk %u len %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->lblk,
		  __entry->len)
);

TRACE_EVENT(ext4_ext_show_extent,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_fsblk_t pblk,
		 unsigned short len),

	TP_ARGS(inode, lblk, pblk, len),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
2003
		__field(	ino_t,		ino	)
2004
		__field(	ext4_fsblk_t,	pblk	)
2005
		__field(	ext4_lblk_t,	lblk	)
2006 2007 2008 2009 2010
		__field(	unsigned short,	len	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
2011
		__entry->ino	= inode->i_ino;
2012
		__entry->pblk	= pblk;
2013
		__entry->lblk	= lblk;
2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027
		__entry->len	= len;
	),

	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->lblk,
		  (unsigned long long) __entry->pblk,
		  (unsigned short) __entry->len)
);

TRACE_EVENT(ext4_remove_blocks,
	    TP_PROTO(struct inode *inode, struct ext4_extent *ex,
		ext4_lblk_t from, ext4_fsblk_t to,
2028
		long long partial_cluster),
2029 2030 2031 2032 2033

	TP_ARGS(inode, ex, from, to, partial_cluster),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
2034
		__field(	ino_t,		ino	)
2035 2036
		__field(	ext4_lblk_t,	from	)
		__field(	ext4_lblk_t,	to	)
2037
		__field(	long long,	partial	)
2038 2039 2040
		__field(	ext4_fsblk_t,	ee_pblk	)
		__field(	ext4_lblk_t,	ee_lblk	)
		__field(	unsigned short,	ee_len	)
2041 2042 2043 2044
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
2045
		__entry->ino		= inode->i_ino;
2046 2047 2048
		__entry->from		= from;
		__entry->to		= to;
		__entry->partial	= partial_cluster;
2049
		__entry->ee_pblk	= ext4_ext_pblock(ex);
2050
		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
2051
		__entry->ee_len		= ext4_ext_get_actual_len(ex);
2052 2053 2054
	),

	TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]"
2055
		  "from %u to %u partial_cluster %lld",
2056 2057 2058 2059 2060 2061 2062
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->ee_lblk,
		  (unsigned long long) __entry->ee_pblk,
		  (unsigned short) __entry->ee_len,
		  (unsigned) __entry->from,
		  (unsigned) __entry->to,
2063
		  (long long) __entry->partial)
2064 2065 2066 2067
);

TRACE_EVENT(ext4_ext_rm_leaf,
	TP_PROTO(struct inode *inode, ext4_lblk_t start,
2068 2069
		 struct ext4_extent *ex,
		 long long partial_cluster),
2070 2071 2072 2073 2074

	TP_ARGS(inode, start, ex, partial_cluster),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
2075
		__field(	ino_t,		ino	)
2076
		__field(	long long,	partial	)
2077 2078 2079 2080 2081 2082 2083 2084
		__field(	ext4_lblk_t,	start	)
		__field(	ext4_lblk_t,	ee_lblk	)
		__field(	ext4_fsblk_t,	ee_pblk	)
		__field(	short,		ee_len	)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
2085 2086
		__entry->ino		= inode->i_ino;
		__entry->partial	= partial_cluster;
2087 2088 2089 2090 2091 2092 2093
		__entry->start		= start;
		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
		__entry->ee_pblk	= ext4_ext_pblock(ex);
		__entry->ee_len		= ext4_ext_get_actual_len(ex);
	),

	TP_printk("dev %d,%d ino %lu start_lblk %u last_extent [%u(%llu), %u]"
2094
		  "partial_cluster %lld",
2095 2096 2097 2098 2099 2100
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->start,
		  (unsigned) __entry->ee_lblk,
		  (unsigned long long) __entry->ee_pblk,
		  (unsigned short) __entry->ee_len,
2101
		  (long long) __entry->partial)
2102 2103 2104 2105 2106 2107 2108 2109 2110
);

TRACE_EVENT(ext4_ext_rm_idx,
	TP_PROTO(struct inode *inode, ext4_fsblk_t pblk),

	TP_ARGS(inode, pblk),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
2111
		__field(	ino_t,		ino	)
2112 2113 2114 2115 2116
		__field(	ext4_fsblk_t,	pblk	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
2117
		__entry->ino	= inode->i_ino;
2118 2119 2120 2121 2122 2123 2124 2125 2126 2127
		__entry->pblk	= pblk;
	),

	TP_printk("dev %d,%d ino %lu index_pblk %llu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned long long) __entry->pblk)
);

TRACE_EVENT(ext4_ext_remove_space,
2128 2129
	TP_PROTO(struct inode *inode, ext4_lblk_t start,
		 ext4_lblk_t end, int depth),
2130

2131
	TP_ARGS(inode, start, end, depth),
2132 2133 2134

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
2135
		__field(	ino_t,		ino	)
2136
		__field(	ext4_lblk_t,	start	)
2137
		__field(	ext4_lblk_t,	end	)
2138 2139 2140 2141 2142
		__field(	int,		depth	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
2143
		__entry->ino	= inode->i_ino;
2144
		__entry->start	= start;
2145
		__entry->end	= end;
2146 2147 2148
		__entry->depth	= depth;
	),

2149
	TP_printk("dev %d,%d ino %lu since %u end %u depth %d",
2150 2151 2152
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->start,
2153
		  (unsigned) __entry->end,
2154 2155 2156 2157
		  __entry->depth)
);

TRACE_EVENT(ext4_ext_remove_space_done,
2158
	TP_PROTO(struct inode *inode, ext4_lblk_t start, ext4_lblk_t end,
2159
		 int depth, long long partial, __le16 eh_entries),
2160

2161
	TP_ARGS(inode, start, end, depth, partial, eh_entries),
2162 2163 2164

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
2165
		__field(	ino_t,		ino		)
2166
		__field(	ext4_lblk_t,	start		)
2167
		__field(	ext4_lblk_t,	end		)
2168
		__field(	int,		depth		)
2169
		__field(	long long,	partial		)
2170 2171 2172 2173 2174
		__field(	unsigned short,	eh_entries	)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
2175
		__entry->ino		= inode->i_ino;
2176
		__entry->start		= start;
2177
		__entry->end		= end;
2178 2179
		__entry->depth		= depth;
		__entry->partial	= partial;
2180
		__entry->eh_entries	= le16_to_cpu(eh_entries);
2181 2182
	),

2183
	TP_printk("dev %d,%d ino %lu since %u end %u depth %d partial %lld "
2184 2185 2186 2187
		  "remaining_entries %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->start,
2188
		  (unsigned) __entry->end,
2189
		  __entry->depth,
2190
		  (long long) __entry->partial,
2191 2192 2193
		  (unsigned short) __entry->eh_entries)
);

2194
DECLARE_EVENT_CLASS(ext4__es_extent,
2195
	TP_PROTO(struct inode *inode, struct extent_status *es),
2196

2197
	TP_ARGS(inode, es),
2198 2199

	TP_STRUCT__entry(
2200 2201 2202 2203 2204
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
		__field(	ext4_lblk_t,	lblk		)
		__field(	ext4_lblk_t,	len		)
		__field(	ext4_fsblk_t,	pblk		)
2205
		__field(	char, status	)
2206 2207 2208 2209 2210
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
2211 2212 2213
		__entry->lblk	= es->es_lblk;
		__entry->len	= es->es_len;
		__entry->pblk	= ext4_es_pblock(es);
2214
		__entry->status	= ext4_es_status(es);
2215 2216
	),

2217
	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2218 2219
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
2220
		  __entry->lblk, __entry->len,
2221
		  __entry->pblk, show_extent_status(__entry->status))
2222 2223
);

2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235
DEFINE_EVENT(ext4__es_extent, ext4_es_insert_extent,
	TP_PROTO(struct inode *inode, struct extent_status *es),

	TP_ARGS(inode, es)
);

DEFINE_EVENT(ext4__es_extent, ext4_es_cache_extent,
	TP_PROTO(struct inode *inode, struct extent_status *es),

	TP_ARGS(inode, es)
);

2236
TRACE_EVENT(ext4_es_remove_extent,
Z
Zheng Liu 已提交
2237
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t len),
2238

Z
Zheng Liu 已提交
2239
	TP_ARGS(inode, lblk, len),
2240 2241 2242 2243

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
		__field(	ino_t,	ino			)
Z
Zheng Liu 已提交
2244
		__field(	loff_t,	lblk			)
2245 2246 2247 2248 2249 2250
		__field(	loff_t,	len			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
Z
Zheng Liu 已提交
2251
		__entry->lblk	= lblk;
2252 2253 2254 2255 2256 2257
		__entry->len	= len;
	),

	TP_printk("dev %d,%d ino %lu es [%lld/%lld)",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
Z
Zheng Liu 已提交
2258
		  __entry->lblk, __entry->len)
2259 2260
);

Y
Yan, Zheng 已提交
2261
TRACE_EVENT(ext4_es_find_delayed_extent_range_enter,
Z
Zheng Liu 已提交
2262
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2263

Z
Zheng Liu 已提交
2264
	TP_ARGS(inode, lblk),
2265 2266 2267 2268

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
Z
Zheng Liu 已提交
2269
		__field(	ext4_lblk_t,	lblk		)
2270 2271 2272 2273 2274
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
Z
Zheng Liu 已提交
2275
		__entry->lblk	= lblk;
2276 2277
	),

Z
Zheng Liu 已提交
2278
	TP_printk("dev %d,%d ino %lu lblk %u",
2279
		  MAJOR(__entry->dev), MINOR(__entry->dev),
Z
Zheng Liu 已提交
2280
		  (unsigned long) __entry->ino, __entry->lblk)
2281 2282
);

Y
Yan, Zheng 已提交
2283
TRACE_EVENT(ext4_es_find_delayed_extent_range_exit,
2284
	TP_PROTO(struct inode *inode, struct extent_status *es),
2285

2286
	TP_ARGS(inode, es),
2287 2288 2289 2290

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
Z
Zheng Liu 已提交
2291
		__field(	ext4_lblk_t,	lblk		)
2292
		__field(	ext4_lblk_t,	len		)
2293
		__field(	ext4_fsblk_t,	pblk		)
2294
		__field(	char, status	)
2295 2296 2297 2298 2299
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
Z
Zheng Liu 已提交
2300 2301
		__entry->lblk	= es->es_lblk;
		__entry->len	= es->es_len;
2302
		__entry->pblk	= ext4_es_pblock(es);
2303
		__entry->status	= ext4_es_status(es);
2304 2305
	),

2306
	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2307 2308
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
2309
		  __entry->lblk, __entry->len,
2310
		  __entry->pblk, show_extent_status(__entry->status))
2311 2312
);

2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346
TRACE_EVENT(ext4_es_lookup_extent_enter,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),

	TP_ARGS(inode, lblk),

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
		__field(	ext4_lblk_t,	lblk		)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->lblk	= lblk;
	),

	TP_printk("dev %d,%d ino %lu lblk %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino, __entry->lblk)
);

TRACE_EVENT(ext4_es_lookup_extent_exit,
	TP_PROTO(struct inode *inode, struct extent_status *es,
		 int found),

	TP_ARGS(inode, es, found),

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
		__field(	ext4_lblk_t,	lblk		)
		__field(	ext4_lblk_t,	len		)
		__field(	ext4_fsblk_t,	pblk		)
2347
		__field(	char,		status		)
2348 2349 2350 2351 2352 2353 2354 2355 2356
		__field(	int,		found		)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->lblk	= es->es_lblk;
		__entry->len	= es->es_len;
		__entry->pblk	= ext4_es_pblock(es);
2357
		__entry->status	= ext4_es_status(es);
2358 2359 2360
		__entry->found	= found;
	),

2361
	TP_printk("dev %d,%d ino %lu found %d [%u/%u) %llu %s",
2362 2363 2364 2365
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino, __entry->found,
		  __entry->lblk, __entry->len,
		  __entry->found ? __entry->pblk : 0,
2366
		  show_extent_status(__entry->found ? __entry->status : 0))
2367 2368
);

2369
TRACE_EVENT(ext4_es_shrink_enter,
T
Theodore Ts'o 已提交
2370
	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2371

T
Theodore Ts'o 已提交
2372
	TP_ARGS(sb, nr_to_scan, cache_cnt),
2373 2374 2375 2376

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
		__field(	int,	nr_to_scan		)
T
Theodore Ts'o 已提交
2377
		__field(	int,	cache_cnt		)
2378 2379 2380 2381 2382
	),

	TP_fast_assign(
		__entry->dev		= sb->s_dev;
		__entry->nr_to_scan	= nr_to_scan;
T
Theodore Ts'o 已提交
2383
		__entry->cache_cnt	= cache_cnt;
2384 2385
	),

T
Theodore Ts'o 已提交
2386
	TP_printk("dev %d,%d nr_to_scan %d cache_cnt %d",
2387
		  MAJOR(__entry->dev), MINOR(__entry->dev),
T
Theodore Ts'o 已提交
2388
		  __entry->nr_to_scan, __entry->cache_cnt)
2389 2390 2391
);

TRACE_EVENT(ext4_es_shrink_exit,
T
Theodore Ts'o 已提交
2392
	TP_PROTO(struct super_block *sb, int shrunk_nr, int cache_cnt),
2393

T
Theodore Ts'o 已提交
2394
	TP_ARGS(sb, shrunk_nr, cache_cnt),
2395 2396 2397 2398

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
		__field(	int,	shrunk_nr		)
T
Theodore Ts'o 已提交
2399
		__field(	int,	cache_cnt		)
2400 2401 2402 2403 2404
	),

	TP_fast_assign(
		__entry->dev		= sb->s_dev;
		__entry->shrunk_nr	= shrunk_nr;
T
Theodore Ts'o 已提交
2405
		__entry->cache_cnt	= cache_cnt;
2406 2407
	),

T
Theodore Ts'o 已提交
2408
	TP_printk("dev %d,%d shrunk_nr %d cache_cnt %d",
2409
		  MAJOR(__entry->dev), MINOR(__entry->dev),
T
Theodore Ts'o 已提交
2410
		  __entry->shrunk_nr, __entry->cache_cnt)
2411 2412
);

2413 2414 2415 2416
#endif /* _TRACE_EXT4_H */

/* This part must be outside protection */
#include <trace/define_trace.h>