ext4.h 38.4 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 12
struct ext4_allocation_context;
struct ext4_allocation_request;
struct ext4_prealloc_space;
13
struct ext4_inode_info;
14
struct mpage_da_data;
15 16

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

18 19 20 21 22 23
TRACE_EVENT(ext4_free_inode,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
24
		__field(	dev_t,	dev			)
25
		__field(	ino_t,	ino			)
26
		__field(	__u16, mode			)
27 28
		__field(	uid_t,	uid			)
		__field(	gid_t,	gid			)
L
Lukas Czerner 已提交
29
		__field(	__u64, blocks			)
30 31 32
	),

	TP_fast_assign(
33
		__entry->dev	= inode->i_sb->s_dev;
34 35 36 37 38 39 40
		__entry->ino	= inode->i_ino;
		__entry->mode	= inode->i_mode;
		__entry->uid	= inode->i_uid;
		__entry->gid	= inode->i_gid;
		__entry->blocks	= inode->i_blocks;
	),

41
	TP_printk("dev %d,%d ino %lu mode 0%o uid %u gid %u blocks %llu",
42
		  MAJOR(__entry->dev), MINOR(__entry->dev),
L
Lukas Czerner 已提交
43 44
		  (unsigned long) __entry->ino, __entry->mode,
		  __entry->uid, __entry->gid, __entry->blocks)
45 46 47 48 49 50 51 52
);

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

	TP_ARGS(dir, mode),

	TP_STRUCT__entry(
53
		__field(	dev_t,	dev			)
54
		__field(	ino_t,	dir			)
55
		__field(	__u16, mode			)
56 57 58
	),

	TP_fast_assign(
59
		__entry->dev	= dir->i_sb->s_dev;
60 61 62 63
		__entry->dir	= dir->i_ino;
		__entry->mode	= mode;
	),

64
	TP_printk("dev %d,%d dir %lu mode 0%o",
65
		  MAJOR(__entry->dev), MINOR(__entry->dev),
66
		  (unsigned long) __entry->dir, __entry->mode)
67 68 69 70 71 72 73 74
);

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

	TP_ARGS(inode, dir, mode),

	TP_STRUCT__entry(
75
		__field(	dev_t,	dev			)
76 77
		__field(	ino_t,	ino			)
		__field(	ino_t,	dir			)
78
		__field(	__u16,	mode			)
79 80 81
	),

	TP_fast_assign(
82
		__entry->dev	= inode->i_sb->s_dev;
83 84 85 86 87
		__entry->ino	= inode->i_ino;
		__entry->dir	= dir->i_ino;
		__entry->mode	= mode;
	),

88
	TP_printk("dev %d,%d ino %lu dir %lu mode 0%o",
89
		  MAJOR(__entry->dev), MINOR(__entry->dev),
90
		  (unsigned long) __entry->ino,
91
		  (unsigned long) __entry->dir, __entry->mode)
92 93
);

94 95 96 97 98 99
TRACE_EVENT(ext4_evict_inode,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
100
		__field(	dev_t,	dev			)
101 102 103 104 105
		__field(	ino_t,	ino			)
		__field(	int,	nlink			)
	),

	TP_fast_assign(
106
		__entry->dev	= inode->i_sb->s_dev;
107 108 109 110 111
		__entry->ino	= inode->i_ino;
		__entry->nlink	= inode->i_nlink;
	),

	TP_printk("dev %d,%d ino %lu nlink %d",
112
		  MAJOR(__entry->dev), MINOR(__entry->dev),
113 114 115 116 117 118 119 120 121
		  (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(
122
		__field(	dev_t,	dev			)
123 124 125 126 127
		__field(	ino_t,	ino			)
		__field(	int,	drop			)
	),

	TP_fast_assign(
128
		__entry->dev	= inode->i_sb->s_dev;
129 130 131 132 133
		__entry->ino	= inode->i_ino;
		__entry->drop	= drop;
	),

	TP_printk("dev %d,%d ino %lu drop %d",
134
		  MAJOR(__entry->dev), MINOR(__entry->dev),
135 136 137 138 139 140 141 142 143
		  (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(
144
		__field(	dev_t,	dev			)
145 146 147 148 149
		__field(	ino_t,	ino			)
		__field(unsigned long,	ip			)
	),

	TP_fast_assign(
150
		__entry->dev	= inode->i_sb->s_dev;
151 152 153 154 155
		__entry->ino	= inode->i_ino;
		__entry->ip	= IP;
	),

	TP_printk("dev %d,%d ino %lu caller %pF",
156
		  MAJOR(__entry->dev), MINOR(__entry->dev),
157 158 159 160 161 162 163 164 165
		  (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(
166
		__field(	dev_t,	dev			)
167 168 169 170 171
		__field(	ino_t,	ino			)
		__field(	loff_t,	new_size		)
	),

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

	TP_printk("dev %d,%d ino %lu new_size %lld",
178
		  MAJOR(__entry->dev), MINOR(__entry->dev),
179
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
180
		  __entry->new_size)
181 182
);

183
DECLARE_EVENT_CLASS(ext4__write_begin,
184 185 186 187 188 189 190

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

	TP_ARGS(inode, pos, len, flags),

	TP_STRUCT__entry(
191
		__field(	dev_t,	dev			)
192 193 194 195 196 197 198
		__field(	ino_t,	ino			)
		__field(	loff_t,	pos			)
		__field(	unsigned int, len		)
		__field(	unsigned int, flags		)
	),

	TP_fast_assign(
199
		__entry->dev	= inode->i_sb->s_dev;
200 201 202 203 204 205
		__entry->ino	= inode->i_ino;
		__entry->pos	= pos;
		__entry->len	= len;
		__entry->flags	= flags;
	),

L
Lukas Czerner 已提交
206
	TP_printk("dev %d,%d ino %lu pos %lld len %u flags %u",
207
		  MAJOR(__entry->dev), MINOR(__entry->dev),
208
		  (unsigned long) __entry->ino,
209
		  __entry->pos, __entry->len, __entry->flags)
210 211
);

212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
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,
229 230 231 232 233 234
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
			unsigned int copied),

	TP_ARGS(inode, pos, len, copied),

	TP_STRUCT__entry(
235
		__field(	dev_t,	dev			)
236 237 238 239 240 241 242
		__field(	ino_t,	ino			)
		__field(	loff_t,	pos			)
		__field(	unsigned int, len		)
		__field(	unsigned int, copied		)
	),

	TP_fast_assign(
243
		__entry->dev	= inode->i_sb->s_dev;
244 245 246 247 248 249
		__entry->ino	= inode->i_ino;
		__entry->pos	= pos;
		__entry->len	= len;
		__entry->copied	= copied;
	),

L
Lukas Czerner 已提交
250
	TP_printk("dev %d,%d ino %lu pos %lld len %u copied %u",
251 252 253
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->pos, __entry->len, __entry->copied)
254 255
);

256 257
DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end,

258 259 260
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),

261 262
	TP_ARGS(inode, pos, len, copied)
);
263

264
DEFINE_EVENT(ext4__write_end, ext4_writeback_write_end,
265

266 267
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),
268

269
	TP_ARGS(inode, pos, len, copied)
270 271
);

