ext4.h 65.3 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0 */
2 3 4
#undef TRACE_SYSTEM
#define TRACE_SYSTEM ext4

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

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

11 12
struct ext4_allocation_context;
struct ext4_allocation_request;
13
struct ext4_extent;
14
struct ext4_prealloc_space;
15
struct ext4_inode_info;
16
struct mpage_da_data;
17
struct ext4_map_blocks;
18
struct extent_status;
D
Darrick J. Wong 已提交
19
struct ext4_fsmap;
20 21

#define EXT4_I(inode) (container_of(inode, struct ext4_inode_info, vfs_inode))
22

23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#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" },		\
41
	{ EXT4_GET_BLOCKS_UNWRIT_EXT,		"UNWRIT" },		\
42 43 44 45 46
	{ 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" },	\
47 48
	{ EXT4_GET_BLOCKS_KEEP_SIZE,		"KEEP_SIZE" },		\
	{ EXT4_GET_BLOCKS_ZERO,			"ZERO" })
49 50 51 52 53

#define show_mflags(flags) __print_flags(flags, "",	\
	{ EXT4_MAP_NEW,		"N" },			\
	{ EXT4_MAP_MAPPED,	"M" },			\
	{ EXT4_MAP_UNWRITTEN,	"U" },			\
54
	{ EXT4_MAP_BOUNDARY,	"B" })
55 56 57 58 59 60 61 62 63 64

#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, "",	\
65 66 67 68
	{ EXTENT_STATUS_WRITTEN,	"W" },			\
	{ EXTENT_STATUS_UNWRITTEN,	"U" },			\
	{ EXTENT_STATUS_DELAYED,	"D" },			\
	{ EXTENT_STATUS_HOLE,		"H" })
69

70 71 72
#define show_falloc_mode(mode) __print_flags(mode, "|",		\
	{ FALLOC_FL_KEEP_SIZE,		"KEEP_SIZE"},		\
	{ FALLOC_FL_PUNCH_HOLE,		"PUNCH_HOLE"},		\
73
	{ FALLOC_FL_NO_HIDE_STALE,	"NO_HIDE_STALE"},	\
74 75
	{ FALLOC_FL_COLLAPSE_RANGE,	"COLLAPSE_RANGE"},	\
	{ FALLOC_FL_ZERO_RANGE,		"ZERO_RANGE"})
76

77

78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
TRACE_EVENT(ext4_other_inode_update_time,
	TP_PROTO(struct inode *inode, ino_t orig_ino),

	TP_ARGS(inode, orig_ino),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
		__field(	ino_t,	ino			)
		__field(	ino_t,	orig_ino		)
		__field(	uid_t,	uid			)
		__field(	gid_t,	gid			)
		__field(	__u16, mode			)
	),

	TP_fast_assign(
		__entry->orig_ino = orig_ino;
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
		__entry->uid	= i_uid_read(inode);
		__entry->gid	= i_gid_read(inode);
		__entry->mode	= inode->i_mode;
	),

	TP_printk("dev %d,%d orig_ino %lu ino %lu mode 0%o uid %u gid %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->orig_ino,
		  (unsigned long) __entry->ino, __entry->mode,
		  __entry->uid, __entry->gid)
);

108 109 110 111 112 113
TRACE_EVENT(ext4_free_inode,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
114
		__field(	dev_t,	dev			)
115 116 117
		__field(	ino_t,	ino			)
		__field(	uid_t,	uid			)
		__field(	gid_t,	gid			)
L
Lukas Czerner 已提交
118
		__field(	__u64, blocks			)
119
		__field(	__u16, mode			)
120 121 122
	),

	TP_fast_assign(
123
		__entry->dev	= inode->i_sb->s_dev;
124
		__entry->ino	= inode->i_ino;
125 126
		__entry->uid	= i_uid_read(inode);
		__entry->gid	= i_gid_read(inode);
127
		__entry->blocks	= inode->i_blocks;
128
		__entry->mode	= inode->i_mode;
129 130
	),

131
	TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu",
132
		  MAJOR(__entry->dev), MINOR(__entry->dev),
L
Lukas Czerner 已提交
133 134
		  (unsigned long) __entry->ino, __entry->mode,
		  __entry->uid, __entry->gid, __entry->blocks)
135 136 137 138 139 140 141 142
);

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

	TP_ARGS(dir, mode),

	TP_STRUCT__entry(
143
		__field(	dev_t,	dev			)
144
		__field(	ino_t,	dir			)
145
		__field(	__u16, mode			)
146 147 148
	),

	TP_fast_assign(
149
		__entry->dev	= dir->i_sb->s_dev;
150 151 152 153
		__entry->dir	= dir->i_ino;
		__entry->mode	= mode;
	),

154
	TP_printk("dev %d,%d dir %lu mode 0%o",
155
		  MAJOR(__entry->dev), MINOR(__entry->dev),
156
		  (unsigned long) __entry->dir, __entry->mode)
157 158 159 160 161 162 163 164
);

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

	TP_ARGS(inode, dir, mode),

	TP_STRUCT__entry(
165
		__field(	dev_t,	dev			)
166 167
		__field(	ino_t,	ino			)
		__field(	ino_t,	dir			)
168
		__field(	__u16,	mode			)
169 170 171
	),

	TP_fast_assign(
172
		__entry->dev	= inode->i_sb->s_dev;
173 174 175 176 177
		__entry->ino	= inode->i_ino;
		__entry->dir	= dir->i_ino;
		__entry->mode	= mode;
	),

178
	TP_printk("dev %d,%d ino %lu dir %lu mode 0%o",
179
		  MAJOR(__entry->dev), MINOR(__entry->dev),
180
		  (unsigned long) __entry->ino,
181
		  (unsigned long) __entry->dir, __entry->mode)
182 183
);

184 185 186 187 188 189
TRACE_EVENT(ext4_evict_inode,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
190
		__field(	dev_t,	dev			)
191 192 193 194 195
		__field(	ino_t,	ino			)
		__field(	int,	nlink			)
	),

	TP_fast_assign(
196
		__entry->dev	= inode->i_sb->s_dev;
197 198 199 200 201
		__entry->ino	= inode->i_ino;
		__entry->nlink	= inode->i_nlink;
	),

	TP_printk("dev %d,%d ino %lu nlink %d",
202
		  MAJOR(__entry->dev), MINOR(__entry->dev),
203 204 205 206 207 208 209 210 211
		  (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(
212
		__field(	dev_t,	dev			)
213 214 215 216 217
		__field(	ino_t,	ino			)
		__field(	int,	drop			)
	),

	TP_fast_assign(
218
		__entry->dev	= inode->i_sb->s_dev;
219 220 221 222 223
		__entry->ino	= inode->i_ino;
		__entry->drop	= drop;
	),

	TP_printk("dev %d,%d ino %lu drop %d",
224
		  MAJOR(__entry->dev), MINOR(__entry->dev),
225 226 227
		  (unsigned long) __entry->ino, __entry->drop)
);

228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
TRACE_EVENT(ext4_nfs_commit_metadata,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

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

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

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

248 249 250 251 252 253
TRACE_EVENT(ext4_mark_inode_dirty,
	TP_PROTO(struct inode *inode, unsigned long IP),

	TP_ARGS(inode, IP),

	TP_STRUCT__entry(
254
		__field(	dev_t,	dev			)
255 256 257 258 259
		__field(	ino_t,	ino			)
		__field(unsigned long,	ip			)
	),

	TP_fast_assign(
260
		__entry->dev	= inode->i_sb->s_dev;
261 262 263 264
		__entry->ino	= inode->i_ino;
		__entry->ip	= IP;
	),

265
	TP_printk("dev %d,%d ino %lu caller %pS",
266
		  MAJOR(__entry->dev), MINOR(__entry->dev),
267 268 269 270 271 272 273 274 275
		  (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(
276
		__field(	dev_t,	dev			)
277 278 279 280 281
		__field(	ino_t,	ino			)
		__field(	loff_t,	new_size		)
	),

	TP_fast_assign(
282
		__entry->dev		= inode->i_sb->s_dev;
283 284 285 286 287
		__entry->ino		= inode->i_ino;
		__entry->new_size	= new_size;
	),

	TP_printk("dev %d,%d ino %lu new_size %lld",
288
		  MAJOR(__entry->dev), MINOR(__entry->dev),
289
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
290
		  __entry->new_size)
291 292
);

293
DECLARE_EVENT_CLASS(ext4__write_begin,
294 295 296 297 298 299 300

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

	TP_ARGS(inode, pos, len, flags),

	TP_STRUCT__entry(
301
		__field(	dev_t,	dev			)
302 303 304 305 306 307 308
		__field(	ino_t,	ino			)
		__field(	loff_t,	pos			)
		__field(	unsigned int, len		)
		__field(	unsigned int, flags		)
	),

	TP_fast_assign(
309
		__entry->dev	= inode->i_sb->s_dev;
310 311 312 313 314 315
		__entry->ino	= inode->i_ino;
		__entry->pos	= pos;
		__entry->len	= len;
		__entry->flags	= flags;
	),

L
Lukas Czerner 已提交
316
	TP_printk("dev %d,%d ino %lu pos %lld len %u flags %u",
317
		  MAJOR(__entry->dev), MINOR(__entry->dev),
318
		  (unsigned long) __entry->ino,
319
		  __entry->pos, __entry->len, __entry->flags)
320 321
);

322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
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,
339 340 341 342 343 344
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
			unsigned int copied),

	TP_ARGS(inode, pos, len, copied),

	TP_STRUCT__entry(
345
		__field(	dev_t,	dev			)
346 347 348 349 350 351 352
		__field(	ino_t,	ino			)
		__field(	loff_t,	pos			)
		__field(	unsigned int, len		)
		__field(	unsigned int, copied		)
	),

	TP_fast_assign(
353
		__entry->dev	= inode->i_sb->s_dev;
354 355 356 357 358 359
		__entry->ino	= inode->i_ino;
		__entry->pos	= pos;
		__entry->len	= len;
		__entry->copied	= copied;
	),

L
Lukas Czerner 已提交
360
	TP_printk("dev %d,%d ino %lu pos %lld len %u copied %u",
361 362 363
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->pos, __entry->len, __entry->copied)
364 365
);

366
DEFINE_EVENT(ext4__write_end, ext4_write_end,
367

368 369
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),
370

371
	TP_ARGS(inode, pos, len, copied)
372 373
);

374 375
DEFINE_EVENT(ext4__write_end, ext4_journalled_write_end,

376 377 378
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),

379 380
	TP_ARGS(inode, pos, len, copied)
);
381

