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

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

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

10 11
struct ext4_allocation_context;
struct ext4_allocation_request;
12
struct ext4_extent;
13
struct ext4_prealloc_space;
14
struct ext4_inode_info;
15
struct mpage_da_data;
16 17
struct ext4_map_blocks;
struct ext4_extent;
18
struct extent_status;
19 20

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

22 23 24 25 26 27
TRACE_EVENT(ext4_free_inode,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
28
		__field(	dev_t,	dev			)
29 30 31
		__field(	ino_t,	ino			)
		__field(	uid_t,	uid			)
		__field(	gid_t,	gid			)
L
Lukas Czerner 已提交
32
		__field(	__u64, blocks			)
33
		__field(	__u16, mode			)
34 35 36
	),

	TP_fast_assign(
37
		__entry->dev	= inode->i_sb->s_dev;
38
		__entry->ino	= inode->i_ino;
39 40
		__entry->uid	= i_uid_read(inode);
		__entry->gid	= i_gid_read(inode);
41
		__entry->blocks	= inode->i_blocks;
42
		__entry->mode	= inode->i_mode;
43 44
	),

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

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

	TP_ARGS(dir, mode),

	TP_STRUCT__entry(
57
		__field(	dev_t,	dev			)
58
		__field(	ino_t,	dir			)
59
		__field(	__u16, mode			)
60 61 62
	),

	TP_fast_assign(
63
		__entry->dev	= dir->i_sb->s_dev;
64 65 66 67
		__entry->dir	= dir->i_ino;
		__entry->mode	= mode;
	),

68
	TP_printk("dev %d,%d dir %lu mode 0%o",
69
		  MAJOR(__entry->dev), MINOR(__entry->dev),
70
		  (unsigned long) __entry->dir, __entry->mode)
71 72 73 74 75 76 77 78
);

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

	TP_ARGS(inode, dir, mode),

	TP_STRUCT__entry(
79
		__field(	dev_t,	dev			)
80 81
		__field(	ino_t,	ino			)
		__field(	ino_t,	dir			)
82
		__field(	__u16,	mode			)
83 84 85
	),

	TP_fast_assign(
86
		__entry->dev	= inode->i_sb->s_dev;
87 88 89 90 91
		__entry->ino	= inode->i_ino;
		__entry->dir	= dir->i_ino;
		__entry->mode	= mode;
	),

92
	TP_printk("dev %d,%d ino %lu dir %lu mode 0%o",
93
		  MAJOR(__entry->dev), MINOR(__entry->dev),
94
		  (unsigned long) __entry->ino,
95
		  (unsigned long) __entry->dir, __entry->mode)
96 97
);

98 99 100 101 102 103
TRACE_EVENT(ext4_evict_inode,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
104
		__field(	dev_t,	dev			)
105 106 107 108 109
		__field(	ino_t,	ino			)
		__field(	int,	nlink			)
	),

	TP_fast_assign(
110
		__entry->dev	= inode->i_sb->s_dev;
111 112 113 114 115
		__entry->ino	= inode->i_ino;
		__entry->nlink	= inode->i_nlink;
	),

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

	TP_fast_assign(
132
		__entry->dev	= inode->i_sb->s_dev;
133 134 135 136 137
		__entry->ino	= inode->i_ino;
		__entry->drop	= drop;
	),

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

	TP_fast_assign(
154
		__entry->dev	= inode->i_sb->s_dev;
155 156 157 158 159
		__entry->ino	= inode->i_ino;
		__entry->ip	= IP;
	),

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

	TP_fast_assign(
176
		__entry->dev		= inode->i_sb->s_dev;
177 178 179 180 181
		__entry->ino		= inode->i_ino;
		__entry->new_size	= new_size;
	),

	TP_printk("dev %d,%d ino %lu new_size %lld",
182
		  MAJOR(__entry->dev), MINOR(__entry->dev),
183
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
184
		  __entry->new_size)
185 186
);

