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 #include <trace/events/mmflags.h> 10 11 struct btrfs_root; 12 struct btrfs_fs_info; 13 struct btrfs_inode; 14 struct extent_map; 15 struct btrfs_ordered_extent; 16 struct btrfs_delayed_ref_node; 17 struct btrfs_delayed_tree_ref; 18 struct btrfs_delayed_data_ref; 19 struct btrfs_delayed_ref_head; 20 struct btrfs_block_group_cache; 21 struct btrfs_free_cluster; 22 struct map_lookup; 23 struct extent_buffer; 24 struct btrfs_work; 25 struct __btrfs_workqueue; 26 struct btrfs_qgroup_extent_record; 27 28 #define show_ref_type(type) \ 29 __print_symbolic(type, \ 30 { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ 31 { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ 32 { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ 33 { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ 34 { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) 35 36 #define __show_root_type(obj) \ 37 __print_symbolic_u64(obj, \ 38 { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ 39 { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ 40 { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ 41 { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ 42 { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ 43 { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ 44 { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ 45 { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ 46 { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ 47 { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ 48 { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \ 49 { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \ 50 { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) 51 52 #define show_root_type(obj) \ 53 obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ 54 (obj >= BTRFS_ROOT_TREE_OBJECTID && \ 55 obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" 56 57 #define BTRFS_GROUP_FLAGS \ 58 { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ 59 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 60 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 61 { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ 62 { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ 63 { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ 64 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 65 { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ 66 { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} 67 68 #define BTRFS_UUID_SIZE 16 69 #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_UUID_SIZE) 70 71 #define TP_fast_assign_fsid(fs_info) \ 72 memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE) 73 74 #define TP_STRUCT__entry_btrfs(args...) \ 75 TP_STRUCT__entry( \ 76 TP_STRUCT__entry_fsid \ 77 args) 78 #define TP_fast_assign_btrfs(fs_info, args...) \ 79 TP_fast_assign( \ 80 TP_fast_assign_fsid(fs_info); \ 81 args) 82 #define TP_printk_btrfs(fmt, args...) \ 83 TP_printk("%pU: " fmt, __entry->fsid, args) 84 85 TRACE_EVENT(btrfs_transaction_commit, 86 87 TP_PROTO(struct btrfs_root *root), 88 89 TP_ARGS(root), 90 91 TP_STRUCT__entry_btrfs( 92 __field( u64, generation ) 93 __field( u64, root_objectid ) 94 ), 95 96 TP_fast_assign_btrfs(root->fs_info, 97 __entry->generation = root->fs_info->generation; 98 __entry->root_objectid = root->root_key.objectid; 99 ), 100 101 TP_printk_btrfs("root = %llu(%s), gen = %llu", 102 show_root_type(__entry->root_objectid), 103 (unsigned long long)__entry->generation) 104 ); 105 106 DECLARE_EVENT_CLASS(btrfs__inode, 107 108 TP_PROTO(struct inode *inode), 109 110 TP_ARGS(inode), 111 112 TP_STRUCT__entry_btrfs( 113 __field( ino_t, ino ) 114 __field( blkcnt_t, blocks ) 115 __field( u64, disk_i_size ) 116 __field( u64, generation ) 117 __field( u64, last_trans ) 118 __field( u64, logged_trans ) 119 __field( u64, root_objectid ) 120 ), 121 122 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 123 __entry->ino = inode->i_ino; 124 __entry->blocks = inode->i_blocks; 125 __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; 126 __entry->generation = BTRFS_I(inode)->generation; 127 __entry->last_trans = BTRFS_I(inode)->last_trans; 128 __entry->logged_trans = BTRFS_I(inode)->logged_trans; 129 __entry->root_objectid = 130 BTRFS_I(inode)->root->root_key.objectid; 131 ), 132 133 TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%lu blocks=%llu " 134 "disk_i_size=%llu last_trans=%llu logged_trans=%llu", 135 show_root_type(__entry->root_objectid), 136 (unsigned long long)__entry->generation, 137 (unsigned long)__entry->ino, 138 (unsigned long long)__entry->blocks, 139 (unsigned long long)__entry->disk_i_size, 140 (unsigned long long)__entry->last_trans, 141 (unsigned long long)__entry->logged_trans) 142 ); 143 144 DEFINE_EVENT(btrfs__inode, btrfs_inode_new, 145 146 TP_PROTO(struct inode *inode), 147 148 TP_ARGS(inode) 149 ); 150 151 DEFINE_EVENT(btrfs__inode, btrfs_inode_request, 152 153 TP_PROTO(struct inode *inode), 154 155 TP_ARGS(inode) 156 ); 157 158 DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, 159 160 TP_PROTO(struct inode *inode), 161 162 TP_ARGS(inode) 163 ); 164 165 #define __show_map_type(type) \ 166 __print_symbolic_u64(type, \ 167 { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ 168 { EXTENT_MAP_HOLE, "HOLE" }, \ 169 { EXTENT_MAP_INLINE, "INLINE" }, \ 170 { EXTENT_MAP_DELALLOC, "DELALLOC" }) 171 172 #define show_map_type(type) \ 173 type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) 174 175 #define show_map_flags(flag) \ 176 __print_flags(flag, "|", \ 177 { (1 << EXTENT_FLAG_PINNED), "PINNED" },\ 178 { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\ 179 { (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\ 180 { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\ 181 { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\ 182 { (1 << EXTENT_FLAG_FILLING), "FILLING" },\ 183 { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" }) 184 185 TRACE_EVENT_CONDITION(btrfs_get_extent, 186 187 TP_PROTO(struct btrfs_root *root, struct btrfs_inode *inode, 188 struct extent_map *map), 189 190 TP_ARGS(root, inode, map), 191 192 TP_CONDITION(map), 193 194 TP_STRUCT__entry_btrfs( 195 __field( u64, root_objectid ) 196 __field( u64, ino ) 197 __field( u64, start ) 198 __field( u64, len ) 199 __field( u64, orig_start ) 200 __field( u64, block_start ) 201 __field( u64, block_len ) 202 __field( unsigned long, flags ) 203 __field( int, refs ) 204 __field( unsigned int, compress_type ) 205 ), 206 207 TP_fast_assign_btrfs(root->fs_info, 208 __entry->root_objectid = root->root_key.objectid; 209 __entry->ino = btrfs_ino(inode); 210 __entry->start = map->start; 211 __entry->len = map->len; 212 __entry->orig_start = map->orig_start; 213 __entry->block_start = map->block_start; 214 __entry->block_len = map->block_len; 215 __entry->flags = map->flags; 216 __entry->refs = atomic_read(&map->refs); 217 __entry->compress_type = map->compress_type; 218 ), 219 220 TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu " 221 "orig_start=%llu block_start=%llu(%s) " 222 "block_len=%llu flags=%s refs=%u " 223 "compress_type=%u", 224 show_root_type(__entry->root_objectid), 225 (unsigned long long)__entry->ino, 226 (unsigned long long)__entry->start, 227 (unsigned long long)__entry->len, 228 (unsigned long long)__entry->orig_start, 229 show_map_type(__entry->block_start), 230 (unsigned long long)__entry->block_len, 231 show_map_flags(__entry->flags), 232 __entry->refs, __entry->compress_type) 233 ); 234 235 #define show_ordered_flags(flags) \ 236 __print_flags(flags, "|", \ 237 { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ 238 { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ 239 { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ 240 { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ 241 { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ 242 { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ 243 { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ 244 { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \ 245 { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \ 246 { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) 247 248 249 DECLARE_EVENT_CLASS(btrfs__ordered_extent, 250 251 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 252 253 TP_ARGS(inode, ordered), 254 255 TP_STRUCT__entry_btrfs( 256 __field( ino_t, ino ) 257 __field( u64, file_offset ) 258 __field( u64, start ) 259 __field( u64, len ) 260 __field( u64, disk_len ) 261 __field( u64, bytes_left ) 262 __field( unsigned long, flags ) 263 __field( int, compress_type ) 264 __field( int, refs ) 265 __field( u64, root_objectid ) 266 __field( u64, truncated_len ) 267 ), 268 269 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 270 __entry->ino = inode->i_ino; 271 __entry->file_offset = ordered->file_offset; 272 __entry->start = ordered->start; 273 __entry->len = ordered->len; 274 __entry->disk_len = ordered->disk_len; 275 __entry->bytes_left = ordered->bytes_left; 276 __entry->flags = ordered->flags; 277 __entry->compress_type = ordered->compress_type; 278 __entry->refs = atomic_read(&ordered->refs); 279 __entry->root_objectid = 280 BTRFS_I(inode)->root->root_key.objectid; 281 __entry->truncated_len = ordered->truncated_len; 282 ), 283 284 TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu " 285 "start=%llu len=%llu disk_len=%llu " 286 "truncated_len=%llu " 287 "bytes_left=%llu flags=%s compress_type=%d " 288 "refs=%d", 289 show_root_type(__entry->root_objectid), 290 (unsigned long long)__entry->ino, 291 (unsigned long long)__entry->file_offset, 292 (unsigned long long)__entry->start, 293 (unsigned long long)__entry->len, 294 (unsigned long long)__entry->disk_len, 295 (unsigned long long)__entry->truncated_len, 296 (unsigned long long)__entry->bytes_left, 297 show_ordered_flags(__entry->flags), 298 __entry->compress_type, __entry->refs) 299 ); 300 301 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, 302 303 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 304 305 TP_ARGS(inode, ordered) 306 ); 307 308 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, 309 310 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 311 312 TP_ARGS(inode, ordered) 313 ); 314 315 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, 316 317 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 318 319 TP_ARGS(inode, ordered) 320 ); 321 322 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, 323 324 TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 325 326 TP_ARGS(inode, ordered) 327 ); 328 329 DECLARE_EVENT_CLASS(btrfs__writepage, 330 331 TP_PROTO(struct page *page, struct inode *inode, 332 struct writeback_control *wbc), 333 334 TP_ARGS(page, inode, wbc), 335 336 TP_STRUCT__entry_btrfs( 337 __field( ino_t, ino ) 338 __field( pgoff_t, index ) 339 __field( long, nr_to_write ) 340 __field( long, pages_skipped ) 341 __field( loff_t, range_start ) 342 __field( loff_t, range_end ) 343 __field( char, for_kupdate ) 344 __field( char, for_reclaim ) 345 __field( char, range_cyclic ) 346 __field( pgoff_t, writeback_index ) 347 __field( u64, root_objectid ) 348 ), 349 350 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 351 __entry->ino = inode->i_ino; 352 __entry->index = page->index; 353 __entry->nr_to_write = wbc->nr_to_write; 354 __entry->pages_skipped = wbc->pages_skipped; 355 __entry->range_start = wbc->range_start; 356 __entry->range_end = wbc->range_end; 357 __entry->for_kupdate = wbc->for_kupdate; 358 __entry->for_reclaim = wbc->for_reclaim; 359 __entry->range_cyclic = wbc->range_cyclic; 360 __entry->writeback_index = inode->i_mapping->writeback_index; 361 __entry->root_objectid = 362 BTRFS_I(inode)->root->root_key.objectid; 363 ), 364 365 TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu " 366 "nr_to_write=%ld pages_skipped=%ld range_start=%llu " 367 "range_end=%llu for_kupdate=%d " 368 "for_reclaim=%d range_cyclic=%d writeback_index=%lu", 369 show_root_type(__entry->root_objectid), 370 (unsigned long)__entry->ino, __entry->index, 371 __entry->nr_to_write, __entry->pages_skipped, 372 __entry->range_start, __entry->range_end, 373 __entry->for_kupdate, 374 __entry->for_reclaim, __entry->range_cyclic, 375 (unsigned long)__entry->writeback_index) 376 ); 377 378 DEFINE_EVENT(btrfs__writepage, __extent_writepage, 379 380 TP_PROTO(struct page *page, struct inode *inode, 381 struct writeback_control *wbc), 382 383 TP_ARGS(page, inode, wbc) 384 ); 385 386 TRACE_EVENT(btrfs_writepage_end_io_hook, 387 388 TP_PROTO(struct page *page, u64 start, u64 end, int uptodate), 389 390 TP_ARGS(page, start, end, uptodate), 391 392 TP_STRUCT__entry_btrfs( 393 __field( ino_t, ino ) 394 __field( pgoff_t, index ) 395 __field( u64, start ) 396 __field( u64, end ) 397 __field( int, uptodate ) 398 __field( u64, root_objectid ) 399 ), 400 401 TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb), 402 __entry->ino = page->mapping->host->i_ino; 403 __entry->index = page->index; 404 __entry->start = start; 405 __entry->end = end; 406 __entry->uptodate = uptodate; 407 __entry->root_objectid = 408 BTRFS_I(page->mapping->host)->root->root_key.objectid; 409 ), 410 411 TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu start=%llu " 412 "end=%llu uptodate=%d", 413 show_root_type(__entry->root_objectid), 414 (unsigned long)__entry->ino, (unsigned long)__entry->index, 415 (unsigned long long)__entry->start, 416 (unsigned long long)__entry->end, __entry->uptodate) 417 ); 418 419 TRACE_EVENT(btrfs_sync_file, 420 421 TP_PROTO(struct file *file, int datasync), 422 423 TP_ARGS(file, datasync), 424 425 TP_STRUCT__entry_btrfs( 426 __field( ino_t, ino ) 427 __field( ino_t, parent ) 428 __field( int, datasync ) 429 __field( u64, root_objectid ) 430 ), 431 432 TP_fast_assign( 433 struct dentry *dentry = file->f_path.dentry; 434 struct inode *inode = d_inode(dentry); 435 436 TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb)); 437 __entry->ino = inode->i_ino; 438 __entry->parent = d_inode(dentry->d_parent)->i_ino; 439 __entry->datasync = datasync; 440 __entry->root_objectid = 441 BTRFS_I(inode)->root->root_key.objectid; 442 ), 443 444 TP_printk_btrfs("root=%llu(%s) ino=%ld parent=%ld datasync=%d", 445 show_root_type(__entry->root_objectid), 446 (unsigned long)__entry->ino, (unsigned long)__entry->parent, 447 __entry->datasync) 448 ); 449 450 TRACE_EVENT(btrfs_sync_fs, 451 452 TP_PROTO(struct btrfs_fs_info *fs_info, int wait), 453 454 TP_ARGS(fs_info, wait), 455 456 TP_STRUCT__entry_btrfs( 457 __field( int, wait ) 458 ), 459 460 TP_fast_assign_btrfs(fs_info, 461 __entry->wait = wait; 462 ), 463 464 TP_printk_btrfs("wait = %d", __entry->wait) 465 ); 466 467 TRACE_EVENT(btrfs_add_block_group, 468 469 TP_PROTO(struct btrfs_fs_info *fs_info, 470 struct btrfs_block_group_cache *block_group, int create), 471 472 TP_ARGS(fs_info, block_group, create), 473 474 TP_STRUCT__entry( 475 __array( u8, fsid, BTRFS_UUID_SIZE ) 476 __field( u64, offset ) 477 __field( u64, size ) 478 __field( u64, flags ) 479 __field( u64, bytes_used ) 480 __field( u64, bytes_super ) 481 __field( int, create ) 482 ), 483 484 TP_fast_assign( 485 memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE); 486 __entry->offset = block_group->key.objectid; 487 __entry->size = block_group->key.offset; 488 __entry->flags = block_group->flags; 489 __entry->bytes_used = 490 btrfs_block_group_used(&block_group->item); 491 __entry->bytes_super = block_group->bytes_super; 492 __entry->create = create; 493 ), 494 495 TP_printk("%pU: block_group offset=%llu size=%llu " 496 "flags=%llu(%s) bytes_used=%llu bytes_super=%llu " 497 "create=%d", __entry->fsid, 498 (unsigned long long)__entry->offset, 499 (unsigned long long)__entry->size, 500 (unsigned long long)__entry->flags, 501 __print_flags((unsigned long)__entry->flags, "|", 502 BTRFS_GROUP_FLAGS), 503 (unsigned long long)__entry->bytes_used, 504 (unsigned long long)__entry->bytes_super, __entry->create) 505 ); 506 507 #define show_ref_action(action) \ 508 __print_symbolic(action, \ 509 { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ 510 { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ 511 { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ 512 { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) 513 514 515 DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, 516 517 TP_PROTO(struct btrfs_fs_info *fs_info, 518 struct btrfs_delayed_ref_node *ref, 519 struct btrfs_delayed_tree_ref *full_ref, 520 int action), 521 522 TP_ARGS(fs_info, ref, full_ref, action), 523 524 TP_STRUCT__entry_btrfs( 525 __field( u64, bytenr ) 526 __field( u64, num_bytes ) 527 __field( int, action ) 528 __field( u64, parent ) 529 __field( u64, ref_root ) 530 __field( int, level ) 531 __field( int, type ) 532 __field( u64, seq ) 533 ), 534 535 TP_fast_assign_btrfs(fs_info, 536 __entry->bytenr = ref->bytenr; 537 __entry->num_bytes = ref->num_bytes; 538 __entry->action = action; 539 __entry->parent = full_ref->parent; 540 __entry->ref_root = full_ref->root; 541 __entry->level = full_ref->level; 542 __entry->type = ref->type; 543 __entry->seq = ref->seq; 544 ), 545 546 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 547 "parent=%llu(%s) ref_root=%llu(%s) level=%d " 548 "type=%s seq=%llu", 549 (unsigned long long)__entry->bytenr, 550 (unsigned long long)__entry->num_bytes, 551 show_ref_action(__entry->action), 552 show_root_type(__entry->parent), 553 show_root_type(__entry->ref_root), 554 __entry->level, show_ref_type(__entry->type), 555 (unsigned long long)__entry->seq) 556 ); 557 558 DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, 559 560 TP_PROTO(struct btrfs_fs_info *fs_info, 561 struct btrfs_delayed_ref_node *ref, 562 struct btrfs_delayed_tree_ref *full_ref, 563 int action), 564 565 TP_ARGS(fs_info, ref, full_ref, action) 566 ); 567 568 DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, 569 570 TP_PROTO(struct btrfs_fs_info *fs_info, 571 struct btrfs_delayed_ref_node *ref, 572 struct btrfs_delayed_tree_ref *full_ref, 573 int action), 574 575 TP_ARGS(fs_info, ref, full_ref, action) 576 ); 577 578 DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, 579 580 TP_PROTO(struct btrfs_fs_info *fs_info, 581 struct btrfs_delayed_ref_node *ref, 582 struct btrfs_delayed_data_ref *full_ref, 583 int action), 584 585 TP_ARGS(fs_info, ref, full_ref, action), 586 587 TP_STRUCT__entry_btrfs( 588 __field( u64, bytenr ) 589 __field( u64, num_bytes ) 590 __field( int, action ) 591 __field( u64, parent ) 592 __field( u64, ref_root ) 593 __field( u64, owner ) 594 __field( u64, offset ) 595 __field( int, type ) 596 __field( u64, seq ) 597 ), 598 599 TP_fast_assign_btrfs(fs_info, 600 __entry->bytenr = ref->bytenr; 601 __entry->num_bytes = ref->num_bytes; 602 __entry->action = action; 603 __entry->parent = full_ref->parent; 604 __entry->ref_root = full_ref->root; 605 __entry->owner = full_ref->objectid; 606 __entry->offset = full_ref->offset; 607 __entry->type = ref->type; 608 __entry->seq = ref->seq; 609 ), 610 611 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 612 "parent=%llu(%s) ref_root=%llu(%s) owner=%llu " 613 "offset=%llu type=%s seq=%llu", 614 (unsigned long long)__entry->bytenr, 615 (unsigned long long)__entry->num_bytes, 616 show_ref_action(__entry->action), 617 show_root_type(__entry->parent), 618 show_root_type(__entry->ref_root), 619 (unsigned long long)__entry->owner, 620 (unsigned long long)__entry->offset, 621 show_ref_type(__entry->type), 622 (unsigned long long)__entry->seq) 623 ); 624 625 DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, 626 627 TP_PROTO(struct btrfs_fs_info *fs_info, 628 struct btrfs_delayed_ref_node *ref, 629 struct btrfs_delayed_data_ref *full_ref, 630 int action), 631 632 TP_ARGS(fs_info, ref, full_ref, action) 633 ); 634 635 DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, 636 637 TP_PROTO(struct btrfs_fs_info *fs_info, 638 struct btrfs_delayed_ref_node *ref, 639 struct btrfs_delayed_data_ref *full_ref, 640 int action), 641 642 TP_ARGS(fs_info, ref, full_ref, action) 643 ); 644 645 DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, 646 647 TP_PROTO(struct btrfs_fs_info *fs_info, 648 struct btrfs_delayed_ref_node *ref, 649 struct btrfs_delayed_ref_head *head_ref, 650 int action), 651 652 TP_ARGS(fs_info, ref, head_ref, action), 653 654 TP_STRUCT__entry_btrfs( 655 __field( u64, bytenr ) 656 __field( u64, num_bytes ) 657 __field( int, action ) 658 __field( int, is_data ) 659 ), 660 661 TP_fast_assign_btrfs(fs_info, 662 __entry->bytenr = ref->bytenr; 663 __entry->num_bytes = ref->num_bytes; 664 __entry->action = action; 665 __entry->is_data = head_ref->is_data; 666 ), 667 668 TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d", 669 (unsigned long long)__entry->bytenr, 670 (unsigned long long)__entry->num_bytes, 671 show_ref_action(__entry->action), 672 __entry->is_data) 673 ); 674 675 DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, 676 677 TP_PROTO(struct btrfs_fs_info *fs_info, 678 struct btrfs_delayed_ref_node *ref, 679 struct btrfs_delayed_ref_head *head_ref, 680 int action), 681 682 TP_ARGS(fs_info, ref, head_ref, action) 683 ); 684 685 DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, 686 687 TP_PROTO(struct btrfs_fs_info *fs_info, 688 struct btrfs_delayed_ref_node *ref, 689 struct btrfs_delayed_ref_head *head_ref, 690 int action), 691 692 TP_ARGS(fs_info, ref, head_ref, action) 693 ); 694 695 #define show_chunk_type(type) \ 696 __print_flags(type, "|", \ 697 { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ 698 { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 699 { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 700 { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ 701 { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ 702 { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ 703 { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 704 { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ 705 { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) 706 707 DECLARE_EVENT_CLASS(btrfs__chunk, 708 709 TP_PROTO(struct btrfs_fs_info *fs_info, struct map_lookup *map, 710 u64 offset, u64 size), 711 712 TP_ARGS(fs_info, map, offset, size), 713 714 TP_STRUCT__entry_btrfs( 715 __field( int, num_stripes ) 716 __field( u64, type ) 717 __field( int, sub_stripes ) 718 __field( u64, offset ) 719 __field( u64, size ) 720 __field( u64, root_objectid ) 721 ), 722 723 TP_fast_assign_btrfs(fs_info, 724 __entry->num_stripes = map->num_stripes; 725 __entry->type = map->type; 726 __entry->sub_stripes = map->sub_stripes; 727 __entry->offset = offset; 728 __entry->size = size; 729 __entry->root_objectid = fs_info->chunk_root->root_key.objectid; 730 ), 731 732 TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu " 733 "num_stripes=%d sub_stripes=%d type=%s", 734 show_root_type(__entry->root_objectid), 735 (unsigned long long)__entry->offset, 736 (unsigned long long)__entry->size, 737 __entry->num_stripes, __entry->sub_stripes, 738 show_chunk_type(__entry->type)) 739 ); 740 741 DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, 742 743 TP_PROTO(struct btrfs_fs_info *fs_info, struct map_lookup *map, 744 u64 offset, u64 size), 745 746 TP_ARGS(fs_info, map, offset, size) 747 ); 748 749 DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, 750 751 TP_PROTO(struct btrfs_fs_info *fs_info, struct map_lookup *map, 752 u64 offset, u64 size), 753 754 TP_ARGS(fs_info, map, offset, size) 755 ); 756 757 TRACE_EVENT(btrfs_cow_block, 758 759 TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf, 760 struct extent_buffer *cow), 761 762 TP_ARGS(root, buf, cow), 763 764 TP_STRUCT__entry_btrfs( 765 __field( u64, root_objectid ) 766 __field( u64, buf_start ) 767 __field( int, refs ) 768 __field( u64, cow_start ) 769 __field( int, buf_level ) 770 __field( int, cow_level ) 771 ), 772 773 TP_fast_assign_btrfs(root->fs_info, 774 __entry->root_objectid = root->root_key.objectid; 775 __entry->buf_start = buf->start; 776 __entry->refs = atomic_read(&buf->refs); 777 __entry->cow_start = cow->start; 778 __entry->buf_level = btrfs_header_level(buf); 779 __entry->cow_level = btrfs_header_level(cow); 780 ), 781 782 TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu " 783 "(orig_level=%d) cow_buf=%llu (cow_level=%d)", 784 show_root_type(__entry->root_objectid), 785 __entry->refs, 786 (unsigned long long)__entry->buf_start, 787 __entry->buf_level, 788 (unsigned long long)__entry->cow_start, 789 __entry->cow_level) 790 ); 791 792 TRACE_EVENT(btrfs_space_reservation, 793 794 TP_PROTO(struct btrfs_fs_info *fs_info, char *type, u64 val, 795 u64 bytes, int reserve), 796 797 TP_ARGS(fs_info, type, val, bytes, reserve), 798 799 TP_STRUCT__entry_btrfs( 800 __string( type, type ) 801 __field( u64, val ) 802 __field( u64, bytes ) 803 __field( int, reserve ) 804 ), 805 806 TP_fast_assign_btrfs(fs_info, 807 __assign_str(type, type); 808 __entry->val = val; 809 __entry->bytes = bytes; 810 __entry->reserve = reserve; 811 ), 812 813 TP_printk_btrfs("%s: %Lu %s %Lu", __get_str(type), __entry->val, 814 __entry->reserve ? "reserve" : "release", 815 __entry->bytes) 816 ); 817 818 #define show_flush_action(action) \ 819 __print_symbolic(action, \ 820 { BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH"}, \ 821 { BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT"}, \ 822 { BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL"}) 823 824 TRACE_EVENT(btrfs_trigger_flush, 825 826 TP_PROTO(struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, 827 int flush, char *reason), 828 829 TP_ARGS(fs_info, flags, bytes, flush, reason), 830 831 TP_STRUCT__entry( 832 __array( u8, fsid, BTRFS_UUID_SIZE ) 833 __field( u64, flags ) 834 __field( u64, bytes ) 835 __field( int, flush ) 836 __string( reason, reason ) 837 ), 838 839 TP_fast_assign( 840 memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE); 841 __entry->flags = flags; 842 __entry->bytes = bytes; 843 __entry->flush = flush; 844 __assign_str(reason, reason) 845 ), 846 847 TP_printk("%pU: %s: flush=%d(%s) flags=%llu(%s) bytes=%llu", 848 __entry->fsid, __get_str(reason), __entry->flush, 849 show_flush_action(__entry->flush), 850 (unsigned long long)__entry->flags, 851 __print_flags((unsigned long)__entry->flags, "|", 852 BTRFS_GROUP_FLAGS), 853 (unsigned long long)__entry->bytes) 854 ); 855 856 #define show_flush_state(state) \ 857 __print_symbolic(state, \ 858 { FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR"}, \ 859 { FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS"}, \ 860 { FLUSH_DELALLOC, "FLUSH_DELALLOC"}, \ 861 { FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT"}, \ 862 { ALLOC_CHUNK, "ALLOC_CHUNK"}, \ 863 { COMMIT_TRANS, "COMMIT_TRANS"}) 864 865 TRACE_EVENT(btrfs_flush_space, 866 867 TP_PROTO(struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes, 868 u64 orig_bytes, int state, int ret), 869 870 TP_ARGS(fs_info, flags, num_bytes, orig_bytes, state, ret), 871 872 TP_STRUCT__entry( 873 __array( u8, fsid, BTRFS_UUID_SIZE ) 874 __field( u64, flags ) 875 __field( u64, num_bytes ) 876 __field( u64, orig_bytes ) 877 __field( int, state ) 878 __field( int, ret ) 879 ), 880 881 TP_fast_assign( 882 memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE); 883 __entry->flags = flags; 884 __entry->num_bytes = num_bytes; 885 __entry->orig_bytes = orig_bytes; 886 __entry->state = state; 887 __entry->ret = ret; 888 ), 889 890 TP_printk("%pU: state=%d(%s) flags=%llu(%s) num_bytes=%llu " 891 "orig_bytes=%llu ret=%d", __entry->fsid, __entry->state, 892 show_flush_state(__entry->state), 893 (unsigned long long)__entry->flags, 894 __print_flags((unsigned long)__entry->flags, "|", 895 BTRFS_GROUP_FLAGS), 896 (unsigned long long)__entry->num_bytes, 897 (unsigned long long)__entry->orig_bytes, __entry->ret) 898 ); 899 900 DECLARE_EVENT_CLASS(btrfs__reserved_extent, 901 902 TP_PROTO(struct btrfs_fs_info *fs_info, u64 start, u64 len), 903 904 TP_ARGS(fs_info, start, len), 905 906 TP_STRUCT__entry_btrfs( 907 __field( u64, start ) 908 __field( u64, len ) 909 ), 910 911 TP_fast_assign_btrfs(fs_info, 912 __entry->start = start; 913 __entry->len = len; 914 ), 915 916 TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu", 917 show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 918 (unsigned long long)__entry->start, 919 (unsigned long long)__entry->len) 920 ); 921 922 DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, 923 924 TP_PROTO(struct btrfs_fs_info *fs_info, u64 start, u64 len), 925 926 TP_ARGS(fs_info, start, len) 927 ); 928 929 DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, 930 931 TP_PROTO(struct btrfs_fs_info *fs_info, u64 start, u64 len), 932 933 TP_ARGS(fs_info, start, len) 934 ); 935 936 TRACE_EVENT(find_free_extent, 937 938 TP_PROTO(struct btrfs_fs_info *fs_info, u64 num_bytes, u64 empty_size, 939 u64 data), 940 941 TP_ARGS(fs_info, num_bytes, empty_size, data), 942 943 TP_STRUCT__entry_btrfs( 944 __field( u64, num_bytes ) 945 __field( u64, empty_size ) 946 __field( u64, data ) 947 ), 948 949 TP_fast_assign_btrfs(fs_info, 950 __entry->num_bytes = num_bytes; 951 __entry->empty_size = empty_size; 952 __entry->data = data; 953 ), 954 955 TP_printk_btrfs("root=%Lu(%s) len=%Lu empty_size=%Lu flags=%Lu(%s)", 956 show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 957 __entry->num_bytes, __entry->empty_size, __entry->data, 958 __print_flags((unsigned long)__entry->data, "|", 959 BTRFS_GROUP_FLAGS)) 960 ); 961 962 DECLARE_EVENT_CLASS(btrfs__reserve_extent, 963 964 TP_PROTO(struct btrfs_fs_info *fs_info, 965 struct btrfs_block_group_cache *block_group, u64 start, 966 u64 len), 967 968 TP_ARGS(fs_info, block_group, start, len), 969 970 TP_STRUCT__entry_btrfs( 971 __field( u64, bg_objectid ) 972 __field( u64, flags ) 973 __field( u64, start ) 974 __field( u64, len ) 975 ), 976 977 TP_fast_assign_btrfs(fs_info, 978 __entry->bg_objectid = block_group->key.objectid; 979 __entry->flags = block_group->flags; 980 __entry->start = start; 981 __entry->len = len; 982 ), 983 984 TP_printk_btrfs("root=%Lu(%s) block_group=%Lu flags=%Lu(%s) " 985 "start=%Lu len=%Lu", 986 show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 987 __entry->bg_objectid, 988 __entry->flags, __print_flags((unsigned long)__entry->flags, 989 "|", BTRFS_GROUP_FLAGS), 990 __entry->start, __entry->len) 991 ); 992 993 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, 994 995 TP_PROTO(struct btrfs_fs_info *fs_info, 996 struct btrfs_block_group_cache *block_group, u64 start, 997 u64 len), 998 999 TP_ARGS(fs_info, block_group, start, len) 1000 ); 1001 1002 DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, 1003 1004 TP_PROTO(struct btrfs_fs_info *fs_info, 1005 struct btrfs_block_group_cache *block_group, u64 start, 1006 u64 len), 1007 1008 TP_ARGS(fs_info, block_group, start, len) 1009 ); 1010 1011 TRACE_EVENT(btrfs_find_cluster, 1012 1013 TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start, 1014 u64 bytes, u64 empty_size, u64 min_bytes), 1015 1016 TP_ARGS(block_group, start, bytes, empty_size, min_bytes), 1017 1018 TP_STRUCT__entry_btrfs( 1019 __field( u64, bg_objectid ) 1020 __field( u64, flags ) 1021 __field( u64, start ) 1022 __field( u64, bytes ) 1023 __field( u64, empty_size ) 1024 __field( u64, min_bytes ) 1025 ), 1026 1027 TP_fast_assign_btrfs(block_group->fs_info, 1028 __entry->bg_objectid = block_group->key.objectid; 1029 __entry->flags = block_group->flags; 1030 __entry->start = start; 1031 __entry->bytes = bytes; 1032 __entry->empty_size = empty_size; 1033 __entry->min_bytes = min_bytes; 1034 ), 1035 1036 TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) start=%Lu len=%Lu " 1037 "empty_size=%Lu min_bytes=%Lu", __entry->bg_objectid, 1038 __entry->flags, 1039 __print_flags((unsigned long)__entry->flags, "|", 1040 BTRFS_GROUP_FLAGS), __entry->start, 1041 __entry->bytes, __entry->empty_size, __entry->min_bytes) 1042 ); 1043 1044 TRACE_EVENT(btrfs_failed_cluster_setup, 1045 1046 TP_PROTO(struct btrfs_block_group_cache *block_group), 1047 1048 TP_ARGS(block_group), 1049 1050 TP_STRUCT__entry_btrfs( 1051 __field( u64, bg_objectid ) 1052 ), 1053 1054 TP_fast_assign_btrfs(block_group->fs_info, 1055 __entry->bg_objectid = block_group->key.objectid; 1056 ), 1057 1058 TP_printk_btrfs("block_group=%Lu", __entry->bg_objectid) 1059 ); 1060 1061 TRACE_EVENT(btrfs_setup_cluster, 1062 1063 TP_PROTO(struct btrfs_block_group_cache *block_group, 1064 struct btrfs_free_cluster *cluster, u64 size, int bitmap), 1065 1066 TP_ARGS(block_group, cluster, size, bitmap), 1067 1068 TP_STRUCT__entry_btrfs( 1069 __field( u64, bg_objectid ) 1070 __field( u64, flags ) 1071 __field( u64, start ) 1072 __field( u64, max_size ) 1073 __field( u64, size ) 1074 __field( int, bitmap ) 1075 ), 1076 1077 TP_fast_assign_btrfs(block_group->fs_info, 1078 __entry->bg_objectid = block_group->key.objectid; 1079 __entry->flags = block_group->flags; 1080 __entry->start = cluster->window_start; 1081 __entry->max_size = cluster->max_size; 1082 __entry->size = size; 1083 __entry->bitmap = bitmap; 1084 ), 1085 1086 TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) window_start=%Lu " 1087 "size=%Lu max_size=%Lu bitmap=%d", 1088 __entry->bg_objectid, 1089 __entry->flags, 1090 __print_flags((unsigned long)__entry->flags, "|", 1091 BTRFS_GROUP_FLAGS), __entry->start, 1092 __entry->size, __entry->max_size, __entry->bitmap) 1093 ); 1094 1095 struct extent_state; 1096 TRACE_EVENT(alloc_extent_state, 1097 1098 TP_PROTO(struct extent_state *state, gfp_t mask, unsigned long IP), 1099 1100 TP_ARGS(state, mask, IP), 1101 1102 TP_STRUCT__entry( 1103 __field(struct extent_state *, state) 1104 __field(gfp_t, mask) 1105 __field(unsigned long, ip) 1106 ), 1107 1108 TP_fast_assign( 1109 __entry->state = state, 1110 __entry->mask = mask, 1111 __entry->ip = IP 1112 ), 1113 1114 TP_printk("state=%p mask=%s caller=%pS", __entry->state, 1115 show_gfp_flags(__entry->mask), (void *)__entry->ip) 1116 ); 1117 1118 TRACE_EVENT(free_extent_state, 1119 1120 TP_PROTO(struct extent_state *state, unsigned long IP), 1121 1122 TP_ARGS(state, IP), 1123 1124 TP_STRUCT__entry( 1125 __field(struct extent_state *, state) 1126 __field(unsigned long, ip) 1127 ), 1128 1129 TP_fast_assign( 1130 __entry->state = state, 1131 __entry->ip = IP 1132 ), 1133 1134 TP_printk("state=%p caller=%pS", __entry->state, 1135 (void *)__entry->ip) 1136 ); 1137 1138 DECLARE_EVENT_CLASS(btrfs__work, 1139 1140 TP_PROTO(struct btrfs_work *work), 1141 1142 TP_ARGS(work), 1143 1144 TP_STRUCT__entry_btrfs( 1145 __field( void *, work ) 1146 __field( void *, wq ) 1147 __field( void *, func ) 1148 __field( void *, ordered_func ) 1149 __field( void *, ordered_free ) 1150 __field( void *, normal_work ) 1151 ), 1152 1153 TP_fast_assign_btrfs(btrfs_work_owner(work), 1154 __entry->work = work; 1155 __entry->wq = work->wq; 1156 __entry->func = work->func; 1157 __entry->ordered_func = work->ordered_func; 1158 __entry->ordered_free = work->ordered_free; 1159 __entry->normal_work = &work->normal_work; 1160 ), 1161 1162 TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%pf ordered_func=%p " 1163 "ordered_free=%p", 1164 __entry->work, __entry->normal_work, __entry->wq, 1165 __entry->func, __entry->ordered_func, __entry->ordered_free) 1166 ); 1167 1168 /* 1169 * For situiations when the work is freed, we pass fs_info and a tag that that 1170 * matches address of the work structure so it can be paired with the 1171 * scheduling event. 1172 */ 1173 DECLARE_EVENT_CLASS(btrfs__work__done, 1174 1175 TP_PROTO(struct btrfs_fs_info *fs_info, void *wtag), 1176 1177 TP_ARGS(fs_info, wtag), 1178 1179 TP_STRUCT__entry_btrfs( 1180 __field( void *, wtag ) 1181 ), 1182 1183 TP_fast_assign_btrfs(fs_info, 1184 __entry->wtag = wtag; 1185 ), 1186 1187 TP_printk_btrfs("work->%p", __entry->wtag) 1188 ); 1189 1190 DEFINE_EVENT(btrfs__work, btrfs_work_queued, 1191 1192 TP_PROTO(struct btrfs_work *work), 1193 1194 TP_ARGS(work) 1195 ); 1196 1197 DEFINE_EVENT(btrfs__work, btrfs_work_sched, 1198 1199 TP_PROTO(struct btrfs_work *work), 1200 1201 TP_ARGS(work) 1202 ); 1203 1204 DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, 1205 1206 TP_PROTO(struct btrfs_fs_info *fs_info, void *wtag), 1207 1208 TP_ARGS(fs_info, wtag) 1209 ); 1210 1211 DEFINE_EVENT(btrfs__work, btrfs_ordered_sched, 1212 1213 TP_PROTO(struct btrfs_work *work), 1214 1215 TP_ARGS(work) 1216 ); 1217 1218 DECLARE_EVENT_CLASS(btrfs__workqueue, 1219 1220 TP_PROTO(struct __btrfs_workqueue *wq, const char *name, int high), 1221 1222 TP_ARGS(wq, name, high), 1223 1224 TP_STRUCT__entry_btrfs( 1225 __field( void *, wq ) 1226 __string( name, name ) 1227 __field( int , high ) 1228 ), 1229 1230 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1231 __entry->wq = wq; 1232 __assign_str(name, name); 1233 __entry->high = high; 1234 ), 1235 1236 TP_printk_btrfs("name=%s%s wq=%p", __get_str(name), 1237 __print_flags(__entry->high, "", 1238 {(WQ_HIGHPRI), "-high"}), 1239 __entry->wq) 1240 ); 1241 1242 DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc, 1243 1244 TP_PROTO(struct __btrfs_workqueue *wq, const char *name, int high), 1245 1246 TP_ARGS(wq, name, high) 1247 ); 1248 1249 DECLARE_EVENT_CLASS(btrfs__workqueue_done, 1250 1251 TP_PROTO(struct __btrfs_workqueue *wq), 1252 1253 TP_ARGS(wq), 1254 1255 TP_STRUCT__entry_btrfs( 1256 __field( void *, wq ) 1257 ), 1258 1259 TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1260 __entry->wq = wq; 1261 ), 1262 1263 TP_printk_btrfs("wq=%p", __entry->wq) 1264 ); 1265 1266 DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy, 1267 1268 TP_PROTO(struct __btrfs_workqueue *wq), 1269 1270 TP_ARGS(wq) 1271 ); 1272 1273 DECLARE_EVENT_CLASS(btrfs__qgroup_data_map, 1274 1275 TP_PROTO(struct inode *inode, u64 free_reserved), 1276 1277 TP_ARGS(inode, free_reserved), 1278 1279 TP_STRUCT__entry_btrfs( 1280 __field( u64, rootid ) 1281 __field( unsigned long, ino ) 1282 __field( u64, free_reserved ) 1283 ), 1284 1285 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 1286 __entry->rootid = BTRFS_I(inode)->root->objectid; 1287 __entry->ino = inode->i_ino; 1288 __entry->free_reserved = free_reserved; 1289 ), 1290 1291 TP_printk_btrfs("rootid=%llu ino=%lu free_reserved=%llu", 1292 __entry->rootid, __entry->ino, __entry->free_reserved) 1293 ); 1294 1295 DEFINE_EVENT(btrfs__qgroup_data_map, btrfs_qgroup_init_data_rsv_map, 1296 1297 TP_PROTO(struct inode *inode, u64 free_reserved), 1298 1299 TP_ARGS(inode, free_reserved) 1300 ); 1301 1302 DEFINE_EVENT(btrfs__qgroup_data_map, btrfs_qgroup_free_data_rsv_map, 1303 1304 TP_PROTO(struct inode *inode, u64 free_reserved), 1305 1306 TP_ARGS(inode, free_reserved) 1307 ); 1308 1309 #define BTRFS_QGROUP_OPERATIONS \ 1310 { QGROUP_RESERVE, "reserve" }, \ 1311 { QGROUP_RELEASE, "release" }, \ 1312 { QGROUP_FREE, "free" } 1313 1314 DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, 1315 1316 TP_PROTO(struct inode *inode, u64 start, u64 len, u64 reserved, int op), 1317 1318 TP_ARGS(inode, start, len, reserved, op), 1319 1320 TP_STRUCT__entry_btrfs( 1321 __field( u64, rootid ) 1322 __field( unsigned long, ino ) 1323 __field( u64, start ) 1324 __field( u64, len ) 1325 __field( u64, reserved ) 1326 __field( int, op ) 1327 ), 1328 1329 TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 1330 __entry->rootid = BTRFS_I(inode)->root->objectid; 1331 __entry->ino = inode->i_ino; 1332 __entry->start = start; 1333 __entry->len = len; 1334 __entry->reserved = reserved; 1335 __entry->op = op; 1336 ), 1337 1338 TP_printk_btrfs("root=%llu ino=%lu start=%llu len=%llu reserved=%llu op=%s", 1339 __entry->rootid, __entry->ino, __entry->start, __entry->len, 1340 __entry->reserved, 1341 __print_flags((unsigned long)__entry->op, "", 1342 BTRFS_QGROUP_OPERATIONS) 1343 ) 1344 ); 1345 1346 DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data, 1347 1348 TP_PROTO(struct inode *inode, u64 start, u64 len, u64 reserved, int op), 1349 1350 TP_ARGS(inode, start, len, reserved, op) 1351 ); 1352 1353 DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data, 1354 1355 TP_PROTO(struct inode *inode, u64 start, u64 len, u64 reserved, int op), 1356 1357 TP_ARGS(inode, start, len, reserved, op) 1358 ); 1359 1360 DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref, 1361 1362 TP_PROTO(struct btrfs_fs_info *fs_info, u64 ref_root, u64 reserved), 1363 1364 TP_ARGS(fs_info, ref_root, reserved), 1365 1366 TP_STRUCT__entry_btrfs( 1367 __field( u64, ref_root ) 1368 __field( u64, reserved ) 1369 ), 1370 1371 TP_fast_assign_btrfs(fs_info, 1372 __entry->ref_root = ref_root; 1373 __entry->reserved = reserved; 1374 ), 1375 1376 TP_printk_btrfs("root=%llu reserved=%llu op=free", 1377 __entry->ref_root, __entry->reserved) 1378 ); 1379 1380 DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref, 1381 1382 TP_PROTO(struct btrfs_fs_info *fs_info, u64 ref_root, u64 reserved), 1383 1384 TP_ARGS(fs_info, ref_root, reserved) 1385 ); 1386 1387 DECLARE_EVENT_CLASS(btrfs_qgroup_extent, 1388 TP_PROTO(struct btrfs_fs_info *fs_info, 1389 struct btrfs_qgroup_extent_record *rec), 1390 1391 TP_ARGS(fs_info, rec), 1392 1393 TP_STRUCT__entry_btrfs( 1394 __field( u64, bytenr ) 1395 __field( u64, num_bytes ) 1396 ), 1397 1398 TP_fast_assign_btrfs(fs_info, 1399 __entry->bytenr = rec->bytenr, 1400 __entry->num_bytes = rec->num_bytes; 1401 ), 1402 1403 TP_printk_btrfs("bytenr=%llu num_bytes=%llu", 1404 (unsigned long long)__entry->bytenr, 1405 (unsigned long long)__entry->num_bytes) 1406 ); 1407 1408 DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, 1409 1410 TP_PROTO(struct btrfs_fs_info *fs_info, 1411 struct btrfs_qgroup_extent_record *rec), 1412 1413 TP_ARGS(fs_info, rec) 1414 ); 1415 1416 DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent, 1417 1418 TP_PROTO(struct btrfs_fs_info *fs_info, 1419 struct btrfs_qgroup_extent_record *rec), 1420 1421 TP_ARGS(fs_info, rec) 1422 ); 1423 1424 TRACE_EVENT(btrfs_qgroup_account_extent, 1425 1426 TP_PROTO(struct btrfs_fs_info *fs_info, u64 bytenr, 1427 u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), 1428 1429 TP_ARGS(fs_info, bytenr, num_bytes, nr_old_roots, nr_new_roots), 1430 1431 TP_STRUCT__entry_btrfs( 1432 __field( u64, bytenr ) 1433 __field( u64, num_bytes ) 1434 __field( u64, nr_old_roots ) 1435 __field( u64, nr_new_roots ) 1436 ), 1437 1438 TP_fast_assign_btrfs(fs_info, 1439 __entry->bytenr = bytenr; 1440 __entry->num_bytes = num_bytes; 1441 __entry->nr_old_roots = nr_old_roots; 1442 __entry->nr_new_roots = nr_new_roots; 1443 ), 1444 1445 TP_printk_btrfs("bytenr=%llu num_bytes=%llu nr_old_roots=%llu " 1446 "nr_new_roots=%llu", 1447 __entry->bytenr, 1448 __entry->num_bytes, 1449 __entry->nr_old_roots, 1450 __entry->nr_new_roots) 1451 ); 1452 1453 TRACE_EVENT(qgroup_update_counters, 1454 1455 TP_PROTO(struct btrfs_fs_info *fs_info, u64 qgid, 1456 u64 cur_old_count, u64 cur_new_count), 1457 1458 TP_ARGS(fs_info, qgid, cur_old_count, cur_new_count), 1459 1460 TP_STRUCT__entry_btrfs( 1461 __field( u64, qgid ) 1462 __field( u64, cur_old_count ) 1463 __field( u64, cur_new_count ) 1464 ), 1465 1466 TP_fast_assign_btrfs(fs_info, 1467 __entry->qgid = qgid; 1468 __entry->cur_old_count = cur_old_count; 1469 __entry->cur_new_count = cur_new_count; 1470 ), 1471 1472 TP_printk_btrfs("qgid=%llu cur_old_count=%llu cur_new_count=%llu", 1473 __entry->qgid, 1474 __entry->cur_old_count, 1475 __entry->cur_new_count) 1476 ); 1477 1478 #endif /* _TRACE_BTRFS_H */ 1479 1480 /* This part must be outside protection */ 1481 #include <trace/define_trace.h> 1482