Linux Audio

Check our new training course

Loading...
v4.6
 
   1/*
   2 * Copyright (c) 2009, Christoph Hellwig
   3 * All Rights Reserved.
   4 *
   5 * This program is free software; you can redistribute it and/or
   6 * modify it under the terms of the GNU General Public License as
   7 * published by the Free Software Foundation.
   8 *
   9 * This program is distributed in the hope that it would be useful,
  10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12 * GNU General Public License for more details.
  13 *
  14 * You should have received a copy of the GNU General Public License
  15 * along with this program; if not, write the Free Software Foundation,
  16 * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  17 */
  18#undef TRACE_SYSTEM
  19#define TRACE_SYSTEM xfs
  20
  21#if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
  22#define _TRACE_XFS_H
  23
  24#include <linux/tracepoint.h>
  25
  26struct xfs_agf;
  27struct xfs_alloc_arg;
  28struct xfs_attr_list_context;
  29struct xfs_buf_log_item;
  30struct xfs_da_args;
  31struct xfs_da_node_entry;
  32struct xfs_dquot;
  33struct xfs_log_item;
  34struct xlog;
  35struct xlog_ticket;
  36struct xlog_recover;
  37struct xlog_recover_item;
 
 
  38struct xfs_buf_log_format;
  39struct xfs_inode_log_format;
  40struct xfs_bmbt_irec;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  41
  42DECLARE_EVENT_CLASS(xfs_attr_list_class,
  43	TP_PROTO(struct xfs_attr_list_context *ctx),
  44	TP_ARGS(ctx),
  45	TP_STRUCT__entry(
  46		__field(dev_t, dev)
  47		__field(xfs_ino_t, ino)
  48		__field(u32, hashval)
  49		__field(u32, blkno)
  50		__field(u32, offset)
  51		__field(void *, alist)
  52		__field(int, bufsize)
  53		__field(int, count)
  54		__field(int, firstu)
  55		__field(int, dupcnt)
  56		__field(int, flags)
  57	),
  58	TP_fast_assign(
  59		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
  60		__entry->ino = ctx->dp->i_ino;
  61		__entry->hashval = ctx->cursor->hashval;
  62		__entry->blkno = ctx->cursor->blkno;
  63		__entry->offset = ctx->cursor->offset;
  64		__entry->alist = ctx->alist;
  65		__entry->bufsize = ctx->bufsize;
  66		__entry->count = ctx->count;
  67		__entry->firstu = ctx->firstu;
  68		__entry->flags = ctx->flags;
  69	),
  70	TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
  71		  "alist 0x%p size %u count %u firstu %u flags %d %s",
  72		  MAJOR(__entry->dev), MINOR(__entry->dev),
  73		   __entry->ino,
  74		   __entry->hashval,
  75		   __entry->blkno,
  76		   __entry->offset,
  77		   __entry->dupcnt,
  78		   __entry->alist,
  79		   __entry->bufsize,
  80		   __entry->count,
  81		   __entry->firstu,
  82		   __entry->flags,
  83		   __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
  84	)
  85)
  86
  87#define DEFINE_ATTR_LIST_EVENT(name) \
  88DEFINE_EVENT(xfs_attr_list_class, name, \
  89	TP_PROTO(struct xfs_attr_list_context *ctx), \
  90	TP_ARGS(ctx))
  91DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
  92DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
  93DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
  94DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
  95DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
  96DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
  97DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
  98DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
  99DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
 100DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
 101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 102DECLARE_EVENT_CLASS(xfs_perag_class,
 103	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
 104		 unsigned long caller_ip),
 105	TP_ARGS(mp, agno, refcount, caller_ip),
 106	TP_STRUCT__entry(
 107		__field(dev_t, dev)
 108		__field(xfs_agnumber_t, agno)
 109		__field(int, refcount)
 
 110		__field(unsigned long, caller_ip)
 111	),
 112	TP_fast_assign(
 113		__entry->dev = mp->m_super->s_dev;
 114		__entry->agno = agno;
 115		__entry->refcount = refcount;
 
 
 116		__entry->caller_ip = caller_ip;
 117	),
 118	TP_printk("dev %d:%d agno %u refcount %d caller %ps",
 119		  MAJOR(__entry->dev), MINOR(__entry->dev),
 120		  __entry->agno,
 121		  __entry->refcount,
 
 122		  (char *)__entry->caller_ip)
 123);
 124
 125#define DEFINE_PERAG_REF_EVENT(name)	\
 126DEFINE_EVENT(xfs_perag_class, name,	\
 127	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,	\
 128		 unsigned long caller_ip),					\
 129	TP_ARGS(mp, agno, refcount, caller_ip))
 130DEFINE_PERAG_REF_EVENT(xfs_perag_get);
 131DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
 132DEFINE_PERAG_REF_EVENT(xfs_perag_put);
 133DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
 134DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
 135DEFINE_PERAG_REF_EVENT(xfs_perag_set_eofblocks);
 136DEFINE_PERAG_REF_EVENT(xfs_perag_clear_eofblocks);
 137
 138DECLARE_EVENT_CLASS(xfs_ag_class,
 139	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
 140	TP_ARGS(mp, agno),
 
 
 
 141	TP_STRUCT__entry(
 142		__field(dev_t, dev)
 
 143		__field(xfs_agnumber_t, agno)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 144	),
 145	TP_fast_assign(
 146		__entry->dev = mp->m_super->s_dev;
 147		__entry->agno = agno;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 148	),
 149	TP_printk("dev %d:%d agno %u",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 150		  MAJOR(__entry->dev), MINOR(__entry->dev),
 151		  __entry->agno)
 152);
 153#define DEFINE_AG_EVENT(name)	\
 154DEFINE_EVENT(xfs_ag_class, name,	\
 155	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),	\
 156	TP_ARGS(mp, agno))
 157
 158DEFINE_AG_EVENT(xfs_read_agf);
 159DEFINE_AG_EVENT(xfs_alloc_read_agf);
 160DEFINE_AG_EVENT(xfs_read_agi);
 161DEFINE_AG_EVENT(xfs_ialloc_read_agi);
 162
 163TRACE_EVENT(xfs_attr_list_node_descend,
 164	TP_PROTO(struct xfs_attr_list_context *ctx,
 165		 struct xfs_da_node_entry *btree),
 166	TP_ARGS(ctx, btree),
 167	TP_STRUCT__entry(
 168		__field(dev_t, dev)
 169		__field(xfs_ino_t, ino)
 170		__field(u32, hashval)
 171		__field(u32, blkno)
 172		__field(u32, offset)
 173		__field(void *, alist)
 174		__field(int, bufsize)
 175		__field(int, count)
 176		__field(int, firstu)
 177		__field(int, dupcnt)
 178		__field(int, flags)
 179		__field(u32, bt_hashval)
 180		__field(u32, bt_before)
 181	),
 182	TP_fast_assign(
 183		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
 184		__entry->ino = ctx->dp->i_ino;
 185		__entry->hashval = ctx->cursor->hashval;
 186		__entry->blkno = ctx->cursor->blkno;
 187		__entry->offset = ctx->cursor->offset;
 188		__entry->alist = ctx->alist;
 189		__entry->bufsize = ctx->bufsize;
 190		__entry->count = ctx->count;
 191		__entry->firstu = ctx->firstu;
 192		__entry->flags = ctx->flags;
 193		__entry->bt_hashval = be32_to_cpu(btree->hashval);
 194		__entry->bt_before = be32_to_cpu(btree->before);
 195	),
 196	TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
 197		  "alist 0x%p size %u count %u firstu %u flags %d %s "
 198		  "node hashval %u, node before %u",
 199		  MAJOR(__entry->dev), MINOR(__entry->dev),
 200		   __entry->ino,
 201		   __entry->hashval,
 202		   __entry->blkno,
 203		   __entry->offset,
 204		   __entry->dupcnt,
 205		   __entry->alist,
 206		   __entry->bufsize,
 207		   __entry->count,
 208		   __entry->firstu,
 209		   __entry->flags,
 210		   __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
 211		   __entry->bt_hashval,
 212		   __entry->bt_before)
 213);
 214
 215TRACE_EVENT(xfs_iext_insert,
 216	TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx,
 217		 struct xfs_bmbt_irec *r, int state, unsigned long caller_ip),
 218	TP_ARGS(ip, idx, r, state, caller_ip),
 219	TP_STRUCT__entry(
 220		__field(dev_t, dev)
 221		__field(xfs_ino_t, ino)
 222		__field(xfs_extnum_t, idx)
 223		__field(xfs_fileoff_t, startoff)
 224		__field(xfs_fsblock_t, startblock)
 225		__field(xfs_filblks_t, blockcount)
 226		__field(xfs_exntst_t, state)
 227		__field(int, bmap_state)
 228		__field(unsigned long, caller_ip)
 229	),
 230	TP_fast_assign(
 231		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 232		__entry->ino = ip->i_ino;
 233		__entry->idx = idx;
 234		__entry->startoff = r->br_startoff;
 235		__entry->startblock = r->br_startblock;
 236		__entry->blockcount = r->br_blockcount;
 237		__entry->state = r->br_state;
 238		__entry->bmap_state = state;
 239		__entry->caller_ip = caller_ip;
 240	),
 241	TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
 242		  "offset %lld block %lld count %lld flag %d caller %ps",
 243		  MAJOR(__entry->dev), MINOR(__entry->dev),
 244		  __entry->ino,
 245		  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
 246		  (long)__entry->idx,
 247		  __entry->startoff,
 248		  (__int64_t)__entry->startblock,
 249		  __entry->blockcount,
 250		  __entry->state,
 251		  (char *)__entry->caller_ip)
 252);
 253
 254DECLARE_EVENT_CLASS(xfs_bmap_class,
 255	TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state,
 256		 unsigned long caller_ip),
 257	TP_ARGS(ip, idx, state, caller_ip),
 258	TP_STRUCT__entry(
 259		__field(dev_t, dev)
 260		__field(xfs_ino_t, ino)
 261		__field(xfs_extnum_t, idx)
 
 262		__field(xfs_fileoff_t, startoff)
 263		__field(xfs_fsblock_t, startblock)
 264		__field(xfs_filblks_t, blockcount)
 265		__field(xfs_exntst_t, state)
 266		__field(int, bmap_state)
 267		__field(unsigned long, caller_ip)
 268	),
 269	TP_fast_assign(
 270		struct xfs_ifork	*ifp = (state & BMAP_ATTRFORK) ?
 271						ip->i_afp : &ip->i_df;
 272		struct xfs_bmbt_irec	r;
 273
 274		xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r);
 
 275		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 276		__entry->ino = ip->i_ino;
 277		__entry->idx = idx;
 
 278		__entry->startoff = r.br_startoff;
 279		__entry->startblock = r.br_startblock;
 280		__entry->blockcount = r.br_blockcount;
 281		__entry->state = r.br_state;
 282		__entry->bmap_state = state;
 283		__entry->caller_ip = caller_ip;
 284	),
 285	TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
 286		  "offset %lld block %lld count %lld flag %d caller %ps",
 287		  MAJOR(__entry->dev), MINOR(__entry->dev),
 288		  __entry->ino,
 289		  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
 290		  (long)__entry->idx,
 
 291		  __entry->startoff,
 292		  (__int64_t)__entry->startblock,
 293		  __entry->blockcount,
 294		  __entry->state,
 295		  (char *)__entry->caller_ip)
 296)
 297
 298#define DEFINE_BMAP_EVENT(name) \
 299DEFINE_EVENT(xfs_bmap_class, name, \
 300	TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
 301		 unsigned long caller_ip), \
 302	TP_ARGS(ip, idx, state, caller_ip))
 
 303DEFINE_BMAP_EVENT(xfs_iext_remove);
 304DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
 305DEFINE_BMAP_EVENT(xfs_bmap_post_update);
 306DEFINE_BMAP_EVENT(xfs_extlist);
 
 307
 308DECLARE_EVENT_CLASS(xfs_buf_class,
 309	TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
 310	TP_ARGS(bp, caller_ip),
 311	TP_STRUCT__entry(
 312		__field(dev_t, dev)
 313		__field(xfs_daddr_t, bno)
 314		__field(int, nblks)
 315		__field(int, hold)
 316		__field(int, pincount)
 317		__field(unsigned, lockval)
 318		__field(unsigned, flags)
 319		__field(unsigned long, caller_ip)
 
 320	),
 321	TP_fast_assign(
 322		__entry->dev = bp->b_target->bt_dev;
 323		__entry->bno = bp->b_bn;
 324		__entry->nblks = bp->b_length;
 325		__entry->hold = atomic_read(&bp->b_hold);
 326		__entry->pincount = atomic_read(&bp->b_pin_count);
 327		__entry->lockval = bp->b_sema.count;
 328		__entry->flags = bp->b_flags;
 329		__entry->caller_ip = caller_ip;
 
 330	),
 331	TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
 332		  "lock %d flags %s caller %ps",
 333		  MAJOR(__entry->dev), MINOR(__entry->dev),
 334		  (unsigned long long)__entry->bno,
 335		  __entry->nblks,
 336		  __entry->hold,
 337		  __entry->pincount,
 338		  __entry->lockval,
 339		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
 
 340		  (void *)__entry->caller_ip)
 341)
 342
 343#define DEFINE_BUF_EVENT(name) \
 344DEFINE_EVENT(xfs_buf_class, name, \
 345	TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
 346	TP_ARGS(bp, caller_ip))
 347DEFINE_BUF_EVENT(xfs_buf_init);
 348DEFINE_BUF_EVENT(xfs_buf_free);
 349DEFINE_BUF_EVENT(xfs_buf_hold);
 350DEFINE_BUF_EVENT(xfs_buf_rele);
 351DEFINE_BUF_EVENT(xfs_buf_iodone);
 352DEFINE_BUF_EVENT(xfs_buf_submit);
 353DEFINE_BUF_EVENT(xfs_buf_submit_wait);
 354DEFINE_BUF_EVENT(xfs_buf_bawrite);
 355DEFINE_BUF_EVENT(xfs_buf_lock);
 356DEFINE_BUF_EVENT(xfs_buf_lock_done);
 
 357DEFINE_BUF_EVENT(xfs_buf_trylock);
 358DEFINE_BUF_EVENT(xfs_buf_unlock);
 359DEFINE_BUF_EVENT(xfs_buf_iowait);
 360DEFINE_BUF_EVENT(xfs_buf_iowait_done);
 361DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
 362DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
 363DEFINE_BUF_EVENT(xfs_buf_delwri_split);
 
 364DEFINE_BUF_EVENT(xfs_buf_get_uncached);
 365DEFINE_BUF_EVENT(xfs_bdstrat_shut);
 366DEFINE_BUF_EVENT(xfs_buf_item_relse);
 367DEFINE_BUF_EVENT(xfs_buf_item_iodone);
 368DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
 369DEFINE_BUF_EVENT(xfs_buf_error_relse);
 370DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
 371DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
 372DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
 373
 374/* not really buffer traces, but the buf provides useful information */
 375DEFINE_BUF_EVENT(xfs_btree_corrupt);
 376DEFINE_BUF_EVENT(xfs_da_btree_corrupt);
 377DEFINE_BUF_EVENT(xfs_reset_dqcounts);
 378DEFINE_BUF_EVENT(xfs_inode_item_push);
 379
 380/* pass flags explicitly */
 381DECLARE_EVENT_CLASS(xfs_buf_flags_class,
 382	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
 383	TP_ARGS(bp, flags, caller_ip),
 384	TP_STRUCT__entry(
 385		__field(dev_t, dev)
 386		__field(xfs_daddr_t, bno)
 387		__field(size_t, buffer_length)
 388		__field(int, hold)
 389		__field(int, pincount)
 390		__field(unsigned, lockval)
 391		__field(unsigned, flags)
 392		__field(unsigned long, caller_ip)
 393	),
 394	TP_fast_assign(
 395		__entry->dev = bp->b_target->bt_dev;
 396		__entry->bno = bp->b_bn;
 397		__entry->buffer_length = BBTOB(bp->b_length);
 398		__entry->flags = flags;
 399		__entry->hold = atomic_read(&bp->b_hold);
 400		__entry->pincount = atomic_read(&bp->b_pin_count);
 401		__entry->lockval = bp->b_sema.count;
 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 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		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
 413		  (void *)__entry->caller_ip)
 414)
 415
 416#define DEFINE_BUF_FLAGS_EVENT(name) \
 417DEFINE_EVENT(xfs_buf_flags_class, name, \
 418	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
 419	TP_ARGS(bp, flags, caller_ip))
 420DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
 421DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
 422DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
 423
 424TRACE_EVENT(xfs_buf_ioerror,
 425	TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
 426	TP_ARGS(bp, error, caller_ip),
 427	TP_STRUCT__entry(
 428		__field(dev_t, dev)
 429		__field(xfs_daddr_t, bno)
 430		__field(size_t, buffer_length)
 431		__field(unsigned, flags)
 432		__field(int, hold)
 433		__field(int, pincount)
 434		__field(unsigned, lockval)
 435		__field(int, error)
 436		__field(unsigned long, caller_ip)
 437	),
 438	TP_fast_assign(
 439		__entry->dev = bp->b_target->bt_dev;
 440		__entry->bno = bp->b_bn;
 441		__entry->buffer_length = BBTOB(bp->b_length);
 442		__entry->hold = atomic_read(&bp->b_hold);
 443		__entry->pincount = atomic_read(&bp->b_pin_count);
 444		__entry->lockval = bp->b_sema.count;
 445		__entry->error = error;
 446		__entry->flags = bp->b_flags;
 447		__entry->caller_ip = caller_ip;
 448	),
 449	TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
 450		  "lock %d error %d flags %s caller %ps",
 451		  MAJOR(__entry->dev), MINOR(__entry->dev),
 452		  (unsigned long long)__entry->bno,
 453		  __entry->buffer_length,
 454		  __entry->hold,
 455		  __entry->pincount,
 456		  __entry->lockval,
 457		  __entry->error,
 458		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
 459		  (void *)__entry->caller_ip)
 460);
 461
 462DECLARE_EVENT_CLASS(xfs_buf_item_class,
 463	TP_PROTO(struct xfs_buf_log_item *bip),
 464	TP_ARGS(bip),
 465	TP_STRUCT__entry(
 466		__field(dev_t, dev)
 467		__field(xfs_daddr_t, buf_bno)
 468		__field(size_t, buf_len)
 469		__field(int, buf_hold)
 470		__field(int, buf_pincount)
 471		__field(int, buf_lockval)
 472		__field(unsigned, buf_flags)
 473		__field(unsigned, bli_recur)
 474		__field(int, bli_refcount)
 475		__field(unsigned, bli_flags)
 476		__field(void *, li_desc)
 477		__field(unsigned, li_flags)
 478	),
 479	TP_fast_assign(
 480		__entry->dev = bip->bli_buf->b_target->bt_dev;
 481		__entry->bli_flags = bip->bli_flags;
 482		__entry->bli_recur = bip->bli_recur;
 483		__entry->bli_refcount = atomic_read(&bip->bli_refcount);
 484		__entry->buf_bno = bip->bli_buf->b_bn;
 485		__entry->buf_len = BBTOB(bip->bli_buf->b_length);
 486		__entry->buf_flags = bip->bli_buf->b_flags;
 487		__entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
 488		__entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
 489		__entry->buf_lockval = bip->bli_buf->b_sema.count;
 490		__entry->li_desc = bip->bli_item.li_desc;
 491		__entry->li_flags = bip->bli_item.li_flags;
 492	),
 493	TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
 494		  "lock %d flags %s recur %d refcount %d bliflags %s "
 495		  "lidesc 0x%p liflags %s",
 496		  MAJOR(__entry->dev), MINOR(__entry->dev),
 497		  (unsigned long long)__entry->buf_bno,
 498		  __entry->buf_len,
 499		  __entry->buf_hold,
 500		  __entry->buf_pincount,
 501		  __entry->buf_lockval,
 502		  __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
 503		  __entry->bli_recur,
 504		  __entry->bli_refcount,
 505		  __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
 506		  __entry->li_desc,
 507		  __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
 508)
 509
 510#define DEFINE_BUF_ITEM_EVENT(name) \
 511DEFINE_EVENT(xfs_buf_item_class, name, \
 512	TP_PROTO(struct xfs_buf_log_item *bip), \
 513	TP_ARGS(bip))
 514DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
 515DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
 516DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
 517DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
 518DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_ordered);
 519DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
 520DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
 521DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
 522DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
 523DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
 524DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
 525DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
 526DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
 527DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
 528DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
 529DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
 530DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
 531DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
 532DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
 533DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
 534DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
 535DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
 
 536DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
 537DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
 538DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
 539DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
 540DEFINE_BUF_ITEM_EVENT(xfs_trans_buf_ordered);
 541
 542DECLARE_EVENT_CLASS(xfs_filestream_class,
 543	TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno),
 544	TP_ARGS(ip, agno),
 545	TP_STRUCT__entry(
 546		__field(dev_t, dev)
 547		__field(xfs_ino_t, ino)
 548		__field(xfs_agnumber_t, agno)
 549		__field(int, streams)
 550	),
 551	TP_fast_assign(
 552		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 553		__entry->ino = ip->i_ino;
 554		__entry->agno = agno;
 555		__entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
 556	),
 557	TP_printk("dev %d:%d ino 0x%llx agno %u streams %d",
 558		  MAJOR(__entry->dev), MINOR(__entry->dev),
 559		  __entry->ino,
 560		  __entry->agno,
 561		  __entry->streams)
 562)
 563#define DEFINE_FILESTREAM_EVENT(name) \
 564DEFINE_EVENT(xfs_filestream_class, name, \
 565	TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno), \
 566	TP_ARGS(ip, agno))
 567DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
 568DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
 569DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
 570
 571TRACE_EVENT(xfs_filestream_pick,
 572	TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
 573		 xfs_extlen_t free, int nscan),
 574	TP_ARGS(ip, agno, free, nscan),
 575	TP_STRUCT__entry(
 576		__field(dev_t, dev)
 577		__field(xfs_ino_t, ino)
 578		__field(xfs_agnumber_t, agno)
 579		__field(int, streams)
 580		__field(xfs_extlen_t, free)
 581		__field(int, nscan)
 582	),
 583	TP_fast_assign(
 584		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 585		__entry->ino = ip->i_ino;
 586		__entry->agno = agno;
 587		__entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
 588		__entry->free = free;
 589		__entry->nscan = nscan;
 590	),
 591	TP_printk("dev %d:%d ino 0x%llx agno %u streams %d free %d nscan %d",
 592		  MAJOR(__entry->dev), MINOR(__entry->dev),
 593		  __entry->ino,
 594		  __entry->agno,
 595		  __entry->streams,
 596		  __entry->free,
 597		  __entry->nscan)
 598);
 599
 600DECLARE_EVENT_CLASS(xfs_lock_class,
 601	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
 602		 unsigned long caller_ip),
 603	TP_ARGS(ip,  lock_flags, caller_ip),
 604	TP_STRUCT__entry(
 605		__field(dev_t, dev)
 606		__field(xfs_ino_t, ino)
 607		__field(int, lock_flags)
 608		__field(unsigned long, caller_ip)
 609	),
 610	TP_fast_assign(
 611		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 612		__entry->ino = ip->i_ino;
 613		__entry->lock_flags = lock_flags;
 614		__entry->caller_ip = caller_ip;
 615	),
 616	TP_printk("dev %d:%d ino 0x%llx flags %s caller %ps",
 617		  MAJOR(__entry->dev), MINOR(__entry->dev),
 618		  __entry->ino,
 619		  __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
 620		  (void *)__entry->caller_ip)
 621)
 622
 623#define DEFINE_LOCK_EVENT(name) \
 624DEFINE_EVENT(xfs_lock_class, name, \
 625	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
 626		 unsigned long caller_ip), \
 627	TP_ARGS(ip,  lock_flags, caller_ip))
 628DEFINE_LOCK_EVENT(xfs_ilock);
 629DEFINE_LOCK_EVENT(xfs_ilock_nowait);
 630DEFINE_LOCK_EVENT(xfs_ilock_demote);
 631DEFINE_LOCK_EVENT(xfs_iunlock);
 632
 633DECLARE_EVENT_CLASS(xfs_inode_class,
 634	TP_PROTO(struct xfs_inode *ip),
 635	TP_ARGS(ip),
 636	TP_STRUCT__entry(
 637		__field(dev_t, dev)
 638		__field(xfs_ino_t, ino)
 
 639	),
 640	TP_fast_assign(
 641		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 642		__entry->ino = ip->i_ino;
 
 643	),
 644	TP_printk("dev %d:%d ino 0x%llx",
 645		  MAJOR(__entry->dev), MINOR(__entry->dev),
 646		  __entry->ino)
 
 647)
 648
 649#define DEFINE_INODE_EVENT(name) \
 650DEFINE_EVENT(xfs_inode_class, name, \
 651	TP_PROTO(struct xfs_inode *ip), \
 652	TP_ARGS(ip))
 653DEFINE_INODE_EVENT(xfs_iget_skip);
 654DEFINE_INODE_EVENT(xfs_iget_reclaim);
 655DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
 656DEFINE_INODE_EVENT(xfs_iget_hit);
 657DEFINE_INODE_EVENT(xfs_iget_miss);
 658
 659DEFINE_INODE_EVENT(xfs_getattr);
 660DEFINE_INODE_EVENT(xfs_setattr);
 661DEFINE_INODE_EVENT(xfs_readlink);
 662DEFINE_INODE_EVENT(xfs_inactive_symlink);
 663DEFINE_INODE_EVENT(xfs_alloc_file_space);
 664DEFINE_INODE_EVENT(xfs_free_file_space);
 665DEFINE_INODE_EVENT(xfs_zero_file_space);
 666DEFINE_INODE_EVENT(xfs_collapse_file_space);
 667DEFINE_INODE_EVENT(xfs_insert_file_space);
 668DEFINE_INODE_EVENT(xfs_readdir);
 669#ifdef CONFIG_XFS_POSIX_ACL
 670DEFINE_INODE_EVENT(xfs_get_acl);
 671#endif
 672DEFINE_INODE_EVENT(xfs_vm_bmap);
 673DEFINE_INODE_EVENT(xfs_file_ioctl);
 674DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
 675DEFINE_INODE_EVENT(xfs_ioctl_setattr);
 676DEFINE_INODE_EVENT(xfs_dir_fsync);
 677DEFINE_INODE_EVENT(xfs_file_fsync);
 678DEFINE_INODE_EVENT(xfs_destroy_inode);
 679DEFINE_INODE_EVENT(xfs_evict_inode);
 680DEFINE_INODE_EVENT(xfs_update_time);
 681
 682DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
 683DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
 684
 685DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
 686DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
 687DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 688
 689DEFINE_INODE_EVENT(xfs_filemap_fault);
 690DEFINE_INODE_EVENT(xfs_filemap_pmd_fault);
 691DEFINE_INODE_EVENT(xfs_filemap_page_mkwrite);
 692DEFINE_INODE_EVENT(xfs_filemap_pfn_mkwrite);
 
 
 693
 694DECLARE_EVENT_CLASS(xfs_iref_class,
 695	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
 696	TP_ARGS(ip, caller_ip),
 697	TP_STRUCT__entry(
 698		__field(dev_t, dev)
 699		__field(xfs_ino_t, ino)
 700		__field(int, count)
 701		__field(int, pincount)
 702		__field(unsigned long, caller_ip)
 703	),
 704	TP_fast_assign(
 705		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 706		__entry->ino = ip->i_ino;
 707		__entry->count = atomic_read(&VFS_I(ip)->i_count);
 708		__entry->pincount = atomic_read(&ip->i_pincount);
 709		__entry->caller_ip = caller_ip;
 710	),
 711	TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %ps",
 712		  MAJOR(__entry->dev), MINOR(__entry->dev),
 713		  __entry->ino,
 714		  __entry->count,
 715		  __entry->pincount,
 716		  (char *)__entry->caller_ip)
 717)
 718
 719TRACE_EVENT(xfs_iomap_prealloc_size,
 720	TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
 721		 unsigned int writeio_blocks),
 722	TP_ARGS(ip, blocks, shift, writeio_blocks),
 723	TP_STRUCT__entry(
 724		__field(dev_t, dev)
 725		__field(xfs_ino_t, ino)
 726		__field(xfs_fsblock_t, blocks)
 727		__field(int, shift)
 728		__field(unsigned int, writeio_blocks)
 729	),
 730	TP_fast_assign(
 731		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 732		__entry->ino = ip->i_ino;
 733		__entry->blocks = blocks;
 734		__entry->shift = shift;
 735		__entry->writeio_blocks = writeio_blocks;
 736	),
 737	TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
 738		  "m_writeio_blocks %u",
 739		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
 740		  __entry->blocks, __entry->shift, __entry->writeio_blocks)
 741)
 742
 743TRACE_EVENT(xfs_irec_merge_pre,
 744	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
 745		 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
 746	TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
 
 747	TP_STRUCT__entry(
 748		__field(dev_t, dev)
 749		__field(xfs_agnumber_t, agno)
 750		__field(xfs_agino_t, agino)
 751		__field(uint16_t, holemask)
 752		__field(xfs_agino_t, nagino)
 753		__field(uint16_t, nholemask)
 754	),
 755	TP_fast_assign(
 756		__entry->dev = mp->m_super->s_dev;
 757		__entry->agno = agno;
 758		__entry->agino = agino;
 759		__entry->holemask = holemask;
 760		__entry->nagino = nagino;
 761		__entry->nholemask = holemask;
 762	),
 763	TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)",
 764		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
 765		  __entry->agino, __entry->holemask, __entry->nagino,
 
 
 
 766		  __entry->nholemask)
 767)
 768
 769TRACE_EVENT(xfs_irec_merge_post,
 770	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
 771		 uint16_t holemask),
 772	TP_ARGS(mp, agno, agino, holemask),
 773	TP_STRUCT__entry(
 774		__field(dev_t, dev)
 775		__field(xfs_agnumber_t, agno)
 776		__field(xfs_agino_t, agino)
 777		__field(uint16_t, holemask)
 778	),
 779	TP_fast_assign(
 780		__entry->dev = mp->m_super->s_dev;
 781		__entry->agno = agno;
 782		__entry->agino = agino;
 783		__entry->holemask = holemask;
 784	),
 785	TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev),
 786		  MINOR(__entry->dev), __entry->agno, __entry->agino,
 
 
 
 787		  __entry->holemask)
 788)
 789
 790#define DEFINE_IREF_EVENT(name) \
 791DEFINE_EVENT(xfs_iref_class, name, \
 792	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
 793	TP_ARGS(ip, caller_ip))
 794DEFINE_IREF_EVENT(xfs_ihold);
 795DEFINE_IREF_EVENT(xfs_irele);
 796DEFINE_IREF_EVENT(xfs_inode_pin);
 797DEFINE_IREF_EVENT(xfs_inode_unpin);
 798DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
 799
 800DECLARE_EVENT_CLASS(xfs_namespace_class,
 801	TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
 802	TP_ARGS(dp, name),
 803	TP_STRUCT__entry(
 804		__field(dev_t, dev)
 805		__field(xfs_ino_t, dp_ino)
 806		__field(int, namelen)
 807		__dynamic_array(char, name, name->len)
 808	),
 809	TP_fast_assign(
 810		__entry->dev = VFS_I(dp)->i_sb->s_dev;
 811		__entry->dp_ino = dp->i_ino;
 812		__entry->namelen = name->len;
 813		memcpy(__get_str(name), name->name, name->len);
 814	),
 815	TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
 816		  MAJOR(__entry->dev), MINOR(__entry->dev),
 817		  __entry->dp_ino,
 818		  __entry->namelen,
 819		  __get_str(name))
 820)
 821
 822#define DEFINE_NAMESPACE_EVENT(name) \
 823DEFINE_EVENT(xfs_namespace_class, name, \
 824	TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
 825	TP_ARGS(dp, name))
 826DEFINE_NAMESPACE_EVENT(xfs_remove);
 827DEFINE_NAMESPACE_EVENT(xfs_link);
 828DEFINE_NAMESPACE_EVENT(xfs_lookup);
 829DEFINE_NAMESPACE_EVENT(xfs_create);
 830DEFINE_NAMESPACE_EVENT(xfs_symlink);
 831
 832TRACE_EVENT(xfs_rename,
 833	TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
 834		 struct xfs_name *src_name, struct xfs_name *target_name),
 835	TP_ARGS(src_dp, target_dp, src_name, target_name),
 836	TP_STRUCT__entry(
 837		__field(dev_t, dev)
 838		__field(xfs_ino_t, src_dp_ino)
 839		__field(xfs_ino_t, target_dp_ino)
 840		__field(int, src_namelen)
 841		__field(int, target_namelen)
 842		__dynamic_array(char, src_name, src_name->len)
 843		__dynamic_array(char, target_name, target_name->len)
 844	),
 845	TP_fast_assign(
 846		__entry->dev = VFS_I(src_dp)->i_sb->s_dev;
 847		__entry->src_dp_ino = src_dp->i_ino;
 848		__entry->target_dp_ino = target_dp->i_ino;
 849		__entry->src_namelen = src_name->len;
 850		__entry->target_namelen = target_name->len;
 851		memcpy(__get_str(src_name), src_name->name, src_name->len);
 852		memcpy(__get_str(target_name), target_name->name,
 853			target_name->len);
 854	),
 855	TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
 856		  " src name %.*s target name %.*s",
 857		  MAJOR(__entry->dev), MINOR(__entry->dev),
 858		  __entry->src_dp_ino,
 859		  __entry->target_dp_ino,
 860		  __entry->src_namelen,
 861		  __get_str(src_name),
 862		  __entry->target_namelen,
 863		  __get_str(target_name))
 864)
 865
 866DECLARE_EVENT_CLASS(xfs_dquot_class,
 867	TP_PROTO(struct xfs_dquot *dqp),
 868	TP_ARGS(dqp),
 869	TP_STRUCT__entry(
 870		__field(dev_t, dev)
 871		__field(u32, id)
 
 872		__field(unsigned, flags)
 873		__field(unsigned, nrefs)
 874		__field(unsigned long long, res_bcount)
 
 
 
 875		__field(unsigned long long, bcount)
 
 876		__field(unsigned long long, icount)
 
 877		__field(unsigned long long, blk_hardlimit)
 878		__field(unsigned long long, blk_softlimit)
 
 
 879		__field(unsigned long long, ino_hardlimit)
 880		__field(unsigned long long, ino_softlimit)
 881	), \
 882	TP_fast_assign(
 883		__entry->dev = dqp->q_mount->m_super->s_dev;
 884		__entry->id = be32_to_cpu(dqp->q_core.d_id);
 885		__entry->flags = dqp->dq_flags;
 
 886		__entry->nrefs = dqp->q_nrefs;
 887		__entry->res_bcount = dqp->q_res_bcount;
 888		__entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
 889		__entry->icount = be64_to_cpu(dqp->q_core.d_icount);
 890		__entry->blk_hardlimit =
 891			be64_to_cpu(dqp->q_core.d_blk_hardlimit);
 892		__entry->blk_softlimit =
 893			be64_to_cpu(dqp->q_core.d_blk_softlimit);
 894		__entry->ino_hardlimit =
 895			be64_to_cpu(dqp->q_core.d_ino_hardlimit);
 896		__entry->ino_softlimit =
 897			be64_to_cpu(dqp->q_core.d_ino_softlimit);
 
 
 
 
 898	),
 899	TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
 
 900		  "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
 
 901		  "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
 902		  MAJOR(__entry->dev), MINOR(__entry->dev),
 903		  __entry->id,
 904		  __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
 
 905		  __entry->nrefs,
 906		  __entry->res_bcount,
 
 
 907		  __entry->bcount,
 908		  __entry->blk_hardlimit,
 909		  __entry->blk_softlimit,
 
 
 
 910		  __entry->icount,
 911		  __entry->ino_hardlimit,
 912		  __entry->ino_softlimit)
 913)
 914
 915#define DEFINE_DQUOT_EVENT(name) \
 916DEFINE_EVENT(xfs_dquot_class, name, \
 917	TP_PROTO(struct xfs_dquot *dqp), \
 918	TP_ARGS(dqp))
 919DEFINE_DQUOT_EVENT(xfs_dqadjust);
 920DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
 921DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
 922DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
 923DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
 924DEFINE_DQUOT_EVENT(xfs_dqattach_found);
 925DEFINE_DQUOT_EVENT(xfs_dqattach_get);
 926DEFINE_DQUOT_EVENT(xfs_dqalloc);
 927DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
 928DEFINE_DQUOT_EVENT(xfs_dqread);
 929DEFINE_DQUOT_EVENT(xfs_dqread_fail);
 930DEFINE_DQUOT_EVENT(xfs_dqget_hit);
 931DEFINE_DQUOT_EVENT(xfs_dqget_miss);
 932DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
 933DEFINE_DQUOT_EVENT(xfs_dqget_dup);
 934DEFINE_DQUOT_EVENT(xfs_dqput);
 935DEFINE_DQUOT_EVENT(xfs_dqput_wait);
 936DEFINE_DQUOT_EVENT(xfs_dqput_free);
 937DEFINE_DQUOT_EVENT(xfs_dqrele);
 938DEFINE_DQUOT_EVENT(xfs_dqflush);
 939DEFINE_DQUOT_EVENT(xfs_dqflush_force);
 940DEFINE_DQUOT_EVENT(xfs_dqflush_done);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 941
 942DECLARE_EVENT_CLASS(xfs_loggrant_class,
 943	TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
 944	TP_ARGS(log, tic),
 945	TP_STRUCT__entry(
 946		__field(dev_t, dev)
 947		__field(unsigned, trans_type)
 948		__field(char, ocnt)
 949		__field(char, cnt)
 950		__field(int, curr_res)
 951		__field(int, unit_res)
 952		__field(unsigned int, flags)
 953		__field(int, reserveq)
 954		__field(int, writeq)
 955		__field(int, grant_reserve_cycle)
 956		__field(int, grant_reserve_bytes)
 957		__field(int, grant_write_cycle)
 958		__field(int, grant_write_bytes)
 959		__field(int, curr_cycle)
 960		__field(int, curr_block)
 961		__field(xfs_lsn_t, tail_lsn)
 962	),
 963	TP_fast_assign(
 964		__entry->dev = log->l_mp->m_super->s_dev;
 965		__entry->trans_type = tic->t_trans_type;
 966		__entry->ocnt = tic->t_ocnt;
 967		__entry->cnt = tic->t_cnt;
 968		__entry->curr_res = tic->t_curr_res;
 969		__entry->unit_res = tic->t_unit_res;
 970		__entry->flags = tic->t_flags;
 971		__entry->reserveq = list_empty(&log->l_reserve_head.waiters);
 972		__entry->writeq = list_empty(&log->l_write_head.waiters);
 973		xlog_crack_grant_head(&log->l_reserve_head.grant,
 974				&__entry->grant_reserve_cycle,
 975				&__entry->grant_reserve_bytes);
 976		xlog_crack_grant_head(&log->l_write_head.grant,
 977				&__entry->grant_write_cycle,
 978				&__entry->grant_write_bytes);
 979		__entry->curr_cycle = log->l_curr_cycle;
 980		__entry->curr_block = log->l_curr_block;
 981		__entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
 982	),
 983	TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u "
 984		  "t_unit_res %u t_flags %s reserveq %s "
 985		  "writeq %s grant_reserve_cycle %d "
 986		  "grant_reserve_bytes %d grant_write_cycle %d "
 987		  "grant_write_bytes %d curr_cycle %d curr_block %d "
 988		  "tail_cycle %d tail_block %d",
 989		  MAJOR(__entry->dev), MINOR(__entry->dev),
 990		  __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES),
 991		  __entry->ocnt,
 992		  __entry->cnt,
 993		  __entry->curr_res,
 994		  __entry->unit_res,
 995		  __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
 996		  __entry->reserveq ? "empty" : "active",
 997		  __entry->writeq ? "empty" : "active",
 998		  __entry->grant_reserve_cycle,
 999		  __entry->grant_reserve_bytes,
1000		  __entry->grant_write_cycle,
1001		  __entry->grant_write_bytes,
1002		  __entry->curr_cycle,
1003		  __entry->curr_block,
1004		  CYCLE_LSN(__entry->tail_lsn),
1005		  BLOCK_LSN(__entry->tail_lsn)
1006	)
1007)
1008
1009#define DEFINE_LOGGRANT_EVENT(name) \
1010DEFINE_EVENT(xfs_loggrant_class, name, \
1011	TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
1012	TP_ARGS(log, tic))
1013DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
1014DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
1015DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
1016DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1017DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
1018DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
1019DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1020DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1021DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1022DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
1023DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
1024DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
1025DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
1026DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
1027DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
1028DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
 
 
1029
1030DECLARE_EVENT_CLASS(xfs_log_item_class,
1031	TP_PROTO(struct xfs_log_item *lip),
1032	TP_ARGS(lip),
1033	TP_STRUCT__entry(
1034		__field(dev_t, dev)
1035		__field(void *, lip)
1036		__field(uint, type)
1037		__field(uint, flags)
1038		__field(xfs_lsn_t, lsn)
1039	),
1040	TP_fast_assign(
1041		__entry->dev = lip->li_mountp->m_super->s_dev;
1042		__entry->lip = lip;
1043		__entry->type = lip->li_type;
1044		__entry->flags = lip->li_flags;
1045		__entry->lsn = lip->li_lsn;
1046	),
1047	TP_printk("dev %d:%d lip 0x%p lsn %d/%d type %s flags %s",
1048		  MAJOR(__entry->dev), MINOR(__entry->dev),
1049		  __entry->lip,
1050		  CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1051		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1052		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1053)
1054
1055TRACE_EVENT(xfs_log_force,
1056	TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn),
1057	TP_ARGS(mp, lsn),
1058	TP_STRUCT__entry(
1059		__field(dev_t, dev)
1060		__field(xfs_lsn_t, lsn)
 
1061	),
1062	TP_fast_assign(
1063		__entry->dev = mp->m_super->s_dev;
1064		__entry->lsn = lsn;
 
1065	),
1066	TP_printk("dev %d:%d lsn 0x%llx",
1067		  MAJOR(__entry->dev), MINOR(__entry->dev),
1068		  __entry->lsn)
1069)
1070
1071#define DEFINE_LOG_ITEM_EVENT(name) \
1072DEFINE_EVENT(xfs_log_item_class, name, \
1073	TP_PROTO(struct xfs_log_item *lip), \
1074	TP_ARGS(lip))
1075DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
1076DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1077DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
1078DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
 
 
 
1079
1080DECLARE_EVENT_CLASS(xfs_ail_class,
1081	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1082	TP_ARGS(lip, old_lsn, new_lsn),
1083	TP_STRUCT__entry(
1084		__field(dev_t, dev)
1085		__field(void *, lip)
1086		__field(uint, type)
1087		__field(uint, flags)
1088		__field(xfs_lsn_t, old_lsn)
1089		__field(xfs_lsn_t, new_lsn)
1090	),
1091	TP_fast_assign(
1092		__entry->dev = lip->li_mountp->m_super->s_dev;
1093		__entry->lip = lip;
1094		__entry->type = lip->li_type;
1095		__entry->flags = lip->li_flags;
1096		__entry->old_lsn = old_lsn;
1097		__entry->new_lsn = new_lsn;
1098	),
1099	TP_printk("dev %d:%d lip 0x%p old lsn %d/%d new lsn %d/%d type %s flags %s",
1100		  MAJOR(__entry->dev), MINOR(__entry->dev),
1101		  __entry->lip,
1102		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1103		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1104		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1105		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1106)
1107
1108#define DEFINE_AIL_EVENT(name) \
1109DEFINE_EVENT(xfs_ail_class, name, \
1110	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1111	TP_ARGS(lip, old_lsn, new_lsn))
1112DEFINE_AIL_EVENT(xfs_ail_insert);
1113DEFINE_AIL_EVENT(xfs_ail_move);
1114DEFINE_AIL_EVENT(xfs_ail_delete);
1115
1116TRACE_EVENT(xfs_log_assign_tail_lsn,
1117	TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1118	TP_ARGS(log, new_lsn),
1119	TP_STRUCT__entry(
1120		__field(dev_t, dev)
1121		__field(xfs_lsn_t, new_lsn)
1122		__field(xfs_lsn_t, old_lsn)
1123		__field(xfs_lsn_t, last_sync_lsn)
1124	),
1125	TP_fast_assign(
1126		__entry->dev = log->l_mp->m_super->s_dev;
1127		__entry->new_lsn = new_lsn;
1128		__entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1129		__entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1130	),
1131	TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1132		  MAJOR(__entry->dev), MINOR(__entry->dev),
1133		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1134		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1135		  CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1136)
1137
1138DECLARE_EVENT_CLASS(xfs_file_class,
1139	TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),
1140	TP_ARGS(ip, count, offset, flags),
1141	TP_STRUCT__entry(
1142		__field(dev_t, dev)
1143		__field(xfs_ino_t, ino)
1144		__field(xfs_fsize_t, size)
1145		__field(loff_t, offset)
1146		__field(size_t, count)
1147		__field(int, flags)
1148	),
1149	TP_fast_assign(
1150		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1151		__entry->ino = ip->i_ino;
1152		__entry->size = ip->i_d.di_size;
1153		__entry->offset = offset;
1154		__entry->count = count;
1155		__entry->flags = flags;
1156	),
1157	TP_printk("dev %d:%d ino 0x%llx size 0x%llx "
1158		  "offset 0x%llx count 0x%zx ioflags %s",
1159		  MAJOR(__entry->dev), MINOR(__entry->dev),
1160		  __entry->ino,
1161		  __entry->size,
1162		  __entry->offset,
1163		  __entry->count,
1164		  __print_flags(__entry->flags, "|", XFS_IO_FLAGS))
1165)
1166
1167#define DEFINE_RW_EVENT(name)		\
1168DEFINE_EVENT(xfs_file_class, name,	\
1169	TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),	\
1170	TP_ARGS(ip, count, offset, flags))
1171DEFINE_RW_EVENT(xfs_file_read);
 
 
1172DEFINE_RW_EVENT(xfs_file_buffered_write);
1173DEFINE_RW_EVENT(xfs_file_direct_write);
1174DEFINE_RW_EVENT(xfs_file_splice_read);
1175
1176DECLARE_EVENT_CLASS(xfs_page_class,
1177	TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1178		 unsigned int len),
1179	TP_ARGS(inode, page, off, len),
1180	TP_STRUCT__entry(
1181		__field(dev_t, dev)
1182		__field(xfs_ino_t, ino)
1183		__field(pgoff_t, pgoff)
1184		__field(loff_t, size)
1185		__field(unsigned long, offset)
1186		__field(unsigned int, length)
1187		__field(int, delalloc)
1188		__field(int, unwritten)
1189	),
1190	TP_fast_assign(
1191		int delalloc = -1, unwritten = -1;
1192
1193		if (page_has_buffers(page))
1194			xfs_count_page_state(page, &delalloc, &unwritten);
1195		__entry->dev = inode->i_sb->s_dev;
1196		__entry->ino = XFS_I(inode)->i_ino;
1197		__entry->pgoff = page_offset(page);
1198		__entry->size = i_size_read(inode);
1199		__entry->offset = off;
1200		__entry->length = len;
1201		__entry->delalloc = delalloc;
1202		__entry->unwritten = unwritten;
1203	),
1204	TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
1205		  "length %x delalloc %d unwritten %d",
1206		  MAJOR(__entry->dev), MINOR(__entry->dev),
1207		  __entry->ino,
1208		  __entry->pgoff,
1209		  __entry->size,
1210		  __entry->offset,
1211		  __entry->length,
1212		  __entry->delalloc,
1213		  __entry->unwritten)
1214)
1215
1216#define DEFINE_PAGE_EVENT(name)		\
1217DEFINE_EVENT(xfs_page_class, name,	\
1218	TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1219		 unsigned int len),	\
1220	TP_ARGS(inode, page, off, len))
1221DEFINE_PAGE_EVENT(xfs_writepage);
1222DEFINE_PAGE_EVENT(xfs_releasepage);
1223DEFINE_PAGE_EVENT(xfs_invalidatepage);
1224
1225DECLARE_EVENT_CLASS(xfs_readpage_class,
1226	TP_PROTO(struct inode *inode, int nr_pages),
1227	TP_ARGS(inode, nr_pages),
1228	TP_STRUCT__entry(
1229		__field(dev_t, dev)
1230		__field(xfs_ino_t, ino)
1231		__field(int, nr_pages)
1232	),
1233	TP_fast_assign(
1234		__entry->dev = inode->i_sb->s_dev;
1235		__entry->ino = inode->i_ino;
1236		__entry->nr_pages = nr_pages;
1237	),
1238	TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
1239		  MAJOR(__entry->dev), MINOR(__entry->dev),
1240		  __entry->ino,
1241		  __entry->nr_pages)
1242)
1243
1244#define DEFINE_READPAGE_EVENT(name)		\
1245DEFINE_EVENT(xfs_readpage_class, name,	\
1246	TP_PROTO(struct inode *inode, int nr_pages), \
1247	TP_ARGS(inode, nr_pages))
1248DEFINE_READPAGE_EVENT(xfs_vm_readpage);
1249DEFINE_READPAGE_EVENT(xfs_vm_readpages);
1250
1251DECLARE_EVENT_CLASS(xfs_imap_class,
1252	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
1253		 int type, struct xfs_bmbt_irec *irec),
1254	TP_ARGS(ip, offset, count, type, irec),
1255	TP_STRUCT__entry(
1256		__field(dev_t, dev)
1257		__field(xfs_ino_t, ino)
1258		__field(loff_t, size)
1259		__field(loff_t, offset)
1260		__field(size_t, count)
1261		__field(int, type)
1262		__field(xfs_fileoff_t, startoff)
1263		__field(xfs_fsblock_t, startblock)
1264		__field(xfs_filblks_t, blockcount)
1265	),
1266	TP_fast_assign(
1267		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1268		__entry->ino = ip->i_ino;
1269		__entry->size = ip->i_d.di_size;
1270		__entry->offset = offset;
1271		__entry->count = count;
1272		__entry->type = type;
1273		__entry->startoff = irec ? irec->br_startoff : 0;
1274		__entry->startblock = irec ? irec->br_startblock : 0;
1275		__entry->blockcount = irec ? irec->br_blockcount : 0;
1276	),
1277	TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1278		  "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
1279		  MAJOR(__entry->dev), MINOR(__entry->dev),
1280		  __entry->ino,
1281		  __entry->size,
1282		  __entry->offset,
1283		  __entry->count,
1284		  __print_symbolic(__entry->type, XFS_IO_TYPES),
1285		  __entry->startoff,
1286		  (__int64_t)__entry->startblock,
1287		  __entry->blockcount)
1288)
1289
1290#define DEFINE_IOMAP_EVENT(name)	\
1291DEFINE_EVENT(xfs_imap_class, name,	\
1292	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,	\
1293		 int type, struct xfs_bmbt_irec *irec),		\
1294	TP_ARGS(ip, offset, count, type, irec))
1295DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1296DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1297DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1298DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
1299DEFINE_IOMAP_EVENT(xfs_get_blocks_map_direct);
1300
1301DECLARE_EVENT_CLASS(xfs_simple_io_class,
1302	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1303	TP_ARGS(ip, offset, count),
1304	TP_STRUCT__entry(
1305		__field(dev_t, dev)
1306		__field(xfs_ino_t, ino)
1307		__field(loff_t, isize)
1308		__field(loff_t, disize)
1309		__field(loff_t, offset)
1310		__field(size_t, count)
1311	),
1312	TP_fast_assign(
1313		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1314		__entry->ino = ip->i_ino;
1315		__entry->isize = VFS_I(ip)->i_size;
1316		__entry->disize = ip->i_d.di_size;
1317		__entry->offset = offset;
1318		__entry->count = count;
1319	),
1320	TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
1321		  "offset 0x%llx count %zd",
1322		  MAJOR(__entry->dev), MINOR(__entry->dev),
1323		  __entry->ino,
1324		  __entry->isize,
1325		  __entry->disize,
1326		  __entry->offset,
1327		  __entry->count)
1328);
1329
1330#define DEFINE_SIMPLE_IO_EVENT(name)	\
1331DEFINE_EVENT(xfs_simple_io_class, name,	\
1332	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),	\
1333	TP_ARGS(ip, offset, count))
1334DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1335DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
1336DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
1337DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
1338DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
1339DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1340DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1341DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
 
1342
1343DECLARE_EVENT_CLASS(xfs_itrunc_class,
1344	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1345	TP_ARGS(ip, new_size),
1346	TP_STRUCT__entry(
1347		__field(dev_t, dev)
1348		__field(xfs_ino_t, ino)
1349		__field(xfs_fsize_t, size)
1350		__field(xfs_fsize_t, new_size)
1351	),
1352	TP_fast_assign(
1353		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1354		__entry->ino = ip->i_ino;
1355		__entry->size = ip->i_d.di_size;
1356		__entry->new_size = new_size;
1357	),
1358	TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1359		  MAJOR(__entry->dev), MINOR(__entry->dev),
1360		  __entry->ino,
1361		  __entry->size,
1362		  __entry->new_size)
1363)
1364
1365#define DEFINE_ITRUNC_EVENT(name) \
1366DEFINE_EVENT(xfs_itrunc_class, name, \
1367	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1368	TP_ARGS(ip, new_size))
1369DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1370DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
1371
1372TRACE_EVENT(xfs_pagecache_inval,
1373	TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1374	TP_ARGS(ip, start, finish),
1375	TP_STRUCT__entry(
1376		__field(dev_t, dev)
1377		__field(xfs_ino_t, ino)
1378		__field(xfs_fsize_t, size)
1379		__field(xfs_off_t, start)
1380		__field(xfs_off_t, finish)
1381	),
1382	TP_fast_assign(
1383		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1384		__entry->ino = ip->i_ino;
1385		__entry->size = ip->i_d.di_size;
1386		__entry->start = start;
1387		__entry->finish = finish;
1388	),
1389	TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1390		  MAJOR(__entry->dev), MINOR(__entry->dev),
1391		  __entry->ino,
1392		  __entry->size,
1393		  __entry->start,
1394		  __entry->finish)
1395);
1396
1397TRACE_EVENT(xfs_bunmap,
1398	TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1399		 int flags, unsigned long caller_ip),
1400	TP_ARGS(ip, bno, len, flags, caller_ip),
1401	TP_STRUCT__entry(
1402		__field(dev_t, dev)
1403		__field(xfs_ino_t, ino)
1404		__field(xfs_fsize_t, size)
1405		__field(xfs_fileoff_t, bno)
1406		__field(xfs_filblks_t, len)
1407		__field(unsigned long, caller_ip)
1408		__field(int, flags)
1409	),
1410	TP_fast_assign(
1411		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1412		__entry->ino = ip->i_ino;
1413		__entry->size = ip->i_d.di_size;
1414		__entry->bno = bno;
1415		__entry->len = len;
1416		__entry->caller_ip = caller_ip;
1417		__entry->flags = flags;
1418	),
1419	TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
1420		  "flags %s caller %ps",
1421		  MAJOR(__entry->dev), MINOR(__entry->dev),
1422		  __entry->ino,
1423		  __entry->size,
1424		  __entry->bno,
1425		  __entry->len,
1426		  __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1427		  (void *)__entry->caller_ip)
1428
1429);
1430
1431DECLARE_EVENT_CLASS(xfs_extent_busy_class,
1432	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1433		 xfs_agblock_t agbno, xfs_extlen_t len),
1434	TP_ARGS(mp, agno, agbno, len),
1435	TP_STRUCT__entry(
1436		__field(dev_t, dev)
 
1437		__field(xfs_agnumber_t, agno)
1438		__field(xfs_agblock_t, agbno)
1439		__field(xfs_extlen_t, len)
1440	),
1441	TP_fast_assign(
1442		__entry->dev = mp->m_super->s_dev;
1443		__entry->agno = agno;
 
1444		__entry->agbno = agbno;
1445		__entry->len = len;
1446	),
1447	TP_printk("dev %d:%d agno %u agbno %u len %u",
1448		  MAJOR(__entry->dev), MINOR(__entry->dev),
 
1449		  __entry->agno,
 
1450		  __entry->agbno,
1451		  __entry->len)
1452);
1453#define DEFINE_BUSY_EVENT(name) \
1454DEFINE_EVENT(xfs_extent_busy_class, name, \
1455	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1456		 xfs_agblock_t agbno, xfs_extlen_t len), \
1457	TP_ARGS(mp, agno, agbno, len))
1458DEFINE_BUSY_EVENT(xfs_extent_busy);
1459DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1460DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1461DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1462DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
1463
1464TRACE_EVENT(xfs_extent_busy_trim,
1465	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1466		 xfs_agblock_t agbno, xfs_extlen_t len,
1467		 xfs_agblock_t tbno, xfs_extlen_t tlen),
1468	TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1469	TP_STRUCT__entry(
1470		__field(dev_t, dev)
 
1471		__field(xfs_agnumber_t, agno)
1472		__field(xfs_agblock_t, agbno)
1473		__field(xfs_extlen_t, len)
1474		__field(xfs_agblock_t, tbno)
1475		__field(xfs_extlen_t, tlen)
1476	),
1477	TP_fast_assign(
1478		__entry->dev = mp->m_super->s_dev;
1479		__entry->agno = agno;
 
1480		__entry->agbno = agbno;
1481		__entry->len = len;
1482		__entry->tbno = tbno;
1483		__entry->tlen = tlen;
1484	),
1485	TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1486		  MAJOR(__entry->dev), MINOR(__entry->dev),
 
1487		  __entry->agno,
 
1488		  __entry->agbno,
1489		  __entry->len,
1490		  __entry->tbno,
1491		  __entry->tlen)
1492);
1493
1494TRACE_EVENT(xfs_trans_commit_lsn,
1495	TP_PROTO(struct xfs_trans *trans),
1496	TP_ARGS(trans),
1497	TP_STRUCT__entry(
1498		__field(dev_t, dev)
1499		__field(struct xfs_trans *, tp)
1500		__field(xfs_lsn_t, lsn)
 
 
 
 
 
 
 
 
 
 
 
1501	),
1502	TP_fast_assign(
1503		__entry->dev = trans->t_mountp->m_super->s_dev;
1504		__entry->tp = trans;
1505		__entry->lsn = trans->t_commit_lsn;
 
 
 
 
 
 
1506	),
1507	TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
 
1508		  MAJOR(__entry->dev), MINOR(__entry->dev),
1509		  __entry->tp,
1510		  __entry->lsn)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1511);
 
1512
1513TRACE_EVENT(xfs_agf,
1514	TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1515		 unsigned long caller_ip),
1516	TP_ARGS(mp, agf, flags, caller_ip),
1517	TP_STRUCT__entry(
1518		__field(dev_t, dev)
1519		__field(xfs_agnumber_t, agno)
1520		__field(int, flags)
1521		__field(__u32, length)
1522		__field(__u32, bno_root)
1523		__field(__u32, cnt_root)
1524		__field(__u32, bno_level)
1525		__field(__u32, cnt_level)
1526		__field(__u32, flfirst)
1527		__field(__u32, fllast)
1528		__field(__u32, flcount)
1529		__field(__u32, freeblks)
1530		__field(__u32, longest)
1531		__field(unsigned long, caller_ip)
1532	),
1533	TP_fast_assign(
1534		__entry->dev = mp->m_super->s_dev;
1535		__entry->agno = be32_to_cpu(agf->agf_seqno),
1536		__entry->flags = flags;
1537		__entry->length = be32_to_cpu(agf->agf_length),
1538		__entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1539		__entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1540		__entry->bno_level =
1541				be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1542		__entry->cnt_level =
1543				be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1544		__entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1545		__entry->fllast = be32_to_cpu(agf->agf_fllast),
1546		__entry->flcount = be32_to_cpu(agf->agf_flcount),
1547		__entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1548		__entry->longest = be32_to_cpu(agf->agf_longest);
1549		__entry->caller_ip = caller_ip;
1550	),
1551	TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1552		  "levels b %u c %u flfirst %u fllast %u flcount %u "
1553		  "freeblks %u longest %u caller %ps",
1554		  MAJOR(__entry->dev), MINOR(__entry->dev),
1555		  __entry->agno,
1556		  __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1557		  __entry->length,
1558		  __entry->bno_root,
1559		  __entry->cnt_root,
1560		  __entry->bno_level,
1561		  __entry->cnt_level,
1562		  __entry->flfirst,
1563		  __entry->fllast,
1564		  __entry->flcount,
1565		  __entry->freeblks,
1566		  __entry->longest,
1567		  (void *)__entry->caller_ip)
1568);
 
 
 
 
 
 
 
1569
1570TRACE_EVENT(xfs_free_extent,
1571	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1572		 xfs_extlen_t len, bool isfl, int haveleft, int haveright),
1573	TP_ARGS(mp, agno, agbno, len, isfl, haveleft, haveright),
 
1574	TP_STRUCT__entry(
1575		__field(dev_t, dev)
1576		__field(xfs_agnumber_t, agno)
1577		__field(xfs_agblock_t, agbno)
1578		__field(xfs_extlen_t, len)
1579		__field(int, isfl)
1580		__field(int, haveleft)
1581		__field(int, haveright)
1582	),
1583	TP_fast_assign(
1584		__entry->dev = mp->m_super->s_dev;
1585		__entry->agno = agno;
1586		__entry->agbno = agbno;
1587		__entry->len = len;
1588		__entry->isfl = isfl;
1589		__entry->haveleft = haveleft;
1590		__entry->haveright = haveright;
1591	),
1592	TP_printk("dev %d:%d agno %u agbno %u len %u isfl %d %s",
1593		  MAJOR(__entry->dev), MINOR(__entry->dev),
1594		  __entry->agno,
1595		  __entry->agbno,
1596		  __entry->len,
1597		  __entry->isfl,
1598		  __entry->haveleft ?
1599			(__entry->haveright ? "both" : "left") :
1600			(__entry->haveright ? "right" : "none"))
1601
1602);
1603
1604DECLARE_EVENT_CLASS(xfs_alloc_class,
1605	TP_PROTO(struct xfs_alloc_arg *args),
1606	TP_ARGS(args),
1607	TP_STRUCT__entry(
1608		__field(dev_t, dev)
1609		__field(xfs_agnumber_t, agno)
1610		__field(xfs_agblock_t, agbno)
1611		__field(xfs_extlen_t, minlen)
1612		__field(xfs_extlen_t, maxlen)
1613		__field(xfs_extlen_t, mod)
1614		__field(xfs_extlen_t, prod)
1615		__field(xfs_extlen_t, minleft)
1616		__field(xfs_extlen_t, total)
1617		__field(xfs_extlen_t, alignment)
1618		__field(xfs_extlen_t, minalignslop)
1619		__field(xfs_extlen_t, len)
1620		__field(short, type)
1621		__field(short, otype)
1622		__field(char, wasdel)
1623		__field(char, wasfromfl)
1624		__field(char, isfl)
1625		__field(char, userdata)
1626		__field(xfs_fsblock_t, firstblock)
1627	),
1628	TP_fast_assign(
1629		__entry->dev = args->mp->m_super->s_dev;
1630		__entry->agno = args->agno;
1631		__entry->agbno = args->agbno;
1632		__entry->minlen = args->minlen;
1633		__entry->maxlen = args->maxlen;
1634		__entry->mod = args->mod;
1635		__entry->prod = args->prod;
1636		__entry->minleft = args->minleft;
1637		__entry->total = args->total;
1638		__entry->alignment = args->alignment;
1639		__entry->minalignslop = args->minalignslop;
1640		__entry->len = args->len;
1641		__entry->type = args->type;
1642		__entry->otype = args->otype;
1643		__entry->wasdel = args->wasdel;
1644		__entry->wasfromfl = args->wasfromfl;
1645		__entry->isfl = args->isfl;
1646		__entry->userdata = args->userdata;
1647		__entry->firstblock = args->firstblock;
1648	),
1649	TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1650		  "prod %u minleft %u total %u alignment %u minalignslop %u "
1651		  "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d "
1652		  "userdata %d firstblock 0x%llx",
1653		  MAJOR(__entry->dev), MINOR(__entry->dev),
1654		  __entry->agno,
1655		  __entry->agbno,
1656		  __entry->minlen,
1657		  __entry->maxlen,
1658		  __entry->mod,
1659		  __entry->prod,
1660		  __entry->minleft,
1661		  __entry->total,
1662		  __entry->alignment,
1663		  __entry->minalignslop,
1664		  __entry->len,
1665		  __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1666		  __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1667		  __entry->wasdel,
1668		  __entry->wasfromfl,
1669		  __entry->isfl,
1670		  __entry->userdata,
1671		  (unsigned long long)__entry->firstblock)
1672)
1673
1674#define DEFINE_ALLOC_EVENT(name) \
1675DEFINE_EVENT(xfs_alloc_class, name, \
1676	TP_PROTO(struct xfs_alloc_arg *args), \
1677	TP_ARGS(args))
1678DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1679DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
1680DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1681DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1682DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1683DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1684DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
 
 
 
1685DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1686DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1687DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
1688DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1689DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1690DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1691DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1692DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1693DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
1694DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1695DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1696DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1697DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1698DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
 
1699DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1700DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1701DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1702DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1703
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1704DECLARE_EVENT_CLASS(xfs_da_class,
1705	TP_PROTO(struct xfs_da_args *args),
1706	TP_ARGS(args),
1707	TP_STRUCT__entry(
1708		__field(dev_t, dev)
1709		__field(xfs_ino_t, ino)
1710		__dynamic_array(char, name, args->namelen)
1711		__field(int, namelen)
1712		__field(xfs_dahash_t, hashval)
1713		__field(xfs_ino_t, inumber)
1714		__field(int, op_flags)
 
1715	),
1716	TP_fast_assign(
1717		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1718		__entry->ino = args->dp->i_ino;
1719		if (args->namelen)
1720			memcpy(__get_str(name), args->name, args->namelen);
1721		__entry->namelen = args->namelen;
1722		__entry->hashval = args->hashval;
1723		__entry->inumber = args->inumber;
1724		__entry->op_flags = args->op_flags;
 
1725	),
1726	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1727		  "inumber 0x%llx op_flags %s",
1728		  MAJOR(__entry->dev), MINOR(__entry->dev),
1729		  __entry->ino,
1730		  __entry->namelen,
1731		  __entry->namelen ? __get_str(name) : NULL,
1732		  __entry->namelen,
1733		  __entry->hashval,
1734		  __entry->inumber,
1735		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
 
1736)
1737
1738#define DEFINE_DIR2_EVENT(name) \
1739DEFINE_EVENT(xfs_da_class, name, \
1740	TP_PROTO(struct xfs_da_args *args), \
1741	TP_ARGS(args))
1742DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1743DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1744DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1745DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1746DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1747DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1748DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1749DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1750DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1751DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1752DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1753DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1754DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1755DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1756DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1757DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1758DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1759DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1760DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1761DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1762DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1763DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1764DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1765DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1766DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1767
1768DECLARE_EVENT_CLASS(xfs_attr_class,
1769	TP_PROTO(struct xfs_da_args *args),
1770	TP_ARGS(args),
1771	TP_STRUCT__entry(
1772		__field(dev_t, dev)
1773		__field(xfs_ino_t, ino)
1774		__dynamic_array(char, name, args->namelen)
1775		__field(int, namelen)
1776		__field(int, valuelen)
1777		__field(xfs_dahash_t, hashval)
1778		__field(int, op_flags)
 
1779	),
1780	TP_fast_assign(
1781		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1782		__entry->ino = args->dp->i_ino;
1783		if (args->namelen)
1784			memcpy(__get_str(name), args->name, args->namelen);
1785		__entry->namelen = args->namelen;
1786		__entry->valuelen = args->valuelen;
1787		__entry->hashval = args->hashval;
 
1788		__entry->op_flags = args->op_flags;
1789	),
1790	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1791		  "hashval 0x%x op_flags %s",
1792		  MAJOR(__entry->dev), MINOR(__entry->dev),
1793		  __entry->ino,
1794		  __entry->namelen,
1795		  __entry->namelen ? __get_str(name) : NULL,
1796		  __entry->namelen,
1797		  __entry->valuelen,
1798		  __entry->hashval,
 
 
1799		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1800)
1801
1802#define DEFINE_ATTR_EVENT(name) \
1803DEFINE_EVENT(xfs_attr_class, name, \
1804	TP_PROTO(struct xfs_da_args *args), \
1805	TP_ARGS(args))
1806DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1807DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1808DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1809DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1810DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
1811DEFINE_ATTR_EVENT(xfs_attr_sf_removename);
1812DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1813
1814DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1815DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1816DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
1817DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
1818DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1819DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
1820DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1821DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
1822DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1823DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
1824DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
1825DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1826DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1827DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1828DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1829DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1830DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1831DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1832DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1833DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1834DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1835DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
1836DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
1837
1838DEFINE_ATTR_EVENT(xfs_attr_node_addname);
1839DEFINE_ATTR_EVENT(xfs_attr_node_get);
1840DEFINE_ATTR_EVENT(xfs_attr_node_lookup);
1841DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1842DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1843
1844DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1845DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1846
1847DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1848DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1849DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1850
1851#define DEFINE_DA_EVENT(name) \
1852DEFINE_EVENT(xfs_da_class, name, \
1853	TP_PROTO(struct xfs_da_args *args), \
1854	TP_ARGS(args))
1855DEFINE_DA_EVENT(xfs_da_split);
1856DEFINE_DA_EVENT(xfs_da_join);
1857DEFINE_DA_EVENT(xfs_da_link_before);
1858DEFINE_DA_EVENT(xfs_da_link_after);
1859DEFINE_DA_EVENT(xfs_da_unlink_back);
1860DEFINE_DA_EVENT(xfs_da_unlink_forward);
1861DEFINE_DA_EVENT(xfs_da_root_split);
1862DEFINE_DA_EVENT(xfs_da_root_join);
1863DEFINE_DA_EVENT(xfs_da_node_add);
1864DEFINE_DA_EVENT(xfs_da_node_create);
1865DEFINE_DA_EVENT(xfs_da_node_split);
1866DEFINE_DA_EVENT(xfs_da_node_remove);
1867DEFINE_DA_EVENT(xfs_da_node_rebalance);
1868DEFINE_DA_EVENT(xfs_da_node_unbalance);
1869DEFINE_DA_EVENT(xfs_da_node_toosmall);
1870DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1871DEFINE_DA_EVENT(xfs_da_grow_inode);
1872DEFINE_DA_EVENT(xfs_da_shrink_inode);
1873DEFINE_DA_EVENT(xfs_da_fixhashpath);
1874DEFINE_DA_EVENT(xfs_da_path_shift);
1875
1876DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1877	TP_PROTO(struct xfs_da_args *args, int idx),
1878	TP_ARGS(args, idx),
1879	TP_STRUCT__entry(
1880		__field(dev_t, dev)
1881		__field(xfs_ino_t, ino)
1882		__field(int, op_flags)
1883		__field(int, idx)
1884	),
1885	TP_fast_assign(
1886		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1887		__entry->ino = args->dp->i_ino;
1888		__entry->op_flags = args->op_flags;
1889		__entry->idx = idx;
1890	),
1891	TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1892		  MAJOR(__entry->dev), MINOR(__entry->dev),
1893		  __entry->ino,
1894		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1895		  __entry->idx)
1896)
1897
1898#define DEFINE_DIR2_SPACE_EVENT(name) \
1899DEFINE_EVENT(xfs_dir2_space_class, name, \
1900	TP_PROTO(struct xfs_da_args *args, int idx), \
1901	TP_ARGS(args, idx))
1902DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1903DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1904DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1905DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
1906
1907TRACE_EVENT(xfs_dir2_leafn_moveents,
1908	TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1909	TP_ARGS(args, src_idx, dst_idx, count),
1910	TP_STRUCT__entry(
1911		__field(dev_t, dev)
1912		__field(xfs_ino_t, ino)
1913		__field(int, op_flags)
1914		__field(int, src_idx)
1915		__field(int, dst_idx)
1916		__field(int, count)
1917	),
1918	TP_fast_assign(
1919		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1920		__entry->ino = args->dp->i_ino;
1921		__entry->op_flags = args->op_flags;
1922		__entry->src_idx = src_idx;
1923		__entry->dst_idx = dst_idx;
1924		__entry->count = count;
1925	),
1926	TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1927		  "src_idx %d dst_idx %d count %d",
1928		  MAJOR(__entry->dev), MINOR(__entry->dev),
1929		  __entry->ino,
1930		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1931		  __entry->src_idx,
1932		  __entry->dst_idx,
1933		  __entry->count)
1934);
1935
1936#define XFS_SWAPEXT_INODES \
1937	{ 0,	"target" }, \
1938	{ 1,	"temp" }
1939
1940#define XFS_INODE_FORMAT_STR \
1941	{ 0,	"invalid" }, \
1942	{ 1,	"local" }, \
1943	{ 2,	"extent" }, \
1944	{ 3,	"btree" }
1945
1946DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1947	TP_PROTO(struct xfs_inode *ip, int which),
1948	TP_ARGS(ip, which),
1949	TP_STRUCT__entry(
1950		__field(dev_t, dev)
1951		__field(int, which)
1952		__field(xfs_ino_t, ino)
1953		__field(int, format)
1954		__field(int, nex)
1955		__field(int, broot_size)
1956		__field(int, fork_off)
1957	),
1958	TP_fast_assign(
1959		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1960		__entry->which = which;
1961		__entry->ino = ip->i_ino;
1962		__entry->format = ip->i_d.di_format;
1963		__entry->nex = ip->i_d.di_nextents;
1964		__entry->broot_size = ip->i_df.if_broot_bytes;
1965		__entry->fork_off = XFS_IFORK_BOFF(ip);
1966	),
1967	TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
1968		  "broot size %d, fork offset %d",
1969		  MAJOR(__entry->dev), MINOR(__entry->dev),
1970		  __entry->ino,
1971		  __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1972		  __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1973		  __entry->nex,
1974		  __entry->broot_size,
1975		  __entry->fork_off)
1976)
1977
1978#define DEFINE_SWAPEXT_EVENT(name) \
1979DEFINE_EVENT(xfs_swap_extent_class, name, \
1980	TP_PROTO(struct xfs_inode *ip, int which), \
1981	TP_ARGS(ip, which))
1982
1983DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1984DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1985
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1986DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
1987	TP_PROTO(struct xlog *log, struct xlog_recover *trans,
1988		struct xlog_recover_item *item, int pass),
1989	TP_ARGS(log, trans, item, pass),
1990	TP_STRUCT__entry(
1991		__field(dev_t, dev)
1992		__field(unsigned long, item)
1993		__field(xlog_tid_t, tid)
 
1994		__field(int, type)
1995		__field(int, pass)
1996		__field(int, count)
1997		__field(int, total)
1998	),
1999	TP_fast_assign(
2000		__entry->dev = log->l_mp->m_super->s_dev;
2001		__entry->item = (unsigned long)item;
2002		__entry->tid = trans->r_log_tid;
 
2003		__entry->type = ITEM_TYPE(item);
2004		__entry->pass = pass;
2005		__entry->count = item->ri_cnt;
2006		__entry->total = item->ri_total;
2007	),
2008	TP_printk("dev %d:%d trans 0x%x, pass %d, item 0x%p, item type %s "
2009		  "item region count/total %d/%d",
2010		  MAJOR(__entry->dev), MINOR(__entry->dev),
2011		  __entry->tid,
 
2012		  __entry->pass,
2013		  (void *)__entry->item,
2014		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2015		  __entry->count,
2016		  __entry->total)
2017)
2018
2019#define DEFINE_LOG_RECOVER_ITEM(name) \
2020DEFINE_EVENT(xfs_log_recover_item_class, name, \
2021	TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
2022		struct xlog_recover_item *item, int pass), \
2023	TP_ARGS(log, trans, item, pass))
2024
2025DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2026DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2027DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2028DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2029DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2030
2031DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
2032	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
2033	TP_ARGS(log, buf_f),
2034	TP_STRUCT__entry(
2035		__field(dev_t, dev)
2036		__field(__int64_t, blkno)
2037		__field(unsigned short, len)
2038		__field(unsigned short, flags)
2039		__field(unsigned short, size)
2040		__field(unsigned int, map_size)
2041	),
2042	TP_fast_assign(
2043		__entry->dev = log->l_mp->m_super->s_dev;
2044		__entry->blkno = buf_f->blf_blkno;
2045		__entry->len = buf_f->blf_len;
2046		__entry->flags = buf_f->blf_flags;
2047		__entry->size = buf_f->blf_size;
2048		__entry->map_size = buf_f->blf_map_size;
2049	),
2050	TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2051			"map_size %d",
2052		  MAJOR(__entry->dev), MINOR(__entry->dev),
2053		  __entry->blkno,
2054		  __entry->len,
2055		  __entry->flags,
2056		  __entry->size,
2057		  __entry->map_size)
2058)
2059
2060#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2061DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
2062	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
2063	TP_ARGS(log, buf_f))
2064
2065DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2066DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2067DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2068DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2069DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
 
2070DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2071DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2072DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2073
2074DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
2075	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
2076	TP_ARGS(log, in_f),
2077	TP_STRUCT__entry(
2078		__field(dev_t, dev)
2079		__field(xfs_ino_t, ino)
2080		__field(unsigned short, size)
2081		__field(int, fields)
2082		__field(unsigned short, asize)
2083		__field(unsigned short, dsize)
2084		__field(__int64_t, blkno)
2085		__field(int, len)
2086		__field(int, boffset)
2087	),
2088	TP_fast_assign(
2089		__entry->dev = log->l_mp->m_super->s_dev;
2090		__entry->ino = in_f->ilf_ino;
2091		__entry->size = in_f->ilf_size;
2092		__entry->fields = in_f->ilf_fields;
2093		__entry->asize = in_f->ilf_asize;
2094		__entry->dsize = in_f->ilf_dsize;
2095		__entry->blkno = in_f->ilf_blkno;
2096		__entry->len = in_f->ilf_len;
2097		__entry->boffset = in_f->ilf_boffset;
2098	),
2099	TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2100			"dsize %d, blkno 0x%llx, len %d, boffset %d",
2101		  MAJOR(__entry->dev), MINOR(__entry->dev),
2102		  __entry->ino,
2103		  __entry->size,
2104		  __entry->fields,
2105		  __entry->asize,
2106		  __entry->dsize,
2107		  __entry->blkno,
2108		  __entry->len,
2109		  __entry->boffset)
2110)
2111#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2112DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
2113	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
2114	TP_ARGS(log, in_f))
2115
2116DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2117DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2118DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2119
2120DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2121	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2122	TP_ARGS(log, in_f),
2123	TP_STRUCT__entry(
2124		__field(dev_t, dev)
2125		__field(xfs_agnumber_t, agno)
2126		__field(xfs_agblock_t, agbno)
2127		__field(unsigned int, count)
2128		__field(unsigned int, isize)
2129		__field(xfs_agblock_t, length)
2130		__field(unsigned int, gen)
2131	),
2132	TP_fast_assign(
2133		__entry->dev = log->l_mp->m_super->s_dev;
2134		__entry->agno = be32_to_cpu(in_f->icl_ag);
2135		__entry->agbno = be32_to_cpu(in_f->icl_agbno);
2136		__entry->count = be32_to_cpu(in_f->icl_count);
2137		__entry->isize = be32_to_cpu(in_f->icl_isize);
2138		__entry->length = be32_to_cpu(in_f->icl_length);
2139		__entry->gen = be32_to_cpu(in_f->icl_gen);
2140	),
2141	TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2142		  "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2143		  __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2144		  __entry->length, __entry->gen)
 
 
 
 
2145)
2146#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2147DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2148	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2149	TP_ARGS(log, in_f))
2150
2151DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2152DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2153
2154DECLARE_EVENT_CLASS(xfs_discard_class,
2155	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2156		 xfs_agblock_t agbno, xfs_extlen_t len),
2157	TP_ARGS(mp, agno, agbno, len),
2158	TP_STRUCT__entry(
2159		__field(dev_t, dev)
 
2160		__field(xfs_agnumber_t, agno)
2161		__field(xfs_agblock_t, agbno)
2162		__field(xfs_extlen_t, len)
2163	),
2164	TP_fast_assign(
2165		__entry->dev = mp->m_super->s_dev;
2166		__entry->agno = agno;
 
2167		__entry->agbno = agbno;
2168		__entry->len = len;
2169	),
2170	TP_printk("dev %d:%d agno %u agbno %u len %u\n",
2171		  MAJOR(__entry->dev), MINOR(__entry->dev),
 
2172		  __entry->agno,
2173		  __entry->agbno,
2174		  __entry->len)
2175)
2176
2177#define DEFINE_DISCARD_EVENT(name) \
2178DEFINE_EVENT(xfs_discard_class, name, \
2179	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2180		 xfs_agblock_t agbno, xfs_extlen_t len), \
2181	TP_ARGS(mp, agno, agbno, len))
2182DEFINE_DISCARD_EVENT(xfs_discard_extent);
2183DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2184DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2185DEFINE_DISCARD_EVENT(xfs_discard_busy);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2186
2187#endif /* _TRACE_XFS_H */
2188
2189#undef TRACE_INCLUDE_PATH
2190#define TRACE_INCLUDE_PATH .
2191#define TRACE_INCLUDE_FILE xfs_trace
2192#include <trace/define_trace.h>
v6.13.7
   1// SPDX-License-Identifier: GPL-2.0
   2/*
   3 * Copyright (c) 2009, Christoph Hellwig
   4 * All Rights Reserved.
   5 *
   6 * NOTE: none of these tracepoints shall be considered a stable kernel ABI
   7 * as they can change at any time.
 
   8 *
   9 * Current conventions for printing numbers measuring specific units:
 
 
 
  10 *
  11 * agno: allocation group number
  12 *
  13 * agino: per-AG inode number
  14 * ino: filesystem inode number
  15 *
  16 * agbno: per-AG block number in fs blocks
  17 * startblock: physical block number for file mappings.  This is either a
  18 *             segmented fsblock for data device mappings, or a rfsblock
  19 *             for realtime device mappings
  20 * fsbcount: number of blocks in an extent, in fs blocks
  21 *
  22 * daddr: physical block number in 512b blocks
  23 * bbcount: number of blocks in a physical extent, in 512b blocks
  24 *
  25 * rtx: physical rt extent number for extent mappings
  26 * rtxcount: number of rt extents in an extent mapping
  27 *
  28 * owner: reverse-mapping owner, usually inodes
  29 *
  30 * fileoff: file offset, in fs blocks
  31 * pos: file offset, in bytes
  32 * bytecount: number of bytes
  33 *
  34 * dablk: directory or xattr block offset, in filesystem blocks
  35 *
  36 * disize: ondisk file size, in bytes
  37 * isize: incore file size, in bytes
  38 *
  39 * forkoff: inode fork offset, in bytes
  40 *
  41 * ireccount: number of inode records
  42 *
  43 * Numbers describing space allocations (blocks, extents, inodes) should be
  44 * formatted in hexadecimal.
  45 */
  46#undef TRACE_SYSTEM
  47#define TRACE_SYSTEM xfs
  48
  49#if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
  50#define _TRACE_XFS_H
  51
  52#include <linux/tracepoint.h>
  53
  54struct xfs_agf;
  55struct xfs_alloc_arg;
  56struct xfs_attr_list_context;
  57struct xfs_buf_log_item;
  58struct xfs_da_args;
  59struct xfs_da_node_entry;
  60struct xfs_dquot;
  61struct xfs_log_item;
  62struct xlog;
  63struct xlog_ticket;
  64struct xlog_recover;
  65struct xlog_recover_item;
  66struct xlog_rec_header;
  67struct xlog_in_core;
  68struct xfs_buf_log_format;
  69struct xfs_inode_log_format;
  70struct xfs_bmbt_irec;
  71struct xfs_btree_cur;
  72struct xfs_defer_op_type;
  73struct xfs_refcount_irec;
  74struct xfs_fsmap;
  75struct xfs_fsmap_irec;
  76struct xfs_group;
  77struct xfs_rmap_irec;
  78struct xfs_icreate_log;
  79struct xfs_iunlink_item;
  80struct xfs_owner_info;
  81struct xfs_trans_res;
  82struct xfs_inobt_rec_incore;
  83union xfs_btree_ptr;
  84struct xfs_dqtrx;
  85struct xfs_icwalk;
  86struct xfs_perag;
  87struct xfbtree;
  88struct xfs_btree_ops;
  89struct xfs_bmap_intent;
  90struct xfs_exchmaps_intent;
  91struct xfs_exchmaps_req;
  92struct xfs_exchrange;
  93struct xfs_getparents;
  94struct xfs_parent_irec;
  95struct xfs_attrlist_cursor_kern;
  96struct xfs_extent_free_item;
  97struct xfs_rmap_intent;
  98struct xfs_refcount_intent;
  99struct xfs_metadir_update;
 100struct xfs_rtgroup;
 101
 102#define XFS_ATTR_FILTER_FLAGS \
 103	{ XFS_ATTR_ROOT,	"ROOT" }, \
 104	{ XFS_ATTR_SECURE,	"SECURE" }, \
 105	{ XFS_ATTR_INCOMPLETE,	"INCOMPLETE" }, \
 106	{ XFS_ATTR_PARENT,	"PARENT" }
 107
 108DECLARE_EVENT_CLASS(xfs_attr_list_class,
 109	TP_PROTO(struct xfs_attr_list_context *ctx),
 110	TP_ARGS(ctx),
 111	TP_STRUCT__entry(
 112		__field(dev_t, dev)
 113		__field(xfs_ino_t, ino)
 114		__field(u32, hashval)
 115		__field(u32, blkno)
 116		__field(u32, offset)
 117		__field(void *, buffer)
 118		__field(int, bufsize)
 119		__field(int, count)
 120		__field(int, firstu)
 121		__field(int, dupcnt)
 122		__field(unsigned int, attr_filter)
 123	),
 124	TP_fast_assign(
 125		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
 126		__entry->ino = ctx->dp->i_ino;
 127		__entry->hashval = ctx->cursor.hashval;
 128		__entry->blkno = ctx->cursor.blkno;
 129		__entry->offset = ctx->cursor.offset;
 130		__entry->buffer = ctx->buffer;
 131		__entry->bufsize = ctx->bufsize;
 132		__entry->count = ctx->count;
 133		__entry->firstu = ctx->firstu;
 134		__entry->attr_filter = ctx->attr_filter;
 135	),
 136	TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
 137		  "buffer %p size %u count %u firstu %u filter %s",
 138		  MAJOR(__entry->dev), MINOR(__entry->dev),
 139		   __entry->ino,
 140		   __entry->hashval,
 141		   __entry->blkno,
 142		   __entry->offset,
 143		   __entry->dupcnt,
 144		   __entry->buffer,
 145		   __entry->bufsize,
 146		   __entry->count,
 147		   __entry->firstu,
 148		   __print_flags(__entry->attr_filter, "|",
 149				 XFS_ATTR_FILTER_FLAGS)
 150	)
 151)
 152
 153#define DEFINE_ATTR_LIST_EVENT(name) \
 154DEFINE_EVENT(xfs_attr_list_class, name, \
 155	TP_PROTO(struct xfs_attr_list_context *ctx), \
 156	TP_ARGS(ctx))
 157DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
 158DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
 159DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
 160DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
 161DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
 162DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
 163DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
 164DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
 165DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
 166DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
 167
 168TRACE_EVENT(xlog_intent_recovery_failed,
 169	TP_PROTO(struct xfs_mount *mp, const struct xfs_defer_op_type *ops,
 170		 int error),
 171	TP_ARGS(mp, ops, error),
 172	TP_STRUCT__entry(
 173		__field(dev_t, dev)
 174		__string(name, ops->name)
 175		__field(int, error)
 176	),
 177	TP_fast_assign(
 178		__entry->dev = mp->m_super->s_dev;
 179		__assign_str(name);
 180		__entry->error = error;
 181	),
 182	TP_printk("dev %d:%d optype %s error %d",
 183		  MAJOR(__entry->dev), MINOR(__entry->dev),
 184		  __get_str(name),
 185		  __entry->error)
 186);
 187
 188DECLARE_EVENT_CLASS(xfs_perag_class,
 189	TP_PROTO(const struct xfs_perag *pag, unsigned long caller_ip),
 190	TP_ARGS(pag, caller_ip),
 
 191	TP_STRUCT__entry(
 192		__field(dev_t, dev)
 193		__field(xfs_agnumber_t, agno)
 194		__field(int, refcount)
 195		__field(int, active_refcount)
 196		__field(unsigned long, caller_ip)
 197	),
 198	TP_fast_assign(
 199		__entry->dev = pag_mount(pag)->m_super->s_dev;
 200		__entry->agno = pag_agno(pag);
 201		__entry->refcount = atomic_read(&pag->pag_group.xg_ref);
 202		__entry->active_refcount =
 203			atomic_read(&pag->pag_group.xg_active_ref);
 204		__entry->caller_ip = caller_ip;
 205	),
 206	TP_printk("dev %d:%d agno 0x%x passive refs %d active refs %d caller %pS",
 207		  MAJOR(__entry->dev), MINOR(__entry->dev),
 208		  __entry->agno,
 209		  __entry->refcount,
 210		  __entry->active_refcount,
 211		  (char *)__entry->caller_ip)
 212);
 213
 214#define DEFINE_PERAG_REF_EVENT(name)	\
 215DEFINE_EVENT(xfs_perag_class, name,	\
 216	TP_PROTO(const struct xfs_perag *pag, unsigned long caller_ip), \
 217	TP_ARGS(pag, caller_ip))
 218DEFINE_PERAG_REF_EVENT(xfs_perag_set_inode_tag);
 219DEFINE_PERAG_REF_EVENT(xfs_perag_clear_inode_tag);
 220DEFINE_PERAG_REF_EVENT(xfs_reclaim_inodes_count);
 
 
 
 
 
 221
 222TRACE_DEFINE_ENUM(XG_TYPE_AG);
 223TRACE_DEFINE_ENUM(XG_TYPE_RTG);
 224
 225DECLARE_EVENT_CLASS(xfs_group_class,
 226	TP_PROTO(struct xfs_group *xg, unsigned long caller_ip),
 227	TP_ARGS(xg, caller_ip),
 228	TP_STRUCT__entry(
 229		__field(dev_t, dev)
 230		__field(enum xfs_group_type, type)
 231		__field(xfs_agnumber_t, agno)
 232		__field(int, refcount)
 233		__field(int, active_refcount)
 234		__field(unsigned long, caller_ip)
 235	),
 236	TP_fast_assign(
 237		__entry->dev = xg->xg_mount->m_super->s_dev;
 238		__entry->type = xg->xg_type;
 239		__entry->agno = xg->xg_gno;
 240		__entry->refcount = atomic_read(&xg->xg_ref);
 241		__entry->active_refcount = atomic_read(&xg->xg_active_ref);
 242		__entry->caller_ip = caller_ip;
 243	),
 244	TP_printk("dev %d:%d %sno 0x%x passive refs %d active refs %d caller %pS",
 245		  MAJOR(__entry->dev), MINOR(__entry->dev),
 246		  __print_symbolic(__entry->type, XG_TYPE_STRINGS),
 247		  __entry->agno,
 248		  __entry->refcount,
 249		  __entry->active_refcount,
 250		  (char *)__entry->caller_ip)
 251);
 252
 253#define DEFINE_GROUP_REF_EVENT(name)	\
 254DEFINE_EVENT(xfs_group_class, name,	\
 255	TP_PROTO(struct xfs_group *xg, unsigned long caller_ip), \
 256	TP_ARGS(xg, caller_ip))
 257DEFINE_GROUP_REF_EVENT(xfs_group_get);
 258DEFINE_GROUP_REF_EVENT(xfs_group_hold);
 259DEFINE_GROUP_REF_EVENT(xfs_group_put);
 260DEFINE_GROUP_REF_EVENT(xfs_group_grab);
 261DEFINE_GROUP_REF_EVENT(xfs_group_grab_next_tag);
 262DEFINE_GROUP_REF_EVENT(xfs_group_rele);
 263
 264TRACE_EVENT(xfs_inodegc_worker,
 265	TP_PROTO(struct xfs_mount *mp, unsigned int shrinker_hits),
 266	TP_ARGS(mp, shrinker_hits),
 267	TP_STRUCT__entry(
 268		__field(dev_t, dev)
 269		__field(unsigned int, shrinker_hits)
 270	),
 271	TP_fast_assign(
 272		__entry->dev = mp->m_super->s_dev;
 273		__entry->shrinker_hits = shrinker_hits;
 274	),
 275	TP_printk("dev %d:%d shrinker_hits %u",
 276		  MAJOR(__entry->dev), MINOR(__entry->dev),
 277		  __entry->shrinker_hits)
 278);
 279
 280DECLARE_EVENT_CLASS(xfs_fs_class,
 281	TP_PROTO(struct xfs_mount *mp, void *caller_ip),
 282	TP_ARGS(mp, caller_ip),
 283	TP_STRUCT__entry(
 284		__field(dev_t, dev)
 285		__field(unsigned long long, mflags)
 286		__field(unsigned long, opstate)
 287		__field(unsigned long, sbflags)
 288		__field(void *, caller_ip)
 289	),
 290	TP_fast_assign(
 291		if (mp) {
 292			__entry->dev = mp->m_super->s_dev;
 293			__entry->mflags = mp->m_features;
 294			__entry->opstate = mp->m_opstate;
 295			__entry->sbflags = mp->m_super->s_flags;
 296		}
 297		__entry->caller_ip = caller_ip;
 298	),
 299	TP_printk("dev %d:%d m_features 0x%llx opstate (%s) s_flags 0x%lx caller %pS",
 300		  MAJOR(__entry->dev), MINOR(__entry->dev),
 301		  __entry->mflags,
 302		  __print_flags(__entry->opstate, "|", XFS_OPSTATE_STRINGS),
 303		  __entry->sbflags,
 304		  __entry->caller_ip)
 305);
 306
 307#define DEFINE_FS_EVENT(name)	\
 308DEFINE_EVENT(xfs_fs_class, name,					\
 309	TP_PROTO(struct xfs_mount *mp, void *caller_ip), \
 310	TP_ARGS(mp, caller_ip))
 311DEFINE_FS_EVENT(xfs_inodegc_flush);
 312DEFINE_FS_EVENT(xfs_inodegc_push);
 313DEFINE_FS_EVENT(xfs_inodegc_start);
 314DEFINE_FS_EVENT(xfs_inodegc_stop);
 315DEFINE_FS_EVENT(xfs_inodegc_queue);
 316DEFINE_FS_EVENT(xfs_inodegc_throttle);
 317DEFINE_FS_EVENT(xfs_fs_sync_fs);
 318DEFINE_FS_EVENT(xfs_blockgc_start);
 319DEFINE_FS_EVENT(xfs_blockgc_stop);
 320DEFINE_FS_EVENT(xfs_blockgc_worker);
 321DEFINE_FS_EVENT(xfs_blockgc_flush_all);
 322
 323TRACE_EVENT(xfs_inodegc_shrinker_scan,
 324	TP_PROTO(struct xfs_mount *mp, struct shrink_control *sc,
 325		 void *caller_ip),
 326	TP_ARGS(mp, sc, caller_ip),
 327	TP_STRUCT__entry(
 328		__field(dev_t, dev)
 329		__field(unsigned long, nr_to_scan)
 330		__field(void *, caller_ip)
 331	),
 332	TP_fast_assign(
 333		__entry->dev = mp->m_super->s_dev;
 334		__entry->nr_to_scan = sc->nr_to_scan;
 335		__entry->caller_ip = caller_ip;
 336	),
 337	TP_printk("dev %d:%d nr_to_scan %lu caller %pS",
 338		  MAJOR(__entry->dev), MINOR(__entry->dev),
 339		  __entry->nr_to_scan,
 340		  __entry->caller_ip)
 341);
 342
 343DECLARE_EVENT_CLASS(xfs_ag_class,
 344	TP_PROTO(const struct xfs_perag *pag),
 345	TP_ARGS(pag),
 346	TP_STRUCT__entry(
 347		__field(dev_t, dev)
 348		__field(xfs_agnumber_t, agno)
 349	),
 350	TP_fast_assign(
 351		__entry->dev = pag_mount(pag)->m_super->s_dev;
 352		__entry->agno = pag_agno(pag);
 353	),
 354	TP_printk("dev %d:%d agno 0x%x",
 355		  MAJOR(__entry->dev), MINOR(__entry->dev),
 356		  __entry->agno)
 357);
 358#define DEFINE_AG_EVENT(name)	\
 359DEFINE_EVENT(xfs_ag_class, name,	\
 360	TP_PROTO(const struct xfs_perag *pag),	\
 361	TP_ARGS(pag))
 362
 363DEFINE_AG_EVENT(xfs_read_agf);
 364DEFINE_AG_EVENT(xfs_alloc_read_agf);
 365DEFINE_AG_EVENT(xfs_read_agi);
 366DEFINE_AG_EVENT(xfs_ialloc_read_agi);
 367
 368TRACE_EVENT(xfs_attr_list_node_descend,
 369	TP_PROTO(struct xfs_attr_list_context *ctx,
 370		 struct xfs_da_node_entry *btree),
 371	TP_ARGS(ctx, btree),
 372	TP_STRUCT__entry(
 373		__field(dev_t, dev)
 374		__field(xfs_ino_t, ino)
 375		__field(u32, hashval)
 376		__field(u32, blkno)
 377		__field(u32, offset)
 378		__field(void *, buffer)
 379		__field(int, bufsize)
 380		__field(int, count)
 381		__field(int, firstu)
 382		__field(int, dupcnt)
 383		__field(unsigned int, attr_filter)
 384		__field(u32, bt_hashval)
 385		__field(u32, bt_before)
 386	),
 387	TP_fast_assign(
 388		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
 389		__entry->ino = ctx->dp->i_ino;
 390		__entry->hashval = ctx->cursor.hashval;
 391		__entry->blkno = ctx->cursor.blkno;
 392		__entry->offset = ctx->cursor.offset;
 393		__entry->buffer = ctx->buffer;
 394		__entry->bufsize = ctx->bufsize;
 395		__entry->count = ctx->count;
 396		__entry->firstu = ctx->firstu;
 397		__entry->attr_filter = ctx->attr_filter;
 398		__entry->bt_hashval = be32_to_cpu(btree->hashval);
 399		__entry->bt_before = be32_to_cpu(btree->before);
 400	),
 401	TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
 402		  "buffer %p size %u count %u firstu %u filter %s "
 403		  "node hashval %u, node before %u",
 404		  MAJOR(__entry->dev), MINOR(__entry->dev),
 405		   __entry->ino,
 406		   __entry->hashval,
 407		   __entry->blkno,
 408		   __entry->offset,
 409		   __entry->dupcnt,
 410		   __entry->buffer,
 411		   __entry->bufsize,
 412		   __entry->count,
 413		   __entry->firstu,
 414		   __print_flags(__entry->attr_filter, "|",
 415				 XFS_ATTR_FILTER_FLAGS),
 416		   __entry->bt_hashval,
 417		   __entry->bt_before)
 418);
 419
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 420DECLARE_EVENT_CLASS(xfs_bmap_class,
 421	TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state,
 422		 unsigned long caller_ip),
 423	TP_ARGS(ip, cur, state, caller_ip),
 424	TP_STRUCT__entry(
 425		__field(dev_t, dev)
 426		__field(xfs_ino_t, ino)
 427		__field(void *, leaf)
 428		__field(int, pos)
 429		__field(xfs_fileoff_t, startoff)
 430		__field(xfs_fsblock_t, startblock)
 431		__field(xfs_filblks_t, blockcount)
 432		__field(xfs_exntst_t, state)
 433		__field(int, bmap_state)
 434		__field(unsigned long, caller_ip)
 435	),
 436	TP_fast_assign(
 437		struct xfs_ifork	*ifp;
 
 438		struct xfs_bmbt_irec	r;
 439
 440		ifp = xfs_iext_state_to_fork(ip, state);
 441		xfs_iext_get_extent(ifp, cur, &r);
 442		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 443		__entry->ino = ip->i_ino;
 444		__entry->leaf = cur->leaf;
 445		__entry->pos = cur->pos;
 446		__entry->startoff = r.br_startoff;
 447		__entry->startblock = r.br_startblock;
 448		__entry->blockcount = r.br_blockcount;
 449		__entry->state = r.br_state;
 450		__entry->bmap_state = state;
 451		__entry->caller_ip = caller_ip;
 452	),
 453	TP_printk("dev %d:%d ino 0x%llx state %s cur %p/%d "
 454		  "fileoff 0x%llx startblock 0x%llx fsbcount 0x%llx flag %d caller %pS",
 455		  MAJOR(__entry->dev), MINOR(__entry->dev),
 456		  __entry->ino,
 457		  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
 458		  __entry->leaf,
 459		  __entry->pos,
 460		  __entry->startoff,
 461		  (int64_t)__entry->startblock,
 462		  __entry->blockcount,
 463		  __entry->state,
 464		  (char *)__entry->caller_ip)
 465)
 466
 467#define DEFINE_BMAP_EVENT(name) \
 468DEFINE_EVENT(xfs_bmap_class, name, \
 469	TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state, \
 470		 unsigned long caller_ip), \
 471	TP_ARGS(ip, cur, state, caller_ip))
 472DEFINE_BMAP_EVENT(xfs_iext_insert);
 473DEFINE_BMAP_EVENT(xfs_iext_remove);
 474DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
 475DEFINE_BMAP_EVENT(xfs_bmap_post_update);
 476DEFINE_BMAP_EVENT(xfs_read_extent);
 477DEFINE_BMAP_EVENT(xfs_write_extent);
 478
 479DECLARE_EVENT_CLASS(xfs_buf_class,
 480	TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
 481	TP_ARGS(bp, caller_ip),
 482	TP_STRUCT__entry(
 483		__field(dev_t, dev)
 484		__field(xfs_daddr_t, bno)
 485		__field(int, nblks)
 486		__field(int, hold)
 487		__field(int, pincount)
 488		__field(unsigned, lockval)
 489		__field(unsigned, flags)
 490		__field(unsigned long, caller_ip)
 491		__field(const void *, buf_ops)
 492	),
 493	TP_fast_assign(
 494		__entry->dev = bp->b_target->bt_dev;
 495		__entry->bno = xfs_buf_daddr(bp);
 496		__entry->nblks = bp->b_length;
 497		__entry->hold = atomic_read(&bp->b_hold);
 498		__entry->pincount = atomic_read(&bp->b_pin_count);
 499		__entry->lockval = bp->b_sema.count;
 500		__entry->flags = bp->b_flags;
 501		__entry->caller_ip = caller_ip;
 502		__entry->buf_ops = bp->b_ops;
 503	),
 504	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
 505		  "lock %d flags %s bufops %pS caller %pS",
 506		  MAJOR(__entry->dev), MINOR(__entry->dev),
 507		  (unsigned long long)__entry->bno,
 508		  __entry->nblks,
 509		  __entry->hold,
 510		  __entry->pincount,
 511		  __entry->lockval,
 512		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
 513		  __entry->buf_ops,
 514		  (void *)__entry->caller_ip)
 515)
 516
 517#define DEFINE_BUF_EVENT(name) \
 518DEFINE_EVENT(xfs_buf_class, name, \
 519	TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
 520	TP_ARGS(bp, caller_ip))
 521DEFINE_BUF_EVENT(xfs_buf_init);
 522DEFINE_BUF_EVENT(xfs_buf_free);
 523DEFINE_BUF_EVENT(xfs_buf_hold);
 524DEFINE_BUF_EVENT(xfs_buf_rele);
 525DEFINE_BUF_EVENT(xfs_buf_iodone);
 526DEFINE_BUF_EVENT(xfs_buf_submit);
 
 
 527DEFINE_BUF_EVENT(xfs_buf_lock);
 528DEFINE_BUF_EVENT(xfs_buf_lock_done);
 529DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
 530DEFINE_BUF_EVENT(xfs_buf_trylock);
 531DEFINE_BUF_EVENT(xfs_buf_unlock);
 532DEFINE_BUF_EVENT(xfs_buf_iowait);
 533DEFINE_BUF_EVENT(xfs_buf_iowait_done);
 534DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
 535DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
 536DEFINE_BUF_EVENT(xfs_buf_delwri_split);
 537DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf);
 538DEFINE_BUF_EVENT(xfs_buf_get_uncached);
 
 539DEFINE_BUF_EVENT(xfs_buf_item_relse);
 540DEFINE_BUF_EVENT(xfs_buf_iodone_async);
 
 541DEFINE_BUF_EVENT(xfs_buf_error_relse);
 542DEFINE_BUF_EVENT(xfs_buf_drain_buftarg);
 
 543DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
 544
 545/* not really buffer traces, but the buf provides useful information */
 546DEFINE_BUF_EVENT(xfs_btree_corrupt);
 
 547DEFINE_BUF_EVENT(xfs_reset_dqcounts);
 
 548
 549/* pass flags explicitly */
 550DECLARE_EVENT_CLASS(xfs_buf_flags_class,
 551	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
 552	TP_ARGS(bp, flags, caller_ip),
 553	TP_STRUCT__entry(
 554		__field(dev_t, dev)
 555		__field(xfs_daddr_t, bno)
 556		__field(unsigned int, length)
 557		__field(int, hold)
 558		__field(int, pincount)
 559		__field(unsigned, lockval)
 560		__field(unsigned, flags)
 561		__field(unsigned long, caller_ip)
 562	),
 563	TP_fast_assign(
 564		__entry->dev = bp->b_target->bt_dev;
 565		__entry->bno = xfs_buf_daddr(bp);
 566		__entry->length = bp->b_length;
 567		__entry->flags = flags;
 568		__entry->hold = atomic_read(&bp->b_hold);
 569		__entry->pincount = atomic_read(&bp->b_pin_count);
 570		__entry->lockval = bp->b_sema.count;
 571		__entry->caller_ip = caller_ip;
 572	),
 573	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
 574		  "lock %d flags %s caller %pS",
 575		  MAJOR(__entry->dev), MINOR(__entry->dev),
 576		  (unsigned long long)__entry->bno,
 577		  __entry->length,
 578		  __entry->hold,
 579		  __entry->pincount,
 580		  __entry->lockval,
 581		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
 582		  (void *)__entry->caller_ip)
 583)
 584
 585#define DEFINE_BUF_FLAGS_EVENT(name) \
 586DEFINE_EVENT(xfs_buf_flags_class, name, \
 587	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
 588	TP_ARGS(bp, flags, caller_ip))
 589DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
 590DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
 591DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
 592
 593TRACE_EVENT(xfs_buf_ioerror,
 594	TP_PROTO(struct xfs_buf *bp, int error, xfs_failaddr_t caller_ip),
 595	TP_ARGS(bp, error, caller_ip),
 596	TP_STRUCT__entry(
 597		__field(dev_t, dev)
 598		__field(xfs_daddr_t, bno)
 599		__field(unsigned int, length)
 600		__field(unsigned, flags)
 601		__field(int, hold)
 602		__field(int, pincount)
 603		__field(unsigned, lockval)
 604		__field(int, error)
 605		__field(xfs_failaddr_t, caller_ip)
 606	),
 607	TP_fast_assign(
 608		__entry->dev = bp->b_target->bt_dev;
 609		__entry->bno = xfs_buf_daddr(bp);
 610		__entry->length = bp->b_length;
 611		__entry->hold = atomic_read(&bp->b_hold);
 612		__entry->pincount = atomic_read(&bp->b_pin_count);
 613		__entry->lockval = bp->b_sema.count;
 614		__entry->error = error;
 615		__entry->flags = bp->b_flags;
 616		__entry->caller_ip = caller_ip;
 617	),
 618	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
 619		  "lock %d error %d flags %s caller %pS",
 620		  MAJOR(__entry->dev), MINOR(__entry->dev),
 621		  (unsigned long long)__entry->bno,
 622		  __entry->length,
 623		  __entry->hold,
 624		  __entry->pincount,
 625		  __entry->lockval,
 626		  __entry->error,
 627		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
 628		  (void *)__entry->caller_ip)
 629);
 630
 631DECLARE_EVENT_CLASS(xfs_buf_item_class,
 632	TP_PROTO(struct xfs_buf_log_item *bip),
 633	TP_ARGS(bip),
 634	TP_STRUCT__entry(
 635		__field(dev_t, dev)
 636		__field(xfs_daddr_t, buf_bno)
 637		__field(unsigned int, buf_len)
 638		__field(int, buf_hold)
 639		__field(int, buf_pincount)
 640		__field(int, buf_lockval)
 641		__field(unsigned, buf_flags)
 642		__field(unsigned, bli_recur)
 643		__field(int, bli_refcount)
 644		__field(unsigned, bli_flags)
 645		__field(unsigned long, li_flags)
 
 646	),
 647	TP_fast_assign(
 648		__entry->dev = bip->bli_buf->b_target->bt_dev;
 649		__entry->bli_flags = bip->bli_flags;
 650		__entry->bli_recur = bip->bli_recur;
 651		__entry->bli_refcount = atomic_read(&bip->bli_refcount);
 652		__entry->buf_bno = xfs_buf_daddr(bip->bli_buf);
 653		__entry->buf_len = bip->bli_buf->b_length;
 654		__entry->buf_flags = bip->bli_buf->b_flags;
 655		__entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
 656		__entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
 657		__entry->buf_lockval = bip->bli_buf->b_sema.count;
 
 658		__entry->li_flags = bip->bli_item.li_flags;
 659	),
 660	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
 661		  "lock %d flags %s recur %d refcount %d bliflags %s "
 662		  "liflags %s",
 663		  MAJOR(__entry->dev), MINOR(__entry->dev),
 664		  (unsigned long long)__entry->buf_bno,
 665		  __entry->buf_len,
 666		  __entry->buf_hold,
 667		  __entry->buf_pincount,
 668		  __entry->buf_lockval,
 669		  __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
 670		  __entry->bli_recur,
 671		  __entry->bli_refcount,
 672		  __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
 
 673		  __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
 674)
 675
 676#define DEFINE_BUF_ITEM_EVENT(name) \
 677DEFINE_EVENT(xfs_buf_item_class, name, \
 678	TP_PROTO(struct xfs_buf_log_item *bip), \
 679	TP_ARGS(bip))
 680DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
 681DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
 682DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
 683DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
 
 684DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
 685DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
 686DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
 687DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
 688DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
 689DEFINE_BUF_ITEM_EVENT(xfs_buf_item_release);
 
 690DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
 691DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
 692DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
 693DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
 694DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
 695DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
 696DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
 697DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
 698DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
 699DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
 700DEFINE_BUF_ITEM_EVENT(xfs_trans_bdetach);
 701DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
 702DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
 703DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
 704DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
 
 705
 706DECLARE_EVENT_CLASS(xfs_filestream_class,
 707	TP_PROTO(const struct xfs_perag *pag, xfs_ino_t ino),
 708	TP_ARGS(pag, ino),
 709	TP_STRUCT__entry(
 710		__field(dev_t, dev)
 711		__field(xfs_ino_t, ino)
 712		__field(xfs_agnumber_t, agno)
 713		__field(int, streams)
 714	),
 715	TP_fast_assign(
 716		__entry->dev = pag_mount(pag)->m_super->s_dev;
 717		__entry->ino = ino;
 718		__entry->agno = pag_agno(pag);
 719		__entry->streams = atomic_read(&pag->pagf_fstrms);
 720	),
 721	TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d",
 722		  MAJOR(__entry->dev), MINOR(__entry->dev),
 723		  __entry->ino,
 724		  __entry->agno,
 725		  __entry->streams)
 726)
 727#define DEFINE_FILESTREAM_EVENT(name) \
 728DEFINE_EVENT(xfs_filestream_class, name, \
 729	TP_PROTO(const struct xfs_perag *pag, xfs_ino_t ino), \
 730	TP_ARGS(pag, ino))
 731DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
 732DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
 733DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
 734
 735TRACE_EVENT(xfs_filestream_pick,
 736	TP_PROTO(const struct xfs_perag *pag, xfs_ino_t ino),
 737	TP_ARGS(pag, ino),
 
 738	TP_STRUCT__entry(
 739		__field(dev_t, dev)
 740		__field(xfs_ino_t, ino)
 741		__field(xfs_agnumber_t, agno)
 742		__field(int, streams)
 743		__field(xfs_extlen_t, free)
 
 744	),
 745	TP_fast_assign(
 746		__entry->dev = pag_mount(pag)->m_super->s_dev;
 747		__entry->ino = ino;
 748		__entry->agno = pag_agno(pag);
 749		__entry->streams = atomic_read(&pag->pagf_fstrms);
 750		__entry->free = pag->pagf_freeblks;
 
 751	),
 752	TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d free %d",
 753		  MAJOR(__entry->dev), MINOR(__entry->dev),
 754		  __entry->ino,
 755		  __entry->agno,
 756		  __entry->streams,
 757		  __entry->free)
 
 758);
 759
 760DECLARE_EVENT_CLASS(xfs_lock_class,
 761	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
 762		 unsigned long caller_ip),
 763	TP_ARGS(ip,  lock_flags, caller_ip),
 764	TP_STRUCT__entry(
 765		__field(dev_t, dev)
 766		__field(xfs_ino_t, ino)
 767		__field(int, lock_flags)
 768		__field(unsigned long, caller_ip)
 769	),
 770	TP_fast_assign(
 771		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 772		__entry->ino = ip->i_ino;
 773		__entry->lock_flags = lock_flags;
 774		__entry->caller_ip = caller_ip;
 775	),
 776	TP_printk("dev %d:%d ino 0x%llx flags %s caller %pS",
 777		  MAJOR(__entry->dev), MINOR(__entry->dev),
 778		  __entry->ino,
 779		  __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
 780		  (void *)__entry->caller_ip)
 781)
 782
 783#define DEFINE_LOCK_EVENT(name) \
 784DEFINE_EVENT(xfs_lock_class, name, \
 785	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
 786		 unsigned long caller_ip), \
 787	TP_ARGS(ip,  lock_flags, caller_ip))
 788DEFINE_LOCK_EVENT(xfs_ilock);
 789DEFINE_LOCK_EVENT(xfs_ilock_nowait);
 790DEFINE_LOCK_EVENT(xfs_ilock_demote);
 791DEFINE_LOCK_EVENT(xfs_iunlock);
 792
 793DECLARE_EVENT_CLASS(xfs_inode_class,
 794	TP_PROTO(struct xfs_inode *ip),
 795	TP_ARGS(ip),
 796	TP_STRUCT__entry(
 797		__field(dev_t, dev)
 798		__field(xfs_ino_t, ino)
 799		__field(unsigned long, iflags)
 800	),
 801	TP_fast_assign(
 802		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 803		__entry->ino = ip->i_ino;
 804		__entry->iflags = ip->i_flags;
 805	),
 806	TP_printk("dev %d:%d ino 0x%llx iflags 0x%lx",
 807		  MAJOR(__entry->dev), MINOR(__entry->dev),
 808		  __entry->ino,
 809		  __entry->iflags)
 810)
 811
 812#define DEFINE_INODE_EVENT(name) \
 813DEFINE_EVENT(xfs_inode_class, name, \
 814	TP_PROTO(struct xfs_inode *ip), \
 815	TP_ARGS(ip))
 816DEFINE_INODE_EVENT(xfs_iget_skip);
 817DEFINE_INODE_EVENT(xfs_iget_recycle);
 818DEFINE_INODE_EVENT(xfs_iget_recycle_fail);
 819DEFINE_INODE_EVENT(xfs_iget_hit);
 820DEFINE_INODE_EVENT(xfs_iget_miss);
 821
 822DEFINE_INODE_EVENT(xfs_getattr);
 823DEFINE_INODE_EVENT(xfs_setattr);
 824DEFINE_INODE_EVENT(xfs_readlink);
 825DEFINE_INODE_EVENT(xfs_inactive_symlink);
 826DEFINE_INODE_EVENT(xfs_alloc_file_space);
 827DEFINE_INODE_EVENT(xfs_free_file_space);
 828DEFINE_INODE_EVENT(xfs_zero_file_space);
 829DEFINE_INODE_EVENT(xfs_collapse_file_space);
 830DEFINE_INODE_EVENT(xfs_insert_file_space);
 831DEFINE_INODE_EVENT(xfs_readdir);
 832#ifdef CONFIG_XFS_POSIX_ACL
 833DEFINE_INODE_EVENT(xfs_get_acl);
 834#endif
 835DEFINE_INODE_EVENT(xfs_vm_bmap);
 836DEFINE_INODE_EVENT(xfs_file_ioctl);
 837DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
 838DEFINE_INODE_EVENT(xfs_ioctl_setattr);
 839DEFINE_INODE_EVENT(xfs_dir_fsync);
 840DEFINE_INODE_EVENT(xfs_file_fsync);
 841DEFINE_INODE_EVENT(xfs_destroy_inode);
 
 842DEFINE_INODE_EVENT(xfs_update_time);
 843
 844DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
 845DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
 846
 847DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
 848DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
 849DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
 850DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
 851DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
 852DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
 853DEFINE_INODE_EVENT(xfs_inode_set_reclaimable);
 854DEFINE_INODE_EVENT(xfs_inode_reclaiming);
 855DEFINE_INODE_EVENT(xfs_inode_set_need_inactive);
 856DEFINE_INODE_EVENT(xfs_inode_inactivating);
 857
 858/*
 859 * ftrace's __print_symbolic requires that all enum values be wrapped in the
 860 * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace
 861 * ring buffer.  Somehow this was only worth mentioning in the ftrace sample
 862 * code.
 863 */
 864TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_SHARED);
 865TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_COW);
 866
 867DECLARE_EVENT_CLASS(xfs_fault_class,
 868	TP_PROTO(struct xfs_inode *ip, unsigned int order),
 869	TP_ARGS(ip, order),
 870	TP_STRUCT__entry(
 871		__field(dev_t, dev)
 872		__field(xfs_ino_t, ino)
 873		__field(unsigned int, order)
 874	),
 875	TP_fast_assign(
 876		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 877		__entry->ino = ip->i_ino;
 878		__entry->order = order;
 879	),
 880	TP_printk("dev %d:%d ino 0x%llx order %u",
 881		  MAJOR(__entry->dev), MINOR(__entry->dev),
 882		  __entry->ino,
 883		  __entry->order)
 884)
 885
 886#define DEFINE_FAULT_EVENT(name) \
 887DEFINE_EVENT(xfs_fault_class, name, \
 888	TP_PROTO(struct xfs_inode *ip, unsigned int order), \
 889	TP_ARGS(ip, order))
 890DEFINE_FAULT_EVENT(xfs_read_fault);
 891DEFINE_FAULT_EVENT(xfs_write_fault);
 892
 893DECLARE_EVENT_CLASS(xfs_iref_class,
 894	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
 895	TP_ARGS(ip, caller_ip),
 896	TP_STRUCT__entry(
 897		__field(dev_t, dev)
 898		__field(xfs_ino_t, ino)
 899		__field(int, count)
 900		__field(int, pincount)
 901		__field(unsigned long, caller_ip)
 902	),
 903	TP_fast_assign(
 904		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 905		__entry->ino = ip->i_ino;
 906		__entry->count = atomic_read(&VFS_I(ip)->i_count);
 907		__entry->pincount = atomic_read(&ip->i_pincount);
 908		__entry->caller_ip = caller_ip;
 909	),
 910	TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS",
 911		  MAJOR(__entry->dev), MINOR(__entry->dev),
 912		  __entry->ino,
 913		  __entry->count,
 914		  __entry->pincount,
 915		  (char *)__entry->caller_ip)
 916)
 917
 918TRACE_EVENT(xfs_iomap_prealloc_size,
 919	TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
 920		 unsigned int writeio_blocks),
 921	TP_ARGS(ip, blocks, shift, writeio_blocks),
 922	TP_STRUCT__entry(
 923		__field(dev_t, dev)
 924		__field(xfs_ino_t, ino)
 925		__field(xfs_fsblock_t, blocks)
 926		__field(int, shift)
 927		__field(unsigned int, writeio_blocks)
 928	),
 929	TP_fast_assign(
 930		__entry->dev = VFS_I(ip)->i_sb->s_dev;
 931		__entry->ino = ip->i_ino;
 932		__entry->blocks = blocks;
 933		__entry->shift = shift;
 934		__entry->writeio_blocks = writeio_blocks;
 935	),
 936	TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
 937		  "m_allocsize_blocks %u",
 938		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
 939		  __entry->blocks, __entry->shift, __entry->writeio_blocks)
 940)
 941
 942TRACE_EVENT(xfs_irec_merge_pre,
 943	TP_PROTO(const struct xfs_perag *pag,
 944		 const struct xfs_inobt_rec_incore *rec,
 945		 const struct xfs_inobt_rec_incore *nrec),
 946	TP_ARGS(pag, rec, nrec),
 947	TP_STRUCT__entry(
 948		__field(dev_t, dev)
 949		__field(xfs_agnumber_t, agno)
 950		__field(xfs_agino_t, agino)
 951		__field(uint16_t, holemask)
 952		__field(xfs_agino_t, nagino)
 953		__field(uint16_t, nholemask)
 954	),
 955	TP_fast_assign(
 956		__entry->dev = pag_mount(pag)->m_super->s_dev;
 957		__entry->agno = pag_agno(pag);
 958		__entry->agino = rec->ir_startino;
 959		__entry->holemask = rec->ir_holemask;
 960		__entry->nagino = nrec->ir_startino;
 961		__entry->nholemask = nrec->ir_holemask;
 962	),
 963	TP_printk("dev %d:%d agno 0x%x agino 0x%x holemask 0x%x new_agino 0x%x new_holemask 0x%x",
 964		  MAJOR(__entry->dev), MINOR(__entry->dev),
 965		  __entry->agno,
 966		  __entry->agino,
 967		  __entry->holemask,
 968		  __entry->nagino,
 969		  __entry->nholemask)
 970)
 971
 972TRACE_EVENT(xfs_irec_merge_post,
 973	TP_PROTO(const struct xfs_perag *pag,
 974		 const struct xfs_inobt_rec_incore *nrec),
 975	TP_ARGS(pag, nrec),
 976	TP_STRUCT__entry(
 977		__field(dev_t, dev)
 978		__field(xfs_agnumber_t, agno)
 979		__field(xfs_agino_t, agino)
 980		__field(uint16_t, holemask)
 981	),
 982	TP_fast_assign(
 983		__entry->dev = pag_mount(pag)->m_super->s_dev;
 984		__entry->agno = pag_agno(pag);
 985		__entry->agino = nrec->ir_startino;
 986		__entry->holemask = nrec->ir_holemask;
 987	),
 988	TP_printk("dev %d:%d agno 0x%x agino 0x%x holemask 0x%x",
 989		  MAJOR(__entry->dev),
 990		  MINOR(__entry->dev),
 991		  __entry->agno,
 992		  __entry->agino,
 993		  __entry->holemask)
 994)
 995
 996#define DEFINE_IREF_EVENT(name) \
 997DEFINE_EVENT(xfs_iref_class, name, \
 998	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
 999	TP_ARGS(ip, caller_ip))
 
1000DEFINE_IREF_EVENT(xfs_irele);
1001DEFINE_IREF_EVENT(xfs_inode_pin);
1002DEFINE_IREF_EVENT(xfs_inode_unpin);
1003DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
1004
1005DECLARE_EVENT_CLASS(xfs_namespace_class,
1006	TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name),
1007	TP_ARGS(dp, name),
1008	TP_STRUCT__entry(
1009		__field(dev_t, dev)
1010		__field(xfs_ino_t, dp_ino)
1011		__field(int, namelen)
1012		__dynamic_array(char, name, name->len)
1013	),
1014	TP_fast_assign(
1015		__entry->dev = VFS_I(dp)->i_sb->s_dev;
1016		__entry->dp_ino = dp->i_ino;
1017		__entry->namelen = name->len;
1018		memcpy(__get_str(name), name->name, name->len);
1019	),
1020	TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
1021		  MAJOR(__entry->dev), MINOR(__entry->dev),
1022		  __entry->dp_ino,
1023		  __entry->namelen,
1024		  __get_str(name))
1025)
1026
1027#define DEFINE_NAMESPACE_EVENT(name) \
1028DEFINE_EVENT(xfs_namespace_class, name, \
1029	TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name), \
1030	TP_ARGS(dp, name))
1031DEFINE_NAMESPACE_EVENT(xfs_remove);
1032DEFINE_NAMESPACE_EVENT(xfs_link);
1033DEFINE_NAMESPACE_EVENT(xfs_lookup);
1034DEFINE_NAMESPACE_EVENT(xfs_create);
1035DEFINE_NAMESPACE_EVENT(xfs_symlink);
1036
1037TRACE_EVENT(xfs_rename,
1038	TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
1039		 struct xfs_name *src_name, struct xfs_name *target_name),
1040	TP_ARGS(src_dp, target_dp, src_name, target_name),
1041	TP_STRUCT__entry(
1042		__field(dev_t, dev)
1043		__field(xfs_ino_t, src_dp_ino)
1044		__field(xfs_ino_t, target_dp_ino)
1045		__field(int, src_namelen)
1046		__field(int, target_namelen)
1047		__dynamic_array(char, src_name, src_name->len)
1048		__dynamic_array(char, target_name, target_name->len)
1049	),
1050	TP_fast_assign(
1051		__entry->dev = VFS_I(src_dp)->i_sb->s_dev;
1052		__entry->src_dp_ino = src_dp->i_ino;
1053		__entry->target_dp_ino = target_dp->i_ino;
1054		__entry->src_namelen = src_name->len;
1055		__entry->target_namelen = target_name->len;
1056		memcpy(__get_str(src_name), src_name->name, src_name->len);
1057		memcpy(__get_str(target_name), target_name->name,
1058			target_name->len);
1059	),
1060	TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
1061		  " src name %.*s target name %.*s",
1062		  MAJOR(__entry->dev), MINOR(__entry->dev),
1063		  __entry->src_dp_ino,
1064		  __entry->target_dp_ino,
1065		  __entry->src_namelen,
1066		  __get_str(src_name),
1067		  __entry->target_namelen,
1068		  __get_str(target_name))
1069)
1070
1071DECLARE_EVENT_CLASS(xfs_dquot_class,
1072	TP_PROTO(struct xfs_dquot *dqp),
1073	TP_ARGS(dqp),
1074	TP_STRUCT__entry(
1075		__field(dev_t, dev)
1076		__field(u32, id)
1077		__field(xfs_dqtype_t, type)
1078		__field(unsigned, flags)
1079		__field(unsigned, nrefs)
1080		__field(unsigned long long, res_bcount)
1081		__field(unsigned long long, res_rtbcount)
1082		__field(unsigned long long, res_icount)
1083
1084		__field(unsigned long long, bcount)
1085		__field(unsigned long long, rtbcount)
1086		__field(unsigned long long, icount)
1087
1088		__field(unsigned long long, blk_hardlimit)
1089		__field(unsigned long long, blk_softlimit)
1090		__field(unsigned long long, rtb_hardlimit)
1091		__field(unsigned long long, rtb_softlimit)
1092		__field(unsigned long long, ino_hardlimit)
1093		__field(unsigned long long, ino_softlimit)
1094	),
1095	TP_fast_assign(
1096		__entry->dev = dqp->q_mount->m_super->s_dev;
1097		__entry->id = dqp->q_id;
1098		__entry->type = dqp->q_type;
1099		__entry->flags = dqp->q_flags;
1100		__entry->nrefs = dqp->q_nrefs;
1101
1102		__entry->res_bcount = dqp->q_blk.reserved;
1103		__entry->res_rtbcount = dqp->q_rtb.reserved;
1104		__entry->res_icount = dqp->q_ino.reserved;
1105
1106		__entry->bcount = dqp->q_blk.count;
1107		__entry->rtbcount = dqp->q_rtb.count;
1108		__entry->icount = dqp->q_ino.count;
1109
1110		__entry->blk_hardlimit = dqp->q_blk.hardlimit;
1111		__entry->blk_softlimit = dqp->q_blk.softlimit;
1112		__entry->rtb_hardlimit = dqp->q_rtb.hardlimit;
1113		__entry->rtb_softlimit = dqp->q_rtb.softlimit;
1114		__entry->ino_hardlimit = dqp->q_ino.hardlimit;
1115		__entry->ino_softlimit = dqp->q_ino.softlimit;
1116	),
1117	TP_printk("dev %d:%d id 0x%x type %s flags %s nrefs %u "
1118		  "res_bc 0x%llx res_rtbc 0x%llx res_ic 0x%llx "
1119		  "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
1120		  "rtbcnt 0x%llx rtbhardlimit 0x%llx rtbsoftlimit 0x%llx "
1121		  "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
1122		  MAJOR(__entry->dev), MINOR(__entry->dev),
1123		  __entry->id,
1124		  __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
1125		  __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
1126		  __entry->nrefs,
1127		  __entry->res_bcount,
1128		  __entry->res_rtbcount,
1129		  __entry->res_icount,
1130		  __entry->bcount,
1131		  __entry->blk_hardlimit,
1132		  __entry->blk_softlimit,
1133		  __entry->rtbcount,
1134		  __entry->rtb_hardlimit,
1135		  __entry->rtb_softlimit,
1136		  __entry->icount,
1137		  __entry->ino_hardlimit,
1138		  __entry->ino_softlimit)
1139)
1140
1141#define DEFINE_DQUOT_EVENT(name) \
1142DEFINE_EVENT(xfs_dquot_class, name, \
1143	TP_PROTO(struct xfs_dquot *dqp), \
1144	TP_ARGS(dqp))
1145DEFINE_DQUOT_EVENT(xfs_dqadjust);
1146DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
1147DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
1148DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
1149DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
1150DEFINE_DQUOT_EVENT(xfs_dqattach_found);
1151DEFINE_DQUOT_EVENT(xfs_dqattach_get);
1152DEFINE_DQUOT_EVENT(xfs_dqalloc);
1153DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
1154DEFINE_DQUOT_EVENT(xfs_dqread);
1155DEFINE_DQUOT_EVENT(xfs_dqread_fail);
1156DEFINE_DQUOT_EVENT(xfs_dqget_hit);
1157DEFINE_DQUOT_EVENT(xfs_dqget_miss);
1158DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
1159DEFINE_DQUOT_EVENT(xfs_dqget_dup);
1160DEFINE_DQUOT_EVENT(xfs_dqput);
 
1161DEFINE_DQUOT_EVENT(xfs_dqput_free);
1162DEFINE_DQUOT_EVENT(xfs_dqrele);
1163DEFINE_DQUOT_EVENT(xfs_dqflush);
1164DEFINE_DQUOT_EVENT(xfs_dqflush_force);
1165DEFINE_DQUOT_EVENT(xfs_dqflush_done);
1166DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_before);
1167DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_after);
1168
1169TRACE_EVENT(xfs_trans_mod_dquot,
1170	TP_PROTO(struct xfs_trans *tp, struct xfs_dquot *dqp,
1171		 unsigned int field, int64_t delta),
1172	TP_ARGS(tp, dqp, field, delta),
1173	TP_STRUCT__entry(
1174		__field(dev_t, dev)
1175		__field(xfs_dqtype_t, type)
1176		__field(unsigned int, flags)
1177		__field(unsigned int, dqid)
1178		__field(unsigned int, field)
1179		__field(int64_t, delta)
1180	),
1181	TP_fast_assign(
1182		__entry->dev = tp->t_mountp->m_super->s_dev;
1183		__entry->type = dqp->q_type;
1184		__entry->flags = dqp->q_flags;
1185		__entry->dqid = dqp->q_id;
1186		__entry->field = field;
1187		__entry->delta = delta;
1188	),
1189	TP_printk("dev %d:%d dquot id 0x%x type %s flags %s field %s delta %lld",
1190		  MAJOR(__entry->dev), MINOR(__entry->dev),
1191		  __entry->dqid,
1192		  __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
1193		  __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
1194		  __print_flags(__entry->field, "|", XFS_QMOPT_FLAGS),
1195		  __entry->delta)
1196);
1197
1198DECLARE_EVENT_CLASS(xfs_dqtrx_class,
1199	TP_PROTO(struct xfs_dqtrx *qtrx),
1200	TP_ARGS(qtrx),
1201	TP_STRUCT__entry(
1202		__field(dev_t, dev)
1203		__field(xfs_dqtype_t, type)
1204		__field(unsigned int, flags)
1205		__field(u32, dqid)
1206
1207		__field(uint64_t, blk_res)
1208		__field(int64_t,  bcount_delta)
1209		__field(int64_t,  delbcnt_delta)
1210
1211		__field(uint64_t, rtblk_res)
1212		__field(uint64_t, rtblk_res_used)
1213		__field(int64_t,  rtbcount_delta)
1214		__field(int64_t,  delrtb_delta)
1215
1216		__field(uint64_t, ino_res)
1217		__field(uint64_t, ino_res_used)
1218		__field(int64_t,  icount_delta)
1219	),
1220	TP_fast_assign(
1221		__entry->dev = qtrx->qt_dquot->q_mount->m_super->s_dev;
1222		__entry->type = qtrx->qt_dquot->q_type;
1223		__entry->flags = qtrx->qt_dquot->q_flags;
1224		__entry->dqid = qtrx->qt_dquot->q_id;
1225
1226		__entry->blk_res = qtrx->qt_blk_res;
1227		__entry->bcount_delta = qtrx->qt_bcount_delta;
1228		__entry->delbcnt_delta = qtrx->qt_delbcnt_delta;
1229
1230		__entry->rtblk_res = qtrx->qt_rtblk_res;
1231		__entry->rtblk_res_used = qtrx->qt_rtblk_res_used;
1232		__entry->rtbcount_delta = qtrx->qt_rtbcount_delta;
1233		__entry->delrtb_delta = qtrx->qt_delrtb_delta;
1234
1235		__entry->ino_res = qtrx->qt_ino_res;
1236		__entry->ino_res_used = qtrx->qt_ino_res_used;
1237		__entry->icount_delta = qtrx->qt_icount_delta;
1238	),
1239	TP_printk("dev %d:%d dquot id 0x%x type %s flags %s "
1240		  "blk_res %llu bcount_delta %lld delbcnt_delta %lld "
1241		  "rtblk_res %llu rtblk_res_used %llu rtbcount_delta %lld delrtb_delta %lld "
1242		  "ino_res %llu ino_res_used %llu icount_delta %lld",
1243		MAJOR(__entry->dev), MINOR(__entry->dev),
1244		__entry->dqid,
1245		  __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
1246		  __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
1247
1248		__entry->blk_res,
1249		__entry->bcount_delta,
1250		__entry->delbcnt_delta,
1251
1252		__entry->rtblk_res,
1253		__entry->rtblk_res_used,
1254		__entry->rtbcount_delta,
1255		__entry->delrtb_delta,
1256
1257		__entry->ino_res,
1258		__entry->ino_res_used,
1259		__entry->icount_delta)
1260)
1261
1262#define DEFINE_DQTRX_EVENT(name) \
1263DEFINE_EVENT(xfs_dqtrx_class, name, \
1264	TP_PROTO(struct xfs_dqtrx *qtrx), \
1265	TP_ARGS(qtrx))
1266DEFINE_DQTRX_EVENT(xfs_trans_apply_dquot_deltas);
1267DEFINE_DQTRX_EVENT(xfs_trans_mod_dquot_before);
1268DEFINE_DQTRX_EVENT(xfs_trans_mod_dquot_after);
1269
1270DECLARE_EVENT_CLASS(xfs_loggrant_class,
1271	TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
1272	TP_ARGS(log, tic),
1273	TP_STRUCT__entry(
1274		__field(dev_t, dev)
1275		__field(unsigned long, tic)
1276		__field(char, ocnt)
1277		__field(char, cnt)
1278		__field(int, curr_res)
1279		__field(int, unit_res)
1280		__field(unsigned int, flags)
1281		__field(int, reserveq)
1282		__field(int, writeq)
1283		__field(uint64_t, grant_reserve_bytes)
1284		__field(uint64_t, grant_write_bytes)
1285		__field(uint64_t, tail_space)
 
1286		__field(int, curr_cycle)
1287		__field(int, curr_block)
1288		__field(xfs_lsn_t, tail_lsn)
1289	),
1290	TP_fast_assign(
1291		__entry->dev = log->l_mp->m_super->s_dev;
1292		__entry->tic = (unsigned long)tic;
1293		__entry->ocnt = tic->t_ocnt;
1294		__entry->cnt = tic->t_cnt;
1295		__entry->curr_res = tic->t_curr_res;
1296		__entry->unit_res = tic->t_unit_res;
1297		__entry->flags = tic->t_flags;
1298		__entry->reserveq = list_empty(&log->l_reserve_head.waiters);
1299		__entry->writeq = list_empty(&log->l_write_head.waiters);
1300		__entry->tail_space = READ_ONCE(log->l_tail_space);
1301		__entry->grant_reserve_bytes = __entry->tail_space +
1302			atomic64_read(&log->l_reserve_head.grant);
1303		__entry->grant_write_bytes = __entry->tail_space +
1304			atomic64_read(&log->l_write_head.grant);
 
1305		__entry->curr_cycle = log->l_curr_cycle;
1306		__entry->curr_block = log->l_curr_block;
1307		__entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
1308	),
1309	TP_printk("dev %d:%d tic 0x%lx t_ocnt %u t_cnt %u t_curr_res %u "
1310		  "t_unit_res %u t_flags %s reserveq %s writeq %s "
1311		  "tail space %llu grant_reserve_bytes %llu "
1312		  "grant_write_bytes %llu curr_cycle %d curr_block %d "
 
1313		  "tail_cycle %d tail_block %d",
1314		  MAJOR(__entry->dev), MINOR(__entry->dev),
1315		  __entry->tic,
1316		  __entry->ocnt,
1317		  __entry->cnt,
1318		  __entry->curr_res,
1319		  __entry->unit_res,
1320		  __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
1321		  __entry->reserveq ? "empty" : "active",
1322		  __entry->writeq ? "empty" : "active",
1323		  __entry->tail_space,
1324		  __entry->grant_reserve_bytes,
 
1325		  __entry->grant_write_bytes,
1326		  __entry->curr_cycle,
1327		  __entry->curr_block,
1328		  CYCLE_LSN(__entry->tail_lsn),
1329		  BLOCK_LSN(__entry->tail_lsn)
1330	)
1331)
1332
1333#define DEFINE_LOGGRANT_EVENT(name) \
1334DEFINE_EVENT(xfs_loggrant_class, name, \
1335	TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
1336	TP_ARGS(log, tic))
 
 
1337DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
1338DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1339DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
1340DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
1341DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1342DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1343DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1344DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
1345DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant);
1346DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant_exit);
1347DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant_sub);
1348DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant);
1349DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant_sub);
1350DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant_exit);
1351DEFINE_LOGGRANT_EVENT(xfs_log_cil_wait);
1352DEFINE_LOGGRANT_EVENT(xfs_log_cil_return);
1353
1354DECLARE_EVENT_CLASS(xfs_log_item_class,
1355	TP_PROTO(struct xfs_log_item *lip),
1356	TP_ARGS(lip),
1357	TP_STRUCT__entry(
1358		__field(dev_t, dev)
1359		__field(void *, lip)
1360		__field(uint, type)
1361		__field(unsigned long, flags)
1362		__field(xfs_lsn_t, lsn)
1363	),
1364	TP_fast_assign(
1365		__entry->dev = lip->li_log->l_mp->m_super->s_dev;
1366		__entry->lip = lip;
1367		__entry->type = lip->li_type;
1368		__entry->flags = lip->li_flags;
1369		__entry->lsn = lip->li_lsn;
1370	),
1371	TP_printk("dev %d:%d lip %p lsn %d/%d type %s flags %s",
1372		  MAJOR(__entry->dev), MINOR(__entry->dev),
1373		  __entry->lip,
1374		  CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1375		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1376		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1377)
1378
1379TRACE_EVENT(xfs_log_force,
1380	TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1381	TP_ARGS(mp, lsn, caller_ip),
1382	TP_STRUCT__entry(
1383		__field(dev_t, dev)
1384		__field(xfs_lsn_t, lsn)
1385		__field(unsigned long, caller_ip)
1386	),
1387	TP_fast_assign(
1388		__entry->dev = mp->m_super->s_dev;
1389		__entry->lsn = lsn;
1390		__entry->caller_ip = caller_ip;
1391	),
1392	TP_printk("dev %d:%d lsn 0x%llx caller %pS",
1393		  MAJOR(__entry->dev), MINOR(__entry->dev),
1394		  __entry->lsn, (void *)__entry->caller_ip)
1395)
1396
1397#define DEFINE_LOG_ITEM_EVENT(name) \
1398DEFINE_EVENT(xfs_log_item_class, name, \
1399	TP_PROTO(struct xfs_log_item *lip), \
1400	TP_ARGS(lip))
1401DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
1402DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1403DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
1404DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
1405DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_mark);
1406DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_skip);
1407DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_unpin);
1408
1409DECLARE_EVENT_CLASS(xfs_ail_class,
1410	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1411	TP_ARGS(lip, old_lsn, new_lsn),
1412	TP_STRUCT__entry(
1413		__field(dev_t, dev)
1414		__field(void *, lip)
1415		__field(uint, type)
1416		__field(unsigned long, flags)
1417		__field(xfs_lsn_t, old_lsn)
1418		__field(xfs_lsn_t, new_lsn)
1419	),
1420	TP_fast_assign(
1421		__entry->dev = lip->li_log->l_mp->m_super->s_dev;
1422		__entry->lip = lip;
1423		__entry->type = lip->li_type;
1424		__entry->flags = lip->li_flags;
1425		__entry->old_lsn = old_lsn;
1426		__entry->new_lsn = new_lsn;
1427	),
1428	TP_printk("dev %d:%d lip %p old lsn %d/%d new lsn %d/%d type %s flags %s",
1429		  MAJOR(__entry->dev), MINOR(__entry->dev),
1430		  __entry->lip,
1431		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1432		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1433		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1434		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1435)
1436
1437#define DEFINE_AIL_EVENT(name) \
1438DEFINE_EVENT(xfs_ail_class, name, \
1439	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1440	TP_ARGS(lip, old_lsn, new_lsn))
1441DEFINE_AIL_EVENT(xfs_ail_insert);
1442DEFINE_AIL_EVENT(xfs_ail_move);
1443DEFINE_AIL_EVENT(xfs_ail_delete);
1444
1445TRACE_EVENT(xfs_log_assign_tail_lsn,
1446	TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1447	TP_ARGS(log, new_lsn),
1448	TP_STRUCT__entry(
1449		__field(dev_t, dev)
1450		__field(xfs_lsn_t, new_lsn)
1451		__field(xfs_lsn_t, old_lsn)
1452		__field(xfs_lsn_t, head_lsn)
1453	),
1454	TP_fast_assign(
1455		__entry->dev = log->l_mp->m_super->s_dev;
1456		__entry->new_lsn = new_lsn;
1457		__entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1458		__entry->head_lsn = log->l_ailp->ail_head_lsn;
1459	),
1460	TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, head lsn %d/%d",
1461		  MAJOR(__entry->dev), MINOR(__entry->dev),
1462		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1463		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1464		  CYCLE_LSN(__entry->head_lsn), BLOCK_LSN(__entry->head_lsn))
1465)
1466
1467DECLARE_EVENT_CLASS(xfs_file_class,
1468	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter),
1469	TP_ARGS(iocb, iter),
1470	TP_STRUCT__entry(
1471		__field(dev_t, dev)
1472		__field(xfs_ino_t, ino)
1473		__field(xfs_fsize_t, size)
1474		__field(loff_t, offset)
1475		__field(size_t, count)
 
1476	),
1477	TP_fast_assign(
1478		__entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev;
1479		__entry->ino = XFS_I(file_inode(iocb->ki_filp))->i_ino;
1480		__entry->size = XFS_I(file_inode(iocb->ki_filp))->i_disk_size;
1481		__entry->offset = iocb->ki_pos;
1482		__entry->count = iov_iter_count(iter);
 
1483	),
1484	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx pos 0x%llx bytecount 0x%zx",
 
1485		  MAJOR(__entry->dev), MINOR(__entry->dev),
1486		  __entry->ino,
1487		  __entry->size,
1488		  __entry->offset,
1489		  __entry->count)
 
1490)
1491
1492#define DEFINE_RW_EVENT(name)		\
1493DEFINE_EVENT(xfs_file_class, name,	\
1494	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter),		\
1495	TP_ARGS(iocb, iter))
1496DEFINE_RW_EVENT(xfs_file_buffered_read);
1497DEFINE_RW_EVENT(xfs_file_direct_read);
1498DEFINE_RW_EVENT(xfs_file_dax_read);
1499DEFINE_RW_EVENT(xfs_file_buffered_write);
1500DEFINE_RW_EVENT(xfs_file_direct_write);
1501DEFINE_RW_EVENT(xfs_file_dax_write);
1502DEFINE_RW_EVENT(xfs_reflink_bounce_dio_write);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1503
1504DECLARE_EVENT_CLASS(xfs_imap_class,
1505	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
1506		 int whichfork, struct xfs_bmbt_irec *irec),
1507	TP_ARGS(ip, offset, count, whichfork, irec),
1508	TP_STRUCT__entry(
1509		__field(dev_t, dev)
1510		__field(xfs_ino_t, ino)
1511		__field(loff_t, size)
1512		__field(loff_t, offset)
1513		__field(size_t, count)
1514		__field(int, whichfork)
1515		__field(xfs_fileoff_t, startoff)
1516		__field(xfs_fsblock_t, startblock)
1517		__field(xfs_filblks_t, blockcount)
1518	),
1519	TP_fast_assign(
1520		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1521		__entry->ino = ip->i_ino;
1522		__entry->size = ip->i_disk_size;
1523		__entry->offset = offset;
1524		__entry->count = count;
1525		__entry->whichfork = whichfork;
1526		__entry->startoff = irec ? irec->br_startoff : 0;
1527		__entry->startblock = irec ? irec->br_startblock : 0;
1528		__entry->blockcount = irec ? irec->br_blockcount : 0;
1529	),
1530	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx pos 0x%llx bytecount 0x%zx "
1531		  "fork %s startoff 0x%llx startblock 0x%llx fsbcount 0x%llx",
1532		  MAJOR(__entry->dev), MINOR(__entry->dev),
1533		  __entry->ino,
1534		  __entry->size,
1535		  __entry->offset,
1536		  __entry->count,
1537		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
1538		  __entry->startoff,
1539		  (int64_t)__entry->startblock,
1540		  __entry->blockcount)
1541)
1542
1543#define DEFINE_IMAP_EVENT(name)	\
1544DEFINE_EVENT(xfs_imap_class, name,	\
1545	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,	\
1546		 int whichfork, struct xfs_bmbt_irec *irec),		\
1547	TP_ARGS(ip, offset, count, whichfork, irec))
1548DEFINE_IMAP_EVENT(xfs_map_blocks_found);
1549DEFINE_IMAP_EVENT(xfs_map_blocks_alloc);
1550DEFINE_IMAP_EVENT(xfs_iomap_alloc);
1551DEFINE_IMAP_EVENT(xfs_iomap_found);
 
1552
1553DECLARE_EVENT_CLASS(xfs_simple_io_class,
1554	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1555	TP_ARGS(ip, offset, count),
1556	TP_STRUCT__entry(
1557		__field(dev_t, dev)
1558		__field(xfs_ino_t, ino)
1559		__field(loff_t, isize)
1560		__field(loff_t, disize)
1561		__field(loff_t, offset)
1562		__field(size_t, count)
1563	),
1564	TP_fast_assign(
1565		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1566		__entry->ino = ip->i_ino;
1567		__entry->isize = VFS_I(ip)->i_size;
1568		__entry->disize = ip->i_disk_size;
1569		__entry->offset = offset;
1570		__entry->count = count;
1571	),
1572	TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
1573		  "pos 0x%llx bytecount 0x%zx",
1574		  MAJOR(__entry->dev), MINOR(__entry->dev),
1575		  __entry->ino,
1576		  __entry->isize,
1577		  __entry->disize,
1578		  __entry->offset,
1579		  __entry->count)
1580);
1581
1582#define DEFINE_SIMPLE_IO_EVENT(name)	\
1583DEFINE_EVENT(xfs_simple_io_class, name,	\
1584	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),	\
1585	TP_ARGS(ip, offset, count))
1586DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1587DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
 
1588DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
1589DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
1590DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1591DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1592DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
1593DEFINE_SIMPLE_IO_EVENT(xfs_file_splice_read);
1594
1595DECLARE_EVENT_CLASS(xfs_itrunc_class,
1596	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1597	TP_ARGS(ip, new_size),
1598	TP_STRUCT__entry(
1599		__field(dev_t, dev)
1600		__field(xfs_ino_t, ino)
1601		__field(xfs_fsize_t, size)
1602		__field(xfs_fsize_t, new_size)
1603	),
1604	TP_fast_assign(
1605		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1606		__entry->ino = ip->i_ino;
1607		__entry->size = ip->i_disk_size;
1608		__entry->new_size = new_size;
1609	),
1610	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx new_size 0x%llx",
1611		  MAJOR(__entry->dev), MINOR(__entry->dev),
1612		  __entry->ino,
1613		  __entry->size,
1614		  __entry->new_size)
1615)
1616
1617#define DEFINE_ITRUNC_EVENT(name) \
1618DEFINE_EVENT(xfs_itrunc_class, name, \
1619	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1620	TP_ARGS(ip, new_size))
1621DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1622DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
1623
1624TRACE_EVENT(xfs_pagecache_inval,
1625	TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1626	TP_ARGS(ip, start, finish),
1627	TP_STRUCT__entry(
1628		__field(dev_t, dev)
1629		__field(xfs_ino_t, ino)
1630		__field(xfs_fsize_t, size)
1631		__field(xfs_off_t, start)
1632		__field(xfs_off_t, finish)
1633	),
1634	TP_fast_assign(
1635		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1636		__entry->ino = ip->i_ino;
1637		__entry->size = ip->i_disk_size;
1638		__entry->start = start;
1639		__entry->finish = finish;
1640	),
1641	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx start 0x%llx finish 0x%llx",
1642		  MAJOR(__entry->dev), MINOR(__entry->dev),
1643		  __entry->ino,
1644		  __entry->size,
1645		  __entry->start,
1646		  __entry->finish)
1647);
1648
1649TRACE_EVENT(xfs_bunmap,
1650	TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t fileoff, xfs_filblks_t len,
1651		 int flags, unsigned long caller_ip),
1652	TP_ARGS(ip, fileoff, len, flags, caller_ip),
1653	TP_STRUCT__entry(
1654		__field(dev_t, dev)
1655		__field(xfs_ino_t, ino)
1656		__field(xfs_fsize_t, size)
1657		__field(xfs_fileoff_t, fileoff)
1658		__field(xfs_filblks_t, len)
1659		__field(unsigned long, caller_ip)
1660		__field(int, flags)
1661	),
1662	TP_fast_assign(
1663		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1664		__entry->ino = ip->i_ino;
1665		__entry->size = ip->i_disk_size;
1666		__entry->fileoff = fileoff;
1667		__entry->len = len;
1668		__entry->caller_ip = caller_ip;
1669		__entry->flags = flags;
1670	),
1671	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx fileoff 0x%llx fsbcount 0x%llx "
1672		  "flags %s caller %pS",
1673		  MAJOR(__entry->dev), MINOR(__entry->dev),
1674		  __entry->ino,
1675		  __entry->size,
1676		  __entry->fileoff,
1677		  __entry->len,
1678		  __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1679		  (void *)__entry->caller_ip)
1680
1681);
1682
1683DECLARE_EVENT_CLASS(xfs_extent_busy_class,
1684	TP_PROTO(const struct xfs_group *xg, xfs_agblock_t agbno,
1685		 xfs_extlen_t len),
1686	TP_ARGS(xg, agbno, len),
1687	TP_STRUCT__entry(
1688		__field(dev_t, dev)
1689		__field(enum xfs_group_type, type)
1690		__field(xfs_agnumber_t, agno)
1691		__field(xfs_agblock_t, agbno)
1692		__field(xfs_extlen_t, len)
1693	),
1694	TP_fast_assign(
1695		__entry->dev = xg->xg_mount->m_super->s_dev;
1696		__entry->type = xg->xg_type;
1697		__entry->agno = xg->xg_gno;
1698		__entry->agbno = agbno;
1699		__entry->len = len;
1700	),
1701	TP_printk("dev %d:%d %sno 0x%x %sbno 0x%x fsbcount 0x%x",
1702		  MAJOR(__entry->dev), MINOR(__entry->dev),
1703		  __print_symbolic(__entry->type, XG_TYPE_STRINGS),
1704		  __entry->agno,
1705		  __print_symbolic(__entry->type, XG_TYPE_STRINGS),
1706		  __entry->agbno,
1707		  __entry->len)
1708);
1709#define DEFINE_BUSY_EVENT(name) \
1710DEFINE_EVENT(xfs_extent_busy_class, name, \
1711	TP_PROTO(const struct xfs_group *xg, xfs_agblock_t agbno, \
1712		 xfs_extlen_t len), \
1713	TP_ARGS(xg, agbno, len))
1714DEFINE_BUSY_EVENT(xfs_extent_busy);
 
1715DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1716DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1717DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
1718
1719TRACE_EVENT(xfs_extent_busy_trim,
1720	TP_PROTO(const struct xfs_group *xg, xfs_agblock_t agbno,
1721		 xfs_extlen_t len, xfs_agblock_t tbno, xfs_extlen_t tlen),
1722	TP_ARGS(xg, agbno, len, tbno, tlen),
 
1723	TP_STRUCT__entry(
1724		__field(dev_t, dev)
1725		__field(enum xfs_group_type, type)
1726		__field(xfs_agnumber_t, agno)
1727		__field(xfs_agblock_t, agbno)
1728		__field(xfs_extlen_t, len)
1729		__field(xfs_agblock_t, tbno)
1730		__field(xfs_extlen_t, tlen)
1731	),
1732	TP_fast_assign(
1733		__entry->dev = xg->xg_mount->m_super->s_dev;
1734		__entry->type = xg->xg_type;
1735		__entry->agno = xg->xg_gno;
1736		__entry->agbno = agbno;
1737		__entry->len = len;
1738		__entry->tbno = tbno;
1739		__entry->tlen = tlen;
1740	),
1741	TP_printk("dev %d:%d %sno 0x%x %sbno 0x%x fsbcount 0x%x found_agbno 0x%x found_fsbcount 0x%x",
1742		  MAJOR(__entry->dev), MINOR(__entry->dev),
1743		  __print_symbolic(__entry->type, XG_TYPE_STRINGS),
1744		  __entry->agno,
1745		  __print_symbolic(__entry->type, XG_TYPE_STRINGS),
1746		  __entry->agbno,
1747		  __entry->len,
1748		  __entry->tbno,
1749		  __entry->tlen)
1750);
1751
1752#ifdef CONFIG_XFS_RT
1753TRACE_EVENT(xfs_rtalloc_extent_busy,
1754	TP_PROTO(struct xfs_rtgroup *rtg, xfs_rtxnum_t start,
1755		 xfs_rtxlen_t minlen, xfs_rtxlen_t maxlen,
1756		 xfs_rtxlen_t len, xfs_rtxlen_t prod, xfs_rtxnum_t rtx,
1757		 unsigned busy_gen),
1758	TP_ARGS(rtg, start, minlen, maxlen, len, prod, rtx, busy_gen),
1759	TP_STRUCT__entry(
1760		__field(dev_t, dev)
1761		__field(xfs_rgnumber_t, rgno)
1762		__field(xfs_rtxnum_t, start)
1763		__field(xfs_rtxlen_t, minlen)
1764		__field(xfs_rtxlen_t, maxlen)
1765		__field(xfs_rtxlen_t, mod)
1766		__field(xfs_rtxlen_t, prod)
1767		__field(xfs_rtxlen_t, len)
1768		__field(xfs_rtxnum_t, rtx)
1769		__field(unsigned, busy_gen)
1770	),
1771	TP_fast_assign(
1772		__entry->dev = rtg_mount(rtg)->m_super->s_dev;
1773		__entry->rgno = rtg_rgno(rtg);
1774		__entry->start = start;
1775		__entry->minlen = minlen;
1776		__entry->maxlen = maxlen;
1777		__entry->prod = prod;
1778		__entry->len = len;
1779		__entry->rtx = rtx;
1780		__entry->busy_gen = busy_gen;
1781	),
1782	TP_printk("dev %d:%d rgno 0x%x startrtx 0x%llx minlen %u maxlen %u "
1783		  "prod %u len %u rtx 0%llx busy_gen 0x%x",
1784		  MAJOR(__entry->dev), MINOR(__entry->dev),
1785		  __entry->rgno,
1786		  __entry->start,
1787		  __entry->minlen,
1788		  __entry->maxlen,
1789		  __entry->prod,
1790		  __entry->len,
1791		  __entry->rtx,
1792		  __entry->busy_gen)
1793)
1794
1795TRACE_EVENT(xfs_rtalloc_extent_busy_trim,
1796	TP_PROTO(struct xfs_rtgroup *rtg, xfs_rtxnum_t old_rtx,
1797		 xfs_rtxlen_t old_len, xfs_rtxnum_t new_rtx,
1798		 xfs_rtxlen_t new_len),
1799	TP_ARGS(rtg, old_rtx, old_len, new_rtx, new_len),
1800	TP_STRUCT__entry(
1801		__field(dev_t, dev)
1802		__field(xfs_rgnumber_t, rgno)
1803		__field(xfs_rtxnum_t, old_rtx)
1804		__field(xfs_rtxnum_t, new_rtx)
1805		__field(xfs_rtxlen_t, old_len)
1806		__field(xfs_rtxlen_t, new_len)
1807	),
1808	TP_fast_assign(
1809		__entry->dev = rtg_mount(rtg)->m_super->s_dev;
1810		__entry->rgno = rtg_rgno(rtg);
1811		__entry->old_rtx = old_rtx;
1812		__entry->old_len = old_len;
1813		__entry->new_rtx = new_rtx;
1814		__entry->new_len = new_len;
1815	),
1816	TP_printk("dev %d:%d rgno 0x%x rtx 0x%llx rtxcount 0x%x -> rtx 0x%llx rtxcount 0x%x",
1817		  MAJOR(__entry->dev), MINOR(__entry->dev),
1818		  __entry->rgno,
1819		  __entry->old_rtx,
1820		  __entry->old_len,
1821		  __entry->new_rtx,
1822		  __entry->new_len)
1823);
1824#endif /* CONFIG_XFS_RT */
1825
1826DECLARE_EVENT_CLASS(xfs_agf_class,
1827	TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1828		 unsigned long caller_ip),
1829	TP_ARGS(mp, agf, flags, caller_ip),
1830	TP_STRUCT__entry(
1831		__field(dev_t, dev)
1832		__field(xfs_agnumber_t, agno)
1833		__field(int, flags)
1834		__field(__u32, length)
1835		__field(__u32, bno_root)
1836		__field(__u32, cnt_root)
1837		__field(__u32, bno_level)
1838		__field(__u32, cnt_level)
1839		__field(__u32, flfirst)
1840		__field(__u32, fllast)
1841		__field(__u32, flcount)
1842		__field(__u32, freeblks)
1843		__field(__u32, longest)
1844		__field(unsigned long, caller_ip)
1845	),
1846	TP_fast_assign(
1847		__entry->dev = mp->m_super->s_dev;
1848		__entry->agno = be32_to_cpu(agf->agf_seqno),
1849		__entry->flags = flags;
1850		__entry->length = be32_to_cpu(agf->agf_length),
1851		__entry->bno_root = be32_to_cpu(agf->agf_bno_root),
1852		__entry->cnt_root = be32_to_cpu(agf->agf_cnt_root),
1853		__entry->bno_level = be32_to_cpu(agf->agf_bno_level),
1854		__entry->cnt_level = be32_to_cpu(agf->agf_cnt_level),
 
 
1855		__entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1856		__entry->fllast = be32_to_cpu(agf->agf_fllast),
1857		__entry->flcount = be32_to_cpu(agf->agf_flcount),
1858		__entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1859		__entry->longest = be32_to_cpu(agf->agf_longest);
1860		__entry->caller_ip = caller_ip;
1861	),
1862	TP_printk("dev %d:%d agno 0x%x flags %s length %u roots b %u c %u "
1863		  "levels b %u c %u flfirst %u fllast %u flcount %u "
1864		  "freeblks %u longest %u caller %pS",
1865		  MAJOR(__entry->dev), MINOR(__entry->dev),
1866		  __entry->agno,
1867		  __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1868		  __entry->length,
1869		  __entry->bno_root,
1870		  __entry->cnt_root,
1871		  __entry->bno_level,
1872		  __entry->cnt_level,
1873		  __entry->flfirst,
1874		  __entry->fllast,
1875		  __entry->flcount,
1876		  __entry->freeblks,
1877		  __entry->longest,
1878		  (void *)__entry->caller_ip)
1879);
1880#define DEFINE_AGF_EVENT(name) \
1881DEFINE_EVENT(xfs_agf_class, name, \
1882	TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags, \
1883		 unsigned long caller_ip), \
1884	TP_ARGS(mp, agf, flags, caller_ip))
1885DEFINE_AGF_EVENT(xfs_agf);
1886DEFINE_AGF_EVENT(xfs_agfl_reset);
1887
1888TRACE_EVENT(xfs_free_extent,
1889	TP_PROTO(const struct xfs_perag *pag, xfs_agblock_t agbno,
1890		 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1891		 int haveright),
1892	TP_ARGS(pag, agbno, len, resv, haveleft, haveright),
1893	TP_STRUCT__entry(
1894		__field(dev_t, dev)
1895		__field(xfs_agnumber_t, agno)
1896		__field(xfs_agblock_t, agbno)
1897		__field(xfs_extlen_t, len)
1898		__field(int, resv)
1899		__field(int, haveleft)
1900		__field(int, haveright)
1901	),
1902	TP_fast_assign(
1903		__entry->dev = pag_mount(pag)->m_super->s_dev;
1904		__entry->agno = pag_agno(pag);
1905		__entry->agbno = agbno;
1906		__entry->len = len;
1907		__entry->resv = resv;
1908		__entry->haveleft = haveleft;
1909		__entry->haveright = haveright;
1910	),
1911	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x resv %d %s",
1912		  MAJOR(__entry->dev), MINOR(__entry->dev),
1913		  __entry->agno,
1914		  __entry->agbno,
1915		  __entry->len,
1916		  __entry->resv,
1917		  __entry->haveleft ?
1918			(__entry->haveright ? "both" : "left") :
1919			(__entry->haveright ? "right" : "none"))
1920
1921);
1922
1923DECLARE_EVENT_CLASS(xfs_alloc_class,
1924	TP_PROTO(struct xfs_alloc_arg *args),
1925	TP_ARGS(args),
1926	TP_STRUCT__entry(
1927		__field(dev_t, dev)
1928		__field(xfs_agnumber_t, agno)
1929		__field(xfs_agblock_t, agbno)
1930		__field(xfs_extlen_t, minlen)
1931		__field(xfs_extlen_t, maxlen)
1932		__field(xfs_extlen_t, mod)
1933		__field(xfs_extlen_t, prod)
1934		__field(xfs_extlen_t, minleft)
1935		__field(xfs_extlen_t, total)
1936		__field(xfs_extlen_t, alignment)
1937		__field(xfs_extlen_t, minalignslop)
1938		__field(xfs_extlen_t, len)
 
 
1939		__field(char, wasdel)
1940		__field(char, wasfromfl)
1941		__field(int, resv)
1942		__field(int, datatype)
1943		__field(xfs_agnumber_t, highest_agno)
1944	),
1945	TP_fast_assign(
1946		__entry->dev = args->mp->m_super->s_dev;
1947		__entry->agno = args->agno;
1948		__entry->agbno = args->agbno;
1949		__entry->minlen = args->minlen;
1950		__entry->maxlen = args->maxlen;
1951		__entry->mod = args->mod;
1952		__entry->prod = args->prod;
1953		__entry->minleft = args->minleft;
1954		__entry->total = args->total;
1955		__entry->alignment = args->alignment;
1956		__entry->minalignslop = args->minalignslop;
1957		__entry->len = args->len;
 
 
1958		__entry->wasdel = args->wasdel;
1959		__entry->wasfromfl = args->wasfromfl;
1960		__entry->resv = args->resv;
1961		__entry->datatype = args->datatype;
1962		__entry->highest_agno = args->tp->t_highest_agno;
1963	),
1964	TP_printk("dev %d:%d agno 0x%x agbno 0x%x minlen %u maxlen %u mod %u "
1965		  "prod %u minleft %u total %u alignment %u minalignslop %u "
1966		  "len %u wasdel %d wasfromfl %d resv %d "
1967		  "datatype 0x%x highest_agno 0x%x",
1968		  MAJOR(__entry->dev), MINOR(__entry->dev),
1969		  __entry->agno,
1970		  __entry->agbno,
1971		  __entry->minlen,
1972		  __entry->maxlen,
1973		  __entry->mod,
1974		  __entry->prod,
1975		  __entry->minleft,
1976		  __entry->total,
1977		  __entry->alignment,
1978		  __entry->minalignslop,
1979		  __entry->len,
 
 
1980		  __entry->wasdel,
1981		  __entry->wasfromfl,
1982		  __entry->resv,
1983		  __entry->datatype,
1984		  __entry->highest_agno)
1985)
1986
1987#define DEFINE_ALLOC_EVENT(name) \
1988DEFINE_EVENT(xfs_alloc_class, name, \
1989	TP_PROTO(struct xfs_alloc_arg *args), \
1990	TP_ARGS(args))
1991DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1992DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
1993DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1994DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1995DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1996DEFINE_ALLOC_EVENT(xfs_alloc_cur);
1997DEFINE_ALLOC_EVENT(xfs_alloc_cur_right);
1998DEFINE_ALLOC_EVENT(xfs_alloc_cur_left);
1999DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup);
2000DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup_done);
2001DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
2002DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
2003DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
2004DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
2005DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
2006DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
2007DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
2008DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
2009DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
2010DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
2011DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
2012DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
2013DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
2014DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
2015DEFINE_ALLOC_EVENT(xfs_alloc_vextent_skip_deadlock);
2016DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
2017DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
2018DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
2019DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
2020
2021DEFINE_ALLOC_EVENT(xfs_alloc_vextent_this_ag);
2022DEFINE_ALLOC_EVENT(xfs_alloc_vextent_start_ag);
2023DEFINE_ALLOC_EVENT(xfs_alloc_vextent_first_ag);
2024DEFINE_ALLOC_EVENT(xfs_alloc_vextent_exact_bno);
2025DEFINE_ALLOC_EVENT(xfs_alloc_vextent_near_bno);
2026DEFINE_ALLOC_EVENT(xfs_alloc_vextent_finish);
2027
2028TRACE_EVENT(xfs_alloc_cur_check,
2029	TP_PROTO(struct xfs_btree_cur *cur, xfs_agblock_t bno,
2030		 xfs_extlen_t len, xfs_extlen_t diff, bool new),
2031	TP_ARGS(cur, bno, len, diff, new),
2032	TP_STRUCT__entry(
2033		__field(dev_t, dev)
2034		__string(name, cur->bc_ops->name)
2035		__field(xfs_agblock_t, bno)
2036		__field(xfs_extlen_t, len)
2037		__field(xfs_extlen_t, diff)
2038		__field(bool, new)
2039	),
2040	TP_fast_assign(
2041		__entry->dev = cur->bc_mp->m_super->s_dev;
2042		__assign_str(name);
2043		__entry->bno = bno;
2044		__entry->len = len;
2045		__entry->diff = diff;
2046		__entry->new = new;
2047	),
2048	TP_printk("dev %d:%d %sbt agbno 0x%x fsbcount 0x%x diff 0x%x new %d",
2049		  MAJOR(__entry->dev), MINOR(__entry->dev),
2050		  __get_str(name),
2051		  __entry->bno, __entry->len, __entry->diff, __entry->new)
2052)
2053
2054DECLARE_EVENT_CLASS(xfs_da_class,
2055	TP_PROTO(struct xfs_da_args *args),
2056	TP_ARGS(args),
2057	TP_STRUCT__entry(
2058		__field(dev_t, dev)
2059		__field(xfs_ino_t, ino)
2060		__dynamic_array(char, name, args->namelen)
2061		__field(int, namelen)
2062		__field(xfs_dahash_t, hashval)
2063		__field(xfs_ino_t, inumber)
2064		__field(uint32_t, op_flags)
2065		__field(xfs_ino_t, owner)
2066	),
2067	TP_fast_assign(
2068		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2069		__entry->ino = args->dp->i_ino;
2070		if (args->namelen)
2071			memcpy(__get_str(name), args->name, args->namelen);
2072		__entry->namelen = args->namelen;
2073		__entry->hashval = args->hashval;
2074		__entry->inumber = args->inumber;
2075		__entry->op_flags = args->op_flags;
2076		__entry->owner = args->owner;
2077	),
2078	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
2079		  "inumber 0x%llx op_flags %s owner 0x%llx",
2080		  MAJOR(__entry->dev), MINOR(__entry->dev),
2081		  __entry->ino,
2082		  __entry->namelen,
2083		  __entry->namelen ? __get_str(name) : NULL,
2084		  __entry->namelen,
2085		  __entry->hashval,
2086		  __entry->inumber,
2087		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
2088		  __entry->owner)
2089)
2090
2091#define DEFINE_DIR2_EVENT(name) \
2092DEFINE_EVENT(xfs_da_class, name, \
2093	TP_PROTO(struct xfs_da_args *args), \
2094	TP_ARGS(args))
2095DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
2096DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
2097DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
2098DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
2099DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
2100DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
2101DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
2102DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
2103DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
2104DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
2105DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
2106DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
2107DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
2108DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
2109DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
2110DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
2111DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
2112DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
2113DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
2114DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
2115DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
2116DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
2117DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
2118DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
2119DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
2120
2121DECLARE_EVENT_CLASS(xfs_attr_class,
2122	TP_PROTO(struct xfs_da_args *args),
2123	TP_ARGS(args),
2124	TP_STRUCT__entry(
2125		__field(dev_t, dev)
2126		__field(xfs_ino_t, ino)
2127		__dynamic_array(char, name, args->namelen)
2128		__field(int, namelen)
2129		__field(int, valuelen)
2130		__field(xfs_dahash_t, hashval)
2131		__field(unsigned int, attr_filter)
2132		__field(uint32_t, op_flags)
2133	),
2134	TP_fast_assign(
2135		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2136		__entry->ino = args->dp->i_ino;
2137		if (args->namelen)
2138			memcpy(__get_str(name), args->name, args->namelen);
2139		__entry->namelen = args->namelen;
2140		__entry->valuelen = args->valuelen;
2141		__entry->hashval = args->hashval;
2142		__entry->attr_filter = args->attr_filter;
2143		__entry->op_flags = args->op_flags;
2144	),
2145	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
2146		  "hashval 0x%x filter %s op_flags %s",
2147		  MAJOR(__entry->dev), MINOR(__entry->dev),
2148		  __entry->ino,
2149		  __entry->namelen,
2150		  __entry->namelen ? __get_str(name) : NULL,
2151		  __entry->namelen,
2152		  __entry->valuelen,
2153		  __entry->hashval,
2154		  __print_flags(__entry->attr_filter, "|",
2155				XFS_ATTR_FILTER_FLAGS),
2156		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
2157)
2158
2159#define DEFINE_ATTR_EVENT(name) \
2160DEFINE_EVENT(xfs_attr_class, name, \
2161	TP_PROTO(struct xfs_da_args *args), \
2162	TP_ARGS(args))
2163DEFINE_ATTR_EVENT(xfs_attr_sf_add);
2164DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
2165DEFINE_ATTR_EVENT(xfs_attr_sf_create);
2166DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
2167DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
 
2168DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
2169
2170DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
2171DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
2172DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
2173DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
 
2174DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
2175DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
2176DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
2177DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
2178DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
2179DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
2180DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
2181DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
2182DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
2183DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
2184DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
2185DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
2186DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
2187DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
2188DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
2189DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
2190DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
2191DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
2192
2193DEFINE_ATTR_EVENT(xfs_attr_node_addname);
2194DEFINE_ATTR_EVENT(xfs_attr_node_get);
 
2195DEFINE_ATTR_EVENT(xfs_attr_node_replace);
2196DEFINE_ATTR_EVENT(xfs_attr_node_removename);
2197
2198DEFINE_ATTR_EVENT(xfs_attr_fillstate);
2199DEFINE_ATTR_EVENT(xfs_attr_refillstate);
2200
2201DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
2202DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
 
2203
2204#define DEFINE_DA_EVENT(name) \
2205DEFINE_EVENT(xfs_da_class, name, \
2206	TP_PROTO(struct xfs_da_args *args), \
2207	TP_ARGS(args))
2208DEFINE_DA_EVENT(xfs_da_split);
2209DEFINE_DA_EVENT(xfs_da_join);
2210DEFINE_DA_EVENT(xfs_da_link_before);
2211DEFINE_DA_EVENT(xfs_da_link_after);
2212DEFINE_DA_EVENT(xfs_da_unlink_back);
2213DEFINE_DA_EVENT(xfs_da_unlink_forward);
2214DEFINE_DA_EVENT(xfs_da_root_split);
2215DEFINE_DA_EVENT(xfs_da_root_join);
2216DEFINE_DA_EVENT(xfs_da_node_add);
2217DEFINE_DA_EVENT(xfs_da_node_create);
2218DEFINE_DA_EVENT(xfs_da_node_split);
2219DEFINE_DA_EVENT(xfs_da_node_remove);
2220DEFINE_DA_EVENT(xfs_da_node_rebalance);
2221DEFINE_DA_EVENT(xfs_da_node_unbalance);
2222DEFINE_DA_EVENT(xfs_da_node_toosmall);
2223DEFINE_DA_EVENT(xfs_da_swap_lastblock);
2224DEFINE_DA_EVENT(xfs_da_grow_inode);
2225DEFINE_DA_EVENT(xfs_da_shrink_inode);
2226DEFINE_DA_EVENT(xfs_da_fixhashpath);
2227DEFINE_DA_EVENT(xfs_da_path_shift);
2228
2229DECLARE_EVENT_CLASS(xfs_dir2_space_class,
2230	TP_PROTO(struct xfs_da_args *args, int idx),
2231	TP_ARGS(args, idx),
2232	TP_STRUCT__entry(
2233		__field(dev_t, dev)
2234		__field(xfs_ino_t, ino)
2235		__field(uint32_t, op_flags)
2236		__field(int, idx)
2237	),
2238	TP_fast_assign(
2239		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2240		__entry->ino = args->dp->i_ino;
2241		__entry->op_flags = args->op_flags;
2242		__entry->idx = idx;
2243	),
2244	TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
2245		  MAJOR(__entry->dev), MINOR(__entry->dev),
2246		  __entry->ino,
2247		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
2248		  __entry->idx)
2249)
2250
2251#define DEFINE_DIR2_SPACE_EVENT(name) \
2252DEFINE_EVENT(xfs_dir2_space_class, name, \
2253	TP_PROTO(struct xfs_da_args *args, int idx), \
2254	TP_ARGS(args, idx))
2255DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
2256DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
2257DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
2258DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
2259
2260TRACE_EVENT(xfs_dir2_leafn_moveents,
2261	TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
2262	TP_ARGS(args, src_idx, dst_idx, count),
2263	TP_STRUCT__entry(
2264		__field(dev_t, dev)
2265		__field(xfs_ino_t, ino)
2266		__field(uint32_t, op_flags)
2267		__field(int, src_idx)
2268		__field(int, dst_idx)
2269		__field(int, count)
2270	),
2271	TP_fast_assign(
2272		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2273		__entry->ino = args->dp->i_ino;
2274		__entry->op_flags = args->op_flags;
2275		__entry->src_idx = src_idx;
2276		__entry->dst_idx = dst_idx;
2277		__entry->count = count;
2278	),
2279	TP_printk("dev %d:%d ino 0x%llx op_flags %s "
2280		  "src_idx %d dst_idx %d count %d",
2281		  MAJOR(__entry->dev), MINOR(__entry->dev),
2282		  __entry->ino,
2283		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
2284		  __entry->src_idx,
2285		  __entry->dst_idx,
2286		  __entry->count)
2287);
2288
2289#define XFS_SWAPEXT_INODES \
2290	{ 0,	"target" }, \
2291	{ 1,	"temp" }
2292
2293TRACE_DEFINE_ENUM(XFS_DINODE_FMT_DEV);
2294TRACE_DEFINE_ENUM(XFS_DINODE_FMT_LOCAL);
2295TRACE_DEFINE_ENUM(XFS_DINODE_FMT_EXTENTS);
2296TRACE_DEFINE_ENUM(XFS_DINODE_FMT_BTREE);
2297TRACE_DEFINE_ENUM(XFS_DINODE_FMT_UUID);
2298
2299DECLARE_EVENT_CLASS(xfs_swap_extent_class,
2300	TP_PROTO(struct xfs_inode *ip, int which),
2301	TP_ARGS(ip, which),
2302	TP_STRUCT__entry(
2303		__field(dev_t, dev)
2304		__field(int, which)
2305		__field(xfs_ino_t, ino)
2306		__field(int, format)
2307		__field(xfs_extnum_t, nex)
2308		__field(int, broot_size)
2309		__field(int, fork_off)
2310	),
2311	TP_fast_assign(
2312		__entry->dev = VFS_I(ip)->i_sb->s_dev;
2313		__entry->which = which;
2314		__entry->ino = ip->i_ino;
2315		__entry->format = ip->i_df.if_format;
2316		__entry->nex = ip->i_df.if_nextents;
2317		__entry->broot_size = ip->i_df.if_broot_bytes;
2318		__entry->fork_off = xfs_inode_fork_boff(ip);
2319	),
2320	TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %llu, "
2321		  "broot size %d, forkoff 0x%x",
2322		  MAJOR(__entry->dev), MINOR(__entry->dev),
2323		  __entry->ino,
2324		  __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
2325		  __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
2326		  __entry->nex,
2327		  __entry->broot_size,
2328		  __entry->fork_off)
2329)
2330
2331#define DEFINE_SWAPEXT_EVENT(name) \
2332DEFINE_EVENT(xfs_swap_extent_class, name, \
2333	TP_PROTO(struct xfs_inode *ip, int which), \
2334	TP_ARGS(ip, which))
2335
2336DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
2337DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
2338
2339TRACE_EVENT(xfs_log_recover,
2340	TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
2341	TP_ARGS(log, headblk, tailblk),
2342	TP_STRUCT__entry(
2343		__field(dev_t, dev)
2344		__field(xfs_daddr_t, headblk)
2345		__field(xfs_daddr_t, tailblk)
2346	),
2347	TP_fast_assign(
2348		__entry->dev = log->l_mp->m_super->s_dev;
2349		__entry->headblk = headblk;
2350		__entry->tailblk = tailblk;
2351	),
2352	TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
2353		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
2354		  __entry->tailblk)
2355)
2356
2357TRACE_EVENT(xfs_log_recover_record,
2358	TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
2359	TP_ARGS(log, rhead, pass),
2360	TP_STRUCT__entry(
2361		__field(dev_t, dev)
2362		__field(xfs_lsn_t, lsn)
2363		__field(int, len)
2364		__field(int, num_logops)
2365		__field(int, pass)
2366	),
2367	TP_fast_assign(
2368		__entry->dev = log->l_mp->m_super->s_dev;
2369		__entry->lsn = be64_to_cpu(rhead->h_lsn);
2370		__entry->len = be32_to_cpu(rhead->h_len);
2371		__entry->num_logops = be32_to_cpu(rhead->h_num_logops);
2372		__entry->pass = pass;
2373	),
2374	TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
2375		  MAJOR(__entry->dev), MINOR(__entry->dev),
2376		  __entry->lsn, __entry->len, __entry->num_logops,
2377		   __entry->pass)
2378)
2379
2380DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
2381	TP_PROTO(struct xlog *log, struct xlog_recover *trans,
2382		struct xlog_recover_item *item, int pass),
2383	TP_ARGS(log, trans, item, pass),
2384	TP_STRUCT__entry(
2385		__field(dev_t, dev)
2386		__field(unsigned long, item)
2387		__field(xlog_tid_t, tid)
2388		__field(xfs_lsn_t, lsn)
2389		__field(int, type)
2390		__field(int, pass)
2391		__field(int, count)
2392		__field(int, total)
2393	),
2394	TP_fast_assign(
2395		__entry->dev = log->l_mp->m_super->s_dev;
2396		__entry->item = (unsigned long)item;
2397		__entry->tid = trans->r_log_tid;
2398		__entry->lsn = trans->r_lsn;
2399		__entry->type = ITEM_TYPE(item);
2400		__entry->pass = pass;
2401		__entry->count = item->ri_cnt;
2402		__entry->total = item->ri_total;
2403	),
2404	TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
2405		  "item type %s item region count/total %d/%d",
2406		  MAJOR(__entry->dev), MINOR(__entry->dev),
2407		  __entry->tid,
2408		  __entry->lsn,
2409		  __entry->pass,
2410		  (void *)__entry->item,
2411		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2412		  __entry->count,
2413		  __entry->total)
2414)
2415
2416#define DEFINE_LOG_RECOVER_ITEM(name) \
2417DEFINE_EVENT(xfs_log_recover_item_class, name, \
2418	TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
2419		struct xlog_recover_item *item, int pass), \
2420	TP_ARGS(log, trans, item, pass))
2421
2422DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2423DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2424DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2425DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2426DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2427
2428DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
2429	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
2430	TP_ARGS(log, buf_f),
2431	TP_STRUCT__entry(
2432		__field(dev_t, dev)
2433		__field(int64_t, blkno)
2434		__field(unsigned short, len)
2435		__field(unsigned short, flags)
2436		__field(unsigned short, size)
2437		__field(unsigned int, map_size)
2438	),
2439	TP_fast_assign(
2440		__entry->dev = log->l_mp->m_super->s_dev;
2441		__entry->blkno = buf_f->blf_blkno;
2442		__entry->len = buf_f->blf_len;
2443		__entry->flags = buf_f->blf_flags;
2444		__entry->size = buf_f->blf_size;
2445		__entry->map_size = buf_f->blf_map_size;
2446	),
2447	TP_printk("dev %d:%d daddr 0x%llx, bbcount 0x%x, flags 0x%x, size %d, "
2448			"map_size %d",
2449		  MAJOR(__entry->dev), MINOR(__entry->dev),
2450		  __entry->blkno,
2451		  __entry->len,
2452		  __entry->flags,
2453		  __entry->size,
2454		  __entry->map_size)
2455)
2456
2457#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2458DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
2459	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
2460	TP_ARGS(log, buf_f))
2461
2462DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2463DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2464DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2465DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2466DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
2467DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
2468DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2469DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2470DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2471
2472DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
2473	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
2474	TP_ARGS(log, in_f),
2475	TP_STRUCT__entry(
2476		__field(dev_t, dev)
2477		__field(xfs_ino_t, ino)
2478		__field(unsigned short, size)
2479		__field(int, fields)
2480		__field(unsigned short, asize)
2481		__field(unsigned short, dsize)
2482		__field(int64_t, blkno)
2483		__field(int, len)
2484		__field(int, boffset)
2485	),
2486	TP_fast_assign(
2487		__entry->dev = log->l_mp->m_super->s_dev;
2488		__entry->ino = in_f->ilf_ino;
2489		__entry->size = in_f->ilf_size;
2490		__entry->fields = in_f->ilf_fields;
2491		__entry->asize = in_f->ilf_asize;
2492		__entry->dsize = in_f->ilf_dsize;
2493		__entry->blkno = in_f->ilf_blkno;
2494		__entry->len = in_f->ilf_len;
2495		__entry->boffset = in_f->ilf_boffset;
2496	),
2497	TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2498			"dsize %d, daddr 0x%llx, bbcount 0x%x, boffset %d",
2499		  MAJOR(__entry->dev), MINOR(__entry->dev),
2500		  __entry->ino,
2501		  __entry->size,
2502		  __entry->fields,
2503		  __entry->asize,
2504		  __entry->dsize,
2505		  __entry->blkno,
2506		  __entry->len,
2507		  __entry->boffset)
2508)
2509#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2510DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
2511	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
2512	TP_ARGS(log, in_f))
2513
2514DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2515DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2516DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2517
2518DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2519	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2520	TP_ARGS(log, in_f),
2521	TP_STRUCT__entry(
2522		__field(dev_t, dev)
2523		__field(xfs_agnumber_t, agno)
2524		__field(xfs_agblock_t, agbno)
2525		__field(unsigned int, count)
2526		__field(unsigned int, isize)
2527		__field(xfs_agblock_t, length)
2528		__field(unsigned int, gen)
2529	),
2530	TP_fast_assign(
2531		__entry->dev = log->l_mp->m_super->s_dev;
2532		__entry->agno = be32_to_cpu(in_f->icl_ag);
2533		__entry->agbno = be32_to_cpu(in_f->icl_agbno);
2534		__entry->count = be32_to_cpu(in_f->icl_count);
2535		__entry->isize = be32_to_cpu(in_f->icl_isize);
2536		__entry->length = be32_to_cpu(in_f->icl_length);
2537		__entry->gen = be32_to_cpu(in_f->icl_gen);
2538	),
2539	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x ireccount %u isize %u gen 0x%x",
2540		  MAJOR(__entry->dev), MINOR(__entry->dev),
2541		  __entry->agno,
2542		  __entry->agbno,
2543		  __entry->length,
2544		  __entry->count,
2545		  __entry->isize,
2546		  __entry->gen)
2547)
2548#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2549DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2550	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2551	TP_ARGS(log, in_f))
2552
2553DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2554DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2555
2556DECLARE_EVENT_CLASS(xfs_discard_class,
2557	TP_PROTO(const struct xfs_group *xg, xfs_agblock_t agbno,
2558		 xfs_extlen_t len),
2559	TP_ARGS(xg, agbno, len),
2560	TP_STRUCT__entry(
2561		__field(dev_t, dev)
2562		__field(enum xfs_group_type, type)
2563		__field(xfs_agnumber_t, agno)
2564		__field(xfs_agblock_t, agbno)
2565		__field(xfs_extlen_t, len)
2566	),
2567	TP_fast_assign(
2568		__entry->dev = xg->xg_mount->m_super->s_dev;
2569		__entry->type = xg->xg_type;
2570		__entry->agno = xg->xg_gno;
2571		__entry->agbno = agbno;
2572		__entry->len = len;
2573	),
2574	TP_printk("dev %d:%d %sno 0x%x gbno 0x%x fsbcount 0x%x",
2575		  MAJOR(__entry->dev), MINOR(__entry->dev),
2576		  __print_symbolic(__entry->type, XG_TYPE_STRINGS),
2577		  __entry->agno,
2578		  __entry->agbno,
2579		  __entry->len)
2580)
2581
2582#define DEFINE_DISCARD_EVENT(name) \
2583DEFINE_EVENT(xfs_discard_class, name, \
2584	TP_PROTO(const struct xfs_group *xg, xfs_agblock_t agbno, \
2585		 xfs_extlen_t len), \
2586	TP_ARGS(xg, agbno, len))
2587DEFINE_DISCARD_EVENT(xfs_discard_extent);
2588DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2589DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2590DEFINE_DISCARD_EVENT(xfs_discard_busy);
2591
2592DECLARE_EVENT_CLASS(xfs_rtdiscard_class,
2593	TP_PROTO(struct xfs_mount *mp,
2594		 xfs_rtblock_t rtbno, xfs_rtblock_t len),
2595	TP_ARGS(mp, rtbno, len),
2596	TP_STRUCT__entry(
2597		__field(dev_t, dev)
2598		__field(xfs_rtblock_t, rtbno)
2599		__field(xfs_rtblock_t, len)
2600	),
2601	TP_fast_assign(
2602		__entry->dev = mp->m_rtdev_targp->bt_dev;
2603		__entry->rtbno = rtbno;
2604		__entry->len = len;
2605	),
2606	TP_printk("dev %d:%d rtbno 0x%llx rtbcount 0x%llx",
2607		  MAJOR(__entry->dev), MINOR(__entry->dev),
2608		  __entry->rtbno,
2609		  __entry->len)
2610)
2611
2612#define DEFINE_RTDISCARD_EVENT(name) \
2613DEFINE_EVENT(xfs_rtdiscard_class, name, \
2614	TP_PROTO(struct xfs_mount *mp, \
2615		 xfs_rtblock_t rtbno, xfs_rtblock_t len), \
2616	TP_ARGS(mp, rtbno, len))
2617DEFINE_RTDISCARD_EVENT(xfs_discard_rtextent);
2618DEFINE_RTDISCARD_EVENT(xfs_discard_rttoosmall);
2619DEFINE_RTDISCARD_EVENT(xfs_discard_rtrelax);
2620
2621DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2622	TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2623	TP_ARGS(cur, level, bp),
2624	TP_STRUCT__entry(
2625		__field(dev_t, dev)
2626		__string(name, cur->bc_ops->name)
2627		__field(int, level)
2628		__field(int, nlevels)
2629		__field(int, ptr)
2630		__field(xfs_daddr_t, daddr)
2631	),
2632	TP_fast_assign(
2633		__entry->dev = cur->bc_mp->m_super->s_dev;
2634		__assign_str(name);
2635		__entry->level = level;
2636		__entry->nlevels = cur->bc_nlevels;
2637		__entry->ptr = cur->bc_levels[level].ptr;
2638		__entry->daddr = bp ? xfs_buf_daddr(bp) : -1;
2639	),
2640	TP_printk("dev %d:%d %sbt level %d/%d ptr %d daddr 0x%llx",
2641		  MAJOR(__entry->dev), MINOR(__entry->dev),
2642		  __get_str(name),
2643		  __entry->level,
2644		  __entry->nlevels,
2645		  __entry->ptr,
2646		  (unsigned long long)__entry->daddr)
2647)
2648
2649#define DEFINE_BTREE_CUR_EVENT(name) \
2650DEFINE_EVENT(xfs_btree_cur_class, name, \
2651	TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2652	TP_ARGS(cur, level, bp))
2653DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
2654DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
2655
2656TRACE_EVENT(xfs_btree_alloc_block,
2657	TP_PROTO(struct xfs_btree_cur *cur, union xfs_btree_ptr *ptr, int stat,
2658		 int error),
2659	TP_ARGS(cur, ptr, stat, error),
2660	TP_STRUCT__entry(
2661		__field(dev_t, dev)
2662		__field(xfs_agnumber_t, agno)
2663		__field(xfs_ino_t, ino)
2664		__string(name, cur->bc_ops->name)
2665		__field(int, error)
2666		__field(xfs_agblock_t, agbno)
2667	),
2668	TP_fast_assign(
2669		__entry->dev = cur->bc_mp->m_super->s_dev;
2670		switch (cur->bc_ops->type) {
2671		case XFS_BTREE_TYPE_INODE:
2672			__entry->agno = 0;
2673			__entry->ino = cur->bc_ino.ip->i_ino;
2674			break;
2675		case XFS_BTREE_TYPE_AG:
2676			__entry->agno = cur->bc_group->xg_gno;
2677			__entry->ino = 0;
2678			break;
2679		case XFS_BTREE_TYPE_MEM:
2680			__entry->agno = 0;
2681			__entry->ino = 0;
2682			break;
2683		}
2684		__assign_str(name);
2685		__entry->error = error;
2686		if (!error && stat) {
2687			if (cur->bc_ops->ptr_len == XFS_BTREE_LONG_PTR_LEN) {
2688				xfs_fsblock_t	fsb = be64_to_cpu(ptr->l);
2689
2690				__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp,
2691								fsb);
2692				__entry->agbno = XFS_FSB_TO_AGBNO(cur->bc_mp,
2693								fsb);
2694			} else {
2695				__entry->agbno = be32_to_cpu(ptr->s);
2696			}
2697		} else {
2698			__entry->agbno = NULLAGBLOCK;
2699		}
2700	),
2701	TP_printk("dev %d:%d %sbt agno 0x%x ino 0x%llx agbno 0x%x error %d",
2702		  MAJOR(__entry->dev), MINOR(__entry->dev),
2703		  __get_str(name),
2704		  __entry->agno,
2705		  __entry->ino,
2706		  __entry->agbno,
2707		  __entry->error)
2708);
2709
2710TRACE_EVENT(xfs_btree_free_block,
2711	TP_PROTO(struct xfs_btree_cur *cur, struct xfs_buf *bp),
2712	TP_ARGS(cur, bp),
2713	TP_STRUCT__entry(
2714		__field(dev_t, dev)
2715		__field(xfs_agnumber_t, agno)
2716		__field(xfs_ino_t, ino)
2717		__string(name, cur->bc_ops->name)
2718		__field(xfs_agblock_t, agbno)
2719	),
2720	TP_fast_assign(
2721		__entry->dev = cur->bc_mp->m_super->s_dev;
2722		__entry->agno = xfs_daddr_to_agno(cur->bc_mp,
2723							xfs_buf_daddr(bp));
2724		if (cur->bc_ops->type == XFS_BTREE_TYPE_INODE)
2725			__entry->ino = cur->bc_ino.ip->i_ino;
2726		else
2727			__entry->ino = 0;
2728		__assign_str(name);
2729		__entry->agbno = xfs_daddr_to_agbno(cur->bc_mp,
2730							xfs_buf_daddr(bp));
2731	),
2732	TP_printk("dev %d:%d %sbt agno 0x%x ino 0x%llx agbno 0x%x",
2733		  MAJOR(__entry->dev), MINOR(__entry->dev),
2734		  __get_str(name),
2735		  __entry->agno,
2736		  __entry->ino,
2737		  __entry->agbno)
2738);
2739
2740/* deferred ops */
2741struct xfs_defer_pending;
2742
2743DECLARE_EVENT_CLASS(xfs_defer_class,
2744	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
2745	TP_ARGS(tp, caller_ip),
2746	TP_STRUCT__entry(
2747		__field(dev_t, dev)
2748		__field(struct xfs_trans *, tp)
2749		__field(char, committed)
2750		__field(unsigned long, caller_ip)
2751	),
2752	TP_fast_assign(
2753		__entry->dev = tp->t_mountp->m_super->s_dev;
2754		__entry->tp = tp;
2755		__entry->caller_ip = caller_ip;
2756	),
2757	TP_printk("dev %d:%d tp %p caller %pS",
2758		  MAJOR(__entry->dev), MINOR(__entry->dev),
2759		  __entry->tp,
2760		  (char *)__entry->caller_ip)
2761)
2762#define DEFINE_DEFER_EVENT(name) \
2763DEFINE_EVENT(xfs_defer_class, name, \
2764	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
2765	TP_ARGS(tp, caller_ip))
2766
2767DECLARE_EVENT_CLASS(xfs_defer_error_class,
2768	TP_PROTO(struct xfs_trans *tp, int error),
2769	TP_ARGS(tp, error),
2770	TP_STRUCT__entry(
2771		__field(dev_t, dev)
2772		__field(struct xfs_trans *, tp)
2773		__field(char, committed)
2774		__field(int, error)
2775	),
2776	TP_fast_assign(
2777		__entry->dev = tp->t_mountp->m_super->s_dev;
2778		__entry->tp = tp;
2779		__entry->error = error;
2780	),
2781	TP_printk("dev %d:%d tp %p err %d",
2782		  MAJOR(__entry->dev), MINOR(__entry->dev),
2783		  __entry->tp,
2784		  __entry->error)
2785)
2786#define DEFINE_DEFER_ERROR_EVENT(name) \
2787DEFINE_EVENT(xfs_defer_error_class, name, \
2788	TP_PROTO(struct xfs_trans *tp, int error), \
2789	TP_ARGS(tp, error))
2790
2791DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2792	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2793	TP_ARGS(mp, dfp),
2794	TP_STRUCT__entry(
2795		__field(dev_t, dev)
2796		__string(name, dfp->dfp_ops->name)
2797		__field(void *, intent)
2798		__field(unsigned int, flags)
2799		__field(char, committed)
2800		__field(int, nr)
2801	),
2802	TP_fast_assign(
2803		__entry->dev = mp ? mp->m_super->s_dev : 0;
2804		__assign_str(name);
2805		__entry->intent = dfp->dfp_intent;
2806		__entry->flags = dfp->dfp_flags;
2807		__entry->committed = dfp->dfp_done != NULL;
2808		__entry->nr = dfp->dfp_count;
2809	),
2810	TP_printk("dev %d:%d optype %s intent %p flags %s committed %d nr %d",
2811		  MAJOR(__entry->dev), MINOR(__entry->dev),
2812		  __get_str(name),
2813		  __entry->intent,
2814		  __print_flags(__entry->flags, "|", XFS_DEFER_PENDING_STRINGS),
2815		  __entry->committed,
2816		  __entry->nr)
2817)
2818#define DEFINE_DEFER_PENDING_EVENT(name) \
2819DEFINE_EVENT(xfs_defer_pending_class, name, \
2820	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2821	TP_ARGS(mp, dfp))
2822
2823DEFINE_DEFER_EVENT(xfs_defer_cancel);
2824DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2825DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2826DEFINE_DEFER_EVENT(xfs_defer_finish);
2827DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2828
2829DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2830DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
2831
2832DEFINE_DEFER_PENDING_EVENT(xfs_defer_create_intent);
2833DEFINE_DEFER_PENDING_EVENT(xfs_defer_cancel_list);
2834DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2835DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2836DEFINE_DEFER_PENDING_EVENT(xfs_defer_relog_intent);
2837DEFINE_DEFER_PENDING_EVENT(xfs_defer_isolate_paused);
2838DEFINE_DEFER_PENDING_EVENT(xfs_defer_item_pause);
2839DEFINE_DEFER_PENDING_EVENT(xfs_defer_item_unpause);
2840
2841DECLARE_EVENT_CLASS(xfs_free_extent_deferred_class,
2842	TP_PROTO(struct xfs_mount *mp, struct xfs_extent_free_item *free),
2843	TP_ARGS(mp, free),
2844	TP_STRUCT__entry(
2845		__field(dev_t, dev)
2846		__field(enum xfs_group_type, type)
2847		__field(xfs_agnumber_t, agno)
2848		__field(xfs_agblock_t, agbno)
2849		__field(xfs_extlen_t, len)
2850		__field(unsigned int, flags)
2851	),
2852	TP_fast_assign(
2853		__entry->dev = mp->m_super->s_dev;
2854		__entry->type = free->xefi_group->xg_type;
2855		__entry->agno = free->xefi_group->xg_gno;
2856		__entry->agbno = xfs_fsb_to_gbno(mp, free->xefi_startblock,
2857						free->xefi_group->xg_type);
2858		__entry->len = free->xefi_blockcount;
2859		__entry->flags = free->xefi_flags;
2860	),
2861	TP_printk("dev %d:%d %sno 0x%x gbno 0x%x fsbcount 0x%x flags 0x%x",
2862		  MAJOR(__entry->dev), MINOR(__entry->dev),
2863		  __print_symbolic(__entry->type, XG_TYPE_STRINGS),
2864		  __entry->agno,
2865		  __entry->agbno,
2866		  __entry->len,
2867		  __entry->flags)
2868);
2869#define DEFINE_FREE_EXTENT_DEFERRED_EVENT(name) \
2870DEFINE_EVENT(xfs_free_extent_deferred_class, name, \
2871	TP_PROTO(struct xfs_mount *mp, struct xfs_extent_free_item *free), \
2872	TP_ARGS(mp, free))
2873DEFINE_FREE_EXTENT_DEFERRED_EVENT(xfs_agfl_free_deferred);
2874DEFINE_FREE_EXTENT_DEFERRED_EVENT(xfs_extent_free_defer);
2875DEFINE_FREE_EXTENT_DEFERRED_EVENT(xfs_extent_free_deferred);
2876
2877DECLARE_EVENT_CLASS(xfs_defer_pending_item_class,
2878	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp,
2879		 void *item),
2880	TP_ARGS(mp, dfp, item),
2881	TP_STRUCT__entry(
2882		__field(dev_t, dev)
2883		__string(name, dfp->dfp_ops->name)
2884		__field(void *, intent)
2885		__field(void *, item)
2886		__field(char, committed)
2887		__field(unsigned int, flags)
2888		__field(int, nr)
2889	),
2890	TP_fast_assign(
2891		__entry->dev = mp ? mp->m_super->s_dev : 0;
2892		__assign_str(name);
2893		__entry->intent = dfp->dfp_intent;
2894		__entry->item = item;
2895		__entry->committed = dfp->dfp_done != NULL;
2896		__entry->flags = dfp->dfp_flags;
2897		__entry->nr = dfp->dfp_count;
2898	),
2899	TP_printk("dev %d:%d optype %s intent %p item %p flags %s committed %d nr %d",
2900		  MAJOR(__entry->dev), MINOR(__entry->dev),
2901		  __get_str(name),
2902		  __entry->intent,
2903		  __entry->item,
2904		  __print_flags(__entry->flags, "|", XFS_DEFER_PENDING_STRINGS),
2905		  __entry->committed,
2906		  __entry->nr)
2907)
2908#define DEFINE_DEFER_PENDING_ITEM_EVENT(name) \
2909DEFINE_EVENT(xfs_defer_pending_item_class, name, \
2910	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp, \
2911		 void *item), \
2912	TP_ARGS(mp, dfp, item))
2913
2914DEFINE_DEFER_PENDING_ITEM_EVENT(xfs_defer_add_item);
2915DEFINE_DEFER_PENDING_ITEM_EVENT(xfs_defer_cancel_item);
2916DEFINE_DEFER_PENDING_ITEM_EVENT(xfs_defer_finish_item);
2917
2918/* rmap tracepoints */
2919DECLARE_EVENT_CLASS(xfs_rmap_class,
2920	TP_PROTO(struct xfs_btree_cur *cur,
2921		 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2922		 const struct xfs_owner_info *oinfo),
2923	TP_ARGS(cur, agbno, len, unwritten, oinfo),
2924	TP_STRUCT__entry(
2925		__field(dev_t, dev)
2926		__field(xfs_agnumber_t, agno)
2927		__field(xfs_agblock_t, agbno)
2928		__field(xfs_extlen_t, len)
2929		__field(uint64_t, owner)
2930		__field(uint64_t, offset)
2931		__field(unsigned long, flags)
2932	),
2933	TP_fast_assign(
2934		__entry->dev = cur->bc_mp->m_super->s_dev;
2935		__entry->agno = cur->bc_group->xg_gno;
2936		__entry->agbno = agbno;
2937		__entry->len = len;
2938		__entry->owner = oinfo->oi_owner;
2939		__entry->offset = oinfo->oi_offset;
2940		__entry->flags = oinfo->oi_flags;
2941		if (unwritten)
2942			__entry->flags |= XFS_RMAP_UNWRITTEN;
2943	),
2944	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%lx",
2945		  MAJOR(__entry->dev), MINOR(__entry->dev),
2946		  __entry->agno,
2947		  __entry->agbno,
2948		  __entry->len,
2949		  __entry->owner,
2950		  __entry->offset,
2951		  __entry->flags)
2952);
2953#define DEFINE_RMAP_EVENT(name) \
2954DEFINE_EVENT(xfs_rmap_class, name, \
2955	TP_PROTO(struct xfs_btree_cur *cur, \
2956		 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2957		 const struct xfs_owner_info *oinfo), \
2958	TP_ARGS(cur, agbno, len, unwritten, oinfo))
2959
2960/* btree cursor error/%ip tracepoint class */
2961DECLARE_EVENT_CLASS(xfs_btree_error_class,
2962	TP_PROTO(struct xfs_btree_cur *cur, int error,
2963		 unsigned long caller_ip),
2964	TP_ARGS(cur, error, caller_ip),
2965	TP_STRUCT__entry(
2966		__field(dev_t, dev)
2967		__field(xfs_agnumber_t, agno)
2968		__field(xfs_ino_t, ino)
2969		__field(int, error)
2970		__field(unsigned long, caller_ip)
2971	),
2972	TP_fast_assign(
2973		__entry->dev = cur->bc_mp->m_super->s_dev;
2974		switch (cur->bc_ops->type) {
2975		case XFS_BTREE_TYPE_INODE:
2976			__entry->agno = 0;
2977			__entry->ino = cur->bc_ino.ip->i_ino;
2978			break;
2979		case XFS_BTREE_TYPE_AG:
2980			__entry->agno = cur->bc_group->xg_gno;
2981			__entry->ino = 0;
2982			break;
2983		case XFS_BTREE_TYPE_MEM:
2984			__entry->agno = 0;
2985			__entry->ino = 0;
2986			break;
2987		}
2988		__entry->error = error;
2989		__entry->caller_ip = caller_ip;
2990	),
2991	TP_printk("dev %d:%d agno 0x%x ino 0x%llx error %d caller %pS",
2992		  MAJOR(__entry->dev), MINOR(__entry->dev),
2993		  __entry->agno,
2994		  __entry->ino,
2995		  __entry->error,
2996		  (char *)__entry->caller_ip)
2997);
2998
2999#define DEFINE_BTREE_ERROR_EVENT(name) \
3000DEFINE_EVENT(xfs_btree_error_class, name, \
3001	TP_PROTO(struct xfs_btree_cur *cur, int error, \
3002		 unsigned long caller_ip), \
3003	TP_ARGS(cur, error, caller_ip))
3004
3005DEFINE_RMAP_EVENT(xfs_rmap_unmap);
3006DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
3007DEFINE_BTREE_ERROR_EVENT(xfs_rmap_unmap_error);
3008DEFINE_RMAP_EVENT(xfs_rmap_map);
3009DEFINE_RMAP_EVENT(xfs_rmap_map_done);
3010DEFINE_BTREE_ERROR_EVENT(xfs_rmap_map_error);
3011DEFINE_RMAP_EVENT(xfs_rmap_convert);
3012DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
3013DEFINE_BTREE_ERROR_EVENT(xfs_rmap_convert_error);
3014
3015TRACE_EVENT(xfs_rmap_convert_state,
3016	TP_PROTO(struct xfs_btree_cur *cur, int state,
3017		 unsigned long caller_ip),
3018	TP_ARGS(cur, state, caller_ip),
3019	TP_STRUCT__entry(
3020		__field(dev_t, dev)
3021		__field(xfs_agnumber_t, agno)
3022		__field(xfs_ino_t, ino)
3023		__field(int, state)
3024		__field(unsigned long, caller_ip)
3025	),
3026	TP_fast_assign(
3027		__entry->dev = cur->bc_mp->m_super->s_dev;
3028		switch (cur->bc_ops->type) {
3029		case XFS_BTREE_TYPE_INODE:
3030			__entry->agno = 0;
3031			__entry->ino = cur->bc_ino.ip->i_ino;
3032			break;
3033		case XFS_BTREE_TYPE_AG:
3034			__entry->agno = cur->bc_group->xg_gno;
3035			__entry->ino = 0;
3036			break;
3037		case XFS_BTREE_TYPE_MEM:
3038			__entry->agno = 0;
3039			__entry->ino = 0;
3040			break;
3041		}
3042		__entry->state = state;
3043		__entry->caller_ip = caller_ip;
3044	),
3045	TP_printk("dev %d:%d agno 0x%x ino 0x%llx state %d caller %pS",
3046		  MAJOR(__entry->dev), MINOR(__entry->dev),
3047		  __entry->agno,
3048		  __entry->ino,
3049		  __entry->state,
3050		  (char *)__entry->caller_ip)
3051);
3052
3053DECLARE_EVENT_CLASS(xfs_rmapbt_class,
3054	TP_PROTO(struct xfs_btree_cur *cur,
3055		 xfs_agblock_t agbno, xfs_extlen_t len,
3056		 uint64_t owner, uint64_t offset, unsigned int flags),
3057	TP_ARGS(cur, agbno, len, owner, offset, flags),
3058	TP_STRUCT__entry(
3059		__field(dev_t, dev)
3060		__field(xfs_agnumber_t, agno)
3061		__field(xfs_agblock_t, agbno)
3062		__field(xfs_extlen_t, len)
3063		__field(uint64_t, owner)
3064		__field(uint64_t, offset)
3065		__field(unsigned int, flags)
3066	),
3067	TP_fast_assign(
3068		__entry->dev = cur->bc_mp->m_super->s_dev;
3069		__entry->agno = cur->bc_group->xg_gno;
3070		__entry->agbno = agbno;
3071		__entry->len = len;
3072		__entry->owner = owner;
3073		__entry->offset = offset;
3074		__entry->flags = flags;
3075	),
3076	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
3077		  MAJOR(__entry->dev), MINOR(__entry->dev),
3078		  __entry->agno,
3079		  __entry->agbno,
3080		  __entry->len,
3081		  __entry->owner,
3082		  __entry->offset,
3083		  __entry->flags)
3084);
3085#define DEFINE_RMAPBT_EVENT(name) \
3086DEFINE_EVENT(xfs_rmapbt_class, name, \
3087	TP_PROTO(struct xfs_btree_cur *cur, \
3088		 xfs_agblock_t agbno, xfs_extlen_t len, \
3089		 uint64_t owner, uint64_t offset, unsigned int flags), \
3090	TP_ARGS(cur, agbno, len, owner, offset, flags))
3091
3092TRACE_DEFINE_ENUM(XFS_RMAP_MAP);
3093TRACE_DEFINE_ENUM(XFS_RMAP_MAP_SHARED);
3094TRACE_DEFINE_ENUM(XFS_RMAP_UNMAP);
3095TRACE_DEFINE_ENUM(XFS_RMAP_UNMAP_SHARED);
3096TRACE_DEFINE_ENUM(XFS_RMAP_CONVERT);
3097TRACE_DEFINE_ENUM(XFS_RMAP_CONVERT_SHARED);
3098TRACE_DEFINE_ENUM(XFS_RMAP_ALLOC);
3099TRACE_DEFINE_ENUM(XFS_RMAP_FREE);
3100
3101DECLARE_EVENT_CLASS(xfs_rmap_deferred_class,
3102	TP_PROTO(struct xfs_mount *mp, struct xfs_rmap_intent *ri),
3103	TP_ARGS(mp, ri),
3104	TP_STRUCT__entry(
3105		__field(dev_t, dev)
3106		__field(unsigned long long, owner)
3107		__field(xfs_agnumber_t, agno)
3108		__field(xfs_agblock_t, agbno)
3109		__field(int, whichfork)
3110		__field(xfs_fileoff_t, l_loff)
3111		__field(xfs_filblks_t, l_len)
3112		__field(xfs_exntst_t, l_state)
3113		__field(int, op)
3114	),
3115	TP_fast_assign(
3116		__entry->dev = mp->m_super->s_dev;
3117		__entry->agno = XFS_FSB_TO_AGNO(mp, ri->ri_bmap.br_startblock);
3118		__entry->agbno = XFS_FSB_TO_AGBNO(mp,
3119					ri->ri_bmap.br_startblock);
3120		__entry->owner = ri->ri_owner;
3121		__entry->whichfork = ri->ri_whichfork;
3122		__entry->l_loff = ri->ri_bmap.br_startoff;
3123		__entry->l_len = ri->ri_bmap.br_blockcount;
3124		__entry->l_state = ri->ri_bmap.br_state;
3125		__entry->op = ri->ri_type;
3126	),
3127	TP_printk("dev %d:%d op %s agno 0x%x agbno 0x%x owner 0x%llx %s fileoff 0x%llx fsbcount 0x%llx state %d",
3128		  MAJOR(__entry->dev), MINOR(__entry->dev),
3129		  __print_symbolic(__entry->op, XFS_RMAP_INTENT_STRINGS),
3130		  __entry->agno,
3131		  __entry->agbno,
3132		  __entry->owner,
3133		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
3134		  __entry->l_loff,
3135		  __entry->l_len,
3136		  __entry->l_state)
3137);
3138#define DEFINE_RMAP_DEFERRED_EVENT(name) \
3139DEFINE_EVENT(xfs_rmap_deferred_class, name, \
3140	TP_PROTO(struct xfs_mount *mp, struct xfs_rmap_intent *ri), \
3141	TP_ARGS(mp, ri))
3142DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
3143DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
3144
3145DEFINE_RMAPBT_EVENT(xfs_rmap_update);
3146DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
3147DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
3148DEFINE_BTREE_ERROR_EVENT(xfs_rmap_insert_error);
3149DEFINE_BTREE_ERROR_EVENT(xfs_rmap_delete_error);
3150DEFINE_BTREE_ERROR_EVENT(xfs_rmap_update_error);
3151
3152DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
3153DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
3154DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
3155DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
3156DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
3157DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
3158DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
3159
3160/* deferred bmbt updates */
3161TRACE_DEFINE_ENUM(XFS_BMAP_MAP);
3162TRACE_DEFINE_ENUM(XFS_BMAP_UNMAP);
3163
3164DECLARE_EVENT_CLASS(xfs_bmap_deferred_class,
3165	TP_PROTO(struct xfs_bmap_intent *bi),
3166	TP_ARGS(bi),
3167	TP_STRUCT__entry(
3168		__field(dev_t, dev)
3169		__field(enum xfs_group_type, type)
3170		__field(xfs_agnumber_t, agno)
3171		__field(xfs_ino_t, ino)
3172		__field(unsigned long long, gbno)
3173		__field(int, whichfork)
3174		__field(xfs_fileoff_t, l_loff)
3175		__field(xfs_filblks_t, l_len)
3176		__field(xfs_exntst_t, l_state)
3177		__field(int, op)
3178	),
3179	TP_fast_assign(
3180		struct xfs_inode	*ip = bi->bi_owner;
3181		struct xfs_mount	*mp = ip->i_mount;
3182
3183		__entry->dev = mp->m_super->s_dev;
3184		__entry->type = bi->bi_group->xg_type;
3185		__entry->agno = bi->bi_group->xg_gno;
3186		if (bi->bi_group->xg_type == XG_TYPE_RTG &&
3187		    !xfs_has_rtgroups(mp)) {
3188			/*
3189			 * Legacy rt filesystems do not have allocation groups
3190			 * ondisk.  We emulate this incore with one gigantic
3191			 * rtgroup whose size can exceed a 32-bit block number.
3192			 * For this tracepoint, we report group 0 and a 64-bit
3193			 * group block number.
3194			 */
3195			__entry->gbno = bi->bi_bmap.br_startblock;
3196		} else {
3197			__entry->gbno = xfs_fsb_to_gbno(mp,
3198						bi->bi_bmap.br_startblock,
3199						bi->bi_group->xg_type);
3200		}
3201		__entry->ino = ip->i_ino;
3202		__entry->whichfork = bi->bi_whichfork;
3203		__entry->l_loff = bi->bi_bmap.br_startoff;
3204		__entry->l_len = bi->bi_bmap.br_blockcount;
3205		__entry->l_state = bi->bi_bmap.br_state;
3206		__entry->op = bi->bi_type;
3207	),
3208	TP_printk("dev %d:%d op %s ino 0x%llx %sno 0x%x gbno 0x%llx %s fileoff 0x%llx fsbcount 0x%llx state %d",
3209		  MAJOR(__entry->dev), MINOR(__entry->dev),
3210		  __print_symbolic(__entry->op, XFS_BMAP_INTENT_STRINGS),
3211		  __entry->ino,
3212		  __print_symbolic(__entry->type, XG_TYPE_STRINGS),
3213		  __entry->agno,
3214		  __entry->gbno,
3215		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
3216		  __entry->l_loff,
3217		  __entry->l_len,
3218		  __entry->l_state)
3219);
3220#define DEFINE_BMAP_DEFERRED_EVENT(name) \
3221DEFINE_EVENT(xfs_bmap_deferred_class, name, \
3222	TP_PROTO(struct xfs_bmap_intent *bi), \
3223	TP_ARGS(bi))
3224DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
3225DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
3226
3227/* per-AG reservation */
3228DECLARE_EVENT_CLASS(xfs_ag_resv_class,
3229	TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
3230		 xfs_extlen_t len),
3231	TP_ARGS(pag, resv, len),
3232	TP_STRUCT__entry(
3233		__field(dev_t, dev)
3234		__field(xfs_agnumber_t, agno)
3235		__field(int, resv)
3236		__field(xfs_extlen_t, freeblks)
3237		__field(xfs_extlen_t, flcount)
3238		__field(xfs_extlen_t, reserved)
3239		__field(xfs_extlen_t, asked)
3240		__field(xfs_extlen_t, len)
3241	),
3242	TP_fast_assign(
3243		struct xfs_ag_resv	*r = xfs_perag_resv(pag, resv);
3244
3245		__entry->dev = pag_mount(pag)->m_super->s_dev;
3246		__entry->agno = pag_agno(pag);
3247		__entry->resv = resv;
3248		__entry->freeblks = pag->pagf_freeblks;
3249		__entry->flcount = pag->pagf_flcount;
3250		__entry->reserved = r ? r->ar_reserved : 0;
3251		__entry->asked = r ? r->ar_asked : 0;
3252		__entry->len = len;
3253	),
3254	TP_printk("dev %d:%d agno 0x%x resv %d freeblks %u flcount %u "
3255		  "resv %u ask %u len %u",
3256		  MAJOR(__entry->dev), MINOR(__entry->dev),
3257		  __entry->agno,
3258		  __entry->resv,
3259		  __entry->freeblks,
3260		  __entry->flcount,
3261		  __entry->reserved,
3262		  __entry->asked,
3263		  __entry->len)
3264)
3265#define DEFINE_AG_RESV_EVENT(name) \
3266DEFINE_EVENT(xfs_ag_resv_class, name, \
3267	TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
3268		 xfs_extlen_t len), \
3269	TP_ARGS(pag, type, len))
3270
3271/* per-AG reservation tracepoints */
3272DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
3273DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
3274DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
3275DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
3276DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
3277DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
3278
3279TRACE_EVENT(xfs_ag_resv_init_error,
3280	TP_PROTO(const struct xfs_perag *pag, int error,
3281		 unsigned long caller_ip),
3282	TP_ARGS(pag, error, caller_ip),
3283	TP_STRUCT__entry(
3284		__field(dev_t, dev)
3285		__field(xfs_agnumber_t, agno)
3286		__field(int, error)
3287		__field(unsigned long, caller_ip)
3288	),
3289	TP_fast_assign(
3290		__entry->dev = pag_mount(pag)->m_super->s_dev;
3291		__entry->agno = pag_agno(pag);
3292		__entry->error = error;
3293		__entry->caller_ip = caller_ip;
3294	),
3295	TP_printk("dev %d:%d agno 0x%x error %d caller %pS",
3296		  MAJOR(__entry->dev), MINOR(__entry->dev),
3297		  __entry->agno,
3298		  __entry->error,
3299		  (char *)__entry->caller_ip)
3300);
3301
3302/* refcount tracepoint classes */
3303
3304DECLARE_EVENT_CLASS(xfs_refcount_class,
3305	TP_PROTO(struct xfs_btree_cur *cur, xfs_agblock_t agbno,
3306		xfs_extlen_t len),
3307	TP_ARGS(cur, agbno, len),
3308	TP_STRUCT__entry(
3309		__field(dev_t, dev)
3310		__field(xfs_agnumber_t, agno)
3311		__field(xfs_agblock_t, agbno)
3312		__field(xfs_extlen_t, len)
3313	),
3314	TP_fast_assign(
3315		__entry->dev = cur->bc_mp->m_super->s_dev;
3316		__entry->agno = cur->bc_group->xg_gno;
3317		__entry->agbno = agbno;
3318		__entry->len = len;
3319	),
3320	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
3321		  MAJOR(__entry->dev), MINOR(__entry->dev),
3322		  __entry->agno,
3323		  __entry->agbno,
3324		  __entry->len)
3325);
3326#define DEFINE_REFCOUNT_EVENT(name) \
3327DEFINE_EVENT(xfs_refcount_class, name, \
3328	TP_PROTO(struct xfs_btree_cur *cur, xfs_agblock_t agbno, \
3329		xfs_extlen_t len), \
3330	TP_ARGS(cur, agbno, len))
3331
3332TRACE_DEFINE_ENUM(XFS_LOOKUP_EQi);
3333TRACE_DEFINE_ENUM(XFS_LOOKUP_LEi);
3334TRACE_DEFINE_ENUM(XFS_LOOKUP_GEi);
3335TRACE_EVENT(xfs_refcount_lookup,
3336	TP_PROTO(struct xfs_btree_cur *cur, xfs_agblock_t agbno,
3337		xfs_lookup_t dir),
3338	TP_ARGS(cur, agbno, dir),
3339	TP_STRUCT__entry(
3340		__field(dev_t, dev)
3341		__field(xfs_agnumber_t, agno)
3342		__field(xfs_agblock_t, agbno)
3343		__field(xfs_lookup_t, dir)
3344	),
3345	TP_fast_assign(
3346		__entry->dev = cur->bc_mp->m_super->s_dev;
3347		__entry->agno = cur->bc_group->xg_gno;
3348		__entry->agbno = agbno;
3349		__entry->dir = dir;
3350	),
3351	TP_printk("dev %d:%d agno 0x%x agbno 0x%x cmp %s(%d)",
3352		  MAJOR(__entry->dev), MINOR(__entry->dev),
3353		  __entry->agno,
3354		  __entry->agbno,
3355		  __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
3356		  __entry->dir)
3357)
3358
3359/* single-rcext tracepoint class */
3360DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
3361	TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *irec),
3362	TP_ARGS(cur, irec),
3363	TP_STRUCT__entry(
3364		__field(dev_t, dev)
3365		__field(xfs_agnumber_t, agno)
3366		__field(enum xfs_refc_domain, domain)
3367		__field(xfs_agblock_t, startblock)
3368		__field(xfs_extlen_t, blockcount)
3369		__field(xfs_nlink_t, refcount)
3370	),
3371	TP_fast_assign(
3372		__entry->dev = cur->bc_mp->m_super->s_dev;
3373		__entry->agno = cur->bc_group->xg_gno;
3374		__entry->domain = irec->rc_domain;
3375		__entry->startblock = irec->rc_startblock;
3376		__entry->blockcount = irec->rc_blockcount;
3377		__entry->refcount = irec->rc_refcount;
3378	),
3379	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u",
3380		  MAJOR(__entry->dev), MINOR(__entry->dev),
3381		  __entry->agno,
3382		  __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS),
3383		  __entry->startblock,
3384		  __entry->blockcount,
3385		  __entry->refcount)
3386)
3387
3388#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
3389DEFINE_EVENT(xfs_refcount_extent_class, name, \
3390	TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *irec), \
3391	TP_ARGS(cur, irec))
3392
3393/* single-rcext and an agbno tracepoint class */
3394DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
3395	TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *irec,
3396		 xfs_agblock_t agbno),
3397	TP_ARGS(cur, irec, agbno),
3398	TP_STRUCT__entry(
3399		__field(dev_t, dev)
3400		__field(xfs_agnumber_t, agno)
3401		__field(enum xfs_refc_domain, domain)
3402		__field(xfs_agblock_t, startblock)
3403		__field(xfs_extlen_t, blockcount)
3404		__field(xfs_nlink_t, refcount)
3405		__field(xfs_agblock_t, agbno)
3406	),
3407	TP_fast_assign(
3408		__entry->dev = cur->bc_mp->m_super->s_dev;
3409		__entry->agno = cur->bc_group->xg_gno;
3410		__entry->domain = irec->rc_domain;
3411		__entry->startblock = irec->rc_startblock;
3412		__entry->blockcount = irec->rc_blockcount;
3413		__entry->refcount = irec->rc_refcount;
3414		__entry->agbno = agbno;
3415	),
3416	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x",
3417		  MAJOR(__entry->dev), MINOR(__entry->dev),
3418		  __entry->agno,
3419		  __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS),
3420		  __entry->startblock,
3421		  __entry->blockcount,
3422		  __entry->refcount,
3423		  __entry->agbno)
3424)
3425
3426#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
3427DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
3428	TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *irec, \
3429		 xfs_agblock_t agbno), \
3430	TP_ARGS(cur, irec, agbno))
3431
3432/* double-rcext tracepoint class */
3433DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
3434	TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1,
3435		struct xfs_refcount_irec *i2),
3436	TP_ARGS(cur, i1, i2),
3437	TP_STRUCT__entry(
3438		__field(dev_t, dev)
3439		__field(xfs_agnumber_t, agno)
3440		__field(enum xfs_refc_domain, i1_domain)
3441		__field(xfs_agblock_t, i1_startblock)
3442		__field(xfs_extlen_t, i1_blockcount)
3443		__field(xfs_nlink_t, i1_refcount)
3444		__field(enum xfs_refc_domain, i2_domain)
3445		__field(xfs_agblock_t, i2_startblock)
3446		__field(xfs_extlen_t, i2_blockcount)
3447		__field(xfs_nlink_t, i2_refcount)
3448	),
3449	TP_fast_assign(
3450		__entry->dev = cur->bc_mp->m_super->s_dev;
3451		__entry->agno = cur->bc_group->xg_gno;
3452		__entry->i1_domain = i1->rc_domain;
3453		__entry->i1_startblock = i1->rc_startblock;
3454		__entry->i1_blockcount = i1->rc_blockcount;
3455		__entry->i1_refcount = i1->rc_refcount;
3456		__entry->i2_domain = i2->rc_domain;
3457		__entry->i2_startblock = i2->rc_startblock;
3458		__entry->i2_blockcount = i2->rc_blockcount;
3459		__entry->i2_refcount = i2->rc_refcount;
3460	),
3461	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3462		  "dom %s agbno 0x%x fsbcount 0x%x refcount %u",
3463		  MAJOR(__entry->dev), MINOR(__entry->dev),
3464		  __entry->agno,
3465		  __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS),
3466		  __entry->i1_startblock,
3467		  __entry->i1_blockcount,
3468		  __entry->i1_refcount,
3469		  __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS),
3470		  __entry->i2_startblock,
3471		  __entry->i2_blockcount,
3472		  __entry->i2_refcount)
3473)
3474
3475#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
3476DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
3477	TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1, \
3478		 struct xfs_refcount_irec *i2), \
3479	TP_ARGS(cur, i1, i2))
3480
3481/* double-rcext and an agbno tracepoint class */
3482DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
3483	TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1,
3484		 struct xfs_refcount_irec *i2, xfs_agblock_t agbno),
3485	TP_ARGS(cur, i1, i2, agbno),
3486	TP_STRUCT__entry(
3487		__field(dev_t, dev)
3488		__field(xfs_agnumber_t, agno)
3489		__field(enum xfs_refc_domain, i1_domain)
3490		__field(xfs_agblock_t, i1_startblock)
3491		__field(xfs_extlen_t, i1_blockcount)
3492		__field(xfs_nlink_t, i1_refcount)
3493		__field(enum xfs_refc_domain, i2_domain)
3494		__field(xfs_agblock_t, i2_startblock)
3495		__field(xfs_extlen_t, i2_blockcount)
3496		__field(xfs_nlink_t, i2_refcount)
3497		__field(xfs_agblock_t, agbno)
3498	),
3499	TP_fast_assign(
3500		__entry->dev = cur->bc_mp->m_super->s_dev;
3501		__entry->agno = cur->bc_group->xg_gno;
3502		__entry->i1_domain = i1->rc_domain;
3503		__entry->i1_startblock = i1->rc_startblock;
3504		__entry->i1_blockcount = i1->rc_blockcount;
3505		__entry->i1_refcount = i1->rc_refcount;
3506		__entry->i2_domain = i2->rc_domain;
3507		__entry->i2_startblock = i2->rc_startblock;
3508		__entry->i2_blockcount = i2->rc_blockcount;
3509		__entry->i2_refcount = i2->rc_refcount;
3510		__entry->agbno = agbno;
3511	),
3512	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3513		  "dom %s agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x",
3514		  MAJOR(__entry->dev), MINOR(__entry->dev),
3515		  __entry->agno,
3516		  __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS),
3517		  __entry->i1_startblock,
3518		  __entry->i1_blockcount,
3519		  __entry->i1_refcount,
3520		  __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS),
3521		  __entry->i2_startblock,
3522		  __entry->i2_blockcount,
3523		  __entry->i2_refcount,
3524		  __entry->agbno)
3525)
3526
3527#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
3528DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
3529	TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1, \
3530		struct xfs_refcount_irec *i2, xfs_agblock_t agbno), \
3531	TP_ARGS(cur, i1, i2, agbno))
3532
3533/* triple-rcext tracepoint class */
3534DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
3535	TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1,
3536		struct xfs_refcount_irec *i2, struct xfs_refcount_irec *i3),
3537	TP_ARGS(cur, i1, i2, i3),
3538	TP_STRUCT__entry(
3539		__field(dev_t, dev)
3540		__field(xfs_agnumber_t, agno)
3541		__field(enum xfs_refc_domain, i1_domain)
3542		__field(xfs_agblock_t, i1_startblock)
3543		__field(xfs_extlen_t, i1_blockcount)
3544		__field(xfs_nlink_t, i1_refcount)
3545		__field(enum xfs_refc_domain, i2_domain)
3546		__field(xfs_agblock_t, i2_startblock)
3547		__field(xfs_extlen_t, i2_blockcount)
3548		__field(xfs_nlink_t, i2_refcount)
3549		__field(enum xfs_refc_domain, i3_domain)
3550		__field(xfs_agblock_t, i3_startblock)
3551		__field(xfs_extlen_t, i3_blockcount)
3552		__field(xfs_nlink_t, i3_refcount)
3553	),
3554	TP_fast_assign(
3555		__entry->dev = cur->bc_mp->m_super->s_dev;
3556		__entry->agno = cur->bc_group->xg_gno;
3557		__entry->i1_domain = i1->rc_domain;
3558		__entry->i1_startblock = i1->rc_startblock;
3559		__entry->i1_blockcount = i1->rc_blockcount;
3560		__entry->i1_refcount = i1->rc_refcount;
3561		__entry->i2_domain = i2->rc_domain;
3562		__entry->i2_startblock = i2->rc_startblock;
3563		__entry->i2_blockcount = i2->rc_blockcount;
3564		__entry->i2_refcount = i2->rc_refcount;
3565		__entry->i3_domain = i3->rc_domain;
3566		__entry->i3_startblock = i3->rc_startblock;
3567		__entry->i3_blockcount = i3->rc_blockcount;
3568		__entry->i3_refcount = i3->rc_refcount;
3569	),
3570	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3571		  "dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3572		  "dom %s agbno 0x%x fsbcount 0x%x refcount %u",
3573		  MAJOR(__entry->dev), MINOR(__entry->dev),
3574		  __entry->agno,
3575		  __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS),
3576		  __entry->i1_startblock,
3577		  __entry->i1_blockcount,
3578		  __entry->i1_refcount,
3579		  __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS),
3580		  __entry->i2_startblock,
3581		  __entry->i2_blockcount,
3582		  __entry->i2_refcount,
3583		  __print_symbolic(__entry->i3_domain, XFS_REFC_DOMAIN_STRINGS),
3584		  __entry->i3_startblock,
3585		  __entry->i3_blockcount,
3586		  __entry->i3_refcount)
3587);
3588
3589#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
3590DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
3591	TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1, \
3592		struct xfs_refcount_irec *i2, struct xfs_refcount_irec *i3), \
3593	TP_ARGS(cur, i1, i2, i3))
3594
3595/* refcount btree tracepoints */
3596DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
3597DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
3598DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
3599DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
3600DEFINE_BTREE_ERROR_EVENT(xfs_refcount_insert_error);
3601DEFINE_BTREE_ERROR_EVENT(xfs_refcount_delete_error);
3602DEFINE_BTREE_ERROR_EVENT(xfs_refcount_update_error);
3603
3604/* refcount adjustment tracepoints */
3605DEFINE_REFCOUNT_EVENT(xfs_refcount_increase);
3606DEFINE_REFCOUNT_EVENT(xfs_refcount_decrease);
3607DEFINE_REFCOUNT_EVENT(xfs_refcount_cow_increase);
3608DEFINE_REFCOUNT_EVENT(xfs_refcount_cow_decrease);
3609DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
3610DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
3611DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
3612DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
3613DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
3614DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
3615DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
3616DEFINE_BTREE_ERROR_EVENT(xfs_refcount_adjust_error);
3617DEFINE_BTREE_ERROR_EVENT(xfs_refcount_adjust_cow_error);
3618DEFINE_BTREE_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
3619DEFINE_BTREE_ERROR_EVENT(xfs_refcount_modify_extent_error);
3620DEFINE_BTREE_ERROR_EVENT(xfs_refcount_split_extent_error);
3621DEFINE_BTREE_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
3622DEFINE_BTREE_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
3623DEFINE_BTREE_ERROR_EVENT(xfs_refcount_find_left_extent_error);
3624DEFINE_BTREE_ERROR_EVENT(xfs_refcount_find_right_extent_error);
3625
3626/* reflink helpers */
3627DEFINE_REFCOUNT_EVENT(xfs_refcount_find_shared);
3628DEFINE_REFCOUNT_EVENT(xfs_refcount_find_shared_result);
3629DEFINE_BTREE_ERROR_EVENT(xfs_refcount_find_shared_error);
3630
3631TRACE_DEFINE_ENUM(XFS_REFCOUNT_INCREASE);
3632TRACE_DEFINE_ENUM(XFS_REFCOUNT_DECREASE);
3633TRACE_DEFINE_ENUM(XFS_REFCOUNT_ALLOC_COW);
3634TRACE_DEFINE_ENUM(XFS_REFCOUNT_FREE_COW);
3635
3636DECLARE_EVENT_CLASS(xfs_refcount_deferred_class,
3637	TP_PROTO(struct xfs_mount *mp, struct xfs_refcount_intent *refc),
3638	TP_ARGS(mp, refc),
3639	TP_STRUCT__entry(
3640		__field(dev_t, dev)
3641		__field(xfs_agnumber_t, agno)
3642		__field(int, op)
3643		__field(xfs_agblock_t, agbno)
3644		__field(xfs_extlen_t, len)
3645	),
3646	TP_fast_assign(
3647		__entry->dev = mp->m_super->s_dev;
3648		__entry->agno = XFS_FSB_TO_AGNO(mp, refc->ri_startblock);
3649		__entry->op = refc->ri_type;
3650		__entry->agbno = XFS_FSB_TO_AGBNO(mp, refc->ri_startblock);
3651		__entry->len = refc->ri_blockcount;
3652	),
3653	TP_printk("dev %d:%d op %s agno 0x%x agbno 0x%x fsbcount 0x%x",
3654		  MAJOR(__entry->dev), MINOR(__entry->dev),
3655		  __print_symbolic(__entry->op, XFS_REFCOUNT_INTENT_STRINGS),
3656		  __entry->agno,
3657		  __entry->agbno,
3658		  __entry->len)
3659);
3660#define DEFINE_REFCOUNT_DEFERRED_EVENT(name) \
3661DEFINE_EVENT(xfs_refcount_deferred_class, name, \
3662	TP_PROTO(struct xfs_mount *mp, struct xfs_refcount_intent *refc), \
3663	TP_ARGS(mp, refc))
3664DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
3665DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
3666DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_finish_one_leftover);
3667
3668/* simple inode-based error/%ip tracepoint class */
3669DECLARE_EVENT_CLASS(xfs_inode_error_class,
3670	TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
3671	TP_ARGS(ip, error, caller_ip),
3672	TP_STRUCT__entry(
3673		__field(dev_t, dev)
3674		__field(xfs_ino_t, ino)
3675		__field(int, error)
3676		__field(unsigned long, caller_ip)
3677	),
3678	TP_fast_assign(
3679		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3680		__entry->ino = ip->i_ino;
3681		__entry->error = error;
3682		__entry->caller_ip = caller_ip;
3683	),
3684	TP_printk("dev %d:%d ino 0x%llx error %d caller %pS",
3685		  MAJOR(__entry->dev), MINOR(__entry->dev),
3686		  __entry->ino,
3687		  __entry->error,
3688		  (char *)__entry->caller_ip)
3689);
3690
3691#define DEFINE_INODE_ERROR_EVENT(name) \
3692DEFINE_EVENT(xfs_inode_error_class, name, \
3693	TP_PROTO(struct xfs_inode *ip, int error, \
3694		 unsigned long caller_ip), \
3695	TP_ARGS(ip, error, caller_ip))
3696
3697/* reflink tracepoint classes */
3698
3699/* two-file io tracepoint class */
3700DECLARE_EVENT_CLASS(xfs_double_io_class,
3701	TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3702		 struct xfs_inode *dest, xfs_off_t doffset),
3703	TP_ARGS(src, soffset, len, dest, doffset),
3704	TP_STRUCT__entry(
3705		__field(dev_t, dev)
3706		__field(xfs_ino_t, src_ino)
3707		__field(loff_t, src_isize)
3708		__field(loff_t, src_disize)
3709		__field(loff_t, src_offset)
3710		__field(long long, len)
3711		__field(xfs_ino_t, dest_ino)
3712		__field(loff_t, dest_isize)
3713		__field(loff_t, dest_disize)
3714		__field(loff_t, dest_offset)
3715	),
3716	TP_fast_assign(
3717		__entry->dev = VFS_I(src)->i_sb->s_dev;
3718		__entry->src_ino = src->i_ino;
3719		__entry->src_isize = VFS_I(src)->i_size;
3720		__entry->src_disize = src->i_disk_size;
3721		__entry->src_offset = soffset;
3722		__entry->len = len;
3723		__entry->dest_ino = dest->i_ino;
3724		__entry->dest_isize = VFS_I(dest)->i_size;
3725		__entry->dest_disize = dest->i_disk_size;
3726		__entry->dest_offset = doffset;
3727	),
3728	TP_printk("dev %d:%d bytecount 0x%llx "
3729		  "ino 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx -> "
3730		  "ino 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx",
3731		  MAJOR(__entry->dev), MINOR(__entry->dev),
3732		  __entry->len,
3733		  __entry->src_ino,
3734		  __entry->src_isize,
3735		  __entry->src_disize,
3736		  __entry->src_offset,
3737		  __entry->dest_ino,
3738		  __entry->dest_isize,
3739		  __entry->dest_disize,
3740		  __entry->dest_offset)
3741)
3742
3743#define DEFINE_DOUBLE_IO_EVENT(name)	\
3744DEFINE_EVENT(xfs_double_io_class, name,	\
3745	TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3746		 struct xfs_inode *dest, xfs_off_t doffset), \
3747	TP_ARGS(src, soffset, len, dest, doffset))
3748
3749/* inode/irec events */
3750DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3751	TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3752	TP_ARGS(ip, irec),
3753	TP_STRUCT__entry(
3754		__field(dev_t, dev)
3755		__field(xfs_ino_t, ino)
3756		__field(xfs_fileoff_t, lblk)
3757		__field(xfs_extlen_t, len)
3758		__field(xfs_fsblock_t, pblk)
3759		__field(int, state)
3760	),
3761	TP_fast_assign(
3762		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3763		__entry->ino = ip->i_ino;
3764		__entry->lblk = irec->br_startoff;
3765		__entry->len = irec->br_blockcount;
3766		__entry->pblk = irec->br_startblock;
3767		__entry->state = irec->br_state;
3768	),
3769	TP_printk("dev %d:%d ino 0x%llx fileoff 0x%llx fsbcount 0x%x startblock 0x%llx st %d",
3770		  MAJOR(__entry->dev), MINOR(__entry->dev),
3771		  __entry->ino,
3772		  __entry->lblk,
3773		  __entry->len,
3774		  __entry->pblk,
3775		  __entry->state)
3776);
3777#define DEFINE_INODE_IREC_EVENT(name) \
3778DEFINE_EVENT(xfs_inode_irec_class, name, \
3779	TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3780	TP_ARGS(ip, irec))
3781
3782/* inode iomap invalidation events */
3783DECLARE_EVENT_CLASS(xfs_wb_invalid_class,
3784	TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap, unsigned int wpcseq, int whichfork),
3785	TP_ARGS(ip, iomap, wpcseq, whichfork),
3786	TP_STRUCT__entry(
3787		__field(dev_t, dev)
3788		__field(xfs_ino_t, ino)
3789		__field(u64, addr)
3790		__field(loff_t, pos)
3791		__field(u64, len)
3792		__field(u16, type)
3793		__field(u16, flags)
3794		__field(u32, wpcseq)
3795		__field(u32, forkseq)
3796	),
3797	TP_fast_assign(
3798		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3799		__entry->ino = ip->i_ino;
3800		__entry->addr = iomap->addr;
3801		__entry->pos = iomap->offset;
3802		__entry->len = iomap->length;
3803		__entry->type = iomap->type;
3804		__entry->flags = iomap->flags;
3805		__entry->wpcseq = wpcseq;
3806		__entry->forkseq = READ_ONCE(xfs_ifork_ptr(ip, whichfork)->if_seq);
3807	),
3808	TP_printk("dev %d:%d ino 0x%llx pos 0x%llx addr 0x%llx bytecount 0x%llx type 0x%x flags 0x%x wpcseq 0x%x forkseq 0x%x",
3809		  MAJOR(__entry->dev), MINOR(__entry->dev),
3810		  __entry->ino,
3811		  __entry->pos,
3812		  __entry->addr,
3813		  __entry->len,
3814		  __entry->type,
3815		  __entry->flags,
3816		  __entry->wpcseq,
3817		  __entry->forkseq)
3818);
3819#define DEFINE_WB_INVALID_EVENT(name) \
3820DEFINE_EVENT(xfs_wb_invalid_class, name, \
3821	TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap, unsigned int wpcseq, int whichfork), \
3822	TP_ARGS(ip, iomap, wpcseq, whichfork))
3823DEFINE_WB_INVALID_EVENT(xfs_wb_cow_iomap_invalid);
3824DEFINE_WB_INVALID_EVENT(xfs_wb_data_iomap_invalid);
3825
3826DECLARE_EVENT_CLASS(xfs_iomap_invalid_class,
3827	TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap),
3828	TP_ARGS(ip, iomap),
3829	TP_STRUCT__entry(
3830		__field(dev_t, dev)
3831		__field(xfs_ino_t, ino)
3832		__field(u64, addr)
3833		__field(loff_t, pos)
3834		__field(u64, len)
3835		__field(u64, validity_cookie)
3836		__field(u64, inodeseq)
3837		__field(u16, type)
3838		__field(u16, flags)
3839	),
3840	TP_fast_assign(
3841		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3842		__entry->ino = ip->i_ino;
3843		__entry->addr = iomap->addr;
3844		__entry->pos = iomap->offset;
3845		__entry->len = iomap->length;
3846		__entry->validity_cookie = iomap->validity_cookie;
3847		__entry->type = iomap->type;
3848		__entry->flags = iomap->flags;
3849		__entry->inodeseq = xfs_iomap_inode_sequence(ip, iomap->flags);
3850	),
3851	TP_printk("dev %d:%d ino 0x%llx pos 0x%llx addr 0x%llx bytecount 0x%llx type 0x%x flags 0x%x validity_cookie 0x%llx inodeseq 0x%llx",
3852		  MAJOR(__entry->dev), MINOR(__entry->dev),
3853		  __entry->ino,
3854		  __entry->pos,
3855		  __entry->addr,
3856		  __entry->len,
3857		  __entry->type,
3858		  __entry->flags,
3859		  __entry->validity_cookie,
3860		  __entry->inodeseq)
3861);
3862#define DEFINE_IOMAP_INVALID_EVENT(name) \
3863DEFINE_EVENT(xfs_iomap_invalid_class, name, \
3864	TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap), \
3865	TP_ARGS(ip, iomap))
3866DEFINE_IOMAP_INVALID_EVENT(xfs_iomap_invalid);
3867
3868/* refcount/reflink tracepoint definitions */
3869
3870/* reflink tracepoints */
3871DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3872DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3873DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3874TRACE_EVENT(xfs_reflink_remap_blocks,
3875	TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3876		 xfs_filblks_t len, struct xfs_inode *dest,
3877		 xfs_fileoff_t doffset),
3878	TP_ARGS(src, soffset, len, dest, doffset),
3879	TP_STRUCT__entry(
3880		__field(dev_t, dev)
3881		__field(xfs_ino_t, src_ino)
3882		__field(xfs_fileoff_t, src_lblk)
3883		__field(xfs_filblks_t, len)
3884		__field(xfs_ino_t, dest_ino)
3885		__field(xfs_fileoff_t, dest_lblk)
3886	),
3887	TP_fast_assign(
3888		__entry->dev = VFS_I(src)->i_sb->s_dev;
3889		__entry->src_ino = src->i_ino;
3890		__entry->src_lblk = soffset;
3891		__entry->len = len;
3892		__entry->dest_ino = dest->i_ino;
3893		__entry->dest_lblk = doffset;
3894	),
3895	TP_printk("dev %d:%d fsbcount 0x%llx "
3896		  "ino 0x%llx fileoff 0x%llx -> ino 0x%llx fileoff 0x%llx",
3897		  MAJOR(__entry->dev), MINOR(__entry->dev),
3898		  __entry->len,
3899		  __entry->src_ino,
3900		  __entry->src_lblk,
3901		  __entry->dest_ino,
3902		  __entry->dest_lblk)
3903);
3904DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3905DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3906DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3907DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
3908DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3909DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3910DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_src);
3911DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_dest);
3912
3913/* dedupe tracepoints */
3914DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3915DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3916
3917/* ioctl tracepoints */
3918TRACE_EVENT(xfs_ioctl_clone,
3919	TP_PROTO(struct inode *src, struct inode *dest),
3920	TP_ARGS(src, dest),
3921	TP_STRUCT__entry(
3922		__field(dev_t, dev)
3923		__field(unsigned long, src_ino)
3924		__field(loff_t, src_isize)
3925		__field(unsigned long, dest_ino)
3926		__field(loff_t, dest_isize)
3927	),
3928	TP_fast_assign(
3929		__entry->dev = src->i_sb->s_dev;
3930		__entry->src_ino = src->i_ino;
3931		__entry->src_isize = i_size_read(src);
3932		__entry->dest_ino = dest->i_ino;
3933		__entry->dest_isize = i_size_read(dest);
3934	),
3935	TP_printk("dev %d:%d ino 0x%lx isize 0x%llx -> ino 0x%lx isize 0x%llx",
3936		  MAJOR(__entry->dev), MINOR(__entry->dev),
3937		  __entry->src_ino,
3938		  __entry->src_isize,
3939		  __entry->dest_ino,
3940		  __entry->dest_isize)
3941);
3942
3943/* unshare tracepoints */
3944DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
3945DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
3946
3947/* copy on write */
3948DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
3949DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3950DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
3951DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
3952
3953DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3954DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3955DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_from);
3956DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_to);
3957
3958DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3959DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3960
3961
3962DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
3963
3964/* rmap swapext tracepoints */
3965DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3966DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3967DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3968
3969/* fsmap traces */
3970TRACE_EVENT(xfs_fsmap_mapping,
3971	TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3972		 const struct xfs_fsmap_irec *frec),
3973	TP_ARGS(mp, keydev, agno, frec),
3974	TP_STRUCT__entry(
3975		__field(dev_t, dev)
3976		__field(dev_t, keydev)
3977		__field(xfs_agnumber_t, agno)
3978		__field(xfs_agblock_t, agbno)
3979		__field(xfs_daddr_t, start_daddr)
3980		__field(xfs_daddr_t, len_daddr)
3981		__field(uint64_t, owner)
3982		__field(uint64_t, offset)
3983		__field(unsigned int, flags)
3984	),
3985	TP_fast_assign(
3986		__entry->dev = mp->m_super->s_dev;
3987		__entry->keydev = new_decode_dev(keydev);
3988		__entry->agno = agno;
3989		__entry->agbno = frec->rec_key;
3990		__entry->start_daddr = frec->start_daddr;
3991		__entry->len_daddr = frec->len_daddr;
3992		__entry->owner = frec->owner;
3993		__entry->offset = frec->offset;
3994		__entry->flags = frec->rm_flags;
3995	),
3996	TP_printk("dev %d:%d keydev %d:%d agno 0x%x rmapbno 0x%x start_daddr 0x%llx len_daddr 0x%llx owner 0x%llx fileoff 0x%llx flags 0x%x",
3997		  MAJOR(__entry->dev), MINOR(__entry->dev),
3998		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
3999		  __entry->agno,
4000		  __entry->agbno,
4001		  __entry->start_daddr,
4002		  __entry->len_daddr,
4003		  __entry->owner,
4004		  __entry->offset,
4005		  __entry->flags)
4006);
4007
4008DECLARE_EVENT_CLASS(xfs_fsmap_group_key_class,
4009	TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
4010		 const struct xfs_rmap_irec *rmap),
4011	TP_ARGS(mp, keydev, agno, rmap),
4012	TP_STRUCT__entry(
4013		__field(dev_t, dev)
4014		__field(dev_t, keydev)
4015		__field(xfs_agnumber_t, agno)
4016		__field(xfs_agblock_t, agbno)
4017		__field(uint64_t, owner)
4018		__field(uint64_t, offset)
4019		__field(unsigned int, flags)
4020	),
4021	TP_fast_assign(
4022		__entry->dev = mp->m_super->s_dev;
4023		__entry->keydev = new_decode_dev(keydev);
4024		__entry->agno = agno;
4025		__entry->agbno = rmap->rm_startblock;
4026		__entry->owner = rmap->rm_owner;
4027		__entry->offset = rmap->rm_offset;
4028		__entry->flags = rmap->rm_flags;
4029	),
4030	TP_printk("dev %d:%d keydev %d:%d agno 0x%x startblock 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
4031		  MAJOR(__entry->dev), MINOR(__entry->dev),
4032		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
4033		  __entry->agno,
4034		  __entry->agbno,
4035		  __entry->owner,
4036		  __entry->offset,
4037		  __entry->flags)
4038)
4039#define DEFINE_FSMAP_GROUP_KEY_EVENT(name) \
4040DEFINE_EVENT(xfs_fsmap_group_key_class, name, \
4041	TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
4042		 const struct xfs_rmap_irec *rmap), \
4043	TP_ARGS(mp, keydev, agno, rmap))
4044DEFINE_FSMAP_GROUP_KEY_EVENT(xfs_fsmap_low_group_key);
4045DEFINE_FSMAP_GROUP_KEY_EVENT(xfs_fsmap_high_group_key);
4046
4047DECLARE_EVENT_CLASS(xfs_fsmap_linear_key_class,
4048	TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_fsblock_t bno),
4049	TP_ARGS(mp, keydev, bno),
4050	TP_STRUCT__entry(
4051		__field(dev_t, dev)
4052		__field(dev_t, keydev)
4053		__field(xfs_fsblock_t, bno)
4054	),
4055	TP_fast_assign(
4056		__entry->dev = mp->m_super->s_dev;
4057		__entry->keydev = new_decode_dev(keydev);
4058		__entry->bno = bno;
4059	),
4060	TP_printk("dev %d:%d keydev %d:%d bno 0x%llx",
4061		  MAJOR(__entry->dev), MINOR(__entry->dev),
4062		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
4063		  __entry->bno)
4064)
4065#define DEFINE_FSMAP_LINEAR_KEY_EVENT(name) \
4066DEFINE_EVENT(xfs_fsmap_linear_key_class, name, \
4067	TP_PROTO(struct xfs_mount *mp, u32 keydev, uint64_t bno), \
4068	TP_ARGS(mp, keydev, bno))
4069DEFINE_FSMAP_LINEAR_KEY_EVENT(xfs_fsmap_low_linear_key);
4070DEFINE_FSMAP_LINEAR_KEY_EVENT(xfs_fsmap_high_linear_key);
4071
4072DECLARE_EVENT_CLASS(xfs_getfsmap_class,
4073	TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
4074	TP_ARGS(mp, fsmap),
4075	TP_STRUCT__entry(
4076		__field(dev_t, dev)
4077		__field(dev_t, keydev)
4078		__field(xfs_daddr_t, block)
4079		__field(xfs_daddr_t, len)
4080		__field(uint64_t, owner)
4081		__field(uint64_t, offset)
4082		__field(uint64_t, flags)
4083	),
4084	TP_fast_assign(
4085		__entry->dev = mp->m_super->s_dev;
4086		__entry->keydev = new_decode_dev(fsmap->fmr_device);
4087		__entry->block = fsmap->fmr_physical;
4088		__entry->len = fsmap->fmr_length;
4089		__entry->owner = fsmap->fmr_owner;
4090		__entry->offset = fsmap->fmr_offset;
4091		__entry->flags = fsmap->fmr_flags;
4092	),
4093	TP_printk("dev %d:%d keydev %d:%d daddr 0x%llx bbcount 0x%llx owner 0x%llx fileoff_daddr 0x%llx flags 0x%llx",
4094		  MAJOR(__entry->dev), MINOR(__entry->dev),
4095		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
4096		  __entry->block,
4097		  __entry->len,
4098		  __entry->owner,
4099		  __entry->offset,
4100		  __entry->flags)
4101)
4102#define DEFINE_GETFSMAP_EVENT(name) \
4103DEFINE_EVENT(xfs_getfsmap_class, name, \
4104	TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
4105	TP_ARGS(mp, fsmap))
4106DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
4107DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
4108DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
4109
4110DECLARE_EVENT_CLASS(xfs_trans_resv_class,
4111	TP_PROTO(struct xfs_mount *mp, unsigned int type,
4112		 struct xfs_trans_res *res),
4113	TP_ARGS(mp, type, res),
4114	TP_STRUCT__entry(
4115		__field(dev_t, dev)
4116		__field(int, type)
4117		__field(uint, logres)
4118		__field(int, logcount)
4119		__field(int, logflags)
4120	),
4121	TP_fast_assign(
4122		__entry->dev = mp->m_super->s_dev;
4123		__entry->type = type;
4124		__entry->logres = res->tr_logres;
4125		__entry->logcount = res->tr_logcount;
4126		__entry->logflags = res->tr_logflags;
4127	),
4128	TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
4129		  MAJOR(__entry->dev), MINOR(__entry->dev),
4130		  __entry->type,
4131		  __entry->logres,
4132		  __entry->logcount,
4133		  __entry->logflags)
4134)
4135
4136#define DEFINE_TRANS_RESV_EVENT(name) \
4137DEFINE_EVENT(xfs_trans_resv_class, name, \
4138	TP_PROTO(struct xfs_mount *mp, unsigned int type, \
4139		 struct xfs_trans_res *res), \
4140	TP_ARGS(mp, type, res))
4141DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc);
4142DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc_minlogsize);
4143
4144TRACE_EVENT(xfs_log_get_max_trans_res,
4145	TP_PROTO(struct xfs_mount *mp, const struct xfs_trans_res *res),
4146	TP_ARGS(mp, res),
4147	TP_STRUCT__entry(
4148		__field(dev_t, dev)
4149		__field(uint, logres)
4150		__field(int, logcount)
4151	),
4152	TP_fast_assign(
4153		__entry->dev = mp->m_super->s_dev;
4154		__entry->logres = res->tr_logres;
4155		__entry->logcount = res->tr_logcount;
4156	),
4157	TP_printk("dev %d:%d logres %u logcount %d",
4158		  MAJOR(__entry->dev), MINOR(__entry->dev),
4159		  __entry->logres,
4160		  __entry->logcount)
4161);
4162
4163DECLARE_EVENT_CLASS(xfs_trans_class,
4164	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
4165	TP_ARGS(tp, caller_ip),
4166	TP_STRUCT__entry(
4167		__field(dev_t, dev)
4168		__field(uint32_t, tid)
4169		__field(uint32_t, flags)
4170		__field(unsigned long, caller_ip)
4171	),
4172	TP_fast_assign(
4173		__entry->dev = tp->t_mountp->m_super->s_dev;
4174		__entry->tid = 0;
4175		if (tp->t_ticket)
4176			__entry->tid = tp->t_ticket->t_tid;
4177		__entry->flags = tp->t_flags;
4178		__entry->caller_ip = caller_ip;
4179	),
4180	TP_printk("dev %d:%d trans %x flags 0x%x caller %pS",
4181		  MAJOR(__entry->dev), MINOR(__entry->dev),
4182		  __entry->tid,
4183		  __entry->flags,
4184		  (char *)__entry->caller_ip)
4185)
4186
4187#define DEFINE_TRANS_EVENT(name) \
4188DEFINE_EVENT(xfs_trans_class, name, \
4189	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
4190	TP_ARGS(tp, caller_ip))
4191DEFINE_TRANS_EVENT(xfs_trans_alloc);
4192DEFINE_TRANS_EVENT(xfs_trans_cancel);
4193DEFINE_TRANS_EVENT(xfs_trans_commit);
4194DEFINE_TRANS_EVENT(xfs_trans_dup);
4195DEFINE_TRANS_EVENT(xfs_trans_free);
4196DEFINE_TRANS_EVENT(xfs_trans_roll);
4197DEFINE_TRANS_EVENT(xfs_trans_add_item);
4198DEFINE_TRANS_EVENT(xfs_trans_commit_items);
4199DEFINE_TRANS_EVENT(xfs_trans_free_items);
4200
4201TRACE_EVENT(xfs_iunlink_update_bucket,
4202	TP_PROTO(const struct xfs_perag *pag, unsigned int bucket,
4203		 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
4204	TP_ARGS(pag, bucket, old_ptr, new_ptr),
4205	TP_STRUCT__entry(
4206		__field(dev_t, dev)
4207		__field(xfs_agnumber_t, agno)
4208		__field(unsigned int, bucket)
4209		__field(xfs_agino_t, old_ptr)
4210		__field(xfs_agino_t, new_ptr)
4211	),
4212	TP_fast_assign(
4213		__entry->dev = pag_mount(pag)->m_super->s_dev;
4214		__entry->agno = pag_agno(pag);
4215		__entry->bucket = bucket;
4216		__entry->old_ptr = old_ptr;
4217		__entry->new_ptr = new_ptr;
4218	),
4219	TP_printk("dev %d:%d agno 0x%x bucket %u old 0x%x new 0x%x",
4220		  MAJOR(__entry->dev), MINOR(__entry->dev),
4221		  __entry->agno,
4222		  __entry->bucket,
4223		  __entry->old_ptr,
4224		  __entry->new_ptr)
4225);
4226
4227TRACE_EVENT(xfs_iunlink_update_dinode,
4228	TP_PROTO(const struct xfs_iunlink_item *iup, xfs_agino_t old_ptr),
4229	TP_ARGS(iup, old_ptr),
4230	TP_STRUCT__entry(
4231		__field(dev_t, dev)
4232		__field(xfs_agnumber_t, agno)
4233		__field(xfs_agino_t, agino)
4234		__field(xfs_agino_t, old_ptr)
4235		__field(xfs_agino_t, new_ptr)
4236	),
4237	TP_fast_assign(
4238		__entry->dev = pag_mount(iup->pag)->m_super->s_dev;
4239		__entry->agno = pag_agno(iup->pag);
4240		__entry->agino =
4241			XFS_INO_TO_AGINO(iup->ip->i_mount, iup->ip->i_ino);
4242		__entry->old_ptr = old_ptr;
4243		__entry->new_ptr = iup->next_agino;
4244	),
4245	TP_printk("dev %d:%d agno 0x%x agino 0x%x old 0x%x new 0x%x",
4246		  MAJOR(__entry->dev), MINOR(__entry->dev),
4247		  __entry->agno,
4248		  __entry->agino,
4249		  __entry->old_ptr,
4250		  __entry->new_ptr)
4251);
4252
4253TRACE_EVENT(xfs_iunlink_reload_next,
4254	TP_PROTO(struct xfs_inode *ip),
4255	TP_ARGS(ip),
4256	TP_STRUCT__entry(
4257		__field(dev_t, dev)
4258		__field(xfs_agnumber_t, agno)
4259		__field(xfs_agino_t, agino)
4260		__field(xfs_agino_t, prev_agino)
4261		__field(xfs_agino_t, next_agino)
4262	),
4263	TP_fast_assign(
4264		__entry->dev = ip->i_mount->m_super->s_dev;
4265		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
4266		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
4267		__entry->prev_agino = ip->i_prev_unlinked;
4268		__entry->next_agino = ip->i_next_unlinked;
4269	),
4270	TP_printk("dev %d:%d agno 0x%x agino 0x%x prev_unlinked 0x%x next_unlinked 0x%x",
4271		  MAJOR(__entry->dev), MINOR(__entry->dev),
4272		  __entry->agno,
4273		  __entry->agino,
4274		  __entry->prev_agino,
4275		  __entry->next_agino)
4276);
4277
4278TRACE_EVENT(xfs_inode_reload_unlinked_bucket,
4279	TP_PROTO(struct xfs_inode *ip),
4280	TP_ARGS(ip),
4281	TP_STRUCT__entry(
4282		__field(dev_t, dev)
4283		__field(xfs_agnumber_t, agno)
4284		__field(xfs_agino_t, agino)
4285	),
4286	TP_fast_assign(
4287		__entry->dev = ip->i_mount->m_super->s_dev;
4288		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
4289		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
4290	),
4291	TP_printk("dev %d:%d agno 0x%x agino 0x%x bucket %u",
4292		  MAJOR(__entry->dev), MINOR(__entry->dev),
4293		  __entry->agno,
4294		  __entry->agino,
4295		  __entry->agino % XFS_AGI_UNLINKED_BUCKETS)
4296);
4297
4298DECLARE_EVENT_CLASS(xfs_ag_inode_class,
4299	TP_PROTO(struct xfs_inode *ip),
4300	TP_ARGS(ip),
4301	TP_STRUCT__entry(
4302		__field(dev_t, dev)
4303		__field(xfs_agnumber_t, agno)
4304		__field(xfs_agino_t, agino)
4305	),
4306	TP_fast_assign(
4307		__entry->dev = VFS_I(ip)->i_sb->s_dev;
4308		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
4309		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
4310	),
4311	TP_printk("dev %d:%d agno 0x%x agino 0x%x",
4312		  MAJOR(__entry->dev), MINOR(__entry->dev),
4313		  __entry->agno, __entry->agino)
4314)
4315
4316#define DEFINE_AGINODE_EVENT(name) \
4317DEFINE_EVENT(xfs_ag_inode_class, name, \
4318	TP_PROTO(struct xfs_inode *ip), \
4319	TP_ARGS(ip))
4320DEFINE_AGINODE_EVENT(xfs_iunlink);
4321DEFINE_AGINODE_EVENT(xfs_iunlink_remove);
4322
4323DECLARE_EVENT_CLASS(xfs_fs_corrupt_class,
4324	TP_PROTO(struct xfs_mount *mp, unsigned int flags),
4325	TP_ARGS(mp, flags),
4326	TP_STRUCT__entry(
4327		__field(dev_t, dev)
4328		__field(unsigned int, flags)
4329	),
4330	TP_fast_assign(
4331		__entry->dev = mp->m_super->s_dev;
4332		__entry->flags = flags;
4333	),
4334	TP_printk("dev %d:%d flags 0x%x",
4335		  MAJOR(__entry->dev), MINOR(__entry->dev),
4336		  __entry->flags)
4337);
4338#define DEFINE_FS_CORRUPT_EVENT(name)	\
4339DEFINE_EVENT(xfs_fs_corrupt_class, name,	\
4340	TP_PROTO(struct xfs_mount *mp, unsigned int flags), \
4341	TP_ARGS(mp, flags))
4342DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_sick);
4343DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_corrupt);
4344DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_healthy);
4345DEFINE_FS_CORRUPT_EVENT(xfs_fs_unfixed_corruption);
4346
4347DECLARE_EVENT_CLASS(xfs_group_corrupt_class,
4348	TP_PROTO(const struct xfs_group *xg, unsigned int flags),
4349	TP_ARGS(xg, flags),
4350	TP_STRUCT__entry(
4351		__field(dev_t, dev)
4352		__field(enum xfs_group_type, type)
4353		__field(uint32_t, index)
4354		__field(unsigned int, flags)
4355	),
4356	TP_fast_assign(
4357		__entry->dev = xg->xg_mount->m_super->s_dev;
4358		__entry->type = xg->xg_type;
4359		__entry->index = xg->xg_gno;
4360		__entry->flags = flags;
4361	),
4362	TP_printk("dev %d:%d %sno 0x%x flags 0x%x",
4363		  MAJOR(__entry->dev), MINOR(__entry->dev),
4364		  __print_symbolic(__entry->type, XG_TYPE_STRINGS),
4365		  __entry->index, __entry->flags)
4366);
4367#define DEFINE_GROUP_CORRUPT_EVENT(name)	\
4368DEFINE_EVENT(xfs_group_corrupt_class, name,	\
4369	TP_PROTO(const struct xfs_group *xg, unsigned int flags), \
4370	TP_ARGS(xg, flags))
4371DEFINE_GROUP_CORRUPT_EVENT(xfs_group_mark_sick);
4372DEFINE_GROUP_CORRUPT_EVENT(xfs_group_mark_corrupt);
4373DEFINE_GROUP_CORRUPT_EVENT(xfs_group_mark_healthy);
4374DEFINE_GROUP_CORRUPT_EVENT(xfs_group_unfixed_corruption);
4375
4376DECLARE_EVENT_CLASS(xfs_inode_corrupt_class,
4377	TP_PROTO(struct xfs_inode *ip, unsigned int flags),
4378	TP_ARGS(ip, flags),
4379	TP_STRUCT__entry(
4380		__field(dev_t, dev)
4381		__field(xfs_ino_t, ino)
4382		__field(unsigned int, flags)
4383	),
4384	TP_fast_assign(
4385		__entry->dev = ip->i_mount->m_super->s_dev;
4386		__entry->ino = ip->i_ino;
4387		__entry->flags = flags;
4388	),
4389	TP_printk("dev %d:%d ino 0x%llx flags 0x%x",
4390		  MAJOR(__entry->dev), MINOR(__entry->dev),
4391		  __entry->ino, __entry->flags)
4392);
4393#define DEFINE_INODE_CORRUPT_EVENT(name)	\
4394DEFINE_EVENT(xfs_inode_corrupt_class, name,	\
4395	TP_PROTO(struct xfs_inode *ip, unsigned int flags), \
4396	TP_ARGS(ip, flags))
4397DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_sick);
4398DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_corrupt);
4399DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_healthy);
4400DEFINE_INODE_CORRUPT_EVENT(xfs_inode_unfixed_corruption);
4401
4402TRACE_EVENT(xfs_iwalk_ag_rec,
4403	TP_PROTO(const struct xfs_perag *pag, \
4404		 struct xfs_inobt_rec_incore *irec),
4405	TP_ARGS(pag, irec),
4406	TP_STRUCT__entry(
4407		__field(dev_t, dev)
4408		__field(xfs_agnumber_t, agno)
4409		__field(xfs_agino_t, startino)
4410		__field(uint64_t, freemask)
4411	),
4412	TP_fast_assign(
4413		__entry->dev = pag_mount(pag)->m_super->s_dev;
4414		__entry->agno = pag_agno(pag);
4415		__entry->startino = irec->ir_startino;
4416		__entry->freemask = irec->ir_free;
4417	),
4418	TP_printk("dev %d:%d agno 0x%x startino 0x%x freemask 0x%llx",
4419		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
4420		  __entry->startino, __entry->freemask)
4421)
4422
4423TRACE_EVENT(xfs_pwork_init,
4424	TP_PROTO(struct xfs_mount *mp, unsigned int nr_threads, pid_t pid),
4425	TP_ARGS(mp, nr_threads, pid),
4426	TP_STRUCT__entry(
4427		__field(dev_t, dev)
4428		__field(unsigned int, nr_threads)
4429		__field(pid_t, pid)
4430	),
4431	TP_fast_assign(
4432		__entry->dev = mp->m_super->s_dev;
4433		__entry->nr_threads = nr_threads;
4434		__entry->pid = pid;
4435	),
4436	TP_printk("dev %d:%d nr_threads %u pid %u",
4437		  MAJOR(__entry->dev), MINOR(__entry->dev),
4438		  __entry->nr_threads, __entry->pid)
4439)
4440
4441TRACE_EVENT(xfs_check_new_dalign,
4442	TP_PROTO(struct xfs_mount *mp, int new_dalign, xfs_ino_t calc_rootino),
4443	TP_ARGS(mp, new_dalign, calc_rootino),
4444	TP_STRUCT__entry(
4445		__field(dev_t, dev)
4446		__field(int, new_dalign)
4447		__field(xfs_ino_t, sb_rootino)
4448		__field(xfs_ino_t, calc_rootino)
4449	),
4450	TP_fast_assign(
4451		__entry->dev = mp->m_super->s_dev;
4452		__entry->new_dalign = new_dalign;
4453		__entry->sb_rootino = mp->m_sb.sb_rootino;
4454		__entry->calc_rootino = calc_rootino;
4455	),
4456	TP_printk("dev %d:%d new_dalign %d sb_rootino 0x%llx calc_rootino 0x%llx",
4457		  MAJOR(__entry->dev), MINOR(__entry->dev),
4458		  __entry->new_dalign, __entry->sb_rootino,
4459		  __entry->calc_rootino)
4460)
4461
4462TRACE_EVENT(xfs_btree_commit_afakeroot,
4463	TP_PROTO(struct xfs_btree_cur *cur),
4464	TP_ARGS(cur),
4465	TP_STRUCT__entry(
4466		__field(dev_t, dev)
4467		__string(name, cur->bc_ops->name)
4468		__field(xfs_agnumber_t, agno)
4469		__field(xfs_agblock_t, agbno)
4470		__field(unsigned int, levels)
4471		__field(unsigned int, blocks)
4472	),
4473	TP_fast_assign(
4474		__entry->dev = cur->bc_mp->m_super->s_dev;
4475		__assign_str(name);
4476		__entry->agno = cur->bc_group->xg_gno;
4477		__entry->agbno = cur->bc_ag.afake->af_root;
4478		__entry->levels = cur->bc_ag.afake->af_levels;
4479		__entry->blocks = cur->bc_ag.afake->af_blocks;
4480	),
4481	TP_printk("dev %d:%d %sbt agno 0x%x levels %u blocks %u root %u",
4482		  MAJOR(__entry->dev), MINOR(__entry->dev),
4483		  __get_str(name),
4484		  __entry->agno,
4485		  __entry->levels,
4486		  __entry->blocks,
4487		  __entry->agbno)
4488)
4489
4490TRACE_EVENT(xfs_btree_commit_ifakeroot,
4491	TP_PROTO(struct xfs_btree_cur *cur),
4492	TP_ARGS(cur),
4493	TP_STRUCT__entry(
4494		__field(dev_t, dev)
4495		__string(name, cur->bc_ops->name)
4496		__field(xfs_agnumber_t, agno)
4497		__field(xfs_agino_t, agino)
4498		__field(unsigned int, levels)
4499		__field(unsigned int, blocks)
4500		__field(int, whichfork)
4501	),
4502	TP_fast_assign(
4503		__entry->dev = cur->bc_mp->m_super->s_dev;
4504		__assign_str(name);
4505		__entry->agno = XFS_INO_TO_AGNO(cur->bc_mp,
4506					cur->bc_ino.ip->i_ino);
4507		__entry->agino = XFS_INO_TO_AGINO(cur->bc_mp,
4508					cur->bc_ino.ip->i_ino);
4509		__entry->levels = cur->bc_ino.ifake->if_levels;
4510		__entry->blocks = cur->bc_ino.ifake->if_blocks;
4511		__entry->whichfork = cur->bc_ino.whichfork;
4512	),
4513	TP_printk("dev %d:%d %sbt agno 0x%x agino 0x%x whichfork %s levels %u blocks %u",
4514		  MAJOR(__entry->dev), MINOR(__entry->dev),
4515		  __get_str(name),
4516		  __entry->agno,
4517		  __entry->agino,
4518		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
4519		  __entry->levels,
4520		  __entry->blocks)
4521)
4522
4523TRACE_EVENT(xfs_btree_bload_level_geometry,
4524	TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
4525		 uint64_t nr_this_level, unsigned int nr_per_block,
4526		 unsigned int desired_npb, uint64_t blocks,
4527		 uint64_t blocks_with_extra),
4528	TP_ARGS(cur, level, nr_this_level, nr_per_block, desired_npb, blocks,
4529		blocks_with_extra),
4530	TP_STRUCT__entry(
4531		__field(dev_t, dev)
4532		__string(name, cur->bc_ops->name)
4533		__field(unsigned int, level)
4534		__field(unsigned int, nlevels)
4535		__field(uint64_t, nr_this_level)
4536		__field(unsigned int, nr_per_block)
4537		__field(unsigned int, desired_npb)
4538		__field(unsigned long long, blocks)
4539		__field(unsigned long long, blocks_with_extra)
4540	),
4541	TP_fast_assign(
4542		__entry->dev = cur->bc_mp->m_super->s_dev;
4543		__assign_str(name);
4544		__entry->level = level;
4545		__entry->nlevels = cur->bc_nlevels;
4546		__entry->nr_this_level = nr_this_level;
4547		__entry->nr_per_block = nr_per_block;
4548		__entry->desired_npb = desired_npb;
4549		__entry->blocks = blocks;
4550		__entry->blocks_with_extra = blocks_with_extra;
4551	),
4552	TP_printk("dev %d:%d %sbt level %u/%u nr_this_level %llu nr_per_block %u desired_npb %u blocks %llu blocks_with_extra %llu",
4553		  MAJOR(__entry->dev), MINOR(__entry->dev),
4554		  __get_str(name),
4555		  __entry->level,
4556		  __entry->nlevels,
4557		  __entry->nr_this_level,
4558		  __entry->nr_per_block,
4559		  __entry->desired_npb,
4560		  __entry->blocks,
4561		  __entry->blocks_with_extra)
4562)
4563
4564TRACE_EVENT(xfs_btree_bload_block,
4565	TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
4566		 uint64_t block_idx, uint64_t nr_blocks,
4567		 union xfs_btree_ptr *ptr, unsigned int nr_records),
4568	TP_ARGS(cur, level, block_idx, nr_blocks, ptr, nr_records),
4569	TP_STRUCT__entry(
4570		__field(dev_t, dev)
4571		__string(name, cur->bc_ops->name)
4572		__field(unsigned int, level)
4573		__field(unsigned long long, block_idx)
4574		__field(unsigned long long, nr_blocks)
4575		__field(xfs_agnumber_t, agno)
4576		__field(xfs_agblock_t, agbno)
4577		__field(unsigned int, nr_records)
4578	),
4579	TP_fast_assign(
4580		__entry->dev = cur->bc_mp->m_super->s_dev;
4581		__assign_str(name);
4582		__entry->level = level;
4583		__entry->block_idx = block_idx;
4584		__entry->nr_blocks = nr_blocks;
4585		if (cur->bc_ops->ptr_len == XFS_BTREE_LONG_PTR_LEN) {
4586			xfs_fsblock_t	fsb = be64_to_cpu(ptr->l);
4587
4588			__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsb);
4589			__entry->agbno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsb);
4590		} else {
4591			__entry->agno = cur->bc_group->xg_gno;
4592			__entry->agbno = be32_to_cpu(ptr->s);
4593		}
4594		__entry->nr_records = nr_records;
4595	),
4596	TP_printk("dev %d:%d %sbt level %u block %llu/%llu agno 0x%x agbno 0x%x recs %u",
4597		  MAJOR(__entry->dev), MINOR(__entry->dev),
4598		  __get_str(name),
4599		  __entry->level,
4600		  __entry->block_idx,
4601		  __entry->nr_blocks,
4602		  __entry->agno,
4603		  __entry->agbno,
4604		  __entry->nr_records)
4605)
4606
4607DECLARE_EVENT_CLASS(xfs_timestamp_range_class,
4608	TP_PROTO(struct xfs_mount *mp, time64_t min, time64_t max),
4609	TP_ARGS(mp, min, max),
4610	TP_STRUCT__entry(
4611		__field(dev_t, dev)
4612		__field(long long, min)
4613		__field(long long, max)
4614	),
4615	TP_fast_assign(
4616		__entry->dev = mp->m_super->s_dev;
4617		__entry->min = min;
4618		__entry->max = max;
4619	),
4620	TP_printk("dev %d:%d min %lld max %lld",
4621		  MAJOR(__entry->dev), MINOR(__entry->dev),
4622		  __entry->min,
4623		  __entry->max)
4624)
4625
4626#define DEFINE_TIMESTAMP_RANGE_EVENT(name) \
4627DEFINE_EVENT(xfs_timestamp_range_class, name, \
4628	TP_PROTO(struct xfs_mount *mp, long long min, long long max), \
4629	TP_ARGS(mp, min, max))
4630DEFINE_TIMESTAMP_RANGE_EVENT(xfs_inode_timestamp_range);
4631DEFINE_TIMESTAMP_RANGE_EVENT(xfs_quota_expiry_range);
4632
4633DECLARE_EVENT_CLASS(xfs_icwalk_class,
4634	TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw,
4635		 unsigned long caller_ip),
4636	TP_ARGS(mp, icw, caller_ip),
4637	TP_STRUCT__entry(
4638		__field(dev_t, dev)
4639		__field(__u32, flags)
4640		__field(uint32_t, uid)
4641		__field(uint32_t, gid)
4642		__field(prid_t, prid)
4643		__field(__u64, min_file_size)
4644		__field(long, scan_limit)
4645		__field(unsigned long, caller_ip)
4646	),
4647	TP_fast_assign(
4648		__entry->dev = mp->m_super->s_dev;
4649		__entry->flags = icw ? icw->icw_flags : 0;
4650		__entry->uid = icw ? from_kuid(mp->m_super->s_user_ns,
4651						icw->icw_uid) : 0;
4652		__entry->gid = icw ? from_kgid(mp->m_super->s_user_ns,
4653						icw->icw_gid) : 0;
4654		__entry->prid = icw ? icw->icw_prid : 0;
4655		__entry->min_file_size = icw ? icw->icw_min_file_size : 0;
4656		__entry->scan_limit = icw ? icw->icw_scan_limit : 0;
4657		__entry->caller_ip = caller_ip;
4658	),
4659	TP_printk("dev %d:%d flags 0x%x uid %u gid %u prid %u minsize %llu scan_limit %ld caller %pS",
4660		  MAJOR(__entry->dev), MINOR(__entry->dev),
4661		  __entry->flags,
4662		  __entry->uid,
4663		  __entry->gid,
4664		  __entry->prid,
4665		  __entry->min_file_size,
4666		  __entry->scan_limit,
4667		  (char *)__entry->caller_ip)
4668);
4669#define DEFINE_ICWALK_EVENT(name)	\
4670DEFINE_EVENT(xfs_icwalk_class, name,	\
4671	TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw, \
4672		 unsigned long caller_ip), \
4673	TP_ARGS(mp, icw, caller_ip))
4674DEFINE_ICWALK_EVENT(xfs_ioc_free_eofblocks);
4675DEFINE_ICWALK_EVENT(xfs_blockgc_free_space);
4676
4677TRACE_DEFINE_ENUM(XLOG_STATE_ACTIVE);
4678TRACE_DEFINE_ENUM(XLOG_STATE_WANT_SYNC);
4679TRACE_DEFINE_ENUM(XLOG_STATE_SYNCING);
4680TRACE_DEFINE_ENUM(XLOG_STATE_DONE_SYNC);
4681TRACE_DEFINE_ENUM(XLOG_STATE_CALLBACK);
4682TRACE_DEFINE_ENUM(XLOG_STATE_DIRTY);
4683
4684DECLARE_EVENT_CLASS(xlog_iclog_class,
4685	TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip),
4686	TP_ARGS(iclog, caller_ip),
4687	TP_STRUCT__entry(
4688		__field(dev_t, dev)
4689		__field(uint32_t, state)
4690		__field(int32_t, refcount)
4691		__field(uint32_t, offset)
4692		__field(uint32_t, flags)
4693		__field(unsigned long long, lsn)
4694		__field(unsigned long, caller_ip)
4695	),
4696	TP_fast_assign(
4697		__entry->dev = iclog->ic_log->l_mp->m_super->s_dev;
4698		__entry->state = iclog->ic_state;
4699		__entry->refcount = atomic_read(&iclog->ic_refcnt);
4700		__entry->offset = iclog->ic_offset;
4701		__entry->flags = iclog->ic_flags;
4702		__entry->lsn = be64_to_cpu(iclog->ic_header.h_lsn);
4703		__entry->caller_ip = caller_ip;
4704	),
4705	TP_printk("dev %d:%d state %s refcnt %d offset %u lsn 0x%llx flags %s caller %pS",
4706		  MAJOR(__entry->dev), MINOR(__entry->dev),
4707		  __print_symbolic(__entry->state, XLOG_STATE_STRINGS),
4708		  __entry->refcount,
4709		  __entry->offset,
4710		  __entry->lsn,
4711		  __print_flags(__entry->flags, "|", XLOG_ICL_STRINGS),
4712		  (char *)__entry->caller_ip)
4713
4714);
4715
4716#define DEFINE_ICLOG_EVENT(name)	\
4717DEFINE_EVENT(xlog_iclog_class, name,	\
4718	TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip), \
4719	TP_ARGS(iclog, caller_ip))
4720
4721DEFINE_ICLOG_EVENT(xlog_iclog_activate);
4722DEFINE_ICLOG_EVENT(xlog_iclog_clean);
4723DEFINE_ICLOG_EVENT(xlog_iclog_callback);
4724DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_start);
4725DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_done);
4726DEFINE_ICLOG_EVENT(xlog_iclog_force);
4727DEFINE_ICLOG_EVENT(xlog_iclog_force_lsn);
4728DEFINE_ICLOG_EVENT(xlog_iclog_get_space);
4729DEFINE_ICLOG_EVENT(xlog_iclog_release);
4730DEFINE_ICLOG_EVENT(xlog_iclog_switch);
4731DEFINE_ICLOG_EVENT(xlog_iclog_sync);
4732DEFINE_ICLOG_EVENT(xlog_iclog_syncing);
4733DEFINE_ICLOG_EVENT(xlog_iclog_sync_done);
4734DEFINE_ICLOG_EVENT(xlog_iclog_want_sync);
4735DEFINE_ICLOG_EVENT(xlog_iclog_wait_on);
4736DEFINE_ICLOG_EVENT(xlog_iclog_write);
4737
4738TRACE_DEFINE_ENUM(XFS_DAS_UNINIT);
4739TRACE_DEFINE_ENUM(XFS_DAS_SF_ADD);
4740TRACE_DEFINE_ENUM(XFS_DAS_SF_REMOVE);
4741TRACE_DEFINE_ENUM(XFS_DAS_LEAF_ADD);
4742TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE);
4743TRACE_DEFINE_ENUM(XFS_DAS_NODE_ADD);
4744TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE);
4745TRACE_DEFINE_ENUM(XFS_DAS_LEAF_SET_RMT);
4746TRACE_DEFINE_ENUM(XFS_DAS_LEAF_ALLOC_RMT);
4747TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REPLACE);
4748TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_OLD);
4749TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_RMT);
4750TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_ATTR);
4751TRACE_DEFINE_ENUM(XFS_DAS_NODE_SET_RMT);
4752TRACE_DEFINE_ENUM(XFS_DAS_NODE_ALLOC_RMT);
4753TRACE_DEFINE_ENUM(XFS_DAS_NODE_REPLACE);
4754TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_OLD);
4755TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_RMT);
4756TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_ATTR);
4757TRACE_DEFINE_ENUM(XFS_DAS_DONE);
4758
4759DECLARE_EVENT_CLASS(xfs_das_state_class,
4760	TP_PROTO(int das, struct xfs_inode *ip),
4761	TP_ARGS(das, ip),
4762	TP_STRUCT__entry(
4763		__field(int, das)
4764		__field(xfs_ino_t, ino)
4765	),
4766	TP_fast_assign(
4767		__entry->das = das;
4768		__entry->ino = ip->i_ino;
4769	),
4770	TP_printk("state change %s ino 0x%llx",
4771		  __print_symbolic(__entry->das, XFS_DAS_STRINGS),
4772		  __entry->ino)
4773)
4774
4775#define DEFINE_DAS_STATE_EVENT(name) \
4776DEFINE_EVENT(xfs_das_state_class, name, \
4777	TP_PROTO(int das, struct xfs_inode *ip), \
4778	TP_ARGS(das, ip))
4779DEFINE_DAS_STATE_EVENT(xfs_attr_sf_addname_return);
4780DEFINE_DAS_STATE_EVENT(xfs_attr_set_iter_return);
4781DEFINE_DAS_STATE_EVENT(xfs_attr_leaf_addname_return);
4782DEFINE_DAS_STATE_EVENT(xfs_attr_node_addname_return);
4783DEFINE_DAS_STATE_EVENT(xfs_attr_remove_iter_return);
4784DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_alloc);
4785DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_remove_return);
4786DEFINE_DAS_STATE_EVENT(xfs_attr_defer_add);
4787
4788
4789TRACE_EVENT(xfs_force_shutdown,
4790	TP_PROTO(struct xfs_mount *mp, int ptag, int flags, const char *fname,
4791		 int line_num),
4792	TP_ARGS(mp, ptag, flags, fname, line_num),
4793	TP_STRUCT__entry(
4794		__field(dev_t, dev)
4795		__field(int, ptag)
4796		__field(int, flags)
4797		__string(fname, fname)
4798		__field(int, line_num)
4799	),
4800	TP_fast_assign(
4801		__entry->dev = mp->m_super->s_dev;
4802		__entry->ptag = ptag;
4803		__entry->flags = flags;
4804		__assign_str(fname);
4805		__entry->line_num = line_num;
4806	),
4807	TP_printk("dev %d:%d tag %s flags %s file %s line_num %d",
4808		  MAJOR(__entry->dev), MINOR(__entry->dev),
4809		__print_flags(__entry->ptag, "|", XFS_PTAG_STRINGS),
4810		__print_flags(__entry->flags, "|", XFS_SHUTDOWN_STRINGS),
4811		__get_str(fname),
4812		__entry->line_num)
4813);
4814
4815#ifdef CONFIG_XFS_DRAIN_INTENTS
4816DECLARE_EVENT_CLASS(xfs_group_intents_class,
4817	TP_PROTO(const struct xfs_group *xg, void *caller_ip),
4818	TP_ARGS(xg, caller_ip),
4819	TP_STRUCT__entry(
4820		__field(dev_t, dev)
4821		__field(enum xfs_group_type, type)
4822		__field(uint32_t, index)
4823		__field(long, nr_intents)
4824		__field(void *, caller_ip)
4825	),
4826	TP_fast_assign(
4827		__entry->dev = xg->xg_mount->m_super->s_dev;
4828		__entry->type = xg->xg_type;
4829		__entry->index = xg->xg_gno;
4830		__entry->nr_intents =
4831			atomic_read(&xg->xg_intents_drain.dr_count);
4832		__entry->caller_ip = caller_ip;
4833	),
4834	TP_printk("dev %d:%d %sno 0x%x intents %ld caller %pS",
4835		  MAJOR(__entry->dev), MINOR(__entry->dev),
4836		  __print_symbolic(__entry->type, XG_TYPE_STRINGS),
4837		  __entry->index,
4838		  __entry->nr_intents,
4839		  __entry->caller_ip)
4840);
4841
4842#define DEFINE_GROUP_INTENTS_EVENT(name)	\
4843DEFINE_EVENT(xfs_group_intents_class, name,					\
4844	TP_PROTO(const struct xfs_group *xg, void *caller_ip), \
4845	TP_ARGS(xg, caller_ip))
4846DEFINE_GROUP_INTENTS_EVENT(xfs_group_intent_hold);
4847DEFINE_GROUP_INTENTS_EVENT(xfs_group_intent_rele);
4848DEFINE_GROUP_INTENTS_EVENT(xfs_group_wait_intents);
4849
4850#endif /* CONFIG_XFS_DRAIN_INTENTS */
4851
4852#ifdef CONFIG_XFS_MEMORY_BUFS
4853TRACE_EVENT(xmbuf_create,
4854	TP_PROTO(struct xfs_buftarg *btp),
4855	TP_ARGS(btp),
4856	TP_STRUCT__entry(
4857		__field(dev_t, dev)
4858		__field(unsigned long, ino)
4859		__array(char, pathname, MAXNAMELEN)
4860	),
4861	TP_fast_assign(
4862		char		*path;
4863		struct file	*file = btp->bt_file;
4864
4865		__entry->dev = btp->bt_mount->m_super->s_dev;
4866		__entry->ino = file_inode(file)->i_ino;
4867		path = file_path(file, __entry->pathname, MAXNAMELEN);
4868		if (IS_ERR(path))
4869			strncpy(__entry->pathname, "(unknown)",
4870					sizeof(__entry->pathname));
4871	),
4872	TP_printk("dev %d:%d xmino 0x%lx path '%s'",
4873		  MAJOR(__entry->dev), MINOR(__entry->dev),
4874		  __entry->ino,
4875		  __entry->pathname)
4876);
4877
4878TRACE_EVENT(xmbuf_free,
4879	TP_PROTO(struct xfs_buftarg *btp),
4880	TP_ARGS(btp),
4881	TP_STRUCT__entry(
4882		__field(dev_t, dev)
4883		__field(unsigned long, ino)
4884		__field(unsigned long long, bytes)
4885		__field(loff_t, size)
4886	),
4887	TP_fast_assign(
4888		struct file	*file = btp->bt_file;
4889		struct inode	*inode = file_inode(file);
4890
4891		__entry->dev = btp->bt_mount->m_super->s_dev;
4892		__entry->size = i_size_read(inode);
4893		__entry->bytes = (inode->i_blocks << SECTOR_SHIFT) + inode->i_bytes;
4894		__entry->ino = inode->i_ino;
4895	),
4896	TP_printk("dev %d:%d xmino 0x%lx mem_bytes 0x%llx isize 0x%llx",
4897		  MAJOR(__entry->dev), MINOR(__entry->dev),
4898		  __entry->ino,
4899		  __entry->bytes,
4900		  __entry->size)
4901);
4902#endif /* CONFIG_XFS_MEMORY_BUFS */
4903
4904#ifdef CONFIG_XFS_BTREE_IN_MEM
4905TRACE_EVENT(xfbtree_init,
4906	TP_PROTO(struct xfs_mount *mp, struct xfbtree *xfbt,
4907		 const struct xfs_btree_ops *ops),
4908	TP_ARGS(mp, xfbt, ops),
4909	TP_STRUCT__entry(
4910		__field(const void *, btree_ops)
4911		__field(unsigned long, xfino)
4912		__field(unsigned int, leaf_mxr)
4913		__field(unsigned int, leaf_mnr)
4914		__field(unsigned int, node_mxr)
4915		__field(unsigned int, node_mnr)
4916		__field(unsigned long long, owner)
4917	),
4918	TP_fast_assign(
4919		__entry->btree_ops = ops;
4920		__entry->xfino = file_inode(xfbt->target->bt_file)->i_ino;
4921		__entry->leaf_mxr = xfbt->maxrecs[0];
4922		__entry->node_mxr = xfbt->maxrecs[1];
4923		__entry->leaf_mnr = xfbt->minrecs[0];
4924		__entry->node_mnr = xfbt->minrecs[1];
4925		__entry->owner = xfbt->owner;
4926	),
4927	TP_printk("xfino 0x%lx btree_ops %pS owner 0x%llx leaf_mxr %u leaf_mnr %u node_mxr %u node_mnr %u",
4928		  __entry->xfino,
4929		  __entry->btree_ops,
4930		  __entry->owner,
4931		  __entry->leaf_mxr,
4932		  __entry->leaf_mnr,
4933		  __entry->node_mxr,
4934		  __entry->node_mnr)
4935);
4936
4937DECLARE_EVENT_CLASS(xfbtree_buf_class,
4938	TP_PROTO(struct xfbtree *xfbt, struct xfs_buf *bp),
4939	TP_ARGS(xfbt, bp),
4940	TP_STRUCT__entry(
4941		__field(unsigned long, xfino)
4942		__field(xfs_daddr_t, bno)
4943		__field(int, nblks)
4944		__field(int, hold)
4945		__field(int, pincount)
4946		__field(unsigned int, lockval)
4947		__field(unsigned int, flags)
4948	),
4949	TP_fast_assign(
4950		__entry->xfino = file_inode(xfbt->target->bt_file)->i_ino;
4951		__entry->bno = xfs_buf_daddr(bp);
4952		__entry->nblks = bp->b_length;
4953		__entry->hold = atomic_read(&bp->b_hold);
4954		__entry->pincount = atomic_read(&bp->b_pin_count);
4955		__entry->lockval = bp->b_sema.count;
4956		__entry->flags = bp->b_flags;
4957	),
4958	TP_printk("xfino 0x%lx daddr 0x%llx bbcount 0x%x hold %d pincount %d lock %d flags %s",
4959		  __entry->xfino,
4960		  (unsigned long long)__entry->bno,
4961		  __entry->nblks,
4962		  __entry->hold,
4963		  __entry->pincount,
4964		  __entry->lockval,
4965		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS))
4966)
4967
4968#define DEFINE_XFBTREE_BUF_EVENT(name) \
4969DEFINE_EVENT(xfbtree_buf_class, name, \
4970	TP_PROTO(struct xfbtree *xfbt, struct xfs_buf *bp), \
4971	TP_ARGS(xfbt, bp))
4972DEFINE_XFBTREE_BUF_EVENT(xfbtree_create_root_buf);
4973DEFINE_XFBTREE_BUF_EVENT(xfbtree_trans_commit_buf);
4974DEFINE_XFBTREE_BUF_EVENT(xfbtree_trans_cancel_buf);
4975
4976DECLARE_EVENT_CLASS(xfbtree_freesp_class,
4977	TP_PROTO(struct xfbtree *xfbt, struct xfs_btree_cur *cur,
4978		 xfs_fileoff_t fileoff),
4979	TP_ARGS(xfbt, cur, fileoff),
4980	TP_STRUCT__entry(
4981		__field(unsigned long, xfino)
4982		__string(btname, cur->bc_ops->name)
4983		__field(int, nlevels)
4984		__field(xfs_fileoff_t, fileoff)
4985	),
4986	TP_fast_assign(
4987		__entry->xfino = file_inode(xfbt->target->bt_file)->i_ino;
4988		__assign_str(btname);
4989		__entry->nlevels = cur->bc_nlevels;
4990		__entry->fileoff = fileoff;
4991	),
4992	TP_printk("xfino 0x%lx %sbt nlevels %d fileoff 0x%llx",
4993		  __entry->xfino,
4994		  __get_str(btname),
4995		  __entry->nlevels,
4996		  (unsigned long long)__entry->fileoff)
4997)
4998
4999#define DEFINE_XFBTREE_FREESP_EVENT(name) \
5000DEFINE_EVENT(xfbtree_freesp_class, name, \
5001	TP_PROTO(struct xfbtree *xfbt, struct xfs_btree_cur *cur, \
5002		 xfs_fileoff_t fileoff), \
5003	TP_ARGS(xfbt, cur, fileoff))
5004DEFINE_XFBTREE_FREESP_EVENT(xfbtree_alloc_block);
5005DEFINE_XFBTREE_FREESP_EVENT(xfbtree_free_block);
5006#endif /* CONFIG_XFS_BTREE_IN_MEM */
5007
5008/* exchmaps tracepoints */
5009#define XFS_EXCHMAPS_STRINGS \
5010	{ XFS_EXCHMAPS_ATTR_FORK,		"ATTRFORK" }, \
5011	{ XFS_EXCHMAPS_SET_SIZES,		"SETSIZES" }, \
5012	{ XFS_EXCHMAPS_INO1_WRITTEN,		"INO1_WRITTEN" }, \
5013	{ XFS_EXCHMAPS_CLEAR_INO1_REFLINK,	"CLEAR_INO1_REFLINK" }, \
5014	{ XFS_EXCHMAPS_CLEAR_INO2_REFLINK,	"CLEAR_INO2_REFLINK" }, \
5015	{ __XFS_EXCHMAPS_INO2_SHORTFORM,	"INO2_SF" }
5016
5017DEFINE_INODE_IREC_EVENT(xfs_exchmaps_mapping1_skip);
5018DEFINE_INODE_IREC_EVENT(xfs_exchmaps_mapping1);
5019DEFINE_INODE_IREC_EVENT(xfs_exchmaps_mapping2);
5020DEFINE_ITRUNC_EVENT(xfs_exchmaps_update_inode_size);
5021
5022#define XFS_EXCHRANGE_INODES \
5023	{ 1,	"file1" }, \
5024	{ 2,	"file2" }
5025
5026DECLARE_EVENT_CLASS(xfs_exchrange_inode_class,
5027	TP_PROTO(struct xfs_inode *ip, int whichfile),
5028	TP_ARGS(ip, whichfile),
5029	TP_STRUCT__entry(
5030		__field(dev_t, dev)
5031		__field(int, whichfile)
5032		__field(xfs_ino_t, ino)
5033		__field(int, format)
5034		__field(xfs_extnum_t, nex)
5035		__field(int, broot_size)
5036		__field(int, fork_off)
5037	),
5038	TP_fast_assign(
5039		__entry->dev = VFS_I(ip)->i_sb->s_dev;
5040		__entry->whichfile = whichfile;
5041		__entry->ino = ip->i_ino;
5042		__entry->format = ip->i_df.if_format;
5043		__entry->nex = ip->i_df.if_nextents;
5044		__entry->fork_off = xfs_inode_fork_boff(ip);
5045	),
5046	TP_printk("dev %d:%d ino 0x%llx whichfile %s format %s num_extents %llu forkoff 0x%x",
5047		  MAJOR(__entry->dev), MINOR(__entry->dev),
5048		  __entry->ino,
5049		  __print_symbolic(__entry->whichfile, XFS_EXCHRANGE_INODES),
5050		  __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
5051		  __entry->nex,
5052		  __entry->fork_off)
5053)
5054
5055#define DEFINE_EXCHRANGE_INODE_EVENT(name) \
5056DEFINE_EVENT(xfs_exchrange_inode_class, name, \
5057	TP_PROTO(struct xfs_inode *ip, int whichfile), \
5058	TP_ARGS(ip, whichfile))
5059
5060DEFINE_EXCHRANGE_INODE_EVENT(xfs_exchrange_before);
5061DEFINE_EXCHRANGE_INODE_EVENT(xfs_exchrange_after);
5062DEFINE_INODE_ERROR_EVENT(xfs_exchrange_error);
5063
5064#define XFS_EXCHANGE_RANGE_FLAGS_STRS \
5065	{ XFS_EXCHANGE_RANGE_TO_EOF,		"TO_EOF" }, \
5066	{ XFS_EXCHANGE_RANGE_DSYNC	,	"DSYNC" }, \
5067	{ XFS_EXCHANGE_RANGE_DRY_RUN,		"DRY_RUN" }, \
5068	{ XFS_EXCHANGE_RANGE_FILE1_WRITTEN,	"F1_WRITTEN" }, \
5069	{ __XFS_EXCHANGE_RANGE_UPD_CMTIME1,	"CMTIME1" }, \
5070	{ __XFS_EXCHANGE_RANGE_UPD_CMTIME2,	"CMTIME2" }, \
5071	{ __XFS_EXCHANGE_RANGE_CHECK_FRESH2,	"FRESH2" }
5072
5073/* file exchange-range tracepoint class */
5074DECLARE_EVENT_CLASS(xfs_exchrange_class,
5075	TP_PROTO(const struct xfs_exchrange *fxr, struct xfs_inode *ip1,
5076		 struct xfs_inode *ip2),
5077	TP_ARGS(fxr, ip1, ip2),
5078	TP_STRUCT__entry(
5079		__field(dev_t, dev)
5080		__field(xfs_ino_t, ip1_ino)
5081		__field(loff_t, ip1_isize)
5082		__field(loff_t, ip1_disize)
5083		__field(xfs_ino_t, ip2_ino)
5084		__field(loff_t, ip2_isize)
5085		__field(loff_t, ip2_disize)
5086
5087		__field(loff_t, file1_offset)
5088		__field(loff_t, file2_offset)
5089		__field(unsigned long long, length)
5090		__field(unsigned long long, flags)
5091	),
5092	TP_fast_assign(
5093		__entry->dev = VFS_I(ip1)->i_sb->s_dev;
5094		__entry->ip1_ino = ip1->i_ino;
5095		__entry->ip1_isize = VFS_I(ip1)->i_size;
5096		__entry->ip1_disize = ip1->i_disk_size;
5097		__entry->ip2_ino = ip2->i_ino;
5098		__entry->ip2_isize = VFS_I(ip2)->i_size;
5099		__entry->ip2_disize = ip2->i_disk_size;
5100
5101		__entry->file1_offset = fxr->file1_offset;
5102		__entry->file2_offset = fxr->file2_offset;
5103		__entry->length = fxr->length;
5104		__entry->flags = fxr->flags;
5105	),
5106	TP_printk("dev %d:%d flags %s bytecount 0x%llx "
5107		  "ino1 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx -> "
5108		  "ino2 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx",
5109		  MAJOR(__entry->dev), MINOR(__entry->dev),
5110		   __print_flags_u64(__entry->flags, "|", XFS_EXCHANGE_RANGE_FLAGS_STRS),
5111		  __entry->length,
5112		  __entry->ip1_ino,
5113		  __entry->ip1_isize,
5114		  __entry->ip1_disize,
5115		  __entry->file1_offset,
5116		  __entry->ip2_ino,
5117		  __entry->ip2_isize,
5118		  __entry->ip2_disize,
5119		  __entry->file2_offset)
5120)
5121
5122#define DEFINE_EXCHRANGE_EVENT(name)	\
5123DEFINE_EVENT(xfs_exchrange_class, name,	\
5124	TP_PROTO(const struct xfs_exchrange *fxr, struct xfs_inode *ip1, \
5125		 struct xfs_inode *ip2), \
5126	TP_ARGS(fxr, ip1, ip2))
5127DEFINE_EXCHRANGE_EVENT(xfs_exchrange_prep);
5128DEFINE_EXCHRANGE_EVENT(xfs_exchrange_flush);
5129DEFINE_EXCHRANGE_EVENT(xfs_exchrange_mappings);
5130
5131TRACE_EVENT(xfs_exchrange_freshness,
5132	TP_PROTO(const struct xfs_exchrange *fxr, struct xfs_inode *ip2),
5133	TP_ARGS(fxr, ip2),
5134	TP_STRUCT__entry(
5135		__field(dev_t, dev)
5136		__field(xfs_ino_t, ip2_ino)
5137		__field(long long, ip2_mtime)
5138		__field(long long, ip2_ctime)
5139		__field(int, ip2_mtime_nsec)
5140		__field(int, ip2_ctime_nsec)
5141
5142		__field(xfs_ino_t, file2_ino)
5143		__field(long long, file2_mtime)
5144		__field(long long, file2_ctime)
5145		__field(int, file2_mtime_nsec)
5146		__field(int, file2_ctime_nsec)
5147	),
5148	TP_fast_assign(
5149		struct timespec64	ts64;
5150		struct inode		*inode2 = VFS_I(ip2);
5151
5152		__entry->dev = inode2->i_sb->s_dev;
5153		__entry->ip2_ino = ip2->i_ino;
5154
5155		ts64 = inode_get_ctime(inode2);
5156		__entry->ip2_ctime = ts64.tv_sec;
5157		__entry->ip2_ctime_nsec = ts64.tv_nsec;
5158
5159		ts64 = inode_get_mtime(inode2);
5160		__entry->ip2_mtime = ts64.tv_sec;
5161		__entry->ip2_mtime_nsec = ts64.tv_nsec;
5162
5163		__entry->file2_ino = fxr->file2_ino;
5164		__entry->file2_mtime = fxr->file2_mtime.tv_sec;
5165		__entry->file2_ctime = fxr->file2_ctime.tv_sec;
5166		__entry->file2_mtime_nsec = fxr->file2_mtime.tv_nsec;
5167		__entry->file2_ctime_nsec = fxr->file2_ctime.tv_nsec;
5168	),
5169	TP_printk("dev %d:%d "
5170		  "ino 0x%llx mtime %lld:%d ctime %lld:%d -> "
5171		  "file 0x%llx mtime %lld:%d ctime %lld:%d",
5172		  MAJOR(__entry->dev), MINOR(__entry->dev),
5173		  __entry->ip2_ino,
5174		  __entry->ip2_mtime,
5175		  __entry->ip2_mtime_nsec,
5176		  __entry->ip2_ctime,
5177		  __entry->ip2_ctime_nsec,
5178		  __entry->file2_ino,
5179		  __entry->file2_mtime,
5180		  __entry->file2_mtime_nsec,
5181		  __entry->file2_ctime,
5182		  __entry->file2_ctime_nsec)
5183);
5184
5185TRACE_EVENT(xfs_exchmaps_overhead,
5186	TP_PROTO(struct xfs_mount *mp, unsigned long long bmbt_blocks,
5187		 unsigned long long rmapbt_blocks),
5188	TP_ARGS(mp, bmbt_blocks, rmapbt_blocks),
5189	TP_STRUCT__entry(
5190		__field(dev_t, dev)
5191		__field(unsigned long long, bmbt_blocks)
5192		__field(unsigned long long, rmapbt_blocks)
5193	),
5194	TP_fast_assign(
5195		__entry->dev = mp->m_super->s_dev;
5196		__entry->bmbt_blocks = bmbt_blocks;
5197		__entry->rmapbt_blocks = rmapbt_blocks;
5198	),
5199	TP_printk("dev %d:%d bmbt_blocks 0x%llx rmapbt_blocks 0x%llx",
5200		  MAJOR(__entry->dev), MINOR(__entry->dev),
5201		  __entry->bmbt_blocks,
5202		  __entry->rmapbt_blocks)
5203);
5204
5205DECLARE_EVENT_CLASS(xfs_exchmaps_estimate_class,
5206	TP_PROTO(const struct xfs_exchmaps_req *req),
5207	TP_ARGS(req),
5208	TP_STRUCT__entry(
5209		__field(dev_t, dev)
5210		__field(xfs_ino_t, ino1)
5211		__field(xfs_ino_t, ino2)
5212		__field(xfs_fileoff_t, startoff1)
5213		__field(xfs_fileoff_t, startoff2)
5214		__field(xfs_filblks_t, blockcount)
5215		__field(uint64_t, flags)
5216		__field(xfs_filblks_t, ip1_bcount)
5217		__field(xfs_filblks_t, ip2_bcount)
5218		__field(xfs_filblks_t, ip1_rtbcount)
5219		__field(xfs_filblks_t, ip2_rtbcount)
5220		__field(unsigned long long, resblks)
5221		__field(unsigned long long, nr_exchanges)
5222	),
5223	TP_fast_assign(
5224		__entry->dev = req->ip1->i_mount->m_super->s_dev;
5225		__entry->ino1 = req->ip1->i_ino;
5226		__entry->ino2 = req->ip2->i_ino;
5227		__entry->startoff1 = req->startoff1;
5228		__entry->startoff2 = req->startoff2;
5229		__entry->blockcount = req->blockcount;
5230		__entry->flags = req->flags;
5231		__entry->ip1_bcount = req->ip1_bcount;
5232		__entry->ip2_bcount = req->ip2_bcount;
5233		__entry->ip1_rtbcount = req->ip1_rtbcount;
5234		__entry->ip2_rtbcount = req->ip2_rtbcount;
5235		__entry->resblks = req->resblks;
5236		__entry->nr_exchanges = req->nr_exchanges;
5237	),
5238	TP_printk("dev %d:%d ino1 0x%llx fileoff1 0x%llx ino2 0x%llx fileoff2 0x%llx fsbcount 0x%llx flags (%s) bcount1 0x%llx rtbcount1 0x%llx bcount2 0x%llx rtbcount2 0x%llx resblks 0x%llx nr_exchanges %llu",
5239		  MAJOR(__entry->dev), MINOR(__entry->dev),
5240		  __entry->ino1, __entry->startoff1,
5241		  __entry->ino2, __entry->startoff2,
5242		  __entry->blockcount,
5243		  __print_flags_u64(__entry->flags, "|", XFS_EXCHMAPS_STRINGS),
5244		  __entry->ip1_bcount,
5245		  __entry->ip1_rtbcount,
5246		  __entry->ip2_bcount,
5247		  __entry->ip2_rtbcount,
5248		  __entry->resblks,
5249		  __entry->nr_exchanges)
5250);
5251
5252#define DEFINE_EXCHMAPS_ESTIMATE_EVENT(name)	\
5253DEFINE_EVENT(xfs_exchmaps_estimate_class, name,	\
5254	TP_PROTO(const struct xfs_exchmaps_req *req), \
5255	TP_ARGS(req))
5256DEFINE_EXCHMAPS_ESTIMATE_EVENT(xfs_exchmaps_initial_estimate);
5257DEFINE_EXCHMAPS_ESTIMATE_EVENT(xfs_exchmaps_final_estimate);
5258
5259DECLARE_EVENT_CLASS(xfs_exchmaps_intent_class,
5260	TP_PROTO(struct xfs_mount *mp, const struct xfs_exchmaps_intent *xmi),
5261	TP_ARGS(mp, xmi),
5262	TP_STRUCT__entry(
5263		__field(dev_t, dev)
5264		__field(xfs_ino_t, ino1)
5265		__field(xfs_ino_t, ino2)
5266		__field(uint64_t, flags)
5267		__field(xfs_fileoff_t, startoff1)
5268		__field(xfs_fileoff_t, startoff2)
5269		__field(xfs_filblks_t, blockcount)
5270		__field(xfs_fsize_t, isize1)
5271		__field(xfs_fsize_t, isize2)
5272		__field(xfs_fsize_t, new_isize1)
5273		__field(xfs_fsize_t, new_isize2)
5274	),
5275	TP_fast_assign(
5276		__entry->dev = mp->m_super->s_dev;
5277		__entry->ino1 = xmi->xmi_ip1->i_ino;
5278		__entry->ino2 = xmi->xmi_ip2->i_ino;
5279		__entry->flags = xmi->xmi_flags;
5280		__entry->startoff1 = xmi->xmi_startoff1;
5281		__entry->startoff2 = xmi->xmi_startoff2;
5282		__entry->blockcount = xmi->xmi_blockcount;
5283		__entry->isize1 = xmi->xmi_ip1->i_disk_size;
5284		__entry->isize2 = xmi->xmi_ip2->i_disk_size;
5285		__entry->new_isize1 = xmi->xmi_isize1;
5286		__entry->new_isize2 = xmi->xmi_isize2;
5287	),
5288	TP_printk("dev %d:%d ino1 0x%llx fileoff1 0x%llx ino2 0x%llx fileoff2 0x%llx fsbcount 0x%llx flags (%s) isize1 0x%llx newisize1 0x%llx isize2 0x%llx newisize2 0x%llx",
5289		  MAJOR(__entry->dev), MINOR(__entry->dev),
5290		  __entry->ino1, __entry->startoff1,
5291		  __entry->ino2, __entry->startoff2,
5292		  __entry->blockcount,
5293		  __print_flags_u64(__entry->flags, "|", XFS_EXCHMAPS_STRINGS),
5294		  __entry->isize1, __entry->new_isize1,
5295		  __entry->isize2, __entry->new_isize2)
5296);
5297
5298#define DEFINE_EXCHMAPS_INTENT_EVENT(name)	\
5299DEFINE_EVENT(xfs_exchmaps_intent_class, name,	\
5300	TP_PROTO(struct xfs_mount *mp, const struct xfs_exchmaps_intent *xmi), \
5301	TP_ARGS(mp, xmi))
5302DEFINE_EXCHMAPS_INTENT_EVENT(xfs_exchmaps_defer);
5303DEFINE_EXCHMAPS_INTENT_EVENT(xfs_exchmaps_recover);
5304
5305TRACE_EVENT(xfs_exchmaps_delta_nextents_step,
5306	TP_PROTO(struct xfs_mount *mp,
5307		 const struct xfs_bmbt_irec *left,
5308		 const struct xfs_bmbt_irec *curr,
5309		 const struct xfs_bmbt_irec *new,
5310		 const struct xfs_bmbt_irec *right,
5311		 int delta, unsigned int state),
5312	TP_ARGS(mp, left, curr, new, right, delta, state),
5313	TP_STRUCT__entry(
5314		__field(dev_t, dev)
5315		__field(xfs_fileoff_t, loff)
5316		__field(xfs_fsblock_t, lstart)
5317		__field(xfs_filblks_t, lcount)
5318		__field(xfs_fileoff_t, coff)
5319		__field(xfs_fsblock_t, cstart)
5320		__field(xfs_filblks_t, ccount)
5321		__field(xfs_fileoff_t, noff)
5322		__field(xfs_fsblock_t, nstart)
5323		__field(xfs_filblks_t, ncount)
5324		__field(xfs_fileoff_t, roff)
5325		__field(xfs_fsblock_t, rstart)
5326		__field(xfs_filblks_t, rcount)
5327		__field(int, delta)
5328		__field(unsigned int, state)
5329	),
5330	TP_fast_assign(
5331		__entry->dev = mp->m_super->s_dev;
5332		__entry->loff = left->br_startoff;
5333		__entry->lstart = left->br_startblock;
5334		__entry->lcount = left->br_blockcount;
5335		__entry->coff = curr->br_startoff;
5336		__entry->cstart = curr->br_startblock;
5337		__entry->ccount = curr->br_blockcount;
5338		__entry->noff = new->br_startoff;
5339		__entry->nstart = new->br_startblock;
5340		__entry->ncount = new->br_blockcount;
5341		__entry->roff = right->br_startoff;
5342		__entry->rstart = right->br_startblock;
5343		__entry->rcount = right->br_blockcount;
5344		__entry->delta = delta;
5345		__entry->state = state;
5346	),
5347	TP_printk("dev %d:%d left 0x%llx:0x%llx:0x%llx; curr 0x%llx:0x%llx:0x%llx <- new 0x%llx:0x%llx:0x%llx; right 0x%llx:0x%llx:0x%llx delta %d state 0x%x",
5348		  MAJOR(__entry->dev), MINOR(__entry->dev),
5349		__entry->loff, __entry->lstart, __entry->lcount,
5350		__entry->coff, __entry->cstart, __entry->ccount,
5351		__entry->noff, __entry->nstart, __entry->ncount,
5352		__entry->roff, __entry->rstart, __entry->rcount,
5353		__entry->delta, __entry->state)
5354);
5355
5356TRACE_EVENT(xfs_exchmaps_delta_nextents,
5357	TP_PROTO(const struct xfs_exchmaps_req *req, int64_t d_nexts1,
5358		 int64_t d_nexts2),
5359	TP_ARGS(req, d_nexts1, d_nexts2),
5360	TP_STRUCT__entry(
5361		__field(dev_t, dev)
5362		__field(xfs_ino_t, ino1)
5363		__field(xfs_ino_t, ino2)
5364		__field(xfs_extnum_t, nexts1)
5365		__field(xfs_extnum_t, nexts2)
5366		__field(int64_t, d_nexts1)
5367		__field(int64_t, d_nexts2)
5368	),
5369	TP_fast_assign(
5370		int whichfork = xfs_exchmaps_reqfork(req);
5371
5372		__entry->dev = req->ip1->i_mount->m_super->s_dev;
5373		__entry->ino1 = req->ip1->i_ino;
5374		__entry->ino2 = req->ip2->i_ino;
5375		__entry->nexts1 = xfs_ifork_ptr(req->ip1, whichfork)->if_nextents;
5376		__entry->nexts2 = xfs_ifork_ptr(req->ip2, whichfork)->if_nextents;
5377		__entry->d_nexts1 = d_nexts1;
5378		__entry->d_nexts2 = d_nexts2;
5379	),
5380	TP_printk("dev %d:%d ino1 0x%llx nexts %llu ino2 0x%llx nexts %llu delta1 %lld delta2 %lld",
5381		  MAJOR(__entry->dev), MINOR(__entry->dev),
5382		  __entry->ino1, __entry->nexts1,
5383		  __entry->ino2, __entry->nexts2,
5384		  __entry->d_nexts1, __entry->d_nexts2)
5385);
5386
5387DECLARE_EVENT_CLASS(xfs_getparents_rec_class,
5388	TP_PROTO(struct xfs_inode *ip, const struct xfs_getparents *ppi,
5389		 const struct xfs_attr_list_context *context,
5390	         const struct xfs_getparents_rec *pptr),
5391	TP_ARGS(ip, ppi, context, pptr),
5392	TP_STRUCT__entry(
5393		__field(dev_t, dev)
5394		__field(xfs_ino_t, ino)
5395		__field(unsigned int, firstu)
5396		__field(unsigned short, reclen)
5397		__field(unsigned int, bufsize)
5398		__field(xfs_ino_t, parent_ino)
5399		__field(unsigned int, parent_gen)
5400		__string(name, pptr->gpr_name)
5401	),
5402	TP_fast_assign(
5403		__entry->dev = ip->i_mount->m_super->s_dev;
5404		__entry->ino = ip->i_ino;
5405		__entry->firstu = context->firstu;
5406		__entry->reclen = pptr->gpr_reclen;
5407		__entry->bufsize = ppi->gp_bufsize;
5408		__entry->parent_ino = pptr->gpr_parent.ha_fid.fid_ino;
5409		__entry->parent_gen = pptr->gpr_parent.ha_fid.fid_gen;
5410		__assign_str(name);
5411	),
5412	TP_printk("dev %d:%d ino 0x%llx firstu %u reclen %u bufsize %u parent_ino 0x%llx parent_gen 0x%x name '%s'",
5413		  MAJOR(__entry->dev), MINOR(__entry->dev),
5414		  __entry->ino,
5415		  __entry->firstu,
5416		  __entry->reclen,
5417		  __entry->bufsize,
5418		  __entry->parent_ino,
5419		  __entry->parent_gen,
5420		  __get_str(name))
5421)
5422#define DEFINE_XFS_GETPARENTS_REC_EVENT(name) \
5423DEFINE_EVENT(xfs_getparents_rec_class, name, \
5424	TP_PROTO(struct xfs_inode *ip, const struct xfs_getparents *ppi, \
5425		 const struct xfs_attr_list_context *context, \
5426	         const struct xfs_getparents_rec *pptr), \
5427	TP_ARGS(ip, ppi, context, pptr))
5428DEFINE_XFS_GETPARENTS_REC_EVENT(xfs_getparents_put_listent);
5429DEFINE_XFS_GETPARENTS_REC_EVENT(xfs_getparents_expand_lastrec);
5430
5431DECLARE_EVENT_CLASS(xfs_getparents_class,
5432	TP_PROTO(struct xfs_inode *ip, const struct xfs_getparents *ppi,
5433		 const struct xfs_attrlist_cursor_kern *cur),
5434	TP_ARGS(ip, ppi, cur),
5435	TP_STRUCT__entry(
5436		__field(dev_t, dev)
5437		__field(xfs_ino_t, ino)
5438		__field(unsigned short, iflags)
5439		__field(unsigned short, oflags)
5440		__field(unsigned int, bufsize)
5441		__field(unsigned int, hashval)
5442		__field(unsigned int, blkno)
5443		__field(unsigned int, offset)
5444		__field(int, initted)
5445	),
5446	TP_fast_assign(
5447		__entry->dev = ip->i_mount->m_super->s_dev;
5448		__entry->ino = ip->i_ino;
5449		__entry->iflags = ppi->gp_iflags;
5450		__entry->oflags = ppi->gp_oflags;
5451		__entry->bufsize = ppi->gp_bufsize;
5452		__entry->hashval = cur->hashval;
5453		__entry->blkno = cur->blkno;
5454		__entry->offset = cur->offset;
5455		__entry->initted = cur->initted;
5456	),
5457	TP_printk("dev %d:%d ino 0x%llx iflags 0x%x oflags 0x%x bufsize %u cur_init? %d hashval 0x%x blkno %u offset %u",
5458		  MAJOR(__entry->dev), MINOR(__entry->dev),
5459		  __entry->ino,
5460		  __entry->iflags,
5461		  __entry->oflags,
5462		  __entry->bufsize,
5463		  __entry->initted,
5464		  __entry->hashval,
5465		  __entry->blkno,
5466		  __entry->offset)
5467)
5468#define DEFINE_XFS_GETPARENTS_EVENT(name) \
5469DEFINE_EVENT(xfs_getparents_class, name, \
5470	TP_PROTO(struct xfs_inode *ip, const struct xfs_getparents *ppi, \
5471		 const struct xfs_attrlist_cursor_kern *cur), \
5472	TP_ARGS(ip, ppi, cur))
5473DEFINE_XFS_GETPARENTS_EVENT(xfs_getparents_begin);
5474DEFINE_XFS_GETPARENTS_EVENT(xfs_getparents_end);
5475
5476DECLARE_EVENT_CLASS(xfs_metadir_update_class,
5477	TP_PROTO(const struct xfs_metadir_update *upd),
5478	TP_ARGS(upd),
5479	TP_STRUCT__entry(
5480		__field(dev_t, dev)
5481		__field(xfs_ino_t, dp_ino)
5482		__field(xfs_ino_t, ino)
5483		__string(fname, upd->path)
5484	),
5485	TP_fast_assign(
5486		__entry->dev = upd->dp->i_mount->m_super->s_dev;
5487		__entry->dp_ino = upd->dp->i_ino;
5488		__entry->ino = upd->ip ? upd->ip->i_ino : NULLFSINO;
5489		__assign_str(fname);
5490	),
5491	TP_printk("dev %d:%d dp 0x%llx fname '%s' ino 0x%llx",
5492		  MAJOR(__entry->dev), MINOR(__entry->dev),
5493		  __entry->dp_ino,
5494		  __get_str(fname),
5495		  __entry->ino)
5496)
5497
5498#define DEFINE_METADIR_UPDATE_EVENT(name) \
5499DEFINE_EVENT(xfs_metadir_update_class, name, \
5500	TP_PROTO(const struct xfs_metadir_update *upd), \
5501	TP_ARGS(upd))
5502DEFINE_METADIR_UPDATE_EVENT(xfs_metadir_start_create);
5503DEFINE_METADIR_UPDATE_EVENT(xfs_metadir_start_link);
5504DEFINE_METADIR_UPDATE_EVENT(xfs_metadir_commit);
5505DEFINE_METADIR_UPDATE_EVENT(xfs_metadir_cancel);
5506DEFINE_METADIR_UPDATE_EVENT(xfs_metadir_try_create);
5507DEFINE_METADIR_UPDATE_EVENT(xfs_metadir_create);
5508DEFINE_METADIR_UPDATE_EVENT(xfs_metadir_link);
5509
5510DECLARE_EVENT_CLASS(xfs_metadir_update_error_class,
5511	TP_PROTO(const struct xfs_metadir_update *upd, int error),
5512	TP_ARGS(upd, error),
5513	TP_STRUCT__entry(
5514		__field(dev_t, dev)
5515		__field(xfs_ino_t, dp_ino)
5516		__field(xfs_ino_t, ino)
5517		__field(int, error)
5518		__string(fname, upd->path)
5519	),
5520	TP_fast_assign(
5521		__entry->dev = upd->dp->i_mount->m_super->s_dev;
5522		__entry->dp_ino = upd->dp->i_ino;
5523		__entry->ino = upd->ip ? upd->ip->i_ino : NULLFSINO;
5524		__entry->error = error;
5525		__assign_str(fname);
5526	),
5527	TP_printk("dev %d:%d dp 0x%llx fname '%s' ino 0x%llx error %d",
5528		  MAJOR(__entry->dev), MINOR(__entry->dev),
5529		  __entry->dp_ino,
5530		  __get_str(fname),
5531		  __entry->ino,
5532		  __entry->error)
5533)
5534
5535#define DEFINE_METADIR_UPDATE_ERROR_EVENT(name) \
5536DEFINE_EVENT(xfs_metadir_update_error_class, name, \
5537	TP_PROTO(const struct xfs_metadir_update *upd, int error), \
5538	TP_ARGS(upd, error))
5539DEFINE_METADIR_UPDATE_ERROR_EVENT(xfs_metadir_teardown);
5540
5541DECLARE_EVENT_CLASS(xfs_metadir_class,
5542	TP_PROTO(struct xfs_inode *dp, struct xfs_name *name,
5543		 xfs_ino_t ino),
5544	TP_ARGS(dp, name, ino),
5545	TP_STRUCT__entry(
5546		__field(dev_t, dev)
5547		__field(xfs_ino_t, dp_ino)
5548		__field(xfs_ino_t, ino)
5549		__field(int, ftype)
5550		__field(int, namelen)
5551		__dynamic_array(char, name, name->len)
5552	),
5553	TP_fast_assign(
5554		__entry->dev = VFS_I(dp)->i_sb->s_dev;
5555		__entry->dp_ino = dp->i_ino;
5556		__entry->ino = ino,
5557		__entry->ftype = name->type;
5558		__entry->namelen = name->len;
5559		memcpy(__get_str(name), name->name, name->len);
5560	),
5561	TP_printk("dev %d:%d dir 0x%llx type %s name '%.*s' ino 0x%llx",
5562		  MAJOR(__entry->dev), MINOR(__entry->dev),
5563		  __entry->dp_ino,
5564		  __print_symbolic(__entry->ftype, XFS_DIR3_FTYPE_STR),
5565		  __entry->namelen,
5566		  __get_str(name),
5567		  __entry->ino)
5568)
5569
5570#define DEFINE_METADIR_EVENT(name) \
5571DEFINE_EVENT(xfs_metadir_class, name, \
5572	TP_PROTO(struct xfs_inode *dp, struct xfs_name *name, \
5573		 xfs_ino_t ino), \
5574	TP_ARGS(dp, name, ino))
5575DEFINE_METADIR_EVENT(xfs_metadir_lookup);
5576
5577#endif /* _TRACE_XFS_H */
5578
5579#undef TRACE_INCLUDE_PATH
5580#define TRACE_INCLUDE_PATH .
5581#define TRACE_INCLUDE_FILE xfs_trace
5582#include <trace/define_trace.h>