187
DECLARE_EVENT_CLASS(ext4__write_begin,
188 189 190 191 192 193 194

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

	TP_ARGS(inode, pos, len, flags),

	TP_STRUCT__entry(
195
		__field(	dev_t,	dev			)
196 197 198 199 200 201 202
		__field(	ino_t,	ino			)
		__field(	loff_t,	pos			)
		__field(	unsigned int, len		)
		__field(	unsigned int, flags		)
	),

	TP_fast_assign(
203
		__entry->dev	= inode->i_sb->s_dev;
204 205 206 207 208 209
		__entry->ino	= inode->i_ino;
		__entry->pos	= pos;
		__entry->len	= len;
		__entry->flags	= flags;
	),

L
Lukas Czerner 已提交
210
	TP_printk("dev %d,%d ino %lu pos %lld len %u flags %u",
211
		  MAJOR(__entry->dev), MINOR(__entry->dev),
212
		  (unsigned long) __entry->ino,
213
		  __entry->pos, __entry->len, __entry->flags)
214 215
);

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

	TP_ARGS(inode, pos, len, copied),

	TP_STRUCT__entry(
239
		__field(	dev_t,	dev			)
240 241 242 243 244 245 246
		__field(	ino_t,	ino			)
		__field(	loff_t,	pos			)
		__field(	unsigned int, len		)
		__field(	unsigned int, copied		)
	),

	TP_fast_assign(
247
		__entry->dev	= inode->i_sb->s_dev;
248 249 250 251 252 253
		__entry->ino	= inode->i_ino;
		__entry->pos	= pos;
		__entry->len	= len;
		__entry->copied	= copied;
	),

L
Lukas Czerner 已提交
254
	TP_printk("dev %d,%d ino %lu pos %lld len %u copied %u",
255 256 257
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->pos, __entry->len, __entry->copied)
258 259
);

260 261
DEFINE_EVENT(ext4__write_end, ext4_ordered_write_end,

262 263 264
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),

265 266
	TP_ARGS(inode, pos, len, copied)
);
267

268
DEFINE_EVENT(ext4__write_end, ext4_writeback_write_end,
269

270 271
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),
272

273
	TP_ARGS(inode, pos, len, copied)
274 275
);

276 277
DEFINE_EVENT(ext4__write_end, ext4_journalled_write_end,

278 279 280
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),

281 282
	TP_ARGS(inode, pos, len, copied)
);
283

284
DEFINE_EVENT(ext4__write_end, ext4_da_write_end,
285

286 287 288 289
	TP_PROTO(struct inode *inode, loff_t pos, unsigned int len,
		 unsigned int copied),

	TP_ARGS(inode, pos, len, copied)
290 291 292 293 294 295 296 297
);

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

	TP_ARGS(inode, wbc),

	TP_STRUCT__entry(
298
		__field(	dev_t,	dev			)
299 300 301 302 303
		__field(	ino_t,	ino			)
		__field(	long,	nr_to_write		)
		__field(	long,	pages_skipped		)
		__field(	loff_t,	range_start		)
		__field(	loff_t,	range_end		)
304
		__field(       pgoff_t,	writeback_index		)
305
		__field(	int,	sync_mode		)
306 307 308 309 310
		__field(	char,	for_kupdate		)
		__field(	char,	range_cyclic		)
	),

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

323
	TP_printk("dev %d,%d ino %lu nr_to_write %ld pages_skipped %ld "
324
		  "range_start %lld range_end %lld sync_mode %d "
325 326
		  "for_kupdate %d range_cyclic %d writeback_index %lu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
327
		  (unsigned long) __entry->ino, __entry->nr_to_write,
328
		  __entry->pages_skipped, __entry->range_start,
329 330
		  __entry->range_end, __entry->sync_mode,
		  __entry->for_kupdate, __entry->range_cyclic,
331
		  (unsigned long) __entry->writeback_index)
332 333
);

334 335 336 337 338 339
TRACE_EVENT(ext4_da_write_pages,
	TP_PROTO(struct inode *inode, struct mpage_da_data *mpd),

	TP_ARGS(inode, mpd),

	TP_STRUCT__entry(
340
		__field(	dev_t,	dev			)
341 342 343 344 345 346 347
		__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		)
348
		__field(	int,	sync_mode		)
349 350 351
	),

	TP_fast_assign(
352
		__entry->dev		= inode->i_sb->s_dev;
353 354 355 356 357 358 359
		__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;
360
		__entry->sync_mode	= mpd->wbc->sync_mode;
361 362
	),

363 364 365
	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),
366
		  (unsigned long) __entry->ino,
367 368
		  __entry->b_blocknr, __entry->b_size,
		  __entry->b_state, __entry->first_page,
369 370 371
		  __entry->io_done, __entry->pages_written,
		  __entry->sync_mode
                  )
372 373
);

374 375 376 377 378 379 380
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(
381
		__field(	dev_t,	dev			)
382 383 384 385
		__field(	ino_t,	ino			)
		__field(	int,	ret			)
		__field(	int,	pages_written		)
		__field(	long,	pages_skipped		)
386
		__field(       pgoff_t,	writeback_index		)
387
		__field(	int,	sync_mode		)
388 389 390
	),

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

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

409 410 411 412 413 414 415
DECLARE_EVENT_CLASS(ext4__page_op,
	TP_PROTO(struct page *page),

	TP_ARGS(page),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
416 417
		__field(	ino_t,	ino			)
		__field(	pgoff_t, index			)
418 419 420 421 422

	),

	TP_fast_assign(
		__entry->dev	= page->mapping->host->i_sb->s_dev;
423 424
		__entry->ino	= page->mapping->host->i_ino;
		__entry->index	= page->index;
425 426 427 428 429
	),

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

