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; 27c3a46891SQu Wenruo 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; 331abe9b8aSliubo 34012e513eSAnand Jain TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS_NR); 35012e513eSAnand Jain TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS); 36012e513eSAnand Jain TRACE_DEFINE_ENUM(FLUSH_DELALLOC); 37012e513eSAnand Jain TRACE_DEFINE_ENUM(FLUSH_DELALLOC_WAIT); 38012e513eSAnand Jain TRACE_DEFINE_ENUM(ALLOC_CHUNK); 39012e513eSAnand Jain TRACE_DEFINE_ENUM(COMMIT_TRANS); 40012e513eSAnand Jain 411abe9b8aSliubo #define show_ref_type(type) \ 421abe9b8aSliubo __print_symbolic(type, \ 431abe9b8aSliubo { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ 441abe9b8aSliubo { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ 451abe9b8aSliubo { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ 461abe9b8aSliubo { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ 471abe9b8aSliubo { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) 481abe9b8aSliubo 491abe9b8aSliubo #define __show_root_type(obj) \ 507f34b746Sliubo __print_symbolic_u64(obj, \ 511abe9b8aSliubo { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ 521abe9b8aSliubo { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ 531abe9b8aSliubo { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ 541abe9b8aSliubo { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ 551abe9b8aSliubo { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ 561abe9b8aSliubo { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ 571abe9b8aSliubo { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ 581abe9b8aSliubo { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ 59e112e2b4SLiu Bo { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ 601abe9b8aSliubo { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ 61208acb8cSOmar Sandoval { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \ 62208acb8cSOmar Sandoval { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \ 631abe9b8aSliubo { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) 641abe9b8aSliubo 651abe9b8aSliubo #define show_root_type(obj) \ 661abe9b8aSliubo obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ 67fb57dc81SLiu Bo (obj >= BTRFS_ROOT_TREE_OBJECTID && \ 68e112e2b4SLiu Bo obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" 691abe9b8aSliubo 705bca2c95SNikolay Borisov #define FLUSH_ACTIONS \ 715bca2c95SNikolay Borisov EM( BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH") \ 725bca2c95SNikolay Borisov EM( BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT") \ 735bca2c95SNikolay Borisov EM( BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL") \ 745bca2c95SNikolay Borisov EMe(BTRFS_RESERVE_FLUSH_ALL_STEAL, "BTRFS_RESERVE_FLUSH_ALL_STEAL") 755bca2c95SNikolay Borisov 760840dd28SNikolay Borisov #define FI_TYPES \ 770840dd28SNikolay Borisov EM( BTRFS_FILE_EXTENT_INLINE, "INLINE") \ 780840dd28SNikolay Borisov EM( BTRFS_FILE_EXTENT_REG, "REG") \ 790840dd28SNikolay Borisov EMe(BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC") 800840dd28SNikolay Borisov 811cb1f0b2SNikolay Borisov #define QGROUP_RSV_TYPES \ 821cb1f0b2SNikolay Borisov EM( BTRFS_QGROUP_RSV_DATA, "DATA") \ 831cb1f0b2SNikolay Borisov EM( BTRFS_QGROUP_RSV_META_PERTRANS, "META_PERTRANS") \ 841cb1f0b2SNikolay Borisov EMe(BTRFS_QGROUP_RSV_META_PREALLOC, "META_PREALLOC") 851cb1f0b2SNikolay Borisov 865bca2c95SNikolay Borisov /* 875bca2c95SNikolay Borisov * First define the enums in the above macros to be exported to userspace via 885bca2c95SNikolay Borisov * TRACE_DEFINE_ENUM(). 895bca2c95SNikolay Borisov */ 905bca2c95SNikolay Borisov 910840dd28SNikolay Borisov #undef EM 920840dd28SNikolay Borisov #undef EMe 930840dd28SNikolay Borisov #define EM(a, b) TRACE_DEFINE_ENUM(a); 940840dd28SNikolay Borisov #define EMe(a, b) TRACE_DEFINE_ENUM(a); 950840dd28SNikolay Borisov 965bca2c95SNikolay Borisov FLUSH_ACTIONS 970840dd28SNikolay Borisov FI_TYPES 981cb1f0b2SNikolay Borisov QGROUP_RSV_TYPES 990840dd28SNikolay Borisov 1005bca2c95SNikolay Borisov /* 1015bca2c95SNikolay Borisov * Now redefine the EM and EMe macros to map the enums to the strings that will 1025bca2c95SNikolay Borisov * be printed in the output 1035bca2c95SNikolay Borisov */ 1045bca2c95SNikolay Borisov 1050840dd28SNikolay Borisov #undef EM 1060840dd28SNikolay Borisov #undef EMe 1070840dd28SNikolay Borisov #define EM(a, b) {a, b}, 1080840dd28SNikolay Borisov #define EMe(a, b) {a, b} 10909ed2f16SLiu Bo 110a1d19847SQu Wenruo #define show_extent_io_tree_owner(owner) \ 111a1d19847SQu Wenruo __print_symbolic(owner, \ 112fe119a6eSNikolay Borisov { IO_TREE_FS_PINNED_EXTENTS, "PINNED_EXTENTS" }, \ 113fe119a6eSNikolay Borisov { IO_TREE_FS_EXCLUDED_EXTENTS, "EXCLUDED_EXTENTS" }, \ 114a1d19847SQu Wenruo { IO_TREE_INODE_IO, "INODE_IO" }, \ 115a1d19847SQu Wenruo { IO_TREE_INODE_IO_FAILURE, "INODE_IO_FAILURE" }, \ 116a1d19847SQu Wenruo { IO_TREE_RELOC_BLOCKS, "RELOC_BLOCKS" }, \ 117a1d19847SQu Wenruo { IO_TREE_TRANS_DIRTY_PAGES, "TRANS_DIRTY_PAGES" }, \ 118a1d19847SQu Wenruo { IO_TREE_ROOT_DIRTY_LOG_PAGES, "ROOT_DIRTY_LOG_PAGES" }, \ 11941a2ee75SJosef Bacik { IO_TREE_INODE_FILE_EXTENT, "INODE_FILE_EXTENT" }, \ 120e289f03eSFilipe Manana { IO_TREE_LOG_CSUM_RANGE, "LOG_CSUM_RANGE" }, \ 121a1d19847SQu Wenruo { IO_TREE_SELFTEST, "SELFTEST" }) 122a1d19847SQu Wenruo 1233f7de037SJosef Bacik #define BTRFS_GROUP_FLAGS \ 1243f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ 1253f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 1263f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 1273f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ 1283f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ 1293f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ 130e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 131e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ 132e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} 1333f7de037SJosef Bacik 134a1d19847SQu Wenruo #define EXTENT_FLAGS \ 135a1d19847SQu Wenruo { EXTENT_DIRTY, "DIRTY"}, \ 136a1d19847SQu Wenruo { EXTENT_UPTODATE, "UPTODATE"}, \ 137a1d19847SQu Wenruo { EXTENT_LOCKED, "LOCKED"}, \ 138a1d19847SQu Wenruo { EXTENT_NEW, "NEW"}, \ 139a1d19847SQu Wenruo { EXTENT_DELALLOC, "DELALLOC"}, \ 140a1d19847SQu Wenruo { EXTENT_DEFRAG, "DEFRAG"}, \ 141a1d19847SQu Wenruo { EXTENT_BOUNDARY, "BOUNDARY"}, \ 142a1d19847SQu Wenruo { EXTENT_NODATASUM, "NODATASUM"}, \ 143a1d19847SQu Wenruo { EXTENT_CLEAR_META_RESV, "CLEAR_META_RESV"}, \ 144a1d19847SQu Wenruo { EXTENT_NEED_WAIT, "NEED_WAIT"}, \ 145a1d19847SQu Wenruo { EXTENT_DAMAGED, "DAMAGED"}, \ 146a1d19847SQu Wenruo { EXTENT_NORESERVE, "NORESERVE"}, \ 147a1d19847SQu Wenruo { EXTENT_QGROUP_RESERVED, "QGROUP_RESERVED"}, \ 148a1d19847SQu Wenruo { EXTENT_CLEAR_DATA_RESV, "CLEAR_DATA_RESV"}, \ 149a1d19847SQu Wenruo { EXTENT_DELALLOC_NEW, "DELALLOC_NEW"} 150a1d19847SQu Wenruo 151b94417eaSAnand Jain #define BTRFS_FSID_SIZE 16 152b94417eaSAnand Jain #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE) 153bc074524SJeff Mahoney 154bc074524SJeff Mahoney #define TP_fast_assign_fsid(fs_info) \ 155a1d19847SQu Wenruo ({ \ 156a1d19847SQu Wenruo if (fs_info) \ 157a1d19847SQu Wenruo memcpy(__entry->fsid, fs_info->fs_devices->fsid, \ 158a1d19847SQu Wenruo BTRFS_FSID_SIZE); \ 159a1d19847SQu Wenruo else \ 160a1d19847SQu Wenruo memset(__entry->fsid, 0, BTRFS_FSID_SIZE); \ 161a1d19847SQu Wenruo }) 162bc074524SJeff Mahoney 163bc074524SJeff Mahoney #define TP_STRUCT__entry_btrfs(args...) \ 164bc074524SJeff Mahoney TP_STRUCT__entry( \ 165bc074524SJeff Mahoney TP_STRUCT__entry_fsid \ 166bc074524SJeff Mahoney args) 167bc074524SJeff Mahoney #define TP_fast_assign_btrfs(fs_info, args...) \ 168bc074524SJeff Mahoney TP_fast_assign( \ 169bc074524SJeff Mahoney TP_fast_assign_fsid(fs_info); \ 170bc074524SJeff Mahoney args) 171bc074524SJeff Mahoney #define TP_printk_btrfs(fmt, args...) \ 172bc074524SJeff Mahoney TP_printk("%pU: " fmt, __entry->fsid, args) 1738c2a3ca2SJosef Bacik 1741abe9b8aSliubo TRACE_EVENT(btrfs_transaction_commit, 1751abe9b8aSliubo 1769a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root), 1771abe9b8aSliubo 1781abe9b8aSliubo TP_ARGS(root), 1791abe9b8aSliubo 180bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1811abe9b8aSliubo __field( u64, generation ) 1821abe9b8aSliubo __field( u64, root_objectid ) 1831abe9b8aSliubo ), 1841abe9b8aSliubo 185bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 1861abe9b8aSliubo __entry->generation = root->fs_info->generation; 1871abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 1881abe9b8aSliubo ), 1891abe9b8aSliubo 19079bcb71aSDavid Sterba TP_printk_btrfs("root=%llu(%s) gen=%llu", 1911abe9b8aSliubo show_root_type(__entry->root_objectid), 1928eec8463SDavid Sterba __entry->generation) 1931abe9b8aSliubo ); 1941abe9b8aSliubo 1951abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__inode, 1961abe9b8aSliubo 1979a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 1981abe9b8aSliubo 1991abe9b8aSliubo TP_ARGS(inode), 2001abe9b8aSliubo 201bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 202f8f8e189SDavid Sterba __field( u64, ino ) 20394c3f6c6SDavid Sterba __field( u64, blocks ) 2041abe9b8aSliubo __field( u64, disk_i_size ) 2051abe9b8aSliubo __field( u64, generation ) 2061abe9b8aSliubo __field( u64, last_trans ) 2071abe9b8aSliubo __field( u64, logged_trans ) 2081abe9b8aSliubo __field( u64, root_objectid ) 2091abe9b8aSliubo ), 2101abe9b8aSliubo 211bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 212f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 2131abe9b8aSliubo __entry->blocks = inode->i_blocks; 2141abe9b8aSliubo __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; 2151abe9b8aSliubo __entry->generation = BTRFS_I(inode)->generation; 2161abe9b8aSliubo __entry->last_trans = BTRFS_I(inode)->last_trans; 2171abe9b8aSliubo __entry->logged_trans = BTRFS_I(inode)->logged_trans; 2181abe9b8aSliubo __entry->root_objectid = 2191abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 2201abe9b8aSliubo ), 2211abe9b8aSliubo 222f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%llu blocks=%llu " 223562a7a07SDavid Sterba "disk_i_size=%llu last_trans=%llu logged_trans=%llu", 2241abe9b8aSliubo show_root_type(__entry->root_objectid), 2258eec8463SDavid Sterba __entry->generation, 2268eec8463SDavid Sterba __entry->ino, 22794c3f6c6SDavid Sterba __entry->blocks, 2288eec8463SDavid Sterba __entry->disk_i_size, 2298eec8463SDavid Sterba __entry->last_trans, 2308eec8463SDavid Sterba __entry->logged_trans) 2311abe9b8aSliubo ); 2321abe9b8aSliubo 2331abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_new, 2341abe9b8aSliubo 2359a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 2361abe9b8aSliubo 2371abe9b8aSliubo TP_ARGS(inode) 2381abe9b8aSliubo ); 2391abe9b8aSliubo 2401abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_request, 2411abe9b8aSliubo 2429a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 2431abe9b8aSliubo 2441abe9b8aSliubo TP_ARGS(inode) 2451abe9b8aSliubo ); 2461abe9b8aSliubo 2471abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, 2481abe9b8aSliubo 2499a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 2501abe9b8aSliubo 2511abe9b8aSliubo TP_ARGS(inode) 2521abe9b8aSliubo ); 2531abe9b8aSliubo 2541abe9b8aSliubo #define __show_map_type(type) \ 2557f34b746Sliubo __print_symbolic_u64(type, \ 2561abe9b8aSliubo { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ 2571abe9b8aSliubo { EXTENT_MAP_HOLE, "HOLE" }, \ 2581abe9b8aSliubo { EXTENT_MAP_INLINE, "INLINE" }, \ 2591abe9b8aSliubo { EXTENT_MAP_DELALLOC, "DELALLOC" }) 2601abe9b8aSliubo 2611abe9b8aSliubo #define show_map_type(type) \ 2621abe9b8aSliubo type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) 2631abe9b8aSliubo 2641abe9b8aSliubo #define show_map_flags(flag) \ 2651abe9b8aSliubo __print_flags(flag, "|", \ 266254a2d14SLiu Bo { (1 << EXTENT_FLAG_PINNED), "PINNED" },\ 267254a2d14SLiu Bo { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\ 268254a2d14SLiu Bo { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\ 269254a2d14SLiu Bo { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\ 270254a2d14SLiu Bo { (1 << EXTENT_FLAG_FILLING), "FILLING" },\ 271254a2d14SLiu Bo { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" }) 2721abe9b8aSliubo 2734cd8587cSSteven Rostedt TRACE_EVENT_CONDITION(btrfs_get_extent, 2741abe9b8aSliubo 2759a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode, 2769a35b637SJeff Mahoney const struct extent_map *map), 2771abe9b8aSliubo 27892a1bf76SLiu Bo TP_ARGS(root, inode, map), 2791abe9b8aSliubo 2804cd8587cSSteven Rostedt TP_CONDITION(map), 2814cd8587cSSteven Rostedt 282bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 2831abe9b8aSliubo __field( u64, root_objectid ) 28492a1bf76SLiu Bo __field( u64, ino ) 2851abe9b8aSliubo __field( u64, start ) 2861abe9b8aSliubo __field( u64, len ) 2871abe9b8aSliubo __field( u64, orig_start ) 2881abe9b8aSliubo __field( u64, block_start ) 2891abe9b8aSliubo __field( u64, block_len ) 2901abe9b8aSliubo __field( unsigned long, flags ) 2911abe9b8aSliubo __field( int, refs ) 2921abe9b8aSliubo __field( unsigned int, compress_type ) 2931abe9b8aSliubo ), 2941abe9b8aSliubo 295bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 2961abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 29792a1bf76SLiu Bo __entry->ino = btrfs_ino(inode); 2981abe9b8aSliubo __entry->start = map->start; 2991abe9b8aSliubo __entry->len = map->len; 3001abe9b8aSliubo __entry->orig_start = map->orig_start; 3011abe9b8aSliubo __entry->block_start = map->block_start; 3021abe9b8aSliubo __entry->block_len = map->block_len; 3031abe9b8aSliubo __entry->flags = map->flags; 304490b54d6SElena Reshetova __entry->refs = refcount_read(&map->refs); 3051abe9b8aSliubo __entry->compress_type = map->compress_type; 3061abe9b8aSliubo ), 3071abe9b8aSliubo 308562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu " 309562a7a07SDavid Sterba "orig_start=%llu block_start=%llu(%s) " 310562a7a07SDavid Sterba "block_len=%llu flags=%s refs=%u " 3111abe9b8aSliubo "compress_type=%u", 3121abe9b8aSliubo show_root_type(__entry->root_objectid), 3138eec8463SDavid Sterba __entry->ino, 3148eec8463SDavid Sterba __entry->start, 3158eec8463SDavid Sterba __entry->len, 3168eec8463SDavid Sterba __entry->orig_start, 3171abe9b8aSliubo show_map_type(__entry->block_start), 3188eec8463SDavid Sterba __entry->block_len, 3191abe9b8aSliubo show_map_flags(__entry->flags), 3201abe9b8aSliubo __entry->refs, __entry->compress_type) 3211abe9b8aSliubo ); 3221abe9b8aSliubo 323393da918SLiu Bo TRACE_EVENT(btrfs_handle_em_exist, 324393da918SLiu Bo 3251d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 326f46b24c9SDavid Sterba const struct extent_map *existing, const struct extent_map *map, 327f46b24c9SDavid Sterba u64 start, u64 len), 328393da918SLiu Bo 329f46b24c9SDavid Sterba TP_ARGS(fs_info, existing, map, start, len), 330393da918SLiu Bo 331f46b24c9SDavid Sterba TP_STRUCT__entry_btrfs( 332393da918SLiu Bo __field( u64, e_start ) 333393da918SLiu Bo __field( u64, e_len ) 334393da918SLiu Bo __field( u64, map_start ) 335393da918SLiu Bo __field( u64, map_len ) 336393da918SLiu Bo __field( u64, start ) 337393da918SLiu Bo __field( u64, len ) 338393da918SLiu Bo ), 339393da918SLiu Bo 340f46b24c9SDavid Sterba TP_fast_assign_btrfs(fs_info, 341393da918SLiu Bo __entry->e_start = existing->start; 342393da918SLiu Bo __entry->e_len = existing->len; 343393da918SLiu Bo __entry->map_start = map->start; 344393da918SLiu Bo __entry->map_len = map->len; 345393da918SLiu Bo __entry->start = start; 346393da918SLiu Bo __entry->len = len; 347393da918SLiu Bo ), 348393da918SLiu Bo 349f46b24c9SDavid Sterba TP_printk_btrfs("start=%llu len=%llu " 350393da918SLiu Bo "existing(start=%llu len=%llu) " 351393da918SLiu Bo "em(start=%llu len=%llu)", 3528eec8463SDavid Sterba __entry->start, 3538eec8463SDavid Sterba __entry->len, 3548eec8463SDavid Sterba __entry->e_start, 3558eec8463SDavid Sterba __entry->e_len, 3568eec8463SDavid Sterba __entry->map_start, 3578eec8463SDavid Sterba __entry->map_len) 358393da918SLiu Bo ); 359393da918SLiu Bo 36009ed2f16SLiu Bo /* file extent item */ 36109ed2f16SLiu Bo DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular, 36209ed2f16SLiu Bo 3631d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 3641d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, u64 start), 36509ed2f16SLiu Bo 36609ed2f16SLiu Bo TP_ARGS(bi, l, fi, start), 36709ed2f16SLiu Bo 36809ed2f16SLiu Bo TP_STRUCT__entry_btrfs( 36909ed2f16SLiu Bo __field( u64, root_obj ) 37009ed2f16SLiu Bo __field( u64, ino ) 37109ed2f16SLiu Bo __field( loff_t, isize ) 37209ed2f16SLiu Bo __field( u64, disk_isize ) 37309ed2f16SLiu Bo __field( u64, num_bytes ) 37409ed2f16SLiu Bo __field( u64, ram_bytes ) 37509ed2f16SLiu Bo __field( u64, disk_bytenr ) 37609ed2f16SLiu Bo __field( u64, disk_num_bytes ) 37709ed2f16SLiu Bo __field( u64, extent_offset ) 37809ed2f16SLiu Bo __field( u8, extent_type ) 37909ed2f16SLiu Bo __field( u8, compression ) 38009ed2f16SLiu Bo __field( u64, extent_start ) 38109ed2f16SLiu Bo __field( u64, extent_end ) 38209ed2f16SLiu Bo ), 38309ed2f16SLiu Bo 38409ed2f16SLiu Bo TP_fast_assign_btrfs(bi->root->fs_info, 3854fd786e6SMisono Tomohiro __entry->root_obj = bi->root->root_key.objectid; 38609ed2f16SLiu Bo __entry->ino = btrfs_ino(bi); 38709ed2f16SLiu Bo __entry->isize = bi->vfs_inode.i_size; 38809ed2f16SLiu Bo __entry->disk_isize = bi->disk_i_size; 38909ed2f16SLiu Bo __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi); 39009ed2f16SLiu Bo __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi); 39109ed2f16SLiu Bo __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi); 39209ed2f16SLiu Bo __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi); 39309ed2f16SLiu Bo __entry->extent_offset = btrfs_file_extent_offset(l, fi); 39409ed2f16SLiu Bo __entry->extent_type = btrfs_file_extent_type(l, fi); 39509ed2f16SLiu Bo __entry->compression = btrfs_file_extent_compression(l, fi); 39609ed2f16SLiu Bo __entry->extent_start = start; 39709ed2f16SLiu Bo __entry->extent_end = (start + __entry->num_bytes); 39809ed2f16SLiu Bo ), 39909ed2f16SLiu Bo 40009ed2f16SLiu Bo TP_printk_btrfs( 40109ed2f16SLiu Bo "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " 40209ed2f16SLiu Bo "file extent range=[%llu %llu] " 40309ed2f16SLiu Bo "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu " 40409ed2f16SLiu Bo "disk_num_bytes=%llu extent_offset=%llu type=%s " 40509ed2f16SLiu Bo "compression=%u", 40609ed2f16SLiu Bo show_root_type(__entry->root_obj), __entry->ino, 40709ed2f16SLiu Bo __entry->isize, 40809ed2f16SLiu Bo __entry->disk_isize, __entry->extent_start, 40909ed2f16SLiu Bo __entry->extent_end, __entry->num_bytes, __entry->ram_bytes, 41009ed2f16SLiu Bo __entry->disk_bytenr, __entry->disk_num_bytes, 4110840dd28SNikolay Borisov __entry->extent_offset, __print_symbolic(__entry->extent_type, FI_TYPES), 41209ed2f16SLiu Bo __entry->compression) 41309ed2f16SLiu Bo ); 41409ed2f16SLiu Bo 41509ed2f16SLiu Bo DECLARE_EVENT_CLASS( 41609ed2f16SLiu Bo btrfs__file_extent_item_inline, 41709ed2f16SLiu Bo 4181d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4191d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, int slot, u64 start), 42009ed2f16SLiu Bo 42109ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start), 42209ed2f16SLiu Bo 42309ed2f16SLiu Bo TP_STRUCT__entry_btrfs( 42409ed2f16SLiu Bo __field( u64, root_obj ) 42509ed2f16SLiu Bo __field( u64, ino ) 42609ed2f16SLiu Bo __field( loff_t, isize ) 42709ed2f16SLiu Bo __field( u64, disk_isize ) 42809ed2f16SLiu Bo __field( u8, extent_type ) 42909ed2f16SLiu Bo __field( u8, compression ) 43009ed2f16SLiu Bo __field( u64, extent_start ) 43109ed2f16SLiu Bo __field( u64, extent_end ) 43209ed2f16SLiu Bo ), 43309ed2f16SLiu Bo 43409ed2f16SLiu Bo TP_fast_assign_btrfs( 43509ed2f16SLiu Bo bi->root->fs_info, 4364fd786e6SMisono Tomohiro __entry->root_obj = bi->root->root_key.objectid; 43709ed2f16SLiu Bo __entry->ino = btrfs_ino(bi); 43809ed2f16SLiu Bo __entry->isize = bi->vfs_inode.i_size; 43909ed2f16SLiu Bo __entry->disk_isize = bi->disk_i_size; 44009ed2f16SLiu Bo __entry->extent_type = btrfs_file_extent_type(l, fi); 44109ed2f16SLiu Bo __entry->compression = btrfs_file_extent_compression(l, fi); 44209ed2f16SLiu Bo __entry->extent_start = start; 443e41ca589SQu Wenruo __entry->extent_end = (start + btrfs_file_extent_ram_bytes(l, fi)); 44409ed2f16SLiu Bo ), 44509ed2f16SLiu Bo 44609ed2f16SLiu Bo TP_printk_btrfs( 44709ed2f16SLiu Bo "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " 44809ed2f16SLiu Bo "file extent range=[%llu %llu] " 44909ed2f16SLiu Bo "extent_type=%s compression=%u", 45009ed2f16SLiu Bo show_root_type(__entry->root_obj), __entry->ino, __entry->isize, 45109ed2f16SLiu Bo __entry->disk_isize, __entry->extent_start, 4520840dd28SNikolay Borisov __entry->extent_end, __print_symbolic(__entry->extent_type, FI_TYPES), 45309ed2f16SLiu Bo __entry->compression) 45409ed2f16SLiu Bo ); 45509ed2f16SLiu Bo 45609ed2f16SLiu Bo DEFINE_EVENT( 45709ed2f16SLiu Bo btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular, 45809ed2f16SLiu Bo 4591d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4601d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, u64 start), 46109ed2f16SLiu Bo 46209ed2f16SLiu Bo TP_ARGS(bi, l, fi, start) 46309ed2f16SLiu Bo ); 46409ed2f16SLiu Bo 46509ed2f16SLiu Bo DEFINE_EVENT( 46609ed2f16SLiu Bo btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular, 46709ed2f16SLiu Bo 4681d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4691d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, u64 start), 47009ed2f16SLiu Bo 47109ed2f16SLiu Bo TP_ARGS(bi, l, fi, start) 47209ed2f16SLiu Bo ); 47309ed2f16SLiu Bo 47409ed2f16SLiu Bo DEFINE_EVENT( 47509ed2f16SLiu Bo btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline, 47609ed2f16SLiu Bo 4771d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4781d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, int slot, u64 start), 47909ed2f16SLiu Bo 48009ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start) 48109ed2f16SLiu Bo ); 48209ed2f16SLiu Bo 48309ed2f16SLiu Bo DEFINE_EVENT( 48409ed2f16SLiu Bo btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline, 48509ed2f16SLiu Bo 4861d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, 4871d2e7c7cSDavid Sterba const struct btrfs_file_extent_item *fi, int slot, u64 start), 48809ed2f16SLiu Bo 48909ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start) 49009ed2f16SLiu Bo ); 49109ed2f16SLiu Bo 4921abe9b8aSliubo #define show_ordered_flags(flags) \ 4939d04a8ceSLiu Bo __print_flags(flags, "|", \ 4949d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ 4959d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ 4969d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ 4979d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ 4989d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ 4999d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ 5009d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ 501792ddef0SLiu Bo { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) 502e112e2b4SLiu Bo 5031abe9b8aSliubo 5041abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__ordered_extent, 5051abe9b8aSliubo 5069a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, 5079a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5081abe9b8aSliubo 5091abe9b8aSliubo TP_ARGS(inode, ordered), 5101abe9b8aSliubo 511bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 512f8f8e189SDavid Sterba __field( u64, ino ) 5131abe9b8aSliubo __field( u64, file_offset ) 5141abe9b8aSliubo __field( u64, start ) 5151abe9b8aSliubo __field( u64, len ) 5161abe9b8aSliubo __field( u64, disk_len ) 5171abe9b8aSliubo __field( u64, bytes_left ) 5181abe9b8aSliubo __field( unsigned long, flags ) 5191abe9b8aSliubo __field( int, compress_type ) 5201abe9b8aSliubo __field( int, refs ) 5211abe9b8aSliubo __field( u64, root_objectid ) 52278566548SLiu Bo __field( u64, truncated_len ) 5231abe9b8aSliubo ), 5241abe9b8aSliubo 525bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 526f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 5271abe9b8aSliubo __entry->file_offset = ordered->file_offset; 528bffe633eSOmar Sandoval __entry->start = ordered->disk_bytenr; 529bffe633eSOmar Sandoval __entry->len = ordered->num_bytes; 530bffe633eSOmar Sandoval __entry->disk_len = ordered->disk_num_bytes; 5311abe9b8aSliubo __entry->bytes_left = ordered->bytes_left; 5321abe9b8aSliubo __entry->flags = ordered->flags; 5331abe9b8aSliubo __entry->compress_type = ordered->compress_type; 534e76edab7SElena Reshetova __entry->refs = refcount_read(&ordered->refs); 5351abe9b8aSliubo __entry->root_objectid = 5361abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 53778566548SLiu Bo __entry->truncated_len = ordered->truncated_len; 5381abe9b8aSliubo ), 5391abe9b8aSliubo 540562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu " 541562a7a07SDavid Sterba "start=%llu len=%llu disk_len=%llu " 542562a7a07SDavid Sterba "truncated_len=%llu " 543562a7a07SDavid Sterba "bytes_left=%llu flags=%s compress_type=%d " 5441abe9b8aSliubo "refs=%d", 5451abe9b8aSliubo show_root_type(__entry->root_objectid), 5468eec8463SDavid Sterba __entry->ino, 5478eec8463SDavid Sterba __entry->file_offset, 5488eec8463SDavid Sterba __entry->start, 5498eec8463SDavid Sterba __entry->len, 5508eec8463SDavid Sterba __entry->disk_len, 5518eec8463SDavid Sterba __entry->truncated_len, 5528eec8463SDavid Sterba __entry->bytes_left, 5531abe9b8aSliubo show_ordered_flags(__entry->flags), 5541abe9b8aSliubo __entry->compress_type, __entry->refs) 5551abe9b8aSliubo ); 5561abe9b8aSliubo 5571abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, 5581abe9b8aSliubo 5599a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, 5609a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5611abe9b8aSliubo 5621abe9b8aSliubo TP_ARGS(inode, ordered) 5631abe9b8aSliubo ); 5641abe9b8aSliubo 5651abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, 5661abe9b8aSliubo 5679a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, 5689a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5691abe9b8aSliubo 5701abe9b8aSliubo TP_ARGS(inode, ordered) 5711abe9b8aSliubo ); 5721abe9b8aSliubo 5731abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, 5741abe9b8aSliubo 5759a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, 5769a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5771abe9b8aSliubo 5781abe9b8aSliubo TP_ARGS(inode, ordered) 5791abe9b8aSliubo ); 5801abe9b8aSliubo 5811abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, 5821abe9b8aSliubo 5839a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, 5849a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 5851abe9b8aSliubo 5861abe9b8aSliubo TP_ARGS(inode, ordered) 5871abe9b8aSliubo ); 5881abe9b8aSliubo 5891abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__writepage, 5901abe9b8aSliubo 5919a35b637SJeff Mahoney TP_PROTO(const struct page *page, const struct inode *inode, 5929a35b637SJeff Mahoney const struct writeback_control *wbc), 5931abe9b8aSliubo 5941abe9b8aSliubo TP_ARGS(page, inode, wbc), 5951abe9b8aSliubo 596bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 597f8f8e189SDavid Sterba __field( u64, ino ) 5981abe9b8aSliubo __field( pgoff_t, index ) 5991abe9b8aSliubo __field( long, nr_to_write ) 6001abe9b8aSliubo __field( long, pages_skipped ) 6011abe9b8aSliubo __field( loff_t, range_start ) 6021abe9b8aSliubo __field( loff_t, range_end ) 6031abe9b8aSliubo __field( char, for_kupdate ) 6041abe9b8aSliubo __field( char, for_reclaim ) 6051abe9b8aSliubo __field( char, range_cyclic ) 60694c3f6c6SDavid Sterba __field( unsigned long, writeback_index ) 6071abe9b8aSliubo __field( u64, root_objectid ) 6081abe9b8aSliubo ), 6091abe9b8aSliubo 610bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 611f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 6121abe9b8aSliubo __entry->index = page->index; 6131abe9b8aSliubo __entry->nr_to_write = wbc->nr_to_write; 6141abe9b8aSliubo __entry->pages_skipped = wbc->pages_skipped; 6151abe9b8aSliubo __entry->range_start = wbc->range_start; 6161abe9b8aSliubo __entry->range_end = wbc->range_end; 6171abe9b8aSliubo __entry->for_kupdate = wbc->for_kupdate; 6181abe9b8aSliubo __entry->for_reclaim = wbc->for_reclaim; 6191abe9b8aSliubo __entry->range_cyclic = wbc->range_cyclic; 6201abe9b8aSliubo __entry->writeback_index = inode->i_mapping->writeback_index; 6211abe9b8aSliubo __entry->root_objectid = 6221abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 6231abe9b8aSliubo ), 6241abe9b8aSliubo 625f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu " 626562a7a07SDavid Sterba "nr_to_write=%ld pages_skipped=%ld range_start=%llu " 627562a7a07SDavid Sterba "range_end=%llu for_kupdate=%d " 628562a7a07SDavid Sterba "for_reclaim=%d range_cyclic=%d writeback_index=%lu", 6291abe9b8aSliubo show_root_type(__entry->root_objectid), 6308eec8463SDavid Sterba __entry->ino, __entry->index, 6311abe9b8aSliubo __entry->nr_to_write, __entry->pages_skipped, 6321abe9b8aSliubo __entry->range_start, __entry->range_end, 633846d5a09SWu Fengguang __entry->for_kupdate, 6341abe9b8aSliubo __entry->for_reclaim, __entry->range_cyclic, 63594c3f6c6SDavid Sterba __entry->writeback_index) 6361abe9b8aSliubo ); 6371abe9b8aSliubo 6381abe9b8aSliubo DEFINE_EVENT(btrfs__writepage, __extent_writepage, 6391abe9b8aSliubo 6409a35b637SJeff Mahoney TP_PROTO(const struct page *page, const struct inode *inode, 6419a35b637SJeff Mahoney const struct writeback_control *wbc), 6421abe9b8aSliubo 6431abe9b8aSliubo TP_ARGS(page, inode, wbc) 6441abe9b8aSliubo ); 6451abe9b8aSliubo 6461abe9b8aSliubo TRACE_EVENT(btrfs_writepage_end_io_hook, 6471abe9b8aSliubo 6489a35b637SJeff Mahoney TP_PROTO(const struct page *page, u64 start, u64 end, int uptodate), 6491abe9b8aSliubo 6501abe9b8aSliubo TP_ARGS(page, start, end, uptodate), 6511abe9b8aSliubo 652bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 653f8f8e189SDavid Sterba __field( u64, ino ) 65494c3f6c6SDavid Sterba __field( unsigned long, index ) 6551abe9b8aSliubo __field( u64, start ) 6561abe9b8aSliubo __field( u64, end ) 6571abe9b8aSliubo __field( int, uptodate ) 6581abe9b8aSliubo __field( u64, root_objectid ) 6591abe9b8aSliubo ), 6601abe9b8aSliubo 661bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb), 662f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(page->mapping->host)); 6631abe9b8aSliubo __entry->index = page->index; 6641abe9b8aSliubo __entry->start = start; 6651abe9b8aSliubo __entry->end = end; 6661abe9b8aSliubo __entry->uptodate = uptodate; 6671abe9b8aSliubo __entry->root_objectid = 6681abe9b8aSliubo BTRFS_I(page->mapping->host)->root->root_key.objectid; 6691abe9b8aSliubo ), 6701abe9b8aSliubo 671f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu start=%llu " 672562a7a07SDavid Sterba "end=%llu uptodate=%d", 6731abe9b8aSliubo show_root_type(__entry->root_objectid), 67494c3f6c6SDavid Sterba __entry->ino, __entry->index, 6758eec8463SDavid Sterba __entry->start, 6768eec8463SDavid Sterba __entry->end, __entry->uptodate) 6771abe9b8aSliubo ); 6781abe9b8aSliubo 6791abe9b8aSliubo TRACE_EVENT(btrfs_sync_file, 6801abe9b8aSliubo 6819a35b637SJeff Mahoney TP_PROTO(const struct file *file, int datasync), 6821abe9b8aSliubo 6831abe9b8aSliubo TP_ARGS(file, datasync), 6841abe9b8aSliubo 685bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 686f8f8e189SDavid Sterba __field( u64, ino ) 687f8f8e189SDavid Sterba __field( u64, parent ) 6881abe9b8aSliubo __field( int, datasync ) 6891abe9b8aSliubo __field( u64, root_objectid ) 6901abe9b8aSliubo ), 6911abe9b8aSliubo 6921abe9b8aSliubo TP_fast_assign( 6939a35b637SJeff Mahoney const struct dentry *dentry = file->f_path.dentry; 6949a35b637SJeff Mahoney const struct inode *inode = d_inode(dentry); 6951abe9b8aSliubo 696bc074524SJeff Mahoney TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb)); 697f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 698f8f8e189SDavid Sterba __entry->parent = btrfs_ino(BTRFS_I(d_inode(dentry->d_parent))); 6991abe9b8aSliubo __entry->datasync = datasync; 7001abe9b8aSliubo __entry->root_objectid = 7011abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 7021abe9b8aSliubo ), 7031abe9b8aSliubo 704f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu parent=%llu datasync=%d", 7051abe9b8aSliubo show_root_type(__entry->root_objectid), 7068eec8463SDavid Sterba __entry->ino, 7078eec8463SDavid Sterba __entry->parent, 7081abe9b8aSliubo __entry->datasync) 7091abe9b8aSliubo ); 7101abe9b8aSliubo 7111abe9b8aSliubo TRACE_EVENT(btrfs_sync_fs, 7121abe9b8aSliubo 7139a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, int wait), 7141abe9b8aSliubo 715bc074524SJeff Mahoney TP_ARGS(fs_info, wait), 7161abe9b8aSliubo 717bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 7181abe9b8aSliubo __field( int, wait ) 7191abe9b8aSliubo ), 7201abe9b8aSliubo 721bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 7221abe9b8aSliubo __entry->wait = wait; 7231abe9b8aSliubo ), 7241abe9b8aSliubo 725bc074524SJeff Mahoney TP_printk_btrfs("wait=%d", __entry->wait) 7261abe9b8aSliubo ); 7271abe9b8aSliubo 728c83f8effSJosef Bacik TRACE_EVENT(btrfs_add_block_group, 729c83f8effSJosef Bacik 7309a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 73132da5386SDavid Sterba const struct btrfs_block_group *block_group, int create), 732c83f8effSJosef Bacik 733c83f8effSJosef Bacik TP_ARGS(fs_info, block_group, create), 734c83f8effSJosef Bacik 7352e63e62dSDavid Sterba TP_STRUCT__entry_btrfs( 736c83f8effSJosef Bacik __field( u64, offset ) 737c83f8effSJosef Bacik __field( u64, size ) 738c83f8effSJosef Bacik __field( u64, flags ) 739c83f8effSJosef Bacik __field( u64, bytes_used ) 740c83f8effSJosef Bacik __field( u64, bytes_super ) 741c83f8effSJosef Bacik __field( int, create ) 742c83f8effSJosef Bacik ), 743c83f8effSJosef Bacik 7442e63e62dSDavid Sterba TP_fast_assign_btrfs(fs_info, 745b3470b5dSDavid Sterba __entry->offset = block_group->start; 746b3470b5dSDavid Sterba __entry->size = block_group->length; 747c83f8effSJosef Bacik __entry->flags = block_group->flags; 748bf38be65SDavid Sterba __entry->bytes_used = block_group->used; 749c83f8effSJosef Bacik __entry->bytes_super = block_group->bytes_super; 750c83f8effSJosef Bacik __entry->create = create; 751c83f8effSJosef Bacik ), 752c83f8effSJosef Bacik 7532e63e62dSDavid Sterba TP_printk_btrfs("block_group offset=%llu size=%llu " 754562a7a07SDavid Sterba "flags=%llu(%s) bytes_used=%llu bytes_super=%llu " 7552e63e62dSDavid Sterba "create=%d", 7568eec8463SDavid Sterba __entry->offset, 7578eec8463SDavid Sterba __entry->size, 7588eec8463SDavid Sterba __entry->flags, 759c83f8effSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 760c83f8effSJosef Bacik BTRFS_GROUP_FLAGS), 7618eec8463SDavid Sterba __entry->bytes_used, 7628eec8463SDavid Sterba __entry->bytes_super, __entry->create) 763c83f8effSJosef Bacik ); 764c83f8effSJosef Bacik 7651abe9b8aSliubo #define show_ref_action(action) \ 7661abe9b8aSliubo __print_symbolic(action, \ 7671abe9b8aSliubo { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ 7681abe9b8aSliubo { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ 7691abe9b8aSliubo { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ 7701abe9b8aSliubo { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) 7711abe9b8aSliubo 7721abe9b8aSliubo 773599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, 7741abe9b8aSliubo 7759a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 7769a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 7779a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 7781abe9b8aSliubo int action), 7791abe9b8aSliubo 780bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action), 7811abe9b8aSliubo 782bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 7831abe9b8aSliubo __field( u64, bytenr ) 7841abe9b8aSliubo __field( u64, num_bytes ) 7851abe9b8aSliubo __field( int, action ) 7861abe9b8aSliubo __field( u64, parent ) 7871abe9b8aSliubo __field( u64, ref_root ) 7881abe9b8aSliubo __field( int, level ) 7891abe9b8aSliubo __field( int, type ) 790dea7d76eSLiu Bo __field( u64, seq ) 7911abe9b8aSliubo ), 7921abe9b8aSliubo 793bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 7941abe9b8aSliubo __entry->bytenr = ref->bytenr; 7951abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 7961abe9b8aSliubo __entry->action = action; 7971abe9b8aSliubo __entry->parent = full_ref->parent; 7981abe9b8aSliubo __entry->ref_root = full_ref->root; 7991abe9b8aSliubo __entry->level = full_ref->level; 8001abe9b8aSliubo __entry->type = ref->type; 801dea7d76eSLiu Bo __entry->seq = ref->seq; 8021abe9b8aSliubo ), 8031abe9b8aSliubo 804562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 805562a7a07SDavid Sterba "parent=%llu(%s) ref_root=%llu(%s) level=%d " 806562a7a07SDavid Sterba "type=%s seq=%llu", 8078eec8463SDavid Sterba __entry->bytenr, 8088eec8463SDavid Sterba __entry->num_bytes, 8091abe9b8aSliubo show_ref_action(__entry->action), 8101abe9b8aSliubo show_root_type(__entry->parent), 8111abe9b8aSliubo show_root_type(__entry->ref_root), 812dea7d76eSLiu Bo __entry->level, show_ref_type(__entry->type), 8138eec8463SDavid Sterba __entry->seq) 8141abe9b8aSliubo ); 8151abe9b8aSliubo 816599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, 817599c75ecSLiu Bo 8189a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8199a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 8209a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 821599c75ecSLiu Bo int action), 822599c75ecSLiu Bo 823bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 824599c75ecSLiu Bo ); 825599c75ecSLiu Bo 826599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, 827599c75ecSLiu Bo 8289a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8299a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 8309a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 831599c75ecSLiu Bo int action), 832599c75ecSLiu Bo 833bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 834599c75ecSLiu Bo ); 835599c75ecSLiu Bo 836599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, 8371abe9b8aSliubo 8389a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8399a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 8409a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 8411abe9b8aSliubo int action), 8421abe9b8aSliubo 843bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action), 8441abe9b8aSliubo 845bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 8461abe9b8aSliubo __field( u64, bytenr ) 8471abe9b8aSliubo __field( u64, num_bytes ) 8481abe9b8aSliubo __field( int, action ) 8491abe9b8aSliubo __field( u64, parent ) 8501abe9b8aSliubo __field( u64, ref_root ) 8511abe9b8aSliubo __field( u64, owner ) 8521abe9b8aSliubo __field( u64, offset ) 8531abe9b8aSliubo __field( int, type ) 854dea7d76eSLiu Bo __field( u64, seq ) 8551abe9b8aSliubo ), 8561abe9b8aSliubo 857bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 8581abe9b8aSliubo __entry->bytenr = ref->bytenr; 8591abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 8601abe9b8aSliubo __entry->action = action; 8611abe9b8aSliubo __entry->parent = full_ref->parent; 8621abe9b8aSliubo __entry->ref_root = full_ref->root; 8631abe9b8aSliubo __entry->owner = full_ref->objectid; 8641abe9b8aSliubo __entry->offset = full_ref->offset; 8651abe9b8aSliubo __entry->type = ref->type; 866dea7d76eSLiu Bo __entry->seq = ref->seq; 8671abe9b8aSliubo ), 8681abe9b8aSliubo 869562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 870562a7a07SDavid Sterba "parent=%llu(%s) ref_root=%llu(%s) owner=%llu " 871562a7a07SDavid Sterba "offset=%llu type=%s seq=%llu", 8728eec8463SDavid Sterba __entry->bytenr, 8738eec8463SDavid Sterba __entry->num_bytes, 8741abe9b8aSliubo show_ref_action(__entry->action), 8751abe9b8aSliubo show_root_type(__entry->parent), 8761abe9b8aSliubo show_root_type(__entry->ref_root), 8778eec8463SDavid Sterba __entry->owner, 8788eec8463SDavid Sterba __entry->offset, 879dea7d76eSLiu Bo show_ref_type(__entry->type), 8808eec8463SDavid Sterba __entry->seq) 8811abe9b8aSliubo ); 8821abe9b8aSliubo 883599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, 884599c75ecSLiu Bo 8859a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8869a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 8879a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 888599c75ecSLiu Bo int action), 889599c75ecSLiu Bo 890bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 891599c75ecSLiu Bo ); 892599c75ecSLiu Bo 893599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, 894599c75ecSLiu Bo 8959a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8969a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 8979a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 898599c75ecSLiu Bo int action), 899599c75ecSLiu Bo 900bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 901599c75ecSLiu Bo ); 902599c75ecSLiu Bo 903599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, 9041abe9b8aSliubo 9059a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9069a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 9071abe9b8aSliubo int action), 9081abe9b8aSliubo 909d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action), 9101abe9b8aSliubo 911bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 9121abe9b8aSliubo __field( u64, bytenr ) 9131abe9b8aSliubo __field( u64, num_bytes ) 9141abe9b8aSliubo __field( int, action ) 9151abe9b8aSliubo __field( int, is_data ) 9161abe9b8aSliubo ), 9171abe9b8aSliubo 918bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 919d278850eSJosef Bacik __entry->bytenr = head_ref->bytenr; 920d278850eSJosef Bacik __entry->num_bytes = head_ref->num_bytes; 9211abe9b8aSliubo __entry->action = action; 9221abe9b8aSliubo __entry->is_data = head_ref->is_data; 9231abe9b8aSliubo ), 9241abe9b8aSliubo 925562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d", 9268eec8463SDavid Sterba __entry->bytenr, 9278eec8463SDavid Sterba __entry->num_bytes, 9281abe9b8aSliubo show_ref_action(__entry->action), 9291abe9b8aSliubo __entry->is_data) 9301abe9b8aSliubo ); 9311abe9b8aSliubo 932599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, 933599c75ecSLiu Bo 9349a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9359a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 936599c75ecSLiu Bo int action), 937599c75ecSLiu Bo 938d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action) 939599c75ecSLiu Bo ); 940599c75ecSLiu Bo 941599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, 942599c75ecSLiu Bo 9439a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9449a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 945599c75ecSLiu Bo int action), 946599c75ecSLiu Bo 947d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action) 948599c75ecSLiu Bo ); 949599c75ecSLiu Bo 9501abe9b8aSliubo #define show_chunk_type(type) \ 9511abe9b8aSliubo __print_flags(type, "|", \ 9521abe9b8aSliubo { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ 9531abe9b8aSliubo { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 9541abe9b8aSliubo { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 9551abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ 9561abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ 9571abe9b8aSliubo { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ 958e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 959e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ 960e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) 9611abe9b8aSliubo 9621abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__chunk, 9631abe9b8aSliubo 9649a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9659a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 9661abe9b8aSliubo 9676bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size), 9681abe9b8aSliubo 969bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 9701abe9b8aSliubo __field( int, num_stripes ) 9711abe9b8aSliubo __field( u64, type ) 9721abe9b8aSliubo __field( int, sub_stripes ) 9731abe9b8aSliubo __field( u64, offset ) 9741abe9b8aSliubo __field( u64, size ) 9751abe9b8aSliubo __field( u64, root_objectid ) 9761abe9b8aSliubo ), 9771abe9b8aSliubo 9786bccf3abSJeff Mahoney TP_fast_assign_btrfs(fs_info, 9791abe9b8aSliubo __entry->num_stripes = map->num_stripes; 9801abe9b8aSliubo __entry->type = map->type; 9811abe9b8aSliubo __entry->sub_stripes = map->sub_stripes; 9821abe9b8aSliubo __entry->offset = offset; 9831abe9b8aSliubo __entry->size = size; 9846bccf3abSJeff Mahoney __entry->root_objectid = fs_info->chunk_root->root_key.objectid; 9851abe9b8aSliubo ), 9861abe9b8aSliubo 987562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu " 988562a7a07SDavid Sterba "num_stripes=%d sub_stripes=%d type=%s", 9891abe9b8aSliubo show_root_type(__entry->root_objectid), 9908eec8463SDavid Sterba __entry->offset, 9918eec8463SDavid Sterba __entry->size, 9921abe9b8aSliubo __entry->num_stripes, __entry->sub_stripes, 9931abe9b8aSliubo show_chunk_type(__entry->type)) 9941abe9b8aSliubo ); 9951abe9b8aSliubo 9961abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, 9971abe9b8aSliubo 9989a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9999a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 10001abe9b8aSliubo 10016bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size) 10021abe9b8aSliubo ); 10031abe9b8aSliubo 10041abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, 10051abe9b8aSliubo 10069a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 10079a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 10081abe9b8aSliubo 10096bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size) 10101abe9b8aSliubo ); 10111abe9b8aSliubo 10121abe9b8aSliubo TRACE_EVENT(btrfs_cow_block, 10131abe9b8aSliubo 10149a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf, 10159a35b637SJeff Mahoney const struct extent_buffer *cow), 10161abe9b8aSliubo 10171abe9b8aSliubo TP_ARGS(root, buf, cow), 10181abe9b8aSliubo 1019bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 10201abe9b8aSliubo __field( u64, root_objectid ) 10211abe9b8aSliubo __field( u64, buf_start ) 10221abe9b8aSliubo __field( int, refs ) 10231abe9b8aSliubo __field( u64, cow_start ) 10241abe9b8aSliubo __field( int, buf_level ) 10251abe9b8aSliubo __field( int, cow_level ) 10261abe9b8aSliubo ), 10271abe9b8aSliubo 1028bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 10291abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 10301abe9b8aSliubo __entry->buf_start = buf->start; 10311abe9b8aSliubo __entry->refs = atomic_read(&buf->refs); 10321abe9b8aSliubo __entry->cow_start = cow->start; 10331abe9b8aSliubo __entry->buf_level = btrfs_header_level(buf); 10341abe9b8aSliubo __entry->cow_level = btrfs_header_level(cow); 10351abe9b8aSliubo ), 10361abe9b8aSliubo 1037562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu " 1038562a7a07SDavid Sterba "(orig_level=%d) cow_buf=%llu (cow_level=%d)", 10391abe9b8aSliubo show_root_type(__entry->root_objectid), 10401abe9b8aSliubo __entry->refs, 10418eec8463SDavid Sterba __entry->buf_start, 10421abe9b8aSliubo __entry->buf_level, 10438eec8463SDavid Sterba __entry->cow_start, 10441abe9b8aSliubo __entry->cow_level) 10451abe9b8aSliubo ); 10461abe9b8aSliubo 10478c2a3ca2SJosef Bacik TRACE_EVENT(btrfs_space_reservation, 10488c2a3ca2SJosef Bacik 10491d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, const char *type, u64 val, 10508c2a3ca2SJosef Bacik u64 bytes, int reserve), 10518c2a3ca2SJosef Bacik 10528c2a3ca2SJosef Bacik TP_ARGS(fs_info, type, val, bytes, reserve), 10538c2a3ca2SJosef Bacik 1054bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 10558c2a3ca2SJosef Bacik __string( type, type ) 10568c2a3ca2SJosef Bacik __field( u64, val ) 10578c2a3ca2SJosef Bacik __field( u64, bytes ) 10588c2a3ca2SJosef Bacik __field( int, reserve ) 10598c2a3ca2SJosef Bacik ), 10608c2a3ca2SJosef Bacik 1061bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 10628c2a3ca2SJosef Bacik __assign_str(type, type); 10638c2a3ca2SJosef Bacik __entry->val = val; 10648c2a3ca2SJosef Bacik __entry->bytes = bytes; 10658c2a3ca2SJosef Bacik __entry->reserve = reserve; 10668c2a3ca2SJosef Bacik ), 10678c2a3ca2SJosef Bacik 10685439c7f5SDavid Sterba TP_printk_btrfs("%s: %llu %s %llu", __get_str(type), __entry->val, 1069bc074524SJeff Mahoney __entry->reserve ? "reserve" : "release", 10708c2a3ca2SJosef Bacik __entry->bytes) 10718c2a3ca2SJosef Bacik ); 10728c2a3ca2SJosef Bacik 1073f376df2bSJosef Bacik TRACE_EVENT(btrfs_trigger_flush, 1074f376df2bSJosef Bacik 10759a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, 10761d2e7c7cSDavid Sterba int flush, const char *reason), 1077f376df2bSJosef Bacik 1078f376df2bSJosef Bacik TP_ARGS(fs_info, flags, bytes, flush, reason), 1079f376df2bSJosef Bacik 10802e63e62dSDavid Sterba TP_STRUCT__entry_btrfs( 1081f376df2bSJosef Bacik __field( u64, flags ) 1082f376df2bSJosef Bacik __field( u64, bytes ) 1083f376df2bSJosef Bacik __field( int, flush ) 1084f376df2bSJosef Bacik __string( reason, reason ) 1085f376df2bSJosef Bacik ), 1086f376df2bSJosef Bacik 10872e63e62dSDavid Sterba TP_fast_assign_btrfs(fs_info, 1088f376df2bSJosef Bacik __entry->flags = flags; 1089f376df2bSJosef Bacik __entry->bytes = bytes; 1090f376df2bSJosef Bacik __entry->flush = flush; 1091f376df2bSJosef Bacik __assign_str(reason, reason) 1092f376df2bSJosef Bacik ), 1093f376df2bSJosef Bacik 10942e63e62dSDavid Sterba TP_printk_btrfs("%s: flush=%d(%s) flags=%llu(%s) bytes=%llu", 10952e63e62dSDavid Sterba __get_str(reason), __entry->flush, 109645e31869SNikolay Borisov __print_symbolic(__entry->flush, FLUSH_ACTIONS), 10978eec8463SDavid Sterba __entry->flags, 1098f376df2bSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 1099f376df2bSJosef Bacik BTRFS_GROUP_FLAGS), 11008eec8463SDavid Sterba __entry->bytes) 1101f376df2bSJosef Bacik ); 1102f376df2bSJosef Bacik 1103f376df2bSJosef Bacik #define show_flush_state(state) \ 1104f376df2bSJosef Bacik __print_symbolic(state, \ 1105f376df2bSJosef Bacik { FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR"}, \ 1106f376df2bSJosef Bacik { FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS"}, \ 1107f376df2bSJosef Bacik { FLUSH_DELALLOC, "FLUSH_DELALLOC"}, \ 1108f376df2bSJosef Bacik { FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT"}, \ 1109413df725SJosef Bacik { FLUSH_DELAYED_REFS_NR, "FLUSH_DELAYED_REFS_NR"}, \ 1110413df725SJosef Bacik { FLUSH_DELAYED_REFS, "FLUSH_ELAYED_REFS"}, \ 1111f376df2bSJosef Bacik { ALLOC_CHUNK, "ALLOC_CHUNK"}, \ 1112450114fcSJosef Bacik { ALLOC_CHUNK_FORCE, "ALLOC_CHUNK_FORCE"}, \ 1113844245b4SJosef Bacik { RUN_DELAYED_IPUTS, "RUN_DELAYED_IPUTS"}, \ 1114f376df2bSJosef Bacik { COMMIT_TRANS, "COMMIT_TRANS"}) 1115f376df2bSJosef Bacik 1116f376df2bSJosef Bacik TRACE_EVENT(btrfs_flush_space, 1117f376df2bSJosef Bacik 11189a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes, 11197bdd6277SNikolay Borisov int state, int ret), 1120f376df2bSJosef Bacik 11217bdd6277SNikolay Borisov TP_ARGS(fs_info, flags, num_bytes, state, ret), 1122f376df2bSJosef Bacik 11232e63e62dSDavid Sterba TP_STRUCT__entry_btrfs( 1124f376df2bSJosef Bacik __field( u64, flags ) 1125f376df2bSJosef Bacik __field( u64, num_bytes ) 1126f376df2bSJosef Bacik __field( int, state ) 1127f376df2bSJosef Bacik __field( int, ret ) 1128f376df2bSJosef Bacik ), 1129f376df2bSJosef Bacik 11302e63e62dSDavid Sterba TP_fast_assign_btrfs(fs_info, 1131f376df2bSJosef Bacik __entry->flags = flags; 1132f376df2bSJosef Bacik __entry->num_bytes = num_bytes; 1133f376df2bSJosef Bacik __entry->state = state; 1134f376df2bSJosef Bacik __entry->ret = ret; 1135f376df2bSJosef Bacik ), 1136f376df2bSJosef Bacik 11372e63e62dSDavid Sterba TP_printk_btrfs("state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d", 11382e63e62dSDavid Sterba __entry->state, 1139f376df2bSJosef Bacik show_flush_state(__entry->state), 11408eec8463SDavid Sterba __entry->flags, 1141f376df2bSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 1142f376df2bSJosef Bacik BTRFS_GROUP_FLAGS), 11438eec8463SDavid Sterba __entry->num_bytes, __entry->ret) 1144f376df2bSJosef Bacik ); 1145f376df2bSJosef Bacik 11461abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__reserved_extent, 11471abe9b8aSliubo 11489a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 11491abe9b8aSliubo 115071ff6437SJeff Mahoney TP_ARGS(fs_info, start, len), 11511abe9b8aSliubo 1152bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 11531abe9b8aSliubo __field( u64, start ) 11541abe9b8aSliubo __field( u64, len ) 11551abe9b8aSliubo ), 11561abe9b8aSliubo 115771ff6437SJeff Mahoney TP_fast_assign_btrfs(fs_info, 11581abe9b8aSliubo __entry->start = start; 11591abe9b8aSliubo __entry->len = len; 11601abe9b8aSliubo ), 11611abe9b8aSliubo 1162562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu", 116371ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 11648eec8463SDavid Sterba __entry->start, 11658eec8463SDavid Sterba __entry->len) 11661abe9b8aSliubo ); 11671abe9b8aSliubo 11681abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, 11691abe9b8aSliubo 11709a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 11711abe9b8aSliubo 117271ff6437SJeff Mahoney TP_ARGS(fs_info, start, len) 11731abe9b8aSliubo ); 11741abe9b8aSliubo 11751abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, 11761abe9b8aSliubo 11779a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 11781abe9b8aSliubo 117971ff6437SJeff Mahoney TP_ARGS(fs_info, start, len) 11801abe9b8aSliubo ); 11811abe9b8aSliubo 11823f7de037SJosef Bacik TRACE_EVENT(find_free_extent, 11833f7de037SJosef Bacik 11849a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, 11859a35b637SJeff Mahoney u64 empty_size, u64 data), 11863f7de037SJosef Bacik 118771ff6437SJeff Mahoney TP_ARGS(fs_info, num_bytes, empty_size, data), 11883f7de037SJosef Bacik 1189bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 11903f7de037SJosef Bacik __field( u64, num_bytes ) 11913f7de037SJosef Bacik __field( u64, empty_size ) 11923f7de037SJosef Bacik __field( u64, data ) 11933f7de037SJosef Bacik ), 11943f7de037SJosef Bacik 119571ff6437SJeff Mahoney TP_fast_assign_btrfs(fs_info, 11963f7de037SJosef Bacik __entry->num_bytes = num_bytes; 11973f7de037SJosef Bacik __entry->empty_size = empty_size; 11983f7de037SJosef Bacik __entry->data = data; 11993f7de037SJosef Bacik ), 12003f7de037SJosef Bacik 12015439c7f5SDavid Sterba TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s)", 120271ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 12033f7de037SJosef Bacik __entry->num_bytes, __entry->empty_size, __entry->data, 12043f7de037SJosef Bacik __print_flags((unsigned long)__entry->data, "|", 12053f7de037SJosef Bacik BTRFS_GROUP_FLAGS)) 12063f7de037SJosef Bacik ); 12073f7de037SJosef Bacik 12083f7de037SJosef Bacik DECLARE_EVENT_CLASS(btrfs__reserve_extent, 12093f7de037SJosef Bacik 121032da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group, u64 start, 12113f7de037SJosef Bacik u64 len), 12123f7de037SJosef Bacik 12133dca5c94SQu Wenruo TP_ARGS(block_group, start, len), 12143f7de037SJosef Bacik 1215bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 12163f7de037SJosef Bacik __field( u64, bg_objectid ) 12173f7de037SJosef Bacik __field( u64, flags ) 12183f7de037SJosef Bacik __field( u64, start ) 12193f7de037SJosef Bacik __field( u64, len ) 12203f7de037SJosef Bacik ), 12213f7de037SJosef Bacik 12223dca5c94SQu Wenruo TP_fast_assign_btrfs(block_group->fs_info, 1223b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 12243f7de037SJosef Bacik __entry->flags = block_group->flags; 12253f7de037SJosef Bacik __entry->start = start; 12263f7de037SJosef Bacik __entry->len = len; 12273f7de037SJosef Bacik ), 12283f7de037SJosef Bacik 12295439c7f5SDavid Sterba TP_printk_btrfs("root=%llu(%s) block_group=%llu flags=%llu(%s) " 12305439c7f5SDavid Sterba "start=%llu len=%llu", 123171ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 123271ff6437SJeff Mahoney __entry->bg_objectid, 12333f7de037SJosef Bacik __entry->flags, __print_flags((unsigned long)__entry->flags, 12343f7de037SJosef Bacik "|", BTRFS_GROUP_FLAGS), 12353f7de037SJosef Bacik __entry->start, __entry->len) 12363f7de037SJosef Bacik ); 12373f7de037SJosef Bacik 12383f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, 12393f7de037SJosef Bacik 124032da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group, u64 start, 12413f7de037SJosef Bacik u64 len), 12423f7de037SJosef Bacik 12433dca5c94SQu Wenruo TP_ARGS(block_group, start, len) 12443f7de037SJosef Bacik ); 12453f7de037SJosef Bacik 12463f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, 12473f7de037SJosef Bacik 124832da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group, u64 start, 12493f7de037SJosef Bacik u64 len), 12503f7de037SJosef Bacik 12513dca5c94SQu Wenruo TP_ARGS(block_group, start, len) 12523f7de037SJosef Bacik ); 12533f7de037SJosef Bacik 12543f7de037SJosef Bacik TRACE_EVENT(btrfs_find_cluster, 12553f7de037SJosef Bacik 125632da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group, u64 start, 12573f7de037SJosef Bacik u64 bytes, u64 empty_size, u64 min_bytes), 12583f7de037SJosef Bacik 12593f7de037SJosef Bacik TP_ARGS(block_group, start, bytes, empty_size, min_bytes), 12603f7de037SJosef Bacik 1261bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 12623f7de037SJosef Bacik __field( u64, bg_objectid ) 12633f7de037SJosef Bacik __field( u64, flags ) 12643f7de037SJosef Bacik __field( u64, start ) 12653f7de037SJosef Bacik __field( u64, bytes ) 12663f7de037SJosef Bacik __field( u64, empty_size ) 12673f7de037SJosef Bacik __field( u64, min_bytes ) 12683f7de037SJosef Bacik ), 12693f7de037SJosef Bacik 1270bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 1271b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 12723f7de037SJosef Bacik __entry->flags = block_group->flags; 12733f7de037SJosef Bacik __entry->start = start; 12743f7de037SJosef Bacik __entry->bytes = bytes; 12753f7de037SJosef Bacik __entry->empty_size = empty_size; 12763f7de037SJosef Bacik __entry->min_bytes = min_bytes; 12773f7de037SJosef Bacik ), 12783f7de037SJosef Bacik 12795439c7f5SDavid Sterba TP_printk_btrfs("block_group=%llu flags=%llu(%s) start=%llu len=%llu " 12805439c7f5SDavid Sterba "empty_size=%llu min_bytes=%llu", __entry->bg_objectid, 12813f7de037SJosef Bacik __entry->flags, 12823f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 12833f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 12843f7de037SJosef Bacik __entry->bytes, __entry->empty_size, __entry->min_bytes) 12853f7de037SJosef Bacik ); 12863f7de037SJosef Bacik 12873f7de037SJosef Bacik TRACE_EVENT(btrfs_failed_cluster_setup, 12883f7de037SJosef Bacik 128932da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group), 12903f7de037SJosef Bacik 12913f7de037SJosef Bacik TP_ARGS(block_group), 12923f7de037SJosef Bacik 1293bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 12943f7de037SJosef Bacik __field( u64, bg_objectid ) 12953f7de037SJosef Bacik ), 12963f7de037SJosef Bacik 1297bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 1298b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 12993f7de037SJosef Bacik ), 13003f7de037SJosef Bacik 13015439c7f5SDavid Sterba TP_printk_btrfs("block_group=%llu", __entry->bg_objectid) 13023f7de037SJosef Bacik ); 13033f7de037SJosef Bacik 13043f7de037SJosef Bacik TRACE_EVENT(btrfs_setup_cluster, 13053f7de037SJosef Bacik 130632da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *block_group, 13079a35b637SJeff Mahoney const struct btrfs_free_cluster *cluster, 13089a35b637SJeff Mahoney u64 size, int bitmap), 13093f7de037SJosef Bacik 13103f7de037SJosef Bacik TP_ARGS(block_group, cluster, size, bitmap), 13113f7de037SJosef Bacik 1312bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 13133f7de037SJosef Bacik __field( u64, bg_objectid ) 13143f7de037SJosef Bacik __field( u64, flags ) 13153f7de037SJosef Bacik __field( u64, start ) 13163f7de037SJosef Bacik __field( u64, max_size ) 13173f7de037SJosef Bacik __field( u64, size ) 13183f7de037SJosef Bacik __field( int, bitmap ) 13193f7de037SJosef Bacik ), 13203f7de037SJosef Bacik 1321bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 1322b3470b5dSDavid Sterba __entry->bg_objectid = block_group->start; 13233f7de037SJosef Bacik __entry->flags = block_group->flags; 13243f7de037SJosef Bacik __entry->start = cluster->window_start; 13253f7de037SJosef Bacik __entry->max_size = cluster->max_size; 13263f7de037SJosef Bacik __entry->size = size; 13273f7de037SJosef Bacik __entry->bitmap = bitmap; 13283f7de037SJosef Bacik ), 13293f7de037SJosef Bacik 13305439c7f5SDavid Sterba TP_printk_btrfs("block_group=%llu flags=%llu(%s) window_start=%llu " 13315439c7f5SDavid Sterba "size=%llu max_size=%llu bitmap=%d", 13323f7de037SJosef Bacik __entry->bg_objectid, 13333f7de037SJosef Bacik __entry->flags, 13343f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 13353f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 13363f7de037SJosef Bacik __entry->size, __entry->max_size, __entry->bitmap) 13373f7de037SJosef Bacik ); 13383f7de037SJosef Bacik 1339143bede5SJeff Mahoney struct extent_state; 1340143bede5SJeff Mahoney TRACE_EVENT(alloc_extent_state, 1341143bede5SJeff Mahoney 13429a35b637SJeff Mahoney TP_PROTO(const struct extent_state *state, 13439a35b637SJeff Mahoney gfp_t mask, unsigned long IP), 1344143bede5SJeff Mahoney 1345143bede5SJeff Mahoney TP_ARGS(state, mask, IP), 1346143bede5SJeff Mahoney 1347143bede5SJeff Mahoney TP_STRUCT__entry( 13489a35b637SJeff Mahoney __field(const struct extent_state *, state) 1349143bede5SJeff Mahoney __field(gfp_t, mask) 135094c3f6c6SDavid Sterba __field(const void*, ip) 1351143bede5SJeff Mahoney ), 1352143bede5SJeff Mahoney 1353143bede5SJeff Mahoney TP_fast_assign( 1354143bede5SJeff Mahoney __entry->state = state, 1355143bede5SJeff Mahoney __entry->mask = mask, 135694c3f6c6SDavid Sterba __entry->ip = (const void *)IP 1357143bede5SJeff Mahoney ), 1358143bede5SJeff Mahoney 1359562a7a07SDavid Sterba TP_printk("state=%p mask=%s caller=%pS", __entry->state, 136094c3f6c6SDavid Sterba show_gfp_flags(__entry->mask), __entry->ip) 1361143bede5SJeff Mahoney ); 1362143bede5SJeff Mahoney 1363143bede5SJeff Mahoney TRACE_EVENT(free_extent_state, 1364143bede5SJeff Mahoney 13659a35b637SJeff Mahoney TP_PROTO(const struct extent_state *state, unsigned long IP), 1366143bede5SJeff Mahoney 1367143bede5SJeff Mahoney TP_ARGS(state, IP), 1368143bede5SJeff Mahoney 1369143bede5SJeff Mahoney TP_STRUCT__entry( 13709a35b637SJeff Mahoney __field(const struct extent_state *, state) 137194c3f6c6SDavid Sterba __field(const void*, ip) 1372143bede5SJeff Mahoney ), 1373143bede5SJeff Mahoney 1374143bede5SJeff Mahoney TP_fast_assign( 1375143bede5SJeff Mahoney __entry->state = state, 137694c3f6c6SDavid Sterba __entry->ip = (const void *)IP 1377143bede5SJeff Mahoney ), 1378143bede5SJeff Mahoney 137994c3f6c6SDavid Sterba TP_printk("state=%p caller=%pS", __entry->state, __entry->ip) 1380143bede5SJeff Mahoney ); 1381143bede5SJeff Mahoney 138252483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work, 138352483bc2SQu Wenruo 13849a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 138552483bc2SQu Wenruo 138652483bc2SQu Wenruo TP_ARGS(work), 138752483bc2SQu Wenruo 1388bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 13899a35b637SJeff Mahoney __field( const void *, work ) 13909a35b637SJeff Mahoney __field( const void *, wq ) 13919a35b637SJeff Mahoney __field( const void *, func ) 13929a35b637SJeff Mahoney __field( const void *, ordered_func ) 13939a35b637SJeff Mahoney __field( const void *, ordered_free ) 13949a35b637SJeff Mahoney __field( const void *, normal_work ) 139552483bc2SQu Wenruo ), 139652483bc2SQu Wenruo 1397bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_work_owner(work), 139852483bc2SQu Wenruo __entry->work = work; 139952483bc2SQu Wenruo __entry->wq = work->wq; 140052483bc2SQu Wenruo __entry->func = work->func; 140152483bc2SQu Wenruo __entry->ordered_func = work->ordered_func; 140252483bc2SQu Wenruo __entry->ordered_free = work->ordered_free; 1403b38a6258SLiu Bo __entry->normal_work = &work->normal_work; 140452483bc2SQu Wenruo ), 140552483bc2SQu Wenruo 1406d75f773cSSakari Ailus TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%ps ordered_func=%p " 1407b38a6258SLiu Bo "ordered_free=%p", 1408b38a6258SLiu Bo __entry->work, __entry->normal_work, __entry->wq, 1409b38a6258SLiu Bo __entry->func, __entry->ordered_func, __entry->ordered_free) 141052483bc2SQu Wenruo ); 141152483bc2SQu Wenruo 1412ac0c7cf8SDavid Sterba /* 1413c9eb55dbSOmar Sandoval * For situations when the work is freed, we pass fs_info and a tag that matches 1414c9eb55dbSOmar Sandoval * the address of the work structure so it can be paired with the scheduling 1415c9eb55dbSOmar Sandoval * event. DO NOT add anything here that dereferences wtag. 1416ac0c7cf8SDavid Sterba */ 141752483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work__done, 141852483bc2SQu Wenruo 14199a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), 142052483bc2SQu Wenruo 1421ac0c7cf8SDavid Sterba TP_ARGS(fs_info, wtag), 142252483bc2SQu Wenruo 1423bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 14249a35b637SJeff Mahoney __field( const void *, wtag ) 142552483bc2SQu Wenruo ), 142652483bc2SQu Wenruo 1427ac0c7cf8SDavid Sterba TP_fast_assign_btrfs(fs_info, 1428ac0c7cf8SDavid Sterba __entry->wtag = wtag; 142952483bc2SQu Wenruo ), 143052483bc2SQu Wenruo 1431ac0c7cf8SDavid Sterba TP_printk_btrfs("work->%p", __entry->wtag) 143252483bc2SQu Wenruo ); 143352483bc2SQu Wenruo 143452483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_queued, 143552483bc2SQu Wenruo 14369a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 143752483bc2SQu Wenruo 143852483bc2SQu Wenruo TP_ARGS(work) 143952483bc2SQu Wenruo ); 144052483bc2SQu Wenruo 144152483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_sched, 144252483bc2SQu Wenruo 14439a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 144452483bc2SQu Wenruo 144552483bc2SQu Wenruo TP_ARGS(work) 144652483bc2SQu Wenruo ); 144752483bc2SQu Wenruo 144852483bc2SQu Wenruo DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, 144952483bc2SQu Wenruo 14509a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), 145152483bc2SQu Wenruo 1452ac0c7cf8SDavid Sterba TP_ARGS(fs_info, wtag) 145352483bc2SQu Wenruo ); 145452483bc2SQu Wenruo 145552483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_ordered_sched, 145652483bc2SQu Wenruo 14579a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 145852483bc2SQu Wenruo 145952483bc2SQu Wenruo TP_ARGS(work) 146052483bc2SQu Wenruo ); 146152483bc2SQu Wenruo 1462c3a46891SQu Wenruo DECLARE_EVENT_CLASS(btrfs__workqueue, 1463c3a46891SQu Wenruo 14649a35b637SJeff Mahoney TP_PROTO(const struct __btrfs_workqueue *wq, 14659a35b637SJeff Mahoney const char *name, int high), 1466c3a46891SQu Wenruo 1467c3a46891SQu Wenruo TP_ARGS(wq, name, high), 1468c3a46891SQu Wenruo 1469bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 14709a35b637SJeff Mahoney __field( const void *, wq ) 1471c3a46891SQu Wenruo __string( name, name ) 1472c3a46891SQu Wenruo __field( int , high ) 1473c3a46891SQu Wenruo ), 1474c3a46891SQu Wenruo 1475bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1476c3a46891SQu Wenruo __entry->wq = wq; 1477c3a46891SQu Wenruo __assign_str(name, name); 1478c3a46891SQu Wenruo __entry->high = high; 1479c3a46891SQu Wenruo ), 1480c3a46891SQu Wenruo 1481562a7a07SDavid Sterba TP_printk_btrfs("name=%s%s wq=%p", __get_str(name), 1482c3a46891SQu Wenruo __print_flags(__entry->high, "", 1483c3a46891SQu Wenruo {(WQ_HIGHPRI), "-high"}), 1484c3a46891SQu Wenruo __entry->wq) 1485c3a46891SQu Wenruo ); 1486c3a46891SQu Wenruo 1487c3a46891SQu Wenruo DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc, 1488c3a46891SQu Wenruo 14899a35b637SJeff Mahoney TP_PROTO(const struct __btrfs_workqueue *wq, 14909a35b637SJeff Mahoney const char *name, int high), 1491c3a46891SQu Wenruo 1492c3a46891SQu Wenruo TP_ARGS(wq, name, high) 1493c3a46891SQu Wenruo ); 1494c3a46891SQu Wenruo 1495c3a46891SQu Wenruo DECLARE_EVENT_CLASS(btrfs__workqueue_done, 1496c3a46891SQu Wenruo 14979a35b637SJeff Mahoney TP_PROTO(const struct __btrfs_workqueue *wq), 1498c3a46891SQu Wenruo 1499c3a46891SQu Wenruo TP_ARGS(wq), 1500c3a46891SQu Wenruo 1501bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15029a35b637SJeff Mahoney __field( const void *, wq ) 1503c3a46891SQu Wenruo ), 1504c3a46891SQu Wenruo 1505bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1506c3a46891SQu Wenruo __entry->wq = wq; 1507c3a46891SQu Wenruo ), 1508c3a46891SQu Wenruo 1509bc074524SJeff Mahoney TP_printk_btrfs("wq=%p", __entry->wq) 1510c3a46891SQu Wenruo ); 1511c3a46891SQu Wenruo 1512c3a46891SQu Wenruo DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy, 1513c3a46891SQu Wenruo 15149a35b637SJeff Mahoney TP_PROTO(const struct __btrfs_workqueue *wq), 1515c3a46891SQu Wenruo 1516c3a46891SQu Wenruo TP_ARGS(wq) 1517c3a46891SQu Wenruo ); 151852483bc2SQu Wenruo 151981fb6f77SQu Wenruo #define BTRFS_QGROUP_OPERATIONS \ 152081fb6f77SQu Wenruo { QGROUP_RESERVE, "reserve" }, \ 152181fb6f77SQu Wenruo { QGROUP_RELEASE, "release" }, \ 152281fb6f77SQu Wenruo { QGROUP_FREE, "free" } 152381fb6f77SQu Wenruo 152481fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, 152581fb6f77SQu Wenruo 15269a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 15279a35b637SJeff Mahoney u64 reserved, int op), 152881fb6f77SQu Wenruo 152981fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op), 153081fb6f77SQu Wenruo 1531bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 153281fb6f77SQu Wenruo __field( u64, rootid ) 1533f8f8e189SDavid Sterba __field( u64, ino ) 153481fb6f77SQu Wenruo __field( u64, start ) 153581fb6f77SQu Wenruo __field( u64, len ) 153681fb6f77SQu Wenruo __field( u64, reserved ) 153781fb6f77SQu Wenruo __field( int, op ) 153881fb6f77SQu Wenruo ), 153981fb6f77SQu Wenruo 1540bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 15414fd786e6SMisono Tomohiro __entry->rootid = 15424fd786e6SMisono Tomohiro BTRFS_I(inode)->root->root_key.objectid; 1543f8f8e189SDavid Sterba __entry->ino = btrfs_ino(BTRFS_I(inode)); 154481fb6f77SQu Wenruo __entry->start = start; 154581fb6f77SQu Wenruo __entry->len = len; 154681fb6f77SQu Wenruo __entry->reserved = reserved; 154781fb6f77SQu Wenruo __entry->op = op; 154881fb6f77SQu Wenruo ), 154981fb6f77SQu Wenruo 1550f8f8e189SDavid Sterba TP_printk_btrfs("root=%llu ino=%llu start=%llu len=%llu reserved=%llu op=%s", 155181fb6f77SQu Wenruo __entry->rootid, __entry->ino, __entry->start, __entry->len, 155281fb6f77SQu Wenruo __entry->reserved, 155381fb6f77SQu Wenruo __print_flags((unsigned long)__entry->op, "", 155481fb6f77SQu Wenruo BTRFS_QGROUP_OPERATIONS) 155581fb6f77SQu Wenruo ) 155681fb6f77SQu Wenruo ); 155781fb6f77SQu Wenruo 155881fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data, 155981fb6f77SQu Wenruo 15609a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 15619a35b637SJeff Mahoney u64 reserved, int op), 156281fb6f77SQu Wenruo 156381fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 156481fb6f77SQu Wenruo ); 156581fb6f77SQu Wenruo 156681fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data, 156781fb6f77SQu Wenruo 15689a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 15699a35b637SJeff Mahoney u64 reserved, int op), 157081fb6f77SQu Wenruo 157181fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 157281fb6f77SQu Wenruo ); 157381fb6f77SQu Wenruo 15740f5dcf8dSMark Fasheh DECLARE_EVENT_CLASS(btrfs_qgroup_extent, 15759a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 15769a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 15770f5dcf8dSMark Fasheh 1578bc074524SJeff Mahoney TP_ARGS(fs_info, rec), 15790f5dcf8dSMark Fasheh 1580bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15810f5dcf8dSMark Fasheh __field( u64, bytenr ) 15820f5dcf8dSMark Fasheh __field( u64, num_bytes ) 15830f5dcf8dSMark Fasheh ), 15840f5dcf8dSMark Fasheh 1585bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 15860f5dcf8dSMark Fasheh __entry->bytenr = rec->bytenr, 15870f5dcf8dSMark Fasheh __entry->num_bytes = rec->num_bytes; 15880f5dcf8dSMark Fasheh ), 15890f5dcf8dSMark Fasheh 1590562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu", 159194c3f6c6SDavid Sterba __entry->bytenr, __entry->num_bytes) 15920f5dcf8dSMark Fasheh ); 15930f5dcf8dSMark Fasheh 15940f5dcf8dSMark Fasheh DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, 15950f5dcf8dSMark Fasheh 15969a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 15979a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 15980f5dcf8dSMark Fasheh 1599bc074524SJeff Mahoney TP_ARGS(fs_info, rec) 16000f5dcf8dSMark Fasheh ); 16010f5dcf8dSMark Fasheh 160250b3e040SQu Wenruo DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent, 16030f5dcf8dSMark Fasheh 16049a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 16059a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 16060f5dcf8dSMark Fasheh 1607bc074524SJeff Mahoney TP_ARGS(fs_info, rec) 16080f5dcf8dSMark Fasheh ); 16090f5dcf8dSMark Fasheh 1610c337e7b0SQu Wenruo TRACE_EVENT(qgroup_num_dirty_extents, 1611c337e7b0SQu Wenruo 1612c337e7b0SQu Wenruo TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, 1613c337e7b0SQu Wenruo u64 num_dirty_extents), 1614c337e7b0SQu Wenruo 1615c337e7b0SQu Wenruo TP_ARGS(fs_info, transid, num_dirty_extents), 1616c337e7b0SQu Wenruo 1617c337e7b0SQu Wenruo TP_STRUCT__entry_btrfs( 1618c337e7b0SQu Wenruo __field( u64, transid ) 1619c337e7b0SQu Wenruo __field( u64, num_dirty_extents ) 1620c337e7b0SQu Wenruo ), 1621c337e7b0SQu Wenruo 1622c337e7b0SQu Wenruo TP_fast_assign_btrfs(fs_info, 1623c337e7b0SQu Wenruo __entry->transid = transid; 1624c337e7b0SQu Wenruo __entry->num_dirty_extents = num_dirty_extents; 1625c337e7b0SQu Wenruo ), 1626c337e7b0SQu Wenruo 1627c337e7b0SQu Wenruo TP_printk_btrfs("transid=%llu num_dirty_extents=%llu", 1628c337e7b0SQu Wenruo __entry->transid, __entry->num_dirty_extents) 1629c337e7b0SQu Wenruo ); 1630c337e7b0SQu Wenruo 16310f5dcf8dSMark Fasheh TRACE_EVENT(btrfs_qgroup_account_extent, 16320f5dcf8dSMark Fasheh 1633c9f6f3cdSQu Wenruo TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, u64 bytenr, 1634bc074524SJeff Mahoney u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), 16350f5dcf8dSMark Fasheh 1636c9f6f3cdSQu Wenruo TP_ARGS(fs_info, transid, bytenr, num_bytes, nr_old_roots, 1637c9f6f3cdSQu Wenruo nr_new_roots), 16380f5dcf8dSMark Fasheh 1639bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1640c9f6f3cdSQu Wenruo __field( u64, transid ) 16410f5dcf8dSMark Fasheh __field( u64, bytenr ) 16420f5dcf8dSMark Fasheh __field( u64, num_bytes ) 16430f5dcf8dSMark Fasheh __field( u64, nr_old_roots ) 16440f5dcf8dSMark Fasheh __field( u64, nr_new_roots ) 16450f5dcf8dSMark Fasheh ), 16460f5dcf8dSMark Fasheh 1647bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 1648c9f6f3cdSQu Wenruo __entry->transid = transid; 16490f5dcf8dSMark Fasheh __entry->bytenr = bytenr; 16500f5dcf8dSMark Fasheh __entry->num_bytes = num_bytes; 16510f5dcf8dSMark Fasheh __entry->nr_old_roots = nr_old_roots; 16520f5dcf8dSMark Fasheh __entry->nr_new_roots = nr_new_roots; 16530f5dcf8dSMark Fasheh ), 16540f5dcf8dSMark Fasheh 1655c9f6f3cdSQu Wenruo TP_printk_btrfs( 1656c9f6f3cdSQu Wenruo "transid=%llu bytenr=%llu num_bytes=%llu nr_old_roots=%llu nr_new_roots=%llu", 1657c9f6f3cdSQu Wenruo __entry->transid, 16580f5dcf8dSMark Fasheh __entry->bytenr, 16590f5dcf8dSMark Fasheh __entry->num_bytes, 16600f5dcf8dSMark Fasheh __entry->nr_old_roots, 16610f5dcf8dSMark Fasheh __entry->nr_new_roots) 16620f5dcf8dSMark Fasheh ); 16630f5dcf8dSMark Fasheh 16640f5dcf8dSMark Fasheh TRACE_EVENT(qgroup_update_counters, 16650f5dcf8dSMark Fasheh 16668b317901SQu Wenruo TP_PROTO(const struct btrfs_fs_info *fs_info, 16671d2e7c7cSDavid Sterba const struct btrfs_qgroup *qgroup, 1668bc074524SJeff Mahoney u64 cur_old_count, u64 cur_new_count), 16690f5dcf8dSMark Fasheh 16708b317901SQu Wenruo TP_ARGS(fs_info, qgroup, cur_old_count, cur_new_count), 16710f5dcf8dSMark Fasheh 1672bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 16730f5dcf8dSMark Fasheh __field( u64, qgid ) 16748b317901SQu Wenruo __field( u64, old_rfer ) 16758b317901SQu Wenruo __field( u64, old_excl ) 16760f5dcf8dSMark Fasheh __field( u64, cur_old_count ) 16770f5dcf8dSMark Fasheh __field( u64, cur_new_count ) 16780f5dcf8dSMark Fasheh ), 16790f5dcf8dSMark Fasheh 1680bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 16818b317901SQu Wenruo __entry->qgid = qgroup->qgroupid; 16828b317901SQu Wenruo __entry->old_rfer = qgroup->rfer; 16838b317901SQu Wenruo __entry->old_excl = qgroup->excl; 16840f5dcf8dSMark Fasheh __entry->cur_old_count = cur_old_count; 16850f5dcf8dSMark Fasheh __entry->cur_new_count = cur_new_count; 16860f5dcf8dSMark Fasheh ), 16870f5dcf8dSMark Fasheh 16888b317901SQu Wenruo TP_printk_btrfs("qgid=%llu old_rfer=%llu old_excl=%llu cur_old_count=%llu cur_new_count=%llu", 16898b317901SQu Wenruo __entry->qgid, __entry->old_rfer, __entry->old_excl, 16908b317901SQu Wenruo __entry->cur_old_count, __entry->cur_new_count) 16910f5dcf8dSMark Fasheh ); 16920f5dcf8dSMark Fasheh 16933159fe7bSQu Wenruo TRACE_EVENT(qgroup_update_reserve, 16943159fe7bSQu Wenruo 16953159fe7bSQu Wenruo TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup, 169664ee4e75SQu Wenruo s64 diff, int type), 16973159fe7bSQu Wenruo 169864ee4e75SQu Wenruo TP_ARGS(fs_info, qgroup, diff, type), 16993159fe7bSQu Wenruo 17003159fe7bSQu Wenruo TP_STRUCT__entry_btrfs( 17013159fe7bSQu Wenruo __field( u64, qgid ) 17023159fe7bSQu Wenruo __field( u64, cur_reserved ) 17033159fe7bSQu Wenruo __field( s64, diff ) 170464ee4e75SQu Wenruo __field( int, type ) 17053159fe7bSQu Wenruo ), 17063159fe7bSQu Wenruo 17073159fe7bSQu Wenruo TP_fast_assign_btrfs(fs_info, 17083159fe7bSQu Wenruo __entry->qgid = qgroup->qgroupid; 170964ee4e75SQu Wenruo __entry->cur_reserved = qgroup->rsv.values[type]; 17103159fe7bSQu Wenruo __entry->diff = diff; 17111b2442b4SQu Wenruo __entry->type = type; 17123159fe7bSQu Wenruo ), 17133159fe7bSQu Wenruo 171464ee4e75SQu Wenruo TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld", 17151cb1f0b2SNikolay Borisov __entry->qgid, __print_symbolic(__entry->type, QGROUP_RSV_TYPES), 171664ee4e75SQu Wenruo __entry->cur_reserved, __entry->diff) 17173159fe7bSQu Wenruo ); 17183159fe7bSQu Wenruo 17193159fe7bSQu Wenruo TRACE_EVENT(qgroup_meta_reserve, 17203159fe7bSQu Wenruo 17214ee0d883SQu Wenruo TP_PROTO(struct btrfs_root *root, s64 diff, int type), 17223159fe7bSQu Wenruo 17234ee0d883SQu Wenruo TP_ARGS(root, diff, type), 17243159fe7bSQu Wenruo 17253159fe7bSQu Wenruo TP_STRUCT__entry_btrfs( 17263159fe7bSQu Wenruo __field( u64, refroot ) 17273159fe7bSQu Wenruo __field( s64, diff ) 17284ee0d883SQu Wenruo __field( int, type ) 17293159fe7bSQu Wenruo ), 17303159fe7bSQu Wenruo 17313159fe7bSQu Wenruo TP_fast_assign_btrfs(root->fs_info, 17324fd786e6SMisono Tomohiro __entry->refroot = root->root_key.objectid; 17333159fe7bSQu Wenruo __entry->diff = diff; 17341b2442b4SQu Wenruo __entry->type = type; 17353159fe7bSQu Wenruo ), 17363159fe7bSQu Wenruo 17374ee0d883SQu Wenruo TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", 17384ee0d883SQu Wenruo show_root_type(__entry->refroot), 17391cb1f0b2SNikolay Borisov __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) 17404ee0d883SQu Wenruo ); 17414ee0d883SQu Wenruo 17424ee0d883SQu Wenruo TRACE_EVENT(qgroup_meta_convert, 17434ee0d883SQu Wenruo 17444ee0d883SQu Wenruo TP_PROTO(struct btrfs_root *root, s64 diff), 17454ee0d883SQu Wenruo 17464ee0d883SQu Wenruo TP_ARGS(root, diff), 17474ee0d883SQu Wenruo 17484ee0d883SQu Wenruo TP_STRUCT__entry_btrfs( 17494ee0d883SQu Wenruo __field( u64, refroot ) 17504ee0d883SQu Wenruo __field( s64, diff ) 17514ee0d883SQu Wenruo ), 17524ee0d883SQu Wenruo 17534ee0d883SQu Wenruo TP_fast_assign_btrfs(root->fs_info, 17544fd786e6SMisono Tomohiro __entry->refroot = root->root_key.objectid; 17554ee0d883SQu Wenruo __entry->diff = diff; 17564ee0d883SQu Wenruo ), 17574ee0d883SQu Wenruo 17584ee0d883SQu Wenruo TP_printk_btrfs("refroot=%llu(%s) type=%s->%s diff=%lld", 17594ee0d883SQu Wenruo show_root_type(__entry->refroot), 17601cb1f0b2SNikolay Borisov __print_symbolic(BTRFS_QGROUP_RSV_META_PREALLOC, QGROUP_RSV_TYPES), 17611cb1f0b2SNikolay Borisov __print_symbolic(BTRFS_QGROUP_RSV_META_PERTRANS, QGROUP_RSV_TYPES), 17624ee0d883SQu Wenruo __entry->diff) 17634ee0d883SQu Wenruo ); 17644ee0d883SQu Wenruo 17654ee0d883SQu Wenruo TRACE_EVENT(qgroup_meta_free_all_pertrans, 17664ee0d883SQu Wenruo 17674ee0d883SQu Wenruo TP_PROTO(struct btrfs_root *root), 17684ee0d883SQu Wenruo 17694ee0d883SQu Wenruo TP_ARGS(root), 17704ee0d883SQu Wenruo 17714ee0d883SQu Wenruo TP_STRUCT__entry_btrfs( 17724ee0d883SQu Wenruo __field( u64, refroot ) 17734ee0d883SQu Wenruo __field( s64, diff ) 17744ee0d883SQu Wenruo __field( int, type ) 17754ee0d883SQu Wenruo ), 17764ee0d883SQu Wenruo 17774ee0d883SQu Wenruo TP_fast_assign_btrfs(root->fs_info, 17784fd786e6SMisono Tomohiro __entry->refroot = root->root_key.objectid; 17794ee0d883SQu Wenruo spin_lock(&root->qgroup_meta_rsv_lock); 17804ee0d883SQu Wenruo __entry->diff = -(s64)root->qgroup_meta_rsv_pertrans; 17814ee0d883SQu Wenruo spin_unlock(&root->qgroup_meta_rsv_lock); 17824ee0d883SQu Wenruo __entry->type = BTRFS_QGROUP_RSV_META_PERTRANS; 17834ee0d883SQu Wenruo ), 17844ee0d883SQu Wenruo 17854ee0d883SQu Wenruo TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", 17864ee0d883SQu Wenruo show_root_type(__entry->refroot), 17871cb1f0b2SNikolay Borisov __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) 17883159fe7bSQu Wenruo ); 17893159fe7bSQu Wenruo 179000142756SJeff Mahoney DECLARE_EVENT_CLASS(btrfs__prelim_ref, 179100142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 179200142756SJeff Mahoney const struct prelim_ref *oldref, 179300142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 179400142756SJeff Mahoney TP_ARGS(fs_info, newref, oldref, tree_size), 179500142756SJeff Mahoney 179600142756SJeff Mahoney TP_STRUCT__entry_btrfs( 179700142756SJeff Mahoney __field( u64, root_id ) 179800142756SJeff Mahoney __field( u64, objectid ) 179900142756SJeff Mahoney __field( u8, type ) 180000142756SJeff Mahoney __field( u64, offset ) 180100142756SJeff Mahoney __field( int, level ) 180200142756SJeff Mahoney __field( int, old_count ) 180300142756SJeff Mahoney __field( u64, parent ) 180400142756SJeff Mahoney __field( u64, bytenr ) 180500142756SJeff Mahoney __field( int, mod_count ) 180600142756SJeff Mahoney __field( u64, tree_size ) 180700142756SJeff Mahoney ), 180800142756SJeff Mahoney 180900142756SJeff Mahoney TP_fast_assign_btrfs(fs_info, 181000142756SJeff Mahoney __entry->root_id = oldref->root_id; 181100142756SJeff Mahoney __entry->objectid = oldref->key_for_search.objectid; 181200142756SJeff Mahoney __entry->type = oldref->key_for_search.type; 181300142756SJeff Mahoney __entry->offset = oldref->key_for_search.offset; 181400142756SJeff Mahoney __entry->level = oldref->level; 181500142756SJeff Mahoney __entry->old_count = oldref->count; 181600142756SJeff Mahoney __entry->parent = oldref->parent; 181700142756SJeff Mahoney __entry->bytenr = oldref->wanted_disk_byte; 181800142756SJeff Mahoney __entry->mod_count = newref ? newref->count : 0; 181900142756SJeff Mahoney __entry->tree_size = tree_size; 182000142756SJeff Mahoney ), 182100142756SJeff Mahoney 182200142756SJeff 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", 18238eec8463SDavid Sterba __entry->root_id, 18248eec8463SDavid Sterba __entry->objectid, __entry->type, 18258eec8463SDavid Sterba __entry->offset, __entry->level, 182600142756SJeff Mahoney __entry->old_count, __entry->mod_count, 182700142756SJeff Mahoney __entry->old_count + __entry->mod_count, 18288eec8463SDavid Sterba __entry->parent, 18298eec8463SDavid Sterba __entry->bytenr, 18308eec8463SDavid Sterba __entry->tree_size) 183100142756SJeff Mahoney ); 183200142756SJeff Mahoney 183300142756SJeff Mahoney DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge, 183400142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 183500142756SJeff Mahoney const struct prelim_ref *oldref, 183600142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 183700142756SJeff Mahoney TP_ARGS(fs_info, oldref, newref, tree_size) 183800142756SJeff Mahoney ); 183900142756SJeff Mahoney 184000142756SJeff Mahoney DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert, 184100142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 184200142756SJeff Mahoney const struct prelim_ref *oldref, 184300142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 184400142756SJeff Mahoney TP_ARGS(fs_info, oldref, newref, tree_size) 184500142756SJeff Mahoney ); 184600142756SJeff Mahoney 1847dd48d407SJosef Bacik TRACE_EVENT(btrfs_inode_mod_outstanding_extents, 18481d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_root *root, u64 ino, int mod), 1849dd48d407SJosef Bacik 1850dd48d407SJosef Bacik TP_ARGS(root, ino, mod), 1851dd48d407SJosef Bacik 1852dd48d407SJosef Bacik TP_STRUCT__entry_btrfs( 1853dd48d407SJosef Bacik __field( u64, root_objectid ) 1854dd48d407SJosef Bacik __field( u64, ino ) 1855dd48d407SJosef Bacik __field( int, mod ) 1856dd48d407SJosef Bacik ), 1857dd48d407SJosef Bacik 1858dd48d407SJosef Bacik TP_fast_assign_btrfs(root->fs_info, 18594fd786e6SMisono Tomohiro __entry->root_objectid = root->root_key.objectid; 1860dd48d407SJosef Bacik __entry->ino = ino; 1861dd48d407SJosef Bacik __entry->mod = mod; 1862dd48d407SJosef Bacik ), 1863dd48d407SJosef Bacik 1864dd48d407SJosef Bacik TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d", 1865dd48d407SJosef Bacik show_root_type(__entry->root_objectid), 18668eec8463SDavid Sterba __entry->ino, __entry->mod) 1867dd48d407SJosef Bacik ); 18683dca5c94SQu Wenruo 18694ed0a7a3SQu Wenruo DECLARE_EVENT_CLASS(btrfs__block_group, 187032da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 18714ed0a7a3SQu Wenruo 18724ed0a7a3SQu Wenruo TP_ARGS(bg_cache), 18734ed0a7a3SQu Wenruo 18744ed0a7a3SQu Wenruo TP_STRUCT__entry_btrfs( 18754ed0a7a3SQu Wenruo __field( u64, bytenr ) 18764ed0a7a3SQu Wenruo __field( u64, len ) 18774ed0a7a3SQu Wenruo __field( u64, used ) 18784ed0a7a3SQu Wenruo __field( u64, flags ) 18794ed0a7a3SQu Wenruo ), 18804ed0a7a3SQu Wenruo 18814ed0a7a3SQu Wenruo TP_fast_assign_btrfs(bg_cache->fs_info, 1882b3470b5dSDavid Sterba __entry->bytenr = bg_cache->start, 1883b3470b5dSDavid Sterba __entry->len = bg_cache->length, 1884bf38be65SDavid Sterba __entry->used = bg_cache->used; 18854ed0a7a3SQu Wenruo __entry->flags = bg_cache->flags; 18864ed0a7a3SQu Wenruo ), 18874ed0a7a3SQu Wenruo 18884ed0a7a3SQu Wenruo TP_printk_btrfs("bg bytenr=%llu len=%llu used=%llu flags=%llu(%s)", 18894ed0a7a3SQu Wenruo __entry->bytenr, __entry->len, __entry->used, __entry->flags, 18904ed0a7a3SQu Wenruo __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS)) 18914ed0a7a3SQu Wenruo ); 18924ed0a7a3SQu Wenruo 18934ed0a7a3SQu Wenruo DEFINE_EVENT(btrfs__block_group, btrfs_remove_block_group, 189432da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 18954ed0a7a3SQu Wenruo 18964ed0a7a3SQu Wenruo TP_ARGS(bg_cache) 18974ed0a7a3SQu Wenruo ); 18984ed0a7a3SQu Wenruo 18994ed0a7a3SQu Wenruo DEFINE_EVENT(btrfs__block_group, btrfs_add_unused_block_group, 190032da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 19014ed0a7a3SQu Wenruo 19024ed0a7a3SQu Wenruo TP_ARGS(bg_cache) 19034ed0a7a3SQu Wenruo ); 19044ed0a7a3SQu Wenruo 19054ed0a7a3SQu Wenruo DEFINE_EVENT(btrfs__block_group, btrfs_skip_unused_block_group, 190632da5386SDavid Sterba TP_PROTO(const struct btrfs_block_group *bg_cache), 19074ed0a7a3SQu Wenruo 19084ed0a7a3SQu Wenruo TP_ARGS(bg_cache) 19094ed0a7a3SQu Wenruo ); 19104ed0a7a3SQu Wenruo 1911a1d19847SQu Wenruo TRACE_EVENT(btrfs_set_extent_bit, 1912a1d19847SQu Wenruo TP_PROTO(const struct extent_io_tree *tree, 1913a1d19847SQu Wenruo u64 start, u64 len, unsigned set_bits), 1914a1d19847SQu Wenruo 1915a1d19847SQu Wenruo TP_ARGS(tree, start, len, set_bits), 1916a1d19847SQu Wenruo 1917a1d19847SQu Wenruo TP_STRUCT__entry_btrfs( 1918a1d19847SQu Wenruo __field( unsigned, owner ) 1919a1d19847SQu Wenruo __field( u64, ino ) 1920a1d19847SQu Wenruo __field( u64, rootid ) 1921a1d19847SQu Wenruo __field( u64, start ) 1922a1d19847SQu Wenruo __field( u64, len ) 1923a1d19847SQu Wenruo __field( unsigned, set_bits) 1924a1d19847SQu Wenruo ), 1925a1d19847SQu Wenruo 1926a1d19847SQu Wenruo TP_fast_assign_btrfs(tree->fs_info, 1927a1d19847SQu Wenruo __entry->owner = tree->owner; 1928a1d19847SQu Wenruo if (tree->private_data) { 19291d2e7c7cSDavid Sterba const struct inode *inode = tree->private_data; 1930a1d19847SQu Wenruo 1931a1d19847SQu Wenruo __entry->ino = btrfs_ino(BTRFS_I(inode)); 1932a1d19847SQu Wenruo __entry->rootid = 1933a1d19847SQu Wenruo BTRFS_I(inode)->root->root_key.objectid; 1934a1d19847SQu Wenruo } else { 1935a1d19847SQu Wenruo __entry->ino = 0; 1936a1d19847SQu Wenruo __entry->rootid = 0; 1937a1d19847SQu Wenruo } 1938a1d19847SQu Wenruo __entry->start = start; 1939a1d19847SQu Wenruo __entry->len = len; 1940a1d19847SQu Wenruo __entry->set_bits = set_bits; 1941a1d19847SQu Wenruo ), 1942a1d19847SQu Wenruo 1943a1d19847SQu Wenruo TP_printk_btrfs( 1944a1d19847SQu Wenruo "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s", 1945a1d19847SQu Wenruo show_extent_io_tree_owner(__entry->owner), __entry->ino, 1946a1d19847SQu Wenruo __entry->rootid, __entry->start, __entry->len, 1947a1d19847SQu Wenruo __print_flags(__entry->set_bits, "|", EXTENT_FLAGS)) 1948a1d19847SQu Wenruo ); 1949a1d19847SQu Wenruo 1950a1d19847SQu Wenruo TRACE_EVENT(btrfs_clear_extent_bit, 1951a1d19847SQu Wenruo TP_PROTO(const struct extent_io_tree *tree, 1952a1d19847SQu Wenruo u64 start, u64 len, unsigned clear_bits), 1953a1d19847SQu Wenruo 1954a1d19847SQu Wenruo TP_ARGS(tree, start, len, clear_bits), 1955a1d19847SQu Wenruo 1956a1d19847SQu Wenruo TP_STRUCT__entry_btrfs( 1957a1d19847SQu Wenruo __field( unsigned, owner ) 1958a1d19847SQu Wenruo __field( u64, ino ) 1959a1d19847SQu Wenruo __field( u64, rootid ) 1960a1d19847SQu Wenruo __field( u64, start ) 1961a1d19847SQu Wenruo __field( u64, len ) 1962a1d19847SQu Wenruo __field( unsigned, clear_bits) 1963a1d19847SQu Wenruo ), 1964a1d19847SQu Wenruo 1965a1d19847SQu Wenruo TP_fast_assign_btrfs(tree->fs_info, 1966a1d19847SQu Wenruo __entry->owner = tree->owner; 1967a1d19847SQu Wenruo if (tree->private_data) { 19681d2e7c7cSDavid Sterba const struct inode *inode = tree->private_data; 1969a1d19847SQu Wenruo 1970a1d19847SQu Wenruo __entry->ino = btrfs_ino(BTRFS_I(inode)); 1971a1d19847SQu Wenruo __entry->rootid = 1972a1d19847SQu Wenruo BTRFS_I(inode)->root->root_key.objectid; 1973a1d19847SQu Wenruo } else { 1974a1d19847SQu Wenruo __entry->ino = 0; 1975a1d19847SQu Wenruo __entry->rootid = 0; 1976a1d19847SQu Wenruo } 1977a1d19847SQu Wenruo __entry->start = start; 1978a1d19847SQu Wenruo __entry->len = len; 1979a1d19847SQu Wenruo __entry->clear_bits = clear_bits; 1980a1d19847SQu Wenruo ), 1981a1d19847SQu Wenruo 1982a1d19847SQu Wenruo TP_printk_btrfs( 1983a1d19847SQu Wenruo "io_tree=%s ino=%llu root=%llu start=%llu len=%llu clear_bits=%s", 1984a1d19847SQu Wenruo show_extent_io_tree_owner(__entry->owner), __entry->ino, 1985a1d19847SQu Wenruo __entry->rootid, __entry->start, __entry->len, 1986a1d19847SQu Wenruo __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS)) 1987a1d19847SQu Wenruo ); 1988a1d19847SQu Wenruo 1989a1d19847SQu Wenruo TRACE_EVENT(btrfs_convert_extent_bit, 1990a1d19847SQu Wenruo TP_PROTO(const struct extent_io_tree *tree, 1991a1d19847SQu Wenruo u64 start, u64 len, unsigned set_bits, unsigned clear_bits), 1992a1d19847SQu Wenruo 1993a1d19847SQu Wenruo TP_ARGS(tree, start, len, set_bits, clear_bits), 1994a1d19847SQu Wenruo 1995a1d19847SQu Wenruo TP_STRUCT__entry_btrfs( 1996a1d19847SQu Wenruo __field( unsigned, owner ) 1997a1d19847SQu Wenruo __field( u64, ino ) 1998a1d19847SQu Wenruo __field( u64, rootid ) 1999a1d19847SQu Wenruo __field( u64, start ) 2000a1d19847SQu Wenruo __field( u64, len ) 2001a1d19847SQu Wenruo __field( unsigned, set_bits) 2002a1d19847SQu Wenruo __field( unsigned, clear_bits) 2003a1d19847SQu Wenruo ), 2004a1d19847SQu Wenruo 2005a1d19847SQu Wenruo TP_fast_assign_btrfs(tree->fs_info, 2006a1d19847SQu Wenruo __entry->owner = tree->owner; 2007a1d19847SQu Wenruo if (tree->private_data) { 20081d2e7c7cSDavid Sterba const struct inode *inode = tree->private_data; 2009a1d19847SQu Wenruo 2010a1d19847SQu Wenruo __entry->ino = btrfs_ino(BTRFS_I(inode)); 2011a1d19847SQu Wenruo __entry->rootid = 2012a1d19847SQu Wenruo BTRFS_I(inode)->root->root_key.objectid; 2013a1d19847SQu Wenruo } else { 2014a1d19847SQu Wenruo __entry->ino = 0; 2015a1d19847SQu Wenruo __entry->rootid = 0; 2016a1d19847SQu Wenruo } 2017a1d19847SQu Wenruo __entry->start = start; 2018a1d19847SQu Wenruo __entry->len = len; 2019a1d19847SQu Wenruo __entry->set_bits = set_bits; 2020a1d19847SQu Wenruo __entry->clear_bits = clear_bits; 2021a1d19847SQu Wenruo ), 2022a1d19847SQu Wenruo 2023a1d19847SQu Wenruo TP_printk_btrfs( 2024a1d19847SQu Wenruo "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s clear_bits=%s", 2025a1d19847SQu Wenruo show_extent_io_tree_owner(__entry->owner), __entry->ino, 2026a1d19847SQu Wenruo __entry->rootid, __entry->start, __entry->len, 2027a1d19847SQu Wenruo __print_flags(__entry->set_bits , "|", EXTENT_FLAGS), 2028a1d19847SQu Wenruo __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS)) 2029a1d19847SQu Wenruo ); 2030a1d19847SQu Wenruo 203134e73cc9SQu Wenruo DECLARE_EVENT_CLASS(btrfs_sleep_tree_lock, 203234e73cc9SQu Wenruo TP_PROTO(const struct extent_buffer *eb, u64 start_ns), 203334e73cc9SQu Wenruo 203434e73cc9SQu Wenruo TP_ARGS(eb, start_ns), 203534e73cc9SQu Wenruo 203634e73cc9SQu Wenruo TP_STRUCT__entry_btrfs( 203734e73cc9SQu Wenruo __field( u64, block ) 203834e73cc9SQu Wenruo __field( u64, generation ) 203934e73cc9SQu Wenruo __field( u64, start_ns ) 204034e73cc9SQu Wenruo __field( u64, end_ns ) 204134e73cc9SQu Wenruo __field( u64, diff_ns ) 204234e73cc9SQu Wenruo __field( u64, owner ) 204334e73cc9SQu Wenruo __field( int, is_log_tree ) 204434e73cc9SQu Wenruo ), 204534e73cc9SQu Wenruo 204634e73cc9SQu Wenruo TP_fast_assign_btrfs(eb->fs_info, 204734e73cc9SQu Wenruo __entry->block = eb->start; 204834e73cc9SQu Wenruo __entry->generation = btrfs_header_generation(eb); 204934e73cc9SQu Wenruo __entry->start_ns = start_ns; 205034e73cc9SQu Wenruo __entry->end_ns = ktime_get_ns(); 205134e73cc9SQu Wenruo __entry->diff_ns = __entry->end_ns - start_ns; 205234e73cc9SQu Wenruo __entry->owner = btrfs_header_owner(eb); 205334e73cc9SQu Wenruo __entry->is_log_tree = (eb->log_index >= 0); 205434e73cc9SQu Wenruo ), 205534e73cc9SQu Wenruo 205634e73cc9SQu Wenruo TP_printk_btrfs( 205734e73cc9SQu Wenruo "block=%llu generation=%llu start_ns=%llu end_ns=%llu diff_ns=%llu owner=%llu is_log_tree=%d", 205834e73cc9SQu Wenruo __entry->block, __entry->generation, 205934e73cc9SQu Wenruo __entry->start_ns, __entry->end_ns, __entry->diff_ns, 206034e73cc9SQu Wenruo __entry->owner, __entry->is_log_tree) 206134e73cc9SQu Wenruo ); 206234e73cc9SQu Wenruo 206334e73cc9SQu Wenruo DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_read_lock, 206434e73cc9SQu Wenruo TP_PROTO(const struct extent_buffer *eb, u64 start_ns), 206534e73cc9SQu Wenruo 206634e73cc9SQu Wenruo TP_ARGS(eb, start_ns) 206734e73cc9SQu Wenruo ); 206834e73cc9SQu Wenruo 206934e73cc9SQu Wenruo DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_lock, 207034e73cc9SQu Wenruo TP_PROTO(const struct extent_buffer *eb, u64 start_ns), 207134e73cc9SQu Wenruo 207234e73cc9SQu Wenruo TP_ARGS(eb, start_ns) 207334e73cc9SQu Wenruo ); 207434e73cc9SQu Wenruo 207531aab402SQu Wenruo DECLARE_EVENT_CLASS(btrfs_locking_events, 207631aab402SQu Wenruo TP_PROTO(const struct extent_buffer *eb), 207731aab402SQu Wenruo 207831aab402SQu Wenruo TP_ARGS(eb), 207931aab402SQu Wenruo 208031aab402SQu Wenruo TP_STRUCT__entry_btrfs( 208131aab402SQu Wenruo __field( u64, block ) 208231aab402SQu Wenruo __field( u64, generation ) 208331aab402SQu Wenruo __field( u64, owner ) 208431aab402SQu Wenruo __field( int, is_log_tree ) 208531aab402SQu Wenruo ), 208631aab402SQu Wenruo 208731aab402SQu Wenruo TP_fast_assign_btrfs(eb->fs_info, 208831aab402SQu Wenruo __entry->block = eb->start; 208931aab402SQu Wenruo __entry->generation = btrfs_header_generation(eb); 209031aab402SQu Wenruo __entry->owner = btrfs_header_owner(eb); 209131aab402SQu Wenruo __entry->is_log_tree = (eb->log_index >= 0); 209231aab402SQu Wenruo ), 209331aab402SQu Wenruo 209431aab402SQu Wenruo TP_printk_btrfs("block=%llu generation=%llu owner=%llu is_log_tree=%d", 209531aab402SQu Wenruo __entry->block, __entry->generation, 209631aab402SQu Wenruo __entry->owner, __entry->is_log_tree) 209731aab402SQu Wenruo ); 209831aab402SQu Wenruo 209931aab402SQu Wenruo #define DEFINE_BTRFS_LOCK_EVENT(name) \ 210031aab402SQu Wenruo DEFINE_EVENT(btrfs_locking_events, name, \ 210131aab402SQu Wenruo TP_PROTO(const struct extent_buffer *eb), \ 210231aab402SQu Wenruo \ 210331aab402SQu Wenruo TP_ARGS(eb) \ 210431aab402SQu Wenruo ) 210531aab402SQu Wenruo 210631aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_unlock); 210731aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock); 210831aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock_blocking); 210931aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_read); 211031aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_write); 211131aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock); 211231aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock); 211331aab402SQu Wenruo DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic); 211431aab402SQu Wenruo 2115480b9b4dSQu Wenruo DECLARE_EVENT_CLASS(btrfs__space_info_update, 2116480b9b4dSQu Wenruo 21171d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 21181d2e7c7cSDavid Sterba const struct btrfs_space_info *sinfo, u64 old, s64 diff), 2119480b9b4dSQu Wenruo 2120480b9b4dSQu Wenruo TP_ARGS(fs_info, sinfo, old, diff), 2121480b9b4dSQu Wenruo 2122480b9b4dSQu Wenruo TP_STRUCT__entry_btrfs( 2123480b9b4dSQu Wenruo __field( u64, type ) 2124480b9b4dSQu Wenruo __field( u64, old ) 2125480b9b4dSQu Wenruo __field( s64, diff ) 2126480b9b4dSQu Wenruo ), 2127480b9b4dSQu Wenruo 2128480b9b4dSQu Wenruo TP_fast_assign_btrfs(fs_info, 2129480b9b4dSQu Wenruo __entry->type = sinfo->flags; 2130480b9b4dSQu Wenruo __entry->old = old; 2131480b9b4dSQu Wenruo __entry->diff = diff; 2132480b9b4dSQu Wenruo ), 2133480b9b4dSQu Wenruo TP_printk_btrfs("type=%s old=%llu diff=%lld", 2134480b9b4dSQu Wenruo __print_flags(__entry->type, "|", BTRFS_GROUP_FLAGS), 2135480b9b4dSQu Wenruo __entry->old, __entry->diff) 2136480b9b4dSQu Wenruo ); 2137480b9b4dSQu Wenruo 2138480b9b4dSQu Wenruo DEFINE_EVENT(btrfs__space_info_update, update_bytes_may_use, 2139480b9b4dSQu Wenruo 21401d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 21411d2e7c7cSDavid Sterba const struct btrfs_space_info *sinfo, u64 old, s64 diff), 2142480b9b4dSQu Wenruo 2143480b9b4dSQu Wenruo TP_ARGS(fs_info, sinfo, old, diff) 2144480b9b4dSQu Wenruo ); 2145480b9b4dSQu Wenruo 2146480b9b4dSQu Wenruo DEFINE_EVENT(btrfs__space_info_update, update_bytes_pinned, 2147480b9b4dSQu Wenruo 21481d2e7c7cSDavid Sterba TP_PROTO(const struct btrfs_fs_info *fs_info, 21491d2e7c7cSDavid Sterba const struct btrfs_space_info *sinfo, u64 old, s64 diff), 2150480b9b4dSQu Wenruo 2151480b9b4dSQu Wenruo TP_ARGS(fs_info, sinfo, old, diff) 2152480b9b4dSQu Wenruo ); 2153480b9b4dSQu Wenruo 21541abe9b8aSliubo #endif /* _TRACE_BTRFS_H */ 21551abe9b8aSliubo 21561abe9b8aSliubo /* This part must be outside protection */ 21571abe9b8aSliubo #include <trace/define_trace.h> 2158