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