382
DEFINE_EVENT(ext4__write_end, ext4_da_write_end,
383

384 385 386 387
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),

	TP_ARGS(inode, pos, len, copied)
388 389
);

390
TRACE_EVENT(ext4_writepages,
391 392 393 394 395
	TP_PROTO(struct inode *inode, struct writeback_control *wbc),

	TP_ARGS(inode, wbc),

	TP_STRUCT__entry(
396
		__field(	dev_t,	dev			)
397 398 399 400 401
		__field(	ino_t,	ino			)
		__field(	long,	nr_to_write		)
		__field(	long,	pages_skipped		)
		__field(	loff_t,	range_start		)
		__field(	loff_t,	range_end		)
402
		__field(       pgoff_t,	writeback_index		)
403
		__field(	int,	sync_mode		)
404 405 406 407 408
		__field(	char,	for_kupdate		)
		__field(	char,	range_cyclic		)
	),

	TP_fast_assign(
409
		__entry->dev		= inode->i_sb->s_dev;
410 411 412 413 414
		__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;
415
		__entry->writeback_index = inode->i_mapping->writeback_index;
416
		__entry->sync_mode	= wbc->sync_mode;
417 418 419 420
		__entry->for_kupdate	= wbc->for_kupdate;
		__entry->range_cyclic	= wbc->range_cyclic;
	),

421
	TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld "
422
		  "range_start %lld range_end %lld sync_mode %d "
423 424
		  "for_kupdate %d range_cyclic %d writeback_index %lu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
425
		  (unsigned long) __entry->ino, __entry->nr_to_write,
426
		  __entry->pages_skipped, __entry->range_start,
427 428
		  __entry->range_end, __entry->sync_mode,
		  __entry->for_kupdate, __entry->range_cyclic,
429
		  (unsigned long) __entry->writeback_index)
430 431
);

432
TRACE_EVENT(ext4_da_write_pages,
J
Jan Kara 已提交
433 434
	TP_PROTO(struct inode *inode, pgoff_t first_page,
		 struct writeback_control *wbc),
435

J
Jan Kara 已提交
436
	TP_ARGS(inode, first_page, wbc),
437 438

	TP_STRUCT__entry(
439
		__field(	dev_t,	dev			)
440
		__field(	ino_t,	ino			)
J
Jan Kara 已提交
441 442 443
		__field(      pgoff_t,	first_page		)
		__field(	 long,	nr_to_write		)
		__field(	  int,	sync_mode		)
444 445 446
	),

	TP_fast_assign(
447
		__entry->dev		= inode->i_sb->s_dev;
448
		__entry->ino		= inode->i_ino;
J
Jan Kara 已提交
449 450 451
		__entry->first_page	= first_page;
		__entry->nr_to_write	= wbc->nr_to_write;
		__entry->sync_mode	= wbc->sync_mode;
452 453
	),

J
Jan Kara 已提交
454 455
	TP_printk("dev %d,%d ino %lu first_page %lu nr_to_write %ld "
		  "sync_mode %d",
456
		  MAJOR(__entry->dev), MINOR(__entry->dev),
J
Jan Kara 已提交
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481
		  (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;
	),

482
	TP_printk("dev %d,%d ino %lu lblk %llu len %u flags %s",
J
Jan Kara 已提交
483 484
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino, __entry->lblk, __entry->len,
485
		  show_mflags(__entry->flags))
486 487
);

488
TRACE_EVENT(ext4_writepages_result,
489 490 491 492 493 494
	TP_PROTO(struct inode *inode, struct writeback_control *wbc,
			int ret, int pages_written),

	TP_ARGS(inode, wbc, ret, pages_written),

	TP_STRUCT__entry(
495
		__field(	dev_t,	dev			)
496 497 498 499
		__field(	ino_t,	ino			)
		__field(	int,	ret			)
		__field(	int,	pages_written		)
		__field(	long,	pages_skipped		)
500
		__field(       pgoff_t,	writeback_index		)
501
		__field(	int,	sync_mode		)
502 503 504
	),

	TP_fast_assign(
505
		__entry->dev		= inode->i_sb->s_dev;
506 507 508 509
		__entry->ino		= inode->i_ino;
		__entry->ret		= ret;
		__entry->pages_written	= pages_written;
		__entry->pages_skipped	= wbc->pages_skipped;
510
		__entry->writeback_index = inode->i_mapping->writeback_index;
511
		__entry->sync_mode	= wbc->sync_mode;
512 513
	),

514
	TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld "
515
		  "sync_mode %d writeback_index %lu",
516
		  MAJOR(__entry->dev), MINOR(__entry->dev),
517
		  (unsigned long) __entry->ino, __entry->ret,
518
		  __entry->pages_written, __entry->pages_skipped,
519
		  __entry->sync_mode,
520
		  (unsigned long) __entry->writeback_index)
521 522
);

523 524 525 526 527 528 529
DECLARE_EVENT_CLASS(ext4__page_op,
	TP_PROTO(struct page *page),

	TP_ARGS(page),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
530 531
		__field(	ino_t,	ino			)
		__field(	pgoff_t, index			)
532 533 534 535 536

	),

	TP_fast_assign(
		__entry->dev	= page->mapping->host->i_sb->s_dev;
537 538
		__entry->ino	= page->mapping->host->i_ino;
		__entry->index	= page->index;
539 540 541 542 543
	),

	TP_printk("dev %d,%d ino %lu page_index %lu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
544 545 546 547 548 549 550 551
		  (unsigned long) __entry->index)
);

DEFINE_EVENT(ext4__page_op, ext4_writepage,

	TP_PROTO(struct page *page),

	TP_ARGS(page)
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
);

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)
);

568
DECLARE_EVENT_CLASS(ext4_invalidatepage_op,
569
	TP_PROTO(struct page *page, unsigned int offset, unsigned int length),
570

571
	TP_ARGS(page, offset, length),
572 573

	TP_STRUCT__entry(
574 575
		__field(	dev_t,	dev			)
		__field(	ino_t,	ino			)
576
		__field(	pgoff_t, index			)
577 578
		__field(	unsigned int, offset		)
		__field(	unsigned int, length		)
579 580 581
	),

	TP_fast_assign(
582 583
		__entry->dev	= page->mapping->host->i_sb->s_dev;
		__entry->ino	= page->mapping->host->i_ino;
584 585
		__entry->index	= page->index;
		__entry->offset	= offset;
586
		__entry->length	= length;
587 588
	),

589
	TP_printk("dev %d,%d ino %lu page_index %lu offset %u length %u",
590 591
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
592 593
		  (unsigned long) __entry->index,
		  __entry->offset, __entry->length)
594 595
);

