1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 21abe9b8aSliubo #undef TRACE_SYSTEM 31abe9b8aSliubo #define TRACE_SYSTEM btrfs 41abe9b8aSliubo 51abe9b8aSliubo #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ) 61abe9b8aSliubo #define _TRACE_BTRFS_H 71abe9b8aSliubo 81abe9b8aSliubo #include <linux/writeback.h> 91abe9b8aSliubo #include <linux/tracepoint.h> 10420adbe9SVlastimil Babka #include <trace/events/mmflags.h> 111abe9b8aSliubo 121abe9b8aSliubo struct btrfs_root; 131abe9b8aSliubo struct btrfs_fs_info; 141abe9b8aSliubo struct btrfs_inode; 151abe9b8aSliubo struct extent_map; 1609ed2f16SLiu Bo struct btrfs_file_extent_item; 171abe9b8aSliubo struct btrfs_ordered_extent; 181abe9b8aSliubo struct btrfs_delayed_ref_node; 191abe9b8aSliubo struct btrfs_delayed_tree_ref; 201abe9b8aSliubo struct btrfs_delayed_data_ref; 211abe9b8aSliubo struct btrfs_delayed_ref_head; 2232da5386SDavid Sterba struct btrfs_block_group; 233f7de037SJosef Bacik struct btrfs_free_cluster; 241abe9b8aSliubo struct map_lookup; 251abe9b8aSliubo struct extent_buffer; 2652483bc2SQu Wenruo struct btrfs_work; 27a31b4a43SChristoph Hellwig struct btrfs_workqueue; 280f5dcf8dSMark Fasheh struct btrfs_qgroup_extent_record; 293159fe7bSQu Wenruo struct btrfs_qgroup; 30a1d19847SQu Wenruo struct extent_io_tree; 3100142756SJeff Mahoney struct prelim_ref; 32480b9b4dSQu Wenruo struct btrfs_space_info; 33b8bea09aSQu Wenruo struct btrfs_raid_bio; 34b8bea09aSQu Wenruo struct raid56_bio_trace_info; 35cfc2de0fSBoris Burkov struct find_free_extent_ctl; 361abe9b8aSliubo 371abe9b8aSliubo #define show_ref_type(type) \ 381abe9b8aSliubo __print_symbolic(type, \ 391abe9b8aSliubo { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ 401abe9b8aSliubo { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ 411abe9b8aSliubo { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ 421abe9b8aSliubo { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ 431abe9b8aSliubo { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) 441abe9b8aSliubo 451abe9b8aSliubo #define __show_root_type(obj) \ 467f34b746Sliubo __print_symbolic_u64(obj, \ 471abe9b8aSliubo { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ 481abe9b8aSliubo { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ 491abe9b8aSliubo { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ 501abe9b8aSliubo { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ 511abe9b8aSliubo { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ 521abe9b8aSliubo { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ 531abe9b8aSliubo { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ 541abe9b8aSliubo { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ 55e112e2b4SLiu Bo { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ 561abe9b8aSliubo { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ 57208acb8cSOmar Sandoval { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \ 58208acb8cSOmar Sandoval { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \ 599c54e80dSJosef Bacik { BTRFS_BLOCK_GROUP_TREE_OBJECTID, "BLOCK_GROUP_TREE" },\ 601abe9b8aSliubo { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) 611abe9b8aSliubo 621abe9b8aSliubo #define show_root_type(obj) \ 631abe9b8aSliubo obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ 64fb57dc81SLiu Bo (obj >= BTRFS_ROOT_TREE_OBJECTID && \ 65e112e2b4SLiu Bo obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" 661abe9b8aSliubo 675bca2c95SNikolay Borisov #define FLUSH_ACTIONS \ 685bca2c95SNikolay Borisov EM( BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH") \ 695bca2c95SNikolay Borisov EM( BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT") \ 705bca2c95SNikolay Borisov EM( BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL") \ 715bca2c95SNikolay Borisov EMe(BTRFS_RESERVE_FLUSH_ALL_STEAL, "BTRFS_RESERVE_FLUSH_ALL_STEAL") 725bca2c95SNikolay Borisov 730840dd28SNikolay Borisov #define FI_TYPES \ 740840dd28SNikolay Borisov EM( BTRFS_FILE_EXTENT_INLINE, "INLINE") \ 750840dd28SNikolay Borisov EM( BTRFS_FILE_EXTENT_REG, "REG") \ 760840dd28SNikolay Borisov EMe(BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC") 770840dd28SNikolay Borisov 781cb1f0b2SNikolay Borisov #define QGROUP_RSV_TYPES \ 791cb1f0b2SNikolay Borisov EM( BTRFS_QGROUP_RSV_DATA, "DATA") \ 801cb1f0b2SNikolay Borisov EM( BTRFS_QGROUP_RSV_META_PERTRANS, "META_PERTRANS") \ 811cb1f0b2SNikolay Borisov EMe(BTRFS_QGROUP_RSV_META_PREALLOC, "META_PREALLOC") 821cb1f0b2SNikolay Borisov 83c92bb304SNikolay Borisov #define IO_TREE_OWNER \ 84c92bb304SNikolay Borisov EM( IO_TREE_FS_PINNED_EXTENTS, "PINNED_EXTENTS") \ 85c92bb304SNikolay Borisov EM( IO_TREE_FS_EXCLUDED_EXTENTS, "EXCLUDED_EXTENTS") \ 862c53a14dSQu Wenruo EM( IO_TREE_BTREE_INODE_IO, "BTREE_INODE_IO") \ 87c92bb304SNikolay Borisov EM( IO_TREE_INODE_IO, "INODE_IO") \ 88c92bb304SNikolay Borisov EM( IO_TREE_RELOC_BLOCKS, "RELOC_BLOCKS") \ 89c92bb304SNikolay Borisov EM( IO_TREE_TRANS_DIRTY_PAGES, "TRANS_DIRTY_PAGES") \ 90c92bb304SNikolay Borisov EM( IO_TREE_ROOT_DIRTY_LOG_PAGES, "ROOT_DIRTY_LOG_PAGES") \ 91c92bb304SNikolay Borisov EM( IO_TREE_INODE_FILE_EXTENT, "INODE_FILE_EXTENT") \ 92c92bb304SNikolay Borisov EM( IO_TREE_LOG_CSUM_RANGE, "LOG_CSUM_RANGE") \ 93c92bb304SNikolay Borisov EMe(IO_TREE_SELFTEST, "SELFTEST") 94c92bb304SNikolay Borisov 95f0cdd15cSNikolay Borisov #define FLUSH_STATES \ 96f0cdd15cSNikolay Borisov EM( FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR") \ 97f0cdd15cSNikolay Borisov EM( FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS") \ 98f0cdd15cSNikolay Borisov EM( FLUSH_DELALLOC, "FLUSH_DELALLOC") \ 99f0cdd15cSNikolay Borisov EM( FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT") \ 10003fe78ccSJosef Bacik EM( FLUSH_DELALLOC_FULL, "FLUSH_DELALLOC_FULL") \ 101f0cdd15cSNikolay Borisov EM( FLUSH_DELAYED_REFS_NR, "FLUSH_DELAYED_REFS_NR") \ 1020a3212deSNaohiro Aota EM( FLUSH_DELAYED_REFS, "FLUSH_DELAYED_REFS") \ 103f0cdd15cSNikolay Borisov EM( ALLOC_CHUNK, "ALLOC_CHUNK") \ 104f0cdd15cSNikolay Borisov EM( ALLOC_CHUNK_FORCE, "ALLOC_CHUNK_FORCE") \ 105f0cdd15cSNikolay Borisov EM( RUN_DELAYED_IPUTS, "RUN_DELAYED_IPUTS") \ 106c416a30cSJosef Bacik EMe(COMMIT_TRANS, "COMMIT_TRANS") 107f0cdd15cSNikolay Borisov 1085bca2c95SNikolay Borisov /* 1095bca2c95SNikolay Borisov * First define the enums in the above macros to be exported to userspace via 1105bca2c95SNikolay Borisov * TRACE_DEFINE_ENUM(). 1115bca2c95SNikolay Borisov */ 1125bca2c95SNikolay Borisov 1130840dd28SNikolay Borisov #undef EM 1140840dd28SNikolay Borisov #undef EMe 1150840dd28SNikolay Borisov #define EM(a, b) TRACE_DEFINE_ENUM(a); 1160840dd28SNikolay Borisov #define EMe(a, b) TRACE_DEFINE_ENUM(a); 1170840dd28SNikolay Borisov 1185bca2c95SNikolay Borisov FLUSH_ACTIONS 1190840dd28SNikolay Borisov FI_TYPES 1201cb1f0b2SNikolay Borisov QGROUP_RSV_TYPES 121c92bb304SNikolay Borisov IO_TREE_OWNER 122f0cdd15cSNikolay Borisov FLUSH_STATES 1230840dd28SNikolay Borisov 1245bca2c95SNikolay Borisov /* 1255bca2c95SNikolay Borisov * Now redefine the EM and EMe macros to map the enums to the strings that will 1265bca2c95SNikolay Borisov * be printed in the output 1275bca2c95SNikolay Borisov */ 1285bca2c95SNikolay Borisov 1290840dd28SNikolay Borisov #undef EM 1300840dd28SNikolay Borisov #undef EMe 1310840dd28SNikolay Borisov #define EM(a, b) {a, b}, 1320840dd28SNikolay Borisov #define EMe(a, b) {a, b} 13309ed2f16SLiu Bo 134a1d19847SQu Wenruo 1353f7de037SJosef Bacik #define BTRFS_GROUP_FLAGS \ 1363f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ 1373f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 1383f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 1393f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ 1403f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ 1413f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ 142e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 143e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ 144e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} 1453f7de037SJosef Bacik 146a1d19847SQu Wenruo #define EXTENT_FLAGS \ 147a1d19847SQu Wenruo { EXTENT_DIRTY, "DIRTY"}, \ 148a1d19847SQu Wenruo { EXTENT_UPTODATE, "UPTODATE"}, \ 149a1d19847SQu Wenruo { EXTENT_LOCKED, "LOCKED"}, \ 150a1d19847SQu Wenruo { EXTENT_NEW, "NEW"}, \ 151a1d19847SQu Wenruo { EXTENT_DELALLOC, "DELALLOC"}, \ 152a1d19847SQu Wenruo { EXTENT_DEFRAG, "DEFRAG"}, \ 153a1d19847SQu Wenruo { EXTENT_BOUNDARY, "BOUNDARY"}, \ 154a1d19847SQu Wenruo { EXTENT_NODATASUM, "NODATASUM"}, \ 155a1d19847SQu Wenruo { EXTENT_CLEAR_META_RESV, "CLEAR_META_RESV"}, \ 156a1d19847SQu Wenruo { EXTENT_NEED_WAIT, "NEED_WAIT"}, \ 157a1d19847SQu Wenruo { EXTENT_NORESERVE, "NORESERVE"}, \ 158a1d19847SQu Wenruo { EXTENT_QGROUP_RESERVED, "QGROUP_RESERVED"}, \ 159a1d19847SQu Wenruo { EXTENT_CLEAR_DATA_RESV, "CLEAR_DATA_RESV"}, \ 160a1d19847SQu Wenruo { EXTENT_DELALLOC_NEW, "DELALLOC_NEW"} 161a1d19847SQu Wenruo 162b94417eaSAnand Jain #define BTRFS_FSID_SIZE 16 163b94417eaSAnand Jain #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE) 164bc074524SJeff Mahoney 165bc074524SJeff Mahoney #define TP_fast_assign_fsid(fs_info) \ 166a1d19847SQu Wenruo ({ \ 167a1d19847SQu Wenruo if (fs_info) \ 168a1d19847SQu Wenruo memcpy(__entry->fsid, fs_info->fs_devices->fsid, \ 169a1d19847SQu Wenruo BTRFS_FSID_SIZE); \ 170a1d19847SQu Wenruo else \ 171a1d19847SQu Wenruo memset(__entry->fsid, 0, BTRFS_FSID_SIZE); \ 172a1d19847SQu Wenruo }) 173bc074524SJeff Mahoney 174bc074524SJeff Mahoney #define TP_STRUCT__entry_btrfs(args...) \ 175bc074524SJeff Mahoney TP_STRUCT__entry( \ 176bc074524SJeff Mahoney TP_STRUCT__entry_fsid \ 177bc074524SJeff Mahoney args) 178bc074524SJeff Mahoney #define TP_fast_assign_btrfs(fs_info, args...) \ 179bc074524SJeff Mahoney TP_fast_assign( \ 180bc074524SJeff Mahoney TP_fast_assign_fsid(fs_info); \ 181bc074524SJeff Mahoney args) 182bc074524SJeff Mahoney #define TP_printk_btrfs(fmt, args...) \ 183bc074524SJeff Mahoney TP_printk("%pU: " fmt, __entry->fsid, args) 1848c2a3ca2SJosef Bacik 1851abe9b8aSliubo TRACE_EVENT(btrfs_transaction_commit, 1861abe9b8aSliubo 1872e4e97abSJosef Bacik TP_PROTO(const struct btrfs_fs_info *fs_info), 1881abe9b8aSliubo 1892e4e97abSJosef Bacik TP_ARGS(fs_info), 1901abe9b8aSliubo 191bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1921abe9b8aSliubo __field( u64, generation ) 1931abe9b8aSliubo __field( u64, root_objectid ) 1941abe9b8aSliubo ), 1951abe9b8aSliubo 1962e4e97abSJosef Bacik TP_fast_assign_btrfs(fs_info, 1972e4e97abSJosef Bacik __entry->generation = fs_info->generation; 1982e4e97abSJosef Bacik __entry->root_objectid = BTRFS_ROOT_TREE_OBJECTID; 1991abe9b8aSliubo ), 2001abe9b8aSliubo 20179bcb71aSDavid Sterba TP_printk_btrfs("root=%llu(%s) gen=%llu", 2021abe9b8aSliubo show_root_type(__entry->root_objectid), 2038eec8463SDavid Sterba __entry->generation) 2041abe9b8aSliubo ); 2051abe9b8aSliubo 2061abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__inode, 2071abe9b8aSliubo 2089a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 2091abe9b8aSliubo 2101abe9b8aSliubo TP_ARGS(inode), 2111abe9b8aSliubo 212bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 213f8f8e189SDavid Sterba __field( u64, ino ) 21494c3f6c6SDavid Sterba __field( u64, blocks ) 2151abe9b8aSliubo __field( u64, disk_i_size ) 2161abe9b8aSliubo __field( u64, generation ) 2171abe9b8aSliubo __field( u64, last_trans ) 2181abe9b8aSliubo __field( u64, logged_trans ) 2191abe9b8aSliubo __field( u64, root_objectid ) 2201abe9b8aSliubo ), 2211abe9b8aSliubo 222bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 223f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 2241abe9b8aSliubo __entry->blocks = inode->i_blocks; 2251abe9b8aSliubo __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; 2261abe9b8aSliubo __entry->generation = BTRFS_I(inode)->generation; 2271abe9b8aSliubo __entry->last_trans = BTRFS_I(inode)->last_trans; 2281abe9b8aSliubo __entry->logged_trans = BTRFS_I(inode)->logged_trans; 2291abe9b8aSliubo __entry->root_objectid = 2301abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 2311abe9b8aSliubo ), 2321abe9b8aSliubo 233f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%llu blocks=%llu " 234562a7a07SDavid Sterba "disk_i_size=%llu last_trans=%llu logged_trans=%llu", 2351abe9b8aSliubo show_root_type(__entry->root_objectid), 2368eec8463SDavid Sterba __entry->generation, 2378eec8463SDavid Sterba __entry->ino, 23894c3f6c6SDavid Sterba __entry->blocks, 2398eec8463SDavid Sterba __entry->disk_i_size, 2408eec8463SDavid Sterba __entry->last_trans, 2418eec8463SDavid Sterba __entry->logged_trans) 2421abe9b8aSliubo ); 2431abe9b8aSliubo 2441abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_new, 2451abe9b8aSliubo 2469a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 2471abe9b8aSliubo 2481abe9b8aSliubo TP_ARGS(inode) 2491abe9b8aSliubo ); 2501abe9b8aSliubo 2511abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_request, 2521abe9b8aSliubo 2539a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 2541abe9b8aSliubo 2551abe9b8aSliubo TP_ARGS(inode) 2561abe9b8aSliubo ); 2571abe9b8aSliubo 2581abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, 2591abe9b8aSliubo 2609a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 2611abe9b8aSliubo 2621abe9b8aSliubo TP_ARGS(inode) 2631abe9b8aSliubo ); 2641abe9b8aSliubo 2651abe9b8aSliubo #define __show_map_type(type) \ 2667f34b746Sliubo __print_symbolic_u64(type, \ 2671abe9b8aSliubo { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ 2681abe9b8aSliubo { EXTENT_MAP_HOLE, "HOLE" }, \ 2691abe9b8aSliubo { EXTENT_MAP_INLINE, "INLINE" }, \ 2701abe9b8aSliubo { EXTENT_MAP_DELALLOC, "DELALLOC" }) 2711abe9b8aSliubo 2721abe9b8aSliubo #define show_map_type(type) \ 2731abe9b8aSliubo type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) 2741abe9b8aSliubo 2751abe9b8aSliubo #define show_map_flags(flag) \ 2761abe9b8aSliubo __print_flags(flag, "|", \ 277254a2d14SLiu Bo { (1 << EXTENT_FLAG_PINNED), "PINNED" },\ 278254a2d14SLiu Bo { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\ 279254a2d14SLiu Bo { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\ 280254a2d14SLiu Bo { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\ 281254a2d14SLiu Bo { (1 << EXTENT_FLAG_FILLING), "FILLING" },\ 282254a2d14SLiu Bo { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" }) 2831abe9b8aSliubo 2844cd8587cSSteven Rostedt TRACE_EVENT_CONDITION(btrfs_get_extent, 2851abe9b8aSliubo 2869a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode, 2879a35b637SJeff Mahoney const struct extent_map *map), 2881abe9b8aSliubo 28992a1bf76SLiu Bo TP_ARGS(root, inode, map), 2901abe9b8aSliubo 2914cd8587cSSteven Rostedt TP_CONDITION(map), 2924cd8587cSSteven Rostedt 293bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 2941abe9b8aSliubo __field( u64, root_objectid ) 29592a1bf76SLiu Bo __field( u64, ino ) 2961abe9b8aSliubo __field( u64, start ) 2971abe9b8aSliubo __field( u64, len ) 2981abe9b8aSliubo __field( u64, orig_start ) 2991abe9b8aSliubo __field( u64, block_start ) 3001abe9b8aSliubo __field( u64, block_len ) 3011abe9b8aSliubo __field( unsigned long, flags ) 3021abe9b8aSliubo __field( int, refs ) 3031abe9b8aSliubo __field( unsigned int, compress_type ) 3041abe9b8aSliubo ), 3051abe9b8aSliubo 306bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 3071abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 30892a1bf76SLiu Bo __entry->ino = btrfs_ino(inode); 3091abe9b8aSliubo __entry->start = map->start; 3101abe9b8aSliubo __entry->len = map->len; 3111abe9b8aSliubo __entry->orig_start = map->orig_start; 3121abe9b8aSliubo __entry->block_start = map->block_start; 3131abe9b8aSliubo __entry->block_len = map->block_len; 3141abe9b8aSliubo __entry->flags = map->flags; 315490b54d6SElena Reshetova __entry->refs = refcount_read(&map->refs); 3161abe9b8aSliubo __entry->compress_type = map->compress_type; 3171abe9b8aSliubo ), 3181abe9b8aSliubo 319562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu " 320562a7a07SDavid Sterba "orig_start=%llu block_start=%llu(%s) " 321562a7a07SDavid Sterba "block_len=%llu flags=%s refs=%u " 3221abe9b8aSliubo "compress_type=%u", 3231abe9b8aSliubo show_root_type(__entry->root_objectid), 3248eec8463SDavid Sterba __entry->ino, 3258eec8463SDavid Sterba __entry->start, 3268eec8463SDavid Sterba __entry->len, 3278eec8463SDavid Sterba __entry->orig_start, 3281abe9b8aSliubo show_map_type(__entry->block_start), 3298eec8463SDavid Sterba __entry->block_len, 3301abe9b8aSliubo show_map_flags(__entry->flags), 3311abe9b8aSliubo __entry->refs, __entry->compress_type) 3321abe9b8aSliubo ); 3331abe9b8aSliubo 334393da918SLiu Bo TRACE_EVENT(btrfs_handle_em_exist, 335393da918SLiu Bo 3361d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 337f46b24c9SDavid Sterba const struct extent_map *existing, const struct extent_map *map, 338f46b24c9SDavid Sterba u64 start, u64 len), 339393da918SLiu Bo 340f46b24c9SDavid Sterba TP_ARGS(fs_info, existing, map, start, len), 341393da918SLiu Bo 342f46b24c9SDavid Sterba TP_STRUCT__entry_btrfs( 343393da918SLiu Bo __field( u64, e_start ) 344393da918SLiu Bo __field( u64, e_len ) 345393da918SLiu Bo __field( u64, map_start ) 346393da918SLiu Bo __field( u64, map_len ) 347393da918SLiu Bo __field( u64, start ) 348393da918SLiu Bo __field( u64, len ) 349393da918SLiu Bo ), 350393da918SLiu Bo 351f46b24c9SDavid Sterba TP_fast_assign_btrfs(fs_info, 352393da918SLiu Bo __entry->e_start = existing->start; 353393da918SLiu Bo __entry->e_len = existing->len; 354393da918SLiu Bo __entry->map_start = map->start; 355393da918SLiu Bo __entry->map_len = map->len; 356393da918SLiu Bo __entry->start = start; 357393da918SLiu Bo __entry->len = len; 358393da918SLiu Bo ), 359393da918SLiu Bo 360f46b24c9SDavid Sterba TP_printk_btrfs("start=%llu len=%llu " 361393da918SLiu Bo "existing(start=%llu len=%llu) " 362393da918SLiu Bo "em(start=%llu len=%llu)", 3638eec8463SDavid Sterba __entry->start, 3648eec8463SDavid Sterba __entry->len, 3658eec8463SDavid Sterba __entry->e_start, 3668eec8463SDavid Sterba __entry->e_len, 3678eec8463SDavid Sterba __entry->map_start, 3688eec8463SDavid Sterba __entry->map_len) 369393da918SLiu Bo ); 370393da918SLiu Bo 37109ed2f16SLiu Bo /* file extent item */ 37209ed2f16SLiu Bo DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular, 37309ed2f16SLiu Bo 3741d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 3751d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, u64 start), 37609ed2f16SLiu Bo 37709ed2f16SLiu Bo TP_ARGS(bi, l, fi, start), 37809ed2f16SLiu Bo 37909ed2f16SLiu Bo TP_STRUCT__entry_btrfs( 38009ed2f16SLiu Bo __field( u64, root_obj ) 38109ed2f16SLiu Bo __field( u64, ino ) 38209ed2f16SLiu Bo __field( loff_t, isize ) 38309ed2f16SLiu Bo __field( u64, disk_isize ) 38409ed2f16SLiu Bo __field( u64, num_bytes ) 38509ed2f16SLiu Bo __field( u64, ram_bytes ) 38609ed2f16SLiu Bo __field( u64, disk_bytenr ) 38709ed2f16SLiu Bo __field( u64, disk_num_bytes ) 38809ed2f16SLiu Bo __field( u64, extent_offset ) 38909ed2f16SLiu Bo __field( u8, extent_type ) 39009ed2f16SLiu Bo __field( u8, compression ) 39109ed2f16SLiu Bo __field( u64, extent_start ) 39209ed2f16SLiu Bo __field( u64, extent_end ) 39309ed2f16SLiu Bo ), 39409ed2f16SLiu Bo 39509ed2f16SLiu Bo TP_fast_assign_btrfs(bi->root->fs_info, 3964fd786e6SMisono Tomohiro __entry->root_obj = bi->root->root_key.objectid; 39709ed2f16SLiu Bo __entry->ino = btrfs_ino(bi); 39809ed2f16SLiu Bo __entry->isize = bi->vfs_inode.i_size; 39909ed2f16SLiu Bo __entry->disk_isize = bi->disk_i_size; 40009ed2f16SLiu Bo __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi); 40109ed2f16SLiu Bo __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi); 40209ed2f16SLiu Bo __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi); 40309ed2f16SLiu Bo __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi); 40409ed2f16SLiu Bo __entry->extent_offset = btrfs_file_extent_offset(l, fi); 40509ed2f16SLiu Bo __entry->extent_type = btrfs_file_extent_type(l, fi); 40609ed2f16SLiu Bo __entry->compression = btrfs_file_extent_compression(l, fi); 40709ed2f16SLiu Bo __entry->extent_start = start; 40809ed2f16SLiu Bo __entry->extent_end = (start + __entry->num_bytes); 40909ed2f16SLiu Bo ), 41009ed2f16SLiu Bo 41109ed2f16SLiu Bo TP_printk_btrfs( 41209ed2f16SLiu Bo "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " 41309ed2f16SLiu Bo "file extent range=[%llu %llu] " 41409ed2f16SLiu Bo "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu " 41509ed2f16SLiu Bo "disk_num_bytes=%llu extent_offset=%llu type=%s " 41609ed2f16SLiu Bo "compression=%u", 41709ed2f16SLiu Bo show_root_type(__entry->root_obj), __entry->ino, 41809ed2f16SLiu Bo __entry->isize, 41909ed2f16SLiu Bo __entry->disk_isize, __entry->extent_start, 42009ed2f16SLiu Bo __entry->extent_end, __entry->num_bytes, __entry->ram_bytes, 42109ed2f16SLiu Bo __entry->disk_bytenr, __entry->disk_num_bytes, 4220840dd28SNikolay Borisov __entry->extent_offset, __print_symbolic(__entry->extent_type, FI_TYPES), 42309ed2f16SLiu Bo __entry->compression) 42409ed2f16SLiu Bo ); 42509ed2f16SLiu Bo 42609ed2f16SLiu Bo DECLARE_EVENT_CLASS( 42709ed2f16SLiu Bo btrfs__file_extent_item_inline, 42809ed2f16SLiu Bo 4291d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4301d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, int slot, u64 start), 43109ed2f16SLiu Bo 43209ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start), 43309ed2f16SLiu Bo 43409ed2f16SLiu Bo TP_STRUCT__entry_btrfs( 43509ed2f16SLiu Bo __field( u64, root_obj ) 43609ed2f16SLiu Bo __field( u64, ino ) 43709ed2f16SLiu Bo __field( loff_t, isize ) 43809ed2f16SLiu Bo __field( u64, disk_isize ) 43909ed2f16SLiu Bo __field( u8, extent_type ) 44009ed2f16SLiu Bo __field( u8, compression ) 44109ed2f16SLiu Bo __field( u64, extent_start ) 44209ed2f16SLiu Bo __field( u64, extent_end ) 44309ed2f16SLiu Bo ), 44409ed2f16SLiu Bo 44509ed2f16SLiu Bo TP_fast_assign_btrfs( 44609ed2f16SLiu Bo bi->root->fs_info, 4474fd786e6SMisono Tomohiro __entry->root_obj = bi->root->root_key.objectid; 44809ed2f16SLiu Bo __entry->ino = btrfs_ino(bi); 44909ed2f16SLiu Bo __entry->isize = bi->vfs_inode.i_size; 45009ed2f16SLiu Bo __entry->disk_isize = bi->disk_i_size; 45109ed2f16SLiu Bo __entry->extent_type = btrfs_file_extent_type(l, fi); 45209ed2f16SLiu Bo __entry->compression = btrfs_file_extent_compression(l, fi); 45309ed2f16SLiu Bo __entry->extent_start = start; 454e41ca589SQu Wenruo __entry->extent_end = (start + btrfs_file_extent_ram_bytes(l, fi)); 45509ed2f16SLiu Bo ), 45609ed2f16SLiu Bo 45709ed2f16SLiu Bo TP_printk_btrfs( 45809ed2f16SLiu Bo "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " 45909ed2f16SLiu Bo "file extent range=[%llu %llu] " 46009ed2f16SLiu Bo "extent_type=%s compression=%u", 46109ed2f16SLiu Bo show_root_type(__entry->root_obj), __entry->ino, __entry->isize, 46209ed2f16SLiu Bo __entry->disk_isize, __entry->extent_start, 4630840dd28SNikolay Borisov __entry->extent_end, __print_symbolic(__entry->extent_type, FI_TYPES), 46409ed2f16SLiu Bo __entry->compression) 46509ed2f16SLiu Bo ); 46609ed2f16SLiu Bo 46709ed2f16SLiu Bo DEFINE_EVENT( 46809ed2f16SLiu Bo btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular, 46909ed2f16SLiu Bo 4701d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4711d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, u64 start), 47209ed2f16SLiu Bo 47309ed2f16SLiu Bo TP_ARGS(bi, l, fi, start) 47409ed2f16SLiu Bo ); 47509ed2f16SLiu Bo 47609ed2f16SLiu Bo DEFINE_EVENT( 47709ed2f16SLiu Bo btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular, 47809ed2f16SLiu Bo 4791d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4801d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, u64 start), 48109ed2f16SLiu Bo 48209ed2f16SLiu Bo TP_ARGS(bi, l, fi, start) 48309ed2f16SLiu Bo ); 48409ed2f16SLiu Bo 48509ed2f16SLiu Bo DEFINE_EVENT( 48609ed2f16SLiu Bo btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline, 48709ed2f16SLiu Bo 4881d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4891d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, int slot, u64 start), 49009ed2f16SLiu Bo 49109ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start) 49209ed2f16SLiu Bo ); 49309ed2f16SLiu Bo 49409ed2f16SLiu Bo DEFINE_EVENT( 49509ed2f16SLiu Bo btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline, 49609ed2f16SLiu Bo 4971d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4981d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, int slot, u64 start), 49909ed2f16SLiu Bo 50009ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start) 50109ed2f16SLiu Bo ); 50209ed2f16SLiu Bo 5031abe9b8aSliubo #define show_ordered_flags(flags) \ 5049d04a8ceSLiu Bo __print_flags(flags, "|", \ 5053c198fe0SQu Wenruo { (1 << BTRFS_ORDERED_REGULAR), "REGULAR" }, \ 5063c198fe0SQu Wenruo { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ 5073c198fe0SQu Wenruo { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ 5083c198fe0SQu Wenruo { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ 5093c198fe0SQu Wenruo { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ 5109d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ 5119d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ 5129d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ 513792ddef0SLiu Bo { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) 514e112e2b4SLiu Bo 5151abe9b8aSliubo 5161abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__ordered_extent, 5171abe9b8aSliubo 518acbf1dd0SNikolay Borisov TP_PROTO(const struct btrfs_inode *inode, 5199a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5201abe9b8aSliubo 5211abe9b8aSliubo TP_ARGS(inode, ordered), 5221abe9b8aSliubo 523bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 524f8f8e189SDavid Sterba __field( u64, ino ) 5251abe9b8aSliubo __field( u64, file_offset ) 5261abe9b8aSliubo __field( u64, start ) 5271abe9b8aSliubo __field( u64, len ) 5281abe9b8aSliubo __field( u64, disk_len ) 5291abe9b8aSliubo __field( u64, bytes_left ) 5301abe9b8aSliubo __field( unsigned long, flags ) 5311abe9b8aSliubo __field( int, compress_type ) 5321abe9b8aSliubo __field( int, refs ) 5331abe9b8aSliubo __field( u64, root_objectid ) 53478566548SLiu Bo __field( u64, truncated_len ) 5351abe9b8aSliubo ), 5361abe9b8aSliubo 537acbf1dd0SNikolay Borisov TP_fast_assign_btrfs(inode->root->fs_info, 538acbf1dd0SNikolay Borisov __entry->ino = btrfs_ino(inode); 5391abe9b8aSliubo __entry->file_offset = ordered->file_offset; 540bffe633eSOmar Sandoval __entry->start = ordered->disk_bytenr; 541bffe633eSOmar Sandoval __entry->len = ordered->num_bytes; 542bffe633eSOmar Sandoval __entry->disk_len = ordered->disk_num_bytes; 5431abe9b8aSliubo __entry->bytes_left = ordered->bytes_left; 5441abe9b8aSliubo __entry->flags = ordered->flags; 5451abe9b8aSliubo __entry->compress_type = ordered->compress_type; 546e76edab7SElena Reshetova __entry->refs = refcount_read(&ordered->refs); 547acbf1dd0SNikolay Borisov __entry->root_objectid = inode->root->root_key.objectid; 54878566548SLiu Bo __entry->truncated_len = ordered->truncated_len; 5491abe9b8aSliubo ), 5501abe9b8aSliubo 551562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu " 552562a7a07SDavid Sterba "start=%llu len=%llu disk_len=%llu " 553562a7a07SDavid Sterba "truncated_len=%llu " 554562a7a07SDavid Sterba "bytes_left=%llu flags=%s compress_type=%d " 5551abe9b8aSliubo "refs=%d", 5561abe9b8aSliubo show_root_type(__entry->root_objectid), 5578eec8463SDavid Sterba __entry->ino, 5588eec8463SDavid Sterba __entry->file_offset, 5598eec8463SDavid Sterba __entry->start, 5608eec8463SDavid Sterba __entry->len, 5618eec8463SDavid Sterba __entry->disk_len, 5628eec8463SDavid Sterba __entry->truncated_len, 5638eec8463SDavid Sterba __entry->bytes_left, 5641abe9b8aSliubo show_ordered_flags(__entry->flags), 5651abe9b8aSliubo __entry->compress_type, __entry->refs) 5661abe9b8aSliubo ); 5671abe9b8aSliubo 5681abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, 5691abe9b8aSliubo 570acbf1dd0SNikolay Borisov TP_PROTO(const struct btrfs_inode *inode, 5719a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5721abe9b8aSliubo 5731abe9b8aSliubo TP_ARGS(inode, ordered) 5741abe9b8aSliubo ); 5751abe9b8aSliubo 5761abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, 5771abe9b8aSliubo 578acbf1dd0SNikolay Borisov TP_PROTO(const struct btrfs_inode *inode, 5799a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5801abe9b8aSliubo 5811abe9b8aSliubo TP_ARGS(inode, ordered) 5821abe9b8aSliubo ); 5831abe9b8aSliubo 5841abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, 5851abe9b8aSliubo 586acbf1dd0SNikolay Borisov TP_PROTO(const struct btrfs_inode *inode, 5879a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5881abe9b8aSliubo 5891abe9b8aSliubo TP_ARGS(inode, ordered) 5901abe9b8aSliubo ); 5911abe9b8aSliubo 5921abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, 5931abe9b8aSliubo 594acbf1dd0SNikolay Borisov TP_PROTO(const struct btrfs_inode *inode, 5959a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5961abe9b8aSliubo 5971abe9b8aSliubo TP_ARGS(inode, ordered) 5981abe9b8aSliubo ); 5991abe9b8aSliubo 6005bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup, 6015bea2508SJohannes Thumshirn 6025bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6035bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6045bea2508SJohannes Thumshirn 6055bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6065bea2508SJohannes Thumshirn ); 6075bea2508SJohannes Thumshirn 6085bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_range, 6095bea2508SJohannes Thumshirn 6105bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6115bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6125bea2508SJohannes Thumshirn 6135bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6145bea2508SJohannes Thumshirn ); 6155bea2508SJohannes Thumshirn 6165bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_first_range, 6175bea2508SJohannes Thumshirn 6185bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6195bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6205bea2508SJohannes Thumshirn 6215bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6225bea2508SJohannes Thumshirn ); 6235bea2508SJohannes Thumshirn 6245bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_for_logging, 6255bea2508SJohannes Thumshirn 6265bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6275bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6285bea2508SJohannes Thumshirn 6295bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6305bea2508SJohannes Thumshirn ); 6315bea2508SJohannes Thumshirn 6325bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_first, 6335bea2508SJohannes Thumshirn 6345bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6355bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6365bea2508SJohannes Thumshirn 6375bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6385bea2508SJohannes Thumshirn ); 6395bea2508SJohannes Thumshirn 6405bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_split, 6415bea2508SJohannes Thumshirn 6425bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6435bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6445bea2508SJohannes Thumshirn 6455bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6465bea2508SJohannes Thumshirn ); 6475bea2508SJohannes Thumshirn 6485bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_dec_test_pending, 6495bea2508SJohannes Thumshirn 6505bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6515bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6525bea2508SJohannes Thumshirn 6535bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6545bea2508SJohannes Thumshirn ); 6555bea2508SJohannes Thumshirn 6565bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_mark_finished, 6575bea2508SJohannes Thumshirn 6585bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6595bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6605bea2508SJohannes Thumshirn 6615bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6625bea2508SJohannes Thumshirn ); 6635bea2508SJohannes Thumshirn 6641abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__writepage, 6651abe9b8aSliubo 6669a35b637SJeff Mahoney TP_PROTO(const struct page *page, const struct inode *inode, 6679a35b637SJeff Mahoney const struct writeback_control *wbc), 6681abe9b8aSliubo 6691abe9b8aSliubo TP_ARGS(page, inode, wbc), 6701abe9b8aSliubo 671bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 672f8f8e189SDavid Sterba __field( u64, ino ) 6731abe9b8aSliubo __field( pgoff_t, index ) 6741abe9b8aSliubo __field( long, nr_to_write ) 6751abe9b8aSliubo __field( long, pages_skipped ) 6761abe9b8aSliubo __field( loff_t, range_start ) 6771abe9b8aSliubo __field( loff_t, range_end ) 6781abe9b8aSliubo __field( char, for_kupdate ) 6791abe9b8aSliubo __field( char, for_reclaim ) 6801abe9b8aSliubo __field( char, range_cyclic ) 68194c3f6c6SDavid Sterba __field( unsigned long, writeback_index ) 6821abe9b8aSliubo __field( u64, root_objectid ) 6831abe9b8aSliubo ), 6841abe9b8aSliubo 685bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 686f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 6871abe9b8aSliubo __entry->index = page->index; 6881abe9b8aSliubo __entry->nr_to_write = wbc->nr_to_write; 6891abe9b8aSliubo __entry->pages_skipped = wbc->pages_skipped; 6901abe9b8aSliubo __entry->range_start = wbc->range_start; 6911abe9b8aSliubo __entry->range_end = wbc->range_end; 6921abe9b8aSliubo __entry->for_kupdate = wbc->for_kupdate; 6931abe9b8aSliubo __entry->for_reclaim = wbc->for_reclaim; 6941abe9b8aSliubo __entry->range_cyclic = wbc->range_cyclic; 6951abe9b8aSliubo __entry->writeback_index = inode->i_mapping->writeback_index; 6961abe9b8aSliubo __entry->root_objectid = 6971abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 6981abe9b8aSliubo ), 6991abe9b8aSliubo 700f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu " 701562a7a07SDavid Sterba "nr_to_write=%ld pages_skipped=%ld range_start=%llu " 702562a7a07SDavid Sterba "range_end=%llu for_kupdate=%d " 703562a7a07SDavid Sterba "for_reclaim=%d range_cyclic=%d writeback_index=%lu", 7041abe9b8aSliubo show_root_type(__entry->root_objectid), 7058eec8463SDavid Sterba __entry->ino, __entry->index, 7061abe9b8aSliubo __entry->nr_to_write, __entry->pages_skipped, 7071abe9b8aSliubo __entry->range_start, __entry->range_end, 708846d5a09SWu Fengguang __entry->for_kupdate, 7091abe9b8aSliubo __entry->for_reclaim, __entry->range_cyclic, 71094c3f6c6SDavid Sterba __entry->writeback_index) 7111abe9b8aSliubo ); 7121abe9b8aSliubo 7131abe9b8aSliubo DEFINE_EVENT(btrfs__writepage, __extent_writepage, 7141abe9b8aSliubo 7159a35b637SJeff Mahoney TP_PROTO(const struct page *page, const struct inode *inode, 7169a35b637SJeff Mahoney const struct writeback_control *wbc), 7171abe9b8aSliubo 7181abe9b8aSliubo TP_ARGS(page, inode, wbc) 7191abe9b8aSliubo ); 7201abe9b8aSliubo 7211abe9b8aSliubo TRACE_EVENT(btrfs_writepage_end_io_hook, 7221abe9b8aSliubo 72338a39ac7SQu Wenruo TP_PROTO(const struct btrfs_inode *inode, u64 start, u64 end, 72438a39ac7SQu Wenruo int uptodate), 7251abe9b8aSliubo 72638a39ac7SQu Wenruo TP_ARGS(inode, start, end, uptodate), 7271abe9b8aSliubo 728bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 729f8f8e189SDavid Sterba __field( u64, ino ) 7301abe9b8aSliubo __field( u64, start ) 7311abe9b8aSliubo __field( u64, end ) 7321abe9b8aSliubo __field( int, uptodate ) 7331abe9b8aSliubo __field( u64, root_objectid ) 7341abe9b8aSliubo ), 7351abe9b8aSliubo 73638a39ac7SQu Wenruo TP_fast_assign_btrfs(inode->root->fs_info, 73738a39ac7SQu Wenruo __entry->ino = btrfs_ino(inode); 7381abe9b8aSliubo __entry->start = start; 7391abe9b8aSliubo __entry->end = end; 7401abe9b8aSliubo __entry->uptodate = uptodate; 74138a39ac7SQu Wenruo __entry->root_objectid = inode->root->root_key.objectid; 7421abe9b8aSliubo ), 7431abe9b8aSliubo 74438a39ac7SQu Wenruo TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu end=%llu uptodate=%d", 7451abe9b8aSliubo show_root_type(__entry->root_objectid), 74638a39ac7SQu Wenruo __entry->ino, __entry->start, 7478eec8463SDavid Sterba __entry->end, __entry->uptodate) 7481abe9b8aSliubo ); 7491abe9b8aSliubo 7501abe9b8aSliubo TRACE_EVENT(btrfs_sync_file, 7511abe9b8aSliubo 7529a35b637SJeff Mahoney TP_PROTO(const struct file *file, int datasync), 7531abe9b8aSliubo 7541abe9b8aSliubo TP_ARGS(file, datasync), 7551abe9b8aSliubo 756bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 757f8f8e189SDavid Sterba __field( u64, ino ) 758f8f8e189SDavid Sterba __field( u64, parent ) 7591abe9b8aSliubo __field( int, datasync ) 7601abe9b8aSliubo __field( u64, root_objectid ) 7611abe9b8aSliubo ), 7621abe9b8aSliubo 7631abe9b8aSliubo TP_fast_assign( 7649a35b637SJeff Mahoney const struct dentry *dentry = file->f_path.dentry; 7659a35b637SJeff Mahoney const struct inode *inode = d_inode(dentry); 7661abe9b8aSliubo 767bc074524SJeff Mahoney TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb)); 768f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 769f8f8e189SDavid Sterba __entry->parent = btrfs_ino(BTRFS_I(d_inode(dentry->d_parent))); 7701abe9b8aSliubo __entry->datasync = datasync; 7711abe9b8aSliubo __entry->root_objectid = 7721abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 7731abe9b8aSliubo ), 7741abe9b8aSliubo 775f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu parent=%llu datasync=%d", 7761abe9b8aSliubo show_root_type(__entry->root_objectid), 7778eec8463SDavid Sterba __entry->ino, 7788eec8463SDavid Sterba __entry->parent, 7791abe9b8aSliubo __entry->datasync) 7801abe9b8aSliubo ); 7811abe9b8aSliubo 7821abe9b8aSliubo TRACE_EVENT(btrfs_sync_fs, 7831abe9b8aSliubo 7849a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, int wait), 7851abe9b8aSliubo 786bc074524SJeff Mahoney TP_ARGS(fs_info, wait), 7871abe9b8aSliubo 788bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 7891abe9b8aSliubo __field( int, wait ) 7901abe9b8aSliubo ), 7911abe9b8aSliubo 792bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 7931abe9b8aSliubo __entry->wait = wait; 7941abe9b8aSliubo ), 7951abe9b8aSliubo 796bc074524SJeff Mahoney TP_printk_btrfs("wait=%d", __entry->wait) 7971abe9b8aSliubo ); 7981abe9b8aSliubo 799c83f8effSJosef Bacik TRACE_EVENT(btrfs_add_block_group, 800c83f8effSJosef Bacik 8019a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 80232da5386SDavid Sterba const struct btrfs_block_group *block_group, int create), 803c83f8effSJosef Bacik 804c83f8effSJosef Bacik TP_ARGS(fs_info, block_group, create), 805c83f8effSJosef Bacik 8062e63e62dSDavid Sterba TP_STRUCT__entry_btrfs( 807c83f8effSJosef Bacik __field( u64, offset ) 808c83f8effSJosef Bacik __field( u64, size ) 809c83f8effSJosef Bacik __field( u64, flags ) 810c83f8effSJosef Bacik __field( u64, bytes_used ) 811c83f8effSJosef Bacik __field( u64, bytes_super ) 812c83f8effSJosef Bacik __field( int, create ) 813c83f8effSJosef Bacik ), 814c83f8effSJosef Bacik 8152e63e62dSDavid Sterba TP_fast_assign_btrfs(fs_info, 816b3470b5dSDavid Sterba __entry->offset = block_group->start; 817b3470b5dSDavid Sterba __entry->size = block_group->length; 818c83f8effSJosef Bacik __entry->flags = block_group->flags; 819bf38be65SDavid Sterba __entry->bytes_used = block_group->used; 820c83f8effSJosef Bacik __entry->bytes_super = block_group->bytes_super; 821c83f8effSJosef Bacik __entry->create = create; 822c83f8effSJosef Bacik ), 823c83f8effSJosef Bacik 8242e63e62dSDavid Sterba TP_printk_btrfs("block_group offset=%llu size=%llu " 825562a7a07SDavid Sterba "flags=%llu(%s) bytes_used=%llu bytes_super=%llu " 8262e63e62dSDavid Sterba "create=%d", 8278eec8463SDavid Sterba __entry->offset, 8288eec8463SDavid Sterba __entry->size, 8298eec8463SDavid Sterba __entry->flags, 830c83f8effSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 831c83f8effSJosef Bacik BTRFS_GROUP_FLAGS), 8328eec8463SDavid Sterba __entry->bytes_used, 8338eec8463SDavid Sterba __entry->bytes_super, __entry->create) 834c83f8effSJosef Bacik ); 835c83f8effSJosef Bacik 8361abe9b8aSliubo #define show_ref_action(action) \ 8371abe9b8aSliubo __print_symbolic(action, \ 8381abe9b8aSliubo { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ 8391abe9b8aSliubo { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ 8401abe9b8aSliubo { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ 8411abe9b8aSliubo { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) 8421abe9b8aSliubo 8431abe9b8aSliubo 844599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, 8451abe9b8aSliubo 8469a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8479a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 8489a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 8491abe9b8aSliubo int action), 8501abe9b8aSliubo 851bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action), 8521abe9b8aSliubo 853bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 8541abe9b8aSliubo __field( u64, bytenr ) 8551abe9b8aSliubo __field( u64, num_bytes ) 8561abe9b8aSliubo __field( int, action ) 8571abe9b8aSliubo __field( u64, parent ) 8581abe9b8aSliubo __field( u64, ref_root ) 8591abe9b8aSliubo __field( int, level ) 8601abe9b8aSliubo __field( int, type ) 861dea7d76eSLiu Bo __field( u64, seq ) 8621abe9b8aSliubo ), 8631abe9b8aSliubo 864bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 8651abe9b8aSliubo __entry->bytenr = ref->bytenr; 8661abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 8671abe9b8aSliubo __entry->action = action; 8681abe9b8aSliubo __entry->parent = full_ref->parent; 8691abe9b8aSliubo __entry->ref_root = full_ref->root; 8701abe9b8aSliubo __entry->level = full_ref->level; 8711abe9b8aSliubo __entry->type = ref->type; 872dea7d76eSLiu Bo __entry->seq = ref->seq; 8731abe9b8aSliubo ), 8741abe9b8aSliubo 875562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 876562a7a07SDavid Sterba "parent=%llu(%s) ref_root=%llu(%s) level=%d " 877562a7a07SDavid Sterba "type=%s seq=%llu", 8788eec8463SDavid Sterba __entry->bytenr, 8798eec8463SDavid Sterba __entry->num_bytes, 8801abe9b8aSliubo show_ref_action(__entry->action), 8811abe9b8aSliubo show_root_type(__entry->parent), 8821abe9b8aSliubo show_root_type(__entry->ref_root), 883dea7d76eSLiu Bo __entry->level, show_ref_type(__entry->type), 8848eec8463SDavid Sterba __entry->seq) 8851abe9b8aSliubo ); 8861abe9b8aSliubo 887599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, 888599c75ecSLiu Bo 8899a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8909a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 8919a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 892599c75ecSLiu Bo int action), 893599c75ecSLiu Bo 894bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 895599c75ecSLiu Bo ); 896599c75ecSLiu Bo 897599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, 898599c75ecSLiu Bo 8999a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9009a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 9019a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 902599c75ecSLiu Bo int action), 903599c75ecSLiu Bo 904bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 905599c75ecSLiu Bo ); 906599c75ecSLiu Bo 907599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, 9081abe9b8aSliubo 9099a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9109a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 9119a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 9121abe9b8aSliubo int action), 9131abe9b8aSliubo 914bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action), 9151abe9b8aSliubo 916bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 9171abe9b8aSliubo __field( u64, bytenr ) 9181abe9b8aSliubo __field( u64, num_bytes ) 9191abe9b8aSliubo __field( int, action ) 9201abe9b8aSliubo __field( u64, parent ) 9211abe9b8aSliubo __field( u64, ref_root ) 9221abe9b8aSliubo __field( u64, owner ) 9231abe9b8aSliubo __field( u64, offset ) 9241abe9b8aSliubo __field( int, type ) 925dea7d76eSLiu Bo __field( u64, seq ) 9261abe9b8aSliubo ), 9271abe9b8aSliubo 928bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 9291abe9b8aSliubo __entry->bytenr = ref->bytenr; 9301abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 9311abe9b8aSliubo __entry->action = action; 9321abe9b8aSliubo __entry->parent = full_ref->parent; 9331abe9b8aSliubo __entry->ref_root = full_ref->root; 9341abe9b8aSliubo __entry->owner = full_ref->objectid; 9351abe9b8aSliubo __entry->offset = full_ref->offset; 9361abe9b8aSliubo __entry->type = ref->type; 937dea7d76eSLiu Bo __entry->seq = ref->seq; 9381abe9b8aSliubo ), 9391abe9b8aSliubo 940562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 941562a7a07SDavid Sterba "parent=%llu(%s) ref_root=%llu(%s) owner=%llu " 942562a7a07SDavid Sterba "offset=%llu type=%s seq=%llu", 9438eec8463SDavid Sterba __entry->bytenr, 9448eec8463SDavid Sterba __entry->num_bytes, 9451abe9b8aSliubo show_ref_action(__entry->action), 9461abe9b8aSliubo show_root_type(__entry->parent), 9471abe9b8aSliubo show_root_type(__entry->ref_root), 9488eec8463SDavid Sterba __entry->owner, 9498eec8463SDavid Sterba __entry->offset, 950dea7d76eSLiu Bo show_ref_type(__entry->type), 9518eec8463SDavid Sterba __entry->seq) 9521abe9b8aSliubo ); 9531abe9b8aSliubo 954599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, 955599c75ecSLiu Bo 9569a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9579a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 9589a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 959599c75ecSLiu Bo int action), 960599c75ecSLiu Bo 961bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 962599c75ecSLiu Bo ); 963599c75ecSLiu Bo 964599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, 965599c75ecSLiu Bo 9669a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9679a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 9689a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 969599c75ecSLiu Bo int action), 970599c75ecSLiu Bo 971bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 972599c75ecSLiu Bo ); 973599c75ecSLiu Bo 974599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, 9751abe9b8aSliubo 9769a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9779a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 9781abe9b8aSliubo int action), 9791abe9b8aSliubo 980d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action), 9811abe9b8aSliubo 982bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 9831abe9b8aSliubo __field( u64, bytenr ) 9841abe9b8aSliubo __field( u64, num_bytes ) 9851abe9b8aSliubo __field( int, action ) 9861abe9b8aSliubo __field( int, is_data ) 9871abe9b8aSliubo ), 9881abe9b8aSliubo 989bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 990d278850eSJosef Bacik __entry->bytenr = head_ref->bytenr; 991d278850eSJosef Bacik __entry->num_bytes = head_ref->num_bytes; 9921abe9b8aSliubo __entry->action = action; 9931abe9b8aSliubo __entry->is_data = head_ref->is_data; 9941abe9b8aSliubo ), 9951abe9b8aSliubo 996562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d", 9978eec8463SDavid Sterba __entry->bytenr, 9988eec8463SDavid Sterba __entry->num_bytes, 9991abe9b8aSliubo show_ref_action(__entry->action), 10001abe9b8aSliubo __entry->is_data) 10011abe9b8aSliubo ); 10021abe9b8aSliubo 1003599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, 1004599c75ecSLiu Bo 10059a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10069a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 1007599c75ecSLiu Bo int action), 1008599c75ecSLiu Bo 1009d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action) 1010599c75ecSLiu Bo ); 1011599c75ecSLiu Bo 1012599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, 1013599c75ecSLiu Bo 10149a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10159a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 1016599c75ecSLiu Bo int action), 1017599c75ecSLiu Bo 1018d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action) 1019599c75ecSLiu Bo ); 1020599c75ecSLiu Bo 10211abe9b8aSliubo #define show_chunk_type(type) \ 10221abe9b8aSliubo __print_flags(type, "|", \ 10231abe9b8aSliubo { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ 10241abe9b8aSliubo { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 10251abe9b8aSliubo { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 10261abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ 10271abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ 10281abe9b8aSliubo { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ 1029e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 1030e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ 1031e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) 10321abe9b8aSliubo 10331abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__chunk, 10341abe9b8aSliubo 10359a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10369a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 10371abe9b8aSliubo 10386bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size), 10391abe9b8aSliubo 1040bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 10411abe9b8aSliubo __field( int, num_stripes ) 10421abe9b8aSliubo __field( u64, type ) 10431abe9b8aSliubo __field( int, sub_stripes ) 10441abe9b8aSliubo __field( u64, offset ) 10451abe9b8aSliubo __field( u64, size ) 10461abe9b8aSliubo __field( u64, root_objectid ) 10471abe9b8aSliubo ), 10481abe9b8aSliubo 10496bccf3abSJeff Mahoney TP_fast_assign_btrfs(fs_info, 10501abe9b8aSliubo __entry->num_stripes = map->num_stripes; 10511abe9b8aSliubo __entry->type = map->type; 10521abe9b8aSliubo __entry->sub_stripes = map->sub_stripes; 10531abe9b8aSliubo __entry->offset = offset; 10541abe9b8aSliubo __entry->size = size; 10556bccf3abSJeff Mahoney __entry->root_objectid = fs_info->chunk_root->root_key.objectid; 10561abe9b8aSliubo ), 10571abe9b8aSliubo 1058562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu " 1059562a7a07SDavid Sterba "num_stripes=%d sub_stripes=%d type=%s", 10601abe9b8aSliubo show_root_type(__entry->root_objectid), 10618eec8463SDavid Sterba __entry->offset, 10628eec8463SDavid Sterba __entry->size, 10631abe9b8aSliubo __entry->num_stripes, __entry->sub_stripes, 10641abe9b8aSliubo show_chunk_type(__entry->type)) 10651abe9b8aSliubo ); 10661abe9b8aSliubo 10671abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, 10681abe9b8aSliubo 10699a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10709a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 10711abe9b8aSliubo 10726bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size) 10731abe9b8aSliubo ); 10741abe9b8aSliubo 10751abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, 10761abe9b8aSliubo 10779a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10789a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 10791abe9b8aSliubo 10806bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size) 10811abe9b8aSliubo ); 10821abe9b8aSliubo 10831abe9b8aSliubo TRACE_EVENT(btrfs_cow_block, 10841abe9b8aSliubo 10859a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf, 10869a35b637SJeff Mahoney const struct extent_buffer *cow), 10871abe9b8aSliubo 10881abe9b8aSliubo TP_ARGS(root, buf, cow), 10891abe9b8aSliubo 1090bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 10911abe9b8aSliubo __field( u64, root_objectid ) 10921abe9b8aSliubo __field( u64, buf_start ) 10931abe9b8aSliubo __field( int, refs ) 10941abe9b8aSliubo __field( u64, cow_start ) 10951abe9b8aSliubo __field( int, buf_level ) 10961abe9b8aSliubo __field( int, cow_level ) 10971abe9b8aSliubo ), 10981abe9b8aSliubo 1099bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 11001abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 11011abe9b8aSliubo __entry->buf_start = buf->start; 11021abe9b8aSliubo __entry->refs = atomic_read(&buf->refs); 11031abe9b8aSliubo __entry->cow_start = cow->start; 11041abe9b8aSliubo __entry->buf_level = btrfs_header_level(buf); 11051abe9b8aSliubo __entry->cow_level = btrfs_header_level(cow); 11061abe9b8aSliubo ), 11071abe9b8aSliubo 1108562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu " 1109562a7a07SDavid Sterba "(orig_level=%d) cow_buf=%llu (cow_level=%d)", 11101abe9b8aSliubo show_root_type(__entry->root_objectid), 11111abe9b8aSliubo __entry->refs, 11128eec8463SDavid Sterba __entry->buf_start, 11131abe9b8aSliubo __entry->buf_level, 11148eec8463SDavid Sterba __entry->cow_start, 11151abe9b8aSliubo __entry->cow_level) 11161abe9b8aSliubo ); 11171abe9b8aSliubo 11188c2a3ca2SJosef Bacik TRACE_EVENT(btrfs_space_reservation, 11198c2a3ca2SJosef Bacik 11201d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, const char *type, u64 val, 11218c2a3ca2SJosef Bacik u64 bytes, int reserve), 11228c2a3ca2SJosef Bacik 11238c2a3ca2SJosef Bacik TP_ARGS(fs_info, type, val, bytes, reserve), 11248c2a3ca2SJosef Bacik 1125bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 11268c2a3ca2SJosef Bacik __string( type, type ) 11278c2a3ca2SJosef Bacik __field( u64, val ) 11288c2a3ca2SJosef Bacik __field( u64, bytes ) 11298c2a3ca2SJosef Bacik __field( int, reserve ) 11308c2a3ca2SJosef Bacik ), 11318c2a3ca2SJosef Bacik 1132bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 11338c2a3ca2SJosef Bacik __assign_str(type, type); 11348c2a3ca2SJosef Bacik __entry->val = val; 11358c2a3ca2SJosef Bacik __entry->bytes = bytes; 11368c2a3ca2SJosef Bacik __entry->reserve = reserve; 11378c2a3ca2SJosef Bacik ), 11388c2a3ca2SJosef Bacik 11395439c7f5SDavid Sterba TP_printk_btrfs("%s: %llu %s %llu", __get_str(type), __entry->val, 1140bc074524SJeff Mahoney __entry->reserve ? "reserve" : "release", 11418c2a3ca2SJosef Bacik __entry->bytes) 11428c2a3ca2SJosef Bacik ); 11438c2a3ca2SJosef Bacik 1144f376df2bSJosef Bacik TRACE_EVENT(btrfs_trigger_flush, 1145f376df2bSJosef Bacik 11469a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, 11471d2e7c7cSDavid Sterba int flush, const char *reason), 1148f376df2bSJosef Bacik 1149f376df2bSJosef Bacik TP_ARGS(fs_info, flags, bytes, flush, reason), 1150f376df2bSJosef Bacik 11512e63e62dSDavid Sterba TP_STRUCT__entry_btrfs( 1152f376df2bSJosef Bacik __field( u64, flags ) 1153f376df2bSJosef Bacik __field( u64, bytes ) 1154f376df2bSJosef Bacik __field( int, flush ) 1155f376df2bSJosef Bacik __string( reason, reason ) 1156f376df2bSJosef Bacik ), 1157f376df2bSJosef Bacik 11582e63e62dSDavid Sterba TP_fast_assign_btrfs(fs_info, 1159f376df2bSJosef Bacik __entry->flags = flags; 1160f376df2bSJosef Bacik __entry->bytes = bytes; 1161f376df2bSJosef Bacik __entry->flush = flush; 116278c14b38SJoe Perches __assign_str(reason, reason); 1163f376df2bSJosef Bacik ), 1164f376df2bSJosef Bacik 11652e63e62dSDavid Sterba TP_printk_btrfs("%s: flush=%d(%s) flags=%llu(%s) bytes=%llu", 11662e63e62dSDavid Sterba __get_str(reason), __entry->flush, 116745e31869SNikolay Borisov __print_symbolic(__entry->flush, FLUSH_ACTIONS), 11688eec8463SDavid Sterba __entry->flags, 1169f376df2bSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 1170f376df2bSJosef Bacik BTRFS_GROUP_FLAGS), 11718eec8463SDavid Sterba __entry->bytes) 1172f376df2bSJosef Bacik ); 1173f376df2bSJosef Bacik 1174f376df2bSJosef Bacik 1175f376df2bSJosef Bacik TRACE_EVENT(btrfs_flush_space, 1176f376df2bSJosef Bacik 11779a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes, 11784b02b00fSJosef Bacik int state, int ret, bool for_preempt), 1179f376df2bSJosef Bacik 11804b02b00fSJosef Bacik TP_ARGS(fs_info, flags, num_bytes, state, ret, for_preempt), 1181f376df2bSJosef Bacik 11822e63e62dSDavid Sterba TP_STRUCT__entry_btrfs( 1183f376df2bSJosef Bacik __field( u64, flags ) 1184f376df2bSJosef Bacik __field( u64, num_bytes ) 1185f376df2bSJosef Bacik __field( int, state ) 1186f376df2bSJosef Bacik __field( int, ret ) 11874b02b00fSJosef Bacik __field( bool, for_preempt ) 1188f376df2bSJosef Bacik ), 1189f376df2bSJosef Bacik 11902e63e62dSDavid Sterba TP_fast_assign_btrfs(fs_info, 1191f376df2bSJosef Bacik __entry->flags = flags; 1192f376df2bSJosef Bacik __entry->num_bytes = num_bytes; 1193f376df2bSJosef Bacik __entry->state = state; 1194f376df2bSJosef Bacik __entry->ret = ret; 11954b02b00fSJosef Bacik __entry->for_preempt = for_preempt; 1196f376df2bSJosef Bacik ), 1197f376df2bSJosef Bacik 11984b02b00fSJosef Bacik TP_printk_btrfs("state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d for_preempt=%d", 11992e63e62dSDavid Sterba __entry->state, 1200f0cdd15cSNikolay Borisov __print_symbolic(__entry->state, FLUSH_STATES), 12018eec8463SDavid Sterba __entry->flags, 1202f376df2bSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 1203f376df2bSJosef Bacik BTRFS_GROUP_FLAGS), 12044b02b00fSJosef Bacik __entry->num_bytes, __entry->ret, __entry->for_preempt) 1205f376df2bSJosef Bacik ); 1206f376df2bSJosef Bacik 12071abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__reserved_extent, 12081abe9b8aSliubo 12099a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 12101abe9b8aSliubo 121171ff6437SJeff Mahoney TP_ARGS(fs_info, start, len), 12121abe9b8aSliubo 1213bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 12141abe9b8aSliubo __field( u64, start ) 12151abe9b8aSliubo __field( u64, len ) 12161abe9b8aSliubo ), 12171abe9b8aSliubo 121871ff6437SJeff Mahoney TP_fast_assign_btrfs(fs_info, 12191abe9b8aSliubo __entry->start = start; 12201abe9b8aSliubo __entry->len = len; 12211abe9b8aSliubo ), 12221abe9b8aSliubo 1223562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu", 122471ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 12258eec8463SDavid Sterba __entry->start, 12268eec8463SDavid Sterba __entry->len) 12271abe9b8aSliubo ); 12281abe9b8aSliubo 12291abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, 12301abe9b8aSliubo 12319a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 12321abe9b8aSliubo 123371ff6437SJeff Mahoney TP_ARGS(fs_info, start, len) 12341abe9b8aSliubo ); 12351abe9b8aSliubo 12361abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, 12371abe9b8aSliubo 12389a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 12391abe9b8aSliubo 124071ff6437SJeff Mahoney TP_ARGS(fs_info, start, len) 12411abe9b8aSliubo ); 12421abe9b8aSliubo 12433f7de037SJosef Bacik TRACE_EVENT(find_free_extent, 12443f7de037SJosef Bacik 1245cfc2de0fSBoris Burkov TP_PROTO(const struct btrfs_root *root, 1246cfc2de0fSBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 12473f7de037SJosef Bacik 1248cfc2de0fSBoris Burkov TP_ARGS(root, ffe_ctl), 12493f7de037SJosef Bacik 1250bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1251437490feSQu Wenruo __field( u64, root_objectid ) 12523f7de037SJosef Bacik __field( u64, num_bytes ) 12533f7de037SJosef Bacik __field( u64, empty_size ) 1254cfc2de0fSBoris Burkov __field( u64, flags ) 12553f7de037SJosef Bacik ), 12563f7de037SJosef Bacik 1257437490feSQu Wenruo TP_fast_assign_btrfs(root->fs_info, 1258437490feSQu Wenruo __entry->root_objectid = root->root_key.objectid; 1259cfc2de0fSBoris Burkov __entry->num_bytes = ffe_ctl->num_bytes; 1260cfc2de0fSBoris Burkov __entry->empty_size = ffe_ctl->empty_size; 1261cfc2de0fSBoris Burkov __entry->flags = ffe_ctl->flags; 12623f7de037SJosef Bacik ), 12633f7de037SJosef Bacik 12645439c7f5SDavid Sterba TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s)", 1265437490feSQu Wenruo show_root_type(__entry->root_objectid), 1266cfc2de0fSBoris Burkov __entry->num_bytes, __entry->empty_size, __entry->flags, 1267cfc2de0fSBoris Burkov __print_flags((unsigned long)__entry->flags, "|", 12683f7de037SJosef Bacik BTRFS_GROUP_FLAGS)) 12693f7de037SJosef Bacik ); 12703f7de037SJosef Bacik 1271*854c2f36SBoris Burkov TRACE_EVENT(find_free_extent_search_loop, 1272*854c2f36SBoris Burkov 1273*854c2f36SBoris Burkov TP_PROTO(const struct btrfs_root *root, 1274*854c2f36SBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 1275*854c2f36SBoris Burkov 1276*854c2f36SBoris Burkov TP_ARGS(root, ffe_ctl), 1277*854c2f36SBoris Burkov 1278*854c2f36SBoris Burkov TP_STRUCT__entry_btrfs( 1279*854c2f36SBoris Burkov __field( u64, root_objectid ) 1280*854c2f36SBoris Burkov __field( u64, num_bytes ) 1281*854c2f36SBoris Burkov __field( u64, empty_size ) 1282*854c2f36SBoris Burkov __field( u64, flags ) 1283*854c2f36SBoris Burkov __field( u64, loop ) 1284*854c2f36SBoris Burkov ), 1285*854c2f36SBoris Burkov 1286*854c2f36SBoris Burkov TP_fast_assign_btrfs(root->fs_info, 1287*854c2f36SBoris Burkov __entry->root_objectid = root->root_key.objectid; 1288*854c2f36SBoris Burkov __entry->num_bytes = ffe_ctl->num_bytes; 1289*854c2f36SBoris Burkov __entry->empty_size = ffe_ctl->empty_size; 1290*854c2f36SBoris Burkov __entry->flags = ffe_ctl->flags; 1291*854c2f36SBoris Burkov __entry->loop = ffe_ctl->loop; 1292*854c2f36SBoris Burkov ), 1293*854c2f36SBoris Burkov 1294*854c2f36SBoris Burkov TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s) loop=%llu", 1295*854c2f36SBoris Burkov show_root_type(__entry->root_objectid), 1296*854c2f36SBoris Burkov __entry->num_bytes, __entry->empty_size, __entry->flags, 1297*854c2f36SBoris Burkov __print_flags((unsigned long)__entry->flags, "|", BTRFS_GROUP_FLAGS), 1298*854c2f36SBoris Burkov __entry->loop) 1299*854c2f36SBoris Burkov ); 1300*854c2f36SBoris Burkov 1301*854c2f36SBoris Burkov TRACE_EVENT(find_free_extent_have_block_group, 1302*854c2f36SBoris Burkov 1303*854c2f36SBoris Burkov TP_PROTO(const struct btrfs_root *root, 1304*854c2f36SBoris Burkov const struct find_free_extent_ctl *ffe_ctl, 1305*854c2f36SBoris Burkov const struct btrfs_block_group *block_group), 1306*854c2f36SBoris Burkov 1307*854c2f36SBoris Burkov TP_ARGS(root, ffe_ctl, block_group), 1308*854c2f36SBoris Burkov 1309*854c2f36SBoris Burkov TP_STRUCT__entry_btrfs( 1310*854c2f36SBoris Burkov __field( u64, root_objectid ) 1311*854c2f36SBoris Burkov __field( u64, num_bytes ) 1312*854c2f36SBoris Burkov __field( u64, empty_size ) 1313*854c2f36SBoris Burkov __field( u64, flags ) 1314*854c2f36SBoris Burkov __field( u64, loop ) 1315*854c2f36SBoris Burkov __field( bool, hinted ) 1316*854c2f36SBoris Burkov __field( u64, bg_start ) 1317*854c2f36SBoris Burkov __field( u64, bg_flags ) 1318*854c2f36SBoris Burkov ), 1319*854c2f36SBoris Burkov 1320*854c2f36SBoris Burkov TP_fast_assign_btrfs(root->fs_info, 1321*854c2f36SBoris Burkov __entry->root_objectid = root->root_key.objectid; 1322*854c2f36SBoris Burkov __entry->num_bytes = ffe_ctl->num_bytes; 1323*854c2f36SBoris Burkov __entry->empty_size = ffe_ctl->empty_size; 1324*854c2f36SBoris Burkov __entry->flags = ffe_ctl->flags; 1325*854c2f36SBoris Burkov __entry->loop = ffe_ctl->loop; 1326*854c2f36SBoris Burkov __entry->hinted = ffe_ctl->hinted; 1327*854c2f36SBoris Burkov __entry->bg_start = block_group->start; 1328*854c2f36SBoris Burkov __entry->bg_flags = block_group->flags; 1329*854c2f36SBoris Burkov ), 1330*854c2f36SBoris Burkov 1331*854c2f36SBoris Burkov TP_printk_btrfs( 1332*854c2f36SBoris Burkov "root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s) loop=%llu hinted=%d block_group=%llu bg_flags=%llu(%s)", 1333*854c2f36SBoris Burkov show_root_type(__entry->root_objectid), 1334*854c2f36SBoris Burkov __entry->num_bytes, __entry->empty_size, __entry->flags, 1335*854c2f36SBoris Burkov __print_flags((unsigned long)__entry->flags, "|", BTRFS_GROUP_FLAGS), 1336*854c2f36SBoris Burkov __entry->loop, __entry->hinted, 1337*854c2f36SBoris Burkov __entry->bg_start, __entry->bg_flags, 1338*854c2f36SBoris Burkov __print_flags((unsigned long)__entry->bg_flags, "|", 1339*854c2f36SBoris Burkov BTRFS_GROUP_FLAGS)) 1340*854c2f36SBoris Burkov ); 1341*854c2f36SBoris Burkov 13423f7de037SJosef Bacik DECLARE_EVENT_CLASS(btrfs__reserve_extent, 13433f7de037SJosef Bacik 1344cfc2de0fSBoris Burkov TP_PROTO(const struct btrfs_block_group *block_group, 1345cfc2de0fSBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 13463f7de037SJosef Bacik 1347cfc2de0fSBoris Burkov TP_ARGS(block_group, ffe_ctl), 13483f7de037SJosef Bacik 1349bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 13503f7de037SJosef Bacik __field( u64, bg_objectid ) 13513f7de037SJosef Bacik __field( u64, flags ) 13523f7de037SJosef Bacik __field( u64, start ) 13533f7de037SJosef Bacik __field( u64, len ) 1354*854c2f36SBoris Burkov __field( u64, loop ) 1355*854c2f36SBoris Burkov __field( bool, hinted ) 13563f7de037SJosef Bacik ), 13573f7de037SJosef Bacik 13583dca5c94SQu Wenruo TP_fast_assign_btrfs(block_group->fs_info, 1359b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 13603f7de037SJosef Bacik __entry->flags = block_group->flags; 1361cfc2de0fSBoris Burkov __entry->start = ffe_ctl->search_start; 1362cfc2de0fSBoris Burkov __entry->len = ffe_ctl->num_bytes; 1363*854c2f36SBoris Burkov __entry->loop = ffe_ctl->loop; 1364*854c2f36SBoris Burkov __entry->hinted = ffe_ctl->hinted; 13653f7de037SJosef Bacik ), 13663f7de037SJosef Bacik 1367*854c2f36SBoris Burkov TP_printk_btrfs( 1368*854c2f36SBoris Burkov "root=%llu(%s) block_group=%llu flags=%llu(%s) start=%llu len=%llu loop=%llu hinted=%d", 136971ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 137071ff6437SJeff Mahoney __entry->bg_objectid, 13713f7de037SJosef Bacik __entry->flags, __print_flags((unsigned long)__entry->flags, 13723f7de037SJosef Bacik "|", BTRFS_GROUP_FLAGS), 1373*854c2f36SBoris Burkov __entry->start, __entry->len, __entry->loop, __entry->hinted) 13743f7de037SJosef Bacik ); 13753f7de037SJosef Bacik 13763f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, 13773f7de037SJosef Bacik 1378cfc2de0fSBoris Burkov TP_PROTO(const struct btrfs_block_group *block_group, 1379cfc2de0fSBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 13803f7de037SJosef Bacik 1381cfc2de0fSBoris Burkov TP_ARGS(block_group, ffe_ctl) 13823f7de037SJosef Bacik ); 13833f7de037SJosef Bacik 13843f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, 13853f7de037SJosef Bacik 1386cfc2de0fSBoris Burkov TP_PROTO(const struct btrfs_block_group *block_group, 1387cfc2de0fSBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 13883f7de037SJosef Bacik 1389cfc2de0fSBoris Burkov TP_ARGS(block_group, ffe_ctl) 13903f7de037SJosef Bacik ); 13913f7de037SJosef Bacik 13923f7de037SJosef Bacik TRACE_EVENT(btrfs_find_cluster, 13933f7de037SJosef Bacik 139432da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group, u64 start, 13953f7de037SJosef Bacik u64 bytes, u64 empty_size, u64 min_bytes), 13963f7de037SJosef Bacik 13973f7de037SJosef Bacik TP_ARGS(block_group, start, bytes, empty_size, min_bytes), 13983f7de037SJosef Bacik 1399bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 14003f7de037SJosef Bacik __field( u64, bg_objectid ) 14013f7de037SJosef Bacik __field( u64, flags ) 14023f7de037SJosef Bacik __field( u64, start ) 14033f7de037SJosef Bacik __field( u64, bytes ) 14043f7de037SJosef Bacik __field( u64, empty_size ) 14053f7de037SJosef Bacik __field( u64, min_bytes ) 14063f7de037SJosef Bacik ), 14073f7de037SJosef Bacik 1408bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 1409b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 14103f7de037SJosef Bacik __entry->flags = block_group->flags; 14113f7de037SJosef Bacik __entry->start = start; 14123f7de037SJosef Bacik __entry->bytes = bytes; 14133f7de037SJosef Bacik __entry->empty_size = empty_size; 14143f7de037SJosef Bacik __entry->min_bytes = min_bytes; 14153f7de037SJosef Bacik ), 14163f7de037SJosef Bacik 14175439c7f5SDavid Sterba TP_printk_btrfs("block_group=%llu flags=%llu(%s) start=%llu len=%llu " 14185439c7f5SDavid Sterba "empty_size=%llu min_bytes=%llu", __entry->bg_objectid, 14193f7de037SJosef Bacik __entry->flags, 14203f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 14213f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 14223f7de037SJosef Bacik __entry->bytes, __entry->empty_size, __entry->min_bytes) 14233f7de037SJosef Bacik ); 14243f7de037SJosef Bacik 14253f7de037SJosef Bacik TRACE_EVENT(btrfs_failed_cluster_setup, 14263f7de037SJosef Bacik 142732da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group), 14283f7de037SJosef Bacik 14293f7de037SJosef Bacik TP_ARGS(block_group), 14303f7de037SJosef Bacik 1431bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 14323f7de037SJosef Bacik __field( u64, bg_objectid ) 14333f7de037SJosef Bacik ), 14343f7de037SJosef Bacik 1435bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 1436b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 14373f7de037SJosef Bacik ), 14383f7de037SJosef Bacik 14395439c7f5SDavid Sterba TP_printk_btrfs("block_group=%llu", __entry->bg_objectid) 14403f7de037SJosef Bacik ); 14413f7de037SJosef Bacik 14423f7de037SJosef Bacik TRACE_EVENT(btrfs_setup_cluster, 14433f7de037SJosef Bacik 144432da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group, 14459a35b637SJeff Mahoney const struct btrfs_free_cluster *cluster, 14469a35b637SJeff Mahoney u64 size, int bitmap), 14473f7de037SJosef Bacik 14483f7de037SJosef Bacik TP_ARGS(block_group, cluster, size, bitmap), 14493f7de037SJosef Bacik 1450bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 14513f7de037SJosef Bacik __field( u64, bg_objectid ) 14523f7de037SJosef Bacik __field( u64, flags ) 14533f7de037SJosef Bacik __field( u64, start ) 14543f7de037SJosef Bacik __field( u64, max_size ) 14553f7de037SJosef Bacik __field( u64, size ) 14563f7de037SJosef Bacik __field( int, bitmap ) 14573f7de037SJosef Bacik ), 14583f7de037SJosef Bacik 1459bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 1460b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 14613f7de037SJosef Bacik __entry->flags = block_group->flags; 14623f7de037SJosef Bacik __entry->start = cluster->window_start; 14633f7de037SJosef Bacik __entry->max_size = cluster->max_size; 14643f7de037SJosef Bacik __entry->size = size; 14653f7de037SJosef Bacik __entry->bitmap = bitmap; 14663f7de037SJosef Bacik ), 14673f7de037SJosef Bacik 14685439c7f5SDavid Sterba TP_printk_btrfs("block_group=%llu flags=%llu(%s) window_start=%llu " 14695439c7f5SDavid Sterba "size=%llu max_size=%llu bitmap=%d", 14703f7de037SJosef Bacik __entry->bg_objectid, 14713f7de037SJosef Bacik __entry->flags, 14723f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 14733f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 14743f7de037SJosef Bacik __entry->size, __entry->max_size, __entry->bitmap) 14753f7de037SJosef Bacik ); 14763f7de037SJosef Bacik 1477143bede5SJeff Mahoney struct extent_state; 1478143bede5SJeff Mahoney TRACE_EVENT(alloc_extent_state, 1479143bede5SJeff Mahoney 14809a35b637SJeff Mahoney TP_PROTO(const struct extent_state *state, 14819a35b637SJeff Mahoney gfp_t mask, unsigned long IP), 1482143bede5SJeff Mahoney 1483143bede5SJeff Mahoney TP_ARGS(state, mask, IP), 1484143bede5SJeff Mahoney 1485143bede5SJeff Mahoney TP_STRUCT__entry( 14869a35b637SJeff Mahoney __field(const struct extent_state *, state) 1487fe573327SVasily Averin __field(unsigned long, mask) 148894c3f6c6SDavid Sterba __field(const void*, ip) 1489143bede5SJeff Mahoney ), 1490143bede5SJeff Mahoney 1491143bede5SJeff Mahoney TP_fast_assign( 1492143bede5SJeff Mahoney __entry->state = state, 1493fe573327SVasily Averin __entry->mask = (__force unsigned long)mask, 149494c3f6c6SDavid Sterba __entry->ip = (const void *)IP 1495143bede5SJeff Mahoney ), 1496143bede5SJeff Mahoney 1497562a7a07SDavid Sterba TP_printk("state=%p mask=%s caller=%pS", __entry->state, 149894c3f6c6SDavid Sterba show_gfp_flags(__entry->mask), __entry->ip) 1499143bede5SJeff Mahoney ); 1500143bede5SJeff Mahoney 1501143bede5SJeff Mahoney TRACE_EVENT(free_extent_state, 1502143bede5SJeff Mahoney 15039a35b637SJeff Mahoney TP_PROTO(const struct extent_state *state, unsigned long IP), 1504143bede5SJeff Mahoney 1505143bede5SJeff Mahoney TP_ARGS(state, IP), 1506143bede5SJeff Mahoney 1507143bede5SJeff Mahoney TP_STRUCT__entry( 15089a35b637SJeff Mahoney __field(const struct extent_state *, state) 150994c3f6c6SDavid Sterba __field(const void*, ip) 1510143bede5SJeff Mahoney ), 1511143bede5SJeff Mahoney 1512143bede5SJeff Mahoney TP_fast_assign( 1513143bede5SJeff Mahoney __entry->state = state, 151494c3f6c6SDavid Sterba __entry->ip = (const void *)IP 1515143bede5SJeff Mahoney ), 1516143bede5SJeff Mahoney 151794c3f6c6SDavid Sterba TP_printk("state=%p caller=%pS", __entry->state, __entry->ip) 1518143bede5SJeff Mahoney ); 1519143bede5SJeff Mahoney 152052483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work, 152152483bc2SQu Wenruo 15229a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 152352483bc2SQu Wenruo 152452483bc2SQu Wenruo TP_ARGS(work), 152552483bc2SQu Wenruo 1526bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15279a35b637SJeff Mahoney __field( const void *, work ) 15289a35b637SJeff Mahoney __field( const void *, wq ) 15299a35b637SJeff Mahoney __field( const void *, func ) 15309a35b637SJeff Mahoney __field( const void *, ordered_func ) 15319a35b637SJeff Mahoney __field( const void *, ordered_free ) 15329a35b637SJeff Mahoney __field( const void *, normal_work ) 153352483bc2SQu Wenruo ), 153452483bc2SQu Wenruo 1535bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_work_owner(work), 153652483bc2SQu Wenruo __entry->work = work; 153752483bc2SQu Wenruo __entry->wq = work->wq; 153852483bc2SQu Wenruo __entry->func = work->func; 153952483bc2SQu Wenruo __entry->ordered_func = work->ordered_func; 154052483bc2SQu Wenruo __entry->ordered_free = work->ordered_free; 1541b38a6258SLiu Bo __entry->normal_work = &work->normal_work; 154252483bc2SQu Wenruo ), 154352483bc2SQu Wenruo 1544d75f773cSSakari Ailus TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%ps ordered_func=%p " 1545b38a6258SLiu Bo "ordered_free=%p", 1546b38a6258SLiu Bo __entry->work, __entry->normal_work, __entry->wq, 1547b38a6258SLiu Bo __entry->func, __entry->ordered_func, __entry->ordered_free) 154852483bc2SQu Wenruo ); 154952483bc2SQu Wenruo 1550ac0c7cf8SDavid Sterba /* 1551c9eb55dbSOmar Sandoval * For situations when the work is freed, we pass fs_info and a tag that matches 1552c9eb55dbSOmar Sandoval * the address of the work structure so it can be paired with the scheduling 1553c9eb55dbSOmar Sandoval * event. DO NOT add anything here that dereferences wtag. 1554ac0c7cf8SDavid Sterba */ 155552483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work__done, 155652483bc2SQu Wenruo 15579a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), 155852483bc2SQu Wenruo 1559ac0c7cf8SDavid Sterba TP_ARGS(fs_info, wtag), 156052483bc2SQu Wenruo 1561bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15629a35b637SJeff Mahoney __field( const void *, wtag ) 156352483bc2SQu Wenruo ), 156452483bc2SQu Wenruo 1565ac0c7cf8SDavid Sterba TP_fast_assign_btrfs(fs_info, 1566ac0c7cf8SDavid Sterba __entry->wtag = wtag; 156752483bc2SQu Wenruo ), 156852483bc2SQu Wenruo 1569ac0c7cf8SDavid Sterba TP_printk_btrfs("work->%p", __entry->wtag) 157052483bc2SQu Wenruo ); 157152483bc2SQu Wenruo 157252483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_queued, 157352483bc2SQu Wenruo 15749a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 157552483bc2SQu Wenruo 157652483bc2SQu Wenruo TP_ARGS(work) 157752483bc2SQu Wenruo ); 157852483bc2SQu Wenruo 157952483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_sched, 158052483bc2SQu Wenruo 15819a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 158252483bc2SQu Wenruo 158352483bc2SQu Wenruo TP_ARGS(work) 158452483bc2SQu Wenruo ); 158552483bc2SQu Wenruo 158652483bc2SQu Wenruo DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, 158752483bc2SQu Wenruo 15889a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), 158952483bc2SQu Wenruo 1590ac0c7cf8SDavid Sterba TP_ARGS(fs_info, wtag) 159152483bc2SQu Wenruo ); 159252483bc2SQu Wenruo 159352483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_ordered_sched, 159452483bc2SQu Wenruo 15959a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 159652483bc2SQu Wenruo 159752483bc2SQu Wenruo TP_ARGS(work) 159852483bc2SQu Wenruo ); 159952483bc2SQu Wenruo 1600a31b4a43SChristoph Hellwig DECLARE_EVENT_CLASS(btrfs_workqueue, 1601c3a46891SQu Wenruo 1602a31b4a43SChristoph Hellwig TP_PROTO(const struct btrfs_workqueue *wq, const char *name), 1603c3a46891SQu Wenruo 1604a31b4a43SChristoph Hellwig TP_ARGS(wq, name), 1605c3a46891SQu Wenruo 1606bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 16079a35b637SJeff Mahoney __field( const void *, wq ) 1608c3a46891SQu Wenruo __string( name, name ) 1609c3a46891SQu Wenruo ), 1610c3a46891SQu Wenruo 1611bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1612c3a46891SQu Wenruo __entry->wq = wq; 1613c3a46891SQu Wenruo __assign_str(name, name); 1614c3a46891SQu Wenruo ), 1615c3a46891SQu Wenruo 1616a31b4a43SChristoph Hellwig TP_printk_btrfs("name=%s wq=%p", __get_str(name), 1617c3a46891SQu Wenruo __entry->wq) 1618c3a46891SQu Wenruo ); 1619c3a46891SQu Wenruo 1620a31b4a43SChristoph Hellwig DEFINE_EVENT(btrfs_workqueue, btrfs_workqueue_alloc, 1621c3a46891SQu Wenruo 1622a31b4a43SChristoph Hellwig TP_PROTO(const struct btrfs_workqueue *wq, const char *name), 1623c3a46891SQu Wenruo 1624a31b4a43SChristoph Hellwig TP_ARGS(wq, name) 1625c3a46891SQu Wenruo ); 1626c3a46891SQu Wenruo 1627a31b4a43SChristoph Hellwig DECLARE_EVENT_CLASS(btrfs_workqueue_done, 1628c3a46891SQu Wenruo 1629a31b4a43SChristoph Hellwig TP_PROTO(const struct btrfs_workqueue *wq), 1630c3a46891SQu Wenruo 1631c3a46891SQu Wenruo TP_ARGS(wq), 1632c3a46891SQu Wenruo 1633bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 16349a35b637SJeff Mahoney __field( const void *, wq ) 1635c3a46891SQu Wenruo ), 1636c3a46891SQu Wenruo 1637bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1638c3a46891SQu Wenruo __entry->wq = wq; 1639c3a46891SQu Wenruo ), 1640c3a46891SQu Wenruo 1641bc074524SJeff Mahoney TP_printk_btrfs("wq=%p", __entry->wq) 1642c3a46891SQu Wenruo ); 1643c3a46891SQu Wenruo 1644a31b4a43SChristoph Hellwig DEFINE_EVENT(btrfs_workqueue_done, btrfs_workqueue_destroy, 1645c3a46891SQu Wenruo 1646a31b4a43SChristoph Hellwig TP_PROTO(const struct btrfs_workqueue *wq), 1647c3a46891SQu Wenruo 1648c3a46891SQu Wenruo TP_ARGS(wq) 1649c3a46891SQu Wenruo ); 165052483bc2SQu Wenruo 165181fb6f77SQu Wenruo #define BTRFS_QGROUP_OPERATIONS \ 165281fb6f77SQu Wenruo { QGROUP_RESERVE, "reserve" }, \ 165381fb6f77SQu Wenruo { QGROUP_RELEASE, "release" }, \ 165481fb6f77SQu Wenruo { QGROUP_FREE, "free" } 165581fb6f77SQu Wenruo 165681fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, 165781fb6f77SQu Wenruo 16589a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 16599a35b637SJeff Mahoney u64 reserved, int op), 166081fb6f77SQu Wenruo 166181fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op), 166281fb6f77SQu Wenruo 1663bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 166481fb6f77SQu Wenruo __field( u64, rootid ) 1665f8f8e189SDavid Sterba __field( u64, ino ) 166681fb6f77SQu Wenruo __field( u64, start ) 166781fb6f77SQu Wenruo __field( u64, len ) 166881fb6f77SQu Wenruo __field( u64, reserved ) 166981fb6f77SQu Wenruo __field( int, op ) 167081fb6f77SQu Wenruo ), 167181fb6f77SQu Wenruo 1672bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 16734fd786e6SMisono Tomohiro __entry->rootid = 16744fd786e6SMisono Tomohiro BTRFS_I(inode)->root->root_key.objectid; 1675f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 167681fb6f77SQu Wenruo __entry->start = start; 167781fb6f77SQu Wenruo __entry->len = len; 167881fb6f77SQu Wenruo __entry->reserved = reserved; 167981fb6f77SQu Wenruo __entry->op = op; 168081fb6f77SQu Wenruo ), 168181fb6f77SQu Wenruo 1682f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu ino=%llu start=%llu len=%llu reserved=%llu op=%s", 168381fb6f77SQu Wenruo __entry->rootid, __entry->ino, __entry->start, __entry->len, 168481fb6f77SQu Wenruo __entry->reserved, 168581fb6f77SQu Wenruo __print_flags((unsigned long)__entry->op, "", 168681fb6f77SQu Wenruo BTRFS_QGROUP_OPERATIONS) 168781fb6f77SQu Wenruo ) 168881fb6f77SQu Wenruo ); 168981fb6f77SQu Wenruo 169081fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data, 169181fb6f77SQu Wenruo 16929a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 16939a35b637SJeff Mahoney u64 reserved, int op), 169481fb6f77SQu Wenruo 169581fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 169681fb6f77SQu Wenruo ); 169781fb6f77SQu Wenruo 169881fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data, 169981fb6f77SQu Wenruo 17009a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 17019a35b637SJeff Mahoney u64 reserved, int op), 170281fb6f77SQu Wenruo 170381fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 170481fb6f77SQu Wenruo ); 170581fb6f77SQu Wenruo 17060f5dcf8dSMark Fasheh DECLARE_EVENT_CLASS(btrfs_qgroup_extent, 17079a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 17089a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 17090f5dcf8dSMark Fasheh 1710bc074524SJeff Mahoney TP_ARGS(fs_info, rec), 17110f5dcf8dSMark Fasheh 1712bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 17130f5dcf8dSMark Fasheh __field( u64, bytenr ) 17140f5dcf8dSMark Fasheh __field( u64, num_bytes ) 17150f5dcf8dSMark Fasheh ), 17160f5dcf8dSMark Fasheh 1717bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 17180f5dcf8dSMark Fasheh __entry->bytenr = rec->bytenr, 17190f5dcf8dSMark Fasheh __entry->num_bytes = rec->num_bytes; 17200f5dcf8dSMark Fasheh ), 17210f5dcf8dSMark Fasheh 1722562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu", 172394c3f6c6SDavid Sterba __entry->bytenr, __entry->num_bytes) 17240f5dcf8dSMark Fasheh ); 17250f5dcf8dSMark Fasheh 17260f5dcf8dSMark Fasheh DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, 17270f5dcf8dSMark Fasheh 17289a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 17299a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 17300f5dcf8dSMark Fasheh 1731bc074524SJeff Mahoney TP_ARGS(fs_info, rec) 17320f5dcf8dSMark Fasheh ); 17330f5dcf8dSMark Fasheh 173450b3e040SQu Wenruo DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent, 17350f5dcf8dSMark Fasheh 17369a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 17379a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 17380f5dcf8dSMark Fasheh 1739bc074524SJeff Mahoney TP_ARGS(fs_info, rec) 17400f5dcf8dSMark Fasheh ); 17410f5dcf8dSMark Fasheh 1742c337e7b0SQu Wenruo TRACE_EVENT(qgroup_num_dirty_extents, 1743c337e7b0SQu Wenruo 1744c337e7b0SQu Wenruo TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, 1745c337e7b0SQu Wenruo u64 num_dirty_extents), 1746c337e7b0SQu Wenruo 1747c337e7b0SQu Wenruo TP_ARGS(fs_info, transid, num_dirty_extents), 1748c337e7b0SQu Wenruo 1749c337e7b0SQu Wenruo TP_STRUCT__entry_btrfs( 1750c337e7b0SQu Wenruo __field( u64, transid ) 1751c337e7b0SQu Wenruo __field( u64, num_dirty_extents ) 1752c337e7b0SQu Wenruo ), 1753c337e7b0SQu Wenruo 1754c337e7b0SQu Wenruo TP_fast_assign_btrfs(fs_info, 1755c337e7b0SQu Wenruo __entry->transid = transid; 1756c337e7b0SQu Wenruo __entry->num_dirty_extents = num_dirty_extents; 1757c337e7b0SQu Wenruo ), 1758c337e7b0SQu Wenruo 1759c337e7b0SQu Wenruo TP_printk_btrfs("transid=%llu num_dirty_extents=%llu", 1760c337e7b0SQu Wenruo __entry->transid, __entry->num_dirty_extents) 1761c337e7b0SQu Wenruo ); 1762c337e7b0SQu Wenruo 17630f5dcf8dSMark Fasheh TRACE_EVENT(btrfs_qgroup_account_extent, 17640f5dcf8dSMark Fasheh 1765c9f6f3cdSQu Wenruo TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, u64 bytenr, 1766bc074524SJeff Mahoney u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), 17670f5dcf8dSMark Fasheh 1768c9f6f3cdSQu Wenruo TP_ARGS(fs_info, transid, bytenr, num_bytes, nr_old_roots, 1769c9f6f3cdSQu Wenruo nr_new_roots), 17700f5dcf8dSMark Fasheh 1771bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1772c9f6f3cdSQu Wenruo __field( u64, transid ) 17730f5dcf8dSMark Fasheh __field( u64, bytenr ) 17740f5dcf8dSMark Fasheh __field( u64, num_bytes ) 17750f5dcf8dSMark Fasheh __field( u64, nr_old_roots ) 17760f5dcf8dSMark Fasheh __field( u64, nr_new_roots ) 17770f5dcf8dSMark Fasheh ), 17780f5dcf8dSMark Fasheh 1779bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 1780c9f6f3cdSQu Wenruo __entry->transid = transid; 17810f5dcf8dSMark Fasheh __entry->bytenr = bytenr; 17820f5dcf8dSMark Fasheh __entry->num_bytes = num_bytes; 17830f5dcf8dSMark Fasheh __entry->nr_old_roots = nr_old_roots; 17840f5dcf8dSMark Fasheh __entry->nr_new_roots = nr_new_roots; 17850f5dcf8dSMark Fasheh ), 17860f5dcf8dSMark Fasheh 1787c9f6f3cdSQu Wenruo TP_printk_btrfs( 1788c9f6f3cdSQu Wenruo "transid=%llu bytenr=%llu num_bytes=%llu nr_old_roots=%llu nr_new_roots=%llu", 1789c9f6f3cdSQu Wenruo __entry->transid, 17900f5dcf8dSMark Fasheh __entry->bytenr, 17910f5dcf8dSMark Fasheh __entry->num_bytes, 17920f5dcf8dSMark Fasheh __entry->nr_old_roots, 17930f5dcf8dSMark Fasheh __entry->nr_new_roots) 17940f5dcf8dSMark Fasheh ); 17950f5dcf8dSMark Fasheh 17960f5dcf8dSMark Fasheh TRACE_EVENT(qgroup_update_counters, 17970f5dcf8dSMark Fasheh 17988b317901SQu Wenruo TP_PROTO(const struct btrfs_fs_info *fs_info, 17991d2e7c7cSDavid Sterba const struct btrfs_qgroup *qgroup, 1800bc074524SJeff Mahoney u64 cur_old_count, u64 cur_new_count), 18010f5dcf8dSMark Fasheh 18028b317901SQu Wenruo TP_ARGS(fs_info, qgroup, cur_old_count, cur_new_count), 18030f5dcf8dSMark Fasheh 1804bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 18050f5dcf8dSMark Fasheh __field( u64, qgid ) 18068b317901SQu Wenruo __field( u64, old_rfer ) 18078b317901SQu Wenruo __field( u64, old_excl ) 18080f5dcf8dSMark Fasheh __field( u64, cur_old_count ) 18090f5dcf8dSMark Fasheh __field( u64, cur_new_count ) 18100f5dcf8dSMark Fasheh ), 18110f5dcf8dSMark Fasheh 1812bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 18138b317901SQu Wenruo __entry->qgid = qgroup->qgroupid; 18148b317901SQu Wenruo __entry->old_rfer = qgroup->rfer; 18158b317901SQu Wenruo __entry->old_excl = qgroup->excl; 18160f5dcf8dSMark Fasheh __entry->cur_old_count = cur_old_count; 18170f5dcf8dSMark Fasheh __entry->cur_new_count = cur_new_count; 18180f5dcf8dSMark Fasheh ), 18190f5dcf8dSMark Fasheh 18208b317901SQu Wenruo TP_printk_btrfs("qgid=%llu old_rfer=%llu old_excl=%llu cur_old_count=%llu cur_new_count=%llu", 18218b317901SQu Wenruo __entry->qgid, __entry->old_rfer, __entry->old_excl, 18228b317901SQu Wenruo __entry->cur_old_count, __entry->cur_new_count) 18230f5dcf8dSMark Fasheh ); 18240f5dcf8dSMark Fasheh 18253159fe7bSQu Wenruo TRACE_EVENT(qgroup_update_reserve, 18263159fe7bSQu Wenruo 18273159fe7bSQu Wenruo TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup, 182864ee4e75SQu Wenruo s64 diff, int type), 18293159fe7bSQu Wenruo 183064ee4e75SQu Wenruo TP_ARGS(fs_info, qgroup, diff, type), 18313159fe7bSQu Wenruo 18323159fe7bSQu Wenruo TP_STRUCT__entry_btrfs( 18333159fe7bSQu Wenruo __field( u64, qgid ) 18343159fe7bSQu Wenruo __field( u64, cur_reserved ) 18353159fe7bSQu Wenruo __field( s64, diff ) 183664ee4e75SQu Wenruo __field( int, type ) 18373159fe7bSQu Wenruo ), 18383159fe7bSQu Wenruo 18393159fe7bSQu Wenruo TP_fast_assign_btrfs(fs_info, 18403159fe7bSQu Wenruo __entry->qgid = qgroup->qgroupid; 184164ee4e75SQu Wenruo __entry->cur_reserved = qgroup->rsv.values[type]; 18423159fe7bSQu Wenruo __entry->diff = diff; 18431b2442b4SQu Wenruo __entry->type = type; 18443159fe7bSQu Wenruo ), 18453159fe7bSQu Wenruo 184664ee4e75SQu Wenruo TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld", 18471cb1f0b2SNikolay Borisov __entry->qgid, __print_symbolic(__entry->type, QGROUP_RSV_TYPES), 184864ee4e75SQu Wenruo __entry->cur_reserved, __entry->diff) 18493159fe7bSQu Wenruo ); 18503159fe7bSQu Wenruo 18513159fe7bSQu Wenruo TRACE_EVENT(qgroup_meta_reserve, 18523159fe7bSQu Wenruo 18534ee0d883SQu Wenruo TP_PROTO(struct btrfs_root *root, s64 diff, int type), 18543159fe7bSQu Wenruo 18554ee0d883SQu Wenruo TP_ARGS(root, diff, type), 18563159fe7bSQu Wenruo 18573159fe7bSQu Wenruo TP_STRUCT__entry_btrfs( 18583159fe7bSQu Wenruo __field( u64, refroot ) 18593159fe7bSQu Wenruo __field( s64, diff ) 18604ee0d883SQu Wenruo __field( int, type ) 18613159fe7bSQu Wenruo ), 18623159fe7bSQu Wenruo 18633159fe7bSQu Wenruo TP_fast_assign_btrfs(root->fs_info, 18644fd786e6SMisono Tomohiro __entry->refroot = root->root_key.objectid; 18653159fe7bSQu Wenruo __entry->diff = diff; 18661b2442b4SQu Wenruo __entry->type = type; 18673159fe7bSQu Wenruo ), 18683159fe7bSQu Wenruo 18694ee0d883SQu Wenruo TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", 18704ee0d883SQu Wenruo show_root_type(__entry->refroot), 18711cb1f0b2SNikolay Borisov __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) 18724ee0d883SQu Wenruo ); 18734ee0d883SQu Wenruo 18744ee0d883SQu Wenruo TRACE_EVENT(qgroup_meta_convert, 18754ee0d883SQu Wenruo 18764ee0d883SQu Wenruo TP_PROTO(struct btrfs_root *root, s64 diff), 18774ee0d883SQu Wenruo 18784ee0d883SQu Wenruo TP_ARGS(root, diff), 18794ee0d883SQu Wenruo 18804ee0d883SQu Wenruo TP_STRUCT__entry_btrfs( 18814ee0d883SQu Wenruo __field( u64, refroot ) 18824ee0d883SQu Wenruo __field( s64, diff ) 18834ee0d883SQu Wenruo ), 18844ee0d883SQu Wenruo 18854ee0d883SQu Wenruo TP_fast_assign_btrfs(root->fs_info, 18864fd786e6SMisono Tomohiro __entry->refroot = root->root_key.objectid; 18874ee0d883SQu Wenruo __entry->diff = diff; 18884ee0d883SQu Wenruo ), 18894ee0d883SQu Wenruo 18904ee0d883SQu Wenruo TP_printk_btrfs("refroot=%llu(%s) type=%s->%s diff=%lld", 18914ee0d883SQu Wenruo show_root_type(__entry->refroot), 18921cb1f0b2SNikolay Borisov __print_symbolic(BTRFS_QGROUP_RSV_META_PREALLOC, QGROUP_RSV_TYPES), 18931cb1f0b2SNikolay Borisov __print_symbolic(BTRFS_QGROUP_RSV_META_PERTRANS, QGROUP_RSV_TYPES), 18944ee0d883SQu Wenruo __entry->diff) 18954ee0d883SQu Wenruo ); 18964ee0d883SQu Wenruo 18974ee0d883SQu Wenruo TRACE_EVENT(qgroup_meta_free_all_pertrans, 18984ee0d883SQu Wenruo 18994ee0d883SQu Wenruo TP_PROTO(struct btrfs_root *root), 19004ee0d883SQu Wenruo 19014ee0d883SQu Wenruo TP_ARGS(root), 19024ee0d883SQu Wenruo 19034ee0d883SQu Wenruo TP_STRUCT__entry_btrfs( 19044ee0d883SQu Wenruo __field( u64, refroot ) 19054ee0d883SQu Wenruo __field( s64, diff ) 19064ee0d883SQu Wenruo __field( int, type ) 19074ee0d883SQu Wenruo ), 19084ee0d883SQu Wenruo 19094ee0d883SQu Wenruo TP_fast_assign_btrfs(root->fs_info, 19104fd786e6SMisono Tomohiro __entry->refroot = root->root_key.objectid; 19114ee0d883SQu Wenruo spin_lock(&root->qgroup_meta_rsv_lock); 19124ee0d883SQu Wenruo __entry->diff = -(s64)root->qgroup_meta_rsv_pertrans; 19134ee0d883SQu Wenruo spin_unlock(&root->qgroup_meta_rsv_lock); 19144ee0d883SQu Wenruo __entry->type = BTRFS_QGROUP_RSV_META_PERTRANS; 19154ee0d883SQu Wenruo ), 19164ee0d883SQu Wenruo 19174ee0d883SQu Wenruo TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", 19184ee0d883SQu Wenruo show_root_type(__entry->refroot), 19191cb1f0b2SNikolay Borisov __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) 19203159fe7bSQu Wenruo ); 19213159fe7bSQu Wenruo 192200142756SJeff Mahoney DECLARE_EVENT_CLASS(btrfs__prelim_ref, 192300142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 192400142756SJeff Mahoney const struct prelim_ref *oldref, 192500142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 192600142756SJeff Mahoney TP_ARGS(fs_info, newref, oldref, tree_size), 192700142756SJeff Mahoney 192800142756SJeff Mahoney TP_STRUCT__entry_btrfs( 192900142756SJeff Mahoney __field( u64, root_id ) 193000142756SJeff Mahoney __field( u64, objectid ) 193100142756SJeff Mahoney __field( u8, type ) 193200142756SJeff Mahoney __field( u64, offset ) 193300142756SJeff Mahoney __field( int, level ) 193400142756SJeff Mahoney __field( int, old_count ) 193500142756SJeff Mahoney __field( u64, parent ) 193600142756SJeff Mahoney __field( u64, bytenr ) 193700142756SJeff Mahoney __field( int, mod_count ) 193800142756SJeff Mahoney __field( u64, tree_size ) 193900142756SJeff Mahoney ), 194000142756SJeff Mahoney 194100142756SJeff Mahoney TP_fast_assign_btrfs(fs_info, 194200142756SJeff Mahoney __entry->root_id = oldref->root_id; 194300142756SJeff Mahoney __entry->objectid = oldref->key_for_search.objectid; 194400142756SJeff Mahoney __entry->type = oldref->key_for_search.type; 194500142756SJeff Mahoney __entry->offset = oldref->key_for_search.offset; 194600142756SJeff Mahoney __entry->level = oldref->level; 194700142756SJeff Mahoney __entry->old_count = oldref->count; 194800142756SJeff Mahoney __entry->parent = oldref->parent; 194900142756SJeff Mahoney __entry->bytenr = oldref->wanted_disk_byte; 195000142756SJeff Mahoney __entry->mod_count = newref ? newref->count : 0; 195100142756SJeff Mahoney __entry->tree_size = tree_size; 195200142756SJeff Mahoney ), 195300142756SJeff Mahoney 195400142756SJeff Mahoney TP_printk_btrfs("root_id=%llu key=[%llu,%u,%llu] level=%d count=[%d+%d=%d] parent=%llu wanted_disk_byte=%llu nodes=%llu", 19558eec8463SDavid Sterba __entry->root_id, 19568eec8463SDavid Sterba __entry->objectid, __entry->type, 19578eec8463SDavid Sterba __entry->offset, __entry->level, 195800142756SJeff Mahoney __entry->old_count, __entry->mod_count, 195900142756SJeff Mahoney __entry->old_count + __entry->mod_count, 19608eec8463SDavid Sterba __entry->parent, 19618eec8463SDavid Sterba __entry->bytenr, 19628eec8463SDavid Sterba __entry->tree_size) 196300142756SJeff Mahoney ); 196400142756SJeff Mahoney 196500142756SJeff Mahoney DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge, 196600142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 196700142756SJeff Mahoney const struct prelim_ref *oldref, 196800142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 196900142756SJeff Mahoney TP_ARGS(fs_info, oldref, newref, tree_size) 197000142756SJeff Mahoney ); 197100142756SJeff Mahoney 197200142756SJeff Mahoney DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert, 197300142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 197400142756SJeff Mahoney const struct prelim_ref *oldref, 197500142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 197600142756SJeff Mahoney TP_ARGS(fs_info, oldref, newref, tree_size) 197700142756SJeff Mahoney ); 197800142756SJeff Mahoney 1979dd48d407SJosef Bacik TRACE_EVENT(btrfs_inode_mod_outstanding_extents, 19801d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_root *root, u64 ino, int mod), 1981dd48d407SJosef Bacik 1982dd48d407SJosef Bacik TP_ARGS(root, ino, mod), 1983dd48d407SJosef Bacik 1984dd48d407SJosef Bacik TP_STRUCT__entry_btrfs( 1985dd48d407SJosef Bacik __field( u64, root_objectid ) 1986dd48d407SJosef Bacik __field( u64, ino ) 1987dd48d407SJosef Bacik __field( int, mod ) 1988dd48d407SJosef Bacik ), 1989dd48d407SJosef Bacik 1990dd48d407SJosef Bacik TP_fast_assign_btrfs(root->fs_info, 19914fd786e6SMisono Tomohiro __entry->root_objectid = root->root_key.objectid; 1992dd48d407SJosef Bacik __entry->ino = ino; 1993dd48d407SJosef Bacik __entry->mod = mod; 1994dd48d407SJosef Bacik ), 1995dd48d407SJosef Bacik 1996dd48d407SJosef Bacik TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d", 1997dd48d407SJosef Bacik show_root_type(__entry->root_objectid), 19988eec8463SDavid Sterba __entry->ino, __entry->mod) 1999dd48d407SJosef Bacik ); 20003dca5c94SQu Wenruo 20014ed0a7a3SQu Wenruo DECLARE_EVENT_CLASS(btrfs__block_group, 200232da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 20034ed0a7a3SQu Wenruo 20044ed0a7a3SQu Wenruo TP_ARGS(bg_cache), 20054ed0a7a3SQu Wenruo 20064ed0a7a3SQu Wenruo TP_STRUCT__entry_btrfs( 20074ed0a7a3SQu Wenruo __field( u64, bytenr ) 20084ed0a7a3SQu Wenruo __field( u64, len ) 20094ed0a7a3SQu Wenruo __field( u64, used ) 20104ed0a7a3SQu Wenruo __field( u64, flags ) 20114ed0a7a3SQu Wenruo ), 20124ed0a7a3SQu Wenruo 20134ed0a7a3SQu Wenruo TP_fast_assign_btrfs(bg_cache->fs_info, 2014b3470b5dSDavid Sterba __entry->bytenr = bg_cache->start, 2015b3470b5dSDavid Sterba __entry->len = bg_cache->length, 2016bf38be65SDavid Sterba __entry->used = bg_cache->used; 20174ed0a7a3SQu Wenruo __entry->flags = bg_cache->flags; 20184ed0a7a3SQu Wenruo ), 20194ed0a7a3SQu Wenruo 20204ed0a7a3SQu Wenruo TP_printk_btrfs("bg bytenr=%llu len=%llu used=%llu flags=%llu(%s)", 20214ed0a7a3SQu Wenruo __entry->bytenr, __entry->len, __entry->used, __entry->flags, 20224ed0a7a3SQu Wenruo __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS)) 20234ed0a7a3SQu Wenruo ); 20244ed0a7a3SQu Wenruo 20254ed0a7a3SQu Wenruo DEFINE_EVENT(btrfs__block_group, btrfs_remove_block_group, 202632da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 20274ed0a7a3SQu Wenruo 20284ed0a7a3SQu Wenruo TP_ARGS(bg_cache) 20294ed0a7a3SQu Wenruo ); 20304ed0a7a3SQu Wenruo 20314ed0a7a3SQu Wenruo DEFINE_EVENT(btrfs__block_group, btrfs_add_unused_block_group, 203232da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 20334ed0a7a3SQu Wenruo 20344ed0a7a3SQu Wenruo TP_ARGS(bg_cache) 20354ed0a7a3SQu Wenruo ); 20364ed0a7a3SQu Wenruo 203718bb8bbfSJohannes Thumshirn DEFINE_EVENT(btrfs__block_group, btrfs_add_reclaim_block_group, 203818bb8bbfSJohannes Thumshirn TP_PROTO(const struct btrfs_block_group *bg_cache), 203918bb8bbfSJohannes Thumshirn 204018bb8bbfSJohannes Thumshirn TP_ARGS(bg_cache) 204118bb8bbfSJohannes Thumshirn ); 204218bb8bbfSJohannes Thumshirn 204318bb8bbfSJohannes Thumshirn DEFINE_EVENT(btrfs__block_group, btrfs_reclaim_block_group, 204418bb8bbfSJohannes Thumshirn TP_PROTO(const struct btrfs_block_group *bg_cache), 204518bb8bbfSJohannes Thumshirn 204618bb8bbfSJohannes Thumshirn TP_ARGS(bg_cache) 204718bb8bbfSJohannes Thumshirn ); 204818bb8bbfSJohannes Thumshirn 20494ed0a7a3SQu Wenruo DEFINE_EVENT(btrfs__block_group, btrfs_skip_unused_block_group, 205032da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 20514ed0a7a3SQu Wenruo 20524ed0a7a3SQu Wenruo TP_ARGS(bg_cache) 20534ed0a7a3SQu Wenruo ); 20544ed0a7a3SQu Wenruo 2055a1d19847SQu Wenruo TRACE_EVENT(btrfs_set_extent_bit, 2056a1d19847SQu Wenruo TP_PROTO(const struct extent_io_tree *tree, 2057a1d19847SQu Wenruo u64 start, u64 len, unsigned set_bits), 2058a1d19847SQu Wenruo 2059a1d19847SQu Wenruo TP_ARGS(tree, start, len, set_bits), 2060a1d19847SQu Wenruo 2061a1d19847SQu Wenruo TP_STRUCT__entry_btrfs( 2062a1d19847SQu Wenruo __field( unsigned, owner ) 2063a1d19847SQu Wenruo __field( u64, ino ) 2064a1d19847SQu Wenruo __field( u64, rootid ) 2065a1d19847SQu Wenruo __field( u64, start ) 2066a1d19847SQu Wenruo __field( u64, len ) 2067a1d19847SQu Wenruo __field( unsigned, set_bits) 2068a1d19847SQu Wenruo ), 2069a1d19847SQu Wenruo 2070a1d19847SQu Wenruo TP_fast_assign_btrfs(tree->fs_info, 2071a1d19847SQu Wenruo __entry->owner = tree->owner; 20720988fc7bSDavid Sterba if (tree->inode) { 20730988fc7bSDavid Sterba const struct btrfs_inode *inode = tree->inode; 2074a1d19847SQu Wenruo 20750988fc7bSDavid Sterba __entry->ino = btrfs_ino(inode); 20760988fc7bSDavid Sterba __entry->rootid = inode->root->root_key.objectid; 2077a1d19847SQu Wenruo } else { 2078a1d19847SQu Wenruo __entry->ino = 0; 2079a1d19847SQu Wenruo __entry->rootid = 0; 2080a1d19847SQu Wenruo } 2081a1d19847SQu Wenruo __entry->start = start; 2082a1d19847SQu Wenruo __entry->len = len; 2083a1d19847SQu Wenruo __entry->set_bits = set_bits; 2084a1d19847SQu Wenruo ), 2085a1d19847SQu Wenruo 2086a1d19847SQu Wenruo TP_printk_btrfs( 2087a1d19847SQu Wenruo "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s", 2088c92bb304SNikolay Borisov __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, 2089a1d19847SQu Wenruo __entry->rootid, __entry->start, __entry->len, 2090a1d19847SQu Wenruo __print_flags(__entry->set_bits, "|", EXTENT_FLAGS)) 2091a1d19847SQu Wenruo ); 2092a1d19847SQu Wenruo 2093a1d19847SQu Wenruo TRACE_EVENT(btrfs_clear_extent_bit, 2094a1d19847SQu Wenruo TP_PROTO(const struct extent_io_tree *tree, 2095a1d19847SQu Wenruo u64 start, u64 len, unsigned clear_bits), 2096a1d19847SQu Wenruo 2097a1d19847SQu Wenruo TP_ARGS(tree, start, len, clear_bits), 2098a1d19847SQu Wenruo 2099a1d19847SQu Wenruo TP_STRUCT__entry_btrfs( 2100a1d19847SQu Wenruo __field( unsigned, owner ) 2101a1d19847SQu Wenruo __field( u64, ino ) 2102a1d19847SQu Wenruo __field( u64, rootid ) 2103a1d19847SQu Wenruo __field( u64, start ) 2104a1d19847SQu Wenruo __field( u64, len ) 2105a1d19847SQu Wenruo __field( unsigned, clear_bits) 2106a1d19847SQu Wenruo ), 2107a1d19847SQu Wenruo 2108a1d19847SQu Wenruo TP_fast_assign_btrfs(tree->fs_info, 2109a1d19847SQu Wenruo __entry->owner = tree->owner; 21100988fc7bSDavid Sterba if (tree->inode) { 21110988fc7bSDavid Sterba const struct btrfs_inode *inode = tree->inode; 2112a1d19847SQu Wenruo 21130988fc7bSDavid Sterba __entry->ino = btrfs_ino(inode); 21140988fc7bSDavid Sterba __entry->rootid = inode->root->root_key.objectid; 2115a1d19847SQu Wenruo } else { 2116a1d19847SQu Wenruo __entry->ino = 0; 2117a1d19847SQu Wenruo __entry->rootid = 0; 2118a1d19847SQu Wenruo } 2119a1d19847SQu Wenruo __entry->start = start; 2120a1d19847SQu Wenruo __entry->len = len; 2121a1d19847SQu Wenruo __entry->clear_bits = clear_bits; 2122a1d19847SQu Wenruo ), 2123a1d19847SQu Wenruo 2124a1d19847SQu Wenruo TP_printk_btrfs( 2125a1d19847SQu Wenruo "io_tree=%s ino=%llu root=%llu start=%llu len=%llu clear_bits=%s", 2126c92bb304SNikolay Borisov __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, 2127a1d19847SQu Wenruo __entry->rootid, __entry->start, __entry->len, 2128a1d19847SQu Wenruo __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS)) 2129a1d19847SQu Wenruo ); 2130a1d19847SQu Wenruo 2131a1d19847SQu Wenruo TRACE_EVENT(btrfs_convert_extent_bit, 2132a1d19847SQu Wenruo TP_PROTO(const struct extent_io_tree *tree, 2133a1d19847SQu Wenruo u64 start, u64 len, unsigned set_bits, unsigned clear_bits), 2134a1d19847SQu Wenruo 2135a1d19847SQu Wenruo TP_ARGS(tree, start, len, set_bits, clear_bits), 2136a1d19847SQu Wenruo 2137a1d19847SQu Wenruo TP_STRUCT__entry_btrfs( 2138a1d19847SQu Wenruo __field( unsigned, owner ) 2139a1d19847SQu Wenruo __field( u64, ino ) 2140a1d19847SQu Wenruo __field( u64, rootid ) 2141a1d19847SQu Wenruo __field( u64, start ) 2142a1d19847SQu Wenruo __field( u64, len ) 2143a1d19847SQu Wenruo __field( unsigned, set_bits) 2144a1d19847SQu Wenruo __field( unsigned, clear_bits) 2145a1d19847SQu Wenruo ), 2146a1d19847SQu Wenruo 2147a1d19847SQu Wenruo TP_fast_assign_btrfs(tree->fs_info, 2148a1d19847SQu Wenruo __entry->owner = tree->owner; 21490988fc7bSDavid Sterba if (tree->inode) { 21500988fc7bSDavid Sterba const struct btrfs_inode *inode = tree->inode; 2151a1d19847SQu Wenruo 21520988fc7bSDavid Sterba __entry->ino = btrfs_ino(inode); 21530988fc7bSDavid Sterba __entry->rootid = inode->root->root_key.objectid; 2154a1d19847SQu Wenruo } else { 2155a1d19847SQu Wenruo __entry->ino = 0; 2156a1d19847SQu Wenruo __entry->rootid = 0; 2157a1d19847SQu Wenruo } 2158a1d19847SQu Wenruo __entry->start = start; 2159a1d19847SQu Wenruo __entry->len = len; 2160a1d19847SQu Wenruo __entry->set_bits = set_bits; 2161a1d19847SQu Wenruo __entry->clear_bits = clear_bits; 2162a1d19847SQu Wenruo ), 2163a1d19847SQu Wenruo 2164a1d19847SQu Wenruo TP_printk_btrfs( 2165a1d19847SQu Wenruo "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s clear_bits=%s", 2166c92bb304SNikolay Borisov __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, 2167a1d19847SQu Wenruo __entry->rootid, __entry->start, __entry->len, 2168a1d19847SQu Wenruo __print_flags(__entry->set_bits , "|", EXTENT_FLAGS), 2169a1d19847SQu Wenruo __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS)) 2170a1d19847SQu Wenruo ); 2171a1d19847SQu Wenruo 2172e5ad49e2SJosef Bacik DECLARE_EVENT_CLASS(btrfs_dump_space_info, 21738197766dSJosef Bacik TP_PROTO(struct btrfs_fs_info *fs_info, 2174e5ad49e2SJosef Bacik const struct btrfs_space_info *sinfo), 2175e5ad49e2SJosef Bacik 2176e5ad49e2SJosef Bacik TP_ARGS(fs_info, sinfo), 2177e5ad49e2SJosef Bacik 2178e5ad49e2SJosef Bacik TP_STRUCT__entry_btrfs( 2179e5ad49e2SJosef Bacik __field( u64, flags ) 2180e5ad49e2SJosef Bacik __field( u64, total_bytes ) 2181e5ad49e2SJosef Bacik __field( u64, bytes_used ) 2182e5ad49e2SJosef Bacik __field( u64, bytes_pinned ) 2183e5ad49e2SJosef Bacik __field( u64, bytes_reserved ) 2184e5ad49e2SJosef Bacik __field( u64, bytes_may_use ) 2185e5ad49e2SJosef Bacik __field( u64, bytes_readonly ) 2186e5ad49e2SJosef Bacik __field( u64, reclaim_size ) 2187e5ad49e2SJosef Bacik __field( int, clamp ) 2188e5ad49e2SJosef Bacik __field( u64, global_reserved ) 2189e5ad49e2SJosef Bacik __field( u64, trans_reserved ) 2190e5ad49e2SJosef Bacik __field( u64, delayed_refs_reserved ) 2191e5ad49e2SJosef Bacik __field( u64, delayed_reserved ) 2192e5ad49e2SJosef Bacik __field( u64, free_chunk_space ) 21938197766dSJosef Bacik __field( u64, delalloc_bytes ) 21948197766dSJosef Bacik __field( u64, ordered_bytes ) 2195e5ad49e2SJosef Bacik ), 2196e5ad49e2SJosef Bacik 2197e5ad49e2SJosef Bacik TP_fast_assign_btrfs(fs_info, 2198e5ad49e2SJosef Bacik __entry->flags = sinfo->flags; 2199e5ad49e2SJosef Bacik __entry->total_bytes = sinfo->total_bytes; 2200e5ad49e2SJosef Bacik __entry->bytes_used = sinfo->bytes_used; 2201e5ad49e2SJosef Bacik __entry->bytes_pinned = sinfo->bytes_pinned; 2202e5ad49e2SJosef Bacik __entry->bytes_reserved = sinfo->bytes_reserved; 2203e5ad49e2SJosef Bacik __entry->bytes_may_use = sinfo->bytes_may_use; 2204e5ad49e2SJosef Bacik __entry->bytes_readonly = sinfo->bytes_readonly; 2205e5ad49e2SJosef Bacik __entry->reclaim_size = sinfo->reclaim_size; 2206e5ad49e2SJosef Bacik __entry->clamp = sinfo->clamp; 2207e5ad49e2SJosef Bacik __entry->global_reserved = fs_info->global_block_rsv.reserved; 2208e5ad49e2SJosef Bacik __entry->trans_reserved = fs_info->trans_block_rsv.reserved; 2209e5ad49e2SJosef Bacik __entry->delayed_refs_reserved = fs_info->delayed_refs_rsv.reserved; 2210e5ad49e2SJosef Bacik __entry->delayed_reserved = fs_info->delayed_block_rsv.reserved; 2211e5ad49e2SJosef Bacik __entry->free_chunk_space = atomic64_read(&fs_info->free_chunk_space); 22128197766dSJosef Bacik __entry->delalloc_bytes = percpu_counter_sum_positive(&fs_info->delalloc_bytes); 22138197766dSJosef Bacik __entry->ordered_bytes = percpu_counter_sum_positive(&fs_info->ordered_bytes); 2214e5ad49e2SJosef Bacik ), 2215e5ad49e2SJosef Bacik 2216e5ad49e2SJosef Bacik TP_printk_btrfs("flags=%s total_bytes=%llu bytes_used=%llu " 2217e5ad49e2SJosef Bacik "bytes_pinned=%llu bytes_reserved=%llu " 2218e5ad49e2SJosef Bacik "bytes_may_use=%llu bytes_readonly=%llu " 2219e5ad49e2SJosef Bacik "reclaim_size=%llu clamp=%d global_reserved=%llu " 2220e5ad49e2SJosef Bacik "trans_reserved=%llu delayed_refs_reserved=%llu " 22218197766dSJosef Bacik "delayed_reserved=%llu chunk_free_space=%llu " 22228197766dSJosef Bacik "delalloc_bytes=%llu ordered_bytes=%llu", 2223e5ad49e2SJosef Bacik __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS), 2224e5ad49e2SJosef Bacik __entry->total_bytes, __entry->bytes_used, 2225e5ad49e2SJosef Bacik __entry->bytes_pinned, __entry->bytes_reserved, 2226e5ad49e2SJosef Bacik __entry->bytes_may_use, __entry->bytes_readonly, 2227e5ad49e2SJosef Bacik __entry->reclaim_size, __entry->clamp, 2228e5ad49e2SJosef Bacik __entry->global_reserved, __entry->trans_reserved, 2229e5ad49e2SJosef Bacik __entry->delayed_refs_reserved, 22308197766dSJosef Bacik __entry->delayed_reserved, __entry->free_chunk_space, 22318197766dSJosef Bacik __entry->delalloc_bytes, __entry->ordered_bytes) 2232e5ad49e2SJosef Bacik ); 2233e5ad49e2SJosef Bacik 2234e5ad49e2SJosef Bacik DEFINE_EVENT(btrfs_dump_space_info, btrfs_done_preemptive_reclaim, 22358197766dSJosef Bacik TP_PROTO(struct btrfs_fs_info *fs_info, 2236e5ad49e2SJosef Bacik const struct btrfs_space_info *sinfo), 2237e5ad49e2SJosef Bacik TP_ARGS(fs_info, sinfo) 2238e5ad49e2SJosef Bacik ); 2239e5ad49e2SJosef Bacik 2240fcdef39cSJosef Bacik DEFINE_EVENT(btrfs_dump_space_info, btrfs_fail_all_tickets, 2241fcdef39cSJosef Bacik TP_PROTO(struct btrfs_fs_info *fs_info, 2242fcdef39cSJosef Bacik const struct btrfs_space_info *sinfo), 2243fcdef39cSJosef Bacik TP_ARGS(fs_info, sinfo) 2244fcdef39cSJosef Bacik ); 2245fcdef39cSJosef Bacik 2246ac1ea10eSJosef Bacik TRACE_EVENT(btrfs_reserve_ticket, 2247ac1ea10eSJosef Bacik TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, 2248ac1ea10eSJosef Bacik u64 start_ns, int flush, int error), 2249ac1ea10eSJosef Bacik 2250ac1ea10eSJosef Bacik TP_ARGS(fs_info, flags, bytes, start_ns, flush, error), 2251ac1ea10eSJosef Bacik 2252ac1ea10eSJosef Bacik TP_STRUCT__entry_btrfs( 2253ac1ea10eSJosef Bacik __field( u64, flags ) 2254ac1ea10eSJosef Bacik __field( u64, bytes ) 2255ac1ea10eSJosef Bacik __field( u64, start_ns ) 2256ac1ea10eSJosef Bacik __field( int, flush ) 2257ac1ea10eSJosef Bacik __field( int, error ) 2258ac1ea10eSJosef Bacik ), 2259ac1ea10eSJosef Bacik 2260ac1ea10eSJosef Bacik TP_fast_assign_btrfs(fs_info, 2261ac1ea10eSJosef Bacik __entry->flags = flags; 2262ac1ea10eSJosef Bacik __entry->bytes = bytes; 2263ac1ea10eSJosef Bacik __entry->start_ns = start_ns; 2264ac1ea10eSJosef Bacik __entry->flush = flush; 2265ac1ea10eSJosef Bacik __entry->error = error; 2266ac1ea10eSJosef Bacik ), 2267ac1ea10eSJosef Bacik 2268ac1ea10eSJosef Bacik TP_printk_btrfs("flags=%s bytes=%llu start_ns=%llu flush=%s error=%d", 2269ac1ea10eSJosef Bacik __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS), 2270ac1ea10eSJosef Bacik __entry->bytes, __entry->start_ns, 2271ac1ea10eSJosef Bacik __print_symbolic(__entry->flush, FLUSH_ACTIONS), 2272ac1ea10eSJosef Bacik __entry->error) 2273ac1ea10eSJosef Bacik ); 2274ac1ea10eSJosef Bacik 227534e73cc9SQu Wenruo DECLARE_EVENT_CLASS(btrfs_sleep_tree_lock, 227634e73cc9SQu Wenruo TP_PROTO(const struct extent_buffer *eb, u64 start_ns), 227734e73cc9SQu Wenruo 227834e73cc9SQu Wenruo TP_ARGS(eb, start_ns), 227934e73cc9SQu Wenruo 228034e73cc9SQu Wenruo TP_STRUCT__entry_btrfs( 228134e73cc9SQu Wenruo __field( u64, block ) 228234e73cc9SQu Wenruo __field( u64, generation ) 228334e73cc9SQu Wenruo __field( u64, start_ns ) 228434e73cc9SQu Wenruo __field( u64, end_ns ) 228534e73cc9SQu Wenruo __field( u64, diff_ns ) 228634e73cc9SQu Wenruo __field( u64, owner ) 228734e73cc9SQu Wenruo __field( int, is_log_tree ) 228834e73cc9SQu Wenruo ), 228934e73cc9SQu Wenruo 229034e73cc9SQu Wenruo TP_fast_assign_btrfs(eb->fs_info, 229134e73cc9SQu Wenruo __entry->block = eb->start; 229234e73cc9SQu Wenruo __entry->generation = btrfs_header_generation(eb); 229334e73cc9SQu Wenruo __entry->start_ns = start_ns; 229434e73cc9SQu Wenruo __entry->end_ns = ktime_get_ns(); 229534e73cc9SQu Wenruo __entry->diff_ns = __entry->end_ns - start_ns; 229634e73cc9SQu Wenruo __entry->owner = btrfs_header_owner(eb); 229734e73cc9SQu Wenruo __entry->is_log_tree = (eb->log_index >= 0); 229834e73cc9SQu Wenruo ), 229934e73cc9SQu Wenruo 230034e73cc9SQu Wenruo TP_printk_btrfs( 230134e73cc9SQu Wenruo "block=%llu generation=%llu start_ns=%llu end_ns=%llu diff_ns=%llu owner=%llu is_log_tree=%d", 230234e73cc9SQu Wenruo __entry->block, __entry->generation, 230334e73cc9SQu Wenruo __entry->start_ns, __entry->end_ns, __entry->diff_ns, 230434e73cc9SQu Wenruo __entry->owner, __entry->is_log_tree) 230534e73cc9SQu Wenruo ); 230634e73cc9SQu Wenruo 230734e73cc9SQu Wenruo DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_read_lock, 230834e73cc9SQu Wenruo TP_PROTO(const struct extent_buffer *eb, u64 start_ns), 230934e73cc9SQu Wenruo 231034e73cc9SQu Wenruo TP_ARGS(eb, start_ns) 231134e73cc9SQu Wenruo ); 231234e73cc9SQu Wenruo 231334e73cc9SQu Wenruo DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_lock, 231434e73cc9SQu Wenruo TP_PROTO(const struct extent_buffer *eb, u64 start_ns), 231534e73cc9SQu Wenruo 231634e73cc9SQu Wenruo TP_ARGS(eb, start_ns) 231734e73cc9SQu Wenruo ); 231834e73cc9SQu Wenruo 231931aab402SQu Wenruo DECLARE_EVENT_CLASS(btrfs_locking_events, 232031aab402SQu Wenruo TP_PROTO(const struct extent_buffer *eb), 232131aab402SQu Wenruo 232231aab402SQu Wenruo TP_ARGS(eb), 232331aab402SQu Wenruo 232431aab402SQu Wenruo TP_STRUCT__entry_btrfs( 232531aab402SQu Wenruo __field( u64, block ) 232631aab402SQu Wenruo __field( u64, generation ) 232731aab402SQu Wenruo __field( u64, owner ) 232831aab402SQu Wenruo __field( int, is_log_tree ) 232931aab402SQu Wenruo ), 233031aab402SQu Wenruo 233131aab402SQu Wenruo TP_fast_assign_btrfs(eb->fs_info, 233231aab402SQu Wenruo __entry->block = eb->start; 233331aab402SQu Wenruo __entry->generation = btrfs_header_generation(eb); 233431aab402SQu Wenruo __entry->owner = btrfs_header_owner(eb); 233531aab402SQu Wenruo __entry->is_log_tree = (eb->log_index >= 0); 233631aab402SQu Wenruo ), 233731aab402SQu Wenruo 233831aab402SQu Wenruo TP_printk_btrfs("block=%llu generation=%llu owner=%llu is_log_tree=%d", 233931aab402SQu Wenruo __entry->block, __entry->generation, 234031aab402SQu Wenruo __entry->owner, __entry->is_log_tree) 234131aab402SQu Wenruo ); 234231aab402SQu Wenruo 234331aab402SQu Wenruo #define DEFINE_BTRFS_LOCK_EVENT(name) \ 234431aab402SQu Wenruo DEFINE_EVENT(btrfs_locking_events, name, \ 234531aab402SQu Wenruo TP_PROTO(const struct extent_buffer *eb), \ 234631aab402SQu Wenruo \ 234731aab402SQu Wenruo TP_ARGS(eb) \ 234831aab402SQu Wenruo ) 234931aab402SQu Wenruo 235031aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_unlock); 235131aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock); 235231aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock_blocking); 235331aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_read); 235431aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_write); 235531aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock); 235631aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock); 235731aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic); 235831aab402SQu Wenruo 2359480b9b4dSQu Wenruo DECLARE_EVENT_CLASS(btrfs__space_info_update, 2360480b9b4dSQu Wenruo 23611d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 23621d2e7c7cSDavid Sterba const struct btrfs_space_info *sinfo, u64 old, s64 diff), 2363480b9b4dSQu Wenruo 2364480b9b4dSQu Wenruo TP_ARGS(fs_info, sinfo, old, diff), 2365480b9b4dSQu Wenruo 2366480b9b4dSQu Wenruo TP_STRUCT__entry_btrfs( 2367480b9b4dSQu Wenruo __field( u64, type ) 2368480b9b4dSQu Wenruo __field( u64, old ) 2369480b9b4dSQu Wenruo __field( s64, diff ) 2370480b9b4dSQu Wenruo ), 2371480b9b4dSQu Wenruo 2372480b9b4dSQu Wenruo TP_fast_assign_btrfs(fs_info, 2373480b9b4dSQu Wenruo __entry->type = sinfo->flags; 2374480b9b4dSQu Wenruo __entry->old = old; 2375480b9b4dSQu Wenruo __entry->diff = diff; 2376480b9b4dSQu Wenruo ), 2377480b9b4dSQu Wenruo TP_printk_btrfs("type=%s old=%llu diff=%lld", 2378480b9b4dSQu Wenruo __print_flags(__entry->type, "|", BTRFS_GROUP_FLAGS), 2379480b9b4dSQu Wenruo __entry->old, __entry->diff) 2380480b9b4dSQu Wenruo ); 2381480b9b4dSQu Wenruo 2382480b9b4dSQu Wenruo DEFINE_EVENT(btrfs__space_info_update, update_bytes_may_use, 2383480b9b4dSQu Wenruo 23841d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 23851d2e7c7cSDavid Sterba const struct btrfs_space_info *sinfo, u64 old, s64 diff), 2386480b9b4dSQu Wenruo 2387480b9b4dSQu Wenruo TP_ARGS(fs_info, sinfo, old, diff) 2388480b9b4dSQu Wenruo ); 2389480b9b4dSQu Wenruo 2390480b9b4dSQu Wenruo DEFINE_EVENT(btrfs__space_info_update, update_bytes_pinned, 2391480b9b4dSQu Wenruo 23921d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 23931d2e7c7cSDavid Sterba const struct btrfs_space_info *sinfo, u64 old, s64 diff), 2394480b9b4dSQu Wenruo 2395480b9b4dSQu Wenruo TP_ARGS(fs_info, sinfo, old, diff) 2396480b9b4dSQu Wenruo ); 2397480b9b4dSQu Wenruo 2398b8bea09aSQu Wenruo DECLARE_EVENT_CLASS(btrfs_raid56_bio, 2399b8bea09aSQu Wenruo 2400b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2401b8bea09aSQu Wenruo const struct bio *bio, 2402b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2403b8bea09aSQu Wenruo 2404b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info), 2405b8bea09aSQu Wenruo 2406b8bea09aSQu Wenruo TP_STRUCT__entry_btrfs( 2407b8bea09aSQu Wenruo __field( u64, full_stripe ) 2408b8bea09aSQu Wenruo __field( u64, physical ) 2409b8bea09aSQu Wenruo __field( u64, devid ) 2410b8bea09aSQu Wenruo __field( u32, offset ) 2411b8bea09aSQu Wenruo __field( u32, len ) 2412b8bea09aSQu Wenruo __field( u8, opf ) 2413b8bea09aSQu Wenruo __field( u8, total_stripes ) 2414b8bea09aSQu Wenruo __field( u8, real_stripes ) 2415b8bea09aSQu Wenruo __field( u8, nr_data ) 2416b8bea09aSQu Wenruo __field( u8, stripe_nr ) 2417b8bea09aSQu Wenruo ), 2418b8bea09aSQu Wenruo 2419b8bea09aSQu Wenruo TP_fast_assign_btrfs(rbio->bioc->fs_info, 2420b8bea09aSQu Wenruo __entry->full_stripe = rbio->bioc->raid_map[0]; 2421b8bea09aSQu Wenruo __entry->physical = bio->bi_iter.bi_sector << SECTOR_SHIFT; 2422b8bea09aSQu Wenruo __entry->len = bio->bi_iter.bi_size; 2423b8bea09aSQu Wenruo __entry->opf = bio_op(bio); 2424b8bea09aSQu Wenruo __entry->devid = trace_info->devid; 2425b8bea09aSQu Wenruo __entry->offset = trace_info->offset; 2426b8bea09aSQu Wenruo __entry->stripe_nr = trace_info->stripe_nr; 2427b8bea09aSQu Wenruo __entry->total_stripes = rbio->bioc->num_stripes; 2428b8bea09aSQu Wenruo __entry->real_stripes = rbio->real_stripes; 2429b8bea09aSQu Wenruo __entry->nr_data = rbio->nr_data; 2430b8bea09aSQu Wenruo ), 2431b8bea09aSQu Wenruo /* 2432b8bea09aSQu Wenruo * For type output, we need to output things like "DATA1" 2433b8bea09aSQu Wenruo * (the first data stripe), "DATA2" (the second data stripe), 2434b8bea09aSQu Wenruo * "PQ1" (P stripe),"PQ2" (Q stripe), "REPLACE0" (replace target device). 2435b8bea09aSQu Wenruo */ 2436b8bea09aSQu Wenruo TP_printk_btrfs( 2437b8bea09aSQu Wenruo "full_stripe=%llu devid=%lld type=%s%d offset=%d opf=0x%x physical=%llu len=%u", 2438b8bea09aSQu Wenruo __entry->full_stripe, __entry->devid, 2439b8bea09aSQu Wenruo (__entry->stripe_nr < __entry->nr_data) ? "DATA" : 2440b8bea09aSQu Wenruo ((__entry->stripe_nr < __entry->real_stripes) ? "PQ" : 2441b8bea09aSQu Wenruo "REPLACE"), 2442b8bea09aSQu Wenruo (__entry->stripe_nr < __entry->nr_data) ? 2443b8bea09aSQu Wenruo (__entry->stripe_nr + 1) : 2444b8bea09aSQu Wenruo ((__entry->stripe_nr < __entry->real_stripes) ? 2445b8bea09aSQu Wenruo (__entry->stripe_nr - __entry->nr_data + 1) : 0), 2446b8bea09aSQu Wenruo __entry->offset, __entry->opf, __entry->physical, __entry->len) 2447b8bea09aSQu Wenruo ); 2448b8bea09aSQu Wenruo 2449b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_read_partial, 2450b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2451b8bea09aSQu Wenruo const struct bio *bio, 2452b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2453b8bea09aSQu Wenruo 2454b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2455b8bea09aSQu Wenruo ); 2456b8bea09aSQu Wenruo 2457b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_write_stripe, 2458b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2459b8bea09aSQu Wenruo const struct bio *bio, 2460b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2461b8bea09aSQu Wenruo 2462b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2463b8bea09aSQu Wenruo ); 2464b8bea09aSQu Wenruo 2465b8bea09aSQu Wenruo 2466b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_scrub_write_stripe, 2467b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2468b8bea09aSQu Wenruo const struct bio *bio, 2469b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2470b8bea09aSQu Wenruo 2471b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2472b8bea09aSQu Wenruo ); 2473b8bea09aSQu Wenruo 2474b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_scrub_read, 2475b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2476b8bea09aSQu Wenruo const struct bio *bio, 2477b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2478b8bea09aSQu Wenruo 2479b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2480b8bea09aSQu Wenruo ); 2481b8bea09aSQu Wenruo 2482b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_scrub_read_recover, 2483b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2484b8bea09aSQu Wenruo const struct bio *bio, 2485b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2486b8bea09aSQu Wenruo 2487b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2488b8bea09aSQu Wenruo ); 2489b8bea09aSQu Wenruo 24901abe9b8aSliubo #endif /* _TRACE_BTRFS_H */ 24911abe9b8aSliubo 24921abe9b8aSliubo /* This part must be outside protection */ 24931abe9b8aSliubo #include <trace/define_trace.h> 2494