272 273
DEFINE_EVENT(ext4__write_end, ext4_journalled_write_end,

274 275 276
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),

277 278
	TP_ARGS(inode, pos, len, copied)
);
279

280
DEFINE_EVENT(ext4__write_end, ext4_da_write_end,
281

282 283 284 285
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),

	TP_ARGS(inode, pos, len, copied)
286 287 288 289 290 291 292 293
);

TRACE_EVENT(ext4_da_writepages,
	TP_PROTO(struct inode *inode, struct writeback_control *wbc),

	TP_ARGS(inode, wbc),

	TP_STRUCT__entry(
294
		__field(	dev_t,	dev			)
295 296 297 298 299
		__field(	ino_t,	ino			)
		__field(	long,	nr_to_write		)
		__field(	long,	pages_skipped		)
		__field(	loff_t,	range_start		)
		__field(	loff_t,	range_end		)
300
		__field(	int,	sync_mode		)
301 302
		__field(	char,	for_kupdate		)
		__field(	char,	range_cyclic		)
303
		__field(       pgoff_t,	writeback_index		)
304 305 306
	),

	TP_fast_assign(
307
		__entry->dev		= inode->i_sb->s_dev;
308 309 310 311 312
		__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;
313
		__entry->sync_mode	= wbc->sync_mode;
314 315
		__entry->for_kupdate	= wbc->for_kupdate;
		__entry->range_cyclic	= wbc->range_cyclic;
316
		__entry->writeback_index = inode->i_mapping->writeback_index;
317 318
	),

319
	TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld "
L
Lukas Czerner 已提交
320
		  "range_start %lld range_end %lld sync_mode %d"
321 322
		  "for_kupdate %d range_cyclic %d writeback_index %lu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
323
		  (unsigned long) __entry->ino, __entry->nr_to_write,
324
		  __entry->pages_skipped, __entry->range_start,
325 326
		  __entry->range_end, __entry->sync_mode,
		  __entry->for_kupdate, __entry->range_cyclic,
327
		  (unsigned long) __entry->writeback_index)
328 329
);

330 331 332 333 334 335
TRACE_EVENT(ext4_da_write_pages,
	TP_PROTO(struct inode *inode, struct mpage_da_data *mpd),

	TP_ARGS(inode, mpd),

	TP_STRUCT__entry(
336
		__field(	dev_t,	dev			)
337 338 339 340 341 342 343
		__field(	ino_t,	ino			)
		__field(	__u64,	b_blocknr		)
		__field(	__u32,	b_size			)
		__field(	__u32,	b_state			)
		__field(	unsigned long,	first_page	)
		__field(	int,	io_done			)
		__field(	int,	pages_written		)
344
		__field(	int,	sync_mode		)
345 346 347
	),

	TP_fast_assign(
348
		__entry->dev		= inode->i_sb->s_dev;
349 350 351 352 353 354 355
		__entry->ino		= inode->i_ino;
		__entry->b_blocknr	= mpd->b_blocknr;
		__entry->b_size		= mpd->b_size;
		__entry->b_state	= mpd->b_state;
		__entry->first_page	= mpd->first_page;
		__entry->io_done	= mpd->io_done;
		__entry->pages_written	= mpd->pages_written;
356
		__entry->sync_mode	= mpd->wbc->sync_mode;
357 358
	),

359 360 361
	TP_printk("dev %d,%d ino %lu b_blocknr %llu b_size %u b_state 0x%04x "
		  "first_page %lu io_done %d pages_written %d sync_mode %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
362
		  (unsigned long) __entry->ino,
363 364
		  __entry->b_blocknr, __entry->b_size,
		  __entry->b_state, __entry->first_page,
365 366 367
		  __entry->io_done, __entry->pages_written,
		  __entry->sync_mode
                  )
368 369
);