596
DEFINE_EVENT(ext4_invalidatepage_op, ext4_invalidatepage,
597
	TP_PROTO(struct page *page, unsigned int offset, unsigned int length),
598

599
	TP_ARGS(page, offset, length)
600 601 602
);

DEFINE_EVENT(ext4_invalidatepage_op, ext4_journalled_invalidatepage,
603
	TP_PROTO(struct page *page, unsigned int offset, unsigned int length),
604

605
	TP_ARGS(page, offset, length)
606 607
);

608 609 610 611 612 613 614
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(
615
		__field(	dev_t,	dev			)
616 617 618 619 620 621
		__field(	__u64,	blk			)
		__field(	__u64,	count			)

	),

	TP_fast_assign(
622
		__entry->dev	= sb->s_dev;
623 624 625 626
		__entry->blk	= blk;
		__entry->count	= count;
	),

627
	TP_printk("dev %d,%d blk %llu count %llu",
628
		  MAJOR(__entry->dev), MINOR(__entry->dev),
629
		  __entry->blk, __entry->count)
630 631
);

632
DECLARE_EVENT_CLASS(ext4__mb_new_pa,
633 634 635 636 637 638
	TP_PROTO(struct ext4_allocation_context *ac,
		 struct ext4_prealloc_space *pa),

	TP_ARGS(ac, pa),

	TP_STRUCT__entry(
639
		__field(	dev_t,	dev			)
640 641 642
		__field(	ino_t,	ino			)
		__field(	__u64,	pa_pstart		)
		__field(	__u64,	pa_lstart		)
643
		__field(	__u32,	pa_len			)
644 645 646 647

	),

	TP_fast_assign(
648
		__entry->dev		= ac->ac_sb->s_dev;
649 650 651
		__entry->ino		= ac->ac_inode->i_ino;
		__entry->pa_pstart	= pa->pa_pstart;
		__entry->pa_lstart	= pa->pa_lstart;
652
		__entry->pa_len		= pa->pa_len;
653 654
	),

655
	TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu",
656 657 658
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
659 660
);

661 662
DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa,

663 664 665
	TP_PROTO(struct ext4_allocation_context *ac,
		 struct ext4_prealloc_space *pa),

666 667
	TP_ARGS(ac, pa)
);
668

669
DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_group_pa,
670

671 672
	TP_PROTO(struct ext4_allocation_context *ac,
		 struct ext4_prealloc_space *pa),
673

674
	TP_ARGS(ac, pa)
675 676 677
);

TRACE_EVENT(ext4_mb_release_inode_pa,
L
Lukas Czerner 已提交
678
	TP_PROTO(struct ext4_prealloc_space *pa,
679 680
		 unsigned long long block, unsigned int count),

L
Lukas Czerner 已提交
681
	TP_ARGS(pa, block, count),
682 683

	TP_STRUCT__entry(
684
		__field(	dev_t,	dev			)
685 686 687 688 689 690 691
		__field(	ino_t,	ino			)
		__field(	__u64,	block			)
		__field(	__u32,	count			)

	),

	TP_fast_assign(
L
Lukas Czerner 已提交
692 693
		__entry->dev		= pa->pa_inode->i_sb->s_dev;
		__entry->ino		= pa->pa_inode->i_ino;
694 695 696 697
		__entry->block		= block;
		__entry->count		= count;
	),

698
	TP_printk("dev %d,%d ino %lu block %llu count %u",
699 700 701
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->block, __entry->count)
702 703 704
);

TRACE_EVENT(ext4_mb_release_group_pa,
705
	TP_PROTO(struct super_block *sb, struct ext4_prealloc_space *pa),
706

707
	TP_ARGS(sb, pa),
708 709

	TP_STRUCT__entry(
710
		__field(	dev_t,	dev			)
711 712 713 714 715 716
		__field(	__u64,	pa_pstart		)
		__field(	__u32,	pa_len			)

	),

	TP_fast_assign(
717
		__entry->dev		= sb->s_dev;
718 719 720 721
		__entry->pa_pstart	= pa->pa_pstart;
		__entry->pa_len		= pa->pa_len;
	),

722
	TP_printk("dev %d,%d pstart %llu len %u",
723
		  MAJOR(__entry->dev), MINOR(__entry->dev),
724
		  __entry->pa_pstart, __entry->pa_len)
725 726 727 728 729 730 731 732
);

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

	TP_ARGS(inode),

	TP_STRUCT__entry(
733
		__field(	dev_t,	dev			)
734 735 736 737 738
		__field(	ino_t,	ino			)

	),

	TP_fast_assign(
739
		__entry->dev	= inode->i_sb->s_dev;
740 741 742
		__entry->ino	= inode->i_ino;
	),

743
	TP_printk("dev %d,%d ino %lu",
744
		  MAJOR(__entry->dev), MINOR(__entry->dev),
745
		  (unsigned long) __entry->ino)
746 747 748 749 750 751 752 753
);

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

	TP_ARGS(sb, needed),

	TP_STRUCT__entry(
754
		__field(	dev_t,	dev			)
755 756 757 758 759
		__field(	int,	needed			)

	),

	TP_fast_assign(
760
		__entry->dev	= sb->s_dev;
761 762 763
		__entry->needed	= needed;
	),

764
	TP_printk("dev %d,%d needed %d",
765 766
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->needed)
767 768 769 770 771 772 773 774
);

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

	TP_ARGS(ar),

	TP_STRUCT__entry(
775
		__field(	dev_t,	dev			)
776 777
		__field(	ino_t,	ino			)
		__field(	unsigned int, len		)
L
Lukas Czerner 已提交
778 779 780
		__field(	__u32,  logical			)
		__field(	__u32,	lleft			)
		__field(	__u32,	lright			)
781 782 783
		__field(	__u64,	goal			)
		__field(	__u64,	pleft			)
		__field(	__u64,	pright			)
784
		__field(	unsigned int, flags		)
785 786 787
	),

	TP_fast_assign(
788
		__entry->dev	= ar->inode->i_sb->s_dev;
789 790 791 792 793 794 795 796
		__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;
797
		__entry->flags	= ar->flags;
798 799
	),

800
	TP_printk("dev %d,%d ino %lu flags %s len %u lblk %u goal %llu "
L
Lukas Czerner 已提交
801
		  "lleft %u lright %u pleft %llu pright %llu ",
802
		  MAJOR(__entry->dev), MINOR(__entry->dev),
803
		  (unsigned long) __entry->ino, show_mballoc_flags(__entry->flags),
L
Lukas Czerner 已提交
804 805 806
		  __entry->len, __entry->logical, __entry->goal,
		  __entry->lleft, __entry->lright, __entry->pleft,
		  __entry->pright)
807 808 809 810 811 812 813 814
);

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

	TP_ARGS(ar, block),

	TP_STRUCT__entry(
815
		__field(	dev_t,	dev			)
816 817 818
		__field(	ino_t,	ino			)
		__field(	__u64,	block			)
		__field(	unsigned int, len		)
L
Lukas Czerner 已提交
819 820 821
		__field(	__u32,  logical			)
		__field(	__u32,	lleft			)
		__field(	__u32,	lright			)
822 823 824
		__field(	__u64,	goal			)
		__field(	__u64,	pleft			)
		__field(	__u64,	pright			)
825
		__field(	unsigned int, flags		)
826 827 828
	),

	TP_fast_assign(
829
		__entry->dev	= ar->inode->i_sb->s_dev;
830 831 832 833 834 835 836 837 838
		__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;
839
		__entry->flags	= ar->flags;
840 841
	),

842
	TP_printk("dev %d,%d ino %lu flags %s len %u block %llu lblk %u "
L
Lukas Czerner 已提交
843
		  "goal %llu lleft %u lright %u pleft %llu pright %llu",
844
		  MAJOR(__entry->dev), MINOR(__entry->dev),
845
		  (unsigned long) __entry->ino, show_mballoc_flags(__entry->flags),
L
Lukas Czerner 已提交
846 847 848
		  __entry->len, __entry->block, __entry->logical,
		  __entry->goal,  __entry->lleft, __entry->lright,
		  __entry->pleft, __entry->pright)
849 850 851 852
);

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

855
	TP_ARGS(inode, block, count, flags),
856 857

	TP_STRUCT__entry(
858
		__field(	dev_t,	dev			)
859 860 861
		__field(	ino_t,	ino			)
		__field(	__u64,	block			)
		__field(	unsigned long,	count		)
L
Lukas Czerner 已提交
862
		__field(	int,	flags			)
863
		__field(	__u16,	mode			)
864 865 866
	),

	TP_fast_assign(
867
		__entry->dev		= inode->i_sb->s_dev;
868 869 870
		__entry->ino		= inode->i_ino;
		__entry->block		= block;
		__entry->count		= count;
871
		__entry->flags		= flags;
872
		__entry->mode		= inode->i_mode;
873 874
	),

