Linux Audio

Check our new training course

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