11abe9b8aSliubo #undef TRACE_SYSTEM 21abe9b8aSliubo #define TRACE_SYSTEM btrfs 31abe9b8aSliubo 41abe9b8aSliubo #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ) 51abe9b8aSliubo #define _TRACE_BTRFS_H 61abe9b8aSliubo 71abe9b8aSliubo #include <linux/writeback.h> 81abe9b8aSliubo #include <linux/tracepoint.h> 9420adbe9SVlastimil Babka #include <trace/events/mmflags.h> 101abe9b8aSliubo 111abe9b8aSliubo struct btrfs_root; 121abe9b8aSliubo struct btrfs_fs_info; 131abe9b8aSliubo struct btrfs_inode; 141abe9b8aSliubo struct extent_map; 1509ed2f16SLiu Bo struct btrfs_file_extent_item; 161abe9b8aSliubo struct btrfs_ordered_extent; 171abe9b8aSliubo struct btrfs_delayed_ref_node; 181abe9b8aSliubo struct btrfs_delayed_tree_ref; 191abe9b8aSliubo struct btrfs_delayed_data_ref; 201abe9b8aSliubo struct btrfs_delayed_ref_head; 213f7de037SJosef Bacik struct btrfs_block_group_cache; 223f7de037SJosef Bacik struct btrfs_free_cluster; 231abe9b8aSliubo struct map_lookup; 241abe9b8aSliubo struct extent_buffer; 2552483bc2SQu Wenruo struct btrfs_work; 26c3a46891SQu Wenruo struct __btrfs_workqueue; 270f5dcf8dSMark Fasheh struct btrfs_qgroup_extent_record; 283159fe7bSQu Wenruo struct btrfs_qgroup; 291abe9b8aSliubo 301abe9b8aSliubo #define show_ref_type(type) \ 311abe9b8aSliubo __print_symbolic(type, \ 321abe9b8aSliubo { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ 331abe9b8aSliubo { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ 341abe9b8aSliubo { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ 351abe9b8aSliubo { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ 361abe9b8aSliubo { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) 371abe9b8aSliubo 381abe9b8aSliubo #define __show_root_type(obj) \ 397f34b746Sliubo __print_symbolic_u64(obj, \ 401abe9b8aSliubo { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ 411abe9b8aSliubo { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ 421abe9b8aSliubo { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ 431abe9b8aSliubo { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ 441abe9b8aSliubo { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ 451abe9b8aSliubo { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ 461abe9b8aSliubo { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ 471abe9b8aSliubo { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ 48e112e2b4SLiu Bo { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ 491abe9b8aSliubo { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ 50208acb8cSOmar Sandoval { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \ 51208acb8cSOmar Sandoval { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \ 521abe9b8aSliubo { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) 531abe9b8aSliubo 541abe9b8aSliubo #define show_root_type(obj) \ 551abe9b8aSliubo obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ 56fb57dc81SLiu Bo (obj >= BTRFS_ROOT_TREE_OBJECTID && \ 57e112e2b4SLiu Bo obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" 581abe9b8aSliubo 5909ed2f16SLiu Bo #define show_fi_type(type) \ 6009ed2f16SLiu Bo __print_symbolic(type, \ 6109ed2f16SLiu Bo { BTRFS_FILE_EXTENT_INLINE, "INLINE" }, \ 6209ed2f16SLiu Bo { BTRFS_FILE_EXTENT_REG, "REG" }, \ 6309ed2f16SLiu Bo { BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC"}) 6409ed2f16SLiu Bo 653f7de037SJosef Bacik #define BTRFS_GROUP_FLAGS \ 663f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ 673f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 683f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 693f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ 703f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ 713f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ 72e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 73e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ 74e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} 753f7de037SJosef Bacik 768c2a3ca2SJosef Bacik #define BTRFS_UUID_SIZE 16 77bc074524SJeff Mahoney #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_UUID_SIZE) 78bc074524SJeff Mahoney 79bc074524SJeff Mahoney #define TP_fast_assign_fsid(fs_info) \ 80bc074524SJeff Mahoney memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE) 81bc074524SJeff Mahoney 82bc074524SJeff Mahoney #define TP_STRUCT__entry_btrfs(args...) \ 83bc074524SJeff Mahoney TP_STRUCT__entry( \ 84bc074524SJeff Mahoney TP_STRUCT__entry_fsid \ 85bc074524SJeff Mahoney args) 86bc074524SJeff Mahoney #define TP_fast_assign_btrfs(fs_info, args...) \ 87bc074524SJeff Mahoney TP_fast_assign( \ 88bc074524SJeff Mahoney TP_fast_assign_fsid(fs_info); \ 89bc074524SJeff Mahoney args) 90bc074524SJeff Mahoney #define TP_printk_btrfs(fmt, args...) \ 91bc074524SJeff Mahoney TP_printk("%pU: " fmt, __entry->fsid, args) 928c2a3ca2SJosef Bacik 931abe9b8aSliubo TRACE_EVENT(btrfs_transaction_commit, 941abe9b8aSliubo 959a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root), 961abe9b8aSliubo 971abe9b8aSliubo TP_ARGS(root), 981abe9b8aSliubo 99bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1001abe9b8aSliubo __field( u64, generation ) 1011abe9b8aSliubo __field( u64, root_objectid ) 1021abe9b8aSliubo ), 1031abe9b8aSliubo 104bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 1051abe9b8aSliubo __entry->generation = root->fs_info->generation; 1061abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 1071abe9b8aSliubo ), 1081abe9b8aSliubo 109bc074524SJeff Mahoney TP_printk_btrfs("root = %llu(%s), gen = %llu", 1101abe9b8aSliubo show_root_type(__entry->root_objectid), 1111abe9b8aSliubo (unsigned long long)__entry->generation) 1121abe9b8aSliubo ); 1131abe9b8aSliubo 1141abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__inode, 1151abe9b8aSliubo 1169a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 1171abe9b8aSliubo 1181abe9b8aSliubo TP_ARGS(inode), 1191abe9b8aSliubo 120bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1211abe9b8aSliubo __field( ino_t, ino ) 1221abe9b8aSliubo __field( blkcnt_t, blocks ) 1231abe9b8aSliubo __field( u64, disk_i_size ) 1241abe9b8aSliubo __field( u64, generation ) 1251abe9b8aSliubo __field( u64, last_trans ) 1261abe9b8aSliubo __field( u64, logged_trans ) 1271abe9b8aSliubo __field( u64, root_objectid ) 1281abe9b8aSliubo ), 1291abe9b8aSliubo 130bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 1311abe9b8aSliubo __entry->ino = inode->i_ino; 1321abe9b8aSliubo __entry->blocks = inode->i_blocks; 1331abe9b8aSliubo __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; 1341abe9b8aSliubo __entry->generation = BTRFS_I(inode)->generation; 1351abe9b8aSliubo __entry->last_trans = BTRFS_I(inode)->last_trans; 1361abe9b8aSliubo __entry->logged_trans = BTRFS_I(inode)->logged_trans; 1371abe9b8aSliubo __entry->root_objectid = 1381abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 1391abe9b8aSliubo ), 1401abe9b8aSliubo 141562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%lu blocks=%llu " 142562a7a07SDavid Sterba "disk_i_size=%llu last_trans=%llu logged_trans=%llu", 1431abe9b8aSliubo show_root_type(__entry->root_objectid), 1441abe9b8aSliubo (unsigned long long)__entry->generation, 1451abe9b8aSliubo (unsigned long)__entry->ino, 1461abe9b8aSliubo (unsigned long long)__entry->blocks, 1471abe9b8aSliubo (unsigned long long)__entry->disk_i_size, 1481abe9b8aSliubo (unsigned long long)__entry->last_trans, 1491abe9b8aSliubo (unsigned long long)__entry->logged_trans) 1501abe9b8aSliubo ); 1511abe9b8aSliubo 1521abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_new, 1531abe9b8aSliubo 1549a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 1551abe9b8aSliubo 1561abe9b8aSliubo TP_ARGS(inode) 1571abe9b8aSliubo ); 1581abe9b8aSliubo 1591abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_request, 1601abe9b8aSliubo 1619a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 1621abe9b8aSliubo 1631abe9b8aSliubo TP_ARGS(inode) 1641abe9b8aSliubo ); 1651abe9b8aSliubo 1661abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, 1671abe9b8aSliubo 1689a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 1691abe9b8aSliubo 1701abe9b8aSliubo TP_ARGS(inode) 1711abe9b8aSliubo ); 1721abe9b8aSliubo 1731abe9b8aSliubo #define __show_map_type(type) \ 1747f34b746Sliubo __print_symbolic_u64(type, \ 1751abe9b8aSliubo { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ 1761abe9b8aSliubo { EXTENT_MAP_HOLE, "HOLE" }, \ 1771abe9b8aSliubo { EXTENT_MAP_INLINE, "INLINE" }, \ 1781abe9b8aSliubo { EXTENT_MAP_DELALLOC, "DELALLOC" }) 1791abe9b8aSliubo 1801abe9b8aSliubo #define show_map_type(type) \ 1811abe9b8aSliubo type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) 1821abe9b8aSliubo 1831abe9b8aSliubo #define show_map_flags(flag) \ 1841abe9b8aSliubo __print_flags(flag, "|", \ 185254a2d14SLiu Bo { (1 << EXTENT_FLAG_PINNED), "PINNED" },\ 186254a2d14SLiu Bo { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\ 187254a2d14SLiu Bo { (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\ 188254a2d14SLiu Bo { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\ 189254a2d14SLiu Bo { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\ 190254a2d14SLiu Bo { (1 << EXTENT_FLAG_FILLING), "FILLING" },\ 191254a2d14SLiu Bo { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" }) 1921abe9b8aSliubo 1934cd8587cSSteven Rostedt TRACE_EVENT_CONDITION(btrfs_get_extent, 1941abe9b8aSliubo 1959a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode, 1969a35b637SJeff Mahoney const struct extent_map *map), 1971abe9b8aSliubo 19892a1bf76SLiu Bo TP_ARGS(root, inode, map), 1991abe9b8aSliubo 2004cd8587cSSteven Rostedt TP_CONDITION(map), 2014cd8587cSSteven Rostedt 202bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 2031abe9b8aSliubo __field( u64, root_objectid ) 20492a1bf76SLiu Bo __field( u64, ino ) 2051abe9b8aSliubo __field( u64, start ) 2061abe9b8aSliubo __field( u64, len ) 2071abe9b8aSliubo __field( u64, orig_start ) 2081abe9b8aSliubo __field( u64, block_start ) 2091abe9b8aSliubo __field( u64, block_len ) 2101abe9b8aSliubo __field( unsigned long, flags ) 2111abe9b8aSliubo __field( int, refs ) 2121abe9b8aSliubo __field( unsigned int, compress_type ) 2131abe9b8aSliubo ), 2141abe9b8aSliubo 215bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 2161abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 21792a1bf76SLiu Bo __entry->ino = btrfs_ino(inode); 2181abe9b8aSliubo __entry->start = map->start; 2191abe9b8aSliubo __entry->len = map->len; 2201abe9b8aSliubo __entry->orig_start = map->orig_start; 2211abe9b8aSliubo __entry->block_start = map->block_start; 2221abe9b8aSliubo __entry->block_len = map->block_len; 2231abe9b8aSliubo __entry->flags = map->flags; 224490b54d6SElena Reshetova __entry->refs = refcount_read(&map->refs); 2251abe9b8aSliubo __entry->compress_type = map->compress_type; 2261abe9b8aSliubo ), 2271abe9b8aSliubo 228562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu " 229562a7a07SDavid Sterba "orig_start=%llu block_start=%llu(%s) " 230562a7a07SDavid Sterba "block_len=%llu flags=%s refs=%u " 2311abe9b8aSliubo "compress_type=%u", 2321abe9b8aSliubo show_root_type(__entry->root_objectid), 23392a1bf76SLiu Bo (unsigned long long)__entry->ino, 2341abe9b8aSliubo (unsigned long long)__entry->start, 2351abe9b8aSliubo (unsigned long long)__entry->len, 2361abe9b8aSliubo (unsigned long long)__entry->orig_start, 2371abe9b8aSliubo show_map_type(__entry->block_start), 2381abe9b8aSliubo (unsigned long long)__entry->block_len, 2391abe9b8aSliubo show_map_flags(__entry->flags), 2401abe9b8aSliubo __entry->refs, __entry->compress_type) 2411abe9b8aSliubo ); 2421abe9b8aSliubo 24309ed2f16SLiu Bo /* file extent item */ 24409ed2f16SLiu Bo DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular, 24509ed2f16SLiu Bo 24609ed2f16SLiu Bo TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, 24709ed2f16SLiu Bo struct btrfs_file_extent_item *fi, u64 start), 24809ed2f16SLiu Bo 24909ed2f16SLiu Bo TP_ARGS(bi, l, fi, start), 25009ed2f16SLiu Bo 25109ed2f16SLiu Bo TP_STRUCT__entry_btrfs( 25209ed2f16SLiu Bo __field( u64, root_obj ) 25309ed2f16SLiu Bo __field( u64, ino ) 25409ed2f16SLiu Bo __field( loff_t, isize ) 25509ed2f16SLiu Bo __field( u64, disk_isize ) 25609ed2f16SLiu Bo __field( u64, num_bytes ) 25709ed2f16SLiu Bo __field( u64, ram_bytes ) 25809ed2f16SLiu Bo __field( u64, disk_bytenr ) 25909ed2f16SLiu Bo __field( u64, disk_num_bytes ) 26009ed2f16SLiu Bo __field( u64, extent_offset ) 26109ed2f16SLiu Bo __field( u8, extent_type ) 26209ed2f16SLiu Bo __field( u8, compression ) 26309ed2f16SLiu Bo __field( u64, extent_start ) 26409ed2f16SLiu Bo __field( u64, extent_end ) 26509ed2f16SLiu Bo ), 26609ed2f16SLiu Bo 26709ed2f16SLiu Bo TP_fast_assign_btrfs(bi->root->fs_info, 26809ed2f16SLiu Bo __entry->root_obj = bi->root->objectid; 26909ed2f16SLiu Bo __entry->ino = btrfs_ino(bi); 27009ed2f16SLiu Bo __entry->isize = bi->vfs_inode.i_size; 27109ed2f16SLiu Bo __entry->disk_isize = bi->disk_i_size; 27209ed2f16SLiu Bo __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi); 27309ed2f16SLiu Bo __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi); 27409ed2f16SLiu Bo __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi); 27509ed2f16SLiu Bo __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi); 27609ed2f16SLiu Bo __entry->extent_offset = btrfs_file_extent_offset(l, fi); 27709ed2f16SLiu Bo __entry->extent_type = btrfs_file_extent_type(l, fi); 27809ed2f16SLiu Bo __entry->compression = btrfs_file_extent_compression(l, fi); 27909ed2f16SLiu Bo __entry->extent_start = start; 28009ed2f16SLiu Bo __entry->extent_end = (start + __entry->num_bytes); 28109ed2f16SLiu Bo ), 28209ed2f16SLiu Bo 28309ed2f16SLiu Bo TP_printk_btrfs( 28409ed2f16SLiu Bo "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " 28509ed2f16SLiu Bo "file extent range=[%llu %llu] " 28609ed2f16SLiu Bo "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu " 28709ed2f16SLiu Bo "disk_num_bytes=%llu extent_offset=%llu type=%s " 28809ed2f16SLiu Bo "compression=%u", 28909ed2f16SLiu Bo show_root_type(__entry->root_obj), __entry->ino, 29009ed2f16SLiu Bo __entry->isize, 29109ed2f16SLiu Bo __entry->disk_isize, __entry->extent_start, 29209ed2f16SLiu Bo __entry->extent_end, __entry->num_bytes, __entry->ram_bytes, 29309ed2f16SLiu Bo __entry->disk_bytenr, __entry->disk_num_bytes, 29409ed2f16SLiu Bo __entry->extent_offset, show_fi_type(__entry->extent_type), 29509ed2f16SLiu Bo __entry->compression) 29609ed2f16SLiu Bo ); 29709ed2f16SLiu Bo 29809ed2f16SLiu Bo DECLARE_EVENT_CLASS( 29909ed2f16SLiu Bo btrfs__file_extent_item_inline, 30009ed2f16SLiu Bo 30109ed2f16SLiu Bo TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, 30209ed2f16SLiu Bo struct btrfs_file_extent_item *fi, int slot, u64 start), 30309ed2f16SLiu Bo 30409ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start), 30509ed2f16SLiu Bo 30609ed2f16SLiu Bo TP_STRUCT__entry_btrfs( 30709ed2f16SLiu Bo __field( u64, root_obj ) 30809ed2f16SLiu Bo __field( u64, ino ) 30909ed2f16SLiu Bo __field( loff_t, isize ) 31009ed2f16SLiu Bo __field( u64, disk_isize ) 31109ed2f16SLiu Bo __field( u8, extent_type ) 31209ed2f16SLiu Bo __field( u8, compression ) 31309ed2f16SLiu Bo __field( u64, extent_start ) 31409ed2f16SLiu Bo __field( u64, extent_end ) 31509ed2f16SLiu Bo ), 31609ed2f16SLiu Bo 31709ed2f16SLiu Bo TP_fast_assign_btrfs( 31809ed2f16SLiu Bo bi->root->fs_info, 31909ed2f16SLiu Bo __entry->root_obj = bi->root->objectid; 32009ed2f16SLiu Bo __entry->ino = btrfs_ino(bi); 32109ed2f16SLiu Bo __entry->isize = bi->vfs_inode.i_size; 32209ed2f16SLiu Bo __entry->disk_isize = bi->disk_i_size; 32309ed2f16SLiu Bo __entry->extent_type = btrfs_file_extent_type(l, fi); 32409ed2f16SLiu Bo __entry->compression = btrfs_file_extent_compression(l, fi); 32509ed2f16SLiu Bo __entry->extent_start = start; 32609ed2f16SLiu Bo __entry->extent_end = (start + btrfs_file_extent_inline_len(l, slot, fi)); 32709ed2f16SLiu Bo ), 32809ed2f16SLiu Bo 32909ed2f16SLiu Bo TP_printk_btrfs( 33009ed2f16SLiu Bo "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " 33109ed2f16SLiu Bo "file extent range=[%llu %llu] " 33209ed2f16SLiu Bo "extent_type=%s compression=%u", 33309ed2f16SLiu Bo show_root_type(__entry->root_obj), __entry->ino, __entry->isize, 33409ed2f16SLiu Bo __entry->disk_isize, __entry->extent_start, 33509ed2f16SLiu Bo __entry->extent_end, show_fi_type(__entry->extent_type), 33609ed2f16SLiu Bo __entry->compression) 33709ed2f16SLiu Bo ); 33809ed2f16SLiu Bo 33909ed2f16SLiu Bo DEFINE_EVENT( 34009ed2f16SLiu Bo btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular, 34109ed2f16SLiu Bo 34209ed2f16SLiu Bo TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, 34309ed2f16SLiu Bo struct btrfs_file_extent_item *fi, u64 start), 34409ed2f16SLiu Bo 34509ed2f16SLiu Bo TP_ARGS(bi, l, fi, start) 34609ed2f16SLiu Bo ); 34709ed2f16SLiu Bo 34809ed2f16SLiu Bo DEFINE_EVENT( 34909ed2f16SLiu Bo btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular, 35009ed2f16SLiu Bo 35109ed2f16SLiu Bo TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, 35209ed2f16SLiu Bo struct btrfs_file_extent_item *fi, u64 start), 35309ed2f16SLiu Bo 35409ed2f16SLiu Bo TP_ARGS(bi, l, fi, start) 35509ed2f16SLiu Bo ); 35609ed2f16SLiu Bo 35709ed2f16SLiu Bo DEFINE_EVENT( 35809ed2f16SLiu Bo btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline, 35909ed2f16SLiu Bo 36009ed2f16SLiu Bo TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, 36109ed2f16SLiu Bo struct btrfs_file_extent_item *fi, int slot, u64 start), 36209ed2f16SLiu Bo 36309ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start) 36409ed2f16SLiu Bo ); 36509ed2f16SLiu Bo 36609ed2f16SLiu Bo DEFINE_EVENT( 36709ed2f16SLiu Bo btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline, 36809ed2f16SLiu Bo 36909ed2f16SLiu Bo TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, 37009ed2f16SLiu Bo struct btrfs_file_extent_item *fi, int slot, u64 start), 37109ed2f16SLiu Bo 37209ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start) 37309ed2f16SLiu Bo ); 37409ed2f16SLiu Bo 3751abe9b8aSliubo #define show_ordered_flags(flags) \ 3769d04a8ceSLiu Bo __print_flags(flags, "|", \ 3779d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ 3789d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ 3799d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ 3809d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ 3819d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ 3829d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ 3839d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ 3849d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \ 385792ddef0SLiu Bo { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \ 386792ddef0SLiu Bo { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) 387e112e2b4SLiu Bo 3881abe9b8aSliubo 3891abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__ordered_extent, 3901abe9b8aSliubo 3919a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, 3929a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 3931abe9b8aSliubo 3941abe9b8aSliubo TP_ARGS(inode, ordered), 3951abe9b8aSliubo 396bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 3971abe9b8aSliubo __field( ino_t, ino ) 3981abe9b8aSliubo __field( u64, file_offset ) 3991abe9b8aSliubo __field( u64, start ) 4001abe9b8aSliubo __field( u64, len ) 4011abe9b8aSliubo __field( u64, disk_len ) 4021abe9b8aSliubo __field( u64, bytes_left ) 4031abe9b8aSliubo __field( unsigned long, flags ) 4041abe9b8aSliubo __field( int, compress_type ) 4051abe9b8aSliubo __field( int, refs ) 4061abe9b8aSliubo __field( u64, root_objectid ) 40778566548SLiu Bo __field( u64, truncated_len ) 4081abe9b8aSliubo ), 4091abe9b8aSliubo 410bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 4111abe9b8aSliubo __entry->ino = inode->i_ino; 4121abe9b8aSliubo __entry->file_offset = ordered->file_offset; 4131abe9b8aSliubo __entry->start = ordered->start; 4141abe9b8aSliubo __entry->len = ordered->len; 4151abe9b8aSliubo __entry->disk_len = ordered->disk_len; 4161abe9b8aSliubo __entry->bytes_left = ordered->bytes_left; 4171abe9b8aSliubo __entry->flags = ordered->flags; 4181abe9b8aSliubo __entry->compress_type = ordered->compress_type; 419e76edab7SElena Reshetova __entry->refs = refcount_read(&ordered->refs); 4201abe9b8aSliubo __entry->root_objectid = 4211abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 42278566548SLiu Bo __entry->truncated_len = ordered->truncated_len; 4231abe9b8aSliubo ), 4241abe9b8aSliubo 425562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu " 426562a7a07SDavid Sterba "start=%llu len=%llu disk_len=%llu " 427562a7a07SDavid Sterba "truncated_len=%llu " 428562a7a07SDavid Sterba "bytes_left=%llu flags=%s compress_type=%d " 4291abe9b8aSliubo "refs=%d", 4301abe9b8aSliubo show_root_type(__entry->root_objectid), 4311abe9b8aSliubo (unsigned long long)__entry->ino, 4321abe9b8aSliubo (unsigned long long)__entry->file_offset, 4331abe9b8aSliubo (unsigned long long)__entry->start, 4341abe9b8aSliubo (unsigned long long)__entry->len, 4351abe9b8aSliubo (unsigned long long)__entry->disk_len, 43678566548SLiu Bo (unsigned long long)__entry->truncated_len, 4371abe9b8aSliubo (unsigned long long)__entry->bytes_left, 4381abe9b8aSliubo show_ordered_flags(__entry->flags), 4391abe9b8aSliubo __entry->compress_type, __entry->refs) 4401abe9b8aSliubo ); 4411abe9b8aSliubo 4421abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, 4431abe9b8aSliubo 4449a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, 4459a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 4461abe9b8aSliubo 4471abe9b8aSliubo TP_ARGS(inode, ordered) 4481abe9b8aSliubo ); 4491abe9b8aSliubo 4501abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, 4511abe9b8aSliubo 4529a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, 4539a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 4541abe9b8aSliubo 4551abe9b8aSliubo TP_ARGS(inode, ordered) 4561abe9b8aSliubo ); 4571abe9b8aSliubo 4581abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, 4591abe9b8aSliubo 4609a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, 4619a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 4621abe9b8aSliubo 4631abe9b8aSliubo TP_ARGS(inode, ordered) 4641abe9b8aSliubo ); 4651abe9b8aSliubo 4661abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, 4671abe9b8aSliubo 4689a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, 4699a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 4701abe9b8aSliubo 4711abe9b8aSliubo TP_ARGS(inode, ordered) 4721abe9b8aSliubo ); 4731abe9b8aSliubo 4741abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__writepage, 4751abe9b8aSliubo 4769a35b637SJeff Mahoney TP_PROTO(const struct page *page, const struct inode *inode, 4779a35b637SJeff Mahoney const struct writeback_control *wbc), 4781abe9b8aSliubo 4791abe9b8aSliubo TP_ARGS(page, inode, wbc), 4801abe9b8aSliubo 481bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 4821abe9b8aSliubo __field( ino_t, ino ) 4831abe9b8aSliubo __field( pgoff_t, index ) 4841abe9b8aSliubo __field( long, nr_to_write ) 4851abe9b8aSliubo __field( long, pages_skipped ) 4861abe9b8aSliubo __field( loff_t, range_start ) 4871abe9b8aSliubo __field( loff_t, range_end ) 4881abe9b8aSliubo __field( char, for_kupdate ) 4891abe9b8aSliubo __field( char, for_reclaim ) 4901abe9b8aSliubo __field( char, range_cyclic ) 4911abe9b8aSliubo __field( pgoff_t, writeback_index ) 4921abe9b8aSliubo __field( u64, root_objectid ) 4931abe9b8aSliubo ), 4941abe9b8aSliubo 495bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 4961abe9b8aSliubo __entry->ino = inode->i_ino; 4971abe9b8aSliubo __entry->index = page->index; 4981abe9b8aSliubo __entry->nr_to_write = wbc->nr_to_write; 4991abe9b8aSliubo __entry->pages_skipped = wbc->pages_skipped; 5001abe9b8aSliubo __entry->range_start = wbc->range_start; 5011abe9b8aSliubo __entry->range_end = wbc->range_end; 5021abe9b8aSliubo __entry->for_kupdate = wbc->for_kupdate; 5031abe9b8aSliubo __entry->for_reclaim = wbc->for_reclaim; 5041abe9b8aSliubo __entry->range_cyclic = wbc->range_cyclic; 5051abe9b8aSliubo __entry->writeback_index = inode->i_mapping->writeback_index; 5061abe9b8aSliubo __entry->root_objectid = 5071abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 5081abe9b8aSliubo ), 5091abe9b8aSliubo 510562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu " 511562a7a07SDavid Sterba "nr_to_write=%ld pages_skipped=%ld range_start=%llu " 512562a7a07SDavid Sterba "range_end=%llu for_kupdate=%d " 513562a7a07SDavid Sterba "for_reclaim=%d range_cyclic=%d writeback_index=%lu", 5141abe9b8aSliubo show_root_type(__entry->root_objectid), 5151abe9b8aSliubo (unsigned long)__entry->ino, __entry->index, 5161abe9b8aSliubo __entry->nr_to_write, __entry->pages_skipped, 5171abe9b8aSliubo __entry->range_start, __entry->range_end, 518846d5a09SWu Fengguang __entry->for_kupdate, 5191abe9b8aSliubo __entry->for_reclaim, __entry->range_cyclic, 5201abe9b8aSliubo (unsigned long)__entry->writeback_index) 5211abe9b8aSliubo ); 5221abe9b8aSliubo 5231abe9b8aSliubo DEFINE_EVENT(btrfs__writepage, __extent_writepage, 5241abe9b8aSliubo 5259a35b637SJeff Mahoney TP_PROTO(const struct page *page, const struct inode *inode, 5269a35b637SJeff Mahoney const struct writeback_control *wbc), 5271abe9b8aSliubo 5281abe9b8aSliubo TP_ARGS(page, inode, wbc) 5291abe9b8aSliubo ); 5301abe9b8aSliubo 5311abe9b8aSliubo TRACE_EVENT(btrfs_writepage_end_io_hook, 5321abe9b8aSliubo 5339a35b637SJeff Mahoney TP_PROTO(const struct page *page, u64 start, u64 end, int uptodate), 5341abe9b8aSliubo 5351abe9b8aSliubo TP_ARGS(page, start, end, uptodate), 5361abe9b8aSliubo 537bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 5381abe9b8aSliubo __field( ino_t, ino ) 5391abe9b8aSliubo __field( pgoff_t, index ) 5401abe9b8aSliubo __field( u64, start ) 5411abe9b8aSliubo __field( u64, end ) 5421abe9b8aSliubo __field( int, uptodate ) 5431abe9b8aSliubo __field( u64, root_objectid ) 5441abe9b8aSliubo ), 5451abe9b8aSliubo 546bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb), 5471abe9b8aSliubo __entry->ino = page->mapping->host->i_ino; 5481abe9b8aSliubo __entry->index = page->index; 5491abe9b8aSliubo __entry->start = start; 5501abe9b8aSliubo __entry->end = end; 5511abe9b8aSliubo __entry->uptodate = uptodate; 5521abe9b8aSliubo __entry->root_objectid = 5531abe9b8aSliubo BTRFS_I(page->mapping->host)->root->root_key.objectid; 5541abe9b8aSliubo ), 5551abe9b8aSliubo 556562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu start=%llu " 557562a7a07SDavid Sterba "end=%llu uptodate=%d", 5581abe9b8aSliubo show_root_type(__entry->root_objectid), 5591abe9b8aSliubo (unsigned long)__entry->ino, (unsigned long)__entry->index, 5601abe9b8aSliubo (unsigned long long)__entry->start, 5611abe9b8aSliubo (unsigned long long)__entry->end, __entry->uptodate) 5621abe9b8aSliubo ); 5631abe9b8aSliubo 5641abe9b8aSliubo TRACE_EVENT(btrfs_sync_file, 5651abe9b8aSliubo 5669a35b637SJeff Mahoney TP_PROTO(const struct file *file, int datasync), 5671abe9b8aSliubo 5681abe9b8aSliubo TP_ARGS(file, datasync), 5691abe9b8aSliubo 570bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 5711abe9b8aSliubo __field( ino_t, ino ) 5721abe9b8aSliubo __field( ino_t, parent ) 5731abe9b8aSliubo __field( int, datasync ) 5741abe9b8aSliubo __field( u64, root_objectid ) 5751abe9b8aSliubo ), 5761abe9b8aSliubo 5771abe9b8aSliubo TP_fast_assign( 5789a35b637SJeff Mahoney const struct dentry *dentry = file->f_path.dentry; 5799a35b637SJeff Mahoney const struct inode *inode = d_inode(dentry); 5801abe9b8aSliubo 581bc074524SJeff Mahoney TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb)); 5821abe9b8aSliubo __entry->ino = inode->i_ino; 5832b0143b5SDavid Howells __entry->parent = d_inode(dentry->d_parent)->i_ino; 5841abe9b8aSliubo __entry->datasync = datasync; 5851abe9b8aSliubo __entry->root_objectid = 5861abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 5871abe9b8aSliubo ), 5881abe9b8aSliubo 589562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%ld parent=%ld datasync=%d", 5901abe9b8aSliubo show_root_type(__entry->root_objectid), 5911abe9b8aSliubo (unsigned long)__entry->ino, (unsigned long)__entry->parent, 5921abe9b8aSliubo __entry->datasync) 5931abe9b8aSliubo ); 5941abe9b8aSliubo 5951abe9b8aSliubo TRACE_EVENT(btrfs_sync_fs, 5961abe9b8aSliubo 5979a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, int wait), 5981abe9b8aSliubo 599bc074524SJeff Mahoney TP_ARGS(fs_info, wait), 6001abe9b8aSliubo 601bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 6021abe9b8aSliubo __field( int, wait ) 6031abe9b8aSliubo ), 6041abe9b8aSliubo 605bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 6061abe9b8aSliubo __entry->wait = wait; 6071abe9b8aSliubo ), 6081abe9b8aSliubo 609bc074524SJeff Mahoney TP_printk_btrfs("wait = %d", __entry->wait) 6101abe9b8aSliubo ); 6111abe9b8aSliubo 612c83f8effSJosef Bacik TRACE_EVENT(btrfs_add_block_group, 613c83f8effSJosef Bacik 6149a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 6159a35b637SJeff Mahoney const struct btrfs_block_group_cache *block_group, int create), 616c83f8effSJosef Bacik 617c83f8effSJosef Bacik TP_ARGS(fs_info, block_group, create), 618c83f8effSJosef Bacik 619c83f8effSJosef Bacik TP_STRUCT__entry( 620c83f8effSJosef Bacik __array( u8, fsid, BTRFS_UUID_SIZE ) 621c83f8effSJosef Bacik __field( u64, offset ) 622c83f8effSJosef Bacik __field( u64, size ) 623c83f8effSJosef Bacik __field( u64, flags ) 624c83f8effSJosef Bacik __field( u64, bytes_used ) 625c83f8effSJosef Bacik __field( u64, bytes_super ) 626c83f8effSJosef Bacik __field( int, create ) 627c83f8effSJosef Bacik ), 628c83f8effSJosef Bacik 629c83f8effSJosef Bacik TP_fast_assign( 630c83f8effSJosef Bacik memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE); 631c83f8effSJosef Bacik __entry->offset = block_group->key.objectid; 632c83f8effSJosef Bacik __entry->size = block_group->key.offset; 633c83f8effSJosef Bacik __entry->flags = block_group->flags; 634c83f8effSJosef Bacik __entry->bytes_used = 635c83f8effSJosef Bacik btrfs_block_group_used(&block_group->item); 636c83f8effSJosef Bacik __entry->bytes_super = block_group->bytes_super; 637c83f8effSJosef Bacik __entry->create = create; 638c83f8effSJosef Bacik ), 639c83f8effSJosef Bacik 640562a7a07SDavid Sterba TP_printk("%pU: block_group offset=%llu size=%llu " 641562a7a07SDavid Sterba "flags=%llu(%s) bytes_used=%llu bytes_super=%llu " 642c83f8effSJosef Bacik "create=%d", __entry->fsid, 643c83f8effSJosef Bacik (unsigned long long)__entry->offset, 644c83f8effSJosef Bacik (unsigned long long)__entry->size, 645c83f8effSJosef Bacik (unsigned long long)__entry->flags, 646c83f8effSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 647c83f8effSJosef Bacik BTRFS_GROUP_FLAGS), 648c83f8effSJosef Bacik (unsigned long long)__entry->bytes_used, 649c83f8effSJosef Bacik (unsigned long long)__entry->bytes_super, __entry->create) 650c83f8effSJosef Bacik ); 651c83f8effSJosef Bacik 6521abe9b8aSliubo #define show_ref_action(action) \ 6531abe9b8aSliubo __print_symbolic(action, \ 6541abe9b8aSliubo { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ 6551abe9b8aSliubo { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ 6561abe9b8aSliubo { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ 6571abe9b8aSliubo { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) 6581abe9b8aSliubo 6591abe9b8aSliubo 660599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, 6611abe9b8aSliubo 6629a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 6639a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 6649a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 6651abe9b8aSliubo int action), 6661abe9b8aSliubo 667bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action), 6681abe9b8aSliubo 669bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 6701abe9b8aSliubo __field( u64, bytenr ) 6711abe9b8aSliubo __field( u64, num_bytes ) 6721abe9b8aSliubo __field( int, action ) 6731abe9b8aSliubo __field( u64, parent ) 6741abe9b8aSliubo __field( u64, ref_root ) 6751abe9b8aSliubo __field( int, level ) 6761abe9b8aSliubo __field( int, type ) 677dea7d76eSLiu Bo __field( u64, seq ) 6781abe9b8aSliubo ), 6791abe9b8aSliubo 680bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 6811abe9b8aSliubo __entry->bytenr = ref->bytenr; 6821abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 6831abe9b8aSliubo __entry->action = action; 6841abe9b8aSliubo __entry->parent = full_ref->parent; 6851abe9b8aSliubo __entry->ref_root = full_ref->root; 6861abe9b8aSliubo __entry->level = full_ref->level; 6871abe9b8aSliubo __entry->type = ref->type; 688dea7d76eSLiu Bo __entry->seq = ref->seq; 6891abe9b8aSliubo ), 6901abe9b8aSliubo 691562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 692562a7a07SDavid Sterba "parent=%llu(%s) ref_root=%llu(%s) level=%d " 693562a7a07SDavid Sterba "type=%s seq=%llu", 6941abe9b8aSliubo (unsigned long long)__entry->bytenr, 6951abe9b8aSliubo (unsigned long long)__entry->num_bytes, 6961abe9b8aSliubo show_ref_action(__entry->action), 6971abe9b8aSliubo show_root_type(__entry->parent), 6981abe9b8aSliubo show_root_type(__entry->ref_root), 699dea7d76eSLiu Bo __entry->level, show_ref_type(__entry->type), 700dea7d76eSLiu Bo (unsigned long long)__entry->seq) 7011abe9b8aSliubo ); 7021abe9b8aSliubo 703599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, 704599c75ecSLiu Bo 7059a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 7069a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 7079a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 708599c75ecSLiu Bo int action), 709599c75ecSLiu Bo 710bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 711599c75ecSLiu Bo ); 712599c75ecSLiu Bo 713599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, 714599c75ecSLiu Bo 7159a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 7169a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 7179a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 718599c75ecSLiu Bo int action), 719599c75ecSLiu Bo 720bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 721599c75ecSLiu Bo ); 722599c75ecSLiu Bo 723599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, 7241abe9b8aSliubo 7259a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 7269a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 7279a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 7281abe9b8aSliubo int action), 7291abe9b8aSliubo 730bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action), 7311abe9b8aSliubo 732bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 7331abe9b8aSliubo __field( u64, bytenr ) 7341abe9b8aSliubo __field( u64, num_bytes ) 7351abe9b8aSliubo __field( int, action ) 7361abe9b8aSliubo __field( u64, parent ) 7371abe9b8aSliubo __field( u64, ref_root ) 7381abe9b8aSliubo __field( u64, owner ) 7391abe9b8aSliubo __field( u64, offset ) 7401abe9b8aSliubo __field( int, type ) 741dea7d76eSLiu Bo __field( u64, seq ) 7421abe9b8aSliubo ), 7431abe9b8aSliubo 744bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 7451abe9b8aSliubo __entry->bytenr = ref->bytenr; 7461abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 7471abe9b8aSliubo __entry->action = action; 7481abe9b8aSliubo __entry->parent = full_ref->parent; 7491abe9b8aSliubo __entry->ref_root = full_ref->root; 7501abe9b8aSliubo __entry->owner = full_ref->objectid; 7511abe9b8aSliubo __entry->offset = full_ref->offset; 7521abe9b8aSliubo __entry->type = ref->type; 753dea7d76eSLiu Bo __entry->seq = ref->seq; 7541abe9b8aSliubo ), 7551abe9b8aSliubo 756562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 757562a7a07SDavid Sterba "parent=%llu(%s) ref_root=%llu(%s) owner=%llu " 758562a7a07SDavid Sterba "offset=%llu type=%s seq=%llu", 7591abe9b8aSliubo (unsigned long long)__entry->bytenr, 7601abe9b8aSliubo (unsigned long long)__entry->num_bytes, 7611abe9b8aSliubo show_ref_action(__entry->action), 7621abe9b8aSliubo show_root_type(__entry->parent), 7631abe9b8aSliubo show_root_type(__entry->ref_root), 7641abe9b8aSliubo (unsigned long long)__entry->owner, 7651abe9b8aSliubo (unsigned long long)__entry->offset, 766dea7d76eSLiu Bo show_ref_type(__entry->type), 767dea7d76eSLiu Bo (unsigned long long)__entry->seq) 7681abe9b8aSliubo ); 7691abe9b8aSliubo 770599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, 771599c75ecSLiu Bo 7729a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 7739a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 7749a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 775599c75ecSLiu Bo int action), 776599c75ecSLiu Bo 777bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 778599c75ecSLiu Bo ); 779599c75ecSLiu Bo 780599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, 781599c75ecSLiu Bo 7829a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 7839a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 7849a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 785599c75ecSLiu Bo int action), 786599c75ecSLiu Bo 787bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 788599c75ecSLiu Bo ); 789599c75ecSLiu Bo 790599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, 7911abe9b8aSliubo 7929a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 7939a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 7949a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 7951abe9b8aSliubo int action), 7961abe9b8aSliubo 797bc074524SJeff Mahoney TP_ARGS(fs_info, ref, head_ref, action), 7981abe9b8aSliubo 799bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 8001abe9b8aSliubo __field( u64, bytenr ) 8011abe9b8aSliubo __field( u64, num_bytes ) 8021abe9b8aSliubo __field( int, action ) 8031abe9b8aSliubo __field( int, is_data ) 8041abe9b8aSliubo ), 8051abe9b8aSliubo 806bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 8071abe9b8aSliubo __entry->bytenr = ref->bytenr; 8081abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 8091abe9b8aSliubo __entry->action = action; 8101abe9b8aSliubo __entry->is_data = head_ref->is_data; 8111abe9b8aSliubo ), 8121abe9b8aSliubo 813562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d", 8141abe9b8aSliubo (unsigned long long)__entry->bytenr, 8151abe9b8aSliubo (unsigned long long)__entry->num_bytes, 8161abe9b8aSliubo show_ref_action(__entry->action), 8171abe9b8aSliubo __entry->is_data) 8181abe9b8aSliubo ); 8191abe9b8aSliubo 820599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, 821599c75ecSLiu Bo 8229a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8239a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 8249a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 825599c75ecSLiu Bo int action), 826599c75ecSLiu Bo 827bc074524SJeff Mahoney TP_ARGS(fs_info, ref, head_ref, action) 828599c75ecSLiu Bo ); 829599c75ecSLiu Bo 830599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, 831599c75ecSLiu Bo 8329a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8339a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 8349a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 835599c75ecSLiu Bo int action), 836599c75ecSLiu Bo 837bc074524SJeff Mahoney TP_ARGS(fs_info, ref, head_ref, action) 838599c75ecSLiu Bo ); 839599c75ecSLiu Bo 8401abe9b8aSliubo #define show_chunk_type(type) \ 8411abe9b8aSliubo __print_flags(type, "|", \ 8421abe9b8aSliubo { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ 8431abe9b8aSliubo { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 8441abe9b8aSliubo { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 8451abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ 8461abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ 8471abe9b8aSliubo { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ 848e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 849e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ 850e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) 8511abe9b8aSliubo 8521abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__chunk, 8531abe9b8aSliubo 8549a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8559a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 8561abe9b8aSliubo 8576bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size), 8581abe9b8aSliubo 859bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 8601abe9b8aSliubo __field( int, num_stripes ) 8611abe9b8aSliubo __field( u64, type ) 8621abe9b8aSliubo __field( int, sub_stripes ) 8631abe9b8aSliubo __field( u64, offset ) 8641abe9b8aSliubo __field( u64, size ) 8651abe9b8aSliubo __field( u64, root_objectid ) 8661abe9b8aSliubo ), 8671abe9b8aSliubo 8686bccf3abSJeff Mahoney TP_fast_assign_btrfs(fs_info, 8691abe9b8aSliubo __entry->num_stripes = map->num_stripes; 8701abe9b8aSliubo __entry->type = map->type; 8711abe9b8aSliubo __entry->sub_stripes = map->sub_stripes; 8721abe9b8aSliubo __entry->offset = offset; 8731abe9b8aSliubo __entry->size = size; 8746bccf3abSJeff Mahoney __entry->root_objectid = fs_info->chunk_root->root_key.objectid; 8751abe9b8aSliubo ), 8761abe9b8aSliubo 877562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu " 878562a7a07SDavid Sterba "num_stripes=%d sub_stripes=%d type=%s", 8791abe9b8aSliubo show_root_type(__entry->root_objectid), 8801abe9b8aSliubo (unsigned long long)__entry->offset, 8811abe9b8aSliubo (unsigned long long)__entry->size, 8821abe9b8aSliubo __entry->num_stripes, __entry->sub_stripes, 8831abe9b8aSliubo show_chunk_type(__entry->type)) 8841abe9b8aSliubo ); 8851abe9b8aSliubo 8861abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, 8871abe9b8aSliubo 8889a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8899a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 8901abe9b8aSliubo 8916bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size) 8921abe9b8aSliubo ); 8931abe9b8aSliubo 8941abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, 8951abe9b8aSliubo 8969a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8979a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 8981abe9b8aSliubo 8996bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size) 9001abe9b8aSliubo ); 9011abe9b8aSliubo 9021abe9b8aSliubo TRACE_EVENT(btrfs_cow_block, 9031abe9b8aSliubo 9049a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf, 9059a35b637SJeff Mahoney const struct extent_buffer *cow), 9061abe9b8aSliubo 9071abe9b8aSliubo TP_ARGS(root, buf, cow), 9081abe9b8aSliubo 909bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 9101abe9b8aSliubo __field( u64, root_objectid ) 9111abe9b8aSliubo __field( u64, buf_start ) 9121abe9b8aSliubo __field( int, refs ) 9131abe9b8aSliubo __field( u64, cow_start ) 9141abe9b8aSliubo __field( int, buf_level ) 9151abe9b8aSliubo __field( int, cow_level ) 9161abe9b8aSliubo ), 9171abe9b8aSliubo 918bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 9191abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 9201abe9b8aSliubo __entry->buf_start = buf->start; 9211abe9b8aSliubo __entry->refs = atomic_read(&buf->refs); 9221abe9b8aSliubo __entry->cow_start = cow->start; 9231abe9b8aSliubo __entry->buf_level = btrfs_header_level(buf); 9241abe9b8aSliubo __entry->cow_level = btrfs_header_level(cow); 9251abe9b8aSliubo ), 9261abe9b8aSliubo 927562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu " 928562a7a07SDavid Sterba "(orig_level=%d) cow_buf=%llu (cow_level=%d)", 9291abe9b8aSliubo show_root_type(__entry->root_objectid), 9301abe9b8aSliubo __entry->refs, 9311abe9b8aSliubo (unsigned long long)__entry->buf_start, 9321abe9b8aSliubo __entry->buf_level, 9331abe9b8aSliubo (unsigned long long)__entry->cow_start, 9341abe9b8aSliubo __entry->cow_level) 9351abe9b8aSliubo ); 9361abe9b8aSliubo 9378c2a3ca2SJosef Bacik TRACE_EVENT(btrfs_space_reservation, 9388c2a3ca2SJosef Bacik 9399a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, char *type, u64 val, 9408c2a3ca2SJosef Bacik u64 bytes, int reserve), 9418c2a3ca2SJosef Bacik 9428c2a3ca2SJosef Bacik TP_ARGS(fs_info, type, val, bytes, reserve), 9438c2a3ca2SJosef Bacik 944bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 9458c2a3ca2SJosef Bacik __string( type, type ) 9468c2a3ca2SJosef Bacik __field( u64, val ) 9478c2a3ca2SJosef Bacik __field( u64, bytes ) 9488c2a3ca2SJosef Bacik __field( int, reserve ) 9498c2a3ca2SJosef Bacik ), 9508c2a3ca2SJosef Bacik 951bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 9528c2a3ca2SJosef Bacik __assign_str(type, type); 9538c2a3ca2SJosef Bacik __entry->val = val; 9548c2a3ca2SJosef Bacik __entry->bytes = bytes; 9558c2a3ca2SJosef Bacik __entry->reserve = reserve; 9568c2a3ca2SJosef Bacik ), 9578c2a3ca2SJosef Bacik 958bc074524SJeff Mahoney TP_printk_btrfs("%s: %Lu %s %Lu", __get_str(type), __entry->val, 959bc074524SJeff Mahoney __entry->reserve ? "reserve" : "release", 9608c2a3ca2SJosef Bacik __entry->bytes) 9618c2a3ca2SJosef Bacik ); 9628c2a3ca2SJosef Bacik 963f376df2bSJosef Bacik #define show_flush_action(action) \ 964f376df2bSJosef Bacik __print_symbolic(action, \ 965f376df2bSJosef Bacik { BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH"}, \ 966f376df2bSJosef Bacik { BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT"}, \ 967f376df2bSJosef Bacik { BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL"}) 968f376df2bSJosef Bacik 969f376df2bSJosef Bacik TRACE_EVENT(btrfs_trigger_flush, 970f376df2bSJosef Bacik 9719a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, 972f376df2bSJosef Bacik int flush, char *reason), 973f376df2bSJosef Bacik 974f376df2bSJosef Bacik TP_ARGS(fs_info, flags, bytes, flush, reason), 975f376df2bSJosef Bacik 976f376df2bSJosef Bacik TP_STRUCT__entry( 977f376df2bSJosef Bacik __array( u8, fsid, BTRFS_UUID_SIZE ) 978f376df2bSJosef Bacik __field( u64, flags ) 979f376df2bSJosef Bacik __field( u64, bytes ) 980f376df2bSJosef Bacik __field( int, flush ) 981f376df2bSJosef Bacik __string( reason, reason ) 982f376df2bSJosef Bacik ), 983f376df2bSJosef Bacik 984f376df2bSJosef Bacik TP_fast_assign( 985f376df2bSJosef Bacik memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE); 986f376df2bSJosef Bacik __entry->flags = flags; 987f376df2bSJosef Bacik __entry->bytes = bytes; 988f376df2bSJosef Bacik __entry->flush = flush; 989f376df2bSJosef Bacik __assign_str(reason, reason) 990f376df2bSJosef Bacik ), 991f376df2bSJosef Bacik 992562a7a07SDavid Sterba TP_printk("%pU: %s: flush=%d(%s) flags=%llu(%s) bytes=%llu", 993f376df2bSJosef Bacik __entry->fsid, __get_str(reason), __entry->flush, 994f376df2bSJosef Bacik show_flush_action(__entry->flush), 995f376df2bSJosef Bacik (unsigned long long)__entry->flags, 996f376df2bSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 997f376df2bSJosef Bacik BTRFS_GROUP_FLAGS), 998f376df2bSJosef Bacik (unsigned long long)__entry->bytes) 999f376df2bSJosef Bacik ); 1000f376df2bSJosef Bacik 1001f376df2bSJosef Bacik #define show_flush_state(state) \ 1002f376df2bSJosef Bacik __print_symbolic(state, \ 1003f376df2bSJosef Bacik { FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR"}, \ 1004f376df2bSJosef Bacik { FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS"}, \ 1005f376df2bSJosef Bacik { FLUSH_DELALLOC, "FLUSH_DELALLOC"}, \ 1006f376df2bSJosef Bacik { FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT"}, \ 1007f376df2bSJosef Bacik { ALLOC_CHUNK, "ALLOC_CHUNK"}, \ 1008f376df2bSJosef Bacik { COMMIT_TRANS, "COMMIT_TRANS"}) 1009f376df2bSJosef Bacik 1010f376df2bSJosef Bacik TRACE_EVENT(btrfs_flush_space, 1011f376df2bSJosef Bacik 10129a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes, 1013f376df2bSJosef Bacik u64 orig_bytes, int state, int ret), 1014f376df2bSJosef Bacik 1015f376df2bSJosef Bacik TP_ARGS(fs_info, flags, num_bytes, orig_bytes, state, ret), 1016f376df2bSJosef Bacik 1017f376df2bSJosef Bacik TP_STRUCT__entry( 1018f376df2bSJosef Bacik __array( u8, fsid, BTRFS_UUID_SIZE ) 1019f376df2bSJosef Bacik __field( u64, flags ) 1020f376df2bSJosef Bacik __field( u64, num_bytes ) 1021f376df2bSJosef Bacik __field( u64, orig_bytes ) 1022f376df2bSJosef Bacik __field( int, state ) 1023f376df2bSJosef Bacik __field( int, ret ) 1024f376df2bSJosef Bacik ), 1025f376df2bSJosef Bacik 1026f376df2bSJosef Bacik TP_fast_assign( 1027f376df2bSJosef Bacik memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE); 1028f376df2bSJosef Bacik __entry->flags = flags; 1029f376df2bSJosef Bacik __entry->num_bytes = num_bytes; 1030f376df2bSJosef Bacik __entry->orig_bytes = orig_bytes; 1031f376df2bSJosef Bacik __entry->state = state; 1032f376df2bSJosef Bacik __entry->ret = ret; 1033f376df2bSJosef Bacik ), 1034f376df2bSJosef Bacik 1035562a7a07SDavid Sterba TP_printk("%pU: state=%d(%s) flags=%llu(%s) num_bytes=%llu " 1036562a7a07SDavid Sterba "orig_bytes=%llu ret=%d", __entry->fsid, __entry->state, 1037f376df2bSJosef Bacik show_flush_state(__entry->state), 1038f376df2bSJosef Bacik (unsigned long long)__entry->flags, 1039f376df2bSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 1040f376df2bSJosef Bacik BTRFS_GROUP_FLAGS), 1041f376df2bSJosef Bacik (unsigned long long)__entry->num_bytes, 1042f376df2bSJosef Bacik (unsigned long long)__entry->orig_bytes, __entry->ret) 1043f376df2bSJosef Bacik ); 1044f376df2bSJosef Bacik 10451abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__reserved_extent, 10461abe9b8aSliubo 10479a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 10481abe9b8aSliubo 104971ff6437SJeff Mahoney TP_ARGS(fs_info, start, len), 10501abe9b8aSliubo 1051bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 10521abe9b8aSliubo __field( u64, start ) 10531abe9b8aSliubo __field( u64, len ) 10541abe9b8aSliubo ), 10551abe9b8aSliubo 105671ff6437SJeff Mahoney TP_fast_assign_btrfs(fs_info, 10571abe9b8aSliubo __entry->start = start; 10581abe9b8aSliubo __entry->len = len; 10591abe9b8aSliubo ), 10601abe9b8aSliubo 1061562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu", 106271ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 10631abe9b8aSliubo (unsigned long long)__entry->start, 10641abe9b8aSliubo (unsigned long long)__entry->len) 10651abe9b8aSliubo ); 10661abe9b8aSliubo 10671abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, 10681abe9b8aSliubo 10699a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 10701abe9b8aSliubo 107171ff6437SJeff Mahoney TP_ARGS(fs_info, start, len) 10721abe9b8aSliubo ); 10731abe9b8aSliubo 10741abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, 10751abe9b8aSliubo 10769a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 10771abe9b8aSliubo 107871ff6437SJeff Mahoney TP_ARGS(fs_info, start, len) 10791abe9b8aSliubo ); 10801abe9b8aSliubo 10813f7de037SJosef Bacik TRACE_EVENT(find_free_extent, 10823f7de037SJosef Bacik 10839a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, 10849a35b637SJeff Mahoney u64 empty_size, u64 data), 10853f7de037SJosef Bacik 108671ff6437SJeff Mahoney TP_ARGS(fs_info, num_bytes, empty_size, data), 10873f7de037SJosef Bacik 1088bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 10893f7de037SJosef Bacik __field( u64, num_bytes ) 10903f7de037SJosef Bacik __field( u64, empty_size ) 10913f7de037SJosef Bacik __field( u64, data ) 10923f7de037SJosef Bacik ), 10933f7de037SJosef Bacik 109471ff6437SJeff Mahoney TP_fast_assign_btrfs(fs_info, 10953f7de037SJosef Bacik __entry->num_bytes = num_bytes; 10963f7de037SJosef Bacik __entry->empty_size = empty_size; 10973f7de037SJosef Bacik __entry->data = data; 10983f7de037SJosef Bacik ), 10993f7de037SJosef Bacik 1100562a7a07SDavid Sterba TP_printk_btrfs("root=%Lu(%s) len=%Lu empty_size=%Lu flags=%Lu(%s)", 110171ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 11023f7de037SJosef Bacik __entry->num_bytes, __entry->empty_size, __entry->data, 11033f7de037SJosef Bacik __print_flags((unsigned long)__entry->data, "|", 11043f7de037SJosef Bacik BTRFS_GROUP_FLAGS)) 11053f7de037SJosef Bacik ); 11063f7de037SJosef Bacik 11073f7de037SJosef Bacik DECLARE_EVENT_CLASS(btrfs__reserve_extent, 11083f7de037SJosef Bacik 11099a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 11109a35b637SJeff Mahoney const struct btrfs_block_group_cache *block_group, u64 start, 11113f7de037SJosef Bacik u64 len), 11123f7de037SJosef Bacik 111371ff6437SJeff Mahoney TP_ARGS(fs_info, block_group, start, len), 11143f7de037SJosef Bacik 1115bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 11163f7de037SJosef Bacik __field( u64, bg_objectid ) 11173f7de037SJosef Bacik __field( u64, flags ) 11183f7de037SJosef Bacik __field( u64, start ) 11193f7de037SJosef Bacik __field( u64, len ) 11203f7de037SJosef Bacik ), 11213f7de037SJosef Bacik 112271ff6437SJeff Mahoney TP_fast_assign_btrfs(fs_info, 11233f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 11243f7de037SJosef Bacik __entry->flags = block_group->flags; 11253f7de037SJosef Bacik __entry->start = start; 11263f7de037SJosef Bacik __entry->len = len; 11273f7de037SJosef Bacik ), 11283f7de037SJosef Bacik 1129562a7a07SDavid Sterba TP_printk_btrfs("root=%Lu(%s) block_group=%Lu flags=%Lu(%s) " 1130562a7a07SDavid Sterba "start=%Lu len=%Lu", 113171ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 113271ff6437SJeff Mahoney __entry->bg_objectid, 11333f7de037SJosef Bacik __entry->flags, __print_flags((unsigned long)__entry->flags, 11343f7de037SJosef Bacik "|", BTRFS_GROUP_FLAGS), 11353f7de037SJosef Bacik __entry->start, __entry->len) 11363f7de037SJosef Bacik ); 11373f7de037SJosef Bacik 11383f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, 11393f7de037SJosef Bacik 11409a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 11419a35b637SJeff Mahoney const struct btrfs_block_group_cache *block_group, u64 start, 11423f7de037SJosef Bacik u64 len), 11433f7de037SJosef Bacik 114471ff6437SJeff Mahoney TP_ARGS(fs_info, block_group, start, len) 11453f7de037SJosef Bacik ); 11463f7de037SJosef Bacik 11473f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, 11483f7de037SJosef Bacik 11499a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 11509a35b637SJeff Mahoney const struct btrfs_block_group_cache *block_group, u64 start, 11513f7de037SJosef Bacik u64 len), 11523f7de037SJosef Bacik 115371ff6437SJeff Mahoney TP_ARGS(fs_info, block_group, start, len) 11543f7de037SJosef Bacik ); 11553f7de037SJosef Bacik 11563f7de037SJosef Bacik TRACE_EVENT(btrfs_find_cluster, 11573f7de037SJosef Bacik 11589a35b637SJeff Mahoney TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start, 11593f7de037SJosef Bacik u64 bytes, u64 empty_size, u64 min_bytes), 11603f7de037SJosef Bacik 11613f7de037SJosef Bacik TP_ARGS(block_group, start, bytes, empty_size, min_bytes), 11623f7de037SJosef Bacik 1163bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 11643f7de037SJosef Bacik __field( u64, bg_objectid ) 11653f7de037SJosef Bacik __field( u64, flags ) 11663f7de037SJosef Bacik __field( u64, start ) 11673f7de037SJosef Bacik __field( u64, bytes ) 11683f7de037SJosef Bacik __field( u64, empty_size ) 11693f7de037SJosef Bacik __field( u64, min_bytes ) 11703f7de037SJosef Bacik ), 11713f7de037SJosef Bacik 1172bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 11733f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 11743f7de037SJosef Bacik __entry->flags = block_group->flags; 11753f7de037SJosef Bacik __entry->start = start; 11763f7de037SJosef Bacik __entry->bytes = bytes; 11773f7de037SJosef Bacik __entry->empty_size = empty_size; 11783f7de037SJosef Bacik __entry->min_bytes = min_bytes; 11793f7de037SJosef Bacik ), 11803f7de037SJosef Bacik 1181562a7a07SDavid Sterba TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) start=%Lu len=%Lu " 1182562a7a07SDavid Sterba "empty_size=%Lu min_bytes=%Lu", __entry->bg_objectid, 11833f7de037SJosef Bacik __entry->flags, 11843f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 11853f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 11863f7de037SJosef Bacik __entry->bytes, __entry->empty_size, __entry->min_bytes) 11873f7de037SJosef Bacik ); 11883f7de037SJosef Bacik 11893f7de037SJosef Bacik TRACE_EVENT(btrfs_failed_cluster_setup, 11903f7de037SJosef Bacik 11919a35b637SJeff Mahoney TP_PROTO(const struct btrfs_block_group_cache *block_group), 11923f7de037SJosef Bacik 11933f7de037SJosef Bacik TP_ARGS(block_group), 11943f7de037SJosef Bacik 1195bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 11963f7de037SJosef Bacik __field( u64, bg_objectid ) 11973f7de037SJosef Bacik ), 11983f7de037SJosef Bacik 1199bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 12003f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 12013f7de037SJosef Bacik ), 12023f7de037SJosef Bacik 1203bc074524SJeff Mahoney TP_printk_btrfs("block_group=%Lu", __entry->bg_objectid) 12043f7de037SJosef Bacik ); 12053f7de037SJosef Bacik 12063f7de037SJosef Bacik TRACE_EVENT(btrfs_setup_cluster, 12073f7de037SJosef Bacik 12089a35b637SJeff Mahoney TP_PROTO(const struct btrfs_block_group_cache *block_group, 12099a35b637SJeff Mahoney const struct btrfs_free_cluster *cluster, 12109a35b637SJeff Mahoney u64 size, int bitmap), 12113f7de037SJosef Bacik 12123f7de037SJosef Bacik TP_ARGS(block_group, cluster, size, bitmap), 12133f7de037SJosef Bacik 1214bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 12153f7de037SJosef Bacik __field( u64, bg_objectid ) 12163f7de037SJosef Bacik __field( u64, flags ) 12173f7de037SJosef Bacik __field( u64, start ) 12183f7de037SJosef Bacik __field( u64, max_size ) 12193f7de037SJosef Bacik __field( u64, size ) 12203f7de037SJosef Bacik __field( int, bitmap ) 12213f7de037SJosef Bacik ), 12223f7de037SJosef Bacik 1223bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 12243f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 12253f7de037SJosef Bacik __entry->flags = block_group->flags; 12263f7de037SJosef Bacik __entry->start = cluster->window_start; 12273f7de037SJosef Bacik __entry->max_size = cluster->max_size; 12283f7de037SJosef Bacik __entry->size = size; 12293f7de037SJosef Bacik __entry->bitmap = bitmap; 12303f7de037SJosef Bacik ), 12313f7de037SJosef Bacik 1232562a7a07SDavid Sterba TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) window_start=%Lu " 1233562a7a07SDavid Sterba "size=%Lu max_size=%Lu bitmap=%d", 12343f7de037SJosef Bacik __entry->bg_objectid, 12353f7de037SJosef Bacik __entry->flags, 12363f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 12373f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 12383f7de037SJosef Bacik __entry->size, __entry->max_size, __entry->bitmap) 12393f7de037SJosef Bacik ); 12403f7de037SJosef Bacik 1241143bede5SJeff Mahoney struct extent_state; 1242143bede5SJeff Mahoney TRACE_EVENT(alloc_extent_state, 1243143bede5SJeff Mahoney 12449a35b637SJeff Mahoney TP_PROTO(const struct extent_state *state, 12459a35b637SJeff Mahoney gfp_t mask, unsigned long IP), 1246143bede5SJeff Mahoney 1247143bede5SJeff Mahoney TP_ARGS(state, mask, IP), 1248143bede5SJeff Mahoney 1249143bede5SJeff Mahoney TP_STRUCT__entry( 12509a35b637SJeff Mahoney __field(const struct extent_state *, state) 1251143bede5SJeff Mahoney __field(gfp_t, mask) 1252143bede5SJeff Mahoney __field(unsigned long, ip) 1253143bede5SJeff Mahoney ), 1254143bede5SJeff Mahoney 1255143bede5SJeff Mahoney TP_fast_assign( 1256143bede5SJeff Mahoney __entry->state = state, 1257143bede5SJeff Mahoney __entry->mask = mask, 1258143bede5SJeff Mahoney __entry->ip = IP 1259143bede5SJeff Mahoney ), 1260143bede5SJeff Mahoney 1261562a7a07SDavid Sterba TP_printk("state=%p mask=%s caller=%pS", __entry->state, 12629a35b637SJeff Mahoney show_gfp_flags(__entry->mask), (const void *)__entry->ip) 1263143bede5SJeff Mahoney ); 1264143bede5SJeff Mahoney 1265143bede5SJeff Mahoney TRACE_EVENT(free_extent_state, 1266143bede5SJeff Mahoney 12679a35b637SJeff Mahoney TP_PROTO(const struct extent_state *state, unsigned long IP), 1268143bede5SJeff Mahoney 1269143bede5SJeff Mahoney TP_ARGS(state, IP), 1270143bede5SJeff Mahoney 1271143bede5SJeff Mahoney TP_STRUCT__entry( 12729a35b637SJeff Mahoney __field(const struct extent_state *, state) 1273143bede5SJeff Mahoney __field(unsigned long, ip) 1274143bede5SJeff Mahoney ), 1275143bede5SJeff Mahoney 1276143bede5SJeff Mahoney TP_fast_assign( 1277143bede5SJeff Mahoney __entry->state = state, 1278143bede5SJeff Mahoney __entry->ip = IP 1279143bede5SJeff Mahoney ), 1280143bede5SJeff Mahoney 1281562a7a07SDavid Sterba TP_printk("state=%p caller=%pS", __entry->state, 12829a35b637SJeff Mahoney (const void *)__entry->ip) 1283143bede5SJeff Mahoney ); 1284143bede5SJeff Mahoney 128552483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work, 128652483bc2SQu Wenruo 12879a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 128852483bc2SQu Wenruo 128952483bc2SQu Wenruo TP_ARGS(work), 129052483bc2SQu Wenruo 1291bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 12929a35b637SJeff Mahoney __field( const void *, work ) 12939a35b637SJeff Mahoney __field( const void *, wq ) 12949a35b637SJeff Mahoney __field( const void *, func ) 12959a35b637SJeff Mahoney __field( const void *, ordered_func ) 12969a35b637SJeff Mahoney __field( const void *, ordered_free ) 12979a35b637SJeff Mahoney __field( const void *, normal_work ) 129852483bc2SQu Wenruo ), 129952483bc2SQu Wenruo 1300bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_work_owner(work), 130152483bc2SQu Wenruo __entry->work = work; 130252483bc2SQu Wenruo __entry->wq = work->wq; 130352483bc2SQu Wenruo __entry->func = work->func; 130452483bc2SQu Wenruo __entry->ordered_func = work->ordered_func; 130552483bc2SQu Wenruo __entry->ordered_free = work->ordered_free; 1306b38a6258SLiu Bo __entry->normal_work = &work->normal_work; 130752483bc2SQu Wenruo ), 130852483bc2SQu Wenruo 1309562a7a07SDavid Sterba TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%pf ordered_func=%p " 1310b38a6258SLiu Bo "ordered_free=%p", 1311b38a6258SLiu Bo __entry->work, __entry->normal_work, __entry->wq, 1312b38a6258SLiu Bo __entry->func, __entry->ordered_func, __entry->ordered_free) 131352483bc2SQu Wenruo ); 131452483bc2SQu Wenruo 1315ac0c7cf8SDavid Sterba /* 1316ac0c7cf8SDavid Sterba * For situiations when the work is freed, we pass fs_info and a tag that that 1317ac0c7cf8SDavid Sterba * matches address of the work structure so it can be paired with the 1318ac0c7cf8SDavid Sterba * scheduling event. 1319ac0c7cf8SDavid Sterba */ 132052483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work__done, 132152483bc2SQu Wenruo 13229a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), 132352483bc2SQu Wenruo 1324ac0c7cf8SDavid Sterba TP_ARGS(fs_info, wtag), 132552483bc2SQu Wenruo 1326bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 13279a35b637SJeff Mahoney __field( const void *, wtag ) 132852483bc2SQu Wenruo ), 132952483bc2SQu Wenruo 1330ac0c7cf8SDavid Sterba TP_fast_assign_btrfs(fs_info, 1331ac0c7cf8SDavid Sterba __entry->wtag = wtag; 133252483bc2SQu Wenruo ), 133352483bc2SQu Wenruo 1334ac0c7cf8SDavid Sterba TP_printk_btrfs("work->%p", __entry->wtag) 133552483bc2SQu Wenruo ); 133652483bc2SQu Wenruo 133752483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_queued, 133852483bc2SQu Wenruo 13399a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 134052483bc2SQu Wenruo 134152483bc2SQu Wenruo TP_ARGS(work) 134252483bc2SQu Wenruo ); 134352483bc2SQu Wenruo 134452483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_sched, 134552483bc2SQu Wenruo 13469a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 134752483bc2SQu Wenruo 134852483bc2SQu Wenruo TP_ARGS(work) 134952483bc2SQu Wenruo ); 135052483bc2SQu Wenruo 135152483bc2SQu Wenruo DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, 135252483bc2SQu Wenruo 13539a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), 135452483bc2SQu Wenruo 1355ac0c7cf8SDavid Sterba TP_ARGS(fs_info, wtag) 135652483bc2SQu Wenruo ); 135752483bc2SQu Wenruo 135852483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_ordered_sched, 135952483bc2SQu Wenruo 13609a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 136152483bc2SQu Wenruo 136252483bc2SQu Wenruo TP_ARGS(work) 136352483bc2SQu Wenruo ); 136452483bc2SQu Wenruo 1365c3a46891SQu Wenruo DECLARE_EVENT_CLASS(btrfs__workqueue, 1366c3a46891SQu Wenruo 13679a35b637SJeff Mahoney TP_PROTO(const struct __btrfs_workqueue *wq, 13689a35b637SJeff Mahoney const char *name, int high), 1369c3a46891SQu Wenruo 1370c3a46891SQu Wenruo TP_ARGS(wq, name, high), 1371c3a46891SQu Wenruo 1372bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 13739a35b637SJeff Mahoney __field( const void *, wq ) 1374c3a46891SQu Wenruo __string( name, name ) 1375c3a46891SQu Wenruo __field( int , high ) 1376c3a46891SQu Wenruo ), 1377c3a46891SQu Wenruo 1378bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1379c3a46891SQu Wenruo __entry->wq = wq; 1380c3a46891SQu Wenruo __assign_str(name, name); 1381c3a46891SQu Wenruo __entry->high = high; 1382c3a46891SQu Wenruo ), 1383c3a46891SQu Wenruo 1384562a7a07SDavid Sterba TP_printk_btrfs("name=%s%s wq=%p", __get_str(name), 1385c3a46891SQu Wenruo __print_flags(__entry->high, "", 1386c3a46891SQu Wenruo {(WQ_HIGHPRI), "-high"}), 1387c3a46891SQu Wenruo __entry->wq) 1388c3a46891SQu Wenruo ); 1389c3a46891SQu Wenruo 1390c3a46891SQu Wenruo DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc, 1391c3a46891SQu Wenruo 13929a35b637SJeff Mahoney TP_PROTO(const struct __btrfs_workqueue *wq, 13939a35b637SJeff Mahoney const char *name, int high), 1394c3a46891SQu Wenruo 1395c3a46891SQu Wenruo TP_ARGS(wq, name, high) 1396c3a46891SQu Wenruo ); 1397c3a46891SQu Wenruo 1398c3a46891SQu Wenruo DECLARE_EVENT_CLASS(btrfs__workqueue_done, 1399c3a46891SQu Wenruo 14009a35b637SJeff Mahoney TP_PROTO(const struct __btrfs_workqueue *wq), 1401c3a46891SQu Wenruo 1402c3a46891SQu Wenruo TP_ARGS(wq), 1403c3a46891SQu Wenruo 1404bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 14059a35b637SJeff Mahoney __field( const void *, wq ) 1406c3a46891SQu Wenruo ), 1407c3a46891SQu Wenruo 1408bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1409c3a46891SQu Wenruo __entry->wq = wq; 1410c3a46891SQu Wenruo ), 1411c3a46891SQu Wenruo 1412bc074524SJeff Mahoney TP_printk_btrfs("wq=%p", __entry->wq) 1413c3a46891SQu Wenruo ); 1414c3a46891SQu Wenruo 1415c3a46891SQu Wenruo DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy, 1416c3a46891SQu Wenruo 14179a35b637SJeff Mahoney TP_PROTO(const struct __btrfs_workqueue *wq), 1418c3a46891SQu Wenruo 1419c3a46891SQu Wenruo TP_ARGS(wq) 1420c3a46891SQu Wenruo ); 142152483bc2SQu Wenruo 142281fb6f77SQu Wenruo #define BTRFS_QGROUP_OPERATIONS \ 142381fb6f77SQu Wenruo { QGROUP_RESERVE, "reserve" }, \ 142481fb6f77SQu Wenruo { QGROUP_RELEASE, "release" }, \ 142581fb6f77SQu Wenruo { QGROUP_FREE, "free" } 142681fb6f77SQu Wenruo 142781fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, 142881fb6f77SQu Wenruo 14299a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 14309a35b637SJeff Mahoney u64 reserved, int op), 143181fb6f77SQu Wenruo 143281fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op), 143381fb6f77SQu Wenruo 1434bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 143581fb6f77SQu Wenruo __field( u64, rootid ) 143681fb6f77SQu Wenruo __field( unsigned long, ino ) 143781fb6f77SQu Wenruo __field( u64, start ) 143881fb6f77SQu Wenruo __field( u64, len ) 143981fb6f77SQu Wenruo __field( u64, reserved ) 144081fb6f77SQu Wenruo __field( int, op ) 144181fb6f77SQu Wenruo ), 144281fb6f77SQu Wenruo 1443bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 144481fb6f77SQu Wenruo __entry->rootid = BTRFS_I(inode)->root->objectid; 144581fb6f77SQu Wenruo __entry->ino = inode->i_ino; 144681fb6f77SQu Wenruo __entry->start = start; 144781fb6f77SQu Wenruo __entry->len = len; 144881fb6f77SQu Wenruo __entry->reserved = reserved; 144981fb6f77SQu Wenruo __entry->op = op; 145081fb6f77SQu Wenruo ), 145181fb6f77SQu Wenruo 1452562a7a07SDavid Sterba TP_printk_btrfs("root=%llu ino=%lu start=%llu len=%llu reserved=%llu op=%s", 145381fb6f77SQu Wenruo __entry->rootid, __entry->ino, __entry->start, __entry->len, 145481fb6f77SQu Wenruo __entry->reserved, 145581fb6f77SQu Wenruo __print_flags((unsigned long)__entry->op, "", 145681fb6f77SQu Wenruo BTRFS_QGROUP_OPERATIONS) 145781fb6f77SQu Wenruo ) 145881fb6f77SQu Wenruo ); 145981fb6f77SQu Wenruo 146081fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data, 146181fb6f77SQu Wenruo 14629a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 14639a35b637SJeff Mahoney u64 reserved, int op), 146481fb6f77SQu Wenruo 146581fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 146681fb6f77SQu Wenruo ); 146781fb6f77SQu Wenruo 146881fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data, 146981fb6f77SQu Wenruo 14709a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 14719a35b637SJeff Mahoney u64 reserved, int op), 147281fb6f77SQu Wenruo 147381fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 147481fb6f77SQu Wenruo ); 147581fb6f77SQu Wenruo 147681fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref, 147781fb6f77SQu Wenruo 14789a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 14799a35b637SJeff Mahoney u64 ref_root, u64 reserved), 148081fb6f77SQu Wenruo 1481bc074524SJeff Mahoney TP_ARGS(fs_info, ref_root, reserved), 148281fb6f77SQu Wenruo 1483bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 148481fb6f77SQu Wenruo __field( u64, ref_root ) 148581fb6f77SQu Wenruo __field( u64, reserved ) 148681fb6f77SQu Wenruo ), 148781fb6f77SQu Wenruo 1488bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 148981fb6f77SQu Wenruo __entry->ref_root = ref_root; 149081fb6f77SQu Wenruo __entry->reserved = reserved; 149181fb6f77SQu Wenruo ), 149281fb6f77SQu Wenruo 1493562a7a07SDavid Sterba TP_printk_btrfs("root=%llu reserved=%llu op=free", 149481fb6f77SQu Wenruo __entry->ref_root, __entry->reserved) 149581fb6f77SQu Wenruo ); 149681fb6f77SQu Wenruo 149781fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref, 149881fb6f77SQu Wenruo 14999a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 15009a35b637SJeff Mahoney u64 ref_root, u64 reserved), 150181fb6f77SQu Wenruo 1502bc074524SJeff Mahoney TP_ARGS(fs_info, ref_root, reserved) 150381fb6f77SQu Wenruo ); 15040f5dcf8dSMark Fasheh 15050f5dcf8dSMark Fasheh DECLARE_EVENT_CLASS(btrfs_qgroup_extent, 15069a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 15079a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 15080f5dcf8dSMark Fasheh 1509bc074524SJeff Mahoney TP_ARGS(fs_info, rec), 15100f5dcf8dSMark Fasheh 1511bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15120f5dcf8dSMark Fasheh __field( u64, bytenr ) 15130f5dcf8dSMark Fasheh __field( u64, num_bytes ) 15140f5dcf8dSMark Fasheh ), 15150f5dcf8dSMark Fasheh 1516bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 15170f5dcf8dSMark Fasheh __entry->bytenr = rec->bytenr, 15180f5dcf8dSMark Fasheh __entry->num_bytes = rec->num_bytes; 15190f5dcf8dSMark Fasheh ), 15200f5dcf8dSMark Fasheh 1521562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu", 15220f5dcf8dSMark Fasheh (unsigned long long)__entry->bytenr, 15230f5dcf8dSMark Fasheh (unsigned long long)__entry->num_bytes) 15240f5dcf8dSMark Fasheh ); 15250f5dcf8dSMark Fasheh 15260f5dcf8dSMark Fasheh DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, 15270f5dcf8dSMark Fasheh 15289a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 15299a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 15300f5dcf8dSMark Fasheh 1531bc074524SJeff Mahoney TP_ARGS(fs_info, rec) 15320f5dcf8dSMark Fasheh ); 15330f5dcf8dSMark Fasheh 153450b3e040SQu Wenruo DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent, 15350f5dcf8dSMark Fasheh 15369a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 15379a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 15380f5dcf8dSMark Fasheh 1539bc074524SJeff Mahoney TP_ARGS(fs_info, rec) 15400f5dcf8dSMark Fasheh ); 15410f5dcf8dSMark Fasheh 15420f5dcf8dSMark Fasheh TRACE_EVENT(btrfs_qgroup_account_extent, 15430f5dcf8dSMark Fasheh 15449a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 bytenr, 1545bc074524SJeff Mahoney u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), 15460f5dcf8dSMark Fasheh 1547bc074524SJeff Mahoney TP_ARGS(fs_info, bytenr, num_bytes, nr_old_roots, nr_new_roots), 15480f5dcf8dSMark Fasheh 1549bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15500f5dcf8dSMark Fasheh __field( u64, bytenr ) 15510f5dcf8dSMark Fasheh __field( u64, num_bytes ) 15520f5dcf8dSMark Fasheh __field( u64, nr_old_roots ) 15530f5dcf8dSMark Fasheh __field( u64, nr_new_roots ) 15540f5dcf8dSMark Fasheh ), 15550f5dcf8dSMark Fasheh 1556bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 15570f5dcf8dSMark Fasheh __entry->bytenr = bytenr; 15580f5dcf8dSMark Fasheh __entry->num_bytes = num_bytes; 15590f5dcf8dSMark Fasheh __entry->nr_old_roots = nr_old_roots; 15600f5dcf8dSMark Fasheh __entry->nr_new_roots = nr_new_roots; 15610f5dcf8dSMark Fasheh ), 15620f5dcf8dSMark Fasheh 1563562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu nr_old_roots=%llu " 15640f5dcf8dSMark Fasheh "nr_new_roots=%llu", 15650f5dcf8dSMark Fasheh __entry->bytenr, 15660f5dcf8dSMark Fasheh __entry->num_bytes, 15670f5dcf8dSMark Fasheh __entry->nr_old_roots, 15680f5dcf8dSMark Fasheh __entry->nr_new_roots) 15690f5dcf8dSMark Fasheh ); 15700f5dcf8dSMark Fasheh 15710f5dcf8dSMark Fasheh TRACE_EVENT(qgroup_update_counters, 15720f5dcf8dSMark Fasheh 15739a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 qgid, 1574bc074524SJeff Mahoney u64 cur_old_count, u64 cur_new_count), 15750f5dcf8dSMark Fasheh 1576bc074524SJeff Mahoney TP_ARGS(fs_info, qgid, cur_old_count, cur_new_count), 15770f5dcf8dSMark Fasheh 1578bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15790f5dcf8dSMark Fasheh __field( u64, qgid ) 15800f5dcf8dSMark Fasheh __field( u64, cur_old_count ) 15810f5dcf8dSMark Fasheh __field( u64, cur_new_count ) 15820f5dcf8dSMark Fasheh ), 15830f5dcf8dSMark Fasheh 1584bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 15850f5dcf8dSMark Fasheh __entry->qgid = qgid; 15860f5dcf8dSMark Fasheh __entry->cur_old_count = cur_old_count; 15870f5dcf8dSMark Fasheh __entry->cur_new_count = cur_new_count; 15880f5dcf8dSMark Fasheh ), 15890f5dcf8dSMark Fasheh 1590562a7a07SDavid Sterba TP_printk_btrfs("qgid=%llu cur_old_count=%llu cur_new_count=%llu", 15910f5dcf8dSMark Fasheh __entry->qgid, 15920f5dcf8dSMark Fasheh __entry->cur_old_count, 15930f5dcf8dSMark Fasheh __entry->cur_new_count) 15940f5dcf8dSMark Fasheh ); 15950f5dcf8dSMark Fasheh 15963159fe7bSQu Wenruo TRACE_EVENT(qgroup_update_reserve, 15973159fe7bSQu Wenruo 15983159fe7bSQu Wenruo TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup, 15993159fe7bSQu Wenruo s64 diff), 16003159fe7bSQu Wenruo 16013159fe7bSQu Wenruo TP_ARGS(fs_info, qgroup, diff), 16023159fe7bSQu Wenruo 16033159fe7bSQu Wenruo TP_STRUCT__entry_btrfs( 16043159fe7bSQu Wenruo __field( u64, qgid ) 16053159fe7bSQu Wenruo __field( u64, cur_reserved ) 16063159fe7bSQu Wenruo __field( s64, diff ) 16073159fe7bSQu Wenruo ), 16083159fe7bSQu Wenruo 16093159fe7bSQu Wenruo TP_fast_assign_btrfs(fs_info, 16103159fe7bSQu Wenruo __entry->qgid = qgroup->qgroupid; 16113159fe7bSQu Wenruo __entry->cur_reserved = qgroup->reserved; 16123159fe7bSQu Wenruo __entry->diff = diff; 16133159fe7bSQu Wenruo ), 16143159fe7bSQu Wenruo 16153159fe7bSQu Wenruo TP_printk_btrfs("qgid=%llu cur_reserved=%llu diff=%lld", 16163159fe7bSQu Wenruo __entry->qgid, __entry->cur_reserved, __entry->diff) 16173159fe7bSQu Wenruo ); 16183159fe7bSQu Wenruo 16193159fe7bSQu Wenruo TRACE_EVENT(qgroup_meta_reserve, 16203159fe7bSQu Wenruo 16213159fe7bSQu Wenruo TP_PROTO(struct btrfs_root *root, s64 diff), 16223159fe7bSQu Wenruo 16233159fe7bSQu Wenruo TP_ARGS(root, diff), 16243159fe7bSQu Wenruo 16253159fe7bSQu Wenruo TP_STRUCT__entry_btrfs( 16263159fe7bSQu Wenruo __field( u64, refroot ) 16273159fe7bSQu Wenruo __field( s64, diff ) 16283159fe7bSQu Wenruo ), 16293159fe7bSQu Wenruo 16303159fe7bSQu Wenruo TP_fast_assign_btrfs(root->fs_info, 16313159fe7bSQu Wenruo __entry->refroot = root->objectid; 16323159fe7bSQu Wenruo __entry->diff = diff; 16333159fe7bSQu Wenruo ), 16343159fe7bSQu Wenruo 16353159fe7bSQu Wenruo TP_printk_btrfs("refroot=%llu(%s) diff=%lld", 16363159fe7bSQu Wenruo show_root_type(__entry->refroot), __entry->diff) 16373159fe7bSQu Wenruo ); 16383159fe7bSQu Wenruo 16391abe9b8aSliubo #endif /* _TRACE_BTRFS_H */ 16401abe9b8aSliubo 16411abe9b8aSliubo /* This part must be outside protection */ 16421abe9b8aSliubo #include <trace/define_trace.h> 1643