875
	TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %s",
876
		  MAJOR(__entry->dev), MINOR(__entry->dev),
877
		  (unsigned long) __entry->ino,
878
		  __entry->mode, __entry->block, __entry->count,
879
		  show_free_flags(__entry->flags))
880 881
);

882
TRACE_EVENT(ext4_sync_file_enter,
883
	TP_PROTO(struct file *file, int datasync),
884

885
	TP_ARGS(file, datasync),
886 887

	TP_STRUCT__entry(
888
		__field(	dev_t,	dev			)
889 890 891 892 893 894
		__field(	ino_t,	ino			)
		__field(	ino_t,	parent			)
		__field(	int,	datasync		)
	),

	TP_fast_assign(
895 896
		struct dentry *dentry = file->f_path.dentry;

897
		__entry->dev		= dentry->d_sb->s_dev;
898
		__entry->ino		= d_inode(dentry)->i_ino;
899
		__entry->datasync	= datasync;
900
		__entry->parent		= d_inode(dentry->d_parent)->i_ino;
901 902
	),

L
Lukas Czerner 已提交
903
	TP_printk("dev %d,%d ino %lu parent %lu datasync %d ",
904
		  MAJOR(__entry->dev), MINOR(__entry->dev),
905
		  (unsigned long) __entry->ino,
906
		  (unsigned long) __entry->parent, __entry->datasync)
907 908
);

909 910 911 912 913 914 915
TRACE_EVENT(ext4_sync_file_exit,
	TP_PROTO(struct inode *inode, int ret),

	TP_ARGS(inode, ret),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
916 917
		__field(	ino_t,	ino			)
		__field(	int,	ret			)
918 919 920 921
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
922 923
		__entry->ino		= inode->i_ino;
		__entry->ret		= ret;
924 925
	),

L
Lukas Czerner 已提交
926
	TP_printk("dev %d,%d ino %lu ret %d",
927 928 929 930 931
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->ret)
);

932 933 934 935 936 937
TRACE_EVENT(ext4_sync_fs,
	TP_PROTO(struct super_block *sb, int wait),

	TP_ARGS(sb, wait),

	TP_STRUCT__entry(
938
		__field(	dev_t,	dev			)
939 940 941 942 943
		__field(	int,	wait			)

	),

	TP_fast_assign(
944
		__entry->dev	= sb->s_dev;
945 946 947
		__entry->wait	= wait;
	),

948 949 950
	TP_printk("dev %d,%d wait %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->wait)
951 952
);

953 954 955 956 957 958
TRACE_EVENT(ext4_alloc_da_blocks,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
959
		__field(	dev_t,	dev			)
960
		__field(	ino_t,	ino			)
961
		__field( unsigned int,	data_blocks		)
962 963 964
	),

	TP_fast_assign(
965
		__entry->dev	= inode->i_sb->s_dev;
966 967 968 969
		__entry->ino	= inode->i_ino;
		__entry->data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
	),

970
	TP_printk("dev %d,%d ino %lu reserved_data_blocks %u",
971
		  MAJOR(__entry->dev), MINOR(__entry->dev),
972
		  (unsigned long) __entry->ino,
973
		  __entry->data_blocks)
974 975
);

976 977 978 979 980 981
TRACE_EVENT(ext4_mballoc_alloc,
	TP_PROTO(struct ext4_allocation_context *ac),

	TP_ARGS(ac),

	TP_STRUCT__entry(
982
		__field(	dev_t,	dev			)
983 984 985 986 987 988 989 990 991 992 993 994 995
		__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		)
996 997 998 999 1000 1001
		__field(	__u16,	found			)
		__field(	__u16,	groups			)
		__field(	__u16,	buddy			)
		__field(	__u16,	flags			)
		__field(	__u16,	tail			)
		__field(	__u8,	cr			)
1002 1003 1004
	),

	TP_fast_assign(
1005
		__entry->dev		= ac->ac_inode->i_sb->s_dev;
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018
		__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;
1019 1020 1021 1022 1023 1024
		__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;
1025 1026
	),

1027
	TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
1028
		  "result %u/%d/%u@%u blks %u grps %u cr %u flags %s "
1029
		  "tail %u broken %u",
1030
		  MAJOR(__entry->dev), MINOR(__entry->dev),
1031
		  (unsigned long) __entry->ino,
1032 1033 1034 1035 1036 1037 1038
		  __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,
1039
		  show_mballoc_flags(__entry->flags), __entry->tail,
1040 1041 1042 1043 1044 1045 1046 1047 1048
		  __entry->buddy ? 1 << __entry->buddy : 0)
);

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

	TP_ARGS(ac),

	TP_STRUCT__entry(
1049
		__field(	dev_t,	dev			)
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061
		__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(
1062
		__entry->dev		= ac->ac_inode->i_sb->s_dev;
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073
		__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;
	),

1074
	TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
1075
		  MAJOR(__entry->dev), MINOR(__entry->dev),
1076
		  (unsigned long) __entry->ino,
1077 1078 1079 1080 1081 1082
		  __entry->orig_group, __entry->orig_start,
		  __entry->orig_len, __entry->orig_logical,
		  __entry->result_group, __entry->result_start,
		  __entry->result_len, __entry->result_logical)
);

1083
DECLARE_EVENT_CLASS(ext4__mballoc,
1084 1085 1086 1087 1088
	TP_PROTO(struct super_block *sb,
		 struct inode *inode,
		 ext4_group_t group,
		 ext4_grpblk_t start,
		 ext4_grpblk_t len),
1089

1090
	TP_ARGS(sb, inode, group, start, len),
1091 1092

	TP_STRUCT__entry(
1093
		__field(	dev_t,	dev			)
1094 1095 1096 1097 1098 1099 1100
		__field(	ino_t,	ino			)
		__field(	  int,	result_start		)
		__field(	__u32, 	result_group		)
		__field(	  int,	result_len		)
	),

	TP_fast_assign(
1101
		__entry->dev		= sb->s_dev;
1102 1103 1104 1105
		__entry->ino		= inode ? inode->i_ino : 0;
		__entry->result_start	= start;
		__entry->result_group	= group;
		__entry->result_len	= len;
1106 1107
	),

L
Lukas Czerner 已提交
1108
	TP_printk("dev %d,%d inode %lu extent %u/%d/%d ",
1109
		  MAJOR(__entry->dev), MINOR(__entry->dev),
1110
		  (unsigned long) __entry->ino,
1111
		  __entry->result_group, __entry->result_start,
1112
		  __entry->result_len)
1113 1114
);

1115 1116
DEFINE_EVENT(ext4__mballoc, ext4_mballoc_discard,

1117 1118 1119 1120 1121
	TP_PROTO(struct super_block *sb,
		 struct inode *inode,
		 ext4_group_t group,
		 ext4_grpblk_t start,
		 ext4_grpblk_t len),
1122

1123
	TP_ARGS(sb, inode, group, start, len)
1124
);
1125

1126
DEFINE_EVENT(ext4__mballoc, ext4_mballoc_free,
1127

1128 1129 1130 1131 1132
	TP_PROTO(struct super_block *sb,
		 struct inode *inode,
		 ext4_group_t group,
		 ext4_grpblk_t start,
		 ext4_grpblk_t len),
1133

1134
	TP_ARGS(sb, inode, group, start, len)
1135 1136
);

1137 1138 1139 1140 1141 1142
TRACE_EVENT(ext4_forget,
	TP_PROTO(struct inode *inode, int is_metadata, __u64 block),

	TP_ARGS(inode, is_metadata, block),

	TP_STRUCT__entry(
1143
		__field(	dev_t,	dev			)
1144 1145
		__field(	ino_t,	ino			)
		__field(	__u64,	block			)
1146 1147
		__field(	int,	is_metadata		)
		__field(	__u16,	mode			)
1148 1149 1150
	),

	TP_fast_assign(
1151
		__entry->dev	= inode->i_sb->s_dev;
1152 1153
		__entry->ino	= inode->i_ino;
		__entry->block	= block;
1154 1155
		__entry->is_metadata = is_metadata;
		__entry->mode	= inode->i_mode;
1156 1157
	),

1158
	TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu",
1159 1160 1161
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->mode, __entry->is_metadata, __entry->block)
1162 1163
);

