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