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; 2900142756SJeff Mahoney struct prelim_ref; 301abe9b8aSliubo 31012e513eSAnand Jain TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS_NR); 32012e513eSAnand Jain TRACE_DEFINE_ENUM(FLUSH_DELAYED_ITEMS); 33012e513eSAnand Jain TRACE_DEFINE_ENUM(FLUSH_DELALLOC); 34012e513eSAnand Jain TRACE_DEFINE_ENUM(FLUSH_DELALLOC_WAIT); 35012e513eSAnand Jain TRACE_DEFINE_ENUM(ALLOC_CHUNK); 36012e513eSAnand Jain TRACE_DEFINE_ENUM(COMMIT_TRANS); 37012e513eSAnand Jain 381abe9b8aSliubo #define show_ref_type(type) \ 391abe9b8aSliubo __print_symbolic(type, \ 401abe9b8aSliubo { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ 411abe9b8aSliubo { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ 421abe9b8aSliubo { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ 431abe9b8aSliubo { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ 441abe9b8aSliubo { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) 451abe9b8aSliubo 461abe9b8aSliubo #define __show_root_type(obj) \ 477f34b746Sliubo __print_symbolic_u64(obj, \ 481abe9b8aSliubo { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ 491abe9b8aSliubo { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ 501abe9b8aSliubo { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ 511abe9b8aSliubo { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ 521abe9b8aSliubo { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ 531abe9b8aSliubo { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ 541abe9b8aSliubo { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ 551abe9b8aSliubo { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ 56e112e2b4SLiu Bo { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ 571abe9b8aSliubo { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ 58208acb8cSOmar Sandoval { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \ 59208acb8cSOmar Sandoval { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \ 601abe9b8aSliubo { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) 611abe9b8aSliubo 621abe9b8aSliubo #define show_root_type(obj) \ 631abe9b8aSliubo obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ 64fb57dc81SLiu Bo (obj >= BTRFS_ROOT_TREE_OBJECTID && \ 65e112e2b4SLiu Bo obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" 661abe9b8aSliubo 6709ed2f16SLiu Bo #define show_fi_type(type) \ 6809ed2f16SLiu Bo __print_symbolic(type, \ 6909ed2f16SLiu Bo { BTRFS_FILE_EXTENT_INLINE, "INLINE" }, \ 7009ed2f16SLiu Bo { BTRFS_FILE_EXTENT_REG, "REG" }, \ 7109ed2f16SLiu Bo { BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC"}) 7209ed2f16SLiu Bo 733f7de037SJosef Bacik #define BTRFS_GROUP_FLAGS \ 743f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ 753f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 763f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 773f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ 783f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ 793f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ 80e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 81e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ 82e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} 833f7de037SJosef Bacik 84b94417eaSAnand Jain #define BTRFS_FSID_SIZE 16 85b94417eaSAnand Jain #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE) 86bc074524SJeff Mahoney 87bc074524SJeff Mahoney #define TP_fast_assign_fsid(fs_info) \ 88b94417eaSAnand Jain memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE) 89bc074524SJeff Mahoney 90bc074524SJeff Mahoney #define TP_STRUCT__entry_btrfs(args...) \ 91bc074524SJeff Mahoney TP_STRUCT__entry( \ 92bc074524SJeff Mahoney TP_STRUCT__entry_fsid \ 93bc074524SJeff Mahoney args) 94bc074524SJeff Mahoney #define TP_fast_assign_btrfs(fs_info, args...) \ 95bc074524SJeff Mahoney TP_fast_assign( \ 96bc074524SJeff Mahoney TP_fast_assign_fsid(fs_info); \ 97bc074524SJeff Mahoney args) 98bc074524SJeff Mahoney #define TP_printk_btrfs(fmt, args...) \ 99bc074524SJeff Mahoney TP_printk("%pU: " fmt, __entry->fsid, args) 1008c2a3ca2SJosef Bacik 1011abe9b8aSliubo TRACE_EVENT(btrfs_transaction_commit, 1021abe9b8aSliubo 1039a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root), 1041abe9b8aSliubo 1051abe9b8aSliubo TP_ARGS(root), 1061abe9b8aSliubo 107bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1081abe9b8aSliubo __field( u64, generation ) 1091abe9b8aSliubo __field( u64, root_objectid ) 1101abe9b8aSliubo ), 1111abe9b8aSliubo 112bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 1131abe9b8aSliubo __entry->generation = root->fs_info->generation; 1141abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 1151abe9b8aSliubo ), 1161abe9b8aSliubo 117bc074524SJeff Mahoney TP_printk_btrfs("root = %llu(%s), gen = %llu", 1181abe9b8aSliubo show_root_type(__entry->root_objectid), 1191abe9b8aSliubo (unsigned long long)__entry->generation) 1201abe9b8aSliubo ); 1211abe9b8aSliubo 1221abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__inode, 1231abe9b8aSliubo 1249a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 1251abe9b8aSliubo 1261abe9b8aSliubo TP_ARGS(inode), 1271abe9b8aSliubo 128bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 1291abe9b8aSliubo __field( ino_t, ino ) 1301abe9b8aSliubo __field( blkcnt_t, blocks ) 1311abe9b8aSliubo __field( u64, disk_i_size ) 1321abe9b8aSliubo __field( u64, generation ) 1331abe9b8aSliubo __field( u64, last_trans ) 1341abe9b8aSliubo __field( u64, logged_trans ) 1351abe9b8aSliubo __field( u64, root_objectid ) 1361abe9b8aSliubo ), 1371abe9b8aSliubo 138bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 1391abe9b8aSliubo __entry->ino = inode->i_ino; 1401abe9b8aSliubo __entry->blocks = inode->i_blocks; 1411abe9b8aSliubo __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; 1421abe9b8aSliubo __entry->generation = BTRFS_I(inode)->generation; 1431abe9b8aSliubo __entry->last_trans = BTRFS_I(inode)->last_trans; 1441abe9b8aSliubo __entry->logged_trans = BTRFS_I(inode)->logged_trans; 1451abe9b8aSliubo __entry->root_objectid = 1461abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 1471abe9b8aSliubo ), 1481abe9b8aSliubo 149562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%lu blocks=%llu " 150562a7a07SDavid Sterba "disk_i_size=%llu last_trans=%llu logged_trans=%llu", 1511abe9b8aSliubo show_root_type(__entry->root_objectid), 1521abe9b8aSliubo (unsigned long long)__entry->generation, 1531abe9b8aSliubo (unsigned long)__entry->ino, 1541abe9b8aSliubo (unsigned long long)__entry->blocks, 1551abe9b8aSliubo (unsigned long long)__entry->disk_i_size, 1561abe9b8aSliubo (unsigned long long)__entry->last_trans, 1571abe9b8aSliubo (unsigned long long)__entry->logged_trans) 1581abe9b8aSliubo ); 1591abe9b8aSliubo 1601abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_new, 1611abe9b8aSliubo 1629a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 1631abe9b8aSliubo 1641abe9b8aSliubo TP_ARGS(inode) 1651abe9b8aSliubo ); 1661abe9b8aSliubo 1671abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_request, 1681abe9b8aSliubo 1699a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 1701abe9b8aSliubo 1711abe9b8aSliubo TP_ARGS(inode) 1721abe9b8aSliubo ); 1731abe9b8aSliubo 1741abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, 1751abe9b8aSliubo 1769a35b637SJeff Mahoney TP_PROTO(const struct inode *inode), 1771abe9b8aSliubo 1781abe9b8aSliubo TP_ARGS(inode) 1791abe9b8aSliubo ); 1801abe9b8aSliubo 1811abe9b8aSliubo #define __show_map_type(type) \ 1827f34b746Sliubo __print_symbolic_u64(type, \ 1831abe9b8aSliubo { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ 1841abe9b8aSliubo { EXTENT_MAP_HOLE, "HOLE" }, \ 1851abe9b8aSliubo { EXTENT_MAP_INLINE, "INLINE" }, \ 1861abe9b8aSliubo { EXTENT_MAP_DELALLOC, "DELALLOC" }) 1871abe9b8aSliubo 1881abe9b8aSliubo #define show_map_type(type) \ 1891abe9b8aSliubo type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) 1901abe9b8aSliubo 1911abe9b8aSliubo #define show_map_flags(flag) \ 1921abe9b8aSliubo __print_flags(flag, "|", \ 193254a2d14SLiu Bo { (1 << EXTENT_FLAG_PINNED), "PINNED" },\ 194254a2d14SLiu Bo { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\ 195254a2d14SLiu Bo { (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\ 196254a2d14SLiu Bo { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\ 197254a2d14SLiu Bo { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\ 198254a2d14SLiu Bo { (1 << EXTENT_FLAG_FILLING), "FILLING" },\ 199254a2d14SLiu Bo { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" }) 2001abe9b8aSliubo 2014cd8587cSSteven Rostedt TRACE_EVENT_CONDITION(btrfs_get_extent, 2021abe9b8aSliubo 2039a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode, 2049a35b637SJeff Mahoney const struct extent_map *map), 2051abe9b8aSliubo 20692a1bf76SLiu Bo TP_ARGS(root, inode, map), 2071abe9b8aSliubo 2084cd8587cSSteven Rostedt TP_CONDITION(map), 2094cd8587cSSteven Rostedt 210bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 2111abe9b8aSliubo __field( u64, root_objectid ) 21292a1bf76SLiu Bo __field( u64, ino ) 2131abe9b8aSliubo __field( u64, start ) 2141abe9b8aSliubo __field( u64, len ) 2151abe9b8aSliubo __field( u64, orig_start ) 2161abe9b8aSliubo __field( u64, block_start ) 2171abe9b8aSliubo __field( u64, block_len ) 2181abe9b8aSliubo __field( unsigned long, flags ) 2191abe9b8aSliubo __field( int, refs ) 2201abe9b8aSliubo __field( unsigned int, compress_type ) 2211abe9b8aSliubo ), 2221abe9b8aSliubo 223bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 2241abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 22592a1bf76SLiu Bo __entry->ino = btrfs_ino(inode); 2261abe9b8aSliubo __entry->start = map->start; 2271abe9b8aSliubo __entry->len = map->len; 2281abe9b8aSliubo __entry->orig_start = map->orig_start; 2291abe9b8aSliubo __entry->block_start = map->block_start; 2301abe9b8aSliubo __entry->block_len = map->block_len; 2311abe9b8aSliubo __entry->flags = map->flags; 232490b54d6SElena Reshetova __entry->refs = refcount_read(&map->refs); 2331abe9b8aSliubo __entry->compress_type = map->compress_type; 2341abe9b8aSliubo ), 2351abe9b8aSliubo 236562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu " 237562a7a07SDavid Sterba "orig_start=%llu block_start=%llu(%s) " 238562a7a07SDavid Sterba "block_len=%llu flags=%s refs=%u " 2391abe9b8aSliubo "compress_type=%u", 2401abe9b8aSliubo show_root_type(__entry->root_objectid), 24192a1bf76SLiu Bo (unsigned long long)__entry->ino, 2421abe9b8aSliubo (unsigned long long)__entry->start, 2431abe9b8aSliubo (unsigned long long)__entry->len, 2441abe9b8aSliubo (unsigned long long)__entry->orig_start, 2451abe9b8aSliubo show_map_type(__entry->block_start), 2461abe9b8aSliubo (unsigned long long)__entry->block_len, 2471abe9b8aSliubo show_map_flags(__entry->flags), 2481abe9b8aSliubo __entry->refs, __entry->compress_type) 2491abe9b8aSliubo ); 2501abe9b8aSliubo 25109ed2f16SLiu Bo /* file extent item */ 25209ed2f16SLiu Bo DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular, 25309ed2f16SLiu Bo 25409ed2f16SLiu Bo TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, 25509ed2f16SLiu Bo struct btrfs_file_extent_item *fi, u64 start), 25609ed2f16SLiu Bo 25709ed2f16SLiu Bo TP_ARGS(bi, l, fi, start), 25809ed2f16SLiu Bo 25909ed2f16SLiu Bo TP_STRUCT__entry_btrfs( 26009ed2f16SLiu Bo __field( u64, root_obj ) 26109ed2f16SLiu Bo __field( u64, ino ) 26209ed2f16SLiu Bo __field( loff_t, isize ) 26309ed2f16SLiu Bo __field( u64, disk_isize ) 26409ed2f16SLiu Bo __field( u64, num_bytes ) 26509ed2f16SLiu Bo __field( u64, ram_bytes ) 26609ed2f16SLiu Bo __field( u64, disk_bytenr ) 26709ed2f16SLiu Bo __field( u64, disk_num_bytes ) 26809ed2f16SLiu Bo __field( u64, extent_offset ) 26909ed2f16SLiu Bo __field( u8, extent_type ) 27009ed2f16SLiu Bo __field( u8, compression ) 27109ed2f16SLiu Bo __field( u64, extent_start ) 27209ed2f16SLiu Bo __field( u64, extent_end ) 27309ed2f16SLiu Bo ), 27409ed2f16SLiu Bo 27509ed2f16SLiu Bo TP_fast_assign_btrfs(bi->root->fs_info, 27609ed2f16SLiu Bo __entry->root_obj = bi->root->objectid; 27709ed2f16SLiu Bo __entry->ino = btrfs_ino(bi); 27809ed2f16SLiu Bo __entry->isize = bi->vfs_inode.i_size; 27909ed2f16SLiu Bo __entry->disk_isize = bi->disk_i_size; 28009ed2f16SLiu Bo __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi); 28109ed2f16SLiu Bo __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi); 28209ed2f16SLiu Bo __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi); 28309ed2f16SLiu Bo __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi); 28409ed2f16SLiu Bo __entry->extent_offset = btrfs_file_extent_offset(l, fi); 28509ed2f16SLiu Bo __entry->extent_type = btrfs_file_extent_type(l, fi); 28609ed2f16SLiu Bo __entry->compression = btrfs_file_extent_compression(l, fi); 28709ed2f16SLiu Bo __entry->extent_start = start; 28809ed2f16SLiu Bo __entry->extent_end = (start + __entry->num_bytes); 28909ed2f16SLiu Bo ), 29009ed2f16SLiu Bo 29109ed2f16SLiu Bo TP_printk_btrfs( 29209ed2f16SLiu Bo "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " 29309ed2f16SLiu Bo "file extent range=[%llu %llu] " 29409ed2f16SLiu Bo "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu " 29509ed2f16SLiu Bo "disk_num_bytes=%llu extent_offset=%llu type=%s " 29609ed2f16SLiu Bo "compression=%u", 29709ed2f16SLiu Bo show_root_type(__entry->root_obj), __entry->ino, 29809ed2f16SLiu Bo __entry->isize, 29909ed2f16SLiu Bo __entry->disk_isize, __entry->extent_start, 30009ed2f16SLiu Bo __entry->extent_end, __entry->num_bytes, __entry->ram_bytes, 30109ed2f16SLiu Bo __entry->disk_bytenr, __entry->disk_num_bytes, 30209ed2f16SLiu Bo __entry->extent_offset, show_fi_type(__entry->extent_type), 30309ed2f16SLiu Bo __entry->compression) 30409ed2f16SLiu Bo ); 30509ed2f16SLiu Bo 30609ed2f16SLiu Bo DECLARE_EVENT_CLASS( 30709ed2f16SLiu Bo btrfs__file_extent_item_inline, 30809ed2f16SLiu Bo 30909ed2f16SLiu Bo TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, 31009ed2f16SLiu Bo struct btrfs_file_extent_item *fi, int slot, u64 start), 31109ed2f16SLiu Bo 31209ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start), 31309ed2f16SLiu Bo 31409ed2f16SLiu Bo TP_STRUCT__entry_btrfs( 31509ed2f16SLiu Bo __field( u64, root_obj ) 31609ed2f16SLiu Bo __field( u64, ino ) 31709ed2f16SLiu Bo __field( loff_t, isize ) 31809ed2f16SLiu Bo __field( u64, disk_isize ) 31909ed2f16SLiu Bo __field( u8, extent_type ) 32009ed2f16SLiu Bo __field( u8, compression ) 32109ed2f16SLiu Bo __field( u64, extent_start ) 32209ed2f16SLiu Bo __field( u64, extent_end ) 32309ed2f16SLiu Bo ), 32409ed2f16SLiu Bo 32509ed2f16SLiu Bo TP_fast_assign_btrfs( 32609ed2f16SLiu Bo bi->root->fs_info, 32709ed2f16SLiu Bo __entry->root_obj = bi->root->objectid; 32809ed2f16SLiu Bo __entry->ino = btrfs_ino(bi); 32909ed2f16SLiu Bo __entry->isize = bi->vfs_inode.i_size; 33009ed2f16SLiu Bo __entry->disk_isize = bi->disk_i_size; 33109ed2f16SLiu Bo __entry->extent_type = btrfs_file_extent_type(l, fi); 33209ed2f16SLiu Bo __entry->compression = btrfs_file_extent_compression(l, fi); 33309ed2f16SLiu Bo __entry->extent_start = start; 33409ed2f16SLiu Bo __entry->extent_end = (start + btrfs_file_extent_inline_len(l, slot, fi)); 33509ed2f16SLiu Bo ), 33609ed2f16SLiu Bo 33709ed2f16SLiu Bo TP_printk_btrfs( 33809ed2f16SLiu Bo "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " 33909ed2f16SLiu Bo "file extent range=[%llu %llu] " 34009ed2f16SLiu Bo "extent_type=%s compression=%u", 34109ed2f16SLiu Bo show_root_type(__entry->root_obj), __entry->ino, __entry->isize, 34209ed2f16SLiu Bo __entry->disk_isize, __entry->extent_start, 34309ed2f16SLiu Bo __entry->extent_end, show_fi_type(__entry->extent_type), 34409ed2f16SLiu Bo __entry->compression) 34509ed2f16SLiu Bo ); 34609ed2f16SLiu Bo 34709ed2f16SLiu Bo DEFINE_EVENT( 34809ed2f16SLiu Bo btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular, 34909ed2f16SLiu Bo 35009ed2f16SLiu Bo TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, 35109ed2f16SLiu Bo struct btrfs_file_extent_item *fi, u64 start), 35209ed2f16SLiu Bo 35309ed2f16SLiu Bo TP_ARGS(bi, l, fi, start) 35409ed2f16SLiu Bo ); 35509ed2f16SLiu Bo 35609ed2f16SLiu Bo DEFINE_EVENT( 35709ed2f16SLiu Bo btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular, 35809ed2f16SLiu Bo 35909ed2f16SLiu Bo TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, 36009ed2f16SLiu Bo struct btrfs_file_extent_item *fi, u64 start), 36109ed2f16SLiu Bo 36209ed2f16SLiu Bo TP_ARGS(bi, l, fi, start) 36309ed2f16SLiu Bo ); 36409ed2f16SLiu Bo 36509ed2f16SLiu Bo DEFINE_EVENT( 36609ed2f16SLiu Bo btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline, 36709ed2f16SLiu Bo 36809ed2f16SLiu Bo TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, 36909ed2f16SLiu Bo struct btrfs_file_extent_item *fi, int slot, u64 start), 37009ed2f16SLiu Bo 37109ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start) 37209ed2f16SLiu Bo ); 37309ed2f16SLiu Bo 37409ed2f16SLiu Bo DEFINE_EVENT( 37509ed2f16SLiu Bo btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline, 37609ed2f16SLiu Bo 37709ed2f16SLiu Bo TP_PROTO(struct btrfs_inode *bi, struct extent_buffer *l, 37809ed2f16SLiu Bo struct btrfs_file_extent_item *fi, int slot, u64 start), 37909ed2f16SLiu Bo 38009ed2f16SLiu Bo TP_ARGS(bi, l, fi, slot, start) 38109ed2f16SLiu Bo ); 38209ed2f16SLiu Bo 3831abe9b8aSliubo #define show_ordered_flags(flags) \ 3849d04a8ceSLiu Bo __print_flags(flags, "|", \ 3859d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ 3869d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ 3879d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ 3889d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ 3899d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ 3909d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ 3919d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ 3929d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \ 393792ddef0SLiu Bo { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \ 394792ddef0SLiu Bo { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) 395e112e2b4SLiu Bo 3961abe9b8aSliubo 3971abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__ordered_extent, 3981abe9b8aSliubo 3999a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, 4009a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 4011abe9b8aSliubo 4021abe9b8aSliubo TP_ARGS(inode, ordered), 4031abe9b8aSliubo 404bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 4051abe9b8aSliubo __field( ino_t, ino ) 4061abe9b8aSliubo __field( u64, file_offset ) 4071abe9b8aSliubo __field( u64, start ) 4081abe9b8aSliubo __field( u64, len ) 4091abe9b8aSliubo __field( u64, disk_len ) 4101abe9b8aSliubo __field( u64, bytes_left ) 4111abe9b8aSliubo __field( unsigned long, flags ) 4121abe9b8aSliubo __field( int, compress_type ) 4131abe9b8aSliubo __field( int, refs ) 4141abe9b8aSliubo __field( u64, root_objectid ) 41578566548SLiu Bo __field( u64, truncated_len ) 4161abe9b8aSliubo ), 4171abe9b8aSliubo 418bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 4191abe9b8aSliubo __entry->ino = inode->i_ino; 4201abe9b8aSliubo __entry->file_offset = ordered->file_offset; 4211abe9b8aSliubo __entry->start = ordered->start; 4221abe9b8aSliubo __entry->len = ordered->len; 4231abe9b8aSliubo __entry->disk_len = ordered->disk_len; 4241abe9b8aSliubo __entry->bytes_left = ordered->bytes_left; 4251abe9b8aSliubo __entry->flags = ordered->flags; 4261abe9b8aSliubo __entry->compress_type = ordered->compress_type; 427e76edab7SElena Reshetova __entry->refs = refcount_read(&ordered->refs); 4281abe9b8aSliubo __entry->root_objectid = 4291abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 43078566548SLiu Bo __entry->truncated_len = ordered->truncated_len; 4311abe9b8aSliubo ), 4321abe9b8aSliubo 433562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu " 434562a7a07SDavid Sterba "start=%llu len=%llu disk_len=%llu " 435562a7a07SDavid Sterba "truncated_len=%llu " 436562a7a07SDavid Sterba "bytes_left=%llu flags=%s compress_type=%d " 4371abe9b8aSliubo "refs=%d", 4381abe9b8aSliubo show_root_type(__entry->root_objectid), 4391abe9b8aSliubo (unsigned long long)__entry->ino, 4401abe9b8aSliubo (unsigned long long)__entry->file_offset, 4411abe9b8aSliubo (unsigned long long)__entry->start, 4421abe9b8aSliubo (unsigned long long)__entry->len, 4431abe9b8aSliubo (unsigned long long)__entry->disk_len, 44478566548SLiu Bo (unsigned long long)__entry->truncated_len, 4451abe9b8aSliubo (unsigned long long)__entry->bytes_left, 4461abe9b8aSliubo show_ordered_flags(__entry->flags), 4471abe9b8aSliubo __entry->compress_type, __entry->refs) 4481abe9b8aSliubo ); 4491abe9b8aSliubo 4501abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, 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_remove, 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_start, 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 DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, 4751abe9b8aSliubo 4769a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, 4779a35b637SJeff Mahoney const struct btrfs_ordered_extent *ordered), 4781abe9b8aSliubo 4791abe9b8aSliubo TP_ARGS(inode, ordered) 4801abe9b8aSliubo ); 4811abe9b8aSliubo 4821abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__writepage, 4831abe9b8aSliubo 4849a35b637SJeff Mahoney TP_PROTO(const struct page *page, const struct inode *inode, 4859a35b637SJeff Mahoney const struct writeback_control *wbc), 4861abe9b8aSliubo 4871abe9b8aSliubo TP_ARGS(page, inode, wbc), 4881abe9b8aSliubo 489bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 4901abe9b8aSliubo __field( ino_t, ino ) 4911abe9b8aSliubo __field( pgoff_t, index ) 4921abe9b8aSliubo __field( long, nr_to_write ) 4931abe9b8aSliubo __field( long, pages_skipped ) 4941abe9b8aSliubo __field( loff_t, range_start ) 4951abe9b8aSliubo __field( loff_t, range_end ) 4961abe9b8aSliubo __field( char, for_kupdate ) 4971abe9b8aSliubo __field( char, for_reclaim ) 4981abe9b8aSliubo __field( char, range_cyclic ) 4991abe9b8aSliubo __field( pgoff_t, writeback_index ) 5001abe9b8aSliubo __field( u64, root_objectid ) 5011abe9b8aSliubo ), 5021abe9b8aSliubo 503bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 5041abe9b8aSliubo __entry->ino = inode->i_ino; 5051abe9b8aSliubo __entry->index = page->index; 5061abe9b8aSliubo __entry->nr_to_write = wbc->nr_to_write; 5071abe9b8aSliubo __entry->pages_skipped = wbc->pages_skipped; 5081abe9b8aSliubo __entry->range_start = wbc->range_start; 5091abe9b8aSliubo __entry->range_end = wbc->range_end; 5101abe9b8aSliubo __entry->for_kupdate = wbc->for_kupdate; 5111abe9b8aSliubo __entry->for_reclaim = wbc->for_reclaim; 5121abe9b8aSliubo __entry->range_cyclic = wbc->range_cyclic; 5131abe9b8aSliubo __entry->writeback_index = inode->i_mapping->writeback_index; 5141abe9b8aSliubo __entry->root_objectid = 5151abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 5161abe9b8aSliubo ), 5171abe9b8aSliubo 518562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu " 519562a7a07SDavid Sterba "nr_to_write=%ld pages_skipped=%ld range_start=%llu " 520562a7a07SDavid Sterba "range_end=%llu for_kupdate=%d " 521562a7a07SDavid Sterba "for_reclaim=%d range_cyclic=%d writeback_index=%lu", 5221abe9b8aSliubo show_root_type(__entry->root_objectid), 5231abe9b8aSliubo (unsigned long)__entry->ino, __entry->index, 5241abe9b8aSliubo __entry->nr_to_write, __entry->pages_skipped, 5251abe9b8aSliubo __entry->range_start, __entry->range_end, 526846d5a09SWu Fengguang __entry->for_kupdate, 5271abe9b8aSliubo __entry->for_reclaim, __entry->range_cyclic, 5281abe9b8aSliubo (unsigned long)__entry->writeback_index) 5291abe9b8aSliubo ); 5301abe9b8aSliubo 5311abe9b8aSliubo DEFINE_EVENT(btrfs__writepage, __extent_writepage, 5321abe9b8aSliubo 5339a35b637SJeff Mahoney TP_PROTO(const struct page *page, const struct inode *inode, 5349a35b637SJeff Mahoney const struct writeback_control *wbc), 5351abe9b8aSliubo 5361abe9b8aSliubo TP_ARGS(page, inode, wbc) 5371abe9b8aSliubo ); 5381abe9b8aSliubo 5391abe9b8aSliubo TRACE_EVENT(btrfs_writepage_end_io_hook, 5401abe9b8aSliubo 5419a35b637SJeff Mahoney TP_PROTO(const struct page *page, u64 start, u64 end, int uptodate), 5421abe9b8aSliubo 5431abe9b8aSliubo TP_ARGS(page, start, end, uptodate), 5441abe9b8aSliubo 545bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 5461abe9b8aSliubo __field( ino_t, ino ) 5471abe9b8aSliubo __field( pgoff_t, index ) 5481abe9b8aSliubo __field( u64, start ) 5491abe9b8aSliubo __field( u64, end ) 5501abe9b8aSliubo __field( int, uptodate ) 5511abe9b8aSliubo __field( u64, root_objectid ) 5521abe9b8aSliubo ), 5531abe9b8aSliubo 554bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb), 5551abe9b8aSliubo __entry->ino = page->mapping->host->i_ino; 5561abe9b8aSliubo __entry->index = page->index; 5571abe9b8aSliubo __entry->start = start; 5581abe9b8aSliubo __entry->end = end; 5591abe9b8aSliubo __entry->uptodate = uptodate; 5601abe9b8aSliubo __entry->root_objectid = 5611abe9b8aSliubo BTRFS_I(page->mapping->host)->root->root_key.objectid; 5621abe9b8aSliubo ), 5631abe9b8aSliubo 564562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%lu page_index=%lu start=%llu " 565562a7a07SDavid Sterba "end=%llu uptodate=%d", 5661abe9b8aSliubo show_root_type(__entry->root_objectid), 5671abe9b8aSliubo (unsigned long)__entry->ino, (unsigned long)__entry->index, 5681abe9b8aSliubo (unsigned long long)__entry->start, 5691abe9b8aSliubo (unsigned long long)__entry->end, __entry->uptodate) 5701abe9b8aSliubo ); 5711abe9b8aSliubo 5721abe9b8aSliubo TRACE_EVENT(btrfs_sync_file, 5731abe9b8aSliubo 5749a35b637SJeff Mahoney TP_PROTO(const struct file *file, int datasync), 5751abe9b8aSliubo 5761abe9b8aSliubo TP_ARGS(file, datasync), 5771abe9b8aSliubo 578bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 5791abe9b8aSliubo __field( ino_t, ino ) 5801abe9b8aSliubo __field( ino_t, parent ) 5811abe9b8aSliubo __field( int, datasync ) 5821abe9b8aSliubo __field( u64, root_objectid ) 5831abe9b8aSliubo ), 5841abe9b8aSliubo 5851abe9b8aSliubo TP_fast_assign( 5869a35b637SJeff Mahoney const struct dentry *dentry = file->f_path.dentry; 5879a35b637SJeff Mahoney const struct inode *inode = d_inode(dentry); 5881abe9b8aSliubo 589bc074524SJeff Mahoney TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb)); 5901abe9b8aSliubo __entry->ino = inode->i_ino; 5912b0143b5SDavid Howells __entry->parent = d_inode(dentry->d_parent)->i_ino; 5921abe9b8aSliubo __entry->datasync = datasync; 5931abe9b8aSliubo __entry->root_objectid = 5941abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 5951abe9b8aSliubo ), 5961abe9b8aSliubo 597562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) ino=%ld parent=%ld datasync=%d", 5981abe9b8aSliubo show_root_type(__entry->root_objectid), 5991abe9b8aSliubo (unsigned long)__entry->ino, (unsigned long)__entry->parent, 6001abe9b8aSliubo __entry->datasync) 6011abe9b8aSliubo ); 6021abe9b8aSliubo 6031abe9b8aSliubo TRACE_EVENT(btrfs_sync_fs, 6041abe9b8aSliubo 6059a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, int wait), 6061abe9b8aSliubo 607bc074524SJeff Mahoney TP_ARGS(fs_info, wait), 6081abe9b8aSliubo 609bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 6101abe9b8aSliubo __field( int, wait ) 6111abe9b8aSliubo ), 6121abe9b8aSliubo 613bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 6141abe9b8aSliubo __entry->wait = wait; 6151abe9b8aSliubo ), 6161abe9b8aSliubo 617bc074524SJeff Mahoney TP_printk_btrfs("wait = %d", __entry->wait) 6181abe9b8aSliubo ); 6191abe9b8aSliubo 620c83f8effSJosef Bacik TRACE_EVENT(btrfs_add_block_group, 621c83f8effSJosef Bacik 6229a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 6239a35b637SJeff Mahoney const struct btrfs_block_group_cache *block_group, int create), 624c83f8effSJosef Bacik 625c83f8effSJosef Bacik TP_ARGS(fs_info, block_group, create), 626c83f8effSJosef Bacik 627c83f8effSJosef Bacik TP_STRUCT__entry( 628b94417eaSAnand Jain __array( u8, fsid, BTRFS_FSID_SIZE ) 629c83f8effSJosef Bacik __field( u64, offset ) 630c83f8effSJosef Bacik __field( u64, size ) 631c83f8effSJosef Bacik __field( u64, flags ) 632c83f8effSJosef Bacik __field( u64, bytes_used ) 633c83f8effSJosef Bacik __field( u64, bytes_super ) 634c83f8effSJosef Bacik __field( int, create ) 635c83f8effSJosef Bacik ), 636c83f8effSJosef Bacik 637c83f8effSJosef Bacik TP_fast_assign( 638b94417eaSAnand Jain memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE); 639c83f8effSJosef Bacik __entry->offset = block_group->key.objectid; 640c83f8effSJosef Bacik __entry->size = block_group->key.offset; 641c83f8effSJosef Bacik __entry->flags = block_group->flags; 642c83f8effSJosef Bacik __entry->bytes_used = 643c83f8effSJosef Bacik btrfs_block_group_used(&block_group->item); 644c83f8effSJosef Bacik __entry->bytes_super = block_group->bytes_super; 645c83f8effSJosef Bacik __entry->create = create; 646c83f8effSJosef Bacik ), 647c83f8effSJosef Bacik 648562a7a07SDavid Sterba TP_printk("%pU: block_group offset=%llu size=%llu " 649562a7a07SDavid Sterba "flags=%llu(%s) bytes_used=%llu bytes_super=%llu " 650c83f8effSJosef Bacik "create=%d", __entry->fsid, 651c83f8effSJosef Bacik (unsigned long long)__entry->offset, 652c83f8effSJosef Bacik (unsigned long long)__entry->size, 653c83f8effSJosef Bacik (unsigned long long)__entry->flags, 654c83f8effSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 655c83f8effSJosef Bacik BTRFS_GROUP_FLAGS), 656c83f8effSJosef Bacik (unsigned long long)__entry->bytes_used, 657c83f8effSJosef Bacik (unsigned long long)__entry->bytes_super, __entry->create) 658c83f8effSJosef Bacik ); 659c83f8effSJosef Bacik 6601abe9b8aSliubo #define show_ref_action(action) \ 6611abe9b8aSliubo __print_symbolic(action, \ 6621abe9b8aSliubo { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ 6631abe9b8aSliubo { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ 6641abe9b8aSliubo { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ 6651abe9b8aSliubo { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) 6661abe9b8aSliubo 6671abe9b8aSliubo 668599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, 6691abe9b8aSliubo 6709a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 6719a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 6729a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 6731abe9b8aSliubo int action), 6741abe9b8aSliubo 675bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action), 6761abe9b8aSliubo 677bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 6781abe9b8aSliubo __field( u64, bytenr ) 6791abe9b8aSliubo __field( u64, num_bytes ) 6801abe9b8aSliubo __field( int, action ) 6811abe9b8aSliubo __field( u64, parent ) 6821abe9b8aSliubo __field( u64, ref_root ) 6831abe9b8aSliubo __field( int, level ) 6841abe9b8aSliubo __field( int, type ) 685dea7d76eSLiu Bo __field( u64, seq ) 6861abe9b8aSliubo ), 6871abe9b8aSliubo 688bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 6891abe9b8aSliubo __entry->bytenr = ref->bytenr; 6901abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 6911abe9b8aSliubo __entry->action = action; 6921abe9b8aSliubo __entry->parent = full_ref->parent; 6931abe9b8aSliubo __entry->ref_root = full_ref->root; 6941abe9b8aSliubo __entry->level = full_ref->level; 6951abe9b8aSliubo __entry->type = ref->type; 696dea7d76eSLiu Bo __entry->seq = ref->seq; 6971abe9b8aSliubo ), 6981abe9b8aSliubo 699562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 700562a7a07SDavid Sterba "parent=%llu(%s) ref_root=%llu(%s) level=%d " 701562a7a07SDavid Sterba "type=%s seq=%llu", 7021abe9b8aSliubo (unsigned long long)__entry->bytenr, 7031abe9b8aSliubo (unsigned long long)__entry->num_bytes, 7041abe9b8aSliubo show_ref_action(__entry->action), 7051abe9b8aSliubo show_root_type(__entry->parent), 7061abe9b8aSliubo show_root_type(__entry->ref_root), 707dea7d76eSLiu Bo __entry->level, show_ref_type(__entry->type), 708dea7d76eSLiu Bo (unsigned long long)__entry->seq) 7091abe9b8aSliubo ); 7101abe9b8aSliubo 711599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, 712599c75ecSLiu Bo 7139a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 7149a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 7159a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 716599c75ecSLiu Bo int action), 717599c75ecSLiu Bo 718bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 719599c75ecSLiu Bo ); 720599c75ecSLiu Bo 721599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, 722599c75ecSLiu Bo 7239a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 7249a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 7259a35b637SJeff Mahoney const struct btrfs_delayed_tree_ref *full_ref, 726599c75ecSLiu Bo int action), 727599c75ecSLiu Bo 728bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 729599c75ecSLiu Bo ); 730599c75ecSLiu Bo 731599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, 7321abe9b8aSliubo 7339a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 7349a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 7359a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 7361abe9b8aSliubo int action), 7371abe9b8aSliubo 738bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action), 7391abe9b8aSliubo 740bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 7411abe9b8aSliubo __field( u64, bytenr ) 7421abe9b8aSliubo __field( u64, num_bytes ) 7431abe9b8aSliubo __field( int, action ) 7441abe9b8aSliubo __field( u64, parent ) 7451abe9b8aSliubo __field( u64, ref_root ) 7461abe9b8aSliubo __field( u64, owner ) 7471abe9b8aSliubo __field( u64, offset ) 7481abe9b8aSliubo __field( int, type ) 749dea7d76eSLiu Bo __field( u64, seq ) 7501abe9b8aSliubo ), 7511abe9b8aSliubo 752bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 7531abe9b8aSliubo __entry->bytenr = ref->bytenr; 7541abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 7551abe9b8aSliubo __entry->action = action; 7561abe9b8aSliubo __entry->parent = full_ref->parent; 7571abe9b8aSliubo __entry->ref_root = full_ref->root; 7581abe9b8aSliubo __entry->owner = full_ref->objectid; 7591abe9b8aSliubo __entry->offset = full_ref->offset; 7601abe9b8aSliubo __entry->type = ref->type; 761dea7d76eSLiu Bo __entry->seq = ref->seq; 7621abe9b8aSliubo ), 7631abe9b8aSliubo 764562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " 765562a7a07SDavid Sterba "parent=%llu(%s) ref_root=%llu(%s) owner=%llu " 766562a7a07SDavid Sterba "offset=%llu type=%s seq=%llu", 7671abe9b8aSliubo (unsigned long long)__entry->bytenr, 7681abe9b8aSliubo (unsigned long long)__entry->num_bytes, 7691abe9b8aSliubo show_ref_action(__entry->action), 7701abe9b8aSliubo show_root_type(__entry->parent), 7711abe9b8aSliubo show_root_type(__entry->ref_root), 7721abe9b8aSliubo (unsigned long long)__entry->owner, 7731abe9b8aSliubo (unsigned long long)__entry->offset, 774dea7d76eSLiu Bo show_ref_type(__entry->type), 775dea7d76eSLiu Bo (unsigned long long)__entry->seq) 7761abe9b8aSliubo ); 7771abe9b8aSliubo 778599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, 779599c75ecSLiu Bo 7809a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 7819a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 7829a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 783599c75ecSLiu Bo int action), 784599c75ecSLiu Bo 785bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 786599c75ecSLiu Bo ); 787599c75ecSLiu Bo 788599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, 789599c75ecSLiu Bo 7909a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 7919a35b637SJeff Mahoney const struct btrfs_delayed_ref_node *ref, 7929a35b637SJeff Mahoney const struct btrfs_delayed_data_ref *full_ref, 793599c75ecSLiu Bo int action), 794599c75ecSLiu Bo 795bc074524SJeff Mahoney TP_ARGS(fs_info, ref, full_ref, action) 796599c75ecSLiu Bo ); 797599c75ecSLiu Bo 798599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, 7991abe9b8aSliubo 8009a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8019a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 8021abe9b8aSliubo int action), 8031abe9b8aSliubo 804d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action), 8051abe9b8aSliubo 806bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 8071abe9b8aSliubo __field( u64, bytenr ) 8081abe9b8aSliubo __field( u64, num_bytes ) 8091abe9b8aSliubo __field( int, action ) 8101abe9b8aSliubo __field( int, is_data ) 8111abe9b8aSliubo ), 8121abe9b8aSliubo 813bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 814d278850eSJosef Bacik __entry->bytenr = head_ref->bytenr; 815d278850eSJosef Bacik __entry->num_bytes = head_ref->num_bytes; 8161abe9b8aSliubo __entry->action = action; 8171abe9b8aSliubo __entry->is_data = head_ref->is_data; 8181abe9b8aSliubo ), 8191abe9b8aSliubo 820562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d", 8211abe9b8aSliubo (unsigned long long)__entry->bytenr, 8221abe9b8aSliubo (unsigned long long)__entry->num_bytes, 8231abe9b8aSliubo show_ref_action(__entry->action), 8241abe9b8aSliubo __entry->is_data) 8251abe9b8aSliubo ); 8261abe9b8aSliubo 827599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, 828599c75ecSLiu Bo 8299a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8309a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 831599c75ecSLiu Bo int action), 832599c75ecSLiu Bo 833d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action) 834599c75ecSLiu Bo ); 835599c75ecSLiu Bo 836599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, 837599c75ecSLiu Bo 8389a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8399a35b637SJeff Mahoney const struct btrfs_delayed_ref_head *head_ref, 840599c75ecSLiu Bo int action), 841599c75ecSLiu Bo 842d278850eSJosef Bacik TP_ARGS(fs_info, head_ref, action) 843599c75ecSLiu Bo ); 844599c75ecSLiu Bo 8451abe9b8aSliubo #define show_chunk_type(type) \ 8461abe9b8aSliubo __print_flags(type, "|", \ 8471abe9b8aSliubo { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ 8481abe9b8aSliubo { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 8491abe9b8aSliubo { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 8501abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ 8511abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ 8521abe9b8aSliubo { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ 853e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 854e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ 855e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) 8561abe9b8aSliubo 8571abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__chunk, 8581abe9b8aSliubo 8599a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8609a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 8611abe9b8aSliubo 8626bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size), 8631abe9b8aSliubo 864bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 8651abe9b8aSliubo __field( int, num_stripes ) 8661abe9b8aSliubo __field( u64, type ) 8671abe9b8aSliubo __field( int, sub_stripes ) 8681abe9b8aSliubo __field( u64, offset ) 8691abe9b8aSliubo __field( u64, size ) 8701abe9b8aSliubo __field( u64, root_objectid ) 8711abe9b8aSliubo ), 8721abe9b8aSliubo 8736bccf3abSJeff Mahoney TP_fast_assign_btrfs(fs_info, 8741abe9b8aSliubo __entry->num_stripes = map->num_stripes; 8751abe9b8aSliubo __entry->type = map->type; 8761abe9b8aSliubo __entry->sub_stripes = map->sub_stripes; 8771abe9b8aSliubo __entry->offset = offset; 8781abe9b8aSliubo __entry->size = size; 8796bccf3abSJeff Mahoney __entry->root_objectid = fs_info->chunk_root->root_key.objectid; 8801abe9b8aSliubo ), 8811abe9b8aSliubo 882562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu " 883562a7a07SDavid Sterba "num_stripes=%d sub_stripes=%d type=%s", 8841abe9b8aSliubo show_root_type(__entry->root_objectid), 8851abe9b8aSliubo (unsigned long long)__entry->offset, 8861abe9b8aSliubo (unsigned long long)__entry->size, 8871abe9b8aSliubo __entry->num_stripes, __entry->sub_stripes, 8881abe9b8aSliubo show_chunk_type(__entry->type)) 8891abe9b8aSliubo ); 8901abe9b8aSliubo 8911abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, 8921abe9b8aSliubo 8939a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 8949a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 8951abe9b8aSliubo 8966bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size) 8971abe9b8aSliubo ); 8981abe9b8aSliubo 8991abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, 9001abe9b8aSliubo 9019a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 9029a35b637SJeff Mahoney const struct map_lookup *map, u64 offset, u64 size), 9031abe9b8aSliubo 9046bccf3abSJeff Mahoney TP_ARGS(fs_info, map, offset, size) 9051abe9b8aSliubo ); 9061abe9b8aSliubo 9071abe9b8aSliubo TRACE_EVENT(btrfs_cow_block, 9081abe9b8aSliubo 9099a35b637SJeff Mahoney TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf, 9109a35b637SJeff Mahoney const struct extent_buffer *cow), 9111abe9b8aSliubo 9121abe9b8aSliubo TP_ARGS(root, buf, cow), 9131abe9b8aSliubo 914bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 9151abe9b8aSliubo __field( u64, root_objectid ) 9161abe9b8aSliubo __field( u64, buf_start ) 9171abe9b8aSliubo __field( int, refs ) 9181abe9b8aSliubo __field( u64, cow_start ) 9191abe9b8aSliubo __field( int, buf_level ) 9201abe9b8aSliubo __field( int, cow_level ) 9211abe9b8aSliubo ), 9221abe9b8aSliubo 923bc074524SJeff Mahoney TP_fast_assign_btrfs(root->fs_info, 9241abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 9251abe9b8aSliubo __entry->buf_start = buf->start; 9261abe9b8aSliubo __entry->refs = atomic_read(&buf->refs); 9271abe9b8aSliubo __entry->cow_start = cow->start; 9281abe9b8aSliubo __entry->buf_level = btrfs_header_level(buf); 9291abe9b8aSliubo __entry->cow_level = btrfs_header_level(cow); 9301abe9b8aSliubo ), 9311abe9b8aSliubo 932562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu " 933562a7a07SDavid Sterba "(orig_level=%d) cow_buf=%llu (cow_level=%d)", 9341abe9b8aSliubo show_root_type(__entry->root_objectid), 9351abe9b8aSliubo __entry->refs, 9361abe9b8aSliubo (unsigned long long)__entry->buf_start, 9371abe9b8aSliubo __entry->buf_level, 9381abe9b8aSliubo (unsigned long long)__entry->cow_start, 9391abe9b8aSliubo __entry->cow_level) 9401abe9b8aSliubo ); 9411abe9b8aSliubo 9428c2a3ca2SJosef Bacik TRACE_EVENT(btrfs_space_reservation, 9438c2a3ca2SJosef Bacik 9449a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, char *type, u64 val, 9458c2a3ca2SJosef Bacik u64 bytes, int reserve), 9468c2a3ca2SJosef Bacik 9478c2a3ca2SJosef Bacik TP_ARGS(fs_info, type, val, bytes, reserve), 9488c2a3ca2SJosef Bacik 949bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 9508c2a3ca2SJosef Bacik __string( type, type ) 9518c2a3ca2SJosef Bacik __field( u64, val ) 9528c2a3ca2SJosef Bacik __field( u64, bytes ) 9538c2a3ca2SJosef Bacik __field( int, reserve ) 9548c2a3ca2SJosef Bacik ), 9558c2a3ca2SJosef Bacik 956bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 9578c2a3ca2SJosef Bacik __assign_str(type, type); 9588c2a3ca2SJosef Bacik __entry->val = val; 9598c2a3ca2SJosef Bacik __entry->bytes = bytes; 9608c2a3ca2SJosef Bacik __entry->reserve = reserve; 9618c2a3ca2SJosef Bacik ), 9628c2a3ca2SJosef Bacik 963bc074524SJeff Mahoney TP_printk_btrfs("%s: %Lu %s %Lu", __get_str(type), __entry->val, 964bc074524SJeff Mahoney __entry->reserve ? "reserve" : "release", 9658c2a3ca2SJosef Bacik __entry->bytes) 9668c2a3ca2SJosef Bacik ); 9678c2a3ca2SJosef Bacik 968f376df2bSJosef Bacik #define show_flush_action(action) \ 969f376df2bSJosef Bacik __print_symbolic(action, \ 970f376df2bSJosef Bacik { BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH"}, \ 971f376df2bSJosef Bacik { BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT"}, \ 972f376df2bSJosef Bacik { BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL"}) 973f376df2bSJosef Bacik 974f376df2bSJosef Bacik TRACE_EVENT(btrfs_trigger_flush, 975f376df2bSJosef Bacik 9769a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, 977f376df2bSJosef Bacik int flush, char *reason), 978f376df2bSJosef Bacik 979f376df2bSJosef Bacik TP_ARGS(fs_info, flags, bytes, flush, reason), 980f376df2bSJosef Bacik 981f376df2bSJosef Bacik TP_STRUCT__entry( 982b94417eaSAnand Jain __array( u8, fsid, BTRFS_FSID_SIZE ) 983f376df2bSJosef Bacik __field( u64, flags ) 984f376df2bSJosef Bacik __field( u64, bytes ) 985f376df2bSJosef Bacik __field( int, flush ) 986f376df2bSJosef Bacik __string( reason, reason ) 987f376df2bSJosef Bacik ), 988f376df2bSJosef Bacik 989f376df2bSJosef Bacik TP_fast_assign( 990b94417eaSAnand Jain memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE); 991f376df2bSJosef Bacik __entry->flags = flags; 992f376df2bSJosef Bacik __entry->bytes = bytes; 993f376df2bSJosef Bacik __entry->flush = flush; 994f376df2bSJosef Bacik __assign_str(reason, reason) 995f376df2bSJosef Bacik ), 996f376df2bSJosef Bacik 997562a7a07SDavid Sterba TP_printk("%pU: %s: flush=%d(%s) flags=%llu(%s) bytes=%llu", 998f376df2bSJosef Bacik __entry->fsid, __get_str(reason), __entry->flush, 999f376df2bSJosef Bacik show_flush_action(__entry->flush), 1000f376df2bSJosef Bacik (unsigned long long)__entry->flags, 1001f376df2bSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 1002f376df2bSJosef Bacik BTRFS_GROUP_FLAGS), 1003f376df2bSJosef Bacik (unsigned long long)__entry->bytes) 1004f376df2bSJosef Bacik ); 1005f376df2bSJosef Bacik 1006f376df2bSJosef Bacik #define show_flush_state(state) \ 1007f376df2bSJosef Bacik __print_symbolic(state, \ 1008f376df2bSJosef Bacik { FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR"}, \ 1009f376df2bSJosef Bacik { FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS"}, \ 1010f376df2bSJosef Bacik { FLUSH_DELALLOC, "FLUSH_DELALLOC"}, \ 1011f376df2bSJosef Bacik { FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT"}, \ 1012f376df2bSJosef Bacik { ALLOC_CHUNK, "ALLOC_CHUNK"}, \ 1013f376df2bSJosef Bacik { COMMIT_TRANS, "COMMIT_TRANS"}) 1014f376df2bSJosef Bacik 1015f376df2bSJosef Bacik TRACE_EVENT(btrfs_flush_space, 1016f376df2bSJosef Bacik 10179a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes, 10187bdd6277SNikolay Borisov int state, int ret), 1019f376df2bSJosef Bacik 10207bdd6277SNikolay Borisov TP_ARGS(fs_info, flags, num_bytes, state, ret), 1021f376df2bSJosef Bacik 1022f376df2bSJosef Bacik TP_STRUCT__entry( 1023b94417eaSAnand Jain __array( u8, fsid, BTRFS_FSID_SIZE ) 1024f376df2bSJosef Bacik __field( u64, flags ) 1025f376df2bSJosef Bacik __field( u64, num_bytes ) 1026f376df2bSJosef Bacik __field( int, state ) 1027f376df2bSJosef Bacik __field( int, ret ) 1028f376df2bSJosef Bacik ), 1029f376df2bSJosef Bacik 1030f376df2bSJosef Bacik TP_fast_assign( 1031b94417eaSAnand Jain memcpy(__entry->fsid, fs_info->fsid, BTRFS_FSID_SIZE); 1032f376df2bSJosef Bacik __entry->flags = flags; 1033f376df2bSJosef Bacik __entry->num_bytes = num_bytes; 1034f376df2bSJosef Bacik __entry->state = state; 1035f376df2bSJosef Bacik __entry->ret = ret; 1036f376df2bSJosef Bacik ), 1037f376df2bSJosef Bacik 10387bdd6277SNikolay Borisov TP_printk("%pU: state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d", 10397bdd6277SNikolay Borisov __entry->fsid, __entry->state, 1040f376df2bSJosef Bacik show_flush_state(__entry->state), 1041f376df2bSJosef Bacik (unsigned long long)__entry->flags, 1042f376df2bSJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 1043f376df2bSJosef Bacik BTRFS_GROUP_FLAGS), 10447bdd6277SNikolay Borisov (unsigned long long)__entry->num_bytes, __entry->ret) 1045f376df2bSJosef Bacik ); 1046f376df2bSJosef Bacik 10471abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__reserved_extent, 10481abe9b8aSliubo 10499a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 10501abe9b8aSliubo 105171ff6437SJeff Mahoney TP_ARGS(fs_info, start, len), 10521abe9b8aSliubo 1053bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 10541abe9b8aSliubo __field( u64, start ) 10551abe9b8aSliubo __field( u64, len ) 10561abe9b8aSliubo ), 10571abe9b8aSliubo 105871ff6437SJeff Mahoney TP_fast_assign_btrfs(fs_info, 10591abe9b8aSliubo __entry->start = start; 10601abe9b8aSliubo __entry->len = len; 10611abe9b8aSliubo ), 10621abe9b8aSliubo 1063562a7a07SDavid Sterba TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu", 106471ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 10651abe9b8aSliubo (unsigned long long)__entry->start, 10661abe9b8aSliubo (unsigned long long)__entry->len) 10671abe9b8aSliubo ); 10681abe9b8aSliubo 10691abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, 10701abe9b8aSliubo 10719a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 10721abe9b8aSliubo 107371ff6437SJeff Mahoney TP_ARGS(fs_info, start, len) 10741abe9b8aSliubo ); 10751abe9b8aSliubo 10761abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, 10771abe9b8aSliubo 10789a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), 10791abe9b8aSliubo 108071ff6437SJeff Mahoney TP_ARGS(fs_info, start, len) 10811abe9b8aSliubo ); 10821abe9b8aSliubo 10833f7de037SJosef Bacik TRACE_EVENT(find_free_extent, 10843f7de037SJosef Bacik 10859a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 num_bytes, 10869a35b637SJeff Mahoney u64 empty_size, u64 data), 10873f7de037SJosef Bacik 108871ff6437SJeff Mahoney TP_ARGS(fs_info, num_bytes, empty_size, data), 10893f7de037SJosef Bacik 1090bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 10913f7de037SJosef Bacik __field( u64, num_bytes ) 10923f7de037SJosef Bacik __field( u64, empty_size ) 10933f7de037SJosef Bacik __field( u64, data ) 10943f7de037SJosef Bacik ), 10953f7de037SJosef Bacik 109671ff6437SJeff Mahoney TP_fast_assign_btrfs(fs_info, 10973f7de037SJosef Bacik __entry->num_bytes = num_bytes; 10983f7de037SJosef Bacik __entry->empty_size = empty_size; 10993f7de037SJosef Bacik __entry->data = data; 11003f7de037SJosef Bacik ), 11013f7de037SJosef Bacik 1102562a7a07SDavid Sterba TP_printk_btrfs("root=%Lu(%s) len=%Lu empty_size=%Lu flags=%Lu(%s)", 110371ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 11043f7de037SJosef Bacik __entry->num_bytes, __entry->empty_size, __entry->data, 11053f7de037SJosef Bacik __print_flags((unsigned long)__entry->data, "|", 11063f7de037SJosef Bacik BTRFS_GROUP_FLAGS)) 11073f7de037SJosef Bacik ); 11083f7de037SJosef Bacik 11093f7de037SJosef Bacik DECLARE_EVENT_CLASS(btrfs__reserve_extent, 11103f7de037SJosef Bacik 11119a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 11129a35b637SJeff Mahoney const struct btrfs_block_group_cache *block_group, u64 start, 11133f7de037SJosef Bacik u64 len), 11143f7de037SJosef Bacik 111571ff6437SJeff Mahoney TP_ARGS(fs_info, block_group, start, len), 11163f7de037SJosef Bacik 1117bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 11183f7de037SJosef Bacik __field( u64, bg_objectid ) 11193f7de037SJosef Bacik __field( u64, flags ) 11203f7de037SJosef Bacik __field( u64, start ) 11213f7de037SJosef Bacik __field( u64, len ) 11223f7de037SJosef Bacik ), 11233f7de037SJosef Bacik 112471ff6437SJeff Mahoney TP_fast_assign_btrfs(fs_info, 11253f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 11263f7de037SJosef Bacik __entry->flags = block_group->flags; 11273f7de037SJosef Bacik __entry->start = start; 11283f7de037SJosef Bacik __entry->len = len; 11293f7de037SJosef Bacik ), 11303f7de037SJosef Bacik 1131562a7a07SDavid Sterba TP_printk_btrfs("root=%Lu(%s) block_group=%Lu flags=%Lu(%s) " 1132562a7a07SDavid Sterba "start=%Lu len=%Lu", 113371ff6437SJeff Mahoney show_root_type(BTRFS_EXTENT_TREE_OBJECTID), 113471ff6437SJeff Mahoney __entry->bg_objectid, 11353f7de037SJosef Bacik __entry->flags, __print_flags((unsigned long)__entry->flags, 11363f7de037SJosef Bacik "|", BTRFS_GROUP_FLAGS), 11373f7de037SJosef Bacik __entry->start, __entry->len) 11383f7de037SJosef Bacik ); 11393f7de037SJosef Bacik 11403f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, 11413f7de037SJosef Bacik 11429a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 11439a35b637SJeff Mahoney const struct btrfs_block_group_cache *block_group, u64 start, 11443f7de037SJosef Bacik u64 len), 11453f7de037SJosef Bacik 114671ff6437SJeff Mahoney TP_ARGS(fs_info, block_group, start, len) 11473f7de037SJosef Bacik ); 11483f7de037SJosef Bacik 11493f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, 11503f7de037SJosef Bacik 11519a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 11529a35b637SJeff Mahoney const struct btrfs_block_group_cache *block_group, u64 start, 11533f7de037SJosef Bacik u64 len), 11543f7de037SJosef Bacik 115571ff6437SJeff Mahoney TP_ARGS(fs_info, block_group, start, len) 11563f7de037SJosef Bacik ); 11573f7de037SJosef Bacik 11583f7de037SJosef Bacik TRACE_EVENT(btrfs_find_cluster, 11593f7de037SJosef Bacik 11609a35b637SJeff Mahoney TP_PROTO(const struct btrfs_block_group_cache *block_group, u64 start, 11613f7de037SJosef Bacik u64 bytes, u64 empty_size, u64 min_bytes), 11623f7de037SJosef Bacik 11633f7de037SJosef Bacik TP_ARGS(block_group, start, bytes, empty_size, min_bytes), 11643f7de037SJosef Bacik 1165bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 11663f7de037SJosef Bacik __field( u64, bg_objectid ) 11673f7de037SJosef Bacik __field( u64, flags ) 11683f7de037SJosef Bacik __field( u64, start ) 11693f7de037SJosef Bacik __field( u64, bytes ) 11703f7de037SJosef Bacik __field( u64, empty_size ) 11713f7de037SJosef Bacik __field( u64, min_bytes ) 11723f7de037SJosef Bacik ), 11733f7de037SJosef Bacik 1174bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 11753f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 11763f7de037SJosef Bacik __entry->flags = block_group->flags; 11773f7de037SJosef Bacik __entry->start = start; 11783f7de037SJosef Bacik __entry->bytes = bytes; 11793f7de037SJosef Bacik __entry->empty_size = empty_size; 11803f7de037SJosef Bacik __entry->min_bytes = min_bytes; 11813f7de037SJosef Bacik ), 11823f7de037SJosef Bacik 1183562a7a07SDavid Sterba TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) start=%Lu len=%Lu " 1184562a7a07SDavid Sterba "empty_size=%Lu min_bytes=%Lu", __entry->bg_objectid, 11853f7de037SJosef Bacik __entry->flags, 11863f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 11873f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 11883f7de037SJosef Bacik __entry->bytes, __entry->empty_size, __entry->min_bytes) 11893f7de037SJosef Bacik ); 11903f7de037SJosef Bacik 11913f7de037SJosef Bacik TRACE_EVENT(btrfs_failed_cluster_setup, 11923f7de037SJosef Bacik 11939a35b637SJeff Mahoney TP_PROTO(const struct btrfs_block_group_cache *block_group), 11943f7de037SJosef Bacik 11953f7de037SJosef Bacik TP_ARGS(block_group), 11963f7de037SJosef Bacik 1197bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 11983f7de037SJosef Bacik __field( u64, bg_objectid ) 11993f7de037SJosef Bacik ), 12003f7de037SJosef Bacik 1201bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 12023f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 12033f7de037SJosef Bacik ), 12043f7de037SJosef Bacik 1205bc074524SJeff Mahoney TP_printk_btrfs("block_group=%Lu", __entry->bg_objectid) 12063f7de037SJosef Bacik ); 12073f7de037SJosef Bacik 12083f7de037SJosef Bacik TRACE_EVENT(btrfs_setup_cluster, 12093f7de037SJosef Bacik 12109a35b637SJeff Mahoney TP_PROTO(const struct btrfs_block_group_cache *block_group, 12119a35b637SJeff Mahoney const struct btrfs_free_cluster *cluster, 12129a35b637SJeff Mahoney u64 size, int bitmap), 12133f7de037SJosef Bacik 12143f7de037SJosef Bacik TP_ARGS(block_group, cluster, size, bitmap), 12153f7de037SJosef Bacik 1216bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 12173f7de037SJosef Bacik __field( u64, bg_objectid ) 12183f7de037SJosef Bacik __field( u64, flags ) 12193f7de037SJosef Bacik __field( u64, start ) 12203f7de037SJosef Bacik __field( u64, max_size ) 12213f7de037SJosef Bacik __field( u64, size ) 12223f7de037SJosef Bacik __field( int, bitmap ) 12233f7de037SJosef Bacik ), 12243f7de037SJosef Bacik 1225bc074524SJeff Mahoney TP_fast_assign_btrfs(block_group->fs_info, 12263f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 12273f7de037SJosef Bacik __entry->flags = block_group->flags; 12283f7de037SJosef Bacik __entry->start = cluster->window_start; 12293f7de037SJosef Bacik __entry->max_size = cluster->max_size; 12303f7de037SJosef Bacik __entry->size = size; 12313f7de037SJosef Bacik __entry->bitmap = bitmap; 12323f7de037SJosef Bacik ), 12333f7de037SJosef Bacik 1234562a7a07SDavid Sterba TP_printk_btrfs("block_group=%Lu flags=%Lu(%s) window_start=%Lu " 1235562a7a07SDavid Sterba "size=%Lu max_size=%Lu bitmap=%d", 12363f7de037SJosef Bacik __entry->bg_objectid, 12373f7de037SJosef Bacik __entry->flags, 12383f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 12393f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 12403f7de037SJosef Bacik __entry->size, __entry->max_size, __entry->bitmap) 12413f7de037SJosef Bacik ); 12423f7de037SJosef Bacik 1243143bede5SJeff Mahoney struct extent_state; 1244143bede5SJeff Mahoney TRACE_EVENT(alloc_extent_state, 1245143bede5SJeff Mahoney 12469a35b637SJeff Mahoney TP_PROTO(const struct extent_state *state, 12479a35b637SJeff Mahoney gfp_t mask, unsigned long IP), 1248143bede5SJeff Mahoney 1249143bede5SJeff Mahoney TP_ARGS(state, mask, IP), 1250143bede5SJeff Mahoney 1251143bede5SJeff Mahoney TP_STRUCT__entry( 12529a35b637SJeff Mahoney __field(const struct extent_state *, state) 1253143bede5SJeff Mahoney __field(gfp_t, mask) 1254143bede5SJeff Mahoney __field(unsigned long, ip) 1255143bede5SJeff Mahoney ), 1256143bede5SJeff Mahoney 1257143bede5SJeff Mahoney TP_fast_assign( 1258143bede5SJeff Mahoney __entry->state = state, 1259143bede5SJeff Mahoney __entry->mask = mask, 1260143bede5SJeff Mahoney __entry->ip = IP 1261143bede5SJeff Mahoney ), 1262143bede5SJeff Mahoney 1263562a7a07SDavid Sterba TP_printk("state=%p mask=%s caller=%pS", __entry->state, 12649a35b637SJeff Mahoney show_gfp_flags(__entry->mask), (const void *)__entry->ip) 1265143bede5SJeff Mahoney ); 1266143bede5SJeff Mahoney 1267143bede5SJeff Mahoney TRACE_EVENT(free_extent_state, 1268143bede5SJeff Mahoney 12699a35b637SJeff Mahoney TP_PROTO(const struct extent_state *state, unsigned long IP), 1270143bede5SJeff Mahoney 1271143bede5SJeff Mahoney TP_ARGS(state, IP), 1272143bede5SJeff Mahoney 1273143bede5SJeff Mahoney TP_STRUCT__entry( 12749a35b637SJeff Mahoney __field(const struct extent_state *, state) 1275143bede5SJeff Mahoney __field(unsigned long, ip) 1276143bede5SJeff Mahoney ), 1277143bede5SJeff Mahoney 1278143bede5SJeff Mahoney TP_fast_assign( 1279143bede5SJeff Mahoney __entry->state = state, 1280143bede5SJeff Mahoney __entry->ip = IP 1281143bede5SJeff Mahoney ), 1282143bede5SJeff Mahoney 1283562a7a07SDavid Sterba TP_printk("state=%p caller=%pS", __entry->state, 12849a35b637SJeff Mahoney (const void *)__entry->ip) 1285143bede5SJeff Mahoney ); 1286143bede5SJeff Mahoney 128752483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work, 128852483bc2SQu Wenruo 12899a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 129052483bc2SQu Wenruo 129152483bc2SQu Wenruo TP_ARGS(work), 129252483bc2SQu Wenruo 1293bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 12949a35b637SJeff Mahoney __field( const void *, work ) 12959a35b637SJeff Mahoney __field( const void *, wq ) 12969a35b637SJeff Mahoney __field( const void *, func ) 12979a35b637SJeff Mahoney __field( const void *, ordered_func ) 12989a35b637SJeff Mahoney __field( const void *, ordered_free ) 12999a35b637SJeff Mahoney __field( const void *, normal_work ) 130052483bc2SQu Wenruo ), 130152483bc2SQu Wenruo 1302bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_work_owner(work), 130352483bc2SQu Wenruo __entry->work = work; 130452483bc2SQu Wenruo __entry->wq = work->wq; 130552483bc2SQu Wenruo __entry->func = work->func; 130652483bc2SQu Wenruo __entry->ordered_func = work->ordered_func; 130752483bc2SQu Wenruo __entry->ordered_free = work->ordered_free; 1308b38a6258SLiu Bo __entry->normal_work = &work->normal_work; 130952483bc2SQu Wenruo ), 131052483bc2SQu Wenruo 1311562a7a07SDavid Sterba TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%pf ordered_func=%p " 1312b38a6258SLiu Bo "ordered_free=%p", 1313b38a6258SLiu Bo __entry->work, __entry->normal_work, __entry->wq, 1314b38a6258SLiu Bo __entry->func, __entry->ordered_func, __entry->ordered_free) 131552483bc2SQu Wenruo ); 131652483bc2SQu Wenruo 1317ac0c7cf8SDavid Sterba /* 1318ac0c7cf8SDavid Sterba * For situiations when the work is freed, we pass fs_info and a tag that that 1319ac0c7cf8SDavid Sterba * matches address of the work structure so it can be paired with the 1320ac0c7cf8SDavid Sterba * scheduling event. 1321ac0c7cf8SDavid Sterba */ 132252483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work__done, 132352483bc2SQu Wenruo 13249a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), 132552483bc2SQu Wenruo 1326ac0c7cf8SDavid Sterba TP_ARGS(fs_info, wtag), 132752483bc2SQu Wenruo 1328bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 13299a35b637SJeff Mahoney __field( const void *, wtag ) 133052483bc2SQu Wenruo ), 133152483bc2SQu Wenruo 1332ac0c7cf8SDavid Sterba TP_fast_assign_btrfs(fs_info, 1333ac0c7cf8SDavid Sterba __entry->wtag = wtag; 133452483bc2SQu Wenruo ), 133552483bc2SQu Wenruo 1336ac0c7cf8SDavid Sterba TP_printk_btrfs("work->%p", __entry->wtag) 133752483bc2SQu Wenruo ); 133852483bc2SQu Wenruo 133952483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_queued, 134052483bc2SQu Wenruo 13419a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 134252483bc2SQu Wenruo 134352483bc2SQu Wenruo TP_ARGS(work) 134452483bc2SQu Wenruo ); 134552483bc2SQu Wenruo 134652483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_sched, 134752483bc2SQu Wenruo 13489a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 134952483bc2SQu Wenruo 135052483bc2SQu Wenruo TP_ARGS(work) 135152483bc2SQu Wenruo ); 135252483bc2SQu Wenruo 135352483bc2SQu Wenruo DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, 135452483bc2SQu Wenruo 13559a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), 135652483bc2SQu Wenruo 1357ac0c7cf8SDavid Sterba TP_ARGS(fs_info, wtag) 135852483bc2SQu Wenruo ); 135952483bc2SQu Wenruo 136052483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_ordered_sched, 136152483bc2SQu Wenruo 13629a35b637SJeff Mahoney TP_PROTO(const struct btrfs_work *work), 136352483bc2SQu Wenruo 136452483bc2SQu Wenruo TP_ARGS(work) 136552483bc2SQu Wenruo ); 136652483bc2SQu Wenruo 1367c3a46891SQu Wenruo DECLARE_EVENT_CLASS(btrfs__workqueue, 1368c3a46891SQu Wenruo 13699a35b637SJeff Mahoney TP_PROTO(const struct __btrfs_workqueue *wq, 13709a35b637SJeff Mahoney const char *name, int high), 1371c3a46891SQu Wenruo 1372c3a46891SQu Wenruo TP_ARGS(wq, name, high), 1373c3a46891SQu Wenruo 1374bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 13759a35b637SJeff Mahoney __field( const void *, wq ) 1376c3a46891SQu Wenruo __string( name, name ) 1377c3a46891SQu Wenruo __field( int , high ) 1378c3a46891SQu Wenruo ), 1379c3a46891SQu Wenruo 1380bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1381c3a46891SQu Wenruo __entry->wq = wq; 1382c3a46891SQu Wenruo __assign_str(name, name); 1383c3a46891SQu Wenruo __entry->high = high; 1384c3a46891SQu Wenruo ), 1385c3a46891SQu Wenruo 1386562a7a07SDavid Sterba TP_printk_btrfs("name=%s%s wq=%p", __get_str(name), 1387c3a46891SQu Wenruo __print_flags(__entry->high, "", 1388c3a46891SQu Wenruo {(WQ_HIGHPRI), "-high"}), 1389c3a46891SQu Wenruo __entry->wq) 1390c3a46891SQu Wenruo ); 1391c3a46891SQu Wenruo 1392c3a46891SQu Wenruo DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc, 1393c3a46891SQu Wenruo 13949a35b637SJeff Mahoney TP_PROTO(const struct __btrfs_workqueue *wq, 13959a35b637SJeff Mahoney const char *name, int high), 1396c3a46891SQu Wenruo 1397c3a46891SQu Wenruo TP_ARGS(wq, name, high) 1398c3a46891SQu Wenruo ); 1399c3a46891SQu Wenruo 1400c3a46891SQu Wenruo DECLARE_EVENT_CLASS(btrfs__workqueue_done, 1401c3a46891SQu Wenruo 14029a35b637SJeff Mahoney TP_PROTO(const struct __btrfs_workqueue *wq), 1403c3a46891SQu Wenruo 1404c3a46891SQu Wenruo TP_ARGS(wq), 1405c3a46891SQu Wenruo 1406bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 14079a35b637SJeff Mahoney __field( const void *, wq ) 1408c3a46891SQu Wenruo ), 1409c3a46891SQu Wenruo 1410bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), 1411c3a46891SQu Wenruo __entry->wq = wq; 1412c3a46891SQu Wenruo ), 1413c3a46891SQu Wenruo 1414bc074524SJeff Mahoney TP_printk_btrfs("wq=%p", __entry->wq) 1415c3a46891SQu Wenruo ); 1416c3a46891SQu Wenruo 1417c3a46891SQu Wenruo DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy, 1418c3a46891SQu Wenruo 14199a35b637SJeff Mahoney TP_PROTO(const struct __btrfs_workqueue *wq), 1420c3a46891SQu Wenruo 1421c3a46891SQu Wenruo TP_ARGS(wq) 1422c3a46891SQu Wenruo ); 142352483bc2SQu Wenruo 142481fb6f77SQu Wenruo #define BTRFS_QGROUP_OPERATIONS \ 142581fb6f77SQu Wenruo { QGROUP_RESERVE, "reserve" }, \ 142681fb6f77SQu Wenruo { QGROUP_RELEASE, "release" }, \ 142781fb6f77SQu Wenruo { QGROUP_FREE, "free" } 142881fb6f77SQu Wenruo 142981fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, 143081fb6f77SQu Wenruo 14319a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 14329a35b637SJeff Mahoney u64 reserved, int op), 143381fb6f77SQu Wenruo 143481fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op), 143581fb6f77SQu Wenruo 1436bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 143781fb6f77SQu Wenruo __field( u64, rootid ) 143881fb6f77SQu Wenruo __field( unsigned long, ino ) 143981fb6f77SQu Wenruo __field( u64, start ) 144081fb6f77SQu Wenruo __field( u64, len ) 144181fb6f77SQu Wenruo __field( u64, reserved ) 144281fb6f77SQu Wenruo __field( int, op ) 144381fb6f77SQu Wenruo ), 144481fb6f77SQu Wenruo 1445bc074524SJeff Mahoney TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), 144681fb6f77SQu Wenruo __entry->rootid = BTRFS_I(inode)->root->objectid; 144781fb6f77SQu Wenruo __entry->ino = inode->i_ino; 144881fb6f77SQu Wenruo __entry->start = start; 144981fb6f77SQu Wenruo __entry->len = len; 145081fb6f77SQu Wenruo __entry->reserved = reserved; 145181fb6f77SQu Wenruo __entry->op = op; 145281fb6f77SQu Wenruo ), 145381fb6f77SQu Wenruo 1454562a7a07SDavid Sterba TP_printk_btrfs("root=%llu ino=%lu start=%llu len=%llu reserved=%llu op=%s", 145581fb6f77SQu Wenruo __entry->rootid, __entry->ino, __entry->start, __entry->len, 145681fb6f77SQu Wenruo __entry->reserved, 145781fb6f77SQu Wenruo __print_flags((unsigned long)__entry->op, "", 145881fb6f77SQu Wenruo BTRFS_QGROUP_OPERATIONS) 145981fb6f77SQu Wenruo ) 146081fb6f77SQu Wenruo ); 146181fb6f77SQu Wenruo 146281fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data, 146381fb6f77SQu Wenruo 14649a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 14659a35b637SJeff Mahoney u64 reserved, int op), 146681fb6f77SQu Wenruo 146781fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 146881fb6f77SQu Wenruo ); 146981fb6f77SQu Wenruo 147081fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data, 147181fb6f77SQu Wenruo 14729a35b637SJeff Mahoney TP_PROTO(const struct inode *inode, u64 start, u64 len, 14739a35b637SJeff Mahoney u64 reserved, int op), 147481fb6f77SQu Wenruo 147581fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 147681fb6f77SQu Wenruo ); 147781fb6f77SQu Wenruo 147881fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref, 147981fb6f77SQu Wenruo 14809a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 14819a35b637SJeff Mahoney u64 ref_root, u64 reserved), 148281fb6f77SQu Wenruo 1483bc074524SJeff Mahoney TP_ARGS(fs_info, ref_root, reserved), 148481fb6f77SQu Wenruo 1485bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 148681fb6f77SQu Wenruo __field( u64, ref_root ) 148781fb6f77SQu Wenruo __field( u64, reserved ) 148881fb6f77SQu Wenruo ), 148981fb6f77SQu Wenruo 1490bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 149181fb6f77SQu Wenruo __entry->ref_root = ref_root; 149281fb6f77SQu Wenruo __entry->reserved = reserved; 149381fb6f77SQu Wenruo ), 149481fb6f77SQu Wenruo 1495562a7a07SDavid Sterba TP_printk_btrfs("root=%llu reserved=%llu op=free", 149681fb6f77SQu Wenruo __entry->ref_root, __entry->reserved) 149781fb6f77SQu Wenruo ); 149881fb6f77SQu Wenruo 149981fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref, 150081fb6f77SQu Wenruo 15019a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 15029a35b637SJeff Mahoney u64 ref_root, u64 reserved), 150381fb6f77SQu Wenruo 1504bc074524SJeff Mahoney TP_ARGS(fs_info, ref_root, reserved) 150581fb6f77SQu Wenruo ); 15060f5dcf8dSMark Fasheh 15070f5dcf8dSMark Fasheh DECLARE_EVENT_CLASS(btrfs_qgroup_extent, 15089a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 15099a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 15100f5dcf8dSMark Fasheh 1511bc074524SJeff Mahoney TP_ARGS(fs_info, rec), 15120f5dcf8dSMark Fasheh 1513bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15140f5dcf8dSMark Fasheh __field( u64, bytenr ) 15150f5dcf8dSMark Fasheh __field( u64, num_bytes ) 15160f5dcf8dSMark Fasheh ), 15170f5dcf8dSMark Fasheh 1518bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 15190f5dcf8dSMark Fasheh __entry->bytenr = rec->bytenr, 15200f5dcf8dSMark Fasheh __entry->num_bytes = rec->num_bytes; 15210f5dcf8dSMark Fasheh ), 15220f5dcf8dSMark Fasheh 1523562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu", 15240f5dcf8dSMark Fasheh (unsigned long long)__entry->bytenr, 15250f5dcf8dSMark Fasheh (unsigned long long)__entry->num_bytes) 15260f5dcf8dSMark Fasheh ); 15270f5dcf8dSMark Fasheh 15280f5dcf8dSMark Fasheh DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, 15290f5dcf8dSMark Fasheh 15309a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 15319a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 15320f5dcf8dSMark Fasheh 1533bc074524SJeff Mahoney TP_ARGS(fs_info, rec) 15340f5dcf8dSMark Fasheh ); 15350f5dcf8dSMark Fasheh 153650b3e040SQu Wenruo DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent, 15370f5dcf8dSMark Fasheh 15389a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 15399a35b637SJeff Mahoney const struct btrfs_qgroup_extent_record *rec), 15400f5dcf8dSMark Fasheh 1541bc074524SJeff Mahoney TP_ARGS(fs_info, rec) 15420f5dcf8dSMark Fasheh ); 15430f5dcf8dSMark Fasheh 15440f5dcf8dSMark Fasheh TRACE_EVENT(btrfs_qgroup_account_extent, 15450f5dcf8dSMark Fasheh 15469a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 bytenr, 1547bc074524SJeff Mahoney u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), 15480f5dcf8dSMark Fasheh 1549bc074524SJeff Mahoney TP_ARGS(fs_info, bytenr, num_bytes, nr_old_roots, nr_new_roots), 15500f5dcf8dSMark Fasheh 1551bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15520f5dcf8dSMark Fasheh __field( u64, bytenr ) 15530f5dcf8dSMark Fasheh __field( u64, num_bytes ) 15540f5dcf8dSMark Fasheh __field( u64, nr_old_roots ) 15550f5dcf8dSMark Fasheh __field( u64, nr_new_roots ) 15560f5dcf8dSMark Fasheh ), 15570f5dcf8dSMark Fasheh 1558bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 15590f5dcf8dSMark Fasheh __entry->bytenr = bytenr; 15600f5dcf8dSMark Fasheh __entry->num_bytes = num_bytes; 15610f5dcf8dSMark Fasheh __entry->nr_old_roots = nr_old_roots; 15620f5dcf8dSMark Fasheh __entry->nr_new_roots = nr_new_roots; 15630f5dcf8dSMark Fasheh ), 15640f5dcf8dSMark Fasheh 1565562a7a07SDavid Sterba TP_printk_btrfs("bytenr=%llu num_bytes=%llu nr_old_roots=%llu " 15660f5dcf8dSMark Fasheh "nr_new_roots=%llu", 15670f5dcf8dSMark Fasheh __entry->bytenr, 15680f5dcf8dSMark Fasheh __entry->num_bytes, 15690f5dcf8dSMark Fasheh __entry->nr_old_roots, 15700f5dcf8dSMark Fasheh __entry->nr_new_roots) 15710f5dcf8dSMark Fasheh ); 15720f5dcf8dSMark Fasheh 15730f5dcf8dSMark Fasheh TRACE_EVENT(qgroup_update_counters, 15740f5dcf8dSMark Fasheh 15759a35b637SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, u64 qgid, 1576bc074524SJeff Mahoney u64 cur_old_count, u64 cur_new_count), 15770f5dcf8dSMark Fasheh 1578bc074524SJeff Mahoney TP_ARGS(fs_info, qgid, cur_old_count, cur_new_count), 15790f5dcf8dSMark Fasheh 1580bc074524SJeff Mahoney TP_STRUCT__entry_btrfs( 15810f5dcf8dSMark Fasheh __field( u64, qgid ) 15820f5dcf8dSMark Fasheh __field( u64, cur_old_count ) 15830f5dcf8dSMark Fasheh __field( u64, cur_new_count ) 15840f5dcf8dSMark Fasheh ), 15850f5dcf8dSMark Fasheh 1586bc074524SJeff Mahoney TP_fast_assign_btrfs(fs_info, 15870f5dcf8dSMark Fasheh __entry->qgid = qgid; 15880f5dcf8dSMark Fasheh __entry->cur_old_count = cur_old_count; 15890f5dcf8dSMark Fasheh __entry->cur_new_count = cur_new_count; 15900f5dcf8dSMark Fasheh ), 15910f5dcf8dSMark Fasheh 1592562a7a07SDavid Sterba TP_printk_btrfs("qgid=%llu cur_old_count=%llu cur_new_count=%llu", 15930f5dcf8dSMark Fasheh __entry->qgid, 15940f5dcf8dSMark Fasheh __entry->cur_old_count, 15950f5dcf8dSMark Fasheh __entry->cur_new_count) 15960f5dcf8dSMark Fasheh ); 15970f5dcf8dSMark Fasheh 15983159fe7bSQu Wenruo TRACE_EVENT(qgroup_update_reserve, 15993159fe7bSQu Wenruo 16003159fe7bSQu Wenruo TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup, 16013159fe7bSQu Wenruo s64 diff), 16023159fe7bSQu Wenruo 16033159fe7bSQu Wenruo TP_ARGS(fs_info, qgroup, diff), 16043159fe7bSQu Wenruo 16053159fe7bSQu Wenruo TP_STRUCT__entry_btrfs( 16063159fe7bSQu Wenruo __field( u64, qgid ) 16073159fe7bSQu Wenruo __field( u64, cur_reserved ) 16083159fe7bSQu Wenruo __field( s64, diff ) 16093159fe7bSQu Wenruo ), 16103159fe7bSQu Wenruo 16113159fe7bSQu Wenruo TP_fast_assign_btrfs(fs_info, 16123159fe7bSQu Wenruo __entry->qgid = qgroup->qgroupid; 16133159fe7bSQu Wenruo __entry->cur_reserved = qgroup->reserved; 16143159fe7bSQu Wenruo __entry->diff = diff; 16153159fe7bSQu Wenruo ), 16163159fe7bSQu Wenruo 16173159fe7bSQu Wenruo TP_printk_btrfs("qgid=%llu cur_reserved=%llu diff=%lld", 16183159fe7bSQu Wenruo __entry->qgid, __entry->cur_reserved, __entry->diff) 16193159fe7bSQu Wenruo ); 16203159fe7bSQu Wenruo 16213159fe7bSQu Wenruo TRACE_EVENT(qgroup_meta_reserve, 16223159fe7bSQu Wenruo 16233159fe7bSQu Wenruo TP_PROTO(struct btrfs_root *root, s64 diff), 16243159fe7bSQu Wenruo 16253159fe7bSQu Wenruo TP_ARGS(root, diff), 16263159fe7bSQu Wenruo 16273159fe7bSQu Wenruo TP_STRUCT__entry_btrfs( 16283159fe7bSQu Wenruo __field( u64, refroot ) 16293159fe7bSQu Wenruo __field( s64, diff ) 16303159fe7bSQu Wenruo ), 16313159fe7bSQu Wenruo 16323159fe7bSQu Wenruo TP_fast_assign_btrfs(root->fs_info, 16333159fe7bSQu Wenruo __entry->refroot = root->objectid; 16343159fe7bSQu Wenruo __entry->diff = diff; 16353159fe7bSQu Wenruo ), 16363159fe7bSQu Wenruo 16373159fe7bSQu Wenruo TP_printk_btrfs("refroot=%llu(%s) diff=%lld", 16383159fe7bSQu Wenruo show_root_type(__entry->refroot), __entry->diff) 16393159fe7bSQu Wenruo ); 16403159fe7bSQu Wenruo 164100142756SJeff Mahoney DECLARE_EVENT_CLASS(btrfs__prelim_ref, 164200142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 164300142756SJeff Mahoney const struct prelim_ref *oldref, 164400142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 164500142756SJeff Mahoney TP_ARGS(fs_info, newref, oldref, tree_size), 164600142756SJeff Mahoney 164700142756SJeff Mahoney TP_STRUCT__entry_btrfs( 164800142756SJeff Mahoney __field( u64, root_id ) 164900142756SJeff Mahoney __field( u64, objectid ) 165000142756SJeff Mahoney __field( u8, type ) 165100142756SJeff Mahoney __field( u64, offset ) 165200142756SJeff Mahoney __field( int, level ) 165300142756SJeff Mahoney __field( int, old_count ) 165400142756SJeff Mahoney __field( u64, parent ) 165500142756SJeff Mahoney __field( u64, bytenr ) 165600142756SJeff Mahoney __field( int, mod_count ) 165700142756SJeff Mahoney __field( u64, tree_size ) 165800142756SJeff Mahoney ), 165900142756SJeff Mahoney 166000142756SJeff Mahoney TP_fast_assign_btrfs(fs_info, 166100142756SJeff Mahoney __entry->root_id = oldref->root_id; 166200142756SJeff Mahoney __entry->objectid = oldref->key_for_search.objectid; 166300142756SJeff Mahoney __entry->type = oldref->key_for_search.type; 166400142756SJeff Mahoney __entry->offset = oldref->key_for_search.offset; 166500142756SJeff Mahoney __entry->level = oldref->level; 166600142756SJeff Mahoney __entry->old_count = oldref->count; 166700142756SJeff Mahoney __entry->parent = oldref->parent; 166800142756SJeff Mahoney __entry->bytenr = oldref->wanted_disk_byte; 166900142756SJeff Mahoney __entry->mod_count = newref ? newref->count : 0; 167000142756SJeff Mahoney __entry->tree_size = tree_size; 167100142756SJeff Mahoney ), 167200142756SJeff Mahoney 167300142756SJeff 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", 167400142756SJeff Mahoney (unsigned long long)__entry->root_id, 167500142756SJeff Mahoney (unsigned long long)__entry->objectid, __entry->type, 167600142756SJeff Mahoney (unsigned long long)__entry->offset, __entry->level, 167700142756SJeff Mahoney __entry->old_count, __entry->mod_count, 167800142756SJeff Mahoney __entry->old_count + __entry->mod_count, 167900142756SJeff Mahoney (unsigned long long)__entry->parent, 168000142756SJeff Mahoney (unsigned long long)__entry->bytenr, 168100142756SJeff Mahoney (unsigned long long)__entry->tree_size) 168200142756SJeff Mahoney ); 168300142756SJeff Mahoney 168400142756SJeff Mahoney DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge, 168500142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 168600142756SJeff Mahoney const struct prelim_ref *oldref, 168700142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 168800142756SJeff Mahoney TP_ARGS(fs_info, oldref, newref, tree_size) 168900142756SJeff Mahoney ); 169000142756SJeff Mahoney 169100142756SJeff Mahoney DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert, 169200142756SJeff Mahoney TP_PROTO(const struct btrfs_fs_info *fs_info, 169300142756SJeff Mahoney const struct prelim_ref *oldref, 169400142756SJeff Mahoney const struct prelim_ref *newref, u64 tree_size), 169500142756SJeff Mahoney TP_ARGS(fs_info, oldref, newref, tree_size) 169600142756SJeff Mahoney ); 169700142756SJeff Mahoney 1698dd48d407SJosef Bacik TRACE_EVENT(btrfs_inode_mod_outstanding_extents, 1699dd48d407SJosef Bacik TP_PROTO(struct btrfs_root *root, u64 ino, int mod), 1700dd48d407SJosef Bacik 1701dd48d407SJosef Bacik TP_ARGS(root, ino, mod), 1702dd48d407SJosef Bacik 1703dd48d407SJosef Bacik TP_STRUCT__entry_btrfs( 1704dd48d407SJosef Bacik __field( u64, root_objectid ) 1705dd48d407SJosef Bacik __field( u64, ino ) 1706dd48d407SJosef Bacik __field( int, mod ) 1707dd48d407SJosef Bacik ), 1708dd48d407SJosef Bacik 1709dd48d407SJosef Bacik TP_fast_assign_btrfs(root->fs_info, 1710dd48d407SJosef Bacik __entry->root_objectid = root->objectid; 1711dd48d407SJosef Bacik __entry->ino = ino; 1712dd48d407SJosef Bacik __entry->mod = mod; 1713dd48d407SJosef Bacik ), 1714dd48d407SJosef Bacik 1715dd48d407SJosef Bacik TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d", 1716dd48d407SJosef Bacik show_root_type(__entry->root_objectid), 1717dd48d407SJosef Bacik (unsigned long long)__entry->ino, __entry->mod) 1718dd48d407SJosef Bacik ); 17191abe9b8aSliubo #endif /* _TRACE_BTRFS_H */ 17201abe9b8aSliubo 17211abe9b8aSliubo /* This part must be outside protection */ 17221abe9b8aSliubo #include <trace/define_trace.h> 1723