1164
TRACE_EVENT(ext4_da_update_reserve_space,
1165
	TP_PROTO(struct inode *inode, int used_blocks, int quota_claim),
1166

1167
	TP_ARGS(inode, used_blocks, quota_claim),
1168 1169

	TP_STRUCT__entry(
1170
		__field(	dev_t,	dev			)
1171 1172 1173 1174
		__field(	ino_t,	ino			)
		__field(	__u64,	i_blocks		)
		__field(	int,	used_blocks		)
		__field(	int,	reserved_data_blocks	)
1175
		__field(	int,	quota_claim		)
1176
		__field(	__u16,	mode			)
1177 1178 1179
	),

	TP_fast_assign(
1180
		__entry->dev	= inode->i_sb->s_dev;
1181 1182 1183
		__entry->ino	= inode->i_ino;
		__entry->i_blocks = inode->i_blocks;
		__entry->used_blocks = used_blocks;
1184 1185 1186
		__entry->reserved_data_blocks =
				EXT4_I(inode)->i_reserved_data_blocks;
		__entry->quota_claim = quota_claim;
1187
		__entry->mode	= inode->i_mode;
1188 1189
	),

1190
	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d "
1191
		  "reserved_data_blocks %d quota_claim %d",
1192 1193
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1194
		  __entry->mode, __entry->i_blocks,
1195
		  __entry->used_blocks, __entry->reserved_data_blocks,
1196
		  __entry->quota_claim)
1197 1198 1199
);

TRACE_EVENT(ext4_da_reserve_space,
1200
	TP_PROTO(struct inode *inode),
1201

1202
	TP_ARGS(inode),
1203 1204

	TP_STRUCT__entry(
1205
		__field(	dev_t,	dev			)
1206 1207 1208
		__field(	ino_t,	ino			)
		__field(	__u64,	i_blocks		)
		__field(	int,	reserved_data_blocks	)
1209
		__field(	__u16,  mode			)
1210 1211 1212
	),

	TP_fast_assign(
1213
		__entry->dev	= inode->i_sb->s_dev;
1214 1215 1216
		__entry->ino	= inode->i_ino;
		__entry->i_blocks = inode->i_blocks;
		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
1217
		__entry->mode	= inode->i_mode;
1218 1219
	),

1220
	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu "
1221
		  "reserved_data_blocks %d",
1222
		  MAJOR(__entry->dev), MINOR(__entry->dev),
1223
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1224
		  __entry->mode, __entry->i_blocks,
1225
		  __entry->reserved_data_blocks)
1226 1227 1228 1229 1230 1231 1232 1233
);

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

	TP_ARGS(inode, freed_blocks),

	TP_STRUCT__entry(
1234
		__field(	dev_t,	dev			)
1235 1236 1237 1238
		__field(	ino_t,	ino			)
		__field(	__u64,	i_blocks		)
		__field(	int,	freed_blocks		)
		__field(	int,	reserved_data_blocks	)
1239
		__field(	__u16,  mode			)
1240 1241 1242
	),

	TP_fast_assign(
1243
		__entry->dev	= inode->i_sb->s_dev;
1244 1245 1246 1247
		__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;
1248
		__entry->mode	= inode->i_mode;
1249 1250
	),

1251
	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu freed_blocks %d "
1252
		  "reserved_data_blocks %d",
1253
		  MAJOR(__entry->dev), MINOR(__entry->dev),
1254
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1255
		  __entry->mode, __entry->i_blocks,
1256
		  __entry->freed_blocks, __entry->reserved_data_blocks)
1257 1258
);

1259 1260 1261 1262 1263 1264
DECLARE_EVENT_CLASS(ext4__bitmap_load,
	TP_PROTO(struct super_block *sb, unsigned long group),

	TP_ARGS(sb, group),

	TP_STRUCT__entry(
1265
		__field(	dev_t,	dev			)
1266 1267 1268 1269 1270
		__field(	__u32,	group			)

	),

	TP_fast_assign(
1271
		__entry->dev	= sb->s_dev;
1272 1273 1274
		__entry->group	= group;
	),

1275
	TP_printk("dev %d,%d group %u",
1276 1277
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->group)
1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292
);

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)
);
1293

1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314
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			)
1315
		__field(	ino_t,	ino			)
1316 1317 1318 1319 1320 1321 1322
		__field(	loff_t,	pos			)
		__field(	unsigned long,	len		)
		__field(	int,	rw			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1323
		__entry->ino	= inode->i_ino;
1324 1325 1326 1327 1328
		__entry->pos	= offset;
		__entry->len	= len;
		__entry->rw	= rw;
	),

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

TRACE_EVENT(ext4_direct_IO_exit,
L
Lukas Czerner 已提交
1336 1337
	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
		 int rw, int ret),
1338 1339 1340 1341 1342

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

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
1343
		__field(	ino_t,	ino			)
1344 1345 1346 1347 1348 1349 1350 1351
		__field(	loff_t,	pos			)
		__field(	unsigned long,	len		)
		__field(	int,	rw			)
		__field(	int,	ret			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1352
		__entry->ino	= inode->i_ino;
1353 1354 1355 1356 1357 1358
		__entry->pos	= offset;
		__entry->len	= len;
		__entry->rw	= rw;
		__entry->ret	= ret;
	),

L
Lukas Czerner 已提交
1359
	TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d ret %d",
1360 1361
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1362
		  __entry->pos, __entry->len,
1363 1364 1365
		  __entry->rw, __entry->ret)
);

1366
DECLARE_EVENT_CLASS(ext4__fallocate_mode,
1367 1368 1369 1370 1371 1372
	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			)
1373
		__field(	ino_t,	ino			)
1374 1375
		__field(	loff_t,	offset			)
		__field(	loff_t, len			)
1376 1377 1378 1379 1380
		__field(	int,	mode			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1381
		__entry->ino	= inode->i_ino;
1382
		__entry->offset	= offset;
1383 1384 1385 1386
		__entry->len	= len;
		__entry->mode	= mode;
	),

1387
	TP_printk("dev %d,%d ino %lu offset %lld len %lld mode %s",
1388
		  MAJOR(__entry->dev), MINOR(__entry->dev),
1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412
		  (unsigned long) __entry->ino,
		  __entry->offset, __entry->len,
		  show_falloc_mode(__entry->mode))
);

DEFINE_EVENT(ext4__fallocate_mode, ext4_fallocate_enter,

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

	TP_ARGS(inode, offset, len, mode)
);

DEFINE_EVENT(ext4__fallocate_mode, ext4_punch_hole,

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

	TP_ARGS(inode, offset, len, mode)
);

DEFINE_EVENT(ext4__fallocate_mode, ext4_zero_range,

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

	TP_ARGS(inode, offset, len, mode)
1413 1414 1415
);

TRACE_EVENT(ext4_fallocate_exit,
L
Lukas Czerner 已提交
1416 1417
	TP_PROTO(struct inode *inode, loff_t offset,
		 unsigned int max_blocks, int ret),
1418 1419 1420 1421 1422

	TP_ARGS(inode, offset, max_blocks, ret),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
1423
		__field(	ino_t,	ino			)
1424
		__field(	loff_t,	pos			)
L
Lukas Czerner 已提交
1425
		__field(	unsigned int,	blocks		)
1426 1427 1428 1429 1430
		__field(	int, 	ret			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1431
		__entry->ino	= inode->i_ino;
1432 1433 1434 1435 1436
		__entry->pos	= offset;
		__entry->blocks	= max_blocks;
		__entry->ret	= ret;
	),

L
Lukas Czerner 已提交
1437
	TP_printk("dev %d,%d ino %lu pos %lld blocks %u ret %d",
1438 1439
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1440
		  __entry->pos, __entry->blocks,
1441 1442 1443 1444 1445 1446 1447 1448 1449
		  __entry->ret)
);

TRACE_EVENT(ext4_unlink_enter,
	TP_PROTO(struct inode *parent, struct dentry *dentry),

	TP_ARGS(parent, dentry),

	TP_STRUCT__entry(
1450
		__field(	dev_t,	dev			)
1451
		__field(	ino_t,	ino			)
1452
		__field(	ino_t,	parent			)
1453 1454 1455 1456
		__field(	loff_t,	size			)
	),

	TP_fast_assign(
1457
		__entry->dev		= dentry->d_sb->s_dev;
1458
		__entry->ino		= d_inode(dentry)->i_ino;
1459
		__entry->parent		= parent->i_ino;
1460
		__entry->size		= d_inode(dentry)->i_size;
1461 1462
	),

L
Lukas Czerner 已提交
1463
	TP_printk("dev %d,%d ino %lu size %lld parent %lu",
1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475
		  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			)
1476
		__field(	ino_t,	ino			)
1477 1478 1479 1480
		__field(	int,	ret			)
	),

	TP_fast_assign(
1481
		__entry->dev		= dentry->d_sb->s_dev;
1482
		__entry->ino		= d_inode(dentry)->i_ino;
1483 1484 1485
		__entry->ret		= ret;
	),

