1 #undef TRACE_SYSTEM 2 #define TRACE_SYSTEM btrfs 3 4 #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ) 5 #define _TRACE_BTRFS_H 6 7 #include <linux/writeback.h> 8 #include <linux/tracepoint.h> 9 10 struct btrfs_root; 11 struct btrfs_fs_info; 12 struct btrfs_inode; 13 struct extent_map; 14 struct btrfs_ordered_extent; 15 struct btrfs_delayed_ref_node; 16 struct btrfs_delayed_tree_ref; 17 struct btrfs_delayed_data_ref; 18 struct btrfs_delayed_ref_head; 19 struct btrfs_block_group_cache; 20 struct btrfs_free_cluster; 21 struct map_lookup; 22 struct extent_buffer; 23 24 #define show_ref_type(type) \ 25 __print_symbolic(type, \ 26 { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ 27 { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ 28 { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ 29 { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ 30 { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) 31 32 #define __show_root_type(obj) \ 33 __print_symbolic_u64(obj, \ 34 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ 35 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ 36 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ 37 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ 38 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ 39 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ 40 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ 41 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ 42 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ 43 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) 44 45 #define show_root_type(obj) \ 46 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ 47 (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-" 48 49 #define BTRFS_GROUP_FLAGS \ 50 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ 51 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 52 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 53 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ 54 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ 55 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ 56 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"} 57 58 #define BTRFS_UUID_SIZE 16 59 60 TRACE_EVENT(btrfs_transaction_commit, 61 62 TP_PROTO(struct btrfs_root *root), 63 64 TP_ARGS(root), 65 66 TP_STRUCT__entry( 67 __field( u64, generation ) 68 __field( u64, root_objectid ) 69 ), 70 71 TP_fast_assign( 72 __entry->generation = root->fs_info->generation; 73 __entry->root_objectid = root->root_key.objectid; 74 ), 75 76 TP_printk("root = %llu(%s), gen = %llu", 77 show_root_type(__entry->root_objectid), 78 (unsigned long long)__entry->generation) 79 ); 80 81 DECLARE_EVENT_CLASS(btrfs__inode, 82 83 TP_PROTO(struct inode *inode), 84 85 TP_ARGS(inode), 86 87 TP_STRUCT__entry( 88 __field( ino_t, ino ) 89 __field( blkcnt_t, blocks ) 90 __field( u64, disk_i_size ) 91 __field( u64, generation ) 92 __field( u64, last_trans ) 93 __field( u64, logged_trans ) 94 __field( u64, root_objectid ) 95 ), 96 97 TP_fast_assign( 98 __entry->ino = inode->i_ino; 99 __entry->blocks = inode->i_blocks; 100 __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; 101 __entry->generation = BTRFS_I(inode)->generation; 102 __entry->last_trans = BTRFS_I(inode)->last_trans; 103 __entry->logged_trans = BTRFS_I(inode)->logged_trans; 104 __entry->root_objectid = 105 BTRFS_I(inode)->root->root_key.objectid; 106 ), 107 108 TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, " 109 "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu", 110 show_root_type(__entry->root_objectid), 111 (unsigned long long)__entry->generation, 112 (unsigned long)__entry->ino, 113 (unsigned long long)__entry->blocks, 114 (unsigned long long)__entry->disk_i_size, 115 (unsigned long long)__entry->last_trans, 116 (unsigned long long)__entry->logged_trans) 117 ); 118 119 DEFINE_EVENT(btrfs__inode, btrfs_inode_new, 120 121 TP_PROTO(struct inode *inode), 122 123 TP_ARGS(inode) 124 ); 125 126 DEFINE_EVENT(btrfs__inode, btrfs_inode_request, 127 128 TP_PROTO(struct inode *inode), 129 130 TP_ARGS(inode) 131 ); 132 133 DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, 134 135 TP_PROTO(struct inode *inode), 136 137 TP_ARGS(inode) 138 ); 139 140 #define __show_map_type(type) \ 141 __print_symbolic_u64(type, \ 142 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ 143 { EXTENT_MAP_HOLE, "HOLE" }, \ 144 { EXTENT_MAP_INLINE, "INLINE" }, \ 145 { EXTENT_MAP_DELALLOC, "DELALLOC" }) 146 147 #define show_map_type(type) \ 148 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) 149 150 #define show_map_flags(flag) \ 151 __print_flags(flag, "|", \ 152 { EXTENT_FLAG_PINNED, "PINNED" }, \ 153 { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \ 154 { EXTENT_FLAG_VACANCY, "VACANCY" }, \ 155 { EXTENT_FLAG_PREALLOC, "PREALLOC" }) 156 157 TRACE_EVENT(btrfs_get_extent, 158 159 TP_PROTO(struct btrfs_root *root, struct extent_map *map), 160 161 TP_ARGS(root, map), 162 163 TP_STRUCT__entry( 164 __field( u64, root_objectid ) 165 __field( u64, start ) 166 __field( u64, len ) 167 __field( u64, orig_start ) 168 __field( u64, block_start ) 169 __field( u64, block_len ) 170 __field( unsigned long, flags ) 171 __field( int, refs ) 172 __field( unsigned int, compress_type ) 173 ), 174 175 TP_fast_assign( 176 __entry->root_objectid = root->root_key.objectid; 177 __entry->start = map->start; 178 __entry->len = map->len; 179 __entry->orig_start = map->orig_start; 180 __entry->block_start = map->block_start; 181 __entry->block_len = map->block_len; 182 __entry->flags = map->flags; 183 __entry->refs = atomic_read(&map->refs); 184 __entry->compress_type = map->compress_type; 185 ), 186 187 TP_printk("root = %llu(%s), start = %llu, len = %llu, " 188 "orig_start = %llu, block_start = %llu(%s), " 189 "block_len = %llu, flags = %s, refs = %u, " 190 "compress_type = %u", 191 show_root_type(__entry->root_objectid), 192 (unsigned long long)__entry->start, 193 (unsigned long long)__entry->len, 194 (unsigned long long)__entry->orig_start, 195 show_map_type(__entry->block_start), 196 (unsigned long long)__entry->block_len, 197 show_map_flags(__entry->flags), 198 __entry->refs, __entry->compress_type) 199 ); 200 201 #define show_ordered_flags(flags) \ 202 __print_symbolic(flags, \ 203 { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \ 204 { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \ 205 { BTRFS_ORDERED_NOCOW, "NOCOW" }, \ 206 { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \ 207 { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \ 208 { BTRFS_ORDERED_DIRECT, "DIRECT" }) 209 210 DECLARE_EVENT_CLASS(btrfs__ordered_extent, 211 212 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 213 214 TP_ARGS(inode, ordered), 215 216 TP_STRUCT__entry( 217 __field( ino_t, ino ) 218 __field( u64, file_offset ) 219 __field( u64, start ) 220 __field( u64, len ) 221 __field( u64, disk_len ) 222 __field( u64, bytes_left ) 223 __field( unsigned long, flags ) 224 __field( int, compress_type ) 225 __field( int, refs ) 226 __field( u64, root_objectid ) 227 ), 228 229 TP_fast_assign( 230 __entry->ino = inode->i_ino; 231 __entry->file_offset = ordered->file_offset; 232 __entry->start = ordered->start; 233 __entry->len = ordered->len; 234 __entry->disk_len = ordered->disk_len; 235 __entry->bytes_left = ordered->bytes_left; 236 __entry->flags = ordered->flags; 237 __entry->compress_type = ordered->compress_type; 238 __entry->refs = atomic_read(&ordered->refs); 239 __entry->root_objectid = 240 BTRFS_I(inode)->root->root_key.objectid; 241 ), 242 243 TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, " 244 "start = %llu, len = %llu, disk_len = %llu, " 245 "bytes_left = %llu, flags = %s, compress_type = %d, " 246 "refs = %d", 247 show_root_type(__entry->root_objectid), 248 (unsigned long long)__entry->ino, 249 (unsigned long long)__entry->file_offset, 250 (unsigned long long)__entry->start, 251 (unsigned long long)__entry->len, 252 (unsigned long long)__entry->disk_len, 253 (unsigned long long)__entry->bytes_left, 254 show_ordered_flags(__entry->flags), 255 __entry->compress_type, __entry->refs) 256 ); 257 258 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, 259 260 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 261 262 TP_ARGS(inode, ordered) 263 ); 264 265 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, 266 267 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 268 269 TP_ARGS(inode, ordered) 270 ); 271 272 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, 273 274 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 275 276 TP_ARGS(inode, ordered) 277 ); 278 279 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, 280 281 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 282 283 TP_ARGS(inode, ordered) 284 ); 285 286 DECLARE_EVENT_CLASS(btrfs__writepage, 287 288 TP_PROTO(struct page *page, struct inode *inode, 289 struct writeback_control *wbc), 290 291 TP_ARGS(page, inode, wbc), 292 293 TP_STRUCT__entry( 294 __field( ino_t, ino ) 295 __field( pgoff_t, index ) 296 __field( long, nr_to_write ) 297 __field( long, pages_skipped ) 298 __field( loff_t, range_start ) 299 __field( loff_t, range_end ) 300 __field( char, for_kupdate ) 301 __field( char, for_reclaim ) 302 __field( char, range_cyclic ) 303 __field( pgoff_t, writeback_index ) 304 __field( u64, root_objectid ) 305 ), 306 307 TP_fast_assign( 308 __entry->ino = inode->i_ino; 309 __entry->index = page->index; 310 __entry->nr_to_write = wbc->nr_to_write; 311 __entry->pages_skipped = wbc->pages_skipped; 312 __entry->range_start = wbc->range_start; 313 __entry->range_end = wbc->range_end; 314 __entry->for_kupdate = wbc->for_kupdate; 315 __entry->for_reclaim = wbc->for_reclaim; 316 __entry->range_cyclic = wbc->range_cyclic; 317 __entry->writeback_index = inode->i_mapping->writeback_index; 318 __entry->root_objectid = 319 BTRFS_I(inode)->root->root_key.objectid; 320 ), 321 322 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, " 323 "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, " 324 "range_end = %llu, for_kupdate = %d, " 325 "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu", 326 show_root_type(__entry->root_objectid), 327 (unsigned long)__entry->ino, __entry->index, 328 __entry->nr_to_write, __entry->pages_skipped, 329 __entry->range_start, __entry->range_end, 330 __entry->for_kupdate, 331 __entry->for_reclaim, __entry->range_cyclic, 332 (unsigned long)__entry->writeback_index) 333 ); 334 335 DEFINE_EVENT(btrfs__writepage, __extent_writepage, 336 337 TP_PROTO(struct page *page, struct inode *inode, 338 struct writeback_control *wbc), 339 340 TP_ARGS(page, inode, wbc) 341 ); 342 343 TRACE_EVENT(btrfs_writepage_end_io_hook, 344 345 TP_PROTO(struct page *page, u64 start, u64 end, int uptodate), 346 347 TP_ARGS(page, start, end, uptodate), 348 349 TP_STRUCT__entry( 350 __field( ino_t, ino ) 351 __field( pgoff_t, index ) 352 __field( u64, start ) 353 __field( u64, end ) 354 __field( int, uptodate ) 355 __field( u64, root_objectid ) 356 ), 357 358 TP_fast_assign( 359 __entry->ino = page->mapping->host->i_ino; 360 __entry->index = page->index; 361 __entry->start = start; 362 __entry->end = end; 363 __entry->uptodate = uptodate; 364 __entry->root_objectid = 365 BTRFS_I(page->mapping->host)->root->root_key.objectid; 366 ), 367 368 TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, " 369 "end = %llu, uptodate = %d", 370 show_root_type(__entry->root_objectid), 371 (unsigned long)__entry->ino, (unsigned long)__entry->index, 372 (unsigned long long)__entry->start, 373 (unsigned long long)__entry->end, __entry->uptodate) 374 ); 375 376 TRACE_EVENT(btrfs_sync_file, 377 378 TP_PROTO(struct file *file, int datasync), 379 380 TP_ARGS(file, datasync), 381 382 TP_STRUCT__entry( 383 __field( ino_t, ino ) 384 __field( ino_t, parent ) 385 __field( int, datasync ) 386 __field( u64, root_objectid ) 387 ), 388 389 TP_fast_assign( 390 struct dentry *dentry = file->f_path.dentry; 391 struct inode *inode = dentry->d_inode; 392 393 __entry->ino = inode->i_ino; 394 __entry->parent = dentry->d_parent->d_inode->i_ino; 395 __entry->datasync = datasync; 396 __entry->root_objectid = 397 BTRFS_I(inode)->root->root_key.objectid; 398 ), 399 400 TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d", 401 show_root_type(__entry->root_objectid), 402 (unsigned long)__entry->ino, (unsigned long)__entry->parent, 403 __entry->datasync) 404 ); 405 406 TRACE_EVENT(btrfs_sync_fs, 407 408 TP_PROTO(int wait), 409 410 TP_ARGS(wait), 411 412 TP_STRUCT__entry( 413 __field( int, wait ) 414 ), 415 416 TP_fast_assign( 417 __entry->wait = wait; 418 ), 419 420 TP_printk("wait = %d", __entry->wait) 421 ); 422 423 #define show_ref_action(action) \ 424 __print_symbolic(action, \ 425 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ 426 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ 427 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ 428 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) 429 430 431 TRACE_EVENT(btrfs_delayed_tree_ref, 432 433 TP_PROTO(struct btrfs_delayed_ref_node *ref, 434 struct btrfs_delayed_tree_ref *full_ref, 435 int action), 436 437 TP_ARGS(ref, full_ref, action), 438 439 TP_STRUCT__entry( 440 __field( u64, bytenr ) 441 __field( u64, num_bytes ) 442 __field( int, action ) 443 __field( u64, parent ) 444 __field( u64, ref_root ) 445 __field( int, level ) 446 __field( int, type ) 447 ), 448 449 TP_fast_assign( 450 __entry->bytenr = ref->bytenr; 451 __entry->num_bytes = ref->num_bytes; 452 __entry->action = action; 453 __entry->parent = full_ref->parent; 454 __entry->ref_root = full_ref->root; 455 __entry->level = full_ref->level; 456 __entry->type = ref->type; 457 ), 458 459 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " 460 "parent = %llu(%s), ref_root = %llu(%s), level = %d, " 461 "type = %s", 462 (unsigned long long)__entry->bytenr, 463 (unsigned long long)__entry->num_bytes, 464 show_ref_action(__entry->action), 465 show_root_type(__entry->parent), 466 show_root_type(__entry->ref_root), 467 __entry->level, show_ref_type(__entry->type)) 468 ); 469 470 TRACE_EVENT(btrfs_delayed_data_ref, 471 472 TP_PROTO(struct btrfs_delayed_ref_node *ref, 473 struct btrfs_delayed_data_ref *full_ref, 474 int action), 475 476 TP_ARGS(ref, full_ref, action), 477 478 TP_STRUCT__entry( 479 __field( u64, bytenr ) 480 __field( u64, num_bytes ) 481 __field( int, action ) 482 __field( u64, parent ) 483 __field( u64, ref_root ) 484 __field( u64, owner ) 485 __field( u64, offset ) 486 __field( int, type ) 487 ), 488 489 TP_fast_assign( 490 __entry->bytenr = ref->bytenr; 491 __entry->num_bytes = ref->num_bytes; 492 __entry->action = action; 493 __entry->parent = full_ref->parent; 494 __entry->ref_root = full_ref->root; 495 __entry->owner = full_ref->objectid; 496 __entry->offset = full_ref->offset; 497 __entry->type = ref->type; 498 ), 499 500 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " 501 "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, " 502 "offset = %llu, type = %s", 503 (unsigned long long)__entry->bytenr, 504 (unsigned long long)__entry->num_bytes, 505 show_ref_action(__entry->action), 506 show_root_type(__entry->parent), 507 show_root_type(__entry->ref_root), 508 (unsigned long long)__entry->owner, 509 (unsigned long long)__entry->offset, 510 show_ref_type(__entry->type)) 511 ); 512 513 TRACE_EVENT(btrfs_delayed_ref_head, 514 515 TP_PROTO(struct btrfs_delayed_ref_node *ref, 516 struct btrfs_delayed_ref_head *head_ref, 517 int action), 518 519 TP_ARGS(ref, head_ref, action), 520 521 TP_STRUCT__entry( 522 __field( u64, bytenr ) 523 __field( u64, num_bytes ) 524 __field( int, action ) 525 __field( int, is_data ) 526 ), 527 528 TP_fast_assign( 529 __entry->bytenr = ref->bytenr; 530 __entry->num_bytes = ref->num_bytes; 531 __entry->action = action; 532 __entry->is_data = head_ref->is_data; 533 ), 534 535 TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d", 536 (unsigned long long)__entry->bytenr, 537 (unsigned long long)__entry->num_bytes, 538 show_ref_action(__entry->action), 539 __entry->is_data) 540 ); 541 542 #define show_chunk_type(type) \ 543 __print_flags(type, "|", \ 544 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ 545 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 546 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 547 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ 548 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ 549 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ 550 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}) 551 552 DECLARE_EVENT_CLASS(btrfs__chunk, 553 554 TP_PROTO(struct btrfs_root *root, struct map_lookup *map, 555 u64 offset, u64 size), 556 557 TP_ARGS(root, map, offset, size), 558 559 TP_STRUCT__entry( 560 __field( int, num_stripes ) 561 __field( u64, type ) 562 __field( int, sub_stripes ) 563 __field( u64, offset ) 564 __field( u64, size ) 565 __field( u64, root_objectid ) 566 ), 567 568 TP_fast_assign( 569 __entry->num_stripes = map->num_stripes; 570 __entry->type = map->type; 571 __entry->sub_stripes = map->sub_stripes; 572 __entry->offset = offset; 573 __entry->size = size; 574 __entry->root_objectid = root->root_key.objectid; 575 ), 576 577 TP_printk("root = %llu(%s), offset = %llu, size = %llu, " 578 "num_stripes = %d, sub_stripes = %d, type = %s", 579 show_root_type(__entry->root_objectid), 580 (unsigned long long)__entry->offset, 581 (unsigned long long)__entry->size, 582 __entry->num_stripes, __entry->sub_stripes, 583 show_chunk_type(__entry->type)) 584 ); 585 586 DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, 587 588 TP_PROTO(struct btrfs_root *root, struct map_lookup *map, 589 u64 offset, u64 size), 590 591 TP_ARGS(root, map, offset, size) 592 ); 593 594 DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, 595 596 TP_PROTO(struct btrfs_root *root, struct map_lookup *map, 597 u64 offset, u64 size), 598 599 TP_ARGS(root, map, offset, size) 600 ); 601 602 TRACE_EVENT(btrfs_cow_block, 603 604 TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf, 605 struct extent_buffer *cow), 606 607 TP_ARGS(root, buf, cow), 608 609 TP_STRUCT__entry( 610 __field( u64, root_objectid ) 611 __field( u64, buf_start ) 612 __field( int, refs ) 613 __field( u64, cow_start ) 614 __field( int, buf_level ) 615 __field( int, cow_level ) 616 ), 617 618 TP_fast_assign( 619 __entry->root_objectid = root->root_key.objectid; 620 __entry->buf_start = buf->start; 621 __entry->refs = atomic_read(&buf->refs); 622 __entry->cow_start = cow->start; 623 __entry->buf_level = btrfs_header_level(buf); 624 __entry->cow_level = btrfs_header_level(cow); 625 ), 626 627 TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu " 628 "(orig_level = %d), cow_buf = %llu (cow_level = %d)", 629 show_root_type(__entry->root_objectid), 630 __entry->refs, 631 (unsigned long long)__entry->buf_start, 632 __entry->buf_level, 633 (unsigned long long)__entry->cow_start, 634 __entry->cow_level) 635 ); 636 637 TRACE_EVENT(btrfs_space_reservation, 638 639 TP_PROTO(struct btrfs_fs_info *fs_info, char *type, u64 val, 640 u64 bytes, int reserve), 641 642 TP_ARGS(fs_info, type, val, bytes, reserve), 643 644 TP_STRUCT__entry( 645 __array( u8, fsid, BTRFS_UUID_SIZE ) 646 __string( type, type ) 647 __field( u64, val ) 648 __field( u64, bytes ) 649 __field( int, reserve ) 650 ), 651 652 TP_fast_assign( 653 memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE); 654 __assign_str(type, type); 655 __entry->val = val; 656 __entry->bytes = bytes; 657 __entry->reserve = reserve; 658 ), 659 660 TP_printk("%pU: %s: %Lu %s %Lu", __entry->fsid, __get_str(type), 661 __entry->val, __entry->reserve ? "reserve" : "release", 662 __entry->bytes) 663 ); 664 665 DECLARE_EVENT_CLASS(btrfs__reserved_extent, 666 667 TP_PROTO(struct btrfs_root *root, u64 start, u64 len), 668 669 TP_ARGS(root, start, len), 670 671 TP_STRUCT__entry( 672 __field( u64, root_objectid ) 673 __field( u64, start ) 674 __field( u64, len ) 675 ), 676 677 TP_fast_assign( 678 __entry->root_objectid = root->root_key.objectid; 679 __entry->start = start; 680 __entry->len = len; 681 ), 682 683 TP_printk("root = %llu(%s), start = %llu, len = %llu", 684 show_root_type(__entry->root_objectid), 685 (unsigned long long)__entry->start, 686 (unsigned long long)__entry->len) 687 ); 688 689 DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, 690 691 TP_PROTO(struct btrfs_root *root, u64 start, u64 len), 692 693 TP_ARGS(root, start, len) 694 ); 695 696 DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, 697 698 TP_PROTO(struct btrfs_root *root, u64 start, u64 len), 699 700 TP_ARGS(root, start, len) 701 ); 702 703 TRACE_EVENT(find_free_extent, 704 705 TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size, 706 u64 data), 707 708 TP_ARGS(root, num_bytes, empty_size, data), 709 710 TP_STRUCT__entry( 711 __field( u64, root_objectid ) 712 __field( u64, num_bytes ) 713 __field( u64, empty_size ) 714 __field( u64, data ) 715 ), 716 717 TP_fast_assign( 718 __entry->root_objectid = root->root_key.objectid; 719 __entry->num_bytes = num_bytes; 720 __entry->empty_size = empty_size; 721 __entry->data = data; 722 ), 723 724 TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, " 725 "flags = %Lu(%s)", show_root_type(__entry->root_objectid), 726 __entry->num_bytes, __entry->empty_size, __entry->data, 727 __print_flags((unsigned long)__entry->data, "|", 728 BTRFS_GROUP_FLAGS)) 729 ); 730 731 DECLARE_EVENT_CLASS(btrfs__reserve_extent, 732 733 TP_PROTO(struct btrfs_root *root, 734 struct btrfs_block_group_cache *block_group, u64 start, 735 u64 len), 736 737 TP_ARGS(root, block_group, start, len), 738 739 TP_STRUCT__entry( 740 __field( u64, root_objectid ) 741 __field( u64, bg_objectid ) 742 __field( u64, flags ) 743 __field( u64, start ) 744 __field( u64, len ) 745 ), 746 747 TP_fast_assign( 748 __entry->root_objectid = root->root_key.objectid; 749 __entry->bg_objectid = block_group->key.objectid; 750 __entry->flags = block_group->flags; 751 __entry->start = start; 752 __entry->len = len; 753 ), 754 755 TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), " 756 "start = %Lu, len = %Lu", 757 show_root_type(__entry->root_objectid), __entry->bg_objectid, 758 __entry->flags, __print_flags((unsigned long)__entry->flags, 759 "|", BTRFS_GROUP_FLAGS), 760 __entry->start, __entry->len) 761 ); 762 763 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, 764 765 TP_PROTO(struct btrfs_root *root, 766 struct btrfs_block_group_cache *block_group, u64 start, 767 u64 len), 768 769 TP_ARGS(root, block_group, start, len) 770 ); 771 772 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, 773 774 TP_PROTO(struct btrfs_root *root, 775 struct btrfs_block_group_cache *block_group, u64 start, 776 u64 len), 777 778 TP_ARGS(root, block_group, start, len) 779 ); 780 781 TRACE_EVENT(btrfs_find_cluster, 782 783 TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start, 784 u64 bytes, u64 empty_size, u64 min_bytes), 785 786 TP_ARGS(block_group, start, bytes, empty_size, min_bytes), 787 788 TP_STRUCT__entry( 789 __field( u64, bg_objectid ) 790 __field( u64, flags ) 791 __field( u64, start ) 792 __field( u64, bytes ) 793 __field( u64, empty_size ) 794 __field( u64, min_bytes ) 795 ), 796 797 TP_fast_assign( 798 __entry->bg_objectid = block_group->key.objectid; 799 __entry->flags = block_group->flags; 800 __entry->start = start; 801 __entry->bytes = bytes; 802 __entry->empty_size = empty_size; 803 __entry->min_bytes = min_bytes; 804 ), 805 806 TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu," 807 " empty_size = %Lu, min_bytes = %Lu", __entry->bg_objectid, 808 __entry->flags, 809 __print_flags((unsigned long)__entry->flags, "|", 810 BTRFS_GROUP_FLAGS), __entry->start, 811 __entry->bytes, __entry->empty_size, __entry->min_bytes) 812 ); 813 814 TRACE_EVENT(btrfs_failed_cluster_setup, 815 816 TP_PROTO(struct btrfs_block_group_cache *block_group), 817 818 TP_ARGS(block_group), 819 820 TP_STRUCT__entry( 821 __field( u64, bg_objectid ) 822 ), 823 824 TP_fast_assign( 825 __entry->bg_objectid = block_group->key.objectid; 826 ), 827 828 TP_printk("block_group = %Lu", __entry->bg_objectid) 829 ); 830 831 TRACE_EVENT(btrfs_setup_cluster, 832 833 TP_PROTO(struct btrfs_block_group_cache *block_group, 834 struct btrfs_free_cluster *cluster, u64 size, int bitmap), 835 836 TP_ARGS(block_group, cluster, size, bitmap), 837 838 TP_STRUCT__entry( 839 __field( u64, bg_objectid ) 840 __field( u64, flags ) 841 __field( u64, start ) 842 __field( u64, max_size ) 843 __field( u64, size ) 844 __field( int, bitmap ) 845 ), 846 847 TP_fast_assign( 848 __entry->bg_objectid = block_group->key.objectid; 849 __entry->flags = block_group->flags; 850 __entry->start = cluster->window_start; 851 __entry->max_size = cluster->max_size; 852 __entry->size = size; 853 __entry->bitmap = bitmap; 854 ), 855 856 TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, " 857 "size = %Lu, max_size = %Lu, bitmap = %d", 858 __entry->bg_objectid, 859 __entry->flags, 860 __print_flags((unsigned long)__entry->flags, "|", 861 BTRFS_GROUP_FLAGS), __entry->start, 862 __entry->size, __entry->max_size, __entry->bitmap) 863 ); 864 865 #endif /* _TRACE_BTRFS_H */ 866 867 /* This part must be outside protection */ 868 #include <trace/define_trace.h> 869