11abe9b8aSliubo #undef TRACE_SYSTEM 21abe9b8aSliubo #define TRACE_SYSTEM btrfs 31abe9b8aSliubo 41abe9b8aSliubo #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ) 51abe9b8aSliubo #define _TRACE_BTRFS_H 61abe9b8aSliubo 71abe9b8aSliubo #include <linux/writeback.h> 81abe9b8aSliubo #include <linux/tracepoint.h> 9420adbe9SVlastimil Babka #include <trace/events/mmflags.h> 101abe9b8aSliubo 111abe9b8aSliubo struct btrfs_root; 121abe9b8aSliubo struct btrfs_fs_info; 131abe9b8aSliubo struct btrfs_inode; 141abe9b8aSliubo struct extent_map; 151abe9b8aSliubo struct btrfs_ordered_extent; 161abe9b8aSliubo struct btrfs_delayed_ref_node; 171abe9b8aSliubo struct btrfs_delayed_tree_ref; 181abe9b8aSliubo struct btrfs_delayed_data_ref; 191abe9b8aSliubo struct btrfs_delayed_ref_head; 203f7de037SJosef Bacik struct btrfs_block_group_cache; 213f7de037SJosef Bacik struct btrfs_free_cluster; 221abe9b8aSliubo struct map_lookup; 231abe9b8aSliubo struct extent_buffer; 2452483bc2SQu Wenruo struct btrfs_work; 25c3a46891SQu Wenruo struct __btrfs_workqueue; 260f5dcf8dSMark Fasheh struct btrfs_qgroup_extent_record; 271abe9b8aSliubo 281abe9b8aSliubo #define show_ref_type(type) \ 291abe9b8aSliubo __print_symbolic(type, \ 301abe9b8aSliubo { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ 311abe9b8aSliubo { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ 321abe9b8aSliubo { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ 331abe9b8aSliubo { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ 341abe9b8aSliubo { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) 351abe9b8aSliubo 361abe9b8aSliubo #define __show_root_type(obj) \ 377f34b746Sliubo __print_symbolic_u64(obj, \ 381abe9b8aSliubo { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ 391abe9b8aSliubo { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ 401abe9b8aSliubo { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ 411abe9b8aSliubo { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ 421abe9b8aSliubo { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ 431abe9b8aSliubo { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ 441abe9b8aSliubo { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ 451abe9b8aSliubo { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ 46e112e2b4SLiu Bo { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ 471abe9b8aSliubo { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ 48208acb8cSOmar Sandoval { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \ 49208acb8cSOmar Sandoval { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \ 501abe9b8aSliubo { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) 511abe9b8aSliubo 521abe9b8aSliubo #define show_root_type(obj) \ 531abe9b8aSliubo obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ 54fb57dc81SLiu Bo (obj >= BTRFS_ROOT_TREE_OBJECTID && \ 55e112e2b4SLiu Bo obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" 561abe9b8aSliubo 573f7de037SJosef Bacik #define BTRFS_GROUP_FLAGS \ 583f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ 593f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 603f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 613f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ 623f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ 633f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ 64e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 65e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ 66e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} 673f7de037SJosef Bacik 688c2a3ca2SJosef Bacik #define BTRFS_UUID_SIZE 16 698c2a3ca2SJosef Bacik 701abe9b8aSliubo TRACE_EVENT(btrfs_transaction_commit, 711abe9b8aSliubo 721abe9b8aSliubo TP_PROTO(struct btrfs_root *root), 731abe9b8aSliubo 741abe9b8aSliubo TP_ARGS(root), 751abe9b8aSliubo 761abe9b8aSliubo TP_STRUCT__entry( 771abe9b8aSliubo __field( u64, generation ) 781abe9b8aSliubo __field( u64, root_objectid ) 791abe9b8aSliubo ), 801abe9b8aSliubo 811abe9b8aSliubo TP_fast_assign( 821abe9b8aSliubo __entry->generation = root->fs_info->generation; 831abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 841abe9b8aSliubo ), 851abe9b8aSliubo 861abe9b8aSliubo TP_printk("root = %llu(%s), gen = %llu", 871abe9b8aSliubo show_root_type(__entry->root_objectid), 881abe9b8aSliubo (unsigned long long)__entry->generation) 891abe9b8aSliubo ); 901abe9b8aSliubo 911abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__inode, 921abe9b8aSliubo 931abe9b8aSliubo TP_PROTO(struct inode *inode), 941abe9b8aSliubo 951abe9b8aSliubo TP_ARGS(inode), 961abe9b8aSliubo 971abe9b8aSliubo TP_STRUCT__entry( 981abe9b8aSliubo __field( ino_t, ino ) 991abe9b8aSliubo __field( blkcnt_t, blocks ) 1001abe9b8aSliubo __field( u64, disk_i_size ) 1011abe9b8aSliubo __field( u64, generation ) 1021abe9b8aSliubo __field( u64, last_trans ) 1031abe9b8aSliubo __field( u64, logged_trans ) 1041abe9b8aSliubo __field( u64, root_objectid ) 1051abe9b8aSliubo ), 1061abe9b8aSliubo 1071abe9b8aSliubo TP_fast_assign( 1081abe9b8aSliubo __entry->ino = inode->i_ino; 1091abe9b8aSliubo __entry->blocks = inode->i_blocks; 1101abe9b8aSliubo __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; 1111abe9b8aSliubo __entry->generation = BTRFS_I(inode)->generation; 1121abe9b8aSliubo __entry->last_trans = BTRFS_I(inode)->last_trans; 1131abe9b8aSliubo __entry->logged_trans = BTRFS_I(inode)->logged_trans; 1141abe9b8aSliubo __entry->root_objectid = 1151abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 1161abe9b8aSliubo ), 1171abe9b8aSliubo 1181abe9b8aSliubo TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, " 1191abe9b8aSliubo "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu", 1201abe9b8aSliubo show_root_type(__entry->root_objectid), 1211abe9b8aSliubo (unsigned long long)__entry->generation, 1221abe9b8aSliubo (unsigned long)__entry->ino, 1231abe9b8aSliubo (unsigned long long)__entry->blocks, 1241abe9b8aSliubo (unsigned long long)__entry->disk_i_size, 1251abe9b8aSliubo (unsigned long long)__entry->last_trans, 1261abe9b8aSliubo (unsigned long long)__entry->logged_trans) 1271abe9b8aSliubo ); 1281abe9b8aSliubo 1291abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_new, 1301abe9b8aSliubo 1311abe9b8aSliubo TP_PROTO(struct inode *inode), 1321abe9b8aSliubo 1331abe9b8aSliubo TP_ARGS(inode) 1341abe9b8aSliubo ); 1351abe9b8aSliubo 1361abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_request, 1371abe9b8aSliubo 1381abe9b8aSliubo TP_PROTO(struct inode *inode), 1391abe9b8aSliubo 1401abe9b8aSliubo TP_ARGS(inode) 1411abe9b8aSliubo ); 1421abe9b8aSliubo 1431abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, 1441abe9b8aSliubo 1451abe9b8aSliubo TP_PROTO(struct inode *inode), 1461abe9b8aSliubo 1471abe9b8aSliubo TP_ARGS(inode) 1481abe9b8aSliubo ); 1491abe9b8aSliubo 1501abe9b8aSliubo #define __show_map_type(type) \ 1517f34b746Sliubo __print_symbolic_u64(type, \ 1521abe9b8aSliubo { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ 1531abe9b8aSliubo { EXTENT_MAP_HOLE, "HOLE" }, \ 1541abe9b8aSliubo { EXTENT_MAP_INLINE, "INLINE" }, \ 1551abe9b8aSliubo { EXTENT_MAP_DELALLOC, "DELALLOC" }) 1561abe9b8aSliubo 1571abe9b8aSliubo #define show_map_type(type) \ 1581abe9b8aSliubo type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) 1591abe9b8aSliubo 1601abe9b8aSliubo #define show_map_flags(flag) \ 1611abe9b8aSliubo __print_flags(flag, "|", \ 162254a2d14SLiu Bo { (1 << EXTENT_FLAG_PINNED), "PINNED" },\ 163254a2d14SLiu Bo { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\ 164254a2d14SLiu Bo { (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\ 165254a2d14SLiu Bo { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\ 166254a2d14SLiu Bo { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\ 167254a2d14SLiu Bo { (1 << EXTENT_FLAG_FILLING), "FILLING" },\ 168254a2d14SLiu Bo { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" }) 1691abe9b8aSliubo 1704cd8587cSSteven Rostedt TRACE_EVENT_CONDITION(btrfs_get_extent, 1711abe9b8aSliubo 1721abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct extent_map *map), 1731abe9b8aSliubo 1741abe9b8aSliubo TP_ARGS(root, map), 1751abe9b8aSliubo 1764cd8587cSSteven Rostedt TP_CONDITION(map), 1774cd8587cSSteven Rostedt 1781abe9b8aSliubo TP_STRUCT__entry( 1791abe9b8aSliubo __field( u64, root_objectid ) 1801abe9b8aSliubo __field( u64, start ) 1811abe9b8aSliubo __field( u64, len ) 1821abe9b8aSliubo __field( u64, orig_start ) 1831abe9b8aSliubo __field( u64, block_start ) 1841abe9b8aSliubo __field( u64, block_len ) 1851abe9b8aSliubo __field( unsigned long, flags ) 1861abe9b8aSliubo __field( int, refs ) 1871abe9b8aSliubo __field( unsigned int, compress_type ) 1881abe9b8aSliubo ), 1891abe9b8aSliubo 1901abe9b8aSliubo TP_fast_assign( 1911abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 1921abe9b8aSliubo __entry->start = map->start; 1931abe9b8aSliubo __entry->len = map->len; 1941abe9b8aSliubo __entry->orig_start = map->orig_start; 1951abe9b8aSliubo __entry->block_start = map->block_start; 1961abe9b8aSliubo __entry->block_len = map->block_len; 1971abe9b8aSliubo __entry->flags = map->flags; 1981abe9b8aSliubo __entry->refs = atomic_read(&map->refs); 1991abe9b8aSliubo __entry->compress_type = map->compress_type; 2001abe9b8aSliubo ), 2011abe9b8aSliubo 2021abe9b8aSliubo TP_printk("root = %llu(%s), start = %llu, len = %llu, " 2031abe9b8aSliubo "orig_start = %llu, block_start = %llu(%s), " 2041abe9b8aSliubo "block_len = %llu, flags = %s, refs = %u, " 2051abe9b8aSliubo "compress_type = %u", 2061abe9b8aSliubo show_root_type(__entry->root_objectid), 2071abe9b8aSliubo (unsigned long long)__entry->start, 2081abe9b8aSliubo (unsigned long long)__entry->len, 2091abe9b8aSliubo (unsigned long long)__entry->orig_start, 2101abe9b8aSliubo show_map_type(__entry->block_start), 2111abe9b8aSliubo (unsigned long long)__entry->block_len, 2121abe9b8aSliubo show_map_flags(__entry->flags), 2131abe9b8aSliubo __entry->refs, __entry->compress_type) 2141abe9b8aSliubo ); 2151abe9b8aSliubo 2161abe9b8aSliubo #define show_ordered_flags(flags) \ 2179d04a8ceSLiu Bo __print_flags(flags, "|", \ 2189d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ 2199d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ 2209d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ 2219d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ 2229d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ 2239d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ 2249d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ 2259d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \ 226792ddef0SLiu Bo { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \ 227792ddef0SLiu Bo { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) 228e112e2b4SLiu Bo 2291abe9b8aSliubo 2301abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__ordered_extent, 2311abe9b8aSliubo 2321abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 2331abe9b8aSliubo 2341abe9b8aSliubo TP_ARGS(inode, ordered), 2351abe9b8aSliubo 2361abe9b8aSliubo TP_STRUCT__entry( 2371abe9b8aSliubo __field( ino_t, ino ) 2381abe9b8aSliubo __field( u64, file_offset ) 2391abe9b8aSliubo __field( u64, start ) 2401abe9b8aSliubo __field( u64, len ) 2411abe9b8aSliubo __field( u64, disk_len ) 2421abe9b8aSliubo __field( u64, bytes_left ) 2431abe9b8aSliubo __field( unsigned long, flags ) 2441abe9b8aSliubo __field( int, compress_type ) 2451abe9b8aSliubo __field( int, refs ) 2461abe9b8aSliubo __field( u64, root_objectid ) 2471abe9b8aSliubo ), 2481abe9b8aSliubo 2491abe9b8aSliubo TP_fast_assign( 2501abe9b8aSliubo __entry->ino = inode->i_ino; 2511abe9b8aSliubo __entry->file_offset = ordered->file_offset; 2521abe9b8aSliubo __entry->start = ordered->start; 2531abe9b8aSliubo __entry->len = ordered->len; 2541abe9b8aSliubo __entry->disk_len = ordered->disk_len; 2551abe9b8aSliubo __entry->bytes_left = ordered->bytes_left; 2561abe9b8aSliubo __entry->flags = ordered->flags; 2571abe9b8aSliubo __entry->compress_type = ordered->compress_type; 2581abe9b8aSliubo __entry->refs = atomic_read(&ordered->refs); 2591abe9b8aSliubo __entry->root_objectid = 2601abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 2611abe9b8aSliubo ), 2621abe9b8aSliubo 2631abe9b8aSliubo TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, " 2641abe9b8aSliubo "start = %llu, len = %llu, disk_len = %llu, " 2651abe9b8aSliubo "bytes_left = %llu, flags = %s, compress_type = %d, " 2661abe9b8aSliubo "refs = %d", 2671abe9b8aSliubo show_root_type(__entry->root_objectid), 2681abe9b8aSliubo (unsigned long long)__entry->ino, 2691abe9b8aSliubo (unsigned long long)__entry->file_offset, 2701abe9b8aSliubo (unsigned long long)__entry->start, 2711abe9b8aSliubo (unsigned long long)__entry->len, 2721abe9b8aSliubo (unsigned long long)__entry->disk_len, 2731abe9b8aSliubo (unsigned long long)__entry->bytes_left, 2741abe9b8aSliubo show_ordered_flags(__entry->flags), 2751abe9b8aSliubo __entry->compress_type, __entry->refs) 2761abe9b8aSliubo ); 2771abe9b8aSliubo 2781abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, 2791abe9b8aSliubo 2801abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 2811abe9b8aSliubo 2821abe9b8aSliubo TP_ARGS(inode, ordered) 2831abe9b8aSliubo ); 2841abe9b8aSliubo 2851abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, 2861abe9b8aSliubo 2871abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 2881abe9b8aSliubo 2891abe9b8aSliubo TP_ARGS(inode, ordered) 2901abe9b8aSliubo ); 2911abe9b8aSliubo 2921abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, 2931abe9b8aSliubo 2941abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 2951abe9b8aSliubo 2961abe9b8aSliubo TP_ARGS(inode, ordered) 2971abe9b8aSliubo ); 2981abe9b8aSliubo 2991abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, 3001abe9b8aSliubo 3011abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 3021abe9b8aSliubo 3031abe9b8aSliubo TP_ARGS(inode, ordered) 3041abe9b8aSliubo ); 3051abe9b8aSliubo 3061abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__writepage, 3071abe9b8aSliubo 3081abe9b8aSliubo TP_PROTO(struct page *page, struct inode *inode, 3091abe9b8aSliubo struct writeback_control *wbc), 3101abe9b8aSliubo 3111abe9b8aSliubo TP_ARGS(page, inode, wbc), 3121abe9b8aSliubo 3131abe9b8aSliubo TP_STRUCT__entry( 3141abe9b8aSliubo __field( ino_t, ino ) 3151abe9b8aSliubo __field( pgoff_t, index ) 3161abe9b8aSliubo __field( long, nr_to_write ) 3171abe9b8aSliubo __field( long, pages_skipped ) 3181abe9b8aSliubo __field( loff_t, range_start ) 3191abe9b8aSliubo __field( loff_t, range_end ) 3201abe9b8aSliubo __field( char, for_kupdate ) 3211abe9b8aSliubo __field( char, for_reclaim ) 3221abe9b8aSliubo __field( char, range_cyclic ) 3231abe9b8aSliubo __field( pgoff_t, writeback_index ) 3241abe9b8aSliubo __field( u64, root_objectid ) 3251abe9b8aSliubo ), 3261abe9b8aSliubo 3271abe9b8aSliubo TP_fast_assign( 3281abe9b8aSliubo __entry->ino = inode->i_ino; 3291abe9b8aSliubo __entry->index = page->index; 3301abe9b8aSliubo __entry->nr_to_write = wbc->nr_to_write; 3311abe9b8aSliubo __entry->pages_skipped = wbc->pages_skipped; 3321abe9b8aSliubo __entry->range_start = wbc->range_start; 3331abe9b8aSliubo __entry->range_end = wbc->range_end; 3341abe9b8aSliubo __entry->for_kupdate = wbc->for_kupdate; 3351abe9b8aSliubo __entry->for_reclaim = wbc->for_reclaim; 3361abe9b8aSliubo __entry->range_cyclic = wbc->range_cyclic; 3371abe9b8aSliubo __entry->writeback_index = inode->i_mapping->writeback_index; 3381abe9b8aSliubo __entry->root_objectid = 3391abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 3401abe9b8aSliubo ), 3411abe9b8aSliubo 3421abe9b8aSliubo TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, " 3431abe9b8aSliubo "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, " 344846d5a09SWu Fengguang "range_end = %llu, for_kupdate = %d, " 3451abe9b8aSliubo "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu", 3461abe9b8aSliubo show_root_type(__entry->root_objectid), 3471abe9b8aSliubo (unsigned long)__entry->ino, __entry->index, 3481abe9b8aSliubo __entry->nr_to_write, __entry->pages_skipped, 3491abe9b8aSliubo __entry->range_start, __entry->range_end, 350846d5a09SWu Fengguang __entry->for_kupdate, 3511abe9b8aSliubo __entry->for_reclaim, __entry->range_cyclic, 3521abe9b8aSliubo (unsigned long)__entry->writeback_index) 3531abe9b8aSliubo ); 3541abe9b8aSliubo 3551abe9b8aSliubo DEFINE_EVENT(btrfs__writepage, __extent_writepage, 3561abe9b8aSliubo 3571abe9b8aSliubo TP_PROTO(struct page *page, struct inode *inode, 3581abe9b8aSliubo struct writeback_control *wbc), 3591abe9b8aSliubo 3601abe9b8aSliubo TP_ARGS(page, inode, wbc) 3611abe9b8aSliubo ); 3621abe9b8aSliubo 3631abe9b8aSliubo TRACE_EVENT(btrfs_writepage_end_io_hook, 3641abe9b8aSliubo 3651abe9b8aSliubo TP_PROTO(struct page *page, u64 start, u64 end, int uptodate), 3661abe9b8aSliubo 3671abe9b8aSliubo TP_ARGS(page, start, end, uptodate), 3681abe9b8aSliubo 3691abe9b8aSliubo TP_STRUCT__entry( 3701abe9b8aSliubo __field( ino_t, ino ) 3711abe9b8aSliubo __field( pgoff_t, index ) 3721abe9b8aSliubo __field( u64, start ) 3731abe9b8aSliubo __field( u64, end ) 3741abe9b8aSliubo __field( int, uptodate ) 3751abe9b8aSliubo __field( u64, root_objectid ) 3761abe9b8aSliubo ), 3771abe9b8aSliubo 3781abe9b8aSliubo TP_fast_assign( 3791abe9b8aSliubo __entry->ino = page->mapping->host->i_ino; 3801abe9b8aSliubo __entry->index = page->index; 3811abe9b8aSliubo __entry->start = start; 3821abe9b8aSliubo __entry->end = end; 3831abe9b8aSliubo __entry->uptodate = uptodate; 3841abe9b8aSliubo __entry->root_objectid = 3851abe9b8aSliubo BTRFS_I(page->mapping->host)->root->root_key.objectid; 3861abe9b8aSliubo ), 3871abe9b8aSliubo 3881abe9b8aSliubo TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, " 3891abe9b8aSliubo "end = %llu, uptodate = %d", 3901abe9b8aSliubo show_root_type(__entry->root_objectid), 3911abe9b8aSliubo (unsigned long)__entry->ino, (unsigned long)__entry->index, 3921abe9b8aSliubo (unsigned long long)__entry->start, 3931abe9b8aSliubo (unsigned long long)__entry->end, __entry->uptodate) 3941abe9b8aSliubo ); 3951abe9b8aSliubo 3961abe9b8aSliubo TRACE_EVENT(btrfs_sync_file, 3971abe9b8aSliubo 3981abe9b8aSliubo TP_PROTO(struct file *file, int datasync), 3991abe9b8aSliubo 4001abe9b8aSliubo TP_ARGS(file, datasync), 4011abe9b8aSliubo 4021abe9b8aSliubo TP_STRUCT__entry( 4031abe9b8aSliubo __field( ino_t, ino ) 4041abe9b8aSliubo __field( ino_t, parent ) 4051abe9b8aSliubo __field( int, datasync ) 4061abe9b8aSliubo __field( u64, root_objectid ) 4071abe9b8aSliubo ), 4081abe9b8aSliubo 4091abe9b8aSliubo TP_fast_assign( 4101abe9b8aSliubo struct dentry *dentry = file->f_path.dentry; 4112b0143b5SDavid Howells struct inode *inode = d_inode(dentry); 4121abe9b8aSliubo 4131abe9b8aSliubo __entry->ino = inode->i_ino; 4142b0143b5SDavid Howells __entry->parent = d_inode(dentry->d_parent)->i_ino; 4151abe9b8aSliubo __entry->datasync = datasync; 4161abe9b8aSliubo __entry->root_objectid = 4171abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 4181abe9b8aSliubo ), 4191abe9b8aSliubo 4201abe9b8aSliubo TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d", 4211abe9b8aSliubo show_root_type(__entry->root_objectid), 4221abe9b8aSliubo (unsigned long)__entry->ino, (unsigned long)__entry->parent, 4231abe9b8aSliubo __entry->datasync) 4241abe9b8aSliubo ); 4251abe9b8aSliubo 4261abe9b8aSliubo TRACE_EVENT(btrfs_sync_fs, 4271abe9b8aSliubo 4281abe9b8aSliubo TP_PROTO(int wait), 4291abe9b8aSliubo 4301abe9b8aSliubo TP_ARGS(wait), 4311abe9b8aSliubo 4321abe9b8aSliubo TP_STRUCT__entry( 4331abe9b8aSliubo __field( int, wait ) 4341abe9b8aSliubo ), 4351abe9b8aSliubo 4361abe9b8aSliubo TP_fast_assign( 4371abe9b8aSliubo __entry->wait = wait; 4381abe9b8aSliubo ), 4391abe9b8aSliubo 4401abe9b8aSliubo TP_printk("wait = %d", __entry->wait) 4411abe9b8aSliubo ); 4421abe9b8aSliubo 443c83f8effSJosef Bacik TRACE_EVENT(btrfs_add_block_group, 444c83f8effSJosef Bacik 445c83f8effSJosef Bacik TP_PROTO(struct btrfs_fs_info *fs_info, 446c83f8effSJosef Bacik struct btrfs_block_group_cache *block_group, int create), 447c83f8effSJosef Bacik 448c83f8effSJosef Bacik TP_ARGS(fs_info, block_group, create), 449c83f8effSJosef Bacik 450c83f8effSJosef Bacik TP_STRUCT__entry( 451c83f8effSJosef Bacik __array( u8, fsid, BTRFS_UUID_SIZE ) 452c83f8effSJosef Bacik __field( u64, offset ) 453c83f8effSJosef Bacik __field( u64, size ) 454c83f8effSJosef Bacik __field( u64, flags ) 455c83f8effSJosef Bacik __field( u64, bytes_used ) 456c83f8effSJosef Bacik __field( u64, bytes_super ) 457c83f8effSJosef Bacik __field( int, create ) 458c83f8effSJosef Bacik ), 459c83f8effSJosef Bacik 460c83f8effSJosef Bacik TP_fast_assign( 461c83f8effSJosef Bacik memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE); 462c83f8effSJosef Bacik __entry->offset = block_group->key.objectid; 463c83f8effSJosef Bacik __entry->size = block_group->key.offset; 464c83f8effSJosef Bacik __entry->flags = block_group->flags; 465c83f8effSJosef Bacik __entry->bytes_used = 466c83f8effSJosef Bacik btrfs_block_group_used(&block_group->item); 467c83f8effSJosef Bacik __entry->bytes_super = block_group->bytes_super; 468c83f8effSJosef Bacik __entry->create = create; 469c83f8effSJosef Bacik ), 470c83f8effSJosef Bacik 471c83f8effSJosef Bacik TP_printk("%pU: block_group offset = %llu, size = %llu, " 472c83f8effSJosef Bacik "flags = %llu(%s), bytes_used = %llu, bytes_super = %llu, " 473c83f8effSJosef Bacik "create = %d", __entry->fsid, 474c83f8effSJosef Bacik (unsigned long long)__entry->offset, 475c83f8effSJosef Bacik (unsigned long long)__entry->size, 476c83f8effSJosef Bacik (unsigned long long)__entry->flags, 477c83f8effSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 478c83f8effSJosef Bacik BTRFS_GROUP_FLAGS), 479c83f8effSJosef Bacik (unsigned long long)__entry->bytes_used, 480c83f8effSJosef Bacik (unsigned long long)__entry->bytes_super, __entry->create) 481c83f8effSJosef Bacik ); 482c83f8effSJosef Bacik 4831abe9b8aSliubo #define show_ref_action(action) \ 4841abe9b8aSliubo __print_symbolic(action, \ 4851abe9b8aSliubo { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ 4861abe9b8aSliubo { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ 4871abe9b8aSliubo { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ 4881abe9b8aSliubo { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) 4891abe9b8aSliubo 4901abe9b8aSliubo 491599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, 4921abe9b8aSliubo 4931abe9b8aSliubo TP_PROTO(struct btrfs_delayed_ref_node *ref, 4941abe9b8aSliubo struct btrfs_delayed_tree_ref *full_ref, 4951abe9b8aSliubo int action), 4961abe9b8aSliubo 4971abe9b8aSliubo TP_ARGS(ref, full_ref, action), 4981abe9b8aSliubo 4991abe9b8aSliubo TP_STRUCT__entry( 5001abe9b8aSliubo __field( u64, bytenr ) 5011abe9b8aSliubo __field( u64, num_bytes ) 5021abe9b8aSliubo __field( int, action ) 5031abe9b8aSliubo __field( u64, parent ) 5041abe9b8aSliubo __field( u64, ref_root ) 5051abe9b8aSliubo __field( int, level ) 5061abe9b8aSliubo __field( int, type ) 507dea7d76eSLiu Bo __field( u64, seq ) 5081abe9b8aSliubo ), 5091abe9b8aSliubo 5101abe9b8aSliubo TP_fast_assign( 5111abe9b8aSliubo __entry->bytenr = ref->bytenr; 5121abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 5131abe9b8aSliubo __entry->action = action; 5141abe9b8aSliubo __entry->parent = full_ref->parent; 5151abe9b8aSliubo __entry->ref_root = full_ref->root; 5161abe9b8aSliubo __entry->level = full_ref->level; 5171abe9b8aSliubo __entry->type = ref->type; 518dea7d76eSLiu Bo __entry->seq = ref->seq; 5191abe9b8aSliubo ), 5201abe9b8aSliubo 5211abe9b8aSliubo TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " 5221abe9b8aSliubo "parent = %llu(%s), ref_root = %llu(%s), level = %d, " 523dea7d76eSLiu Bo "type = %s, seq = %llu", 5241abe9b8aSliubo (unsigned long long)__entry->bytenr, 5251abe9b8aSliubo (unsigned long long)__entry->num_bytes, 5261abe9b8aSliubo show_ref_action(__entry->action), 5271abe9b8aSliubo show_root_type(__entry->parent), 5281abe9b8aSliubo show_root_type(__entry->ref_root), 529dea7d76eSLiu Bo __entry->level, show_ref_type(__entry->type), 530dea7d76eSLiu Bo (unsigned long long)__entry->seq) 5311abe9b8aSliubo ); 5321abe9b8aSliubo 533599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, 534599c75ecSLiu Bo 535599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 536599c75ecSLiu Bo struct btrfs_delayed_tree_ref *full_ref, 537599c75ecSLiu Bo int action), 538599c75ecSLiu Bo 539599c75ecSLiu Bo TP_ARGS(ref, full_ref, action) 540599c75ecSLiu Bo ); 541599c75ecSLiu Bo 542599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, 543599c75ecSLiu Bo 544599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 545599c75ecSLiu Bo struct btrfs_delayed_tree_ref *full_ref, 546599c75ecSLiu Bo int action), 547599c75ecSLiu Bo 548599c75ecSLiu Bo TP_ARGS(ref, full_ref, action) 549599c75ecSLiu Bo ); 550599c75ecSLiu Bo 551599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, 5521abe9b8aSliubo 5531abe9b8aSliubo TP_PROTO(struct btrfs_delayed_ref_node *ref, 5541abe9b8aSliubo struct btrfs_delayed_data_ref *full_ref, 5551abe9b8aSliubo int action), 5561abe9b8aSliubo 5571abe9b8aSliubo TP_ARGS(ref, full_ref, action), 5581abe9b8aSliubo 5591abe9b8aSliubo TP_STRUCT__entry( 5601abe9b8aSliubo __field( u64, bytenr ) 5611abe9b8aSliubo __field( u64, num_bytes ) 5621abe9b8aSliubo __field( int, action ) 5631abe9b8aSliubo __field( u64, parent ) 5641abe9b8aSliubo __field( u64, ref_root ) 5651abe9b8aSliubo __field( u64, owner ) 5661abe9b8aSliubo __field( u64, offset ) 5671abe9b8aSliubo __field( int, type ) 568dea7d76eSLiu Bo __field( u64, seq ) 5691abe9b8aSliubo ), 5701abe9b8aSliubo 5711abe9b8aSliubo TP_fast_assign( 5721abe9b8aSliubo __entry->bytenr = ref->bytenr; 5731abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 5741abe9b8aSliubo __entry->action = action; 5751abe9b8aSliubo __entry->parent = full_ref->parent; 5761abe9b8aSliubo __entry->ref_root = full_ref->root; 5771abe9b8aSliubo __entry->owner = full_ref->objectid; 5781abe9b8aSliubo __entry->offset = full_ref->offset; 5791abe9b8aSliubo __entry->type = ref->type; 580dea7d76eSLiu Bo __entry->seq = ref->seq; 5811abe9b8aSliubo ), 5821abe9b8aSliubo 5831abe9b8aSliubo TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " 5841abe9b8aSliubo "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, " 585dea7d76eSLiu Bo "offset = %llu, type = %s, seq = %llu", 5861abe9b8aSliubo (unsigned long long)__entry->bytenr, 5871abe9b8aSliubo (unsigned long long)__entry->num_bytes, 5881abe9b8aSliubo show_ref_action(__entry->action), 5891abe9b8aSliubo show_root_type(__entry->parent), 5901abe9b8aSliubo show_root_type(__entry->ref_root), 5911abe9b8aSliubo (unsigned long long)__entry->owner, 5921abe9b8aSliubo (unsigned long long)__entry->offset, 593dea7d76eSLiu Bo show_ref_type(__entry->type), 594dea7d76eSLiu Bo (unsigned long long)__entry->seq) 5951abe9b8aSliubo ); 5961abe9b8aSliubo 597599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, 598599c75ecSLiu Bo 599599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 600599c75ecSLiu Bo struct btrfs_delayed_data_ref *full_ref, 601599c75ecSLiu Bo int action), 602599c75ecSLiu Bo 603599c75ecSLiu Bo TP_ARGS(ref, full_ref, action) 604599c75ecSLiu Bo ); 605599c75ecSLiu Bo 606599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, 607599c75ecSLiu Bo 608599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 609599c75ecSLiu Bo struct btrfs_delayed_data_ref *full_ref, 610599c75ecSLiu Bo int action), 611599c75ecSLiu Bo 612599c75ecSLiu Bo TP_ARGS(ref, full_ref, action) 613599c75ecSLiu Bo ); 614599c75ecSLiu Bo 615599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, 6161abe9b8aSliubo 6171abe9b8aSliubo TP_PROTO(struct btrfs_delayed_ref_node *ref, 6181abe9b8aSliubo struct btrfs_delayed_ref_head *head_ref, 6191abe9b8aSliubo int action), 6201abe9b8aSliubo 6211abe9b8aSliubo TP_ARGS(ref, head_ref, action), 6221abe9b8aSliubo 6231abe9b8aSliubo TP_STRUCT__entry( 6241abe9b8aSliubo __field( u64, bytenr ) 6251abe9b8aSliubo __field( u64, num_bytes ) 6261abe9b8aSliubo __field( int, action ) 6271abe9b8aSliubo __field( int, is_data ) 6281abe9b8aSliubo ), 6291abe9b8aSliubo 6301abe9b8aSliubo TP_fast_assign( 6311abe9b8aSliubo __entry->bytenr = ref->bytenr; 6321abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 6331abe9b8aSliubo __entry->action = action; 6341abe9b8aSliubo __entry->is_data = head_ref->is_data; 6351abe9b8aSliubo ), 6361abe9b8aSliubo 6371abe9b8aSliubo TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d", 6381abe9b8aSliubo (unsigned long long)__entry->bytenr, 6391abe9b8aSliubo (unsigned long long)__entry->num_bytes, 6401abe9b8aSliubo show_ref_action(__entry->action), 6411abe9b8aSliubo __entry->is_data) 6421abe9b8aSliubo ); 6431abe9b8aSliubo 644599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, 645599c75ecSLiu Bo 646599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 647599c75ecSLiu Bo struct btrfs_delayed_ref_head *head_ref, 648599c75ecSLiu Bo int action), 649599c75ecSLiu Bo 650599c75ecSLiu Bo TP_ARGS(ref, head_ref, action) 651599c75ecSLiu Bo ); 652599c75ecSLiu Bo 653599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, 654599c75ecSLiu Bo 655599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 656599c75ecSLiu Bo struct btrfs_delayed_ref_head *head_ref, 657599c75ecSLiu Bo int action), 658599c75ecSLiu Bo 659599c75ecSLiu Bo TP_ARGS(ref, head_ref, action) 660599c75ecSLiu Bo ); 661599c75ecSLiu Bo 6621abe9b8aSliubo #define show_chunk_type(type) \ 6631abe9b8aSliubo __print_flags(type, "|", \ 6641abe9b8aSliubo { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ 6651abe9b8aSliubo { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 6661abe9b8aSliubo { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 6671abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ 6681abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ 6691abe9b8aSliubo { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ 670e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 671e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ 672e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) 6731abe9b8aSliubo 6741abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__chunk, 6751abe9b8aSliubo 6761abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct map_lookup *map, 6771abe9b8aSliubo u64 offset, u64 size), 6781abe9b8aSliubo 6791abe9b8aSliubo TP_ARGS(root, map, offset, size), 6801abe9b8aSliubo 6811abe9b8aSliubo TP_STRUCT__entry( 6821abe9b8aSliubo __field( int, num_stripes ) 6831abe9b8aSliubo __field( u64, type ) 6841abe9b8aSliubo __field( int, sub_stripes ) 6851abe9b8aSliubo __field( u64, offset ) 6861abe9b8aSliubo __field( u64, size ) 6871abe9b8aSliubo __field( u64, root_objectid ) 6881abe9b8aSliubo ), 6891abe9b8aSliubo 6901abe9b8aSliubo TP_fast_assign( 6911abe9b8aSliubo __entry->num_stripes = map->num_stripes; 6921abe9b8aSliubo __entry->type = map->type; 6931abe9b8aSliubo __entry->sub_stripes = map->sub_stripes; 6941abe9b8aSliubo __entry->offset = offset; 6951abe9b8aSliubo __entry->size = size; 6961abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 6971abe9b8aSliubo ), 6981abe9b8aSliubo 6991abe9b8aSliubo TP_printk("root = %llu(%s), offset = %llu, size = %llu, " 7001abe9b8aSliubo "num_stripes = %d, sub_stripes = %d, type = %s", 7011abe9b8aSliubo show_root_type(__entry->root_objectid), 7021abe9b8aSliubo (unsigned long long)__entry->offset, 7031abe9b8aSliubo (unsigned long long)__entry->size, 7041abe9b8aSliubo __entry->num_stripes, __entry->sub_stripes, 7051abe9b8aSliubo show_chunk_type(__entry->type)) 7061abe9b8aSliubo ); 7071abe9b8aSliubo 7081abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, 7091abe9b8aSliubo 7101abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct map_lookup *map, 7111abe9b8aSliubo u64 offset, u64 size), 7121abe9b8aSliubo 7131abe9b8aSliubo TP_ARGS(root, map, offset, size) 7141abe9b8aSliubo ); 7151abe9b8aSliubo 7161abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, 7171abe9b8aSliubo 7181abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct map_lookup *map, 7191abe9b8aSliubo u64 offset, u64 size), 7201abe9b8aSliubo 7211abe9b8aSliubo TP_ARGS(root, map, offset, size) 7221abe9b8aSliubo ); 7231abe9b8aSliubo 7241abe9b8aSliubo TRACE_EVENT(btrfs_cow_block, 7251abe9b8aSliubo 7261abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf, 7271abe9b8aSliubo struct extent_buffer *cow), 7281abe9b8aSliubo 7291abe9b8aSliubo TP_ARGS(root, buf, cow), 7301abe9b8aSliubo 7311abe9b8aSliubo TP_STRUCT__entry( 7321abe9b8aSliubo __field( u64, root_objectid ) 7331abe9b8aSliubo __field( u64, buf_start ) 7341abe9b8aSliubo __field( int, refs ) 7351abe9b8aSliubo __field( u64, cow_start ) 7361abe9b8aSliubo __field( int, buf_level ) 7371abe9b8aSliubo __field( int, cow_level ) 7381abe9b8aSliubo ), 7391abe9b8aSliubo 7401abe9b8aSliubo TP_fast_assign( 7411abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 7421abe9b8aSliubo __entry->buf_start = buf->start; 7431abe9b8aSliubo __entry->refs = atomic_read(&buf->refs); 7441abe9b8aSliubo __entry->cow_start = cow->start; 7451abe9b8aSliubo __entry->buf_level = btrfs_header_level(buf); 7461abe9b8aSliubo __entry->cow_level = btrfs_header_level(cow); 7471abe9b8aSliubo ), 7481abe9b8aSliubo 7491abe9b8aSliubo TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu " 7501abe9b8aSliubo "(orig_level = %d), cow_buf = %llu (cow_level = %d)", 7511abe9b8aSliubo show_root_type(__entry->root_objectid), 7521abe9b8aSliubo __entry->refs, 7531abe9b8aSliubo (unsigned long long)__entry->buf_start, 7541abe9b8aSliubo __entry->buf_level, 7551abe9b8aSliubo (unsigned long long)__entry->cow_start, 7561abe9b8aSliubo __entry->cow_level) 7571abe9b8aSliubo ); 7581abe9b8aSliubo 7598c2a3ca2SJosef Bacik TRACE_EVENT(btrfs_space_reservation, 7608c2a3ca2SJosef Bacik 7618c2a3ca2SJosef Bacik TP_PROTO(struct btrfs_fs_info *fs_info, char *type, u64 val, 7628c2a3ca2SJosef Bacik u64 bytes, int reserve), 7638c2a3ca2SJosef Bacik 7648c2a3ca2SJosef Bacik TP_ARGS(fs_info, type, val, bytes, reserve), 7658c2a3ca2SJosef Bacik 7668c2a3ca2SJosef Bacik TP_STRUCT__entry( 7678c2a3ca2SJosef Bacik __array( u8, fsid, BTRFS_UUID_SIZE ) 7688c2a3ca2SJosef Bacik __string( type, type ) 7698c2a3ca2SJosef Bacik __field( u64, val ) 7708c2a3ca2SJosef Bacik __field( u64, bytes ) 7718c2a3ca2SJosef Bacik __field( int, reserve ) 7728c2a3ca2SJosef Bacik ), 7738c2a3ca2SJosef Bacik 7748c2a3ca2SJosef Bacik TP_fast_assign( 7758c2a3ca2SJosef Bacik memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE); 7768c2a3ca2SJosef Bacik __assign_str(type, type); 7778c2a3ca2SJosef Bacik __entry->val = val; 7788c2a3ca2SJosef Bacik __entry->bytes = bytes; 7798c2a3ca2SJosef Bacik __entry->reserve = reserve; 7808c2a3ca2SJosef Bacik ), 7818c2a3ca2SJosef Bacik 7828c2a3ca2SJosef Bacik TP_printk("%pU: %s: %Lu %s %Lu", __entry->fsid, __get_str(type), 7838c2a3ca2SJosef Bacik __entry->val, __entry->reserve ? "reserve" : "release", 7848c2a3ca2SJosef Bacik __entry->bytes) 7858c2a3ca2SJosef Bacik ); 7868c2a3ca2SJosef Bacik 7871abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__reserved_extent, 7881abe9b8aSliubo 7891abe9b8aSliubo TP_PROTO(struct btrfs_root *root, u64 start, u64 len), 7901abe9b8aSliubo 7911abe9b8aSliubo TP_ARGS(root, start, len), 7921abe9b8aSliubo 7931abe9b8aSliubo TP_STRUCT__entry( 7941abe9b8aSliubo __field( u64, root_objectid ) 7951abe9b8aSliubo __field( u64, start ) 7961abe9b8aSliubo __field( u64, len ) 7971abe9b8aSliubo ), 7981abe9b8aSliubo 7991abe9b8aSliubo TP_fast_assign( 8001abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 8011abe9b8aSliubo __entry->start = start; 8021abe9b8aSliubo __entry->len = len; 8031abe9b8aSliubo ), 8041abe9b8aSliubo 8051abe9b8aSliubo TP_printk("root = %llu(%s), start = %llu, len = %llu", 8061abe9b8aSliubo show_root_type(__entry->root_objectid), 8071abe9b8aSliubo (unsigned long long)__entry->start, 8081abe9b8aSliubo (unsigned long long)__entry->len) 8091abe9b8aSliubo ); 8101abe9b8aSliubo 8111abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, 8121abe9b8aSliubo 8131abe9b8aSliubo TP_PROTO(struct btrfs_root *root, u64 start, u64 len), 8141abe9b8aSliubo 8151abe9b8aSliubo TP_ARGS(root, start, len) 8161abe9b8aSliubo ); 8171abe9b8aSliubo 8181abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, 8191abe9b8aSliubo 8201abe9b8aSliubo TP_PROTO(struct btrfs_root *root, u64 start, u64 len), 8211abe9b8aSliubo 8221abe9b8aSliubo TP_ARGS(root, start, len) 8231abe9b8aSliubo ); 8241abe9b8aSliubo 8253f7de037SJosef Bacik TRACE_EVENT(find_free_extent, 8263f7de037SJosef Bacik 8273f7de037SJosef Bacik TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size, 8283f7de037SJosef Bacik u64 data), 8293f7de037SJosef Bacik 8303f7de037SJosef Bacik TP_ARGS(root, num_bytes, empty_size, data), 8313f7de037SJosef Bacik 8323f7de037SJosef Bacik TP_STRUCT__entry( 8333f7de037SJosef Bacik __field( u64, root_objectid ) 8343f7de037SJosef Bacik __field( u64, num_bytes ) 8353f7de037SJosef Bacik __field( u64, empty_size ) 8363f7de037SJosef Bacik __field( u64, data ) 8373f7de037SJosef Bacik ), 8383f7de037SJosef Bacik 8393f7de037SJosef Bacik TP_fast_assign( 8403f7de037SJosef Bacik __entry->root_objectid = root->root_key.objectid; 8413f7de037SJosef Bacik __entry->num_bytes = num_bytes; 8423f7de037SJosef Bacik __entry->empty_size = empty_size; 8433f7de037SJosef Bacik __entry->data = data; 8443f7de037SJosef Bacik ), 8453f7de037SJosef Bacik 8463f7de037SJosef Bacik TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, " 8473f7de037SJosef Bacik "flags = %Lu(%s)", show_root_type(__entry->root_objectid), 8483f7de037SJosef Bacik __entry->num_bytes, __entry->empty_size, __entry->data, 8493f7de037SJosef Bacik __print_flags((unsigned long)__entry->data, "|", 8503f7de037SJosef Bacik BTRFS_GROUP_FLAGS)) 8513f7de037SJosef Bacik ); 8523f7de037SJosef Bacik 8533f7de037SJosef Bacik DECLARE_EVENT_CLASS(btrfs__reserve_extent, 8543f7de037SJosef Bacik 8553f7de037SJosef Bacik TP_PROTO(struct btrfs_root *root, 8563f7de037SJosef Bacik struct btrfs_block_group_cache *block_group, u64 start, 8573f7de037SJosef Bacik u64 len), 8583f7de037SJosef Bacik 8593f7de037SJosef Bacik TP_ARGS(root, block_group, start, len), 8603f7de037SJosef Bacik 8613f7de037SJosef Bacik TP_STRUCT__entry( 8623f7de037SJosef Bacik __field( u64, root_objectid ) 8633f7de037SJosef Bacik __field( u64, bg_objectid ) 8643f7de037SJosef Bacik __field( u64, flags ) 8653f7de037SJosef Bacik __field( u64, start ) 8663f7de037SJosef Bacik __field( u64, len ) 8673f7de037SJosef Bacik ), 8683f7de037SJosef Bacik 8693f7de037SJosef Bacik TP_fast_assign( 8703f7de037SJosef Bacik __entry->root_objectid = root->root_key.objectid; 8713f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 8723f7de037SJosef Bacik __entry->flags = block_group->flags; 8733f7de037SJosef Bacik __entry->start = start; 8743f7de037SJosef Bacik __entry->len = len; 8753f7de037SJosef Bacik ), 8763f7de037SJosef Bacik 8773f7de037SJosef Bacik TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), " 8783f7de037SJosef Bacik "start = %Lu, len = %Lu", 8793f7de037SJosef Bacik show_root_type(__entry->root_objectid), __entry->bg_objectid, 8803f7de037SJosef Bacik __entry->flags, __print_flags((unsigned long)__entry->flags, 8813f7de037SJosef Bacik "|", BTRFS_GROUP_FLAGS), 8823f7de037SJosef Bacik __entry->start, __entry->len) 8833f7de037SJosef Bacik ); 8843f7de037SJosef Bacik 8853f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, 8863f7de037SJosef Bacik 8873f7de037SJosef Bacik TP_PROTO(struct btrfs_root *root, 8883f7de037SJosef Bacik struct btrfs_block_group_cache *block_group, u64 start, 8893f7de037SJosef Bacik u64 len), 8903f7de037SJosef Bacik 8913f7de037SJosef Bacik TP_ARGS(root, block_group, start, len) 8923f7de037SJosef Bacik ); 8933f7de037SJosef Bacik 8943f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, 8953f7de037SJosef Bacik 8963f7de037SJosef Bacik TP_PROTO(struct btrfs_root *root, 8973f7de037SJosef Bacik struct btrfs_block_group_cache *block_group, u64 start, 8983f7de037SJosef Bacik u64 len), 8993f7de037SJosef Bacik 9003f7de037SJosef Bacik TP_ARGS(root, block_group, start, len) 9013f7de037SJosef Bacik ); 9023f7de037SJosef Bacik 9033f7de037SJosef Bacik TRACE_EVENT(btrfs_find_cluster, 9043f7de037SJosef Bacik 9053f7de037SJosef Bacik TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start, 9063f7de037SJosef Bacik u64 bytes, u64 empty_size, u64 min_bytes), 9073f7de037SJosef Bacik 9083f7de037SJosef Bacik TP_ARGS(block_group, start, bytes, empty_size, min_bytes), 9093f7de037SJosef Bacik 9103f7de037SJosef Bacik TP_STRUCT__entry( 9113f7de037SJosef Bacik __field( u64, bg_objectid ) 9123f7de037SJosef Bacik __field( u64, flags ) 9133f7de037SJosef Bacik __field( u64, start ) 9143f7de037SJosef Bacik __field( u64, bytes ) 9153f7de037SJosef Bacik __field( u64, empty_size ) 9163f7de037SJosef Bacik __field( u64, min_bytes ) 9173f7de037SJosef Bacik ), 9183f7de037SJosef Bacik 9193f7de037SJosef Bacik TP_fast_assign( 9203f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 9213f7de037SJosef Bacik __entry->flags = block_group->flags; 9223f7de037SJosef Bacik __entry->start = start; 9233f7de037SJosef Bacik __entry->bytes = bytes; 9243f7de037SJosef Bacik __entry->empty_size = empty_size; 9253f7de037SJosef Bacik __entry->min_bytes = min_bytes; 9263f7de037SJosef Bacik ), 9273f7de037SJosef Bacik 9283f7de037SJosef Bacik TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu," 9293f7de037SJosef Bacik " empty_size = %Lu, min_bytes = %Lu", __entry->bg_objectid, 9303f7de037SJosef Bacik __entry->flags, 9313f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 9323f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 9333f7de037SJosef Bacik __entry->bytes, __entry->empty_size, __entry->min_bytes) 9343f7de037SJosef Bacik ); 9353f7de037SJosef Bacik 9363f7de037SJosef Bacik TRACE_EVENT(btrfs_failed_cluster_setup, 9373f7de037SJosef Bacik 9383f7de037SJosef Bacik TP_PROTO(struct btrfs_block_group_cache *block_group), 9393f7de037SJosef Bacik 9403f7de037SJosef Bacik TP_ARGS(block_group), 9413f7de037SJosef Bacik 9423f7de037SJosef Bacik TP_STRUCT__entry( 9433f7de037SJosef Bacik __field( u64, bg_objectid ) 9443f7de037SJosef Bacik ), 9453f7de037SJosef Bacik 9463f7de037SJosef Bacik TP_fast_assign( 9473f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 9483f7de037SJosef Bacik ), 9493f7de037SJosef Bacik 9503f7de037SJosef Bacik TP_printk("block_group = %Lu", __entry->bg_objectid) 9513f7de037SJosef Bacik ); 9523f7de037SJosef Bacik 9533f7de037SJosef Bacik TRACE_EVENT(btrfs_setup_cluster, 9543f7de037SJosef Bacik 9553f7de037SJosef Bacik TP_PROTO(struct btrfs_block_group_cache *block_group, 9563f7de037SJosef Bacik struct btrfs_free_cluster *cluster, u64 size, int bitmap), 9573f7de037SJosef Bacik 9583f7de037SJosef Bacik TP_ARGS(block_group, cluster, size, bitmap), 9593f7de037SJosef Bacik 9603f7de037SJosef Bacik TP_STRUCT__entry( 9613f7de037SJosef Bacik __field( u64, bg_objectid ) 9623f7de037SJosef Bacik __field( u64, flags ) 9633f7de037SJosef Bacik __field( u64, start ) 9643f7de037SJosef Bacik __field( u64, max_size ) 9653f7de037SJosef Bacik __field( u64, size ) 9663f7de037SJosef Bacik __field( int, bitmap ) 9673f7de037SJosef Bacik ), 9683f7de037SJosef Bacik 9693f7de037SJosef Bacik TP_fast_assign( 9703f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 9713f7de037SJosef Bacik __entry->flags = block_group->flags; 9723f7de037SJosef Bacik __entry->start = cluster->window_start; 9733f7de037SJosef Bacik __entry->max_size = cluster->max_size; 9743f7de037SJosef Bacik __entry->size = size; 9753f7de037SJosef Bacik __entry->bitmap = bitmap; 9763f7de037SJosef Bacik ), 9773f7de037SJosef Bacik 9783f7de037SJosef Bacik TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, " 9793f7de037SJosef Bacik "size = %Lu, max_size = %Lu, bitmap = %d", 9803f7de037SJosef Bacik __entry->bg_objectid, 9813f7de037SJosef Bacik __entry->flags, 9823f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 9833f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 9843f7de037SJosef Bacik __entry->size, __entry->max_size, __entry->bitmap) 9853f7de037SJosef Bacik ); 9863f7de037SJosef Bacik 987143bede5SJeff Mahoney struct extent_state; 988143bede5SJeff Mahoney TRACE_EVENT(alloc_extent_state, 989143bede5SJeff Mahoney 990143bede5SJeff Mahoney TP_PROTO(struct extent_state *state, gfp_t mask, unsigned long IP), 991143bede5SJeff Mahoney 992143bede5SJeff Mahoney TP_ARGS(state, mask, IP), 993143bede5SJeff Mahoney 994143bede5SJeff Mahoney TP_STRUCT__entry( 995143bede5SJeff Mahoney __field(struct extent_state *, state) 996143bede5SJeff Mahoney __field(gfp_t, mask) 997143bede5SJeff Mahoney __field(unsigned long, ip) 998143bede5SJeff Mahoney ), 999143bede5SJeff Mahoney 1000143bede5SJeff Mahoney TP_fast_assign( 1001143bede5SJeff Mahoney __entry->state = state, 1002143bede5SJeff Mahoney __entry->mask = mask, 1003143bede5SJeff Mahoney __entry->ip = IP 1004143bede5SJeff Mahoney ), 1005143bede5SJeff Mahoney 1006bbedb179SScott Wood TP_printk("state=%p; mask = %s; caller = %pS", __entry->state, 1007143bede5SJeff Mahoney show_gfp_flags(__entry->mask), (void *)__entry->ip) 1008143bede5SJeff Mahoney ); 1009143bede5SJeff Mahoney 1010143bede5SJeff Mahoney TRACE_EVENT(free_extent_state, 1011143bede5SJeff Mahoney 1012143bede5SJeff Mahoney TP_PROTO(struct extent_state *state, unsigned long IP), 1013143bede5SJeff Mahoney 1014143bede5SJeff Mahoney TP_ARGS(state, IP), 1015143bede5SJeff Mahoney 1016143bede5SJeff Mahoney TP_STRUCT__entry( 1017143bede5SJeff Mahoney __field(struct extent_state *, state) 1018143bede5SJeff Mahoney __field(unsigned long, ip) 1019143bede5SJeff Mahoney ), 1020143bede5SJeff Mahoney 1021143bede5SJeff Mahoney TP_fast_assign( 1022143bede5SJeff Mahoney __entry->state = state, 1023143bede5SJeff Mahoney __entry->ip = IP 1024143bede5SJeff Mahoney ), 1025143bede5SJeff Mahoney 1026bbedb179SScott Wood TP_printk(" state=%p; caller = %pS", __entry->state, 1027143bede5SJeff Mahoney (void *)__entry->ip) 1028143bede5SJeff Mahoney ); 1029143bede5SJeff Mahoney 103052483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work, 103152483bc2SQu Wenruo 103252483bc2SQu Wenruo TP_PROTO(struct btrfs_work *work), 103352483bc2SQu Wenruo 103452483bc2SQu Wenruo TP_ARGS(work), 103552483bc2SQu Wenruo 103652483bc2SQu Wenruo TP_STRUCT__entry( 103752483bc2SQu Wenruo __field( void *, work ) 103852483bc2SQu Wenruo __field( void *, wq ) 103952483bc2SQu Wenruo __field( void *, func ) 104052483bc2SQu Wenruo __field( void *, ordered_func ) 104152483bc2SQu Wenruo __field( void *, ordered_free ) 1042b38a6258SLiu Bo __field( void *, normal_work ) 104352483bc2SQu Wenruo ), 104452483bc2SQu Wenruo 104552483bc2SQu Wenruo TP_fast_assign( 104652483bc2SQu Wenruo __entry->work = work; 104752483bc2SQu Wenruo __entry->wq = work->wq; 104852483bc2SQu Wenruo __entry->func = work->func; 104952483bc2SQu Wenruo __entry->ordered_func = work->ordered_func; 105052483bc2SQu Wenruo __entry->ordered_free = work->ordered_free; 1051b38a6258SLiu Bo __entry->normal_work = &work->normal_work; 105252483bc2SQu Wenruo ), 105352483bc2SQu Wenruo 1054b7831b20SLiu Bo TP_printk("work=%p (normal_work=%p), wq=%p, func=%pf, ordered_func=%p," 1055b38a6258SLiu Bo " ordered_free=%p", 1056b38a6258SLiu Bo __entry->work, __entry->normal_work, __entry->wq, 1057b38a6258SLiu Bo __entry->func, __entry->ordered_func, __entry->ordered_free) 105852483bc2SQu Wenruo ); 105952483bc2SQu Wenruo 106052483bc2SQu Wenruo /* For situiations that the work is freed */ 106152483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work__done, 106252483bc2SQu Wenruo 106352483bc2SQu Wenruo TP_PROTO(struct btrfs_work *work), 106452483bc2SQu Wenruo 106552483bc2SQu Wenruo TP_ARGS(work), 106652483bc2SQu Wenruo 106752483bc2SQu Wenruo TP_STRUCT__entry( 106852483bc2SQu Wenruo __field( void *, work ) 106952483bc2SQu Wenruo ), 107052483bc2SQu Wenruo 107152483bc2SQu Wenruo TP_fast_assign( 107252483bc2SQu Wenruo __entry->work = work; 107352483bc2SQu Wenruo ), 107452483bc2SQu Wenruo 107552483bc2SQu Wenruo TP_printk("work->%p", __entry->work) 107652483bc2SQu Wenruo ); 107752483bc2SQu Wenruo 107852483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_queued, 107952483bc2SQu Wenruo 108052483bc2SQu Wenruo TP_PROTO(struct btrfs_work *work), 108152483bc2SQu Wenruo 108252483bc2SQu Wenruo TP_ARGS(work) 108352483bc2SQu Wenruo ); 108452483bc2SQu Wenruo 108552483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_sched, 108652483bc2SQu Wenruo 108752483bc2SQu Wenruo TP_PROTO(struct btrfs_work *work), 108852483bc2SQu Wenruo 108952483bc2SQu Wenruo TP_ARGS(work) 109052483bc2SQu Wenruo ); 109152483bc2SQu Wenruo 109252483bc2SQu Wenruo DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, 109352483bc2SQu Wenruo 109452483bc2SQu Wenruo TP_PROTO(struct btrfs_work *work), 109552483bc2SQu Wenruo 109652483bc2SQu Wenruo TP_ARGS(work) 109752483bc2SQu Wenruo ); 109852483bc2SQu Wenruo 109952483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_ordered_sched, 110052483bc2SQu Wenruo 110152483bc2SQu Wenruo TP_PROTO(struct btrfs_work *work), 110252483bc2SQu Wenruo 110352483bc2SQu Wenruo TP_ARGS(work) 110452483bc2SQu Wenruo ); 110552483bc2SQu Wenruo 1106c3a46891SQu Wenruo DECLARE_EVENT_CLASS(btrfs__workqueue, 1107c3a46891SQu Wenruo 1108c3a46891SQu Wenruo TP_PROTO(struct __btrfs_workqueue *wq, const char *name, int high), 1109c3a46891SQu Wenruo 1110c3a46891SQu Wenruo TP_ARGS(wq, name, high), 1111c3a46891SQu Wenruo 1112c3a46891SQu Wenruo TP_STRUCT__entry( 1113c3a46891SQu Wenruo __field( void *, wq ) 1114c3a46891SQu Wenruo __string( name, name ) 1115c3a46891SQu Wenruo __field( int , high ) 1116c3a46891SQu Wenruo ), 1117c3a46891SQu Wenruo 1118c3a46891SQu Wenruo TP_fast_assign( 1119c3a46891SQu Wenruo __entry->wq = wq; 1120c3a46891SQu Wenruo __assign_str(name, name); 1121c3a46891SQu Wenruo __entry->high = high; 1122c3a46891SQu Wenruo ), 1123c3a46891SQu Wenruo 1124c3a46891SQu Wenruo TP_printk("name=%s%s, wq=%p", __get_str(name), 1125c3a46891SQu Wenruo __print_flags(__entry->high, "", 1126c3a46891SQu Wenruo {(WQ_HIGHPRI), "-high"}), 1127c3a46891SQu Wenruo __entry->wq) 1128c3a46891SQu Wenruo ); 1129c3a46891SQu Wenruo 1130c3a46891SQu Wenruo DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc, 1131c3a46891SQu Wenruo 1132c3a46891SQu Wenruo TP_PROTO(struct __btrfs_workqueue *wq, const char *name, int high), 1133c3a46891SQu Wenruo 1134c3a46891SQu Wenruo TP_ARGS(wq, name, high) 1135c3a46891SQu Wenruo ); 1136c3a46891SQu Wenruo 1137c3a46891SQu Wenruo DECLARE_EVENT_CLASS(btrfs__workqueue_done, 1138c3a46891SQu Wenruo 1139c3a46891SQu Wenruo TP_PROTO(struct __btrfs_workqueue *wq), 1140c3a46891SQu Wenruo 1141c3a46891SQu Wenruo TP_ARGS(wq), 1142c3a46891SQu Wenruo 1143c3a46891SQu Wenruo TP_STRUCT__entry( 1144c3a46891SQu Wenruo __field( void *, wq ) 1145c3a46891SQu Wenruo ), 1146c3a46891SQu Wenruo 1147c3a46891SQu Wenruo TP_fast_assign( 1148c3a46891SQu Wenruo __entry->wq = wq; 1149c3a46891SQu Wenruo ), 1150c3a46891SQu Wenruo 1151c3a46891SQu Wenruo TP_printk("wq=%p", __entry->wq) 1152c3a46891SQu Wenruo ); 1153c3a46891SQu Wenruo 1154c3a46891SQu Wenruo DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy, 1155c3a46891SQu Wenruo 1156c3a46891SQu Wenruo TP_PROTO(struct __btrfs_workqueue *wq), 1157c3a46891SQu Wenruo 1158c3a46891SQu Wenruo TP_ARGS(wq) 1159c3a46891SQu Wenruo ); 116052483bc2SQu Wenruo 116181fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_data_map, 116281fb6f77SQu Wenruo 116381fb6f77SQu Wenruo TP_PROTO(struct inode *inode, u64 free_reserved), 116481fb6f77SQu Wenruo 116581fb6f77SQu Wenruo TP_ARGS(inode, free_reserved), 116681fb6f77SQu Wenruo 116781fb6f77SQu Wenruo TP_STRUCT__entry( 116881fb6f77SQu Wenruo __field( u64, rootid ) 116981fb6f77SQu Wenruo __field( unsigned long, ino ) 117081fb6f77SQu Wenruo __field( u64, free_reserved ) 117181fb6f77SQu Wenruo ), 117281fb6f77SQu Wenruo 117381fb6f77SQu Wenruo TP_fast_assign( 117481fb6f77SQu Wenruo __entry->rootid = BTRFS_I(inode)->root->objectid; 117581fb6f77SQu Wenruo __entry->ino = inode->i_ino; 117681fb6f77SQu Wenruo __entry->free_reserved = free_reserved; 117781fb6f77SQu Wenruo ), 117881fb6f77SQu Wenruo 117981fb6f77SQu Wenruo TP_printk("rootid=%llu, ino=%lu, free_reserved=%llu", 118081fb6f77SQu Wenruo __entry->rootid, __entry->ino, __entry->free_reserved) 118181fb6f77SQu Wenruo ); 118281fb6f77SQu Wenruo 118381fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_data_map, btrfs_qgroup_init_data_rsv_map, 118481fb6f77SQu Wenruo 118581fb6f77SQu Wenruo TP_PROTO(struct inode *inode, u64 free_reserved), 118681fb6f77SQu Wenruo 118781fb6f77SQu Wenruo TP_ARGS(inode, free_reserved) 118881fb6f77SQu Wenruo ); 118981fb6f77SQu Wenruo 119081fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_data_map, btrfs_qgroup_free_data_rsv_map, 119181fb6f77SQu Wenruo 119281fb6f77SQu Wenruo TP_PROTO(struct inode *inode, u64 free_reserved), 119381fb6f77SQu Wenruo 119481fb6f77SQu Wenruo TP_ARGS(inode, free_reserved) 119581fb6f77SQu Wenruo ); 119681fb6f77SQu Wenruo 119781fb6f77SQu Wenruo #define BTRFS_QGROUP_OPERATIONS \ 119881fb6f77SQu Wenruo { QGROUP_RESERVE, "reserve" }, \ 119981fb6f77SQu Wenruo { QGROUP_RELEASE, "release" }, \ 120081fb6f77SQu Wenruo { QGROUP_FREE, "free" } 120181fb6f77SQu Wenruo 120281fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, 120381fb6f77SQu Wenruo 120481fb6f77SQu Wenruo TP_PROTO(struct inode *inode, u64 start, u64 len, u64 reserved, int op), 120581fb6f77SQu Wenruo 120681fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op), 120781fb6f77SQu Wenruo 120881fb6f77SQu Wenruo TP_STRUCT__entry( 120981fb6f77SQu Wenruo __field( u64, rootid ) 121081fb6f77SQu Wenruo __field( unsigned long, ino ) 121181fb6f77SQu Wenruo __field( u64, start ) 121281fb6f77SQu Wenruo __field( u64, len ) 121381fb6f77SQu Wenruo __field( u64, reserved ) 121481fb6f77SQu Wenruo __field( int, op ) 121581fb6f77SQu Wenruo ), 121681fb6f77SQu Wenruo 121781fb6f77SQu Wenruo TP_fast_assign( 121881fb6f77SQu Wenruo __entry->rootid = BTRFS_I(inode)->root->objectid; 121981fb6f77SQu Wenruo __entry->ino = inode->i_ino; 122081fb6f77SQu Wenruo __entry->start = start; 122181fb6f77SQu Wenruo __entry->len = len; 122281fb6f77SQu Wenruo __entry->reserved = reserved; 122381fb6f77SQu Wenruo __entry->op = op; 122481fb6f77SQu Wenruo ), 122581fb6f77SQu Wenruo 122681fb6f77SQu Wenruo TP_printk("root=%llu, ino=%lu, start=%llu, len=%llu, reserved=%llu, op=%s", 122781fb6f77SQu Wenruo __entry->rootid, __entry->ino, __entry->start, __entry->len, 122881fb6f77SQu Wenruo __entry->reserved, 122981fb6f77SQu Wenruo __print_flags((unsigned long)__entry->op, "", 123081fb6f77SQu Wenruo BTRFS_QGROUP_OPERATIONS) 123181fb6f77SQu Wenruo ) 123281fb6f77SQu Wenruo ); 123381fb6f77SQu Wenruo 123481fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data, 123581fb6f77SQu Wenruo 123681fb6f77SQu Wenruo TP_PROTO(struct inode *inode, u64 start, u64 len, u64 reserved, int op), 123781fb6f77SQu Wenruo 123881fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 123981fb6f77SQu Wenruo ); 124081fb6f77SQu Wenruo 124181fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data, 124281fb6f77SQu Wenruo 124381fb6f77SQu Wenruo TP_PROTO(struct inode *inode, u64 start, u64 len, u64 reserved, int op), 124481fb6f77SQu Wenruo 124581fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 124681fb6f77SQu Wenruo ); 124781fb6f77SQu Wenruo 124881fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref, 124981fb6f77SQu Wenruo 125081fb6f77SQu Wenruo TP_PROTO(u64 ref_root, u64 reserved), 125181fb6f77SQu Wenruo 125281fb6f77SQu Wenruo TP_ARGS(ref_root, reserved), 125381fb6f77SQu Wenruo 125481fb6f77SQu Wenruo TP_STRUCT__entry( 125581fb6f77SQu Wenruo __field( u64, ref_root ) 125681fb6f77SQu Wenruo __field( u64, reserved ) 125781fb6f77SQu Wenruo ), 125881fb6f77SQu Wenruo 125981fb6f77SQu Wenruo TP_fast_assign( 126081fb6f77SQu Wenruo __entry->ref_root = ref_root; 126181fb6f77SQu Wenruo __entry->reserved = reserved; 126281fb6f77SQu Wenruo ), 126381fb6f77SQu Wenruo 126481fb6f77SQu Wenruo TP_printk("root=%llu, reserved=%llu, op=free", 126581fb6f77SQu Wenruo __entry->ref_root, __entry->reserved) 126681fb6f77SQu Wenruo ); 126781fb6f77SQu Wenruo 126881fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref, 126981fb6f77SQu Wenruo 127081fb6f77SQu Wenruo TP_PROTO(u64 ref_root, u64 reserved), 127181fb6f77SQu Wenruo 127281fb6f77SQu Wenruo TP_ARGS(ref_root, reserved) 127381fb6f77SQu Wenruo ); 12740f5dcf8dSMark Fasheh 12750f5dcf8dSMark Fasheh DECLARE_EVENT_CLASS(btrfs_qgroup_extent, 12760f5dcf8dSMark Fasheh TP_PROTO(struct btrfs_qgroup_extent_record *rec), 12770f5dcf8dSMark Fasheh 12780f5dcf8dSMark Fasheh TP_ARGS(rec), 12790f5dcf8dSMark Fasheh 12800f5dcf8dSMark Fasheh TP_STRUCT__entry( 12810f5dcf8dSMark Fasheh __field( u64, bytenr ) 12820f5dcf8dSMark Fasheh __field( u64, num_bytes ) 12830f5dcf8dSMark Fasheh ), 12840f5dcf8dSMark Fasheh 12850f5dcf8dSMark Fasheh TP_fast_assign( 12860f5dcf8dSMark Fasheh __entry->bytenr = rec->bytenr, 12870f5dcf8dSMark Fasheh __entry->num_bytes = rec->num_bytes; 12880f5dcf8dSMark Fasheh ), 12890f5dcf8dSMark Fasheh 12900f5dcf8dSMark Fasheh TP_printk("bytenr = %llu, num_bytes = %llu", 12910f5dcf8dSMark Fasheh (unsigned long long)__entry->bytenr, 12920f5dcf8dSMark Fasheh (unsigned long long)__entry->num_bytes) 12930f5dcf8dSMark Fasheh ); 12940f5dcf8dSMark Fasheh 12950f5dcf8dSMark Fasheh DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, 12960f5dcf8dSMark Fasheh 12970f5dcf8dSMark Fasheh TP_PROTO(struct btrfs_qgroup_extent_record *rec), 12980f5dcf8dSMark Fasheh 12990f5dcf8dSMark Fasheh TP_ARGS(rec) 13000f5dcf8dSMark Fasheh ); 13010f5dcf8dSMark Fasheh 13020f5dcf8dSMark Fasheh DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_insert_dirty_extent, 13030f5dcf8dSMark Fasheh 13040f5dcf8dSMark Fasheh TP_PROTO(struct btrfs_qgroup_extent_record *rec), 13050f5dcf8dSMark Fasheh 13060f5dcf8dSMark Fasheh TP_ARGS(rec) 13070f5dcf8dSMark Fasheh ); 13080f5dcf8dSMark Fasheh 13090f5dcf8dSMark Fasheh TRACE_EVENT(btrfs_qgroup_account_extent, 13100f5dcf8dSMark Fasheh 13110f5dcf8dSMark Fasheh TP_PROTO(u64 bytenr, u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), 13120f5dcf8dSMark Fasheh 13130f5dcf8dSMark Fasheh TP_ARGS(bytenr, num_bytes, nr_old_roots, nr_new_roots), 13140f5dcf8dSMark Fasheh 13150f5dcf8dSMark Fasheh TP_STRUCT__entry( 13160f5dcf8dSMark Fasheh __field( u64, bytenr ) 13170f5dcf8dSMark Fasheh __field( u64, num_bytes ) 13180f5dcf8dSMark Fasheh __field( u64, nr_old_roots ) 13190f5dcf8dSMark Fasheh __field( u64, nr_new_roots ) 13200f5dcf8dSMark Fasheh ), 13210f5dcf8dSMark Fasheh 13220f5dcf8dSMark Fasheh TP_fast_assign( 13230f5dcf8dSMark Fasheh __entry->bytenr = bytenr; 13240f5dcf8dSMark Fasheh __entry->num_bytes = num_bytes; 13250f5dcf8dSMark Fasheh __entry->nr_old_roots = nr_old_roots; 13260f5dcf8dSMark Fasheh __entry->nr_new_roots = nr_new_roots; 13270f5dcf8dSMark Fasheh ), 13280f5dcf8dSMark Fasheh 13290f5dcf8dSMark Fasheh TP_printk("bytenr = %llu, num_bytes = %llu, nr_old_roots = %llu, " 13300f5dcf8dSMark Fasheh "nr_new_roots = %llu", 13310f5dcf8dSMark Fasheh __entry->bytenr, 13320f5dcf8dSMark Fasheh __entry->num_bytes, 13330f5dcf8dSMark Fasheh __entry->nr_old_roots, 13340f5dcf8dSMark Fasheh __entry->nr_new_roots) 13350f5dcf8dSMark Fasheh ); 13360f5dcf8dSMark Fasheh 13370f5dcf8dSMark Fasheh TRACE_EVENT(qgroup_update_counters, 13380f5dcf8dSMark Fasheh 13390f5dcf8dSMark Fasheh TP_PROTO(u64 qgid, u64 cur_old_count, u64 cur_new_count), 13400f5dcf8dSMark Fasheh 13410f5dcf8dSMark Fasheh TP_ARGS(qgid, cur_old_count, cur_new_count), 13420f5dcf8dSMark Fasheh 13430f5dcf8dSMark Fasheh TP_STRUCT__entry( 13440f5dcf8dSMark Fasheh __field( u64, qgid ) 13450f5dcf8dSMark Fasheh __field( u64, cur_old_count ) 13460f5dcf8dSMark Fasheh __field( u64, cur_new_count ) 13470f5dcf8dSMark Fasheh ), 13480f5dcf8dSMark Fasheh 13490f5dcf8dSMark Fasheh TP_fast_assign( 13500f5dcf8dSMark Fasheh __entry->qgid = qgid; 13510f5dcf8dSMark Fasheh __entry->cur_old_count = cur_old_count; 13520f5dcf8dSMark Fasheh __entry->cur_new_count = cur_new_count; 13530f5dcf8dSMark Fasheh ), 13540f5dcf8dSMark Fasheh 13550f5dcf8dSMark Fasheh TP_printk("qgid = %llu, cur_old_count = %llu, cur_new_count = %llu", 13560f5dcf8dSMark Fasheh __entry->qgid, 13570f5dcf8dSMark Fasheh __entry->cur_old_count, 13580f5dcf8dSMark Fasheh __entry->cur_new_count) 13590f5dcf8dSMark Fasheh ); 13600f5dcf8dSMark Fasheh 13611abe9b8aSliubo #endif /* _TRACE_BTRFS_H */ 13621abe9b8aSliubo 13631abe9b8aSliubo /* This part must be outside protection */ 13641abe9b8aSliubo #include <trace/define_trace.h> 1365