370 371 372 373 374 375 376
TRACE_EVENT(ext4_da_writepages_result,
	TP_PROTO(struct inode *inode, struct writeback_control *wbc,
			int ret, int pages_written),

	TP_ARGS(inode, wbc, ret, pages_written),

	TP_STRUCT__entry(
377
		__field(	dev_t,	dev			)
378 379 380 381
		__field(	ino_t,	ino			)
		__field(	int,	ret			)
		__field(	int,	pages_written		)
		__field(	long,	pages_skipped		)
382
		__field(	int,	sync_mode		)
383
		__field(	char,	more_io			)	
384
		__field(       pgoff_t,	writeback_index		)
385 386 387
	),

	TP_fast_assign(
388
		__entry->dev		= inode->i_sb->s_dev;
389 390 391 392
		__entry->ino		= inode->i_ino;
		__entry->ret		= ret;
		__entry->pages_written	= pages_written;
		__entry->pages_skipped	= wbc->pages_skipped;
393
		__entry->sync_mode	= wbc->sync_mode;
394
		__entry->more_io	= wbc->more_io;
395
		__entry->writeback_index = inode->i_mapping->writeback_index;
396 397
	),

398 399 400
	TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld "
		  " more_io %d sync_mode %d writeback_index %lu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
401
		  (unsigned long) __entry->ino, __entry->ret,
402
		  __entry->pages_written, __entry->pages_skipped,
403
		  __entry->more_io, __entry->sync_mode,
404
		  (unsigned long) __entry->writeback_index)
405 406
);

407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
DECLARE_EVENT_CLASS(ext4__page_op,
	TP_PROTO(struct page *page),

	TP_ARGS(page),

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

	),

	TP_fast_assign(
		__entry->index	= page->index;
		__entry->ino	= page->mapping->host->i_ino;
		__entry->dev	= page->mapping->host->i_sb->s_dev;
	),

	TP_printk("dev %d,%d ino %lu page_index %lu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
428 429 430 431 432 433 434 435
		  (unsigned long) __entry->index)
);

DEFINE_EVENT(ext4__page_op, ext4_writepage,

	TP_PROTO(struct page *page),

	TP_ARGS(page)
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474
);

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

TRACE_EVENT(ext4_invalidatepage,
	TP_PROTO(struct page *page, unsigned long offset),

	TP_ARGS(page, offset),

	TP_STRUCT__entry(
		__field(	pgoff_t, index			)
		__field(	unsigned long, offset		)
		__field(	ino_t,	ino			)
		__field(	dev_t,	dev			)

	),

	TP_fast_assign(
		__entry->index	= page->index;
		__entry->offset	= offset;
		__entry->ino	= page->mapping->host->i_ino;
		__entry->dev	= page->mapping->host->i_sb->s_dev;
	),

	TP_printk("dev %d,%d ino %lu page_index %lu offset %lu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
475
		  (unsigned long) __entry->index, __entry->offset)
476 477
);

478 479 480 481 482 483 484
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(
485
		__field(	dev_t,	dev			)
486 487 488 489 490 491
		__field(	__u64,	blk			)
		__field(	__u64,	count			)

	),

	TP_fast_assign(
492
		__entry->dev	= sb->s_dev;
493 494 495 496
		__entry->blk	= blk;
		__entry->count	= count;
	),

497
	TP_printk("dev %d,%d blk %llu count %llu",
498
		  MAJOR(__entry->dev), MINOR(__entry->dev),
499
		  __entry->blk, __entry->count)
500 501
);

502
DECLARE_EVENT_CLASS(ext4__mb_new_pa,
503 504 505 506 507 508
	TP_PROTO(struct ext4_allocation_context *ac,
		 struct ext4_prealloc_space *pa),

	TP_ARGS(ac, pa),

	TP_STRUCT__entry(
509
		__field(	dev_t,	dev			)
510 511 512 513 514 515 516 517
		__field(	ino_t,	ino			)
		__field(	__u64,	pa_pstart		)
		__field(	__u32,	pa_len			)
		__field(	__u64,	pa_lstart		)

	),

	TP_fast_assign(
518
		__entry->dev		= ac->ac_sb->s_dev;
519 520 521 522 523 524
		__entry->ino		= ac->ac_inode->i_ino;
		__entry->pa_pstart	= pa->pa_pstart;
		__entry->pa_len		= pa->pa_len;
		__entry->pa_lstart	= pa->pa_lstart;
	),

525
	TP_printk("dev %d,%d ino %lu pstart %llu len %u lstart %llu",
526 527 528
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->pa_pstart, __entry->pa_len, __entry->pa_lstart)
529 530
);