L
Lukas Czerner 已提交
1486
	TP_printk("dev %d,%d ino %lu ret %d",
1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497
		  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(
1498 1499
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
L
Lukas Czerner 已提交
1500
		__field(	__u64,		blocks		)
1501 1502 1503 1504
	),

	TP_fast_assign(
		__entry->dev    = inode->i_sb->s_dev;
1505
		__entry->ino    = inode->i_ino;
1506 1507 1508
		__entry->blocks	= inode->i_blocks;
	),

L
Lukas Czerner 已提交
1509
	TP_printk("dev %d,%d ino %lu blocks %llu",
1510
		  MAJOR(__entry->dev), MINOR(__entry->dev),
L
Lukas Czerner 已提交
1511
		  (unsigned long) __entry->ino, __entry->blocks)
1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527
);

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)
);

1528
/* 'ux' is the unwritten extent. */
1529 1530 1531 1532 1533 1534 1535 1536
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	)
1537
		__field(	ino_t,		ino	)
1538 1539 1540 1541 1542 1543 1544 1545 1546
		__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;
1547
		__entry->ino		= inode->i_ino;
1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563
		__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)
);

/*
1564
 * 'ux' is the unwritten extent.
1565 1566 1567 1568 1569 1570 1571 1572 1573 1574
 * '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	)
1575
		__field(	ino_t,		ino	)
1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587
		__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;
1588
		__entry->ino		= inode->i_ino;
1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608
		__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)
);

1609 1610
DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
L
Lukas Czerner 已提交
1611
		 unsigned int len, unsigned int flags),
1612 1613 1614 1615

	TP_ARGS(inode, lblk, len, flags),

	TP_STRUCT__entry(
1616 1617
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
1618
		__field(	ext4_lblk_t,	lblk		)
L
Lukas Czerner 已提交
1619 1620
		__field(	unsigned int,	len		)
		__field(	unsigned int,	flags		)
1621 1622 1623 1624
	),

	TP_fast_assign(
		__entry->dev    = inode->i_sb->s_dev;
1625
		__entry->ino    = inode->i_ino;
1626 1627 1628 1629 1630
		__entry->lblk	= lblk;
		__entry->len	= len;
		__entry->flags	= flags;
	),

1631
	TP_printk("dev %d,%d ino %lu lblk %u len %u flags %s",
1632 1633
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
1634
		  __entry->lblk, __entry->len, show_map_flags(__entry->flags))
1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651
);

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,
1652 1653
	TP_PROTO(struct inode *inode, unsigned flags, struct ext4_map_blocks *map,
		 int ret),
1654

1655
	TP_ARGS(inode, flags, map, ret),
1656 1657 1658

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
1659
		__field(	ino_t,		ino		)
1660
		__field(	unsigned int,	flags		)
1661
		__field(	ext4_fsblk_t,	pblk		)
1662
		__field(	ext4_lblk_t,	lblk		)
L
Lukas Czerner 已提交
1663
		__field(	unsigned int,	len		)
1664
		__field(	unsigned int,	mflags		)
1665 1666 1667 1668 1669
		__field(	int,		ret		)
	),

	TP_fast_assign(
		__entry->dev    = inode->i_sb->s_dev;
1670
		__entry->ino    = inode->i_ino;
1671
		__entry->flags	= flags;
1672 1673 1674
		__entry->pblk	= map->m_pblk;
		__entry->lblk	= map->m_lblk;
		__entry->len	= map->m_len;
1675
		__entry->mflags	= map->m_flags;
1676 1677 1678
		__entry->ret	= ret;
	),

1679 1680
	TP_printk("dev %d,%d ino %lu flags %s lblk %u pblk %llu len %u "
		  "mflags %s ret %d",
1681 1682
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
1683 1684
		  show_map_flags(__entry->flags), __entry->lblk, __entry->pblk,
		  __entry->len, show_mflags(__entry->mflags), __entry->ret)
1685 1686 1687
);

DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1688 1689
	TP_PROTO(struct inode *inode, unsigned flags,
		 struct ext4_map_blocks *map, int ret),
1690

1691
	TP_ARGS(inode, flags, map, ret)
1692 1693 1694
);

DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1695 1696
	TP_PROTO(struct inode *inode, unsigned flags,
		 struct ext4_map_blocks *map, int ret),
1697

1698
	TP_ARGS(inode, flags, map, ret)
1699 1700 1701 1702 1703 1704 1705 1706 1707
);

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		)
1708
		__field(	ino_t,		ino		)
1709
		__field(	ext4_fsblk_t,	pblk		)
1710
		__field(	ext4_lblk_t,	lblk		)
1711 1712 1713 1714
	),

	TP_fast_assign(
		__entry->dev    = inode->i_sb->s_dev;
1715
		__entry->ino    = inode->i_ino;
1716
		__entry->pblk	= pblk;
1717
		__entry->lblk	= lblk;
1718 1719 1720 1721 1722
	),

	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1723
		  __entry->lblk, __entry->pblk)
1724 1725 1726 1727 1728 1729 1730 1731 1732
);

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

	TP_ARGS(inode),

	TP_STRUCT__entry(
		__field(	dev_t,	dev		)
1733
		__field(	ino_t,	ino		)
1734 1735 1736 1737
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
1738
		__entry->ino		= inode->i_ino;
1739 1740 1741 1742 1743 1744 1745
	),

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

1746
TRACE_EVENT(ext4_journal_start,
1747 1748
	TP_PROTO(struct super_block *sb, int blocks, int rsv_blocks,
		 unsigned long IP),
1749

1750
	TP_ARGS(sb, blocks, rsv_blocks, IP),
1751 1752 1753 1754

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
		__field(unsigned long,	ip			)
1755 1756
		__field(	  int,	blocks			)
		__field(	  int,	rsv_blocks		)
1757 1758 1759
	),

	TP_fast_assign(
1760 1761 1762 1763
		__entry->dev		 = sb->s_dev;
		__entry->ip		 = IP;
		__entry->blocks		 = blocks;
		__entry->rsv_blocks	 = rsv_blocks;
1764 1765
	),

1766
	TP_printk("dev %d,%d blocks, %d rsv_blocks, %d caller %pS",
1767
		  MAJOR(__entry->dev), MINOR(__entry->dev),
1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787
		  __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;
	),

1788
	TP_printk("dev %d,%d blocks, %d caller %pS",
1789 1790
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->blocks, (void *)__entry->ip)
1791 1792
);

T
Tao Ma 已提交
1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841
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)
);

1842
TRACE_EVENT(ext4_ext_handle_unwritten_extents,
1843
	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1844 1845
		 unsigned int allocated, ext4_fsblk_t newblock),

1846
	TP_ARGS(inode, map, flags, allocated, newblock),
1847 1848 1849

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
1850 1851
		__field(	ino_t,		ino		)
		__field(	int,		flags		)
1852 1853 1854 1855 1856 1857 1858 1859 1860
		__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;
1861
		__entry->ino		= inode->i_ino;
1862
		__entry->flags		= flags;
1863 1864 1865 1866 1867 1868 1869
		__entry->lblk		= map->m_lblk;
		__entry->pblk		= map->m_pblk;
		__entry->len		= map->m_len;
		__entry->allocated	= allocated;
		__entry->newblk		= newblock;
	),

1870
	TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %s "
1871 1872 1873 1874
		  "allocated %d newblock %llu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->lblk, (unsigned long long) __entry->pblk,
1875
		  __entry->len, show_map_flags(__entry->flags),
1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886
		  (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	)
1887
		__field(	unsigned int,	flags	)
1888 1889 1890 1891 1892 1893 1894 1895
		__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;
1896
		__entry->flags	= map->m_flags;
1897 1898 1899 1900 1901 1902
		__entry->lblk	= map->m_lblk;
		__entry->pblk	= map->m_pblk;
		__entry->len	= map->m_len;
		__entry->ret	= ret;
	),

1903
	TP_printk("dev %d,%d m_lblk %u m_pblk %llu m_len %u m_flags %s ret %d",
1904 1905
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->lblk, (unsigned long long) __entry->pblk,
1906
		  __entry->len, show_mflags(__entry->flags), __entry->ret)
1907 1908 1909 1910 1911 1912 1913 1914 1915 1916
);

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	)
1917
		__field(	ino_t,		ino	)
1918 1919 1920 1921 1922 1923 1924
		__field(	ext4_lblk_t,	lblk	)
		__field(	unsigned int,	len	)
		__field(	ext4_fsblk_t,	start	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1925
		__entry->ino	= inode->i_ino;
1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945
		__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	)
1946
		__field(	ino_t,		ino	)
1947 1948 1949 1950 1951 1952
		__field(	ext4_lblk_t,	lblk	)
		__field(	int,		ret	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1953
		__entry->ino	= inode->i_ino;
1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973
		__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		)
1974
		__field(	ino_t,		ino		)
1975 1976 1977 1978 1979 1980 1981 1982 1983
		__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;
1984
		__entry->ino		= inode->i_ino;
1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007
		__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	)
2008
		__field(	ino_t,		ino	)
2009 2010 2011 2012 2013 2014
		__field(	ext4_lblk_t,	lblk	)
		__field(	unsigned int,	len	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
2015
		__entry->ino	= inode->i_ino;
2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034
		__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	)
2035
		__field(	ino_t,		ino	)
2036
		__field(	ext4_fsblk_t,	pblk	)
2037
		__field(	ext4_lblk_t,	lblk	)
2038 2039 2040 2041 2042
		__field(	unsigned short,	len	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
2043
		__entry->ino	= inode->i_ino;
2044
		__entry->pblk	= pblk;
2045
		__entry->lblk	= lblk;
2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059
		__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,
2060
		long long partial_cluster),
2061 2062 2063 2064 2065

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

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
2066
		__field(	ino_t,		ino	)
2067 2068
		__field(	ext4_lblk_t,	from	)
		__field(	ext4_lblk_t,	to	)
2069
		__field(	long long,	partial	)
2070 2071 2072
		__field(	ext4_fsblk_t,	ee_pblk	)
		__field(	ext4_lblk_t,	ee_lblk	)
		__field(	unsigned short,	ee_len	)
2073 2074 2075 2076
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
2077
		__entry->ino		= inode->i_ino;
2078 2079 2080
		__entry->from		= from;
		__entry->to		= to;
		__entry->partial	= partial_cluster;
2081
		__entry->ee_pblk	= ext4_ext_pblock(ex);
2082
		__entry->ee_lblk	= le32_to_cpu(ex->ee_block);
2083
		__entry->ee_len		= ext4_ext_get_actual_len(ex);
2084 2085 2086
	),

	TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]"
2087
		  "from %u to %u partial_cluster %lld",
2088 2089 2090 2091 2092 2093 2094
		  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,
2095
		  (long long) __entry->partial)
2096 2097 2098 2099
);

TRACE_EVENT(ext4_ext_rm_leaf,
	TP_PROTO(struct inode *inode, ext4_lblk_t start,
2100 2101
		 struct ext4_extent *ex,
		 long long partial_cluster),
2102 2103 2104 2105 2106

	TP_ARGS(inode, start, ex, partial_cluster),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
2107
		__field(	ino_t,		ino	)
2108
		__field(	long long,	partial	)
2109 2110 2111 2112 2113 2114 2115 2116
		__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;
2117 2118
		__entry->ino		= inode->i_ino;
		__entry->partial	= partial_cluster;
2119 2120 2121 2122 2123 2124 2125
		__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]"
2126
		  "partial_cluster %lld",
2127 2128 2129 2130 2131 2132
		  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,
2133
		  (long long) __entry->partial)
2134 2135 2136 2137 2138 2139 2140 2141 2142
);

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	)
2143
		__field(	ino_t,		ino	)
2144 2145 2146 2147 2148
		__field(	ext4_fsblk_t,	pblk	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
2149
		__entry->ino	= inode->i_ino;
2150 2151 2152 2153 2154 2155 2156 2157 2158 2159
		__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,
2160 2161
	TP_PROTO(struct inode *inode, ext4_lblk_t start,
		 ext4_lblk_t end, int depth),
2162

2163
	TP_ARGS(inode, start, end, depth),
2164 2165 2166

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
2167
		__field(	ino_t,		ino	)
2168
		__field(	ext4_lblk_t,	start	)
2169
		__field(	ext4_lblk_t,	end	)
2170 2171 2172 2173 2174
		__field(	int,		depth	)
	),

	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 2180
		__entry->depth	= depth;
	),

2181
	TP_printk("dev %d,%d ino %lu since %u end %u depth %d",
2182 2183 2184
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->start,
2185
		  (unsigned) __entry->end,
2186 2187 2188 2189
		  __entry->depth)
);

TRACE_EVENT(ext4_ext_remove_space_done,
2190
	TP_PROTO(struct inode *inode, ext4_lblk_t start, ext4_lblk_t end,
2191
		 int depth, long long partial, __le16 eh_entries),
2192

2193
	TP_ARGS(inode, start, end, depth, partial, eh_entries),
2194 2195 2196

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
2197
		__field(	ino_t,		ino		)
2198
		__field(	ext4_lblk_t,	start		)
2199
		__field(	ext4_lblk_t,	end		)
2200
		__field(	int,		depth		)
2201
		__field(	long long,	partial		)
2202 2203 2204 2205 2206
		__field(	unsigned short,	eh_entries	)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
2207
		__entry->ino		= inode->i_ino;
2208
		__entry->start		= start;
2209
		__entry->end		= end;
2210 2211
		__entry->depth		= depth;
		__entry->partial	= partial;
2212
		__entry->eh_entries	= le16_to_cpu(eh_entries);
2213 2214
	),

2215
	TP_printk("dev %d,%d ino %lu since %u end %u depth %d partial %lld "
2216 2217 2218 2219
		  "remaining_entries %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->start,
2220
		  (unsigned) __entry->end,
2221
		  __entry->depth,
2222
		  (long long) __entry->partial,
2223 2224 2225
		  (unsigned short) __entry->eh_entries)
);

2226
DECLARE_EVENT_CLASS(ext4__es_extent,
2227
	TP_PROTO(struct inode *inode, struct extent_status *es),
2228

2229
	TP_ARGS(inode, es),
2230 2231

	TP_STRUCT__entry(
2232 2233 2234 2235 2236
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
		__field(	ext4_lblk_t,	lblk		)
		__field(	ext4_lblk_t,	len		)
		__field(	ext4_fsblk_t,	pblk		)
2237
		__field(	char, status	)
2238 2239 2240 2241 2242
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
2243 2244 2245
		__entry->lblk	= es->es_lblk;
		__entry->len	= es->es_len;
		__entry->pblk	= ext4_es_pblock(es);
2246
		__entry->status	= ext4_es_status(es);
2247 2248
	),

2249
	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2250 2251
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
2252
		  __entry->lblk, __entry->len,
2253
		  __entry->pblk, show_extent_status(__entry->status))
2254 2255
);

2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267
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)
);

2268
TRACE_EVENT(ext4_es_remove_extent,
Z
Zheng Liu 已提交
2269
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk, ext4_lblk_t len),
2270

Z
Zheng Liu 已提交
2271
	TP_ARGS(inode, lblk, len),
2272 2273 2274 2275

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
		__field(	ino_t,	ino			)
Z
Zheng Liu 已提交
2276
		__field(	loff_t,	lblk			)
2277 2278 2279 2280 2281 2282
		__field(	loff_t,	len			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
Z
Zheng Liu 已提交
2283
		__entry->lblk	= lblk;
2284 2285 2286 2287 2288 2289
		__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 已提交
2290
		  __entry->lblk, __entry->len)
2291 2292
);

2293
TRACE_EVENT(ext4_es_find_extent_range_enter,
Z
Zheng Liu 已提交
2294
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk),
2295

Z
Zheng Liu 已提交
2296
	TP_ARGS(inode, lblk),
2297 2298 2299 2300

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
Z
Zheng Liu 已提交
2301
		__field(	ext4_lblk_t,	lblk		)
2302 2303 2304 2305 2306
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
Z
Zheng Liu 已提交
2307
		__entry->lblk	= lblk;
2308 2309
	),

Z
Zheng Liu 已提交
2310
	TP_printk("dev %d,%d ino %lu lblk %u",
2311
		  MAJOR(__entry->dev), MINOR(__entry->dev),
Z
Zheng Liu 已提交
2312
		  (unsigned long) __entry->ino, __entry->lblk)
2313 2314
);

2315
TRACE_EVENT(ext4_es_find_extent_range_exit,
2316
	TP_PROTO(struct inode *inode, struct extent_status *es),
2317

2318
	TP_ARGS(inode, es),
2319 2320 2321 2322

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
Z
Zheng Liu 已提交
2323
		__field(	ext4_lblk_t,	lblk		)
2324
		__field(	ext4_lblk_t,	len		)
2325
		__field(	ext4_fsblk_t,	pblk		)
2326
		__field(	char, status	)
2327 2328 2329 2330 2331
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
		__entry->ino	= inode->i_ino;
Z
Zheng Liu 已提交
2332 2333
		__entry->lblk	= es->es_lblk;
		__entry->len	= es->es_len;
2334
		__entry->pblk	= ext4_es_pblock(es);
2335
		__entry->status	= ext4_es_status(es);
2336 2337
	),

2338
	TP_printk("dev %d,%d ino %lu es [%u/%u) mapped %llu status %s",
2339 2340
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
2341
		  __entry->lblk, __entry->len,
2342
		  __entry->pblk, show_extent_status(__entry->status))
2343 2344
);

2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378
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		)
2379
		__field(	char,		status		)
2380 2381 2382 2383 2384 2385 2386 2387 2388
		__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);
2389
		__entry->status	= ext4_es_status(es);
2390 2391 2392
		__entry->found	= found;
	),

2393
	TP_printk("dev %d,%d ino %lu found %d [%u/%u) %llu %s",
2394 2395 2396 2397
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino, __entry->found,
		  __entry->lblk, __entry->len,
		  __entry->found ? __entry->pblk : 0,
2398
		  show_extent_status(__entry->found ? __entry->status : 0))
2399 2400
);

2401
DECLARE_EVENT_CLASS(ext4__es_shrink_enter,
T
Theodore Ts'o 已提交
2402
	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),
2403

T
Theodore Ts'o 已提交
2404
	TP_ARGS(sb, nr_to_scan, cache_cnt),
2405 2406 2407 2408

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
		__field(	int,	nr_to_scan		)
T
Theodore Ts'o 已提交
2409
		__field(	int,	cache_cnt		)
2410 2411 2412 2413 2414
	),

	TP_fast_assign(
		__entry->dev		= sb->s_dev;
		__entry->nr_to_scan	= nr_to_scan;
T
Theodore Ts'o 已提交
2415
		__entry->cache_cnt	= cache_cnt;
2416 2417
	),

T
Theodore Ts'o 已提交
2418
	TP_printk("dev %d,%d nr_to_scan %d cache_cnt %d",
2419
		  MAJOR(__entry->dev), MINOR(__entry->dev),
T
Theodore Ts'o 已提交
2420
		  __entry->nr_to_scan, __entry->cache_cnt)
2421 2422
);

2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436
DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_count,
	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),

	TP_ARGS(sb, nr_to_scan, cache_cnt)
);

DEFINE_EVENT(ext4__es_shrink_enter, ext4_es_shrink_scan_enter,
	TP_PROTO(struct super_block *sb, int nr_to_scan, int cache_cnt),

	TP_ARGS(sb, nr_to_scan, cache_cnt)
);

TRACE_EVENT(ext4_es_shrink_scan_exit,
	TP_PROTO(struct super_block *sb, int nr_shrunk, int cache_cnt),
2437

2438
	TP_ARGS(sb, nr_shrunk, cache_cnt),
2439 2440 2441

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
2442
		__field(	int,	nr_shrunk		)
T
Theodore Ts'o 已提交
2443
		__field(	int,	cache_cnt		)
2444 2445 2446 2447
	),

	TP_fast_assign(
		__entry->dev		= sb->s_dev;
2448
		__entry->nr_shrunk	= nr_shrunk;
T
Theodore Ts'o 已提交
2449
		__entry->cache_cnt	= cache_cnt;
2450 2451
	),

2452
	TP_printk("dev %d,%d nr_shrunk %d cache_cnt %d",
2453
		  MAJOR(__entry->dev), MINOR(__entry->dev),
2454
		  __entry->nr_shrunk, __entry->cache_cnt)
2455 2456
);

2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475
TRACE_EVENT(ext4_collapse_range,
	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;
	),

2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500
	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)
);

TRACE_EVENT(ext4_insert_range,
	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;
	),

2501 2502 2503 2504 2505 2506
	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)
);

2507 2508
TRACE_EVENT(ext4_es_shrink,
	TP_PROTO(struct super_block *sb, int nr_shrunk, u64 scan_time,
2509
		 int nr_skipped, int retried),
2510

2511
	TP_ARGS(sb, nr_shrunk, scan_time, nr_skipped, retried),
2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
		__field(	int,		nr_shrunk	)
		__field(	unsigned long long, scan_time	)
		__field(	int,		nr_skipped	)
		__field(	int,		retried		)
	),

	TP_fast_assign(
		__entry->dev		= sb->s_dev;
		__entry->nr_shrunk	= nr_shrunk;
		__entry->scan_time	= div_u64(scan_time, 1000);
		__entry->nr_skipped	= nr_skipped;
		__entry->retried	= retried;
	),

2529
	TP_printk("dev %d,%d nr_shrunk %d, scan_time %llu "
2530 2531
		  "nr_skipped %d retried %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->nr_shrunk,
2532
		  __entry->scan_time, __entry->nr_skipped, __entry->retried)
2533 2534
);

D
Darrick J. Wong 已提交
2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607
/* fsmap traces */
DECLARE_EVENT_CLASS(ext4_fsmap_class,
	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len,
		 u64 owner),
	TP_ARGS(sb, keydev, agno, bno, len, owner),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(dev_t, keydev)
		__field(u32, agno)
		__field(u64, bno)
		__field(u64, len)
		__field(u64, owner)
	),
	TP_fast_assign(
		__entry->dev = sb->s_bdev->bd_dev;
		__entry->keydev = new_decode_dev(keydev);
		__entry->agno = agno;
		__entry->bno = bno;
		__entry->len = len;
		__entry->owner = owner;
	),
	TP_printk("dev %d:%d keydev %d:%d agno %u bno %llu len %llu owner %lld\n",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
		  __entry->agno,
		  __entry->bno,
		  __entry->len,
		  __entry->owner)
)
#define DEFINE_FSMAP_EVENT(name) \
DEFINE_EVENT(ext4_fsmap_class, name, \
	TP_PROTO(struct super_block *sb, u32 keydev, u32 agno, u64 bno, u64 len, \
		 u64 owner), \
	TP_ARGS(sb, keydev, agno, bno, len, owner))
