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; 35*cfc2de0fSBoris Burkov struct find_free_extent_ctl; 361abe9b8aSliubo 371abe9b8aSliubo #define show_ref_type(type) \ 381abe9b8aSliubo __print_symbolic(type, \ 391abe9b8aSliubo { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ 401abe9b8aSliubo { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ 411abe9b8aSliubo { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ 421abe9b8aSliubo { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ 431abe9b8aSliubo { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) 441abe9b8aSliubo 451abe9b8aSliubo #define __show_root_type(obj) \ 467f34b746Sliubo __print_symbolic_u64(obj, \ 471abe9b8aSliubo { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ 481abe9b8aSliubo { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ 491abe9b8aSliubo { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ 501abe9b8aSliubo { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ 511abe9b8aSliubo { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ 521abe9b8aSliubo { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ 531abe9b8aSliubo { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ 541abe9b8aSliubo { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ 55e112e2b4SLiu Bo { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ 561abe9b8aSliubo { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ 57208acb8cSOmar Sandoval { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \ 58208acb8cSOmar Sandoval { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \ 599c54e80dSJosef Bacik { BTRFS_BLOCK_GROUP_TREE_OBJECTID, "BLOCK_GROUP_TREE" },\ 601abe9b8aSliubo { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) 611abe9b8aSliubo 621abe9b8aSliubo #define show_root_type(obj) \ 631abe9b8aSliubo obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ 64fb57dc81SLiu Bo (obj >= BTRFS_ROOT_TREE_OBJECTID && \ 65e112e2b4SLiu Bo obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" 661abe9b8aSliubo 675bca2c95SNikolay Borisov #define FLUSH_ACTIONS \ 685bca2c95SNikolay Borisov EM( BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH") \ 695bca2c95SNikolay Borisov EM( BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT") \ 705bca2c95SNikolay Borisov EM( BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL") \ 715bca2c95SNikolay Borisov EMe(BTRFS_RESERVE_FLUSH_ALL_STEAL, "BTRFS_RESERVE_FLUSH_ALL_STEAL") 725bca2c95SNikolay Borisov 730840dd28SNikolay Borisov #define FI_TYPES \ 740840dd28SNikolay Borisov EM( BTRFS_FILE_EXTENT_INLINE, "INLINE") \ 750840dd28SNikolay Borisov EM( BTRFS_FILE_EXTENT_REG, "REG") \ 760840dd28SNikolay Borisov EMe(BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC") 770840dd28SNikolay Borisov 781cb1f0b2SNikolay Borisov #define QGROUP_RSV_TYPES \ 791cb1f0b2SNikolay Borisov EM( BTRFS_QGROUP_RSV_DATA, "DATA") \ 801cb1f0b2SNikolay Borisov EM( BTRFS_QGROUP_RSV_META_PERTRANS, "META_PERTRANS") \ 811cb1f0b2SNikolay Borisov EMe(BTRFS_QGROUP_RSV_META_PREALLOC, "META_PREALLOC") 821cb1f0b2SNikolay Borisov 83c92bb304SNikolay Borisov #define IO_TREE_OWNER \ 84c92bb304SNikolay Borisov EM( IO_TREE_FS_PINNED_EXTENTS, "PINNED_EXTENTS") \ 85c92bb304SNikolay Borisov EM( IO_TREE_FS_EXCLUDED_EXTENTS, "EXCLUDED_EXTENTS") \ 862c53a14dSQu Wenruo EM( IO_TREE_BTREE_INODE_IO, "BTREE_INODE_IO") \ 87c92bb304SNikolay Borisov EM( IO_TREE_INODE_IO, "INODE_IO") \ 88c92bb304SNikolay Borisov EM( IO_TREE_RELOC_BLOCKS, "RELOC_BLOCKS") \ 89c92bb304SNikolay Borisov EM( IO_TREE_TRANS_DIRTY_PAGES, "TRANS_DIRTY_PAGES") \ 90c92bb304SNikolay Borisov EM( IO_TREE_ROOT_DIRTY_LOG_PAGES, "ROOT_DIRTY_LOG_PAGES") \ 91c92bb304SNikolay Borisov EM( IO_TREE_INODE_FILE_EXTENT, "INODE_FILE_EXTENT") \ 92c92bb304SNikolay Borisov EM( IO_TREE_LOG_CSUM_RANGE, "LOG_CSUM_RANGE") \ 93c92bb304SNikolay Borisov EMe(IO_TREE_SELFTEST, "SELFTEST") 94c92bb304SNikolay Borisov 95f0cdd15cSNikolay Borisov #define FLUSH_STATES \ 96f0cdd15cSNikolay Borisov EM( FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR") \ 97f0cdd15cSNikolay Borisov EM( FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS") \ 98f0cdd15cSNikolay Borisov EM( FLUSH_DELALLOC, "FLUSH_DELALLOC") \ 99f0cdd15cSNikolay Borisov EM( FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT") \ 10003fe78ccSJosef Bacik EM( FLUSH_DELALLOC_FULL, "FLUSH_DELALLOC_FULL") \ 101f0cdd15cSNikolay Borisov EM( FLUSH_DELAYED_REFS_NR, "FLUSH_DELAYED_REFS_NR") \ 1020a3212deSNaohiro Aota EM( FLUSH_DELAYED_REFS, "FLUSH_DELAYED_REFS") \ 103f0cdd15cSNikolay Borisov EM( ALLOC_CHUNK, "ALLOC_CHUNK") \ 104f0cdd15cSNikolay Borisov EM( ALLOC_CHUNK_FORCE, "ALLOC_CHUNK_FORCE") \ 105f0cdd15cSNikolay Borisov EM( RUN_DELAYED_IPUTS, "RUN_DELAYED_IPUTS") \ 106c416a30cSJosef Bacik EMe(COMMIT_TRANS, "COMMIT_TRANS") 107f0cdd15cSNikolay Borisov 1085bca2c95SNikolay Borisov /* 1095bca2c95SNikolay Borisov * First define the enums in the above macros to be exported to userspace via 1105bca2c95SNikolay Borisov * TRACE_DEFINE_ENUM(). 1115bca2c95SNikolay Borisov */ 1125bca2c95SNikolay Borisov 1130840dd28SNikolay Borisov #undef EM 1140840dd28SNikolay Borisov #undef EMe 1150840dd28SNikolay Borisov #define EM(a, b) TRACE_DEFINE_ENUM(a); 1160840dd28SNikolay Borisov #define EMe(a, b) TRACE_DEFINE_ENUM(a); 1170840dd28SNikolay Borisov 1185bca2c95SNikolay Borisov FLUSH_ACTIONS 1190840dd28SNikolay Borisov FI_TYPES 1201cb1f0b2SNikolay Borisov QGROUP_RSV_TYPES 121c92bb304SNikolay Borisov IO_TREE_OWNER 122f0cdd15cSNikolay Borisov FLUSH_STATES 1230840dd28SNikolay Borisov 1245bca2c95SNikolay Borisov /* 1255bca2c95SNikolay Borisov * Now redefine the EM and EMe macros to map the enums to the strings that will 1265bca2c95SNikolay Borisov * be printed in the output 1275bca2c95SNikolay Borisov */ 1285bca2c95SNikolay Borisov 1290840dd28SNikolay Borisov #undef EM 1300840dd28SNikolay Borisov #undef EMe 1310840dd28SNikolay Borisov #define EM(a, b) {a, b}, 1320840dd28SNikolay Borisov #define EMe(a, b) {a, b} 13309ed2f16SLiu Bo 134a1d19847SQu Wenruo 1353f7de037SJosef Bacik #define BTRFS_GROUP_FLAGS \ 1363f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ 1373f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 1383f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 1393f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ 1403f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ 1413f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ 142e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 143e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ 144e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} 1453f7de037SJosef Bacik 146a1d19847SQu Wenruo #define EXTENT_FLAGS \ 147a1d19847SQu Wenruo { EXTENT_DIRTY, "DIRTY"}, \ 148a1d19847SQu Wenruo { EXTENT_UPTODATE, "UPTODATE"}, \ 149a1d19847SQu Wenruo { EXTENT_LOCKED, "LOCKED"}, \ 150a1d19847SQu Wenruo { EXTENT_NEW, "NEW"}, \ 151a1d19847SQu Wenruo { EXTENT_DELALLOC, "DELALLOC"}, \ 152a1d19847SQu Wenruo { EXTENT_DEFRAG, "DEFRAG"}, \ 153a1d19847SQu Wenruo { EXTENT_BOUNDARY, "BOUNDARY"}, \ 154a1d19847SQu Wenruo { EXTENT_NODATASUM, "NODATASUM"}, \ 155a1d19847SQu Wenruo { EXTENT_CLEAR_META_RESV, "CLEAR_META_RESV"}, \ 156a1d19847SQu Wenruo { EXTENT_NEED_WAIT, "NEED_WAIT"}, \ 157a1d19847SQu Wenruo { EXTENT_NORESERVE, "NORESERVE"}, \ 158a1d19847SQu Wenruo { EXTENT_QGROUP_RESERVED, "QGROUP_RESERVED"}, \ 159a1d19847SQu Wenruo { EXTENT_CLEAR_DATA_RESV, "CLEAR_DATA_RESV"}, \ 160a1d19847SQu Wenruo { EXTENT_DELALLOC_NEW, "DELALLOC_NEW"} 161a1d19847SQu Wenruo 162b94417eaSAnand Jain #define BTRFS_FSID_SIZE 16 163b94417eaSAnand Jain #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE) 164bc074524SJeff Mahoney 165bc074524SJeff Mahoney #define TP_fast_assign_fsid(fs_info) \ 166a1d19847SQu Wenruo ({ \ 167a1d19847SQu Wenruo if (fs_info) \ 168a1d19847SQu Wenruo memcpy(__entry->fsid, fs_info->fs_devices->fsid, \ 169a1d19847SQu Wenruo BTRFS_FSID_SIZE); \ 170a1d19847SQu Wenruo else \ 171a1d19847SQu Wenruo memset(__entry->fsid, 0, BTRFS_FSID_SIZE); \ 172a1d19847SQu Wenruo }) 173bc074524SJeff Mahoney 174bc074524SJeff Mahoney #define TP_STRUCT__entry_btrfs(args...) \ 175bc074524SJeff Mahoney TP_STRUCT__entry( \ 176bc074524SJeff Mahoney TP_STRUCT__entry_fsid \ 177bc074524SJeff Mahoney args) 178bc074524SJeff Mahoney #define TP_fast_assign_btrfs(fs_info, args...) \ 179bc074524SJeff Mahoney TP_fast_assign( \ 180bc074524SJeff Mahoney TP_fast_assign_fsid(fs_info); \ 181bc074524SJeff Mahoney args) 182bc074524SJeff Mahoney #define TP_printk_btrfs(fmt, args...) \ 183bc074524SJeff Mahoney TP_printk("%pU: " fmt, __entry->fsid, args) 1848c2a3ca2SJosef Bacik 1851abe9b8aSliubo TRACE_EVENT(btrfs_transaction_commit, 1861abe9b8aSliubo 1872e4e97abSJosef Bacik TP_PROTO(const struct btrfs_fs_info *fs_info), 1881abe9b8aSliubo 1892e4e97abSJosef Bacik TP_ARGS(fs_info), 1901abe9b8aSliubo 191bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1921abe9b8aSliubo __field( u64, generation ) 1931abe9b8aSliubo __field( u64, root_objectid ) 1941abe9b8aSliubo ), 1951abe9b8aSliubo 1962e4e97abSJosef Bacik TP_fast_assign_btrfs(fs_info, 1972e4e97abSJosef Bacik __entry->generation = fs_info->generation; 1982e4e97abSJosef Bacik __entry->root_objectid = BTRFS_ROOT_TREE_OBJECTID; 1991abe9b8aSliubo ), 2001abe9b8aSliubo 20179bcb71aSDavid Sterba TP_printk_btrfs("root=%llu(%s) gen=%llu", 2021abe9b8aSliubo show_root_type(__entry->root_objectid), 2038eec8463SDavid Sterba __entry->generation) 2041abe9b8aSliubo ); 2051abe9b8aSliubo 2061abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__inode, 2071abe9b8aSliubo 2089a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 2091abe9b8aSliubo 2101abe9b8aSliubo TP_ARGS(inode), 2111abe9b8aSliubo 212bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 213f8f8e189SDavid Sterba __field( u64, ino ) 21494c3f6c6SDavid Sterba __field( u64, blocks ) 2151abe9b8aSliubo __field( u64, disk_i_size ) 2161abe9b8aSliubo __field( u64, generation ) 2171abe9b8aSliubo __field( u64, last_trans ) 2181abe9b8aSliubo __field( u64, logged_trans ) 2191abe9b8aSliubo __field( u64, root_objectid ) 2201abe9b8aSliubo ), 2211abe9b8aSliubo 222bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 223f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 2241abe9b8aSliubo __entry->blocks = inode->i_blocks; 2251abe9b8aSliubo __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; 2261abe9b8aSliubo __entry->generation = BTRFS_I(inode)->generation; 2271abe9b8aSliubo __entry->last_trans = BTRFS_I(inode)->last_trans; 2281abe9b8aSliubo __entry->logged_trans = BTRFS_I(inode)->logged_trans; 2291abe9b8aSliubo __entry->root_objectid = 2301abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 2311abe9b8aSliubo ), 2321abe9b8aSliubo 233f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%llu blocks=%llu " 234562a7a07SDavid Sterba "disk_i_size=%llu last_trans=%llu logged_trans=%llu", 2351abe9b8aSliubo show_root_type(__entry->root_objectid), 2368eec8463SDavid Sterba __entry->generation, 2378eec8463SDavid Sterba __entry->ino, 23894c3f6c6SDavid Sterba __entry->blocks, 2398eec8463SDavid Sterba __entry->disk_i_size, 2408eec8463SDavid Sterba __entry->last_trans, 2418eec8463SDavid Sterba __entry->logged_trans) 2421abe9b8aSliubo ); 2431abe9b8aSliubo 2441abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_new, 2451abe9b8aSliubo 2469a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 2471abe9b8aSliubo 2481abe9b8aSliubo TP_ARGS(inode) 2491abe9b8aSliubo ); 2501abe9b8aSliubo 2511abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_request, 2521abe9b8aSliubo 2539a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 2541abe9b8aSliubo 2551abe9b8aSliubo TP_ARGS(inode) 2561abe9b8aSliubo ); 2571abe9b8aSliubo 2581abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, 2591abe9b8aSliubo 2609a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 2611abe9b8aSliubo 2621abe9b8aSliubo TP_ARGS(inode) 2631abe9b8aSliubo ); 2641abe9b8aSliubo 2651abe9b8aSliubo #define __show_map_type(type) \ 2667f34b746Sliubo __print_symbolic_u64(type, \ 2671abe9b8aSliubo { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ 2681abe9b8aSliubo { EXTENT_MAP_HOLE, "HOLE" }, \ 2691abe9b8aSliubo { EXTENT_MAP_INLINE, "INLINE" }, \ 2701abe9b8aSliubo { EXTENT_MAP_DELALLOC, "DELALLOC" }) 2711abe9b8aSliubo 2721abe9b8aSliubo #define show_map_type(type) \ 2731abe9b8aSliubo type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) 2741abe9b8aSliubo 2751abe9b8aSliubo #define show_map_flags(flag) \ 2761abe9b8aSliubo __print_flags(flag, "|", \ 277254a2d14SLiu Bo { (1 << EXTENT_FLAG_PINNED), "PINNED" },\ 278254a2d14SLiu Bo { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\ 279254a2d14SLiu Bo { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\ 280254a2d14SLiu Bo { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\ 281254a2d14SLiu Bo { (1 << EXTENT_FLAG_FILLING), "FILLING" },\ 282254a2d14SLiu Bo { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" }) 2831abe9b8aSliubo 2844cd8587cSSteven Rostedt TRACE_EVENT_CONDITION(btrfs_get_extent, 2851abe9b8aSliubo 2869a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode, 2879a35b637SJeff Mahoney const struct extent_map *map), 2881abe9b8aSliubo 28992a1bf76SLiu Bo TP_ARGS(root, inode, map), 2901abe9b8aSliubo 2914cd8587cSSteven Rostedt TP_CONDITION(map), 2924cd8587cSSteven Rostedt 293bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 2941abe9b8aSliubo __field( u64, root_objectid ) 29592a1bf76SLiu Bo __field( u64, ino ) 2961abe9b8aSliubo __field( u64, start ) 2971abe9b8aSliubo __field( u64, len ) 2981abe9b8aSliubo __field( u64, orig_start ) 2991abe9b8aSliubo __field( u64, block_start ) 3001abe9b8aSliubo __field( u64, block_len ) 3011abe9b8aSliubo __field( unsigned long, flags ) 3021abe9b8aSliubo __field( int, refs ) 3031abe9b8aSliubo __field( unsigned int, compress_type ) 3041abe9b8aSliubo ), 3051abe9b8aSliubo 306bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 3071abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 30892a1bf76SLiu Bo __entry->ino = btrfs_ino(inode); 3091abe9b8aSliubo __entry->start = map->start; 3101abe9b8aSliubo __entry->len = map->len; 3111abe9b8aSliubo __entry->orig_start = map->orig_start; 3121abe9b8aSliubo __entry->block_start = map->block_start; 3131abe9b8aSliubo __entry->block_len = map->block_len; 3141abe9b8aSliubo __entry->flags = map->flags; 315490b54d6SElena Reshetova __entry->refs = refcount_read(&map->refs); 3161abe9b8aSliubo __entry->compress_type = map->compress_type; 3171abe9b8aSliubo ), 3181abe9b8aSliubo 319562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu " 320562a7a07SDavid Sterba "orig_start=%llu block_start=%llu(%s) " 321562a7a07SDavid Sterba "block_len=%llu flags=%s refs=%u " 3221abe9b8aSliubo "compress_type=%u", 3231abe9b8aSliubo show_root_type(__entry->root_objectid), 3248eec8463SDavid Sterba __entry->ino, 3258eec8463SDavid Sterba __entry->start, 3268eec8463SDavid Sterba __entry->len, 3278eec8463SDavid Sterba __entry->orig_start, 3281abe9b8aSliubo show_map_type(__entry->block_start), 3298eec8463SDavid Sterba __entry->block_len, 3301abe9b8aSliubo show_map_flags(__entry->flags), 3311abe9b8aSliubo __entry->refs, __entry->compress_type) 3321abe9b8aSliubo ); 3331abe9b8aSliubo 334393da918SLiu Bo TRACE_EVENT(btrfs_handle_em_exist, 335393da918SLiu Bo 3361d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 337f46b24c9SDavid Sterba const struct extent_map *existing, const struct extent_map *map, 338f46b24c9SDavid Sterba u64 start, u64 len), 339393da918SLiu Bo 340f46b24c9SDavid Sterba TP_ARGS(fs_info, existing, map, start, len), 341393da918SLiu Bo 342f46b24c9SDavid Sterba TP_STRUCT__entry_btrfs( 343393da918SLiu Bo __field( u64, e_start ) 344393da918SLiu Bo __field( u64, e_len ) 345393da918SLiu Bo __field( u64, map_start ) 346393da918SLiu Bo __field( u64, map_len ) 347393da918SLiu Bo __field( u64, start ) 348393da918SLiu Bo __field( u64, len ) 349393da918SLiu Bo ), 350393da918SLiu Bo 351f46b24c9SDavid Sterba TP_fast_assign_btrfs(fs_info, 352393da918SLiu Bo __entry->e_start = existing->start; 353393da918SLiu Bo __entry->e_len = existing->len; 354393da918SLiu Bo __entry->map_start = map->start; 355393da918SLiu Bo __entry->map_len = map->len; 356393da918SLiu Bo __entry->start = start; 357393da918SLiu Bo __entry->len = len; 358393da918SLiu Bo ), 359393da918SLiu Bo 360f46b24c9SDavid Sterba TP_printk_btrfs("start=%llu len=%llu " 361393da918SLiu Bo "existing(start=%llu len=%llu) " 362393da918SLiu Bo "em(start=%llu len=%llu)", 3638eec8463SDavid Sterba __entry->start, 3648eec8463SDavid Sterba __entry->len, 3658eec8463SDavid Sterba __entry->e_start, 3668eec8463SDavid Sterba __entry->e_len, 3678eec8463SDavid Sterba __entry->map_start, 3688eec8463SDavid Sterba __entry->map_len) 369393da918SLiu Bo ); 370393da918SLiu Bo 37109ed2f16SLiu Bo /* file extent item */ 37209ed2f16SLiu Bo DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular, 37309ed2f16SLiu Bo 3741d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 3751d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, u64 start), 37609ed2f16SLiu Bo 37709ed2f16SLiu Bo TP_ARGS(bi, l, fi, start), 37809ed2f16SLiu Bo 37909ed2f16SLiu Bo TP_STRUCT__entry_btrfs( 38009ed2f16SLiu Bo __field( u64, root_obj ) 38109ed2f16SLiu Bo __field( u64, ino ) 38209ed2f16SLiu Bo __field( loff_t, isize ) 38309ed2f16SLiu Bo __field( u64, disk_isize ) 38409ed2f16SLiu Bo __field( u64, num_bytes ) 38509ed2f16SLiu Bo __field( u64, ram_bytes ) 38609ed2f16SLiu Bo __field( u64, disk_bytenr ) 38709ed2f16SLiu Bo __field( u64, disk_num_bytes ) 38809ed2f16SLiu Bo __field( u64, extent_offset ) 38909ed2f16SLiu Bo __field( u8, extent_type ) 39009ed2f16SLiu Bo __field( u8, compression ) 39109ed2f16SLiu Bo __field( u64, extent_start ) 39209ed2f16SLiu Bo __field( u64, extent_end ) 39309ed2f16SLiu Bo ), 39409ed2f16SLiu Bo 39509ed2f16SLiu Bo TP_fast_assign_btrfs(bi->root->fs_info, 3964fd786e6SMisono Tomohiro __entry->root_obj = bi->root->root_key.objectid; 39709ed2f16SLiu Bo __entry->ino = btrfs_ino(bi); 39809ed2f16SLiu Bo __entry->isize = bi->vfs_inode.i_size; 39909ed2f16SLiu Bo __entry->disk_isize = bi->disk_i_size; 40009ed2f16SLiu Bo __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi); 40109ed2f16SLiu Bo __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi); 40209ed2f16SLiu Bo __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi); 40309ed2f16SLiu Bo __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi); 40409ed2f16SLiu Bo __entry->extent_offset = btrfs_file_extent_offset(l, fi); 40509ed2f16SLiu Bo __entry->extent_type = btrfs_file_extent_type(l, fi); 40609ed2f16SLiu Bo __entry->compression = btrfs_file_extent_compression(l, fi); 40709ed2f16SLiu Bo __entry->extent_start = start; 40809ed2f16SLiu Bo __entry->extent_end = (start + __entry->num_bytes); 40909ed2f16SLiu Bo ), 41009ed2f16SLiu Bo 41109ed2f16SLiu Bo TP_printk_btrfs( 41209ed2f16SLiu Bo "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " 41309ed2f16SLiu Bo "file extent range=[%llu %llu] " 41409ed2f16SLiu Bo "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu " 41509ed2f16SLiu Bo "disk_num_bytes=%llu extent_offset=%llu type=%s " 41609ed2f16SLiu Bo "compression=%u", 41709ed2f16SLiu Bo show_root_type(__entry->root_obj), __entry->ino, 41809ed2f16SLiu Bo __entry->isize, 41909ed2f16SLiu Bo __entry->disk_isize, __entry->extent_start, 42009ed2f16SLiu Bo __entry->extent_end, __entry->num_bytes, __entry->ram_bytes, 42109ed2f16SLiu Bo __entry->disk_bytenr, __entry->disk_num_bytes, 4220840dd28SNikolay Borisov __entry->extent_offset, __print_symbolic(__entry->extent_type, FI_TYPES), 42309ed2f16SLiu Bo __entry->compression) 42409ed2f16SLiu Bo ); 42509ed2f16SLiu Bo 42609ed2f16SLiu Bo DECLARE_EVENT_CLASS( 42709ed2f16SLiu Bo btrfs__file_extent_item_inline, 42809ed2f16SLiu Bo 4291d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4301d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, int slot, u64 start), 43109ed2f16SLiu Bo 43209ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start), 43309ed2f16SLiu Bo 43409ed2f16SLiu Bo TP_STRUCT__entry_btrfs( 43509ed2f16SLiu Bo __field( u64, root_obj ) 43609ed2f16SLiu Bo __field( u64, ino ) 43709ed2f16SLiu Bo __field( loff_t, isize ) 43809ed2f16SLiu Bo __field( u64, disk_isize ) 43909ed2f16SLiu Bo __field( u8, extent_type ) 44009ed2f16SLiu Bo __field( u8, compression ) 44109ed2f16SLiu Bo __field( u64, extent_start ) 44209ed2f16SLiu Bo __field( u64, extent_end ) 44309ed2f16SLiu Bo ), 44409ed2f16SLiu Bo 44509ed2f16SLiu Bo TP_fast_assign_btrfs( 44609ed2f16SLiu Bo bi->root->fs_info, 4474fd786e6SMisono Tomohiro __entry->root_obj = bi->root->root_key.objectid; 44809ed2f16SLiu Bo __entry->ino = btrfs_ino(bi); 44909ed2f16SLiu Bo __entry->isize = bi->vfs_inode.i_size; 45009ed2f16SLiu Bo __entry->disk_isize = bi->disk_i_size; 45109ed2f16SLiu Bo __entry->extent_type = btrfs_file_extent_type(l, fi); 45209ed2f16SLiu Bo __entry->compression = btrfs_file_extent_compression(l, fi); 45309ed2f16SLiu Bo __entry->extent_start = start; 454e41ca589SQu Wenruo __entry->extent_end = (start + btrfs_file_extent_ram_bytes(l, fi)); 45509ed2f16SLiu Bo ), 45609ed2f16SLiu Bo 45709ed2f16SLiu Bo TP_printk_btrfs( 45809ed2f16SLiu Bo "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " 45909ed2f16SLiu Bo "file extent range=[%llu %llu] " 46009ed2f16SLiu Bo "extent_type=%s compression=%u", 46109ed2f16SLiu Bo show_root_type(__entry->root_obj), __entry->ino, __entry->isize, 46209ed2f16SLiu Bo __entry->disk_isize, __entry->extent_start, 4630840dd28SNikolay Borisov __entry->extent_end, __print_symbolic(__entry->extent_type, FI_TYPES), 46409ed2f16SLiu Bo __entry->compression) 46509ed2f16SLiu Bo ); 46609ed2f16SLiu Bo 46709ed2f16SLiu Bo DEFINE_EVENT( 46809ed2f16SLiu Bo btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular, 46909ed2f16SLiu Bo 4701d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4711d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, u64 start), 47209ed2f16SLiu Bo 47309ed2f16SLiu Bo TP_ARGS(bi, l, fi, start) 47409ed2f16SLiu Bo ); 47509ed2f16SLiu Bo 47609ed2f16SLiu Bo DEFINE_EVENT( 47709ed2f16SLiu Bo btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular, 47809ed2f16SLiu Bo 4791d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4801d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, u64 start), 48109ed2f16SLiu Bo 48209ed2f16SLiu Bo TP_ARGS(bi, l, fi, start) 48309ed2f16SLiu Bo ); 48409ed2f16SLiu Bo 48509ed2f16SLiu Bo DEFINE_EVENT( 48609ed2f16SLiu Bo btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline, 48709ed2f16SLiu Bo 4881d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4891d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, int slot, u64 start), 49009ed2f16SLiu Bo 49109ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start) 49209ed2f16SLiu Bo ); 49309ed2f16SLiu Bo 49409ed2f16SLiu Bo DEFINE_EVENT( 49509ed2f16SLiu Bo btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline, 49609ed2f16SLiu Bo 4971d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4981d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, int slot, u64 start), 49909ed2f16SLiu Bo 50009ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start) 50109ed2f16SLiu Bo ); 50209ed2f16SLiu Bo 5031abe9b8aSliubo #define show_ordered_flags(flags) \ 5049d04a8ceSLiu Bo __print_flags(flags, "|", \ 5053c198fe0SQu Wenruo { (1 << BTRFS_ORDERED_REGULAR), "REGULAR" }, \ 5063c198fe0SQu Wenruo { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ 5073c198fe0SQu Wenruo { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ 5083c198fe0SQu Wenruo { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ 5093c198fe0SQu Wenruo { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ 5109d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ 5119d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ 5129d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ 513792ddef0SLiu Bo { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) 514e112e2b4SLiu Bo 5151abe9b8aSliubo 5161abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__ordered_extent, 5171abe9b8aSliubo 518acbf1dd0SNikolay Borisov TP_PROTO(const struct btrfs_inode *inode, 5199a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5201abe9b8aSliubo 5211abe9b8aSliubo TP_ARGS(inode, ordered), 5221abe9b8aSliubo 523bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 524f8f8e189SDavid Sterba __field( u64, ino ) 5251abe9b8aSliubo __field( u64, file_offset ) 5261abe9b8aSliubo __field( u64, start ) 5271abe9b8aSliubo __field( u64, len ) 5281abe9b8aSliubo __field( u64, disk_len ) 5291abe9b8aSliubo __field( u64, bytes_left ) 5301abe9b8aSliubo __field( unsigned long, flags ) 5311abe9b8aSliubo __field( int, compress_type ) 5321abe9b8aSliubo __field( int, refs ) 5331abe9b8aSliubo __field( u64, root_objectid ) 53478566548SLiu Bo __field( u64, truncated_len ) 5351abe9b8aSliubo ), 5361abe9b8aSliubo 537acbf1dd0SNikolay Borisov TP_fast_assign_btrfs(inode->root->fs_info, 538acbf1dd0SNikolay Borisov __entry->ino = btrfs_ino(inode); 5391abe9b8aSliubo __entry->file_offset = ordered->file_offset; 540bffe633eSOmar Sandoval __entry->start = ordered->disk_bytenr; 541bffe633eSOmar Sandoval __entry->len = ordered->num_bytes; 542bffe633eSOmar Sandoval __entry->disk_len = ordered->disk_num_bytes; 5431abe9b8aSliubo __entry->bytes_left = ordered->bytes_left; 5441abe9b8aSliubo __entry->flags = ordered->flags; 5451abe9b8aSliubo __entry->compress_type = ordered->compress_type; 546e76edab7SElena Reshetova __entry->refs = refcount_read(&ordered->refs); 547acbf1dd0SNikolay Borisov __entry->root_objectid = inode->root->root_key.objectid; 54878566548SLiu Bo __entry->truncated_len = ordered->truncated_len; 5491abe9b8aSliubo ), 5501abe9b8aSliubo 551562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu " 552562a7a07SDavid Sterba "start=%llu len=%llu disk_len=%llu " 553562a7a07SDavid Sterba "truncated_len=%llu " 554562a7a07SDavid Sterba "bytes_left=%llu flags=%s compress_type=%d " 5551abe9b8aSliubo "refs=%d", 5561abe9b8aSliubo show_root_type(__entry->root_objectid), 5578eec8463SDavid Sterba __entry->ino, 5588eec8463SDavid Sterba __entry->file_offset, 5598eec8463SDavid Sterba __entry->start, 5608eec8463SDavid Sterba __entry->len, 5618eec8463SDavid Sterba __entry->disk_len, 5628eec8463SDavid Sterba __entry->truncated_len, 5638eec8463SDavid Sterba __entry->bytes_left, 5641abe9b8aSliubo show_ordered_flags(__entry->flags), 5651abe9b8aSliubo __entry->compress_type, __entry->refs) 5661abe9b8aSliubo ); 5671abe9b8aSliubo 5681abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, 5691abe9b8aSliubo 570acbf1dd0SNikolay Borisov TP_PROTO(const struct btrfs_inode *inode, 5719a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5721abe9b8aSliubo 5731abe9b8aSliubo TP_ARGS(inode, ordered) 5741abe9b8aSliubo ); 5751abe9b8aSliubo 5761abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, 5771abe9b8aSliubo 578acbf1dd0SNikolay Borisov TP_PROTO(const struct btrfs_inode *inode, 5799a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5801abe9b8aSliubo 5811abe9b8aSliubo TP_ARGS(inode, ordered) 5821abe9b8aSliubo ); 5831abe9b8aSliubo 5841abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, 5851abe9b8aSliubo 586acbf1dd0SNikolay Borisov TP_PROTO(const struct btrfs_inode *inode, 5879a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5881abe9b8aSliubo 5891abe9b8aSliubo TP_ARGS(inode, ordered) 5901abe9b8aSliubo ); 5911abe9b8aSliubo 5921abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, 5931abe9b8aSliubo 594acbf1dd0SNikolay Borisov TP_PROTO(const struct btrfs_inode *inode, 5959a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5961abe9b8aSliubo 5971abe9b8aSliubo TP_ARGS(inode, ordered) 5981abe9b8aSliubo ); 5991abe9b8aSliubo 6005bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup, 6015bea2508SJohannes Thumshirn 6025bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6035bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6045bea2508SJohannes Thumshirn 6055bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6065bea2508SJohannes Thumshirn ); 6075bea2508SJohannes Thumshirn 6085bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_range, 6095bea2508SJohannes Thumshirn 6105bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6115bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6125bea2508SJohannes Thumshirn 6135bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6145bea2508SJohannes Thumshirn ); 6155bea2508SJohannes Thumshirn 6165bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_first_range, 6175bea2508SJohannes Thumshirn 6185bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6195bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6205bea2508SJohannes Thumshirn 6215bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6225bea2508SJohannes Thumshirn ); 6235bea2508SJohannes Thumshirn 6245bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_for_logging, 6255bea2508SJohannes Thumshirn 6265bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6275bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6285bea2508SJohannes Thumshirn 6295bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6305bea2508SJohannes Thumshirn ); 6315bea2508SJohannes Thumshirn 6325bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_first, 6335bea2508SJohannes Thumshirn 6345bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6355bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6365bea2508SJohannes Thumshirn 6375bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6385bea2508SJohannes Thumshirn ); 6395bea2508SJohannes Thumshirn 6405bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_split, 6415bea2508SJohannes Thumshirn 6425bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6435bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6445bea2508SJohannes Thumshirn 6455bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6465bea2508SJohannes Thumshirn ); 6475bea2508SJohannes Thumshirn 6485bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_dec_test_pending, 6495bea2508SJohannes Thumshirn 6505bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6515bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6525bea2508SJohannes Thumshirn 6535bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6545bea2508SJohannes Thumshirn ); 6555bea2508SJohannes Thumshirn 6565bea2508SJohannes Thumshirn DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_mark_finished, 6575bea2508SJohannes Thumshirn 6585bea2508SJohannes Thumshirn TP_PROTO(const struct btrfs_inode *inode, 6595bea2508SJohannes Thumshirn const struct btrfs_ordered_extent *ordered), 6605bea2508SJohannes Thumshirn 6615bea2508SJohannes Thumshirn TP_ARGS(inode, ordered) 6625bea2508SJohannes Thumshirn ); 6635bea2508SJohannes Thumshirn 6641abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__writepage, 6651abe9b8aSliubo 6669a35b637SJeff Mahoney TP_PROTO(const struct page *page, const struct inode *inode, 6679a35b637SJeff Mahoney const struct writeback_control *wbc), 6681abe9b8aSliubo 6691abe9b8aSliubo TP_ARGS(page, inode, wbc), 6701abe9b8aSliubo 671bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 672f8f8e189SDavid Sterba __field( u64, ino ) 6731abe9b8aSliubo __field( pgoff_t, index ) 6741abe9b8aSliubo __field( long, nr_to_write ) 6751abe9b8aSliubo __field( long, pages_skipped ) 6761abe9b8aSliubo __field( loff_t, range_start ) 6771abe9b8aSliubo __field( loff_t, range_end ) 6781abe9b8aSliubo __field( char, for_kupdate ) 6791abe9b8aSliubo __field( char, for_reclaim ) 6801abe9b8aSliubo __field( char, range_cyclic ) 68194c3f6c6SDavid Sterba __field( unsigned long, writeback_index ) 6821abe9b8aSliubo __field( u64, root_objectid ) 6831abe9b8aSliubo ), 6841abe9b8aSliubo 685bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 686f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 6871abe9b8aSliubo __entry->index = page->index; 6881abe9b8aSliubo __entry->nr_to_write = wbc->nr_to_write; 6891abe9b8aSliubo __entry->pages_skipped = wbc->pages_skipped; 6901abe9b8aSliubo __entry->range_start = wbc->range_start; 6911abe9b8aSliubo __entry->range_end = wbc->range_end; 6921abe9b8aSliubo __entry->for_kupdate = wbc->for_kupdate; 6931abe9b8aSliubo __entry->for_reclaim = wbc->for_reclaim; 6941abe9b8aSliubo __entry->range_cyclic = wbc->range_cyclic; 6951abe9b8aSliubo __entry->writeback_index = inode->i_mapping->writeback_index; 6961abe9b8aSliubo __entry->root_objectid = 6971abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 6981abe9b8aSliubo ), 6991abe9b8aSliubo 700f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu " 701562a7a07SDavid Sterba "nr_to_write=%ld pages_skipped=%ld range_start=%llu " 702562a7a07SDavid Sterba "range_end=%llu for_kupdate=%d " 703562a7a07SDavid Sterba "for_reclaim=%d range_cyclic=%d writeback_index=%lu", 7041abe9b8aSliubo show_root_type(__entry->root_objectid), 7058eec8463SDavid Sterba __entry->ino, __entry->index, 7061abe9b8aSliubo __entry->nr_to_write, __entry->pages_skipped, 7071abe9b8aSliubo __entry->range_start, __entry->range_end, 708846d5a09SWu Fengguang __entry->for_kupdate, 7091abe9b8aSliubo __entry->for_reclaim, __entry->range_cyclic, 71094c3f6c6SDavid Sterba __entry->writeback_index) 7111abe9b8aSliubo ); 7121abe9b8aSliubo 7131abe9b8aSliubo DEFINE_EVENT(btrfs__writepage, __extent_writepage, 7141abe9b8aSliubo 7159a35b637SJeff Mahoney TP_PROTO(const struct page *page, const struct inode *inode, 7169a35b637SJeff Mahoney const struct writeback_control *wbc), 7171abe9b8aSliubo 7181abe9b8aSliubo TP_ARGS(page, inode, wbc) 7191abe9b8aSliubo ); 7201abe9b8aSliubo 7211abe9b8aSliubo TRACE_EVENT(btrfs_writepage_end_io_hook, 7221abe9b8aSliubo 72338a39ac7SQu Wenruo TP_PROTO(const struct btrfs_inode *inode, u64 start, u64 end, 72438a39ac7SQu Wenruo int uptodate), 7251abe9b8aSliubo 72638a39ac7SQu Wenruo TP_ARGS(inode, start, end, uptodate), 7271abe9b8aSliubo 728bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 729f8f8e189SDavid Sterba __field( u64, ino ) 7301abe9b8aSliubo __field( u64, start ) 7311abe9b8aSliubo __field( u64, end ) 7321abe9b8aSliubo __field( int, uptodate ) 7331abe9b8aSliubo __field( u64, root_objectid ) 7341abe9b8aSliubo ), 7351abe9b8aSliubo 73638a39ac7SQu Wenruo TP_fast_assign_btrfs(inode->root->fs_info, 73738a39ac7SQu Wenruo __entry->ino = btrfs_ino(inode); 7381abe9b8aSliubo __entry->start = start; 7391abe9b8aSliubo __entry->end = end; 7401abe9b8aSliubo __entry->uptodate = uptodate; 74138a39ac7SQu Wenruo __entry->root_objectid = inode->root->root_key.objectid; 7421abe9b8aSliubo ), 7431abe9b8aSliubo 74438a39ac7SQu Wenruo TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu end=%llu uptodate=%d", 7451abe9b8aSliubo show_root_type(__entry->root_objectid), 74638a39ac7SQu Wenruo __entry->ino, __entry->start, 7478eec8463SDavid Sterba __entry->end, __entry->uptodate) 7481abe9b8aSliubo ); 7491abe9b8aSliubo 7501abe9b8aSliubo TRACE_EVENT(btrfs_sync_file, 7511abe9b8aSliubo 7529a35b637SJeff Mahoney TP_PROTO(const struct file *file, int datasync), 7531abe9b8aSliubo 7541abe9b8aSliubo TP_ARGS(file, datasync), 7551abe9b8aSliubo 756bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 757f8f8e189SDavid Sterba __field( u64, ino ) 758f8f8e189SDavid Sterba __field( u64, parent ) 7591abe9b8aSliubo __field( int, datasync ) 7601abe9b8aSliubo __field( u64, root_objectid ) 7611abe9b8aSliubo ), 7621abe9b8aSliubo 7631abe9b8aSliubo TP_fast_assign( 7649a35b637SJeff Mahoney const struct dentry *dentry = file->f_path.dentry; 7659a35b637SJeff Mahoney const struct inode *inode = d_inode(dentry); 7661abe9b8aSliubo 767bc074524SJeff Mahoney TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb)); 768f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 769f8f8e189SDavid Sterba __entry->parent = btrfs_ino(BTRFS_I(d_inode(dentry->d_parent))); 7701abe9b8aSliubo __entry->datasync = datasync; 7711abe9b8aSliubo __entry->root_objectid = 7721abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 7731abe9b8aSliubo ), 7741abe9b8aSliubo 775f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu parent=%llu datasync=%d", 7761abe9b8aSliubo show_root_type(__entry->root_objectid), 7778eec8463SDavid Sterba __entry->ino, 7788eec8463SDavid Sterba __entry->parent, 7791abe9b8aSliubo __entry->datasync) 7801abe9b8aSliubo ); 7811abe9b8aSliubo 7821abe9b8aSliubo TRACE_EVENT(btrfs_sync_fs, 7831abe9b8aSliubo 7849a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, int wait), 7851abe9b8aSliubo 786bc074524SJeff Mahoney TP_ARGS(fs_info, wait), 7871abe9b8aSliubo 788bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 7891abe9b8aSliubo __field( int, wait ) 7901abe9b8aSliubo ), 7911abe9b8aSliubo 792bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 7931abe9b8aSliubo __entry->wait = wait; 7941abe9b8aSliubo ), 7951abe9b8aSliubo 796bc074524SJeff Mahoney TP_printk_btrfs("wait=%d", __entry->wait) 7971abe9b8aSliubo ); 7981abe9b8aSliubo 799c83f8effSJosef Bacik TRACE_EVENT(btrfs_add_block_group, 800c83f8effSJosef Bacik 8019a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 80232da5386SDavid Sterba const struct btrfs_block_group *block_group, int create), 803c83f8effSJosef Bacik 804c83f8effSJosef Bacik TP_ARGS(fs_info, block_group, create), 805c83f8effSJosef Bacik 8062e63e62dSDavid Sterba TP_STRUCT__entry_btrfs( 807c83f8effSJosef Bacik __field( u64, offset ) 808c83f8effSJosef Bacik __field( u64, size ) 809c83f8effSJosef Bacik __field( u64, flags ) 810c83f8effSJosef Bacik __field( u64, bytes_used ) 811c83f8effSJosef Bacik __field( u64, bytes_super ) 812c83f8effSJosef Bacik __field( int, create ) 813c83f8effSJosef Bacik ), 814c83f8effSJosef Bacik 8152e63e62dSDavid Sterba TP_fast_assign_btrfs(fs_info, 816b3470b5dSDavid Sterba __entry->offset = block_group->start; 817b3470b5dSDavid Sterba __entry->size = block_group->length; 818c83f8effSJosef Bacik __entry->flags = block_group->flags; 819bf38be65SDavid Sterba __entry->bytes_used = block_group->used; 820c83f8effSJosef Bacik __entry->bytes_super = block_group->bytes_super; 821c83f8effSJosef Bacik __entry->create = create; 822c83f8effSJosef Bacik ), 823c83f8effSJosef Bacik 8242e63e62dSDavid Sterba TP_printk_btrfs("block_group offset=%llu size=%llu " 825562a7a07SDavid Sterba "flags=%llu(%s) bytes_used=%llu bytes_super=%llu " 8262e63e62dSDavid Sterba "create=%d", 8278eec8463SDavid Sterba __entry->offset, 8288eec8463SDavid Sterba __entry->size, 8298eec8463SDavid Sterba __entry->flags, 830c83f8effSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 831c83f8effSJosef Bacik BTRFS_GROUP_FLAGS), 8328eec8463SDavid Sterba __entry->bytes_used, 8338eec8463SDavid Sterba __entry->bytes_super, __entry->create) 834c83f8effSJosef Bacik ); 835c83f8effSJosef Bacik 8361abe9b8aSliubo #define show_ref_action(action) \ 8371abe9b8aSliubo __print_symbolic(action, \ 8381abe9b8aSliubo { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ 8391abe9b8aSliubo { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ 8401abe9b8aSliubo { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ 8411abe9b8aSliubo { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) 8421abe9b8aSliubo 8431abe9b8aSliubo 844599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, 8451abe9b8aSliubo 8469a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8479a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 8489a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 8491abe9b8aSliubo int action), 8501abe9b8aSliubo 851bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action), 8521abe9b8aSliubo 853bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 8541abe9b8aSliubo __field( u64, bytenr ) 8551abe9b8aSliubo __field( u64, num_bytes ) 8561abe9b8aSliubo __field( int, action ) 8571abe9b8aSliubo __field( u64, parent ) 8581abe9b8aSliubo __field( u64, ref_root ) 8591abe9b8aSliubo __field( int, level ) 8601abe9b8aSliubo __field( int, type ) 861dea7d76eSLiu Bo __field( u64, seq ) 8621abe9b8aSliubo ), 8631abe9b8aSliubo 864bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 8651abe9b8aSliubo __entry->bytenr = ref->bytenr; 8661abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 8671abe9b8aSliubo __entry->action = action; 8681abe9b8aSliubo __entry->parent = full_ref->parent; 8691abe9b8aSliubo __entry->ref_root = full_ref->root; 8701abe9b8aSliubo __entry->level = full_ref->level; 8711abe9b8aSliubo __entry->type = ref->type; 872dea7d76eSLiu Bo __entry->seq = ref->seq; 8731abe9b8aSliubo ), 8741abe9b8aSliubo 875562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 876562a7a07SDavid Sterba "parent=%llu(%s) ref_root=%llu(%s) level=%d " 877562a7a07SDavid Sterba "type=%s seq=%llu", 8788eec8463SDavid Sterba __entry->bytenr, 8798eec8463SDavid Sterba __entry->num_bytes, 8801abe9b8aSliubo show_ref_action(__entry->action), 8811abe9b8aSliubo show_root_type(__entry->parent), 8821abe9b8aSliubo show_root_type(__entry->ref_root), 883dea7d76eSLiu Bo __entry->level, show_ref_type(__entry->type), 8848eec8463SDavid Sterba __entry->seq) 8851abe9b8aSliubo ); 8861abe9b8aSliubo 887599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, 888599c75ecSLiu Bo 8899a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8909a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 8919a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 892599c75ecSLiu Bo int action), 893599c75ecSLiu Bo 894bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 895599c75ecSLiu Bo ); 896599c75ecSLiu Bo 897599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, 898599c75ecSLiu Bo 8999a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9009a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 9019a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 902599c75ecSLiu Bo int action), 903599c75ecSLiu Bo 904bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 905599c75ecSLiu Bo ); 906599c75ecSLiu Bo 907599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, 9081abe9b8aSliubo 9099a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9109a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 9119a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 9121abe9b8aSliubo int action), 9131abe9b8aSliubo 914bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action), 9151abe9b8aSliubo 916bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 9171abe9b8aSliubo __field( u64, bytenr ) 9181abe9b8aSliubo __field( u64, num_bytes ) 9191abe9b8aSliubo __field( int, action ) 9201abe9b8aSliubo __field( u64, parent ) 9211abe9b8aSliubo __field( u64, ref_root ) 9221abe9b8aSliubo __field( u64, owner ) 9231abe9b8aSliubo __field( u64, offset ) 9241abe9b8aSliubo __field( int, type ) 925dea7d76eSLiu Bo __field( u64, seq ) 9261abe9b8aSliubo ), 9271abe9b8aSliubo 928bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 9291abe9b8aSliubo __entry->bytenr = ref->bytenr; 9301abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 9311abe9b8aSliubo __entry->action = action; 9321abe9b8aSliubo __entry->parent = full_ref->parent; 9331abe9b8aSliubo __entry->ref_root = full_ref->root; 9341abe9b8aSliubo __entry->owner = full_ref->objectid; 9351abe9b8aSliubo __entry->offset = full_ref->offset; 9361abe9b8aSliubo __entry->type = ref->type; 937dea7d76eSLiu Bo __entry->seq = ref->seq; 9381abe9b8aSliubo ), 9391abe9b8aSliubo 940562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 941562a7a07SDavid Sterba "parent=%llu(%s) ref_root=%llu(%s) owner=%llu " 942562a7a07SDavid Sterba "offset=%llu type=%s seq=%llu", 9438eec8463SDavid Sterba __entry->bytenr, 9448eec8463SDavid Sterba __entry->num_bytes, 9451abe9b8aSliubo show_ref_action(__entry->action), 9461abe9b8aSliubo show_root_type(__entry->parent), 9471abe9b8aSliubo show_root_type(__entry->ref_root), 9488eec8463SDavid Sterba __entry->owner, 9498eec8463SDavid Sterba __entry->offset, 950dea7d76eSLiu Bo show_ref_type(__entry->type), 9518eec8463SDavid Sterba __entry->seq) 9521abe9b8aSliubo ); 9531abe9b8aSliubo 954599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, 955599c75ecSLiu Bo 9569a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9579a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 9589a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 959599c75ecSLiu Bo int action), 960599c75ecSLiu Bo 961bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 962599c75ecSLiu Bo ); 963599c75ecSLiu Bo 964599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, 965599c75ecSLiu Bo 9669a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9679a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 9689a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 969599c75ecSLiu Bo int action), 970599c75ecSLiu Bo 971bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 972599c75ecSLiu Bo ); 973599c75ecSLiu Bo 974599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, 9751abe9b8aSliubo 9769a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9779a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 9781abe9b8aSliubo int action), 9791abe9b8aSliubo 980d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action), 9811abe9b8aSliubo 982bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 9831abe9b8aSliubo __field( u64, bytenr ) 9841abe9b8aSliubo __field( u64, num_bytes ) 9851abe9b8aSliubo __field( int, action ) 9861abe9b8aSliubo __field( int, is_data ) 9871abe9b8aSliubo ), 9881abe9b8aSliubo 989bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 990d278850eSJosef Bacik __entry->bytenr = head_ref->bytenr; 991d278850eSJosef Bacik __entry->num_bytes = head_ref->num_bytes; 9921abe9b8aSliubo __entry->action = action; 9931abe9b8aSliubo __entry->is_data = head_ref->is_data; 9941abe9b8aSliubo ), 9951abe9b8aSliubo 996562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d", 9978eec8463SDavid Sterba __entry->bytenr, 9988eec8463SDavid Sterba __entry->num_bytes, 9991abe9b8aSliubo show_ref_action(__entry->action), 10001abe9b8aSliubo __entry->is_data) 10011abe9b8aSliubo ); 10021abe9b8aSliubo 1003599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, 1004599c75ecSLiu Bo 10059a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10069a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 1007599c75ecSLiu Bo int action), 1008599c75ecSLiu Bo 1009d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action) 1010599c75ecSLiu Bo ); 1011599c75ecSLiu Bo 1012599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, 1013599c75ecSLiu Bo 10149a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10159a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 1016599c75ecSLiu Bo int action), 1017599c75ecSLiu Bo 1018d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action) 1019599c75ecSLiu Bo ); 1020599c75ecSLiu Bo 10211abe9b8aSliubo #define show_chunk_type(type) \ 10221abe9b8aSliubo __print_flags(type, "|", \ 10231abe9b8aSliubo { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ 10241abe9b8aSliubo { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 10251abe9b8aSliubo { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 10261abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ 10271abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ 10281abe9b8aSliubo { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ 1029e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 1030e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ 1031e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) 10321abe9b8aSliubo 10331abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__chunk, 10341abe9b8aSliubo 10359a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10369a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 10371abe9b8aSliubo 10386bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size), 10391abe9b8aSliubo 1040bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 10411abe9b8aSliubo __field( int, num_stripes ) 10421abe9b8aSliubo __field( u64, type ) 10431abe9b8aSliubo __field( int, sub_stripes ) 10441abe9b8aSliubo __field( u64, offset ) 10451abe9b8aSliubo __field( u64, size ) 10461abe9b8aSliubo __field( u64, root_objectid ) 10471abe9b8aSliubo ), 10481abe9b8aSliubo 10496bccf3abSJeff Mahoney TP_fast_assign_btrfs(fs_info, 10501abe9b8aSliubo __entry->num_stripes = map->num_stripes; 10511abe9b8aSliubo __entry->type = map->type; 10521abe9b8aSliubo __entry->sub_stripes = map->sub_stripes; 10531abe9b8aSliubo __entry->offset = offset; 10541abe9b8aSliubo __entry->size = size; 10556bccf3abSJeff Mahoney __entry->root_objectid = fs_info->chunk_root->root_key.objectid; 10561abe9b8aSliubo ), 10571abe9b8aSliubo 1058562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu " 1059562a7a07SDavid Sterba "num_stripes=%d sub_stripes=%d type=%s", 10601abe9b8aSliubo show_root_type(__entry->root_objectid), 10618eec8463SDavid Sterba __entry->offset, 10628eec8463SDavid Sterba __entry->size, 10631abe9b8aSliubo __entry->num_stripes, __entry->sub_stripes, 10641abe9b8aSliubo show_chunk_type(__entry->type)) 10651abe9b8aSliubo ); 10661abe9b8aSliubo 10671abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, 10681abe9b8aSliubo 10699a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10709a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 10711abe9b8aSliubo 10726bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size) 10731abe9b8aSliubo ); 10741abe9b8aSliubo 10751abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, 10761abe9b8aSliubo 10779a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10789a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 10791abe9b8aSliubo 10806bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size) 10811abe9b8aSliubo ); 10821abe9b8aSliubo 10831abe9b8aSliubo TRACE_EVENT(btrfs_cow_block, 10841abe9b8aSliubo 10859a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf, 10869a35b637SJeff Mahoney const struct extent_buffer *cow), 10871abe9b8aSliubo 10881abe9b8aSliubo TP_ARGS(root, buf, cow), 10891abe9b8aSliubo 1090bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 10911abe9b8aSliubo __field( u64, root_objectid ) 10921abe9b8aSliubo __field( u64, buf_start ) 10931abe9b8aSliubo __field( int, refs ) 10941abe9b8aSliubo __field( u64, cow_start ) 10951abe9b8aSliubo __field( int, buf_level ) 10961abe9b8aSliubo __field( int, cow_level ) 10971abe9b8aSliubo ), 10981abe9b8aSliubo 1099bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 11001abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 11011abe9b8aSliubo __entry->buf_start = buf->start; 11021abe9b8aSliubo __entry->refs = atomic_read(&buf->refs); 11031abe9b8aSliubo __entry->cow_start = cow->start; 11041abe9b8aSliubo __entry->buf_level = btrfs_header_level(buf); 11051abe9b8aSliubo __entry->cow_level = btrfs_header_level(cow); 11061abe9b8aSliubo ), 11071abe9b8aSliubo 1108562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu " 1109562a7a07SDavid Sterba "(orig_level=%d) cow_buf=%llu (cow_level=%d)", 11101abe9b8aSliubo show_root_type(__entry->root_objectid), 11111abe9b8aSliubo __entry->refs, 11128eec8463SDavid Sterba __entry->buf_start, 11131abe9b8aSliubo __entry->buf_level, 11148eec8463SDavid Sterba __entry->cow_start, 11151abe9b8aSliubo __entry->cow_level) 11161abe9b8aSliubo ); 11171abe9b8aSliubo 11188c2a3ca2SJosef Bacik TRACE_EVENT(btrfs_space_reservation, 11198c2a3ca2SJosef Bacik 11201d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, const char *type, u64 val, 11218c2a3ca2SJosef Bacik u64 bytes, int reserve), 11228c2a3ca2SJosef Bacik 11238c2a3ca2SJosef Bacik TP_ARGS(fs_info, type, val, bytes, reserve), 11248c2a3ca2SJosef Bacik 1125bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 11268c2a3ca2SJosef Bacik __string( type, type ) 11278c2a3ca2SJosef Bacik __field( u64, val ) 11288c2a3ca2SJosef Bacik __field( u64, bytes ) 11298c2a3ca2SJosef Bacik __field( int, reserve ) 11308c2a3ca2SJosef Bacik ), 11318c2a3ca2SJosef Bacik 1132bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 11338c2a3ca2SJosef Bacik __assign_str(type, type); 11348c2a3ca2SJosef Bacik __entry->val = val; 11358c2a3ca2SJosef Bacik __entry->bytes = bytes; 11368c2a3ca2SJosef Bacik __entry->reserve = reserve; 11378c2a3ca2SJosef Bacik ), 11388c2a3ca2SJosef Bacik 11395439c7f5SDavid Sterba TP_printk_btrfs("%s: %llu %s %llu", __get_str(type), __entry->val, 1140bc074524SJeff Mahoney __entry->reserve ? "reserve" : "release", 11418c2a3ca2SJosef Bacik __entry->bytes) 11428c2a3ca2SJosef Bacik ); 11438c2a3ca2SJosef Bacik 1144f376df2bSJosef Bacik TRACE_EVENT(btrfs_trigger_flush, 1145f376df2bSJosef Bacik 11469a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, 11471d2e7c7cSDavid Sterba int flush, const char *reason), 1148f376df2bSJosef Bacik 1149f376df2bSJosef Bacik TP_ARGS(fs_info, flags, bytes, flush, reason), 1150f376df2bSJosef Bacik 11512e63e62dSDavid Sterba TP_STRUCT__entry_btrfs( 1152f376df2bSJosef Bacik __field( u64, flags ) 1153f376df2bSJosef Bacik __field( u64, bytes ) 1154f376df2bSJosef Bacik __field( int, flush ) 1155f376df2bSJosef Bacik __string( reason, reason ) 1156f376df2bSJosef Bacik ), 1157f376df2bSJosef Bacik 11582e63e62dSDavid Sterba TP_fast_assign_btrfs(fs_info, 1159f376df2bSJosef Bacik __entry->flags = flags; 1160f376df2bSJosef Bacik __entry->bytes = bytes; 1161f376df2bSJosef Bacik __entry->flush = flush; 116278c14b38SJoe Perches __assign_str(reason, reason); 1163f376df2bSJosef Bacik ), 1164f376df2bSJosef Bacik 11652e63e62dSDavid Sterba TP_printk_btrfs("%s: flush=%d(%s) flags=%llu(%s) bytes=%llu", 11662e63e62dSDavid Sterba __get_str(reason), __entry->flush, 116745e31869SNikolay Borisov __print_symbolic(__entry->flush, FLUSH_ACTIONS), 11688eec8463SDavid Sterba __entry->flags, 1169f376df2bSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 1170f376df2bSJosef Bacik BTRFS_GROUP_FLAGS), 11718eec8463SDavid Sterba __entry->bytes) 1172f376df2bSJosef Bacik ); 1173f376df2bSJosef Bacik 1174f376df2bSJosef Bacik 1175f376df2bSJosef Bacik TRACE_EVENT(btrfs_flush_space, 1176f376df2bSJosef Bacik 11779a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes, 11784b02b00fSJosef Bacik int state, int ret, bool for_preempt), 1179f376df2bSJosef Bacik 11804b02b00fSJosef Bacik TP_ARGS(fs_info, flags, num_bytes, state, ret, for_preempt), 1181f376df2bSJosef Bacik 11822e63e62dSDavid Sterba TP_STRUCT__entry_btrfs( 1183f376df2bSJosef Bacik __field( u64, flags ) 1184f376df2bSJosef Bacik __field( u64, num_bytes ) 1185f376df2bSJosef Bacik __field( int, state ) 1186f376df2bSJosef Bacik __field( int, ret ) 11874b02b00fSJosef Bacik __field( bool, for_preempt ) 1188f376df2bSJosef Bacik ), 1189f376df2bSJosef Bacik 11902e63e62dSDavid Sterba TP_fast_assign_btrfs(fs_info, 1191f376df2bSJosef Bacik __entry->flags = flags; 1192f376df2bSJosef Bacik __entry->num_bytes = num_bytes; 1193f376df2bSJosef Bacik __entry->state = state; 1194f376df2bSJosef Bacik __entry->ret = ret; 11954b02b00fSJosef Bacik __entry->for_preempt = for_preempt; 1196f376df2bSJosef Bacik ), 1197f376df2bSJosef Bacik 11984b02b00fSJosef Bacik TP_printk_btrfs("state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d for_preempt=%d", 11992e63e62dSDavid Sterba __entry->state, 1200f0cdd15cSNikolay Borisov __print_symbolic(__entry->state, FLUSH_STATES), 12018eec8463SDavid Sterba __entry->flags, 1202f376df2bSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 1203f376df2bSJosef Bacik BTRFS_GROUP_FLAGS), 12044b02b00fSJosef Bacik __entry->num_bytes, __entry->ret, __entry->for_preempt) 1205f376df2bSJosef Bacik ); 1206f376df2bSJosef Bacik 12071abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__reserved_extent, 12081abe9b8aSliubo 12099a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 12101abe9b8aSliubo 121171ff6437SJeff Mahoney TP_ARGS(fs_info, start, len), 12121abe9b8aSliubo 1213bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 12141abe9b8aSliubo __field( u64, start ) 12151abe9b8aSliubo __field( u64, len ) 12161abe9b8aSliubo ), 12171abe9b8aSliubo 121871ff6437SJeff Mahoney TP_fast_assign_btrfs(fs_info, 12191abe9b8aSliubo __entry->start = start; 12201abe9b8aSliubo __entry->len = len; 12211abe9b8aSliubo ), 12221abe9b8aSliubo 1223562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu", 122471ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 12258eec8463SDavid Sterba __entry->start, 12268eec8463SDavid Sterba __entry->len) 12271abe9b8aSliubo ); 12281abe9b8aSliubo 12291abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, 12301abe9b8aSliubo 12319a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 12321abe9b8aSliubo 123371ff6437SJeff Mahoney TP_ARGS(fs_info, start, len) 12341abe9b8aSliubo ); 12351abe9b8aSliubo 12361abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, 12371abe9b8aSliubo 12389a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 12391abe9b8aSliubo 124071ff6437SJeff Mahoney TP_ARGS(fs_info, start, len) 12411abe9b8aSliubo ); 12421abe9b8aSliubo 12433f7de037SJosef Bacik TRACE_EVENT(find_free_extent, 12443f7de037SJosef Bacik 1245*cfc2de0fSBoris Burkov TP_PROTO(const struct btrfs_root *root, 1246*cfc2de0fSBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 12473f7de037SJosef Bacik 1248*cfc2de0fSBoris Burkov TP_ARGS(root, ffe_ctl), 12493f7de037SJosef Bacik 1250bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1251437490feSQu Wenruo __field( u64, root_objectid ) 12523f7de037SJosef Bacik __field( u64, num_bytes ) 12533f7de037SJosef Bacik __field( u64, empty_size ) 1254*cfc2de0fSBoris Burkov __field( u64, flags ) 12553f7de037SJosef Bacik ), 12563f7de037SJosef Bacik 1257437490feSQu Wenruo TP_fast_assign_btrfs(root->fs_info, 1258437490feSQu Wenruo __entry->root_objectid = root->root_key.objectid; 1259*cfc2de0fSBoris Burkov __entry->num_bytes = ffe_ctl->num_bytes; 1260*cfc2de0fSBoris Burkov __entry->empty_size = ffe_ctl->empty_size; 1261*cfc2de0fSBoris Burkov __entry->flags = ffe_ctl->flags; 12623f7de037SJosef Bacik ), 12633f7de037SJosef Bacik 12645439c7f5SDavid Sterba TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s)", 1265437490feSQu Wenruo show_root_type(__entry->root_objectid), 1266*cfc2de0fSBoris Burkov __entry->num_bytes, __entry->empty_size, __entry->flags, 1267*cfc2de0fSBoris Burkov __print_flags((unsigned long)__entry->flags, "|", 12683f7de037SJosef Bacik BTRFS_GROUP_FLAGS)) 12693f7de037SJosef Bacik ); 12703f7de037SJosef Bacik 12713f7de037SJosef Bacik DECLARE_EVENT_CLASS(btrfs__reserve_extent, 12723f7de037SJosef Bacik 1273*cfc2de0fSBoris Burkov TP_PROTO(const struct btrfs_block_group *block_group, 1274*cfc2de0fSBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 12753f7de037SJosef Bacik 1276*cfc2de0fSBoris Burkov TP_ARGS(block_group, ffe_ctl), 12773f7de037SJosef Bacik 1278bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 12793f7de037SJosef Bacik __field( u64, bg_objectid ) 12803f7de037SJosef Bacik __field( u64, flags ) 12813f7de037SJosef Bacik __field( u64, start ) 12823f7de037SJosef Bacik __field( u64, len ) 12833f7de037SJosef Bacik ), 12843f7de037SJosef Bacik 12853dca5c94SQu Wenruo TP_fast_assign_btrfs(block_group->fs_info, 1286b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 12873f7de037SJosef Bacik __entry->flags = block_group->flags; 1288*cfc2de0fSBoris Burkov __entry->start = ffe_ctl->search_start; 1289*cfc2de0fSBoris Burkov __entry->len = ffe_ctl->num_bytes; 12903f7de037SJosef Bacik ), 12913f7de037SJosef Bacik 12925439c7f5SDavid Sterba TP_printk_btrfs("root=%llu(%s) block_group=%llu flags=%llu(%s) " 12935439c7f5SDavid Sterba "start=%llu len=%llu", 129471ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 129571ff6437SJeff Mahoney __entry->bg_objectid, 12963f7de037SJosef Bacik __entry->flags, __print_flags((unsigned long)__entry->flags, 12973f7de037SJosef Bacik "|", BTRFS_GROUP_FLAGS), 12983f7de037SJosef Bacik __entry->start, __entry->len) 12993f7de037SJosef Bacik ); 13003f7de037SJosef Bacik 13013f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, 13023f7de037SJosef Bacik 1303*cfc2de0fSBoris Burkov TP_PROTO(const struct btrfs_block_group *block_group, 1304*cfc2de0fSBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 13053f7de037SJosef Bacik 1306*cfc2de0fSBoris Burkov TP_ARGS(block_group, ffe_ctl) 13073f7de037SJosef Bacik ); 13083f7de037SJosef Bacik 13093f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, 13103f7de037SJosef Bacik 1311*cfc2de0fSBoris Burkov TP_PROTO(const struct btrfs_block_group *block_group, 1312*cfc2de0fSBoris Burkov const struct find_free_extent_ctl *ffe_ctl), 13133f7de037SJosef Bacik 1314*cfc2de0fSBoris Burkov TP_ARGS(block_group, ffe_ctl) 13153f7de037SJosef Bacik ); 13163f7de037SJosef Bacik 13173f7de037SJosef Bacik TRACE_EVENT(btrfs_find_cluster, 13183f7de037SJosef Bacik 131932da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group, u64 start, 13203f7de037SJosef Bacik u64 bytes, u64 empty_size, u64 min_bytes), 13213f7de037SJosef Bacik 13223f7de037SJosef Bacik TP_ARGS(block_group, start, bytes, empty_size, min_bytes), 13233f7de037SJosef Bacik 1324bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 13253f7de037SJosef Bacik __field( u64, bg_objectid ) 13263f7de037SJosef Bacik __field( u64, flags ) 13273f7de037SJosef Bacik __field( u64, start ) 13283f7de037SJosef Bacik __field( u64, bytes ) 13293f7de037SJosef Bacik __field( u64, empty_size ) 13303f7de037SJosef Bacik __field( u64, min_bytes ) 13313f7de037SJosef Bacik ), 13323f7de037SJosef Bacik 1333bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 1334b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 13353f7de037SJosef Bacik __entry->flags = block_group->flags; 13363f7de037SJosef Bacik __entry->start = start; 13373f7de037SJosef Bacik __entry->bytes = bytes; 13383f7de037SJosef Bacik __entry->empty_size = empty_size; 13393f7de037SJosef Bacik __entry->min_bytes = min_bytes; 13403f7de037SJosef Bacik ), 13413f7de037SJosef Bacik 13425439c7f5SDavid Sterba TP_printk_btrfs("block_group=%llu flags=%llu(%s) start=%llu len=%llu " 13435439c7f5SDavid Sterba "empty_size=%llu min_bytes=%llu", __entry->bg_objectid, 13443f7de037SJosef Bacik __entry->flags, 13453f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 13463f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 13473f7de037SJosef Bacik __entry->bytes, __entry->empty_size, __entry->min_bytes) 13483f7de037SJosef Bacik ); 13493f7de037SJosef Bacik 13503f7de037SJosef Bacik TRACE_EVENT(btrfs_failed_cluster_setup, 13513f7de037SJosef Bacik 135232da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group), 13533f7de037SJosef Bacik 13543f7de037SJosef Bacik TP_ARGS(block_group), 13553f7de037SJosef Bacik 1356bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 13573f7de037SJosef Bacik __field( u64, bg_objectid ) 13583f7de037SJosef Bacik ), 13593f7de037SJosef Bacik 1360bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 1361b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 13623f7de037SJosef Bacik ), 13633f7de037SJosef Bacik 13645439c7f5SDavid Sterba TP_printk_btrfs("block_group=%llu", __entry->bg_objectid) 13653f7de037SJosef Bacik ); 13663f7de037SJosef Bacik 13673f7de037SJosef Bacik TRACE_EVENT(btrfs_setup_cluster, 13683f7de037SJosef Bacik 136932da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group, 13709a35b637SJeff Mahoney const struct btrfs_free_cluster *cluster, 13719a35b637SJeff Mahoney u64 size, int bitmap), 13723f7de037SJosef Bacik 13733f7de037SJosef Bacik TP_ARGS(block_group, cluster, size, bitmap), 13743f7de037SJosef Bacik 1375bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 13763f7de037SJosef Bacik __field( u64, bg_objectid ) 13773f7de037SJosef Bacik __field( u64, flags ) 13783f7de037SJosef Bacik __field( u64, start ) 13793f7de037SJosef Bacik __field( u64, max_size ) 13803f7de037SJosef Bacik __field( u64, size ) 13813f7de037SJosef Bacik __field( int, bitmap ) 13823f7de037SJosef Bacik ), 13833f7de037SJosef Bacik 1384bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 1385b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 13863f7de037SJosef Bacik __entry->flags = block_group->flags; 13873f7de037SJosef Bacik __entry->start = cluster->window_start; 13883f7de037SJosef Bacik __entry->max_size = cluster->max_size; 13893f7de037SJosef Bacik __entry->size = size; 13903f7de037SJosef Bacik __entry->bitmap = bitmap; 13913f7de037SJosef Bacik ), 13923f7de037SJosef Bacik 13935439c7f5SDavid Sterba TP_printk_btrfs("block_group=%llu flags=%llu(%s) window_start=%llu " 13945439c7f5SDavid Sterba "size=%llu max_size=%llu bitmap=%d", 13953f7de037SJosef Bacik __entry->bg_objectid, 13963f7de037SJosef Bacik __entry->flags, 13973f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 13983f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 13993f7de037SJosef Bacik __entry->size, __entry->max_size, __entry->bitmap) 14003f7de037SJosef Bacik ); 14013f7de037SJosef Bacik 1402143bede5SJeff Mahoney struct extent_state; 1403143bede5SJeff Mahoney TRACE_EVENT(alloc_extent_state, 1404143bede5SJeff Mahoney 14059a35b637SJeff Mahoney TP_PROTO(const struct extent_state *state, 14069a35b637SJeff Mahoney gfp_t mask, unsigned long IP), 1407143bede5SJeff Mahoney 1408143bede5SJeff Mahoney TP_ARGS(state, mask, IP), 1409143bede5SJeff Mahoney 1410143bede5SJeff Mahoney TP_STRUCT__entry( 14119a35b637SJeff Mahoney __field(const struct extent_state *, state) 1412fe573327SVasily Averin __field(unsigned long, mask) 141394c3f6c6SDavid Sterba __field(const void*, ip) 1414143bede5SJeff Mahoney ), 1415143bede5SJeff Mahoney 1416143bede5SJeff Mahoney TP_fast_assign( 1417143bede5SJeff Mahoney __entry->state = state, 1418fe573327SVasily Averin __entry->mask = (__force unsigned long)mask, 141994c3f6c6SDavid Sterba __entry->ip = (const void *)IP 1420143bede5SJeff Mahoney ), 1421143bede5SJeff Mahoney 1422562a7a07SDavid Sterba TP_printk("state=%p mask=%s caller=%pS", __entry->state, 142394c3f6c6SDavid Sterba show_gfp_flags(__entry->mask), __entry->ip) 1424143bede5SJeff Mahoney ); 1425143bede5SJeff Mahoney 1426143bede5SJeff Mahoney TRACE_EVENT(free_extent_state, 1427143bede5SJeff Mahoney 14289a35b637SJeff Mahoney TP_PROTO(const struct extent_state *state, unsigned long IP), 1429143bede5SJeff Mahoney 1430143bede5SJeff Mahoney TP_ARGS(state, IP), 1431143bede5SJeff Mahoney 1432143bede5SJeff Mahoney TP_STRUCT__entry( 14339a35b637SJeff Mahoney __field(const struct extent_state *, state) 143494c3f6c6SDavid Sterba __field(const void*, ip) 1435143bede5SJeff Mahoney ), 1436143bede5SJeff Mahoney 1437143bede5SJeff Mahoney TP_fast_assign( 1438143bede5SJeff Mahoney __entry->state = state, 143994c3f6c6SDavid Sterba __entry->ip = (const void *)IP 1440143bede5SJeff Mahoney ), 1441143bede5SJeff Mahoney 144294c3f6c6SDavid Sterba TP_printk("state=%p caller=%pS", __entry->state, __entry->ip) 1443143bede5SJeff Mahoney ); 1444143bede5SJeff Mahoney 144552483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work, 144652483bc2SQu Wenruo 14479a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 144852483bc2SQu Wenruo 144952483bc2SQu Wenruo TP_ARGS(work), 145052483bc2SQu Wenruo 1451bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 14529a35b637SJeff Mahoney __field( const void *, work ) 14539a35b637SJeff Mahoney __field( const void *, wq ) 14549a35b637SJeff Mahoney __field( const void *, func ) 14559a35b637SJeff Mahoney __field( const void *, ordered_func ) 14569a35b637SJeff Mahoney __field( const void *, ordered_free ) 14579a35b637SJeff Mahoney __field( const void *, normal_work ) 145852483bc2SQu Wenruo ), 145952483bc2SQu Wenruo 1460bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_work_owner(work), 146152483bc2SQu Wenruo __entry->work = work; 146252483bc2SQu Wenruo __entry->wq = work->wq; 146352483bc2SQu Wenruo __entry->func = work->func; 146452483bc2SQu Wenruo __entry->ordered_func = work->ordered_func; 146552483bc2SQu Wenruo __entry->ordered_free = work->ordered_free; 1466b38a6258SLiu Bo __entry->normal_work = &work->normal_work; 146752483bc2SQu Wenruo ), 146852483bc2SQu Wenruo 1469d75f773cSSakari Ailus TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%ps ordered_func=%p " 1470b38a6258SLiu Bo "ordered_free=%p", 1471b38a6258SLiu Bo __entry->work, __entry->normal_work, __entry->wq, 1472b38a6258SLiu Bo __entry->func, __entry->ordered_func, __entry->ordered_free) 147352483bc2SQu Wenruo ); 147452483bc2SQu Wenruo 1475ac0c7cf8SDavid Sterba /* 1476c9eb55dbSOmar Sandoval * For situations when the work is freed, we pass fs_info and a tag that matches 1477c9eb55dbSOmar Sandoval * the address of the work structure so it can be paired with the scheduling 1478c9eb55dbSOmar Sandoval * event. DO NOT add anything here that dereferences wtag. 1479ac0c7cf8SDavid Sterba */ 148052483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work__done, 148152483bc2SQu Wenruo 14829a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), 148352483bc2SQu Wenruo 1484ac0c7cf8SDavid Sterba TP_ARGS(fs_info, wtag), 148552483bc2SQu Wenruo 1486bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 14879a35b637SJeff Mahoney __field( const void *, wtag ) 148852483bc2SQu Wenruo ), 148952483bc2SQu Wenruo 1490ac0c7cf8SDavid Sterba TP_fast_assign_btrfs(fs_info, 1491ac0c7cf8SDavid Sterba __entry->wtag = wtag; 149252483bc2SQu Wenruo ), 149352483bc2SQu Wenruo 1494ac0c7cf8SDavid Sterba TP_printk_btrfs("work->%p", __entry->wtag) 149552483bc2SQu Wenruo ); 149652483bc2SQu Wenruo 149752483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_queued, 149852483bc2SQu Wenruo 14999a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 150052483bc2SQu Wenruo 150152483bc2SQu Wenruo TP_ARGS(work) 150252483bc2SQu Wenruo ); 150352483bc2SQu Wenruo 150452483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_sched, 150552483bc2SQu Wenruo 15069a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 150752483bc2SQu Wenruo 150852483bc2SQu Wenruo TP_ARGS(work) 150952483bc2SQu Wenruo ); 151052483bc2SQu Wenruo 151152483bc2SQu Wenruo DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, 151252483bc2SQu Wenruo 15139a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), 151452483bc2SQu Wenruo 1515ac0c7cf8SDavid Sterba TP_ARGS(fs_info, wtag) 151652483bc2SQu Wenruo ); 151752483bc2SQu Wenruo 151852483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_ordered_sched, 151952483bc2SQu Wenruo 15209a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 152152483bc2SQu Wenruo 152252483bc2SQu Wenruo TP_ARGS(work) 152352483bc2SQu Wenruo ); 152452483bc2SQu Wenruo 1525a31b4a43SChristoph Hellwig DECLARE_EVENT_CLASS(btrfs_workqueue, 1526c3a46891SQu Wenruo 1527a31b4a43SChristoph Hellwig TP_PROTO(const struct btrfs_workqueue *wq, const char *name), 1528c3a46891SQu Wenruo 1529a31b4a43SChristoph Hellwig TP_ARGS(wq, name), 1530c3a46891SQu Wenruo 1531bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15329a35b637SJeff Mahoney __field( const void *, wq ) 1533c3a46891SQu Wenruo __string( name, name ) 1534c3a46891SQu Wenruo ), 1535c3a46891SQu Wenruo 1536bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1537c3a46891SQu Wenruo __entry->wq = wq; 1538c3a46891SQu Wenruo __assign_str(name, name); 1539c3a46891SQu Wenruo ), 1540c3a46891SQu Wenruo 1541a31b4a43SChristoph Hellwig TP_printk_btrfs("name=%s wq=%p", __get_str(name), 1542c3a46891SQu Wenruo __entry->wq) 1543c3a46891SQu Wenruo ); 1544c3a46891SQu Wenruo 1545a31b4a43SChristoph Hellwig DEFINE_EVENT(btrfs_workqueue, btrfs_workqueue_alloc, 1546c3a46891SQu Wenruo 1547a31b4a43SChristoph Hellwig TP_PROTO(const struct btrfs_workqueue *wq, const char *name), 1548c3a46891SQu Wenruo 1549a31b4a43SChristoph Hellwig TP_ARGS(wq, name) 1550c3a46891SQu Wenruo ); 1551c3a46891SQu Wenruo 1552a31b4a43SChristoph Hellwig DECLARE_EVENT_CLASS(btrfs_workqueue_done, 1553c3a46891SQu Wenruo 1554a31b4a43SChristoph Hellwig TP_PROTO(const struct btrfs_workqueue *wq), 1555c3a46891SQu Wenruo 1556c3a46891SQu Wenruo TP_ARGS(wq), 1557c3a46891SQu Wenruo 1558bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15599a35b637SJeff Mahoney __field( const void *, wq ) 1560c3a46891SQu Wenruo ), 1561c3a46891SQu Wenruo 1562bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1563c3a46891SQu Wenruo __entry->wq = wq; 1564c3a46891SQu Wenruo ), 1565c3a46891SQu Wenruo 1566bc074524SJeff Mahoney TP_printk_btrfs("wq=%p", __entry->wq) 1567c3a46891SQu Wenruo ); 1568c3a46891SQu Wenruo 1569a31b4a43SChristoph Hellwig DEFINE_EVENT(btrfs_workqueue_done, btrfs_workqueue_destroy, 1570c3a46891SQu Wenruo 1571a31b4a43SChristoph Hellwig TP_PROTO(const struct btrfs_workqueue *wq), 1572c3a46891SQu Wenruo 1573c3a46891SQu Wenruo TP_ARGS(wq) 1574c3a46891SQu Wenruo ); 157552483bc2SQu Wenruo 157681fb6f77SQu Wenruo #define BTRFS_QGROUP_OPERATIONS \ 157781fb6f77SQu Wenruo { QGROUP_RESERVE, "reserve" }, \ 157881fb6f77SQu Wenruo { QGROUP_RELEASE, "release" }, \ 157981fb6f77SQu Wenruo { QGROUP_FREE, "free" } 158081fb6f77SQu Wenruo 158181fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, 158281fb6f77SQu Wenruo 15839a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 15849a35b637SJeff Mahoney u64 reserved, int op), 158581fb6f77SQu Wenruo 158681fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op), 158781fb6f77SQu Wenruo 1588bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 158981fb6f77SQu Wenruo __field( u64, rootid ) 1590f8f8e189SDavid Sterba __field( u64, ino ) 159181fb6f77SQu Wenruo __field( u64, start ) 159281fb6f77SQu Wenruo __field( u64, len ) 159381fb6f77SQu Wenruo __field( u64, reserved ) 159481fb6f77SQu Wenruo __field( int, op ) 159581fb6f77SQu Wenruo ), 159681fb6f77SQu Wenruo 1597bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 15984fd786e6SMisono Tomohiro __entry->rootid = 15994fd786e6SMisono Tomohiro BTRFS_I(inode)->root->root_key.objectid; 1600f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 160181fb6f77SQu Wenruo __entry->start = start; 160281fb6f77SQu Wenruo __entry->len = len; 160381fb6f77SQu Wenruo __entry->reserved = reserved; 160481fb6f77SQu Wenruo __entry->op = op; 160581fb6f77SQu Wenruo ), 160681fb6f77SQu Wenruo 1607f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu ino=%llu start=%llu len=%llu reserved=%llu op=%s", 160881fb6f77SQu Wenruo __entry->rootid, __entry->ino, __entry->start, __entry->len, 160981fb6f77SQu Wenruo __entry->reserved, 161081fb6f77SQu Wenruo __print_flags((unsigned long)__entry->op, "", 161181fb6f77SQu Wenruo BTRFS_QGROUP_OPERATIONS) 161281fb6f77SQu Wenruo ) 161381fb6f77SQu Wenruo ); 161481fb6f77SQu Wenruo 161581fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data, 161681fb6f77SQu Wenruo 16179a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 16189a35b637SJeff Mahoney u64 reserved, int op), 161981fb6f77SQu Wenruo 162081fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 162181fb6f77SQu Wenruo ); 162281fb6f77SQu Wenruo 162381fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data, 162481fb6f77SQu Wenruo 16259a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 16269a35b637SJeff Mahoney u64 reserved, int op), 162781fb6f77SQu Wenruo 162881fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 162981fb6f77SQu Wenruo ); 163081fb6f77SQu Wenruo 16310f5dcf8dSMark Fasheh DECLARE_EVENT_CLASS(btrfs_qgroup_extent, 16329a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 16339a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 16340f5dcf8dSMark Fasheh 1635bc074524SJeff Mahoney TP_ARGS(fs_info, rec), 16360f5dcf8dSMark Fasheh 1637bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 16380f5dcf8dSMark Fasheh __field( u64, bytenr ) 16390f5dcf8dSMark Fasheh __field( u64, num_bytes ) 16400f5dcf8dSMark Fasheh ), 16410f5dcf8dSMark Fasheh 1642bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 16430f5dcf8dSMark Fasheh __entry->bytenr = rec->bytenr, 16440f5dcf8dSMark Fasheh __entry->num_bytes = rec->num_bytes; 16450f5dcf8dSMark Fasheh ), 16460f5dcf8dSMark Fasheh 1647562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu", 164894c3f6c6SDavid Sterba __entry->bytenr, __entry->num_bytes) 16490f5dcf8dSMark Fasheh ); 16500f5dcf8dSMark Fasheh 16510f5dcf8dSMark Fasheh DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, 16520f5dcf8dSMark Fasheh 16539a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 16549a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 16550f5dcf8dSMark Fasheh 1656bc074524SJeff Mahoney TP_ARGS(fs_info, rec) 16570f5dcf8dSMark Fasheh ); 16580f5dcf8dSMark Fasheh 165950b3e040SQu Wenruo DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent, 16600f5dcf8dSMark Fasheh 16619a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 16629a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 16630f5dcf8dSMark Fasheh 1664bc074524SJeff Mahoney TP_ARGS(fs_info, rec) 16650f5dcf8dSMark Fasheh ); 16660f5dcf8dSMark Fasheh 1667c337e7b0SQu Wenruo TRACE_EVENT(qgroup_num_dirty_extents, 1668c337e7b0SQu Wenruo 1669c337e7b0SQu Wenruo TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, 1670c337e7b0SQu Wenruo u64 num_dirty_extents), 1671c337e7b0SQu Wenruo 1672c337e7b0SQu Wenruo TP_ARGS(fs_info, transid, num_dirty_extents), 1673c337e7b0SQu Wenruo 1674c337e7b0SQu Wenruo TP_STRUCT__entry_btrfs( 1675c337e7b0SQu Wenruo __field( u64, transid ) 1676c337e7b0SQu Wenruo __field( u64, num_dirty_extents ) 1677c337e7b0SQu Wenruo ), 1678c337e7b0SQu Wenruo 1679c337e7b0SQu Wenruo TP_fast_assign_btrfs(fs_info, 1680c337e7b0SQu Wenruo __entry->transid = transid; 1681c337e7b0SQu Wenruo __entry->num_dirty_extents = num_dirty_extents; 1682c337e7b0SQu Wenruo ), 1683c337e7b0SQu Wenruo 1684c337e7b0SQu Wenruo TP_printk_btrfs("transid=%llu num_dirty_extents=%llu", 1685c337e7b0SQu Wenruo __entry->transid, __entry->num_dirty_extents) 1686c337e7b0SQu Wenruo ); 1687c337e7b0SQu Wenruo 16880f5dcf8dSMark Fasheh TRACE_EVENT(btrfs_qgroup_account_extent, 16890f5dcf8dSMark Fasheh 1690c9f6f3cdSQu Wenruo TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, u64 bytenr, 1691bc074524SJeff Mahoney u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), 16920f5dcf8dSMark Fasheh 1693c9f6f3cdSQu Wenruo TP_ARGS(fs_info, transid, bytenr, num_bytes, nr_old_roots, 1694c9f6f3cdSQu Wenruo nr_new_roots), 16950f5dcf8dSMark Fasheh 1696bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1697c9f6f3cdSQu Wenruo __field( u64, transid ) 16980f5dcf8dSMark Fasheh __field( u64, bytenr ) 16990f5dcf8dSMark Fasheh __field( u64, num_bytes ) 17000f5dcf8dSMark Fasheh __field( u64, nr_old_roots ) 17010f5dcf8dSMark Fasheh __field( u64, nr_new_roots ) 17020f5dcf8dSMark Fasheh ), 17030f5dcf8dSMark Fasheh 1704bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 1705c9f6f3cdSQu Wenruo __entry->transid = transid; 17060f5dcf8dSMark Fasheh __entry->bytenr = bytenr; 17070f5dcf8dSMark Fasheh __entry->num_bytes = num_bytes; 17080f5dcf8dSMark Fasheh __entry->nr_old_roots = nr_old_roots; 17090f5dcf8dSMark Fasheh __entry->nr_new_roots = nr_new_roots; 17100f5dcf8dSMark Fasheh ), 17110f5dcf8dSMark Fasheh 1712c9f6f3cdSQu Wenruo TP_printk_btrfs( 1713c9f6f3cdSQu Wenruo "transid=%llu bytenr=%llu num_bytes=%llu nr_old_roots=%llu nr_new_roots=%llu", 1714c9f6f3cdSQu Wenruo __entry->transid, 17150f5dcf8dSMark Fasheh __entry->bytenr, 17160f5dcf8dSMark Fasheh __entry->num_bytes, 17170f5dcf8dSMark Fasheh __entry->nr_old_roots, 17180f5dcf8dSMark Fasheh __entry->nr_new_roots) 17190f5dcf8dSMark Fasheh ); 17200f5dcf8dSMark Fasheh 17210f5dcf8dSMark Fasheh TRACE_EVENT(qgroup_update_counters, 17220f5dcf8dSMark Fasheh 17238b317901SQu Wenruo TP_PROTO(const struct btrfs_fs_info *fs_info, 17241d2e7c7cSDavid Sterba const struct btrfs_qgroup *qgroup, 1725bc074524SJeff Mahoney u64 cur_old_count, u64 cur_new_count), 17260f5dcf8dSMark Fasheh 17278b317901SQu Wenruo TP_ARGS(fs_info, qgroup, cur_old_count, cur_new_count), 17280f5dcf8dSMark Fasheh 1729bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 17300f5dcf8dSMark Fasheh __field( u64, qgid ) 17318b317901SQu Wenruo __field( u64, old_rfer ) 17328b317901SQu Wenruo __field( u64, old_excl ) 17330f5dcf8dSMark Fasheh __field( u64, cur_old_count ) 17340f5dcf8dSMark Fasheh __field( u64, cur_new_count ) 17350f5dcf8dSMark Fasheh ), 17360f5dcf8dSMark Fasheh 1737bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 17388b317901SQu Wenruo __entry->qgid = qgroup->qgroupid; 17398b317901SQu Wenruo __entry->old_rfer = qgroup->rfer; 17408b317901SQu Wenruo __entry->old_excl = qgroup->excl; 17410f5dcf8dSMark Fasheh __entry->cur_old_count = cur_old_count; 17420f5dcf8dSMark Fasheh __entry->cur_new_count = cur_new_count; 17430f5dcf8dSMark Fasheh ), 17440f5dcf8dSMark Fasheh 17458b317901SQu Wenruo TP_printk_btrfs("qgid=%llu old_rfer=%llu old_excl=%llu cur_old_count=%llu cur_new_count=%llu", 17468b317901SQu Wenruo __entry->qgid, __entry->old_rfer, __entry->old_excl, 17478b317901SQu Wenruo __entry->cur_old_count, __entry->cur_new_count) 17480f5dcf8dSMark Fasheh ); 17490f5dcf8dSMark Fasheh 17503159fe7bSQu Wenruo TRACE_EVENT(qgroup_update_reserve, 17513159fe7bSQu Wenruo 17523159fe7bSQu Wenruo TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup, 175364ee4e75SQu Wenruo s64 diff, int type), 17543159fe7bSQu Wenruo 175564ee4e75SQu Wenruo TP_ARGS(fs_info, qgroup, diff, type), 17563159fe7bSQu Wenruo 17573159fe7bSQu Wenruo TP_STRUCT__entry_btrfs( 17583159fe7bSQu Wenruo __field( u64, qgid ) 17593159fe7bSQu Wenruo __field( u64, cur_reserved ) 17603159fe7bSQu Wenruo __field( s64, diff ) 176164ee4e75SQu Wenruo __field( int, type ) 17623159fe7bSQu Wenruo ), 17633159fe7bSQu Wenruo 17643159fe7bSQu Wenruo TP_fast_assign_btrfs(fs_info, 17653159fe7bSQu Wenruo __entry->qgid = qgroup->qgroupid; 176664ee4e75SQu Wenruo __entry->cur_reserved = qgroup->rsv.values[type]; 17673159fe7bSQu Wenruo __entry->diff = diff; 17681b2442b4SQu Wenruo __entry->type = type; 17693159fe7bSQu Wenruo ), 17703159fe7bSQu Wenruo 177164ee4e75SQu Wenruo TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld", 17721cb1f0b2SNikolay Borisov __entry->qgid, __print_symbolic(__entry->type, QGROUP_RSV_TYPES), 177364ee4e75SQu Wenruo __entry->cur_reserved, __entry->diff) 17743159fe7bSQu Wenruo ); 17753159fe7bSQu Wenruo 17763159fe7bSQu Wenruo TRACE_EVENT(qgroup_meta_reserve, 17773159fe7bSQu Wenruo 17784ee0d883SQu Wenruo TP_PROTO(struct btrfs_root *root, s64 diff, int type), 17793159fe7bSQu Wenruo 17804ee0d883SQu Wenruo TP_ARGS(root, diff, type), 17813159fe7bSQu Wenruo 17823159fe7bSQu Wenruo TP_STRUCT__entry_btrfs( 17833159fe7bSQu Wenruo __field( u64, refroot ) 17843159fe7bSQu Wenruo __field( s64, diff ) 17854ee0d883SQu Wenruo __field( int, type ) 17863159fe7bSQu Wenruo ), 17873159fe7bSQu Wenruo 17883159fe7bSQu Wenruo TP_fast_assign_btrfs(root->fs_info, 17894fd786e6SMisono Tomohiro __entry->refroot = root->root_key.objectid; 17903159fe7bSQu Wenruo __entry->diff = diff; 17911b2442b4SQu Wenruo __entry->type = type; 17923159fe7bSQu Wenruo ), 17933159fe7bSQu Wenruo 17944ee0d883SQu Wenruo TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", 17954ee0d883SQu Wenruo show_root_type(__entry->refroot), 17961cb1f0b2SNikolay Borisov __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) 17974ee0d883SQu Wenruo ); 17984ee0d883SQu Wenruo 17994ee0d883SQu Wenruo TRACE_EVENT(qgroup_meta_convert, 18004ee0d883SQu Wenruo 18014ee0d883SQu Wenruo TP_PROTO(struct btrfs_root *root, s64 diff), 18024ee0d883SQu Wenruo 18034ee0d883SQu Wenruo TP_ARGS(root, diff), 18044ee0d883SQu Wenruo 18054ee0d883SQu Wenruo TP_STRUCT__entry_btrfs( 18064ee0d883SQu Wenruo __field( u64, refroot ) 18074ee0d883SQu Wenruo __field( s64, diff ) 18084ee0d883SQu Wenruo ), 18094ee0d883SQu Wenruo 18104ee0d883SQu Wenruo TP_fast_assign_btrfs(root->fs_info, 18114fd786e6SMisono Tomohiro __entry->refroot = root->root_key.objectid; 18124ee0d883SQu Wenruo __entry->diff = diff; 18134ee0d883SQu Wenruo ), 18144ee0d883SQu Wenruo 18154ee0d883SQu Wenruo TP_printk_btrfs("refroot=%llu(%s) type=%s->%s diff=%lld", 18164ee0d883SQu Wenruo show_root_type(__entry->refroot), 18171cb1f0b2SNikolay Borisov __print_symbolic(BTRFS_QGROUP_RSV_META_PREALLOC, QGROUP_RSV_TYPES), 18181cb1f0b2SNikolay Borisov __print_symbolic(BTRFS_QGROUP_RSV_META_PERTRANS, QGROUP_RSV_TYPES), 18194ee0d883SQu Wenruo __entry->diff) 18204ee0d883SQu Wenruo ); 18214ee0d883SQu Wenruo 18224ee0d883SQu Wenruo TRACE_EVENT(qgroup_meta_free_all_pertrans, 18234ee0d883SQu Wenruo 18244ee0d883SQu Wenruo TP_PROTO(struct btrfs_root *root), 18254ee0d883SQu Wenruo 18264ee0d883SQu Wenruo TP_ARGS(root), 18274ee0d883SQu Wenruo 18284ee0d883SQu Wenruo TP_STRUCT__entry_btrfs( 18294ee0d883SQu Wenruo __field( u64, refroot ) 18304ee0d883SQu Wenruo __field( s64, diff ) 18314ee0d883SQu Wenruo __field( int, type ) 18324ee0d883SQu Wenruo ), 18334ee0d883SQu Wenruo 18344ee0d883SQu Wenruo TP_fast_assign_btrfs(root->fs_info, 18354fd786e6SMisono Tomohiro __entry->refroot = root->root_key.objectid; 18364ee0d883SQu Wenruo spin_lock(&root->qgroup_meta_rsv_lock); 18374ee0d883SQu Wenruo __entry->diff = -(s64)root->qgroup_meta_rsv_pertrans; 18384ee0d883SQu Wenruo spin_unlock(&root->qgroup_meta_rsv_lock); 18394ee0d883SQu Wenruo __entry->type = BTRFS_QGROUP_RSV_META_PERTRANS; 18404ee0d883SQu Wenruo ), 18414ee0d883SQu Wenruo 18424ee0d883SQu Wenruo TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", 18434ee0d883SQu Wenruo show_root_type(__entry->refroot), 18441cb1f0b2SNikolay Borisov __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) 18453159fe7bSQu Wenruo ); 18463159fe7bSQu Wenruo 184700142756SJeff Mahoney DECLARE_EVENT_CLASS(btrfs__prelim_ref, 184800142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 184900142756SJeff Mahoney const struct prelim_ref *oldref, 185000142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 185100142756SJeff Mahoney TP_ARGS(fs_info, newref, oldref, tree_size), 185200142756SJeff Mahoney 185300142756SJeff Mahoney TP_STRUCT__entry_btrfs( 185400142756SJeff Mahoney __field( u64, root_id ) 185500142756SJeff Mahoney __field( u64, objectid ) 185600142756SJeff Mahoney __field( u8, type ) 185700142756SJeff Mahoney __field( u64, offset ) 185800142756SJeff Mahoney __field( int, level ) 185900142756SJeff Mahoney __field( int, old_count ) 186000142756SJeff Mahoney __field( u64, parent ) 186100142756SJeff Mahoney __field( u64, bytenr ) 186200142756SJeff Mahoney __field( int, mod_count ) 186300142756SJeff Mahoney __field( u64, tree_size ) 186400142756SJeff Mahoney ), 186500142756SJeff Mahoney 186600142756SJeff Mahoney TP_fast_assign_btrfs(fs_info, 186700142756SJeff Mahoney __entry->root_id = oldref->root_id; 186800142756SJeff Mahoney __entry->objectid = oldref->key_for_search.objectid; 186900142756SJeff Mahoney __entry->type = oldref->key_for_search.type; 187000142756SJeff Mahoney __entry->offset = oldref->key_for_search.offset; 187100142756SJeff Mahoney __entry->level = oldref->level; 187200142756SJeff Mahoney __entry->old_count = oldref->count; 187300142756SJeff Mahoney __entry->parent = oldref->parent; 187400142756SJeff Mahoney __entry->bytenr = oldref->wanted_disk_byte; 187500142756SJeff Mahoney __entry->mod_count = newref ? newref->count : 0; 187600142756SJeff Mahoney __entry->tree_size = tree_size; 187700142756SJeff Mahoney ), 187800142756SJeff Mahoney 187900142756SJeff 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", 18808eec8463SDavid Sterba __entry->root_id, 18818eec8463SDavid Sterba __entry->objectid, __entry->type, 18828eec8463SDavid Sterba __entry->offset, __entry->level, 188300142756SJeff Mahoney __entry->old_count, __entry->mod_count, 188400142756SJeff Mahoney __entry->old_count + __entry->mod_count, 18858eec8463SDavid Sterba __entry->parent, 18868eec8463SDavid Sterba __entry->bytenr, 18878eec8463SDavid Sterba __entry->tree_size) 188800142756SJeff Mahoney ); 188900142756SJeff Mahoney 189000142756SJeff Mahoney DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge, 189100142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 189200142756SJeff Mahoney const struct prelim_ref *oldref, 189300142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 189400142756SJeff Mahoney TP_ARGS(fs_info, oldref, newref, tree_size) 189500142756SJeff Mahoney ); 189600142756SJeff Mahoney 189700142756SJeff Mahoney DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert, 189800142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 189900142756SJeff Mahoney const struct prelim_ref *oldref, 190000142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 190100142756SJeff Mahoney TP_ARGS(fs_info, oldref, newref, tree_size) 190200142756SJeff Mahoney ); 190300142756SJeff Mahoney 1904dd48d407SJosef Bacik TRACE_EVENT(btrfs_inode_mod_outstanding_extents, 19051d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_root *root, u64 ino, int mod), 1906dd48d407SJosef Bacik 1907dd48d407SJosef Bacik TP_ARGS(root, ino, mod), 1908dd48d407SJosef Bacik 1909dd48d407SJosef Bacik TP_STRUCT__entry_btrfs( 1910dd48d407SJosef Bacik __field( u64, root_objectid ) 1911dd48d407SJosef Bacik __field( u64, ino ) 1912dd48d407SJosef Bacik __field( int, mod ) 1913dd48d407SJosef Bacik ), 1914dd48d407SJosef Bacik 1915dd48d407SJosef Bacik TP_fast_assign_btrfs(root->fs_info, 19164fd786e6SMisono Tomohiro __entry->root_objectid = root->root_key.objectid; 1917dd48d407SJosef Bacik __entry->ino = ino; 1918dd48d407SJosef Bacik __entry->mod = mod; 1919dd48d407SJosef Bacik ), 1920dd48d407SJosef Bacik 1921dd48d407SJosef Bacik TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d", 1922dd48d407SJosef Bacik show_root_type(__entry->root_objectid), 19238eec8463SDavid Sterba __entry->ino, __entry->mod) 1924dd48d407SJosef Bacik ); 19253dca5c94SQu Wenruo 19264ed0a7a3SQu Wenruo DECLARE_EVENT_CLASS(btrfs__block_group, 192732da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 19284ed0a7a3SQu Wenruo 19294ed0a7a3SQu Wenruo TP_ARGS(bg_cache), 19304ed0a7a3SQu Wenruo 19314ed0a7a3SQu Wenruo TP_STRUCT__entry_btrfs( 19324ed0a7a3SQu Wenruo __field( u64, bytenr ) 19334ed0a7a3SQu Wenruo __field( u64, len ) 19344ed0a7a3SQu Wenruo __field( u64, used ) 19354ed0a7a3SQu Wenruo __field( u64, flags ) 19364ed0a7a3SQu Wenruo ), 19374ed0a7a3SQu Wenruo 19384ed0a7a3SQu Wenruo TP_fast_assign_btrfs(bg_cache->fs_info, 1939b3470b5dSDavid Sterba __entry->bytenr = bg_cache->start, 1940b3470b5dSDavid Sterba __entry->len = bg_cache->length, 1941bf38be65SDavid Sterba __entry->used = bg_cache->used; 19424ed0a7a3SQu Wenruo __entry->flags = bg_cache->flags; 19434ed0a7a3SQu Wenruo ), 19444ed0a7a3SQu Wenruo 19454ed0a7a3SQu Wenruo TP_printk_btrfs("bg bytenr=%llu len=%llu used=%llu flags=%llu(%s)", 19464ed0a7a3SQu Wenruo __entry->bytenr, __entry->len, __entry->used, __entry->flags, 19474ed0a7a3SQu Wenruo __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS)) 19484ed0a7a3SQu Wenruo ); 19494ed0a7a3SQu Wenruo 19504ed0a7a3SQu Wenruo DEFINE_EVENT(btrfs__block_group, btrfs_remove_block_group, 195132da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 19524ed0a7a3SQu Wenruo 19534ed0a7a3SQu Wenruo TP_ARGS(bg_cache) 19544ed0a7a3SQu Wenruo ); 19554ed0a7a3SQu Wenruo 19564ed0a7a3SQu Wenruo DEFINE_EVENT(btrfs__block_group, btrfs_add_unused_block_group, 195732da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 19584ed0a7a3SQu Wenruo 19594ed0a7a3SQu Wenruo TP_ARGS(bg_cache) 19604ed0a7a3SQu Wenruo ); 19614ed0a7a3SQu Wenruo 196218bb8bbfSJohannes Thumshirn DEFINE_EVENT(btrfs__block_group, btrfs_add_reclaim_block_group, 196318bb8bbfSJohannes Thumshirn TP_PROTO(const struct btrfs_block_group *bg_cache), 196418bb8bbfSJohannes Thumshirn 196518bb8bbfSJohannes Thumshirn TP_ARGS(bg_cache) 196618bb8bbfSJohannes Thumshirn ); 196718bb8bbfSJohannes Thumshirn 196818bb8bbfSJohannes Thumshirn DEFINE_EVENT(btrfs__block_group, btrfs_reclaim_block_group, 196918bb8bbfSJohannes Thumshirn TP_PROTO(const struct btrfs_block_group *bg_cache), 197018bb8bbfSJohannes Thumshirn 197118bb8bbfSJohannes Thumshirn TP_ARGS(bg_cache) 197218bb8bbfSJohannes Thumshirn ); 197318bb8bbfSJohannes Thumshirn 19744ed0a7a3SQu Wenruo DEFINE_EVENT(btrfs__block_group, btrfs_skip_unused_block_group, 197532da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 19764ed0a7a3SQu Wenruo 19774ed0a7a3SQu Wenruo TP_ARGS(bg_cache) 19784ed0a7a3SQu Wenruo ); 19794ed0a7a3SQu Wenruo 1980a1d19847SQu Wenruo TRACE_EVENT(btrfs_set_extent_bit, 1981a1d19847SQu Wenruo TP_PROTO(const struct extent_io_tree *tree, 1982a1d19847SQu Wenruo u64 start, u64 len, unsigned set_bits), 1983a1d19847SQu Wenruo 1984a1d19847SQu Wenruo TP_ARGS(tree, start, len, set_bits), 1985a1d19847SQu Wenruo 1986a1d19847SQu Wenruo TP_STRUCT__entry_btrfs( 1987a1d19847SQu Wenruo __field( unsigned, owner ) 1988a1d19847SQu Wenruo __field( u64, ino ) 1989a1d19847SQu Wenruo __field( u64, rootid ) 1990a1d19847SQu Wenruo __field( u64, start ) 1991a1d19847SQu Wenruo __field( u64, len ) 1992a1d19847SQu Wenruo __field( unsigned, set_bits) 1993a1d19847SQu Wenruo ), 1994a1d19847SQu Wenruo 1995a1d19847SQu Wenruo TP_fast_assign_btrfs(tree->fs_info, 1996a1d19847SQu Wenruo __entry->owner = tree->owner; 19970988fc7bSDavid Sterba if (tree->inode) { 19980988fc7bSDavid Sterba const struct btrfs_inode *inode = tree->inode; 1999a1d19847SQu Wenruo 20000988fc7bSDavid Sterba __entry->ino = btrfs_ino(inode); 20010988fc7bSDavid Sterba __entry->rootid = inode->root->root_key.objectid; 2002a1d19847SQu Wenruo } else { 2003a1d19847SQu Wenruo __entry->ino = 0; 2004a1d19847SQu Wenruo __entry->rootid = 0; 2005a1d19847SQu Wenruo } 2006a1d19847SQu Wenruo __entry->start = start; 2007a1d19847SQu Wenruo __entry->len = len; 2008a1d19847SQu Wenruo __entry->set_bits = set_bits; 2009a1d19847SQu Wenruo ), 2010a1d19847SQu Wenruo 2011a1d19847SQu Wenruo TP_printk_btrfs( 2012a1d19847SQu Wenruo "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s", 2013c92bb304SNikolay Borisov __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, 2014a1d19847SQu Wenruo __entry->rootid, __entry->start, __entry->len, 2015a1d19847SQu Wenruo __print_flags(__entry->set_bits, "|", EXTENT_FLAGS)) 2016a1d19847SQu Wenruo ); 2017a1d19847SQu Wenruo 2018a1d19847SQu Wenruo TRACE_EVENT(btrfs_clear_extent_bit, 2019a1d19847SQu Wenruo TP_PROTO(const struct extent_io_tree *tree, 2020a1d19847SQu Wenruo u64 start, u64 len, unsigned clear_bits), 2021a1d19847SQu Wenruo 2022a1d19847SQu Wenruo TP_ARGS(tree, start, len, clear_bits), 2023a1d19847SQu Wenruo 2024a1d19847SQu Wenruo TP_STRUCT__entry_btrfs( 2025a1d19847SQu Wenruo __field( unsigned, owner ) 2026a1d19847SQu Wenruo __field( u64, ino ) 2027a1d19847SQu Wenruo __field( u64, rootid ) 2028a1d19847SQu Wenruo __field( u64, start ) 2029a1d19847SQu Wenruo __field( u64, len ) 2030a1d19847SQu Wenruo __field( unsigned, clear_bits) 2031a1d19847SQu Wenruo ), 2032a1d19847SQu Wenruo 2033a1d19847SQu Wenruo TP_fast_assign_btrfs(tree->fs_info, 2034a1d19847SQu Wenruo __entry->owner = tree->owner; 20350988fc7bSDavid Sterba if (tree->inode) { 20360988fc7bSDavid Sterba const struct btrfs_inode *inode = tree->inode; 2037a1d19847SQu Wenruo 20380988fc7bSDavid Sterba __entry->ino = btrfs_ino(inode); 20390988fc7bSDavid Sterba __entry->rootid = inode->root->root_key.objectid; 2040a1d19847SQu Wenruo } else { 2041a1d19847SQu Wenruo __entry->ino = 0; 2042a1d19847SQu Wenruo __entry->rootid = 0; 2043a1d19847SQu Wenruo } 2044a1d19847SQu Wenruo __entry->start = start; 2045a1d19847SQu Wenruo __entry->len = len; 2046a1d19847SQu Wenruo __entry->clear_bits = clear_bits; 2047a1d19847SQu Wenruo ), 2048a1d19847SQu Wenruo 2049a1d19847SQu Wenruo TP_printk_btrfs( 2050a1d19847SQu Wenruo "io_tree=%s ino=%llu root=%llu start=%llu len=%llu clear_bits=%s", 2051c92bb304SNikolay Borisov __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, 2052a1d19847SQu Wenruo __entry->rootid, __entry->start, __entry->len, 2053a1d19847SQu Wenruo __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS)) 2054a1d19847SQu Wenruo ); 2055a1d19847SQu Wenruo 2056a1d19847SQu Wenruo TRACE_EVENT(btrfs_convert_extent_bit, 2057a1d19847SQu Wenruo TP_PROTO(const struct extent_io_tree *tree, 2058a1d19847SQu Wenruo u64 start, u64 len, unsigned set_bits, unsigned clear_bits), 2059a1d19847SQu Wenruo 2060a1d19847SQu Wenruo TP_ARGS(tree, start, len, set_bits, clear_bits), 2061a1d19847SQu Wenruo 2062a1d19847SQu Wenruo TP_STRUCT__entry_btrfs( 2063a1d19847SQu Wenruo __field( unsigned, owner ) 2064a1d19847SQu Wenruo __field( u64, ino ) 2065a1d19847SQu Wenruo __field( u64, rootid ) 2066a1d19847SQu Wenruo __field( u64, start ) 2067a1d19847SQu Wenruo __field( u64, len ) 2068a1d19847SQu Wenruo __field( unsigned, set_bits) 2069a1d19847SQu Wenruo __field( unsigned, clear_bits) 2070a1d19847SQu Wenruo ), 2071a1d19847SQu Wenruo 2072a1d19847SQu Wenruo TP_fast_assign_btrfs(tree->fs_info, 2073a1d19847SQu Wenruo __entry->owner = tree->owner; 20740988fc7bSDavid Sterba if (tree->inode) { 20750988fc7bSDavid Sterba const struct btrfs_inode *inode = tree->inode; 2076a1d19847SQu Wenruo 20770988fc7bSDavid Sterba __entry->ino = btrfs_ino(inode); 20780988fc7bSDavid Sterba __entry->rootid = inode->root->root_key.objectid; 2079a1d19847SQu Wenruo } else { 2080a1d19847SQu Wenruo __entry->ino = 0; 2081a1d19847SQu Wenruo __entry->rootid = 0; 2082a1d19847SQu Wenruo } 2083a1d19847SQu Wenruo __entry->start = start; 2084a1d19847SQu Wenruo __entry->len = len; 2085a1d19847SQu Wenruo __entry->set_bits = set_bits; 2086a1d19847SQu Wenruo __entry->clear_bits = clear_bits; 2087a1d19847SQu Wenruo ), 2088a1d19847SQu Wenruo 2089a1d19847SQu Wenruo TP_printk_btrfs( 2090a1d19847SQu Wenruo "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s clear_bits=%s", 2091c92bb304SNikolay Borisov __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, 2092a1d19847SQu Wenruo __entry->rootid, __entry->start, __entry->len, 2093a1d19847SQu Wenruo __print_flags(__entry->set_bits , "|", EXTENT_FLAGS), 2094a1d19847SQu Wenruo __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS)) 2095a1d19847SQu Wenruo ); 2096a1d19847SQu Wenruo 2097e5ad49e2SJosef Bacik DECLARE_EVENT_CLASS(btrfs_dump_space_info, 20988197766dSJosef Bacik TP_PROTO(struct btrfs_fs_info *fs_info, 2099e5ad49e2SJosef Bacik const struct btrfs_space_info *sinfo), 2100e5ad49e2SJosef Bacik 2101e5ad49e2SJosef Bacik TP_ARGS(fs_info, sinfo), 2102e5ad49e2SJosef Bacik 2103e5ad49e2SJosef Bacik TP_STRUCT__entry_btrfs( 2104e5ad49e2SJosef Bacik __field( u64, flags ) 2105e5ad49e2SJosef Bacik __field( u64, total_bytes ) 2106e5ad49e2SJosef Bacik __field( u64, bytes_used ) 2107e5ad49e2SJosef Bacik __field( u64, bytes_pinned ) 2108e5ad49e2SJosef Bacik __field( u64, bytes_reserved ) 2109e5ad49e2SJosef Bacik __field( u64, bytes_may_use ) 2110e5ad49e2SJosef Bacik __field( u64, bytes_readonly ) 2111e5ad49e2SJosef Bacik __field( u64, reclaim_size ) 2112e5ad49e2SJosef Bacik __field( int, clamp ) 2113e5ad49e2SJosef Bacik __field( u64, global_reserved ) 2114e5ad49e2SJosef Bacik __field( u64, trans_reserved ) 2115e5ad49e2SJosef Bacik __field( u64, delayed_refs_reserved ) 2116e5ad49e2SJosef Bacik __field( u64, delayed_reserved ) 2117e5ad49e2SJosef Bacik __field( u64, free_chunk_space ) 21188197766dSJosef Bacik __field( u64, delalloc_bytes ) 21198197766dSJosef Bacik __field( u64, ordered_bytes ) 2120e5ad49e2SJosef Bacik ), 2121e5ad49e2SJosef Bacik 2122e5ad49e2SJosef Bacik TP_fast_assign_btrfs(fs_info, 2123e5ad49e2SJosef Bacik __entry->flags = sinfo->flags; 2124e5ad49e2SJosef Bacik __entry->total_bytes = sinfo->total_bytes; 2125e5ad49e2SJosef Bacik __entry->bytes_used = sinfo->bytes_used; 2126e5ad49e2SJosef Bacik __entry->bytes_pinned = sinfo->bytes_pinned; 2127e5ad49e2SJosef Bacik __entry->bytes_reserved = sinfo->bytes_reserved; 2128e5ad49e2SJosef Bacik __entry->bytes_may_use = sinfo->bytes_may_use; 2129e5ad49e2SJosef Bacik __entry->bytes_readonly = sinfo->bytes_readonly; 2130e5ad49e2SJosef Bacik __entry->reclaim_size = sinfo->reclaim_size; 2131e5ad49e2SJosef Bacik __entry->clamp = sinfo->clamp; 2132e5ad49e2SJosef Bacik __entry->global_reserved = fs_info->global_block_rsv.reserved; 2133e5ad49e2SJosef Bacik __entry->trans_reserved = fs_info->trans_block_rsv.reserved; 2134e5ad49e2SJosef Bacik __entry->delayed_refs_reserved = fs_info->delayed_refs_rsv.reserved; 2135e5ad49e2SJosef Bacik __entry->delayed_reserved = fs_info->delayed_block_rsv.reserved; 2136e5ad49e2SJosef Bacik __entry->free_chunk_space = atomic64_read(&fs_info->free_chunk_space); 21378197766dSJosef Bacik __entry->delalloc_bytes = percpu_counter_sum_positive(&fs_info->delalloc_bytes); 21388197766dSJosef Bacik __entry->ordered_bytes = percpu_counter_sum_positive(&fs_info->ordered_bytes); 2139e5ad49e2SJosef Bacik ), 2140e5ad49e2SJosef Bacik 2141e5ad49e2SJosef Bacik TP_printk_btrfs("flags=%s total_bytes=%llu bytes_used=%llu " 2142e5ad49e2SJosef Bacik "bytes_pinned=%llu bytes_reserved=%llu " 2143e5ad49e2SJosef Bacik "bytes_may_use=%llu bytes_readonly=%llu " 2144e5ad49e2SJosef Bacik "reclaim_size=%llu clamp=%d global_reserved=%llu " 2145e5ad49e2SJosef Bacik "trans_reserved=%llu delayed_refs_reserved=%llu " 21468197766dSJosef Bacik "delayed_reserved=%llu chunk_free_space=%llu " 21478197766dSJosef Bacik "delalloc_bytes=%llu ordered_bytes=%llu", 2148e5ad49e2SJosef Bacik __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS), 2149e5ad49e2SJosef Bacik __entry->total_bytes, __entry->bytes_used, 2150e5ad49e2SJosef Bacik __entry->bytes_pinned, __entry->bytes_reserved, 2151e5ad49e2SJosef Bacik __entry->bytes_may_use, __entry->bytes_readonly, 2152e5ad49e2SJosef Bacik __entry->reclaim_size, __entry->clamp, 2153e5ad49e2SJosef Bacik __entry->global_reserved, __entry->trans_reserved, 2154e5ad49e2SJosef Bacik __entry->delayed_refs_reserved, 21558197766dSJosef Bacik __entry->delayed_reserved, __entry->free_chunk_space, 21568197766dSJosef Bacik __entry->delalloc_bytes, __entry->ordered_bytes) 2157e5ad49e2SJosef Bacik ); 2158e5ad49e2SJosef Bacik 2159e5ad49e2SJosef Bacik DEFINE_EVENT(btrfs_dump_space_info, btrfs_done_preemptive_reclaim, 21608197766dSJosef Bacik TP_PROTO(struct btrfs_fs_info *fs_info, 2161e5ad49e2SJosef Bacik const struct btrfs_space_info *sinfo), 2162e5ad49e2SJosef Bacik TP_ARGS(fs_info, sinfo) 2163e5ad49e2SJosef Bacik ); 2164e5ad49e2SJosef Bacik 2165fcdef39cSJosef Bacik DEFINE_EVENT(btrfs_dump_space_info, btrfs_fail_all_tickets, 2166fcdef39cSJosef Bacik TP_PROTO(struct btrfs_fs_info *fs_info, 2167fcdef39cSJosef Bacik const struct btrfs_space_info *sinfo), 2168fcdef39cSJosef Bacik TP_ARGS(fs_info, sinfo) 2169fcdef39cSJosef Bacik ); 2170fcdef39cSJosef Bacik 2171ac1ea10eSJosef Bacik TRACE_EVENT(btrfs_reserve_ticket, 2172ac1ea10eSJosef Bacik TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, 2173ac1ea10eSJosef Bacik u64 start_ns, int flush, int error), 2174ac1ea10eSJosef Bacik 2175ac1ea10eSJosef Bacik TP_ARGS(fs_info, flags, bytes, start_ns, flush, error), 2176ac1ea10eSJosef Bacik 2177ac1ea10eSJosef Bacik TP_STRUCT__entry_btrfs( 2178ac1ea10eSJosef Bacik __field( u64, flags ) 2179ac1ea10eSJosef Bacik __field( u64, bytes ) 2180ac1ea10eSJosef Bacik __field( u64, start_ns ) 2181ac1ea10eSJosef Bacik __field( int, flush ) 2182ac1ea10eSJosef Bacik __field( int, error ) 2183ac1ea10eSJosef Bacik ), 2184ac1ea10eSJosef Bacik 2185ac1ea10eSJosef Bacik TP_fast_assign_btrfs(fs_info, 2186ac1ea10eSJosef Bacik __entry->flags = flags; 2187ac1ea10eSJosef Bacik __entry->bytes = bytes; 2188ac1ea10eSJosef Bacik __entry->start_ns = start_ns; 2189ac1ea10eSJosef Bacik __entry->flush = flush; 2190ac1ea10eSJosef Bacik __entry->error = error; 2191ac1ea10eSJosef Bacik ), 2192ac1ea10eSJosef Bacik 2193ac1ea10eSJosef Bacik TP_printk_btrfs("flags=%s bytes=%llu start_ns=%llu flush=%s error=%d", 2194ac1ea10eSJosef Bacik __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS), 2195ac1ea10eSJosef Bacik __entry->bytes, __entry->start_ns, 2196ac1ea10eSJosef Bacik __print_symbolic(__entry->flush, FLUSH_ACTIONS), 2197ac1ea10eSJosef Bacik __entry->error) 2198ac1ea10eSJosef Bacik ); 2199ac1ea10eSJosef Bacik 220034e73cc9SQu Wenruo DECLARE_EVENT_CLASS(btrfs_sleep_tree_lock, 220134e73cc9SQu Wenruo TP_PROTO(const struct extent_buffer *eb, u64 start_ns), 220234e73cc9SQu Wenruo 220334e73cc9SQu Wenruo TP_ARGS(eb, start_ns), 220434e73cc9SQu Wenruo 220534e73cc9SQu Wenruo TP_STRUCT__entry_btrfs( 220634e73cc9SQu Wenruo __field( u64, block ) 220734e73cc9SQu Wenruo __field( u64, generation ) 220834e73cc9SQu Wenruo __field( u64, start_ns ) 220934e73cc9SQu Wenruo __field( u64, end_ns ) 221034e73cc9SQu Wenruo __field( u64, diff_ns ) 221134e73cc9SQu Wenruo __field( u64, owner ) 221234e73cc9SQu Wenruo __field( int, is_log_tree ) 221334e73cc9SQu Wenruo ), 221434e73cc9SQu Wenruo 221534e73cc9SQu Wenruo TP_fast_assign_btrfs(eb->fs_info, 221634e73cc9SQu Wenruo __entry->block = eb->start; 221734e73cc9SQu Wenruo __entry->generation = btrfs_header_generation(eb); 221834e73cc9SQu Wenruo __entry->start_ns = start_ns; 221934e73cc9SQu Wenruo __entry->end_ns = ktime_get_ns(); 222034e73cc9SQu Wenruo __entry->diff_ns = __entry->end_ns - start_ns; 222134e73cc9SQu Wenruo __entry->owner = btrfs_header_owner(eb); 222234e73cc9SQu Wenruo __entry->is_log_tree = (eb->log_index >= 0); 222334e73cc9SQu Wenruo ), 222434e73cc9SQu Wenruo 222534e73cc9SQu Wenruo TP_printk_btrfs( 222634e73cc9SQu Wenruo "block=%llu generation=%llu start_ns=%llu end_ns=%llu diff_ns=%llu owner=%llu is_log_tree=%d", 222734e73cc9SQu Wenruo __entry->block, __entry->generation, 222834e73cc9SQu Wenruo __entry->start_ns, __entry->end_ns, __entry->diff_ns, 222934e73cc9SQu Wenruo __entry->owner, __entry->is_log_tree) 223034e73cc9SQu Wenruo ); 223134e73cc9SQu Wenruo 223234e73cc9SQu Wenruo DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_read_lock, 223334e73cc9SQu Wenruo TP_PROTO(const struct extent_buffer *eb, u64 start_ns), 223434e73cc9SQu Wenruo 223534e73cc9SQu Wenruo TP_ARGS(eb, start_ns) 223634e73cc9SQu Wenruo ); 223734e73cc9SQu Wenruo 223834e73cc9SQu Wenruo DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_lock, 223934e73cc9SQu Wenruo TP_PROTO(const struct extent_buffer *eb, u64 start_ns), 224034e73cc9SQu Wenruo 224134e73cc9SQu Wenruo TP_ARGS(eb, start_ns) 224234e73cc9SQu Wenruo ); 224334e73cc9SQu Wenruo 224431aab402SQu Wenruo DECLARE_EVENT_CLASS(btrfs_locking_events, 224531aab402SQu Wenruo TP_PROTO(const struct extent_buffer *eb), 224631aab402SQu Wenruo 224731aab402SQu Wenruo TP_ARGS(eb), 224831aab402SQu Wenruo 224931aab402SQu Wenruo TP_STRUCT__entry_btrfs( 225031aab402SQu Wenruo __field( u64, block ) 225131aab402SQu Wenruo __field( u64, generation ) 225231aab402SQu Wenruo __field( u64, owner ) 225331aab402SQu Wenruo __field( int, is_log_tree ) 225431aab402SQu Wenruo ), 225531aab402SQu Wenruo 225631aab402SQu Wenruo TP_fast_assign_btrfs(eb->fs_info, 225731aab402SQu Wenruo __entry->block = eb->start; 225831aab402SQu Wenruo __entry->generation = btrfs_header_generation(eb); 225931aab402SQu Wenruo __entry->owner = btrfs_header_owner(eb); 226031aab402SQu Wenruo __entry->is_log_tree = (eb->log_index >= 0); 226131aab402SQu Wenruo ), 226231aab402SQu Wenruo 226331aab402SQu Wenruo TP_printk_btrfs("block=%llu generation=%llu owner=%llu is_log_tree=%d", 226431aab402SQu Wenruo __entry->block, __entry->generation, 226531aab402SQu Wenruo __entry->owner, __entry->is_log_tree) 226631aab402SQu Wenruo ); 226731aab402SQu Wenruo 226831aab402SQu Wenruo #define DEFINE_BTRFS_LOCK_EVENT(name) \ 226931aab402SQu Wenruo DEFINE_EVENT(btrfs_locking_events, name, \ 227031aab402SQu Wenruo TP_PROTO(const struct extent_buffer *eb), \ 227131aab402SQu Wenruo \ 227231aab402SQu Wenruo TP_ARGS(eb) \ 227331aab402SQu Wenruo ) 227431aab402SQu Wenruo 227531aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_unlock); 227631aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock); 227731aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock_blocking); 227831aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_read); 227931aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_write); 228031aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock); 228131aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock); 228231aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic); 228331aab402SQu Wenruo 2284480b9b4dSQu Wenruo DECLARE_EVENT_CLASS(btrfs__space_info_update, 2285480b9b4dSQu Wenruo 22861d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 22871d2e7c7cSDavid Sterba const struct btrfs_space_info *sinfo, u64 old, s64 diff), 2288480b9b4dSQu Wenruo 2289480b9b4dSQu Wenruo TP_ARGS(fs_info, sinfo, old, diff), 2290480b9b4dSQu Wenruo 2291480b9b4dSQu Wenruo TP_STRUCT__entry_btrfs( 2292480b9b4dSQu Wenruo __field( u64, type ) 2293480b9b4dSQu Wenruo __field( u64, old ) 2294480b9b4dSQu Wenruo __field( s64, diff ) 2295480b9b4dSQu Wenruo ), 2296480b9b4dSQu Wenruo 2297480b9b4dSQu Wenruo TP_fast_assign_btrfs(fs_info, 2298480b9b4dSQu Wenruo __entry->type = sinfo->flags; 2299480b9b4dSQu Wenruo __entry->old = old; 2300480b9b4dSQu Wenruo __entry->diff = diff; 2301480b9b4dSQu Wenruo ), 2302480b9b4dSQu Wenruo TP_printk_btrfs("type=%s old=%llu diff=%lld", 2303480b9b4dSQu Wenruo __print_flags(__entry->type, "|", BTRFS_GROUP_FLAGS), 2304480b9b4dSQu Wenruo __entry->old, __entry->diff) 2305480b9b4dSQu Wenruo ); 2306480b9b4dSQu Wenruo 2307480b9b4dSQu Wenruo DEFINE_EVENT(btrfs__space_info_update, update_bytes_may_use, 2308480b9b4dSQu Wenruo 23091d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 23101d2e7c7cSDavid Sterba const struct btrfs_space_info *sinfo, u64 old, s64 diff), 2311480b9b4dSQu Wenruo 2312480b9b4dSQu Wenruo TP_ARGS(fs_info, sinfo, old, diff) 2313480b9b4dSQu Wenruo ); 2314480b9b4dSQu Wenruo 2315480b9b4dSQu Wenruo DEFINE_EVENT(btrfs__space_info_update, update_bytes_pinned, 2316480b9b4dSQu Wenruo 23171d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 23181d2e7c7cSDavid Sterba const struct btrfs_space_info *sinfo, u64 old, s64 diff), 2319480b9b4dSQu Wenruo 2320480b9b4dSQu Wenruo TP_ARGS(fs_info, sinfo, old, diff) 2321480b9b4dSQu Wenruo ); 2322480b9b4dSQu Wenruo 2323b8bea09aSQu Wenruo DECLARE_EVENT_CLASS(btrfs_raid56_bio, 2324b8bea09aSQu Wenruo 2325b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2326b8bea09aSQu Wenruo const struct bio *bio, 2327b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2328b8bea09aSQu Wenruo 2329b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info), 2330b8bea09aSQu Wenruo 2331b8bea09aSQu Wenruo TP_STRUCT__entry_btrfs( 2332b8bea09aSQu Wenruo __field( u64, full_stripe ) 2333b8bea09aSQu Wenruo __field( u64, physical ) 2334b8bea09aSQu Wenruo __field( u64, devid ) 2335b8bea09aSQu Wenruo __field( u32, offset ) 2336b8bea09aSQu Wenruo __field( u32, len ) 2337b8bea09aSQu Wenruo __field( u8, opf ) 2338b8bea09aSQu Wenruo __field( u8, total_stripes ) 2339b8bea09aSQu Wenruo __field( u8, real_stripes ) 2340b8bea09aSQu Wenruo __field( u8, nr_data ) 2341b8bea09aSQu Wenruo __field( u8, stripe_nr ) 2342b8bea09aSQu Wenruo ), 2343b8bea09aSQu Wenruo 2344b8bea09aSQu Wenruo TP_fast_assign_btrfs(rbio->bioc->fs_info, 2345b8bea09aSQu Wenruo __entry->full_stripe = rbio->bioc->raid_map[0]; 2346b8bea09aSQu Wenruo __entry->physical = bio->bi_iter.bi_sector << SECTOR_SHIFT; 2347b8bea09aSQu Wenruo __entry->len = bio->bi_iter.bi_size; 2348b8bea09aSQu Wenruo __entry->opf = bio_op(bio); 2349b8bea09aSQu Wenruo __entry->devid = trace_info->devid; 2350b8bea09aSQu Wenruo __entry->offset = trace_info->offset; 2351b8bea09aSQu Wenruo __entry->stripe_nr = trace_info->stripe_nr; 2352b8bea09aSQu Wenruo __entry->total_stripes = rbio->bioc->num_stripes; 2353b8bea09aSQu Wenruo __entry->real_stripes = rbio->real_stripes; 2354b8bea09aSQu Wenruo __entry->nr_data = rbio->nr_data; 2355b8bea09aSQu Wenruo ), 2356b8bea09aSQu Wenruo /* 2357b8bea09aSQu Wenruo * For type output, we need to output things like "DATA1" 2358b8bea09aSQu Wenruo * (the first data stripe), "DATA2" (the second data stripe), 2359b8bea09aSQu Wenruo * "PQ1" (P stripe),"PQ2" (Q stripe), "REPLACE0" (replace target device). 2360b8bea09aSQu Wenruo */ 2361b8bea09aSQu Wenruo TP_printk_btrfs( 2362b8bea09aSQu Wenruo "full_stripe=%llu devid=%lld type=%s%d offset=%d opf=0x%x physical=%llu len=%u", 2363b8bea09aSQu Wenruo __entry->full_stripe, __entry->devid, 2364b8bea09aSQu Wenruo (__entry->stripe_nr < __entry->nr_data) ? "DATA" : 2365b8bea09aSQu Wenruo ((__entry->stripe_nr < __entry->real_stripes) ? "PQ" : 2366b8bea09aSQu Wenruo "REPLACE"), 2367b8bea09aSQu Wenruo (__entry->stripe_nr < __entry->nr_data) ? 2368b8bea09aSQu Wenruo (__entry->stripe_nr + 1) : 2369b8bea09aSQu Wenruo ((__entry->stripe_nr < __entry->real_stripes) ? 2370b8bea09aSQu Wenruo (__entry->stripe_nr - __entry->nr_data + 1) : 0), 2371b8bea09aSQu Wenruo __entry->offset, __entry->opf, __entry->physical, __entry->len) 2372b8bea09aSQu Wenruo ); 2373b8bea09aSQu Wenruo 2374b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_read_partial, 2375b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2376b8bea09aSQu Wenruo const struct bio *bio, 2377b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2378b8bea09aSQu Wenruo 2379b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2380b8bea09aSQu Wenruo ); 2381b8bea09aSQu Wenruo 2382b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_write_stripe, 2383b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2384b8bea09aSQu Wenruo const struct bio *bio, 2385b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2386b8bea09aSQu Wenruo 2387b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2388b8bea09aSQu Wenruo ); 2389b8bea09aSQu Wenruo 2390b8bea09aSQu Wenruo 2391b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_scrub_write_stripe, 2392b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2393b8bea09aSQu Wenruo const struct bio *bio, 2394b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2395b8bea09aSQu Wenruo 2396b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2397b8bea09aSQu Wenruo ); 2398b8bea09aSQu Wenruo 2399b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_scrub_read, 2400b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2401b8bea09aSQu Wenruo const struct bio *bio, 2402b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2403b8bea09aSQu Wenruo 2404b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2405b8bea09aSQu Wenruo ); 2406b8bea09aSQu Wenruo 2407b8bea09aSQu Wenruo DEFINE_EVENT(btrfs_raid56_bio, raid56_scrub_read_recover, 2408b8bea09aSQu Wenruo TP_PROTO(const struct btrfs_raid_bio *rbio, 2409b8bea09aSQu Wenruo const struct bio *bio, 2410b8bea09aSQu Wenruo const struct raid56_bio_trace_info *trace_info), 2411b8bea09aSQu Wenruo 2412b8bea09aSQu Wenruo TP_ARGS(rbio, bio, trace_info) 2413b8bea09aSQu Wenruo ); 2414b8bea09aSQu Wenruo 24151abe9b8aSliubo #endif /* _TRACE_BTRFS_H */ 24161abe9b8aSliubo 24171abe9b8aSliubo /* This part must be outside protection */ 24181abe9b8aSliubo #include <trace/define_trace.h> 2419