531 532
DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa,

533 534 535
	TP_PROTO(struct ext4_allocation_context *ac,
		 struct ext4_prealloc_space *pa),

536 537
	TP_ARGS(ac, pa)
);
538

539
DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_group_pa,
540

541 542
	TP_PROTO(struct ext4_allocation_context *ac,
		 struct ext4_prealloc_space *pa),
543

544
	TP_ARGS(ac, pa)
545 546 547
);

TRACE_EVENT(ext4_mb_release_inode_pa,
L
Lukas Czerner 已提交
548
	TP_PROTO(struct ext4_prealloc_space *pa,
549 550
		 unsigned long long block, unsigned int count),

L
Lukas Czerner 已提交
551
	TP_ARGS(pa, block, count),
552 553

	TP_STRUCT__entry(
554
		__field(	dev_t,	dev			)
555 556 557 558 559 560 561
		__field(	ino_t,	ino			)
		__field(	__u64,	block			)
		__field(	__u32,	count			)

	),

	TP_fast_assign(
L
Lukas Czerner 已提交
562 563
		__entry->dev		= pa->pa_inode->i_sb->s_dev;
		__entry->ino		= pa->pa_inode->i_ino;
564 565 566 567
		__entry->block		= block;
		__entry->count		= count;
	),

568
	TP_printk("dev %d,%d ino %lu block %llu count %u",
569 570 571
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->block, __entry->count)
572 573 574
);

TRACE_EVENT(ext4_mb_release_group_pa,
L
Lukas Czerner 已提交
575
	TP_PROTO(struct ext4_prealloc_space *pa),
576

L
Lukas Czerner 已提交
577
	TP_ARGS(pa),
578 579

	TP_STRUCT__entry(
580
		__field(	dev_t,	dev			)
581 582 583 584 585 586
		__field(	__u64,	pa_pstart		)
		__field(	__u32,	pa_len			)

	),

	TP_fast_assign(
L
Lukas Czerner 已提交
587
		__entry->dev		= pa->pa_inode->i_sb->s_dev;
588 589 590 591
		__entry->pa_pstart	= pa->pa_pstart;
		__entry->pa_len		= pa->pa_len;
	),

592
	TP_printk("dev %d,%d pstart %llu len %u",
593
		  MAJOR(__entry->dev), MINOR(__entry->dev),
594
		  __entry->pa_pstart, __entry->pa_len)
595 596 597 598 599 600 601 602
);

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

	TP_ARGS(inode),

	TP_STRUCT__entry(
603
		__field(	dev_t,	dev			)
604 605 606 607 608
		__field(	ino_t,	ino			)

	),

	TP_fast_assign(
609
		__entry->dev	= inode->i_sb->s_dev;
610 611 612
		__entry->ino	= inode->i_ino;
	),

613
	TP_printk("dev %d,%d ino %lu",
614
		  MAJOR(__entry->dev), MINOR(__entry->dev),
615
		  (unsigned long) __entry->ino)
616 617 618 619 620 621 622 623
);

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

	TP_ARGS(sb, needed),

	TP_STRUCT__entry(
624
		__field(	dev_t,	dev			)
625 626 627 628 629
		__field(	int,	needed			)

	),

	TP_fast_assign(
630
		__entry->dev	= sb->s_dev;
631 632 633
		__entry->needed	= needed;
	),

634
	TP_printk("dev %d,%d needed %d",
635 636
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->needed)
637 638 639 640 641 642 643 644
);

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

	TP_ARGS(ar),

	TP_STRUCT__entry(
645
		__field(	dev_t,	dev			)
646 647 648
		__field(	ino_t,	ino			)
		__field(	unsigned int, flags		)
		__field(	unsigned int, len		)
L
Lukas Czerner 已提交
649 650 651
		__field(	__u32,  logical			)
		__field(	__u32,	lleft			)
		__field(	__u32,	lright			)
652 653 654 655 656 657
		__field(	__u64,	goal			)
		__field(	__u64,	pleft			)
		__field(	__u64,	pright			)
	),

	TP_fast_assign(
658
		__entry->dev	= ar->inode->i_sb->s_dev;
659 660 661 662 663 664 665 666 667 668 669
		__entry->ino	= ar->inode->i_ino;
		__entry->flags	= ar->flags;
		__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;
	),

L
Lukas Czerner 已提交
670 671
	TP_printk("dev %d,%d ino %lu flags %u len %u lblk %u goal %llu "
		  "lleft %u lright %u pleft %llu pright %llu ",
672
		  MAJOR(__entry->dev), MINOR(__entry->dev),
L
Lukas Czerner 已提交
673 674 675 676
		  (unsigned long) __entry->ino, __entry->flags,
		  __entry->len, __entry->logical, __entry->goal,
		  __entry->lleft, __entry->lright, __entry->pleft,
		  __entry->pright)
