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