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 664*122e9edeSChristoph Hellwig TRACE_EVENT(btrfs_finish_ordered_extent, 665*122e9edeSChristoph Hellwig 666*122e9edeSChristoph Hellwig TP_PROTO(const struct btrfs_inode *inode, u64 start, u64 len, 667*122e9edeSChristoph Hellwig bool uptodate), 668*122e9edeSChristoph Hellwig 669*122e9edeSChristoph Hellwig TP_ARGS(inode, start, len, uptodate), 670*122e9edeSChristoph Hellwig 671*122e9edeSChristoph Hellwig TP_STRUCT__entry_btrfs( 672*122e9edeSChristoph Hellwig __field( u64, ino ) 673*122e9edeSChristoph Hellwig __field( u64, start ) 674*122e9edeSChristoph Hellwig __field( u64, len ) 675*122e9edeSChristoph Hellwig __field( bool, uptodate ) 676*122e9edeSChristoph Hellwig __field( u64, root_objectid ) 677*122e9edeSChristoph Hellwig ), 678*122e9edeSChristoph Hellwig 679*122e9edeSChristoph Hellwig TP_fast_assign_btrfs(inode->root->fs_info, 680*122e9edeSChristoph Hellwig __entry->ino = btrfs_ino(inode); 681*122e9edeSChristoph Hellwig __entry->start = start; 682*122e9edeSChristoph Hellwig __entry->len = len; 683*122e9edeSChristoph Hellwig __entry->uptodate = uptodate; 684*122e9edeSChristoph Hellwig __entry->root_objectid = inode->root->root_key.objectid; 685*122e9edeSChristoph Hellwig ), 686*122e9edeSChristoph Hellwig 687*122e9edeSChristoph Hellwig TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu uptodate=%d", 688*122e9edeSChristoph Hellwig show_root_type(__entry->root_objectid), 689*122e9edeSChristoph Hellwig __entry->ino, __entry->start, 690*122e9edeSChristoph Hellwig __entry->len, !!__entry->uptodate) 691*122e9edeSChristoph Hellwig ); 692*122e9edeSChristoph Hellwig 6931abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__writepage, 6941abe9b8aSliubo 6959a35b637SJeff Mahoney TP_PROTO(const struct page *page, const struct inode *inode, 6969a35b637SJeff Mahoney const struct writeback_control *wbc), 6971abe9b8aSliubo 6981abe9b8aSliubo TP_ARGS(page, inode, wbc), 6991abe9b8aSliubo 700bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 701f8f8e189SDavid Sterba __field( u64, ino ) 7021abe9b8aSliubo __field( pgoff_t, index ) 7031abe9b8aSliubo __field( long, nr_to_write ) 7041abe9b8aSliubo __field( long, pages_skipped ) 7051abe9b8aSliubo __field( loff_t, range_start ) 7061abe9b8aSliubo __field( loff_t, range_end ) 7071abe9b8aSliubo __field( char, for_kupdate ) 7081abe9b8aSliubo __field( char, for_reclaim ) 7091abe9b8aSliubo __field( char, range_cyclic ) 71094c3f6c6SDavid Sterba __field( unsigned long, writeback_index ) 7111abe9b8aSliubo __field( u64, root_objectid ) 7121abe9b8aSliubo ), 7131abe9b8aSliubo 714bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 715f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 7161abe9b8aSliubo __entry->index = page->index; 7171abe9b8aSliubo __entry->nr_to_write = wbc->nr_to_write; 7181abe9b8aSliubo __entry->pages_skipped = wbc->pages_skipped; 7191abe9b8aSliubo __entry->range_start = wbc->range_start; 7201abe9b8aSliubo __entry->range_end = wbc->range_end; 7211abe9b8aSliubo __entry->for_kupdate = wbc->for_kupdate; 7221abe9b8aSliubo __entry->for_reclaim = wbc->for_reclaim; 7231abe9b8aSliubo __entry->range_cyclic = wbc->range_cyclic; 7241abe9b8aSliubo __entry->writeback_index = inode->i_mapping->writeback_index; 7251abe9b8aSliubo __entry->root_objectid = 7261abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 7271abe9b8aSliubo ), 7281abe9b8aSliubo 729f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu " 730562a7a07SDavid Sterba "nr_to_write=%ld pages_skipped=%ld range_start=%llu " 731562a7a07SDavid Sterba "range_end=%llu for_kupdate=%d " 732562a7a07SDavid Sterba "for_reclaim=%d range_cyclic=%d writeback_index=%lu", 7331abe9b8aSliubo show_root_type(__entry->root_objectid), 7348eec8463SDavid Sterba __entry->ino, __entry->index, 7351abe9b8aSliubo __entry->nr_to_write, __entry->pages_skipped, 7361abe9b8aSliubo __entry->range_start, __entry->range_end, 737846d5a09SWu Fengguang __entry->for_kupdate, 7381abe9b8aSliubo __entry->for_reclaim, __entry->range_cyclic, 73994c3f6c6SDavid Sterba __entry->writeback_index) 7401abe9b8aSliubo ); 7411abe9b8aSliubo 7421abe9b8aSliubo DEFINE_EVENT(btrfs__writepage, __extent_writepage, 7431abe9b8aSliubo 7449a35b637SJeff Mahoney TP_PROTO(const struct page *page, const struct inode *inode, 7459a35b637SJeff Mahoney const struct writeback_control *wbc), 7461abe9b8aSliubo 7471abe9b8aSliubo TP_ARGS(page, inode, wbc) 7481abe9b8aSliubo ); 7491abe9b8aSliubo 7501abe9b8aSliubo TRACE_EVENT(btrfs_writepage_end_io_hook, 7511abe9b8aSliubo 75238a39ac7SQu Wenruo TP_PROTO(const struct btrfs_inode *inode, u64 start, u64 end, 75338a39ac7SQu Wenruo int uptodate), 7541abe9b8aSliubo 75538a39ac7SQu Wenruo TP_ARGS(inode, start, end, uptodate), 7561abe9b8aSliubo 757bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 758f8f8e189SDavid Sterba __field( u64, ino ) 7591abe9b8aSliubo __field( u64, start ) 7601abe9b8aSliubo __field( u64, end ) 7611abe9b8aSliubo __field( int, uptodate ) 7621abe9b8aSliubo __field( u64, root_objectid ) 7631abe9b8aSliubo ), 7641abe9b8aSliubo 76538a39ac7SQu Wenruo TP_fast_assign_btrfs(inode->root->fs_info, 76638a39ac7SQu Wenruo __entry->ino = btrfs_ino(inode); 7671abe9b8aSliubo __entry->start = start; 7681abe9b8aSliubo __entry->end = end; 7691abe9b8aSliubo __entry->uptodate = uptodate; 77038a39ac7SQu Wenruo __entry->root_objectid = inode->root->root_key.objectid; 7711abe9b8aSliubo ), 7721abe9b8aSliubo 77338a39ac7SQu Wenruo TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu end=%llu uptodate=%d", 7741abe9b8aSliubo show_root_type(__entry->root_objectid), 77538a39ac7SQu Wenruo __entry->ino, __entry->start, 7768eec8463SDavid Sterba __entry->end, __entry->uptodate) 7771abe9b8aSliubo ); 7781abe9b8aSliubo 7791abe9b8aSliubo TRACE_EVENT(btrfs_sync_file, 7801abe9b8aSliubo 7819a35b637SJeff Mahoney TP_PROTO(const struct file *file, int datasync), 7821abe9b8aSliubo 7831abe9b8aSliubo TP_ARGS(file, datasync), 7841abe9b8aSliubo 785bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 786f8f8e189SDavid Sterba __field( u64, ino ) 787f8f8e189SDavid Sterba __field( u64, parent ) 7881abe9b8aSliubo __field( int, datasync ) 7891abe9b8aSliubo __field( u64, root_objectid ) 7901abe9b8aSliubo ), 7911abe9b8aSliubo 7921abe9b8aSliubo TP_fast_assign( 7939a35b637SJeff Mahoney const struct dentry *dentry = file->f_path.dentry; 7949a35b637SJeff Mahoney const struct inode *inode = d_inode(dentry); 7951abe9b8aSliubo 796bc074524SJeff Mahoney TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb)); 797f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 798f8f8e189SDavid Sterba __entry->parent = btrfs_ino(BTRFS_I(d_inode(dentry->d_parent))); 7991abe9b8aSliubo __entry->datasync = datasync; 8001abe9b8aSliubo __entry->root_objectid = 8011abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 8021abe9b8aSliubo ), 8031abe9b8aSliubo 804f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu parent=%llu datasync=%d", 8051abe9b8aSliubo show_root_type(__entry->root_objectid), 8068eec8463SDavid Sterba __entry->ino, 8078eec8463SDavid Sterba __entry->parent, 8081abe9b8aSliubo __entry->datasync) 8091abe9b8aSliubo ); 8101abe9b8aSliubo 8111abe9b8aSliubo TRACE_EVENT(btrfs_sync_fs, 8121abe9b8aSliubo 8139a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, int wait), 8141abe9b8aSliubo 815bc074524SJeff Mahoney TP_ARGS(fs_info, wait), 8161abe9b8aSliubo 817bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 8181abe9b8aSliubo __field( int, wait ) 8191abe9b8aSliubo ), 8201abe9b8aSliubo 821bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 8221abe9b8aSliubo __entry->wait = wait; 8231abe9b8aSliubo ), 8241abe9b8aSliubo 825bc074524SJeff Mahoney TP_printk_btrfs("wait=%d", __entry->wait) 8261abe9b8aSliubo ); 8271abe9b8aSliubo 828c83f8effSJosef Bacik TRACE_EVENT(btrfs_add_block_group, 829c83f8effSJosef Bacik 8309a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 83132da5386SDavid Sterba const struct btrfs_block_group *block_group, int create), 832c83f8effSJosef Bacik 833c83f8effSJosef Bacik TP_ARGS(fs_info, block_group, create), 834c83f8effSJosef Bacik 8352e63e62dSDavid Sterba TP_STRUCT__entry_btrfs( 836c83f8effSJosef Bacik __field( u64, offset ) 837c83f8effSJosef Bacik __field( u64, size ) 838c83f8effSJosef Bacik __field( u64, flags ) 839c83f8effSJosef Bacik __field( u64, bytes_used ) 840c83f8effSJosef Bacik __field( u64, bytes_super ) 841c83f8effSJosef Bacik __field( int, create ) 842c83f8effSJosef Bacik ), 843c83f8effSJosef Bacik 8442e63e62dSDavid Sterba TP_fast_assign_btrfs(fs_info, 845b3470b5dSDavid Sterba __entry->offset = block_group->start; 846b3470b5dSDavid Sterba __entry->size = block_group->length; 847c83f8effSJosef Bacik __entry->flags = block_group->flags; 848bf38be65SDavid Sterba __entry->bytes_used = block_group->used; 849c83f8effSJosef Bacik __entry->bytes_super = block_group->bytes_super; 850c83f8effSJosef Bacik __entry->create = create; 851c83f8effSJosef Bacik ), 852c83f8effSJosef Bacik 8532e63e62dSDavid Sterba TP_printk_btrfs("block_group offset=%llu size=%llu " 854562a7a07SDavid Sterba "flags=%llu(%s) bytes_used=%llu bytes_super=%llu " 8552e63e62dSDavid Sterba "create=%d", 8568eec8463SDavid Sterba __entry->offset, 8578eec8463SDavid Sterba __entry->size, 8588eec8463SDavid Sterba __entry->flags, 859c83f8effSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 860c83f8effSJosef Bacik BTRFS_GROUP_FLAGS), 8618eec8463SDavid Sterba __entry->bytes_used, 8628eec8463SDavid Sterba __entry->bytes_super, __entry->create) 863c83f8effSJosef Bacik ); 864c83f8effSJosef Bacik 8651abe9b8aSliubo #define show_ref_action(action) \ 8661abe9b8aSliubo __print_symbolic(action, \ 8671abe9b8aSliubo { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ 8681abe9b8aSliubo { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ 8691abe9b8aSliubo { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ 8701abe9b8aSliubo { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) 8711abe9b8aSliubo 8721abe9b8aSliubo 873599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, 8741abe9b8aSliubo 8759a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8769a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 8779a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 8781abe9b8aSliubo int action), 8791abe9b8aSliubo 880bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action), 8811abe9b8aSliubo 882bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 8831abe9b8aSliubo __field( u64, bytenr ) 8841abe9b8aSliubo __field( u64, num_bytes ) 8851abe9b8aSliubo __field( int, action ) 8861abe9b8aSliubo __field( u64, parent ) 8871abe9b8aSliubo __field( u64, ref_root ) 8881abe9b8aSliubo __field( int, level ) 8891abe9b8aSliubo __field( int, type ) 890dea7d76eSLiu Bo __field( u64, seq ) 8911abe9b8aSliubo ), 8921abe9b8aSliubo 893bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 8941abe9b8aSliubo __entry->bytenr = ref->bytenr; 8951abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 8961abe9b8aSliubo __entry->action = action; 8971abe9b8aSliubo __entry->parent = full_ref->parent; 8981abe9b8aSliubo __entry->ref_root = full_ref->root; 8991abe9b8aSliubo __entry->level = full_ref->level; 9001abe9b8aSliubo __entry->type = ref->type; 901dea7d76eSLiu Bo __entry->seq = ref->seq; 9021abe9b8aSliubo ), 9031abe9b8aSliubo 904562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 905562a7a07SDavid Sterba "parent=%llu(%s) ref_root=%llu(%s) level=%d " 906562a7a07SDavid Sterba "type=%s seq=%llu", 9078eec8463SDavid Sterba __entry->bytenr, 9088eec8463SDavid Sterba __entry->num_bytes, 9091abe9b8aSliubo show_ref_action(__entry->action), 9101abe9b8aSliubo show_root_type(__entry->parent), 9111abe9b8aSliubo show_root_type(__entry->ref_root), 912dea7d76eSLiu Bo __entry->level, show_ref_type(__entry->type), 9138eec8463SDavid Sterba __entry->seq) 9141abe9b8aSliubo ); 9151abe9b8aSliubo 916599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, 917599c75ecSLiu Bo 9189a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9199a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 9209a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 921599c75ecSLiu Bo int action), 922599c75ecSLiu Bo 923bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 924599c75ecSLiu Bo ); 925599c75ecSLiu Bo 926599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, 927599c75ecSLiu Bo 9289a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9299a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 9309a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 931599c75ecSLiu Bo int action), 932599c75ecSLiu Bo 933bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 934599c75ecSLiu Bo ); 935599c75ecSLiu Bo 936599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, 9371abe9b8aSliubo 9389a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9399a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 9409a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 9411abe9b8aSliubo int action), 9421abe9b8aSliubo 943bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action), 9441abe9b8aSliubo 945bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 9461abe9b8aSliubo __field( u64, bytenr ) 9471abe9b8aSliubo __field( u64, num_bytes ) 9481abe9b8aSliubo __field( int, action ) 9491abe9b8aSliubo __field( u64, parent ) 9501abe9b8aSliubo __field( u64, ref_root ) 9511abe9b8aSliubo __field( u64, owner ) 9521abe9b8aSliubo __field( u64, offset ) 9531abe9b8aSliubo __field( int, type ) 954dea7d76eSLiu Bo __field( u64, seq ) 9551abe9b8aSliubo ), 9561abe9b8aSliubo 957bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 9581abe9b8aSliubo __entry->bytenr = ref->bytenr; 9591abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 9601abe9b8aSliubo __entry->action = action; 9611abe9b8aSliubo __entry->parent = full_ref->parent; 9621abe9b8aSliubo __entry->ref_root = full_ref->root; 9631abe9b8aSliubo __entry->owner = full_ref->objectid; 9641abe9b8aSliubo __entry->offset = full_ref->offset; 9651abe9b8aSliubo __entry->type = ref->type; 966dea7d76eSLiu Bo __entry->seq = ref->seq; 9671abe9b8aSliubo ), 9681abe9b8aSliubo 969562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 970562a7a07SDavid Sterba "parent=%llu(%s) ref_root=%llu(%s) owner=%llu " 971562a7a07SDavid Sterba "offset=%llu type=%s seq=%llu", 9728eec8463SDavid Sterba __entry->bytenr, 9738eec8463SDavid Sterba __entry->num_bytes, 9741abe9b8aSliubo show_ref_action(__entry->action), 9751abe9b8aSliubo show_root_type(__entry->parent), 9761abe9b8aSliubo show_root_type(__entry->ref_root), 9778eec8463SDavid Sterba __entry->owner, 9788eec8463SDavid Sterba __entry->offset, 979dea7d76eSLiu Bo show_ref_type(__entry->type), 9808eec8463SDavid Sterba __entry->seq) 9811abe9b8aSliubo ); 9821abe9b8aSliubo 983599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, 984599c75ecSLiu Bo 9859a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9869a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 9879a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 988599c75ecSLiu Bo int action), 989599c75ecSLiu Bo 990bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 991599c75ecSLiu Bo ); 992599c75ecSLiu Bo 993599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, 994599c75ecSLiu Bo 9959a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9969a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 9979a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 998599c75ecSLiu Bo int action), 999599c75ecSLiu Bo 1000bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 1001599c75ecSLiu Bo ); 1002599c75ecSLiu Bo 1003599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, 10041abe9b8aSliubo 10059a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10069a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 10071abe9b8aSliubo int action), 10081abe9b8aSliubo 1009d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action), 10101abe9b8aSliubo 1011bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 10121abe9b8aSliubo __field( u64, bytenr ) 10131abe9b8aSliubo __field( u64, num_bytes ) 10141abe9b8aSliubo __field( int, action ) 10151abe9b8aSliubo __field( int, is_data ) 10161abe9b8aSliubo ), 10171abe9b8aSliubo 1018bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 1019d278850eSJosef Bacik __entry->bytenr = head_ref->bytenr; 1020d278850eSJosef Bacik __entry->num_bytes = head_ref->num_bytes; 10211abe9b8aSliubo __entry->action = action; 10221abe9b8aSliubo __entry->is_data = head_ref->is_data; 10231abe9b8aSliubo ), 10241abe9b8aSliubo 1025562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d", 10268eec8463SDavid Sterba __entry->bytenr, 10278eec8463SDavid Sterba __entry->num_bytes, 10281abe9b8aSliubo show_ref_action(__entry->action), 10291abe9b8aSliubo __entry->is_data) 10301abe9b8aSliubo ); 10311abe9b8aSliubo 1032599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, 1033599c75ecSLiu Bo 10349a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10359a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 1036599c75ecSLiu Bo int action), 1037599c75ecSLiu Bo 1038d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action) 1039599c75ecSLiu Bo ); 1040599c75ecSLiu Bo 1041599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, 1042599c75ecSLiu Bo 10439a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10449a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 1045599c75ecSLiu Bo int action), 1046599c75ecSLiu Bo 1047d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action) 1048599c75ecSLiu Bo ); 1049599c75ecSLiu Bo 10501abe9b8aSliubo #define show_chunk_type(type) \ 10511abe9b8aSliubo __print_flags(type, "|", \ 10521abe9b8aSliubo { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ 10531abe9b8aSliubo { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 10541abe9b8aSliubo { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 10551abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ 10561abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ 10571abe9b8aSliubo { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ 1058e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 1059e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ 1060e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) 10611abe9b8aSliubo 10621abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__chunk, 10631abe9b8aSliubo 10649a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10659a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 10661abe9b8aSliubo 10676bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size), 10681abe9b8aSliubo 1069bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 10701abe9b8aSliubo __field( int, num_stripes ) 10711abe9b8aSliubo __field( u64, type ) 10721abe9b8aSliubo __field( int, sub_stripes ) 10731abe9b8aSliubo __field( u64, offset ) 10741abe9b8aSliubo __field( u64, size ) 10751abe9b8aSliubo __field( u64, root_objectid ) 10761abe9b8aSliubo ), 10771abe9b8aSliubo 10786bccf3abSJeff Mahoney TP_fast_assign_btrfs(fs_info, 10791abe9b8aSliubo __entry->num_stripes = map->num_stripes; 10801abe9b8aSliubo __entry->type = map->type; 10811abe9b8aSliubo __entry->sub_stripes = map->sub_stripes; 10821abe9b8aSliubo __entry->offset = offset; 10831abe9b8aSliubo __entry->size = size; 10846bccf3abSJeff Mahoney __entry->root_objectid = fs_info->chunk_root->root_key.objectid; 10851abe9b8aSliubo ), 10861abe9b8aSliubo 1087562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu " 1088562a7a07SDavid Sterba "num_stripes=%d sub_stripes=%d type=%s", 10891abe9b8aSliubo show_root_type(__entry->root_objectid), 10908eec8463SDavid Sterba __entry->offset, 10918eec8463SDavid Sterba __entry->size, 10921abe9b8aSliubo __entry->num_stripes, __entry->sub_stripes, 10931abe9b8aSliubo show_chunk_type(__entry->type)) 10941abe9b8aSliubo ); 10951abe9b8aSliubo 10961abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, 10971abe9b8aSliubo 10989a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10999a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 11001abe9b8aSliubo 11016bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size) 11021abe9b8aSliubo ); 11031abe9b8aSliubo 11041abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, 11051abe9b8aSliubo 11069a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 11079a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 11081abe9b8aSliubo 11096bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size) 11101abe9b8aSliubo ); 11111abe9b8aSliubo 11121abe9b8aSliubo TRACE_EVENT(btrfs_cow_block, 11131abe9b8aSliubo 11149a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf, 11159a35b637SJeff Mahoney const struct extent_buffer *cow), 11161abe9b8aSliubo 11171abe9b8aSliubo TP_ARGS(root, buf, cow), 11181abe9b8aSliubo 1119bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 11201abe9b8aSliubo __field( u64, root_objectid ) 11211abe9b8aSliubo __field( u64, buf_start ) 11221abe9b8aSliubo __field( int, refs ) 11231abe9b8aSliubo __field( u64, cow_start ) 11241abe9b8aSliubo __field( int, buf_level ) 11251abe9b8aSliubo __field( int, cow_level ) 11261abe9b8aSliubo ), 11271abe9b8aSliubo 1128bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 11291abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 11301abe9b8aSliubo __entry->buf_start = buf->start; 11311abe9b8aSliubo __entry->refs = atomic_read(&buf->refs); 11321abe9b8aSliubo __entry->cow_start = cow->start; 11331abe9b8aSliubo __entry->buf_level = btrfs_header_level(buf); 11341abe9b8aSliubo __entry->cow_level = btrfs_header_level(cow); 11351abe9b8aSliubo ), 11361abe9b8aSliubo 1137562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu " 1138562a7a07SDavid Sterba "(orig_level=%d) cow_buf=%llu (cow_level=%d)", 11391abe9b8aSliubo show_root_type(__entry->root_objectid), 11401abe9b8aSliubo __entry->refs, 11418eec8463SDavid Sterba __entry->buf_start, 11421abe9b8aSliubo __entry->buf_level, 11438eec8463SDavid Sterba __entry->cow_start, 11441abe9b8aSliubo __entry->cow_level) 11451abe9b8aSliubo ); 11461abe9b8aSliubo 11478c2a3ca2SJosef Bacik TRACE_EVENT(btrfs_space_reservation, 11488c2a3ca2SJosef Bacik 11491d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, const char *type, u64 val, 11508c2a3ca2SJosef Bacik u64 bytes, int reserve), 11518c2a3ca2SJosef Bacik 11528c2a3ca2SJosef Bacik TP_ARGS(fs_info, type, val, bytes, reserve), 11538c2a3ca2SJosef Bacik 1154bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 11558c2a3ca2SJosef Bacik __string( type, type ) 11568c2a3ca2SJosef Bacik __field( u64, val ) 11578c2a3ca2SJosef Bacik __field( u64, bytes ) 11588c2a3ca2SJosef Bacik __field( int, reserve ) 11598c2a3ca2SJosef Bacik ), 11608c2a3ca2SJosef Bacik 1161bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 11628c2a3ca2SJosef Bacik __assign_str(type, type); 11638c2a3ca2SJosef Bacik __entry->val = val; 11648c2a3ca2SJosef Bacik __entry->bytes = bytes; 11658c2a3ca2SJosef Bacik __entry->reserve = reserve; 11668c2a3ca2SJosef Bacik ), 11678c2a3ca2SJosef Bacik 11685439c7f5SDavid Sterba TP_printk_btrfs("%s: %llu %s %llu", __get_str(type), __entry->val, 1169bc074524SJeff Mahoney __entry->reserve ? "reserve" : "release", 11708c2a3ca2SJosef Bacik __entry->bytes) 11718c2a3ca2SJosef Bacik ); 11728c2a3ca2SJosef Bacik 1173f376df2bSJosef Bacik TRACE_EVENT(btrfs_trigger_flush, 1174f376df2bSJosef Bacik 11759a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, 11761d2e7c7cSDavid Sterba int flush, const char *reason), 1177f376df2bSJosef Bacik 1178f376df2bSJosef Bacik TP_ARGS(fs_info, flags, bytes, flush, reason), 1179f376df2bSJosef Bacik 11802e63e62dSDavid Sterba TP_STRUCT__entry_btrfs( 1181f376df2bSJosef Bacik __field( u64, flags ) 1182f376df2bSJosef Bacik __field( u64, bytes ) 1183f376df2bSJosef Bacik __field( int, flush ) 1184f376df2bSJosef Bacik __string( reason, reason ) 1185f376df2bSJosef Bacik ), 1186f376df2bSJosef Bacik 11872e63e62dSDavid Sterba TP_fast_assign_btrfs(fs_info, 1188f376df2bSJosef Bacik __entry->flags = flags; 1189f376df2bSJosef Bacik __entry->bytes = bytes; 1190f376df2bSJosef Bacik __entry->flush = flush; 119178c14b38SJoe Perches __assign_str(reason, reason); 1192f376df2bSJosef Bacik ), 1193f376df2bSJosef Bacik 11942e63e62dSDavid Sterba TP_printk_btrfs("%s: flush=%d(%s) flags=%llu(%s) bytes=%llu", 11952e63e62dSDavid Sterba __get_str(reason), __entry->flush, 119645e31869SNikolay Borisov __print_symbolic(__entry->flush, FLUSH_ACTIONS), 11978eec8463SDavid Sterba __entry->flags, 1198f376df2bSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 1199f376df2bSJosef Bacik BTRFS_GROUP_FLAGS), 12008eec8463SDavid Sterba __entry->bytes) 1201f376df2bSJosef Bacik ); 1202f376df2bSJosef Bacik 1203f376df2bSJosef Bacik 1204f376df2bSJosef Bacik TRACE_EVENT(btrfs_flush_space, 1205f376df2bSJosef Bacik 12069a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes, 12074b02b00fSJosef Bacik int state, int ret, bool for_preempt), 1208f376df2bSJosef Bacik 12094b02b00fSJosef Bacik TP_ARGS(fs_info, flags, num_bytes, state, ret, for_preempt), 1210f376df2bSJosef Bacik 12112e63e62dSDavid Sterba TP_STRUCT__entry_btrfs( 1212f376df2bSJosef Bacik __field( u64, flags ) 1213f376df2bSJosef Bacik __field( u64, num_bytes ) 1214f376df2bSJosef Bacik __field( int, state ) 1215f376df2bSJosef Bacik __field( int, ret ) 12164b02b00fSJosef Bacik __field( bool, for_preempt ) 1217f376df2bSJosef Bacik ), 1218f376df2bSJosef Bacik 12192e63e62dSDavid Sterba TP_fast_assign_btrfs(fs_info, 1220f376df2bSJosef Bacik __entry->flags = flags; 1221f376df2bSJosef Bacik __entry->num_bytes = num_bytes; 1222f376df2bSJosef Bacik __entry->state = state; 1223f376df2bSJosef Bacik __entry->ret = ret; 12244b02b00fSJosef Bacik __entry->for_preempt = for_preempt; 1225f376df2bSJosef Bacik ), 1226f376df2bSJosef Bacik 12274b02b00fSJosef Bacik TP_printk_btrfs("state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d for_preempt=%d", 12282e63e62dSDavid Sterba __entry->state, 1229f0cdd15cSNikolay Borisov __print_symbolic(__entry->state, FLUSH_STATES), 12308eec8463SDavid Sterba __entry->flags, 1231f376df2bSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 1232f376df2bSJosef Bacik BTRFS_GROUP_FLAGS), 12334b02b00fSJosef Bacik __entry->num_bytes, __entry->ret, __entry->for_preempt) 1234f376df2bSJosef Bacik ); 1235f376df2bSJosef Bacik 12361abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__reserved_extent, 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 1242bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 12431abe9b8aSliubo __field( u64, start ) 12441abe9b8aSliubo __field( u64, len ) 12451abe9b8aSliubo ), 12461abe9b8aSliubo 124771ff6437SJeff Mahoney TP_fast_assign_btrfs(fs_info, 12481abe9b8aSliubo __entry->start = start; 12491abe9b8aSliubo __entry->len = len; 12501abe9b8aSliubo ), 12511abe9b8aSliubo 1252562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu", 125371ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 12548eec8463SDavid Sterba __entry->start, 12558eec8463SDavid Sterba __entry->len) 12561abe9b8aSliubo ); 12571abe9b8aSliubo 12581abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, 12591abe9b8aSliubo 12609a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 12611abe9b8aSliubo 126271ff6437SJeff Mahoney TP_ARGS(fs_info, start, len) 12631abe9b8aSliubo ); 12641abe9b8aSliubo 12651abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, 12661abe9b8aSliubo 12679a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 12681abe9b8aSliubo 126971ff6437SJeff Mahoney TP_ARGS(fs_info, start, len) 12701abe9b8aSliubo ); 12711abe9b8aSliubo 12723f7de037SJosef Bacik TRACE_EVENT(find_free_extent, 12733f7de037SJosef Bacik 1274cfc2de0fSBoris Burkov TP_PROTO(const struct btrfs_root *root, 1275cfc2de0fSBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 12763f7de037SJosef Bacik 1277cfc2de0fSBoris Burkov TP_ARGS(root, ffe_ctl), 12783f7de037SJosef Bacik 1279bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1280437490feSQu Wenruo __field( u64, root_objectid ) 12813f7de037SJosef Bacik __field( u64, num_bytes ) 12823f7de037SJosef Bacik __field( u64, empty_size ) 1283cfc2de0fSBoris Burkov __field( u64, flags ) 12843f7de037SJosef Bacik ), 12853f7de037SJosef Bacik 1286437490feSQu Wenruo TP_fast_assign_btrfs(root->fs_info, 1287437490feSQu Wenruo __entry->root_objectid = root->root_key.objectid; 1288cfc2de0fSBoris Burkov __entry->num_bytes = ffe_ctl->num_bytes; 1289cfc2de0fSBoris Burkov __entry->empty_size = ffe_ctl->empty_size; 1290cfc2de0fSBoris Burkov __entry->flags = ffe_ctl->flags; 12913f7de037SJosef Bacik ), 12923f7de037SJosef Bacik 12935439c7f5SDavid Sterba TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s)", 1294437490feSQu Wenruo show_root_type(__entry->root_objectid), 1295cfc2de0fSBoris Burkov __entry->num_bytes, __entry->empty_size, __entry->flags, 1296cfc2de0fSBoris Burkov __print_flags((unsigned long)__entry->flags, "|", 12973f7de037SJosef Bacik BTRFS_GROUP_FLAGS)) 12983f7de037SJosef Bacik ); 12993f7de037SJosef Bacik 1300854c2f36SBoris Burkov TRACE_EVENT(find_free_extent_search_loop, 1301854c2f36SBoris Burkov 1302854c2f36SBoris Burkov TP_PROTO(const struct btrfs_root *root, 1303854c2f36SBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 1304854c2f36SBoris Burkov 1305854c2f36SBoris Burkov TP_ARGS(root, ffe_ctl), 1306854c2f36SBoris Burkov 1307854c2f36SBoris Burkov TP_STRUCT__entry_btrfs( 1308854c2f36SBoris Burkov __field( u64, root_objectid ) 1309854c2f36SBoris Burkov __field( u64, num_bytes ) 1310854c2f36SBoris Burkov __field( u64, empty_size ) 1311854c2f36SBoris Burkov __field( u64, flags ) 1312854c2f36SBoris Burkov __field( u64, loop ) 1313854c2f36SBoris Burkov ), 1314854c2f36SBoris Burkov 1315854c2f36SBoris Burkov TP_fast_assign_btrfs(root->fs_info, 1316854c2f36SBoris Burkov __entry->root_objectid = root->root_key.objectid; 1317854c2f36SBoris Burkov __entry->num_bytes = ffe_ctl->num_bytes; 1318854c2f36SBoris Burkov __entry->empty_size = ffe_ctl->empty_size; 1319854c2f36SBoris Burkov __entry->flags = ffe_ctl->flags; 1320854c2f36SBoris Burkov __entry->loop = ffe_ctl->loop; 1321854c2f36SBoris Burkov ), 1322854c2f36SBoris Burkov 1323854c2f36SBoris Burkov TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s) loop=%llu", 1324854c2f36SBoris Burkov show_root_type(__entry->root_objectid), 1325854c2f36SBoris Burkov __entry->num_bytes, __entry->empty_size, __entry->flags, 1326854c2f36SBoris Burkov __print_flags((unsigned long)__entry->flags, "|", BTRFS_GROUP_FLAGS), 1327854c2f36SBoris Burkov __entry->loop) 1328854c2f36SBoris Burkov ); 1329854c2f36SBoris Burkov 1330854c2f36SBoris Burkov TRACE_EVENT(find_free_extent_have_block_group, 1331854c2f36SBoris Burkov 1332854c2f36SBoris Burkov TP_PROTO(const struct btrfs_root *root, 1333854c2f36SBoris Burkov const struct find_free_extent_ctl *ffe_ctl, 1334854c2f36SBoris Burkov const struct btrfs_block_group *block_group), 1335854c2f36SBoris Burkov 1336854c2f36SBoris Burkov TP_ARGS(root, ffe_ctl, block_group), 1337854c2f36SBoris Burkov 1338854c2f36SBoris Burkov TP_STRUCT__entry_btrfs( 1339854c2f36SBoris Burkov __field( u64, root_objectid ) 1340854c2f36SBoris Burkov __field( u64, num_bytes ) 1341854c2f36SBoris Burkov __field( u64, empty_size ) 1342854c2f36SBoris Burkov __field( u64, flags ) 1343854c2f36SBoris Burkov __field( u64, loop ) 1344854c2f36SBoris Burkov __field( bool, hinted ) 1345854c2f36SBoris Burkov __field( u64, bg_start ) 1346854c2f36SBoris Burkov __field( u64, bg_flags ) 1347854c2f36SBoris Burkov ), 1348854c2f36SBoris Burkov 1349854c2f36SBoris Burkov TP_fast_assign_btrfs(root->fs_info, 1350854c2f36SBoris Burkov __entry->root_objectid = root->root_key.objectid; 1351854c2f36SBoris Burkov __entry->num_bytes = ffe_ctl->num_bytes; 1352854c2f36SBoris Burkov __entry->empty_size = ffe_ctl->empty_size; 1353854c2f36SBoris Burkov __entry->flags = ffe_ctl->flags; 1354854c2f36SBoris Burkov __entry->loop = ffe_ctl->loop; 1355854c2f36SBoris Burkov __entry->hinted = ffe_ctl->hinted; 1356854c2f36SBoris Burkov __entry->bg_start = block_group->start; 1357854c2f36SBoris Burkov __entry->bg_flags = block_group->flags; 1358854c2f36SBoris Burkov ), 1359854c2f36SBoris Burkov 1360854c2f36SBoris Burkov TP_printk_btrfs( 1361854c2f36SBoris Burkov "root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s) loop=%llu hinted=%d block_group=%llu bg_flags=%llu(%s)", 1362854c2f36SBoris Burkov show_root_type(__entry->root_objectid), 1363854c2f36SBoris Burkov __entry->num_bytes, __entry->empty_size, __entry->flags, 1364854c2f36SBoris Burkov __print_flags((unsigned long)__entry->flags, "|", BTRFS_GROUP_FLAGS), 1365854c2f36SBoris Burkov __entry->loop, __entry->hinted, 1366854c2f36SBoris Burkov __entry->bg_start, __entry->bg_flags, 1367854c2f36SBoris Burkov __print_flags((unsigned long)__entry->bg_flags, "|", 1368854c2f36SBoris Burkov BTRFS_GROUP_FLAGS)) 1369854c2f36SBoris Burkov ); 1370854c2f36SBoris Burkov 13713f7de037SJosef Bacik DECLARE_EVENT_CLASS(btrfs__reserve_extent, 13723f7de037SJosef Bacik 1373cfc2de0fSBoris Burkov TP_PROTO(const struct btrfs_block_group *block_group, 1374cfc2de0fSBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 13753f7de037SJosef Bacik 1376cfc2de0fSBoris Burkov TP_ARGS(block_group, ffe_ctl), 13773f7de037SJosef Bacik 1378bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 13793f7de037SJosef Bacik __field( u64, bg_objectid ) 13803f7de037SJosef Bacik __field( u64, flags ) 138152bb7a21SBoris Burkov __field( int, bg_size_class ) 13823f7de037SJosef Bacik __field( u64, start ) 13833f7de037SJosef Bacik __field( u64, len ) 1384854c2f36SBoris Burkov __field( u64, loop ) 1385854c2f36SBoris Burkov __field( bool, hinted ) 138652bb7a21SBoris Burkov __field( int, size_class ) 13873f7de037SJosef Bacik ), 13883f7de037SJosef Bacik 13893dca5c94SQu Wenruo TP_fast_assign_btrfs(block_group->fs_info, 1390b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 13913f7de037SJosef Bacik __entry->flags = block_group->flags; 139252bb7a21SBoris Burkov __entry->bg_size_class = block_group->size_class; 1393cfc2de0fSBoris Burkov __entry->start = ffe_ctl->search_start; 1394cfc2de0fSBoris Burkov __entry->len = ffe_ctl->num_bytes; 1395854c2f36SBoris Burkov __entry->loop = ffe_ctl->loop; 1396854c2f36SBoris Burkov __entry->hinted = ffe_ctl->hinted; 139752bb7a21SBoris Burkov __entry->size_class = ffe_ctl->size_class; 13983f7de037SJosef Bacik ), 13993f7de037SJosef Bacik 1400854c2f36SBoris Burkov TP_printk_btrfs( 140152bb7a21SBoris Burkov "root=%llu(%s) block_group=%llu flags=%llu(%s) bg_size_class=%d start=%llu len=%llu loop=%llu hinted=%d size_class=%d", 140271ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 140371ff6437SJeff Mahoney __entry->bg_objectid, 14043f7de037SJosef Bacik __entry->flags, __print_flags((unsigned long)__entry->flags, 14053f7de037SJosef Bacik "|", BTRFS_GROUP_FLAGS), 140652bb7a21SBoris Burkov __entry->bg_size_class, __entry->start, __entry->len, 140752bb7a21SBoris Burkov __entry->loop, __entry->hinted, __entry->size_class) 14083f7de037SJosef Bacik ); 14093f7de037SJosef Bacik 14103f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, 14113f7de037SJosef Bacik 1412cfc2de0fSBoris Burkov TP_PROTO(const struct btrfs_block_group *block_group, 1413cfc2de0fSBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 14143f7de037SJosef Bacik 1415cfc2de0fSBoris Burkov TP_ARGS(block_group, ffe_ctl) 14163f7de037SJosef Bacik ); 14173f7de037SJosef Bacik 14183f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, 14193f7de037SJosef Bacik 1420cfc2de0fSBoris Burkov TP_PROTO(const struct btrfs_block_group *block_group, 1421cfc2de0fSBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 14223f7de037SJosef Bacik 1423cfc2de0fSBoris Burkov TP_ARGS(block_group, ffe_ctl) 14243f7de037SJosef Bacik ); 14253f7de037SJosef Bacik 14263f7de037SJosef Bacik TRACE_EVENT(btrfs_find_cluster, 14273f7de037SJosef Bacik 142832da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group, u64 start, 14293f7de037SJosef Bacik u64 bytes, u64 empty_size, u64 min_bytes), 14303f7de037SJosef Bacik 14313f7de037SJosef Bacik TP_ARGS(block_group, start, bytes, empty_size, min_bytes), 14323f7de037SJosef Bacik 1433bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 14343f7de037SJosef Bacik __field( u64, bg_objectid ) 14353f7de037SJosef Bacik __field( u64, flags ) 14363f7de037SJosef Bacik __field( u64, start ) 14373f7de037SJosef Bacik __field( u64, bytes ) 14383f7de037SJosef Bacik __field( u64, empty_size ) 14393f7de037SJosef Bacik __field( u64, min_bytes ) 14403f7de037SJosef Bacik ), 14413f7de037SJosef Bacik 1442bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 1443b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 14443f7de037SJosef Bacik __entry->flags = block_group->flags; 14453f7de037SJosef Bacik __entry->start = start; 14463f7de037SJosef Bacik __entry->bytes = bytes; 14473f7de037SJosef Bacik __entry->empty_size = empty_size; 14483f7de037SJosef Bacik __entry->min_bytes = min_bytes; 14493f7de037SJosef Bacik ), 14503f7de037SJosef Bacik 14515439c7f5SDavid Sterba TP_printk_btrfs("block_group=%llu flags=%llu(%s) start=%llu len=%llu " 14525439c7f5SDavid Sterba "empty_size=%llu min_bytes=%llu", __entry->bg_objectid, 14533f7de037SJosef Bacik __entry->flags, 14543f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 14553f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 14563f7de037SJosef Bacik __entry->bytes, __entry->empty_size, __entry->min_bytes) 14573f7de037SJosef Bacik ); 14583f7de037SJosef Bacik 14593f7de037SJosef Bacik TRACE_EVENT(btrfs_failed_cluster_setup, 14603f7de037SJosef Bacik 146132da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group), 14623f7de037SJosef Bacik 14633f7de037SJosef Bacik TP_ARGS(block_group), 14643f7de037SJosef Bacik 1465bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 14663f7de037SJosef Bacik __field( u64, bg_objectid ) 14673f7de037SJosef Bacik ), 14683f7de037SJosef Bacik 1469bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 1470b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 14713f7de037SJosef Bacik ), 14723f7de037SJosef Bacik 14735439c7f5SDavid Sterba TP_printk_btrfs("block_group=%llu", __entry->bg_objectid) 14743f7de037SJosef Bacik ); 14753f7de037SJosef Bacik 14763f7de037SJosef Bacik TRACE_EVENT(btrfs_setup_cluster, 14773f7de037SJosef Bacik 147832da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group, 14799a35b637SJeff Mahoney const struct btrfs_free_cluster *cluster, 14809a35b637SJeff Mahoney u64 size, int bitmap), 14813f7de037SJosef Bacik 14823f7de037SJosef Bacik TP_ARGS(block_group, cluster, size, bitmap), 14833f7de037SJosef Bacik 1484bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 14853f7de037SJosef Bacik __field( u64, bg_objectid ) 14863f7de037SJosef Bacik __field( u64, flags ) 14873f7de037SJosef Bacik __field( u64, start ) 14883f7de037SJosef Bacik __field( u64, max_size ) 14893f7de037SJosef Bacik __field( u64, size ) 14903f7de037SJosef Bacik __field( int, bitmap ) 14913f7de037SJosef Bacik ), 14923f7de037SJosef Bacik 1493bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 1494b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 14953f7de037SJosef Bacik __entry->flags = block_group->flags; 14963f7de037SJosef Bacik __entry->start = cluster->window_start; 14973f7de037SJosef Bacik __entry->max_size = cluster->max_size; 14983f7de037SJosef Bacik __entry->size = size; 14993f7de037SJosef Bacik __entry->bitmap = bitmap; 15003f7de037SJosef Bacik ), 15013f7de037SJosef Bacik 15025439c7f5SDavid Sterba TP_printk_btrfs("block_group=%llu flags=%llu(%s) window_start=%llu " 15035439c7f5SDavid Sterba "size=%llu max_size=%llu bitmap=%d", 15043f7de037SJosef Bacik __entry->bg_objectid, 15053f7de037SJosef Bacik __entry->flags, 15063f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 15073f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 15083f7de037SJosef Bacik __entry->size, __entry->max_size, __entry->bitmap) 15093f7de037SJosef Bacik ); 15103f7de037SJosef Bacik 1511143bede5SJeff Mahoney struct extent_state; 1512143bede5SJeff Mahoney TRACE_EVENT(alloc_extent_state, 1513143bede5SJeff Mahoney 15149a35b637SJeff Mahoney TP_PROTO(const struct extent_state *state, 15159a35b637SJeff Mahoney gfp_t mask, unsigned long IP), 1516143bede5SJeff Mahoney 1517143bede5SJeff Mahoney TP_ARGS(state, mask, IP), 1518143bede5SJeff Mahoney 1519143bede5SJeff Mahoney TP_STRUCT__entry( 15209a35b637SJeff Mahoney __field(const struct extent_state *, state) 1521fe573327SVasily Averin __field(unsigned long, mask) 152294c3f6c6SDavid Sterba __field(const void*, ip) 1523143bede5SJeff Mahoney ), 1524143bede5SJeff Mahoney 1525143bede5SJeff Mahoney TP_fast_assign( 1526143bede5SJeff Mahoney __entry->state = state, 1527fe573327SVasily Averin __entry->mask = (__force unsigned long)mask, 152894c3f6c6SDavid Sterba __entry->ip = (const void *)IP 1529143bede5SJeff Mahoney ), 1530143bede5SJeff Mahoney 1531562a7a07SDavid Sterba TP_printk("state=%p mask=%s caller=%pS", __entry->state, 153294c3f6c6SDavid Sterba show_gfp_flags(__entry->mask), __entry->ip) 1533143bede5SJeff Mahoney ); 1534143bede5SJeff Mahoney 1535143bede5SJeff Mahoney TRACE_EVENT(free_extent_state, 1536143bede5SJeff Mahoney 15379a35b637SJeff Mahoney TP_PROTO(const struct extent_state *state, unsigned long IP), 1538143bede5SJeff Mahoney 1539143bede5SJeff Mahoney TP_ARGS(state, IP), 1540143bede5SJeff Mahoney 1541143bede5SJeff Mahoney TP_STRUCT__entry( 15429a35b637SJeff Mahoney __field(const struct extent_state *, state) 154394c3f6c6SDavid Sterba __field(const void*, ip) 1544143bede5SJeff Mahoney ), 1545143bede5SJeff Mahoney 1546143bede5SJeff Mahoney TP_fast_assign( 1547143bede5SJeff Mahoney __entry->state = state, 154894c3f6c6SDavid Sterba __entry->ip = (const void *)IP 1549143bede5SJeff Mahoney ), 1550143bede5SJeff Mahoney 155194c3f6c6SDavid Sterba TP_printk("state=%p caller=%pS", __entry->state, __entry->ip) 1552143bede5SJeff Mahoney ); 1553143bede5SJeff Mahoney 155452483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work, 155552483bc2SQu Wenruo 15569a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 155752483bc2SQu Wenruo 155852483bc2SQu Wenruo TP_ARGS(work), 155952483bc2SQu Wenruo 1560bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15619a35b637SJeff Mahoney __field( const void *, work ) 15629a35b637SJeff Mahoney __field( const void *, wq ) 15639a35b637SJeff Mahoney __field( const void *, func ) 15649a35b637SJeff Mahoney __field( const void *, ordered_func ) 15659a35b637SJeff Mahoney __field( const void *, ordered_free ) 15669a35b637SJeff Mahoney __field( const void *, normal_work ) 156752483bc2SQu Wenruo ), 156852483bc2SQu Wenruo 1569bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_work_owner(work), 157052483bc2SQu Wenruo __entry->work = work; 157152483bc2SQu Wenruo __entry->wq = work->wq; 157252483bc2SQu Wenruo __entry->func = work->func; 157352483bc2SQu Wenruo __entry->ordered_func = work->ordered_func; 157452483bc2SQu Wenruo __entry->ordered_free = work->ordered_free; 1575b38a6258SLiu Bo __entry->normal_work = &work->normal_work; 157652483bc2SQu Wenruo ), 157752483bc2SQu Wenruo 1578d75f773cSSakari Ailus TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%ps ordered_func=%p " 1579b38a6258SLiu Bo "ordered_free=%p", 1580b38a6258SLiu Bo __entry->work, __entry->normal_work, __entry->wq, 1581b38a6258SLiu Bo __entry->func, __entry->ordered_func, __entry->ordered_free) 158252483bc2SQu Wenruo ); 158352483bc2SQu Wenruo 1584ac0c7cf8SDavid Sterba /* 1585c9eb55dbSOmar Sandoval * For situations when the work is freed, we pass fs_info and a tag that matches 1586c9eb55dbSOmar Sandoval * the address of the work structure so it can be paired with the scheduling 1587c9eb55dbSOmar Sandoval * event. DO NOT add anything here that dereferences wtag. 1588ac0c7cf8SDavid Sterba */ 158952483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work__done, 159052483bc2SQu Wenruo 15919a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), 159252483bc2SQu Wenruo 1593ac0c7cf8SDavid Sterba TP_ARGS(fs_info, wtag), 159452483bc2SQu Wenruo 1595bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15969a35b637SJeff Mahoney __field( const void *, wtag ) 159752483bc2SQu Wenruo ), 159852483bc2SQu Wenruo 1599ac0c7cf8SDavid Sterba TP_fast_assign_btrfs(fs_info, 1600ac0c7cf8SDavid Sterba __entry->wtag = wtag; 160152483bc2SQu Wenruo ), 160252483bc2SQu Wenruo 1603ac0c7cf8SDavid Sterba TP_printk_btrfs("work->%p", __entry->wtag) 160452483bc2SQu Wenruo ); 160552483bc2SQu Wenruo 160652483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_queued, 160752483bc2SQu Wenruo 16089a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 160952483bc2SQu Wenruo 161052483bc2SQu Wenruo TP_ARGS(work) 161152483bc2SQu Wenruo ); 161252483bc2SQu Wenruo 161352483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_sched, 161452483bc2SQu Wenruo 16159a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 161652483bc2SQu Wenruo 161752483bc2SQu Wenruo TP_ARGS(work) 161852483bc2SQu Wenruo ); 161952483bc2SQu Wenruo 162052483bc2SQu Wenruo DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, 162152483bc2SQu Wenruo 16229a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), 162352483bc2SQu Wenruo 1624ac0c7cf8SDavid Sterba TP_ARGS(fs_info, wtag) 162552483bc2SQu Wenruo ); 162652483bc2SQu Wenruo 162752483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_ordered_sched, 162852483bc2SQu Wenruo 16299a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 163052483bc2SQu Wenruo 163152483bc2SQu Wenruo TP_ARGS(work) 163252483bc2SQu Wenruo ); 163352483bc2SQu Wenruo 1634a31b4a43SChristoph Hellwig DECLARE_EVENT_CLASS(btrfs_workqueue, 1635c3a46891SQu Wenruo 1636a31b4a43SChristoph Hellwig TP_PROTO(const struct btrfs_workqueue *wq, const char *name), 1637c3a46891SQu Wenruo 1638a31b4a43SChristoph Hellwig TP_ARGS(wq, name), 1639c3a46891SQu Wenruo 1640bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 16419a35b637SJeff Mahoney __field( const void *, wq ) 1642c3a46891SQu Wenruo __string( name, name ) 1643c3a46891SQu Wenruo ), 1644c3a46891SQu Wenruo 1645bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1646c3a46891SQu Wenruo __entry->wq = wq; 1647c3a46891SQu Wenruo __assign_str(name, name); 1648c3a46891SQu Wenruo ), 1649c3a46891SQu Wenruo 1650a31b4a43SChristoph Hellwig TP_printk_btrfs("name=%s wq=%p", __get_str(name), 1651c3a46891SQu Wenruo __entry->wq) 1652c3a46891SQu Wenruo ); 1653c3a46891SQu Wenruo 1654a31b4a43SChristoph Hellwig DEFINE_EVENT(btrfs_workqueue, btrfs_workqueue_alloc, 1655c3a46891SQu Wenruo 1656a31b4a43SChristoph Hellwig TP_PROTO(const struct btrfs_workqueue *wq, const char *name), 1657c3a46891SQu Wenruo 1658a31b4a43SChristoph Hellwig TP_ARGS(wq, name) 1659c3a46891SQu Wenruo ); 1660c3a46891SQu Wenruo 1661a31b4a43SChristoph Hellwig DECLARE_EVENT_CLASS(btrfs_workqueue_done, 1662c3a46891SQu Wenruo 1663a31b4a43SChristoph Hellwig TP_PROTO(const struct btrfs_workqueue *wq), 1664c3a46891SQu Wenruo 1665c3a46891SQu Wenruo TP_ARGS(wq), 1666c3a46891SQu Wenruo 1667bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 16689a35b637SJeff Mahoney __field( const void *, wq ) 1669c3a46891SQu Wenruo ), 1670c3a46891SQu Wenruo 1671bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1672c3a46891SQu Wenruo __entry->wq = wq; 1673c3a46891SQu Wenruo ), 1674c3a46891SQu Wenruo 1675bc074524SJeff Mahoney TP_printk_btrfs("wq=%p", __entry->wq) 1676c3a46891SQu Wenruo ); 1677c3a46891SQu Wenruo 1678a31b4a43SChristoph Hellwig DEFINE_EVENT(btrfs_workqueue_done, btrfs_workqueue_destroy, 1679c3a46891SQu Wenruo 1680a31b4a43SChristoph Hellwig TP_PROTO(const struct btrfs_workqueue *wq), 1681c3a46891SQu Wenruo 1682c3a46891SQu Wenruo TP_ARGS(wq) 1683c3a46891SQu Wenruo ); 168452483bc2SQu Wenruo 168581fb6f77SQu Wenruo #define BTRFS_QGROUP_OPERATIONS \ 168681fb6f77SQu Wenruo { QGROUP_RESERVE, "reserve" }, \ 168781fb6f77SQu Wenruo { QGROUP_RELEASE, "release" }, \ 168881fb6f77SQu Wenruo { QGROUP_FREE, "free" } 168981fb6f77SQu Wenruo 169081fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_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 1697bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 169881fb6f77SQu Wenruo __field( u64, rootid ) 1699f8f8e189SDavid Sterba __field( u64, ino ) 170081fb6f77SQu Wenruo __field( u64, start ) 170181fb6f77SQu Wenruo __field( u64, len ) 170281fb6f77SQu Wenruo __field( u64, reserved ) 170381fb6f77SQu Wenruo __field( int, op ) 170481fb6f77SQu Wenruo ), 170581fb6f77SQu Wenruo 1706bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 17074fd786e6SMisono Tomohiro __entry->rootid = 17084fd786e6SMisono Tomohiro BTRFS_I(inode)->root->root_key.objectid; 1709f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 171081fb6f77SQu Wenruo __entry->start = start; 171181fb6f77SQu Wenruo __entry->len = len; 171281fb6f77SQu Wenruo __entry->reserved = reserved; 171381fb6f77SQu Wenruo __entry->op = op; 171481fb6f77SQu Wenruo ), 171581fb6f77SQu Wenruo 1716f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu ino=%llu start=%llu len=%llu reserved=%llu op=%s", 171781fb6f77SQu Wenruo __entry->rootid, __entry->ino, __entry->start, __entry->len, 171881fb6f77SQu Wenruo __entry->reserved, 171981fb6f77SQu Wenruo __print_flags((unsigned long)__entry->op, "", 172081fb6f77SQu Wenruo BTRFS_QGROUP_OPERATIONS) 172181fb6f77SQu Wenruo ) 172281fb6f77SQu Wenruo ); 172381fb6f77SQu Wenruo 172481fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data, 172581fb6f77SQu Wenruo 17269a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 17279a35b637SJeff Mahoney u64 reserved, int op), 172881fb6f77SQu Wenruo 172981fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 173081fb6f77SQu Wenruo ); 173181fb6f77SQu Wenruo 173281fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data, 173381fb6f77SQu Wenruo 17349a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 17359a35b637SJeff Mahoney u64 reserved, int op), 173681fb6f77SQu Wenruo 173781fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 173881fb6f77SQu Wenruo ); 173981fb6f77SQu Wenruo 17400f5dcf8dSMark Fasheh DECLARE_EVENT_CLASS(btrfs_qgroup_extent, 17419a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 17429a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 17430f5dcf8dSMark Fasheh 1744bc074524SJeff Mahoney TP_ARGS(fs_info, rec), 17450f5dcf8dSMark Fasheh 1746bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 17470f5dcf8dSMark Fasheh __field( u64, bytenr ) 17480f5dcf8dSMark Fasheh __field( u64, num_bytes ) 17490f5dcf8dSMark Fasheh ), 17500f5dcf8dSMark Fasheh 1751bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 17520f5dcf8dSMark Fasheh __entry->bytenr = rec->bytenr, 17530f5dcf8dSMark Fasheh __entry->num_bytes = rec->num_bytes; 17540f5dcf8dSMark Fasheh ), 17550f5dcf8dSMark Fasheh 1756562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu", 175794c3f6c6SDavid Sterba __entry->bytenr, __entry->num_bytes) 17580f5dcf8dSMark Fasheh ); 17590f5dcf8dSMark Fasheh 17600f5dcf8dSMark Fasheh DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, 17610f5dcf8dSMark Fasheh 17629a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 17639a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 17640f5dcf8dSMark Fasheh 1765bc074524SJeff Mahoney TP_ARGS(fs_info, rec) 17660f5dcf8dSMark Fasheh ); 17670f5dcf8dSMark Fasheh 176850b3e040SQu Wenruo DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent, 17690f5dcf8dSMark Fasheh 17709a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 17719a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 17720f5dcf8dSMark Fasheh 1773bc074524SJeff Mahoney TP_ARGS(fs_info, rec) 17740f5dcf8dSMark Fasheh ); 17750f5dcf8dSMark Fasheh 1776c337e7b0SQu Wenruo TRACE_EVENT(qgroup_num_dirty_extents, 1777c337e7b0SQu Wenruo 1778c337e7b0SQu Wenruo TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, 1779c337e7b0SQu Wenruo u64 num_dirty_extents), 1780c337e7b0SQu Wenruo 1781c337e7b0SQu Wenruo TP_ARGS(fs_info, transid, num_dirty_extents), 1782c337e7b0SQu Wenruo 1783c337e7b0SQu Wenruo TP_STRUCT__entry_btrfs( 1784c337e7b0SQu Wenruo __field( u64, transid ) 1785c337e7b0SQu Wenruo __field( u64, num_dirty_extents ) 1786c337e7b0SQu Wenruo ), 1787c337e7b0SQu Wenruo 1788c337e7b0SQu Wenruo TP_fast_assign_btrfs(fs_info, 1789c337e7b0SQu Wenruo __entry->transid = transid; 1790c337e7b0SQu Wenruo __entry->num_dirty_extents = num_dirty_extents; 1791c337e7b0SQu Wenruo ), 1792c337e7b0SQu Wenruo 1793c337e7b0SQu Wenruo TP_printk_btrfs("transid=%llu num_dirty_extents=%llu", 1794c337e7b0SQu Wenruo __entry->transid, __entry->num_dirty_extents) 1795c337e7b0SQu Wenruo ); 1796c337e7b0SQu Wenruo 17970f5dcf8dSMark Fasheh TRACE_EVENT(btrfs_qgroup_account_extent, 17980f5dcf8dSMark Fasheh 1799c9f6f3cdSQu Wenruo TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, u64 bytenr, 1800bc074524SJeff Mahoney u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), 18010f5dcf8dSMark Fasheh 1802c9f6f3cdSQu Wenruo TP_ARGS(fs_info, transid, bytenr, num_bytes, nr_old_roots, 1803c9f6f3cdSQu Wenruo nr_new_roots), 18040f5dcf8dSMark Fasheh 1805bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1806c9f6f3cdSQu Wenruo __field( u64, transid ) 18070f5dcf8dSMark Fasheh __field( u64, bytenr ) 18080f5dcf8dSMark Fasheh __field( u64, num_bytes ) 18090f5dcf8dSMark Fasheh __field( u64, nr_old_roots ) 18100f5dcf8dSMark Fasheh __field( u64, nr_new_roots ) 18110f5dcf8dSMark Fasheh ), 18120f5dcf8dSMark Fasheh 1813bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 1814c9f6f3cdSQu Wenruo __entry->transid = transid; 18150f5dcf8dSMark Fasheh __entry->bytenr = bytenr; 18160f5dcf8dSMark Fasheh __entry->num_bytes = num_bytes; 18170f5dcf8dSMark Fasheh __entry->nr_old_roots = nr_old_roots; 18180f5dcf8dSMark Fasheh __entry->nr_new_roots = nr_new_roots; 18190f5dcf8dSMark Fasheh ), 18200f5dcf8dSMark Fasheh 1821c9f6f3cdSQu Wenruo TP_printk_btrfs( 1822c9f6f3cdSQu Wenruo "transid=%llu bytenr=%llu num_bytes=%llu nr_old_roots=%llu nr_new_roots=%llu", 1823c9f6f3cdSQu Wenruo __entry->transid, 18240f5dcf8dSMark Fasheh __entry->bytenr, 18250f5dcf8dSMark Fasheh __entry->num_bytes, 18260f5dcf8dSMark Fasheh __entry->nr_old_roots, 18270f5dcf8dSMark Fasheh __entry->nr_new_roots) 18280f5dcf8dSMark Fasheh ); 18290f5dcf8dSMark Fasheh 18300f5dcf8dSMark Fasheh TRACE_EVENT(qgroup_update_counters, 18310f5dcf8dSMark Fasheh 18328b317901SQu Wenruo TP_PROTO(const struct btrfs_fs_info *fs_info, 18331d2e7c7cSDavid Sterba const struct btrfs_qgroup *qgroup, 1834bc074524SJeff Mahoney u64 cur_old_count, u64 cur_new_count), 18350f5dcf8dSMark Fasheh 18368b317901SQu Wenruo TP_ARGS(fs_info, qgroup, cur_old_count, cur_new_count), 18370f5dcf8dSMark Fasheh 1838bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 18390f5dcf8dSMark Fasheh __field( u64, qgid ) 18408b317901SQu Wenruo __field( u64, old_rfer ) 18418b317901SQu Wenruo __field( u64, old_excl ) 18420f5dcf8dSMark Fasheh __field( u64, cur_old_count ) 18430f5dcf8dSMark Fasheh __field( u64, cur_new_count ) 18440f5dcf8dSMark Fasheh ), 18450f5dcf8dSMark Fasheh 1846bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 18478b317901SQu Wenruo __entry->qgid = qgroup->qgroupid; 18488b317901SQu Wenruo __entry->old_rfer = qgroup->rfer; 18498b317901SQu Wenruo __entry->old_excl = qgroup->excl; 18500f5dcf8dSMark Fasheh __entry->cur_old_count = cur_old_count; 18510f5dcf8dSMark Fasheh __entry->cur_new_count = cur_new_count; 18520f5dcf8dSMark Fasheh ), 18530f5dcf8dSMark Fasheh 18548b317901SQu Wenruo TP_printk_btrfs("qgid=%llu old_rfer=%llu old_excl=%llu cur_old_count=%llu cur_new_count=%llu", 18558b317901SQu Wenruo __entry->qgid, __entry->old_rfer, __entry->old_excl, 18568b317901SQu Wenruo __entry->cur_old_count, __entry->cur_new_count) 18570f5dcf8dSMark Fasheh ); 18580f5dcf8dSMark Fasheh 18593159fe7bSQu Wenruo TRACE_EVENT(qgroup_update_reserve, 18603159fe7bSQu Wenruo 18613159fe7bSQu Wenruo TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup, 186264ee4e75SQu Wenruo s64 diff, int type), 18633159fe7bSQu Wenruo 186464ee4e75SQu Wenruo TP_ARGS(fs_info, qgroup, diff, type), 18653159fe7bSQu Wenruo 18663159fe7bSQu Wenruo TP_STRUCT__entry_btrfs( 18673159fe7bSQu Wenruo __field( u64, qgid ) 18683159fe7bSQu Wenruo __field( u64, cur_reserved ) 18693159fe7bSQu Wenruo __field( s64, diff ) 187064ee4e75SQu Wenruo __field( int, type ) 18713159fe7bSQu Wenruo ), 18723159fe7bSQu Wenruo 18733159fe7bSQu Wenruo TP_fast_assign_btrfs(fs_info, 18743159fe7bSQu Wenruo __entry->qgid = qgroup->qgroupid; 187564ee4e75SQu Wenruo __entry->cur_reserved = qgroup->rsv.values[type]; 18763159fe7bSQu Wenruo __entry->diff = diff; 18771b2442b4SQu Wenruo __entry->type = type; 18783159fe7bSQu Wenruo ), 18793159fe7bSQu Wenruo 188064ee4e75SQu Wenruo TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld", 18811cb1f0b2SNikolay Borisov __entry->qgid, __print_symbolic(__entry->type, QGROUP_RSV_TYPES), 188264ee4e75SQu Wenruo __entry->cur_reserved, __entry->diff) 18833159fe7bSQu Wenruo ); 18843159fe7bSQu Wenruo 18853159fe7bSQu Wenruo TRACE_EVENT(qgroup_meta_reserve, 18863159fe7bSQu Wenruo 18874ee0d883SQu Wenruo TP_PROTO(struct btrfs_root *root, s64 diff, int type), 18883159fe7bSQu Wenruo 18894ee0d883SQu Wenruo TP_ARGS(root, diff, type), 18903159fe7bSQu Wenruo 18913159fe7bSQu Wenruo TP_STRUCT__entry_btrfs( 18923159fe7bSQu Wenruo __field( u64, refroot ) 18933159fe7bSQu Wenruo __field( s64, diff ) 18944ee0d883SQu Wenruo __field( int, type ) 18953159fe7bSQu Wenruo ), 18963159fe7bSQu Wenruo 18973159fe7bSQu Wenruo TP_fast_assign_btrfs(root->fs_info, 18984fd786e6SMisono Tomohiro __entry->refroot = root->root_key.objectid; 18993159fe7bSQu Wenruo __entry->diff = diff; 19001b2442b4SQu Wenruo __entry->type = type; 19013159fe7bSQu Wenruo ), 19023159fe7bSQu Wenruo 19034ee0d883SQu Wenruo TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", 19044ee0d883SQu Wenruo show_root_type(__entry->refroot), 19051cb1f0b2SNikolay Borisov __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) 19064ee0d883SQu Wenruo ); 19074ee0d883SQu Wenruo 19084ee0d883SQu Wenruo TRACE_EVENT(qgroup_meta_convert, 19094ee0d883SQu Wenruo 19104ee0d883SQu Wenruo TP_PROTO(struct btrfs_root *root, s64 diff), 19114ee0d883SQu Wenruo 19124ee0d883SQu Wenruo TP_ARGS(root, diff), 19134ee0d883SQu Wenruo 19144ee0d883SQu Wenruo TP_STRUCT__entry_btrfs( 19154ee0d883SQu Wenruo __field( u64, refroot ) 19164ee0d883SQu Wenruo __field( s64, diff ) 19174ee0d883SQu Wenruo ), 19184ee0d883SQu Wenruo 19194ee0d883SQu Wenruo TP_fast_assign_btrfs(root->fs_info, 19204fd786e6SMisono Tomohiro __entry->refroot = root->root_key.objectid; 19214ee0d883SQu Wenruo __entry->diff = diff; 19224ee0d883SQu Wenruo ), 19234ee0d883SQu Wenruo 19244ee0d883SQu Wenruo TP_printk_btrfs("refroot=%llu(%s) type=%s->%s diff=%lld", 19254ee0d883SQu Wenruo show_root_type(__entry->refroot), 19261cb1f0b2SNikolay Borisov __print_symbolic(BTRFS_QGROUP_RSV_META_PREALLOC, QGROUP_RSV_TYPES), 19271cb1f0b2SNikolay Borisov __print_symbolic(BTRFS_QGROUP_RSV_META_PERTRANS, QGROUP_RSV_TYPES), 19284ee0d883SQu Wenruo __entry->diff) 19294ee0d883SQu Wenruo ); 19304ee0d883SQu Wenruo 19314ee0d883SQu Wenruo TRACE_EVENT(qgroup_meta_free_all_pertrans, 19324ee0d883SQu Wenruo 19334ee0d883SQu Wenruo TP_PROTO(struct btrfs_root *root), 19344ee0d883SQu Wenruo 19354ee0d883SQu Wenruo TP_ARGS(root), 19364ee0d883SQu Wenruo 19374ee0d883SQu Wenruo TP_STRUCT__entry_btrfs( 19384ee0d883SQu Wenruo __field( u64, refroot ) 19394ee0d883SQu Wenruo __field( s64, diff ) 19404ee0d883SQu Wenruo __field( int, type ) 19414ee0d883SQu Wenruo ), 19424ee0d883SQu Wenruo 19434ee0d883SQu Wenruo TP_fast_assign_btrfs(root->fs_info, 19444fd786e6SMisono Tomohiro __entry->refroot = root->root_key.objectid; 19454ee0d883SQu Wenruo spin_lock(&root->qgroup_meta_rsv_lock); 19464ee0d883SQu Wenruo __entry->diff = -(s64)root->qgroup_meta_rsv_pertrans; 19474ee0d883SQu Wenruo spin_unlock(&root->qgroup_meta_rsv_lock); 19484ee0d883SQu Wenruo __entry->type = BTRFS_QGROUP_RSV_META_PERTRANS; 19494ee0d883SQu Wenruo ), 19504ee0d883SQu Wenruo 19514ee0d883SQu Wenruo TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", 19524ee0d883SQu Wenruo show_root_type(__entry->refroot), 19531cb1f0b2SNikolay Borisov __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) 19543159fe7bSQu Wenruo ); 19553159fe7bSQu Wenruo 195600142756SJeff Mahoney DECLARE_EVENT_CLASS(btrfs__prelim_ref, 195700142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 195800142756SJeff Mahoney const struct prelim_ref *oldref, 195900142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 196000142756SJeff Mahoney TP_ARGS(fs_info, newref, oldref, tree_size), 196100142756SJeff Mahoney 196200142756SJeff Mahoney TP_STRUCT__entry_btrfs( 196300142756SJeff Mahoney __field( u64, root_id ) 196400142756SJeff Mahoney __field( u64, objectid ) 196500142756SJeff Mahoney __field( u8, type ) 196600142756SJeff Mahoney __field( u64, offset ) 196700142756SJeff Mahoney __field( int, level ) 196800142756SJeff Mahoney __field( int, old_count ) 196900142756SJeff Mahoney __field( u64, parent ) 197000142756SJeff Mahoney __field( u64, bytenr ) 197100142756SJeff Mahoney __field( int, mod_count ) 197200142756SJeff Mahoney __field( u64, tree_size ) 197300142756SJeff Mahoney ), 197400142756SJeff Mahoney 197500142756SJeff Mahoney TP_fast_assign_btrfs(fs_info, 197600142756SJeff Mahoney __entry->root_id = oldref->root_id; 197700142756SJeff Mahoney __entry->objectid = oldref->key_for_search.objectid; 197800142756SJeff Mahoney __entry->type = oldref->key_for_search.type; 197900142756SJeff Mahoney __entry->offset = oldref->key_for_search.offset; 198000142756SJeff Mahoney __entry->level = oldref->level; 198100142756SJeff Mahoney __entry->old_count = oldref->count; 198200142756SJeff Mahoney __entry->parent = oldref->parent; 198300142756SJeff Mahoney __entry->bytenr = oldref->wanted_disk_byte; 198400142756SJeff Mahoney __entry->mod_count = newref ? newref->count : 0; 198500142756SJeff Mahoney __entry->tree_size = tree_size; 198600142756SJeff Mahoney ), 198700142756SJeff Mahoney 198800142756SJeff 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", 19898eec8463SDavid Sterba __entry->root_id, 19908eec8463SDavid Sterba __entry->objectid, __entry->type, 19918eec8463SDavid Sterba __entry->offset, __entry->level, 199200142756SJeff Mahoney __entry->old_count, __entry->mod_count, 199300142756SJeff Mahoney __entry->old_count + __entry->mod_count, 19948eec8463SDavid Sterba __entry->parent, 19958eec8463SDavid Sterba __entry->bytenr, 19968eec8463SDavid Sterba __entry->tree_size) 199700142756SJeff Mahoney ); 199800142756SJeff Mahoney 199900142756SJeff Mahoney DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge, 200000142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 200100142756SJeff Mahoney const struct prelim_ref *oldref, 200200142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 200300142756SJeff Mahoney TP_ARGS(fs_info, oldref, newref, tree_size) 200400142756SJeff Mahoney ); 200500142756SJeff Mahoney 200600142756SJeff Mahoney DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert, 200700142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 200800142756SJeff Mahoney const struct prelim_ref *oldref, 200900142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 201000142756SJeff Mahoney TP_ARGS(fs_info, oldref, newref, tree_size) 201100142756SJeff Mahoney ); 201200142756SJeff Mahoney 2013dd48d407SJosef Bacik TRACE_EVENT(btrfs_inode_mod_outstanding_extents, 20141d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_root *root, u64 ino, int mod), 2015dd48d407SJosef Bacik 2016dd48d407SJosef Bacik TP_ARGS(root, ino, mod), 2017dd48d407SJosef Bacik 2018dd48d407SJosef Bacik TP_STRUCT__entry_btrfs( 2019dd48d407SJosef Bacik __field( u64, root_objectid ) 2020dd48d407SJosef Bacik __field( u64, ino ) 2021dd48d407SJosef Bacik __field( int, mod ) 2022dd48d407SJosef Bacik ), 2023dd48d407SJosef Bacik 2024dd48d407SJosef Bacik TP_fast_assign_btrfs(root->fs_info, 20254fd786e6SMisono Tomohiro __entry->root_objectid = root->root_key.objectid; 2026dd48d407SJosef Bacik __entry->ino = ino; 2027dd48d407SJosef Bacik __entry->mod = mod; 2028dd48d407SJosef Bacik ), 2029dd48d407SJosef Bacik 2030dd48d407SJosef Bacik TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d", 2031dd48d407SJosef Bacik show_root_type(__entry->root_objectid), 20328eec8463SDavid Sterba __entry->ino, __entry->mod) 2033dd48d407SJosef Bacik ); 20343dca5c94SQu Wenruo 20354ed0a7a3SQu Wenruo DECLARE_EVENT_CLASS(btrfs__block_group, 203632da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 20374ed0a7a3SQu Wenruo 20384ed0a7a3SQu Wenruo TP_ARGS(bg_cache), 20394ed0a7a3SQu Wenruo 20404ed0a7a3SQu Wenruo TP_STRUCT__entry_btrfs( 20414ed0a7a3SQu Wenruo __field( u64, bytenr ) 20424ed0a7a3SQu Wenruo __field( u64, len ) 20434ed0a7a3SQu Wenruo __field( u64, used ) 20444ed0a7a3SQu Wenruo __field( u64, flags ) 20454ed0a7a3SQu Wenruo ), 20464ed0a7a3SQu Wenruo 20474ed0a7a3SQu Wenruo TP_fast_assign_btrfs(bg_cache->fs_info, 2048b3470b5dSDavid Sterba __entry->bytenr = bg_cache->start, 2049b3470b5dSDavid Sterba __entry->len = bg_cache->length, 2050bf38be65SDavid Sterba __entry->used = bg_cache->used; 20514ed0a7a3SQu Wenruo __entry->flags = bg_cache->flags; 20524ed0a7a3SQu Wenruo ), 20534ed0a7a3SQu Wenruo 20544ed0a7a3SQu Wenruo TP_printk_btrfs("bg bytenr=%llu len=%llu used=%llu flags=%llu(%s)", 20554ed0a7a3SQu Wenruo __entry->bytenr, __entry->len, __entry->used, __entry->flags, 20564ed0a7a3SQu Wenruo __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS)) 20574ed0a7a3SQu Wenruo ); 20584ed0a7a3SQu Wenruo 20594ed0a7a3SQu Wenruo DEFINE_EVENT(btrfs__block_group, btrfs_remove_block_group, 206032da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 20614ed0a7a3SQu Wenruo 20624ed0a7a3SQu Wenruo TP_ARGS(bg_cache) 20634ed0a7a3SQu Wenruo ); 20644ed0a7a3SQu Wenruo 20654ed0a7a3SQu Wenruo DEFINE_EVENT(btrfs__block_group, btrfs_add_unused_block_group, 206632da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 20674ed0a7a3SQu Wenruo 20684ed0a7a3SQu Wenruo TP_ARGS(bg_cache) 20694ed0a7a3SQu Wenruo ); 20704ed0a7a3SQu Wenruo 207118bb8bbfSJohannes Thumshirn DEFINE_EVENT(btrfs__block_group, btrfs_add_reclaim_block_group, 207218bb8bbfSJohannes Thumshirn TP_PROTO(const struct btrfs_block_group *bg_cache), 207318bb8bbfSJohannes Thumshirn 207418bb8bbfSJohannes Thumshirn TP_ARGS(bg_cache) 207518bb8bbfSJohannes Thumshirn ); 207618bb8bbfSJohannes Thumshirn 207718bb8bbfSJohannes Thumshirn DEFINE_EVENT(btrfs__block_group, btrfs_reclaim_block_group, 207818bb8bbfSJohannes Thumshirn TP_PROTO(const struct btrfs_block_group *bg_cache), 207918bb8bbfSJohannes Thumshirn 208018bb8bbfSJohannes Thumshirn TP_ARGS(bg_cache) 208118bb8bbfSJohannes Thumshirn ); 208218bb8bbfSJohannes Thumshirn 20834ed0a7a3SQu Wenruo DEFINE_EVENT(btrfs__block_group, btrfs_skip_unused_block_group, 208432da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 20854ed0a7a3SQu Wenruo 20864ed0a7a3SQu Wenruo TP_ARGS(bg_cache) 20874ed0a7a3SQu Wenruo ); 20884ed0a7a3SQu Wenruo 2089a1d19847SQu Wenruo TRACE_EVENT(btrfs_set_extent_bit, 2090a1d19847SQu Wenruo TP_PROTO(const struct extent_io_tree *tree, 2091a1d19847SQu Wenruo u64 start, u64 len, unsigned set_bits), 2092a1d19847SQu Wenruo 2093a1d19847SQu Wenruo TP_ARGS(tree, start, len, set_bits), 2094a1d19847SQu Wenruo 2095a1d19847SQu Wenruo TP_STRUCT__entry_btrfs( 2096a1d19847SQu Wenruo __field( unsigned, owner ) 2097a1d19847SQu Wenruo __field( u64, ino ) 2098a1d19847SQu Wenruo __field( u64, rootid ) 2099a1d19847SQu Wenruo __field( u64, start ) 2100a1d19847SQu Wenruo __field( u64, len ) 2101a1d19847SQu Wenruo __field( unsigned, set_bits) 2102a1d19847SQu Wenruo ), 2103a1d19847SQu Wenruo 2104a1d19847SQu Wenruo TP_fast_assign_btrfs(tree->fs_info, 2105a1d19847SQu Wenruo __entry->owner = tree->owner; 21060988fc7bSDavid Sterba if (tree->inode) { 21070988fc7bSDavid Sterba const struct btrfs_inode *inode = tree->inode; 2108a1d19847SQu Wenruo 21090988fc7bSDavid Sterba __entry->ino = btrfs_ino(inode); 21100988fc7bSDavid Sterba __entry->rootid = inode->root->root_key.objectid; 2111a1d19847SQu Wenruo } else { 2112a1d19847SQu Wenruo __entry->ino = 0; 2113a1d19847SQu Wenruo __entry->rootid = 0; 2114a1d19847SQu Wenruo } 2115a1d19847SQu Wenruo __entry->start = start; 2116a1d19847SQu Wenruo __entry->len = len; 2117a1d19847SQu Wenruo __entry->set_bits = set_bits; 2118a1d19847SQu Wenruo ), 2119a1d19847SQu Wenruo 2120a1d19847SQu Wenruo TP_printk_btrfs( 2121a1d19847SQu Wenruo "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s", 2122c92bb304SNikolay Borisov __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, 2123a1d19847SQu Wenruo __entry->rootid, __entry->start, __entry->len, 2124a1d19847SQu Wenruo __print_flags(__entry->set_bits, "|", EXTENT_FLAGS)) 2125a1d19847SQu Wenruo ); 2126a1d19847SQu Wenruo 2127a1d19847SQu Wenruo TRACE_EVENT(btrfs_clear_extent_bit, 2128a1d19847SQu Wenruo TP_PROTO(const struct extent_io_tree *tree, 2129a1d19847SQu Wenruo u64 start, u64 len, unsigned clear_bits), 2130a1d19847SQu Wenruo 2131a1d19847SQu Wenruo TP_ARGS(tree, start, len, clear_bits), 2132a1d19847SQu Wenruo 2133a1d19847SQu Wenruo TP_STRUCT__entry_btrfs( 2134a1d19847SQu Wenruo __field( unsigned, owner ) 2135a1d19847SQu Wenruo __field( u64, ino ) 2136a1d19847SQu Wenruo __field( u64, rootid ) 2137a1d19847SQu Wenruo __field( u64, start ) 2138a1d19847SQu Wenruo __field( u64, len ) 2139a1d19847SQu Wenruo __field( unsigned, clear_bits) 2140a1d19847SQu Wenruo ), 2141a1d19847SQu Wenruo 2142a1d19847SQu Wenruo TP_fast_assign_btrfs(tree->fs_info, 2143a1d19847SQu Wenruo __entry->owner = tree->owner; 21440988fc7bSDavid Sterba if (tree->inode) { 21450988fc7bSDavid Sterba const struct btrfs_inode *inode = tree->inode; 2146a1d19847SQu Wenruo 21470988fc7bSDavid Sterba __entry->ino = btrfs_ino(inode); 21480988fc7bSDavid Sterba __entry->rootid = inode->root->root_key.objectid; 2149a1d19847SQu Wenruo } else { 2150a1d19847SQu Wenruo __entry->ino = 0; 2151a1d19847SQu Wenruo __entry->rootid = 0; 2152a1d19847SQu Wenruo } 2153a1d19847SQu Wenruo __entry->start = start; 2154a1d19847SQu Wenruo __entry->len = len; 2155a1d19847SQu Wenruo __entry->clear_bits = clear_bits; 2156a1d19847SQu Wenruo ), 2157a1d19847SQu Wenruo 2158a1d19847SQu Wenruo TP_printk_btrfs( 2159a1d19847SQu Wenruo "io_tree=%s ino=%llu root=%llu start=%llu len=%llu clear_bits=%s", 2160c92bb304SNikolay Borisov __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, 2161a1d19847SQu Wenruo __entry->rootid, __entry->start, __entry->len, 2162a1d19847SQu Wenruo __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS)) 2163a1d19847SQu Wenruo ); 2164a1d19847SQu Wenruo 2165a1d19847SQu Wenruo TRACE_EVENT(btrfs_convert_extent_bit, 2166a1d19847SQu Wenruo TP_PROTO(const struct extent_io_tree *tree, 2167a1d19847SQu Wenruo u64 start, u64 len, unsigned set_bits, unsigned clear_bits), 2168a1d19847SQu Wenruo 2169a1d19847SQu Wenruo TP_ARGS(tree, start, len, set_bits, clear_bits), 2170a1d19847SQu Wenruo 2171a1d19847SQu Wenruo TP_STRUCT__entry_btrfs( 2172a1d19847SQu Wenruo __field( unsigned, owner ) 2173a1d19847SQu Wenruo __field( u64, ino ) 2174a1d19847SQu Wenruo __field( u64, rootid ) 2175a1d19847SQu Wenruo __field( u64, start ) 2176a1d19847SQu Wenruo __field( u64, len ) 2177a1d19847SQu Wenruo __field( unsigned, set_bits) 2178a1d19847SQu Wenruo __field( unsigned, clear_bits) 2179a1d19847SQu Wenruo ), 2180a1d19847SQu Wenruo 2181a1d19847SQu Wenruo TP_fast_assign_btrfs(tree->fs_info, 2182a1d19847SQu Wenruo __entry->owner = tree->owner; 21830988fc7bSDavid Sterba if (tree->inode) { 21840988fc7bSDavid Sterba const struct btrfs_inode *inode = tree->inode; 2185a1d19847SQu Wenruo 21860988fc7bSDavid Sterba __entry->ino = btrfs_ino(inode); 21870988fc7bSDavid Sterba __entry->rootid = inode->root->root_key.objectid; 2188a1d19847SQu Wenruo } else { 2189a1d19847SQu Wenruo __entry->ino = 0; 2190a1d19847SQu Wenruo __entry->rootid = 0; 2191a1d19847SQu Wenruo } 2192a1d19847SQu Wenruo __entry->start = start; 2193a1d19847SQu Wenruo __entry->len = len; 2194a1d19847SQu Wenruo __entry->set_bits = set_bits; 2195a1d19847SQu Wenruo __entry->clear_bits = clear_bits; 2196a1d19847SQu Wenruo ), 2197a1d19847SQu Wenruo 2198a1d19847SQu Wenruo TP_printk_btrfs( 2199a1d19847SQu Wenruo "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s clear_bits=%s", 2200c92bb304SNikolay Borisov __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, 2201a1d19847SQu Wenruo __entry->rootid, __entry->start, __entry->len, 2202a1d19847SQu Wenruo __print_flags(__entry->set_bits , "|", EXTENT_FLAGS), 2203a1d19847SQu Wenruo __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS)) 2204a1d19847SQu Wenruo ); 2205a1d19847SQu Wenruo 2206e5ad49e2SJosef Bacik DECLARE_EVENT_CLASS(btrfs_dump_space_info, 22078197766dSJosef Bacik TP_PROTO(struct btrfs_fs_info *fs_info, 2208e5ad49e2SJosef Bacik const struct btrfs_space_info *sinfo), 2209e5ad49e2SJosef Bacik 2210e5ad49e2SJosef Bacik TP_ARGS(fs_info, sinfo), 2211e5ad49e2SJosef Bacik 2212e5ad49e2SJosef Bacik TP_STRUCT__entry_btrfs( 2213e5ad49e2SJosef Bacik __field( u64, flags ) 2214e5ad49e2SJosef Bacik __field( u64, total_bytes ) 2215e5ad49e2SJosef Bacik __field( u64, bytes_used ) 2216e5ad49e2SJosef Bacik __field( u64, bytes_pinned ) 2217e5ad49e2SJosef Bacik __field( u64, bytes_reserved ) 2218e5ad49e2SJosef Bacik __field( u64, bytes_may_use ) 2219e5ad49e2SJosef Bacik __field( u64, bytes_readonly ) 2220e5ad49e2SJosef Bacik __field( u64, reclaim_size ) 2221e5ad49e2SJosef Bacik __field( int, clamp ) 2222e5ad49e2SJosef Bacik __field( u64, global_reserved ) 2223e5ad49e2SJosef Bacik __field( u64, trans_reserved ) 2224e5ad49e2SJosef Bacik __field( u64, delayed_refs_reserved ) 2225e5ad49e2SJosef Bacik __field( u64, delayed_reserved ) 2226e5ad49e2SJosef Bacik __field( u64, free_chunk_space ) 22278197766dSJosef Bacik __field( u64, delalloc_bytes ) 22288197766dSJosef Bacik __field( u64, ordered_bytes ) 2229e5ad49e2SJosef Bacik ), 2230e5ad49e2SJosef Bacik 2231e5ad49e2SJosef Bacik TP_fast_assign_btrfs(fs_info, 2232e5ad49e2SJosef Bacik __entry->flags = sinfo->flags; 2233e5ad49e2SJosef Bacik __entry->total_bytes = sinfo->total_bytes; 2234e5ad49e2SJosef Bacik __entry->bytes_used = sinfo->bytes_used; 2235e5ad49e2SJosef Bacik __entry->bytes_pinned = sinfo->bytes_pinned; 2236e5ad49e2SJosef Bacik __entry->bytes_reserved = sinfo->bytes_reserved; 2237e5ad49e2SJosef Bacik __entry->bytes_may_use = sinfo->bytes_may_use; 2238e5ad49e2SJosef Bacik __entry->bytes_readonly = sinfo->bytes_readonly; 2239e5ad49e2SJosef Bacik __entry->reclaim_size = sinfo->reclaim_size; 2240e5ad49e2SJosef Bacik __entry->clamp = sinfo->clamp; 2241e5ad49e2SJosef Bacik __entry->global_reserved = fs_info->global_block_rsv.reserved; 2242e5ad49e2SJosef Bacik __entry->trans_reserved = fs_info->trans_block_rsv.reserved; 2243e5ad49e2SJosef Bacik __entry->delayed_refs_reserved = fs_info->delayed_refs_rsv.reserved; 2244e5ad49e2SJosef Bacik __entry->delayed_reserved = fs_info->delayed_block_rsv.reserved; 2245e5ad49e2SJosef Bacik __entry->free_chunk_space = atomic64_read(&fs_info->free_chunk_space); 22468197766dSJosef Bacik __entry->delalloc_bytes = percpu_counter_sum_positive(&fs_info->delalloc_bytes); 22478197766dSJosef Bacik __entry->ordered_bytes = percpu_counter_sum_positive(&fs_info->ordered_bytes); 2248e5ad49e2SJosef Bacik ), 2249e5ad49e2SJosef Bacik 2250e5ad49e2SJosef Bacik TP_printk_btrfs("flags=%s total_bytes=%llu bytes_used=%llu " 2251e5ad49e2SJosef Bacik "bytes_pinned=%llu bytes_reserved=%llu " 2252e5ad49e2SJosef Bacik "bytes_may_use=%llu bytes_readonly=%llu " 2253e5ad49e2SJosef Bacik "reclaim_size=%llu clamp=%d global_reserved=%llu " 2254e5ad49e2SJosef Bacik "trans_reserved=%llu delayed_refs_reserved=%llu " 22558197766dSJosef Bacik "delayed_reserved=%llu chunk_free_space=%llu " 22568197766dSJosef Bacik "delalloc_bytes=%llu ordered_bytes=%llu", 2257e5ad49e2SJosef Bacik __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS), 2258e5ad49e2SJosef Bacik __entry->total_bytes, __entry->bytes_used, 2259e5ad49e2SJosef Bacik __entry->bytes_pinned, __entry->bytes_reserved, 2260e5ad49e2SJosef Bacik __entry->bytes_may_use, __entry->bytes_readonly, 2261e5ad49e2SJosef Bacik __entry->reclaim_size, __entry->clamp, 2262e5ad49e2SJosef Bacik __entry->global_reserved, __entry->trans_reserved, 2263e5ad49e2SJosef Bacik __entry->delayed_refs_reserved, 22648197766dSJosef Bacik __entry->delayed_reserved, __entry->free_chunk_space, 22658197766dSJosef Bacik __entry->delalloc_bytes, __entry->ordered_bytes) 2266e5ad49e2SJosef Bacik ); 2267e5ad49e2SJosef Bacik 2268e5ad49e2SJosef Bacik DEFINE_EVENT(btrfs_dump_space_info, btrfs_done_preemptive_reclaim, 22698197766dSJosef Bacik TP_PROTO(struct btrfs_fs_info *fs_info, 2270e5ad49e2SJosef Bacik const struct btrfs_space_info *sinfo), 2271e5ad49e2SJosef Bacik TP_ARGS(fs_info, sinfo) 2272e5ad49e2SJosef Bacik ); 2273e5ad49e2SJosef Bacik 2274fcdef39cSJosef Bacik DEFINE_EVENT(btrfs_dump_space_info, btrfs_fail_all_tickets, 2275fcdef39cSJosef Bacik TP_PROTO(struct btrfs_fs_info *fs_info, 2276fcdef39cSJosef Bacik const struct btrfs_space_info *sinfo), 2277fcdef39cSJosef Bacik TP_ARGS(fs_info, sinfo) 2278fcdef39cSJosef Bacik ); 2279fcdef39cSJosef Bacik 2280ac1ea10eSJosef Bacik TRACE_EVENT(btrfs_reserve_ticket, 2281ac1ea10eSJosef Bacik TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, 2282ac1ea10eSJosef Bacik u64 start_ns, int flush, int error), 2283ac1ea10eSJosef Bacik 2284ac1ea10eSJosef Bacik TP_ARGS(fs_info, flags, bytes, start_ns, flush, error), 2285ac1ea10eSJosef Bacik 2286ac1ea10eSJosef Bacik TP_STRUCT__entry_btrfs( 2287ac1ea10eSJosef Bacik __field( u64, flags ) 2288ac1ea10eSJosef Bacik __field( u64, bytes ) 2289ac1ea10eSJosef Bacik __field( u64, start_ns ) 2290ac1ea10eSJosef Bacik __field( int, flush ) 2291ac1ea10eSJosef Bacik __field( int, error ) 2292ac1ea10eSJosef Bacik ), 2293ac1ea10eSJosef Bacik 2294ac1ea10eSJosef Bacik TP_fast_assign_btrfs(fs_info, 2295ac1ea10eSJosef Bacik __entry->flags = flags; 2296ac1ea10eSJosef Bacik __entry->bytes = bytes; 2297ac1ea10eSJosef Bacik __entry->start_ns = start_ns; 2298ac1ea10eSJosef Bacik __entry->flush = flush; 2299ac1ea10eSJosef Bacik __entry->error = error; 2300ac1ea10eSJosef Bacik ), 2301ac1ea10eSJosef Bacik 2302ac1ea10eSJosef Bacik TP_printk_btrfs("flags=%s bytes=%llu start_ns=%llu flush=%s error=%d", 2303ac1ea10eSJosef Bacik __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS), 2304ac1ea10eSJosef Bacik __entry->bytes, __entry->start_ns, 2305ac1ea10eSJosef Bacik __print_symbolic(__entry->flush, FLUSH_ACTIONS), 2306ac1ea10eSJosef Bacik __entry->error) 2307ac1ea10eSJosef Bacik ); 2308ac1ea10eSJosef Bacik 230934e73cc9SQu Wenruo DECLARE_EVENT_CLASS(btrfs_sleep_tree_lock, 231034e73cc9SQu Wenruo TP_PROTO(const struct extent_buffer *eb, u64 start_ns), 231134e73cc9SQu Wenruo 231234e73cc9SQu Wenruo TP_ARGS(eb, start_ns), 231334e73cc9SQu Wenruo 231434e73cc9SQu Wenruo TP_STRUCT__entry_btrfs( 231534e73cc9SQu Wenruo __field( u64, block ) 231634e73cc9SQu Wenruo __field( u64, generation ) 231734e73cc9SQu Wenruo __field( u64, start_ns ) 231834e73cc9SQu Wenruo __field( u64, end_ns ) 231934e73cc9SQu Wenruo __field( u64, diff_ns ) 232034e73cc9SQu Wenruo __field( u64, owner ) 232134e73cc9SQu Wenruo __field( int, is_log_tree ) 232234e73cc9SQu Wenruo ), 232334e73cc9SQu Wenruo 232434e73cc9SQu Wenruo TP_fast_assign_btrfs(eb->fs_info, 232534e73cc9SQu Wenruo __entry->block = eb->start; 232634e73cc9SQu Wenruo __entry->generation = btrfs_header_generation(eb); 232734e73cc9SQu Wenruo __entry->start_ns = start_ns; 232834e73cc9SQu Wenruo __entry->end_ns = ktime_get_ns(); 232934e73cc9SQu Wenruo __entry->diff_ns = __entry->end_ns - start_ns; 233034e73cc9SQu Wenruo __entry->owner = btrfs_header_owner(eb); 233134e73cc9SQu Wenruo __entry->is_log_tree = (eb->log_index >= 0); 233234e73cc9SQu Wenruo ), 233334e73cc9SQu Wenruo 233434e73cc9SQu Wenruo TP_printk_btrfs( 233534e73cc9SQu Wenruo "block=%llu generation=%llu start_ns=%llu end_ns=%llu diff_ns=%llu owner=%llu is_log_tree=%d", 233634e73cc9SQu Wenruo __entry->block, __entry->generation, 233734e73cc9SQu Wenruo __entry->start_ns, __entry->end_ns, __entry->diff_ns, 233834e73cc9SQu Wenruo __entry->owner, __entry->is_log_tree) 233934e73cc9SQu Wenruo ); 234034e73cc9SQu Wenruo 234134e73cc9SQu Wenruo DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_read_lock, 234234e73cc9SQu Wenruo TP_PROTO(const struct extent_buffer *eb, u64 start_ns), 234334e73cc9SQu Wenruo 234434e73cc9SQu Wenruo TP_ARGS(eb, start_ns) 234534e73cc9SQu Wenruo ); 234634e73cc9SQu Wenruo 234734e73cc9SQu Wenruo DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_lock, 234834e73cc9SQu Wenruo TP_PROTO(const struct extent_buffer *eb, u64 start_ns), 234934e73cc9SQu Wenruo 235034e73cc9SQu Wenruo TP_ARGS(eb, start_ns) 235134e73cc9SQu Wenruo ); 235234e73cc9SQu Wenruo 235331aab402SQu Wenruo DECLARE_EVENT_CLASS(btrfs_locking_events, 235431aab402SQu Wenruo TP_PROTO(const struct extent_buffer *eb), 235531aab402SQu Wenruo 235631aab402SQu Wenruo TP_ARGS(eb), 235731aab402SQu Wenruo 235831aab402SQu Wenruo TP_STRUCT__entry_btrfs( 235931aab402SQu Wenruo __field( u64, block ) 236031aab402SQu Wenruo __field( u64, generation ) 236131aab402SQu Wenruo __field( u64, owner ) 236231aab402SQu Wenruo __field( int, is_log_tree ) 236331aab402SQu Wenruo ), 236431aab402SQu Wenruo 236531aab402SQu Wenruo TP_fast_assign_btrfs(eb->fs_info, 236631aab402SQu Wenruo __entry->block = eb->start; 236731aab402SQu Wenruo __entry->generation = btrfs_header_generation(eb); 236831aab402SQu Wenruo __entry->owner = btrfs_header_owner(eb); 236931aab402SQu Wenruo __entry->is_log_tree = (eb->log_index >= 0); 237031aab402SQu Wenruo ), 237131aab402SQu Wenruo 237231aab402SQu Wenruo TP_printk_btrfs("block=%llu generation=%llu owner=%llu is_log_tree=%d", 237331aab402SQu Wenruo __entry->block, __entry->generation, 237431aab402SQu Wenruo __entry->owner, __entry->is_log_tree) 237531aab402SQu Wenruo ); 237631aab402SQu Wenruo 237731aab402SQu Wenruo #define DEFINE_BTRFS_LOCK_EVENT(name) \ 237831aab402SQu Wenruo DEFINE_EVENT(btrfs_locking_events, name, \ 237931aab402SQu Wenruo TP_PROTO(const struct extent_buffer *eb), \ 238031aab402SQu Wenruo \ 238131aab402SQu Wenruo TP_ARGS(eb) \ 238231aab402SQu Wenruo ) 238331aab402SQu Wenruo 238431aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_unlock); 238531aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock); 238631aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock_blocking); 238731aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_read); 238831aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_write); 238931aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock); 239031aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock); 239131aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic); 239231aab402SQu Wenruo 2393480b9b4dSQu Wenruo DECLARE_EVENT_CLASS(btrfs__space_info_update, 2394480b9b4dSQu Wenruo 23951d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 23961d2e7c7cSDavid Sterba const struct btrfs_space_info *sinfo, u64 old, s64 diff), 2397480b9b4dSQu Wenruo 2398480b9b4dSQu Wenruo TP_ARGS(fs_info, sinfo, old, diff), 2399480b9b4dSQu Wenruo 2400480b9b4dSQu Wenruo TP_STRUCT__entry_btrfs( 2401480b9b4dSQu Wenruo __field( u64, type ) 2402480b9b4dSQu Wenruo __field( u64, old ) 2403480b9b4dSQu Wenruo __field( s64, diff ) 2404480b9b4dSQu Wenruo ), 2405480b9b4dSQu Wenruo 2406480b9b4dSQu Wenruo TP_fast_assign_btrfs(fs_info, 2407480b9b4dSQu Wenruo __entry->type = sinfo->flags; 2408480b9b4dSQu Wenruo __entry->old = old; 2409480b9b4dSQu Wenruo __entry->diff = diff; 2410480b9b4dSQu Wenruo ), 2411480b9b4dSQu Wenruo TP_printk_btrfs("type=%s old=%llu diff=%lld", 2412480b9b4dSQu Wenruo __print_flags(__entry->type, "|", BTRFS_GROUP_FLAGS), 2413480b9b4dSQu Wenruo __entry->old, __entry->diff) 2414480b9b4dSQu Wenruo ); 2415480b9b4dSQu Wenruo 2416480b9b4dSQu Wenruo DEFINE_EVENT(btrfs__space_info_update, update_bytes_may_use, 2417480b9b4dSQu Wenruo 24181d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 24191d2e7c7cSDavid Sterba const struct btrfs_space_info *sinfo, u64 old, s64 diff), 2420480b9b4dSQu Wenruo 2421480b9b4dSQu Wenruo TP_ARGS(fs_info, sinfo, old, diff) 2422480b9b4dSQu Wenruo ); 2423480b9b4dSQu Wenruo 2424480b9b4dSQu Wenruo DEFINE_EVENT(btrfs__space_info_update, update_bytes_pinned, 2425480b9b4dSQu Wenruo 24261d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 24271d2e7c7cSDavid Sterba const struct btrfs_space_info *sinfo, u64 old, s64 diff), 2428480b9b4dSQu Wenruo 2429480b9b4dSQu Wenruo TP_ARGS(fs_info, sinfo, old, diff) 2430480b9b4dSQu Wenruo ); 2431480b9b4dSQu Wenruo 2432b8bea09aSQu Wenruo DECLARE_EVENT_CLASS(btrfs_raid56_bio, 2433b8bea09aSQu Wenruo 2434b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2435b8bea09aSQu Wenruo const struct bio *bio, 2436b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2437b8bea09aSQu Wenruo 2438b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info), 2439b8bea09aSQu Wenruo 2440b8bea09aSQu Wenruo TP_STRUCT__entry_btrfs( 2441b8bea09aSQu Wenruo __field( u64, full_stripe ) 2442b8bea09aSQu Wenruo __field( u64, physical ) 2443b8bea09aSQu Wenruo __field( u64, devid ) 2444b8bea09aSQu Wenruo __field( u32, offset ) 2445b8bea09aSQu Wenruo __field( u32, len ) 2446b8bea09aSQu Wenruo __field( u8, opf ) 2447b8bea09aSQu Wenruo __field( u8, total_stripes ) 2448b8bea09aSQu Wenruo __field( u8, real_stripes ) 2449b8bea09aSQu Wenruo __field( u8, nr_data ) 2450b8bea09aSQu Wenruo __field( u8, stripe_nr ) 2451b8bea09aSQu Wenruo ), 2452b8bea09aSQu Wenruo 2453b8bea09aSQu Wenruo TP_fast_assign_btrfs(rbio->bioc->fs_info, 245418d758a2SQu Wenruo __entry->full_stripe = rbio->bioc->full_stripe_logical; 2455b8bea09aSQu Wenruo __entry->physical = bio->bi_iter.bi_sector << SECTOR_SHIFT; 2456b8bea09aSQu Wenruo __entry->len = bio->bi_iter.bi_size; 2457b8bea09aSQu Wenruo __entry->opf = bio_op(bio); 2458b8bea09aSQu Wenruo __entry->devid = trace_info->devid; 2459b8bea09aSQu Wenruo __entry->offset = trace_info->offset; 2460b8bea09aSQu Wenruo __entry->stripe_nr = trace_info->stripe_nr; 2461b8bea09aSQu Wenruo __entry->total_stripes = rbio->bioc->num_stripes; 2462b8bea09aSQu Wenruo __entry->real_stripes = rbio->real_stripes; 2463b8bea09aSQu Wenruo __entry->nr_data = rbio->nr_data; 2464b8bea09aSQu Wenruo ), 2465b8bea09aSQu Wenruo /* 2466b8bea09aSQu Wenruo * For type output, we need to output things like "DATA1" 2467b8bea09aSQu Wenruo * (the first data stripe), "DATA2" (the second data stripe), 2468b8bea09aSQu Wenruo * "PQ1" (P stripe),"PQ2" (Q stripe), "REPLACE0" (replace target device). 2469b8bea09aSQu Wenruo */ 2470b8bea09aSQu Wenruo TP_printk_btrfs( 2471b8bea09aSQu Wenruo "full_stripe=%llu devid=%lld type=%s%d offset=%d opf=0x%x physical=%llu len=%u", 2472b8bea09aSQu Wenruo __entry->full_stripe, __entry->devid, 2473b8bea09aSQu Wenruo (__entry->stripe_nr < __entry->nr_data) ? "DATA" : 2474b8bea09aSQu Wenruo ((__entry->stripe_nr < __entry->real_stripes) ? "PQ" : 2475b8bea09aSQu Wenruo "REPLACE"), 2476b8bea09aSQu Wenruo (__entry->stripe_nr < __entry->nr_data) ? 2477b8bea09aSQu Wenruo (__entry->stripe_nr + 1) : 2478b8bea09aSQu Wenruo ((__entry->stripe_nr < __entry->real_stripes) ? 2479b8bea09aSQu Wenruo (__entry->stripe_nr - __entry->nr_data + 1) : 0), 2480b8bea09aSQu Wenruo __entry->offset, __entry->opf, __entry->physical, __entry->len) 2481b8bea09aSQu Wenruo ); 2482b8bea09aSQu Wenruo 2483b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_read_partial, 2484b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2485b8bea09aSQu Wenruo const struct bio *bio, 2486b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2487b8bea09aSQu Wenruo 2488b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2489b8bea09aSQu Wenruo ); 2490b8bea09aSQu Wenruo 2491b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_write_stripe, 2492b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2493b8bea09aSQu Wenruo const struct bio *bio, 2494b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2495b8bea09aSQu Wenruo 2496b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2497b8bea09aSQu Wenruo ); 2498b8bea09aSQu Wenruo 2499b8bea09aSQu Wenruo 2500b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_scrub_write_stripe, 2501b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2502b8bea09aSQu Wenruo const struct bio *bio, 2503b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2504b8bea09aSQu Wenruo 2505b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2506b8bea09aSQu Wenruo ); 2507b8bea09aSQu Wenruo 2508b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_scrub_read, 2509b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2510b8bea09aSQu Wenruo const struct bio *bio, 2511b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2512b8bea09aSQu Wenruo 2513b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2514b8bea09aSQu Wenruo ); 2515b8bea09aSQu Wenruo 2516b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_scrub_read_recover, 2517b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2518b8bea09aSQu Wenruo const struct bio *bio, 2519b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2520b8bea09aSQu Wenruo 2521b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2522b8bea09aSQu Wenruo ); 2523b8bea09aSQu Wenruo 25241abe9b8aSliubo #endif /* _TRACE_BTRFS_H */ 25251abe9b8aSliubo 25261abe9b8aSliubo /* This part must be outside protection */ 25271abe9b8aSliubo #include <trace/define_trace.h> 2528