677 678 679 680 681 682 683 684
);

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

	TP_ARGS(ar, block),

	TP_STRUCT__entry(
685
		__field(	dev_t,	dev			)
686 687 688 689
		__field(	ino_t,	ino			)
		__field(	__u64,	block			)
		__field(	unsigned int, flags		)
		__field(	unsigned int, len		)
L
Lukas Czerner 已提交
690 691 692
		__field(	__u32,  logical			)
		__field(	__u32,	lleft			)
		__field(	__u32,	lright			)
693 694 695 696 697 698
		__field(	__u64,	goal			)
		__field(	__u64,	pleft			)
		__field(	__u64,	pright			)
	),

	TP_fast_assign(
699
		__entry->dev	= ar->inode->i_sb->s_dev;
700 701 702 703 704 705 706 707 708 709 710 711
		__entry->ino	= ar->inode->i_ino;
		__entry->block	= block;
		__entry->flags	= ar->flags;
		__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;
	),

L
Lukas Czerner 已提交
712 713
	TP_printk("dev %d,%d ino %lu flags %u len %u block %llu lblk %u "
		  "goal %llu lleft %u lright %u pleft %llu pright %llu",
714
		  MAJOR(__entry->dev), MINOR(__entry->dev),
L
Lukas Czerner 已提交
715 716 717 718
		  (unsigned long) __entry->ino, __entry->flags,
		  __entry->len, __entry->block, __entry->logical,
		  __entry->goal,  __entry->lleft, __entry->lright,
		  __entry->pleft, __entry->pright)
719 720 721 722
);

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

725
	TP_ARGS(inode, block, count, flags),
726 727

	TP_STRUCT__entry(
728
		__field(	dev_t,	dev			)
729
		__field(	ino_t,	ino			)
730
		__field(	__u16,	mode			)
731 732
		__field(	__u64,	block			)
		__field(	unsigned long,	count		)
L
Lukas Czerner 已提交
733
		__field(	int,	flags			)
734 735 736
	),

	TP_fast_assign(
737
		__entry->dev		= inode->i_sb->s_dev;
738
		__entry->ino		= inode->i_ino;
739
		__entry->mode		= inode->i_mode;
740 741
		__entry->block		= block;
		__entry->count		= count;
742
		__entry->flags		= flags;
743 744
	),

745
	TP_printk("dev %d,%d ino %lu mode 0%o block %llu count %lu flags %d",
746
		  MAJOR(__entry->dev), MINOR(__entry->dev),
747
		  (unsigned long) __entry->ino,
748 749
		  __entry->mode, __entry->block, __entry->count,
		  __entry->flags)
750 751
);

752
TRACE_EVENT(ext4_sync_file_enter,
753
	TP_PROTO(struct file *file, int datasync),
754

755
	TP_ARGS(file, datasync),
756 757

	TP_STRUCT__entry(
758
		__field(	dev_t,	dev			)
759 760 761 762 763 764
		__field(	ino_t,	ino			)
		__field(	ino_t,	parent			)
		__field(	int,	datasync		)
	),

	TP_fast_assign(
765 766
		struct dentry *dentry = file->f_path.dentry;

767
		__entry->dev		= dentry->d_inode->i_sb->s_dev;
768 769 770 771 772
		__entry->ino		= dentry->d_inode->i_ino;
		__entry->datasync	= datasync;
		__entry->parent		= dentry->d_parent->d_inode->i_ino;
	),

L
Lukas Czerner 已提交
773
	TP_printk("dev %d,%d ino %lu parent %lu datasync %d ",
774
		  MAJOR(__entry->dev), MINOR(__entry->dev),
775
		  (unsigned long) __entry->ino,
776
		  (unsigned long) __entry->parent, __entry->datasync)
777 778
);

779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795
TRACE_EVENT(ext4_sync_file_exit,
	TP_PROTO(struct inode *inode, int ret),

	TP_ARGS(inode, ret),

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

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

L
Lukas Czerner 已提交
796
	TP_printk("dev %d,%d ino %lu ret %d",
797 798 799 800 801
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->ret)
);

802 803 804 805 806 807
TRACE_EVENT(ext4_sync_fs,
	TP_PROTO(struct super_block *sb, int wait),

	TP_ARGS(sb, wait),

	TP_STRUCT__entry(
808
		__field(	dev_t,	dev			)
809 810 811 812 813
		__field(	int,	wait			)

	),

	TP_fast_assign(
814
		__entry->dev	= sb->s_dev;
815 816 817
		__entry->wait	= wait;
	),

818 819 820
	TP_printk("dev %d,%d wait %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->wait)
821 822
);

823 824 825 826 827 828
TRACE_EVENT(ext4_alloc_da_blocks,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
829
		__field(	dev_t,	dev			)
830 831 832 833 834 835
		__field(	ino_t,	ino			)
		__field( unsigned int,	data_blocks	)
		__field( unsigned int,	meta_blocks	)
	),

	TP_fast_assign(
836
		__entry->dev	= inode->i_sb->s_dev;
837 838 839 840 841
		__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;
	),

842
	TP_printk("dev %d,%d ino %lu data_blocks %u meta_blocks %u",
843
		  MAJOR(__entry->dev), MINOR(__entry->dev),
844
		  (unsigned long) __entry->ino,
845 846 847
		  __entry->data_blocks, __entry->meta_blocks)
);