DEFINE_EVENT(ext4__page_op, ext4_writepage,

	TP_PROTO(struct page *page),

	TP_ARGS(page)
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
);

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(
460 461
		__field(	dev_t,	dev			)
		__field(	ino_t,	ino			)
462 463 464 465 466 467
		__field(	pgoff_t, index			)
		__field(	unsigned long, offset		)

	),

	TP_fast_assign(
468 469
		__entry->dev	= page->mapping->host->i_sb->s_dev;
		__entry->ino	= page->mapping->host->i_ino;
470 471 472 473 474 475 476
		__entry->index	= page->index;
		__entry->offset	= offset;
	),

	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 已提交
477
		  (unsigned long) __entry->index, __entry->offset)
478 479
);

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

	),

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

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

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

	TP_ARGS(ac, pa),

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

	),

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

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

533 534
DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_inode_pa,

535 536 537
	TP_PROTO(struct ext4_allocation_context *ac,
		 struct ext4_prealloc_space *pa),

538 539
	TP_ARGS(ac, pa)
);
540

541
DEFINE_EVENT(ext4__mb_new_pa, ext4_mb_new_group_pa,
542

543 544
	TP_PROTO(struct ext4_allocation_context *ac,
		 struct ext4_prealloc_space *pa),
545

546
	TP_ARGS(ac, pa)
547 548 549
);

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

L
Lukas Czerner 已提交
553
	TP_ARGS(pa, block, count),
554 555

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

	),

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

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

TRACE_EVENT(ext4_mb_release_group_pa,
577
	TP_PROTO(struct super_block *sb, struct ext4_prealloc_space *pa),
578

579
	TP_ARGS(sb, pa),
580 581

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

	),

	TP_fast_assign(
589
		__entry->dev		= sb->s_dev;
590 591 592 593
		__entry->pa_pstart	= pa->pa_pstart;
		__entry->pa_len		= pa->pa_len;
	),

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

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

	TP_ARGS(inode),

	TP_STRUCT__entry(
605
		__field(	dev_t,	dev			)
606 607 608 609 610
		__field(	ino_t,	ino			)

	),

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

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

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

	TP_ARGS(sb, needed),

	TP_STRUCT__entry(
626
		__field(	dev_t,	dev			)
627 628 629 630 631
		__field(	int,	needed			)

	),

	TP_fast_assign(
632
		__entry->dev	= sb->s_dev;
633 634 635
		__entry->needed	= needed;
	),

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

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

	TP_ARGS(ar),

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

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

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

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

	TP_ARGS(ar, block),

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

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

L
Lukas Czerner 已提交
714 715
	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",
716
		  MAJOR(__entry->dev), MINOR(__entry->dev),
L
Lukas Czerner 已提交
717 718 719 720
		  (unsigned long) __entry->ino, __entry->flags,
		  __entry->len, __entry->block, __entry->logical,
		  __entry->goal,  __entry->lleft, __entry->lright,
		  __entry->pleft, __entry->pright)
721 722 723 724
);

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

727
	TP_ARGS(inode, block, count, flags),
728 729

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

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

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

