1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * Copyright (c) 2009, Christoph Hellwig 4 * All Rights Reserved. 5 */ 6 #undef TRACE_SYSTEM 7 #define TRACE_SYSTEM xfs 8 9 #if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ) 10 #define _TRACE_XFS_H 11 12 #include <linux/tracepoint.h> 13 14 struct xfs_agf; 15 struct xfs_alloc_arg; 16 struct xfs_attr_list_context; 17 struct xfs_buf_log_item; 18 struct xfs_da_args; 19 struct xfs_da_node_entry; 20 struct xfs_dquot; 21 struct xfs_log_item; 22 struct xlog; 23 struct xlog_ticket; 24 struct xlog_recover; 25 struct xlog_recover_item; 26 struct xfs_buf_log_format; 27 struct xfs_inode_log_format; 28 struct xfs_bmbt_irec; 29 struct xfs_btree_cur; 30 struct xfs_refcount_irec; 31 struct xfs_fsmap; 32 struct xfs_rmap_irec; 33 34 DECLARE_EVENT_CLASS(xfs_attr_list_class, 35 TP_PROTO(struct xfs_attr_list_context *ctx), 36 TP_ARGS(ctx), 37 TP_STRUCT__entry( 38 __field(dev_t, dev) 39 __field(xfs_ino_t, ino) 40 __field(u32, hashval) 41 __field(u32, blkno) 42 __field(u32, offset) 43 __field(void *, alist) 44 __field(int, bufsize) 45 __field(int, count) 46 __field(int, firstu) 47 __field(int, dupcnt) 48 __field(int, flags) 49 ), 50 TP_fast_assign( 51 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev; 52 __entry->ino = ctx->dp->i_ino; 53 __entry->hashval = ctx->cursor->hashval; 54 __entry->blkno = ctx->cursor->blkno; 55 __entry->offset = ctx->cursor->offset; 56 __entry->alist = ctx->alist; 57 __entry->bufsize = ctx->bufsize; 58 __entry->count = ctx->count; 59 __entry->firstu = ctx->firstu; 60 __entry->flags = ctx->flags; 61 ), 62 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u " 63 "alist %p size %u count %u firstu %u flags %d %s", 64 MAJOR(__entry->dev), MINOR(__entry->dev), 65 __entry->ino, 66 __entry->hashval, 67 __entry->blkno, 68 __entry->offset, 69 __entry->dupcnt, 70 __entry->alist, 71 __entry->bufsize, 72 __entry->count, 73 __entry->firstu, 74 __entry->flags, 75 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS) 76 ) 77 ) 78 79 #define DEFINE_ATTR_LIST_EVENT(name) \ 80 DEFINE_EVENT(xfs_attr_list_class, name, \ 81 TP_PROTO(struct xfs_attr_list_context *ctx), \ 82 TP_ARGS(ctx)) 83 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf); 84 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all); 85 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf); 86 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end); 87 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full); 88 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add); 89 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk); 90 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound); 91 DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list); 92 DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list); 93 94 DECLARE_EVENT_CLASS(xfs_perag_class, 95 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, 96 unsigned long caller_ip), 97 TP_ARGS(mp, agno, refcount, caller_ip), 98 TP_STRUCT__entry( 99 __field(dev_t, dev) 100 __field(xfs_agnumber_t, agno) 101 __field(int, refcount) 102 __field(unsigned long, caller_ip) 103 ), 104 TP_fast_assign( 105 __entry->dev = mp->m_super->s_dev; 106 __entry->agno = agno; 107 __entry->refcount = refcount; 108 __entry->caller_ip = caller_ip; 109 ), 110 TP_printk("dev %d:%d agno %u refcount %d caller %pS", 111 MAJOR(__entry->dev), MINOR(__entry->dev), 112 __entry->agno, 113 __entry->refcount, 114 (char *)__entry->caller_ip) 115 ); 116 117 #define DEFINE_PERAG_REF_EVENT(name) \ 118 DEFINE_EVENT(xfs_perag_class, name, \ 119 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \ 120 unsigned long caller_ip), \ 121 TP_ARGS(mp, agno, refcount, caller_ip)) 122 DEFINE_PERAG_REF_EVENT(xfs_perag_get); 123 DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag); 124 DEFINE_PERAG_REF_EVENT(xfs_perag_put); 125 DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim); 126 DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim); 127 DEFINE_PERAG_REF_EVENT(xfs_perag_set_eofblocks); 128 DEFINE_PERAG_REF_EVENT(xfs_perag_clear_eofblocks); 129 DEFINE_PERAG_REF_EVENT(xfs_perag_set_cowblocks); 130 DEFINE_PERAG_REF_EVENT(xfs_perag_clear_cowblocks); 131 132 DECLARE_EVENT_CLASS(xfs_ag_class, 133 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno), 134 TP_ARGS(mp, agno), 135 TP_STRUCT__entry( 136 __field(dev_t, dev) 137 __field(xfs_agnumber_t, agno) 138 ), 139 TP_fast_assign( 140 __entry->dev = mp->m_super->s_dev; 141 __entry->agno = agno; 142 ), 143 TP_printk("dev %d:%d agno %u", 144 MAJOR(__entry->dev), MINOR(__entry->dev), 145 __entry->agno) 146 ); 147 #define DEFINE_AG_EVENT(name) \ 148 DEFINE_EVENT(xfs_ag_class, name, \ 149 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno), \ 150 TP_ARGS(mp, agno)) 151 152 DEFINE_AG_EVENT(xfs_read_agf); 153 DEFINE_AG_EVENT(xfs_alloc_read_agf); 154 DEFINE_AG_EVENT(xfs_read_agi); 155 DEFINE_AG_EVENT(xfs_ialloc_read_agi); 156 157 TRACE_EVENT(xfs_attr_list_node_descend, 158 TP_PROTO(struct xfs_attr_list_context *ctx, 159 struct xfs_da_node_entry *btree), 160 TP_ARGS(ctx, btree), 161 TP_STRUCT__entry( 162 __field(dev_t, dev) 163 __field(xfs_ino_t, ino) 164 __field(u32, hashval) 165 __field(u32, blkno) 166 __field(u32, offset) 167 __field(void *, alist) 168 __field(int, bufsize) 169 __field(int, count) 170 __field(int, firstu) 171 __field(int, dupcnt) 172 __field(int, flags) 173 __field(u32, bt_hashval) 174 __field(u32, bt_before) 175 ), 176 TP_fast_assign( 177 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev; 178 __entry->ino = ctx->dp->i_ino; 179 __entry->hashval = ctx->cursor->hashval; 180 __entry->blkno = ctx->cursor->blkno; 181 __entry->offset = ctx->cursor->offset; 182 __entry->alist = ctx->alist; 183 __entry->bufsize = ctx->bufsize; 184 __entry->count = ctx->count; 185 __entry->firstu = ctx->firstu; 186 __entry->flags = ctx->flags; 187 __entry->bt_hashval = be32_to_cpu(btree->hashval); 188 __entry->bt_before = be32_to_cpu(btree->before); 189 ), 190 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u " 191 "alist %p size %u count %u firstu %u flags %d %s " 192 "node hashval %u, node before %u", 193 MAJOR(__entry->dev), MINOR(__entry->dev), 194 __entry->ino, 195 __entry->hashval, 196 __entry->blkno, 197 __entry->offset, 198 __entry->dupcnt, 199 __entry->alist, 200 __entry->bufsize, 201 __entry->count, 202 __entry->firstu, 203 __entry->flags, 204 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS), 205 __entry->bt_hashval, 206 __entry->bt_before) 207 ); 208 209 DECLARE_EVENT_CLASS(xfs_bmap_class, 210 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state, 211 unsigned long caller_ip), 212 TP_ARGS(ip, cur, state, caller_ip), 213 TP_STRUCT__entry( 214 __field(dev_t, dev) 215 __field(xfs_ino_t, ino) 216 __field(void *, leaf); 217 __field(int, pos); 218 __field(xfs_fileoff_t, startoff) 219 __field(xfs_fsblock_t, startblock) 220 __field(xfs_filblks_t, blockcount) 221 __field(xfs_exntst_t, state) 222 __field(int, bmap_state) 223 __field(unsigned long, caller_ip) 224 ), 225 TP_fast_assign( 226 struct xfs_ifork *ifp; 227 struct xfs_bmbt_irec r; 228 229 ifp = xfs_iext_state_to_fork(ip, state); 230 xfs_iext_get_extent(ifp, cur, &r); 231 __entry->dev = VFS_I(ip)->i_sb->s_dev; 232 __entry->ino = ip->i_ino; 233 __entry->leaf = cur->leaf; 234 __entry->pos = cur->pos; 235 __entry->startoff = r.br_startoff; 236 __entry->startblock = r.br_startblock; 237 __entry->blockcount = r.br_blockcount; 238 __entry->state = r.br_state; 239 __entry->bmap_state = state; 240 __entry->caller_ip = caller_ip; 241 ), 242 TP_printk("dev %d:%d ino 0x%llx state %s cur %p/%d " 243 "offset %lld block %lld count %lld flag %d caller %pS", 244 MAJOR(__entry->dev), MINOR(__entry->dev), 245 __entry->ino, 246 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS), 247 __entry->leaf, 248 __entry->pos, 249 __entry->startoff, 250 (int64_t)__entry->startblock, 251 __entry->blockcount, 252 __entry->state, 253 (char *)__entry->caller_ip) 254 ) 255 256 #define DEFINE_BMAP_EVENT(name) \ 257 DEFINE_EVENT(xfs_bmap_class, name, \ 258 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state, \ 259 unsigned long caller_ip), \ 260 TP_ARGS(ip, cur, state, caller_ip)) 261 DEFINE_BMAP_EVENT(xfs_iext_insert); 262 DEFINE_BMAP_EVENT(xfs_iext_remove); 263 DEFINE_BMAP_EVENT(xfs_bmap_pre_update); 264 DEFINE_BMAP_EVENT(xfs_bmap_post_update); 265 DEFINE_BMAP_EVENT(xfs_read_extent); 266 DEFINE_BMAP_EVENT(xfs_write_extent); 267 268 DECLARE_EVENT_CLASS(xfs_buf_class, 269 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), 270 TP_ARGS(bp, caller_ip), 271 TP_STRUCT__entry( 272 __field(dev_t, dev) 273 __field(xfs_daddr_t, bno) 274 __field(int, nblks) 275 __field(int, hold) 276 __field(int, pincount) 277 __field(unsigned, lockval) 278 __field(unsigned, flags) 279 __field(unsigned long, caller_ip) 280 ), 281 TP_fast_assign( 282 __entry->dev = bp->b_target->bt_dev; 283 __entry->bno = bp->b_bn; 284 __entry->nblks = bp->b_length; 285 __entry->hold = atomic_read(&bp->b_hold); 286 __entry->pincount = atomic_read(&bp->b_pin_count); 287 __entry->lockval = bp->b_sema.count; 288 __entry->flags = bp->b_flags; 289 __entry->caller_ip = caller_ip; 290 ), 291 TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d " 292 "lock %d flags %s caller %pS", 293 MAJOR(__entry->dev), MINOR(__entry->dev), 294 (unsigned long long)__entry->bno, 295 __entry->nblks, 296 __entry->hold, 297 __entry->pincount, 298 __entry->lockval, 299 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), 300 (void *)__entry->caller_ip) 301 ) 302 303 #define DEFINE_BUF_EVENT(name) \ 304 DEFINE_EVENT(xfs_buf_class, name, \ 305 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \ 306 TP_ARGS(bp, caller_ip)) 307 DEFINE_BUF_EVENT(xfs_buf_init); 308 DEFINE_BUF_EVENT(xfs_buf_free); 309 DEFINE_BUF_EVENT(xfs_buf_hold); 310 DEFINE_BUF_EVENT(xfs_buf_rele); 311 DEFINE_BUF_EVENT(xfs_buf_iodone); 312 DEFINE_BUF_EVENT(xfs_buf_submit); 313 DEFINE_BUF_EVENT(xfs_buf_lock); 314 DEFINE_BUF_EVENT(xfs_buf_lock_done); 315 DEFINE_BUF_EVENT(xfs_buf_trylock_fail); 316 DEFINE_BUF_EVENT(xfs_buf_trylock); 317 DEFINE_BUF_EVENT(xfs_buf_unlock); 318 DEFINE_BUF_EVENT(xfs_buf_iowait); 319 DEFINE_BUF_EVENT(xfs_buf_iowait_done); 320 DEFINE_BUF_EVENT(xfs_buf_delwri_queue); 321 DEFINE_BUF_EVENT(xfs_buf_delwri_queued); 322 DEFINE_BUF_EVENT(xfs_buf_delwri_split); 323 DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf); 324 DEFINE_BUF_EVENT(xfs_buf_get_uncached); 325 DEFINE_BUF_EVENT(xfs_buf_item_relse); 326 DEFINE_BUF_EVENT(xfs_buf_item_iodone_async); 327 DEFINE_BUF_EVENT(xfs_buf_error_relse); 328 DEFINE_BUF_EVENT(xfs_buf_wait_buftarg); 329 DEFINE_BUF_EVENT(xfs_trans_read_buf_shut); 330 331 /* not really buffer traces, but the buf provides useful information */ 332 DEFINE_BUF_EVENT(xfs_btree_corrupt); 333 DEFINE_BUF_EVENT(xfs_reset_dqcounts); 334 335 /* pass flags explicitly */ 336 DECLARE_EVENT_CLASS(xfs_buf_flags_class, 337 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), 338 TP_ARGS(bp, flags, caller_ip), 339 TP_STRUCT__entry( 340 __field(dev_t, dev) 341 __field(xfs_daddr_t, bno) 342 __field(size_t, buffer_length) 343 __field(int, hold) 344 __field(int, pincount) 345 __field(unsigned, lockval) 346 __field(unsigned, flags) 347 __field(unsigned long, caller_ip) 348 ), 349 TP_fast_assign( 350 __entry->dev = bp->b_target->bt_dev; 351 __entry->bno = bp->b_bn; 352 __entry->buffer_length = BBTOB(bp->b_length); 353 __entry->flags = flags; 354 __entry->hold = atomic_read(&bp->b_hold); 355 __entry->pincount = atomic_read(&bp->b_pin_count); 356 __entry->lockval = bp->b_sema.count; 357 __entry->caller_ip = caller_ip; 358 ), 359 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " 360 "lock %d flags %s caller %pS", 361 MAJOR(__entry->dev), MINOR(__entry->dev), 362 (unsigned long long)__entry->bno, 363 __entry->buffer_length, 364 __entry->hold, 365 __entry->pincount, 366 __entry->lockval, 367 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), 368 (void *)__entry->caller_ip) 369 ) 370 371 #define DEFINE_BUF_FLAGS_EVENT(name) \ 372 DEFINE_EVENT(xfs_buf_flags_class, name, \ 373 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \ 374 TP_ARGS(bp, flags, caller_ip)) 375 DEFINE_BUF_FLAGS_EVENT(xfs_buf_find); 376 DEFINE_BUF_FLAGS_EVENT(xfs_buf_get); 377 DEFINE_BUF_FLAGS_EVENT(xfs_buf_read); 378 379 TRACE_EVENT(xfs_buf_ioerror, 380 TP_PROTO(struct xfs_buf *bp, int error, xfs_failaddr_t caller_ip), 381 TP_ARGS(bp, error, caller_ip), 382 TP_STRUCT__entry( 383 __field(dev_t, dev) 384 __field(xfs_daddr_t, bno) 385 __field(size_t, buffer_length) 386 __field(unsigned, flags) 387 __field(int, hold) 388 __field(int, pincount) 389 __field(unsigned, lockval) 390 __field(int, error) 391 __field(xfs_failaddr_t, caller_ip) 392 ), 393 TP_fast_assign( 394 __entry->dev = bp->b_target->bt_dev; 395 __entry->bno = bp->b_bn; 396 __entry->buffer_length = BBTOB(bp->b_length); 397 __entry->hold = atomic_read(&bp->b_hold); 398 __entry->pincount = atomic_read(&bp->b_pin_count); 399 __entry->lockval = bp->b_sema.count; 400 __entry->error = error; 401 __entry->flags = bp->b_flags; 402 __entry->caller_ip = caller_ip; 403 ), 404 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " 405 "lock %d error %d flags %s caller %pS", 406 MAJOR(__entry->dev), MINOR(__entry->dev), 407 (unsigned long long)__entry->bno, 408 __entry->buffer_length, 409 __entry->hold, 410 __entry->pincount, 411 __entry->lockval, 412 __entry->error, 413 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS), 414 (void *)__entry->caller_ip) 415 ); 416 417 DECLARE_EVENT_CLASS(xfs_buf_item_class, 418 TP_PROTO(struct xfs_buf_log_item *bip), 419 TP_ARGS(bip), 420 TP_STRUCT__entry( 421 __field(dev_t, dev) 422 __field(xfs_daddr_t, buf_bno) 423 __field(size_t, buf_len) 424 __field(int, buf_hold) 425 __field(int, buf_pincount) 426 __field(int, buf_lockval) 427 __field(unsigned, buf_flags) 428 __field(unsigned, bli_recur) 429 __field(int, bli_refcount) 430 __field(unsigned, bli_flags) 431 __field(unsigned long, li_flags) 432 ), 433 TP_fast_assign( 434 __entry->dev = bip->bli_buf->b_target->bt_dev; 435 __entry->bli_flags = bip->bli_flags; 436 __entry->bli_recur = bip->bli_recur; 437 __entry->bli_refcount = atomic_read(&bip->bli_refcount); 438 __entry->buf_bno = bip->bli_buf->b_bn; 439 __entry->buf_len = BBTOB(bip->bli_buf->b_length); 440 __entry->buf_flags = bip->bli_buf->b_flags; 441 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold); 442 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count); 443 __entry->buf_lockval = bip->bli_buf->b_sema.count; 444 __entry->li_flags = bip->bli_item.li_flags; 445 ), 446 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d " 447 "lock %d flags %s recur %d refcount %d bliflags %s " 448 "liflags %s", 449 MAJOR(__entry->dev), MINOR(__entry->dev), 450 (unsigned long long)__entry->buf_bno, 451 __entry->buf_len, 452 __entry->buf_hold, 453 __entry->buf_pincount, 454 __entry->buf_lockval, 455 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS), 456 __entry->bli_recur, 457 __entry->bli_refcount, 458 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS), 459 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS)) 460 ) 461 462 #define DEFINE_BUF_ITEM_EVENT(name) \ 463 DEFINE_EVENT(xfs_buf_item_class, name, \ 464 TP_PROTO(struct xfs_buf_log_item *bip), \ 465 TP_ARGS(bip)) 466 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size); 467 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered); 468 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale); 469 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format); 470 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale); 471 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered); 472 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin); 473 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin); 474 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale); 475 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock); 476 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed); 477 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push); 478 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf); 479 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur); 480 DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb); 481 DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur); 482 DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf); 483 DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur); 484 DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf); 485 DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse); 486 DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin); 487 DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold); 488 DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release); 489 DEFINE_BUF_ITEM_EVENT(xfs_trans_binval); 490 491 DECLARE_EVENT_CLASS(xfs_filestream_class, 492 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno), 493 TP_ARGS(mp, ino, agno), 494 TP_STRUCT__entry( 495 __field(dev_t, dev) 496 __field(xfs_ino_t, ino) 497 __field(xfs_agnumber_t, agno) 498 __field(int, streams) 499 ), 500 TP_fast_assign( 501 __entry->dev = mp->m_super->s_dev; 502 __entry->ino = ino; 503 __entry->agno = agno; 504 __entry->streams = xfs_filestream_peek_ag(mp, agno); 505 ), 506 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d", 507 MAJOR(__entry->dev), MINOR(__entry->dev), 508 __entry->ino, 509 __entry->agno, 510 __entry->streams) 511 ) 512 #define DEFINE_FILESTREAM_EVENT(name) \ 513 DEFINE_EVENT(xfs_filestream_class, name, \ 514 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno), \ 515 TP_ARGS(mp, ino, agno)) 516 DEFINE_FILESTREAM_EVENT(xfs_filestream_free); 517 DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup); 518 DEFINE_FILESTREAM_EVENT(xfs_filestream_scan); 519 520 TRACE_EVENT(xfs_filestream_pick, 521 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno, 522 xfs_extlen_t free, int nscan), 523 TP_ARGS(ip, agno, free, nscan), 524 TP_STRUCT__entry( 525 __field(dev_t, dev) 526 __field(xfs_ino_t, ino) 527 __field(xfs_agnumber_t, agno) 528 __field(int, streams) 529 __field(xfs_extlen_t, free) 530 __field(int, nscan) 531 ), 532 TP_fast_assign( 533 __entry->dev = VFS_I(ip)->i_sb->s_dev; 534 __entry->ino = ip->i_ino; 535 __entry->agno = agno; 536 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno); 537 __entry->free = free; 538 __entry->nscan = nscan; 539 ), 540 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d free %d nscan %d", 541 MAJOR(__entry->dev), MINOR(__entry->dev), 542 __entry->ino, 543 __entry->agno, 544 __entry->streams, 545 __entry->free, 546 __entry->nscan) 547 ); 548 549 DECLARE_EVENT_CLASS(xfs_lock_class, 550 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, 551 unsigned long caller_ip), 552 TP_ARGS(ip, lock_flags, caller_ip), 553 TP_STRUCT__entry( 554 __field(dev_t, dev) 555 __field(xfs_ino_t, ino) 556 __field(int, lock_flags) 557 __field(unsigned long, caller_ip) 558 ), 559 TP_fast_assign( 560 __entry->dev = VFS_I(ip)->i_sb->s_dev; 561 __entry->ino = ip->i_ino; 562 __entry->lock_flags = lock_flags; 563 __entry->caller_ip = caller_ip; 564 ), 565 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pS", 566 MAJOR(__entry->dev), MINOR(__entry->dev), 567 __entry->ino, 568 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS), 569 (void *)__entry->caller_ip) 570 ) 571 572 #define DEFINE_LOCK_EVENT(name) \ 573 DEFINE_EVENT(xfs_lock_class, name, \ 574 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \ 575 unsigned long caller_ip), \ 576 TP_ARGS(ip, lock_flags, caller_ip)) 577 DEFINE_LOCK_EVENT(xfs_ilock); 578 DEFINE_LOCK_EVENT(xfs_ilock_nowait); 579 DEFINE_LOCK_EVENT(xfs_ilock_demote); 580 DEFINE_LOCK_EVENT(xfs_iunlock); 581 582 DECLARE_EVENT_CLASS(xfs_inode_class, 583 TP_PROTO(struct xfs_inode *ip), 584 TP_ARGS(ip), 585 TP_STRUCT__entry( 586 __field(dev_t, dev) 587 __field(xfs_ino_t, ino) 588 ), 589 TP_fast_assign( 590 __entry->dev = VFS_I(ip)->i_sb->s_dev; 591 __entry->ino = ip->i_ino; 592 ), 593 TP_printk("dev %d:%d ino 0x%llx", 594 MAJOR(__entry->dev), MINOR(__entry->dev), 595 __entry->ino) 596 ) 597 598 #define DEFINE_INODE_EVENT(name) \ 599 DEFINE_EVENT(xfs_inode_class, name, \ 600 TP_PROTO(struct xfs_inode *ip), \ 601 TP_ARGS(ip)) 602 DEFINE_INODE_EVENT(xfs_iget_skip); 603 DEFINE_INODE_EVENT(xfs_iget_reclaim); 604 DEFINE_INODE_EVENT(xfs_iget_reclaim_fail); 605 DEFINE_INODE_EVENT(xfs_iget_hit); 606 DEFINE_INODE_EVENT(xfs_iget_miss); 607 608 DEFINE_INODE_EVENT(xfs_getattr); 609 DEFINE_INODE_EVENT(xfs_setattr); 610 DEFINE_INODE_EVENT(xfs_readlink); 611 DEFINE_INODE_EVENT(xfs_inactive_symlink); 612 DEFINE_INODE_EVENT(xfs_alloc_file_space); 613 DEFINE_INODE_EVENT(xfs_free_file_space); 614 DEFINE_INODE_EVENT(xfs_zero_file_space); 615 DEFINE_INODE_EVENT(xfs_collapse_file_space); 616 DEFINE_INODE_EVENT(xfs_insert_file_space); 617 DEFINE_INODE_EVENT(xfs_readdir); 618 #ifdef CONFIG_XFS_POSIX_ACL 619 DEFINE_INODE_EVENT(xfs_get_acl); 620 #endif 621 DEFINE_INODE_EVENT(xfs_vm_bmap); 622 DEFINE_INODE_EVENT(xfs_file_ioctl); 623 DEFINE_INODE_EVENT(xfs_file_compat_ioctl); 624 DEFINE_INODE_EVENT(xfs_ioctl_setattr); 625 DEFINE_INODE_EVENT(xfs_dir_fsync); 626 DEFINE_INODE_EVENT(xfs_file_fsync); 627 DEFINE_INODE_EVENT(xfs_destroy_inode); 628 DEFINE_INODE_EVENT(xfs_update_time); 629 630 DEFINE_INODE_EVENT(xfs_dquot_dqalloc); 631 DEFINE_INODE_EVENT(xfs_dquot_dqdetach); 632 633 DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag); 634 DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag); 635 DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid); 636 DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag); 637 DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag); 638 DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid); 639 640 TRACE_EVENT(xfs_filemap_fault, 641 TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size, 642 bool write_fault), 643 TP_ARGS(ip, pe_size, write_fault), 644 TP_STRUCT__entry( 645 __field(dev_t, dev) 646 __field(xfs_ino_t, ino) 647 __field(enum page_entry_size, pe_size) 648 __field(bool, write_fault) 649 ), 650 TP_fast_assign( 651 __entry->dev = VFS_I(ip)->i_sb->s_dev; 652 __entry->ino = ip->i_ino; 653 __entry->pe_size = pe_size; 654 __entry->write_fault = write_fault; 655 ), 656 TP_printk("dev %d:%d ino 0x%llx %s write_fault %d", 657 MAJOR(__entry->dev), MINOR(__entry->dev), 658 __entry->ino, 659 __print_symbolic(__entry->pe_size, 660 { PE_SIZE_PTE, "PTE" }, 661 { PE_SIZE_PMD, "PMD" }, 662 { PE_SIZE_PUD, "PUD" }), 663 __entry->write_fault) 664 ) 665 666 DECLARE_EVENT_CLASS(xfs_iref_class, 667 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), 668 TP_ARGS(ip, caller_ip), 669 TP_STRUCT__entry( 670 __field(dev_t, dev) 671 __field(xfs_ino_t, ino) 672 __field(int, count) 673 __field(int, pincount) 674 __field(unsigned long, caller_ip) 675 ), 676 TP_fast_assign( 677 __entry->dev = VFS_I(ip)->i_sb->s_dev; 678 __entry->ino = ip->i_ino; 679 __entry->count = atomic_read(&VFS_I(ip)->i_count); 680 __entry->pincount = atomic_read(&ip->i_pincount); 681 __entry->caller_ip = caller_ip; 682 ), 683 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS", 684 MAJOR(__entry->dev), MINOR(__entry->dev), 685 __entry->ino, 686 __entry->count, 687 __entry->pincount, 688 (char *)__entry->caller_ip) 689 ) 690 691 TRACE_EVENT(xfs_iomap_prealloc_size, 692 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift, 693 unsigned int writeio_blocks), 694 TP_ARGS(ip, blocks, shift, writeio_blocks), 695 TP_STRUCT__entry( 696 __field(dev_t, dev) 697 __field(xfs_ino_t, ino) 698 __field(xfs_fsblock_t, blocks) 699 __field(int, shift) 700 __field(unsigned int, writeio_blocks) 701 ), 702 TP_fast_assign( 703 __entry->dev = VFS_I(ip)->i_sb->s_dev; 704 __entry->ino = ip->i_ino; 705 __entry->blocks = blocks; 706 __entry->shift = shift; 707 __entry->writeio_blocks = writeio_blocks; 708 ), 709 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d " 710 "m_writeio_blocks %u", 711 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, 712 __entry->blocks, __entry->shift, __entry->writeio_blocks) 713 ) 714 715 TRACE_EVENT(xfs_irec_merge_pre, 716 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino, 717 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask), 718 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask), 719 TP_STRUCT__entry( 720 __field(dev_t, dev) 721 __field(xfs_agnumber_t, agno) 722 __field(xfs_agino_t, agino) 723 __field(uint16_t, holemask) 724 __field(xfs_agino_t, nagino) 725 __field(uint16_t, nholemask) 726 ), 727 TP_fast_assign( 728 __entry->dev = mp->m_super->s_dev; 729 __entry->agno = agno; 730 __entry->agino = agino; 731 __entry->holemask = holemask; 732 __entry->nagino = nagino; 733 __entry->nholemask = holemask; 734 ), 735 TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)", 736 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno, 737 __entry->agino, __entry->holemask, __entry->nagino, 738 __entry->nholemask) 739 ) 740 741 TRACE_EVENT(xfs_irec_merge_post, 742 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino, 743 uint16_t holemask), 744 TP_ARGS(mp, agno, agino, holemask), 745 TP_STRUCT__entry( 746 __field(dev_t, dev) 747 __field(xfs_agnumber_t, agno) 748 __field(xfs_agino_t, agino) 749 __field(uint16_t, holemask) 750 ), 751 TP_fast_assign( 752 __entry->dev = mp->m_super->s_dev; 753 __entry->agno = agno; 754 __entry->agino = agino; 755 __entry->holemask = holemask; 756 ), 757 TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev), 758 MINOR(__entry->dev), __entry->agno, __entry->agino, 759 __entry->holemask) 760 ) 761 762 #define DEFINE_IREF_EVENT(name) \ 763 DEFINE_EVENT(xfs_iref_class, name, \ 764 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \ 765 TP_ARGS(ip, caller_ip)) 766 DEFINE_IREF_EVENT(xfs_irele); 767 DEFINE_IREF_EVENT(xfs_inode_pin); 768 DEFINE_IREF_EVENT(xfs_inode_unpin); 769 DEFINE_IREF_EVENT(xfs_inode_unpin_nowait); 770 771 DECLARE_EVENT_CLASS(xfs_namespace_class, 772 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), 773 TP_ARGS(dp, name), 774 TP_STRUCT__entry( 775 __field(dev_t, dev) 776 __field(xfs_ino_t, dp_ino) 777 __field(int, namelen) 778 __dynamic_array(char, name, name->len) 779 ), 780 TP_fast_assign( 781 __entry->dev = VFS_I(dp)->i_sb->s_dev; 782 __entry->dp_ino = dp->i_ino; 783 __entry->namelen = name->len; 784 memcpy(__get_str(name), name->name, name->len); 785 ), 786 TP_printk("dev %d:%d dp ino 0x%llx name %.*s", 787 MAJOR(__entry->dev), MINOR(__entry->dev), 788 __entry->dp_ino, 789 __entry->namelen, 790 __get_str(name)) 791 ) 792 793 #define DEFINE_NAMESPACE_EVENT(name) \ 794 DEFINE_EVENT(xfs_namespace_class, name, \ 795 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \ 796 TP_ARGS(dp, name)) 797 DEFINE_NAMESPACE_EVENT(xfs_remove); 798 DEFINE_NAMESPACE_EVENT(xfs_link); 799 DEFINE_NAMESPACE_EVENT(xfs_lookup); 800 DEFINE_NAMESPACE_EVENT(xfs_create); 801 DEFINE_NAMESPACE_EVENT(xfs_symlink); 802 803 TRACE_EVENT(xfs_rename, 804 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp, 805 struct xfs_name *src_name, struct xfs_name *target_name), 806 TP_ARGS(src_dp, target_dp, src_name, target_name), 807 TP_STRUCT__entry( 808 __field(dev_t, dev) 809 __field(xfs_ino_t, src_dp_ino) 810 __field(xfs_ino_t, target_dp_ino) 811 __field(int, src_namelen) 812 __field(int, target_namelen) 813 __dynamic_array(char, src_name, src_name->len) 814 __dynamic_array(char, target_name, target_name->len) 815 ), 816 TP_fast_assign( 817 __entry->dev = VFS_I(src_dp)->i_sb->s_dev; 818 __entry->src_dp_ino = src_dp->i_ino; 819 __entry->target_dp_ino = target_dp->i_ino; 820 __entry->src_namelen = src_name->len; 821 __entry->target_namelen = target_name->len; 822 memcpy(__get_str(src_name), src_name->name, src_name->len); 823 memcpy(__get_str(target_name), target_name->name, 824 target_name->len); 825 ), 826 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx" 827 " src name %.*s target name %.*s", 828 MAJOR(__entry->dev), MINOR(__entry->dev), 829 __entry->src_dp_ino, 830 __entry->target_dp_ino, 831 __entry->src_namelen, 832 __get_str(src_name), 833 __entry->target_namelen, 834 __get_str(target_name)) 835 ) 836 837 DECLARE_EVENT_CLASS(xfs_dquot_class, 838 TP_PROTO(struct xfs_dquot *dqp), 839 TP_ARGS(dqp), 840 TP_STRUCT__entry( 841 __field(dev_t, dev) 842 __field(u32, id) 843 __field(unsigned, flags) 844 __field(unsigned, nrefs) 845 __field(unsigned long long, res_bcount) 846 __field(unsigned long long, bcount) 847 __field(unsigned long long, icount) 848 __field(unsigned long long, blk_hardlimit) 849 __field(unsigned long long, blk_softlimit) 850 __field(unsigned long long, ino_hardlimit) 851 __field(unsigned long long, ino_softlimit) 852 ), \ 853 TP_fast_assign( 854 __entry->dev = dqp->q_mount->m_super->s_dev; 855 __entry->id = be32_to_cpu(dqp->q_core.d_id); 856 __entry->flags = dqp->dq_flags; 857 __entry->nrefs = dqp->q_nrefs; 858 __entry->res_bcount = dqp->q_res_bcount; 859 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount); 860 __entry->icount = be64_to_cpu(dqp->q_core.d_icount); 861 __entry->blk_hardlimit = 862 be64_to_cpu(dqp->q_core.d_blk_hardlimit); 863 __entry->blk_softlimit = 864 be64_to_cpu(dqp->q_core.d_blk_softlimit); 865 __entry->ino_hardlimit = 866 be64_to_cpu(dqp->q_core.d_ino_hardlimit); 867 __entry->ino_softlimit = 868 be64_to_cpu(dqp->q_core.d_ino_softlimit); 869 ), 870 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx " 871 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx " 872 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]", 873 MAJOR(__entry->dev), MINOR(__entry->dev), 874 __entry->id, 875 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS), 876 __entry->nrefs, 877 __entry->res_bcount, 878 __entry->bcount, 879 __entry->blk_hardlimit, 880 __entry->blk_softlimit, 881 __entry->icount, 882 __entry->ino_hardlimit, 883 __entry->ino_softlimit) 884 ) 885 886 #define DEFINE_DQUOT_EVENT(name) \ 887 DEFINE_EVENT(xfs_dquot_class, name, \ 888 TP_PROTO(struct xfs_dquot *dqp), \ 889 TP_ARGS(dqp)) 890 DEFINE_DQUOT_EVENT(xfs_dqadjust); 891 DEFINE_DQUOT_EVENT(xfs_dqreclaim_want); 892 DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty); 893 DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy); 894 DEFINE_DQUOT_EVENT(xfs_dqreclaim_done); 895 DEFINE_DQUOT_EVENT(xfs_dqattach_found); 896 DEFINE_DQUOT_EVENT(xfs_dqattach_get); 897 DEFINE_DQUOT_EVENT(xfs_dqalloc); 898 DEFINE_DQUOT_EVENT(xfs_dqtobp_read); 899 DEFINE_DQUOT_EVENT(xfs_dqread); 900 DEFINE_DQUOT_EVENT(xfs_dqread_fail); 901 DEFINE_DQUOT_EVENT(xfs_dqget_hit); 902 DEFINE_DQUOT_EVENT(xfs_dqget_miss); 903 DEFINE_DQUOT_EVENT(xfs_dqget_freeing); 904 DEFINE_DQUOT_EVENT(xfs_dqget_dup); 905 DEFINE_DQUOT_EVENT(xfs_dqput); 906 DEFINE_DQUOT_EVENT(xfs_dqput_free); 907 DEFINE_DQUOT_EVENT(xfs_dqrele); 908 DEFINE_DQUOT_EVENT(xfs_dqflush); 909 DEFINE_DQUOT_EVENT(xfs_dqflush_force); 910 DEFINE_DQUOT_EVENT(xfs_dqflush_done); 911 912 DECLARE_EVENT_CLASS(xfs_loggrant_class, 913 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), 914 TP_ARGS(log, tic), 915 TP_STRUCT__entry( 916 __field(dev_t, dev) 917 __field(char, ocnt) 918 __field(char, cnt) 919 __field(int, curr_res) 920 __field(int, unit_res) 921 __field(unsigned int, flags) 922 __field(int, reserveq) 923 __field(int, writeq) 924 __field(int, grant_reserve_cycle) 925 __field(int, grant_reserve_bytes) 926 __field(int, grant_write_cycle) 927 __field(int, grant_write_bytes) 928 __field(int, curr_cycle) 929 __field(int, curr_block) 930 __field(xfs_lsn_t, tail_lsn) 931 ), 932 TP_fast_assign( 933 __entry->dev = log->l_mp->m_super->s_dev; 934 __entry->ocnt = tic->t_ocnt; 935 __entry->cnt = tic->t_cnt; 936 __entry->curr_res = tic->t_curr_res; 937 __entry->unit_res = tic->t_unit_res; 938 __entry->flags = tic->t_flags; 939 __entry->reserveq = list_empty(&log->l_reserve_head.waiters); 940 __entry->writeq = list_empty(&log->l_write_head.waiters); 941 xlog_crack_grant_head(&log->l_reserve_head.grant, 942 &__entry->grant_reserve_cycle, 943 &__entry->grant_reserve_bytes); 944 xlog_crack_grant_head(&log->l_write_head.grant, 945 &__entry->grant_write_cycle, 946 &__entry->grant_write_bytes); 947 __entry->curr_cycle = log->l_curr_cycle; 948 __entry->curr_block = log->l_curr_block; 949 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn); 950 ), 951 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u " 952 "t_unit_res %u t_flags %s reserveq %s " 953 "writeq %s grant_reserve_cycle %d " 954 "grant_reserve_bytes %d grant_write_cycle %d " 955 "grant_write_bytes %d curr_cycle %d curr_block %d " 956 "tail_cycle %d tail_block %d", 957 MAJOR(__entry->dev), MINOR(__entry->dev), 958 __entry->ocnt, 959 __entry->cnt, 960 __entry->curr_res, 961 __entry->unit_res, 962 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS), 963 __entry->reserveq ? "empty" : "active", 964 __entry->writeq ? "empty" : "active", 965 __entry->grant_reserve_cycle, 966 __entry->grant_reserve_bytes, 967 __entry->grant_write_cycle, 968 __entry->grant_write_bytes, 969 __entry->curr_cycle, 970 __entry->curr_block, 971 CYCLE_LSN(__entry->tail_lsn), 972 BLOCK_LSN(__entry->tail_lsn) 973 ) 974 ) 975 976 #define DEFINE_LOGGRANT_EVENT(name) \ 977 DEFINE_EVENT(xfs_loggrant_class, name, \ 978 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \ 979 TP_ARGS(log, tic)) 980 DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm); 981 DEFINE_LOGGRANT_EVENT(xfs_log_done_perm); 982 DEFINE_LOGGRANT_EVENT(xfs_log_umount_write); 983 DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep); 984 DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake); 985 DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up); 986 DEFINE_LOGGRANT_EVENT(xfs_log_reserve); 987 DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit); 988 DEFINE_LOGGRANT_EVENT(xfs_log_regrant); 989 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit); 990 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter); 991 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit); 992 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub); 993 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter); 994 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit); 995 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub); 996 997 DECLARE_EVENT_CLASS(xfs_log_item_class, 998 TP_PROTO(struct xfs_log_item *lip), 999 TP_ARGS(lip), 1000 TP_STRUCT__entry( 1001 __field(dev_t, dev) 1002 __field(void *, lip) 1003 __field(uint, type) 1004 __field(unsigned long, flags) 1005 __field(xfs_lsn_t, lsn) 1006 ), 1007 TP_fast_assign( 1008 __entry->dev = lip->li_mountp->m_super->s_dev; 1009 __entry->lip = lip; 1010 __entry->type = lip->li_type; 1011 __entry->flags = lip->li_flags; 1012 __entry->lsn = lip->li_lsn; 1013 ), 1014 TP_printk("dev %d:%d lip %p lsn %d/%d type %s flags %s", 1015 MAJOR(__entry->dev), MINOR(__entry->dev), 1016 __entry->lip, 1017 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn), 1018 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC), 1019 __print_flags(__entry->flags, "|", XFS_LI_FLAGS)) 1020 ) 1021 1022 TRACE_EVENT(xfs_log_force, 1023 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip), 1024 TP_ARGS(mp, lsn, caller_ip), 1025 TP_STRUCT__entry( 1026 __field(dev_t, dev) 1027 __field(xfs_lsn_t, lsn) 1028 __field(unsigned long, caller_ip) 1029 ), 1030 TP_fast_assign( 1031 __entry->dev = mp->m_super->s_dev; 1032 __entry->lsn = lsn; 1033 __entry->caller_ip = caller_ip; 1034 ), 1035 TP_printk("dev %d:%d lsn 0x%llx caller %pS", 1036 MAJOR(__entry->dev), MINOR(__entry->dev), 1037 __entry->lsn, (void *)__entry->caller_ip) 1038 ) 1039 1040 #define DEFINE_LOG_ITEM_EVENT(name) \ 1041 DEFINE_EVENT(xfs_log_item_class, name, \ 1042 TP_PROTO(struct xfs_log_item *lip), \ 1043 TP_ARGS(lip)) 1044 DEFINE_LOG_ITEM_EVENT(xfs_ail_push); 1045 DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned); 1046 DEFINE_LOG_ITEM_EVENT(xfs_ail_locked); 1047 DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing); 1048 1049 DECLARE_EVENT_CLASS(xfs_ail_class, 1050 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), 1051 TP_ARGS(lip, old_lsn, new_lsn), 1052 TP_STRUCT__entry( 1053 __field(dev_t, dev) 1054 __field(void *, lip) 1055 __field(uint, type) 1056 __field(unsigned long, flags) 1057 __field(xfs_lsn_t, old_lsn) 1058 __field(xfs_lsn_t, new_lsn) 1059 ), 1060 TP_fast_assign( 1061 __entry->dev = lip->li_mountp->m_super->s_dev; 1062 __entry->lip = lip; 1063 __entry->type = lip->li_type; 1064 __entry->flags = lip->li_flags; 1065 __entry->old_lsn = old_lsn; 1066 __entry->new_lsn = new_lsn; 1067 ), 1068 TP_printk("dev %d:%d lip %p old lsn %d/%d new lsn %d/%d type %s flags %s", 1069 MAJOR(__entry->dev), MINOR(__entry->dev), 1070 __entry->lip, 1071 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn), 1072 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn), 1073 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC), 1074 __print_flags(__entry->flags, "|", XFS_LI_FLAGS)) 1075 ) 1076 1077 #define DEFINE_AIL_EVENT(name) \ 1078 DEFINE_EVENT(xfs_ail_class, name, \ 1079 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \ 1080 TP_ARGS(lip, old_lsn, new_lsn)) 1081 DEFINE_AIL_EVENT(xfs_ail_insert); 1082 DEFINE_AIL_EVENT(xfs_ail_move); 1083 DEFINE_AIL_EVENT(xfs_ail_delete); 1084 1085 TRACE_EVENT(xfs_log_assign_tail_lsn, 1086 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn), 1087 TP_ARGS(log, new_lsn), 1088 TP_STRUCT__entry( 1089 __field(dev_t, dev) 1090 __field(xfs_lsn_t, new_lsn) 1091 __field(xfs_lsn_t, old_lsn) 1092 __field(xfs_lsn_t, last_sync_lsn) 1093 ), 1094 TP_fast_assign( 1095 __entry->dev = log->l_mp->m_super->s_dev; 1096 __entry->new_lsn = new_lsn; 1097 __entry->old_lsn = atomic64_read(&log->l_tail_lsn); 1098 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn); 1099 ), 1100 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d", 1101 MAJOR(__entry->dev), MINOR(__entry->dev), 1102 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn), 1103 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn), 1104 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn)) 1105 ) 1106 1107 DECLARE_EVENT_CLASS(xfs_file_class, 1108 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), 1109 TP_ARGS(ip, count, offset), 1110 TP_STRUCT__entry( 1111 __field(dev_t, dev) 1112 __field(xfs_ino_t, ino) 1113 __field(xfs_fsize_t, size) 1114 __field(loff_t, offset) 1115 __field(size_t, count) 1116 ), 1117 TP_fast_assign( 1118 __entry->dev = VFS_I(ip)->i_sb->s_dev; 1119 __entry->ino = ip->i_ino; 1120 __entry->size = ip->i_d.di_size; 1121 __entry->offset = offset; 1122 __entry->count = count; 1123 ), 1124 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx", 1125 MAJOR(__entry->dev), MINOR(__entry->dev), 1126 __entry->ino, 1127 __entry->size, 1128 __entry->offset, 1129 __entry->count) 1130 ) 1131 1132 #define DEFINE_RW_EVENT(name) \ 1133 DEFINE_EVENT(xfs_file_class, name, \ 1134 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \ 1135 TP_ARGS(ip, count, offset)) 1136 DEFINE_RW_EVENT(xfs_file_buffered_read); 1137 DEFINE_RW_EVENT(xfs_file_direct_read); 1138 DEFINE_RW_EVENT(xfs_file_dax_read); 1139 DEFINE_RW_EVENT(xfs_file_buffered_write); 1140 DEFINE_RW_EVENT(xfs_file_direct_write); 1141 DEFINE_RW_EVENT(xfs_file_dax_write); 1142 1143 DECLARE_EVENT_CLASS(xfs_page_class, 1144 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, 1145 unsigned int len), 1146 TP_ARGS(inode, page, off, len), 1147 TP_STRUCT__entry( 1148 __field(dev_t, dev) 1149 __field(xfs_ino_t, ino) 1150 __field(pgoff_t, pgoff) 1151 __field(loff_t, size) 1152 __field(unsigned long, offset) 1153 __field(unsigned int, length) 1154 ), 1155 TP_fast_assign( 1156 __entry->dev = inode->i_sb->s_dev; 1157 __entry->ino = XFS_I(inode)->i_ino; 1158 __entry->pgoff = page_offset(page); 1159 __entry->size = i_size_read(inode); 1160 __entry->offset = off; 1161 __entry->length = len; 1162 ), 1163 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx " 1164 "length %x", 1165 MAJOR(__entry->dev), MINOR(__entry->dev), 1166 __entry->ino, 1167 __entry->pgoff, 1168 __entry->size, 1169 __entry->offset, 1170 __entry->length) 1171 ) 1172 1173 #define DEFINE_PAGE_EVENT(name) \ 1174 DEFINE_EVENT(xfs_page_class, name, \ 1175 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \ 1176 unsigned int len), \ 1177 TP_ARGS(inode, page, off, len)) 1178 DEFINE_PAGE_EVENT(xfs_writepage); 1179 DEFINE_PAGE_EVENT(xfs_releasepage); 1180 DEFINE_PAGE_EVENT(xfs_invalidatepage); 1181 1182 DECLARE_EVENT_CLASS(xfs_readpage_class, 1183 TP_PROTO(struct inode *inode, int nr_pages), 1184 TP_ARGS(inode, nr_pages), 1185 TP_STRUCT__entry( 1186 __field(dev_t, dev) 1187 __field(xfs_ino_t, ino) 1188 __field(int, nr_pages) 1189 ), 1190 TP_fast_assign( 1191 __entry->dev = inode->i_sb->s_dev; 1192 __entry->ino = inode->i_ino; 1193 __entry->nr_pages = nr_pages; 1194 ), 1195 TP_printk("dev %d:%d ino 0x%llx nr_pages %d", 1196 MAJOR(__entry->dev), MINOR(__entry->dev), 1197 __entry->ino, 1198 __entry->nr_pages) 1199 ) 1200 1201 #define DEFINE_READPAGE_EVENT(name) \ 1202 DEFINE_EVENT(xfs_readpage_class, name, \ 1203 TP_PROTO(struct inode *inode, int nr_pages), \ 1204 TP_ARGS(inode, nr_pages)) 1205 DEFINE_READPAGE_EVENT(xfs_vm_readpage); 1206 DEFINE_READPAGE_EVENT(xfs_vm_readpages); 1207 1208 DECLARE_EVENT_CLASS(xfs_imap_class, 1209 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, 1210 int type, struct xfs_bmbt_irec *irec), 1211 TP_ARGS(ip, offset, count, type, irec), 1212 TP_STRUCT__entry( 1213 __field(dev_t, dev) 1214 __field(xfs_ino_t, ino) 1215 __field(loff_t, size) 1216 __field(loff_t, offset) 1217 __field(size_t, count) 1218 __field(int, type) 1219 __field(xfs_fileoff_t, startoff) 1220 __field(xfs_fsblock_t, startblock) 1221 __field(xfs_filblks_t, blockcount) 1222 ), 1223 TP_fast_assign( 1224 __entry->dev = VFS_I(ip)->i_sb->s_dev; 1225 __entry->ino = ip->i_ino; 1226 __entry->size = ip->i_d.di_size; 1227 __entry->offset = offset; 1228 __entry->count = count; 1229 __entry->type = type; 1230 __entry->startoff = irec ? irec->br_startoff : 0; 1231 __entry->startblock = irec ? irec->br_startblock : 0; 1232 __entry->blockcount = irec ? irec->br_blockcount : 0; 1233 ), 1234 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd " 1235 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx", 1236 MAJOR(__entry->dev), MINOR(__entry->dev), 1237 __entry->ino, 1238 __entry->size, 1239 __entry->offset, 1240 __entry->count, 1241 __print_symbolic(__entry->type, XFS_IO_TYPES), 1242 __entry->startoff, 1243 (int64_t)__entry->startblock, 1244 __entry->blockcount) 1245 ) 1246 1247 #define DEFINE_IOMAP_EVENT(name) \ 1248 DEFINE_EVENT(xfs_imap_class, name, \ 1249 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \ 1250 int type, struct xfs_bmbt_irec *irec), \ 1251 TP_ARGS(ip, offset, count, type, irec)) 1252 DEFINE_IOMAP_EVENT(xfs_map_blocks_found); 1253 DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc); 1254 DEFINE_IOMAP_EVENT(xfs_iomap_alloc); 1255 DEFINE_IOMAP_EVENT(xfs_iomap_found); 1256 1257 DECLARE_EVENT_CLASS(xfs_simple_io_class, 1258 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), 1259 TP_ARGS(ip, offset, count), 1260 TP_STRUCT__entry( 1261 __field(dev_t, dev) 1262 __field(xfs_ino_t, ino) 1263 __field(loff_t, isize) 1264 __field(loff_t, disize) 1265 __field(loff_t, offset) 1266 __field(size_t, count) 1267 ), 1268 TP_fast_assign( 1269 __entry->dev = VFS_I(ip)->i_sb->s_dev; 1270 __entry->ino = ip->i_ino; 1271 __entry->isize = VFS_I(ip)->i_size; 1272 __entry->disize = ip->i_d.di_size; 1273 __entry->offset = offset; 1274 __entry->count = count; 1275 ), 1276 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx " 1277 "offset 0x%llx count %zd", 1278 MAJOR(__entry->dev), MINOR(__entry->dev), 1279 __entry->ino, 1280 __entry->isize, 1281 __entry->disize, 1282 __entry->offset, 1283 __entry->count) 1284 ); 1285 1286 #define DEFINE_SIMPLE_IO_EVENT(name) \ 1287 DEFINE_EVENT(xfs_simple_io_class, name, \ 1288 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \ 1289 TP_ARGS(ip, offset, count)) 1290 DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc); 1291 DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert); 1292 DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize); 1293 DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof); 1294 DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write); 1295 DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten); 1296 DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append); 1297 1298 DECLARE_EVENT_CLASS(xfs_itrunc_class, 1299 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), 1300 TP_ARGS(ip, new_size), 1301 TP_STRUCT__entry( 1302 __field(dev_t, dev) 1303 __field(xfs_ino_t, ino) 1304 __field(xfs_fsize_t, size) 1305 __field(xfs_fsize_t, new_size) 1306 ), 1307 TP_fast_assign( 1308 __entry->dev = VFS_I(ip)->i_sb->s_dev; 1309 __entry->ino = ip->i_ino; 1310 __entry->size = ip->i_d.di_size; 1311 __entry->new_size = new_size; 1312 ), 1313 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx", 1314 MAJOR(__entry->dev), MINOR(__entry->dev), 1315 __entry->ino, 1316 __entry->size, 1317 __entry->new_size) 1318 ) 1319 1320 #define DEFINE_ITRUNC_EVENT(name) \ 1321 DEFINE_EVENT(xfs_itrunc_class, name, \ 1322 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \ 1323 TP_ARGS(ip, new_size)) 1324 DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start); 1325 DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end); 1326 1327 TRACE_EVENT(xfs_pagecache_inval, 1328 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish), 1329 TP_ARGS(ip, start, finish), 1330 TP_STRUCT__entry( 1331 __field(dev_t, dev) 1332 __field(xfs_ino_t, ino) 1333 __field(xfs_fsize_t, size) 1334 __field(xfs_off_t, start) 1335 __field(xfs_off_t, finish) 1336 ), 1337 TP_fast_assign( 1338 __entry->dev = VFS_I(ip)->i_sb->s_dev; 1339 __entry->ino = ip->i_ino; 1340 __entry->size = ip->i_d.di_size; 1341 __entry->start = start; 1342 __entry->finish = finish; 1343 ), 1344 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx", 1345 MAJOR(__entry->dev), MINOR(__entry->dev), 1346 __entry->ino, 1347 __entry->size, 1348 __entry->start, 1349 __entry->finish) 1350 ); 1351 1352 TRACE_EVENT(xfs_bunmap, 1353 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len, 1354 int flags, unsigned long caller_ip), 1355 TP_ARGS(ip, bno, len, flags, caller_ip), 1356 TP_STRUCT__entry( 1357 __field(dev_t, dev) 1358 __field(xfs_ino_t, ino) 1359 __field(xfs_fsize_t, size) 1360 __field(xfs_fileoff_t, bno) 1361 __field(xfs_filblks_t, len) 1362 __field(unsigned long, caller_ip) 1363 __field(int, flags) 1364 ), 1365 TP_fast_assign( 1366 __entry->dev = VFS_I(ip)->i_sb->s_dev; 1367 __entry->ino = ip->i_ino; 1368 __entry->size = ip->i_d.di_size; 1369 __entry->bno = bno; 1370 __entry->len = len; 1371 __entry->caller_ip = caller_ip; 1372 __entry->flags = flags; 1373 ), 1374 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx" 1375 "flags %s caller %pS", 1376 MAJOR(__entry->dev), MINOR(__entry->dev), 1377 __entry->ino, 1378 __entry->size, 1379 __entry->bno, 1380 __entry->len, 1381 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS), 1382 (void *)__entry->caller_ip) 1383 1384 ); 1385 1386 DECLARE_EVENT_CLASS(xfs_extent_busy_class, 1387 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 1388 xfs_agblock_t agbno, xfs_extlen_t len), 1389 TP_ARGS(mp, agno, agbno, len), 1390 TP_STRUCT__entry( 1391 __field(dev_t, dev) 1392 __field(xfs_agnumber_t, agno) 1393 __field(xfs_agblock_t, agbno) 1394 __field(xfs_extlen_t, len) 1395 ), 1396 TP_fast_assign( 1397 __entry->dev = mp->m_super->s_dev; 1398 __entry->agno = agno; 1399 __entry->agbno = agbno; 1400 __entry->len = len; 1401 ), 1402 TP_printk("dev %d:%d agno %u agbno %u len %u", 1403 MAJOR(__entry->dev), MINOR(__entry->dev), 1404 __entry->agno, 1405 __entry->agbno, 1406 __entry->len) 1407 ); 1408 #define DEFINE_BUSY_EVENT(name) \ 1409 DEFINE_EVENT(xfs_extent_busy_class, name, \ 1410 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 1411 xfs_agblock_t agbno, xfs_extlen_t len), \ 1412 TP_ARGS(mp, agno, agbno, len)) 1413 DEFINE_BUSY_EVENT(xfs_extent_busy); 1414 DEFINE_BUSY_EVENT(xfs_extent_busy_enomem); 1415 DEFINE_BUSY_EVENT(xfs_extent_busy_force); 1416 DEFINE_BUSY_EVENT(xfs_extent_busy_reuse); 1417 DEFINE_BUSY_EVENT(xfs_extent_busy_clear); 1418 1419 TRACE_EVENT(xfs_extent_busy_trim, 1420 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 1421 xfs_agblock_t agbno, xfs_extlen_t len, 1422 xfs_agblock_t tbno, xfs_extlen_t tlen), 1423 TP_ARGS(mp, agno, agbno, len, tbno, tlen), 1424 TP_STRUCT__entry( 1425 __field(dev_t, dev) 1426 __field(xfs_agnumber_t, agno) 1427 __field(xfs_agblock_t, agbno) 1428 __field(xfs_extlen_t, len) 1429 __field(xfs_agblock_t, tbno) 1430 __field(xfs_extlen_t, tlen) 1431 ), 1432 TP_fast_assign( 1433 __entry->dev = mp->m_super->s_dev; 1434 __entry->agno = agno; 1435 __entry->agbno = agbno; 1436 __entry->len = len; 1437 __entry->tbno = tbno; 1438 __entry->tlen = tlen; 1439 ), 1440 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u", 1441 MAJOR(__entry->dev), MINOR(__entry->dev), 1442 __entry->agno, 1443 __entry->agbno, 1444 __entry->len, 1445 __entry->tbno, 1446 __entry->tlen) 1447 ); 1448 1449 DECLARE_EVENT_CLASS(xfs_agf_class, 1450 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags, 1451 unsigned long caller_ip), 1452 TP_ARGS(mp, agf, flags, caller_ip), 1453 TP_STRUCT__entry( 1454 __field(dev_t, dev) 1455 __field(xfs_agnumber_t, agno) 1456 __field(int, flags) 1457 __field(__u32, length) 1458 __field(__u32, bno_root) 1459 __field(__u32, cnt_root) 1460 __field(__u32, bno_level) 1461 __field(__u32, cnt_level) 1462 __field(__u32, flfirst) 1463 __field(__u32, fllast) 1464 __field(__u32, flcount) 1465 __field(__u32, freeblks) 1466 __field(__u32, longest) 1467 __field(unsigned long, caller_ip) 1468 ), 1469 TP_fast_assign( 1470 __entry->dev = mp->m_super->s_dev; 1471 __entry->agno = be32_to_cpu(agf->agf_seqno), 1472 __entry->flags = flags; 1473 __entry->length = be32_to_cpu(agf->agf_length), 1474 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]), 1475 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]), 1476 __entry->bno_level = 1477 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]), 1478 __entry->cnt_level = 1479 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]), 1480 __entry->flfirst = be32_to_cpu(agf->agf_flfirst), 1481 __entry->fllast = be32_to_cpu(agf->agf_fllast), 1482 __entry->flcount = be32_to_cpu(agf->agf_flcount), 1483 __entry->freeblks = be32_to_cpu(agf->agf_freeblks), 1484 __entry->longest = be32_to_cpu(agf->agf_longest); 1485 __entry->caller_ip = caller_ip; 1486 ), 1487 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u " 1488 "levels b %u c %u flfirst %u fllast %u flcount %u " 1489 "freeblks %u longest %u caller %pS", 1490 MAJOR(__entry->dev), MINOR(__entry->dev), 1491 __entry->agno, 1492 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS), 1493 __entry->length, 1494 __entry->bno_root, 1495 __entry->cnt_root, 1496 __entry->bno_level, 1497 __entry->cnt_level, 1498 __entry->flfirst, 1499 __entry->fllast, 1500 __entry->flcount, 1501 __entry->freeblks, 1502 __entry->longest, 1503 (void *)__entry->caller_ip) 1504 ); 1505 #define DEFINE_AGF_EVENT(name) \ 1506 DEFINE_EVENT(xfs_agf_class, name, \ 1507 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags, \ 1508 unsigned long caller_ip), \ 1509 TP_ARGS(mp, agf, flags, caller_ip)) 1510 DEFINE_AGF_EVENT(xfs_agf); 1511 DEFINE_AGF_EVENT(xfs_agfl_reset); 1512 1513 TRACE_EVENT(xfs_free_extent, 1514 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, 1515 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft, 1516 int haveright), 1517 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright), 1518 TP_STRUCT__entry( 1519 __field(dev_t, dev) 1520 __field(xfs_agnumber_t, agno) 1521 __field(xfs_agblock_t, agbno) 1522 __field(xfs_extlen_t, len) 1523 __field(int, resv) 1524 __field(int, haveleft) 1525 __field(int, haveright) 1526 ), 1527 TP_fast_assign( 1528 __entry->dev = mp->m_super->s_dev; 1529 __entry->agno = agno; 1530 __entry->agbno = agbno; 1531 __entry->len = len; 1532 __entry->resv = resv; 1533 __entry->haveleft = haveleft; 1534 __entry->haveright = haveright; 1535 ), 1536 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s", 1537 MAJOR(__entry->dev), MINOR(__entry->dev), 1538 __entry->agno, 1539 __entry->agbno, 1540 __entry->len, 1541 __entry->resv, 1542 __entry->haveleft ? 1543 (__entry->haveright ? "both" : "left") : 1544 (__entry->haveright ? "right" : "none")) 1545 1546 ); 1547 1548 DECLARE_EVENT_CLASS(xfs_alloc_class, 1549 TP_PROTO(struct xfs_alloc_arg *args), 1550 TP_ARGS(args), 1551 TP_STRUCT__entry( 1552 __field(dev_t, dev) 1553 __field(xfs_agnumber_t, agno) 1554 __field(xfs_agblock_t, agbno) 1555 __field(xfs_extlen_t, minlen) 1556 __field(xfs_extlen_t, maxlen) 1557 __field(xfs_extlen_t, mod) 1558 __field(xfs_extlen_t, prod) 1559 __field(xfs_extlen_t, minleft) 1560 __field(xfs_extlen_t, total) 1561 __field(xfs_extlen_t, alignment) 1562 __field(xfs_extlen_t, minalignslop) 1563 __field(xfs_extlen_t, len) 1564 __field(short, type) 1565 __field(short, otype) 1566 __field(char, wasdel) 1567 __field(char, wasfromfl) 1568 __field(int, resv) 1569 __field(int, datatype) 1570 __field(xfs_fsblock_t, firstblock) 1571 ), 1572 TP_fast_assign( 1573 __entry->dev = args->mp->m_super->s_dev; 1574 __entry->agno = args->agno; 1575 __entry->agbno = args->agbno; 1576 __entry->minlen = args->minlen; 1577 __entry->maxlen = args->maxlen; 1578 __entry->mod = args->mod; 1579 __entry->prod = args->prod; 1580 __entry->minleft = args->minleft; 1581 __entry->total = args->total; 1582 __entry->alignment = args->alignment; 1583 __entry->minalignslop = args->minalignslop; 1584 __entry->len = args->len; 1585 __entry->type = args->type; 1586 __entry->otype = args->otype; 1587 __entry->wasdel = args->wasdel; 1588 __entry->wasfromfl = args->wasfromfl; 1589 __entry->resv = args->resv; 1590 __entry->datatype = args->datatype; 1591 __entry->firstblock = args->tp->t_firstblock; 1592 ), 1593 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u " 1594 "prod %u minleft %u total %u alignment %u minalignslop %u " 1595 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d " 1596 "datatype 0x%x firstblock 0x%llx", 1597 MAJOR(__entry->dev), MINOR(__entry->dev), 1598 __entry->agno, 1599 __entry->agbno, 1600 __entry->minlen, 1601 __entry->maxlen, 1602 __entry->mod, 1603 __entry->prod, 1604 __entry->minleft, 1605 __entry->total, 1606 __entry->alignment, 1607 __entry->minalignslop, 1608 __entry->len, 1609 __print_symbolic(__entry->type, XFS_ALLOC_TYPES), 1610 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES), 1611 __entry->wasdel, 1612 __entry->wasfromfl, 1613 __entry->resv, 1614 __entry->datatype, 1615 (unsigned long long)__entry->firstblock) 1616 ) 1617 1618 #define DEFINE_ALLOC_EVENT(name) \ 1619 DEFINE_EVENT(xfs_alloc_class, name, \ 1620 TP_PROTO(struct xfs_alloc_arg *args), \ 1621 TP_ARGS(args)) 1622 DEFINE_ALLOC_EVENT(xfs_alloc_exact_done); 1623 DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound); 1624 DEFINE_ALLOC_EVENT(xfs_alloc_exact_error); 1625 DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft); 1626 DEFINE_ALLOC_EVENT(xfs_alloc_near_first); 1627 DEFINE_ALLOC_EVENT(xfs_alloc_near_greater); 1628 DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser); 1629 DEFINE_ALLOC_EVENT(xfs_alloc_near_error); 1630 DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry); 1631 DEFINE_ALLOC_EVENT(xfs_alloc_near_busy); 1632 DEFINE_ALLOC_EVENT(xfs_alloc_size_neither); 1633 DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry); 1634 DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft); 1635 DEFINE_ALLOC_EVENT(xfs_alloc_size_done); 1636 DEFINE_ALLOC_EVENT(xfs_alloc_size_error); 1637 DEFINE_ALLOC_EVENT(xfs_alloc_size_busy); 1638 DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist); 1639 DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough); 1640 DEFINE_ALLOC_EVENT(xfs_alloc_small_done); 1641 DEFINE_ALLOC_EVENT(xfs_alloc_small_error); 1642 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs); 1643 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix); 1644 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp); 1645 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed); 1646 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed); 1647 1648 DECLARE_EVENT_CLASS(xfs_da_class, 1649 TP_PROTO(struct xfs_da_args *args), 1650 TP_ARGS(args), 1651 TP_STRUCT__entry( 1652 __field(dev_t, dev) 1653 __field(xfs_ino_t, ino) 1654 __dynamic_array(char, name, args->namelen) 1655 __field(int, namelen) 1656 __field(xfs_dahash_t, hashval) 1657 __field(xfs_ino_t, inumber) 1658 __field(int, op_flags) 1659 ), 1660 TP_fast_assign( 1661 __entry->dev = VFS_I(args->dp)->i_sb->s_dev; 1662 __entry->ino = args->dp->i_ino; 1663 if (args->namelen) 1664 memcpy(__get_str(name), args->name, args->namelen); 1665 __entry->namelen = args->namelen; 1666 __entry->hashval = args->hashval; 1667 __entry->inumber = args->inumber; 1668 __entry->op_flags = args->op_flags; 1669 ), 1670 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x " 1671 "inumber 0x%llx op_flags %s", 1672 MAJOR(__entry->dev), MINOR(__entry->dev), 1673 __entry->ino, 1674 __entry->namelen, 1675 __entry->namelen ? __get_str(name) : NULL, 1676 __entry->namelen, 1677 __entry->hashval, 1678 __entry->inumber, 1679 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS)) 1680 ) 1681 1682 #define DEFINE_DIR2_EVENT(name) \ 1683 DEFINE_EVENT(xfs_da_class, name, \ 1684 TP_PROTO(struct xfs_da_args *args), \ 1685 TP_ARGS(args)) 1686 DEFINE_DIR2_EVENT(xfs_dir2_sf_addname); 1687 DEFINE_DIR2_EVENT(xfs_dir2_sf_create); 1688 DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup); 1689 DEFINE_DIR2_EVENT(xfs_dir2_sf_replace); 1690 DEFINE_DIR2_EVENT(xfs_dir2_sf_removename); 1691 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4); 1692 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8); 1693 DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block); 1694 DEFINE_DIR2_EVENT(xfs_dir2_block_addname); 1695 DEFINE_DIR2_EVENT(xfs_dir2_block_lookup); 1696 DEFINE_DIR2_EVENT(xfs_dir2_block_replace); 1697 DEFINE_DIR2_EVENT(xfs_dir2_block_removename); 1698 DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf); 1699 DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf); 1700 DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname); 1701 DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup); 1702 DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace); 1703 DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename); 1704 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block); 1705 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node); 1706 DEFINE_DIR2_EVENT(xfs_dir2_node_addname); 1707 DEFINE_DIR2_EVENT(xfs_dir2_node_lookup); 1708 DEFINE_DIR2_EVENT(xfs_dir2_node_replace); 1709 DEFINE_DIR2_EVENT(xfs_dir2_node_removename); 1710 DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf); 1711 1712 DECLARE_EVENT_CLASS(xfs_attr_class, 1713 TP_PROTO(struct xfs_da_args *args), 1714 TP_ARGS(args), 1715 TP_STRUCT__entry( 1716 __field(dev_t, dev) 1717 __field(xfs_ino_t, ino) 1718 __dynamic_array(char, name, args->namelen) 1719 __field(int, namelen) 1720 __field(int, valuelen) 1721 __field(xfs_dahash_t, hashval) 1722 __field(int, flags) 1723 __field(int, op_flags) 1724 ), 1725 TP_fast_assign( 1726 __entry->dev = VFS_I(args->dp)->i_sb->s_dev; 1727 __entry->ino = args->dp->i_ino; 1728 if (args->namelen) 1729 memcpy(__get_str(name), args->name, args->namelen); 1730 __entry->namelen = args->namelen; 1731 __entry->valuelen = args->valuelen; 1732 __entry->hashval = args->hashval; 1733 __entry->flags = args->flags; 1734 __entry->op_flags = args->op_flags; 1735 ), 1736 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d " 1737 "hashval 0x%x flags %s op_flags %s", 1738 MAJOR(__entry->dev), MINOR(__entry->dev), 1739 __entry->ino, 1740 __entry->namelen, 1741 __entry->namelen ? __get_str(name) : NULL, 1742 __entry->namelen, 1743 __entry->valuelen, 1744 __entry->hashval, 1745 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS), 1746 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS)) 1747 ) 1748 1749 #define DEFINE_ATTR_EVENT(name) \ 1750 DEFINE_EVENT(xfs_attr_class, name, \ 1751 TP_PROTO(struct xfs_da_args *args), \ 1752 TP_ARGS(args)) 1753 DEFINE_ATTR_EVENT(xfs_attr_sf_add); 1754 DEFINE_ATTR_EVENT(xfs_attr_sf_addname); 1755 DEFINE_ATTR_EVENT(xfs_attr_sf_create); 1756 DEFINE_ATTR_EVENT(xfs_attr_sf_lookup); 1757 DEFINE_ATTR_EVENT(xfs_attr_sf_remove); 1758 DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf); 1759 1760 DEFINE_ATTR_EVENT(xfs_attr_leaf_add); 1761 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old); 1762 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new); 1763 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work); 1764 DEFINE_ATTR_EVENT(xfs_attr_leaf_addname); 1765 DEFINE_ATTR_EVENT(xfs_attr_leaf_create); 1766 DEFINE_ATTR_EVENT(xfs_attr_leaf_compact); 1767 DEFINE_ATTR_EVENT(xfs_attr_leaf_get); 1768 DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup); 1769 DEFINE_ATTR_EVENT(xfs_attr_leaf_replace); 1770 DEFINE_ATTR_EVENT(xfs_attr_leaf_remove); 1771 DEFINE_ATTR_EVENT(xfs_attr_leaf_removename); 1772 DEFINE_ATTR_EVENT(xfs_attr_leaf_split); 1773 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before); 1774 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after); 1775 DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag); 1776 DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag); 1777 DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags); 1778 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf); 1779 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node); 1780 DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance); 1781 DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance); 1782 DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall); 1783 1784 DEFINE_ATTR_EVENT(xfs_attr_node_addname); 1785 DEFINE_ATTR_EVENT(xfs_attr_node_get); 1786 DEFINE_ATTR_EVENT(xfs_attr_node_replace); 1787 DEFINE_ATTR_EVENT(xfs_attr_node_removename); 1788 1789 DEFINE_ATTR_EVENT(xfs_attr_fillstate); 1790 DEFINE_ATTR_EVENT(xfs_attr_refillstate); 1791 1792 DEFINE_ATTR_EVENT(xfs_attr_rmtval_get); 1793 DEFINE_ATTR_EVENT(xfs_attr_rmtval_set); 1794 DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove); 1795 1796 #define DEFINE_DA_EVENT(name) \ 1797 DEFINE_EVENT(xfs_da_class, name, \ 1798 TP_PROTO(struct xfs_da_args *args), \ 1799 TP_ARGS(args)) 1800 DEFINE_DA_EVENT(xfs_da_split); 1801 DEFINE_DA_EVENT(xfs_da_join); 1802 DEFINE_DA_EVENT(xfs_da_link_before); 1803 DEFINE_DA_EVENT(xfs_da_link_after); 1804 DEFINE_DA_EVENT(xfs_da_unlink_back); 1805 DEFINE_DA_EVENT(xfs_da_unlink_forward); 1806 DEFINE_DA_EVENT(xfs_da_root_split); 1807 DEFINE_DA_EVENT(xfs_da_root_join); 1808 DEFINE_DA_EVENT(xfs_da_node_add); 1809 DEFINE_DA_EVENT(xfs_da_node_create); 1810 DEFINE_DA_EVENT(xfs_da_node_split); 1811 DEFINE_DA_EVENT(xfs_da_node_remove); 1812 DEFINE_DA_EVENT(xfs_da_node_rebalance); 1813 DEFINE_DA_EVENT(xfs_da_node_unbalance); 1814 DEFINE_DA_EVENT(xfs_da_node_toosmall); 1815 DEFINE_DA_EVENT(xfs_da_swap_lastblock); 1816 DEFINE_DA_EVENT(xfs_da_grow_inode); 1817 DEFINE_DA_EVENT(xfs_da_shrink_inode); 1818 DEFINE_DA_EVENT(xfs_da_fixhashpath); 1819 DEFINE_DA_EVENT(xfs_da_path_shift); 1820 1821 DECLARE_EVENT_CLASS(xfs_dir2_space_class, 1822 TP_PROTO(struct xfs_da_args *args, int idx), 1823 TP_ARGS(args, idx), 1824 TP_STRUCT__entry( 1825 __field(dev_t, dev) 1826 __field(xfs_ino_t, ino) 1827 __field(int, op_flags) 1828 __field(int, idx) 1829 ), 1830 TP_fast_assign( 1831 __entry->dev = VFS_I(args->dp)->i_sb->s_dev; 1832 __entry->ino = args->dp->i_ino; 1833 __entry->op_flags = args->op_flags; 1834 __entry->idx = idx; 1835 ), 1836 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d", 1837 MAJOR(__entry->dev), MINOR(__entry->dev), 1838 __entry->ino, 1839 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS), 1840 __entry->idx) 1841 ) 1842 1843 #define DEFINE_DIR2_SPACE_EVENT(name) \ 1844 DEFINE_EVENT(xfs_dir2_space_class, name, \ 1845 TP_PROTO(struct xfs_da_args *args, int idx), \ 1846 TP_ARGS(args, idx)) 1847 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add); 1848 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove); 1849 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode); 1850 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode); 1851 1852 TRACE_EVENT(xfs_dir2_leafn_moveents, 1853 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count), 1854 TP_ARGS(args, src_idx, dst_idx, count), 1855 TP_STRUCT__entry( 1856 __field(dev_t, dev) 1857 __field(xfs_ino_t, ino) 1858 __field(int, op_flags) 1859 __field(int, src_idx) 1860 __field(int, dst_idx) 1861 __field(int, count) 1862 ), 1863 TP_fast_assign( 1864 __entry->dev = VFS_I(args->dp)->i_sb->s_dev; 1865 __entry->ino = args->dp->i_ino; 1866 __entry->op_flags = args->op_flags; 1867 __entry->src_idx = src_idx; 1868 __entry->dst_idx = dst_idx; 1869 __entry->count = count; 1870 ), 1871 TP_printk("dev %d:%d ino 0x%llx op_flags %s " 1872 "src_idx %d dst_idx %d count %d", 1873 MAJOR(__entry->dev), MINOR(__entry->dev), 1874 __entry->ino, 1875 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS), 1876 __entry->src_idx, 1877 __entry->dst_idx, 1878 __entry->count) 1879 ); 1880 1881 #define XFS_SWAPEXT_INODES \ 1882 { 0, "target" }, \ 1883 { 1, "temp" } 1884 1885 #define XFS_INODE_FORMAT_STR \ 1886 { 0, "invalid" }, \ 1887 { 1, "local" }, \ 1888 { 2, "extent" }, \ 1889 { 3, "btree" } 1890 1891 DECLARE_EVENT_CLASS(xfs_swap_extent_class, 1892 TP_PROTO(struct xfs_inode *ip, int which), 1893 TP_ARGS(ip, which), 1894 TP_STRUCT__entry( 1895 __field(dev_t, dev) 1896 __field(int, which) 1897 __field(xfs_ino_t, ino) 1898 __field(int, format) 1899 __field(int, nex) 1900 __field(int, broot_size) 1901 __field(int, fork_off) 1902 ), 1903 TP_fast_assign( 1904 __entry->dev = VFS_I(ip)->i_sb->s_dev; 1905 __entry->which = which; 1906 __entry->ino = ip->i_ino; 1907 __entry->format = ip->i_d.di_format; 1908 __entry->nex = ip->i_d.di_nextents; 1909 __entry->broot_size = ip->i_df.if_broot_bytes; 1910 __entry->fork_off = XFS_IFORK_BOFF(ip); 1911 ), 1912 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, " 1913 "broot size %d, fork offset %d", 1914 MAJOR(__entry->dev), MINOR(__entry->dev), 1915 __entry->ino, 1916 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES), 1917 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR), 1918 __entry->nex, 1919 __entry->broot_size, 1920 __entry->fork_off) 1921 ) 1922 1923 #define DEFINE_SWAPEXT_EVENT(name) \ 1924 DEFINE_EVENT(xfs_swap_extent_class, name, \ 1925 TP_PROTO(struct xfs_inode *ip, int which), \ 1926 TP_ARGS(ip, which)) 1927 1928 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before); 1929 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after); 1930 1931 TRACE_EVENT(xfs_log_recover, 1932 TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk), 1933 TP_ARGS(log, headblk, tailblk), 1934 TP_STRUCT__entry( 1935 __field(dev_t, dev) 1936 __field(xfs_daddr_t, headblk) 1937 __field(xfs_daddr_t, tailblk) 1938 ), 1939 TP_fast_assign( 1940 __entry->dev = log->l_mp->m_super->s_dev; 1941 __entry->headblk = headblk; 1942 __entry->tailblk = tailblk; 1943 ), 1944 TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx", 1945 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk, 1946 __entry->tailblk) 1947 ) 1948 1949 TRACE_EVENT(xfs_log_recover_record, 1950 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass), 1951 TP_ARGS(log, rhead, pass), 1952 TP_STRUCT__entry( 1953 __field(dev_t, dev) 1954 __field(xfs_lsn_t, lsn) 1955 __field(int, len) 1956 __field(int, num_logops) 1957 __field(int, pass) 1958 ), 1959 TP_fast_assign( 1960 __entry->dev = log->l_mp->m_super->s_dev; 1961 __entry->lsn = be64_to_cpu(rhead->h_lsn); 1962 __entry->len = be32_to_cpu(rhead->h_len); 1963 __entry->num_logops = be32_to_cpu(rhead->h_num_logops); 1964 __entry->pass = pass; 1965 ), 1966 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d", 1967 MAJOR(__entry->dev), MINOR(__entry->dev), 1968 __entry->lsn, __entry->len, __entry->num_logops, 1969 __entry->pass) 1970 ) 1971 1972 DECLARE_EVENT_CLASS(xfs_log_recover_item_class, 1973 TP_PROTO(struct xlog *log, struct xlog_recover *trans, 1974 struct xlog_recover_item *item, int pass), 1975 TP_ARGS(log, trans, item, pass), 1976 TP_STRUCT__entry( 1977 __field(dev_t, dev) 1978 __field(unsigned long, item) 1979 __field(xlog_tid_t, tid) 1980 __field(xfs_lsn_t, lsn) 1981 __field(int, type) 1982 __field(int, pass) 1983 __field(int, count) 1984 __field(int, total) 1985 ), 1986 TP_fast_assign( 1987 __entry->dev = log->l_mp->m_super->s_dev; 1988 __entry->item = (unsigned long)item; 1989 __entry->tid = trans->r_log_tid; 1990 __entry->lsn = trans->r_lsn; 1991 __entry->type = ITEM_TYPE(item); 1992 __entry->pass = pass; 1993 __entry->count = item->ri_cnt; 1994 __entry->total = item->ri_total; 1995 ), 1996 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, " 1997 "item type %s item region count/total %d/%d", 1998 MAJOR(__entry->dev), MINOR(__entry->dev), 1999 __entry->tid, 2000 __entry->lsn, 2001 __entry->pass, 2002 (void *)__entry->item, 2003 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC), 2004 __entry->count, 2005 __entry->total) 2006 ) 2007 2008 #define DEFINE_LOG_RECOVER_ITEM(name) \ 2009 DEFINE_EVENT(xfs_log_recover_item_class, name, \ 2010 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \ 2011 struct xlog_recover_item *item, int pass), \ 2012 TP_ARGS(log, trans, item, pass)) 2013 2014 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add); 2015 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont); 2016 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head); 2017 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail); 2018 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover); 2019 2020 DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class, 2021 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), 2022 TP_ARGS(log, buf_f), 2023 TP_STRUCT__entry( 2024 __field(dev_t, dev) 2025 __field(int64_t, blkno) 2026 __field(unsigned short, len) 2027 __field(unsigned short, flags) 2028 __field(unsigned short, size) 2029 __field(unsigned int, map_size) 2030 ), 2031 TP_fast_assign( 2032 __entry->dev = log->l_mp->m_super->s_dev; 2033 __entry->blkno = buf_f->blf_blkno; 2034 __entry->len = buf_f->blf_len; 2035 __entry->flags = buf_f->blf_flags; 2036 __entry->size = buf_f->blf_size; 2037 __entry->map_size = buf_f->blf_map_size; 2038 ), 2039 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, " 2040 "map_size %d", 2041 MAJOR(__entry->dev), MINOR(__entry->dev), 2042 __entry->blkno, 2043 __entry->len, 2044 __entry->flags, 2045 __entry->size, 2046 __entry->map_size) 2047 ) 2048 2049 #define DEFINE_LOG_RECOVER_BUF_ITEM(name) \ 2050 DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \ 2051 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \ 2052 TP_ARGS(log, buf_f)) 2053 2054 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel); 2055 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel); 2056 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add); 2057 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc); 2058 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover); 2059 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip); 2060 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf); 2061 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf); 2062 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf); 2063 2064 DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class, 2065 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), 2066 TP_ARGS(log, in_f), 2067 TP_STRUCT__entry( 2068 __field(dev_t, dev) 2069 __field(xfs_ino_t, ino) 2070 __field(unsigned short, size) 2071 __field(int, fields) 2072 __field(unsigned short, asize) 2073 __field(unsigned short, dsize) 2074 __field(int64_t, blkno) 2075 __field(int, len) 2076 __field(int, boffset) 2077 ), 2078 TP_fast_assign( 2079 __entry->dev = log->l_mp->m_super->s_dev; 2080 __entry->ino = in_f->ilf_ino; 2081 __entry->size = in_f->ilf_size; 2082 __entry->fields = in_f->ilf_fields; 2083 __entry->asize = in_f->ilf_asize; 2084 __entry->dsize = in_f->ilf_dsize; 2085 __entry->blkno = in_f->ilf_blkno; 2086 __entry->len = in_f->ilf_len; 2087 __entry->boffset = in_f->ilf_boffset; 2088 ), 2089 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, " 2090 "dsize %d, blkno 0x%llx, len %d, boffset %d", 2091 MAJOR(__entry->dev), MINOR(__entry->dev), 2092 __entry->ino, 2093 __entry->size, 2094 __entry->fields, 2095 __entry->asize, 2096 __entry->dsize, 2097 __entry->blkno, 2098 __entry->len, 2099 __entry->boffset) 2100 ) 2101 #define DEFINE_LOG_RECOVER_INO_ITEM(name) \ 2102 DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \ 2103 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \ 2104 TP_ARGS(log, in_f)) 2105 2106 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover); 2107 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel); 2108 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip); 2109 2110 DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class, 2111 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), 2112 TP_ARGS(log, in_f), 2113 TP_STRUCT__entry( 2114 __field(dev_t, dev) 2115 __field(xfs_agnumber_t, agno) 2116 __field(xfs_agblock_t, agbno) 2117 __field(unsigned int, count) 2118 __field(unsigned int, isize) 2119 __field(xfs_agblock_t, length) 2120 __field(unsigned int, gen) 2121 ), 2122 TP_fast_assign( 2123 __entry->dev = log->l_mp->m_super->s_dev; 2124 __entry->agno = be32_to_cpu(in_f->icl_ag); 2125 __entry->agbno = be32_to_cpu(in_f->icl_agbno); 2126 __entry->count = be32_to_cpu(in_f->icl_count); 2127 __entry->isize = be32_to_cpu(in_f->icl_isize); 2128 __entry->length = be32_to_cpu(in_f->icl_length); 2129 __entry->gen = be32_to_cpu(in_f->icl_gen); 2130 ), 2131 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u " 2132 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev), 2133 __entry->agno, __entry->agbno, __entry->count, __entry->isize, 2134 __entry->length, __entry->gen) 2135 ) 2136 #define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \ 2137 DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \ 2138 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \ 2139 TP_ARGS(log, in_f)) 2140 2141 DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel); 2142 DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover); 2143 2144 DECLARE_EVENT_CLASS(xfs_discard_class, 2145 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 2146 xfs_agblock_t agbno, xfs_extlen_t len), 2147 TP_ARGS(mp, agno, agbno, len), 2148 TP_STRUCT__entry( 2149 __field(dev_t, dev) 2150 __field(xfs_agnumber_t, agno) 2151 __field(xfs_agblock_t, agbno) 2152 __field(xfs_extlen_t, len) 2153 ), 2154 TP_fast_assign( 2155 __entry->dev = mp->m_super->s_dev; 2156 __entry->agno = agno; 2157 __entry->agbno = agbno; 2158 __entry->len = len; 2159 ), 2160 TP_printk("dev %d:%d agno %u agbno %u len %u", 2161 MAJOR(__entry->dev), MINOR(__entry->dev), 2162 __entry->agno, 2163 __entry->agbno, 2164 __entry->len) 2165 ) 2166 2167 #define DEFINE_DISCARD_EVENT(name) \ 2168 DEFINE_EVENT(xfs_discard_class, name, \ 2169 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 2170 xfs_agblock_t agbno, xfs_extlen_t len), \ 2171 TP_ARGS(mp, agno, agbno, len)) 2172 DEFINE_DISCARD_EVENT(xfs_discard_extent); 2173 DEFINE_DISCARD_EVENT(xfs_discard_toosmall); 2174 DEFINE_DISCARD_EVENT(xfs_discard_exclude); 2175 DEFINE_DISCARD_EVENT(xfs_discard_busy); 2176 2177 /* btree cursor events */ 2178 DECLARE_EVENT_CLASS(xfs_btree_cur_class, 2179 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), 2180 TP_ARGS(cur, level, bp), 2181 TP_STRUCT__entry( 2182 __field(dev_t, dev) 2183 __field(xfs_btnum_t, btnum) 2184 __field(int, level) 2185 __field(int, nlevels) 2186 __field(int, ptr) 2187 __field(xfs_daddr_t, daddr) 2188 ), 2189 TP_fast_assign( 2190 __entry->dev = cur->bc_mp->m_super->s_dev; 2191 __entry->btnum = cur->bc_btnum; 2192 __entry->level = level; 2193 __entry->nlevels = cur->bc_nlevels; 2194 __entry->ptr = cur->bc_ptrs[level]; 2195 __entry->daddr = bp ? bp->b_bn : -1; 2196 ), 2197 TP_printk("dev %d:%d btnum %d level %d/%d ptr %d daddr 0x%llx", 2198 MAJOR(__entry->dev), MINOR(__entry->dev), 2199 __entry->btnum, 2200 __entry->level, 2201 __entry->nlevels, 2202 __entry->ptr, 2203 (unsigned long long)__entry->daddr) 2204 ) 2205 2206 #define DEFINE_BTREE_CUR_EVENT(name) \ 2207 DEFINE_EVENT(xfs_btree_cur_class, name, \ 2208 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \ 2209 TP_ARGS(cur, level, bp)) 2210 DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys); 2211 DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range); 2212 2213 /* deferred ops */ 2214 struct xfs_defer_pending; 2215 2216 DECLARE_EVENT_CLASS(xfs_defer_class, 2217 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), 2218 TP_ARGS(tp, caller_ip), 2219 TP_STRUCT__entry( 2220 __field(dev_t, dev) 2221 __field(struct xfs_trans *, tp) 2222 __field(char, committed) 2223 __field(unsigned long, caller_ip) 2224 ), 2225 TP_fast_assign( 2226 __entry->dev = tp->t_mountp->m_super->s_dev; 2227 __entry->tp = tp; 2228 __entry->caller_ip = caller_ip; 2229 ), 2230 TP_printk("dev %d:%d tp %p caller %pS", 2231 MAJOR(__entry->dev), MINOR(__entry->dev), 2232 __entry->tp, 2233 (char *)__entry->caller_ip) 2234 ) 2235 #define DEFINE_DEFER_EVENT(name) \ 2236 DEFINE_EVENT(xfs_defer_class, name, \ 2237 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \ 2238 TP_ARGS(tp, caller_ip)) 2239 2240 DECLARE_EVENT_CLASS(xfs_defer_error_class, 2241 TP_PROTO(struct xfs_trans *tp, int error), 2242 TP_ARGS(tp, error), 2243 TP_STRUCT__entry( 2244 __field(dev_t, dev) 2245 __field(struct xfs_trans *, tp) 2246 __field(char, committed) 2247 __field(int, error) 2248 ), 2249 TP_fast_assign( 2250 __entry->dev = tp->t_mountp->m_super->s_dev; 2251 __entry->tp = tp; 2252 __entry->error = error; 2253 ), 2254 TP_printk("dev %d:%d tp %p err %d", 2255 MAJOR(__entry->dev), MINOR(__entry->dev), 2256 __entry->tp, 2257 __entry->error) 2258 ) 2259 #define DEFINE_DEFER_ERROR_EVENT(name) \ 2260 DEFINE_EVENT(xfs_defer_error_class, name, \ 2261 TP_PROTO(struct xfs_trans *tp, int error), \ 2262 TP_ARGS(tp, error)) 2263 2264 DECLARE_EVENT_CLASS(xfs_defer_pending_class, 2265 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), 2266 TP_ARGS(mp, dfp), 2267 TP_STRUCT__entry( 2268 __field(dev_t, dev) 2269 __field(int, type) 2270 __field(void *, intent) 2271 __field(char, committed) 2272 __field(int, nr) 2273 ), 2274 TP_fast_assign( 2275 __entry->dev = mp ? mp->m_super->s_dev : 0; 2276 __entry->type = dfp->dfp_type->type; 2277 __entry->intent = dfp->dfp_intent; 2278 __entry->committed = dfp->dfp_done != NULL; 2279 __entry->nr = dfp->dfp_count; 2280 ), 2281 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d", 2282 MAJOR(__entry->dev), MINOR(__entry->dev), 2283 __entry->type, 2284 __entry->intent, 2285 __entry->committed, 2286 __entry->nr) 2287 ) 2288 #define DEFINE_DEFER_PENDING_EVENT(name) \ 2289 DEFINE_EVENT(xfs_defer_pending_class, name, \ 2290 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \ 2291 TP_ARGS(mp, dfp)) 2292 2293 DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class, 2294 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 2295 int type, xfs_agblock_t agbno, xfs_extlen_t len), 2296 TP_ARGS(mp, agno, type, agbno, len), 2297 TP_STRUCT__entry( 2298 __field(dev_t, dev) 2299 __field(xfs_agnumber_t, agno) 2300 __field(int, type) 2301 __field(xfs_agblock_t, agbno) 2302 __field(xfs_extlen_t, len) 2303 ), 2304 TP_fast_assign( 2305 __entry->dev = mp->m_super->s_dev; 2306 __entry->agno = agno; 2307 __entry->type = type; 2308 __entry->agbno = agbno; 2309 __entry->len = len; 2310 ), 2311 TP_printk("dev %d:%d op %d agno %u agbno %u len %u", 2312 MAJOR(__entry->dev), MINOR(__entry->dev), 2313 __entry->type, 2314 __entry->agno, 2315 __entry->agbno, 2316 __entry->len) 2317 ); 2318 #define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \ 2319 DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \ 2320 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 2321 int type, \ 2322 xfs_agblock_t bno, \ 2323 xfs_extlen_t len), \ 2324 TP_ARGS(mp, agno, type, bno, len)) 2325 2326 DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class, 2327 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 2328 int op, 2329 xfs_agblock_t agbno, 2330 xfs_ino_t ino, 2331 int whichfork, 2332 xfs_fileoff_t offset, 2333 xfs_filblks_t len, 2334 xfs_exntst_t state), 2335 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state), 2336 TP_STRUCT__entry( 2337 __field(dev_t, dev) 2338 __field(xfs_agnumber_t, agno) 2339 __field(xfs_ino_t, ino) 2340 __field(xfs_agblock_t, agbno) 2341 __field(int, whichfork) 2342 __field(xfs_fileoff_t, l_loff) 2343 __field(xfs_filblks_t, l_len) 2344 __field(xfs_exntst_t, l_state) 2345 __field(int, op) 2346 ), 2347 TP_fast_assign( 2348 __entry->dev = mp->m_super->s_dev; 2349 __entry->agno = agno; 2350 __entry->ino = ino; 2351 __entry->agbno = agbno; 2352 __entry->whichfork = whichfork; 2353 __entry->l_loff = offset; 2354 __entry->l_len = len; 2355 __entry->l_state = state; 2356 __entry->op = op; 2357 ), 2358 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d", 2359 MAJOR(__entry->dev), MINOR(__entry->dev), 2360 __entry->op, 2361 __entry->agno, 2362 __entry->agbno, 2363 __entry->ino, 2364 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data", 2365 __entry->l_loff, 2366 __entry->l_len, 2367 __entry->l_state) 2368 ); 2369 #define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \ 2370 DEFINE_EVENT(xfs_map_extent_deferred_class, name, \ 2371 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 2372 int op, \ 2373 xfs_agblock_t agbno, \ 2374 xfs_ino_t ino, \ 2375 int whichfork, \ 2376 xfs_fileoff_t offset, \ 2377 xfs_filblks_t len, \ 2378 xfs_exntst_t state), \ 2379 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state)) 2380 2381 DEFINE_DEFER_EVENT(xfs_defer_cancel); 2382 DEFINE_DEFER_EVENT(xfs_defer_trans_roll); 2383 DEFINE_DEFER_EVENT(xfs_defer_trans_abort); 2384 DEFINE_DEFER_EVENT(xfs_defer_finish); 2385 DEFINE_DEFER_EVENT(xfs_defer_finish_done); 2386 2387 DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error); 2388 DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error); 2389 2390 DEFINE_DEFER_PENDING_EVENT(xfs_defer_create_intent); 2391 DEFINE_DEFER_PENDING_EVENT(xfs_defer_cancel_list); 2392 DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish); 2393 DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort); 2394 2395 #define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT 2396 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer); 2397 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred); 2398 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_defer); 2399 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred); 2400 2401 /* rmap tracepoints */ 2402 DECLARE_EVENT_CLASS(xfs_rmap_class, 2403 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 2404 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, 2405 struct xfs_owner_info *oinfo), 2406 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo), 2407 TP_STRUCT__entry( 2408 __field(dev_t, dev) 2409 __field(xfs_agnumber_t, agno) 2410 __field(xfs_agblock_t, agbno) 2411 __field(xfs_extlen_t, len) 2412 __field(uint64_t, owner) 2413 __field(uint64_t, offset) 2414 __field(unsigned long, flags) 2415 ), 2416 TP_fast_assign( 2417 __entry->dev = mp->m_super->s_dev; 2418 __entry->agno = agno; 2419 __entry->agbno = agbno; 2420 __entry->len = len; 2421 __entry->owner = oinfo->oi_owner; 2422 __entry->offset = oinfo->oi_offset; 2423 __entry->flags = oinfo->oi_flags; 2424 if (unwritten) 2425 __entry->flags |= XFS_RMAP_UNWRITTEN; 2426 ), 2427 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx", 2428 MAJOR(__entry->dev), MINOR(__entry->dev), 2429 __entry->agno, 2430 __entry->agbno, 2431 __entry->len, 2432 __entry->owner, 2433 __entry->offset, 2434 __entry->flags) 2435 ); 2436 #define DEFINE_RMAP_EVENT(name) \ 2437 DEFINE_EVENT(xfs_rmap_class, name, \ 2438 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 2439 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \ 2440 struct xfs_owner_info *oinfo), \ 2441 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo)) 2442 2443 /* simple AG-based error/%ip tracepoint class */ 2444 DECLARE_EVENT_CLASS(xfs_ag_error_class, 2445 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, 2446 unsigned long caller_ip), 2447 TP_ARGS(mp, agno, error, caller_ip), 2448 TP_STRUCT__entry( 2449 __field(dev_t, dev) 2450 __field(xfs_agnumber_t, agno) 2451 __field(int, error) 2452 __field(unsigned long, caller_ip) 2453 ), 2454 TP_fast_assign( 2455 __entry->dev = mp->m_super->s_dev; 2456 __entry->agno = agno; 2457 __entry->error = error; 2458 __entry->caller_ip = caller_ip; 2459 ), 2460 TP_printk("dev %d:%d agno %u error %d caller %pS", 2461 MAJOR(__entry->dev), MINOR(__entry->dev), 2462 __entry->agno, 2463 __entry->error, 2464 (char *)__entry->caller_ip) 2465 ); 2466 2467 #define DEFINE_AG_ERROR_EVENT(name) \ 2468 DEFINE_EVENT(xfs_ag_error_class, name, \ 2469 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \ 2470 unsigned long caller_ip), \ 2471 TP_ARGS(mp, agno, error, caller_ip)) 2472 2473 DEFINE_RMAP_EVENT(xfs_rmap_unmap); 2474 DEFINE_RMAP_EVENT(xfs_rmap_unmap_done); 2475 DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error); 2476 DEFINE_RMAP_EVENT(xfs_rmap_map); 2477 DEFINE_RMAP_EVENT(xfs_rmap_map_done); 2478 DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error); 2479 DEFINE_RMAP_EVENT(xfs_rmap_convert); 2480 DEFINE_RMAP_EVENT(xfs_rmap_convert_done); 2481 DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error); 2482 DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state); 2483 2484 DECLARE_EVENT_CLASS(xfs_rmapbt_class, 2485 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 2486 xfs_agblock_t agbno, xfs_extlen_t len, 2487 uint64_t owner, uint64_t offset, unsigned int flags), 2488 TP_ARGS(mp, agno, agbno, len, owner, offset, flags), 2489 TP_STRUCT__entry( 2490 __field(dev_t, dev) 2491 __field(xfs_agnumber_t, agno) 2492 __field(xfs_agblock_t, agbno) 2493 __field(xfs_extlen_t, len) 2494 __field(uint64_t, owner) 2495 __field(uint64_t, offset) 2496 __field(unsigned int, flags) 2497 ), 2498 TP_fast_assign( 2499 __entry->dev = mp->m_super->s_dev; 2500 __entry->agno = agno; 2501 __entry->agbno = agbno; 2502 __entry->len = len; 2503 __entry->owner = owner; 2504 __entry->offset = offset; 2505 __entry->flags = flags; 2506 ), 2507 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x", 2508 MAJOR(__entry->dev), MINOR(__entry->dev), 2509 __entry->agno, 2510 __entry->agbno, 2511 __entry->len, 2512 __entry->owner, 2513 __entry->offset, 2514 __entry->flags) 2515 ); 2516 #define DEFINE_RMAPBT_EVENT(name) \ 2517 DEFINE_EVENT(xfs_rmapbt_class, name, \ 2518 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 2519 xfs_agblock_t agbno, xfs_extlen_t len, \ 2520 uint64_t owner, uint64_t offset, unsigned int flags), \ 2521 TP_ARGS(mp, agno, agbno, len, owner, offset, flags)) 2522 2523 #define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT 2524 DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer); 2525 DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred); 2526 2527 DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block); 2528 DEFINE_BUSY_EVENT(xfs_rmapbt_free_block); 2529 DEFINE_RMAPBT_EVENT(xfs_rmap_update); 2530 DEFINE_RMAPBT_EVENT(xfs_rmap_insert); 2531 DEFINE_RMAPBT_EVENT(xfs_rmap_delete); 2532 DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error); 2533 DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error); 2534 DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error); 2535 2536 DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate); 2537 DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query); 2538 DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate); 2539 DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range); 2540 DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result); 2541 DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result); 2542 DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result); 2543 2544 /* deferred bmbt updates */ 2545 #define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT 2546 DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer); 2547 DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred); 2548 2549 /* per-AG reservation */ 2550 DECLARE_EVENT_CLASS(xfs_ag_resv_class, 2551 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv, 2552 xfs_extlen_t len), 2553 TP_ARGS(pag, resv, len), 2554 TP_STRUCT__entry( 2555 __field(dev_t, dev) 2556 __field(xfs_agnumber_t, agno) 2557 __field(int, resv) 2558 __field(xfs_extlen_t, freeblks) 2559 __field(xfs_extlen_t, flcount) 2560 __field(xfs_extlen_t, reserved) 2561 __field(xfs_extlen_t, asked) 2562 __field(xfs_extlen_t, len) 2563 ), 2564 TP_fast_assign( 2565 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv); 2566 2567 __entry->dev = pag->pag_mount->m_super->s_dev; 2568 __entry->agno = pag->pag_agno; 2569 __entry->resv = resv; 2570 __entry->freeblks = pag->pagf_freeblks; 2571 __entry->flcount = pag->pagf_flcount; 2572 __entry->reserved = r ? r->ar_reserved : 0; 2573 __entry->asked = r ? r->ar_asked : 0; 2574 __entry->len = len; 2575 ), 2576 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u " 2577 "resv %u ask %u len %u", 2578 MAJOR(__entry->dev), MINOR(__entry->dev), 2579 __entry->agno, 2580 __entry->resv, 2581 __entry->freeblks, 2582 __entry->flcount, 2583 __entry->reserved, 2584 __entry->asked, 2585 __entry->len) 2586 ) 2587 #define DEFINE_AG_RESV_EVENT(name) \ 2588 DEFINE_EVENT(xfs_ag_resv_class, name, \ 2589 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \ 2590 xfs_extlen_t len), \ 2591 TP_ARGS(pag, type, len)) 2592 2593 /* per-AG reservation tracepoints */ 2594 DEFINE_AG_RESV_EVENT(xfs_ag_resv_init); 2595 DEFINE_AG_RESV_EVENT(xfs_ag_resv_free); 2596 DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent); 2597 DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent); 2598 DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical); 2599 DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed); 2600 2601 DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error); 2602 DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error); 2603 2604 /* refcount tracepoint classes */ 2605 2606 /* reuse the discard trace class for agbno/aglen-based traces */ 2607 #define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name) 2608 2609 /* ag btree lookup tracepoint class */ 2610 #define XFS_AG_BTREE_CMP_FORMAT_STR \ 2611 { XFS_LOOKUP_EQ, "eq" }, \ 2612 { XFS_LOOKUP_LE, "le" }, \ 2613 { XFS_LOOKUP_GE, "ge" } 2614 DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class, 2615 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 2616 xfs_agblock_t agbno, xfs_lookup_t dir), 2617 TP_ARGS(mp, agno, agbno, dir), 2618 TP_STRUCT__entry( 2619 __field(dev_t, dev) 2620 __field(xfs_agnumber_t, agno) 2621 __field(xfs_agblock_t, agbno) 2622 __field(xfs_lookup_t, dir) 2623 ), 2624 TP_fast_assign( 2625 __entry->dev = mp->m_super->s_dev; 2626 __entry->agno = agno; 2627 __entry->agbno = agbno; 2628 __entry->dir = dir; 2629 ), 2630 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)", 2631 MAJOR(__entry->dev), MINOR(__entry->dev), 2632 __entry->agno, 2633 __entry->agbno, 2634 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR), 2635 __entry->dir) 2636 ) 2637 2638 #define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \ 2639 DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \ 2640 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 2641 xfs_agblock_t agbno, xfs_lookup_t dir), \ 2642 TP_ARGS(mp, agno, agbno, dir)) 2643 2644 /* single-rcext tracepoint class */ 2645 DECLARE_EVENT_CLASS(xfs_refcount_extent_class, 2646 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 2647 struct xfs_refcount_irec *irec), 2648 TP_ARGS(mp, agno, irec), 2649 TP_STRUCT__entry( 2650 __field(dev_t, dev) 2651 __field(xfs_agnumber_t, agno) 2652 __field(xfs_agblock_t, startblock) 2653 __field(xfs_extlen_t, blockcount) 2654 __field(xfs_nlink_t, refcount) 2655 ), 2656 TP_fast_assign( 2657 __entry->dev = mp->m_super->s_dev; 2658 __entry->agno = agno; 2659 __entry->startblock = irec->rc_startblock; 2660 __entry->blockcount = irec->rc_blockcount; 2661 __entry->refcount = irec->rc_refcount; 2662 ), 2663 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u", 2664 MAJOR(__entry->dev), MINOR(__entry->dev), 2665 __entry->agno, 2666 __entry->startblock, 2667 __entry->blockcount, 2668 __entry->refcount) 2669 ) 2670 2671 #define DEFINE_REFCOUNT_EXTENT_EVENT(name) \ 2672 DEFINE_EVENT(xfs_refcount_extent_class, name, \ 2673 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 2674 struct xfs_refcount_irec *irec), \ 2675 TP_ARGS(mp, agno, irec)) 2676 2677 /* single-rcext and an agbno tracepoint class */ 2678 DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class, 2679 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 2680 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), 2681 TP_ARGS(mp, agno, irec, agbno), 2682 TP_STRUCT__entry( 2683 __field(dev_t, dev) 2684 __field(xfs_agnumber_t, agno) 2685 __field(xfs_agblock_t, startblock) 2686 __field(xfs_extlen_t, blockcount) 2687 __field(xfs_nlink_t, refcount) 2688 __field(xfs_agblock_t, agbno) 2689 ), 2690 TP_fast_assign( 2691 __entry->dev = mp->m_super->s_dev; 2692 __entry->agno = agno; 2693 __entry->startblock = irec->rc_startblock; 2694 __entry->blockcount = irec->rc_blockcount; 2695 __entry->refcount = irec->rc_refcount; 2696 __entry->agbno = agbno; 2697 ), 2698 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u", 2699 MAJOR(__entry->dev), MINOR(__entry->dev), 2700 __entry->agno, 2701 __entry->startblock, 2702 __entry->blockcount, 2703 __entry->refcount, 2704 __entry->agbno) 2705 ) 2706 2707 #define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \ 2708 DEFINE_EVENT(xfs_refcount_extent_at_class, name, \ 2709 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 2710 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \ 2711 TP_ARGS(mp, agno, irec, agbno)) 2712 2713 /* double-rcext tracepoint class */ 2714 DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class, 2715 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 2716 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), 2717 TP_ARGS(mp, agno, i1, i2), 2718 TP_STRUCT__entry( 2719 __field(dev_t, dev) 2720 __field(xfs_agnumber_t, agno) 2721 __field(xfs_agblock_t, i1_startblock) 2722 __field(xfs_extlen_t, i1_blockcount) 2723 __field(xfs_nlink_t, i1_refcount) 2724 __field(xfs_agblock_t, i2_startblock) 2725 __field(xfs_extlen_t, i2_blockcount) 2726 __field(xfs_nlink_t, i2_refcount) 2727 ), 2728 TP_fast_assign( 2729 __entry->dev = mp->m_super->s_dev; 2730 __entry->agno = agno; 2731 __entry->i1_startblock = i1->rc_startblock; 2732 __entry->i1_blockcount = i1->rc_blockcount; 2733 __entry->i1_refcount = i1->rc_refcount; 2734 __entry->i2_startblock = i2->rc_startblock; 2735 __entry->i2_blockcount = i2->rc_blockcount; 2736 __entry->i2_refcount = i2->rc_refcount; 2737 ), 2738 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- " 2739 "agbno %u len %u refcount %u", 2740 MAJOR(__entry->dev), MINOR(__entry->dev), 2741 __entry->agno, 2742 __entry->i1_startblock, 2743 __entry->i1_blockcount, 2744 __entry->i1_refcount, 2745 __entry->i2_startblock, 2746 __entry->i2_blockcount, 2747 __entry->i2_refcount) 2748 ) 2749 2750 #define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \ 2751 DEFINE_EVENT(xfs_refcount_double_extent_class, name, \ 2752 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 2753 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \ 2754 TP_ARGS(mp, agno, i1, i2)) 2755 2756 /* double-rcext and an agbno tracepoint class */ 2757 DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class, 2758 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 2759 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, 2760 xfs_agblock_t agbno), 2761 TP_ARGS(mp, agno, i1, i2, agbno), 2762 TP_STRUCT__entry( 2763 __field(dev_t, dev) 2764 __field(xfs_agnumber_t, agno) 2765 __field(xfs_agblock_t, i1_startblock) 2766 __field(xfs_extlen_t, i1_blockcount) 2767 __field(xfs_nlink_t, i1_refcount) 2768 __field(xfs_agblock_t, i2_startblock) 2769 __field(xfs_extlen_t, i2_blockcount) 2770 __field(xfs_nlink_t, i2_refcount) 2771 __field(xfs_agblock_t, agbno) 2772 ), 2773 TP_fast_assign( 2774 __entry->dev = mp->m_super->s_dev; 2775 __entry->agno = agno; 2776 __entry->i1_startblock = i1->rc_startblock; 2777 __entry->i1_blockcount = i1->rc_blockcount; 2778 __entry->i1_refcount = i1->rc_refcount; 2779 __entry->i2_startblock = i2->rc_startblock; 2780 __entry->i2_blockcount = i2->rc_blockcount; 2781 __entry->i2_refcount = i2->rc_refcount; 2782 __entry->agbno = agbno; 2783 ), 2784 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- " 2785 "agbno %u len %u refcount %u @ agbno %u", 2786 MAJOR(__entry->dev), MINOR(__entry->dev), 2787 __entry->agno, 2788 __entry->i1_startblock, 2789 __entry->i1_blockcount, 2790 __entry->i1_refcount, 2791 __entry->i2_startblock, 2792 __entry->i2_blockcount, 2793 __entry->i2_refcount, 2794 __entry->agbno) 2795 ) 2796 2797 #define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \ 2798 DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \ 2799 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 2800 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \ 2801 xfs_agblock_t agbno), \ 2802 TP_ARGS(mp, agno, i1, i2, agbno)) 2803 2804 /* triple-rcext tracepoint class */ 2805 DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class, 2806 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 2807 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, 2808 struct xfs_refcount_irec *i3), 2809 TP_ARGS(mp, agno, i1, i2, i3), 2810 TP_STRUCT__entry( 2811 __field(dev_t, dev) 2812 __field(xfs_agnumber_t, agno) 2813 __field(xfs_agblock_t, i1_startblock) 2814 __field(xfs_extlen_t, i1_blockcount) 2815 __field(xfs_nlink_t, i1_refcount) 2816 __field(xfs_agblock_t, i2_startblock) 2817 __field(xfs_extlen_t, i2_blockcount) 2818 __field(xfs_nlink_t, i2_refcount) 2819 __field(xfs_agblock_t, i3_startblock) 2820 __field(xfs_extlen_t, i3_blockcount) 2821 __field(xfs_nlink_t, i3_refcount) 2822 ), 2823 TP_fast_assign( 2824 __entry->dev = mp->m_super->s_dev; 2825 __entry->agno = agno; 2826 __entry->i1_startblock = i1->rc_startblock; 2827 __entry->i1_blockcount = i1->rc_blockcount; 2828 __entry->i1_refcount = i1->rc_refcount; 2829 __entry->i2_startblock = i2->rc_startblock; 2830 __entry->i2_blockcount = i2->rc_blockcount; 2831 __entry->i2_refcount = i2->rc_refcount; 2832 __entry->i3_startblock = i3->rc_startblock; 2833 __entry->i3_blockcount = i3->rc_blockcount; 2834 __entry->i3_refcount = i3->rc_refcount; 2835 ), 2836 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- " 2837 "agbno %u len %u refcount %u -- " 2838 "agbno %u len %u refcount %u", 2839 MAJOR(__entry->dev), MINOR(__entry->dev), 2840 __entry->agno, 2841 __entry->i1_startblock, 2842 __entry->i1_blockcount, 2843 __entry->i1_refcount, 2844 __entry->i2_startblock, 2845 __entry->i2_blockcount, 2846 __entry->i2_refcount, 2847 __entry->i3_startblock, 2848 __entry->i3_blockcount, 2849 __entry->i3_refcount) 2850 ); 2851 2852 #define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \ 2853 DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \ 2854 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 2855 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \ 2856 struct xfs_refcount_irec *i3), \ 2857 TP_ARGS(mp, agno, i1, i2, i3)) 2858 2859 /* refcount btree tracepoints */ 2860 DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block); 2861 DEFINE_BUSY_EVENT(xfs_refcountbt_free_block); 2862 DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup); 2863 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get); 2864 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update); 2865 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert); 2866 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete); 2867 DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error); 2868 DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error); 2869 DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error); 2870 2871 /* refcount adjustment tracepoints */ 2872 DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase); 2873 DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease); 2874 DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase); 2875 DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease); 2876 DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents); 2877 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent); 2878 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent); 2879 DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent); 2880 DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent); 2881 DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent); 2882 DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent); 2883 DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent); 2884 DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error); 2885 DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error); 2886 DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error); 2887 DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error); 2888 DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error); 2889 DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error); 2890 DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error); 2891 DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error); 2892 DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error); 2893 2894 /* reflink helpers */ 2895 DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared); 2896 DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result); 2897 DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error); 2898 #define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT 2899 DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer); 2900 DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred); 2901 2902 TRACE_EVENT(xfs_refcount_finish_one_leftover, 2903 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 2904 int type, xfs_agblock_t agbno, xfs_extlen_t len, 2905 xfs_agblock_t new_agbno, xfs_extlen_t new_len), 2906 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len), 2907 TP_STRUCT__entry( 2908 __field(dev_t, dev) 2909 __field(xfs_agnumber_t, agno) 2910 __field(int, type) 2911 __field(xfs_agblock_t, agbno) 2912 __field(xfs_extlen_t, len) 2913 __field(xfs_agblock_t, new_agbno) 2914 __field(xfs_extlen_t, new_len) 2915 ), 2916 TP_fast_assign( 2917 __entry->dev = mp->m_super->s_dev; 2918 __entry->agno = agno; 2919 __entry->type = type; 2920 __entry->agbno = agbno; 2921 __entry->len = len; 2922 __entry->new_agbno = new_agbno; 2923 __entry->new_len = new_len; 2924 ), 2925 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u", 2926 MAJOR(__entry->dev), MINOR(__entry->dev), 2927 __entry->type, 2928 __entry->agno, 2929 __entry->agbno, 2930 __entry->len, 2931 __entry->new_agbno, 2932 __entry->new_len) 2933 ); 2934 2935 /* simple inode-based error/%ip tracepoint class */ 2936 DECLARE_EVENT_CLASS(xfs_inode_error_class, 2937 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip), 2938 TP_ARGS(ip, error, caller_ip), 2939 TP_STRUCT__entry( 2940 __field(dev_t, dev) 2941 __field(xfs_ino_t, ino) 2942 __field(int, error) 2943 __field(unsigned long, caller_ip) 2944 ), 2945 TP_fast_assign( 2946 __entry->dev = VFS_I(ip)->i_sb->s_dev; 2947 __entry->ino = ip->i_ino; 2948 __entry->error = error; 2949 __entry->caller_ip = caller_ip; 2950 ), 2951 TP_printk("dev %d:%d ino %llx error %d caller %pS", 2952 MAJOR(__entry->dev), MINOR(__entry->dev), 2953 __entry->ino, 2954 __entry->error, 2955 (char *)__entry->caller_ip) 2956 ); 2957 2958 #define DEFINE_INODE_ERROR_EVENT(name) \ 2959 DEFINE_EVENT(xfs_inode_error_class, name, \ 2960 TP_PROTO(struct xfs_inode *ip, int error, \ 2961 unsigned long caller_ip), \ 2962 TP_ARGS(ip, error, caller_ip)) 2963 2964 /* reflink tracepoint classes */ 2965 2966 /* two-file io tracepoint class */ 2967 DECLARE_EVENT_CLASS(xfs_double_io_class, 2968 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, 2969 struct xfs_inode *dest, xfs_off_t doffset), 2970 TP_ARGS(src, soffset, len, dest, doffset), 2971 TP_STRUCT__entry( 2972 __field(dev_t, dev) 2973 __field(xfs_ino_t, src_ino) 2974 __field(loff_t, src_isize) 2975 __field(loff_t, src_disize) 2976 __field(loff_t, src_offset) 2977 __field(size_t, len) 2978 __field(xfs_ino_t, dest_ino) 2979 __field(loff_t, dest_isize) 2980 __field(loff_t, dest_disize) 2981 __field(loff_t, dest_offset) 2982 ), 2983 TP_fast_assign( 2984 __entry->dev = VFS_I(src)->i_sb->s_dev; 2985 __entry->src_ino = src->i_ino; 2986 __entry->src_isize = VFS_I(src)->i_size; 2987 __entry->src_disize = src->i_d.di_size; 2988 __entry->src_offset = soffset; 2989 __entry->len = len; 2990 __entry->dest_ino = dest->i_ino; 2991 __entry->dest_isize = VFS_I(dest)->i_size; 2992 __entry->dest_disize = dest->i_d.di_size; 2993 __entry->dest_offset = doffset; 2994 ), 2995 TP_printk("dev %d:%d count %zd " 2996 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> " 2997 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx", 2998 MAJOR(__entry->dev), MINOR(__entry->dev), 2999 __entry->len, 3000 __entry->src_ino, 3001 __entry->src_isize, 3002 __entry->src_disize, 3003 __entry->src_offset, 3004 __entry->dest_ino, 3005 __entry->dest_isize, 3006 __entry->dest_disize, 3007 __entry->dest_offset) 3008 ) 3009 3010 #define DEFINE_DOUBLE_IO_EVENT(name) \ 3011 DEFINE_EVENT(xfs_double_io_class, name, \ 3012 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \ 3013 struct xfs_inode *dest, xfs_off_t doffset), \ 3014 TP_ARGS(src, soffset, len, dest, doffset)) 3015 3016 /* inode/irec events */ 3017 DECLARE_EVENT_CLASS(xfs_inode_irec_class, 3018 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), 3019 TP_ARGS(ip, irec), 3020 TP_STRUCT__entry( 3021 __field(dev_t, dev) 3022 __field(xfs_ino_t, ino) 3023 __field(xfs_fileoff_t, lblk) 3024 __field(xfs_extlen_t, len) 3025 __field(xfs_fsblock_t, pblk) 3026 __field(int, state) 3027 ), 3028 TP_fast_assign( 3029 __entry->dev = VFS_I(ip)->i_sb->s_dev; 3030 __entry->ino = ip->i_ino; 3031 __entry->lblk = irec->br_startoff; 3032 __entry->len = irec->br_blockcount; 3033 __entry->pblk = irec->br_startblock; 3034 __entry->state = irec->br_state; 3035 ), 3036 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x pblk %llu st %d", 3037 MAJOR(__entry->dev), MINOR(__entry->dev), 3038 __entry->ino, 3039 __entry->lblk, 3040 __entry->len, 3041 __entry->pblk, 3042 __entry->state) 3043 ); 3044 #define DEFINE_INODE_IREC_EVENT(name) \ 3045 DEFINE_EVENT(xfs_inode_irec_class, name, \ 3046 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \ 3047 TP_ARGS(ip, irec)) 3048 3049 /* refcount/reflink tracepoint definitions */ 3050 3051 /* reflink tracepoints */ 3052 DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag); 3053 DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag); 3054 DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size); 3055 DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap); 3056 TRACE_EVENT(xfs_reflink_remap_blocks_loop, 3057 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset, 3058 xfs_filblks_t len, struct xfs_inode *dest, 3059 xfs_fileoff_t doffset), 3060 TP_ARGS(src, soffset, len, dest, doffset), 3061 TP_STRUCT__entry( 3062 __field(dev_t, dev) 3063 __field(xfs_ino_t, src_ino) 3064 __field(xfs_fileoff_t, src_lblk) 3065 __field(xfs_filblks_t, len) 3066 __field(xfs_ino_t, dest_ino) 3067 __field(xfs_fileoff_t, dest_lblk) 3068 ), 3069 TP_fast_assign( 3070 __entry->dev = VFS_I(src)->i_sb->s_dev; 3071 __entry->src_ino = src->i_ino; 3072 __entry->src_lblk = soffset; 3073 __entry->len = len; 3074 __entry->dest_ino = dest->i_ino; 3075 __entry->dest_lblk = doffset; 3076 ), 3077 TP_printk("dev %d:%d len 0x%llx " 3078 "ino 0x%llx offset 0x%llx blocks -> " 3079 "ino 0x%llx offset 0x%llx blocks", 3080 MAJOR(__entry->dev), MINOR(__entry->dev), 3081 __entry->len, 3082 __entry->src_ino, 3083 __entry->src_lblk, 3084 __entry->dest_ino, 3085 __entry->dest_lblk) 3086 ); 3087 TRACE_EVENT(xfs_reflink_punch_range, 3088 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk, 3089 xfs_extlen_t len), 3090 TP_ARGS(ip, lblk, len), 3091 TP_STRUCT__entry( 3092 __field(dev_t, dev) 3093 __field(xfs_ino_t, ino) 3094 __field(xfs_fileoff_t, lblk) 3095 __field(xfs_extlen_t, len) 3096 ), 3097 TP_fast_assign( 3098 __entry->dev = VFS_I(ip)->i_sb->s_dev; 3099 __entry->ino = ip->i_ino; 3100 __entry->lblk = lblk; 3101 __entry->len = len; 3102 ), 3103 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x", 3104 MAJOR(__entry->dev), MINOR(__entry->dev), 3105 __entry->ino, 3106 __entry->lblk, 3107 __entry->len) 3108 ); 3109 TRACE_EVENT(xfs_reflink_remap, 3110 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk, 3111 xfs_extlen_t len, xfs_fsblock_t new_pblk), 3112 TP_ARGS(ip, lblk, len, new_pblk), 3113 TP_STRUCT__entry( 3114 __field(dev_t, dev) 3115 __field(xfs_ino_t, ino) 3116 __field(xfs_fileoff_t, lblk) 3117 __field(xfs_extlen_t, len) 3118 __field(xfs_fsblock_t, new_pblk) 3119 ), 3120 TP_fast_assign( 3121 __entry->dev = VFS_I(ip)->i_sb->s_dev; 3122 __entry->ino = ip->i_ino; 3123 __entry->lblk = lblk; 3124 __entry->len = len; 3125 __entry->new_pblk = new_pblk; 3126 ), 3127 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu", 3128 MAJOR(__entry->dev), MINOR(__entry->dev), 3129 __entry->ino, 3130 __entry->lblk, 3131 __entry->len, 3132 __entry->new_pblk) 3133 ); 3134 DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range); 3135 DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error); 3136 DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error); 3137 DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error); 3138 DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error); 3139 DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error); 3140 3141 /* dedupe tracepoints */ 3142 DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents); 3143 DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error); 3144 3145 /* ioctl tracepoints */ 3146 TRACE_EVENT(xfs_ioctl_clone, 3147 TP_PROTO(struct inode *src, struct inode *dest), 3148 TP_ARGS(src, dest), 3149 TP_STRUCT__entry( 3150 __field(dev_t, dev) 3151 __field(unsigned long, src_ino) 3152 __field(loff_t, src_isize) 3153 __field(unsigned long, dest_ino) 3154 __field(loff_t, dest_isize) 3155 ), 3156 TP_fast_assign( 3157 __entry->dev = src->i_sb->s_dev; 3158 __entry->src_ino = src->i_ino; 3159 __entry->src_isize = i_size_read(src); 3160 __entry->dest_ino = dest->i_ino; 3161 __entry->dest_isize = i_size_read(dest); 3162 ), 3163 TP_printk("dev %d:%d " 3164 "ino 0x%lx isize 0x%llx -> " 3165 "ino 0x%lx isize 0x%llx", 3166 MAJOR(__entry->dev), MINOR(__entry->dev), 3167 __entry->src_ino, 3168 __entry->src_isize, 3169 __entry->dest_ino, 3170 __entry->dest_isize) 3171 ); 3172 3173 /* unshare tracepoints */ 3174 DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare); 3175 DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error); 3176 3177 /* copy on write */ 3178 DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared); 3179 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc); 3180 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found); 3181 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc); 3182 DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow); 3183 3184 DEFINE_RW_EVENT(xfs_reflink_reserve_cow); 3185 3186 DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write); 3187 3188 DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range); 3189 DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow); 3190 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap); 3191 3192 DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error); 3193 DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error); 3194 3195 3196 DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow); 3197 3198 /* rmap swapext tracepoints */ 3199 DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap); 3200 DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece); 3201 DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error); 3202 3203 /* fsmap traces */ 3204 DECLARE_EVENT_CLASS(xfs_fsmap_class, 3205 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, 3206 struct xfs_rmap_irec *rmap), 3207 TP_ARGS(mp, keydev, agno, rmap), 3208 TP_STRUCT__entry( 3209 __field(dev_t, dev) 3210 __field(dev_t, keydev) 3211 __field(xfs_agnumber_t, agno) 3212 __field(xfs_fsblock_t, bno) 3213 __field(xfs_filblks_t, len) 3214 __field(uint64_t, owner) 3215 __field(uint64_t, offset) 3216 __field(unsigned int, flags) 3217 ), 3218 TP_fast_assign( 3219 __entry->dev = mp->m_super->s_dev; 3220 __entry->keydev = new_decode_dev(keydev); 3221 __entry->agno = agno; 3222 __entry->bno = rmap->rm_startblock; 3223 __entry->len = rmap->rm_blockcount; 3224 __entry->owner = rmap->rm_owner; 3225 __entry->offset = rmap->rm_offset; 3226 __entry->flags = rmap->rm_flags; 3227 ), 3228 TP_printk("dev %d:%d keydev %d:%d agno %u bno %llu len %llu owner %lld offset %llu flags 0x%x", 3229 MAJOR(__entry->dev), MINOR(__entry->dev), 3230 MAJOR(__entry->keydev), MINOR(__entry->keydev), 3231 __entry->agno, 3232 __entry->bno, 3233 __entry->len, 3234 __entry->owner, 3235 __entry->offset, 3236 __entry->flags) 3237 ) 3238 #define DEFINE_FSMAP_EVENT(name) \ 3239 DEFINE_EVENT(xfs_fsmap_class, name, \ 3240 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \ 3241 struct xfs_rmap_irec *rmap), \ 3242 TP_ARGS(mp, keydev, agno, rmap)) 3243 DEFINE_FSMAP_EVENT(xfs_fsmap_low_key); 3244 DEFINE_FSMAP_EVENT(xfs_fsmap_high_key); 3245 DEFINE_FSMAP_EVENT(xfs_fsmap_mapping); 3246 3247 DECLARE_EVENT_CLASS(xfs_getfsmap_class, 3248 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), 3249 TP_ARGS(mp, fsmap), 3250 TP_STRUCT__entry( 3251 __field(dev_t, dev) 3252 __field(dev_t, keydev) 3253 __field(xfs_daddr_t, block) 3254 __field(xfs_daddr_t, len) 3255 __field(uint64_t, owner) 3256 __field(uint64_t, offset) 3257 __field(uint64_t, flags) 3258 ), 3259 TP_fast_assign( 3260 __entry->dev = mp->m_super->s_dev; 3261 __entry->keydev = new_decode_dev(fsmap->fmr_device); 3262 __entry->block = fsmap->fmr_physical; 3263 __entry->len = fsmap->fmr_length; 3264 __entry->owner = fsmap->fmr_owner; 3265 __entry->offset = fsmap->fmr_offset; 3266 __entry->flags = fsmap->fmr_flags; 3267 ), 3268 TP_printk("dev %d:%d keydev %d:%d block %llu len %llu owner %lld offset %llu flags 0x%llx", 3269 MAJOR(__entry->dev), MINOR(__entry->dev), 3270 MAJOR(__entry->keydev), MINOR(__entry->keydev), 3271 __entry->block, 3272 __entry->len, 3273 __entry->owner, 3274 __entry->offset, 3275 __entry->flags) 3276 ) 3277 #define DEFINE_GETFSMAP_EVENT(name) \ 3278 DEFINE_EVENT(xfs_getfsmap_class, name, \ 3279 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \ 3280 TP_ARGS(mp, fsmap)) 3281 DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key); 3282 DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key); 3283 DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping); 3284 3285 TRACE_EVENT(xfs_trans_resv_calc, 3286 TP_PROTO(struct xfs_mount *mp, unsigned int type, 3287 struct xfs_trans_res *res), 3288 TP_ARGS(mp, type, res), 3289 TP_STRUCT__entry( 3290 __field(dev_t, dev) 3291 __field(int, type) 3292 __field(uint, logres) 3293 __field(int, logcount) 3294 __field(int, logflags) 3295 ), 3296 TP_fast_assign( 3297 __entry->dev = mp->m_super->s_dev; 3298 __entry->type = type; 3299 __entry->logres = res->tr_logres; 3300 __entry->logcount = res->tr_logcount; 3301 __entry->logflags = res->tr_logflags; 3302 ), 3303 TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x", 3304 MAJOR(__entry->dev), MINOR(__entry->dev), 3305 __entry->type, 3306 __entry->logres, 3307 __entry->logcount, 3308 __entry->logflags) 3309 ); 3310 3311 DECLARE_EVENT_CLASS(xfs_trans_class, 3312 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), 3313 TP_ARGS(tp, caller_ip), 3314 TP_STRUCT__entry( 3315 __field(dev_t, dev) 3316 __field(uint32_t, tid) 3317 __field(uint32_t, flags) 3318 __field(unsigned long, caller_ip) 3319 ), 3320 TP_fast_assign( 3321 __entry->dev = tp->t_mountp->m_super->s_dev; 3322 __entry->tid = 0; 3323 if (tp->t_ticket) 3324 __entry->tid = tp->t_ticket->t_tid; 3325 __entry->flags = tp->t_flags; 3326 __entry->caller_ip = caller_ip; 3327 ), 3328 TP_printk("dev %d:%d trans %x flags 0x%x caller %pS", 3329 MAJOR(__entry->dev), MINOR(__entry->dev), 3330 __entry->tid, 3331 __entry->flags, 3332 (char *)__entry->caller_ip) 3333 ) 3334 3335 #define DEFINE_TRANS_EVENT(name) \ 3336 DEFINE_EVENT(xfs_trans_class, name, \ 3337 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \ 3338 TP_ARGS(tp, caller_ip)) 3339 DEFINE_TRANS_EVENT(xfs_trans_alloc); 3340 DEFINE_TRANS_EVENT(xfs_trans_cancel); 3341 DEFINE_TRANS_EVENT(xfs_trans_commit); 3342 DEFINE_TRANS_EVENT(xfs_trans_dup); 3343 DEFINE_TRANS_EVENT(xfs_trans_free); 3344 DEFINE_TRANS_EVENT(xfs_trans_roll); 3345 DEFINE_TRANS_EVENT(xfs_trans_add_item); 3346 DEFINE_TRANS_EVENT(xfs_trans_free_items); 3347 3348 #endif /* _TRACE_XFS_H */ 3349 3350 #undef TRACE_INCLUDE_PATH 3351 #define TRACE_INCLUDE_PATH . 3352 #define TRACE_INCLUDE_FILE xfs_trace 3353 #include <trace/define_trace.h> 3354