848 849 850 851 852 853
TRACE_EVENT(ext4_mballoc_alloc,
	TP_PROTO(struct ext4_allocation_context *ac),

	TP_ARGS(ac),

	TP_STRUCT__entry(
854
		__field(	dev_t,	dev			)
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876
		__field(	ino_t,	ino			)
		__field(	__u16,	found			)
		__field(	__u16,	groups			)
		__field(	__u16,	buddy			)
		__field(	__u16,	flags			)
		__field(	__u16,	tail			)
		__field(	__u8,	cr			)
		__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		)
	),

	TP_fast_assign(
877
		__entry->dev		= ac->ac_inode->i_sb->s_dev;
878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898
		__entry->ino		= ac->ac_inode->i_ino;
		__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;
		__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;
	),

899
	TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
900 901
		  "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x "
		  "tail %u broken %u",
902
		  MAJOR(__entry->dev), MINOR(__entry->dev),
903
		  (unsigned long) __entry->ino,
904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920
		  __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,
		  __entry->flags, __entry->tail,
		  __entry->buddy ? 1 << __entry->buddy : 0)
);

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

	TP_ARGS(ac),

	TP_STRUCT__entry(
921
		__field(	dev_t,	dev			)
922 923 924 925 926 927 928 929 930 931 932 933
		__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(
934
		__entry->dev		= ac->ac_inode->i_sb->s_dev;
935 936 937 938 939 940 941 942 943 944 945
		__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;
	),

946
	TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u result %u/%d/%u@%u",
947
		  MAJOR(__entry->dev), MINOR(__entry->dev),
948
		  (unsigned long) __entry->ino,
949 950 951 952 953 954
		  __entry->orig_group, __entry->orig_start,
		  __entry->orig_len, __entry->orig_logical,
		  __entry->result_group, __entry->result_start,
		  __entry->result_len, __entry->result_logical)
);

955
DECLARE_EVENT_CLASS(ext4__mballoc,
956 957 958 959 960
	TP_PROTO(struct super_block *sb,
		 struct inode *inode,
		 ext4_group_t group,
		 ext4_grpblk_t start,
		 ext4_grpblk_t len),
961

962
	TP_ARGS(sb, inode, group, start, len),
963 964

	TP_STRUCT__entry(
965
		__field(	dev_t,	dev			)
966 967 968 969 970 971 972
		__field(	ino_t,	ino			)
		__field(	  int,	result_start		)
		__field(	__u32, 	result_group		)
		__field(	  int,	result_len		)
	),

	TP_fast_assign(
973
		__entry->dev		= sb->s_dev;
974 975 976 977
		__entry->ino		= inode ? inode->i_ino : 0;
		__entry->result_start	= start;
		__entry->result_group	= group;
		__entry->result_len	= len;
978 979
	),

L
Lukas Czerner 已提交
980
	TP_printk("dev %d,%d inode %lu extent %u/%d/%d ",
981
		  MAJOR(__entry->dev), MINOR(__entry->dev),
982
		  (unsigned long) __entry->ino,
983
		  __entry->result_group, __entry->result_start,
984
		  __entry->result_len)
985 986
);

987 988
DEFINE_EVENT(ext4__mballoc, ext4_mballoc_discard,

989 990 991 992 993
	TP_PROTO(struct super_block *sb,
		 struct inode *inode,
		 ext4_group_t group,
		 ext4_grpblk_t start,
		 ext4_grpblk_t len),
994

995
	TP_ARGS(sb, inode, group, start, len)
996
);
997

998
DEFINE_EVENT(ext4__mballoc, ext4_mballoc_free,
999

1000 1001 1002 1003 1004
	TP_PROTO(struct super_block *sb,
		 struct inode *inode,
		 ext4_group_t group,
		 ext4_grpblk_t start,
		 ext4_grpblk_t len),
1005

1006
	TP_ARGS(sb, inode, group, start, len)
1007 1008
);

1009 1010 1011 1012 1013 1014
TRACE_EVENT(ext4_forget,
	TP_PROTO(struct inode *inode, int is_metadata, __u64 block),

	TP_ARGS(inode, is_metadata, block),

	TP_STRUCT__entry(
1015
		__field(	dev_t,	dev			)
1016
		__field(	ino_t,	ino			)
1017
		__field(	__u16,	mode			)
1018 1019 1020 1021 1022
		__field(	int,	is_metadata		)
		__field(	__u64,	block			)
	),

	TP_fast_assign(
1023
		__entry->dev	= inode->i_sb->s_dev;
1024 1025 1026 1027 1028 1029
		__entry->ino	= inode->i_ino;
		__entry->mode	= inode->i_mode;
		__entry->is_metadata = is_metadata;
		__entry->block	= block;
	),

1030
	TP_printk("dev %d,%d ino %lu mode 0%o is_metadata %d block %llu",
1031 1032 1033
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->mode, __entry->is_metadata, __entry->block)
1034 1035
);