754
TRACE_EVENT(ext4_sync_file_enter,
755
	TP_PROTO(struct file *file, int datasync),
756

757
	TP_ARGS(file, datasync),
758 759

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

	TP_fast_assign(
767 768
		struct dentry *dentry = file->f_path.dentry;

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

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

781 782 783 784 785 786 787
TRACE_EVENT(ext4_sync_file_exit,
	TP_PROTO(struct inode *inode, int ret),

	TP_ARGS(inode, ret),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
788 789
		__field(	ino_t,	ino			)
		__field(	int,	ret			)
790 791 792 793
	),

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

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

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

	TP_ARGS(sb, wait),

	TP_STRUCT__entry(
810
		__field(	dev_t,	dev			)
811 812 813 814 815
		__field(	int,	wait			)

	),

	TP_fast_assign(
816
		__entry->dev	= sb->s_dev;
817 818 819
		__entry->wait	= wait;
	),

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

825 826 827 828 829 830
TRACE_EVENT(ext4_alloc_da_blocks,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

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

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

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

850 851 852 853 854 855
TRACE_EVENT(ext4_mballoc_alloc,
	TP_PROTO(struct ext4_allocation_context *ac),

	TP_ARGS(ac),

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

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

901
	TP_printk("dev %d,%d inode %lu orig %u/%d/%u@%u goal %u/%d/%u@%u "
902 903
		  "result %u/%d/%u@%u blks %u grps %u cr %u flags 0x%04x "
		  "tail %u broken %u",
904
		  MAJOR(__entry->dev), MINOR(__entry->dev),
905
		  (unsigned long) __entry->ino,
906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922
		  __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(
923
		__field(	dev_t,	dev			)
924 925 926 927 928 929 930 931 932 933 934 935
		__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(
936
		__entry->dev		= ac->ac_inode->i_sb->s_dev;
937 938 939 940 941 942 943 944 945 946 947
		__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;
	),

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

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

964
	TP_ARGS(sb, inode, group, start, len),
965 966

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

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

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

989 990
DEFINE_EVENT(ext4__mballoc, ext4_mballoc_discard,

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

997
	TP_ARGS(sb, inode, group, start, len)
998
);
999

1000
DEFINE_EVENT(ext4__mballoc, ext4_mballoc_free,
1001

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

1008
	TP_ARGS(sb, inode, group, start, len)
1009 1010
);

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

	TP_ARGS(inode, is_metadata, block),

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

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

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

1038
TRACE_EVENT(ext4_da_update_reserve_space,
1039
	TP_PROTO(struct inode *inode, int used_blocks, int quota_claim),
1040

1041
	TP_ARGS(inode, used_blocks, quota_claim),
1042 1043

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

	TP_fast_assign(
1056
		__entry->dev	= inode->i_sb->s_dev;
1057 1058 1059
		__entry->ino	= inode->i_ino;
		__entry->i_blocks = inode->i_blocks;
		__entry->used_blocks = used_blocks;
1060 1061 1062 1063 1064 1065 1066
		__entry->reserved_data_blocks =
				EXT4_I(inode)->i_reserved_data_blocks;
		__entry->reserved_meta_blocks =
				EXT4_I(inode)->i_reserved_meta_blocks;
		__entry->allocated_meta_blocks =
				EXT4_I(inode)->i_allocated_meta_blocks;
		__entry->quota_claim = quota_claim;
1067
		__entry->mode	= inode->i_mode;
1068 1069
	),

1070 1071
	TP_printk("dev %d,%d ino %lu mode 0%o i_blocks %llu used_blocks %d "
		  "reserved_data_blocks %d reserved_meta_blocks %d "
1072
		  "allocated_meta_blocks %d quota_claim %d",
1073 1074
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1075
		  __entry->mode, __entry->i_blocks,
1076
		  __entry->used_blocks, __entry->reserved_data_blocks,
1077 1078
		  __entry->reserved_meta_blocks, __entry->allocated_meta_blocks,
		  __entry->quota_claim)
1079 1080 1081 1082 1083 1084 1085 1086
);

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

	TP_ARGS(inode, md_needed),

	TP_STRUCT__entry(
1087
		__field(	dev_t,	dev			)
1088 1089 1090 1091 1092
		__field(	ino_t,	ino			)
		__field(	__u64,	i_blocks		)
		__field(	int,	md_needed		)
		__field(	int,	reserved_data_blocks	)
		__field(	int,	reserved_meta_blocks	)
1093
		__field(	__u16,  mode			)
1094 1095 1096
	),

	TP_fast_assign(
1097
		__entry->dev	= inode->i_sb->s_dev;
1098 1099 1100 1101 1102
		__entry->ino	= inode->i_ino;
		__entry->i_blocks = inode->i_blocks;
		__entry->md_needed = md_needed;
		__entry->reserved_data_blocks = EXT4_I(inode)->i_reserved_data_blocks;
		__entry->reserved_meta_blocks = EXT4_I(inode)->i_reserved_meta_blocks;
1103
		__entry->mode	= inode->i_mode;
1104 1105
	),

1106 1107 1108
	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),
1109
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1110
		  __entry->mode, __entry->i_blocks,
1111 1112 1113 1114 1115 1116 1117 1118 1119 1120
		  __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(
1121
		__field(	dev_t,	dev			)
1122 1123 1124 1125 1126 1127
		__field(	ino_t,	ino			)
		__field(	__u64,	i_blocks		)
		__field(	int,	freed_blocks		)
		__field(	int,	reserved_data_blocks	)
		__field(	int,	reserved_meta_blocks	)
		__field(	int,	allocated_meta_blocks	)
1128
		__field(	__u16,  mode			)
1129 1130 1131
	),

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

1142 1143 1144 1145
	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),
1146
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1147
		  __entry->mode, __entry->i_blocks,
1148 1149 1150 1151
		  __entry->freed_blocks, __entry->reserved_data_blocks,
		  __entry->reserved_meta_blocks, __entry->allocated_meta_blocks)
);

1152 1153 1154 1155 1156 1157
DECLARE_EVENT_CLASS(ext4__bitmap_load,
	TP_PROTO(struct super_block *sb, unsigned long group),

	TP_ARGS(sb, group),

	TP_STRUCT__entry(
1158
		__field(	dev_t,	dev			)
1159 1160 1161 1162 1163
		__field(	__u32,	group			)

	),

	TP_fast_assign(
1164
		__entry->dev	= sb->s_dev;
1165 1166 1167
		__entry->group	= group;
	),

1168
	TP_printk("dev %d,%d group %u",
1169 1170
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->group)
1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185
);

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

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

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1216
		__entry->ino	= inode->i_ino;
1217 1218 1219 1220 1221
		__entry->pos	= offset;
		__entry->len	= len;
		__entry->rw	= rw;
	),

L
Lukas Czerner 已提交
1222
	TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d",
1223 1224
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1225
		  __entry->pos, __entry->len, __entry->rw)
