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