| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM btrfs |
| 4 | |
| 5 | #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define _TRACE_BTRFS_H |
| 7 | |
| 8 | #include <linux/writeback.h> |
| 9 | #include <linux/tracepoint.h> |
| 10 | #include <trace/events/mmflags.h> |
| 11 | |
| 12 | struct btrfs_root; |
| 13 | struct btrfs_fs_info; |
| 14 | struct btrfs_inode; |
| 15 | struct extent_map; |
| 16 | struct btrfs_file_extent_item; |
| 17 | struct btrfs_ordered_extent; |
| 18 | struct btrfs_delayed_ref_node; |
| 19 | struct btrfs_delayed_ref_head; |
| 20 | struct btrfs_block_group; |
| 21 | struct btrfs_free_cluster; |
| 22 | struct btrfs_chunk_map; |
| 23 | struct extent_buffer; |
| 24 | struct btrfs_work; |
| 25 | struct btrfs_workqueue; |
| 26 | struct btrfs_qgroup_extent_record; |
| 27 | struct btrfs_qgroup; |
| 28 | struct extent_io_tree; |
| 29 | struct prelim_ref; |
| 30 | struct btrfs_space_info; |
| 31 | struct btrfs_raid_bio; |
| 32 | struct raid56_bio_trace_info; |
| 33 | struct find_free_extent_ctl; |
| 34 | |
| 35 | #define show_ref_type(type) \ |
| 36 | __print_symbolic(type, \ |
| 37 | { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ |
| 38 | { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ |
| 39 | { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ |
| 40 | { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) |
| 41 | |
| 42 | #define __show_root_type(obj) \ |
| 43 | __print_symbolic_u64(obj, \ |
| 44 | { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ |
| 45 | { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ |
| 46 | { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ |
| 47 | { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ |
| 48 | { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ |
| 49 | { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ |
| 50 | { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ |
| 51 | { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ |
| 52 | { BTRFS_QUOTA_TREE_OBJECTID, "QUOTA_TREE" }, \ |
| 53 | { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ |
| 54 | { BTRFS_UUID_TREE_OBJECTID, "UUID_TREE" }, \ |
| 55 | { BTRFS_FREE_SPACE_TREE_OBJECTID, "FREE_SPACE_TREE" }, \ |
| 56 | { BTRFS_BLOCK_GROUP_TREE_OBJECTID, "BLOCK_GROUP_TREE" },\ |
| 57 | { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) |
| 58 | |
| 59 | #define show_root_type(obj) \ |
| 60 | obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ |
| 61 | (obj >= BTRFS_ROOT_TREE_OBJECTID && \ |
| 62 | obj <= BTRFS_QUOTA_TREE_OBJECTID)) ? __show_root_type(obj) : "-" |
| 63 | |
| 64 | #define FLUSH_ACTIONS \ |
| 65 | EM( BTRFS_RESERVE_NO_FLUSH, "BTRFS_RESERVE_NO_FLUSH") \ |
| 66 | EM( BTRFS_RESERVE_FLUSH_LIMIT, "BTRFS_RESERVE_FLUSH_LIMIT") \ |
| 67 | EM( BTRFS_RESERVE_FLUSH_ALL, "BTRFS_RESERVE_FLUSH_ALL") \ |
| 68 | EMe(BTRFS_RESERVE_FLUSH_ALL_STEAL, "BTRFS_RESERVE_FLUSH_ALL_STEAL") |
| 69 | |
| 70 | #define FI_TYPES \ |
| 71 | EM( BTRFS_FILE_EXTENT_INLINE, "INLINE") \ |
| 72 | EM( BTRFS_FILE_EXTENT_REG, "REG") \ |
| 73 | EMe(BTRFS_FILE_EXTENT_PREALLOC, "PREALLOC") |
| 74 | |
| 75 | #define QGROUP_RSV_TYPES \ |
| 76 | EM( BTRFS_QGROUP_RSV_DATA, "DATA") \ |
| 77 | EM( BTRFS_QGROUP_RSV_META_PERTRANS, "META_PERTRANS") \ |
| 78 | EMe(BTRFS_QGROUP_RSV_META_PREALLOC, "META_PREALLOC") |
| 79 | |
| 80 | #define IO_TREE_OWNER \ |
| 81 | EM( IO_TREE_FS_PINNED_EXTENTS, "PINNED_EXTENTS") \ |
| 82 | EM( IO_TREE_FS_EXCLUDED_EXTENTS, "EXCLUDED_EXTENTS") \ |
| 83 | EM( IO_TREE_BTREE_INODE_IO, "BTREE_INODE_IO") \ |
| 84 | EM( IO_TREE_INODE_IO, "INODE_IO") \ |
| 85 | EM( IO_TREE_RELOC_BLOCKS, "RELOC_BLOCKS") \ |
| 86 | EM( IO_TREE_TRANS_DIRTY_PAGES, "TRANS_DIRTY_PAGES") \ |
| 87 | EM( IO_TREE_ROOT_DIRTY_LOG_PAGES, "ROOT_DIRTY_LOG_PAGES") \ |
| 88 | EM( IO_TREE_INODE_FILE_EXTENT, "INODE_FILE_EXTENT") \ |
| 89 | EM( IO_TREE_LOG_CSUM_RANGE, "LOG_CSUM_RANGE") \ |
| 90 | EMe(IO_TREE_SELFTEST, "SELFTEST") |
| 91 | |
| 92 | #define FLUSH_STATES \ |
| 93 | EM( FLUSH_DELAYED_ITEMS_NR, "FLUSH_DELAYED_ITEMS_NR") \ |
| 94 | EM( FLUSH_DELAYED_ITEMS, "FLUSH_DELAYED_ITEMS") \ |
| 95 | EM( FLUSH_DELALLOC, "FLUSH_DELALLOC") \ |
| 96 | EM( FLUSH_DELALLOC_WAIT, "FLUSH_DELALLOC_WAIT") \ |
| 97 | EM( FLUSH_DELALLOC_FULL, "FLUSH_DELALLOC_FULL") \ |
| 98 | EM( FLUSH_DELAYED_REFS_NR, "FLUSH_DELAYED_REFS_NR") \ |
| 99 | EM( FLUSH_DELAYED_REFS, "FLUSH_DELAYED_REFS") \ |
| 100 | EM( ALLOC_CHUNK, "ALLOC_CHUNK") \ |
| 101 | EM( ALLOC_CHUNK_FORCE, "ALLOC_CHUNK_FORCE") \ |
| 102 | EM( RUN_DELAYED_IPUTS, "RUN_DELAYED_IPUTS") \ |
| 103 | EM( COMMIT_TRANS, "COMMIT_TRANS") \ |
| 104 | EMe(RESET_ZONES, "RESET_ZONES") |
| 105 | |
| 106 | /* |
| 107 | * First define the enums in the above macros to be exported to userspace via |
| 108 | * TRACE_DEFINE_ENUM(). |
| 109 | */ |
| 110 | |
| 111 | #undef EM |
| 112 | #undef EMe |
| 113 | #define EM(a, b) TRACE_DEFINE_ENUM(a); |
| 114 | #define EMe(a, b) TRACE_DEFINE_ENUM(a); |
| 115 | |
| 116 | FLUSH_ACTIONS |
| 117 | FI_TYPES |
| 118 | QGROUP_RSV_TYPES |
| 119 | IO_TREE_OWNER |
| 120 | FLUSH_STATES |
| 121 | |
| 122 | /* |
| 123 | * Now redefine the EM and EMe macros to map the enums to the strings that will |
| 124 | * be printed in the output |
| 125 | */ |
| 126 | |
| 127 | #undef EM |
| 128 | #undef EMe |
| 129 | #define EM(a, b) {a, b}, |
| 130 | #define EMe(a, b) {a, b} |
| 131 | |
| 132 | |
| 133 | #define BTRFS_GROUP_FLAGS \ |
| 134 | { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ |
| 135 | { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ |
| 136 | { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ |
| 137 | { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ |
| 138 | { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ |
| 139 | { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ |
| 140 | { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ |
| 141 | { BTRFS_BLOCK_GROUP_RAID5, "RAID5"}, \ |
| 142 | { BTRFS_BLOCK_GROUP_RAID6, "RAID6"} |
| 143 | |
| 144 | #define EXTENT_FLAGS \ |
| 145 | { EXTENT_DIRTY, "DIRTY"}, \ |
| 146 | { EXTENT_LOCKED, "LOCKED"}, \ |
| 147 | { EXTENT_DIRTY_LOG1, "DIRTY_LOG1"}, \ |
| 148 | { EXTENT_DIRTY_LOG2, "DIRTY_LOG2"}, \ |
| 149 | { EXTENT_DELALLOC, "DELALLOC"}, \ |
| 150 | { EXTENT_DEFRAG, "DEFRAG"}, \ |
| 151 | { EXTENT_BOUNDARY, "BOUNDARY"}, \ |
| 152 | { EXTENT_NODATASUM, "NODATASUM"}, \ |
| 153 | { EXTENT_CLEAR_META_RESV, "CLEAR_META_RESV"}, \ |
| 154 | { EXTENT_NEED_WAIT, "NEED_WAIT"}, \ |
| 155 | { EXTENT_NORESERVE, "NORESERVE"}, \ |
| 156 | { EXTENT_QGROUP_RESERVED, "QGROUP_RESERVED"}, \ |
| 157 | { EXTENT_CLEAR_DATA_RESV, "CLEAR_DATA_RESV"}, \ |
| 158 | { EXTENT_DELALLOC_NEW, "DELALLOC_NEW"} |
| 159 | |
| 160 | #define BTRFS_FSID_SIZE 16 |
| 161 | #define TP_STRUCT__entry_fsid __array(u8, fsid, BTRFS_FSID_SIZE) |
| 162 | |
| 163 | #define TP_fast_assign_fsid(fs_info) \ |
| 164 | ({ \ |
| 165 | if (fs_info) \ |
| 166 | memcpy(__entry->fsid, fs_info->fs_devices->fsid, \ |
| 167 | BTRFS_FSID_SIZE); \ |
| 168 | else \ |
| 169 | memset(__entry->fsid, 0, BTRFS_FSID_SIZE); \ |
| 170 | }) |
| 171 | |
| 172 | #define TP_STRUCT__entry_btrfs(args...) \ |
| 173 | TP_STRUCT__entry( \ |
| 174 | TP_STRUCT__entry_fsid \ |
| 175 | args) |
| 176 | #define TP_fast_assign_btrfs(fs_info, args...) \ |
| 177 | TP_fast_assign( \ |
| 178 | TP_fast_assign_fsid(fs_info); \ |
| 179 | args) |
| 180 | #define TP_printk_btrfs(fmt, args...) \ |
| 181 | TP_printk("%pU: " fmt, __entry->fsid, args) |
| 182 | |
| 183 | TRACE_EVENT(btrfs_transaction_commit, |
| 184 | |
| 185 | TP_PROTO(const struct btrfs_fs_info *fs_info), |
| 186 | |
| 187 | TP_ARGS(fs_info), |
| 188 | |
| 189 | TP_STRUCT__entry_btrfs( |
| 190 | __field( u64, generation ) |
| 191 | __field( u64, root_objectid ) |
| 192 | ), |
| 193 | |
| 194 | TP_fast_assign_btrfs(fs_info, |
| 195 | __entry->generation = fs_info->generation; |
| 196 | __entry->root_objectid = BTRFS_ROOT_TREE_OBJECTID; |
| 197 | ), |
| 198 | |
| 199 | TP_printk_btrfs("root=%llu(%s) gen=%llu" , |
| 200 | show_root_type(__entry->root_objectid), |
| 201 | __entry->generation) |
| 202 | ); |
| 203 | |
| 204 | DECLARE_EVENT_CLASS(btrfs__inode, |
| 205 | |
| 206 | TP_PROTO(const struct inode *inode), |
| 207 | |
| 208 | TP_ARGS(inode), |
| 209 | |
| 210 | TP_STRUCT__entry_btrfs( |
| 211 | __field( u64, ino ) |
| 212 | __field( u64, blocks ) |
| 213 | __field( u64, disk_i_size ) |
| 214 | __field( u64, generation ) |
| 215 | __field( u64, last_trans ) |
| 216 | __field( u64, logged_trans ) |
| 217 | __field( u64, root_objectid ) |
| 218 | ), |
| 219 | |
| 220 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
| 221 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
| 222 | __entry->blocks = inode->i_blocks; |
| 223 | __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; |
| 224 | __entry->generation = BTRFS_I(inode)->generation; |
| 225 | __entry->last_trans = BTRFS_I(inode)->last_trans; |
| 226 | __entry->logged_trans = BTRFS_I(inode)->logged_trans; |
| 227 | __entry->root_objectid = BTRFS_I(inode)->root ? |
| 228 | btrfs_root_id(BTRFS_I(inode)->root) : 0; |
| 229 | ), |
| 230 | |
| 231 | TP_printk_btrfs("root=%llu(%s) gen=%llu ino=%llu blocks=%llu " |
| 232 | "disk_i_size=%llu last_trans=%llu logged_trans=%llu" , |
| 233 | show_root_type(__entry->root_objectid), |
| 234 | __entry->generation, |
| 235 | __entry->ino, |
| 236 | __entry->blocks, |
| 237 | __entry->disk_i_size, |
| 238 | __entry->last_trans, |
| 239 | __entry->logged_trans) |
| 240 | ); |
| 241 | |
| 242 | DEFINE_EVENT(btrfs__inode, btrfs_inode_new, |
| 243 | |
| 244 | TP_PROTO(const struct inode *inode), |
| 245 | |
| 246 | TP_ARGS(inode) |
| 247 | ); |
| 248 | |
| 249 | DEFINE_EVENT(btrfs__inode, btrfs_inode_request, |
| 250 | |
| 251 | TP_PROTO(const struct inode *inode), |
| 252 | |
| 253 | TP_ARGS(inode) |
| 254 | ); |
| 255 | |
| 256 | DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, |
| 257 | |
| 258 | TP_PROTO(const struct inode *inode), |
| 259 | |
| 260 | TP_ARGS(inode) |
| 261 | ); |
| 262 | |
| 263 | #define __show_map_type(type) \ |
| 264 | __print_symbolic_u64(type, \ |
| 265 | { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ |
| 266 | { EXTENT_MAP_HOLE, "HOLE" }, \ |
| 267 | { EXTENT_MAP_INLINE, "INLINE" }) |
| 268 | |
| 269 | #define show_map_type(type) \ |
| 270 | type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) |
| 271 | |
| 272 | #define show_map_flags(flag) \ |
| 273 | __print_flags(flag, "|", \ |
| 274 | { EXTENT_FLAG_PINNED, "PINNED" },\ |
| 275 | { EXTENT_FLAG_COMPRESS_ZLIB, "COMPRESS_ZLIB" },\ |
| 276 | { EXTENT_FLAG_COMPRESS_LZO, "COMPRESS_LZO" },\ |
| 277 | { EXTENT_FLAG_COMPRESS_ZSTD, "COMPRESS_ZSTD" },\ |
| 278 | { EXTENT_FLAG_PREALLOC, "PREALLOC" },\ |
| 279 | { EXTENT_FLAG_LOGGING, "LOGGING" }) |
| 280 | |
| 281 | TRACE_EVENT_CONDITION(btrfs_get_extent, |
| 282 | |
| 283 | TP_PROTO(const struct btrfs_root *root, const struct btrfs_inode *inode, |
| 284 | const struct extent_map *map), |
| 285 | |
| 286 | TP_ARGS(root, inode, map), |
| 287 | |
| 288 | TP_CONDITION(map), |
| 289 | |
| 290 | TP_STRUCT__entry_btrfs( |
| 291 | __field( u64, root_objectid ) |
| 292 | __field( u64, ino ) |
| 293 | __field( u64, start ) |
| 294 | __field( u64, len ) |
| 295 | __field( u32, flags ) |
| 296 | __field( int, refs ) |
| 297 | ), |
| 298 | |
| 299 | TP_fast_assign_btrfs(root->fs_info, |
| 300 | __entry->root_objectid = btrfs_root_id(root); |
| 301 | __entry->ino = btrfs_ino(inode); |
| 302 | __entry->start = map->start; |
| 303 | __entry->len = map->len; |
| 304 | __entry->flags = map->flags; |
| 305 | __entry->refs = refcount_read(&map->refs); |
| 306 | ), |
| 307 | |
| 308 | TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu flags=%s refs=%u" , |
| 309 | show_root_type(__entry->root_objectid), |
| 310 | __entry->ino, |
| 311 | __entry->start, |
| 312 | __entry->len, |
| 313 | show_map_flags(__entry->flags), |
| 314 | __entry->refs) |
| 315 | ); |
| 316 | |
| 317 | TRACE_EVENT(btrfs_handle_em_exist, |
| 318 | |
| 319 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 320 | const struct extent_map *existing, const struct extent_map *map, |
| 321 | u64 start, u64 len), |
| 322 | |
| 323 | TP_ARGS(fs_info, existing, map, start, len), |
| 324 | |
| 325 | TP_STRUCT__entry_btrfs( |
| 326 | __field( u64, e_start ) |
| 327 | __field( u64, e_len ) |
| 328 | __field( u64, map_start ) |
| 329 | __field( u64, map_len ) |
| 330 | __field( u64, start ) |
| 331 | __field( u64, len ) |
| 332 | ), |
| 333 | |
| 334 | TP_fast_assign_btrfs(fs_info, |
| 335 | __entry->e_start = existing->start; |
| 336 | __entry->e_len = existing->len; |
| 337 | __entry->map_start = map->start; |
| 338 | __entry->map_len = map->len; |
| 339 | __entry->start = start; |
| 340 | __entry->len = len; |
| 341 | ), |
| 342 | |
| 343 | TP_printk_btrfs("start=%llu len=%llu " |
| 344 | "existing(start=%llu len=%llu) " |
| 345 | "em(start=%llu len=%llu)" , |
| 346 | __entry->start, |
| 347 | __entry->len, |
| 348 | __entry->e_start, |
| 349 | __entry->e_len, |
| 350 | __entry->map_start, |
| 351 | __entry->map_len) |
| 352 | ); |
| 353 | |
| 354 | /* file extent item */ |
| 355 | DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular, |
| 356 | |
| 357 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
| 358 | const struct btrfs_file_extent_item *fi, u64 start), |
| 359 | |
| 360 | TP_ARGS(bi, l, fi, start), |
| 361 | |
| 362 | TP_STRUCT__entry_btrfs( |
| 363 | __field( u64, root_obj ) |
| 364 | __field( u64, ino ) |
| 365 | __field( loff_t, isize ) |
| 366 | __field( u64, disk_isize ) |
| 367 | __field( u64, num_bytes ) |
| 368 | __field( u64, ram_bytes ) |
| 369 | __field( u64, disk_bytenr ) |
| 370 | __field( u64, disk_num_bytes ) |
| 371 | __field( u64, extent_offset ) |
| 372 | __field( u8, extent_type ) |
| 373 | __field( u8, compression ) |
| 374 | __field( u64, extent_start ) |
| 375 | __field( u64, extent_end ) |
| 376 | ), |
| 377 | |
| 378 | TP_fast_assign_btrfs(bi->root->fs_info, |
| 379 | __entry->root_obj = btrfs_root_id(bi->root); |
| 380 | __entry->ino = btrfs_ino(bi); |
| 381 | __entry->isize = bi->vfs_inode.i_size; |
| 382 | __entry->disk_isize = bi->disk_i_size; |
| 383 | __entry->num_bytes = btrfs_file_extent_num_bytes(l, fi); |
| 384 | __entry->ram_bytes = btrfs_file_extent_ram_bytes(l, fi); |
| 385 | __entry->disk_bytenr = btrfs_file_extent_disk_bytenr(l, fi); |
| 386 | __entry->disk_num_bytes = btrfs_file_extent_disk_num_bytes(l, fi); |
| 387 | __entry->extent_offset = btrfs_file_extent_offset(l, fi); |
| 388 | __entry->extent_type = btrfs_file_extent_type(l, fi); |
| 389 | __entry->compression = btrfs_file_extent_compression(l, fi); |
| 390 | __entry->extent_start = start; |
| 391 | __entry->extent_end = (start + __entry->num_bytes); |
| 392 | ), |
| 393 | |
| 394 | TP_printk_btrfs( |
| 395 | "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " |
| 396 | "file extent range=[%llu %llu] " |
| 397 | "(num_bytes=%llu ram_bytes=%llu disk_bytenr=%llu " |
| 398 | "disk_num_bytes=%llu extent_offset=%llu type=%s " |
| 399 | "compression=%u" , |
| 400 | show_root_type(__entry->root_obj), __entry->ino, |
| 401 | __entry->isize, |
| 402 | __entry->disk_isize, __entry->extent_start, |
| 403 | __entry->extent_end, __entry->num_bytes, __entry->ram_bytes, |
| 404 | __entry->disk_bytenr, __entry->disk_num_bytes, |
| 405 | __entry->extent_offset, __print_symbolic(__entry->extent_type, FI_TYPES), |
| 406 | __entry->compression) |
| 407 | ); |
| 408 | |
| 409 | DECLARE_EVENT_CLASS( |
| 410 | btrfs__file_extent_item_inline, |
| 411 | |
| 412 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
| 413 | const struct btrfs_file_extent_item *fi, int slot, u64 start), |
| 414 | |
| 415 | TP_ARGS(bi, l, fi, slot, start), |
| 416 | |
| 417 | TP_STRUCT__entry_btrfs( |
| 418 | __field( u64, root_obj ) |
| 419 | __field( u64, ino ) |
| 420 | __field( loff_t, isize ) |
| 421 | __field( u64, disk_isize ) |
| 422 | __field( u8, extent_type ) |
| 423 | __field( u8, compression ) |
| 424 | __field( u64, extent_start ) |
| 425 | __field( u64, extent_end ) |
| 426 | ), |
| 427 | |
| 428 | TP_fast_assign_btrfs( |
| 429 | bi->root->fs_info, |
| 430 | __entry->root_obj = btrfs_root_id(bi->root); |
| 431 | __entry->ino = btrfs_ino(bi); |
| 432 | __entry->isize = bi->vfs_inode.i_size; |
| 433 | __entry->disk_isize = bi->disk_i_size; |
| 434 | __entry->extent_type = btrfs_file_extent_type(l, fi); |
| 435 | __entry->compression = btrfs_file_extent_compression(l, fi); |
| 436 | __entry->extent_start = start; |
| 437 | __entry->extent_end = (start + btrfs_file_extent_ram_bytes(l, fi)); |
| 438 | ), |
| 439 | |
| 440 | TP_printk_btrfs( |
| 441 | "root=%llu(%s) inode=%llu size=%llu disk_isize=%llu " |
| 442 | "file extent range=[%llu %llu] " |
| 443 | "extent_type=%s compression=%u" , |
| 444 | show_root_type(__entry->root_obj), __entry->ino, __entry->isize, |
| 445 | __entry->disk_isize, __entry->extent_start, |
| 446 | __entry->extent_end, __print_symbolic(__entry->extent_type, FI_TYPES), |
| 447 | __entry->compression) |
| 448 | ); |
| 449 | |
| 450 | DEFINE_EVENT( |
| 451 | btrfs__file_extent_item_regular, btrfs_get_extent_show_fi_regular, |
| 452 | |
| 453 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
| 454 | const struct btrfs_file_extent_item *fi, u64 start), |
| 455 | |
| 456 | TP_ARGS(bi, l, fi, start) |
| 457 | ); |
| 458 | |
| 459 | DEFINE_EVENT( |
| 460 | btrfs__file_extent_item_regular, btrfs_truncate_show_fi_regular, |
| 461 | |
| 462 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
| 463 | const struct btrfs_file_extent_item *fi, u64 start), |
| 464 | |
| 465 | TP_ARGS(bi, l, fi, start) |
| 466 | ); |
| 467 | |
| 468 | DEFINE_EVENT( |
| 469 | btrfs__file_extent_item_inline, btrfs_get_extent_show_fi_inline, |
| 470 | |
| 471 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
| 472 | const struct btrfs_file_extent_item *fi, int slot, u64 start), |
| 473 | |
| 474 | TP_ARGS(bi, l, fi, slot, start) |
| 475 | ); |
| 476 | |
| 477 | DEFINE_EVENT( |
| 478 | btrfs__file_extent_item_inline, btrfs_truncate_show_fi_inline, |
| 479 | |
| 480 | TP_PROTO(const struct btrfs_inode *bi, const struct extent_buffer *l, |
| 481 | const struct btrfs_file_extent_item *fi, int slot, u64 start), |
| 482 | |
| 483 | TP_ARGS(bi, l, fi, slot, start) |
| 484 | ); |
| 485 | |
| 486 | #define show_ordered_flags(flags) \ |
| 487 | __print_flags(flags, "|", \ |
| 488 | { (1 << BTRFS_ORDERED_REGULAR), "REGULAR" }, \ |
| 489 | { (1 << BTRFS_ORDERED_NOCOW), "NOCOW" }, \ |
| 490 | { (1 << BTRFS_ORDERED_PREALLOC), "PREALLOC" }, \ |
| 491 | { (1 << BTRFS_ORDERED_COMPRESSED), "COMPRESSED" }, \ |
| 492 | { (1 << BTRFS_ORDERED_DIRECT), "DIRECT" }, \ |
| 493 | { (1 << BTRFS_ORDERED_IO_DONE), "IO_DONE" }, \ |
| 494 | { (1 << BTRFS_ORDERED_COMPLETE), "COMPLETE" }, \ |
| 495 | { (1 << BTRFS_ORDERED_IOERR), "IOERR" }, \ |
| 496 | { (1 << BTRFS_ORDERED_TRUNCATED), "TRUNCATED" }) |
| 497 | |
| 498 | |
| 499 | DECLARE_EVENT_CLASS(btrfs__ordered_extent, |
| 500 | |
| 501 | TP_PROTO(const struct btrfs_inode *inode, |
| 502 | const struct btrfs_ordered_extent *ordered), |
| 503 | |
| 504 | TP_ARGS(inode, ordered), |
| 505 | |
| 506 | TP_STRUCT__entry_btrfs( |
| 507 | __field( u64, ino ) |
| 508 | __field( u64, file_offset ) |
| 509 | __field( u64, start ) |
| 510 | __field( u64, len ) |
| 511 | __field( u64, disk_len ) |
| 512 | __field( u64, bytes_left ) |
| 513 | __field( unsigned long, flags ) |
| 514 | __field( int, compress_type ) |
| 515 | __field( int, refs ) |
| 516 | __field( u64, root_objectid ) |
| 517 | __field( u64, truncated_len ) |
| 518 | ), |
| 519 | |
| 520 | TP_fast_assign_btrfs(inode->root->fs_info, |
| 521 | __entry->ino = btrfs_ino(inode); |
| 522 | __entry->file_offset = ordered->file_offset; |
| 523 | __entry->start = ordered->disk_bytenr; |
| 524 | __entry->len = ordered->num_bytes; |
| 525 | __entry->disk_len = ordered->disk_num_bytes; |
| 526 | __entry->bytes_left = ordered->bytes_left; |
| 527 | __entry->flags = ordered->flags; |
| 528 | __entry->compress_type = ordered->compress_type; |
| 529 | __entry->refs = refcount_read(&ordered->refs); |
| 530 | __entry->root_objectid = btrfs_root_id(inode->root); |
| 531 | __entry->truncated_len = ordered->truncated_len; |
| 532 | ), |
| 533 | |
| 534 | TP_printk_btrfs("root=%llu(%s) ino=%llu file_offset=%llu " |
| 535 | "start=%llu len=%llu disk_len=%llu " |
| 536 | "truncated_len=%llu " |
| 537 | "bytes_left=%llu flags=%s compress_type=%d " |
| 538 | "refs=%d" , |
| 539 | show_root_type(__entry->root_objectid), |
| 540 | __entry->ino, |
| 541 | __entry->file_offset, |
| 542 | __entry->start, |
| 543 | __entry->len, |
| 544 | __entry->disk_len, |
| 545 | __entry->truncated_len, |
| 546 | __entry->bytes_left, |
| 547 | show_ordered_flags(__entry->flags), |
| 548 | __entry->compress_type, __entry->refs) |
| 549 | ); |
| 550 | |
| 551 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, |
| 552 | |
| 553 | TP_PROTO(const struct btrfs_inode *inode, |
| 554 | const struct btrfs_ordered_extent *ordered), |
| 555 | |
| 556 | TP_ARGS(inode, ordered) |
| 557 | ); |
| 558 | |
| 559 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, |
| 560 | |
| 561 | TP_PROTO(const struct btrfs_inode *inode, |
| 562 | const struct btrfs_ordered_extent *ordered), |
| 563 | |
| 564 | TP_ARGS(inode, ordered) |
| 565 | ); |
| 566 | |
| 567 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, |
| 568 | |
| 569 | TP_PROTO(const struct btrfs_inode *inode, |
| 570 | const struct btrfs_ordered_extent *ordered), |
| 571 | |
| 572 | TP_ARGS(inode, ordered) |
| 573 | ); |
| 574 | |
| 575 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, |
| 576 | |
| 577 | TP_PROTO(const struct btrfs_inode *inode, |
| 578 | const struct btrfs_ordered_extent *ordered), |
| 579 | |
| 580 | TP_ARGS(inode, ordered) |
| 581 | ); |
| 582 | |
| 583 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup, |
| 584 | |
| 585 | TP_PROTO(const struct btrfs_inode *inode, |
| 586 | const struct btrfs_ordered_extent *ordered), |
| 587 | |
| 588 | TP_ARGS(inode, ordered) |
| 589 | ); |
| 590 | |
| 591 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_range, |
| 592 | |
| 593 | TP_PROTO(const struct btrfs_inode *inode, |
| 594 | const struct btrfs_ordered_extent *ordered), |
| 595 | |
| 596 | TP_ARGS(inode, ordered) |
| 597 | ); |
| 598 | |
| 599 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_first_range, |
| 600 | |
| 601 | TP_PROTO(const struct btrfs_inode *inode, |
| 602 | const struct btrfs_ordered_extent *ordered), |
| 603 | |
| 604 | TP_ARGS(inode, ordered) |
| 605 | ); |
| 606 | |
| 607 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_for_logging, |
| 608 | |
| 609 | TP_PROTO(const struct btrfs_inode *inode, |
| 610 | const struct btrfs_ordered_extent *ordered), |
| 611 | |
| 612 | TP_ARGS(inode, ordered) |
| 613 | ); |
| 614 | |
| 615 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_lookup_first, |
| 616 | |
| 617 | TP_PROTO(const struct btrfs_inode *inode, |
| 618 | const struct btrfs_ordered_extent *ordered), |
| 619 | |
| 620 | TP_ARGS(inode, ordered) |
| 621 | ); |
| 622 | |
| 623 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_split, |
| 624 | |
| 625 | TP_PROTO(const struct btrfs_inode *inode, |
| 626 | const struct btrfs_ordered_extent *ordered), |
| 627 | |
| 628 | TP_ARGS(inode, ordered) |
| 629 | ); |
| 630 | |
| 631 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_dec_test_pending, |
| 632 | |
| 633 | TP_PROTO(const struct btrfs_inode *inode, |
| 634 | const struct btrfs_ordered_extent *ordered), |
| 635 | |
| 636 | TP_ARGS(inode, ordered) |
| 637 | ); |
| 638 | |
| 639 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_mark_finished, |
| 640 | |
| 641 | TP_PROTO(const struct btrfs_inode *inode, |
| 642 | const struct btrfs_ordered_extent *ordered), |
| 643 | |
| 644 | TP_ARGS(inode, ordered) |
| 645 | ); |
| 646 | |
| 647 | TRACE_EVENT(btrfs_finish_ordered_extent, |
| 648 | |
| 649 | TP_PROTO(const struct btrfs_inode *inode, u64 start, u64 len, |
| 650 | bool uptodate), |
| 651 | |
| 652 | TP_ARGS(inode, start, len, uptodate), |
| 653 | |
| 654 | TP_STRUCT__entry_btrfs( |
| 655 | __field( u64, ino ) |
| 656 | __field( u64, start ) |
| 657 | __field( u64, len ) |
| 658 | __field( bool, uptodate ) |
| 659 | __field( u64, root_objectid ) |
| 660 | ), |
| 661 | |
| 662 | TP_fast_assign_btrfs(inode->root->fs_info, |
| 663 | __entry->ino = btrfs_ino(inode); |
| 664 | __entry->start = start; |
| 665 | __entry->len = len; |
| 666 | __entry->uptodate = uptodate; |
| 667 | __entry->root_objectid = btrfs_root_id(inode->root); |
| 668 | ), |
| 669 | |
| 670 | TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu len=%llu uptodate=%d" , |
| 671 | show_root_type(__entry->root_objectid), |
| 672 | __entry->ino, __entry->start, |
| 673 | __entry->len, !!__entry->uptodate) |
| 674 | ); |
| 675 | |
| 676 | DECLARE_EVENT_CLASS(btrfs__writepage, |
| 677 | |
| 678 | TP_PROTO(const struct folio *folio, const struct inode *inode, |
| 679 | const struct writeback_control *wbc), |
| 680 | |
| 681 | TP_ARGS(folio, inode, wbc), |
| 682 | |
| 683 | TP_STRUCT__entry_btrfs( |
| 684 | __field( u64, ino ) |
| 685 | __field( pgoff_t, index ) |
| 686 | __field( long, nr_to_write ) |
| 687 | __field( long, pages_skipped ) |
| 688 | __field( loff_t, range_start ) |
| 689 | __field( loff_t, range_end ) |
| 690 | __field( char, for_kupdate ) |
| 691 | __field( char, range_cyclic ) |
| 692 | __field( unsigned long, writeback_index ) |
| 693 | __field( u64, root_objectid ) |
| 694 | ), |
| 695 | |
| 696 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
| 697 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
| 698 | __entry->index = folio->index; |
| 699 | __entry->nr_to_write = wbc->nr_to_write; |
| 700 | __entry->pages_skipped = wbc->pages_skipped; |
| 701 | __entry->range_start = wbc->range_start; |
| 702 | __entry->range_end = wbc->range_end; |
| 703 | __entry->for_kupdate = wbc->for_kupdate; |
| 704 | __entry->range_cyclic = wbc->range_cyclic; |
| 705 | __entry->writeback_index = inode->i_mapping->writeback_index; |
| 706 | __entry->root_objectid = btrfs_root_id(BTRFS_I(inode)->root); |
| 707 | ), |
| 708 | |
| 709 | TP_printk_btrfs("root=%llu(%s) ino=%llu page_index=%lu " |
| 710 | "nr_to_write=%ld pages_skipped=%ld range_start=%llu " |
| 711 | "range_end=%llu for_kupdate=%d " |
| 712 | "range_cyclic=%d writeback_index=%lu" , |
| 713 | show_root_type(__entry->root_objectid), |
| 714 | __entry->ino, __entry->index, |
| 715 | __entry->nr_to_write, __entry->pages_skipped, |
| 716 | __entry->range_start, __entry->range_end, |
| 717 | __entry->for_kupdate, __entry->range_cyclic, |
| 718 | __entry->writeback_index) |
| 719 | ); |
| 720 | |
| 721 | DEFINE_EVENT(btrfs__writepage, extent_writepage, |
| 722 | |
| 723 | TP_PROTO(const struct folio *folio, const struct inode *inode, |
| 724 | const struct writeback_control *wbc), |
| 725 | |
| 726 | TP_ARGS(folio, inode, wbc) |
| 727 | ); |
| 728 | |
| 729 | TRACE_EVENT(btrfs_writepage_end_io_hook, |
| 730 | |
| 731 | TP_PROTO(const struct btrfs_inode *inode, u64 start, u64 end, |
| 732 | int uptodate), |
| 733 | |
| 734 | TP_ARGS(inode, start, end, uptodate), |
| 735 | |
| 736 | TP_STRUCT__entry_btrfs( |
| 737 | __field( u64, ino ) |
| 738 | __field( u64, start ) |
| 739 | __field( u64, end ) |
| 740 | __field( int, uptodate ) |
| 741 | __field( u64, root_objectid ) |
| 742 | ), |
| 743 | |
| 744 | TP_fast_assign_btrfs(inode->root->fs_info, |
| 745 | __entry->ino = btrfs_ino(inode); |
| 746 | __entry->start = start; |
| 747 | __entry->end = end; |
| 748 | __entry->uptodate = uptodate; |
| 749 | __entry->root_objectid = btrfs_root_id(inode->root); |
| 750 | ), |
| 751 | |
| 752 | TP_printk_btrfs("root=%llu(%s) ino=%llu start=%llu end=%llu uptodate=%d" , |
| 753 | show_root_type(__entry->root_objectid), |
| 754 | __entry->ino, __entry->start, |
| 755 | __entry->end, __entry->uptodate) |
| 756 | ); |
| 757 | |
| 758 | TRACE_EVENT(btrfs_sync_file, |
| 759 | |
| 760 | TP_PROTO(const struct file *file, int datasync), |
| 761 | |
| 762 | TP_ARGS(file, datasync), |
| 763 | |
| 764 | TP_STRUCT__entry_btrfs( |
| 765 | __field( u64, ino ) |
| 766 | __field( u64, parent ) |
| 767 | __field( int, datasync ) |
| 768 | __field( u64, root_objectid ) |
| 769 | ), |
| 770 | |
| 771 | TP_fast_assign( |
| 772 | const struct dentry *dentry = file->f_path.dentry; |
| 773 | const struct inode *inode = d_inode(dentry); |
| 774 | |
| 775 | TP_fast_assign_fsid(btrfs_sb(file->f_path.dentry->d_sb)); |
| 776 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
| 777 | __entry->parent = btrfs_ino(BTRFS_I(d_inode(dentry->d_parent))); |
| 778 | __entry->datasync = datasync; |
| 779 | __entry->root_objectid = btrfs_root_id(BTRFS_I(inode)->root); |
| 780 | ), |
| 781 | |
| 782 | TP_printk_btrfs("root=%llu(%s) ino=%llu parent=%llu datasync=%d" , |
| 783 | show_root_type(__entry->root_objectid), |
| 784 | __entry->ino, |
| 785 | __entry->parent, |
| 786 | __entry->datasync) |
| 787 | ); |
| 788 | |
| 789 | TRACE_EVENT(btrfs_sync_fs, |
| 790 | |
| 791 | TP_PROTO(const struct btrfs_fs_info *fs_info, int wait), |
| 792 | |
| 793 | TP_ARGS(fs_info, wait), |
| 794 | |
| 795 | TP_STRUCT__entry_btrfs( |
| 796 | __field( int, wait ) |
| 797 | ), |
| 798 | |
| 799 | TP_fast_assign_btrfs(fs_info, |
| 800 | __entry->wait = wait; |
| 801 | ), |
| 802 | |
| 803 | TP_printk_btrfs("wait=%d" , __entry->wait) |
| 804 | ); |
| 805 | |
| 806 | TRACE_EVENT(btrfs_add_block_group, |
| 807 | |
| 808 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 809 | const struct btrfs_block_group *block_group, int create), |
| 810 | |
| 811 | TP_ARGS(fs_info, block_group, create), |
| 812 | |
| 813 | TP_STRUCT__entry_btrfs( |
| 814 | __field( u64, offset ) |
| 815 | __field( u64, size ) |
| 816 | __field( u64, flags ) |
| 817 | __field( u64, bytes_used ) |
| 818 | __field( u64, bytes_super ) |
| 819 | __field( int, create ) |
| 820 | ), |
| 821 | |
| 822 | TP_fast_assign_btrfs(fs_info, |
| 823 | __entry->offset = block_group->start; |
| 824 | __entry->size = block_group->length; |
| 825 | __entry->flags = block_group->flags; |
| 826 | __entry->bytes_used = block_group->used; |
| 827 | __entry->bytes_super = block_group->bytes_super; |
| 828 | __entry->create = create; |
| 829 | ), |
| 830 | |
| 831 | TP_printk_btrfs("block_group offset=%llu size=%llu " |
| 832 | "flags=%llu(%s) bytes_used=%llu bytes_super=%llu " |
| 833 | "create=%d" , |
| 834 | __entry->offset, |
| 835 | __entry->size, |
| 836 | __entry->flags, |
| 837 | __print_flags((unsigned long)__entry->flags, "|" , |
| 838 | BTRFS_GROUP_FLAGS), |
| 839 | __entry->bytes_used, |
| 840 | __entry->bytes_super, __entry->create) |
| 841 | ); |
| 842 | |
| 843 | #define show_ref_action(action) \ |
| 844 | __print_symbolic(action, \ |
| 845 | { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ |
| 846 | { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ |
| 847 | { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ |
| 848 | { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) |
| 849 | |
| 850 | |
| 851 | DECLARE_EVENT_CLASS(btrfs_delayed_tree_ref, |
| 852 | |
| 853 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 854 | const struct btrfs_delayed_ref_node *ref), |
| 855 | |
| 856 | TP_ARGS(fs_info, ref), |
| 857 | |
| 858 | TP_STRUCT__entry_btrfs( |
| 859 | __field( u64, bytenr ) |
| 860 | __field( u64, num_bytes ) |
| 861 | __field( int, action ) |
| 862 | __field( u64, parent ) |
| 863 | __field( u64, ref_root ) |
| 864 | __field( int, level ) |
| 865 | __field( int, type ) |
| 866 | __field( u64, seq ) |
| 867 | ), |
| 868 | |
| 869 | TP_fast_assign_btrfs(fs_info, |
| 870 | __entry->bytenr = ref->bytenr; |
| 871 | __entry->num_bytes = ref->num_bytes; |
| 872 | __entry->action = ref->action; |
| 873 | __entry->parent = ref->parent; |
| 874 | __entry->ref_root = ref->ref_root; |
| 875 | __entry->level = ref->tree_ref.level; |
| 876 | __entry->type = ref->type; |
| 877 | __entry->seq = ref->seq; |
| 878 | ), |
| 879 | |
| 880 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " |
| 881 | "parent=%llu(%s) ref_root=%llu(%s) level=%d " |
| 882 | "type=%s seq=%llu" , |
| 883 | __entry->bytenr, |
| 884 | __entry->num_bytes, |
| 885 | show_ref_action(__entry->action), |
| 886 | show_root_type(__entry->parent), |
| 887 | show_root_type(__entry->ref_root), |
| 888 | __entry->level, show_ref_type(__entry->type), |
| 889 | __entry->seq) |
| 890 | ); |
| 891 | |
| 892 | DEFINE_EVENT(btrfs_delayed_tree_ref, add_delayed_tree_ref, |
| 893 | |
| 894 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 895 | const struct btrfs_delayed_ref_node *ref), |
| 896 | |
| 897 | TP_ARGS(fs_info, ref) |
| 898 | ); |
| 899 | |
| 900 | DEFINE_EVENT(btrfs_delayed_tree_ref, run_delayed_tree_ref, |
| 901 | |
| 902 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 903 | const struct btrfs_delayed_ref_node *ref), |
| 904 | |
| 905 | TP_ARGS(fs_info, ref) |
| 906 | ); |
| 907 | |
| 908 | DECLARE_EVENT_CLASS(btrfs_delayed_data_ref, |
| 909 | |
| 910 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 911 | const struct btrfs_delayed_ref_node *ref), |
| 912 | |
| 913 | TP_ARGS(fs_info, ref), |
| 914 | |
| 915 | TP_STRUCT__entry_btrfs( |
| 916 | __field( u64, bytenr ) |
| 917 | __field( u64, num_bytes ) |
| 918 | __field( int, action ) |
| 919 | __field( u64, parent ) |
| 920 | __field( u64, ref_root ) |
| 921 | __field( u64, owner ) |
| 922 | __field( u64, offset ) |
| 923 | __field( int, type ) |
| 924 | __field( u64, seq ) |
| 925 | ), |
| 926 | |
| 927 | TP_fast_assign_btrfs(fs_info, |
| 928 | __entry->bytenr = ref->bytenr; |
| 929 | __entry->num_bytes = ref->num_bytes; |
| 930 | __entry->action = ref->action; |
| 931 | __entry->parent = ref->parent; |
| 932 | __entry->ref_root = ref->ref_root; |
| 933 | __entry->owner = ref->data_ref.objectid; |
| 934 | __entry->offset = ref->data_ref.offset; |
| 935 | __entry->type = ref->type; |
| 936 | __entry->seq = ref->seq; |
| 937 | ), |
| 938 | |
| 939 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s " |
| 940 | "parent=%llu(%s) ref_root=%llu(%s) owner=%llu " |
| 941 | "offset=%llu type=%s seq=%llu" , |
| 942 | __entry->bytenr, |
| 943 | __entry->num_bytes, |
| 944 | show_ref_action(__entry->action), |
| 945 | show_root_type(__entry->parent), |
| 946 | show_root_type(__entry->ref_root), |
| 947 | __entry->owner, |
| 948 | __entry->offset, |
| 949 | show_ref_type(__entry->type), |
| 950 | __entry->seq) |
| 951 | ); |
| 952 | |
| 953 | DEFINE_EVENT(btrfs_delayed_data_ref, add_delayed_data_ref, |
| 954 | |
| 955 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 956 | const struct btrfs_delayed_ref_node *ref), |
| 957 | |
| 958 | TP_ARGS(fs_info, ref) |
| 959 | ); |
| 960 | |
| 961 | DEFINE_EVENT(btrfs_delayed_data_ref, run_delayed_data_ref, |
| 962 | |
| 963 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 964 | const struct btrfs_delayed_ref_node *ref), |
| 965 | |
| 966 | TP_ARGS(fs_info, ref) |
| 967 | ); |
| 968 | |
| 969 | DECLARE_EVENT_CLASS(btrfs_delayed_ref_head, |
| 970 | |
| 971 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 972 | const struct btrfs_delayed_ref_head *head_ref, |
| 973 | int action), |
| 974 | |
| 975 | TP_ARGS(fs_info, head_ref, action), |
| 976 | |
| 977 | TP_STRUCT__entry_btrfs( |
| 978 | __field( u64, bytenr ) |
| 979 | __field( u64, num_bytes ) |
| 980 | __field( int, action ) |
| 981 | __field( int, is_data ) |
| 982 | ), |
| 983 | |
| 984 | TP_fast_assign_btrfs(fs_info, |
| 985 | __entry->bytenr = head_ref->bytenr; |
| 986 | __entry->num_bytes = head_ref->num_bytes; |
| 987 | __entry->action = action; |
| 988 | __entry->is_data = head_ref->is_data; |
| 989 | ), |
| 990 | |
| 991 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu action=%s is_data=%d" , |
| 992 | __entry->bytenr, |
| 993 | __entry->num_bytes, |
| 994 | show_ref_action(__entry->action), |
| 995 | __entry->is_data) |
| 996 | ); |
| 997 | |
| 998 | DEFINE_EVENT(btrfs_delayed_ref_head, add_delayed_ref_head, |
| 999 | |
| 1000 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1001 | const struct btrfs_delayed_ref_head *head_ref, |
| 1002 | int action), |
| 1003 | |
| 1004 | TP_ARGS(fs_info, head_ref, action) |
| 1005 | ); |
| 1006 | |
| 1007 | DEFINE_EVENT(btrfs_delayed_ref_head, run_delayed_ref_head, |
| 1008 | |
| 1009 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1010 | const struct btrfs_delayed_ref_head *head_ref, |
| 1011 | int action), |
| 1012 | |
| 1013 | TP_ARGS(fs_info, head_ref, action) |
| 1014 | ); |
| 1015 | |
| 1016 | #define show_chunk_type(type) \ |
| 1017 | __print_flags(type, "|", \ |
| 1018 | { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ |
| 1019 | { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ |
| 1020 | { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ |
| 1021 | { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ |
| 1022 | { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ |
| 1023 | { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ |
| 1024 | { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}, \ |
| 1025 | { BTRFS_BLOCK_GROUP_RAID5, "RAID5" }, \ |
| 1026 | { BTRFS_BLOCK_GROUP_RAID6, "RAID6" }) |
| 1027 | |
| 1028 | DECLARE_EVENT_CLASS(btrfs__chunk, |
| 1029 | |
| 1030 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1031 | const struct btrfs_chunk_map *map, u64 offset, u64 size), |
| 1032 | |
| 1033 | TP_ARGS(fs_info, map, offset, size), |
| 1034 | |
| 1035 | TP_STRUCT__entry_btrfs( |
| 1036 | __field( int, num_stripes ) |
| 1037 | __field( u64, type ) |
| 1038 | __field( int, sub_stripes ) |
| 1039 | __field( u64, offset ) |
| 1040 | __field( u64, size ) |
| 1041 | __field( u64, root_objectid ) |
| 1042 | ), |
| 1043 | |
| 1044 | TP_fast_assign_btrfs(fs_info, |
| 1045 | __entry->num_stripes = map->num_stripes; |
| 1046 | __entry->type = map->type; |
| 1047 | __entry->sub_stripes = map->sub_stripes; |
| 1048 | __entry->offset = offset; |
| 1049 | __entry->size = size; |
| 1050 | __entry->root_objectid = btrfs_root_id(fs_info->chunk_root); |
| 1051 | ), |
| 1052 | |
| 1053 | TP_printk_btrfs("root=%llu(%s) offset=%llu size=%llu " |
| 1054 | "num_stripes=%d sub_stripes=%d type=%s" , |
| 1055 | show_root_type(__entry->root_objectid), |
| 1056 | __entry->offset, |
| 1057 | __entry->size, |
| 1058 | __entry->num_stripes, __entry->sub_stripes, |
| 1059 | show_chunk_type(__entry->type)) |
| 1060 | ); |
| 1061 | |
| 1062 | DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, |
| 1063 | |
| 1064 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1065 | const struct btrfs_chunk_map *map, u64 offset, u64 size), |
| 1066 | |
| 1067 | TP_ARGS(fs_info, map, offset, size) |
| 1068 | ); |
| 1069 | |
| 1070 | DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, |
| 1071 | |
| 1072 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1073 | const struct btrfs_chunk_map *map, u64 offset, u64 size), |
| 1074 | |
| 1075 | TP_ARGS(fs_info, map, offset, size) |
| 1076 | ); |
| 1077 | |
| 1078 | TRACE_EVENT(btrfs_cow_block, |
| 1079 | |
| 1080 | TP_PROTO(const struct btrfs_root *root, const struct extent_buffer *buf, |
| 1081 | const struct extent_buffer *cow), |
| 1082 | |
| 1083 | TP_ARGS(root, buf, cow), |
| 1084 | |
| 1085 | TP_STRUCT__entry_btrfs( |
| 1086 | __field( u64, root_objectid ) |
| 1087 | __field( u64, buf_start ) |
| 1088 | __field( int, refs ) |
| 1089 | __field( u64, cow_start ) |
| 1090 | __field( int, buf_level ) |
| 1091 | __field( int, cow_level ) |
| 1092 | ), |
| 1093 | |
| 1094 | TP_fast_assign_btrfs(root->fs_info, |
| 1095 | __entry->root_objectid = btrfs_root_id(root); |
| 1096 | __entry->buf_start = buf->start; |
| 1097 | __entry->refs = refcount_read(&buf->refs); |
| 1098 | __entry->cow_start = cow->start; |
| 1099 | __entry->buf_level = btrfs_header_level(buf); |
| 1100 | __entry->cow_level = btrfs_header_level(cow); |
| 1101 | ), |
| 1102 | |
| 1103 | TP_printk_btrfs("root=%llu(%s) refs=%d orig_buf=%llu " |
| 1104 | "(orig_level=%d) cow_buf=%llu (cow_level=%d)" , |
| 1105 | show_root_type(__entry->root_objectid), |
| 1106 | __entry->refs, |
| 1107 | __entry->buf_start, |
| 1108 | __entry->buf_level, |
| 1109 | __entry->cow_start, |
| 1110 | __entry->cow_level) |
| 1111 | ); |
| 1112 | |
| 1113 | TRACE_EVENT(btrfs_space_reservation, |
| 1114 | |
| 1115 | TP_PROTO(const struct btrfs_fs_info *fs_info, const char *type, u64 val, |
| 1116 | u64 bytes, int reserve), |
| 1117 | |
| 1118 | TP_ARGS(fs_info, type, val, bytes, reserve), |
| 1119 | |
| 1120 | TP_STRUCT__entry_btrfs( |
| 1121 | __string( type, type ) |
| 1122 | __field( u64, val ) |
| 1123 | __field( u64, bytes ) |
| 1124 | __field( int, reserve ) |
| 1125 | ), |
| 1126 | |
| 1127 | TP_fast_assign_btrfs(fs_info, |
| 1128 | __assign_str(type); |
| 1129 | __entry->val = val; |
| 1130 | __entry->bytes = bytes; |
| 1131 | __entry->reserve = reserve; |
| 1132 | ), |
| 1133 | |
| 1134 | TP_printk_btrfs("%s: %llu %s %llu" , __get_str(type), __entry->val, |
| 1135 | __entry->reserve ? "reserve" : "release" , |
| 1136 | __entry->bytes) |
| 1137 | ); |
| 1138 | |
| 1139 | TRACE_EVENT(btrfs_trigger_flush, |
| 1140 | |
| 1141 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, |
| 1142 | int flush, const char *reason), |
| 1143 | |
| 1144 | TP_ARGS(fs_info, flags, bytes, flush, reason), |
| 1145 | |
| 1146 | TP_STRUCT__entry_btrfs( |
| 1147 | __field( u64, flags ) |
| 1148 | __field( u64, bytes ) |
| 1149 | __field( int, flush ) |
| 1150 | __string( reason, reason ) |
| 1151 | ), |
| 1152 | |
| 1153 | TP_fast_assign_btrfs(fs_info, |
| 1154 | __entry->flags = flags; |
| 1155 | __entry->bytes = bytes; |
| 1156 | __entry->flush = flush; |
| 1157 | __assign_str(reason); |
| 1158 | ), |
| 1159 | |
| 1160 | TP_printk_btrfs("%s: flush=%d(%s) flags=%llu(%s) bytes=%llu" , |
| 1161 | __get_str(reason), __entry->flush, |
| 1162 | __print_symbolic(__entry->flush, FLUSH_ACTIONS), |
| 1163 | __entry->flags, |
| 1164 | __print_flags((unsigned long)__entry->flags, "|" , |
| 1165 | BTRFS_GROUP_FLAGS), |
| 1166 | __entry->bytes) |
| 1167 | ); |
| 1168 | |
| 1169 | |
| 1170 | TRACE_EVENT(btrfs_flush_space, |
| 1171 | |
| 1172 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 num_bytes, |
| 1173 | int state, int ret, bool for_preempt), |
| 1174 | |
| 1175 | TP_ARGS(fs_info, flags, num_bytes, state, ret, for_preempt), |
| 1176 | |
| 1177 | TP_STRUCT__entry_btrfs( |
| 1178 | __field( u64, flags ) |
| 1179 | __field( u64, num_bytes ) |
| 1180 | __field( int, state ) |
| 1181 | __field( int, ret ) |
| 1182 | __field( bool, for_preempt ) |
| 1183 | ), |
| 1184 | |
| 1185 | TP_fast_assign_btrfs(fs_info, |
| 1186 | __entry->flags = flags; |
| 1187 | __entry->num_bytes = num_bytes; |
| 1188 | __entry->state = state; |
| 1189 | __entry->ret = ret; |
| 1190 | __entry->for_preempt = for_preempt; |
| 1191 | ), |
| 1192 | |
| 1193 | TP_printk_btrfs("state=%d(%s) flags=%llu(%s) num_bytes=%llu ret=%d for_preempt=%d" , |
| 1194 | __entry->state, |
| 1195 | __print_symbolic(__entry->state, FLUSH_STATES), |
| 1196 | __entry->flags, |
| 1197 | __print_flags((unsigned long)__entry->flags, "|" , |
| 1198 | BTRFS_GROUP_FLAGS), |
| 1199 | __entry->num_bytes, __entry->ret, __entry->for_preempt) |
| 1200 | ); |
| 1201 | |
| 1202 | DECLARE_EVENT_CLASS(btrfs__reserved_extent, |
| 1203 | |
| 1204 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), |
| 1205 | |
| 1206 | TP_ARGS(fs_info, start, len), |
| 1207 | |
| 1208 | TP_STRUCT__entry_btrfs( |
| 1209 | __field( u64, start ) |
| 1210 | __field( u64, len ) |
| 1211 | ), |
| 1212 | |
| 1213 | TP_fast_assign_btrfs(fs_info, |
| 1214 | __entry->start = start; |
| 1215 | __entry->len = len; |
| 1216 | ), |
| 1217 | |
| 1218 | TP_printk_btrfs("root=%llu(%s) start=%llu len=%llu" , |
| 1219 | show_root_type(BTRFS_EXTENT_TREE_OBJECTID), |
| 1220 | __entry->start, |
| 1221 | __entry->len) |
| 1222 | ); |
| 1223 | |
| 1224 | DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, |
| 1225 | |
| 1226 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), |
| 1227 | |
| 1228 | TP_ARGS(fs_info, start, len) |
| 1229 | ); |
| 1230 | |
| 1231 | DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, |
| 1232 | |
| 1233 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 len), |
| 1234 | |
| 1235 | TP_ARGS(fs_info, start, len) |
| 1236 | ); |
| 1237 | |
| 1238 | TRACE_EVENT(btrfs_find_free_extent, |
| 1239 | |
| 1240 | TP_PROTO(const struct btrfs_root *root, |
| 1241 | const struct find_free_extent_ctl *ffe_ctl), |
| 1242 | |
| 1243 | TP_ARGS(root, ffe_ctl), |
| 1244 | |
| 1245 | TP_STRUCT__entry_btrfs( |
| 1246 | __field( u64, root_objectid ) |
| 1247 | __field( u64, num_bytes ) |
| 1248 | __field( u64, empty_size ) |
| 1249 | __field( u64, flags ) |
| 1250 | ), |
| 1251 | |
| 1252 | TP_fast_assign_btrfs(root->fs_info, |
| 1253 | __entry->root_objectid = btrfs_root_id(root); |
| 1254 | __entry->num_bytes = ffe_ctl->num_bytes; |
| 1255 | __entry->empty_size = ffe_ctl->empty_size; |
| 1256 | __entry->flags = ffe_ctl->flags; |
| 1257 | ), |
| 1258 | |
| 1259 | TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s)" , |
| 1260 | show_root_type(__entry->root_objectid), |
| 1261 | __entry->num_bytes, __entry->empty_size, __entry->flags, |
| 1262 | __print_flags((unsigned long)__entry->flags, "|" , |
| 1263 | BTRFS_GROUP_FLAGS)) |
| 1264 | ); |
| 1265 | |
| 1266 | TRACE_EVENT(btrfs_find_free_extent_search_loop, |
| 1267 | |
| 1268 | TP_PROTO(const struct btrfs_root *root, |
| 1269 | const struct find_free_extent_ctl *ffe_ctl), |
| 1270 | |
| 1271 | TP_ARGS(root, ffe_ctl), |
| 1272 | |
| 1273 | TP_STRUCT__entry_btrfs( |
| 1274 | __field( u64, root_objectid ) |
| 1275 | __field( u64, num_bytes ) |
| 1276 | __field( u64, empty_size ) |
| 1277 | __field( u64, flags ) |
| 1278 | __field( u64, loop ) |
| 1279 | ), |
| 1280 | |
| 1281 | TP_fast_assign_btrfs(root->fs_info, |
| 1282 | __entry->root_objectid = btrfs_root_id(root); |
| 1283 | __entry->num_bytes = ffe_ctl->num_bytes; |
| 1284 | __entry->empty_size = ffe_ctl->empty_size; |
| 1285 | __entry->flags = ffe_ctl->flags; |
| 1286 | __entry->loop = ffe_ctl->loop; |
| 1287 | ), |
| 1288 | |
| 1289 | TP_printk_btrfs("root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s) loop=%llu" , |
| 1290 | show_root_type(__entry->root_objectid), |
| 1291 | __entry->num_bytes, __entry->empty_size, __entry->flags, |
| 1292 | __print_flags((unsigned long)__entry->flags, "|" , BTRFS_GROUP_FLAGS), |
| 1293 | __entry->loop) |
| 1294 | ); |
| 1295 | |
| 1296 | TRACE_EVENT(btrfs_find_free_extent_have_block_group, |
| 1297 | |
| 1298 | TP_PROTO(const struct btrfs_root *root, |
| 1299 | const struct find_free_extent_ctl *ffe_ctl, |
| 1300 | const struct btrfs_block_group *block_group), |
| 1301 | |
| 1302 | TP_ARGS(root, ffe_ctl, block_group), |
| 1303 | |
| 1304 | TP_STRUCT__entry_btrfs( |
| 1305 | __field( u64, root_objectid ) |
| 1306 | __field( u64, num_bytes ) |
| 1307 | __field( u64, empty_size ) |
| 1308 | __field( u64, flags ) |
| 1309 | __field( u64, loop ) |
| 1310 | __field( bool, hinted ) |
| 1311 | __field( u64, bg_start ) |
| 1312 | __field( u64, bg_flags ) |
| 1313 | ), |
| 1314 | |
| 1315 | TP_fast_assign_btrfs(root->fs_info, |
| 1316 | __entry->root_objectid = btrfs_root_id(root); |
| 1317 | __entry->num_bytes = ffe_ctl->num_bytes; |
| 1318 | __entry->empty_size = ffe_ctl->empty_size; |
| 1319 | __entry->flags = ffe_ctl->flags; |
| 1320 | __entry->loop = ffe_ctl->loop; |
| 1321 | __entry->hinted = ffe_ctl->hinted; |
| 1322 | __entry->bg_start = block_group->start; |
| 1323 | __entry->bg_flags = block_group->flags; |
| 1324 | ), |
| 1325 | |
| 1326 | TP_printk_btrfs( |
| 1327 | "root=%llu(%s) len=%llu empty_size=%llu flags=%llu(%s) loop=%llu hinted=%d block_group=%llu bg_flags=%llu(%s)" , |
| 1328 | show_root_type(__entry->root_objectid), |
| 1329 | __entry->num_bytes, __entry->empty_size, __entry->flags, |
| 1330 | __print_flags((unsigned long)__entry->flags, "|" , BTRFS_GROUP_FLAGS), |
| 1331 | __entry->loop, __entry->hinted, |
| 1332 | __entry->bg_start, __entry->bg_flags, |
| 1333 | __print_flags((unsigned long)__entry->bg_flags, "|" , |
| 1334 | BTRFS_GROUP_FLAGS)) |
| 1335 | ); |
| 1336 | |
| 1337 | DECLARE_EVENT_CLASS(btrfs__reserve_extent, |
| 1338 | |
| 1339 | TP_PROTO(const struct btrfs_block_group *block_group, |
| 1340 | const struct find_free_extent_ctl *ffe_ctl), |
| 1341 | |
| 1342 | TP_ARGS(block_group, ffe_ctl), |
| 1343 | |
| 1344 | TP_STRUCT__entry_btrfs( |
| 1345 | __field( u64, bg_objectid ) |
| 1346 | __field( u64, flags ) |
| 1347 | __field( int, bg_size_class ) |
| 1348 | __field( u64, start ) |
| 1349 | __field( u64, len ) |
| 1350 | __field( u64, loop ) |
| 1351 | __field( bool, hinted ) |
| 1352 | __field( int, size_class ) |
| 1353 | ), |
| 1354 | |
| 1355 | TP_fast_assign_btrfs(block_group->fs_info, |
| 1356 | __entry->bg_objectid = block_group->start; |
| 1357 | __entry->flags = block_group->flags; |
| 1358 | __entry->bg_size_class = block_group->size_class; |
| 1359 | __entry->start = ffe_ctl->search_start; |
| 1360 | __entry->len = ffe_ctl->num_bytes; |
| 1361 | __entry->loop = ffe_ctl->loop; |
| 1362 | __entry->hinted = ffe_ctl->hinted; |
| 1363 | __entry->size_class = ffe_ctl->size_class; |
| 1364 | ), |
| 1365 | |
| 1366 | TP_printk_btrfs( |
| 1367 | "root=%llu(%s) block_group=%llu flags=%llu(%s) bg_size_class=%d start=%llu len=%llu loop=%llu hinted=%d size_class=%d" , |
| 1368 | show_root_type(BTRFS_EXTENT_TREE_OBJECTID), |
| 1369 | __entry->bg_objectid, |
| 1370 | __entry->flags, __print_flags((unsigned long)__entry->flags, |
| 1371 | "|" , BTRFS_GROUP_FLAGS), |
| 1372 | __entry->bg_size_class, __entry->start, __entry->len, |
| 1373 | __entry->loop, __entry->hinted, __entry->size_class) |
| 1374 | ); |
| 1375 | |
| 1376 | DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, |
| 1377 | |
| 1378 | TP_PROTO(const struct btrfs_block_group *block_group, |
| 1379 | const struct find_free_extent_ctl *ffe_ctl), |
| 1380 | |
| 1381 | TP_ARGS(block_group, ffe_ctl) |
| 1382 | ); |
| 1383 | |
| 1384 | DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, |
| 1385 | |
| 1386 | TP_PROTO(const struct btrfs_block_group *block_group, |
| 1387 | const struct find_free_extent_ctl *ffe_ctl), |
| 1388 | |
| 1389 | TP_ARGS(block_group, ffe_ctl) |
| 1390 | ); |
| 1391 | |
| 1392 | TRACE_EVENT(btrfs_find_cluster, |
| 1393 | |
| 1394 | TP_PROTO(const struct btrfs_block_group *block_group, u64 start, |
| 1395 | u64 bytes, u64 empty_size, u64 min_bytes), |
| 1396 | |
| 1397 | TP_ARGS(block_group, start, bytes, empty_size, min_bytes), |
| 1398 | |
| 1399 | TP_STRUCT__entry_btrfs( |
| 1400 | __field( u64, bg_objectid ) |
| 1401 | __field( u64, flags ) |
| 1402 | __field( u64, start ) |
| 1403 | __field( u64, bytes ) |
| 1404 | __field( u64, empty_size ) |
| 1405 | __field( u64, min_bytes ) |
| 1406 | ), |
| 1407 | |
| 1408 | TP_fast_assign_btrfs(block_group->fs_info, |
| 1409 | __entry->bg_objectid = block_group->start; |
| 1410 | __entry->flags = block_group->flags; |
| 1411 | __entry->start = start; |
| 1412 | __entry->bytes = bytes; |
| 1413 | __entry->empty_size = empty_size; |
| 1414 | __entry->min_bytes = min_bytes; |
| 1415 | ), |
| 1416 | |
| 1417 | TP_printk_btrfs("block_group=%llu flags=%llu(%s) start=%llu len=%llu " |
| 1418 | "empty_size=%llu min_bytes=%llu" , __entry->bg_objectid, |
| 1419 | __entry->flags, |
| 1420 | __print_flags((unsigned long)__entry->flags, "|" , |
| 1421 | BTRFS_GROUP_FLAGS), __entry->start, |
| 1422 | __entry->bytes, __entry->empty_size, __entry->min_bytes) |
| 1423 | ); |
| 1424 | |
| 1425 | TRACE_EVENT(btrfs_failed_cluster_setup, |
| 1426 | |
| 1427 | TP_PROTO(const struct btrfs_block_group *block_group), |
| 1428 | |
| 1429 | TP_ARGS(block_group), |
| 1430 | |
| 1431 | TP_STRUCT__entry_btrfs( |
| 1432 | __field( u64, bg_objectid ) |
| 1433 | ), |
| 1434 | |
| 1435 | TP_fast_assign_btrfs(block_group->fs_info, |
| 1436 | __entry->bg_objectid = block_group->start; |
| 1437 | ), |
| 1438 | |
| 1439 | TP_printk_btrfs("block_group=%llu" , __entry->bg_objectid) |
| 1440 | ); |
| 1441 | |
| 1442 | TRACE_EVENT(btrfs_setup_cluster, |
| 1443 | |
| 1444 | TP_PROTO(const struct btrfs_block_group *block_group, |
| 1445 | const struct btrfs_free_cluster *cluster, |
| 1446 | u64 size, int bitmap), |
| 1447 | |
| 1448 | TP_ARGS(block_group, cluster, size, bitmap), |
| 1449 | |
| 1450 | TP_STRUCT__entry_btrfs( |
| 1451 | __field( u64, bg_objectid ) |
| 1452 | __field( u64, flags ) |
| 1453 | __field( u64, start ) |
| 1454 | __field( u64, max_size ) |
| 1455 | __field( u64, size ) |
| 1456 | __field( int, bitmap ) |
| 1457 | ), |
| 1458 | |
| 1459 | TP_fast_assign_btrfs(block_group->fs_info, |
| 1460 | __entry->bg_objectid = block_group->start; |
| 1461 | __entry->flags = block_group->flags; |
| 1462 | __entry->start = cluster->window_start; |
| 1463 | __entry->max_size = cluster->max_size; |
| 1464 | __entry->size = size; |
| 1465 | __entry->bitmap = bitmap; |
| 1466 | ), |
| 1467 | |
| 1468 | TP_printk_btrfs("block_group=%llu flags=%llu(%s) window_start=%llu " |
| 1469 | "size=%llu max_size=%llu bitmap=%d" , |
| 1470 | __entry->bg_objectid, |
| 1471 | __entry->flags, |
| 1472 | __print_flags((unsigned long)__entry->flags, "|" , |
| 1473 | BTRFS_GROUP_FLAGS), __entry->start, |
| 1474 | __entry->size, __entry->max_size, __entry->bitmap) |
| 1475 | ); |
| 1476 | |
| 1477 | struct extent_state; |
| 1478 | TRACE_EVENT(btrfs_alloc_extent_state, |
| 1479 | |
| 1480 | TP_PROTO(const struct extent_state *state, |
| 1481 | gfp_t mask, unsigned long IP), |
| 1482 | |
| 1483 | TP_ARGS(state, mask, IP), |
| 1484 | |
| 1485 | TP_STRUCT__entry( |
| 1486 | __field(const struct extent_state *, state) |
| 1487 | __field(unsigned long, mask) |
| 1488 | __field(const void*, ip) |
| 1489 | ), |
| 1490 | |
| 1491 | TP_fast_assign( |
| 1492 | __entry->state = state, |
| 1493 | __entry->mask = (__force unsigned long)mask, |
| 1494 | __entry->ip = (const void *)IP |
| 1495 | ), |
| 1496 | |
| 1497 | TP_printk("state=%p mask=%s caller=%pS" , __entry->state, |
| 1498 | show_gfp_flags(__entry->mask), __entry->ip) |
| 1499 | ); |
| 1500 | |
| 1501 | TRACE_EVENT(btrfs_free_extent_state, |
| 1502 | |
| 1503 | TP_PROTO(const struct extent_state *state, unsigned long IP), |
| 1504 | |
| 1505 | TP_ARGS(state, IP), |
| 1506 | |
| 1507 | TP_STRUCT__entry( |
| 1508 | __field(const struct extent_state *, state) |
| 1509 | __field(const void*, ip) |
| 1510 | ), |
| 1511 | |
| 1512 | TP_fast_assign( |
| 1513 | __entry->state = state, |
| 1514 | __entry->ip = (const void *)IP |
| 1515 | ), |
| 1516 | |
| 1517 | TP_printk("state=%p caller=%pS" , __entry->state, __entry->ip) |
| 1518 | ); |
| 1519 | |
| 1520 | DECLARE_EVENT_CLASS(btrfs__work, |
| 1521 | |
| 1522 | TP_PROTO(const struct btrfs_work *work), |
| 1523 | |
| 1524 | TP_ARGS(work), |
| 1525 | |
| 1526 | TP_STRUCT__entry_btrfs( |
| 1527 | __field( const void *, work ) |
| 1528 | __field( const void *, wq ) |
| 1529 | __field( const void *, func ) |
| 1530 | __field( const void *, ordered_func ) |
| 1531 | __field( const void *, normal_work ) |
| 1532 | ), |
| 1533 | |
| 1534 | TP_fast_assign_btrfs(btrfs_work_owner(work), |
| 1535 | __entry->work = work; |
| 1536 | __entry->wq = work->wq; |
| 1537 | __entry->func = work->func; |
| 1538 | __entry->ordered_func = work->ordered_func; |
| 1539 | __entry->normal_work = &work->normal_work; |
| 1540 | ), |
| 1541 | |
| 1542 | TP_printk_btrfs("work=%p (normal_work=%p) wq=%p func=%ps ordered_func=%p" , |
| 1543 | __entry->work, __entry->normal_work, __entry->wq, |
| 1544 | __entry->func, __entry->ordered_func) |
| 1545 | ); |
| 1546 | |
| 1547 | /* |
| 1548 | * For situations when the work is freed, we pass fs_info and a tag that matches |
| 1549 | * the address of the work structure so it can be paired with the scheduling |
| 1550 | * event. DO NOT add anything here that dereferences wtag. |
| 1551 | */ |
| 1552 | DECLARE_EVENT_CLASS(btrfs__work__done, |
| 1553 | |
| 1554 | TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), |
| 1555 | |
| 1556 | TP_ARGS(fs_info, wtag), |
| 1557 | |
| 1558 | TP_STRUCT__entry_btrfs( |
| 1559 | __field( const void *, wtag ) |
| 1560 | ), |
| 1561 | |
| 1562 | TP_fast_assign_btrfs(fs_info, |
| 1563 | __entry->wtag = wtag; |
| 1564 | ), |
| 1565 | |
| 1566 | TP_printk_btrfs("work->%p" , __entry->wtag) |
| 1567 | ); |
| 1568 | |
| 1569 | DEFINE_EVENT(btrfs__work, btrfs_work_queued, |
| 1570 | |
| 1571 | TP_PROTO(const struct btrfs_work *work), |
| 1572 | |
| 1573 | TP_ARGS(work) |
| 1574 | ); |
| 1575 | |
| 1576 | DEFINE_EVENT(btrfs__work, btrfs_work_sched, |
| 1577 | |
| 1578 | TP_PROTO(const struct btrfs_work *work), |
| 1579 | |
| 1580 | TP_ARGS(work) |
| 1581 | ); |
| 1582 | |
| 1583 | DEFINE_EVENT(btrfs__work__done, btrfs_all_work_done, |
| 1584 | |
| 1585 | TP_PROTO(const struct btrfs_fs_info *fs_info, const void *wtag), |
| 1586 | |
| 1587 | TP_ARGS(fs_info, wtag) |
| 1588 | ); |
| 1589 | |
| 1590 | DEFINE_EVENT(btrfs__work, btrfs_ordered_sched, |
| 1591 | |
| 1592 | TP_PROTO(const struct btrfs_work *work), |
| 1593 | |
| 1594 | TP_ARGS(work) |
| 1595 | ); |
| 1596 | |
| 1597 | DECLARE_EVENT_CLASS(btrfs_workqueue, |
| 1598 | |
| 1599 | TP_PROTO(const struct btrfs_workqueue *wq, const char *name), |
| 1600 | |
| 1601 | TP_ARGS(wq, name), |
| 1602 | |
| 1603 | TP_STRUCT__entry_btrfs( |
| 1604 | __field( const void *, wq ) |
| 1605 | __string( name, name ) |
| 1606 | ), |
| 1607 | |
| 1608 | TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), |
| 1609 | __entry->wq = wq; |
| 1610 | __assign_str(name); |
| 1611 | ), |
| 1612 | |
| 1613 | TP_printk_btrfs("name=%s wq=%p" , __get_str(name), |
| 1614 | __entry->wq) |
| 1615 | ); |
| 1616 | |
| 1617 | DEFINE_EVENT(btrfs_workqueue, btrfs_workqueue_alloc, |
| 1618 | |
| 1619 | TP_PROTO(const struct btrfs_workqueue *wq, const char *name), |
| 1620 | |
| 1621 | TP_ARGS(wq, name) |
| 1622 | ); |
| 1623 | |
| 1624 | DECLARE_EVENT_CLASS(btrfs_workqueue_done, |
| 1625 | |
| 1626 | TP_PROTO(const struct btrfs_workqueue *wq), |
| 1627 | |
| 1628 | TP_ARGS(wq), |
| 1629 | |
| 1630 | TP_STRUCT__entry_btrfs( |
| 1631 | __field( const void *, wq ) |
| 1632 | ), |
| 1633 | |
| 1634 | TP_fast_assign_btrfs(btrfs_workqueue_owner(wq), |
| 1635 | __entry->wq = wq; |
| 1636 | ), |
| 1637 | |
| 1638 | TP_printk_btrfs("wq=%p" , __entry->wq) |
| 1639 | ); |
| 1640 | |
| 1641 | DEFINE_EVENT(btrfs_workqueue_done, btrfs_workqueue_destroy, |
| 1642 | |
| 1643 | TP_PROTO(const struct btrfs_workqueue *wq), |
| 1644 | |
| 1645 | TP_ARGS(wq) |
| 1646 | ); |
| 1647 | |
| 1648 | #define BTRFS_QGROUP_OPERATIONS \ |
| 1649 | { QGROUP_RESERVE, "reserve" }, \ |
| 1650 | { QGROUP_RELEASE, "release" }, \ |
| 1651 | { QGROUP_FREE, "free" } |
| 1652 | |
| 1653 | DECLARE_EVENT_CLASS(btrfs__qgroup_rsv_data, |
| 1654 | |
| 1655 | TP_PROTO(const struct inode *inode, u64 start, u64 len, |
| 1656 | u64 reserved, int op), |
| 1657 | |
| 1658 | TP_ARGS(inode, start, len, reserved, op), |
| 1659 | |
| 1660 | TP_STRUCT__entry_btrfs( |
| 1661 | __field( u64, rootid ) |
| 1662 | __field( u64, ino ) |
| 1663 | __field( u64, start ) |
| 1664 | __field( u64, len ) |
| 1665 | __field( u64, reserved ) |
| 1666 | __field( int, op ) |
| 1667 | ), |
| 1668 | |
| 1669 | TP_fast_assign_btrfs(btrfs_sb(inode->i_sb), |
| 1670 | __entry->rootid = btrfs_root_id(BTRFS_I(inode)->root); |
| 1671 | __entry->ino = btrfs_ino(BTRFS_I(inode)); |
| 1672 | __entry->start = start; |
| 1673 | __entry->len = len; |
| 1674 | __entry->reserved = reserved; |
| 1675 | __entry->op = op; |
| 1676 | ), |
| 1677 | |
| 1678 | TP_printk_btrfs("root=%llu ino=%llu start=%llu len=%llu reserved=%llu op=%s" , |
| 1679 | __entry->rootid, __entry->ino, __entry->start, __entry->len, |
| 1680 | __entry->reserved, |
| 1681 | __print_flags((unsigned long)__entry->op, "" , |
| 1682 | BTRFS_QGROUP_OPERATIONS) |
| 1683 | ) |
| 1684 | ); |
| 1685 | |
| 1686 | DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_reserve_data, |
| 1687 | |
| 1688 | TP_PROTO(const struct inode *inode, u64 start, u64 len, |
| 1689 | u64 reserved, int op), |
| 1690 | |
| 1691 | TP_ARGS(inode, start, len, reserved, op) |
| 1692 | ); |
| 1693 | |
| 1694 | DEFINE_EVENT(btrfs__qgroup_rsv_data, btrfs_qgroup_release_data, |
| 1695 | |
| 1696 | TP_PROTO(const struct inode *inode, u64 start, u64 len, |
| 1697 | u64 reserved, int op), |
| 1698 | |
| 1699 | TP_ARGS(inode, start, len, reserved, op) |
| 1700 | ); |
| 1701 | |
| 1702 | DECLARE_EVENT_CLASS(btrfs_qgroup_extent, |
| 1703 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1704 | const struct btrfs_qgroup_extent_record *rec, |
| 1705 | u64 bytenr), |
| 1706 | |
| 1707 | TP_ARGS(fs_info, rec, bytenr), |
| 1708 | |
| 1709 | TP_STRUCT__entry_btrfs( |
| 1710 | __field( u64, bytenr ) |
| 1711 | __field( u64, num_bytes ) |
| 1712 | ), |
| 1713 | |
| 1714 | TP_fast_assign_btrfs(fs_info, |
| 1715 | __entry->bytenr = bytenr; |
| 1716 | __entry->num_bytes = rec->num_bytes; |
| 1717 | ), |
| 1718 | |
| 1719 | TP_printk_btrfs("bytenr=%llu num_bytes=%llu" , |
| 1720 | __entry->bytenr, __entry->num_bytes) |
| 1721 | ); |
| 1722 | |
| 1723 | DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_account_extents, |
| 1724 | |
| 1725 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1726 | const struct btrfs_qgroup_extent_record *rec, |
| 1727 | u64 bytenr), |
| 1728 | |
| 1729 | TP_ARGS(fs_info, rec, bytenr) |
| 1730 | ); |
| 1731 | |
| 1732 | DEFINE_EVENT(btrfs_qgroup_extent, btrfs_qgroup_trace_extent, |
| 1733 | |
| 1734 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1735 | const struct btrfs_qgroup_extent_record *rec, |
| 1736 | u64 bytenr), |
| 1737 | |
| 1738 | TP_ARGS(fs_info, rec, bytenr) |
| 1739 | ); |
| 1740 | |
| 1741 | TRACE_EVENT(btrfs_qgroup_num_dirty_extents, |
| 1742 | |
| 1743 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, |
| 1744 | u64 num_dirty_extents), |
| 1745 | |
| 1746 | TP_ARGS(fs_info, transid, num_dirty_extents), |
| 1747 | |
| 1748 | TP_STRUCT__entry_btrfs( |
| 1749 | __field( u64, transid ) |
| 1750 | __field( u64, num_dirty_extents ) |
| 1751 | ), |
| 1752 | |
| 1753 | TP_fast_assign_btrfs(fs_info, |
| 1754 | __entry->transid = transid; |
| 1755 | __entry->num_dirty_extents = num_dirty_extents; |
| 1756 | ), |
| 1757 | |
| 1758 | TP_printk_btrfs("transid=%llu num_dirty_extents=%llu" , |
| 1759 | __entry->transid, __entry->num_dirty_extents) |
| 1760 | ); |
| 1761 | |
| 1762 | TRACE_EVENT(btrfs_qgroup_account_extent, |
| 1763 | |
| 1764 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 transid, u64 bytenr, |
| 1765 | u64 num_bytes, u64 nr_old_roots, u64 nr_new_roots), |
| 1766 | |
| 1767 | TP_ARGS(fs_info, transid, bytenr, num_bytes, nr_old_roots, |
| 1768 | nr_new_roots), |
| 1769 | |
| 1770 | TP_STRUCT__entry_btrfs( |
| 1771 | __field( u64, transid ) |
| 1772 | __field( u64, bytenr ) |
| 1773 | __field( u64, num_bytes ) |
| 1774 | __field( u64, nr_old_roots ) |
| 1775 | __field( u64, nr_new_roots ) |
| 1776 | ), |
| 1777 | |
| 1778 | TP_fast_assign_btrfs(fs_info, |
| 1779 | __entry->transid = transid; |
| 1780 | __entry->bytenr = bytenr; |
| 1781 | __entry->num_bytes = num_bytes; |
| 1782 | __entry->nr_old_roots = nr_old_roots; |
| 1783 | __entry->nr_new_roots = nr_new_roots; |
| 1784 | ), |
| 1785 | |
| 1786 | TP_printk_btrfs( |
| 1787 | "transid=%llu bytenr=%llu num_bytes=%llu nr_old_roots=%llu nr_new_roots=%llu" , |
| 1788 | __entry->transid, |
| 1789 | __entry->bytenr, |
| 1790 | __entry->num_bytes, |
| 1791 | __entry->nr_old_roots, |
| 1792 | __entry->nr_new_roots) |
| 1793 | ); |
| 1794 | |
| 1795 | TRACE_EVENT(btrfs_qgroup_update_counters, |
| 1796 | |
| 1797 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1798 | const struct btrfs_qgroup *qgroup, |
| 1799 | u64 cur_old_count, u64 cur_new_count), |
| 1800 | |
| 1801 | TP_ARGS(fs_info, qgroup, cur_old_count, cur_new_count), |
| 1802 | |
| 1803 | TP_STRUCT__entry_btrfs( |
| 1804 | __field( u64, qgid ) |
| 1805 | __field( u64, old_rfer ) |
| 1806 | __field( u64, old_excl ) |
| 1807 | __field( u64, cur_old_count ) |
| 1808 | __field( u64, cur_new_count ) |
| 1809 | ), |
| 1810 | |
| 1811 | TP_fast_assign_btrfs(fs_info, |
| 1812 | __entry->qgid = qgroup->qgroupid; |
| 1813 | __entry->old_rfer = qgroup->rfer; |
| 1814 | __entry->old_excl = qgroup->excl; |
| 1815 | __entry->cur_old_count = cur_old_count; |
| 1816 | __entry->cur_new_count = cur_new_count; |
| 1817 | ), |
| 1818 | |
| 1819 | TP_printk_btrfs("qgid=%llu old_rfer=%llu old_excl=%llu cur_old_count=%llu cur_new_count=%llu" , |
| 1820 | __entry->qgid, __entry->old_rfer, __entry->old_excl, |
| 1821 | __entry->cur_old_count, __entry->cur_new_count) |
| 1822 | ); |
| 1823 | |
| 1824 | TRACE_EVENT(btrfs_qgroup_update_reserve, |
| 1825 | |
| 1826 | TP_PROTO(const struct btrfs_fs_info *fs_info, const struct btrfs_qgroup *qgroup, |
| 1827 | s64 diff, int type), |
| 1828 | |
| 1829 | TP_ARGS(fs_info, qgroup, diff, type), |
| 1830 | |
| 1831 | TP_STRUCT__entry_btrfs( |
| 1832 | __field( u64, qgid ) |
| 1833 | __field( u64, cur_reserved ) |
| 1834 | __field( s64, diff ) |
| 1835 | __field( int, type ) |
| 1836 | ), |
| 1837 | |
| 1838 | TP_fast_assign_btrfs(fs_info, |
| 1839 | __entry->qgid = qgroup->qgroupid; |
| 1840 | __entry->cur_reserved = qgroup->rsv.values[type]; |
| 1841 | __entry->diff = diff; |
| 1842 | __entry->type = type; |
| 1843 | ), |
| 1844 | |
| 1845 | TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld" , |
| 1846 | __entry->qgid, __print_symbolic(__entry->type, QGROUP_RSV_TYPES), |
| 1847 | __entry->cur_reserved, __entry->diff) |
| 1848 | ); |
| 1849 | |
| 1850 | TRACE_EVENT(btrfs_qgroup_meta_reserve, |
| 1851 | |
| 1852 | TP_PROTO(const struct btrfs_root *root, s64 diff, int type), |
| 1853 | |
| 1854 | TP_ARGS(root, diff, type), |
| 1855 | |
| 1856 | TP_STRUCT__entry_btrfs( |
| 1857 | __field( u64, refroot ) |
| 1858 | __field( s64, diff ) |
| 1859 | __field( int, type ) |
| 1860 | ), |
| 1861 | |
| 1862 | TP_fast_assign_btrfs(root->fs_info, |
| 1863 | __entry->refroot = btrfs_root_id(root); |
| 1864 | __entry->diff = diff; |
| 1865 | __entry->type = type; |
| 1866 | ), |
| 1867 | |
| 1868 | TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld" , |
| 1869 | show_root_type(__entry->refroot), |
| 1870 | __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) |
| 1871 | ); |
| 1872 | |
| 1873 | TRACE_EVENT(btrfs_qgroup_meta_convert, |
| 1874 | |
| 1875 | TP_PROTO(const struct btrfs_root *root, s64 diff), |
| 1876 | |
| 1877 | TP_ARGS(root, diff), |
| 1878 | |
| 1879 | TP_STRUCT__entry_btrfs( |
| 1880 | __field( u64, refroot ) |
| 1881 | __field( s64, diff ) |
| 1882 | ), |
| 1883 | |
| 1884 | TP_fast_assign_btrfs(root->fs_info, |
| 1885 | __entry->refroot = btrfs_root_id(root); |
| 1886 | __entry->diff = diff; |
| 1887 | ), |
| 1888 | |
| 1889 | TP_printk_btrfs("refroot=%llu(%s) type=%s->%s diff=%lld" , |
| 1890 | show_root_type(__entry->refroot), |
| 1891 | __print_symbolic(BTRFS_QGROUP_RSV_META_PREALLOC, QGROUP_RSV_TYPES), |
| 1892 | __print_symbolic(BTRFS_QGROUP_RSV_META_PERTRANS, QGROUP_RSV_TYPES), |
| 1893 | __entry->diff) |
| 1894 | ); |
| 1895 | |
| 1896 | TRACE_EVENT(btrfs_qgroup_meta_free_all_pertrans, |
| 1897 | |
| 1898 | TP_PROTO(struct btrfs_root *root), |
| 1899 | |
| 1900 | TP_ARGS(root), |
| 1901 | |
| 1902 | TP_STRUCT__entry_btrfs( |
| 1903 | __field( u64, refroot ) |
| 1904 | __field( s64, diff ) |
| 1905 | __field( int, type ) |
| 1906 | ), |
| 1907 | |
| 1908 | TP_fast_assign_btrfs(root->fs_info, |
| 1909 | __entry->refroot = btrfs_root_id(root); |
| 1910 | spin_lock(&root->qgroup_meta_rsv_lock); |
| 1911 | __entry->diff = -(s64)root->qgroup_meta_rsv_pertrans; |
| 1912 | spin_unlock(&root->qgroup_meta_rsv_lock); |
| 1913 | __entry->type = BTRFS_QGROUP_RSV_META_PERTRANS; |
| 1914 | ), |
| 1915 | |
| 1916 | TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld" , |
| 1917 | show_root_type(__entry->refroot), |
| 1918 | __print_symbolic(__entry->type, QGROUP_RSV_TYPES), __entry->diff) |
| 1919 | ); |
| 1920 | |
| 1921 | DECLARE_EVENT_CLASS(btrfs__prelim_ref, |
| 1922 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1923 | const struct prelim_ref *oldref, |
| 1924 | const struct prelim_ref *newref, u64 tree_size), |
| 1925 | TP_ARGS(fs_info, oldref, newref, tree_size), |
| 1926 | |
| 1927 | TP_STRUCT__entry_btrfs( |
| 1928 | __field( u64, root_id ) |
| 1929 | __field( u64, objectid ) |
| 1930 | __field( u8, type ) |
| 1931 | __field( u64, offset ) |
| 1932 | __field( int, level ) |
| 1933 | __field( int, old_count ) |
| 1934 | __field( u64, parent ) |
| 1935 | __field( u64, bytenr ) |
| 1936 | __field( int, mod_count ) |
| 1937 | __field( u64, tree_size ) |
| 1938 | ), |
| 1939 | |
| 1940 | TP_fast_assign_btrfs(fs_info, |
| 1941 | __entry->root_id = oldref->root_id; |
| 1942 | __entry->objectid = oldref->key_for_search.objectid; |
| 1943 | __entry->type = oldref->key_for_search.type; |
| 1944 | __entry->offset = oldref->key_for_search.offset; |
| 1945 | __entry->level = oldref->level; |
| 1946 | __entry->old_count = oldref->count; |
| 1947 | __entry->parent = oldref->parent; |
| 1948 | __entry->bytenr = oldref->wanted_disk_byte; |
| 1949 | __entry->mod_count = newref ? newref->count : 0; |
| 1950 | __entry->tree_size = tree_size; |
| 1951 | ), |
| 1952 | |
| 1953 | TP_printk_btrfs("root_id=%llu key=[%llu,%u,%llu] level=%d count=[%d+%d=%d] parent=%llu wanted_disk_byte=%llu nodes=%llu" , |
| 1954 | __entry->root_id, |
| 1955 | __entry->objectid, __entry->type, |
| 1956 | __entry->offset, __entry->level, |
| 1957 | __entry->old_count, __entry->mod_count, |
| 1958 | __entry->old_count + __entry->mod_count, |
| 1959 | __entry->parent, |
| 1960 | __entry->bytenr, |
| 1961 | __entry->tree_size) |
| 1962 | ); |
| 1963 | |
| 1964 | DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_merge, |
| 1965 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1966 | const struct prelim_ref *oldref, |
| 1967 | const struct prelim_ref *newref, u64 tree_size), |
| 1968 | TP_ARGS(fs_info, oldref, newref, tree_size) |
| 1969 | ); |
| 1970 | |
| 1971 | DEFINE_EVENT(btrfs__prelim_ref, btrfs_prelim_ref_insert, |
| 1972 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 1973 | const struct prelim_ref *oldref, |
| 1974 | const struct prelim_ref *newref, u64 tree_size), |
| 1975 | TP_ARGS(fs_info, oldref, newref, tree_size) |
| 1976 | ); |
| 1977 | |
| 1978 | TRACE_EVENT(btrfs_inode_mod_outstanding_extents, |
| 1979 | TP_PROTO(const struct btrfs_root *root, u64 ino, int mod, unsigned outstanding), |
| 1980 | |
| 1981 | TP_ARGS(root, ino, mod, outstanding), |
| 1982 | |
| 1983 | TP_STRUCT__entry_btrfs( |
| 1984 | __field( u64, root_objectid ) |
| 1985 | __field( u64, ino ) |
| 1986 | __field( int, mod ) |
| 1987 | __field( unsigned, outstanding ) |
| 1988 | ), |
| 1989 | |
| 1990 | TP_fast_assign_btrfs(root->fs_info, |
| 1991 | __entry->root_objectid = btrfs_root_id(root); |
| 1992 | __entry->ino = ino; |
| 1993 | __entry->mod = mod; |
| 1994 | __entry->outstanding = outstanding; |
| 1995 | ), |
| 1996 | |
| 1997 | TP_printk_btrfs("root=%llu(%s) ino=%llu mod=%d outstanding=%u" , |
| 1998 | show_root_type(__entry->root_objectid), |
| 1999 | __entry->ino, __entry->mod, __entry->outstanding) |
| 2000 | ); |
| 2001 | |
| 2002 | DECLARE_EVENT_CLASS(btrfs__block_group, |
| 2003 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
| 2004 | |
| 2005 | TP_ARGS(bg_cache), |
| 2006 | |
| 2007 | TP_STRUCT__entry_btrfs( |
| 2008 | __field( u64, bytenr ) |
| 2009 | __field( u64, len ) |
| 2010 | __field( u64, used ) |
| 2011 | __field( u64, flags ) |
| 2012 | ), |
| 2013 | |
| 2014 | TP_fast_assign_btrfs(bg_cache->fs_info, |
| 2015 | __entry->bytenr = bg_cache->start, |
| 2016 | __entry->len = bg_cache->length, |
| 2017 | __entry->used = bg_cache->used; |
| 2018 | __entry->flags = bg_cache->flags; |
| 2019 | ), |
| 2020 | |
| 2021 | TP_printk_btrfs("bg bytenr=%llu len=%llu used=%llu flags=%llu(%s)" , |
| 2022 | __entry->bytenr, __entry->len, __entry->used, __entry->flags, |
| 2023 | __print_flags(__entry->flags, "|" , BTRFS_GROUP_FLAGS)) |
| 2024 | ); |
| 2025 | |
| 2026 | DEFINE_EVENT(btrfs__block_group, btrfs_remove_block_group, |
| 2027 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
| 2028 | |
| 2029 | TP_ARGS(bg_cache) |
| 2030 | ); |
| 2031 | |
| 2032 | DEFINE_EVENT(btrfs__block_group, btrfs_add_unused_block_group, |
| 2033 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
| 2034 | |
| 2035 | TP_ARGS(bg_cache) |
| 2036 | ); |
| 2037 | |
| 2038 | DEFINE_EVENT(btrfs__block_group, btrfs_add_reclaim_block_group, |
| 2039 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
| 2040 | |
| 2041 | TP_ARGS(bg_cache) |
| 2042 | ); |
| 2043 | |
| 2044 | DEFINE_EVENT(btrfs__block_group, btrfs_reclaim_block_group, |
| 2045 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
| 2046 | |
| 2047 | TP_ARGS(bg_cache) |
| 2048 | ); |
| 2049 | |
| 2050 | DEFINE_EVENT(btrfs__block_group, btrfs_skip_unused_block_group, |
| 2051 | TP_PROTO(const struct btrfs_block_group *bg_cache), |
| 2052 | |
| 2053 | TP_ARGS(bg_cache) |
| 2054 | ); |
| 2055 | |
| 2056 | TRACE_EVENT(btrfs_set_extent_bit, |
| 2057 | TP_PROTO(const struct extent_io_tree *tree, |
| 2058 | u64 start, u64 len, unsigned set_bits), |
| 2059 | |
| 2060 | TP_ARGS(tree, start, len, set_bits), |
| 2061 | |
| 2062 | TP_STRUCT__entry_btrfs( |
| 2063 | __field( unsigned, owner ) |
| 2064 | __field( u64, ino ) |
| 2065 | __field( u64, rootid ) |
| 2066 | __field( u64, start ) |
| 2067 | __field( u64, len ) |
| 2068 | __field( unsigned, set_bits) |
| 2069 | ), |
| 2070 | |
| 2071 | TP_fast_assign_btrfs(btrfs_extent_io_tree_to_fs_info(tree), |
| 2072 | const struct btrfs_inode *inode = btrfs_extent_io_tree_to_inode(tree); |
| 2073 | |
| 2074 | __entry->owner = tree->owner; |
| 2075 | __entry->ino = inode ? btrfs_ino(inode) : 0; |
| 2076 | __entry->rootid = inode ? btrfs_root_id(inode->root) : 0; |
| 2077 | __entry->start = start; |
| 2078 | __entry->len = len; |
| 2079 | __entry->set_bits = set_bits; |
| 2080 | ), |
| 2081 | |
| 2082 | TP_printk_btrfs( |
| 2083 | "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s" , |
| 2084 | __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, |
| 2085 | __entry->rootid, __entry->start, __entry->len, |
| 2086 | __print_flags(__entry->set_bits, "|" , EXTENT_FLAGS)) |
| 2087 | ); |
| 2088 | |
| 2089 | TRACE_EVENT(btrfs_clear_extent_bit, |
| 2090 | TP_PROTO(const struct extent_io_tree *tree, |
| 2091 | u64 start, u64 len, unsigned clear_bits), |
| 2092 | |
| 2093 | TP_ARGS(tree, start, len, clear_bits), |
| 2094 | |
| 2095 | TP_STRUCT__entry_btrfs( |
| 2096 | __field( unsigned, owner ) |
| 2097 | __field( u64, ino ) |
| 2098 | __field( u64, rootid ) |
| 2099 | __field( u64, start ) |
| 2100 | __field( u64, len ) |
| 2101 | __field( unsigned, clear_bits) |
| 2102 | ), |
| 2103 | |
| 2104 | TP_fast_assign_btrfs(btrfs_extent_io_tree_to_fs_info(tree), |
| 2105 | const struct btrfs_inode *inode = btrfs_extent_io_tree_to_inode(tree); |
| 2106 | |
| 2107 | __entry->owner = tree->owner; |
| 2108 | __entry->ino = inode ? btrfs_ino(inode) : 0; |
| 2109 | __entry->rootid = inode ? btrfs_root_id(inode->root) : 0; |
| 2110 | __entry->start = start; |
| 2111 | __entry->len = len; |
| 2112 | __entry->clear_bits = clear_bits; |
| 2113 | ), |
| 2114 | |
| 2115 | TP_printk_btrfs( |
| 2116 | "io_tree=%s ino=%llu root=%llu start=%llu len=%llu clear_bits=%s" , |
| 2117 | __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, |
| 2118 | __entry->rootid, __entry->start, __entry->len, |
| 2119 | __print_flags(__entry->clear_bits, "|" , EXTENT_FLAGS)) |
| 2120 | ); |
| 2121 | |
| 2122 | TRACE_EVENT(btrfs_convert_extent_bit, |
| 2123 | TP_PROTO(const struct extent_io_tree *tree, |
| 2124 | u64 start, u64 len, unsigned set_bits, unsigned clear_bits), |
| 2125 | |
| 2126 | TP_ARGS(tree, start, len, set_bits, clear_bits), |
| 2127 | |
| 2128 | TP_STRUCT__entry_btrfs( |
| 2129 | __field( unsigned, owner ) |
| 2130 | __field( u64, ino ) |
| 2131 | __field( u64, rootid ) |
| 2132 | __field( u64, start ) |
| 2133 | __field( u64, len ) |
| 2134 | __field( unsigned, set_bits) |
| 2135 | __field( unsigned, clear_bits) |
| 2136 | ), |
| 2137 | |
| 2138 | TP_fast_assign_btrfs(btrfs_extent_io_tree_to_fs_info(tree), |
| 2139 | const struct btrfs_inode *inode = btrfs_extent_io_tree_to_inode(tree); |
| 2140 | |
| 2141 | __entry->owner = tree->owner; |
| 2142 | __entry->ino = inode ? btrfs_ino(inode) : 0; |
| 2143 | __entry->rootid = inode ? btrfs_root_id(inode->root) : 0; |
| 2144 | __entry->start = start; |
| 2145 | __entry->len = len; |
| 2146 | __entry->set_bits = set_bits; |
| 2147 | __entry->clear_bits = clear_bits; |
| 2148 | ), |
| 2149 | |
| 2150 | TP_printk_btrfs( |
| 2151 | "io_tree=%s ino=%llu root=%llu start=%llu len=%llu set_bits=%s clear_bits=%s" , |
| 2152 | __print_symbolic(__entry->owner, IO_TREE_OWNER), __entry->ino, |
| 2153 | __entry->rootid, __entry->start, __entry->len, |
| 2154 | __print_flags(__entry->set_bits , "|" , EXTENT_FLAGS), |
| 2155 | __print_flags(__entry->clear_bits, "|" , EXTENT_FLAGS)) |
| 2156 | ); |
| 2157 | |
| 2158 | DECLARE_EVENT_CLASS(btrfs_dump_space_info, |
| 2159 | TP_PROTO(struct btrfs_fs_info *fs_info, |
| 2160 | const struct btrfs_space_info *sinfo), |
| 2161 | |
| 2162 | TP_ARGS(fs_info, sinfo), |
| 2163 | |
| 2164 | TP_STRUCT__entry_btrfs( |
| 2165 | __field( u64, flags ) |
| 2166 | __field( u64, total_bytes ) |
| 2167 | __field( u64, bytes_used ) |
| 2168 | __field( u64, bytes_pinned ) |
| 2169 | __field( u64, bytes_reserved ) |
| 2170 | __field( u64, bytes_may_use ) |
| 2171 | __field( u64, bytes_readonly ) |
| 2172 | __field( u64, reclaim_size ) |
| 2173 | __field( int, clamp ) |
| 2174 | __field( u64, global_reserved ) |
| 2175 | __field( u64, trans_reserved ) |
| 2176 | __field( u64, delayed_refs_reserved ) |
| 2177 | __field( u64, delayed_reserved ) |
| 2178 | __field( u64, free_chunk_space ) |
| 2179 | __field( u64, delalloc_bytes ) |
| 2180 | __field( u64, ordered_bytes ) |
| 2181 | ), |
| 2182 | |
| 2183 | TP_fast_assign_btrfs(fs_info, |
| 2184 | __entry->flags = sinfo->flags; |
| 2185 | __entry->total_bytes = sinfo->total_bytes; |
| 2186 | __entry->bytes_used = sinfo->bytes_used; |
| 2187 | __entry->bytes_pinned = sinfo->bytes_pinned; |
| 2188 | __entry->bytes_reserved = sinfo->bytes_reserved; |
| 2189 | __entry->bytes_may_use = sinfo->bytes_may_use; |
| 2190 | __entry->bytes_readonly = sinfo->bytes_readonly; |
| 2191 | __entry->reclaim_size = sinfo->reclaim_size; |
| 2192 | __entry->clamp = sinfo->clamp; |
| 2193 | __entry->global_reserved = fs_info->global_block_rsv.reserved; |
| 2194 | __entry->trans_reserved = fs_info->trans_block_rsv.reserved; |
| 2195 | __entry->delayed_refs_reserved = fs_info->delayed_refs_rsv.reserved; |
| 2196 | __entry->delayed_reserved = fs_info->delayed_block_rsv.reserved; |
| 2197 | __entry->free_chunk_space = atomic64_read(&fs_info->free_chunk_space); |
| 2198 | __entry->delalloc_bytes = percpu_counter_sum_positive(&fs_info->delalloc_bytes); |
| 2199 | __entry->ordered_bytes = percpu_counter_sum_positive(&fs_info->ordered_bytes); |
| 2200 | ), |
| 2201 | |
| 2202 | TP_printk_btrfs("flags=%s total_bytes=%llu bytes_used=%llu " |
| 2203 | "bytes_pinned=%llu bytes_reserved=%llu " |
| 2204 | "bytes_may_use=%llu bytes_readonly=%llu " |
| 2205 | "reclaim_size=%llu clamp=%d global_reserved=%llu " |
| 2206 | "trans_reserved=%llu delayed_refs_reserved=%llu " |
| 2207 | "delayed_reserved=%llu chunk_free_space=%llu " |
| 2208 | "delalloc_bytes=%llu ordered_bytes=%llu" , |
| 2209 | __print_flags(__entry->flags, "|" , BTRFS_GROUP_FLAGS), |
| 2210 | __entry->total_bytes, __entry->bytes_used, |
| 2211 | __entry->bytes_pinned, __entry->bytes_reserved, |
| 2212 | __entry->bytes_may_use, __entry->bytes_readonly, |
| 2213 | __entry->reclaim_size, __entry->clamp, |
| 2214 | __entry->global_reserved, __entry->trans_reserved, |
| 2215 | __entry->delayed_refs_reserved, |
| 2216 | __entry->delayed_reserved, __entry->free_chunk_space, |
| 2217 | __entry->delalloc_bytes, __entry->ordered_bytes) |
| 2218 | ); |
| 2219 | |
| 2220 | DEFINE_EVENT(btrfs_dump_space_info, btrfs_done_preemptive_reclaim, |
| 2221 | TP_PROTO(struct btrfs_fs_info *fs_info, |
| 2222 | const struct btrfs_space_info *sinfo), |
| 2223 | TP_ARGS(fs_info, sinfo) |
| 2224 | ); |
| 2225 | |
| 2226 | DEFINE_EVENT(btrfs_dump_space_info, btrfs_fail_all_tickets, |
| 2227 | TP_PROTO(struct btrfs_fs_info *fs_info, |
| 2228 | const struct btrfs_space_info *sinfo), |
| 2229 | TP_ARGS(fs_info, sinfo) |
| 2230 | ); |
| 2231 | |
| 2232 | TRACE_EVENT(btrfs_reserve_ticket, |
| 2233 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 flags, u64 bytes, |
| 2234 | u64 start_ns, int flush, int error), |
| 2235 | |
| 2236 | TP_ARGS(fs_info, flags, bytes, start_ns, flush, error), |
| 2237 | |
| 2238 | TP_STRUCT__entry_btrfs( |
| 2239 | __field( u64, flags ) |
| 2240 | __field( u64, bytes ) |
| 2241 | __field( u64, start_ns ) |
| 2242 | __field( int, flush ) |
| 2243 | __field( int, error ) |
| 2244 | ), |
| 2245 | |
| 2246 | TP_fast_assign_btrfs(fs_info, |
| 2247 | __entry->flags = flags; |
| 2248 | __entry->bytes = bytes; |
| 2249 | __entry->start_ns = start_ns; |
| 2250 | __entry->flush = flush; |
| 2251 | __entry->error = error; |
| 2252 | ), |
| 2253 | |
| 2254 | TP_printk_btrfs("flags=%s bytes=%llu start_ns=%llu flush=%s error=%d" , |
| 2255 | __print_flags(__entry->flags, "|" , BTRFS_GROUP_FLAGS), |
| 2256 | __entry->bytes, __entry->start_ns, |
| 2257 | __print_symbolic(__entry->flush, FLUSH_ACTIONS), |
| 2258 | __entry->error) |
| 2259 | ); |
| 2260 | |
| 2261 | DECLARE_EVENT_CLASS(btrfs_sleep_tree_lock, |
| 2262 | TP_PROTO(const struct extent_buffer *eb, u64 start_ns), |
| 2263 | |
| 2264 | TP_ARGS(eb, start_ns), |
| 2265 | |
| 2266 | TP_STRUCT__entry_btrfs( |
| 2267 | __field( u64, block ) |
| 2268 | __field( u64, generation ) |
| 2269 | __field( u64, start_ns ) |
| 2270 | __field( u64, end_ns ) |
| 2271 | __field( u64, diff_ns ) |
| 2272 | __field( u64, owner ) |
| 2273 | __field( int, is_log_tree ) |
| 2274 | ), |
| 2275 | |
| 2276 | TP_fast_assign_btrfs(eb->fs_info, |
| 2277 | __entry->block = eb->start; |
| 2278 | __entry->generation = btrfs_header_generation(eb); |
| 2279 | __entry->start_ns = start_ns; |
| 2280 | __entry->end_ns = ktime_get_ns(); |
| 2281 | __entry->diff_ns = __entry->end_ns - start_ns; |
| 2282 | __entry->owner = btrfs_header_owner(eb); |
| 2283 | __entry->is_log_tree = (eb->log_index >= 0); |
| 2284 | ), |
| 2285 | |
| 2286 | TP_printk_btrfs( |
| 2287 | "block=%llu generation=%llu start_ns=%llu end_ns=%llu diff_ns=%llu owner=%llu is_log_tree=%d" , |
| 2288 | __entry->block, __entry->generation, |
| 2289 | __entry->start_ns, __entry->end_ns, __entry->diff_ns, |
| 2290 | __entry->owner, __entry->is_log_tree) |
| 2291 | ); |
| 2292 | |
| 2293 | DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_read_lock, |
| 2294 | TP_PROTO(const struct extent_buffer *eb, u64 start_ns), |
| 2295 | |
| 2296 | TP_ARGS(eb, start_ns) |
| 2297 | ); |
| 2298 | |
| 2299 | DEFINE_EVENT(btrfs_sleep_tree_lock, btrfs_tree_lock, |
| 2300 | TP_PROTO(const struct extent_buffer *eb, u64 start_ns), |
| 2301 | |
| 2302 | TP_ARGS(eb, start_ns) |
| 2303 | ); |
| 2304 | |
| 2305 | DECLARE_EVENT_CLASS(btrfs_locking_events, |
| 2306 | TP_PROTO(const struct extent_buffer *eb), |
| 2307 | |
| 2308 | TP_ARGS(eb), |
| 2309 | |
| 2310 | TP_STRUCT__entry_btrfs( |
| 2311 | __field( u64, block ) |
| 2312 | __field( u64, generation ) |
| 2313 | __field( u64, owner ) |
| 2314 | __field( int, is_log_tree ) |
| 2315 | ), |
| 2316 | |
| 2317 | TP_fast_assign_btrfs(eb->fs_info, |
| 2318 | __entry->block = eb->start; |
| 2319 | __entry->generation = btrfs_header_generation(eb); |
| 2320 | __entry->owner = btrfs_header_owner(eb); |
| 2321 | __entry->is_log_tree = (eb->log_index >= 0); |
| 2322 | ), |
| 2323 | |
| 2324 | TP_printk_btrfs("block=%llu generation=%llu owner=%llu is_log_tree=%d" , |
| 2325 | __entry->block, __entry->generation, |
| 2326 | __entry->owner, __entry->is_log_tree) |
| 2327 | ); |
| 2328 | |
| 2329 | #define DEFINE_BTRFS_LOCK_EVENT(name) \ |
| 2330 | DEFINE_EVENT(btrfs_locking_events, name, \ |
| 2331 | TP_PROTO(const struct extent_buffer *eb), \ |
| 2332 | \ |
| 2333 | TP_ARGS(eb) \ |
| 2334 | ) |
| 2335 | |
| 2336 | DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_unlock); |
| 2337 | DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock); |
| 2338 | DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock); |
| 2339 | |
| 2340 | DECLARE_EVENT_CLASS(btrfs__space_info_update, |
| 2341 | |
| 2342 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 2343 | const struct btrfs_space_info *sinfo, u64 old, s64 diff), |
| 2344 | |
| 2345 | TP_ARGS(fs_info, sinfo, old, diff), |
| 2346 | |
| 2347 | TP_STRUCT__entry_btrfs( |
| 2348 | __field( u64, type ) |
| 2349 | __field( u64, old ) |
| 2350 | __field( s64, diff ) |
| 2351 | ), |
| 2352 | |
| 2353 | TP_fast_assign_btrfs(fs_info, |
| 2354 | __entry->type = sinfo->flags; |
| 2355 | __entry->old = old; |
| 2356 | __entry->diff = diff; |
| 2357 | ), |
| 2358 | TP_printk_btrfs("type=%s old=%llu diff=%lld" , |
| 2359 | __print_flags(__entry->type, "|" , BTRFS_GROUP_FLAGS), |
| 2360 | __entry->old, __entry->diff) |
| 2361 | ); |
| 2362 | |
| 2363 | DEFINE_EVENT(btrfs__space_info_update, update_bytes_may_use, |
| 2364 | |
| 2365 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 2366 | const struct btrfs_space_info *sinfo, u64 old, s64 diff), |
| 2367 | |
| 2368 | TP_ARGS(fs_info, sinfo, old, diff) |
| 2369 | ); |
| 2370 | |
| 2371 | DEFINE_EVENT(btrfs__space_info_update, update_bytes_pinned, |
| 2372 | |
| 2373 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 2374 | const struct btrfs_space_info *sinfo, u64 old, s64 diff), |
| 2375 | |
| 2376 | TP_ARGS(fs_info, sinfo, old, diff) |
| 2377 | ); |
| 2378 | |
| 2379 | DEFINE_EVENT(btrfs__space_info_update, update_bytes_zone_unusable, |
| 2380 | |
| 2381 | TP_PROTO(const struct btrfs_fs_info *fs_info, |
| 2382 | const struct btrfs_space_info *sinfo, u64 old, s64 diff), |
| 2383 | |
| 2384 | TP_ARGS(fs_info, sinfo, old, diff) |
| 2385 | ); |
| 2386 | |
| 2387 | DECLARE_EVENT_CLASS(btrfs_raid56_bio, |
| 2388 | |
| 2389 | TP_PROTO(const struct btrfs_raid_bio *rbio, |
| 2390 | const struct bio *bio, |
| 2391 | const struct raid56_bio_trace_info *trace_info), |
| 2392 | |
| 2393 | TP_ARGS(rbio, bio, trace_info), |
| 2394 | |
| 2395 | TP_STRUCT__entry_btrfs( |
| 2396 | __field( u64, full_stripe ) |
| 2397 | __field( u64, physical ) |
| 2398 | __field( u64, devid ) |
| 2399 | __field( u32, offset ) |
| 2400 | __field( u32, len ) |
| 2401 | __field( u8, opf ) |
| 2402 | __field( u8, total_stripes ) |
| 2403 | __field( u8, real_stripes ) |
| 2404 | __field( u8, nr_data ) |
| 2405 | __field( u8, stripe_nr ) |
| 2406 | ), |
| 2407 | |
| 2408 | TP_fast_assign_btrfs(rbio->bioc->fs_info, |
| 2409 | __entry->full_stripe = rbio->bioc->full_stripe_logical; |
| 2410 | __entry->physical = bio->bi_iter.bi_sector << SECTOR_SHIFT; |
| 2411 | __entry->len = bio->bi_iter.bi_size; |
| 2412 | __entry->opf = bio_op(bio); |
| 2413 | __entry->devid = trace_info->devid; |
| 2414 | __entry->offset = trace_info->offset; |
| 2415 | __entry->stripe_nr = trace_info->stripe_nr; |
| 2416 | __entry->total_stripes = rbio->bioc->num_stripes; |
| 2417 | __entry->real_stripes = rbio->real_stripes; |
| 2418 | __entry->nr_data = rbio->nr_data; |
| 2419 | ), |
| 2420 | /* |
| 2421 | * For type output, we need to output things like "DATA1" |
| 2422 | * (the first data stripe), "DATA2" (the second data stripe), |
| 2423 | * "PQ1" (P stripe),"PQ2" (Q stripe), "REPLACE0" (replace target device). |
| 2424 | */ |
| 2425 | TP_printk_btrfs( |
| 2426 | "full_stripe=%llu devid=%lld type=%s%d offset=%d opf=0x%x physical=%llu len=%u" , |
| 2427 | __entry->full_stripe, __entry->devid, |
| 2428 | (__entry->stripe_nr < __entry->nr_data) ? "DATA" : |
| 2429 | ((__entry->stripe_nr < __entry->real_stripes) ? "PQ" : |
| 2430 | "REPLACE" ), |
| 2431 | (__entry->stripe_nr < __entry->nr_data) ? |
| 2432 | (__entry->stripe_nr + 1) : |
| 2433 | ((__entry->stripe_nr < __entry->real_stripes) ? |
| 2434 | (__entry->stripe_nr - __entry->nr_data + 1) : 0), |
| 2435 | __entry->offset, __entry->opf, __entry->physical, __entry->len) |
| 2436 | ); |
| 2437 | |
| 2438 | DEFINE_EVENT(btrfs_raid56_bio, raid56_read, |
| 2439 | TP_PROTO(const struct btrfs_raid_bio *rbio, |
| 2440 | const struct bio *bio, |
| 2441 | const struct raid56_bio_trace_info *trace_info), |
| 2442 | |
| 2443 | TP_ARGS(rbio, bio, trace_info) |
| 2444 | ); |
| 2445 | |
| 2446 | DEFINE_EVENT(btrfs_raid56_bio, raid56_write, |
| 2447 | TP_PROTO(const struct btrfs_raid_bio *rbio, |
| 2448 | const struct bio *bio, |
| 2449 | const struct raid56_bio_trace_info *trace_info), |
| 2450 | |
| 2451 | TP_ARGS(rbio, bio, trace_info) |
| 2452 | ); |
| 2453 | |
| 2454 | TRACE_EVENT(btrfs_insert_one_raid_extent, |
| 2455 | |
| 2456 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 logical, u64 length, |
| 2457 | int num_stripes), |
| 2458 | |
| 2459 | TP_ARGS(fs_info, logical, length, num_stripes), |
| 2460 | |
| 2461 | TP_STRUCT__entry_btrfs( |
| 2462 | __field( u64, logical ) |
| 2463 | __field( u64, length ) |
| 2464 | __field( int, num_stripes ) |
| 2465 | ), |
| 2466 | |
| 2467 | TP_fast_assign_btrfs(fs_info, |
| 2468 | __entry->logical = logical; |
| 2469 | __entry->length = length; |
| 2470 | __entry->num_stripes = num_stripes; |
| 2471 | ), |
| 2472 | |
| 2473 | TP_printk_btrfs("logical=%llu length=%llu num_stripes=%d" , |
| 2474 | __entry->logical, __entry->length, |
| 2475 | __entry->num_stripes) |
| 2476 | ); |
| 2477 | |
| 2478 | TRACE_EVENT(btrfs_raid_extent_delete, |
| 2479 | |
| 2480 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 end, |
| 2481 | u64 found_start, u64 found_end), |
| 2482 | |
| 2483 | TP_ARGS(fs_info, start, end, found_start, found_end), |
| 2484 | |
| 2485 | TP_STRUCT__entry_btrfs( |
| 2486 | __field( u64, start ) |
| 2487 | __field( u64, end ) |
| 2488 | __field( u64, found_start ) |
| 2489 | __field( u64, found_end ) |
| 2490 | ), |
| 2491 | |
| 2492 | TP_fast_assign_btrfs(fs_info, |
| 2493 | __entry->start = start; |
| 2494 | __entry->end = end; |
| 2495 | __entry->found_start = found_start; |
| 2496 | __entry->found_end = found_end; |
| 2497 | ), |
| 2498 | |
| 2499 | TP_printk_btrfs("start=%llu end=%llu found_start=%llu found_end=%llu" , |
| 2500 | __entry->start, __entry->end, __entry->found_start, |
| 2501 | __entry->found_end) |
| 2502 | ); |
| 2503 | |
| 2504 | TRACE_EVENT(btrfs_get_raid_extent_offset, |
| 2505 | |
| 2506 | TP_PROTO(const struct btrfs_fs_info *fs_info, u64 logical, u64 length, |
| 2507 | u64 physical, u64 devid), |
| 2508 | |
| 2509 | TP_ARGS(fs_info, logical, length, physical, devid), |
| 2510 | |
| 2511 | TP_STRUCT__entry_btrfs( |
| 2512 | __field( u64, logical ) |
| 2513 | __field( u64, length ) |
| 2514 | __field( u64, physical ) |
| 2515 | __field( u64, devid ) |
| 2516 | ), |
| 2517 | |
| 2518 | TP_fast_assign_btrfs(fs_info, |
| 2519 | __entry->logical = logical; |
| 2520 | __entry->length = length; |
| 2521 | __entry->physical = physical; |
| 2522 | __entry->devid = devid; |
| 2523 | ), |
| 2524 | |
| 2525 | TP_printk_btrfs("logical=%llu length=%llu physical=%llu devid=%llu" , |
| 2526 | __entry->logical, __entry->length, __entry->physical, |
| 2527 | __entry->devid) |
| 2528 | ); |
| 2529 | |
| 2530 | TRACE_EVENT(btrfs_extent_map_shrinker_count, |
| 2531 | |
| 2532 | TP_PROTO(const struct btrfs_fs_info *fs_info, long nr), |
| 2533 | |
| 2534 | TP_ARGS(fs_info, nr), |
| 2535 | |
| 2536 | TP_STRUCT__entry_btrfs( |
| 2537 | __field( long, nr ) |
| 2538 | ), |
| 2539 | |
| 2540 | TP_fast_assign_btrfs(fs_info, |
| 2541 | __entry->nr = nr; |
| 2542 | ), |
| 2543 | |
| 2544 | TP_printk_btrfs("nr=%ld" , __entry->nr) |
| 2545 | ); |
| 2546 | |
| 2547 | TRACE_EVENT(btrfs_extent_map_shrinker_scan_enter, |
| 2548 | |
| 2549 | TP_PROTO(const struct btrfs_fs_info *fs_info, long nr), |
| 2550 | |
| 2551 | TP_ARGS(fs_info, nr), |
| 2552 | |
| 2553 | TP_STRUCT__entry_btrfs( |
| 2554 | __field( long, nr_to_scan ) |
| 2555 | __field( long, nr ) |
| 2556 | __field( u64, last_root_id ) |
| 2557 | __field( u64, last_ino ) |
| 2558 | ), |
| 2559 | |
| 2560 | TP_fast_assign_btrfs(fs_info, |
| 2561 | __entry->nr_to_scan = \ |
| 2562 | atomic64_read(&fs_info->em_shrinker_nr_to_scan); |
| 2563 | __entry->nr = nr; |
| 2564 | __entry->last_root_id = fs_info->em_shrinker_last_root; |
| 2565 | __entry->last_ino = fs_info->em_shrinker_last_ino; |
| 2566 | ), |
| 2567 | |
| 2568 | TP_printk_btrfs("nr_to_scan=%ld nr=%ld last_root=%llu(%s) last_ino=%llu" , |
| 2569 | __entry->nr_to_scan, __entry->nr, |
| 2570 | show_root_type(__entry->last_root_id), __entry->last_ino) |
| 2571 | ); |
| 2572 | |
| 2573 | TRACE_EVENT(btrfs_extent_map_shrinker_scan_exit, |
| 2574 | |
| 2575 | TP_PROTO(const struct btrfs_fs_info *fs_info, long nr_dropped, long nr), |
| 2576 | |
| 2577 | TP_ARGS(fs_info, nr_dropped, nr), |
| 2578 | |
| 2579 | TP_STRUCT__entry_btrfs( |
| 2580 | __field( long, nr_dropped ) |
| 2581 | __field( long, nr ) |
| 2582 | __field( u64, last_root_id ) |
| 2583 | __field( u64, last_ino ) |
| 2584 | ), |
| 2585 | |
| 2586 | TP_fast_assign_btrfs(fs_info, |
| 2587 | __entry->nr_dropped = nr_dropped; |
| 2588 | __entry->nr = nr; |
| 2589 | __entry->last_root_id = fs_info->em_shrinker_last_root; |
| 2590 | __entry->last_ino = fs_info->em_shrinker_last_ino; |
| 2591 | ), |
| 2592 | |
| 2593 | TP_printk_btrfs("nr_dropped=%ld nr=%ld last_root=%llu(%s) last_ino=%llu" , |
| 2594 | __entry->nr_dropped, __entry->nr, |
| 2595 | show_root_type(__entry->last_root_id), __entry->last_ino) |
| 2596 | ); |
| 2597 | |
| 2598 | TRACE_EVENT(btrfs_extent_map_shrinker_remove_em, |
| 2599 | |
| 2600 | TP_PROTO(const struct btrfs_inode *inode, const struct extent_map *em), |
| 2601 | |
| 2602 | TP_ARGS(inode, em), |
| 2603 | |
| 2604 | TP_STRUCT__entry_btrfs( |
| 2605 | __field( u64, ino ) |
| 2606 | __field( u64, root_id ) |
| 2607 | __field( u64, start ) |
| 2608 | __field( u64, len ) |
| 2609 | __field( u32, flags ) |
| 2610 | ), |
| 2611 | |
| 2612 | TP_fast_assign_btrfs(inode->root->fs_info, |
| 2613 | __entry->ino = btrfs_ino(inode); |
| 2614 | __entry->root_id = btrfs_root_id(inode->root); |
| 2615 | __entry->start = em->start; |
| 2616 | __entry->len = em->len; |
| 2617 | __entry->flags = em->flags; |
| 2618 | ), |
| 2619 | |
| 2620 | TP_printk_btrfs("ino=%llu root=%llu(%s) start=%llu len=%llu flags=%s" , |
| 2621 | __entry->ino, show_root_type(__entry->root_id), |
| 2622 | __entry->start, __entry->len, |
| 2623 | show_map_flags(__entry->flags)) |
| 2624 | ); |
| 2625 | |
| 2626 | #endif /* _TRACE_BTRFS_H */ |
| 2627 | |
| 2628 | /* This part must be outside protection */ |
| 2629 | #include <trace/define_trace.h> |
| 2630 | |