1226 1227 1228
);

TRACE_EVENT(ext4_direct_IO_exit,
L
Lukas Czerner 已提交
1229 1230
	TP_PROTO(struct inode *inode, loff_t offset, unsigned long len,
		 int rw, int ret),
1231 1232 1233 1234 1235

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

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
1236
		__field(	ino_t,	ino			)
1237 1238 1239 1240 1241 1242 1243 1244
		__field(	loff_t,	pos			)
		__field(	unsigned long,	len		)
		__field(	int,	rw			)
		__field(	int,	ret			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1245
		__entry->ino	= inode->i_ino;
1246 1247 1248 1249 1250 1251
		__entry->pos	= offset;
		__entry->len	= len;
		__entry->rw	= rw;
		__entry->ret	= ret;
	),

L
Lukas Czerner 已提交
1252
	TP_printk("dev %d,%d ino %lu pos %lld len %lu rw %d ret %d",
1253 1254
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1255
		  __entry->pos, __entry->len,
1256 1257 1258 1259 1260 1261 1262 1263 1264 1265
		  __entry->rw, __entry->ret)
);

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

	TP_ARGS(inode, offset, len, mode),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
1266
		__field(	ino_t,	ino			)
1267 1268 1269 1270 1271 1272 1273
		__field(	loff_t,	pos			)
		__field(	loff_t,	len			)
		__field(	int,	mode			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1274
		__entry->ino	= inode->i_ino;
1275 1276 1277 1278 1279
		__entry->pos	= offset;
		__entry->len	= len;
		__entry->mode	= mode;
	),

L
Lukas Czerner 已提交
1280
	TP_printk("dev %d,%d ino %lu pos %lld len %lld mode %d",
1281
		  MAJOR(__entry->dev), MINOR(__entry->dev),
L
Lukas Czerner 已提交
1282 1283
		  (unsigned long) __entry->ino, __entry->pos,
		  __entry->len, __entry->mode)
1284 1285 1286
);

TRACE_EVENT(ext4_fallocate_exit,
L
Lukas Czerner 已提交
1287 1288
	TP_PROTO(struct inode *inode, loff_t offset,
		 unsigned int max_blocks, int ret),
1289 1290 1291 1292 1293

	TP_ARGS(inode, offset, max_blocks, ret),

	TP_STRUCT__entry(
		__field(	dev_t,	dev			)
1294
		__field(	ino_t,	ino			)
1295
		__field(	loff_t,	pos			)
L
Lukas Czerner 已提交
1296
		__field(	unsigned int,	blocks		)
1297 1298 1299 1300 1301
		__field(	int, 	ret			)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1302
		__entry->ino	= inode->i_ino;
1303 1304 1305 1306 1307
		__entry->pos	= offset;
		__entry->blocks	= max_blocks;
		__entry->ret	= ret;
	),

L
Lukas Czerner 已提交
1308
	TP_printk("dev %d,%d ino %lu pos %lld blocks %u ret %d",
1309 1310
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1311
		  __entry->pos, __entry->blocks,
1312 1313 1314 1315 1316 1317 1318 1319 1320
		  __entry->ret)
);

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

	TP_ARGS(parent, dentry),

	TP_STRUCT__entry(
1321
		__field(	dev_t,	dev			)
1322
		__field(	ino_t,	ino			)
1323
		__field(	ino_t,	parent			)
1324 1325 1326 1327
		__field(	loff_t,	size			)
	),

	TP_fast_assign(
1328
		__entry->dev		= dentry->d_inode->i_sb->s_dev;
1329
		__entry->ino		= dentry->d_inode->i_ino;
1330
		__entry->parent		= parent->i_ino;
1331 1332 1333
		__entry->size		= dentry->d_inode->i_size;
	),

L
Lukas Czerner 已提交
1334
	TP_printk("dev %d,%d ino %lu size %lld parent %lu",
1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346
		  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			)