DEFINE_FSMAP_EVENT(ext4_fsmap_low_key);
DEFINE_FSMAP_EVENT(ext4_fsmap_high_key);
DEFINE_FSMAP_EVENT(ext4_fsmap_mapping);

DECLARE_EVENT_CLASS(ext4_getfsmap_class,
	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap),
	TP_ARGS(sb, fsmap),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(dev_t, keydev)
		__field(u64, block)
		__field(u64, len)
		__field(u64, owner)
		__field(u64, flags)
	),
	TP_fast_assign(
		__entry->dev = sb->s_bdev->bd_dev;
		__entry->keydev = new_decode_dev(fsmap->fmr_device);
		__entry->block = fsmap->fmr_physical;
		__entry->len = fsmap->fmr_length;
		__entry->owner = fsmap->fmr_owner;
		__entry->flags = fsmap->fmr_flags;
	),
	TP_printk("dev %d:%d keydev %d:%d block %llu len %llu owner %lld flags 0x%llx\n",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
		  __entry->block,
		  __entry->len,
		  __entry->owner,
		  __entry->flags)
)
#define DEFINE_GETFSMAP_EVENT(name) \
DEFINE_EVENT(ext4_getfsmap_class, name, \
	TP_PROTO(struct super_block *sb, struct ext4_fsmap *fsmap), \
	TP_ARGS(sb, fsmap))
DEFINE_GETFSMAP_EVENT(ext4_getfsmap_low_key);
DEFINE_GETFSMAP_EVENT(ext4_getfsmap_high_key);
DEFINE_GETFSMAP_EVENT(ext4_getfsmap_mapping);

2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650
TRACE_EVENT(ext4_shutdown,
	TP_PROTO(struct super_block *sb, unsigned long flags),

	TP_ARGS(sb, flags),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
		__field(     unsigned,	flags			)
	),

	TP_fast_assign(
		__entry->dev	= sb->s_dev;
		__entry->flags	= flags;
	),

	TP_printk("dev %d,%d flags %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->flags)
);

TRACE_EVENT(ext4_error,
	TP_PROTO(struct super_block *sb, const char *function,
		 unsigned int line),

	TP_ARGS(sb, function, line),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
		__field( const char *,	function		)
		__field(     unsigned,	line			)
	),

	TP_fast_assign(
		__entry->dev	= sb->s_dev;
		__entry->function = function;
		__entry->line	= line;
	),

	TP_printk("dev %d,%d function %s line %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->function, __entry->line)
);

2651 2652 2653 2654
#endif /* _TRACE_EXT4_H */

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