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> 9143bede5SJeff Mahoney #include <trace/events/gfpflags.h> 101abe9b8aSliubo 111abe9b8aSliubo struct btrfs_root; 121abe9b8aSliubo struct btrfs_fs_info; 131abe9b8aSliubo struct btrfs_inode; 141abe9b8aSliubo struct extent_map; 151abe9b8aSliubo struct btrfs_ordered_extent; 161abe9b8aSliubo struct btrfs_delayed_ref_node; 171abe9b8aSliubo struct btrfs_delayed_tree_ref; 181abe9b8aSliubo struct btrfs_delayed_data_ref; 191abe9b8aSliubo struct btrfs_delayed_ref_head; 203f7de037SJosef Bacik struct btrfs_block_group_cache; 213f7de037SJosef Bacik struct btrfs_free_cluster; 221abe9b8aSliubo struct map_lookup; 231abe9b8aSliubo struct extent_buffer; 241abe9b8aSliubo 251abe9b8aSliubo #define show_ref_type(type) \ 261abe9b8aSliubo __print_symbolic(type, \ 271abe9b8aSliubo { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ 281abe9b8aSliubo { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ 291abe9b8aSliubo { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ 301abe9b8aSliubo { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ 311abe9b8aSliubo { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) 321abe9b8aSliubo 331abe9b8aSliubo #define __show_root_type(obj) \ 347f34b746Sliubo __print_symbolic_u64(obj, \ 351abe9b8aSliubo { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ 361abe9b8aSliubo { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ 371abe9b8aSliubo { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ 381abe9b8aSliubo { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ 391abe9b8aSliubo { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ 401abe9b8aSliubo { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ 411abe9b8aSliubo { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ 421abe9b8aSliubo { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ 43e112e2b4SLiu Bo { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ 441abe9b8aSliubo { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ 4513fd8da9SDavid Sterba { BTRFS_UUID_TREE_OBJECTID, "UUID_RELOC" }, \ 461abe9b8aSliubo { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) 471abe9b8aSliubo 481abe9b8aSliubo #define show_root_type(obj) \ 491abe9b8aSliubo obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ 50fb57dc81SLiu Bo (obj >= BTRFS_ROOT_TREE_OBJECTID && \ 51e112e2b4SLiu Bo obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" 521abe9b8aSliubo 533f7de037SJosef Bacik #define BTRFS_GROUP_FLAGS \ 543f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ 553f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 563f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 573f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ 583f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ 593f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ 60e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 61e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ 62e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} 633f7de037SJosef Bacik 648c2a3ca2SJosef Bacik #define BTRFS_UUID_SIZE 16 658c2a3ca2SJosef Bacik 661abe9b8aSliubo TRACE_EVENT(btrfs_transaction_commit, 671abe9b8aSliubo 681abe9b8aSliubo TP_PROTO(struct btrfs_root *root), 691abe9b8aSliubo 701abe9b8aSliubo TP_ARGS(root), 711abe9b8aSliubo 721abe9b8aSliubo TP_STRUCT__entry( 731abe9b8aSliubo __field( u64, generation ) 741abe9b8aSliubo __field( u64, root_objectid ) 751abe9b8aSliubo ), 761abe9b8aSliubo 771abe9b8aSliubo TP_fast_assign( 781abe9b8aSliubo __entry->generation = root->fs_info->generation; 791abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 801abe9b8aSliubo ), 811abe9b8aSliubo 821abe9b8aSliubo TP_printk("root = %llu(%s), gen = %llu", 831abe9b8aSliubo show_root_type(__entry->root_objectid), 841abe9b8aSliubo (unsigned long long)__entry->generation) 851abe9b8aSliubo ); 861abe9b8aSliubo 871abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__inode, 881abe9b8aSliubo 891abe9b8aSliubo TP_PROTO(struct inode *inode), 901abe9b8aSliubo 911abe9b8aSliubo TP_ARGS(inode), 921abe9b8aSliubo 931abe9b8aSliubo TP_STRUCT__entry( 941abe9b8aSliubo __field( ino_t, ino ) 951abe9b8aSliubo __field( blkcnt_t, blocks ) 961abe9b8aSliubo __field( u64, disk_i_size ) 971abe9b8aSliubo __field( u64, generation ) 981abe9b8aSliubo __field( u64, last_trans ) 991abe9b8aSliubo __field( u64, logged_trans ) 1001abe9b8aSliubo __field( u64, root_objectid ) 1011abe9b8aSliubo ), 1021abe9b8aSliubo 1031abe9b8aSliubo TP_fast_assign( 1041abe9b8aSliubo __entry->ino = inode->i_ino; 1051abe9b8aSliubo __entry->blocks = inode->i_blocks; 1061abe9b8aSliubo __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; 1071abe9b8aSliubo __entry->generation = BTRFS_I(inode)->generation; 1081abe9b8aSliubo __entry->last_trans = BTRFS_I(inode)->last_trans; 1091abe9b8aSliubo __entry->logged_trans = BTRFS_I(inode)->logged_trans; 1101abe9b8aSliubo __entry->root_objectid = 1111abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 1121abe9b8aSliubo ), 1131abe9b8aSliubo 1141abe9b8aSliubo TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, " 1151abe9b8aSliubo "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu", 1161abe9b8aSliubo show_root_type(__entry->root_objectid), 1171abe9b8aSliubo (unsigned long long)__entry->generation, 1181abe9b8aSliubo (unsigned long)__entry->ino, 1191abe9b8aSliubo (unsigned long long)__entry->blocks, 1201abe9b8aSliubo (unsigned long long)__entry->disk_i_size, 1211abe9b8aSliubo (unsigned long long)__entry->last_trans, 1221abe9b8aSliubo (unsigned long long)__entry->logged_trans) 1231abe9b8aSliubo ); 1241abe9b8aSliubo 1251abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_new, 1261abe9b8aSliubo 1271abe9b8aSliubo TP_PROTO(struct inode *inode), 1281abe9b8aSliubo 1291abe9b8aSliubo TP_ARGS(inode) 1301abe9b8aSliubo ); 1311abe9b8aSliubo 1321abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_request, 1331abe9b8aSliubo 1341abe9b8aSliubo TP_PROTO(struct inode *inode), 1351abe9b8aSliubo 1361abe9b8aSliubo TP_ARGS(inode) 1371abe9b8aSliubo ); 1381abe9b8aSliubo 1391abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, 1401abe9b8aSliubo 1411abe9b8aSliubo TP_PROTO(struct inode *inode), 1421abe9b8aSliubo 1431abe9b8aSliubo TP_ARGS(inode) 1441abe9b8aSliubo ); 1451abe9b8aSliubo 1461abe9b8aSliubo #define __show_map_type(type) \ 1477f34b746Sliubo __print_symbolic_u64(type, \ 1481abe9b8aSliubo { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ 1491abe9b8aSliubo { EXTENT_MAP_HOLE, "HOLE" }, \ 1501abe9b8aSliubo { EXTENT_MAP_INLINE, "INLINE" }, \ 1511abe9b8aSliubo { EXTENT_MAP_DELALLOC, "DELALLOC" }) 1521abe9b8aSliubo 1531abe9b8aSliubo #define show_map_type(type) \ 1541abe9b8aSliubo type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) 1551abe9b8aSliubo 1561abe9b8aSliubo #define show_map_flags(flag) \ 1571abe9b8aSliubo __print_flags(flag, "|", \ 1581abe9b8aSliubo { EXTENT_FLAG_PINNED, "PINNED" }, \ 1591abe9b8aSliubo { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \ 1601abe9b8aSliubo { EXTENT_FLAG_VACANCY, "VACANCY" }, \ 161e112e2b4SLiu Bo { EXTENT_FLAG_PREALLOC, "PREALLOC" }, \ 162e112e2b4SLiu Bo { EXTENT_FLAG_LOGGING, "LOGGING" }, \ 163e112e2b4SLiu Bo { EXTENT_FLAG_FILLING, "FILLING" }) 1641abe9b8aSliubo 1654cd8587cSSteven Rostedt TRACE_EVENT_CONDITION(btrfs_get_extent, 1661abe9b8aSliubo 1671abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct extent_map *map), 1681abe9b8aSliubo 1691abe9b8aSliubo TP_ARGS(root, map), 1701abe9b8aSliubo 1714cd8587cSSteven Rostedt TP_CONDITION(map), 1724cd8587cSSteven Rostedt 1731abe9b8aSliubo TP_STRUCT__entry( 1741abe9b8aSliubo __field( u64, root_objectid ) 1751abe9b8aSliubo __field( u64, start ) 1761abe9b8aSliubo __field( u64, len ) 1771abe9b8aSliubo __field( u64, orig_start ) 1781abe9b8aSliubo __field( u64, block_start ) 1791abe9b8aSliubo __field( u64, block_len ) 1801abe9b8aSliubo __field( unsigned long, flags ) 1811abe9b8aSliubo __field( int, refs ) 1821abe9b8aSliubo __field( unsigned int, compress_type ) 1831abe9b8aSliubo ), 1841abe9b8aSliubo 1851abe9b8aSliubo TP_fast_assign( 1861abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 1871abe9b8aSliubo __entry->start = map->start; 1881abe9b8aSliubo __entry->len = map->len; 1891abe9b8aSliubo __entry->orig_start = map->orig_start; 1901abe9b8aSliubo __entry->block_start = map->block_start; 1911abe9b8aSliubo __entry->block_len = map->block_len; 1921abe9b8aSliubo __entry->flags = map->flags; 1931abe9b8aSliubo __entry->refs = atomic_read(&map->refs); 1941abe9b8aSliubo __entry->compress_type = map->compress_type; 1951abe9b8aSliubo ), 1961abe9b8aSliubo 1971abe9b8aSliubo TP_printk("root = %llu(%s), start = %llu, len = %llu, " 1981abe9b8aSliubo "orig_start = %llu, block_start = %llu(%s), " 1991abe9b8aSliubo "block_len = %llu, flags = %s, refs = %u, " 2001abe9b8aSliubo "compress_type = %u", 2011abe9b8aSliubo show_root_type(__entry->root_objectid), 2021abe9b8aSliubo (unsigned long long)__entry->start, 2031abe9b8aSliubo (unsigned long long)__entry->len, 2041abe9b8aSliubo (unsigned long long)__entry->orig_start, 2051abe9b8aSliubo show_map_type(__entry->block_start), 2061abe9b8aSliubo (unsigned long long)__entry->block_len, 2071abe9b8aSliubo show_map_flags(__entry->flags), 2081abe9b8aSliubo __entry->refs, __entry->compress_type) 2091abe9b8aSliubo ); 2101abe9b8aSliubo 2111abe9b8aSliubo #define show_ordered_flags(flags) \ 2129d04a8ceSLiu Bo __print_flags(flags, "|", \ 2139d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ 2149d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ 2159d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ 2169d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ 2179d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ 2189d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ 2199d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ 2209d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \ 221*792ddef0SLiu Bo { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \ 222*792ddef0SLiu Bo { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) 223e112e2b4SLiu Bo 2241abe9b8aSliubo 2251abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__ordered_extent, 2261abe9b8aSliubo 2271abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 2281abe9b8aSliubo 2291abe9b8aSliubo TP_ARGS(inode, ordered), 2301abe9b8aSliubo 2311abe9b8aSliubo TP_STRUCT__entry( 2321abe9b8aSliubo __field( ino_t, ino ) 2331abe9b8aSliubo __field( u64, file_offset ) 2341abe9b8aSliubo __field( u64, start ) 2351abe9b8aSliubo __field( u64, len ) 2361abe9b8aSliubo __field( u64, disk_len ) 2371abe9b8aSliubo __field( u64, bytes_left ) 2381abe9b8aSliubo __field( unsigned long, flags ) 2391abe9b8aSliubo __field( int, compress_type ) 2401abe9b8aSliubo __field( int, refs ) 2411abe9b8aSliubo __field( u64, root_objectid ) 2421abe9b8aSliubo ), 2431abe9b8aSliubo 2441abe9b8aSliubo TP_fast_assign( 2451abe9b8aSliubo __entry->ino = inode->i_ino; 2461abe9b8aSliubo __entry->file_offset = ordered->file_offset; 2471abe9b8aSliubo __entry->start = ordered->start; 2481abe9b8aSliubo __entry->len = ordered->len; 2491abe9b8aSliubo __entry->disk_len = ordered->disk_len; 2501abe9b8aSliubo __entry->bytes_left = ordered->bytes_left; 2511abe9b8aSliubo __entry->flags = ordered->flags; 2521abe9b8aSliubo __entry->compress_type = ordered->compress_type; 2531abe9b8aSliubo __entry->refs = atomic_read(&ordered->refs); 2541abe9b8aSliubo __entry->root_objectid = 2551abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 2561abe9b8aSliubo ), 2571abe9b8aSliubo 2581abe9b8aSliubo TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, " 2591abe9b8aSliubo "start = %llu, len = %llu, disk_len = %llu, " 2601abe9b8aSliubo "bytes_left = %llu, flags = %s, compress_type = %d, " 2611abe9b8aSliubo "refs = %d", 2621abe9b8aSliubo show_root_type(__entry->root_objectid), 2631abe9b8aSliubo (unsigned long long)__entry->ino, 2641abe9b8aSliubo (unsigned long long)__entry->file_offset, 2651abe9b8aSliubo (unsigned long long)__entry->start, 2661abe9b8aSliubo (unsigned long long)__entry->len, 2671abe9b8aSliubo (unsigned long long)__entry->disk_len, 2681abe9b8aSliubo (unsigned long long)__entry->bytes_left, 2691abe9b8aSliubo show_ordered_flags(__entry->flags), 2701abe9b8aSliubo __entry->compress_type, __entry->refs) 2711abe9b8aSliubo ); 2721abe9b8aSliubo 2731abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, 2741abe9b8aSliubo 2751abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 2761abe9b8aSliubo 2771abe9b8aSliubo TP_ARGS(inode, ordered) 2781abe9b8aSliubo ); 2791abe9b8aSliubo 2801abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, 2811abe9b8aSliubo 2821abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 2831abe9b8aSliubo 2841abe9b8aSliubo TP_ARGS(inode, ordered) 2851abe9b8aSliubo ); 2861abe9b8aSliubo 2871abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, 2881abe9b8aSliubo 2891abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 2901abe9b8aSliubo 2911abe9b8aSliubo TP_ARGS(inode, ordered) 2921abe9b8aSliubo ); 2931abe9b8aSliubo 2941abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, 2951abe9b8aSliubo 2961abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 2971abe9b8aSliubo 2981abe9b8aSliubo TP_ARGS(inode, ordered) 2991abe9b8aSliubo ); 3001abe9b8aSliubo 3011abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__writepage, 3021abe9b8aSliubo 3031abe9b8aSliubo TP_PROTO(struct page *page, struct inode *inode, 3041abe9b8aSliubo struct writeback_control *wbc), 3051abe9b8aSliubo 3061abe9b8aSliubo TP_ARGS(page, inode, wbc), 3071abe9b8aSliubo 3081abe9b8aSliubo TP_STRUCT__entry( 3091abe9b8aSliubo __field( ino_t, ino ) 3101abe9b8aSliubo __field( pgoff_t, index ) 3111abe9b8aSliubo __field( long, nr_to_write ) 3121abe9b8aSliubo __field( long, pages_skipped ) 3131abe9b8aSliubo __field( loff_t, range_start ) 3141abe9b8aSliubo __field( loff_t, range_end ) 3151abe9b8aSliubo __field( char, for_kupdate ) 3161abe9b8aSliubo __field( char, for_reclaim ) 3171abe9b8aSliubo __field( char, range_cyclic ) 3181abe9b8aSliubo __field( pgoff_t, writeback_index ) 3191abe9b8aSliubo __field( u64, root_objectid ) 3201abe9b8aSliubo ), 3211abe9b8aSliubo 3221abe9b8aSliubo TP_fast_assign( 3231abe9b8aSliubo __entry->ino = inode->i_ino; 3241abe9b8aSliubo __entry->index = page->index; 3251abe9b8aSliubo __entry->nr_to_write = wbc->nr_to_write; 3261abe9b8aSliubo __entry->pages_skipped = wbc->pages_skipped; 3271abe9b8aSliubo __entry->range_start = wbc->range_start; 3281abe9b8aSliubo __entry->range_end = wbc->range_end; 3291abe9b8aSliubo __entry->for_kupdate = wbc->for_kupdate; 3301abe9b8aSliubo __entry->for_reclaim = wbc->for_reclaim; 3311abe9b8aSliubo __entry->range_cyclic = wbc->range_cyclic; 3321abe9b8aSliubo __entry->writeback_index = inode->i_mapping->writeback_index; 3331abe9b8aSliubo __entry->root_objectid = 3341abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 3351abe9b8aSliubo ), 3361abe9b8aSliubo 3371abe9b8aSliubo TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, " 3381abe9b8aSliubo "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, " 339846d5a09SWu Fengguang "range_end = %llu, for_kupdate = %d, " 3401abe9b8aSliubo "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu", 3411abe9b8aSliubo show_root_type(__entry->root_objectid), 3421abe9b8aSliubo (unsigned long)__entry->ino, __entry->index, 3431abe9b8aSliubo __entry->nr_to_write, __entry->pages_skipped, 3441abe9b8aSliubo __entry->range_start, __entry->range_end, 345846d5a09SWu Fengguang __entry->for_kupdate, 3461abe9b8aSliubo __entry->for_reclaim, __entry->range_cyclic, 3471abe9b8aSliubo (unsigned long)__entry->writeback_index) 3481abe9b8aSliubo ); 3491abe9b8aSliubo 3501abe9b8aSliubo DEFINE_EVENT(btrfs__writepage, __extent_writepage, 3511abe9b8aSliubo 3521abe9b8aSliubo TP_PROTO(struct page *page, struct inode *inode, 3531abe9b8aSliubo struct writeback_control *wbc), 3541abe9b8aSliubo 3551abe9b8aSliubo TP_ARGS(page, inode, wbc) 3561abe9b8aSliubo ); 3571abe9b8aSliubo 3581abe9b8aSliubo TRACE_EVENT(btrfs_writepage_end_io_hook, 3591abe9b8aSliubo 3601abe9b8aSliubo TP_PROTO(struct page *page, u64 start, u64 end, int uptodate), 3611abe9b8aSliubo 3621abe9b8aSliubo TP_ARGS(page, start, end, uptodate), 3631abe9b8aSliubo 3641abe9b8aSliubo TP_STRUCT__entry( 3651abe9b8aSliubo __field( ino_t, ino ) 3661abe9b8aSliubo __field( pgoff_t, index ) 3671abe9b8aSliubo __field( u64, start ) 3681abe9b8aSliubo __field( u64, end ) 3691abe9b8aSliubo __field( int, uptodate ) 3701abe9b8aSliubo __field( u64, root_objectid ) 3711abe9b8aSliubo ), 3721abe9b8aSliubo 3731abe9b8aSliubo TP_fast_assign( 3741abe9b8aSliubo __entry->ino = page->mapping->host->i_ino; 3751abe9b8aSliubo __entry->index = page->index; 3761abe9b8aSliubo __entry->start = start; 3771abe9b8aSliubo __entry->end = end; 3781abe9b8aSliubo __entry->uptodate = uptodate; 3791abe9b8aSliubo __entry->root_objectid = 3801abe9b8aSliubo BTRFS_I(page->mapping->host)->root->root_key.objectid; 3811abe9b8aSliubo ), 3821abe9b8aSliubo 3831abe9b8aSliubo TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, " 3841abe9b8aSliubo "end = %llu, uptodate = %d", 3851abe9b8aSliubo show_root_type(__entry->root_objectid), 3861abe9b8aSliubo (unsigned long)__entry->ino, (unsigned long)__entry->index, 3871abe9b8aSliubo (unsigned long long)__entry->start, 3881abe9b8aSliubo (unsigned long long)__entry->end, __entry->uptodate) 3891abe9b8aSliubo ); 3901abe9b8aSliubo 3911abe9b8aSliubo TRACE_EVENT(btrfs_sync_file, 3921abe9b8aSliubo 3931abe9b8aSliubo TP_PROTO(struct file *file, int datasync), 3941abe9b8aSliubo 3951abe9b8aSliubo TP_ARGS(file, datasync), 3961abe9b8aSliubo 3971abe9b8aSliubo TP_STRUCT__entry( 3981abe9b8aSliubo __field( ino_t, ino ) 3991abe9b8aSliubo __field( ino_t, parent ) 4001abe9b8aSliubo __field( int, datasync ) 4011abe9b8aSliubo __field( u64, root_objectid ) 4021abe9b8aSliubo ), 4031abe9b8aSliubo 4041abe9b8aSliubo TP_fast_assign( 4051abe9b8aSliubo struct dentry *dentry = file->f_path.dentry; 4061abe9b8aSliubo struct inode *inode = dentry->d_inode; 4071abe9b8aSliubo 4081abe9b8aSliubo __entry->ino = inode->i_ino; 4091abe9b8aSliubo __entry->parent = dentry->d_parent->d_inode->i_ino; 4101abe9b8aSliubo __entry->datasync = datasync; 4111abe9b8aSliubo __entry->root_objectid = 4121abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 4131abe9b8aSliubo ), 4141abe9b8aSliubo 4151abe9b8aSliubo TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d", 4161abe9b8aSliubo show_root_type(__entry->root_objectid), 4171abe9b8aSliubo (unsigned long)__entry->ino, (unsigned long)__entry->parent, 4181abe9b8aSliubo __entry->datasync) 4191abe9b8aSliubo ); 4201abe9b8aSliubo 4211abe9b8aSliubo TRACE_EVENT(btrfs_sync_fs, 4221abe9b8aSliubo 4231abe9b8aSliubo TP_PROTO(int wait), 4241abe9b8aSliubo 4251abe9b8aSliubo TP_ARGS(wait), 4261abe9b8aSliubo 4271abe9b8aSliubo TP_STRUCT__entry( 4281abe9b8aSliubo __field( int, wait ) 4291abe9b8aSliubo ), 4301abe9b8aSliubo 4311abe9b8aSliubo TP_fast_assign( 4321abe9b8aSliubo __entry->wait = wait; 4331abe9b8aSliubo ), 4341abe9b8aSliubo 4351abe9b8aSliubo TP_printk("wait = %d", __entry->wait) 4361abe9b8aSliubo ); 4371abe9b8aSliubo 4381abe9b8aSliubo #define show_ref_action(action) \ 4391abe9b8aSliubo __print_symbolic(action, \ 4401abe9b8aSliubo { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ 4411abe9b8aSliubo { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ 4421abe9b8aSliubo { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ 4431abe9b8aSliubo { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) 4441abe9b8aSliubo 4451abe9b8aSliubo 446599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, 4471abe9b8aSliubo 4481abe9b8aSliubo TP_PROTO(struct btrfs_delayed_ref_node *ref, 4491abe9b8aSliubo struct btrfs_delayed_tree_ref *full_ref, 4501abe9b8aSliubo int action), 4511abe9b8aSliubo 4521abe9b8aSliubo TP_ARGS(ref, full_ref, action), 4531abe9b8aSliubo 4541abe9b8aSliubo TP_STRUCT__entry( 4551abe9b8aSliubo __field( u64, bytenr ) 4561abe9b8aSliubo __field( u64, num_bytes ) 4571abe9b8aSliubo __field( int, action ) 4581abe9b8aSliubo __field( u64, parent ) 4591abe9b8aSliubo __field( u64, ref_root ) 4601abe9b8aSliubo __field( int, level ) 4611abe9b8aSliubo __field( int, type ) 462dea7d76eSLiu Bo __field( u64, seq ) 4631abe9b8aSliubo ), 4641abe9b8aSliubo 4651abe9b8aSliubo TP_fast_assign( 4661abe9b8aSliubo __entry->bytenr = ref->bytenr; 4671abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 4681abe9b8aSliubo __entry->action = action; 4691abe9b8aSliubo __entry->parent = full_ref->parent; 4701abe9b8aSliubo __entry->ref_root = full_ref->root; 4711abe9b8aSliubo __entry->level = full_ref->level; 4721abe9b8aSliubo __entry->type = ref->type; 473dea7d76eSLiu Bo __entry->seq = ref->seq; 4741abe9b8aSliubo ), 4751abe9b8aSliubo 4761abe9b8aSliubo TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " 4771abe9b8aSliubo "parent = %llu(%s), ref_root = %llu(%s), level = %d, " 478dea7d76eSLiu Bo "type = %s, seq = %llu", 4791abe9b8aSliubo (unsigned long long)__entry->bytenr, 4801abe9b8aSliubo (unsigned long long)__entry->num_bytes, 4811abe9b8aSliubo show_ref_action(__entry->action), 4821abe9b8aSliubo show_root_type(__entry->parent), 4831abe9b8aSliubo show_root_type(__entry->ref_root), 484dea7d76eSLiu Bo __entry->level, show_ref_type(__entry->type), 485dea7d76eSLiu Bo (unsigned long long)__entry->seq) 4861abe9b8aSliubo ); 4871abe9b8aSliubo 488599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, 489599c75ecSLiu Bo 490599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 491599c75ecSLiu Bo struct btrfs_delayed_tree_ref *full_ref, 492599c75ecSLiu Bo int action), 493599c75ecSLiu Bo 494599c75ecSLiu Bo TP_ARGS(ref, full_ref, action) 495599c75ecSLiu Bo ); 496599c75ecSLiu Bo 497599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, 498599c75ecSLiu Bo 499599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 500599c75ecSLiu Bo struct btrfs_delayed_tree_ref *full_ref, 501599c75ecSLiu Bo int action), 502599c75ecSLiu Bo 503599c75ecSLiu Bo TP_ARGS(ref, full_ref, action) 504599c75ecSLiu Bo ); 505599c75ecSLiu Bo 506599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, 5071abe9b8aSliubo 5081abe9b8aSliubo TP_PROTO(struct btrfs_delayed_ref_node *ref, 5091abe9b8aSliubo struct btrfs_delayed_data_ref *full_ref, 5101abe9b8aSliubo int action), 5111abe9b8aSliubo 5121abe9b8aSliubo TP_ARGS(ref, full_ref, action), 5131abe9b8aSliubo 5141abe9b8aSliubo TP_STRUCT__entry( 5151abe9b8aSliubo __field( u64, bytenr ) 5161abe9b8aSliubo __field( u64, num_bytes ) 5171abe9b8aSliubo __field( int, action ) 5181abe9b8aSliubo __field( u64, parent ) 5191abe9b8aSliubo __field( u64, ref_root ) 5201abe9b8aSliubo __field( u64, owner ) 5211abe9b8aSliubo __field( u64, offset ) 5221abe9b8aSliubo __field( int, type ) 523dea7d76eSLiu Bo __field( u64, seq ) 5241abe9b8aSliubo ), 5251abe9b8aSliubo 5261abe9b8aSliubo TP_fast_assign( 5271abe9b8aSliubo __entry->bytenr = ref->bytenr; 5281abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 5291abe9b8aSliubo __entry->action = action; 5301abe9b8aSliubo __entry->parent = full_ref->parent; 5311abe9b8aSliubo __entry->ref_root = full_ref->root; 5321abe9b8aSliubo __entry->owner = full_ref->objectid; 5331abe9b8aSliubo __entry->offset = full_ref->offset; 5341abe9b8aSliubo __entry->type = ref->type; 535dea7d76eSLiu Bo __entry->seq = ref->seq; 5361abe9b8aSliubo ), 5371abe9b8aSliubo 5381abe9b8aSliubo TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " 5391abe9b8aSliubo "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, " 540dea7d76eSLiu Bo "offset = %llu, type = %s, seq = %llu", 5411abe9b8aSliubo (unsigned long long)__entry->bytenr, 5421abe9b8aSliubo (unsigned long long)__entry->num_bytes, 5431abe9b8aSliubo show_ref_action(__entry->action), 5441abe9b8aSliubo show_root_type(__entry->parent), 5451abe9b8aSliubo show_root_type(__entry->ref_root), 5461abe9b8aSliubo (unsigned long long)__entry->owner, 5471abe9b8aSliubo (unsigned long long)__entry->offset, 548dea7d76eSLiu Bo show_ref_type(__entry->type), 549dea7d76eSLiu Bo (unsigned long long)__entry->seq) 5501abe9b8aSliubo ); 5511abe9b8aSliubo 552599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, 553599c75ecSLiu Bo 554599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 555599c75ecSLiu Bo struct btrfs_delayed_data_ref *full_ref, 556599c75ecSLiu Bo int action), 557599c75ecSLiu Bo 558599c75ecSLiu Bo TP_ARGS(ref, full_ref, action) 559599c75ecSLiu Bo ); 560599c75ecSLiu Bo 561599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, 562599c75ecSLiu Bo 563599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 564599c75ecSLiu Bo struct btrfs_delayed_data_ref *full_ref, 565599c75ecSLiu Bo int action), 566599c75ecSLiu Bo 567599c75ecSLiu Bo TP_ARGS(ref, full_ref, action) 568599c75ecSLiu Bo ); 569599c75ecSLiu Bo 570599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, 5711abe9b8aSliubo 5721abe9b8aSliubo TP_PROTO(struct btrfs_delayed_ref_node *ref, 5731abe9b8aSliubo struct btrfs_delayed_ref_head *head_ref, 5741abe9b8aSliubo int action), 5751abe9b8aSliubo 5761abe9b8aSliubo TP_ARGS(ref, head_ref, action), 5771abe9b8aSliubo 5781abe9b8aSliubo TP_STRUCT__entry( 5791abe9b8aSliubo __field( u64, bytenr ) 5801abe9b8aSliubo __field( u64, num_bytes ) 5811abe9b8aSliubo __field( int, action ) 5821abe9b8aSliubo __field( int, is_data ) 5831abe9b8aSliubo ), 5841abe9b8aSliubo 5851abe9b8aSliubo TP_fast_assign( 5861abe9b8aSliubo __entry->bytenr = ref->bytenr; 5871abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 5881abe9b8aSliubo __entry->action = action; 5891abe9b8aSliubo __entry->is_data = head_ref->is_data; 5901abe9b8aSliubo ), 5911abe9b8aSliubo 5921abe9b8aSliubo TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d", 5931abe9b8aSliubo (unsigned long long)__entry->bytenr, 5941abe9b8aSliubo (unsigned long long)__entry->num_bytes, 5951abe9b8aSliubo show_ref_action(__entry->action), 5961abe9b8aSliubo __entry->is_data) 5971abe9b8aSliubo ); 5981abe9b8aSliubo 599599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, 600599c75ecSLiu Bo 601599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 602599c75ecSLiu Bo struct btrfs_delayed_ref_head *head_ref, 603599c75ecSLiu Bo int action), 604599c75ecSLiu Bo 605599c75ecSLiu Bo TP_ARGS(ref, head_ref, action) 606599c75ecSLiu Bo ); 607599c75ecSLiu Bo 608599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, 609599c75ecSLiu Bo 610599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 611599c75ecSLiu Bo struct btrfs_delayed_ref_head *head_ref, 612599c75ecSLiu Bo int action), 613599c75ecSLiu Bo 614599c75ecSLiu Bo TP_ARGS(ref, head_ref, action) 615599c75ecSLiu Bo ); 616599c75ecSLiu Bo 6171abe9b8aSliubo #define show_chunk_type(type) \ 6181abe9b8aSliubo __print_flags(type, "|", \ 6191abe9b8aSliubo { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ 6201abe9b8aSliubo { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 6211abe9b8aSliubo { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 6221abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ 6231abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ 6241abe9b8aSliubo { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ 625e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 626e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ 627e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) 6281abe9b8aSliubo 6291abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__chunk, 6301abe9b8aSliubo 6311abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct map_lookup *map, 6321abe9b8aSliubo u64 offset, u64 size), 6331abe9b8aSliubo 6341abe9b8aSliubo TP_ARGS(root, map, offset, size), 6351abe9b8aSliubo 6361abe9b8aSliubo TP_STRUCT__entry( 6371abe9b8aSliubo __field( int, num_stripes ) 6381abe9b8aSliubo __field( u64, type ) 6391abe9b8aSliubo __field( int, sub_stripes ) 6401abe9b8aSliubo __field( u64, offset ) 6411abe9b8aSliubo __field( u64, size ) 6421abe9b8aSliubo __field( u64, root_objectid ) 6431abe9b8aSliubo ), 6441abe9b8aSliubo 6451abe9b8aSliubo TP_fast_assign( 6461abe9b8aSliubo __entry->num_stripes = map->num_stripes; 6471abe9b8aSliubo __entry->type = map->type; 6481abe9b8aSliubo __entry->sub_stripes = map->sub_stripes; 6491abe9b8aSliubo __entry->offset = offset; 6501abe9b8aSliubo __entry->size = size; 6511abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 6521abe9b8aSliubo ), 6531abe9b8aSliubo 6541abe9b8aSliubo TP_printk("root = %llu(%s), offset = %llu, size = %llu, " 6551abe9b8aSliubo "num_stripes = %d, sub_stripes = %d, type = %s", 6561abe9b8aSliubo show_root_type(__entry->root_objectid), 6571abe9b8aSliubo (unsigned long long)__entry->offset, 6581abe9b8aSliubo (unsigned long long)__entry->size, 6591abe9b8aSliubo __entry->num_stripes, __entry->sub_stripes, 6601abe9b8aSliubo show_chunk_type(__entry->type)) 6611abe9b8aSliubo ); 6621abe9b8aSliubo 6631abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, 6641abe9b8aSliubo 6651abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct map_lookup *map, 6661abe9b8aSliubo u64 offset, u64 size), 6671abe9b8aSliubo 6681abe9b8aSliubo TP_ARGS(root, map, offset, size) 6691abe9b8aSliubo ); 6701abe9b8aSliubo 6711abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, 6721abe9b8aSliubo 6731abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct map_lookup *map, 6741abe9b8aSliubo u64 offset, u64 size), 6751abe9b8aSliubo 6761abe9b8aSliubo TP_ARGS(root, map, offset, size) 6771abe9b8aSliubo ); 6781abe9b8aSliubo 6791abe9b8aSliubo TRACE_EVENT(btrfs_cow_block, 6801abe9b8aSliubo 6811abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf, 6821abe9b8aSliubo struct extent_buffer *cow), 6831abe9b8aSliubo 6841abe9b8aSliubo TP_ARGS(root, buf, cow), 6851abe9b8aSliubo 6861abe9b8aSliubo TP_STRUCT__entry( 6871abe9b8aSliubo __field( u64, root_objectid ) 6881abe9b8aSliubo __field( u64, buf_start ) 6891abe9b8aSliubo __field( int, refs ) 6901abe9b8aSliubo __field( u64, cow_start ) 6911abe9b8aSliubo __field( int, buf_level ) 6921abe9b8aSliubo __field( int, cow_level ) 6931abe9b8aSliubo ), 6941abe9b8aSliubo 6951abe9b8aSliubo TP_fast_assign( 6961abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 6971abe9b8aSliubo __entry->buf_start = buf->start; 6981abe9b8aSliubo __entry->refs = atomic_read(&buf->refs); 6991abe9b8aSliubo __entry->cow_start = cow->start; 7001abe9b8aSliubo __entry->buf_level = btrfs_header_level(buf); 7011abe9b8aSliubo __entry->cow_level = btrfs_header_level(cow); 7021abe9b8aSliubo ), 7031abe9b8aSliubo 7041abe9b8aSliubo TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu " 7051abe9b8aSliubo "(orig_level = %d), cow_buf = %llu (cow_level = %d)", 7061abe9b8aSliubo show_root_type(__entry->root_objectid), 7071abe9b8aSliubo __entry->refs, 7081abe9b8aSliubo (unsigned long long)__entry->buf_start, 7091abe9b8aSliubo __entry->buf_level, 7101abe9b8aSliubo (unsigned long long)__entry->cow_start, 7111abe9b8aSliubo __entry->cow_level) 7121abe9b8aSliubo ); 7131abe9b8aSliubo 7148c2a3ca2SJosef Bacik TRACE_EVENT(btrfs_space_reservation, 7158c2a3ca2SJosef Bacik 7168c2a3ca2SJosef Bacik TP_PROTO(struct btrfs_fs_info *fs_info, char *type, u64 val, 7178c2a3ca2SJosef Bacik u64 bytes, int reserve), 7188c2a3ca2SJosef Bacik 7198c2a3ca2SJosef Bacik TP_ARGS(fs_info, type, val, bytes, reserve), 7208c2a3ca2SJosef Bacik 7218c2a3ca2SJosef Bacik TP_STRUCT__entry( 7228c2a3ca2SJosef Bacik __array( u8, fsid, BTRFS_UUID_SIZE ) 7238c2a3ca2SJosef Bacik __string( type, type ) 7248c2a3ca2SJosef Bacik __field( u64, val ) 7258c2a3ca2SJosef Bacik __field( u64, bytes ) 7268c2a3ca2SJosef Bacik __field( int, reserve ) 7278c2a3ca2SJosef Bacik ), 7288c2a3ca2SJosef Bacik 7298c2a3ca2SJosef Bacik TP_fast_assign( 7308c2a3ca2SJosef Bacik memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE); 7318c2a3ca2SJosef Bacik __assign_str(type, type); 7328c2a3ca2SJosef Bacik __entry->val = val; 7338c2a3ca2SJosef Bacik __entry->bytes = bytes; 7348c2a3ca2SJosef Bacik __entry->reserve = reserve; 7358c2a3ca2SJosef Bacik ), 7368c2a3ca2SJosef Bacik 7378c2a3ca2SJosef Bacik TP_printk("%pU: %s: %Lu %s %Lu", __entry->fsid, __get_str(type), 7388c2a3ca2SJosef Bacik __entry->val, __entry->reserve ? "reserve" : "release", 7398c2a3ca2SJosef Bacik __entry->bytes) 7408c2a3ca2SJosef Bacik ); 7418c2a3ca2SJosef Bacik 7421abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__reserved_extent, 7431abe9b8aSliubo 7441abe9b8aSliubo TP_PROTO(struct btrfs_root *root, u64 start, u64 len), 7451abe9b8aSliubo 7461abe9b8aSliubo TP_ARGS(root, start, len), 7471abe9b8aSliubo 7481abe9b8aSliubo TP_STRUCT__entry( 7491abe9b8aSliubo __field( u64, root_objectid ) 7501abe9b8aSliubo __field( u64, start ) 7511abe9b8aSliubo __field( u64, len ) 7521abe9b8aSliubo ), 7531abe9b8aSliubo 7541abe9b8aSliubo TP_fast_assign( 7551abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 7561abe9b8aSliubo __entry->start = start; 7571abe9b8aSliubo __entry->len = len; 7581abe9b8aSliubo ), 7591abe9b8aSliubo 7601abe9b8aSliubo TP_printk("root = %llu(%s), start = %llu, len = %llu", 7611abe9b8aSliubo show_root_type(__entry->root_objectid), 7621abe9b8aSliubo (unsigned long long)__entry->start, 7631abe9b8aSliubo (unsigned long long)__entry->len) 7641abe9b8aSliubo ); 7651abe9b8aSliubo 7661abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, 7671abe9b8aSliubo 7681abe9b8aSliubo TP_PROTO(struct btrfs_root *root, u64 start, u64 len), 7691abe9b8aSliubo 7701abe9b8aSliubo TP_ARGS(root, start, len) 7711abe9b8aSliubo ); 7721abe9b8aSliubo 7731abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, 7741abe9b8aSliubo 7751abe9b8aSliubo TP_PROTO(struct btrfs_root *root, u64 start, u64 len), 7761abe9b8aSliubo 7771abe9b8aSliubo TP_ARGS(root, start, len) 7781abe9b8aSliubo ); 7791abe9b8aSliubo 7803f7de037SJosef Bacik TRACE_EVENT(find_free_extent, 7813f7de037SJosef Bacik 7823f7de037SJosef Bacik TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size, 7833f7de037SJosef Bacik u64 data), 7843f7de037SJosef Bacik 7853f7de037SJosef Bacik TP_ARGS(root, num_bytes, empty_size, data), 7863f7de037SJosef Bacik 7873f7de037SJosef Bacik TP_STRUCT__entry( 7883f7de037SJosef Bacik __field( u64, root_objectid ) 7893f7de037SJosef Bacik __field( u64, num_bytes ) 7903f7de037SJosef Bacik __field( u64, empty_size ) 7913f7de037SJosef Bacik __field( u64, data ) 7923f7de037SJosef Bacik ), 7933f7de037SJosef Bacik 7943f7de037SJosef Bacik TP_fast_assign( 7953f7de037SJosef Bacik __entry->root_objectid = root->root_key.objectid; 7963f7de037SJosef Bacik __entry->num_bytes = num_bytes; 7973f7de037SJosef Bacik __entry->empty_size = empty_size; 7983f7de037SJosef Bacik __entry->data = data; 7993f7de037SJosef Bacik ), 8003f7de037SJosef Bacik 8013f7de037SJosef Bacik TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, " 8023f7de037SJosef Bacik "flags = %Lu(%s)", show_root_type(__entry->root_objectid), 8033f7de037SJosef Bacik __entry->num_bytes, __entry->empty_size, __entry->data, 8043f7de037SJosef Bacik __print_flags((unsigned long)__entry->data, "|", 8053f7de037SJosef Bacik BTRFS_GROUP_FLAGS)) 8063f7de037SJosef Bacik ); 8073f7de037SJosef Bacik 8083f7de037SJosef Bacik DECLARE_EVENT_CLASS(btrfs__reserve_extent, 8093f7de037SJosef Bacik 8103f7de037SJosef Bacik TP_PROTO(struct btrfs_root *root, 8113f7de037SJosef Bacik struct btrfs_block_group_cache *block_group, u64 start, 8123f7de037SJosef Bacik u64 len), 8133f7de037SJosef Bacik 8143f7de037SJosef Bacik TP_ARGS(root, block_group, start, len), 8153f7de037SJosef Bacik 8163f7de037SJosef Bacik TP_STRUCT__entry( 8173f7de037SJosef Bacik __field( u64, root_objectid ) 8183f7de037SJosef Bacik __field( u64, bg_objectid ) 8193f7de037SJosef Bacik __field( u64, flags ) 8203f7de037SJosef Bacik __field( u64, start ) 8213f7de037SJosef Bacik __field( u64, len ) 8223f7de037SJosef Bacik ), 8233f7de037SJosef Bacik 8243f7de037SJosef Bacik TP_fast_assign( 8253f7de037SJosef Bacik __entry->root_objectid = root->root_key.objectid; 8263f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 8273f7de037SJosef Bacik __entry->flags = block_group->flags; 8283f7de037SJosef Bacik __entry->start = start; 8293f7de037SJosef Bacik __entry->len = len; 8303f7de037SJosef Bacik ), 8313f7de037SJosef Bacik 8323f7de037SJosef Bacik TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), " 8333f7de037SJosef Bacik "start = %Lu, len = %Lu", 8343f7de037SJosef Bacik show_root_type(__entry->root_objectid), __entry->bg_objectid, 8353f7de037SJosef Bacik __entry->flags, __print_flags((unsigned long)__entry->flags, 8363f7de037SJosef Bacik "|", BTRFS_GROUP_FLAGS), 8373f7de037SJosef Bacik __entry->start, __entry->len) 8383f7de037SJosef Bacik ); 8393f7de037SJosef Bacik 8403f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, 8413f7de037SJosef Bacik 8423f7de037SJosef Bacik TP_PROTO(struct btrfs_root *root, 8433f7de037SJosef Bacik struct btrfs_block_group_cache *block_group, u64 start, 8443f7de037SJosef Bacik u64 len), 8453f7de037SJosef Bacik 8463f7de037SJosef Bacik TP_ARGS(root, block_group, start, len) 8473f7de037SJosef Bacik ); 8483f7de037SJosef Bacik 8493f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, 8503f7de037SJosef Bacik 8513f7de037SJosef Bacik TP_PROTO(struct btrfs_root *root, 8523f7de037SJosef Bacik struct btrfs_block_group_cache *block_group, u64 start, 8533f7de037SJosef Bacik u64 len), 8543f7de037SJosef Bacik 8553f7de037SJosef Bacik TP_ARGS(root, block_group, start, len) 8563f7de037SJosef Bacik ); 8573f7de037SJosef Bacik 8583f7de037SJosef Bacik TRACE_EVENT(btrfs_find_cluster, 8593f7de037SJosef Bacik 8603f7de037SJosef Bacik TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start, 8613f7de037SJosef Bacik u64 bytes, u64 empty_size, u64 min_bytes), 8623f7de037SJosef Bacik 8633f7de037SJosef Bacik TP_ARGS(block_group, start, bytes, empty_size, min_bytes), 8643f7de037SJosef Bacik 8653f7de037SJosef Bacik TP_STRUCT__entry( 8663f7de037SJosef Bacik __field( u64, bg_objectid ) 8673f7de037SJosef Bacik __field( u64, flags ) 8683f7de037SJosef Bacik __field( u64, start ) 8693f7de037SJosef Bacik __field( u64, bytes ) 8703f7de037SJosef Bacik __field( u64, empty_size ) 8713f7de037SJosef Bacik __field( u64, min_bytes ) 8723f7de037SJosef Bacik ), 8733f7de037SJosef Bacik 8743f7de037SJosef Bacik TP_fast_assign( 8753f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 8763f7de037SJosef Bacik __entry->flags = block_group->flags; 8773f7de037SJosef Bacik __entry->start = start; 8783f7de037SJosef Bacik __entry->bytes = bytes; 8793f7de037SJosef Bacik __entry->empty_size = empty_size; 8803f7de037SJosef Bacik __entry->min_bytes = min_bytes; 8813f7de037SJosef Bacik ), 8823f7de037SJosef Bacik 8833f7de037SJosef Bacik TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu," 8843f7de037SJosef Bacik " empty_size = %Lu, min_bytes = %Lu", __entry->bg_objectid, 8853f7de037SJosef Bacik __entry->flags, 8863f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 8873f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 8883f7de037SJosef Bacik __entry->bytes, __entry->empty_size, __entry->min_bytes) 8893f7de037SJosef Bacik ); 8903f7de037SJosef Bacik 8913f7de037SJosef Bacik TRACE_EVENT(btrfs_failed_cluster_setup, 8923f7de037SJosef Bacik 8933f7de037SJosef Bacik TP_PROTO(struct btrfs_block_group_cache *block_group), 8943f7de037SJosef Bacik 8953f7de037SJosef Bacik TP_ARGS(block_group), 8963f7de037SJosef Bacik 8973f7de037SJosef Bacik TP_STRUCT__entry( 8983f7de037SJosef Bacik __field( u64, bg_objectid ) 8993f7de037SJosef Bacik ), 9003f7de037SJosef Bacik 9013f7de037SJosef Bacik TP_fast_assign( 9023f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 9033f7de037SJosef Bacik ), 9043f7de037SJosef Bacik 9053f7de037SJosef Bacik TP_printk("block_group = %Lu", __entry->bg_objectid) 9063f7de037SJosef Bacik ); 9073f7de037SJosef Bacik 9083f7de037SJosef Bacik TRACE_EVENT(btrfs_setup_cluster, 9093f7de037SJosef Bacik 9103f7de037SJosef Bacik TP_PROTO(struct btrfs_block_group_cache *block_group, 9113f7de037SJosef Bacik struct btrfs_free_cluster *cluster, u64 size, int bitmap), 9123f7de037SJosef Bacik 9133f7de037SJosef Bacik TP_ARGS(block_group, cluster, size, bitmap), 9143f7de037SJosef Bacik 9153f7de037SJosef Bacik TP_STRUCT__entry( 9163f7de037SJosef Bacik __field( u64, bg_objectid ) 9173f7de037SJosef Bacik __field( u64, flags ) 9183f7de037SJosef Bacik __field( u64, start ) 9193f7de037SJosef Bacik __field( u64, max_size ) 9203f7de037SJosef Bacik __field( u64, size ) 9213f7de037SJosef Bacik __field( int, bitmap ) 9223f7de037SJosef Bacik ), 9233f7de037SJosef Bacik 9243f7de037SJosef Bacik TP_fast_assign( 9253f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 9263f7de037SJosef Bacik __entry->flags = block_group->flags; 9273f7de037SJosef Bacik __entry->start = cluster->window_start; 9283f7de037SJosef Bacik __entry->max_size = cluster->max_size; 9293f7de037SJosef Bacik __entry->size = size; 9303f7de037SJosef Bacik __entry->bitmap = bitmap; 9313f7de037SJosef Bacik ), 9323f7de037SJosef Bacik 9333f7de037SJosef Bacik TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, " 9343f7de037SJosef Bacik "size = %Lu, max_size = %Lu, bitmap = %d", 9353f7de037SJosef Bacik __entry->bg_objectid, 9363f7de037SJosef Bacik __entry->flags, 9373f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 9383f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 9393f7de037SJosef Bacik __entry->size, __entry->max_size, __entry->bitmap) 9403f7de037SJosef Bacik ); 9413f7de037SJosef Bacik 942143bede5SJeff Mahoney struct extent_state; 943143bede5SJeff Mahoney TRACE_EVENT(alloc_extent_state, 944143bede5SJeff Mahoney 945143bede5SJeff Mahoney TP_PROTO(struct extent_state *state, gfp_t mask, unsigned long IP), 946143bede5SJeff Mahoney 947143bede5SJeff Mahoney TP_ARGS(state, mask, IP), 948143bede5SJeff Mahoney 949143bede5SJeff Mahoney TP_STRUCT__entry( 950143bede5SJeff Mahoney __field(struct extent_state *, state) 951143bede5SJeff Mahoney __field(gfp_t, mask) 952143bede5SJeff Mahoney __field(unsigned long, ip) 953143bede5SJeff Mahoney ), 954143bede5SJeff Mahoney 955143bede5SJeff Mahoney TP_fast_assign( 956143bede5SJeff Mahoney __entry->state = state, 957143bede5SJeff Mahoney __entry->mask = mask, 958143bede5SJeff Mahoney __entry->ip = IP 959143bede5SJeff Mahoney ), 960143bede5SJeff Mahoney 961143bede5SJeff Mahoney TP_printk("state=%p; mask = %s; caller = %pF", __entry->state, 962143bede5SJeff Mahoney show_gfp_flags(__entry->mask), (void *)__entry->ip) 963143bede5SJeff Mahoney ); 964143bede5SJeff Mahoney 965143bede5SJeff Mahoney TRACE_EVENT(free_extent_state, 966143bede5SJeff Mahoney 967143bede5SJeff Mahoney TP_PROTO(struct extent_state *state, unsigned long IP), 968143bede5SJeff Mahoney 969143bede5SJeff Mahoney TP_ARGS(state, IP), 970143bede5SJeff Mahoney 971143bede5SJeff Mahoney TP_STRUCT__entry( 972143bede5SJeff Mahoney __field(struct extent_state *, state) 973143bede5SJeff Mahoney __field(unsigned long, ip) 974143bede5SJeff Mahoney ), 975143bede5SJeff Mahoney 976143bede5SJeff Mahoney TP_fast_assign( 977143bede5SJeff Mahoney __entry->state = state, 978143bede5SJeff Mahoney __entry->ip = IP 979143bede5SJeff Mahoney ), 980143bede5SJeff Mahoney 981143bede5SJeff Mahoney TP_printk(" state=%p; caller = %pF", __entry->state, 982143bede5SJeff Mahoney (void *)__entry->ip) 983143bede5SJeff Mahoney ); 984143bede5SJeff Mahoney 9851abe9b8aSliubo #endif /* _TRACE_BTRFS_H */ 9861abe9b8aSliubo 9871abe9b8aSliubo /* This part must be outside protection */ 9881abe9b8aSliubo #include <trace/define_trace.h> 989