1347
		__field(	ino_t,	ino			)
1348 1349 1350 1351 1352
		__field(	int,	ret			)
	),

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

L
Lukas Czerner 已提交
1357
	TP_printk("dev %d,%d ino %lu ret %d",
1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368
		  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(
1369 1370
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
L
Lukas Czerner 已提交
1371
		__field(	__u64,		blocks		)
1372 1373 1374 1375
	),

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

L
Lukas Czerner 已提交
1380
	TP_printk("dev %d,%d ino %lu blocks %llu",
1381
		  MAJOR(__entry->dev), MINOR(__entry->dev),
L
Lukas Czerner 已提交
1382
		  (unsigned long) __entry->ino, __entry->blocks)
1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398
);

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

1399 1400 1401 1402 1403 1404 1405 1406 1407
/* 'ux' is the uninitialized extent. */
TRACE_EVENT(ext4_ext_convert_to_initialized_enter,
	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map,
		 struct ext4_extent *ux),

	TP_ARGS(inode, map, ux),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
1408
		__field(	ino_t,		ino	)
1409 1410 1411 1412 1413 1414 1415 1416 1417
		__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;
1418
		__entry->ino		= inode->i_ino;
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445
		__entry->m_lblk		= map->m_lblk;
		__entry->m_len		= map->m_len;
		__entry->u_lblk		= le32_to_cpu(ux->ee_block);
		__entry->u_len		= ext4_ext_get_actual_len(ux);
		__entry->u_pblk		= ext4_ext_pblock(ux);
	),

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

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

	TP_ARGS(inode, map, ux, ix),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
1446
		__field(	ino_t,		ino	)
1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458
		__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;
1459
		__entry->ino		= inode->i_ino;
1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479
		__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)
);

1480 1481
DECLARE_EVENT_CLASS(ext4__map_blocks_enter,
	TP_PROTO(struct inode *inode, ext4_lblk_t lblk,
L
Lukas Czerner 已提交
1482
		 unsigned int len, unsigned int flags),
1483 1484 1485 1486

	TP_ARGS(inode, lblk, len, flags),

	TP_STRUCT__entry(
1487 1488
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
1489
		__field(	ext4_lblk_t,	lblk		)
L
Lukas Czerner 已提交
1490 1491
		__field(	unsigned int,	len		)
		__field(	unsigned int,	flags		)
1492 1493 1494 1495
	),

	TP_fast_assign(
		__entry->dev    = inode->i_sb->s_dev;
1496
		__entry->ino    = inode->i_ino;
1497 1498 1499 1500 1501 1502 1503 1504
		__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 已提交
1505
		  __entry->lblk, __entry->len, __entry->flags)
1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522
);

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,
1523
	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int ret),
1524

1525
	TP_ARGS(inode, map, ret),
1526 1527 1528

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
1529
		__field(	ino_t,		ino		)
1530
		__field(	ext4_fsblk_t,	pblk		)
1531
		__field(	ext4_lblk_t,	lblk		)
L
Lukas Czerner 已提交
1532
		__field(	unsigned int,	len		)
1533
		__field(	unsigned int,	flags		)
1534 1535 1536 1537 1538
		__field(	int,		ret		)
	),

	TP_fast_assign(
		__entry->dev    = inode->i_sb->s_dev;
1539
		__entry->ino    = inode->i_ino;
1540 1541 1542 1543
		__entry->pblk	= map->m_pblk;
		__entry->lblk	= map->m_lblk;
		__entry->len	= map->m_len;
		__entry->flags	= map->m_flags;
1544 1545 1546
		__entry->ret	= ret;
	),

1547
	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu len %u flags %x ret %d",
1548 1549
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1550
		  __entry->lblk, __entry->pblk,
1551
		  __entry->len, __entry->flags, __entry->ret)
1552 1553 1554
);

DEFINE_EVENT(ext4__map_blocks_exit, ext4_ext_map_blocks_exit,
1555
	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int ret),
1556

1557
	TP_ARGS(inode, map, ret)
1558 1559 1560
);

DEFINE_EVENT(ext4__map_blocks_exit, ext4_ind_map_blocks_exit,
1561
	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int ret),
1562

1563
	TP_ARGS(inode, map, ret)
1564 1565 1566 1567 1568 1569 1570 1571 1572
);

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		)
1573
		__field(	ino_t,		ino		)
1574
		__field(	ext4_fsblk_t,	pblk		)
1575
		__field(	ext4_lblk_t,	lblk		)
1576 1577 1578 1579
	),

	TP_fast_assign(
		__entry->dev    = inode->i_sb->s_dev;
1580
		__entry->ino    = inode->i_ino;
1581
		__entry->pblk	= pblk;
1582
		__entry->lblk	= lblk;
1583 1584 1585 1586 1587
	),

	TP_printk("dev %d,%d ino %lu lblk %u pblk %llu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
L
Lukas Czerner 已提交
1588
		  __entry->lblk, __entry->pblk)
