liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM btrfs |
| 3 | |
| 4 | #if !defined(_TRACE_BTRFS_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define _TRACE_BTRFS_H |
| 6 | |
| 7 | #include <linux/writeback.h> |
| 8 | #include <linux/tracepoint.h> |
| 9 | |
| 10 | struct btrfs_root; |
| 11 | struct btrfs_fs_info; |
| 12 | struct btrfs_inode; |
| 13 | struct extent_map; |
| 14 | struct btrfs_ordered_extent; |
| 15 | struct btrfs_delayed_ref_node; |
| 16 | struct btrfs_delayed_tree_ref; |
| 17 | struct btrfs_delayed_data_ref; |
| 18 | struct btrfs_delayed_ref_head; |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame^] | 19 | struct btrfs_block_group_cache; |
| 20 | struct btrfs_free_cluster; |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 21 | struct map_lookup; |
| 22 | struct extent_buffer; |
| 23 | |
| 24 | #define show_ref_type(type) \ |
| 25 | __print_symbolic(type, \ |
| 26 | { BTRFS_TREE_BLOCK_REF_KEY, "TREE_BLOCK_REF" }, \ |
| 27 | { BTRFS_EXTENT_DATA_REF_KEY, "EXTENT_DATA_REF" }, \ |
| 28 | { BTRFS_EXTENT_REF_V0_KEY, "EXTENT_REF_V0" }, \ |
| 29 | { BTRFS_SHARED_BLOCK_REF_KEY, "SHARED_BLOCK_REF" }, \ |
| 30 | { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) |
| 31 | |
| 32 | #define __show_root_type(obj) \ |
liubo | 7f34b74 | 2011-04-19 09:35:31 +0800 | [diff] [blame] | 33 | __print_symbolic_u64(obj, \ |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 34 | { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ |
| 35 | { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ |
| 36 | { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ |
| 37 | { BTRFS_DEV_TREE_OBJECTID, "DEV_TREE" }, \ |
| 38 | { BTRFS_FS_TREE_OBJECTID, "FS_TREE" }, \ |
| 39 | { BTRFS_ROOT_TREE_DIR_OBJECTID, "ROOT_TREE_DIR" }, \ |
| 40 | { BTRFS_CSUM_TREE_OBJECTID, "CSUM_TREE" }, \ |
| 41 | { BTRFS_TREE_LOG_OBJECTID, "TREE_LOG" }, \ |
| 42 | { BTRFS_TREE_RELOC_OBJECTID, "TREE_RELOC" }, \ |
| 43 | { BTRFS_DATA_RELOC_TREE_OBJECTID, "DATA_RELOC_TREE" }) |
| 44 | |
| 45 | #define show_root_type(obj) \ |
| 46 | obj, ((obj >= BTRFS_DATA_RELOC_TREE_OBJECTID) || \ |
| 47 | (obj <= BTRFS_CSUM_TREE_OBJECTID )) ? __show_root_type(obj) : "-" |
| 48 | |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame^] | 49 | #define BTRFS_GROUP_FLAGS \ |
| 50 | { BTRFS_BLOCK_GROUP_DATA, "DATA"}, \ |
| 51 | { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ |
| 52 | { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ |
| 53 | { BTRFS_BLOCK_GROUP_RAID0, "RAID0"}, \ |
| 54 | { BTRFS_BLOCK_GROUP_RAID1, "RAID1"}, \ |
| 55 | { BTRFS_BLOCK_GROUP_DUP, "DUP"}, \ |
| 56 | { BTRFS_BLOCK_GROUP_RAID10, "RAID10"} |
| 57 | |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 58 | TRACE_EVENT(btrfs_transaction_commit, |
| 59 | |
| 60 | TP_PROTO(struct btrfs_root *root), |
| 61 | |
| 62 | TP_ARGS(root), |
| 63 | |
| 64 | TP_STRUCT__entry( |
| 65 | __field( u64, generation ) |
| 66 | __field( u64, root_objectid ) |
| 67 | ), |
| 68 | |
| 69 | TP_fast_assign( |
| 70 | __entry->generation = root->fs_info->generation; |
| 71 | __entry->root_objectid = root->root_key.objectid; |
| 72 | ), |
| 73 | |
| 74 | TP_printk("root = %llu(%s), gen = %llu", |
| 75 | show_root_type(__entry->root_objectid), |
| 76 | (unsigned long long)__entry->generation) |
| 77 | ); |
| 78 | |
| 79 | DECLARE_EVENT_CLASS(btrfs__inode, |
| 80 | |
| 81 | TP_PROTO(struct inode *inode), |
| 82 | |
| 83 | TP_ARGS(inode), |
| 84 | |
| 85 | TP_STRUCT__entry( |
| 86 | __field( ino_t, ino ) |
| 87 | __field( blkcnt_t, blocks ) |
| 88 | __field( u64, disk_i_size ) |
| 89 | __field( u64, generation ) |
| 90 | __field( u64, last_trans ) |
| 91 | __field( u64, logged_trans ) |
| 92 | __field( u64, root_objectid ) |
| 93 | ), |
| 94 | |
| 95 | TP_fast_assign( |
| 96 | __entry->ino = inode->i_ino; |
| 97 | __entry->blocks = inode->i_blocks; |
| 98 | __entry->disk_i_size = BTRFS_I(inode)->disk_i_size; |
| 99 | __entry->generation = BTRFS_I(inode)->generation; |
| 100 | __entry->last_trans = BTRFS_I(inode)->last_trans; |
| 101 | __entry->logged_trans = BTRFS_I(inode)->logged_trans; |
| 102 | __entry->root_objectid = |
| 103 | BTRFS_I(inode)->root->root_key.objectid; |
| 104 | ), |
| 105 | |
| 106 | TP_printk("root = %llu(%s), gen = %llu, ino = %lu, blocks = %llu, " |
| 107 | "disk_i_size = %llu, last_trans = %llu, logged_trans = %llu", |
| 108 | show_root_type(__entry->root_objectid), |
| 109 | (unsigned long long)__entry->generation, |
| 110 | (unsigned long)__entry->ino, |
| 111 | (unsigned long long)__entry->blocks, |
| 112 | (unsigned long long)__entry->disk_i_size, |
| 113 | (unsigned long long)__entry->last_trans, |
| 114 | (unsigned long long)__entry->logged_trans) |
| 115 | ); |
| 116 | |
| 117 | DEFINE_EVENT(btrfs__inode, btrfs_inode_new, |
| 118 | |
| 119 | TP_PROTO(struct inode *inode), |
| 120 | |
| 121 | TP_ARGS(inode) |
| 122 | ); |
| 123 | |
| 124 | DEFINE_EVENT(btrfs__inode, btrfs_inode_request, |
| 125 | |
| 126 | TP_PROTO(struct inode *inode), |
| 127 | |
| 128 | TP_ARGS(inode) |
| 129 | ); |
| 130 | |
| 131 | DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, |
| 132 | |
| 133 | TP_PROTO(struct inode *inode), |
| 134 | |
| 135 | TP_ARGS(inode) |
| 136 | ); |
| 137 | |
| 138 | #define __show_map_type(type) \ |
liubo | 7f34b74 | 2011-04-19 09:35:31 +0800 | [diff] [blame] | 139 | __print_symbolic_u64(type, \ |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 140 | { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ |
| 141 | { EXTENT_MAP_HOLE, "HOLE" }, \ |
| 142 | { EXTENT_MAP_INLINE, "INLINE" }, \ |
| 143 | { EXTENT_MAP_DELALLOC, "DELALLOC" }) |
| 144 | |
| 145 | #define show_map_type(type) \ |
| 146 | type, (type >= EXTENT_MAP_LAST_BYTE) ? "-" : __show_map_type(type) |
| 147 | |
| 148 | #define show_map_flags(flag) \ |
| 149 | __print_flags(flag, "|", \ |
| 150 | { EXTENT_FLAG_PINNED, "PINNED" }, \ |
| 151 | { EXTENT_FLAG_COMPRESSED, "COMPRESSED" }, \ |
| 152 | { EXTENT_FLAG_VACANCY, "VACANCY" }, \ |
| 153 | { EXTENT_FLAG_PREALLOC, "PREALLOC" }) |
| 154 | |
| 155 | TRACE_EVENT(btrfs_get_extent, |
| 156 | |
| 157 | TP_PROTO(struct btrfs_root *root, struct extent_map *map), |
| 158 | |
| 159 | TP_ARGS(root, map), |
| 160 | |
| 161 | TP_STRUCT__entry( |
| 162 | __field( u64, root_objectid ) |
| 163 | __field( u64, start ) |
| 164 | __field( u64, len ) |
| 165 | __field( u64, orig_start ) |
| 166 | __field( u64, block_start ) |
| 167 | __field( u64, block_len ) |
| 168 | __field( unsigned long, flags ) |
| 169 | __field( int, refs ) |
| 170 | __field( unsigned int, compress_type ) |
| 171 | ), |
| 172 | |
| 173 | TP_fast_assign( |
| 174 | __entry->root_objectid = root->root_key.objectid; |
| 175 | __entry->start = map->start; |
| 176 | __entry->len = map->len; |
| 177 | __entry->orig_start = map->orig_start; |
| 178 | __entry->block_start = map->block_start; |
| 179 | __entry->block_len = map->block_len; |
| 180 | __entry->flags = map->flags; |
| 181 | __entry->refs = atomic_read(&map->refs); |
| 182 | __entry->compress_type = map->compress_type; |
| 183 | ), |
| 184 | |
| 185 | TP_printk("root = %llu(%s), start = %llu, len = %llu, " |
| 186 | "orig_start = %llu, block_start = %llu(%s), " |
| 187 | "block_len = %llu, flags = %s, refs = %u, " |
| 188 | "compress_type = %u", |
| 189 | show_root_type(__entry->root_objectid), |
| 190 | (unsigned long long)__entry->start, |
| 191 | (unsigned long long)__entry->len, |
| 192 | (unsigned long long)__entry->orig_start, |
| 193 | show_map_type(__entry->block_start), |
| 194 | (unsigned long long)__entry->block_len, |
| 195 | show_map_flags(__entry->flags), |
| 196 | __entry->refs, __entry->compress_type) |
| 197 | ); |
| 198 | |
| 199 | #define show_ordered_flags(flags) \ |
| 200 | __print_symbolic(flags, \ |
| 201 | { BTRFS_ORDERED_IO_DONE, "IO_DONE" }, \ |
| 202 | { BTRFS_ORDERED_COMPLETE, "COMPLETE" }, \ |
| 203 | { BTRFS_ORDERED_NOCOW, "NOCOW" }, \ |
| 204 | { BTRFS_ORDERED_COMPRESSED, "COMPRESSED" }, \ |
| 205 | { BTRFS_ORDERED_PREALLOC, "PREALLOC" }, \ |
| 206 | { BTRFS_ORDERED_DIRECT, "DIRECT" }) |
| 207 | |
| 208 | DECLARE_EVENT_CLASS(btrfs__ordered_extent, |
| 209 | |
| 210 | TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), |
| 211 | |
| 212 | TP_ARGS(inode, ordered), |
| 213 | |
| 214 | TP_STRUCT__entry( |
| 215 | __field( ino_t, ino ) |
| 216 | __field( u64, file_offset ) |
| 217 | __field( u64, start ) |
| 218 | __field( u64, len ) |
| 219 | __field( u64, disk_len ) |
| 220 | __field( u64, bytes_left ) |
| 221 | __field( unsigned long, flags ) |
| 222 | __field( int, compress_type ) |
| 223 | __field( int, refs ) |
| 224 | __field( u64, root_objectid ) |
| 225 | ), |
| 226 | |
| 227 | TP_fast_assign( |
| 228 | __entry->ino = inode->i_ino; |
| 229 | __entry->file_offset = ordered->file_offset; |
| 230 | __entry->start = ordered->start; |
| 231 | __entry->len = ordered->len; |
| 232 | __entry->disk_len = ordered->disk_len; |
| 233 | __entry->bytes_left = ordered->bytes_left; |
| 234 | __entry->flags = ordered->flags; |
| 235 | __entry->compress_type = ordered->compress_type; |
| 236 | __entry->refs = atomic_read(&ordered->refs); |
| 237 | __entry->root_objectid = |
| 238 | BTRFS_I(inode)->root->root_key.objectid; |
| 239 | ), |
| 240 | |
| 241 | TP_printk("root = %llu(%s), ino = %llu, file_offset = %llu, " |
| 242 | "start = %llu, len = %llu, disk_len = %llu, " |
| 243 | "bytes_left = %llu, flags = %s, compress_type = %d, " |
| 244 | "refs = %d", |
| 245 | show_root_type(__entry->root_objectid), |
| 246 | (unsigned long long)__entry->ino, |
| 247 | (unsigned long long)__entry->file_offset, |
| 248 | (unsigned long long)__entry->start, |
| 249 | (unsigned long long)__entry->len, |
| 250 | (unsigned long long)__entry->disk_len, |
| 251 | (unsigned long long)__entry->bytes_left, |
| 252 | show_ordered_flags(__entry->flags), |
| 253 | __entry->compress_type, __entry->refs) |
| 254 | ); |
| 255 | |
| 256 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_add, |
| 257 | |
| 258 | TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), |
| 259 | |
| 260 | TP_ARGS(inode, ordered) |
| 261 | ); |
| 262 | |
| 263 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_remove, |
| 264 | |
| 265 | TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), |
| 266 | |
| 267 | TP_ARGS(inode, ordered) |
| 268 | ); |
| 269 | |
| 270 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_start, |
| 271 | |
| 272 | TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), |
| 273 | |
| 274 | TP_ARGS(inode, ordered) |
| 275 | ); |
| 276 | |
| 277 | DEFINE_EVENT(btrfs__ordered_extent, btrfs_ordered_extent_put, |
| 278 | |
| 279 | TP_PROTO(struct inode *inode, struct btrfs_ordered_extent *ordered), |
| 280 | |
| 281 | TP_ARGS(inode, ordered) |
| 282 | ); |
| 283 | |
| 284 | DECLARE_EVENT_CLASS(btrfs__writepage, |
| 285 | |
| 286 | TP_PROTO(struct page *page, struct inode *inode, |
| 287 | struct writeback_control *wbc), |
| 288 | |
| 289 | TP_ARGS(page, inode, wbc), |
| 290 | |
| 291 | TP_STRUCT__entry( |
| 292 | __field( ino_t, ino ) |
| 293 | __field( pgoff_t, index ) |
| 294 | __field( long, nr_to_write ) |
| 295 | __field( long, pages_skipped ) |
| 296 | __field( loff_t, range_start ) |
| 297 | __field( loff_t, range_end ) |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 298 | __field( char, for_kupdate ) |
| 299 | __field( char, for_reclaim ) |
| 300 | __field( char, range_cyclic ) |
| 301 | __field( pgoff_t, writeback_index ) |
| 302 | __field( u64, root_objectid ) |
| 303 | ), |
| 304 | |
| 305 | TP_fast_assign( |
| 306 | __entry->ino = inode->i_ino; |
| 307 | __entry->index = page->index; |
| 308 | __entry->nr_to_write = wbc->nr_to_write; |
| 309 | __entry->pages_skipped = wbc->pages_skipped; |
| 310 | __entry->range_start = wbc->range_start; |
| 311 | __entry->range_end = wbc->range_end; |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 312 | __entry->for_kupdate = wbc->for_kupdate; |
| 313 | __entry->for_reclaim = wbc->for_reclaim; |
| 314 | __entry->range_cyclic = wbc->range_cyclic; |
| 315 | __entry->writeback_index = inode->i_mapping->writeback_index; |
| 316 | __entry->root_objectid = |
| 317 | BTRFS_I(inode)->root->root_key.objectid; |
| 318 | ), |
| 319 | |
| 320 | TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, " |
| 321 | "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, " |
Wu Fengguang | 846d5a0 | 2011-05-05 21:10:38 -0600 | [diff] [blame] | 322 | "range_end = %llu, for_kupdate = %d, " |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 323 | "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu", |
| 324 | show_root_type(__entry->root_objectid), |
| 325 | (unsigned long)__entry->ino, __entry->index, |
| 326 | __entry->nr_to_write, __entry->pages_skipped, |
| 327 | __entry->range_start, __entry->range_end, |
Wu Fengguang | 846d5a0 | 2011-05-05 21:10:38 -0600 | [diff] [blame] | 328 | __entry->for_kupdate, |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 329 | __entry->for_reclaim, __entry->range_cyclic, |
| 330 | (unsigned long)__entry->writeback_index) |
| 331 | ); |
| 332 | |
| 333 | DEFINE_EVENT(btrfs__writepage, __extent_writepage, |
| 334 | |
| 335 | TP_PROTO(struct page *page, struct inode *inode, |
| 336 | struct writeback_control *wbc), |
| 337 | |
| 338 | TP_ARGS(page, inode, wbc) |
| 339 | ); |
| 340 | |
| 341 | TRACE_EVENT(btrfs_writepage_end_io_hook, |
| 342 | |
| 343 | TP_PROTO(struct page *page, u64 start, u64 end, int uptodate), |
| 344 | |
| 345 | TP_ARGS(page, start, end, uptodate), |
| 346 | |
| 347 | TP_STRUCT__entry( |
| 348 | __field( ino_t, ino ) |
| 349 | __field( pgoff_t, index ) |
| 350 | __field( u64, start ) |
| 351 | __field( u64, end ) |
| 352 | __field( int, uptodate ) |
| 353 | __field( u64, root_objectid ) |
| 354 | ), |
| 355 | |
| 356 | TP_fast_assign( |
| 357 | __entry->ino = page->mapping->host->i_ino; |
| 358 | __entry->index = page->index; |
| 359 | __entry->start = start; |
| 360 | __entry->end = end; |
| 361 | __entry->uptodate = uptodate; |
| 362 | __entry->root_objectid = |
| 363 | BTRFS_I(page->mapping->host)->root->root_key.objectid; |
| 364 | ), |
| 365 | |
| 366 | TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, start = %llu, " |
| 367 | "end = %llu, uptodate = %d", |
| 368 | show_root_type(__entry->root_objectid), |
| 369 | (unsigned long)__entry->ino, (unsigned long)__entry->index, |
| 370 | (unsigned long long)__entry->start, |
| 371 | (unsigned long long)__entry->end, __entry->uptodate) |
| 372 | ); |
| 373 | |
| 374 | TRACE_EVENT(btrfs_sync_file, |
| 375 | |
| 376 | TP_PROTO(struct file *file, int datasync), |
| 377 | |
| 378 | TP_ARGS(file, datasync), |
| 379 | |
| 380 | TP_STRUCT__entry( |
| 381 | __field( ino_t, ino ) |
| 382 | __field( ino_t, parent ) |
| 383 | __field( int, datasync ) |
| 384 | __field( u64, root_objectid ) |
| 385 | ), |
| 386 | |
| 387 | TP_fast_assign( |
| 388 | struct dentry *dentry = file->f_path.dentry; |
| 389 | struct inode *inode = dentry->d_inode; |
| 390 | |
| 391 | __entry->ino = inode->i_ino; |
| 392 | __entry->parent = dentry->d_parent->d_inode->i_ino; |
| 393 | __entry->datasync = datasync; |
| 394 | __entry->root_objectid = |
| 395 | BTRFS_I(inode)->root->root_key.objectid; |
| 396 | ), |
| 397 | |
| 398 | TP_printk("root = %llu(%s), ino = %ld, parent = %ld, datasync = %d", |
| 399 | show_root_type(__entry->root_objectid), |
| 400 | (unsigned long)__entry->ino, (unsigned long)__entry->parent, |
| 401 | __entry->datasync) |
| 402 | ); |
| 403 | |
| 404 | TRACE_EVENT(btrfs_sync_fs, |
| 405 | |
| 406 | TP_PROTO(int wait), |
| 407 | |
| 408 | TP_ARGS(wait), |
| 409 | |
| 410 | TP_STRUCT__entry( |
| 411 | __field( int, wait ) |
| 412 | ), |
| 413 | |
| 414 | TP_fast_assign( |
| 415 | __entry->wait = wait; |
| 416 | ), |
| 417 | |
| 418 | TP_printk("wait = %d", __entry->wait) |
| 419 | ); |
| 420 | |
| 421 | #define show_ref_action(action) \ |
| 422 | __print_symbolic(action, \ |
| 423 | { BTRFS_ADD_DELAYED_REF, "ADD_DELAYED_REF" }, \ |
| 424 | { BTRFS_DROP_DELAYED_REF, "DROP_DELAYED_REF" }, \ |
| 425 | { BTRFS_ADD_DELAYED_EXTENT, "ADD_DELAYED_EXTENT" }, \ |
| 426 | { BTRFS_UPDATE_DELAYED_HEAD, "UPDATE_DELAYED_HEAD" }) |
| 427 | |
| 428 | |
| 429 | TRACE_EVENT(btrfs_delayed_tree_ref, |
| 430 | |
| 431 | TP_PROTO(struct btrfs_delayed_ref_node *ref, |
| 432 | struct btrfs_delayed_tree_ref *full_ref, |
| 433 | int action), |
| 434 | |
| 435 | TP_ARGS(ref, full_ref, action), |
| 436 | |
| 437 | TP_STRUCT__entry( |
| 438 | __field( u64, bytenr ) |
| 439 | __field( u64, num_bytes ) |
| 440 | __field( int, action ) |
| 441 | __field( u64, parent ) |
| 442 | __field( u64, ref_root ) |
| 443 | __field( int, level ) |
| 444 | __field( int, type ) |
| 445 | ), |
| 446 | |
| 447 | TP_fast_assign( |
| 448 | __entry->bytenr = ref->bytenr; |
| 449 | __entry->num_bytes = ref->num_bytes; |
| 450 | __entry->action = action; |
| 451 | __entry->parent = full_ref->parent; |
| 452 | __entry->ref_root = full_ref->root; |
| 453 | __entry->level = full_ref->level; |
| 454 | __entry->type = ref->type; |
| 455 | ), |
| 456 | |
| 457 | TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " |
| 458 | "parent = %llu(%s), ref_root = %llu(%s), level = %d, " |
| 459 | "type = %s", |
| 460 | (unsigned long long)__entry->bytenr, |
| 461 | (unsigned long long)__entry->num_bytes, |
| 462 | show_ref_action(__entry->action), |
| 463 | show_root_type(__entry->parent), |
| 464 | show_root_type(__entry->ref_root), |
| 465 | __entry->level, show_ref_type(__entry->type)) |
| 466 | ); |
| 467 | |
| 468 | TRACE_EVENT(btrfs_delayed_data_ref, |
| 469 | |
| 470 | TP_PROTO(struct btrfs_delayed_ref_node *ref, |
| 471 | struct btrfs_delayed_data_ref *full_ref, |
| 472 | int action), |
| 473 | |
| 474 | TP_ARGS(ref, full_ref, action), |
| 475 | |
| 476 | TP_STRUCT__entry( |
| 477 | __field( u64, bytenr ) |
| 478 | __field( u64, num_bytes ) |
| 479 | __field( int, action ) |
| 480 | __field( u64, parent ) |
| 481 | __field( u64, ref_root ) |
| 482 | __field( u64, owner ) |
| 483 | __field( u64, offset ) |
| 484 | __field( int, type ) |
| 485 | ), |
| 486 | |
| 487 | TP_fast_assign( |
| 488 | __entry->bytenr = ref->bytenr; |
| 489 | __entry->num_bytes = ref->num_bytes; |
| 490 | __entry->action = action; |
| 491 | __entry->parent = full_ref->parent; |
| 492 | __entry->ref_root = full_ref->root; |
| 493 | __entry->owner = full_ref->objectid; |
| 494 | __entry->offset = full_ref->offset; |
| 495 | __entry->type = ref->type; |
| 496 | ), |
| 497 | |
| 498 | TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, " |
| 499 | "parent = %llu(%s), ref_root = %llu(%s), owner = %llu, " |
| 500 | "offset = %llu, type = %s", |
| 501 | (unsigned long long)__entry->bytenr, |
| 502 | (unsigned long long)__entry->num_bytes, |
| 503 | show_ref_action(__entry->action), |
| 504 | show_root_type(__entry->parent), |
| 505 | show_root_type(__entry->ref_root), |
| 506 | (unsigned long long)__entry->owner, |
| 507 | (unsigned long long)__entry->offset, |
| 508 | show_ref_type(__entry->type)) |
| 509 | ); |
| 510 | |
| 511 | TRACE_EVENT(btrfs_delayed_ref_head, |
| 512 | |
| 513 | TP_PROTO(struct btrfs_delayed_ref_node *ref, |
| 514 | struct btrfs_delayed_ref_head *head_ref, |
| 515 | int action), |
| 516 | |
| 517 | TP_ARGS(ref, head_ref, action), |
| 518 | |
| 519 | TP_STRUCT__entry( |
| 520 | __field( u64, bytenr ) |
| 521 | __field( u64, num_bytes ) |
| 522 | __field( int, action ) |
| 523 | __field( int, is_data ) |
| 524 | ), |
| 525 | |
| 526 | TP_fast_assign( |
| 527 | __entry->bytenr = ref->bytenr; |
| 528 | __entry->num_bytes = ref->num_bytes; |
| 529 | __entry->action = action; |
| 530 | __entry->is_data = head_ref->is_data; |
| 531 | ), |
| 532 | |
| 533 | TP_printk("bytenr = %llu, num_bytes = %llu, action = %s, is_data = %d", |
| 534 | (unsigned long long)__entry->bytenr, |
| 535 | (unsigned long long)__entry->num_bytes, |
| 536 | show_ref_action(__entry->action), |
| 537 | __entry->is_data) |
| 538 | ); |
| 539 | |
| 540 | #define show_chunk_type(type) \ |
| 541 | __print_flags(type, "|", \ |
| 542 | { BTRFS_BLOCK_GROUP_DATA, "DATA" }, \ |
| 543 | { BTRFS_BLOCK_GROUP_SYSTEM, "SYSTEM"}, \ |
| 544 | { BTRFS_BLOCK_GROUP_METADATA, "METADATA"}, \ |
| 545 | { BTRFS_BLOCK_GROUP_RAID0, "RAID0" }, \ |
| 546 | { BTRFS_BLOCK_GROUP_RAID1, "RAID1" }, \ |
| 547 | { BTRFS_BLOCK_GROUP_DUP, "DUP" }, \ |
| 548 | { BTRFS_BLOCK_GROUP_RAID10, "RAID10"}) |
| 549 | |
| 550 | DECLARE_EVENT_CLASS(btrfs__chunk, |
| 551 | |
| 552 | TP_PROTO(struct btrfs_root *root, struct map_lookup *map, |
| 553 | u64 offset, u64 size), |
| 554 | |
| 555 | TP_ARGS(root, map, offset, size), |
| 556 | |
| 557 | TP_STRUCT__entry( |
| 558 | __field( int, num_stripes ) |
| 559 | __field( u64, type ) |
| 560 | __field( int, sub_stripes ) |
| 561 | __field( u64, offset ) |
| 562 | __field( u64, size ) |
| 563 | __field( u64, root_objectid ) |
| 564 | ), |
| 565 | |
| 566 | TP_fast_assign( |
| 567 | __entry->num_stripes = map->num_stripes; |
| 568 | __entry->type = map->type; |
| 569 | __entry->sub_stripes = map->sub_stripes; |
| 570 | __entry->offset = offset; |
| 571 | __entry->size = size; |
| 572 | __entry->root_objectid = root->root_key.objectid; |
| 573 | ), |
| 574 | |
| 575 | TP_printk("root = %llu(%s), offset = %llu, size = %llu, " |
| 576 | "num_stripes = %d, sub_stripes = %d, type = %s", |
| 577 | show_root_type(__entry->root_objectid), |
| 578 | (unsigned long long)__entry->offset, |
| 579 | (unsigned long long)__entry->size, |
| 580 | __entry->num_stripes, __entry->sub_stripes, |
| 581 | show_chunk_type(__entry->type)) |
| 582 | ); |
| 583 | |
| 584 | DEFINE_EVENT(btrfs__chunk, btrfs_chunk_alloc, |
| 585 | |
| 586 | TP_PROTO(struct btrfs_root *root, struct map_lookup *map, |
| 587 | u64 offset, u64 size), |
| 588 | |
| 589 | TP_ARGS(root, map, offset, size) |
| 590 | ); |
| 591 | |
| 592 | DEFINE_EVENT(btrfs__chunk, btrfs_chunk_free, |
| 593 | |
| 594 | TP_PROTO(struct btrfs_root *root, struct map_lookup *map, |
| 595 | u64 offset, u64 size), |
| 596 | |
| 597 | TP_ARGS(root, map, offset, size) |
| 598 | ); |
| 599 | |
| 600 | TRACE_EVENT(btrfs_cow_block, |
| 601 | |
| 602 | TP_PROTO(struct btrfs_root *root, struct extent_buffer *buf, |
| 603 | struct extent_buffer *cow), |
| 604 | |
| 605 | TP_ARGS(root, buf, cow), |
| 606 | |
| 607 | TP_STRUCT__entry( |
| 608 | __field( u64, root_objectid ) |
| 609 | __field( u64, buf_start ) |
| 610 | __field( int, refs ) |
| 611 | __field( u64, cow_start ) |
| 612 | __field( int, buf_level ) |
| 613 | __field( int, cow_level ) |
| 614 | ), |
| 615 | |
| 616 | TP_fast_assign( |
| 617 | __entry->root_objectid = root->root_key.objectid; |
| 618 | __entry->buf_start = buf->start; |
| 619 | __entry->refs = atomic_read(&buf->refs); |
| 620 | __entry->cow_start = cow->start; |
| 621 | __entry->buf_level = btrfs_header_level(buf); |
| 622 | __entry->cow_level = btrfs_header_level(cow); |
| 623 | ), |
| 624 | |
| 625 | TP_printk("root = %llu(%s), refs = %d, orig_buf = %llu " |
| 626 | "(orig_level = %d), cow_buf = %llu (cow_level = %d)", |
| 627 | show_root_type(__entry->root_objectid), |
| 628 | __entry->refs, |
| 629 | (unsigned long long)__entry->buf_start, |
| 630 | __entry->buf_level, |
| 631 | (unsigned long long)__entry->cow_start, |
| 632 | __entry->cow_level) |
| 633 | ); |
| 634 | |
| 635 | DECLARE_EVENT_CLASS(btrfs__reserved_extent, |
| 636 | |
| 637 | TP_PROTO(struct btrfs_root *root, u64 start, u64 len), |
| 638 | |
| 639 | TP_ARGS(root, start, len), |
| 640 | |
| 641 | TP_STRUCT__entry( |
| 642 | __field( u64, root_objectid ) |
| 643 | __field( u64, start ) |
| 644 | __field( u64, len ) |
| 645 | ), |
| 646 | |
| 647 | TP_fast_assign( |
| 648 | __entry->root_objectid = root->root_key.objectid; |
| 649 | __entry->start = start; |
| 650 | __entry->len = len; |
| 651 | ), |
| 652 | |
| 653 | TP_printk("root = %llu(%s), start = %llu, len = %llu", |
| 654 | show_root_type(__entry->root_objectid), |
| 655 | (unsigned long long)__entry->start, |
| 656 | (unsigned long long)__entry->len) |
| 657 | ); |
| 658 | |
| 659 | DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_alloc, |
| 660 | |
| 661 | TP_PROTO(struct btrfs_root *root, u64 start, u64 len), |
| 662 | |
| 663 | TP_ARGS(root, start, len) |
| 664 | ); |
| 665 | |
| 666 | DEFINE_EVENT(btrfs__reserved_extent, btrfs_reserved_extent_free, |
| 667 | |
| 668 | TP_PROTO(struct btrfs_root *root, u64 start, u64 len), |
| 669 | |
| 670 | TP_ARGS(root, start, len) |
| 671 | ); |
| 672 | |
Josef Bacik | 3f7de03 | 2011-11-10 08:29:20 -0500 | [diff] [blame^] | 673 | TRACE_EVENT(find_free_extent, |
| 674 | |
| 675 | TP_PROTO(struct btrfs_root *root, u64 num_bytes, u64 empty_size, |
| 676 | u64 data), |
| 677 | |
| 678 | TP_ARGS(root, num_bytes, empty_size, data), |
| 679 | |
| 680 | TP_STRUCT__entry( |
| 681 | __field( u64, root_objectid ) |
| 682 | __field( u64, num_bytes ) |
| 683 | __field( u64, empty_size ) |
| 684 | __field( u64, data ) |
| 685 | ), |
| 686 | |
| 687 | TP_fast_assign( |
| 688 | __entry->root_objectid = root->root_key.objectid; |
| 689 | __entry->num_bytes = num_bytes; |
| 690 | __entry->empty_size = empty_size; |
| 691 | __entry->data = data; |
| 692 | ), |
| 693 | |
| 694 | TP_printk("root = %Lu(%s), len = %Lu, empty_size = %Lu, " |
| 695 | "flags = %Lu(%s)", show_root_type(__entry->root_objectid), |
| 696 | __entry->num_bytes, __entry->empty_size, __entry->data, |
| 697 | __print_flags((unsigned long)__entry->data, "|", |
| 698 | BTRFS_GROUP_FLAGS)) |
| 699 | ); |
| 700 | |
| 701 | DECLARE_EVENT_CLASS(btrfs__reserve_extent, |
| 702 | |
| 703 | TP_PROTO(struct btrfs_root *root, |
| 704 | struct btrfs_block_group_cache *block_group, u64 start, |
| 705 | u64 len), |
| 706 | |
| 707 | TP_ARGS(root, block_group, start, len), |
| 708 | |
| 709 | TP_STRUCT__entry( |
| 710 | __field( u64, root_objectid ) |
| 711 | __field( u64, bg_objectid ) |
| 712 | __field( u64, flags ) |
| 713 | __field( u64, start ) |
| 714 | __field( u64, len ) |
| 715 | ), |
| 716 | |
| 717 | TP_fast_assign( |
| 718 | __entry->root_objectid = root->root_key.objectid; |
| 719 | __entry->bg_objectid = block_group->key.objectid; |
| 720 | __entry->flags = block_group->flags; |
| 721 | __entry->start = start; |
| 722 | __entry->len = len; |
| 723 | ), |
| 724 | |
| 725 | TP_printk("root = %Lu(%s), block_group = %Lu, flags = %Lu(%s), " |
| 726 | "start = %Lu, len = %Lu", |
| 727 | show_root_type(__entry->root_objectid), __entry->bg_objectid, |
| 728 | __entry->flags, __print_flags((unsigned long)__entry->flags, |
| 729 | "|", BTRFS_GROUP_FLAGS), |
| 730 | __entry->start, __entry->len) |
| 731 | ); |
| 732 | |
| 733 | DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent, |
| 734 | |
| 735 | TP_PROTO(struct btrfs_root *root, |
| 736 | struct btrfs_block_group_cache *block_group, u64 start, |
| 737 | u64 len), |
| 738 | |
| 739 | TP_ARGS(root, block_group, start, len) |
| 740 | ); |
| 741 | |
| 742 | DEFINE_EVENT(btrfs__reserve_extent, btrfs_reserve_extent_cluster, |
| 743 | |
| 744 | TP_PROTO(struct btrfs_root *root, |
| 745 | struct btrfs_block_group_cache *block_group, u64 start, |
| 746 | u64 len), |
| 747 | |
| 748 | TP_ARGS(root, block_group, start, len) |
| 749 | ); |
| 750 | |
| 751 | TRACE_EVENT(btrfs_find_cluster, |
| 752 | |
| 753 | TP_PROTO(struct btrfs_block_group_cache *block_group, u64 start, |
| 754 | u64 bytes, u64 empty_size, u64 min_bytes), |
| 755 | |
| 756 | TP_ARGS(block_group, start, bytes, empty_size, min_bytes), |
| 757 | |
| 758 | TP_STRUCT__entry( |
| 759 | __field( u64, bg_objectid ) |
| 760 | __field( u64, flags ) |
| 761 | __field( u64, start ) |
| 762 | __field( u64, bytes ) |
| 763 | __field( u64, empty_size ) |
| 764 | __field( u64, min_bytes ) |
| 765 | ), |
| 766 | |
| 767 | TP_fast_assign( |
| 768 | __entry->bg_objectid = block_group->key.objectid; |
| 769 | __entry->flags = block_group->flags; |
| 770 | __entry->start = start; |
| 771 | __entry->bytes = bytes; |
| 772 | __entry->empty_size = empty_size; |
| 773 | __entry->min_bytes = min_bytes; |
| 774 | ), |
| 775 | |
| 776 | TP_printk("block_group = %Lu, flags = %Lu(%s), start = %Lu, len = %Lu," |
| 777 | " empty_size = %Lu, min_bytes = %Lu", __entry->bg_objectid, |
| 778 | __entry->flags, |
| 779 | __print_flags((unsigned long)__entry->flags, "|", |
| 780 | BTRFS_GROUP_FLAGS), __entry->start, |
| 781 | __entry->bytes, __entry->empty_size, __entry->min_bytes) |
| 782 | ); |
| 783 | |
| 784 | TRACE_EVENT(btrfs_failed_cluster_setup, |
| 785 | |
| 786 | TP_PROTO(struct btrfs_block_group_cache *block_group), |
| 787 | |
| 788 | TP_ARGS(block_group), |
| 789 | |
| 790 | TP_STRUCT__entry( |
| 791 | __field( u64, bg_objectid ) |
| 792 | ), |
| 793 | |
| 794 | TP_fast_assign( |
| 795 | __entry->bg_objectid = block_group->key.objectid; |
| 796 | ), |
| 797 | |
| 798 | TP_printk("block_group = %Lu", __entry->bg_objectid) |
| 799 | ); |
| 800 | |
| 801 | TRACE_EVENT(btrfs_setup_cluster, |
| 802 | |
| 803 | TP_PROTO(struct btrfs_block_group_cache *block_group, |
| 804 | struct btrfs_free_cluster *cluster, u64 size, int bitmap), |
| 805 | |
| 806 | TP_ARGS(block_group, cluster, size, bitmap), |
| 807 | |
| 808 | TP_STRUCT__entry( |
| 809 | __field( u64, bg_objectid ) |
| 810 | __field( u64, flags ) |
| 811 | __field( u64, start ) |
| 812 | __field( u64, max_size ) |
| 813 | __field( u64, size ) |
| 814 | __field( int, bitmap ) |
| 815 | ), |
| 816 | |
| 817 | TP_fast_assign( |
| 818 | __entry->bg_objectid = block_group->key.objectid; |
| 819 | __entry->flags = block_group->flags; |
| 820 | __entry->start = cluster->window_start; |
| 821 | __entry->max_size = cluster->max_size; |
| 822 | __entry->size = size; |
| 823 | __entry->bitmap = bitmap; |
| 824 | ), |
| 825 | |
| 826 | TP_printk("block_group = %Lu, flags = %Lu(%s), window_start = %Lu, " |
| 827 | "size = %Lu, max_size = %Lu, bitmap = %d", |
| 828 | __entry->bg_objectid, |
| 829 | __entry->flags, |
| 830 | __print_flags((unsigned long)__entry->flags, "|", |
| 831 | BTRFS_GROUP_FLAGS), __entry->start, |
| 832 | __entry->size, __entry->max_size, __entry->bitmap) |
| 833 | ); |
| 834 | |
liubo | 1abe9b8 | 2011-03-24 11:18:59 +0000 | [diff] [blame] | 835 | #endif /* _TRACE_BTRFS_H */ |
| 836 | |
| 837 | /* This part must be outside protection */ |
| 838 | #include <trace/define_trace.h> |