1036 1037 1038 1039 1040 1041
TRACE_EVENT(ext4_da_update_reserve_space,
	TP_PROTO(struct inode *inode, int used_blocks),

	TP_ARGS(inode, used_blocks),

	TP_STRUCT__entry(
1042
		__field(	dev_t,	dev			)
1043
		__field(	ino_t,	ino			)
1044
		__field(	__u16,	mode			)
1045 1046 1047 1048 1049 1050 1051 1052
		__field(	__u64,	i_blocks		)
		__field(	int,	used_blocks		)
		__field(	int,	reserved_data_blocks	)
		__field(	int,	reserved_meta_blocks	)
		__field(	int,	allocated_meta_blocks	)
	),

	TP_fast_assign(
1053
		__entry->dev	= inode->i_sb->s_dev;
1054 1055 1056 1057 1058 1059 1060 1061 1062
		__entry->ino	= inode->i_ino;
		__entry->mode	= inode->i_mode;
		__entry->i_blocks = inode->i_blocks;
		__entry->used_blocks = used_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;
	),

1063 1064 1065 1066 1067
	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d "
		  "reserved_data_blocks %d reserved_meta_blocks %d "
		  "allocated_meta_blocks %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1068
		  __entry->mode, __entry->i_blocks,
1069 1070 1071 1072 1073 1074 1075 1076 1077 1078
		  __entry->used_blocks, __entry->reserved_data_blocks,
		  __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
);

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

	TP_ARGS(inode, md_needed),

	TP_STRUCT__entry(
1079
		__field(	dev_t,	dev			)
1080
		__field(	ino_t,	ino			)
1081
		__field(	__u16,  mode			)
1082 1083 1084 1085 1086 1087 1088
		__field(	__u64,	i_blocks		)
		__field(	int,	md_needed		)
		__field(	int,	reserved_data_blocks	)
		__field(	int,	reserved_meta_blocks	)
	),

	TP_fast_assign(
1089
		__entry->dev	= inode->i_sb->s_dev;
1090 1091 1092 1093 1094 1095 1096 1097
		__entry->ino	= inode->i_ino;
		__entry->mode	= inode->i_mode;
		__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;
	),

1098 1099 1100
	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),
1101
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1102
		  __entry->mode, __entry->i_blocks,
1103 1104 1105 1106 1107 1108 1109 1110 1111 1112
		  __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(
1113
		__field(	dev_t,	dev			)
1114
		__field(	ino_t,	ino			)
1115
		__field(	__u16,  mode			)
1116 1117 1118 1119 1120 1121 1122 1123
		__field(	__u64,	i_blocks		)
		__field(	int,	freed_blocks		)
		__field(	int,	reserved_data_blocks	)
		__field(	int,	reserved_meta_blocks	)
		__field(	int,	allocated_meta_blocks	)
	),

	TP_fast_assign(
1124
		__entry->dev	= inode->i_sb->s_dev;
1125 1126 1127 1128 1129 1130 1131 1132 1133
		__entry->ino	= inode->i_ino;
		__entry->mode	= inode->i_mode;
		__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;
	),

1134 1135 1136 1137
	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),
1138
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1139
		  __entry->mode, __entry->i_blocks,
1140 1141 1142 1143
		  __entry->freed_blocks, __entry->reserved_data_blocks,
		  __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
);

1144 1145 1146 1147 1148 1149
DECLARE_EVENT_CLASS(ext4__bitmap_load,
	TP_PROTO(struct super_block *sb, unsigned long group),

	TP_ARGS(sb, group),

	TP_STRUCT__entry(
1150
		__field(	dev_t,	dev			)
1151 1152 1153 1154 1155
		__field(	__u32,	group			)

	),

	TP_fast_assign(
1156
		__entry->dev	= sb->s_dev;
1157 1158 1159
		__entry->group	= group;
	),

1160
	TP_printk("dev %d,%d group %u",
1161 1162
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->group)
1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177
);

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

1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213
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(	ino_t,	ino			)
		__field(	dev_t,	dev			)
		__field(	loff_t,	pos			)
		__field(	unsigned long,	len		)
		__field(	int,	rw			)
	),

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

L
Lukas Czerner 已提交
1214
	TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d",
1215 1216
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1217
		  __entry->pos, __entry->len, __entry->rw)
1218 1219 1220
);

TRACE_EVENT(ext4_direct_IO_exit,
L
Lukas Czerner 已提交
1221 1222
	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
		 int rw, int ret),
1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243

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

	TP_STRUCT__entry(
		__field(	ino_t,	ino			)
		__field(	dev_t,	dev			)
		__field(	loff_t,	pos			)
		__field(	unsigned long,	len		)
		__field(	int,	rw			)
		__field(	int,	ret			)
	),

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

L
Lukas Czerner 已提交
1244
	TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d ret %d",
1245 1246
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1247
		  __entry->pos, __entry->len,
1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271
		  __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(	ino_t,	ino			)
		__field(	dev_t,	dev			)
		__field(	loff_t,	pos			)
		__field(	loff_t,	len			)
		__field(	int,	mode			)
	),

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

L
Lukas Czerner 已提交
1272
	TP_printk("dev %d,%d ino %lu pos %lld len %lld mode %d",
1273
		  MAJOR(__entry->dev), MINOR(__entry->dev),
L
Lukas Czerner 已提交
1274 1275
		  (unsigned long) __entry->ino, __entry->pos,
		  __entry->len, __entry->mode)