1589 1590 1591 1592 1593 1594 1595 1596 1597
);

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

	TP_ARGS(inode),

	TP_STRUCT__entry(
		__field(	dev_t,	dev		)
1598
		__field(	ino_t,	ino		)
1599 1600 1601 1602
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
1603
		__entry->ino		= inode->i_ino;
1604 1605 1606 1607 1608 1609 1610
	),

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

1611 1612 1613 1614 1615 1616 1617 1618
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(unsigned long,	ip			)
1619
		__field(	int,	nblocks			)
1620 1621 1622 1623 1624
	),

	TP_fast_assign(
		__entry->dev	 = sb->s_dev;
		__entry->ip	 = IP;
1625
		__entry->nblocks = nblocks;
1626 1627 1628 1629 1630 1631 1632
	),

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

T
Tao Ma 已提交
1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681
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)
);

1682
TRACE_EVENT(ext4_ext_handle_uninitialized_extents,
1683
	TP_PROTO(struct inode *inode, struct ext4_map_blocks *map, int flags,
1684 1685
		 unsigned int allocated, ext4_fsblk_t newblock),

1686
	TP_ARGS(inode, map, flags, allocated, newblock),
1687 1688 1689

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
1690 1691
		__field(	ino_t,		ino		)
		__field(	int,		flags		)
1692 1693 1694 1695 1696 1697 1698 1699 1700
		__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;
1701
		__entry->ino		= inode->i_ino;
1702
		__entry->flags		= flags;
1703 1704 1705 1706 1707 1708 1709
		__entry->lblk		= map->m_lblk;
		__entry->pblk		= map->m_pblk;
		__entry->len		= map->m_len;
		__entry->allocated	= allocated;
		__entry->newblk		= newblock;
	),

1710
	TP_printk("dev %d,%d ino %lu m_lblk %u m_pblk %llu m_len %u flags %x "
1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726
		  "allocated %d newblock %llu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->lblk, (unsigned long long) __entry->pblk,
		  __entry->len, __entry->flags,
		  (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	)
1727
		__field(	unsigned int,	flags	)
1728 1729 1730 1731 1732 1733 1734 1735
		__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;
1736
		__entry->flags	= map->m_flags;
1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756
		__entry->lblk	= map->m_lblk;
		__entry->pblk	= map->m_pblk;
		__entry->len	= map->m_len;
		__entry->ret	= ret;
	),

	TP_printk("dev %d,%d m_lblk %u m_pblk %llu m_len %u m_flags %u ret %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->lblk, (unsigned long long) __entry->pblk,
		  __entry->len, __entry->flags, __entry->ret)
);

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	)
1757
		__field(	ino_t,		ino	)
1758 1759 1760 1761 1762 1763 1764
		__field(	ext4_lblk_t,	lblk	)
		__field(	unsigned int,	len	)
		__field(	ext4_fsblk_t,	start	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1765
		__entry->ino	= inode->i_ino;
1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785
		__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	)
1786
		__field(	ino_t,		ino	)
1787 1788 1789 1790 1791 1792
		__field(	ext4_lblk_t,	lblk	)
		__field(	int,		ret	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1793
		__entry->ino	= inode->i_ino;
1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813
		__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		)
1814
		__field(	ino_t,		ino		)
1815 1816 1817 1818 1819 1820 1821 1822 1823
		__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;
1824
		__entry->ino		= inode->i_ino;
1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847
		__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	)
1848
		__field(	ino_t,		ino	)
1849 1850 1851 1852 1853 1854
		__field(	ext4_lblk_t,	lblk	)
		__field(	unsigned int,	len	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1855
		__entry->ino	= inode->i_ino;
1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874
		__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	)
1875
		__field(	ino_t,		ino	)
1876
		__field(	ext4_fsblk_t,	pblk	)
1877
		__field(	ext4_lblk_t,	lblk	)
1878 1879 1880 1881 1882
		__field(	unsigned short,	len	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1883
		__entry->ino	= inode->i_ino;
1884
		__entry->pblk	= pblk;
1885
		__entry->lblk	= lblk;
1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905
		__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,
		ext4_fsblk_t partial_cluster),

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

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
1906
		__field(	ino_t,		ino	)
1907 1908 1909
		__field(	ext4_lblk_t,	from	)
		__field(	ext4_lblk_t,	to	)
		__field(	ext4_fsblk_t,	partial	)
1910 1911 1912
		__field(	ext4_fsblk_t,	ee_pblk	)
		__field(	ext4_lblk_t,	ee_lblk	)
		__field(	unsigned short,	ee_len	)
