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