1276 1277 1278
);

TRACE_EVENT(ext4_fallocate_exit,
L
Lukas Czerner 已提交
1279 1280
	TP_PROTO(struct inode *inode, loff_t offset,
		 unsigned int max_blocks, int ret),
1281 1282 1283 1284 1285 1286 1287

	TP_ARGS(inode, offset, max_blocks, ret),

	TP_STRUCT__entry(
		__field(	ino_t,	ino			)
		__field(	dev_t,	dev			)
		__field(	loff_t,	pos			)
L
Lukas Czerner 已提交
1288
		__field(	unsigned int,	blocks		)
1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299
		__field(	int, 	ret			)
	),

	TP_fast_assign(
		__entry->ino	= inode->i_ino;
		__entry->dev	= inode->i_sb->s_dev;
		__entry->pos	= offset;
		__entry->blocks	= max_blocks;
		__entry->ret	= ret;
	),

L
Lukas Czerner 已提交
1300
	TP_printk("dev %d,%d ino %lu pos %lld blocks %u ret %d",
1301 1302
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1303
		  __entry->pos, __entry->blocks,
1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325
		  __entry->ret)
);

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

	TP_ARGS(parent, dentry),

	TP_STRUCT__entry(
		__field(	ino_t,	parent			)
		__field(	ino_t,	ino			)
		__field(	loff_t,	size			)
		__field(	dev_t,	dev			)
	),

	TP_fast_assign(
		__entry->parent		= parent->i_ino;
		__entry->ino		= dentry->d_inode->i_ino;
		__entry->size		= dentry->d_inode->i_size;
		__entry->dev		= dentry->d_inode->i_sb->s_dev;
	),

L
Lukas Czerner 已提交
1326
	TP_printk("dev %d,%d ino %lu size %lld parent %lu",
1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348
		  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(	ino_t,	ino			)
		__field(	dev_t,	dev			)
		__field(	int,	ret			)
	),

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

L
Lukas Czerner 已提交
1349
	TP_printk("dev %d,%d ino %lu ret %d",
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362
		  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(
		__field(	ino_t,  	ino		)
		__field(	dev_t,  	dev		)
L
Lukas Czerner 已提交
1363
		__field(	__u64,		blocks		)
1364 1365 1366 1367 1368 1369 1370 1371
	),

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

L
Lukas Czerner 已提交
1372
	TP_printk("dev %d,%d ino %lu blocks %llu",
1373
		  MAJOR(__entry->dev), MINOR(__entry->dev),
L
Lukas Czerner 已提交
1374
		  (unsigned long) __entry->ino, __entry->blocks)
1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392
);

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

DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
L
Lukas Czerner 已提交
1393
		 unsigned int len, unsigned int flags),
1394 1395 1396 1397 1398 1399 1400

	TP_ARGS(inode, lblk, len, flags),

	TP_STRUCT__entry(
		__field(	ino_t,  	ino		)
		__field(	dev_t,  	dev		)
		__field(	ext4_lblk_t,	lblk		)
L
Lukas Czerner 已提交
1401 1402
		__field(	unsigned int,	len		)
		__field(	unsigned int,	flags		)
1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415
	),

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

	TP_printk("dev %d,%d ino %lu lblk %u len %u flags %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1416
		  __entry->lblk, __entry->len, __entry->flags)
1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434
);

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,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
L
Lukas Czerner 已提交
1435
		 ext4_fsblk_t pblk, unsigned int len, int ret),
1436 1437 1438 1439 1440 1441 1442 1443

	TP_ARGS(inode, lblk, pblk, len, ret),

	TP_STRUCT__entry(
		__field(	ino_t,		ino		)
		__field(	dev_t,		dev		)
		__field(	ext4_lblk_t,	lblk		)
		__field(	ext4_fsblk_t,	pblk		)
L
Lukas Czerner 已提交
1444
		__field(	unsigned int,	len		)
1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459
		__field(	int,		ret		)
	),

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

	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u ret %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1460
		  __entry->lblk, __entry->pblk,
1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499
		  __entry->len, __entry->ret)
);

DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
		 ext4_fsblk_t pblk, unsigned len, int ret),

	TP_ARGS(inode, lblk, pblk, len, ret)
);

DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
		 ext4_fsblk_t pblk, unsigned len, int ret),

	TP_ARGS(inode, lblk, pblk, len, ret)
);

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(	ino_t,		ino		)
		__field(	dev_t,		dev		)
		__field(	ext4_lblk_t,	lblk		)
		__field(	ext4_fsblk_t,	pblk		)
	),

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

	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1500
		  __entry->lblk, __entry->pblk)
1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522
);

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

	TP_ARGS(inode),

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

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

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

1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544
TRACE_EVENT(ext4_journal_start,
	TP_PROTO(struct super_block *sb, int nblocks, unsigned long IP),

	TP_ARGS(sb, nblocks, IP),

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

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

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

T
Tao Ma 已提交
1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593
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)
);

1594 1595 1596 1597
#endif /* _TRACE_EXT4_H */

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