1913 1914 1915 1916
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
1917
		__entry->ino		= inode->i_ino;
1918 1919 1920
		__entry->from		= from;
		__entry->to		= to;
		__entry->partial	= partial_cluster;
1921 1922 1923
		__entry->ee_pblk	= ext4_ext_pblock(ex);
		__entry->ee_lblk	= cpu_to_le32(ex->ee_block);
		__entry->ee_len		= ext4_ext_get_actual_len(ex);
1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945
	),

	TP_printk("dev %d,%d ino %lu extent [%u(%llu), %u]"
		  "from %u to %u partial_cluster %u",
		  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,
		  (unsigned) __entry->partial)
);

TRACE_EVENT(ext4_ext_rm_leaf,
	TP_PROTO(struct inode *inode, ext4_lblk_t start,
		 struct ext4_extent *ex, ext4_fsblk_t partial_cluster),

	TP_ARGS(inode, start, ex, partial_cluster),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
1946 1947
		__field(	ino_t,		ino	)
		__field(	ext4_fsblk_t,	partial	)
1948 1949 1950 1951 1952 1953 1954 1955
		__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;
1956 1957
		__entry->ino		= inode->i_ino;
		__entry->partial	= partial_cluster;
1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981
		__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]"
		  "partial_cluster %u",
		  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,
		  (unsigned) __entry->partial)
);

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	)
1982
		__field(	ino_t,		ino	)
1983 1984 1985 1986 1987
		__field(	ext4_fsblk_t,	pblk	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
1988
		__entry->ino	= inode->i_ino;
1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004
		__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,
	TP_PROTO(struct inode *inode, ext4_lblk_t start, int depth),

	TP_ARGS(inode, start, depth),

	TP_STRUCT__entry(
		__field(	dev_t,		dev	)
2005
		__field(	ino_t,		ino	)
2006 2007 2008 2009 2010 2011
		__field(	ext4_lblk_t,	start	)
		__field(	int,		depth	)
	),

	TP_fast_assign(
		__entry->dev	= inode->i_sb->s_dev;
2012
		__entry->ino	= inode->i_ino;
2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031
		__entry->start	= start;
		__entry->depth	= depth;
	),

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

TRACE_EVENT(ext4_ext_remove_space_done,
	TP_PROTO(struct inode *inode, ext4_lblk_t start, int depth,
		ext4_lblk_t partial, unsigned short eh_entries),

	TP_ARGS(inode, start, depth, partial, eh_entries),

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
2032
		__field(	ino_t,		ino		)
2033 2034 2035 2036 2037 2038 2039 2040
		__field(	ext4_lblk_t,	start		)
		__field(	int,		depth		)
		__field(	ext4_lblk_t,	partial		)
		__field(	unsigned short,	eh_entries	)
	),

	TP_fast_assign(
		__entry->dev		= inode->i_sb->s_dev;
2041
		__entry->ino		= inode->i_ino;
2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057
		__entry->start		= start;
		__entry->depth		= depth;
		__entry->partial	= partial;
		__entry->eh_entries	= eh_entries;
	),

	TP_printk("dev %d,%d ino %lu since %u depth %d partial %u "
		  "remaining_entries %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  (unsigned) __entry->start,
		  __entry->depth,
		  (unsigned) __entry->partial,
		  (unsigned short) __entry->eh_entries)
);

2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157
TRACE_EVENT(ext4_es_insert_extent,
	TP_PROTO(struct inode *inode, ext4_lblk_t start, ext4_lblk_t len),

	TP_ARGS(inode, start, len),

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

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

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

TRACE_EVENT(ext4_es_remove_extent,
	TP_PROTO(struct inode *inode, ext4_lblk_t start, ext4_lblk_t len),

	TP_ARGS(inode, start, len),

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

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

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

TRACE_EVENT(ext4_es_find_extent_enter,
	TP_PROTO(struct inode *inode, ext4_lblk_t start),

	TP_ARGS(inode, start),

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

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

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

TRACE_EVENT(ext4_es_find_extent_exit,
	TP_PROTO(struct inode *inode, struct extent_status *es,
		 ext4_lblk_t ret),

	TP_ARGS(inode, es, ret),

	TP_STRUCT__entry(
		__field(	dev_t,		dev		)
		__field(	ino_t,		ino		)
		__field(	ext4_lblk_t,	start		)
		__field(	ext4_lblk_t,	len		)
		__field(	ext4_lblk_t,	ret		)
	),

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

	TP_printk("dev %d,%d ino %lu es [%u/%u) ret %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino,
		  __entry->start, __entry->len, __entry->ret)
);

2158 2159 2160 2161
#endif /* _TRACE_EXT4_H */

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