Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM btrfs |
| 4 | |
| 5 | #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define _TRACE_BTRFS_H |
| 7 | |
| 8 | #include <linux/writeback.h> |
| 9 | #include <linux/tracepoint.h> |
Vlastimil Babka | 420adbe9 | 2016-03-15 14:55:52 -0700 | [diff] [blame] | 10 | #include <trace/events/mmflags.h> |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 11 | |
| 12 | struct btrfs_root; |
| 13 | struct btrfs_fs_info; |
| 14 | struct btrfs_inode; |
| 15 | struct extent_map; |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 16 | struct btrfs_file_extent_item; |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 17 | struct btrfs_ordered_extent; |
| 18 | struct btrfs_delayed_ref_node; |
| 19 | struct btrfs_delayed_tree_ref; |
| 20 | struct btrfs_delayed_data_ref; |
| 21 | struct btrfs_delayed_ref_head; |
David Sterba | 32da5386 | 2019-10-29 19:20:18 +0100 | [diff] [blame] | 22 | struct btrfs_block_group; |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 23 | struct btrfs_free_cluster; |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 24 | struct map_lookup; |
| 25 | struct extent_buffer; |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 26 | struct btrfs_work; |
Qu Wenruo | c3a4689 | 2014-03-12 08:05:33 +0000 | [diff] [blame] | 27 | struct __btrfs_workqueue; |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 28 | struct btrfs_qgroup_extent_record; |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 29 | struct btrfs_qgroup; |
Qu Wenruo | a1d1984 | 2019-03-01 10:48:00 +0800 | [diff] [blame] | 30 | struct extent_io_tree; |
Jeff Mahoney | 0014275 | 2017-07-12 16:20:08 -0600 | [diff] [blame] | 31 | struct prelim_ref; |
Qu Wenruo | 480b9b4 | 2019-04-29 14:03:33 +0800 | [diff] [blame] | 32 | struct btrfs_space_info; |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 33 | |
| 34 | #define show_ref_type(type) \ |
| 35 | __print_symbolic(type, \ |
| 36 | { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ |
| 37 | { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ |
| 38 | { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ |
| 39 | { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ |
| 40 | { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) |
| 41 | |
| 42 | #define __show_root_type(obj) \ |
liubo | 7f34b74 | 2011-04-19 09:35:31 +0800 | [diff] [blame] | 43 | __print_symbolic_u64(obj, \ |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 44 | { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ |
| 45 | { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ |
| 46 | { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ |
| 47 | { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ |
| 48 | { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ |
| 49 | { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ |
| 50 | { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ |
| 51 | { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ |
Liu Bo | e112e2b | 2013-05-26 13:50:28 +0000 | [diff] [blame] | 52 | { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 53 | { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ |
Omar Sandoval | 208acb8 | 2015-09-29 20:50:34 -0700 | [diff] [blame] | 54 | { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \ |
| 55 | { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \ |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 56 | { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) |
| 57 | |
| 58 | #define show_root_type(obj) \ |
| 59 | obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ |
Liu Bo | fb57dc8 | 2012-11-30 11:24:22 +0000 | [diff] [blame] | 60 | (obj >= BTRFS_ROOT_TREE_OBJECTID && \ |
Liu Bo | e112e2b | 2013-05-26 13:50:28 +0000 | [diff] [blame] | 61 | obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 62 | |
Nikolay Borisov | 5bca2c9 | 2020-06-19 15:24:48 +0300 | [diff] [blame] | 63 | #define FLUSH_ACTIONS \ |
| 64 | EM( BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH") \ |
| 65 | EM( BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT") \ |
| 66 | EM( BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL") \ |
| 67 | EMe(BTRFS_RESERVE_FLUSH_ALL_STEAL, "BTRFS_RESERVE_FLUSH_ALL_STEAL") |
| 68 | |
Nikolay Borisov | 0840dd2 | 2020-06-19 15:24:47 +0300 | [diff] [blame] | 69 | #define FI_TYPES \ |
| 70 | EM( BTRFS_FILE_EXTENT_INLINE, "INLINE") \ |
| 71 | EM( BTRFS_FILE_EXTENT_REG, "REG") \ |
| 72 | EMe(BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC") |
| 73 | |
Nikolay Borisov | 1cb1f0b | 2020-06-19 15:24:49 +0300 | [diff] [blame] | 74 | #define QGROUP_RSV_TYPES \ |
| 75 | EM( BTRFS_QGROUP_RSV_DATA, "DATA") \ |
| 76 | EM( BTRFS_QGROUP_RSV_META_PERTRANS, "META_PERTRANS") \ |
| 77 | EMe(BTRFS_QGROUP_RSV_META_PREALLOC, "META_PREALLOC") |
| 78 | |
Nikolay Borisov | c92bb30 | 2020-06-19 15:24:50 +0300 | [diff] [blame] | 79 | #define IO_TREE_OWNER \ |
| 80 | EM( IO_TREE_FS_PINNED_EXTENTS, "PINNED_EXTENTS") \ |
| 81 | EM( IO_TREE_FS_EXCLUDED_EXTENTS, "EXCLUDED_EXTENTS") \ |
Qu Wenruo | 2c53a14 | 2020-09-15 13:35:27 +0800 | [diff] [blame] | 82 | EM( IO_TREE_BTREE_INODE_IO, "BTREE_INODE_IO") \ |
Nikolay Borisov | c92bb30 | 2020-06-19 15:24:50 +0300 | [diff] [blame] | 83 | EM( IO_TREE_INODE_IO, "INODE_IO") \ |
| 84 | EM( IO_TREE_INODE_IO_FAILURE, "INODE_IO_FAILURE") \ |
| 85 | EM( IO_TREE_RELOC_BLOCKS, "RELOC_BLOCKS") \ |
| 86 | EM( IO_TREE_TRANS_DIRTY_PAGES, "TRANS_DIRTY_PAGES") \ |
| 87 | EM( IO_TREE_ROOT_DIRTY_LOG_PAGES, "ROOT_DIRTY_LOG_PAGES") \ |
| 88 | EM( IO_TREE_INODE_FILE_EXTENT, "INODE_FILE_EXTENT") \ |
| 89 | EM( IO_TREE_LOG_CSUM_RANGE, "LOG_CSUM_RANGE") \ |
| 90 | EMe(IO_TREE_SELFTEST, "SELFTEST") |
| 91 | |
Nikolay Borisov | f0cdd15 | 2020-06-19 15:24:51 +0300 | [diff] [blame] | 92 | #define FLUSH_STATES \ |
| 93 | EM( FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR") \ |
| 94 | EM( FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS") \ |
| 95 | EM( FLUSH_DELALLOC, "FLUSH_DELALLOC") \ |
| 96 | EM( FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT") \ |
| 97 | EM( FLUSH_DELAYED_REFS_NR, "FLUSH_DELAYED_REFS_NR") \ |
| 98 | EM( FLUSH_DELAYED_REFS, "FLUSH_ELAYED_REFS") \ |
| 99 | EM( ALLOC_CHUNK, "ALLOC_CHUNK") \ |
| 100 | EM( ALLOC_CHUNK_FORCE, "ALLOC_CHUNK_FORCE") \ |
| 101 | EM( RUN_DELAYED_IPUTS, "RUN_DELAYED_IPUTS") \ |
| 102 | EMe(COMMIT_TRANS, "COMMIT_TRANS") |
| 103 | |
Nikolay Borisov | 5bca2c9 | 2020-06-19 15:24:48 +0300 | [diff] [blame] | 104 | /* |
| 105 | * First define the enums in the above macros to be exported to userspace via |
| 106 | * TRACE_DEFINE_ENUM(). |
| 107 | */ |
| 108 | |
Nikolay Borisov | 0840dd2 | 2020-06-19 15:24:47 +0300 | [diff] [blame] | 109 | #undef EM |
| 110 | #undef EMe |
| 111 | #define EM(a, b) TRACE_DEFINE_ENUM(a); |
| 112 | #define EMe(a, b) TRACE_DEFINE_ENUM(a); |
| 113 | |
Nikolay Borisov | 5bca2c9 | 2020-06-19 15:24:48 +0300 | [diff] [blame] | 114 | FLUSH_ACTIONS |
Nikolay Borisov | 0840dd2 | 2020-06-19 15:24:47 +0300 | [diff] [blame] | 115 | FI_TYPES |
Nikolay Borisov | 1cb1f0b | 2020-06-19 15:24:49 +0300 | [diff] [blame] | 116 | QGROUP_RSV_TYPES |
Nikolay Borisov | c92bb30 | 2020-06-19 15:24:50 +0300 | [diff] [blame] | 117 | IO_TREE_OWNER |
Nikolay Borisov | f0cdd15 | 2020-06-19 15:24:51 +0300 | [diff] [blame] | 118 | FLUSH_STATES |
Nikolay Borisov | 0840dd2 | 2020-06-19 15:24:47 +0300 | [diff] [blame] | 119 | |
Nikolay Borisov | 5bca2c9 | 2020-06-19 15:24:48 +0300 | [diff] [blame] | 120 | /* |
| 121 | * Now redefine the EM and EMe macros to map the enums to the strings that will |
| 122 | * be printed in the output |
| 123 | */ |
| 124 | |
Nikolay Borisov | 0840dd2 | 2020-06-19 15:24:47 +0300 | [diff] [blame] | 125 | #undef EM |
| 126 | #undef EMe |
| 127 | #define EM(a, b) {a, b}, |
| 128 | #define EMe(a, b) {a, b} |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 129 | |
Qu Wenruo | a1d1984 | 2019-03-01 10:48:00 +0800 | [diff] [blame] | 130 | |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 131 | #define BTRFS_GROUP_FLAGS \ |
Liu Bo | e112e2b | 2013-05-26 13:50:28 +0000 | [diff] [blame] | 132 | { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ |
| 133 | { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ |
| 134 | { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ |
| 135 | { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ |
| 136 | { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ |
| 137 | { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ |
| 138 | { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ |
| 139 | { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ |
| 140 | { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 141 | |
Qu Wenruo | a1d1984 | 2019-03-01 10:48:00 +0800 | [diff] [blame] | 142 | #define EXTENT_FLAGS \ |
| 143 | { EXTENT_DIRTY, "DIRTY"}, \ |
Qu Wenruo | a1d1984 | 2019-03-01 10:48:00 +0800 | [diff] [blame] | 144 | { EXTENT_UPTODATE, "UPTODATE"}, \ |
| 145 | { EXTENT_LOCKED, "LOCKED"}, \ |
| 146 | { EXTENT_NEW, "NEW"}, \ |
| 147 | { EXTENT_DELALLOC, "DELALLOC"}, \ |
| 148 | { EXTENT_DEFRAG, "DEFRAG"}, \ |
| 149 | { EXTENT_BOUNDARY, "BOUNDARY"}, \ |
| 150 | { EXTENT_NODATASUM, "NODATASUM"}, \ |
| 151 | { EXTENT_CLEAR_META_RESV, "CLEAR_META_RESV"}, \ |
| 152 | { EXTENT_NEED_WAIT, "NEED_WAIT"}, \ |
| 153 | { EXTENT_DAMAGED, "DAMAGED"}, \ |
| 154 | { EXTENT_NORESERVE, "NORESERVE"}, \ |
| 155 | { EXTENT_QGROUP_RESERVED, "QGROUP_RESERVED"}, \ |
| 156 | { EXTENT_CLEAR_DATA_RESV, "CLEAR_DATA_RESV"}, \ |
| 157 | { EXTENT_DELALLOC_NEW, "DELALLOC_NEW"} |
| 158 | |
Anand Jain | b94417e | 2017-08-13 11:58:30 +0800 | [diff] [blame] | 159 | #define BTRFS_FSID_SIZE 16 |
| 160 | #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE) |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 161 | |
| 162 | #define TP_fast_assign_fsid(fs_info) \ |
Qu Wenruo | a1d1984 | 2019-03-01 10:48:00 +0800 | [diff] [blame] | 163 | ({ \ |
| 164 | if (fs_info) \ |
| 165 | memcpy(__entry->fsid, fs_info->fs_devices->fsid, \ |
| 166 | BTRFS_FSID_SIZE); \ |
| 167 | else \ |
| 168 | memset(__entry->fsid, 0, BTRFS_FSID_SIZE); \ |
| 169 | }) |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 170 | |
| 171 | #define TP_STRUCT__entry_btrfs(args...) \ |
| 172 | TP_STRUCT__entry( \ |
| 173 | TP_STRUCT__entry_fsid \ |
| 174 | args) |
| 175 | #define TP_fast_assign_btrfs(fs_info, args...) \ |
| 176 | TP_fast_assign( \ |
| 177 | TP_fast_assign_fsid(fs_info); \ |
| 178 | args) |
| 179 | #define TP_printk_btrfs(fmt, args...) \ |
| 180 | TP_printk("%pU: " fmt, __entry->fsid, args) |
Josef Bacik | 8c2a3ca | 2012-01-10 10:31:31 -0500 | [diff] [blame] | 181 | |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 182 | TRACE_EVENT(btrfs_transaction_commit, |
| 183 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 184 | TP_PROTO(const struct btrfs_root *root), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 185 | |
| 186 | TP_ARGS(root), |
| 187 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 188 | TP_STRUCT__entry_btrfs( |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 189 | __field( u64, generation ) |
| 190 | __field( u64, root_objectid ) |
| 191 | ), |
| 192 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 193 | TP_fast_assign_btrfs(root->fs_info, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 194 | __entry->generation = root->fs_info->generation; |
| 195 | __entry->root_objectid = root->root_key.objectid; |
| 196 | ), |
| 197 | |
David Sterba | 79bcb71 | 2018-04-03 21:21:17 +0200 | [diff] [blame] | 198 | TP_printk_btrfs("root=%llu(%s) gen=%llu", |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 199 | show_root_type(__entry->root_objectid), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 200 | __entry->generation) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 201 | ); |
| 202 | |
| 203 | DECLARE_EVENT_CLASS(btrfs__inode, |
| 204 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 205 | TP_PROTO(const struct inode *inode), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 206 | |
| 207 | TP_ARGS(inode), |
| 208 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 209 | TP_STRUCT__entry_btrfs( |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 210 | __field( u64, ino ) |
David Sterba | 94c3f6c | 2019-10-17 13:28:55 +0200 | [diff] [blame] | 211 | __field( u64, blocks ) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 212 | __field( u64, disk_i_size ) |
| 213 | __field( u64, generation ) |
| 214 | __field( u64, last_trans ) |
| 215 | __field( u64, logged_trans ) |
| 216 | __field( u64, root_objectid ) |
| 217 | ), |
| 218 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 219 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 220 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 221 | __entry->blocks = inode->i_blocks; |
| 222 | __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; |
| 223 | __entry->generation = BTRFS_I(inode)->generation; |
| 224 | __entry->last_trans = BTRFS_I(inode)->last_trans; |
| 225 | __entry->logged_trans = BTRFS_I(inode)->logged_trans; |
| 226 | __entry->root_objectid = |
| 227 | BTRFS_I(inode)->root->root_key.objectid; |
| 228 | ), |
| 229 | |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 230 | TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%llu blocks=%llu " |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 231 | "disk_i_size=%llu last_trans=%llu logged_trans=%llu", |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 232 | show_root_type(__entry->root_objectid), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 233 | __entry->generation, |
| 234 | __entry->ino, |
David Sterba | 94c3f6c | 2019-10-17 13:28:55 +0200 | [diff] [blame] | 235 | __entry->blocks, |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 236 | __entry->disk_i_size, |
| 237 | __entry->last_trans, |
| 238 | __entry->logged_trans) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 239 | ); |
| 240 | |
| 241 | DEFINE_EVENT(btrfs__inode, btrfs_inode_new, |
| 242 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 243 | TP_PROTO(const struct inode *inode), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 244 | |
| 245 | TP_ARGS(inode) |
| 246 | ); |
| 247 | |
| 248 | DEFINE_EVENT(btrfs__inode, btrfs_inode_request, |
| 249 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 250 | TP_PROTO(const struct inode *inode), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 251 | |
| 252 | TP_ARGS(inode) |
| 253 | ); |
| 254 | |
| 255 | DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, |
| 256 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 257 | TP_PROTO(const struct inode *inode), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 258 | |
| 259 | TP_ARGS(inode) |
| 260 | ); |
| 261 | |
| 262 | #define __show_map_type(type) \ |
liubo | 7f34b74 | 2011-04-19 09:35:31 +0800 | [diff] [blame] | 263 | __print_symbolic_u64(type, \ |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 264 | { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ |
| 265 | { EXTENT_MAP_HOLE, "HOLE" }, \ |
| 266 | { EXTENT_MAP_INLINE, "INLINE" }, \ |
| 267 | { EXTENT_MAP_DELALLOC, "DELALLOC" }) |
| 268 | |
| 269 | #define show_map_type(type) \ |
| 270 | type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) |
| 271 | |
| 272 | #define show_map_flags(flag) \ |
| 273 | __print_flags(flag, "|", \ |
Liu Bo | 254a2d1 | 2014-09-17 21:36:41 +0800 | [diff] [blame] | 274 | { (1 << EXTENT_FLAG_PINNED), "PINNED" },\ |
| 275 | { (1 << EXTENT_FLAG_COMPRESSED), "COMPRESSED" },\ |
Liu Bo | 254a2d1 | 2014-09-17 21:36:41 +0800 | [diff] [blame] | 276 | { (1 << EXTENT_FLAG_PREALLOC), "PREALLOC" },\ |
| 277 | { (1 << EXTENT_FLAG_LOGGING), "LOGGING" },\ |
| 278 | { (1 << EXTENT_FLAG_FILLING), "FILLING" },\ |
| 279 | { (1 << EXTENT_FLAG_FS_MAPPING), "FS_MAPPING" }) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 280 | |
Steven Rostedt | 4cd8587 | 2013-11-14 22:57:29 -0500 | [diff] [blame] | 281 | TRACE_EVENT_CONDITION(btrfs_get_extent, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 282 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 283 | TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode, |
| 284 | const struct extent_map *map), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 285 | |
Liu Bo | 92a1bf7 | 2016-11-17 15:00:50 -0800 | [diff] [blame] | 286 | TP_ARGS(root, inode, map), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 287 | |
Steven Rostedt | 4cd8587 | 2013-11-14 22:57:29 -0500 | [diff] [blame] | 288 | TP_CONDITION(map), |
| 289 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 290 | TP_STRUCT__entry_btrfs( |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 291 | __field( u64, root_objectid ) |
Liu Bo | 92a1bf7 | 2016-11-17 15:00:50 -0800 | [diff] [blame] | 292 | __field( u64, ino ) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 293 | __field( u64, start ) |
| 294 | __field( u64, len ) |
| 295 | __field( u64, orig_start ) |
| 296 | __field( u64, block_start ) |
| 297 | __field( u64, block_len ) |
| 298 | __field( unsigned long, flags ) |
| 299 | __field( int, refs ) |
| 300 | __field( unsigned int, compress_type ) |
| 301 | ), |
| 302 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 303 | TP_fast_assign_btrfs(root->fs_info, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 304 | __entry->root_objectid = root->root_key.objectid; |
Liu Bo | 92a1bf7 | 2016-11-17 15:00:50 -0800 | [diff] [blame] | 305 | __entry->ino = btrfs_ino(inode); |
| 306 | __entry->start = map->start; |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 307 | __entry->len = map->len; |
| 308 | __entry->orig_start = map->orig_start; |
| 309 | __entry->block_start = map->block_start; |
| 310 | __entry->block_len = map->block_len; |
| 311 | __entry->flags = map->flags; |
Elena Reshetova | 490b54d | 2017-03-03 10:55:12 +0200 | [diff] [blame] | 312 | __entry->refs = refcount_read(&map->refs); |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 313 | __entry->compress_type = map->compress_type; |
| 314 | ), |
| 315 | |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 316 | TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu " |
| 317 | "orig_start=%llu block_start=%llu(%s) " |
| 318 | "block_len=%llu flags=%s refs=%u " |
| 319 | "compress_type=%u", |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 320 | show_root_type(__entry->root_objectid), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 321 | __entry->ino, |
| 322 | __entry->start, |
| 323 | __entry->len, |
| 324 | __entry->orig_start, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 325 | show_map_type(__entry->block_start), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 326 | __entry->block_len, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 327 | show_map_flags(__entry->flags), |
| 328 | __entry->refs, __entry->compress_type) |
| 329 | ); |
| 330 | |
Liu Bo | 393da91 | 2018-01-05 12:51:16 -0700 | [diff] [blame] | 331 | TRACE_EVENT(btrfs_handle_em_exist, |
| 332 | |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 333 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
David Sterba | f46b24c | 2018-04-03 21:45:57 +0200 | [diff] [blame] | 334 | const struct extent_map *existing, const struct extent_map *map, |
| 335 | u64 start, u64 len), |
Liu Bo | 393da91 | 2018-01-05 12:51:16 -0700 | [diff] [blame] | 336 | |
David Sterba | f46b24c | 2018-04-03 21:45:57 +0200 | [diff] [blame] | 337 | TP_ARGS(fs_info, existing, map, start, len), |
Liu Bo | 393da91 | 2018-01-05 12:51:16 -0700 | [diff] [blame] | 338 | |
David Sterba | f46b24c | 2018-04-03 21:45:57 +0200 | [diff] [blame] | 339 | TP_STRUCT__entry_btrfs( |
Liu Bo | 393da91 | 2018-01-05 12:51:16 -0700 | [diff] [blame] | 340 | __field( u64, e_start ) |
| 341 | __field( u64, e_len ) |
| 342 | __field( u64, map_start ) |
| 343 | __field( u64, map_len ) |
| 344 | __field( u64, start ) |
| 345 | __field( u64, len ) |
| 346 | ), |
| 347 | |
David Sterba | f46b24c | 2018-04-03 21:45:57 +0200 | [diff] [blame] | 348 | TP_fast_assign_btrfs(fs_info, |
Liu Bo | 393da91 | 2018-01-05 12:51:16 -0700 | [diff] [blame] | 349 | __entry->e_start = existing->start; |
| 350 | __entry->e_len = existing->len; |
| 351 | __entry->map_start = map->start; |
| 352 | __entry->map_len = map->len; |
| 353 | __entry->start = start; |
| 354 | __entry->len = len; |
| 355 | ), |
| 356 | |
David Sterba | f46b24c | 2018-04-03 21:45:57 +0200 | [diff] [blame] | 357 | TP_printk_btrfs("start=%llu len=%llu " |
Liu Bo | 393da91 | 2018-01-05 12:51:16 -0700 | [diff] [blame] | 358 | "existing(start=%llu len=%llu) " |
| 359 | "em(start=%llu len=%llu)", |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 360 | __entry->start, |
| 361 | __entry->len, |
| 362 | __entry->e_start, |
| 363 | __entry->e_len, |
| 364 | __entry->map_start, |
| 365 | __entry->map_len) |
Liu Bo | 393da91 | 2018-01-05 12:51:16 -0700 | [diff] [blame] | 366 | ); |
| 367 | |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 368 | /* file extent item */ |
| 369 | DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular, |
| 370 | |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 371 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
| 372 | const struct btrfs_file_extent_item *fi, u64 start), |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 373 | |
| 374 | TP_ARGS(bi, l, fi, start), |
| 375 | |
| 376 | TP_STRUCT__entry_btrfs( |
| 377 | __field( u64, root_obj ) |
| 378 | __field( u64, ino ) |
| 379 | __field( loff_t, isize ) |
| 380 | __field( u64, disk_isize ) |
| 381 | __field( u64, num_bytes ) |
| 382 | __field( u64, ram_bytes ) |
| 383 | __field( u64, disk_bytenr ) |
| 384 | __field( u64, disk_num_bytes ) |
| 385 | __field( u64, extent_offset ) |
| 386 | __field( u8, extent_type ) |
| 387 | __field( u8, compression ) |
| 388 | __field( u64, extent_start ) |
| 389 | __field( u64, extent_end ) |
| 390 | ), |
| 391 | |
| 392 | TP_fast_assign_btrfs(bi->root->fs_info, |
Misono Tomohiro | 4fd786e | 2018-08-06 14:25:24 +0900 | [diff] [blame] | 393 | __entry->root_obj = bi->root->root_key.objectid; |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 394 | __entry->ino = btrfs_ino(bi); |
| 395 | __entry->isize = bi->vfs_inode.i_size; |
| 396 | __entry->disk_isize = bi->disk_i_size; |
| 397 | __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi); |
| 398 | __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi); |
| 399 | __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi); |
| 400 | __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi); |
| 401 | __entry->extent_offset = btrfs_file_extent_offset(l, fi); |
| 402 | __entry->extent_type = btrfs_file_extent_type(l, fi); |
| 403 | __entry->compression = btrfs_file_extent_compression(l, fi); |
| 404 | __entry->extent_start = start; |
| 405 | __entry->extent_end = (start + __entry->num_bytes); |
| 406 | ), |
| 407 | |
| 408 | TP_printk_btrfs( |
| 409 | "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " |
| 410 | "file extent range=[%llu %llu] " |
| 411 | "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu " |
| 412 | "disk_num_bytes=%llu extent_offset=%llu type=%s " |
| 413 | "compression=%u", |
| 414 | show_root_type(__entry->root_obj), __entry->ino, |
| 415 | __entry->isize, |
| 416 | __entry->disk_isize, __entry->extent_start, |
| 417 | __entry->extent_end, __entry->num_bytes, __entry->ram_bytes, |
| 418 | __entry->disk_bytenr, __entry->disk_num_bytes, |
Nikolay Borisov | 0840dd2 | 2020-06-19 15:24:47 +0300 | [diff] [blame] | 419 | __entry->extent_offset, __print_symbolic(__entry->extent_type, FI_TYPES), |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 420 | __entry->compression) |
| 421 | ); |
| 422 | |
| 423 | DECLARE_EVENT_CLASS( |
| 424 | btrfs__file_extent_item_inline, |
| 425 | |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 426 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
| 427 | const struct btrfs_file_extent_item *fi, int slot, u64 start), |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 428 | |
| 429 | TP_ARGS(bi, l, fi, slot, start), |
| 430 | |
| 431 | TP_STRUCT__entry_btrfs( |
| 432 | __field( u64, root_obj ) |
| 433 | __field( u64, ino ) |
| 434 | __field( loff_t, isize ) |
| 435 | __field( u64, disk_isize ) |
| 436 | __field( u8, extent_type ) |
| 437 | __field( u8, compression ) |
| 438 | __field( u64, extent_start ) |
| 439 | __field( u64, extent_end ) |
| 440 | ), |
| 441 | |
| 442 | TP_fast_assign_btrfs( |
| 443 | bi->root->fs_info, |
Misono Tomohiro | 4fd786e | 2018-08-06 14:25:24 +0900 | [diff] [blame] | 444 | __entry->root_obj = bi->root->root_key.objectid; |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 445 | __entry->ino = btrfs_ino(bi); |
| 446 | __entry->isize = bi->vfs_inode.i_size; |
| 447 | __entry->disk_isize = bi->disk_i_size; |
| 448 | __entry->extent_type = btrfs_file_extent_type(l, fi); |
| 449 | __entry->compression = btrfs_file_extent_compression(l, fi); |
| 450 | __entry->extent_start = start; |
Qu Wenruo | e41ca58 | 2018-06-06 15:41:49 +0800 | [diff] [blame] | 451 | __entry->extent_end = (start + btrfs_file_extent_ram_bytes(l, fi)); |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 452 | ), |
| 453 | |
| 454 | TP_printk_btrfs( |
| 455 | "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " |
| 456 | "file extent range=[%llu %llu] " |
| 457 | "extent_type=%s compression=%u", |
| 458 | show_root_type(__entry->root_obj), __entry->ino, __entry->isize, |
| 459 | __entry->disk_isize, __entry->extent_start, |
Nikolay Borisov | 0840dd2 | 2020-06-19 15:24:47 +0300 | [diff] [blame] | 460 | __entry->extent_end, __print_symbolic(__entry->extent_type, FI_TYPES), |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 461 | __entry->compression) |
| 462 | ); |
| 463 | |
| 464 | DEFINE_EVENT( |
| 465 | btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular, |
| 466 | |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 467 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
| 468 | const struct btrfs_file_extent_item *fi, u64 start), |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 469 | |
| 470 | TP_ARGS(bi, l, fi, start) |
| 471 | ); |
| 472 | |
| 473 | DEFINE_EVENT( |
| 474 | btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular, |
| 475 | |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 476 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
| 477 | const struct btrfs_file_extent_item *fi, u64 start), |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 478 | |
| 479 | TP_ARGS(bi, l, fi, start) |
| 480 | ); |
| 481 | |
| 482 | DEFINE_EVENT( |
| 483 | btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline, |
| 484 | |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 485 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
| 486 | const struct btrfs_file_extent_item *fi, int slot, u64 start), |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 487 | |
| 488 | TP_ARGS(bi, l, fi, slot, start) |
| 489 | ); |
| 490 | |
| 491 | DEFINE_EVENT( |
| 492 | btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline, |
| 493 | |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 494 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
| 495 | const struct btrfs_file_extent_item *fi, int slot, u64 start), |
Liu Bo | 09ed2f1 | 2017-03-10 11:09:48 -0800 | [diff] [blame] | 496 | |
| 497 | TP_ARGS(bi, l, fi, slot, start) |
| 498 | ); |
| 499 | |
Liu Bo | 9d04a8c | 2013-11-06 12:04:13 +0800 | [diff] [blame] | 500 | #define show_ordered_flags(flags) \ |
| 501 | __print_flags(flags, "|", \ |
| 502 | { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ |
| 503 | { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ |
| 504 | { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ |
| 505 | { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ |
| 506 | { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ |
| 507 | { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ |
| 508 | { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ |
Liu Bo | 792ddef | 2013-11-06 12:04:14 +0800 | [diff] [blame] | 509 | { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) |
Liu Bo | e112e2b | 2013-05-26 13:50:28 +0000 | [diff] [blame] | 510 | |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 511 | |
| 512 | DECLARE_EVENT_CLASS(btrfs__ordered_extent, |
| 513 | |
Nikolay Borisov | acbf1dd | 2020-08-31 14:42:40 +0300 | [diff] [blame] | 514 | TP_PROTO(const struct btrfs_inode *inode, |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 515 | const struct btrfs_ordered_extent *ordered), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 516 | |
| 517 | TP_ARGS(inode, ordered), |
| 518 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 519 | TP_STRUCT__entry_btrfs( |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 520 | __field( u64, ino ) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 521 | __field( u64, file_offset ) |
| 522 | __field( u64, start ) |
| 523 | __field( u64, len ) |
| 524 | __field( u64, disk_len ) |
| 525 | __field( u64, bytes_left ) |
| 526 | __field( unsigned long, flags ) |
| 527 | __field( int, compress_type ) |
| 528 | __field( int, refs ) |
| 529 | __field( u64, root_objectid ) |
Liu Bo | 7856654 | 2016-11-30 16:10:10 -0800 | [diff] [blame] | 530 | __field( u64, truncated_len ) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 531 | ), |
| 532 | |
Nikolay Borisov | acbf1dd | 2020-08-31 14:42:40 +0300 | [diff] [blame] | 533 | TP_fast_assign_btrfs(inode->root->fs_info, |
| 534 | __entry->ino = btrfs_ino(inode); |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 535 | __entry->file_offset = ordered->file_offset; |
Omar Sandoval | bffe633 | 2019-12-02 17:34:19 -0800 | [diff] [blame] | 536 | __entry->start = ordered->disk_bytenr; |
| 537 | __entry->len = ordered->num_bytes; |
| 538 | __entry->disk_len = ordered->disk_num_bytes; |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 539 | __entry->bytes_left = ordered->bytes_left; |
| 540 | __entry->flags = ordered->flags; |
| 541 | __entry->compress_type = ordered->compress_type; |
Elena Reshetova | e76edab | 2017-03-03 10:55:13 +0200 | [diff] [blame] | 542 | __entry->refs = refcount_read(&ordered->refs); |
Nikolay Borisov | acbf1dd | 2020-08-31 14:42:40 +0300 | [diff] [blame] | 543 | __entry->root_objectid = inode->root->root_key.objectid; |
Liu Bo | 7856654 | 2016-11-30 16:10:10 -0800 | [diff] [blame] | 544 | __entry->truncated_len = ordered->truncated_len; |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 545 | ), |
| 546 | |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 547 | TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu " |
| 548 | "start=%llu len=%llu disk_len=%llu " |
| 549 | "truncated_len=%llu " |
| 550 | "bytes_left=%llu flags=%s compress_type=%d " |
| 551 | "refs=%d", |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 552 | show_root_type(__entry->root_objectid), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 553 | __entry->ino, |
| 554 | __entry->file_offset, |
| 555 | __entry->start, |
| 556 | __entry->len, |
| 557 | __entry->disk_len, |
| 558 | __entry->truncated_len, |
| 559 | __entry->bytes_left, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 560 | show_ordered_flags(__entry->flags), |
| 561 | __entry->compress_type, __entry->refs) |
| 562 | ); |
| 563 | |
| 564 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, |
| 565 | |
Nikolay Borisov | acbf1dd | 2020-08-31 14:42:40 +0300 | [diff] [blame] | 566 | TP_PROTO(const struct btrfs_inode *inode, |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 567 | const struct btrfs_ordered_extent *ordered), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 568 | |
| 569 | TP_ARGS(inode, ordered) |
| 570 | ); |
| 571 | |
| 572 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, |
| 573 | |
Nikolay Borisov | acbf1dd | 2020-08-31 14:42:40 +0300 | [diff] [blame] | 574 | TP_PROTO(const struct btrfs_inode *inode, |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 575 | const struct btrfs_ordered_extent *ordered), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 576 | |
| 577 | TP_ARGS(inode, ordered) |
| 578 | ); |
| 579 | |
| 580 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, |
| 581 | |
Nikolay Borisov | acbf1dd | 2020-08-31 14:42:40 +0300 | [diff] [blame] | 582 | TP_PROTO(const struct btrfs_inode *inode, |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 583 | const struct btrfs_ordered_extent *ordered), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 584 | |
| 585 | TP_ARGS(inode, ordered) |
| 586 | ); |
| 587 | |
| 588 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, |
| 589 | |
Nikolay Borisov | acbf1dd | 2020-08-31 14:42:40 +0300 | [diff] [blame] | 590 | TP_PROTO(const struct btrfs_inode *inode, |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 591 | const struct btrfs_ordered_extent *ordered), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 592 | |
| 593 | TP_ARGS(inode, ordered) |
| 594 | ); |
| 595 | |
| 596 | DECLARE_EVENT_CLASS(btrfs__writepage, |
| 597 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 598 | TP_PROTO(const struct page *page, const struct inode *inode, |
| 599 | const struct writeback_control *wbc), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 600 | |
| 601 | TP_ARGS(page, inode, wbc), |
| 602 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 603 | TP_STRUCT__entry_btrfs( |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 604 | __field( u64, ino ) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 605 | __field( pgoff_t, index ) |
| 606 | __field( long, nr_to_write ) |
| 607 | __field( long, pages_skipped ) |
| 608 | __field( loff_t, range_start ) |
| 609 | __field( loff_t, range_end ) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 610 | __field( char, for_kupdate ) |
| 611 | __field( char, for_reclaim ) |
| 612 | __field( char, range_cyclic ) |
David Sterba | 94c3f6c | 2019-10-17 13:28:55 +0200 | [diff] [blame] | 613 | __field( unsigned long, writeback_index ) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 614 | __field( u64, root_objectid ) |
| 615 | ), |
| 616 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 617 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 618 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 619 | __entry->index = page->index; |
| 620 | __entry->nr_to_write = wbc->nr_to_write; |
| 621 | __entry->pages_skipped = wbc->pages_skipped; |
| 622 | __entry->range_start = wbc->range_start; |
| 623 | __entry->range_end = wbc->range_end; |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 624 | __entry->for_kupdate = wbc->for_kupdate; |
| 625 | __entry->for_reclaim = wbc->for_reclaim; |
| 626 | __entry->range_cyclic = wbc->range_cyclic; |
| 627 | __entry->writeback_index = inode->i_mapping->writeback_index; |
| 628 | __entry->root_objectid = |
| 629 | BTRFS_I(inode)->root->root_key.objectid; |
| 630 | ), |
| 631 | |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 632 | TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu " |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 633 | "nr_to_write=%ld pages_skipped=%ld range_start=%llu " |
| 634 | "range_end=%llu for_kupdate=%d " |
| 635 | "for_reclaim=%d range_cyclic=%d writeback_index=%lu", |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 636 | show_root_type(__entry->root_objectid), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 637 | __entry->ino, __entry->index, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 638 | __entry->nr_to_write, __entry->pages_skipped, |
| 639 | __entry->range_start, __entry->range_end, |
Wu Fengguang | 846d5a0 | 2011-05-05 21:10:38 -0600 | [diff] [blame] | 640 | __entry->for_kupdate, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 641 | __entry->for_reclaim, __entry->range_cyclic, |
David Sterba | 94c3f6c | 2019-10-17 13:28:55 +0200 | [diff] [blame] | 642 | __entry->writeback_index) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 643 | ); |
| 644 | |
| 645 | DEFINE_EVENT(btrfs__writepage, __extent_writepage, |
| 646 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 647 | TP_PROTO(const struct page *page, const struct inode *inode, |
| 648 | const struct writeback_control *wbc), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 649 | |
| 650 | TP_ARGS(page, inode, wbc) |
| 651 | ); |
| 652 | |
| 653 | TRACE_EVENT(btrfs_writepage_end_io_hook, |
| 654 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 655 | TP_PROTO(const struct page *page, u64 start, u64 end, int uptodate), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 656 | |
| 657 | TP_ARGS(page, start, end, uptodate), |
| 658 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 659 | TP_STRUCT__entry_btrfs( |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 660 | __field( u64, ino ) |
David Sterba | 94c3f6c | 2019-10-17 13:28:55 +0200 | [diff] [blame] | 661 | __field( unsigned long, index ) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 662 | __field( u64, start ) |
| 663 | __field( u64, end ) |
| 664 | __field( int, uptodate ) |
| 665 | __field( u64, root_objectid ) |
| 666 | ), |
| 667 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 668 | TP_fast_assign_btrfs(btrfs_sb(page->mapping->host->i_sb), |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 669 | __entry->ino = btrfs_ino(BTRFS_I(page->mapping->host)); |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 670 | __entry->index = page->index; |
| 671 | __entry->start = start; |
| 672 | __entry->end = end; |
| 673 | __entry->uptodate = uptodate; |
| 674 | __entry->root_objectid = |
| 675 | BTRFS_I(page->mapping->host)->root->root_key.objectid; |
| 676 | ), |
| 677 | |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 678 | TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu start=%llu " |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 679 | "end=%llu uptodate=%d", |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 680 | show_root_type(__entry->root_objectid), |
David Sterba | 94c3f6c | 2019-10-17 13:28:55 +0200 | [diff] [blame] | 681 | __entry->ino, __entry->index, |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 682 | __entry->start, |
| 683 | __entry->end, __entry->uptodate) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 684 | ); |
| 685 | |
| 686 | TRACE_EVENT(btrfs_sync_file, |
| 687 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 688 | TP_PROTO(const struct file *file, int datasync), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 689 | |
| 690 | TP_ARGS(file, datasync), |
| 691 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 692 | TP_STRUCT__entry_btrfs( |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 693 | __field( u64, ino ) |
| 694 | __field( u64, parent ) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 695 | __field( int, datasync ) |
| 696 | __field( u64, root_objectid ) |
| 697 | ), |
| 698 | |
| 699 | TP_fast_assign( |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 700 | const struct dentry *dentry = file->f_path.dentry; |
| 701 | const struct inode *inode = d_inode(dentry); |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 702 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 703 | TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb)); |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 704 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
| 705 | __entry->parent = btrfs_ino(BTRFS_I(d_inode(dentry->d_parent))); |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 706 | __entry->datasync = datasync; |
| 707 | __entry->root_objectid = |
| 708 | BTRFS_I(inode)->root->root_key.objectid; |
| 709 | ), |
| 710 | |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 711 | TP_printk_btrfs("root=%llu(%s) ino=%llu parent=%llu datasync=%d", |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 712 | show_root_type(__entry->root_objectid), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 713 | __entry->ino, |
| 714 | __entry->parent, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 715 | __entry->datasync) |
| 716 | ); |
| 717 | |
| 718 | TRACE_EVENT(btrfs_sync_fs, |
| 719 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 720 | TP_PROTO(const struct btrfs_fs_info *fs_info, int wait), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 721 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 722 | TP_ARGS(fs_info, wait), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 723 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 724 | TP_STRUCT__entry_btrfs( |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 725 | __field( int, wait ) |
| 726 | ), |
| 727 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 728 | TP_fast_assign_btrfs(fs_info, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 729 | __entry->wait = wait; |
| 730 | ), |
| 731 | |
David Sterba | 79bcb71 | 2018-04-03 21:21:17 +0200 | [diff] [blame] | 732 | TP_printk_btrfs("wait=%d", __entry->wait) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 733 | ); |
| 734 | |
Josef Bacik | c83f8ef | 2016-03-25 13:25:52 -0400 | [diff] [blame] | 735 | TRACE_EVENT(btrfs_add_block_group, |
| 736 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 737 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
David Sterba | 32da5386 | 2019-10-29 19:20:18 +0100 | [diff] [blame] | 738 | const struct btrfs_block_group *block_group, int create), |
Josef Bacik | c83f8ef | 2016-03-25 13:25:52 -0400 | [diff] [blame] | 739 | |
| 740 | TP_ARGS(fs_info, block_group, create), |
| 741 | |
David Sterba | 2e63e62 | 2018-04-03 21:34:06 +0200 | [diff] [blame] | 742 | TP_STRUCT__entry_btrfs( |
Josef Bacik | c83f8ef | 2016-03-25 13:25:52 -0400 | [diff] [blame] | 743 | __field( u64, offset ) |
| 744 | __field( u64, size ) |
| 745 | __field( u64, flags ) |
| 746 | __field( u64, bytes_used ) |
| 747 | __field( u64, bytes_super ) |
| 748 | __field( int, create ) |
| 749 | ), |
| 750 | |
David Sterba | 2e63e62 | 2018-04-03 21:34:06 +0200 | [diff] [blame] | 751 | TP_fast_assign_btrfs(fs_info, |
David Sterba | b3470b5 | 2019-10-23 18:48:22 +0200 | [diff] [blame] | 752 | __entry->offset = block_group->start; |
| 753 | __entry->size = block_group->length; |
Josef Bacik | c83f8ef | 2016-03-25 13:25:52 -0400 | [diff] [blame] | 754 | __entry->flags = block_group->flags; |
David Sterba | bf38be6 | 2019-10-23 18:48:11 +0200 | [diff] [blame] | 755 | __entry->bytes_used = block_group->used; |
Josef Bacik | c83f8ef | 2016-03-25 13:25:52 -0400 | [diff] [blame] | 756 | __entry->bytes_super = block_group->bytes_super; |
| 757 | __entry->create = create; |
| 758 | ), |
| 759 | |
David Sterba | 2e63e62 | 2018-04-03 21:34:06 +0200 | [diff] [blame] | 760 | TP_printk_btrfs("block_group offset=%llu size=%llu " |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 761 | "flags=%llu(%s) bytes_used=%llu bytes_super=%llu " |
David Sterba | 2e63e62 | 2018-04-03 21:34:06 +0200 | [diff] [blame] | 762 | "create=%d", |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 763 | __entry->offset, |
| 764 | __entry->size, |
| 765 | __entry->flags, |
Josef Bacik | c83f8ef | 2016-03-25 13:25:52 -0400 | [diff] [blame] | 766 | __print_flags((unsigned long)__entry->flags, "|", |
| 767 | BTRFS_GROUP_FLAGS), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 768 | __entry->bytes_used, |
| 769 | __entry->bytes_super, __entry->create) |
Josef Bacik | c83f8ef | 2016-03-25 13:25:52 -0400 | [diff] [blame] | 770 | ); |
| 771 | |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 772 | #define show_ref_action(action) \ |
| 773 | __print_symbolic(action, \ |
| 774 | { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ |
| 775 | { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ |
| 776 | { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ |
| 777 | { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) |
| 778 | |
| 779 | |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 780 | DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 781 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 782 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 783 | const struct btrfs_delayed_ref_node *ref, |
| 784 | const struct btrfs_delayed_tree_ref *full_ref, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 785 | int action), |
| 786 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 787 | TP_ARGS(fs_info, ref, full_ref, action), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 788 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 789 | TP_STRUCT__entry_btrfs( |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 790 | __field( u64, bytenr ) |
| 791 | __field( u64, num_bytes ) |
| 792 | __field( int, action ) |
| 793 | __field( u64, parent ) |
| 794 | __field( u64, ref_root ) |
| 795 | __field( int, level ) |
| 796 | __field( int, type ) |
Liu Bo | dea7d76 | 2012-09-07 20:01:27 -0600 | [diff] [blame] | 797 | __field( u64, seq ) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 798 | ), |
| 799 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 800 | TP_fast_assign_btrfs(fs_info, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 801 | __entry->bytenr = ref->bytenr; |
| 802 | __entry->num_bytes = ref->num_bytes; |
| 803 | __entry->action = action; |
| 804 | __entry->parent = full_ref->parent; |
| 805 | __entry->ref_root = full_ref->root; |
| 806 | __entry->level = full_ref->level; |
| 807 | __entry->type = ref->type; |
Liu Bo | dea7d76 | 2012-09-07 20:01:27 -0600 | [diff] [blame] | 808 | __entry->seq = ref->seq; |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 809 | ), |
| 810 | |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 811 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " |
| 812 | "parent=%llu(%s) ref_root=%llu(%s) level=%d " |
| 813 | "type=%s seq=%llu", |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 814 | __entry->bytenr, |
| 815 | __entry->num_bytes, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 816 | show_ref_action(__entry->action), |
| 817 | show_root_type(__entry->parent), |
| 818 | show_root_type(__entry->ref_root), |
Liu Bo | dea7d76 | 2012-09-07 20:01:27 -0600 | [diff] [blame] | 819 | __entry->level, show_ref_type(__entry->type), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 820 | __entry->seq) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 821 | ); |
| 822 | |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 823 | DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, |
| 824 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 825 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 826 | const struct btrfs_delayed_ref_node *ref, |
| 827 | const struct btrfs_delayed_tree_ref *full_ref, |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 828 | int action), |
| 829 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 830 | TP_ARGS(fs_info, ref, full_ref, action) |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 831 | ); |
| 832 | |
| 833 | DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, |
| 834 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 835 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 836 | const struct btrfs_delayed_ref_node *ref, |
| 837 | const struct btrfs_delayed_tree_ref *full_ref, |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 838 | int action), |
| 839 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 840 | TP_ARGS(fs_info, ref, full_ref, action) |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 841 | ); |
| 842 | |
| 843 | DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 844 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 845 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 846 | const struct btrfs_delayed_ref_node *ref, |
| 847 | const struct btrfs_delayed_data_ref *full_ref, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 848 | int action), |
| 849 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 850 | TP_ARGS(fs_info, ref, full_ref, action), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 851 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 852 | TP_STRUCT__entry_btrfs( |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 853 | __field( u64, bytenr ) |
| 854 | __field( u64, num_bytes ) |
| 855 | __field( int, action ) |
| 856 | __field( u64, parent ) |
| 857 | __field( u64, ref_root ) |
| 858 | __field( u64, owner ) |
| 859 | __field( u64, offset ) |
| 860 | __field( int, type ) |
Liu Bo | dea7d76 | 2012-09-07 20:01:27 -0600 | [diff] [blame] | 861 | __field( u64, seq ) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 862 | ), |
| 863 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 864 | TP_fast_assign_btrfs(fs_info, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 865 | __entry->bytenr = ref->bytenr; |
| 866 | __entry->num_bytes = ref->num_bytes; |
| 867 | __entry->action = action; |
| 868 | __entry->parent = full_ref->parent; |
| 869 | __entry->ref_root = full_ref->root; |
| 870 | __entry->owner = full_ref->objectid; |
| 871 | __entry->offset = full_ref->offset; |
| 872 | __entry->type = ref->type; |
Liu Bo | dea7d76 | 2012-09-07 20:01:27 -0600 | [diff] [blame] | 873 | __entry->seq = ref->seq; |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 874 | ), |
| 875 | |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 876 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " |
| 877 | "parent=%llu(%s) ref_root=%llu(%s) owner=%llu " |
| 878 | "offset=%llu type=%s seq=%llu", |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 879 | __entry->bytenr, |
| 880 | __entry->num_bytes, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 881 | show_ref_action(__entry->action), |
| 882 | show_root_type(__entry->parent), |
| 883 | show_root_type(__entry->ref_root), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 884 | __entry->owner, |
| 885 | __entry->offset, |
Liu Bo | dea7d76 | 2012-09-07 20:01:27 -0600 | [diff] [blame] | 886 | show_ref_type(__entry->type), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 887 | __entry->seq) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 888 | ); |
| 889 | |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 890 | DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, |
| 891 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 892 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 893 | const struct btrfs_delayed_ref_node *ref, |
| 894 | const struct btrfs_delayed_data_ref *full_ref, |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 895 | int action), |
| 896 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 897 | TP_ARGS(fs_info, ref, full_ref, action) |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 898 | ); |
| 899 | |
| 900 | DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, |
| 901 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 902 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 903 | const struct btrfs_delayed_ref_node *ref, |
| 904 | const struct btrfs_delayed_data_ref *full_ref, |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 905 | int action), |
| 906 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 907 | TP_ARGS(fs_info, ref, full_ref, action) |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 908 | ); |
| 909 | |
| 910 | DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 911 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 912 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 913 | const struct btrfs_delayed_ref_head *head_ref, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 914 | int action), |
| 915 | |
Josef Bacik | d278850 | 2017-09-29 15:43:57 -0400 | [diff] [blame] | 916 | TP_ARGS(fs_info, head_ref, action), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 917 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 918 | TP_STRUCT__entry_btrfs( |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 919 | __field( u64, bytenr ) |
| 920 | __field( u64, num_bytes ) |
| 921 | __field( int, action ) |
| 922 | __field( int, is_data ) |
| 923 | ), |
| 924 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 925 | TP_fast_assign_btrfs(fs_info, |
Josef Bacik | d278850 | 2017-09-29 15:43:57 -0400 | [diff] [blame] | 926 | __entry->bytenr = head_ref->bytenr; |
| 927 | __entry->num_bytes = head_ref->num_bytes; |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 928 | __entry->action = action; |
| 929 | __entry->is_data = head_ref->is_data; |
| 930 | ), |
| 931 | |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 932 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d", |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 933 | __entry->bytenr, |
| 934 | __entry->num_bytes, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 935 | show_ref_action(__entry->action), |
| 936 | __entry->is_data) |
| 937 | ); |
| 938 | |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 939 | DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, |
| 940 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 941 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 942 | const struct btrfs_delayed_ref_head *head_ref, |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 943 | int action), |
| 944 | |
Josef Bacik | d278850 | 2017-09-29 15:43:57 -0400 | [diff] [blame] | 945 | TP_ARGS(fs_info, head_ref, action) |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 946 | ); |
| 947 | |
| 948 | DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, |
| 949 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 950 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 951 | const struct btrfs_delayed_ref_head *head_ref, |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 952 | int action), |
| 953 | |
Josef Bacik | d278850 | 2017-09-29 15:43:57 -0400 | [diff] [blame] | 954 | TP_ARGS(fs_info, head_ref, action) |
Liu Bo | 599c75e | 2013-07-16 19:03:36 +0800 | [diff] [blame] | 955 | ); |
| 956 | |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 957 | #define show_chunk_type(type) \ |
| 958 | __print_flags(type, "|", \ |
| 959 | { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ |
| 960 | { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ |
| 961 | { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ |
| 962 | { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ |
| 963 | { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ |
| 964 | { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ |
Liu Bo | e112e2b | 2013-05-26 13:50:28 +0000 | [diff] [blame] | 965 | { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ |
| 966 | { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ |
| 967 | { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 968 | |
| 969 | DECLARE_EVENT_CLASS(btrfs__chunk, |
| 970 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 971 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 972 | const struct map_lookup *map, u64 offset, u64 size), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 973 | |
Jeff Mahoney | 6bccf3a | 2016-06-21 21:16:51 -0400 | [diff] [blame] | 974 | TP_ARGS(fs_info, map, offset, size), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 975 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 976 | TP_STRUCT__entry_btrfs( |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 977 | __field( int, num_stripes ) |
| 978 | __field( u64, type ) |
| 979 | __field( int, sub_stripes ) |
| 980 | __field( u64, offset ) |
| 981 | __field( u64, size ) |
| 982 | __field( u64, root_objectid ) |
| 983 | ), |
| 984 | |
Jeff Mahoney | 6bccf3a | 2016-06-21 21:16:51 -0400 | [diff] [blame] | 985 | TP_fast_assign_btrfs(fs_info, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 986 | __entry->num_stripes = map->num_stripes; |
| 987 | __entry->type = map->type; |
| 988 | __entry->sub_stripes = map->sub_stripes; |
| 989 | __entry->offset = offset; |
| 990 | __entry->size = size; |
Jeff Mahoney | 6bccf3a | 2016-06-21 21:16:51 -0400 | [diff] [blame] | 991 | __entry->root_objectid = fs_info->chunk_root->root_key.objectid; |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 992 | ), |
| 993 | |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 994 | TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu " |
| 995 | "num_stripes=%d sub_stripes=%d type=%s", |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 996 | show_root_type(__entry->root_objectid), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 997 | __entry->offset, |
| 998 | __entry->size, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 999 | __entry->num_stripes, __entry->sub_stripes, |
| 1000 | show_chunk_type(__entry->type)) |
| 1001 | ); |
| 1002 | |
| 1003 | DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, |
| 1004 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1005 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1006 | const struct map_lookup *map, u64 offset, u64 size), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1007 | |
Jeff Mahoney | 6bccf3a | 2016-06-21 21:16:51 -0400 | [diff] [blame] | 1008 | TP_ARGS(fs_info, map, offset, size) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1009 | ); |
| 1010 | |
| 1011 | DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, |
| 1012 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1013 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1014 | const struct map_lookup *map, u64 offset, u64 size), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1015 | |
Jeff Mahoney | 6bccf3a | 2016-06-21 21:16:51 -0400 | [diff] [blame] | 1016 | TP_ARGS(fs_info, map, offset, size) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1017 | ); |
| 1018 | |
| 1019 | TRACE_EVENT(btrfs_cow_block, |
| 1020 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1021 | TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf, |
| 1022 | const struct extent_buffer *cow), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1023 | |
| 1024 | TP_ARGS(root, buf, cow), |
| 1025 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1026 | TP_STRUCT__entry_btrfs( |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1027 | __field( u64, root_objectid ) |
| 1028 | __field( u64, buf_start ) |
| 1029 | __field( int, refs ) |
| 1030 | __field( u64, cow_start ) |
| 1031 | __field( int, buf_level ) |
| 1032 | __field( int, cow_level ) |
| 1033 | ), |
| 1034 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1035 | TP_fast_assign_btrfs(root->fs_info, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1036 | __entry->root_objectid = root->root_key.objectid; |
| 1037 | __entry->buf_start = buf->start; |
| 1038 | __entry->refs = atomic_read(&buf->refs); |
| 1039 | __entry->cow_start = cow->start; |
| 1040 | __entry->buf_level = btrfs_header_level(buf); |
| 1041 | __entry->cow_level = btrfs_header_level(cow); |
| 1042 | ), |
| 1043 | |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 1044 | TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu " |
| 1045 | "(orig_level=%d) cow_buf=%llu (cow_level=%d)", |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1046 | show_root_type(__entry->root_objectid), |
| 1047 | __entry->refs, |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 1048 | __entry->buf_start, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1049 | __entry->buf_level, |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 1050 | __entry->cow_start, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1051 | __entry->cow_level) |
| 1052 | ); |
| 1053 | |
Josef Bacik | 8c2a3ca | 2012-01-10 10:31:31 -0500 | [diff] [blame] | 1054 | TRACE_EVENT(btrfs_space_reservation, |
| 1055 | |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 1056 | TP_PROTO(const struct btrfs_fs_info *fs_info, const char *type, u64 val, |
Josef Bacik | 8c2a3ca | 2012-01-10 10:31:31 -0500 | [diff] [blame] | 1057 | u64 bytes, int reserve), |
| 1058 | |
| 1059 | TP_ARGS(fs_info, type, val, bytes, reserve), |
| 1060 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1061 | TP_STRUCT__entry_btrfs( |
Josef Bacik | 8c2a3ca | 2012-01-10 10:31:31 -0500 | [diff] [blame] | 1062 | __string( type, type ) |
| 1063 | __field( u64, val ) |
| 1064 | __field( u64, bytes ) |
| 1065 | __field( int, reserve ) |
| 1066 | ), |
| 1067 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1068 | TP_fast_assign_btrfs(fs_info, |
Josef Bacik | 8c2a3ca | 2012-01-10 10:31:31 -0500 | [diff] [blame] | 1069 | __assign_str(type, type); |
| 1070 | __entry->val = val; |
| 1071 | __entry->bytes = bytes; |
| 1072 | __entry->reserve = reserve; |
| 1073 | ), |
| 1074 | |
David Sterba | 5439c7f | 2018-04-03 21:05:37 +0200 | [diff] [blame] | 1075 | TP_printk_btrfs("%s: %llu %s %llu", __get_str(type), __entry->val, |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1076 | __entry->reserve ? "reserve" : "release", |
| 1077 | __entry->bytes) |
Josef Bacik | 8c2a3ca | 2012-01-10 10:31:31 -0500 | [diff] [blame] | 1078 | ); |
| 1079 | |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1080 | TRACE_EVENT(btrfs_trigger_flush, |
| 1081 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1082 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 1083 | int flush, const char *reason), |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1084 | |
| 1085 | TP_ARGS(fs_info, flags, bytes, flush, reason), |
| 1086 | |
David Sterba | 2e63e62 | 2018-04-03 21:34:06 +0200 | [diff] [blame] | 1087 | TP_STRUCT__entry_btrfs( |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1088 | __field( u64, flags ) |
| 1089 | __field( u64, bytes ) |
| 1090 | __field( int, flush ) |
| 1091 | __string( reason, reason ) |
| 1092 | ), |
| 1093 | |
David Sterba | 2e63e62 | 2018-04-03 21:34:06 +0200 | [diff] [blame] | 1094 | TP_fast_assign_btrfs(fs_info, |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1095 | __entry->flags = flags; |
| 1096 | __entry->bytes = bytes; |
| 1097 | __entry->flush = flush; |
| 1098 | __assign_str(reason, reason) |
| 1099 | ), |
| 1100 | |
David Sterba | 2e63e62 | 2018-04-03 21:34:06 +0200 | [diff] [blame] | 1101 | TP_printk_btrfs("%s: flush=%d(%s) flags=%llu(%s) bytes=%llu", |
| 1102 | __get_str(reason), __entry->flush, |
Nikolay Borisov | 45e3186 | 2020-06-19 15:24:46 +0300 | [diff] [blame] | 1103 | __print_symbolic(__entry->flush, FLUSH_ACTIONS), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 1104 | __entry->flags, |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1105 | __print_flags((unsigned long)__entry->flags, "|", |
| 1106 | BTRFS_GROUP_FLAGS), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 1107 | __entry->bytes) |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1108 | ); |
| 1109 | |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1110 | |
| 1111 | TRACE_EVENT(btrfs_flush_space, |
| 1112 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1113 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes, |
Nikolay Borisov | 7bdd627 | 2017-07-11 13:25:13 +0300 | [diff] [blame] | 1114 | int state, int ret), |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1115 | |
Nikolay Borisov | 7bdd627 | 2017-07-11 13:25:13 +0300 | [diff] [blame] | 1116 | TP_ARGS(fs_info, flags, num_bytes, state, ret), |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1117 | |
David Sterba | 2e63e62 | 2018-04-03 21:34:06 +0200 | [diff] [blame] | 1118 | TP_STRUCT__entry_btrfs( |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1119 | __field( u64, flags ) |
| 1120 | __field( u64, num_bytes ) |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1121 | __field( int, state ) |
| 1122 | __field( int, ret ) |
| 1123 | ), |
| 1124 | |
David Sterba | 2e63e62 | 2018-04-03 21:34:06 +0200 | [diff] [blame] | 1125 | TP_fast_assign_btrfs(fs_info, |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1126 | __entry->flags = flags; |
| 1127 | __entry->num_bytes = num_bytes; |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1128 | __entry->state = state; |
| 1129 | __entry->ret = ret; |
| 1130 | ), |
| 1131 | |
David Sterba | 2e63e62 | 2018-04-03 21:34:06 +0200 | [diff] [blame] | 1132 | TP_printk_btrfs("state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d", |
| 1133 | __entry->state, |
Nikolay Borisov | f0cdd15 | 2020-06-19 15:24:51 +0300 | [diff] [blame] | 1134 | __print_symbolic(__entry->state, FLUSH_STATES), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 1135 | __entry->flags, |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1136 | __print_flags((unsigned long)__entry->flags, "|", |
| 1137 | BTRFS_GROUP_FLAGS), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 1138 | __entry->num_bytes, __entry->ret) |
Josef Bacik | f376df2 | 2016-03-25 13:25:56 -0400 | [diff] [blame] | 1139 | ); |
| 1140 | |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1141 | DECLARE_EVENT_CLASS(btrfs__reserved_extent, |
| 1142 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1143 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1144 | |
Jeff Mahoney | 71ff643 | 2016-09-06 16:00:42 -0400 | [diff] [blame] | 1145 | TP_ARGS(fs_info, start, len), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1146 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1147 | TP_STRUCT__entry_btrfs( |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1148 | __field( u64, start ) |
| 1149 | __field( u64, len ) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1150 | ), |
| 1151 | |
Jeff Mahoney | 71ff643 | 2016-09-06 16:00:42 -0400 | [diff] [blame] | 1152 | TP_fast_assign_btrfs(fs_info, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1153 | __entry->start = start; |
| 1154 | __entry->len = len; |
| 1155 | ), |
| 1156 | |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 1157 | TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu", |
Jeff Mahoney | 71ff643 | 2016-09-06 16:00:42 -0400 | [diff] [blame] | 1158 | show_root_type(BTRFS_EXTENT_TREE_OBJECTID), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 1159 | __entry->start, |
| 1160 | __entry->len) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1161 | ); |
| 1162 | |
| 1163 | DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, |
| 1164 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1165 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1166 | |
Jeff Mahoney | 71ff643 | 2016-09-06 16:00:42 -0400 | [diff] [blame] | 1167 | TP_ARGS(fs_info, start, len) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1168 | ); |
| 1169 | |
| 1170 | DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, |
| 1171 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1172 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1173 | |
Jeff Mahoney | 71ff643 | 2016-09-06 16:00:42 -0400 | [diff] [blame] | 1174 | TP_ARGS(fs_info, start, len) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1175 | ); |
| 1176 | |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1177 | TRACE_EVENT(find_free_extent, |
| 1178 | |
Qu Wenruo | 437490f | 2020-07-28 09:42:49 +0800 | [diff] [blame] | 1179 | TP_PROTO(const struct btrfs_root *root, u64 num_bytes, |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1180 | u64 empty_size, u64 data), |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1181 | |
Qu Wenruo | 437490f | 2020-07-28 09:42:49 +0800 | [diff] [blame] | 1182 | TP_ARGS(root, num_bytes, empty_size, data), |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1183 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1184 | TP_STRUCT__entry_btrfs( |
Qu Wenruo | 437490f | 2020-07-28 09:42:49 +0800 | [diff] [blame] | 1185 | __field( u64, root_objectid ) |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1186 | __field( u64, num_bytes ) |
| 1187 | __field( u64, empty_size ) |
| 1188 | __field( u64, data ) |
| 1189 | ), |
| 1190 | |
Qu Wenruo | 437490f | 2020-07-28 09:42:49 +0800 | [diff] [blame] | 1191 | TP_fast_assign_btrfs(root->fs_info, |
| 1192 | __entry->root_objectid = root->root_key.objectid; |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1193 | __entry->num_bytes = num_bytes; |
| 1194 | __entry->empty_size = empty_size; |
| 1195 | __entry->data = data; |
| 1196 | ), |
| 1197 | |
David Sterba | 5439c7f | 2018-04-03 21:05:37 +0200 | [diff] [blame] | 1198 | TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s)", |
Qu Wenruo | 437490f | 2020-07-28 09:42:49 +0800 | [diff] [blame] | 1199 | show_root_type(__entry->root_objectid), |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1200 | __entry->num_bytes, __entry->empty_size, __entry->data, |
| 1201 | __print_flags((unsigned long)__entry->data, "|", |
| 1202 | BTRFS_GROUP_FLAGS)) |
| 1203 | ); |
| 1204 | |
| 1205 | DECLARE_EVENT_CLASS(btrfs__reserve_extent, |
| 1206 | |
David Sterba | 32da5386 | 2019-10-29 19:20:18 +0100 | [diff] [blame] | 1207 | TP_PROTO(const struct btrfs_block_group *block_group, u64 start, |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1208 | u64 len), |
| 1209 | |
Qu Wenruo | 3dca5c9 | 2018-04-26 14:24:25 +0800 | [diff] [blame] | 1210 | TP_ARGS(block_group, start, len), |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1211 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1212 | TP_STRUCT__entry_btrfs( |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1213 | __field( u64, bg_objectid ) |
| 1214 | __field( u64, flags ) |
| 1215 | __field( u64, start ) |
| 1216 | __field( u64, len ) |
| 1217 | ), |
| 1218 | |
Qu Wenruo | 3dca5c9 | 2018-04-26 14:24:25 +0800 | [diff] [blame] | 1219 | TP_fast_assign_btrfs(block_group->fs_info, |
David Sterba | b3470b5 | 2019-10-23 18:48:22 +0200 | [diff] [blame] | 1220 | __entry->bg_objectid = block_group->start; |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1221 | __entry->flags = block_group->flags; |
| 1222 | __entry->start = start; |
| 1223 | __entry->len = len; |
| 1224 | ), |
| 1225 | |
David Sterba | 5439c7f | 2018-04-03 21:05:37 +0200 | [diff] [blame] | 1226 | TP_printk_btrfs("root=%llu(%s) block_group=%llu flags=%llu(%s) " |
| 1227 | "start=%llu len=%llu", |
Jeff Mahoney | 71ff643 | 2016-09-06 16:00:42 -0400 | [diff] [blame] | 1228 | show_root_type(BTRFS_EXTENT_TREE_OBJECTID), |
| 1229 | __entry->bg_objectid, |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1230 | __entry->flags, __print_flags((unsigned long)__entry->flags, |
| 1231 | "|", BTRFS_GROUP_FLAGS), |
| 1232 | __entry->start, __entry->len) |
| 1233 | ); |
| 1234 | |
| 1235 | DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, |
| 1236 | |
David Sterba | 32da5386 | 2019-10-29 19:20:18 +0100 | [diff] [blame] | 1237 | TP_PROTO(const struct btrfs_block_group *block_group, u64 start, |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1238 | u64 len), |
| 1239 | |
Qu Wenruo | 3dca5c9 | 2018-04-26 14:24:25 +0800 | [diff] [blame] | 1240 | TP_ARGS(block_group, start, len) |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1241 | ); |
| 1242 | |
| 1243 | DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, |
| 1244 | |
David Sterba | 32da5386 | 2019-10-29 19:20:18 +0100 | [diff] [blame] | 1245 | TP_PROTO(const struct btrfs_block_group *block_group, u64 start, |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1246 | u64 len), |
| 1247 | |
Qu Wenruo | 3dca5c9 | 2018-04-26 14:24:25 +0800 | [diff] [blame] | 1248 | TP_ARGS(block_group, start, len) |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1249 | ); |
| 1250 | |
| 1251 | TRACE_EVENT(btrfs_find_cluster, |
| 1252 | |
David Sterba | 32da5386 | 2019-10-29 19:20:18 +0100 | [diff] [blame] | 1253 | TP_PROTO(const struct btrfs_block_group *block_group, u64 start, |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1254 | u64 bytes, u64 empty_size, u64 min_bytes), |
| 1255 | |
| 1256 | TP_ARGS(block_group, start, bytes, empty_size, min_bytes), |
| 1257 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1258 | TP_STRUCT__entry_btrfs( |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1259 | __field( u64, bg_objectid ) |
| 1260 | __field( u64, flags ) |
| 1261 | __field( u64, start ) |
| 1262 | __field( u64, bytes ) |
| 1263 | __field( u64, empty_size ) |
| 1264 | __field( u64, min_bytes ) |
| 1265 | ), |
| 1266 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1267 | TP_fast_assign_btrfs(block_group->fs_info, |
David Sterba | b3470b5 | 2019-10-23 18:48:22 +0200 | [diff] [blame] | 1268 | __entry->bg_objectid = block_group->start; |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1269 | __entry->flags = block_group->flags; |
| 1270 | __entry->start = start; |
| 1271 | __entry->bytes = bytes; |
| 1272 | __entry->empty_size = empty_size; |
| 1273 | __entry->min_bytes = min_bytes; |
| 1274 | ), |
| 1275 | |
David Sterba | 5439c7f | 2018-04-03 21:05:37 +0200 | [diff] [blame] | 1276 | TP_printk_btrfs("block_group=%llu flags=%llu(%s) start=%llu len=%llu " |
| 1277 | "empty_size=%llu min_bytes=%llu", __entry->bg_objectid, |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1278 | __entry->flags, |
| 1279 | __print_flags((unsigned long)__entry->flags, "|", |
| 1280 | BTRFS_GROUP_FLAGS), __entry->start, |
| 1281 | __entry->bytes, __entry->empty_size, __entry->min_bytes) |
| 1282 | ); |
| 1283 | |
| 1284 | TRACE_EVENT(btrfs_failed_cluster_setup, |
| 1285 | |
David Sterba | 32da5386 | 2019-10-29 19:20:18 +0100 | [diff] [blame] | 1286 | TP_PROTO(const struct btrfs_block_group *block_group), |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1287 | |
| 1288 | TP_ARGS(block_group), |
| 1289 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1290 | TP_STRUCT__entry_btrfs( |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1291 | __field( u64, bg_objectid ) |
| 1292 | ), |
| 1293 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1294 | TP_fast_assign_btrfs(block_group->fs_info, |
David Sterba | b3470b5 | 2019-10-23 18:48:22 +0200 | [diff] [blame] | 1295 | __entry->bg_objectid = block_group->start; |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1296 | ), |
| 1297 | |
David Sterba | 5439c7f | 2018-04-03 21:05:37 +0200 | [diff] [blame] | 1298 | TP_printk_btrfs("block_group=%llu", __entry->bg_objectid) |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1299 | ); |
| 1300 | |
| 1301 | TRACE_EVENT(btrfs_setup_cluster, |
| 1302 | |
David Sterba | 32da5386 | 2019-10-29 19:20:18 +0100 | [diff] [blame] | 1303 | TP_PROTO(const struct btrfs_block_group *block_group, |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1304 | const struct btrfs_free_cluster *cluster, |
| 1305 | u64 size, int bitmap), |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1306 | |
| 1307 | TP_ARGS(block_group, cluster, size, bitmap), |
| 1308 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1309 | TP_STRUCT__entry_btrfs( |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1310 | __field( u64, bg_objectid ) |
| 1311 | __field( u64, flags ) |
| 1312 | __field( u64, start ) |
| 1313 | __field( u64, max_size ) |
| 1314 | __field( u64, size ) |
| 1315 | __field( int, bitmap ) |
| 1316 | ), |
| 1317 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1318 | TP_fast_assign_btrfs(block_group->fs_info, |
David Sterba | b3470b5 | 2019-10-23 18:48:22 +0200 | [diff] [blame] | 1319 | __entry->bg_objectid = block_group->start; |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1320 | __entry->flags = block_group->flags; |
| 1321 | __entry->start = cluster->window_start; |
| 1322 | __entry->max_size = cluster->max_size; |
| 1323 | __entry->size = size; |
| 1324 | __entry->bitmap = bitmap; |
| 1325 | ), |
| 1326 | |
David Sterba | 5439c7f | 2018-04-03 21:05:37 +0200 | [diff] [blame] | 1327 | TP_printk_btrfs("block_group=%llu flags=%llu(%s) window_start=%llu " |
| 1328 | "size=%llu max_size=%llu bitmap=%d", |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame] | 1329 | __entry->bg_objectid, |
| 1330 | __entry->flags, |
| 1331 | __print_flags((unsigned long)__entry->flags, "|", |
| 1332 | BTRFS_GROUP_FLAGS), __entry->start, |
| 1333 | __entry->size, __entry->max_size, __entry->bitmap) |
| 1334 | ); |
| 1335 | |
Jeff Mahoney | 143bede | 2012-03-01 14:56:26 +0100 | [diff] [blame] | 1336 | struct extent_state; |
| 1337 | TRACE_EVENT(alloc_extent_state, |
| 1338 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1339 | TP_PROTO(const struct extent_state *state, |
| 1340 | gfp_t mask, unsigned long IP), |
Jeff Mahoney | 143bede | 2012-03-01 14:56:26 +0100 | [diff] [blame] | 1341 | |
| 1342 | TP_ARGS(state, mask, IP), |
| 1343 | |
| 1344 | TP_STRUCT__entry( |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1345 | __field(const struct extent_state *, state) |
Jeff Mahoney | 143bede | 2012-03-01 14:56:26 +0100 | [diff] [blame] | 1346 | __field(gfp_t, mask) |
David Sterba | 94c3f6c | 2019-10-17 13:28:55 +0200 | [diff] [blame] | 1347 | __field(const void*, ip) |
Jeff Mahoney | 143bede | 2012-03-01 14:56:26 +0100 | [diff] [blame] | 1348 | ), |
| 1349 | |
| 1350 | TP_fast_assign( |
| 1351 | __entry->state = state, |
| 1352 | __entry->mask = mask, |
David Sterba | 94c3f6c | 2019-10-17 13:28:55 +0200 | [diff] [blame] | 1353 | __entry->ip = (const void *)IP |
Jeff Mahoney | 143bede | 2012-03-01 14:56:26 +0100 | [diff] [blame] | 1354 | ), |
| 1355 | |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 1356 | TP_printk("state=%p mask=%s caller=%pS", __entry->state, |
David Sterba | 94c3f6c | 2019-10-17 13:28:55 +0200 | [diff] [blame] | 1357 | show_gfp_flags(__entry->mask), __entry->ip) |
Jeff Mahoney | 143bede | 2012-03-01 14:56:26 +0100 | [diff] [blame] | 1358 | ); |
| 1359 | |
| 1360 | TRACE_EVENT(free_extent_state, |
| 1361 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1362 | TP_PROTO(const struct extent_state *state, unsigned long IP), |
Jeff Mahoney | 143bede | 2012-03-01 14:56:26 +0100 | [diff] [blame] | 1363 | |
| 1364 | TP_ARGS(state, IP), |
| 1365 | |
| 1366 | TP_STRUCT__entry( |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1367 | __field(const struct extent_state *, state) |
David Sterba | 94c3f6c | 2019-10-17 13:28:55 +0200 | [diff] [blame] | 1368 | __field(const void*, ip) |
Jeff Mahoney | 143bede | 2012-03-01 14:56:26 +0100 | [diff] [blame] | 1369 | ), |
| 1370 | |
| 1371 | TP_fast_assign( |
| 1372 | __entry->state = state, |
David Sterba | 94c3f6c | 2019-10-17 13:28:55 +0200 | [diff] [blame] | 1373 | __entry->ip = (const void *)IP |
Jeff Mahoney | 143bede | 2012-03-01 14:56:26 +0100 | [diff] [blame] | 1374 | ), |
| 1375 | |
David Sterba | 94c3f6c | 2019-10-17 13:28:55 +0200 | [diff] [blame] | 1376 | TP_printk("state=%p caller=%pS", __entry->state, __entry->ip) |
Jeff Mahoney | 143bede | 2012-03-01 14:56:26 +0100 | [diff] [blame] | 1377 | ); |
| 1378 | |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1379 | DECLARE_EVENT_CLASS(btrfs__work, |
| 1380 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1381 | TP_PROTO(const struct btrfs_work *work), |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1382 | |
| 1383 | TP_ARGS(work), |
| 1384 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1385 | TP_STRUCT__entry_btrfs( |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1386 | __field( const void *, work ) |
| 1387 | __field( const void *, wq ) |
| 1388 | __field( const void *, func ) |
| 1389 | __field( const void *, ordered_func ) |
| 1390 | __field( const void *, ordered_free ) |
| 1391 | __field( const void *, normal_work ) |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1392 | ), |
| 1393 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1394 | TP_fast_assign_btrfs(btrfs_work_owner(work), |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1395 | __entry->work = work; |
| 1396 | __entry->wq = work->wq; |
| 1397 | __entry->func = work->func; |
| 1398 | __entry->ordered_func = work->ordered_func; |
| 1399 | __entry->ordered_free = work->ordered_free; |
Liu Bo | b38a625 | 2014-08-12 16:33:17 +0800 | [diff] [blame] | 1400 | __entry->normal_work = &work->normal_work; |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1401 | ), |
| 1402 | |
Sakari Ailus | d75f773 | 2019-03-25 21:32:28 +0200 | [diff] [blame] | 1403 | TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%ps ordered_func=%p " |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 1404 | "ordered_free=%p", |
Liu Bo | b38a625 | 2014-08-12 16:33:17 +0800 | [diff] [blame] | 1405 | __entry->work, __entry->normal_work, __entry->wq, |
| 1406 | __entry->func, __entry->ordered_func, __entry->ordered_free) |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1407 | ); |
| 1408 | |
David Sterba | ac0c7cf | 2017-01-06 14:12:51 +0100 | [diff] [blame] | 1409 | /* |
Omar Sandoval | c9eb55d | 2019-09-16 11:30:58 -0700 | [diff] [blame] | 1410 | * For situations when the work is freed, we pass fs_info and a tag that matches |
| 1411 | * the address of the work structure so it can be paired with the scheduling |
| 1412 | * event. DO NOT add anything here that dereferences wtag. |
David Sterba | ac0c7cf | 2017-01-06 14:12:51 +0100 | [diff] [blame] | 1413 | */ |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1414 | DECLARE_EVENT_CLASS(btrfs__work__done, |
| 1415 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1416 | TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1417 | |
David Sterba | ac0c7cf | 2017-01-06 14:12:51 +0100 | [diff] [blame] | 1418 | TP_ARGS(fs_info, wtag), |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1419 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1420 | TP_STRUCT__entry_btrfs( |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1421 | __field( const void *, wtag ) |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1422 | ), |
| 1423 | |
David Sterba | ac0c7cf | 2017-01-06 14:12:51 +0100 | [diff] [blame] | 1424 | TP_fast_assign_btrfs(fs_info, |
| 1425 | __entry->wtag = wtag; |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1426 | ), |
| 1427 | |
David Sterba | ac0c7cf | 2017-01-06 14:12:51 +0100 | [diff] [blame] | 1428 | TP_printk_btrfs("work->%p", __entry->wtag) |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1429 | ); |
| 1430 | |
| 1431 | DEFINE_EVENT(btrfs__work, btrfs_work_queued, |
| 1432 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1433 | TP_PROTO(const struct btrfs_work *work), |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1434 | |
| 1435 | TP_ARGS(work) |
| 1436 | ); |
| 1437 | |
| 1438 | DEFINE_EVENT(btrfs__work, btrfs_work_sched, |
| 1439 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1440 | TP_PROTO(const struct btrfs_work *work), |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1441 | |
| 1442 | TP_ARGS(work) |
| 1443 | ); |
| 1444 | |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1445 | DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, |
| 1446 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1447 | TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1448 | |
David Sterba | ac0c7cf | 2017-01-06 14:12:51 +0100 | [diff] [blame] | 1449 | TP_ARGS(fs_info, wtag) |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1450 | ); |
| 1451 | |
| 1452 | DEFINE_EVENT(btrfs__work, btrfs_ordered_sched, |
| 1453 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1454 | TP_PROTO(const struct btrfs_work *work), |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1455 | |
| 1456 | TP_ARGS(work) |
| 1457 | ); |
| 1458 | |
Qu Wenruo | c3a4689 | 2014-03-12 08:05:33 +0000 | [diff] [blame] | 1459 | DECLARE_EVENT_CLASS(btrfs__workqueue, |
| 1460 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1461 | TP_PROTO(const struct __btrfs_workqueue *wq, |
| 1462 | const char *name, int high), |
Qu Wenruo | c3a4689 | 2014-03-12 08:05:33 +0000 | [diff] [blame] | 1463 | |
| 1464 | TP_ARGS(wq, name, high), |
| 1465 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1466 | TP_STRUCT__entry_btrfs( |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1467 | __field( const void *, wq ) |
Qu Wenruo | c3a4689 | 2014-03-12 08:05:33 +0000 | [diff] [blame] | 1468 | __string( name, name ) |
| 1469 | __field( int , high ) |
| 1470 | ), |
| 1471 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1472 | TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), |
Qu Wenruo | c3a4689 | 2014-03-12 08:05:33 +0000 | [diff] [blame] | 1473 | __entry->wq = wq; |
| 1474 | __assign_str(name, name); |
| 1475 | __entry->high = high; |
| 1476 | ), |
| 1477 | |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 1478 | TP_printk_btrfs("name=%s%s wq=%p", __get_str(name), |
Qu Wenruo | c3a4689 | 2014-03-12 08:05:33 +0000 | [diff] [blame] | 1479 | __print_flags(__entry->high, "", |
| 1480 | {(WQ_HIGHPRI), "-high"}), |
| 1481 | __entry->wq) |
| 1482 | ); |
| 1483 | |
| 1484 | DEFINE_EVENT(btrfs__workqueue, btrfs_workqueue_alloc, |
| 1485 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1486 | TP_PROTO(const struct __btrfs_workqueue *wq, |
| 1487 | const char *name, int high), |
Qu Wenruo | c3a4689 | 2014-03-12 08:05:33 +0000 | [diff] [blame] | 1488 | |
| 1489 | TP_ARGS(wq, name, high) |
| 1490 | ); |
| 1491 | |
| 1492 | DECLARE_EVENT_CLASS(btrfs__workqueue_done, |
| 1493 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1494 | TP_PROTO(const struct __btrfs_workqueue *wq), |
Qu Wenruo | c3a4689 | 2014-03-12 08:05:33 +0000 | [diff] [blame] | 1495 | |
| 1496 | TP_ARGS(wq), |
| 1497 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1498 | TP_STRUCT__entry_btrfs( |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1499 | __field( const void *, wq ) |
Qu Wenruo | c3a4689 | 2014-03-12 08:05:33 +0000 | [diff] [blame] | 1500 | ), |
| 1501 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1502 | TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), |
Qu Wenruo | c3a4689 | 2014-03-12 08:05:33 +0000 | [diff] [blame] | 1503 | __entry->wq = wq; |
| 1504 | ), |
| 1505 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1506 | TP_printk_btrfs("wq=%p", __entry->wq) |
Qu Wenruo | c3a4689 | 2014-03-12 08:05:33 +0000 | [diff] [blame] | 1507 | ); |
| 1508 | |
| 1509 | DEFINE_EVENT(btrfs__workqueue_done, btrfs_workqueue_destroy, |
| 1510 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1511 | TP_PROTO(const struct __btrfs_workqueue *wq), |
Qu Wenruo | c3a4689 | 2014-03-12 08:05:33 +0000 | [diff] [blame] | 1512 | |
| 1513 | TP_ARGS(wq) |
| 1514 | ); |
Qu Wenruo | 52483bc | 2014-03-06 04:19:50 +0000 | [diff] [blame] | 1515 | |
Qu Wenruo | 81fb6f7 | 2015-09-28 16:57:53 +0800 | [diff] [blame] | 1516 | #define BTRFS_QGROUP_OPERATIONS \ |
| 1517 | { QGROUP_RESERVE, "reserve" }, \ |
| 1518 | { QGROUP_RELEASE, "release" }, \ |
| 1519 | { QGROUP_FREE, "free" } |
| 1520 | |
| 1521 | DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, |
| 1522 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1523 | TP_PROTO(const struct inode *inode, u64 start, u64 len, |
| 1524 | u64 reserved, int op), |
Qu Wenruo | 81fb6f7 | 2015-09-28 16:57:53 +0800 | [diff] [blame] | 1525 | |
| 1526 | TP_ARGS(inode, start, len, reserved, op), |
| 1527 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1528 | TP_STRUCT__entry_btrfs( |
Qu Wenruo | 81fb6f7 | 2015-09-28 16:57:53 +0800 | [diff] [blame] | 1529 | __field( u64, rootid ) |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 1530 | __field( u64, ino ) |
Qu Wenruo | 81fb6f7 | 2015-09-28 16:57:53 +0800 | [diff] [blame] | 1531 | __field( u64, start ) |
| 1532 | __field( u64, len ) |
| 1533 | __field( u64, reserved ) |
| 1534 | __field( int, op ) |
| 1535 | ), |
| 1536 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1537 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
Misono Tomohiro | 4fd786e | 2018-08-06 14:25:24 +0900 | [diff] [blame] | 1538 | __entry->rootid = |
| 1539 | BTRFS_I(inode)->root->root_key.objectid; |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 1540 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
Qu Wenruo | 81fb6f7 | 2015-09-28 16:57:53 +0800 | [diff] [blame] | 1541 | __entry->start = start; |
| 1542 | __entry->len = len; |
| 1543 | __entry->reserved = reserved; |
| 1544 | __entry->op = op; |
| 1545 | ), |
| 1546 | |
David Sterba | f8f8e18 | 2018-04-03 20:57:21 +0200 | [diff] [blame] | 1547 | TP_printk_btrfs("root=%llu ino=%llu start=%llu len=%llu reserved=%llu op=%s", |
Qu Wenruo | 81fb6f7 | 2015-09-28 16:57:53 +0800 | [diff] [blame] | 1548 | __entry->rootid, __entry->ino, __entry->start, __entry->len, |
| 1549 | __entry->reserved, |
| 1550 | __print_flags((unsigned long)__entry->op, "", |
| 1551 | BTRFS_QGROUP_OPERATIONS) |
| 1552 | ) |
| 1553 | ); |
| 1554 | |
| 1555 | DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data, |
| 1556 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1557 | TP_PROTO(const struct inode *inode, u64 start, u64 len, |
| 1558 | u64 reserved, int op), |
Qu Wenruo | 81fb6f7 | 2015-09-28 16:57:53 +0800 | [diff] [blame] | 1559 | |
| 1560 | TP_ARGS(inode, start, len, reserved, op) |
| 1561 | ); |
| 1562 | |
| 1563 | DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data, |
| 1564 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1565 | TP_PROTO(const struct inode *inode, u64 start, u64 len, |
| 1566 | u64 reserved, int op), |
Qu Wenruo | 81fb6f7 | 2015-09-28 16:57:53 +0800 | [diff] [blame] | 1567 | |
| 1568 | TP_ARGS(inode, start, len, reserved, op) |
| 1569 | ); |
| 1570 | |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1571 | DECLARE_EVENT_CLASS(btrfs_qgroup_extent, |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1572 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1573 | const struct btrfs_qgroup_extent_record *rec), |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1574 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1575 | TP_ARGS(fs_info, rec), |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1576 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1577 | TP_STRUCT__entry_btrfs( |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1578 | __field( u64, bytenr ) |
| 1579 | __field( u64, num_bytes ) |
| 1580 | ), |
| 1581 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1582 | TP_fast_assign_btrfs(fs_info, |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1583 | __entry->bytenr = rec->bytenr, |
| 1584 | __entry->num_bytes = rec->num_bytes; |
| 1585 | ), |
| 1586 | |
David Sterba | 562a7a0 | 2017-01-06 15:51:36 +0100 | [diff] [blame] | 1587 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu", |
David Sterba | 94c3f6c | 2019-10-17 13:28:55 +0200 | [diff] [blame] | 1588 | __entry->bytenr, __entry->num_bytes) |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1589 | ); |
| 1590 | |
| 1591 | DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, |
| 1592 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1593 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1594 | const struct btrfs_qgroup_extent_record *rec), |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1595 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1596 | TP_ARGS(fs_info, rec) |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1597 | ); |
| 1598 | |
Qu Wenruo | 50b3e04 | 2016-10-18 09:31:27 +0800 | [diff] [blame] | 1599 | DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent, |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1600 | |
Jeff Mahoney | 9a35b63 | 2017-06-28 21:56:54 -0600 | [diff] [blame] | 1601 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1602 | const struct btrfs_qgroup_extent_record *rec), |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1603 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1604 | TP_ARGS(fs_info, rec) |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1605 | ); |
| 1606 | |
Qu Wenruo | c337e7b | 2018-09-27 14:42:29 +0800 | [diff] [blame] | 1607 | TRACE_EVENT(qgroup_num_dirty_extents, |
| 1608 | |
| 1609 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, |
| 1610 | u64 num_dirty_extents), |
| 1611 | |
| 1612 | TP_ARGS(fs_info, transid, num_dirty_extents), |
| 1613 | |
| 1614 | TP_STRUCT__entry_btrfs( |
| 1615 | __field( u64, transid ) |
| 1616 | __field( u64, num_dirty_extents ) |
| 1617 | ), |
| 1618 | |
| 1619 | TP_fast_assign_btrfs(fs_info, |
| 1620 | __entry->transid = transid; |
| 1621 | __entry->num_dirty_extents = num_dirty_extents; |
| 1622 | ), |
| 1623 | |
| 1624 | TP_printk_btrfs("transid=%llu num_dirty_extents=%llu", |
| 1625 | __entry->transid, __entry->num_dirty_extents) |
| 1626 | ); |
| 1627 | |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1628 | TRACE_EVENT(btrfs_qgroup_account_extent, |
| 1629 | |
Qu Wenruo | c9f6f3c | 2018-05-03 09:59:02 +0800 | [diff] [blame] | 1630 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, u64 bytenr, |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1631 | u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1632 | |
Qu Wenruo | c9f6f3c | 2018-05-03 09:59:02 +0800 | [diff] [blame] | 1633 | TP_ARGS(fs_info, transid, bytenr, num_bytes, nr_old_roots, |
| 1634 | nr_new_roots), |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1635 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1636 | TP_STRUCT__entry_btrfs( |
Qu Wenruo | c9f6f3c | 2018-05-03 09:59:02 +0800 | [diff] [blame] | 1637 | __field( u64, transid ) |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1638 | __field( u64, bytenr ) |
| 1639 | __field( u64, num_bytes ) |
| 1640 | __field( u64, nr_old_roots ) |
| 1641 | __field( u64, nr_new_roots ) |
| 1642 | ), |
| 1643 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1644 | TP_fast_assign_btrfs(fs_info, |
Qu Wenruo | c9f6f3c | 2018-05-03 09:59:02 +0800 | [diff] [blame] | 1645 | __entry->transid = transid; |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1646 | __entry->bytenr = bytenr; |
| 1647 | __entry->num_bytes = num_bytes; |
| 1648 | __entry->nr_old_roots = nr_old_roots; |
| 1649 | __entry->nr_new_roots = nr_new_roots; |
| 1650 | ), |
| 1651 | |
Qu Wenruo | c9f6f3c | 2018-05-03 09:59:02 +0800 | [diff] [blame] | 1652 | TP_printk_btrfs( |
| 1653 | "transid=%llu bytenr=%llu num_bytes=%llu nr_old_roots=%llu nr_new_roots=%llu", |
| 1654 | __entry->transid, |
| 1655 | __entry->bytenr, |
| 1656 | __entry->num_bytes, |
| 1657 | __entry->nr_old_roots, |
| 1658 | __entry->nr_new_roots) |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1659 | ); |
| 1660 | |
| 1661 | TRACE_EVENT(qgroup_update_counters, |
| 1662 | |
Qu Wenruo | 8b31790 | 2018-04-30 15:04:44 +0800 | [diff] [blame] | 1663 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 1664 | const struct btrfs_qgroup *qgroup, |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1665 | u64 cur_old_count, u64 cur_new_count), |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1666 | |
Qu Wenruo | 8b31790 | 2018-04-30 15:04:44 +0800 | [diff] [blame] | 1667 | TP_ARGS(fs_info, qgroup, cur_old_count, cur_new_count), |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1668 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1669 | TP_STRUCT__entry_btrfs( |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1670 | __field( u64, qgid ) |
Qu Wenruo | 8b31790 | 2018-04-30 15:04:44 +0800 | [diff] [blame] | 1671 | __field( u64, old_rfer ) |
| 1672 | __field( u64, old_excl ) |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1673 | __field( u64, cur_old_count ) |
| 1674 | __field( u64, cur_new_count ) |
| 1675 | ), |
| 1676 | |
Jeff Mahoney | bc07452 | 2016-06-09 17:27:55 -0400 | [diff] [blame] | 1677 | TP_fast_assign_btrfs(fs_info, |
Qu Wenruo | 8b31790 | 2018-04-30 15:04:44 +0800 | [diff] [blame] | 1678 | __entry->qgid = qgroup->qgroupid; |
| 1679 | __entry->old_rfer = qgroup->rfer; |
| 1680 | __entry->old_excl = qgroup->excl; |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1681 | __entry->cur_old_count = cur_old_count; |
| 1682 | __entry->cur_new_count = cur_new_count; |
| 1683 | ), |
| 1684 | |
Qu Wenruo | 8b31790 | 2018-04-30 15:04:44 +0800 | [diff] [blame] | 1685 | TP_printk_btrfs("qgid=%llu old_rfer=%llu old_excl=%llu cur_old_count=%llu cur_new_count=%llu", |
| 1686 | __entry->qgid, __entry->old_rfer, __entry->old_excl, |
| 1687 | __entry->cur_old_count, __entry->cur_new_count) |
Mark Fasheh | 0f5dcf8 | 2016-03-29 17:19:55 -0700 | [diff] [blame] | 1688 | ); |
| 1689 | |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 1690 | TRACE_EVENT(qgroup_update_reserve, |
| 1691 | |
| 1692 | TP_PROTO(struct btrfs_fs_info *fs_info, struct btrfs_qgroup *qgroup, |
Qu Wenruo | 64ee4e7 | 2017-12-12 15:34:27 +0800 | [diff] [blame] | 1693 | s64 diff, int type), |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 1694 | |
Qu Wenruo | 64ee4e7 | 2017-12-12 15:34:27 +0800 | [diff] [blame] | 1695 | TP_ARGS(fs_info, qgroup, diff, type), |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 1696 | |
| 1697 | TP_STRUCT__entry_btrfs( |
| 1698 | __field( u64, qgid ) |
| 1699 | __field( u64, cur_reserved ) |
| 1700 | __field( s64, diff ) |
Qu Wenruo | 64ee4e7 | 2017-12-12 15:34:27 +0800 | [diff] [blame] | 1701 | __field( int, type ) |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 1702 | ), |
| 1703 | |
| 1704 | TP_fast_assign_btrfs(fs_info, |
| 1705 | __entry->qgid = qgroup->qgroupid; |
Qu Wenruo | 64ee4e7 | 2017-12-12 15:34:27 +0800 | [diff] [blame] | 1706 | __entry->cur_reserved = qgroup->rsv.values[type]; |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 1707 | __entry->diff = diff; |
Qu Wenruo | 1b2442b | 2019-10-17 10:38:37 +0800 | [diff] [blame] | 1708 | __entry->type = type; |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 1709 | ), |
| 1710 | |
Qu Wenruo | 64ee4e7 | 2017-12-12 15:34:27 +0800 | [diff] [blame] | 1711 | TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld", |
Nikolay Borisov | 1cb1f0b | 2020-06-19 15:24:49 +0300 | [diff] [blame] | 1712 | __entry->qgid, __print_symbolic(__entry->type, QGROUP_RSV_TYPES), |
Qu Wenruo | 64ee4e7 | 2017-12-12 15:34:27 +0800 | [diff] [blame] | 1713 | __entry->cur_reserved, __entry->diff) |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 1714 | ); |
| 1715 | |
| 1716 | TRACE_EVENT(qgroup_meta_reserve, |
| 1717 | |
Qu Wenruo | 4ee0d88 | 2017-12-12 15:34:35 +0800 | [diff] [blame] | 1718 | TP_PROTO(struct btrfs_root *root, s64 diff, int type), |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 1719 | |
Qu Wenruo | 4ee0d88 | 2017-12-12 15:34:35 +0800 | [diff] [blame] | 1720 | TP_ARGS(root, diff, type), |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 1721 | |
| 1722 | TP_STRUCT__entry_btrfs( |
| 1723 | __field( u64, refroot ) |
| 1724 | __field( s64, diff ) |
Qu Wenruo | 4ee0d88 | 2017-12-12 15:34:35 +0800 | [diff] [blame] | 1725 | __field( int, type ) |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 1726 | ), |
| 1727 | |
| 1728 | TP_fast_assign_btrfs(root->fs_info, |
Misono Tomohiro | 4fd786e | 2018-08-06 14:25:24 +0900 | [diff] [blame] | 1729 | __entry->refroot = root->root_key.objectid; |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 1730 | __entry->diff = diff; |
Qu Wenruo | 1b2442b | 2019-10-17 10:38:37 +0800 | [diff] [blame] | 1731 | __entry->type = type; |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 1732 | ), |
| 1733 | |
Qu Wenruo | 4ee0d88 | 2017-12-12 15:34:35 +0800 | [diff] [blame] | 1734 | TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", |
| 1735 | show_root_type(__entry->refroot), |
Nikolay Borisov | 1cb1f0b | 2020-06-19 15:24:49 +0300 | [diff] [blame] | 1736 | __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) |
Qu Wenruo | 4ee0d88 | 2017-12-12 15:34:35 +0800 | [diff] [blame] | 1737 | ); |
| 1738 | |
| 1739 | TRACE_EVENT(qgroup_meta_convert, |
| 1740 | |
| 1741 | TP_PROTO(struct btrfs_root *root, s64 diff), |
| 1742 | |
| 1743 | TP_ARGS(root, diff), |
| 1744 | |
| 1745 | TP_STRUCT__entry_btrfs( |
| 1746 | __field( u64, refroot ) |
| 1747 | __field( s64, diff ) |
Qu Wenruo | 4ee0d88 | 2017-12-12 15:34:35 +0800 | [diff] [blame] | 1748 | ), |
| 1749 | |
| 1750 | TP_fast_assign_btrfs(root->fs_info, |
Misono Tomohiro | 4fd786e | 2018-08-06 14:25:24 +0900 | [diff] [blame] | 1751 | __entry->refroot = root->root_key.objectid; |
Qu Wenruo | 4ee0d88 | 2017-12-12 15:34:35 +0800 | [diff] [blame] | 1752 | __entry->diff = diff; |
| 1753 | ), |
| 1754 | |
| 1755 | TP_printk_btrfs("refroot=%llu(%s) type=%s->%s diff=%lld", |
| 1756 | show_root_type(__entry->refroot), |
Nikolay Borisov | 1cb1f0b | 2020-06-19 15:24:49 +0300 | [diff] [blame] | 1757 | __print_symbolic(BTRFS_QGROUP_RSV_META_PREALLOC, QGROUP_RSV_TYPES), |
| 1758 | __print_symbolic(BTRFS_QGROUP_RSV_META_PERTRANS, QGROUP_RSV_TYPES), |
Qu Wenruo | 4ee0d88 | 2017-12-12 15:34:35 +0800 | [diff] [blame] | 1759 | __entry->diff) |
| 1760 | ); |
| 1761 | |
| 1762 | TRACE_EVENT(qgroup_meta_free_all_pertrans, |
| 1763 | |
| 1764 | TP_PROTO(struct btrfs_root *root), |
| 1765 | |
| 1766 | TP_ARGS(root), |
| 1767 | |
| 1768 | TP_STRUCT__entry_btrfs( |
| 1769 | __field( u64, refroot ) |
| 1770 | __field( s64, diff ) |
| 1771 | __field( int, type ) |
| 1772 | ), |
| 1773 | |
| 1774 | TP_fast_assign_btrfs(root->fs_info, |
Misono Tomohiro | 4fd786e | 2018-08-06 14:25:24 +0900 | [diff] [blame] | 1775 | __entry->refroot = root->root_key.objectid; |
Qu Wenruo | 4ee0d88 | 2017-12-12 15:34:35 +0800 | [diff] [blame] | 1776 | spin_lock(&root->qgroup_meta_rsv_lock); |
| 1777 | __entry->diff = -(s64)root->qgroup_meta_rsv_pertrans; |
| 1778 | spin_unlock(&root->qgroup_meta_rsv_lock); |
| 1779 | __entry->type = BTRFS_QGROUP_RSV_META_PERTRANS; |
| 1780 | ), |
| 1781 | |
| 1782 | TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld", |
| 1783 | show_root_type(__entry->refroot), |
Nikolay Borisov | 1cb1f0b | 2020-06-19 15:24:49 +0300 | [diff] [blame] | 1784 | __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) |
Qu Wenruo | 3159fe7 | 2017-03-13 15:52:08 +0800 | [diff] [blame] | 1785 | ); |
| 1786 | |
Jeff Mahoney | 0014275 | 2017-07-12 16:20:08 -0600 | [diff] [blame] | 1787 | DECLARE_EVENT_CLASS(btrfs__prelim_ref, |
| 1788 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1789 | const struct prelim_ref *oldref, |
| 1790 | const struct prelim_ref *newref, u64 tree_size), |
| 1791 | TP_ARGS(fs_info, newref, oldref, tree_size), |
| 1792 | |
| 1793 | TP_STRUCT__entry_btrfs( |
| 1794 | __field( u64, root_id ) |
| 1795 | __field( u64, objectid ) |
| 1796 | __field( u8, type ) |
| 1797 | __field( u64, offset ) |
| 1798 | __field( int, level ) |
| 1799 | __field( int, old_count ) |
| 1800 | __field( u64, parent ) |
| 1801 | __field( u64, bytenr ) |
| 1802 | __field( int, mod_count ) |
| 1803 | __field( u64, tree_size ) |
| 1804 | ), |
| 1805 | |
| 1806 | TP_fast_assign_btrfs(fs_info, |
| 1807 | __entry->root_id = oldref->root_id; |
| 1808 | __entry->objectid = oldref->key_for_search.objectid; |
| 1809 | __entry->type = oldref->key_for_search.type; |
| 1810 | __entry->offset = oldref->key_for_search.offset; |
| 1811 | __entry->level = oldref->level; |
| 1812 | __entry->old_count = oldref->count; |
| 1813 | __entry->parent = oldref->parent; |
| 1814 | __entry->bytenr = oldref->wanted_disk_byte; |
| 1815 | __entry->mod_count = newref ? newref->count : 0; |
| 1816 | __entry->tree_size = tree_size; |
| 1817 | ), |
| 1818 | |
| 1819 | TP_printk_btrfs("root_id=%llu key=[%llu,%u,%llu] level=%d count=[%d+%d=%d] parent=%llu wanted_disk_byte=%llu nodes=%llu", |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 1820 | __entry->root_id, |
| 1821 | __entry->objectid, __entry->type, |
| 1822 | __entry->offset, __entry->level, |
Jeff Mahoney | 0014275 | 2017-07-12 16:20:08 -0600 | [diff] [blame] | 1823 | __entry->old_count, __entry->mod_count, |
| 1824 | __entry->old_count + __entry->mod_count, |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 1825 | __entry->parent, |
| 1826 | __entry->bytenr, |
| 1827 | __entry->tree_size) |
Jeff Mahoney | 0014275 | 2017-07-12 16:20:08 -0600 | [diff] [blame] | 1828 | ); |
| 1829 | |
| 1830 | DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge, |
| 1831 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1832 | const struct prelim_ref *oldref, |
| 1833 | const struct prelim_ref *newref, u64 tree_size), |
| 1834 | TP_ARGS(fs_info, oldref, newref, tree_size) |
| 1835 | ); |
| 1836 | |
| 1837 | DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert, |
| 1838 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1839 | const struct prelim_ref *oldref, |
| 1840 | const struct prelim_ref *newref, u64 tree_size), |
| 1841 | TP_ARGS(fs_info, oldref, newref, tree_size) |
| 1842 | ); |
| 1843 | |
Josef Bacik | dd48d40 | 2017-10-19 14:15:56 -0400 | [diff] [blame] | 1844 | TRACE_EVENT(btrfs_inode_mod_outstanding_extents, |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 1845 | TP_PROTO(const struct btrfs_root *root, u64 ino, int mod), |
Josef Bacik | dd48d40 | 2017-10-19 14:15:56 -0400 | [diff] [blame] | 1846 | |
| 1847 | TP_ARGS(root, ino, mod), |
| 1848 | |
| 1849 | TP_STRUCT__entry_btrfs( |
| 1850 | __field( u64, root_objectid ) |
| 1851 | __field( u64, ino ) |
| 1852 | __field( int, mod ) |
| 1853 | ), |
| 1854 | |
| 1855 | TP_fast_assign_btrfs(root->fs_info, |
Misono Tomohiro | 4fd786e | 2018-08-06 14:25:24 +0900 | [diff] [blame] | 1856 | __entry->root_objectid = root->root_key.objectid; |
Josef Bacik | dd48d40 | 2017-10-19 14:15:56 -0400 | [diff] [blame] | 1857 | __entry->ino = ino; |
| 1858 | __entry->mod = mod; |
| 1859 | ), |
| 1860 | |
| 1861 | TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d", |
| 1862 | show_root_type(__entry->root_objectid), |
David Sterba | 8eec846 | 2018-04-03 21:15:11 +0200 | [diff] [blame] | 1863 | __entry->ino, __entry->mod) |
Josef Bacik | dd48d40 | 2017-10-19 14:15:56 -0400 | [diff] [blame] | 1864 | ); |
Qu Wenruo | 3dca5c9 | 2018-04-26 14:24:25 +0800 | [diff] [blame] | 1865 | |
Qu Wenruo | 4ed0a7a | 2018-04-26 17:17:20 +0800 | [diff] [blame] | 1866 | DECLARE_EVENT_CLASS(btrfs__block_group, |
David Sterba | 32da5386 | 2019-10-29 19:20:18 +0100 | [diff] [blame] | 1867 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
Qu Wenruo | 4ed0a7a | 2018-04-26 17:17:20 +0800 | [diff] [blame] | 1868 | |
| 1869 | TP_ARGS(bg_cache), |
| 1870 | |
| 1871 | TP_STRUCT__entry_btrfs( |
| 1872 | __field( u64, bytenr ) |
| 1873 | __field( u64, len ) |
| 1874 | __field( u64, used ) |
| 1875 | __field( u64, flags ) |
| 1876 | ), |
| 1877 | |
| 1878 | TP_fast_assign_btrfs(bg_cache->fs_info, |
David Sterba | b3470b5 | 2019-10-23 18:48:22 +0200 | [diff] [blame] | 1879 | __entry->bytenr = bg_cache->start, |
| 1880 | __entry->len = bg_cache->length, |
David Sterba | bf38be6 | 2019-10-23 18:48:11 +0200 | [diff] [blame] | 1881 | __entry->used = bg_cache->used; |
Qu Wenruo | 4ed0a7a | 2018-04-26 17:17:20 +0800 | [diff] [blame] | 1882 | __entry->flags = bg_cache->flags; |
| 1883 | ), |
| 1884 | |
| 1885 | TP_printk_btrfs("bg bytenr=%llu len=%llu used=%llu flags=%llu(%s)", |
| 1886 | __entry->bytenr, __entry->len, __entry->used, __entry->flags, |
| 1887 | __print_flags(__entry->flags, "|", BTRFS_GROUP_FLAGS)) |
| 1888 | ); |
| 1889 | |
| 1890 | DEFINE_EVENT(btrfs__block_group, btrfs_remove_block_group, |
David Sterba | 32da5386 | 2019-10-29 19:20:18 +0100 | [diff] [blame] | 1891 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
Qu Wenruo | 4ed0a7a | 2018-04-26 17:17:20 +0800 | [diff] [blame] | 1892 | |
| 1893 | TP_ARGS(bg_cache) |
| 1894 | ); |
| 1895 | |
| 1896 | DEFINE_EVENT(btrfs__block_group, btrfs_add_unused_block_group, |
David Sterba | 32da5386 | 2019-10-29 19:20:18 +0100 | [diff] [blame] | 1897 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
Qu Wenruo | 4ed0a7a | 2018-04-26 17:17:20 +0800 | [diff] [blame] | 1898 | |
| 1899 | TP_ARGS(bg_cache) |
| 1900 | ); |
| 1901 | |
| 1902 | DEFINE_EVENT(btrfs__block_group, btrfs_skip_unused_block_group, |
David Sterba | 32da5386 | 2019-10-29 19:20:18 +0100 | [diff] [blame] | 1903 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
Qu Wenruo | 4ed0a7a | 2018-04-26 17:17:20 +0800 | [diff] [blame] | 1904 | |
| 1905 | TP_ARGS(bg_cache) |
| 1906 | ); |
| 1907 | |
Qu Wenruo | a1d1984 | 2019-03-01 10:48:00 +0800 | [diff] [blame] | 1908 | TRACE_EVENT(btrfs_set_extent_bit, |
| 1909 | TP_PROTO(const struct extent_io_tree *tree, |
| 1910 | u64 start, u64 len, unsigned set_bits), |
| 1911 | |
| 1912 | TP_ARGS(tree, start, len, set_bits), |
| 1913 | |
| 1914 | TP_STRUCT__entry_btrfs( |
| 1915 | __field( unsigned, owner ) |
| 1916 | __field( u64, ino ) |
| 1917 | __field( u64, rootid ) |
| 1918 | __field( u64, start ) |
| 1919 | __field( u64, len ) |
| 1920 | __field( unsigned, set_bits) |
| 1921 | ), |
| 1922 | |
| 1923 | TP_fast_assign_btrfs(tree->fs_info, |
| 1924 | __entry->owner = tree->owner; |
| 1925 | if (tree->private_data) { |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 1926 | const struct inode *inode = tree->private_data; |
Qu Wenruo | a1d1984 | 2019-03-01 10:48:00 +0800 | [diff] [blame] | 1927 | |
| 1928 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
| 1929 | __entry->rootid = |
| 1930 | BTRFS_I(inode)->root->root_key.objectid; |
| 1931 | } else { |
| 1932 | __entry->ino = 0; |
| 1933 | __entry->rootid = 0; |
| 1934 | } |
| 1935 | __entry->start = start; |
| 1936 | __entry->len = len; |
| 1937 | __entry->set_bits = set_bits; |
| 1938 | ), |
| 1939 | |
| 1940 | TP_printk_btrfs( |
| 1941 | "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s", |
Nikolay Borisov | c92bb30 | 2020-06-19 15:24:50 +0300 | [diff] [blame] | 1942 | __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, |
Qu Wenruo | a1d1984 | 2019-03-01 10:48:00 +0800 | [diff] [blame] | 1943 | __entry->rootid, __entry->start, __entry->len, |
| 1944 | __print_flags(__entry->set_bits, "|", EXTENT_FLAGS)) |
| 1945 | ); |
| 1946 | |
| 1947 | TRACE_EVENT(btrfs_clear_extent_bit, |
| 1948 | TP_PROTO(const struct extent_io_tree *tree, |
| 1949 | u64 start, u64 len, unsigned clear_bits), |
| 1950 | |
| 1951 | TP_ARGS(tree, start, len, clear_bits), |
| 1952 | |
| 1953 | TP_STRUCT__entry_btrfs( |
| 1954 | __field( unsigned, owner ) |
| 1955 | __field( u64, ino ) |
| 1956 | __field( u64, rootid ) |
| 1957 | __field( u64, start ) |
| 1958 | __field( u64, len ) |
| 1959 | __field( unsigned, clear_bits) |
| 1960 | ), |
| 1961 | |
| 1962 | TP_fast_assign_btrfs(tree->fs_info, |
| 1963 | __entry->owner = tree->owner; |
| 1964 | if (tree->private_data) { |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 1965 | const struct inode *inode = tree->private_data; |
Qu Wenruo | a1d1984 | 2019-03-01 10:48:00 +0800 | [diff] [blame] | 1966 | |
| 1967 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
| 1968 | __entry->rootid = |
| 1969 | BTRFS_I(inode)->root->root_key.objectid; |
| 1970 | } else { |
| 1971 | __entry->ino = 0; |
| 1972 | __entry->rootid = 0; |
| 1973 | } |
| 1974 | __entry->start = start; |
| 1975 | __entry->len = len; |
| 1976 | __entry->clear_bits = clear_bits; |
| 1977 | ), |
| 1978 | |
| 1979 | TP_printk_btrfs( |
| 1980 | "io_tree=%s ino=%llu root=%llu start=%llu len=%llu clear_bits=%s", |
Nikolay Borisov | c92bb30 | 2020-06-19 15:24:50 +0300 | [diff] [blame] | 1981 | __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, |
Qu Wenruo | a1d1984 | 2019-03-01 10:48:00 +0800 | [diff] [blame] | 1982 | __entry->rootid, __entry->start, __entry->len, |
| 1983 | __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS)) |
| 1984 | ); |
| 1985 | |
| 1986 | TRACE_EVENT(btrfs_convert_extent_bit, |
| 1987 | TP_PROTO(const struct extent_io_tree *tree, |
| 1988 | u64 start, u64 len, unsigned set_bits, unsigned clear_bits), |
| 1989 | |
| 1990 | TP_ARGS(tree, start, len, set_bits, clear_bits), |
| 1991 | |
| 1992 | TP_STRUCT__entry_btrfs( |
| 1993 | __field( unsigned, owner ) |
| 1994 | __field( u64, ino ) |
| 1995 | __field( u64, rootid ) |
| 1996 | __field( u64, start ) |
| 1997 | __field( u64, len ) |
| 1998 | __field( unsigned, set_bits) |
| 1999 | __field( unsigned, clear_bits) |
| 2000 | ), |
| 2001 | |
| 2002 | TP_fast_assign_btrfs(tree->fs_info, |
| 2003 | __entry->owner = tree->owner; |
| 2004 | if (tree->private_data) { |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 2005 | const struct inode *inode = tree->private_data; |
Qu Wenruo | a1d1984 | 2019-03-01 10:48:00 +0800 | [diff] [blame] | 2006 | |
| 2007 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
| 2008 | __entry->rootid = |
| 2009 | BTRFS_I(inode)->root->root_key.objectid; |
| 2010 | } else { |
| 2011 | __entry->ino = 0; |
| 2012 | __entry->rootid = 0; |
| 2013 | } |
| 2014 | __entry->start = start; |
| 2015 | __entry->len = len; |
| 2016 | __entry->set_bits = set_bits; |
| 2017 | __entry->clear_bits = clear_bits; |
| 2018 | ), |
| 2019 | |
| 2020 | TP_printk_btrfs( |
| 2021 | "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s clear_bits=%s", |
Nikolay Borisov | c92bb30 | 2020-06-19 15:24:50 +0300 | [diff] [blame] | 2022 | __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, |
Qu Wenruo | a1d1984 | 2019-03-01 10:48:00 +0800 | [diff] [blame] | 2023 | __entry->rootid, __entry->start, __entry->len, |
| 2024 | __print_flags(__entry->set_bits , "|", EXTENT_FLAGS), |
| 2025 | __print_flags(__entry->clear_bits, "|", EXTENT_FLAGS)) |
| 2026 | ); |
| 2027 | |
Qu Wenruo | 34e73cc | 2019-04-15 21:15:24 +0800 | [diff] [blame] | 2028 | DECLARE_EVENT_CLASS(btrfs_sleep_tree_lock, |
| 2029 | TP_PROTO(const struct extent_buffer *eb, u64 start_ns), |
| 2030 | |
| 2031 | TP_ARGS(eb, start_ns), |
| 2032 | |
| 2033 | TP_STRUCT__entry_btrfs( |
| 2034 | __field( u64, block ) |
| 2035 | __field( u64, generation ) |
| 2036 | __field( u64, start_ns ) |
| 2037 | __field( u64, end_ns ) |
| 2038 | __field( u64, diff_ns ) |
| 2039 | __field( u64, owner ) |
| 2040 | __field( int, is_log_tree ) |
| 2041 | ), |
| 2042 | |
| 2043 | TP_fast_assign_btrfs(eb->fs_info, |
| 2044 | __entry->block = eb->start; |
| 2045 | __entry->generation = btrfs_header_generation(eb); |
| 2046 | __entry->start_ns = start_ns; |
| 2047 | __entry->end_ns = ktime_get_ns(); |
| 2048 | __entry->diff_ns = __entry->end_ns - start_ns; |
| 2049 | __entry->owner = btrfs_header_owner(eb); |
| 2050 | __entry->is_log_tree = (eb->log_index >= 0); |
| 2051 | ), |
| 2052 | |
| 2053 | TP_printk_btrfs( |
| 2054 | "block=%llu generation=%llu start_ns=%llu end_ns=%llu diff_ns=%llu owner=%llu is_log_tree=%d", |
| 2055 | __entry->block, __entry->generation, |
| 2056 | __entry->start_ns, __entry->end_ns, __entry->diff_ns, |
| 2057 | __entry->owner, __entry->is_log_tree) |
| 2058 | ); |
| 2059 | |
| 2060 | DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_read_lock, |
| 2061 | TP_PROTO(const struct extent_buffer *eb, u64 start_ns), |
| 2062 | |
| 2063 | TP_ARGS(eb, start_ns) |
| 2064 | ); |
| 2065 | |
| 2066 | DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_lock, |
| 2067 | TP_PROTO(const struct extent_buffer *eb, u64 start_ns), |
| 2068 | |
| 2069 | TP_ARGS(eb, start_ns) |
| 2070 | ); |
| 2071 | |
Qu Wenruo | 31aab40 | 2019-04-15 21:15:25 +0800 | [diff] [blame] | 2072 | DECLARE_EVENT_CLASS(btrfs_locking_events, |
| 2073 | TP_PROTO(const struct extent_buffer *eb), |
| 2074 | |
| 2075 | TP_ARGS(eb), |
| 2076 | |
| 2077 | TP_STRUCT__entry_btrfs( |
| 2078 | __field( u64, block ) |
| 2079 | __field( u64, generation ) |
| 2080 | __field( u64, owner ) |
| 2081 | __field( int, is_log_tree ) |
| 2082 | ), |
| 2083 | |
| 2084 | TP_fast_assign_btrfs(eb->fs_info, |
| 2085 | __entry->block = eb->start; |
| 2086 | __entry->generation = btrfs_header_generation(eb); |
| 2087 | __entry->owner = btrfs_header_owner(eb); |
| 2088 | __entry->is_log_tree = (eb->log_index >= 0); |
| 2089 | ), |
| 2090 | |
| 2091 | TP_printk_btrfs("block=%llu generation=%llu owner=%llu is_log_tree=%d", |
| 2092 | __entry->block, __entry->generation, |
| 2093 | __entry->owner, __entry->is_log_tree) |
| 2094 | ); |
| 2095 | |
| 2096 | #define DEFINE_BTRFS_LOCK_EVENT(name) \ |
| 2097 | DEFINE_EVENT(btrfs_locking_events, name, \ |
| 2098 | TP_PROTO(const struct extent_buffer *eb), \ |
| 2099 | \ |
| 2100 | TP_ARGS(eb) \ |
| 2101 | ) |
| 2102 | |
| 2103 | DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_unlock); |
| 2104 | DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock); |
| 2105 | DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock_blocking); |
| 2106 | DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_read); |
| 2107 | DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_write); |
Qu Wenruo | 31aab40 | 2019-04-15 21:15:25 +0800 | [diff] [blame] | 2108 | DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock); |
| 2109 | DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock); |
| 2110 | DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic); |
| 2111 | |
Qu Wenruo | 480b9b4 | 2019-04-29 14:03:33 +0800 | [diff] [blame] | 2112 | DECLARE_EVENT_CLASS(btrfs__space_info_update, |
| 2113 | |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 2114 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 2115 | const struct btrfs_space_info *sinfo, u64 old, s64 diff), |
Qu Wenruo | 480b9b4 | 2019-04-29 14:03:33 +0800 | [diff] [blame] | 2116 | |
| 2117 | TP_ARGS(fs_info, sinfo, old, diff), |
| 2118 | |
| 2119 | TP_STRUCT__entry_btrfs( |
| 2120 | __field( u64, type ) |
| 2121 | __field( u64, old ) |
| 2122 | __field( s64, diff ) |
| 2123 | ), |
| 2124 | |
| 2125 | TP_fast_assign_btrfs(fs_info, |
| 2126 | __entry->type = sinfo->flags; |
| 2127 | __entry->old = old; |
| 2128 | __entry->diff = diff; |
| 2129 | ), |
| 2130 | TP_printk_btrfs("type=%s old=%llu diff=%lld", |
| 2131 | __print_flags(__entry->type, "|", BTRFS_GROUP_FLAGS), |
| 2132 | __entry->old, __entry->diff) |
| 2133 | ); |
| 2134 | |
| 2135 | DEFINE_EVENT(btrfs__space_info_update, update_bytes_may_use, |
| 2136 | |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 2137 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 2138 | const struct btrfs_space_info *sinfo, u64 old, s64 diff), |
Qu Wenruo | 480b9b4 | 2019-04-29 14:03:33 +0800 | [diff] [blame] | 2139 | |
| 2140 | TP_ARGS(fs_info, sinfo, old, diff) |
| 2141 | ); |
| 2142 | |
| 2143 | DEFINE_EVENT(btrfs__space_info_update, update_bytes_pinned, |
| 2144 | |
David Sterba | 1d2e7c7 | 2019-10-17 13:28:57 +0200 | [diff] [blame] | 2145 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 2146 | const struct btrfs_space_info *sinfo, u64 old, s64 diff), |
Qu Wenruo | 480b9b4 | 2019-04-29 14:03:33 +0800 | [diff] [blame] | 2147 | |
| 2148 | TP_ARGS(fs_info, sinfo, old, diff) |
| 2149 | ); |
| 2150 | |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 2151 | #endif /* _TRACE_BTRFS_H */ |
| 2152 | |
| 2153 | /* This part must be outside protection */ |
| 2154 | #include <trace/define_trace.h> |