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; 2452483bc2SQu Wenruo struct btrfs_work; 25c3a46891SQu Wenruo struct __btrfs_workqueue; 26*0f5dcf8dSMark Fasheh struct btrfs_qgroup_extent_record; 271abe9b8aSliubo 281abe9b8aSliubo #define show_ref_type(type) \ 291abe9b8aSliubo __print_symbolic(type, \ 301abe9b8aSliubo { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ 311abe9b8aSliubo { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ 321abe9b8aSliubo { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ 331abe9b8aSliubo { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ 341abe9b8aSliubo { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) 351abe9b8aSliubo 361abe9b8aSliubo #define __show_root_type(obj) \ 377f34b746Sliubo __print_symbolic_u64(obj, \ 381abe9b8aSliubo { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ 391abe9b8aSliubo { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ 401abe9b8aSliubo { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ 411abe9b8aSliubo { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ 421abe9b8aSliubo { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ 431abe9b8aSliubo { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ 441abe9b8aSliubo { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ 451abe9b8aSliubo { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ 46e112e2b4SLiu Bo { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ 471abe9b8aSliubo { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ 48208acb8cSOmar Sandoval { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \ 49208acb8cSOmar Sandoval { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \ 501abe9b8aSliubo { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) 511abe9b8aSliubo 521abe9b8aSliubo #define show_root_type(obj) \ 531abe9b8aSliubo obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ 54fb57dc81SLiu Bo (obj >= BTRFS_ROOT_TREE_OBJECTID && \ 55e112e2b4SLiu Bo obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" 561abe9b8aSliubo 573f7de037SJosef Bacik #define BTRFS_GROUP_FLAGS \ 583f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ 593f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 603f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 613f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ 623f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ 633f7de037SJosef Bacik { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ 64e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 65e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ 66e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} 673f7de037SJosef Bacik 688c2a3ca2SJosef Bacik #define BTRFS_UUID_SIZE 16 698c2a3ca2SJosef Bacik 701abe9b8aSliubo TRACE_EVENT(btrfs_transaction_commit, 711abe9b8aSliubo 721abe9b8aSliubo TP_PROTO(struct btrfs_root *root), 731abe9b8aSliubo 741abe9b8aSliubo TP_ARGS(root), 751abe9b8aSliubo 761abe9b8aSliubo TP_STRUCT__entry( 771abe9b8aSliubo __field( u64, generation ) 781abe9b8aSliubo __field( u64, root_objectid ) 791abe9b8aSliubo ), 801abe9b8aSliubo 811abe9b8aSliubo TP_fast_assign( 821abe9b8aSliubo __entry->generation = root->fs_info->generation; 831abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 841abe9b8aSliubo ), 851abe9b8aSliubo 861abe9b8aSliubo TP_printk("root = %llu(%s), gen = %llu", 871abe9b8aSliubo show_root_type(__entry->root_objectid), 881abe9b8aSliubo (unsigned long long)__entry->generation) 891abe9b8aSliubo ); 901abe9b8aSliubo 911abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__inode, 921abe9b8aSliubo 931abe9b8aSliubo TP_PROTO(struct inode *inode), 941abe9b8aSliubo 951abe9b8aSliubo TP_ARGS(inode), 961abe9b8aSliubo 971abe9b8aSliubo TP_STRUCT__entry( 981abe9b8aSliubo __field( ino_t, ino ) 991abe9b8aSliubo __field( blkcnt_t, blocks ) 1001abe9b8aSliubo __field( u64, disk_i_size ) 1011abe9b8aSliubo __field( u64, generation ) 1021abe9b8aSliubo __field( u64, last_trans ) 1031abe9b8aSliubo __field( u64, logged_trans ) 1041abe9b8aSliubo __field( u64, root_objectid ) 1051abe9b8aSliubo ), 1061abe9b8aSliubo 1071abe9b8aSliubo TP_fast_assign( 1081abe9b8aSliubo __entry->ino = inode->i_ino; 1091abe9b8aSliubo __entry->blocks = inode->i_blocks; 1101abe9b8aSliubo __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; 1111abe9b8aSliubo __entry->generation = BTRFS_I(inode)->generation; 1121abe9b8aSliubo __entry->last_trans = BTRFS_I(inode)->last_trans; 1131abe9b8aSliubo __entry->logged_trans = BTRFS_I(inode)->logged_trans; 1141abe9b8aSliubo __entry->root_objectid = 1151abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 1161abe9b8aSliubo ), 1171abe9b8aSliubo 1181abe9b8aSliubo TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, " 1191abe9b8aSliubo "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu", 1201abe9b8aSliubo show_root_type(__entry->root_objectid), 1211abe9b8aSliubo (unsigned long long)__entry->generation, 1221abe9b8aSliubo (unsigned long)__entry->ino, 1231abe9b8aSliubo (unsigned long long)__entry->blocks, 1241abe9b8aSliubo (unsigned long long)__entry->disk_i_size, 1251abe9b8aSliubo (unsigned long long)__entry->last_trans, 1261abe9b8aSliubo (unsigned long long)__entry->logged_trans) 1271abe9b8aSliubo ); 1281abe9b8aSliubo 1291abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_new, 1301abe9b8aSliubo 1311abe9b8aSliubo TP_PROTO(struct inode *inode), 1321abe9b8aSliubo 1331abe9b8aSliubo TP_ARGS(inode) 1341abe9b8aSliubo ); 1351abe9b8aSliubo 1361abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_request, 1371abe9b8aSliubo 1381abe9b8aSliubo TP_PROTO(struct inode *inode), 1391abe9b8aSliubo 1401abe9b8aSliubo TP_ARGS(inode) 1411abe9b8aSliubo ); 1421abe9b8aSliubo 1431abe9b8aSliubo DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, 1441abe9b8aSliubo 1451abe9b8aSliubo TP_PROTO(struct inode *inode), 1461abe9b8aSliubo 1471abe9b8aSliubo TP_ARGS(inode) 1481abe9b8aSliubo ); 1491abe9b8aSliubo 1501abe9b8aSliubo #define __show_map_type(type) \ 1517f34b746Sliubo __print_symbolic_u64(type, \ 1521abe9b8aSliubo { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ 1531abe9b8aSliubo { EXTENT_MAP_HOLE, "HOLE" }, \ 1541abe9b8aSliubo { EXTENT_MAP_INLINE, "INLINE" }, \ 1551abe9b8aSliubo { EXTENT_MAP_DELALLOC, "DELALLOC" }) 1561abe9b8aSliubo 1571abe9b8aSliubo #define show_map_type(type) \ 1581abe9b8aSliubo type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) 1591abe9b8aSliubo 1601abe9b8aSliubo #define show_map_flags(flag) \ 1611abe9b8aSliubo __print_flags(flag, "|", \ 162254a2d14SLiu Bo { (1 << EXTENT_FLAG_PINNED), "PINNED" },\ 163254a2d14SLiu Bo { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\ 164254a2d14SLiu Bo { (1 << EXTENT_FLAG_VACANCY), "VACANCY" },\ 165254a2d14SLiu Bo { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\ 166254a2d14SLiu Bo { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\ 167254a2d14SLiu Bo { (1 << EXTENT_FLAG_FILLING), "FILLING" },\ 168254a2d14SLiu Bo { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" }) 1691abe9b8aSliubo 1704cd8587cSSteven Rostedt TRACE_EVENT_CONDITION(btrfs_get_extent, 1711abe9b8aSliubo 1721abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct extent_map *map), 1731abe9b8aSliubo 1741abe9b8aSliubo TP_ARGS(root, map), 1751abe9b8aSliubo 1764cd8587cSSteven Rostedt TP_CONDITION(map), 1774cd8587cSSteven Rostedt 1781abe9b8aSliubo TP_STRUCT__entry( 1791abe9b8aSliubo __field( u64, root_objectid ) 1801abe9b8aSliubo __field( u64, start ) 1811abe9b8aSliubo __field( u64, len ) 1821abe9b8aSliubo __field( u64, orig_start ) 1831abe9b8aSliubo __field( u64, block_start ) 1841abe9b8aSliubo __field( u64, block_len ) 1851abe9b8aSliubo __field( unsigned long, flags ) 1861abe9b8aSliubo __field( int, refs ) 1871abe9b8aSliubo __field( unsigned int, compress_type ) 1881abe9b8aSliubo ), 1891abe9b8aSliubo 1901abe9b8aSliubo TP_fast_assign( 1911abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 1921abe9b8aSliubo __entry->start = map->start; 1931abe9b8aSliubo __entry->len = map->len; 1941abe9b8aSliubo __entry->orig_start = map->orig_start; 1951abe9b8aSliubo __entry->block_start = map->block_start; 1961abe9b8aSliubo __entry->block_len = map->block_len; 1971abe9b8aSliubo __entry->flags = map->flags; 1981abe9b8aSliubo __entry->refs = atomic_read(&map->refs); 1991abe9b8aSliubo __entry->compress_type = map->compress_type; 2001abe9b8aSliubo ), 2011abe9b8aSliubo 2021abe9b8aSliubo TP_printk("root = %llu(%s), start = %llu, len = %llu, " 2031abe9b8aSliubo "orig_start = %llu, block_start = %llu(%s), " 2041abe9b8aSliubo "block_len = %llu, flags = %s, refs = %u, " 2051abe9b8aSliubo "compress_type = %u", 2061abe9b8aSliubo show_root_type(__entry->root_objectid), 2071abe9b8aSliubo (unsigned long long)__entry->start, 2081abe9b8aSliubo (unsigned long long)__entry->len, 2091abe9b8aSliubo (unsigned long long)__entry->orig_start, 2101abe9b8aSliubo show_map_type(__entry->block_start), 2111abe9b8aSliubo (unsigned long long)__entry->block_len, 2121abe9b8aSliubo show_map_flags(__entry->flags), 2131abe9b8aSliubo __entry->refs, __entry->compress_type) 2141abe9b8aSliubo ); 2151abe9b8aSliubo 2161abe9b8aSliubo #define show_ordered_flags(flags) \ 2179d04a8ceSLiu Bo __print_flags(flags, "|", \ 2189d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ 2199d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ 2209d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ 2219d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ 2229d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ 2239d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ 2249d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ 2259d04a8ceSLiu Bo { (1 << BTRFS_ORDERED_UPDATED_ISIZE), "UPDATED_ISIZE" }, \ 226792ddef0SLiu Bo { (1 << BTRFS_ORDERED_LOGGED_CSUM), "LOGGED_CSUM" }, \ 227792ddef0SLiu Bo { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) 228e112e2b4SLiu Bo 2291abe9b8aSliubo 2301abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__ordered_extent, 2311abe9b8aSliubo 2321abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 2331abe9b8aSliubo 2341abe9b8aSliubo TP_ARGS(inode, ordered), 2351abe9b8aSliubo 2361abe9b8aSliubo TP_STRUCT__entry( 2371abe9b8aSliubo __field( ino_t, ino ) 2381abe9b8aSliubo __field( u64, file_offset ) 2391abe9b8aSliubo __field( u64, start ) 2401abe9b8aSliubo __field( u64, len ) 2411abe9b8aSliubo __field( u64, disk_len ) 2421abe9b8aSliubo __field( u64, bytes_left ) 2431abe9b8aSliubo __field( unsigned long, flags ) 2441abe9b8aSliubo __field( int, compress_type ) 2451abe9b8aSliubo __field( int, refs ) 2461abe9b8aSliubo __field( u64, root_objectid ) 2471abe9b8aSliubo ), 2481abe9b8aSliubo 2491abe9b8aSliubo TP_fast_assign( 2501abe9b8aSliubo __entry->ino = inode->i_ino; 2511abe9b8aSliubo __entry->file_offset = ordered->file_offset; 2521abe9b8aSliubo __entry->start = ordered->start; 2531abe9b8aSliubo __entry->len = ordered->len; 2541abe9b8aSliubo __entry->disk_len = ordered->disk_len; 2551abe9b8aSliubo __entry->bytes_left = ordered->bytes_left; 2561abe9b8aSliubo __entry->flags = ordered->flags; 2571abe9b8aSliubo __entry->compress_type = ordered->compress_type; 2581abe9b8aSliubo __entry->refs = atomic_read(&ordered->refs); 2591abe9b8aSliubo __entry->root_objectid = 2601abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 2611abe9b8aSliubo ), 2621abe9b8aSliubo 2631abe9b8aSliubo TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, " 2641abe9b8aSliubo "start = %llu, len = %llu, disk_len = %llu, " 2651abe9b8aSliubo "bytes_left = %llu, flags = %s, compress_type = %d, " 2661abe9b8aSliubo "refs = %d", 2671abe9b8aSliubo show_root_type(__entry->root_objectid), 2681abe9b8aSliubo (unsigned long long)__entry->ino, 2691abe9b8aSliubo (unsigned long long)__entry->file_offset, 2701abe9b8aSliubo (unsigned long long)__entry->start, 2711abe9b8aSliubo (unsigned long long)__entry->len, 2721abe9b8aSliubo (unsigned long long)__entry->disk_len, 2731abe9b8aSliubo (unsigned long long)__entry->bytes_left, 2741abe9b8aSliubo show_ordered_flags(__entry->flags), 2751abe9b8aSliubo __entry->compress_type, __entry->refs) 2761abe9b8aSliubo ); 2771abe9b8aSliubo 2781abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, 2791abe9b8aSliubo 2801abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 2811abe9b8aSliubo 2821abe9b8aSliubo TP_ARGS(inode, ordered) 2831abe9b8aSliubo ); 2841abe9b8aSliubo 2851abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, 2861abe9b8aSliubo 2871abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 2881abe9b8aSliubo 2891abe9b8aSliubo TP_ARGS(inode, ordered) 2901abe9b8aSliubo ); 2911abe9b8aSliubo 2921abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, 2931abe9b8aSliubo 2941abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 2951abe9b8aSliubo 2961abe9b8aSliubo TP_ARGS(inode, ordered) 2971abe9b8aSliubo ); 2981abe9b8aSliubo 2991abe9b8aSliubo DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, 3001abe9b8aSliubo 3011abe9b8aSliubo TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), 3021abe9b8aSliubo 3031abe9b8aSliubo TP_ARGS(inode, ordered) 3041abe9b8aSliubo ); 3051abe9b8aSliubo 3061abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__writepage, 3071abe9b8aSliubo 3081abe9b8aSliubo TP_PROTO(struct page *page, struct inode *inode, 3091abe9b8aSliubo struct writeback_control *wbc), 3101abe9b8aSliubo 3111abe9b8aSliubo TP_ARGS(page, inode, wbc), 3121abe9b8aSliubo 3131abe9b8aSliubo TP_STRUCT__entry( 3141abe9b8aSliubo __field( ino_t, ino ) 3151abe9b8aSliubo __field( pgoff_t, index ) 3161abe9b8aSliubo __field( long, nr_to_write ) 3171abe9b8aSliubo __field( long, pages_skipped ) 3181abe9b8aSliubo __field( loff_t, range_start ) 3191abe9b8aSliubo __field( loff_t, range_end ) 3201abe9b8aSliubo __field( char, for_kupdate ) 3211abe9b8aSliubo __field( char, for_reclaim ) 3221abe9b8aSliubo __field( char, range_cyclic ) 3231abe9b8aSliubo __field( pgoff_t, writeback_index ) 3241abe9b8aSliubo __field( u64, root_objectid ) 3251abe9b8aSliubo ), 3261abe9b8aSliubo 3271abe9b8aSliubo TP_fast_assign( 3281abe9b8aSliubo __entry->ino = inode->i_ino; 3291abe9b8aSliubo __entry->index = page->index; 3301abe9b8aSliubo __entry->nr_to_write = wbc->nr_to_write; 3311abe9b8aSliubo __entry->pages_skipped = wbc->pages_skipped; 3321abe9b8aSliubo __entry->range_start = wbc->range_start; 3331abe9b8aSliubo __entry->range_end = wbc->range_end; 3341abe9b8aSliubo __entry->for_kupdate = wbc->for_kupdate; 3351abe9b8aSliubo __entry->for_reclaim = wbc->for_reclaim; 3361abe9b8aSliubo __entry->range_cyclic = wbc->range_cyclic; 3371abe9b8aSliubo __entry->writeback_index = inode->i_mapping->writeback_index; 3381abe9b8aSliubo __entry->root_objectid = 3391abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 3401abe9b8aSliubo ), 3411abe9b8aSliubo 3421abe9b8aSliubo TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, " 3431abe9b8aSliubo "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, " 344846d5a09SWu Fengguang "range_end = %llu, for_kupdate = %d, " 3451abe9b8aSliubo "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu", 3461abe9b8aSliubo show_root_type(__entry->root_objectid), 3471abe9b8aSliubo (unsigned long)__entry->ino, __entry->index, 3481abe9b8aSliubo __entry->nr_to_write, __entry->pages_skipped, 3491abe9b8aSliubo __entry->range_start, __entry->range_end, 350846d5a09SWu Fengguang __entry->for_kupdate, 3511abe9b8aSliubo __entry->for_reclaim, __entry->range_cyclic, 3521abe9b8aSliubo (unsigned long)__entry->writeback_index) 3531abe9b8aSliubo ); 3541abe9b8aSliubo 3551abe9b8aSliubo DEFINE_EVENT(btrfs__writepage, __extent_writepage, 3561abe9b8aSliubo 3571abe9b8aSliubo TP_PROTO(struct page *page, struct inode *inode, 3581abe9b8aSliubo struct writeback_control *wbc), 3591abe9b8aSliubo 3601abe9b8aSliubo TP_ARGS(page, inode, wbc) 3611abe9b8aSliubo ); 3621abe9b8aSliubo 3631abe9b8aSliubo TRACE_EVENT(btrfs_writepage_end_io_hook, 3641abe9b8aSliubo 3651abe9b8aSliubo TP_PROTO(struct page *page, u64 start, u64 end, int uptodate), 3661abe9b8aSliubo 3671abe9b8aSliubo TP_ARGS(page, start, end, uptodate), 3681abe9b8aSliubo 3691abe9b8aSliubo TP_STRUCT__entry( 3701abe9b8aSliubo __field( ino_t, ino ) 3711abe9b8aSliubo __field( pgoff_t, index ) 3721abe9b8aSliubo __field( u64, start ) 3731abe9b8aSliubo __field( u64, end ) 3741abe9b8aSliubo __field( int, uptodate ) 3751abe9b8aSliubo __field( u64, root_objectid ) 3761abe9b8aSliubo ), 3771abe9b8aSliubo 3781abe9b8aSliubo TP_fast_assign( 3791abe9b8aSliubo __entry->ino = page->mapping->host->i_ino; 3801abe9b8aSliubo __entry->index = page->index; 3811abe9b8aSliubo __entry->start = start; 3821abe9b8aSliubo __entry->end = end; 3831abe9b8aSliubo __entry->uptodate = uptodate; 3841abe9b8aSliubo __entry->root_objectid = 3851abe9b8aSliubo BTRFS_I(page->mapping->host)->root->root_key.objectid; 3861abe9b8aSliubo ), 3871abe9b8aSliubo 3881abe9b8aSliubo TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, " 3891abe9b8aSliubo "end = %llu, uptodate = %d", 3901abe9b8aSliubo show_root_type(__entry->root_objectid), 3911abe9b8aSliubo (unsigned long)__entry->ino, (unsigned long)__entry->index, 3921abe9b8aSliubo (unsigned long long)__entry->start, 3931abe9b8aSliubo (unsigned long long)__entry->end, __entry->uptodate) 3941abe9b8aSliubo ); 3951abe9b8aSliubo 3961abe9b8aSliubo TRACE_EVENT(btrfs_sync_file, 3971abe9b8aSliubo 3981abe9b8aSliubo TP_PROTO(struct file *file, int datasync), 3991abe9b8aSliubo 4001abe9b8aSliubo TP_ARGS(file, datasync), 4011abe9b8aSliubo 4021abe9b8aSliubo TP_STRUCT__entry( 4031abe9b8aSliubo __field( ino_t, ino ) 4041abe9b8aSliubo __field( ino_t, parent ) 4051abe9b8aSliubo __field( int, datasync ) 4061abe9b8aSliubo __field( u64, root_objectid ) 4071abe9b8aSliubo ), 4081abe9b8aSliubo 4091abe9b8aSliubo TP_fast_assign( 4101abe9b8aSliubo struct dentry *dentry = file->f_path.dentry; 4112b0143b5SDavid Howells struct inode *inode = d_inode(dentry); 4121abe9b8aSliubo 4131abe9b8aSliubo __entry->ino = inode->i_ino; 4142b0143b5SDavid Howells __entry->parent = d_inode(dentry->d_parent)->i_ino; 4151abe9b8aSliubo __entry->datasync = datasync; 4161abe9b8aSliubo __entry->root_objectid = 4171abe9b8aSliubo BTRFS_I(inode)->root->root_key.objectid; 4181abe9b8aSliubo ), 4191abe9b8aSliubo 4201abe9b8aSliubo TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d", 4211abe9b8aSliubo show_root_type(__entry->root_objectid), 4221abe9b8aSliubo (unsigned long)__entry->ino, (unsigned long)__entry->parent, 4231abe9b8aSliubo __entry->datasync) 4241abe9b8aSliubo ); 4251abe9b8aSliubo 4261abe9b8aSliubo TRACE_EVENT(btrfs_sync_fs, 4271abe9b8aSliubo 4281abe9b8aSliubo TP_PROTO(int wait), 4291abe9b8aSliubo 4301abe9b8aSliubo TP_ARGS(wait), 4311abe9b8aSliubo 4321abe9b8aSliubo TP_STRUCT__entry( 4331abe9b8aSliubo __field( int, wait ) 4341abe9b8aSliubo ), 4351abe9b8aSliubo 4361abe9b8aSliubo TP_fast_assign( 4371abe9b8aSliubo __entry->wait = wait; 4381abe9b8aSliubo ), 4391abe9b8aSliubo 4401abe9b8aSliubo TP_printk("wait = %d", __entry->wait) 4411abe9b8aSliubo ); 4421abe9b8aSliubo 4431abe9b8aSliubo #define show_ref_action(action) \ 4441abe9b8aSliubo __print_symbolic(action, \ 4451abe9b8aSliubo { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ 4461abe9b8aSliubo { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ 4471abe9b8aSliubo { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ 4481abe9b8aSliubo { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) 4491abe9b8aSliubo 4501abe9b8aSliubo 451599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, 4521abe9b8aSliubo 4531abe9b8aSliubo TP_PROTO(struct btrfs_delayed_ref_node *ref, 4541abe9b8aSliubo struct btrfs_delayed_tree_ref *full_ref, 4551abe9b8aSliubo int action), 4561abe9b8aSliubo 4571abe9b8aSliubo TP_ARGS(ref, full_ref, action), 4581abe9b8aSliubo 4591abe9b8aSliubo TP_STRUCT__entry( 4601abe9b8aSliubo __field( u64, bytenr ) 4611abe9b8aSliubo __field( u64, num_bytes ) 4621abe9b8aSliubo __field( int, action ) 4631abe9b8aSliubo __field( u64, parent ) 4641abe9b8aSliubo __field( u64, ref_root ) 4651abe9b8aSliubo __field( int, level ) 4661abe9b8aSliubo __field( int, type ) 467dea7d76eSLiu Bo __field( u64, seq ) 4681abe9b8aSliubo ), 4691abe9b8aSliubo 4701abe9b8aSliubo TP_fast_assign( 4711abe9b8aSliubo __entry->bytenr = ref->bytenr; 4721abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 4731abe9b8aSliubo __entry->action = action; 4741abe9b8aSliubo __entry->parent = full_ref->parent; 4751abe9b8aSliubo __entry->ref_root = full_ref->root; 4761abe9b8aSliubo __entry->level = full_ref->level; 4771abe9b8aSliubo __entry->type = ref->type; 478dea7d76eSLiu Bo __entry->seq = ref->seq; 4791abe9b8aSliubo ), 4801abe9b8aSliubo 4811abe9b8aSliubo TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " 4821abe9b8aSliubo "parent = %llu(%s), ref_root = %llu(%s), level = %d, " 483dea7d76eSLiu Bo "type = %s, seq = %llu", 4841abe9b8aSliubo (unsigned long long)__entry->bytenr, 4851abe9b8aSliubo (unsigned long long)__entry->num_bytes, 4861abe9b8aSliubo show_ref_action(__entry->action), 4871abe9b8aSliubo show_root_type(__entry->parent), 4881abe9b8aSliubo show_root_type(__entry->ref_root), 489dea7d76eSLiu Bo __entry->level, show_ref_type(__entry->type), 490dea7d76eSLiu Bo (unsigned long long)__entry->seq) 4911abe9b8aSliubo ); 4921abe9b8aSliubo 493599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, 494599c75ecSLiu Bo 495599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 496599c75ecSLiu Bo struct btrfs_delayed_tree_ref *full_ref, 497599c75ecSLiu Bo int action), 498599c75ecSLiu Bo 499599c75ecSLiu Bo TP_ARGS(ref, full_ref, action) 500599c75ecSLiu Bo ); 501599c75ecSLiu Bo 502599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, 503599c75ecSLiu Bo 504599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 505599c75ecSLiu Bo struct btrfs_delayed_tree_ref *full_ref, 506599c75ecSLiu Bo int action), 507599c75ecSLiu Bo 508599c75ecSLiu Bo TP_ARGS(ref, full_ref, action) 509599c75ecSLiu Bo ); 510599c75ecSLiu Bo 511599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, 5121abe9b8aSliubo 5131abe9b8aSliubo TP_PROTO(struct btrfs_delayed_ref_node *ref, 5141abe9b8aSliubo struct btrfs_delayed_data_ref *full_ref, 5151abe9b8aSliubo int action), 5161abe9b8aSliubo 5171abe9b8aSliubo TP_ARGS(ref, full_ref, action), 5181abe9b8aSliubo 5191abe9b8aSliubo TP_STRUCT__entry( 5201abe9b8aSliubo __field( u64, bytenr ) 5211abe9b8aSliubo __field( u64, num_bytes ) 5221abe9b8aSliubo __field( int, action ) 5231abe9b8aSliubo __field( u64, parent ) 5241abe9b8aSliubo __field( u64, ref_root ) 5251abe9b8aSliubo __field( u64, owner ) 5261abe9b8aSliubo __field( u64, offset ) 5271abe9b8aSliubo __field( int, type ) 528dea7d76eSLiu Bo __field( u64, seq ) 5291abe9b8aSliubo ), 5301abe9b8aSliubo 5311abe9b8aSliubo TP_fast_assign( 5321abe9b8aSliubo __entry->bytenr = ref->bytenr; 5331abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 5341abe9b8aSliubo __entry->action = action; 5351abe9b8aSliubo __entry->parent = full_ref->parent; 5361abe9b8aSliubo __entry->ref_root = full_ref->root; 5371abe9b8aSliubo __entry->owner = full_ref->objectid; 5381abe9b8aSliubo __entry->offset = full_ref->offset; 5391abe9b8aSliubo __entry->type = ref->type; 540dea7d76eSLiu Bo __entry->seq = ref->seq; 5411abe9b8aSliubo ), 5421abe9b8aSliubo 5431abe9b8aSliubo TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " 5441abe9b8aSliubo "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, " 545dea7d76eSLiu Bo "offset = %llu, type = %s, seq = %llu", 5461abe9b8aSliubo (unsigned long long)__entry->bytenr, 5471abe9b8aSliubo (unsigned long long)__entry->num_bytes, 5481abe9b8aSliubo show_ref_action(__entry->action), 5491abe9b8aSliubo show_root_type(__entry->parent), 5501abe9b8aSliubo show_root_type(__entry->ref_root), 5511abe9b8aSliubo (unsigned long long)__entry->owner, 5521abe9b8aSliubo (unsigned long long)__entry->offset, 553dea7d76eSLiu Bo show_ref_type(__entry->type), 554dea7d76eSLiu Bo (unsigned long long)__entry->seq) 5551abe9b8aSliubo ); 5561abe9b8aSliubo 557599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, 558599c75ecSLiu Bo 559599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 560599c75ecSLiu Bo struct btrfs_delayed_data_ref *full_ref, 561599c75ecSLiu Bo int action), 562599c75ecSLiu Bo 563599c75ecSLiu Bo TP_ARGS(ref, full_ref, action) 564599c75ecSLiu Bo ); 565599c75ecSLiu Bo 566599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, 567599c75ecSLiu Bo 568599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 569599c75ecSLiu Bo struct btrfs_delayed_data_ref *full_ref, 570599c75ecSLiu Bo int action), 571599c75ecSLiu Bo 572599c75ecSLiu Bo TP_ARGS(ref, full_ref, action) 573599c75ecSLiu Bo ); 574599c75ecSLiu Bo 575599c75ecSLiu Bo DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, 5761abe9b8aSliubo 5771abe9b8aSliubo TP_PROTO(struct btrfs_delayed_ref_node *ref, 5781abe9b8aSliubo struct btrfs_delayed_ref_head *head_ref, 5791abe9b8aSliubo int action), 5801abe9b8aSliubo 5811abe9b8aSliubo TP_ARGS(ref, head_ref, action), 5821abe9b8aSliubo 5831abe9b8aSliubo TP_STRUCT__entry( 5841abe9b8aSliubo __field( u64, bytenr ) 5851abe9b8aSliubo __field( u64, num_bytes ) 5861abe9b8aSliubo __field( int, action ) 5871abe9b8aSliubo __field( int, is_data ) 5881abe9b8aSliubo ), 5891abe9b8aSliubo 5901abe9b8aSliubo TP_fast_assign( 5911abe9b8aSliubo __entry->bytenr = ref->bytenr; 5921abe9b8aSliubo __entry->num_bytes = ref->num_bytes; 5931abe9b8aSliubo __entry->action = action; 5941abe9b8aSliubo __entry->is_data = head_ref->is_data; 5951abe9b8aSliubo ), 5961abe9b8aSliubo 5971abe9b8aSliubo TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d", 5981abe9b8aSliubo (unsigned long long)__entry->bytenr, 5991abe9b8aSliubo (unsigned long long)__entry->num_bytes, 6001abe9b8aSliubo show_ref_action(__entry->action), 6011abe9b8aSliubo __entry->is_data) 6021abe9b8aSliubo ); 6031abe9b8aSliubo 604599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, 605599c75ecSLiu Bo 606599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 607599c75ecSLiu Bo struct btrfs_delayed_ref_head *head_ref, 608599c75ecSLiu Bo int action), 609599c75ecSLiu Bo 610599c75ecSLiu Bo TP_ARGS(ref, head_ref, action) 611599c75ecSLiu Bo ); 612599c75ecSLiu Bo 613599c75ecSLiu Bo DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, 614599c75ecSLiu Bo 615599c75ecSLiu Bo TP_PROTO(struct btrfs_delayed_ref_node *ref, 616599c75ecSLiu Bo struct btrfs_delayed_ref_head *head_ref, 617599c75ecSLiu Bo int action), 618599c75ecSLiu Bo 619599c75ecSLiu Bo TP_ARGS(ref, head_ref, action) 620599c75ecSLiu Bo ); 621599c75ecSLiu Bo 6221abe9b8aSliubo #define show_chunk_type(type) \ 6231abe9b8aSliubo __print_flags(type, "|", \ 6241abe9b8aSliubo { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ 6251abe9b8aSliubo { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ 6261abe9b8aSliubo { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ 6271abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ 6281abe9b8aSliubo { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ 6291abe9b8aSliubo { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ 630e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ 631e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ 632e112e2b4SLiu Bo { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) 6331abe9b8aSliubo 6341abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__chunk, 6351abe9b8aSliubo 6361abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct map_lookup *map, 6371abe9b8aSliubo u64 offset, u64 size), 6381abe9b8aSliubo 6391abe9b8aSliubo TP_ARGS(root, map, offset, size), 6401abe9b8aSliubo 6411abe9b8aSliubo TP_STRUCT__entry( 6421abe9b8aSliubo __field( int, num_stripes ) 6431abe9b8aSliubo __field( u64, type ) 6441abe9b8aSliubo __field( int, sub_stripes ) 6451abe9b8aSliubo __field( u64, offset ) 6461abe9b8aSliubo __field( u64, size ) 6471abe9b8aSliubo __field( u64, root_objectid ) 6481abe9b8aSliubo ), 6491abe9b8aSliubo 6501abe9b8aSliubo TP_fast_assign( 6511abe9b8aSliubo __entry->num_stripes = map->num_stripes; 6521abe9b8aSliubo __entry->type = map->type; 6531abe9b8aSliubo __entry->sub_stripes = map->sub_stripes; 6541abe9b8aSliubo __entry->offset = offset; 6551abe9b8aSliubo __entry->size = size; 6561abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 6571abe9b8aSliubo ), 6581abe9b8aSliubo 6591abe9b8aSliubo TP_printk("root = %llu(%s), offset = %llu, size = %llu, " 6601abe9b8aSliubo "num_stripes = %d, sub_stripes = %d, type = %s", 6611abe9b8aSliubo show_root_type(__entry->root_objectid), 6621abe9b8aSliubo (unsigned long long)__entry->offset, 6631abe9b8aSliubo (unsigned long long)__entry->size, 6641abe9b8aSliubo __entry->num_stripes, __entry->sub_stripes, 6651abe9b8aSliubo show_chunk_type(__entry->type)) 6661abe9b8aSliubo ); 6671abe9b8aSliubo 6681abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, 6691abe9b8aSliubo 6701abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct map_lookup *map, 6711abe9b8aSliubo u64 offset, u64 size), 6721abe9b8aSliubo 6731abe9b8aSliubo TP_ARGS(root, map, offset, size) 6741abe9b8aSliubo ); 6751abe9b8aSliubo 6761abe9b8aSliubo DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, 6771abe9b8aSliubo 6781abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct map_lookup *map, 6791abe9b8aSliubo u64 offset, u64 size), 6801abe9b8aSliubo 6811abe9b8aSliubo TP_ARGS(root, map, offset, size) 6821abe9b8aSliubo ); 6831abe9b8aSliubo 6841abe9b8aSliubo TRACE_EVENT(btrfs_cow_block, 6851abe9b8aSliubo 6861abe9b8aSliubo TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf, 6871abe9b8aSliubo struct extent_buffer *cow), 6881abe9b8aSliubo 6891abe9b8aSliubo TP_ARGS(root, buf, cow), 6901abe9b8aSliubo 6911abe9b8aSliubo TP_STRUCT__entry( 6921abe9b8aSliubo __field( u64, root_objectid ) 6931abe9b8aSliubo __field( u64, buf_start ) 6941abe9b8aSliubo __field( int, refs ) 6951abe9b8aSliubo __field( u64, cow_start ) 6961abe9b8aSliubo __field( int, buf_level ) 6971abe9b8aSliubo __field( int, cow_level ) 6981abe9b8aSliubo ), 6991abe9b8aSliubo 7001abe9b8aSliubo TP_fast_assign( 7011abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 7021abe9b8aSliubo __entry->buf_start = buf->start; 7031abe9b8aSliubo __entry->refs = atomic_read(&buf->refs); 7041abe9b8aSliubo __entry->cow_start = cow->start; 7051abe9b8aSliubo __entry->buf_level = btrfs_header_level(buf); 7061abe9b8aSliubo __entry->cow_level = btrfs_header_level(cow); 7071abe9b8aSliubo ), 7081abe9b8aSliubo 7091abe9b8aSliubo TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu " 7101abe9b8aSliubo "(orig_level = %d), cow_buf = %llu (cow_level = %d)", 7111abe9b8aSliubo show_root_type(__entry->root_objectid), 7121abe9b8aSliubo __entry->refs, 7131abe9b8aSliubo (unsigned long long)__entry->buf_start, 7141abe9b8aSliubo __entry->buf_level, 7151abe9b8aSliubo (unsigned long long)__entry->cow_start, 7161abe9b8aSliubo __entry->cow_level) 7171abe9b8aSliubo ); 7181abe9b8aSliubo 7198c2a3ca2SJosef Bacik TRACE_EVENT(btrfs_space_reservation, 7208c2a3ca2SJosef Bacik 7218c2a3ca2SJosef Bacik TP_PROTO(struct btrfs_fs_info *fs_info, char *type, u64 val, 7228c2a3ca2SJosef Bacik u64 bytes, int reserve), 7238c2a3ca2SJosef Bacik 7248c2a3ca2SJosef Bacik TP_ARGS(fs_info, type, val, bytes, reserve), 7258c2a3ca2SJosef Bacik 7268c2a3ca2SJosef Bacik TP_STRUCT__entry( 7278c2a3ca2SJosef Bacik __array( u8, fsid, BTRFS_UUID_SIZE ) 7288c2a3ca2SJosef Bacik __string( type, type ) 7298c2a3ca2SJosef Bacik __field( u64, val ) 7308c2a3ca2SJosef Bacik __field( u64, bytes ) 7318c2a3ca2SJosef Bacik __field( int, reserve ) 7328c2a3ca2SJosef Bacik ), 7338c2a3ca2SJosef Bacik 7348c2a3ca2SJosef Bacik TP_fast_assign( 7358c2a3ca2SJosef Bacik memcpy(__entry->fsid, fs_info->fsid, BTRFS_UUID_SIZE); 7368c2a3ca2SJosef Bacik __assign_str(type, type); 7378c2a3ca2SJosef Bacik __entry->val = val; 7388c2a3ca2SJosef Bacik __entry->bytes = bytes; 7398c2a3ca2SJosef Bacik __entry->reserve = reserve; 7408c2a3ca2SJosef Bacik ), 7418c2a3ca2SJosef Bacik 7428c2a3ca2SJosef Bacik TP_printk("%pU: %s: %Lu %s %Lu", __entry->fsid, __get_str(type), 7438c2a3ca2SJosef Bacik __entry->val, __entry->reserve ? "reserve" : "release", 7448c2a3ca2SJosef Bacik __entry->bytes) 7458c2a3ca2SJosef Bacik ); 7468c2a3ca2SJosef Bacik 7471abe9b8aSliubo DECLARE_EVENT_CLASS(btrfs__reserved_extent, 7481abe9b8aSliubo 7491abe9b8aSliubo TP_PROTO(struct btrfs_root *root, u64 start, u64 len), 7501abe9b8aSliubo 7511abe9b8aSliubo TP_ARGS(root, start, len), 7521abe9b8aSliubo 7531abe9b8aSliubo TP_STRUCT__entry( 7541abe9b8aSliubo __field( u64, root_objectid ) 7551abe9b8aSliubo __field( u64, start ) 7561abe9b8aSliubo __field( u64, len ) 7571abe9b8aSliubo ), 7581abe9b8aSliubo 7591abe9b8aSliubo TP_fast_assign( 7601abe9b8aSliubo __entry->root_objectid = root->root_key.objectid; 7611abe9b8aSliubo __entry->start = start; 7621abe9b8aSliubo __entry->len = len; 7631abe9b8aSliubo ), 7641abe9b8aSliubo 7651abe9b8aSliubo TP_printk("root = %llu(%s), start = %llu, len = %llu", 7661abe9b8aSliubo show_root_type(__entry->root_objectid), 7671abe9b8aSliubo (unsigned long long)__entry->start, 7681abe9b8aSliubo (unsigned long long)__entry->len) 7691abe9b8aSliubo ); 7701abe9b8aSliubo 7711abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, 7721abe9b8aSliubo 7731abe9b8aSliubo TP_PROTO(struct btrfs_root *root, u64 start, u64 len), 7741abe9b8aSliubo 7751abe9b8aSliubo TP_ARGS(root, start, len) 7761abe9b8aSliubo ); 7771abe9b8aSliubo 7781abe9b8aSliubo DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, 7791abe9b8aSliubo 7801abe9b8aSliubo TP_PROTO(struct btrfs_root *root, u64 start, u64 len), 7811abe9b8aSliubo 7821abe9b8aSliubo TP_ARGS(root, start, len) 7831abe9b8aSliubo ); 7841abe9b8aSliubo 7853f7de037SJosef Bacik TRACE_EVENT(find_free_extent, 7863f7de037SJosef Bacik 7873f7de037SJosef Bacik TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size, 7883f7de037SJosef Bacik u64 data), 7893f7de037SJosef Bacik 7903f7de037SJosef Bacik TP_ARGS(root, num_bytes, empty_size, data), 7913f7de037SJosef Bacik 7923f7de037SJosef Bacik TP_STRUCT__entry( 7933f7de037SJosef Bacik __field( u64, root_objectid ) 7943f7de037SJosef Bacik __field( u64, num_bytes ) 7953f7de037SJosef Bacik __field( u64, empty_size ) 7963f7de037SJosef Bacik __field( u64, data ) 7973f7de037SJosef Bacik ), 7983f7de037SJosef Bacik 7993f7de037SJosef Bacik TP_fast_assign( 8003f7de037SJosef Bacik __entry->root_objectid = root->root_key.objectid; 8013f7de037SJosef Bacik __entry->num_bytes = num_bytes; 8023f7de037SJosef Bacik __entry->empty_size = empty_size; 8033f7de037SJosef Bacik __entry->data = data; 8043f7de037SJosef Bacik ), 8053f7de037SJosef Bacik 8063f7de037SJosef Bacik TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, " 8073f7de037SJosef Bacik "flags = %Lu(%s)", show_root_type(__entry->root_objectid), 8083f7de037SJosef Bacik __entry->num_bytes, __entry->empty_size, __entry->data, 8093f7de037SJosef Bacik __print_flags((unsigned long)__entry->data, "|", 8103f7de037SJosef Bacik BTRFS_GROUP_FLAGS)) 8113f7de037SJosef Bacik ); 8123f7de037SJosef Bacik 8133f7de037SJosef Bacik DECLARE_EVENT_CLASS(btrfs__reserve_extent, 8143f7de037SJosef Bacik 8153f7de037SJosef Bacik TP_PROTO(struct btrfs_root *root, 8163f7de037SJosef Bacik struct btrfs_block_group_cache *block_group, u64 start, 8173f7de037SJosef Bacik u64 len), 8183f7de037SJosef Bacik 8193f7de037SJosef Bacik TP_ARGS(root, block_group, start, len), 8203f7de037SJosef Bacik 8213f7de037SJosef Bacik TP_STRUCT__entry( 8223f7de037SJosef Bacik __field( u64, root_objectid ) 8233f7de037SJosef Bacik __field( u64, bg_objectid ) 8243f7de037SJosef Bacik __field( u64, flags ) 8253f7de037SJosef Bacik __field( u64, start ) 8263f7de037SJosef Bacik __field( u64, len ) 8273f7de037SJosef Bacik ), 8283f7de037SJosef Bacik 8293f7de037SJosef Bacik TP_fast_assign( 8303f7de037SJosef Bacik __entry->root_objectid = root->root_key.objectid; 8313f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 8323f7de037SJosef Bacik __entry->flags = block_group->flags; 8333f7de037SJosef Bacik __entry->start = start; 8343f7de037SJosef Bacik __entry->len = len; 8353f7de037SJosef Bacik ), 8363f7de037SJosef Bacik 8373f7de037SJosef Bacik TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), " 8383f7de037SJosef Bacik "start = %Lu, len = %Lu", 8393f7de037SJosef Bacik show_root_type(__entry->root_objectid), __entry->bg_objectid, 8403f7de037SJosef Bacik __entry->flags, __print_flags((unsigned long)__entry->flags, 8413f7de037SJosef Bacik "|", BTRFS_GROUP_FLAGS), 8423f7de037SJosef Bacik __entry->start, __entry->len) 8433f7de037SJosef Bacik ); 8443f7de037SJosef Bacik 8453f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, 8463f7de037SJosef Bacik 8473f7de037SJosef Bacik TP_PROTO(struct btrfs_root *root, 8483f7de037SJosef Bacik struct btrfs_block_group_cache *block_group, u64 start, 8493f7de037SJosef Bacik u64 len), 8503f7de037SJosef Bacik 8513f7de037SJosef Bacik TP_ARGS(root, block_group, start, len) 8523f7de037SJosef Bacik ); 8533f7de037SJosef Bacik 8543f7de037SJosef Bacik DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, 8553f7de037SJosef Bacik 8563f7de037SJosef Bacik TP_PROTO(struct btrfs_root *root, 8573f7de037SJosef Bacik struct btrfs_block_group_cache *block_group, u64 start, 8583f7de037SJosef Bacik u64 len), 8593f7de037SJosef Bacik 8603f7de037SJosef Bacik TP_ARGS(root, block_group, start, len) 8613f7de037SJosef Bacik ); 8623f7de037SJosef Bacik 8633f7de037SJosef Bacik TRACE_EVENT(btrfs_find_cluster, 8643f7de037SJosef Bacik 8653f7de037SJosef Bacik TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start, 8663f7de037SJosef Bacik u64 bytes, u64 empty_size, u64 min_bytes), 8673f7de037SJosef Bacik 8683f7de037SJosef Bacik TP_ARGS(block_group, start, bytes, empty_size, min_bytes), 8693f7de037SJosef Bacik 8703f7de037SJosef Bacik TP_STRUCT__entry( 8713f7de037SJosef Bacik __field( u64, bg_objectid ) 8723f7de037SJosef Bacik __field( u64, flags ) 8733f7de037SJosef Bacik __field( u64, start ) 8743f7de037SJosef Bacik __field( u64, bytes ) 8753f7de037SJosef Bacik __field( u64, empty_size ) 8763f7de037SJosef Bacik __field( u64, min_bytes ) 8773f7de037SJosef Bacik ), 8783f7de037SJosef Bacik 8793f7de037SJosef Bacik TP_fast_assign( 8803f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 8813f7de037SJosef Bacik __entry->flags = block_group->flags; 8823f7de037SJosef Bacik __entry->start = start; 8833f7de037SJosef Bacik __entry->bytes = bytes; 8843f7de037SJosef Bacik __entry->empty_size = empty_size; 8853f7de037SJosef Bacik __entry->min_bytes = min_bytes; 8863f7de037SJosef Bacik ), 8873f7de037SJosef Bacik 8883f7de037SJosef Bacik TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu," 8893f7de037SJosef Bacik " empty_size = %Lu, min_bytes = %Lu", __entry->bg_objectid, 8903f7de037SJosef Bacik __entry->flags, 8913f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 8923f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 8933f7de037SJosef Bacik __entry->bytes, __entry->empty_size, __entry->min_bytes) 8943f7de037SJosef Bacik ); 8953f7de037SJosef Bacik 8963f7de037SJosef Bacik TRACE_EVENT(btrfs_failed_cluster_setup, 8973f7de037SJosef Bacik 8983f7de037SJosef Bacik TP_PROTO(struct btrfs_block_group_cache *block_group), 8993f7de037SJosef Bacik 9003f7de037SJosef Bacik TP_ARGS(block_group), 9013f7de037SJosef Bacik 9023f7de037SJosef Bacik TP_STRUCT__entry( 9033f7de037SJosef Bacik __field( u64, bg_objectid ) 9043f7de037SJosef Bacik ), 9053f7de037SJosef Bacik 9063f7de037SJosef Bacik TP_fast_assign( 9073f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 9083f7de037SJosef Bacik ), 9093f7de037SJosef Bacik 9103f7de037SJosef Bacik TP_printk("block_group = %Lu", __entry->bg_objectid) 9113f7de037SJosef Bacik ); 9123f7de037SJosef Bacik 9133f7de037SJosef Bacik TRACE_EVENT(btrfs_setup_cluster, 9143f7de037SJosef Bacik 9153f7de037SJosef Bacik TP_PROTO(struct btrfs_block_group_cache *block_group, 9163f7de037SJosef Bacik struct btrfs_free_cluster *cluster, u64 size, int bitmap), 9173f7de037SJosef Bacik 9183f7de037SJosef Bacik TP_ARGS(block_group, cluster, size, bitmap), 9193f7de037SJosef Bacik 9203f7de037SJosef Bacik TP_STRUCT__entry( 9213f7de037SJosef Bacik __field( u64, bg_objectid ) 9223f7de037SJosef Bacik __field( u64, flags ) 9233f7de037SJosef Bacik __field( u64, start ) 9243f7de037SJosef Bacik __field( u64, max_size ) 9253f7de037SJosef Bacik __field( u64, size ) 9263f7de037SJosef Bacik __field( int, bitmap ) 9273f7de037SJosef Bacik ), 9283f7de037SJosef Bacik 9293f7de037SJosef Bacik TP_fast_assign( 9303f7de037SJosef Bacik __entry->bg_objectid = block_group->key.objectid; 9313f7de037SJosef Bacik __entry->flags = block_group->flags; 9323f7de037SJosef Bacik __entry->start = cluster->window_start; 9333f7de037SJosef Bacik __entry->max_size = cluster->max_size; 9343f7de037SJosef Bacik __entry->size = size; 9353f7de037SJosef Bacik __entry->bitmap = bitmap; 9363f7de037SJosef Bacik ), 9373f7de037SJosef Bacik 9383f7de037SJosef Bacik TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, " 9393f7de037SJosef Bacik "size = %Lu, max_size = %Lu, bitmap = %d", 9403f7de037SJosef Bacik __entry->bg_objectid, 9413f7de037SJosef Bacik __entry->flags, 9423f7de037SJosef Bacik __print_flags((unsigned long)__entry->flags, "|", 9433f7de037SJosef Bacik BTRFS_GROUP_FLAGS), __entry->start, 9443f7de037SJosef Bacik __entry->size, __entry->max_size, __entry->bitmap) 9453f7de037SJosef Bacik ); 9463f7de037SJosef Bacik 947143bede5SJeff Mahoney struct extent_state; 948143bede5SJeff Mahoney TRACE_EVENT(alloc_extent_state, 949143bede5SJeff Mahoney 950143bede5SJeff Mahoney TP_PROTO(struct extent_state *state, gfp_t mask, unsigned long IP), 951143bede5SJeff Mahoney 952143bede5SJeff Mahoney TP_ARGS(state, mask, IP), 953143bede5SJeff Mahoney 954143bede5SJeff Mahoney TP_STRUCT__entry( 955143bede5SJeff Mahoney __field(struct extent_state *, state) 956143bede5SJeff Mahoney __field(gfp_t, mask) 957143bede5SJeff Mahoney __field(unsigned long, ip) 958143bede5SJeff Mahoney ), 959143bede5SJeff Mahoney 960143bede5SJeff Mahoney TP_fast_assign( 961143bede5SJeff Mahoney __entry->state = state, 962143bede5SJeff Mahoney __entry->mask = mask, 963143bede5SJeff Mahoney __entry->ip = IP 964143bede5SJeff Mahoney ), 965143bede5SJeff Mahoney 966bbedb179SScott Wood TP_printk("state=%p; mask = %s; caller = %pS", __entry->state, 967143bede5SJeff Mahoney show_gfp_flags(__entry->mask), (void *)__entry->ip) 968143bede5SJeff Mahoney ); 969143bede5SJeff Mahoney 970143bede5SJeff Mahoney TRACE_EVENT(free_extent_state, 971143bede5SJeff Mahoney 972143bede5SJeff Mahoney TP_PROTO(struct extent_state *state, unsigned long IP), 973143bede5SJeff Mahoney 974143bede5SJeff Mahoney TP_ARGS(state, IP), 975143bede5SJeff Mahoney 976143bede5SJeff Mahoney TP_STRUCT__entry( 977143bede5SJeff Mahoney __field(struct extent_state *, state) 978143bede5SJeff Mahoney __field(unsigned long, ip) 979143bede5SJeff Mahoney ), 980143bede5SJeff Mahoney 981143bede5SJeff Mahoney TP_fast_assign( 982143bede5SJeff Mahoney __entry->state = state, 983143bede5SJeff Mahoney __entry->ip = IP 984143bede5SJeff Mahoney ), 985143bede5SJeff Mahoney 986bbedb179SScott Wood TP_printk(" state=%p; caller = %pS", __entry->state, 987143bede5SJeff Mahoney (void *)__entry->ip) 988143bede5SJeff Mahoney ); 989143bede5SJeff Mahoney 99052483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work, 99152483bc2SQu Wenruo 99252483bc2SQu Wenruo TP_PROTO(struct btrfs_work *work), 99352483bc2SQu Wenruo 99452483bc2SQu Wenruo TP_ARGS(work), 99552483bc2SQu Wenruo 99652483bc2SQu Wenruo TP_STRUCT__entry( 99752483bc2SQu Wenruo __field( void *, work ) 99852483bc2SQu Wenruo __field( void *, wq ) 99952483bc2SQu Wenruo __field( void *, func ) 100052483bc2SQu Wenruo __field( void *, ordered_func ) 100152483bc2SQu Wenruo __field( void *, ordered_free ) 1002b38a6258SLiu Bo __field( void *, normal_work ) 100352483bc2SQu Wenruo ), 100452483bc2SQu Wenruo 100552483bc2SQu Wenruo TP_fast_assign( 100652483bc2SQu Wenruo __entry->work = work; 100752483bc2SQu Wenruo __entry->wq = work->wq; 100852483bc2SQu Wenruo __entry->func = work->func; 100952483bc2SQu Wenruo __entry->ordered_func = work->ordered_func; 101052483bc2SQu Wenruo __entry->ordered_free = work->ordered_free; 1011b38a6258SLiu Bo __entry->normal_work = &work->normal_work; 101252483bc2SQu Wenruo ), 101352483bc2SQu Wenruo 1014b7831b20SLiu Bo TP_printk("work=%p (normal_work=%p), wq=%p, func=%pf, ordered_func=%p," 1015b38a6258SLiu Bo " ordered_free=%p", 1016b38a6258SLiu Bo __entry->work, __entry->normal_work, __entry->wq, 1017b38a6258SLiu Bo __entry->func, __entry->ordered_func, __entry->ordered_free) 101852483bc2SQu Wenruo ); 101952483bc2SQu Wenruo 102052483bc2SQu Wenruo /* For situiations that the work is freed */ 102152483bc2SQu Wenruo DECLARE_EVENT_CLASS(btrfs__work__done, 102252483bc2SQu Wenruo 102352483bc2SQu Wenruo TP_PROTO(struct btrfs_work *work), 102452483bc2SQu Wenruo 102552483bc2SQu Wenruo TP_ARGS(work), 102652483bc2SQu Wenruo 102752483bc2SQu Wenruo TP_STRUCT__entry( 102852483bc2SQu Wenruo __field( void *, work ) 102952483bc2SQu Wenruo ), 103052483bc2SQu Wenruo 103152483bc2SQu Wenruo TP_fast_assign( 103252483bc2SQu Wenruo __entry->work = work; 103352483bc2SQu Wenruo ), 103452483bc2SQu Wenruo 103552483bc2SQu Wenruo TP_printk("work->%p", __entry->work) 103652483bc2SQu Wenruo ); 103752483bc2SQu Wenruo 103852483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_queued, 103952483bc2SQu Wenruo 104052483bc2SQu Wenruo TP_PROTO(struct btrfs_work *work), 104152483bc2SQu Wenruo 104252483bc2SQu Wenruo TP_ARGS(work) 104352483bc2SQu Wenruo ); 104452483bc2SQu Wenruo 104552483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_work_sched, 104652483bc2SQu Wenruo 104752483bc2SQu Wenruo TP_PROTO(struct btrfs_work *work), 104852483bc2SQu Wenruo 104952483bc2SQu Wenruo TP_ARGS(work) 105052483bc2SQu Wenruo ); 105152483bc2SQu Wenruo 105252483bc2SQu Wenruo DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, 105352483bc2SQu Wenruo 105452483bc2SQu Wenruo TP_PROTO(struct btrfs_work *work), 105552483bc2SQu Wenruo 105652483bc2SQu Wenruo TP_ARGS(work) 105752483bc2SQu Wenruo ); 105852483bc2SQu Wenruo 105952483bc2SQu Wenruo DEFINE_EVENT(btrfs__work, btrfs_ordered_sched, 106052483bc2SQu Wenruo 106152483bc2SQu Wenruo TP_PROTO(struct btrfs_work *work), 106252483bc2SQu Wenruo 106352483bc2SQu Wenruo TP_ARGS(work) 106452483bc2SQu Wenruo ); 106552483bc2SQu Wenruo 1066c3a46891SQu Wenruo DECLARE_EVENT_CLASS(btrfs__workqueue, 1067c3a46891SQu Wenruo 1068c3a46891SQu Wenruo TP_PROTO(struct __btrfs_workqueue *wq, const char *name, int high), 1069c3a46891SQu Wenruo 1070c3a46891SQu Wenruo TP_ARGS(wq, name, high), 1071c3a46891SQu Wenruo 1072c3a46891SQu Wenruo TP_STRUCT__entry( 1073c3a46891SQu Wenruo __field( void *, wq ) 1074c3a46891SQu Wenruo __string( name, name ) 1075c3a46891SQu Wenruo __field( int , high ) 1076c3a46891SQu Wenruo ), 1077c3a46891SQu Wenruo 1078c3a46891SQu Wenruo TP_fast_assign( 1079c3a46891SQu Wenruo __entry->wq = wq; 1080c3a46891SQu Wenruo __assign_str(name, name); 1081c3a46891SQu Wenruo __entry->high = high; 1082c3a46891SQu Wenruo ), 1083c3a46891SQu Wenruo 1084c3a46891SQu Wenruo TP_printk("name=%s%s, wq=%p", __get_str(name), 1085c3a46891SQu Wenruo __print_flags(__entry->high, "", 1086c3a46891SQu Wenruo {(WQ_HIGHPRI), "-high"}), 1087c3a46891SQu Wenruo __entry->wq) 1088c3a46891SQu Wenruo ); 1089c3a46891SQu Wenruo 1090c3a46891SQu Wenruo DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc, 1091c3a46891SQu Wenruo 1092c3a46891SQu Wenruo TP_PROTO(struct __btrfs_workqueue *wq, const char *name, int high), 1093c3a46891SQu Wenruo 1094c3a46891SQu Wenruo TP_ARGS(wq, name, high) 1095c3a46891SQu Wenruo ); 1096c3a46891SQu Wenruo 1097c3a46891SQu Wenruo DECLARE_EVENT_CLASS(btrfs__workqueue_done, 1098c3a46891SQu Wenruo 1099c3a46891SQu Wenruo TP_PROTO(struct __btrfs_workqueue *wq), 1100c3a46891SQu Wenruo 1101c3a46891SQu Wenruo TP_ARGS(wq), 1102c3a46891SQu Wenruo 1103c3a46891SQu Wenruo TP_STRUCT__entry( 1104c3a46891SQu Wenruo __field( void *, wq ) 1105c3a46891SQu Wenruo ), 1106c3a46891SQu Wenruo 1107c3a46891SQu Wenruo TP_fast_assign( 1108c3a46891SQu Wenruo __entry->wq = wq; 1109c3a46891SQu Wenruo ), 1110c3a46891SQu Wenruo 1111c3a46891SQu Wenruo TP_printk("wq=%p", __entry->wq) 1112c3a46891SQu Wenruo ); 1113c3a46891SQu Wenruo 1114c3a46891SQu Wenruo DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy, 1115c3a46891SQu Wenruo 1116c3a46891SQu Wenruo TP_PROTO(struct __btrfs_workqueue *wq), 1117c3a46891SQu Wenruo 1118c3a46891SQu Wenruo TP_ARGS(wq) 1119c3a46891SQu Wenruo ); 112052483bc2SQu Wenruo 112181fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_data_map, 112281fb6f77SQu Wenruo 112381fb6f77SQu Wenruo TP_PROTO(struct inode *inode, u64 free_reserved), 112481fb6f77SQu Wenruo 112581fb6f77SQu Wenruo TP_ARGS(inode, free_reserved), 112681fb6f77SQu Wenruo 112781fb6f77SQu Wenruo TP_STRUCT__entry( 112881fb6f77SQu Wenruo __field( u64, rootid ) 112981fb6f77SQu Wenruo __field( unsigned long, ino ) 113081fb6f77SQu Wenruo __field( u64, free_reserved ) 113181fb6f77SQu Wenruo ), 113281fb6f77SQu Wenruo 113381fb6f77SQu Wenruo TP_fast_assign( 113481fb6f77SQu Wenruo __entry->rootid = BTRFS_I(inode)->root->objectid; 113581fb6f77SQu Wenruo __entry->ino = inode->i_ino; 113681fb6f77SQu Wenruo __entry->free_reserved = free_reserved; 113781fb6f77SQu Wenruo ), 113881fb6f77SQu Wenruo 113981fb6f77SQu Wenruo TP_printk("rootid=%llu, ino=%lu, free_reserved=%llu", 114081fb6f77SQu Wenruo __entry->rootid, __entry->ino, __entry->free_reserved) 114181fb6f77SQu Wenruo ); 114281fb6f77SQu Wenruo 114381fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_data_map, btrfs_qgroup_init_data_rsv_map, 114481fb6f77SQu Wenruo 114581fb6f77SQu Wenruo TP_PROTO(struct inode *inode, u64 free_reserved), 114681fb6f77SQu Wenruo 114781fb6f77SQu Wenruo TP_ARGS(inode, free_reserved) 114881fb6f77SQu Wenruo ); 114981fb6f77SQu Wenruo 115081fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_data_map, btrfs_qgroup_free_data_rsv_map, 115181fb6f77SQu Wenruo 115281fb6f77SQu Wenruo TP_PROTO(struct inode *inode, u64 free_reserved), 115381fb6f77SQu Wenruo 115481fb6f77SQu Wenruo TP_ARGS(inode, free_reserved) 115581fb6f77SQu Wenruo ); 115681fb6f77SQu Wenruo 115781fb6f77SQu Wenruo #define BTRFS_QGROUP_OPERATIONS \ 115881fb6f77SQu Wenruo { QGROUP_RESERVE, "reserve" }, \ 115981fb6f77SQu Wenruo { QGROUP_RELEASE, "release" }, \ 116081fb6f77SQu Wenruo { QGROUP_FREE, "free" } 116181fb6f77SQu Wenruo 116281fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, 116381fb6f77SQu Wenruo 116481fb6f77SQu Wenruo TP_PROTO(struct inode *inode, u64 start, u64 len, u64 reserved, int op), 116581fb6f77SQu Wenruo 116681fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op), 116781fb6f77SQu Wenruo 116881fb6f77SQu Wenruo TP_STRUCT__entry( 116981fb6f77SQu Wenruo __field( u64, rootid ) 117081fb6f77SQu Wenruo __field( unsigned long, ino ) 117181fb6f77SQu Wenruo __field( u64, start ) 117281fb6f77SQu Wenruo __field( u64, len ) 117381fb6f77SQu Wenruo __field( u64, reserved ) 117481fb6f77SQu Wenruo __field( int, op ) 117581fb6f77SQu Wenruo ), 117681fb6f77SQu Wenruo 117781fb6f77SQu Wenruo TP_fast_assign( 117881fb6f77SQu Wenruo __entry->rootid = BTRFS_I(inode)->root->objectid; 117981fb6f77SQu Wenruo __entry->ino = inode->i_ino; 118081fb6f77SQu Wenruo __entry->start = start; 118181fb6f77SQu Wenruo __entry->len = len; 118281fb6f77SQu Wenruo __entry->reserved = reserved; 118381fb6f77SQu Wenruo __entry->op = op; 118481fb6f77SQu Wenruo ), 118581fb6f77SQu Wenruo 118681fb6f77SQu Wenruo TP_printk("root=%llu, ino=%lu, start=%llu, len=%llu, reserved=%llu, op=%s", 118781fb6f77SQu Wenruo __entry->rootid, __entry->ino, __entry->start, __entry->len, 118881fb6f77SQu Wenruo __entry->reserved, 118981fb6f77SQu Wenruo __print_flags((unsigned long)__entry->op, "", 119081fb6f77SQu Wenruo BTRFS_QGROUP_OPERATIONS) 119181fb6f77SQu Wenruo ) 119281fb6f77SQu Wenruo ); 119381fb6f77SQu Wenruo 119481fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data, 119581fb6f77SQu Wenruo 119681fb6f77SQu Wenruo TP_PROTO(struct inode *inode, u64 start, u64 len, u64 reserved, int op), 119781fb6f77SQu Wenruo 119881fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 119981fb6f77SQu Wenruo ); 120081fb6f77SQu Wenruo 120181fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data, 120281fb6f77SQu Wenruo 120381fb6f77SQu Wenruo TP_PROTO(struct inode *inode, u64 start, u64 len, u64 reserved, int op), 120481fb6f77SQu Wenruo 120581fb6f77SQu Wenruo TP_ARGS(inode, start, len, reserved, op) 120681fb6f77SQu Wenruo ); 120781fb6f77SQu Wenruo 120881fb6f77SQu Wenruo DECLARE_EVENT_CLASS(btrfs__qgroup_delayed_ref, 120981fb6f77SQu Wenruo 121081fb6f77SQu Wenruo TP_PROTO(u64 ref_root, u64 reserved), 121181fb6f77SQu Wenruo 121281fb6f77SQu Wenruo TP_ARGS(ref_root, reserved), 121381fb6f77SQu Wenruo 121481fb6f77SQu Wenruo TP_STRUCT__entry( 121581fb6f77SQu Wenruo __field( u64, ref_root ) 121681fb6f77SQu Wenruo __field( u64, reserved ) 121781fb6f77SQu Wenruo ), 121881fb6f77SQu Wenruo 121981fb6f77SQu Wenruo TP_fast_assign( 122081fb6f77SQu Wenruo __entry->ref_root = ref_root; 122181fb6f77SQu Wenruo __entry->reserved = reserved; 122281fb6f77SQu Wenruo ), 122381fb6f77SQu Wenruo 122481fb6f77SQu Wenruo TP_printk("root=%llu, reserved=%llu, op=free", 122581fb6f77SQu Wenruo __entry->ref_root, __entry->reserved) 122681fb6f77SQu Wenruo ); 122781fb6f77SQu Wenruo 122881fb6f77SQu Wenruo DEFINE_EVENT(btrfs__qgroup_delayed_ref, btrfs_qgroup_free_delayed_ref, 122981fb6f77SQu Wenruo 123081fb6f77SQu Wenruo TP_PROTO(u64 ref_root, u64 reserved), 123181fb6f77SQu Wenruo 123281fb6f77SQu Wenruo TP_ARGS(ref_root, reserved) 123381fb6f77SQu Wenruo ); 1234*0f5dcf8dSMark Fasheh 1235*0f5dcf8dSMark Fasheh DECLARE_EVENT_CLASS(btrfs_qgroup_extent, 1236*0f5dcf8dSMark Fasheh TP_PROTO(struct btrfs_qgroup_extent_record *rec), 1237*0f5dcf8dSMark Fasheh 1238*0f5dcf8dSMark Fasheh TP_ARGS(rec), 1239*0f5dcf8dSMark Fasheh 1240*0f5dcf8dSMark Fasheh TP_STRUCT__entry( 1241*0f5dcf8dSMark Fasheh __field( u64, bytenr ) 1242*0f5dcf8dSMark Fasheh __field( u64, num_bytes ) 1243*0f5dcf8dSMark Fasheh ), 1244*0f5dcf8dSMark Fasheh 1245*0f5dcf8dSMark Fasheh TP_fast_assign( 1246*0f5dcf8dSMark Fasheh __entry->bytenr = rec->bytenr, 1247*0f5dcf8dSMark Fasheh __entry->num_bytes = rec->num_bytes; 1248*0f5dcf8dSMark Fasheh ), 1249*0f5dcf8dSMark Fasheh 1250*0f5dcf8dSMark Fasheh TP_printk("bytenr = %llu, num_bytes = %llu", 1251*0f5dcf8dSMark Fasheh (unsigned long long)__entry->bytenr, 1252*0f5dcf8dSMark Fasheh (unsigned long long)__entry->num_bytes) 1253*0f5dcf8dSMark Fasheh ); 1254*0f5dcf8dSMark Fasheh 1255*0f5dcf8dSMark Fasheh DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, 1256*0f5dcf8dSMark Fasheh 1257*0f5dcf8dSMark Fasheh TP_PROTO(struct btrfs_qgroup_extent_record *rec), 1258*0f5dcf8dSMark Fasheh 1259*0f5dcf8dSMark Fasheh TP_ARGS(rec) 1260*0f5dcf8dSMark Fasheh ); 1261*0f5dcf8dSMark Fasheh 1262*0f5dcf8dSMark Fasheh DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_insert_dirty_extent, 1263*0f5dcf8dSMark Fasheh 1264*0f5dcf8dSMark Fasheh TP_PROTO(struct btrfs_qgroup_extent_record *rec), 1265*0f5dcf8dSMark Fasheh 1266*0f5dcf8dSMark Fasheh TP_ARGS(rec) 1267*0f5dcf8dSMark Fasheh ); 1268*0f5dcf8dSMark Fasheh 1269*0f5dcf8dSMark Fasheh TRACE_EVENT(btrfs_qgroup_account_extent, 1270*0f5dcf8dSMark Fasheh 1271*0f5dcf8dSMark Fasheh TP_PROTO(u64 bytenr, u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), 1272*0f5dcf8dSMark Fasheh 1273*0f5dcf8dSMark Fasheh TP_ARGS(bytenr, num_bytes, nr_old_roots, nr_new_roots), 1274*0f5dcf8dSMark Fasheh 1275*0f5dcf8dSMark Fasheh TP_STRUCT__entry( 1276*0f5dcf8dSMark Fasheh __field( u64, bytenr ) 1277*0f5dcf8dSMark Fasheh __field( u64, num_bytes ) 1278*0f5dcf8dSMark Fasheh __field( u64, nr_old_roots ) 1279*0f5dcf8dSMark Fasheh __field( u64, nr_new_roots ) 1280*0f5dcf8dSMark Fasheh ), 1281*0f5dcf8dSMark Fasheh 1282*0f5dcf8dSMark Fasheh TP_fast_assign( 1283*0f5dcf8dSMark Fasheh __entry->bytenr = bytenr; 1284*0f5dcf8dSMark Fasheh __entry->num_bytes = num_bytes; 1285*0f5dcf8dSMark Fasheh __entry->nr_old_roots = nr_old_roots; 1286*0f5dcf8dSMark Fasheh __entry->nr_new_roots = nr_new_roots; 1287*0f5dcf8dSMark Fasheh ), 1288*0f5dcf8dSMark Fasheh 1289*0f5dcf8dSMark Fasheh TP_printk("bytenr = %llu, num_bytes = %llu, nr_old_roots = %llu, " 1290*0f5dcf8dSMark Fasheh "nr_new_roots = %llu", 1291*0f5dcf8dSMark Fasheh __entry->bytenr, 1292*0f5dcf8dSMark Fasheh __entry->num_bytes, 1293*0f5dcf8dSMark Fasheh __entry->nr_old_roots, 1294*0f5dcf8dSMark Fasheh __entry->nr_new_roots) 1295*0f5dcf8dSMark Fasheh ); 1296*0f5dcf8dSMark Fasheh 1297*0f5dcf8dSMark Fasheh TRACE_EVENT(qgroup_update_counters, 1298*0f5dcf8dSMark Fasheh 1299*0f5dcf8dSMark Fasheh TP_PROTO(u64 qgid, u64 cur_old_count, u64 cur_new_count), 1300*0f5dcf8dSMark Fasheh 1301*0f5dcf8dSMark Fasheh TP_ARGS(qgid, cur_old_count, cur_new_count), 1302*0f5dcf8dSMark Fasheh 1303*0f5dcf8dSMark Fasheh TP_STRUCT__entry( 1304*0f5dcf8dSMark Fasheh __field( u64, qgid ) 1305*0f5dcf8dSMark Fasheh __field( u64, cur_old_count ) 1306*0f5dcf8dSMark Fasheh __field( u64, cur_new_count ) 1307*0f5dcf8dSMark Fasheh ), 1308*0f5dcf8dSMark Fasheh 1309*0f5dcf8dSMark Fasheh TP_fast_assign( 1310*0f5dcf8dSMark Fasheh __entry->qgid = qgid; 1311*0f5dcf8dSMark Fasheh __entry->cur_old_count = cur_old_count; 1312*0f5dcf8dSMark Fasheh __entry->cur_new_count = cur_new_count; 1313*0f5dcf8dSMark Fasheh ), 1314*0f5dcf8dSMark Fasheh 1315*0f5dcf8dSMark Fasheh TP_printk("qgid = %llu, cur_old_count = %llu, cur_new_count = %llu", 1316*0f5dcf8dSMark Fasheh __entry->qgid, 1317*0f5dcf8dSMark Fasheh __entry->cur_old_count, 1318*0f5dcf8dSMark Fasheh __entry->cur_new_count) 1319*0f5dcf8dSMark Fasheh ); 1320*0f5dcf8dSMark Fasheh 13211abe9b8aSliubo #endif /* _TRACE_BTRFS_H */ 13221abe9b8aSliubo 13231abe9b8aSliubo /* This part must be outside protection */ 13241abe9b8aSliubo #include <trace/define_trace.h> 1325