linux/fs/xfs/xfs_trace.h
<<
>>
Prefs
   1/*
   2 * Copyright (c) 2009, Christoph Hellwig
   3 * All Rights Reserved.
   4 *
   5 * This program is free software; you can redistribute it and/or
   6 * modify it under the terms of the GNU General Public License as
   7 * published by the Free Software Foundation.
   8 *
   9 * This program is distributed in the hope that it would be useful,
  10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12 * GNU General Public License for more details.
  13 *
  14 * You should have received a copy of the GNU General Public License
  15 * along with this program; if not, write the Free Software Foundation,
  16 * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  17 */
  18#undef TRACE_SYSTEM
  19#define TRACE_SYSTEM xfs
  20
  21#if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
  22#define _TRACE_XFS_H
  23
  24#include <linux/tracepoint.h>
  25
  26struct xfs_agf;
  27struct xfs_alloc_arg;
  28struct xfs_attr_list_context;
  29struct xfs_buf_log_item;
  30struct xfs_da_args;
  31struct xfs_da_node_entry;
  32struct xfs_dquot;
  33struct xfs_log_item;
  34struct xlog_ticket;
  35struct xlog;
  36struct xlog_recover;
  37struct xlog_recover_item;
  38struct xfs_buf_log_format;
  39struct xfs_inode_log_format;
  40struct xfs_bmbt_irec;
  41
  42DECLARE_EVENT_CLASS(xfs_attr_list_class,
  43        TP_PROTO(struct xfs_attr_list_context *ctx),
  44        TP_ARGS(ctx),
  45        TP_STRUCT__entry(
  46                __field(dev_t, dev)
  47                __field(xfs_ino_t, ino)
  48                __field(u32, hashval)
  49                __field(u32, blkno)
  50                __field(u32, offset)
  51                __field(void *, alist)
  52                __field(int, bufsize)
  53                __field(int, count)
  54                __field(int, firstu)
  55                __field(int, dupcnt)
  56                __field(int, flags)
  57        ),
  58        TP_fast_assign(
  59                __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
  60                __entry->ino = ctx->dp->i_ino;
  61                __entry->hashval = ctx->cursor->hashval;
  62                __entry->blkno = ctx->cursor->blkno;
  63                __entry->offset = ctx->cursor->offset;
  64                __entry->alist = ctx->alist;
  65                __entry->bufsize = ctx->bufsize;
  66                __entry->count = ctx->count;
  67                __entry->firstu = ctx->firstu;
  68                __entry->flags = ctx->flags;
  69        ),
  70        TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
  71                  "alist 0x%p size %u count %u firstu %u flags %d %s",
  72                  MAJOR(__entry->dev), MINOR(__entry->dev),
  73                   __entry->ino,
  74                   __entry->hashval,
  75                   __entry->blkno,
  76                   __entry->offset,
  77                   __entry->dupcnt,
  78                   __entry->alist,
  79                   __entry->bufsize,
  80                   __entry->count,
  81                   __entry->firstu,
  82                   __entry->flags,
  83                   __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
  84        )
  85)
  86
  87#define DEFINE_ATTR_LIST_EVENT(name) \
  88DEFINE_EVENT(xfs_attr_list_class, name, \
  89        TP_PROTO(struct xfs_attr_list_context *ctx), \
  90        TP_ARGS(ctx))
  91DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
  92DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
  93DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
  94DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
  95DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
  96DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
  97DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
  98DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
  99
 100DECLARE_EVENT_CLASS(xfs_perag_class,
 101        TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
 102                 unsigned long caller_ip),
 103        TP_ARGS(mp, agno, refcount, caller_ip),
 104        TP_STRUCT__entry(
 105                __field(dev_t, dev)
 106                __field(xfs_agnumber_t, agno)
 107                __field(int, refcount)
 108                __field(unsigned long, caller_ip)
 109        ),
 110        TP_fast_assign(
 111                __entry->dev = mp->m_super->s_dev;
 112                __entry->agno = agno;
 113                __entry->refcount = refcount;
 114                __entry->caller_ip = caller_ip;
 115        ),
 116        TP_printk("dev %d:%d agno %u refcount %d caller %pf",
 117                  MAJOR(__entry->dev), MINOR(__entry->dev),
 118                  __entry->agno,
 119                  __entry->refcount,
 120                  (char *)__entry->caller_ip)
 121);
 122
 123#define DEFINE_PERAG_REF_EVENT(name)    \
 124DEFINE_EVENT(xfs_perag_class, name,     \
 125        TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,       \
 126                 unsigned long caller_ip),                                      \
 127        TP_ARGS(mp, agno, refcount, caller_ip))
 128DEFINE_PERAG_REF_EVENT(xfs_perag_get);
 129DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
 130DEFINE_PERAG_REF_EVENT(xfs_perag_put);
 131DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
 132DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
 133
 134TRACE_EVENT(xfs_attr_list_node_descend,
 135        TP_PROTO(struct xfs_attr_list_context *ctx,
 136                 struct xfs_da_node_entry *btree),
 137        TP_ARGS(ctx, btree),
 138        TP_STRUCT__entry(
 139                __field(dev_t, dev)
 140                __field(xfs_ino_t, ino)
 141                __field(u32, hashval)
 142                __field(u32, blkno)
 143                __field(u32, offset)
 144                __field(void *, alist)
 145                __field(int, bufsize)
 146                __field(int, count)
 147                __field(int, firstu)
 148                __field(int, dupcnt)
 149                __field(int, flags)
 150                __field(u32, bt_hashval)
 151                __field(u32, bt_before)
 152        ),
 153        TP_fast_assign(
 154                __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
 155                __entry->ino = ctx->dp->i_ino;
 156                __entry->hashval = ctx->cursor->hashval;
 157                __entry->blkno = ctx->cursor->blkno;
 158                __entry->offset = ctx->cursor->offset;
 159                __entry->alist = ctx->alist;
 160                __entry->bufsize = ctx->bufsize;
 161                __entry->count = ctx->count;
 162                __entry->firstu = ctx->firstu;
 163                __entry->flags = ctx->flags;
 164                __entry->bt_hashval = be32_to_cpu(btree->hashval);
 165                __entry->bt_before = be32_to_cpu(btree->before);
 166        ),
 167        TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
 168                  "alist 0x%p size %u count %u firstu %u flags %d %s "
 169                  "node hashval %u, node before %u",
 170                  MAJOR(__entry->dev), MINOR(__entry->dev),
 171                   __entry->ino,
 172                   __entry->hashval,
 173                   __entry->blkno,
 174                   __entry->offset,
 175                   __entry->dupcnt,
 176                   __entry->alist,
 177                   __entry->bufsize,
 178                   __entry->count,
 179                   __entry->firstu,
 180                   __entry->flags,
 181                   __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
 182                   __entry->bt_hashval,
 183                   __entry->bt_before)
 184);
 185
 186TRACE_EVENT(xfs_iext_insert,
 187        TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx,
 188                 struct xfs_bmbt_irec *r, int state, unsigned long caller_ip),
 189        TP_ARGS(ip, idx, r, state, caller_ip),
 190        TP_STRUCT__entry(
 191                __field(dev_t, dev)
 192                __field(xfs_ino_t, ino)
 193                __field(xfs_extnum_t, idx)
 194                __field(xfs_fileoff_t, startoff)
 195                __field(xfs_fsblock_t, startblock)
 196                __field(xfs_filblks_t, blockcount)
 197                __field(xfs_exntst_t, state)
 198                __field(int, bmap_state)
 199                __field(unsigned long, caller_ip)
 200        ),
 201        TP_fast_assign(
 202                __entry->dev = VFS_I(ip)->i_sb->s_dev;
 203                __entry->ino = ip->i_ino;
 204                __entry->idx = idx;
 205                __entry->startoff = r->br_startoff;
 206                __entry->startblock = r->br_startblock;
 207                __entry->blockcount = r->br_blockcount;
 208                __entry->state = r->br_state;
 209                __entry->bmap_state = state;
 210                __entry->caller_ip = caller_ip;
 211        ),
 212        TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
 213                  "offset %lld block %lld count %lld flag %d caller %pf",
 214                  MAJOR(__entry->dev), MINOR(__entry->dev),
 215                  __entry->ino,
 216                  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
 217                  (long)__entry->idx,
 218                  __entry->startoff,
 219                  (__int64_t)__entry->startblock,
 220                  __entry->blockcount,
 221                  __entry->state,
 222                  (char *)__entry->caller_ip)
 223);
 224
 225DECLARE_EVENT_CLASS(xfs_bmap_class,
 226        TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state,
 227                 unsigned long caller_ip),
 228        TP_ARGS(ip, idx, state, caller_ip),
 229        TP_STRUCT__entry(
 230                __field(dev_t, dev)
 231                __field(xfs_ino_t, ino)
 232                __field(xfs_extnum_t, idx)
 233                __field(xfs_fileoff_t, startoff)
 234                __field(xfs_fsblock_t, startblock)
 235                __field(xfs_filblks_t, blockcount)
 236                __field(xfs_exntst_t, state)
 237                __field(int, bmap_state)
 238                __field(unsigned long, caller_ip)
 239        ),
 240        TP_fast_assign(
 241                struct xfs_ifork        *ifp = (state & BMAP_ATTRFORK) ?
 242                                                ip->i_afp : &ip->i_df;
 243                struct xfs_bmbt_irec    r;
 244
 245                xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r);
 246                __entry->dev = VFS_I(ip)->i_sb->s_dev;
 247                __entry->ino = ip->i_ino;
 248                __entry->idx = idx;
 249                __entry->startoff = r.br_startoff;
 250                __entry->startblock = r.br_startblock;
 251                __entry->blockcount = r.br_blockcount;
 252                __entry->state = r.br_state;
 253                __entry->bmap_state = state;
 254                __entry->caller_ip = caller_ip;
 255        ),
 256        TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
 257                  "offset %lld block %lld count %lld flag %d caller %pf",
 258                  MAJOR(__entry->dev), MINOR(__entry->dev),
 259                  __entry->ino,
 260                  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
 261                  (long)__entry->idx,
 262                  __entry->startoff,
 263                  (__int64_t)__entry->startblock,
 264                  __entry->blockcount,
 265                  __entry->state,
 266                  (char *)__entry->caller_ip)
 267)
 268
 269#define DEFINE_BMAP_EVENT(name) \
 270DEFINE_EVENT(xfs_bmap_class, name, \
 271        TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
 272                 unsigned long caller_ip), \
 273        TP_ARGS(ip, idx, state, caller_ip))
 274DEFINE_BMAP_EVENT(xfs_iext_remove);
 275DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
 276DEFINE_BMAP_EVENT(xfs_bmap_post_update);
 277DEFINE_BMAP_EVENT(xfs_extlist);
 278
 279DECLARE_EVENT_CLASS(xfs_buf_class,
 280        TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
 281        TP_ARGS(bp, caller_ip),
 282        TP_STRUCT__entry(
 283                __field(dev_t, dev)
 284                __field(xfs_daddr_t, bno)
 285                __field(int, nblks)
 286                __field(int, hold)
 287                __field(int, pincount)
 288                __field(unsigned, lockval)
 289                __field(unsigned, flags)
 290                __field(unsigned long, caller_ip)
 291        ),
 292        TP_fast_assign(
 293                __entry->dev = bp->b_target->bt_dev;
 294                __entry->bno = bp->b_bn;
 295                __entry->nblks = bp->b_length;
 296                __entry->hold = atomic_read(&bp->b_hold);
 297                __entry->pincount = atomic_read(&bp->b_pin_count);
 298                __entry->lockval = bp->b_sema.count;
 299                __entry->flags = bp->b_flags;
 300                __entry->caller_ip = caller_ip;
 301        ),
 302        TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
 303                  "lock %d flags %s caller %pf",
 304                  MAJOR(__entry->dev), MINOR(__entry->dev),
 305                  (unsigned long long)__entry->bno,
 306                  __entry->nblks,
 307                  __entry->hold,
 308                  __entry->pincount,
 309                  __entry->lockval,
 310                  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
 311                  (void *)__entry->caller_ip)
 312)
 313
 314#define DEFINE_BUF_EVENT(name) \
 315DEFINE_EVENT(xfs_buf_class, name, \
 316        TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
 317        TP_ARGS(bp, caller_ip))
 318DEFINE_BUF_EVENT(xfs_buf_init);
 319DEFINE_BUF_EVENT(xfs_buf_free);
 320DEFINE_BUF_EVENT(xfs_buf_hold);
 321DEFINE_BUF_EVENT(xfs_buf_rele);
 322DEFINE_BUF_EVENT(xfs_buf_iodone);
 323DEFINE_BUF_EVENT(xfs_buf_iorequest);
 324DEFINE_BUF_EVENT(xfs_buf_bawrite);
 325DEFINE_BUF_EVENT(xfs_buf_lock);
 326DEFINE_BUF_EVENT(xfs_buf_lock_done);
 327DEFINE_BUF_EVENT(xfs_buf_trylock);
 328DEFINE_BUF_EVENT(xfs_buf_unlock);
 329DEFINE_BUF_EVENT(xfs_buf_iowait);
 330DEFINE_BUF_EVENT(xfs_buf_iowait_done);
 331DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
 332DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
 333DEFINE_BUF_EVENT(xfs_buf_delwri_split);
 334DEFINE_BUF_EVENT(xfs_buf_get_uncached);
 335DEFINE_BUF_EVENT(xfs_bdstrat_shut);
 336DEFINE_BUF_EVENT(xfs_buf_item_relse);
 337DEFINE_BUF_EVENT(xfs_buf_item_iodone);
 338DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
 339DEFINE_BUF_EVENT(xfs_buf_error_relse);
 340DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
 341DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
 342
 343/* not really buffer traces, but the buf provides useful information */
 344DEFINE_BUF_EVENT(xfs_btree_corrupt);
 345DEFINE_BUF_EVENT(xfs_da_btree_corrupt);
 346DEFINE_BUF_EVENT(xfs_reset_dqcounts);
 347DEFINE_BUF_EVENT(xfs_inode_item_push);
 348
 349/* pass flags explicitly */
 350DECLARE_EVENT_CLASS(xfs_buf_flags_class,
 351        TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
 352        TP_ARGS(bp, flags, caller_ip),
 353        TP_STRUCT__entry(
 354                __field(dev_t, dev)
 355                __field(xfs_daddr_t, bno)
 356                __field(size_t, buffer_length)
 357                __field(int, hold)
 358                __field(int, pincount)
 359                __field(unsigned, lockval)
 360                __field(unsigned, flags)
 361                __field(unsigned long, caller_ip)
 362        ),
 363        TP_fast_assign(
 364                __entry->dev = bp->b_target->bt_dev;
 365                __entry->bno = bp->b_bn;
 366                __entry->buffer_length = BBTOB(bp->b_length);
 367                __entry->flags = flags;
 368                __entry->hold = atomic_read(&bp->b_hold);
 369                __entry->pincount = atomic_read(&bp->b_pin_count);
 370                __entry->lockval = bp->b_sema.count;
 371                __entry->caller_ip = caller_ip;
 372        ),
 373        TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
 374                  "lock %d flags %s caller %pf",
 375                  MAJOR(__entry->dev), MINOR(__entry->dev),
 376                  (unsigned long long)__entry->bno,
 377                  __entry->buffer_length,
 378                  __entry->hold,
 379                  __entry->pincount,
 380                  __entry->lockval,
 381                  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
 382                  (void *)__entry->caller_ip)
 383)
 384
 385#define DEFINE_BUF_FLAGS_EVENT(name) \
 386DEFINE_EVENT(xfs_buf_flags_class, name, \
 387        TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
 388        TP_ARGS(bp, flags, caller_ip))
 389DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
 390DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
 391DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
 392
 393TRACE_EVENT(xfs_buf_ioerror,
 394        TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
 395        TP_ARGS(bp, error, caller_ip),
 396        TP_STRUCT__entry(
 397                __field(dev_t, dev)
 398                __field(xfs_daddr_t, bno)
 399                __field(size_t, buffer_length)
 400                __field(unsigned, flags)
 401                __field(int, hold)
 402                __field(int, pincount)
 403                __field(unsigned, lockval)
 404                __field(int, error)
 405                __field(unsigned long, caller_ip)
 406        ),
 407        TP_fast_assign(
 408                __entry->dev = bp->b_target->bt_dev;
 409                __entry->bno = bp->b_bn;
 410                __entry->buffer_length = BBTOB(bp->b_length);
 411                __entry->hold = atomic_read(&bp->b_hold);
 412                __entry->pincount = atomic_read(&bp->b_pin_count);
 413                __entry->lockval = bp->b_sema.count;
 414                __entry->error = error;
 415                __entry->flags = bp->b_flags;
 416                __entry->caller_ip = caller_ip;
 417        ),
 418        TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
 419                  "lock %d error %d flags %s caller %pf",
 420                  MAJOR(__entry->dev), MINOR(__entry->dev),
 421                  (unsigned long long)__entry->bno,
 422                  __entry->buffer_length,
 423                  __entry->hold,
 424                  __entry->pincount,
 425                  __entry->lockval,
 426                  __entry->error,
 427                  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
 428                  (void *)__entry->caller_ip)
 429);
 430
 431DECLARE_EVENT_CLASS(xfs_buf_item_class,
 432        TP_PROTO(struct xfs_buf_log_item *bip),
 433        TP_ARGS(bip),
 434        TP_STRUCT__entry(
 435                __field(dev_t, dev)
 436                __field(xfs_daddr_t, buf_bno)
 437                __field(size_t, buf_len)
 438                __field(int, buf_hold)
 439                __field(int, buf_pincount)
 440                __field(int, buf_lockval)
 441                __field(unsigned, buf_flags)
 442                __field(unsigned, bli_recur)
 443                __field(int, bli_refcount)
 444                __field(unsigned, bli_flags)
 445                __field(void *, li_desc)
 446                __field(unsigned, 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_desc = bip->bli_item.li_desc;
 460                __entry->li_flags = bip->bli_item.li_flags;
 461        ),
 462        TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
 463                  "lock %d flags %s recur %d refcount %d bliflags %s "
 464                  "lidesc 0x%p liflags %s",
 465                  MAJOR(__entry->dev), MINOR(__entry->dev),
 466                  (unsigned long long)__entry->buf_bno,
 467                  __entry->buf_len,
 468                  __entry->buf_hold,
 469                  __entry->buf_pincount,
 470                  __entry->buf_lockval,
 471                  __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
 472                  __entry->bli_recur,
 473                  __entry->bli_refcount,
 474                  __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
 475                  __entry->li_desc,
 476                  __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
 477)
 478
 479#define DEFINE_BUF_ITEM_EVENT(name) \
 480DEFINE_EVENT(xfs_buf_item_class, name, \
 481        TP_PROTO(struct xfs_buf_log_item *bip), \
 482        TP_ARGS(bip))
 483DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
 484DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
 485DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
 486DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
 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_unlock);
 491DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
 492DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
 493DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
 494DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
 495DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
 496DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
 497DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
 498DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
 499DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
 500DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
 501DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
 502DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
 503DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
 504DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
 505DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
 506
 507DECLARE_EVENT_CLASS(xfs_lock_class,
 508        TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
 509                 unsigned long caller_ip),
 510        TP_ARGS(ip,  lock_flags, caller_ip),
 511        TP_STRUCT__entry(
 512                __field(dev_t, dev)
 513                __field(xfs_ino_t, ino)
 514                __field(int, lock_flags)
 515                __field(unsigned long, caller_ip)
 516        ),
 517        TP_fast_assign(
 518                __entry->dev = VFS_I(ip)->i_sb->s_dev;
 519                __entry->ino = ip->i_ino;
 520                __entry->lock_flags = lock_flags;
 521                __entry->caller_ip = caller_ip;
 522        ),
 523        TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf",
 524                  MAJOR(__entry->dev), MINOR(__entry->dev),
 525                  __entry->ino,
 526                  __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
 527                  (void *)__entry->caller_ip)
 528)
 529
 530#define DEFINE_LOCK_EVENT(name) \
 531DEFINE_EVENT(xfs_lock_class, name, \
 532        TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
 533                 unsigned long caller_ip), \
 534        TP_ARGS(ip,  lock_flags, caller_ip))
 535DEFINE_LOCK_EVENT(xfs_ilock);
 536DEFINE_LOCK_EVENT(xfs_ilock_nowait);
 537DEFINE_LOCK_EVENT(xfs_ilock_demote);
 538DEFINE_LOCK_EVENT(xfs_iunlock);
 539
 540DECLARE_EVENT_CLASS(xfs_inode_class,
 541        TP_PROTO(struct xfs_inode *ip),
 542        TP_ARGS(ip),
 543        TP_STRUCT__entry(
 544                __field(dev_t, dev)
 545                __field(xfs_ino_t, ino)
 546        ),
 547        TP_fast_assign(
 548                __entry->dev = VFS_I(ip)->i_sb->s_dev;
 549                __entry->ino = ip->i_ino;
 550        ),
 551        TP_printk("dev %d:%d ino 0x%llx",
 552                  MAJOR(__entry->dev), MINOR(__entry->dev),
 553                  __entry->ino)
 554)
 555
 556#define DEFINE_INODE_EVENT(name) \
 557DEFINE_EVENT(xfs_inode_class, name, \
 558        TP_PROTO(struct xfs_inode *ip), \
 559        TP_ARGS(ip))
 560DEFINE_INODE_EVENT(xfs_iget_skip);
 561DEFINE_INODE_EVENT(xfs_iget_reclaim);
 562DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
 563DEFINE_INODE_EVENT(xfs_iget_hit);
 564DEFINE_INODE_EVENT(xfs_iget_miss);
 565
 566DEFINE_INODE_EVENT(xfs_getattr);
 567DEFINE_INODE_EVENT(xfs_setattr);
 568DEFINE_INODE_EVENT(xfs_readlink);
 569DEFINE_INODE_EVENT(xfs_alloc_file_space);
 570DEFINE_INODE_EVENT(xfs_free_file_space);
 571DEFINE_INODE_EVENT(xfs_readdir);
 572#ifdef CONFIG_XFS_POSIX_ACL
 573DEFINE_INODE_EVENT(xfs_get_acl);
 574#endif
 575DEFINE_INODE_EVENT(xfs_vm_bmap);
 576DEFINE_INODE_EVENT(xfs_file_ioctl);
 577DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
 578DEFINE_INODE_EVENT(xfs_ioctl_setattr);
 579DEFINE_INODE_EVENT(xfs_dir_fsync);
 580DEFINE_INODE_EVENT(xfs_file_fsync);
 581DEFINE_INODE_EVENT(xfs_destroy_inode);
 582DEFINE_INODE_EVENT(xfs_evict_inode);
 583DEFINE_INODE_EVENT(xfs_update_time);
 584
 585DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
 586DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
 587
 588DECLARE_EVENT_CLASS(xfs_iref_class,
 589        TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
 590        TP_ARGS(ip, caller_ip),
 591        TP_STRUCT__entry(
 592                __field(dev_t, dev)
 593                __field(xfs_ino_t, ino)
 594                __field(int, count)
 595                __field(int, pincount)
 596                __field(unsigned long, caller_ip)
 597        ),
 598        TP_fast_assign(
 599                __entry->dev = VFS_I(ip)->i_sb->s_dev;
 600                __entry->ino = ip->i_ino;
 601                __entry->count = atomic_read(&VFS_I(ip)->i_count);
 602                __entry->pincount = atomic_read(&ip->i_pincount);
 603                __entry->caller_ip = caller_ip;
 604        ),
 605        TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pf",
 606                  MAJOR(__entry->dev), MINOR(__entry->dev),
 607                  __entry->ino,
 608                  __entry->count,
 609                  __entry->pincount,
 610                  (char *)__entry->caller_ip)
 611)
 612
 613#define DEFINE_IREF_EVENT(name) \
 614DEFINE_EVENT(xfs_iref_class, name, \
 615        TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
 616        TP_ARGS(ip, caller_ip))
 617DEFINE_IREF_EVENT(xfs_ihold);
 618DEFINE_IREF_EVENT(xfs_irele);
 619DEFINE_IREF_EVENT(xfs_inode_pin);
 620DEFINE_IREF_EVENT(xfs_inode_unpin);
 621DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
 622
 623DECLARE_EVENT_CLASS(xfs_namespace_class,
 624        TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
 625        TP_ARGS(dp, name),
 626        TP_STRUCT__entry(
 627                __field(dev_t, dev)
 628                __field(xfs_ino_t, dp_ino)
 629                __field(int, namelen)
 630                __dynamic_array(char, name, name->len)
 631        ),
 632        TP_fast_assign(
 633                __entry->dev = VFS_I(dp)->i_sb->s_dev;
 634                __entry->dp_ino = dp->i_ino;
 635                __entry->namelen = name->len;
 636                memcpy(__get_str(name), name->name, name->len);
 637        ),
 638        TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
 639                  MAJOR(__entry->dev), MINOR(__entry->dev),
 640                  __entry->dp_ino,
 641                  __entry->namelen,
 642                  __get_str(name))
 643)
 644
 645#define DEFINE_NAMESPACE_EVENT(name) \
 646DEFINE_EVENT(xfs_namespace_class, name, \
 647        TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
 648        TP_ARGS(dp, name))
 649DEFINE_NAMESPACE_EVENT(xfs_remove);
 650DEFINE_NAMESPACE_EVENT(xfs_link);
 651DEFINE_NAMESPACE_EVENT(xfs_lookup);
 652DEFINE_NAMESPACE_EVENT(xfs_create);
 653DEFINE_NAMESPACE_EVENT(xfs_symlink);
 654
 655TRACE_EVENT(xfs_rename,
 656        TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
 657                 struct xfs_name *src_name, struct xfs_name *target_name),
 658        TP_ARGS(src_dp, target_dp, src_name, target_name),
 659        TP_STRUCT__entry(
 660                __field(dev_t, dev)
 661                __field(xfs_ino_t, src_dp_ino)
 662                __field(xfs_ino_t, target_dp_ino)
 663                __field(int, src_namelen)
 664                __field(int, target_namelen)
 665                __dynamic_array(char, src_name, src_name->len)
 666                __dynamic_array(char, target_name, target_name->len)
 667        ),
 668        TP_fast_assign(
 669                __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
 670                __entry->src_dp_ino = src_dp->i_ino;
 671                __entry->target_dp_ino = target_dp->i_ino;
 672                __entry->src_namelen = src_name->len;
 673                __entry->target_namelen = target_name->len;
 674                memcpy(__get_str(src_name), src_name->name, src_name->len);
 675                memcpy(__get_str(target_name), target_name->name,
 676                        target_name->len);
 677        ),
 678        TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
 679                  " src name %.*s target name %.*s",
 680                  MAJOR(__entry->dev), MINOR(__entry->dev),
 681                  __entry->src_dp_ino,
 682                  __entry->target_dp_ino,
 683                  __entry->src_namelen,
 684                  __get_str(src_name),
 685                  __entry->target_namelen,
 686                  __get_str(target_name))
 687)
 688
 689DECLARE_EVENT_CLASS(xfs_dquot_class,
 690        TP_PROTO(struct xfs_dquot *dqp),
 691        TP_ARGS(dqp),
 692        TP_STRUCT__entry(
 693                __field(dev_t, dev)
 694                __field(u32, id)
 695                __field(unsigned, flags)
 696                __field(unsigned, nrefs)
 697                __field(unsigned long long, res_bcount)
 698                __field(unsigned long long, bcount)
 699                __field(unsigned long long, icount)
 700                __field(unsigned long long, blk_hardlimit)
 701                __field(unsigned long long, blk_softlimit)
 702                __field(unsigned long long, ino_hardlimit)
 703                __field(unsigned long long, ino_softlimit)
 704        ), \
 705        TP_fast_assign(
 706                __entry->dev = dqp->q_mount->m_super->s_dev;
 707                __entry->id = be32_to_cpu(dqp->q_core.d_id);
 708                __entry->flags = dqp->dq_flags;
 709                __entry->nrefs = dqp->q_nrefs;
 710                __entry->res_bcount = dqp->q_res_bcount;
 711                __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
 712                __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
 713                __entry->blk_hardlimit =
 714                        be64_to_cpu(dqp->q_core.d_blk_hardlimit);
 715                __entry->blk_softlimit =
 716                        be64_to_cpu(dqp->q_core.d_blk_softlimit);
 717                __entry->ino_hardlimit =
 718                        be64_to_cpu(dqp->q_core.d_ino_hardlimit);
 719                __entry->ino_softlimit =
 720                        be64_to_cpu(dqp->q_core.d_ino_softlimit);
 721        ),
 722        TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
 723                  "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
 724                  "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
 725                  MAJOR(__entry->dev), MINOR(__entry->dev),
 726                  __entry->id,
 727                  __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
 728                  __entry->nrefs,
 729                  __entry->res_bcount,
 730                  __entry->bcount,
 731                  __entry->blk_hardlimit,
 732                  __entry->blk_softlimit,
 733                  __entry->icount,
 734                  __entry->ino_hardlimit,
 735                  __entry->ino_softlimit)
 736)
 737
 738#define DEFINE_DQUOT_EVENT(name) \
 739DEFINE_EVENT(xfs_dquot_class, name, \
 740        TP_PROTO(struct xfs_dquot *dqp), \
 741        TP_ARGS(dqp))
 742DEFINE_DQUOT_EVENT(xfs_dqadjust);
 743DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
 744DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
 745DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
 746DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
 747DEFINE_DQUOT_EVENT(xfs_dqattach_found);
 748DEFINE_DQUOT_EVENT(xfs_dqattach_get);
 749DEFINE_DQUOT_EVENT(xfs_dqalloc);
 750DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
 751DEFINE_DQUOT_EVENT(xfs_dqread);
 752DEFINE_DQUOT_EVENT(xfs_dqread_fail);
 753DEFINE_DQUOT_EVENT(xfs_dqget_hit);
 754DEFINE_DQUOT_EVENT(xfs_dqget_miss);
 755DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
 756DEFINE_DQUOT_EVENT(xfs_dqget_dup);
 757DEFINE_DQUOT_EVENT(xfs_dqput);
 758DEFINE_DQUOT_EVENT(xfs_dqput_wait);
 759DEFINE_DQUOT_EVENT(xfs_dqput_free);
 760DEFINE_DQUOT_EVENT(xfs_dqrele);
 761DEFINE_DQUOT_EVENT(xfs_dqflush);
 762DEFINE_DQUOT_EVENT(xfs_dqflush_force);
 763DEFINE_DQUOT_EVENT(xfs_dqflush_done);
 764
 765DECLARE_EVENT_CLASS(xfs_loggrant_class,
 766        TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
 767        TP_ARGS(log, tic),
 768        TP_STRUCT__entry(
 769                __field(dev_t, dev)
 770                __field(unsigned, trans_type)
 771                __field(char, ocnt)
 772                __field(char, cnt)
 773                __field(int, curr_res)
 774                __field(int, unit_res)
 775                __field(unsigned int, flags)
 776                __field(int, reserveq)
 777                __field(int, writeq)
 778                __field(int, grant_reserve_cycle)
 779                __field(int, grant_reserve_bytes)
 780                __field(int, grant_write_cycle)
 781                __field(int, grant_write_bytes)
 782                __field(int, curr_cycle)
 783                __field(int, curr_block)
 784                __field(xfs_lsn_t, tail_lsn)
 785        ),
 786        TP_fast_assign(
 787                __entry->dev = log->l_mp->m_super->s_dev;
 788                __entry->trans_type = tic->t_trans_type;
 789                __entry->ocnt = tic->t_ocnt;
 790                __entry->cnt = tic->t_cnt;
 791                __entry->curr_res = tic->t_curr_res;
 792                __entry->unit_res = tic->t_unit_res;
 793                __entry->flags = tic->t_flags;
 794                __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
 795                __entry->writeq = list_empty(&log->l_write_head.waiters);
 796                xlog_crack_grant_head(&log->l_reserve_head.grant,
 797                                &__entry->grant_reserve_cycle,
 798                                &__entry->grant_reserve_bytes);
 799                xlog_crack_grant_head(&log->l_write_head.grant,
 800                                &__entry->grant_write_cycle,
 801                                &__entry->grant_write_bytes);
 802                __entry->curr_cycle = log->l_curr_cycle;
 803                __entry->curr_block = log->l_curr_block;
 804                __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
 805        ),
 806        TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u "
 807                  "t_unit_res %u t_flags %s reserveq %s "
 808                  "writeq %s grant_reserve_cycle %d "
 809                  "grant_reserve_bytes %d grant_write_cycle %d "
 810                  "grant_write_bytes %d curr_cycle %d curr_block %d "
 811                  "tail_cycle %d tail_block %d",
 812                  MAJOR(__entry->dev), MINOR(__entry->dev),
 813                  __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES),
 814                  __entry->ocnt,
 815                  __entry->cnt,
 816                  __entry->curr_res,
 817                  __entry->unit_res,
 818                  __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
 819                  __entry->reserveq ? "empty" : "active",
 820                  __entry->writeq ? "empty" : "active",
 821                  __entry->grant_reserve_cycle,
 822                  __entry->grant_reserve_bytes,
 823                  __entry->grant_write_cycle,
 824                  __entry->grant_write_bytes,
 825                  __entry->curr_cycle,
 826                  __entry->curr_block,
 827                  CYCLE_LSN(__entry->tail_lsn),
 828                  BLOCK_LSN(__entry->tail_lsn)
 829        )
 830)
 831
 832#define DEFINE_LOGGRANT_EVENT(name) \
 833DEFINE_EVENT(xfs_loggrant_class, name, \
 834        TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
 835        TP_ARGS(log, tic))
 836DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
 837DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
 838DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
 839DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
 840DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
 841DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
 842DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
 843DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
 844DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
 845DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
 846DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
 847DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
 848DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
 849DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
 850DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
 851DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
 852
 853DECLARE_EVENT_CLASS(xfs_log_item_class,
 854        TP_PROTO(struct xfs_log_item *lip),
 855        TP_ARGS(lip),
 856        TP_STRUCT__entry(
 857                __field(dev_t, dev)
 858                __field(void *, lip)
 859                __field(uint, type)
 860                __field(uint, flags)
 861                __field(xfs_lsn_t, lsn)
 862        ),
 863        TP_fast_assign(
 864                __entry->dev = lip->li_mountp->m_super->s_dev;
 865                __entry->lip = lip;
 866                __entry->type = lip->li_type;
 867                __entry->flags = lip->li_flags;
 868                __entry->lsn = lip->li_lsn;
 869        ),
 870        TP_printk("dev %d:%d lip 0x%p lsn %d/%d type %s flags %s",
 871                  MAJOR(__entry->dev), MINOR(__entry->dev),
 872                  __entry->lip,
 873                  CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
 874                  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
 875                  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
 876)
 877
 878TRACE_EVENT(xfs_log_force,
 879        TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn),
 880        TP_ARGS(mp, lsn),
 881        TP_STRUCT__entry(
 882                __field(dev_t, dev)
 883                __field(xfs_lsn_t, lsn)
 884        ),
 885        TP_fast_assign(
 886                __entry->dev = mp->m_super->s_dev;
 887                __entry->lsn = lsn;
 888        ),
 889        TP_printk("dev %d:%d lsn 0x%llx",
 890                  MAJOR(__entry->dev), MINOR(__entry->dev),
 891                  __entry->lsn)
 892)
 893
 894#define DEFINE_LOG_ITEM_EVENT(name) \
 895DEFINE_EVENT(xfs_log_item_class, name, \
 896        TP_PROTO(struct xfs_log_item *lip), \
 897        TP_ARGS(lip))
 898DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
 899DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
 900DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
 901DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
 902
 903
 904DECLARE_EVENT_CLASS(xfs_file_class,
 905        TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),
 906        TP_ARGS(ip, count, offset, flags),
 907        TP_STRUCT__entry(
 908                __field(dev_t, dev)
 909                __field(xfs_ino_t, ino)
 910                __field(xfs_fsize_t, size)
 911                __field(loff_t, offset)
 912                __field(size_t, count)
 913                __field(int, flags)
 914        ),
 915        TP_fast_assign(
 916                __entry->dev = VFS_I(ip)->i_sb->s_dev;
 917                __entry->ino = ip->i_ino;
 918                __entry->size = ip->i_d.di_size;
 919                __entry->offset = offset;
 920                __entry->count = count;
 921                __entry->flags = flags;
 922        ),
 923        TP_printk("dev %d:%d ino 0x%llx size 0x%llx "
 924                  "offset 0x%llx count 0x%zx ioflags %s",
 925                  MAJOR(__entry->dev), MINOR(__entry->dev),
 926                  __entry->ino,
 927                  __entry->size,
 928                  __entry->offset,
 929                  __entry->count,
 930                  __print_flags(__entry->flags, "|", XFS_IO_FLAGS))
 931)
 932
 933#define DEFINE_RW_EVENT(name)           \
 934DEFINE_EVENT(xfs_file_class, name,      \
 935        TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags), \
 936        TP_ARGS(ip, count, offset, flags))
 937DEFINE_RW_EVENT(xfs_file_read);
 938DEFINE_RW_EVENT(xfs_file_buffered_write);
 939DEFINE_RW_EVENT(xfs_file_direct_write);
 940DEFINE_RW_EVENT(xfs_file_splice_read);
 941DEFINE_RW_EVENT(xfs_file_splice_write);
 942
 943DECLARE_EVENT_CLASS(xfs_page_class,
 944        TP_PROTO(struct inode *inode, struct page *page, unsigned long off),
 945        TP_ARGS(inode, page, off),
 946        TP_STRUCT__entry(
 947                __field(dev_t, dev)
 948                __field(xfs_ino_t, ino)
 949                __field(pgoff_t, pgoff)
 950                __field(loff_t, size)
 951                __field(unsigned long, offset)
 952                __field(int, delalloc)
 953                __field(int, unwritten)
 954        ),
 955        TP_fast_assign(
 956                int delalloc = -1, unwritten = -1;
 957
 958                if (page_has_buffers(page))
 959                        xfs_count_page_state(page, &delalloc, &unwritten);
 960                __entry->dev = inode->i_sb->s_dev;
 961                __entry->ino = XFS_I(inode)->i_ino;
 962                __entry->pgoff = page_offset(page);
 963                __entry->size = i_size_read(inode);
 964                __entry->offset = off;
 965                __entry->delalloc = delalloc;
 966                __entry->unwritten = unwritten;
 967        ),
 968        TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
 969                  "delalloc %d unwritten %d",
 970                  MAJOR(__entry->dev), MINOR(__entry->dev),
 971                  __entry->ino,
 972                  __entry->pgoff,
 973                  __entry->size,
 974                  __entry->offset,
 975                  __entry->delalloc,
 976                  __entry->unwritten)
 977)
 978
 979#define DEFINE_PAGE_EVENT(name)         \
 980DEFINE_EVENT(xfs_page_class, name,      \
 981        TP_PROTO(struct inode *inode, struct page *page, unsigned long off),    \
 982        TP_ARGS(inode, page, off))
 983DEFINE_PAGE_EVENT(xfs_writepage);
 984DEFINE_PAGE_EVENT(xfs_releasepage);
 985DEFINE_PAGE_EVENT(xfs_invalidatepage);
 986
 987DECLARE_EVENT_CLASS(xfs_imap_class,
 988        TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
 989                 int type, struct xfs_bmbt_irec *irec),
 990        TP_ARGS(ip, offset, count, type, irec),
 991        TP_STRUCT__entry(
 992                __field(dev_t, dev)
 993                __field(xfs_ino_t, ino)
 994                __field(loff_t, size)
 995                __field(loff_t, offset)
 996                __field(size_t, count)
 997                __field(int, type)
 998                __field(xfs_fileoff_t, startoff)
 999                __field(xfs_fsblock_t, startblock)
1000                __field(xfs_filblks_t, blockcount)
1001        ),
1002        TP_fast_assign(
1003                __entry->dev = VFS_I(ip)->i_sb->s_dev;
1004                __entry->ino = ip->i_ino;
1005                __entry->size = ip->i_d.di_size;
1006                __entry->offset = offset;
1007                __entry->count = count;
1008                __entry->type = type;
1009                __entry->startoff = irec ? irec->br_startoff : 0;
1010                __entry->startblock = irec ? irec->br_startblock : 0;
1011                __entry->blockcount = irec ? irec->br_blockcount : 0;
1012        ),
1013        TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1014                  "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
1015                  MAJOR(__entry->dev), MINOR(__entry->dev),
1016                  __entry->ino,
1017                  __entry->size,
1018                  __entry->offset,
1019                  __entry->count,
1020                  __print_symbolic(__entry->type, XFS_IO_TYPES),
1021                  __entry->startoff,
1022                  (__int64_t)__entry->startblock,
1023                  __entry->blockcount)
1024)
1025
1026#define DEFINE_IOMAP_EVENT(name)        \
1027DEFINE_EVENT(xfs_imap_class, name,      \
1028        TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
1029                 int type, struct xfs_bmbt_irec *irec),         \
1030        TP_ARGS(ip, offset, count, type, irec))
1031DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1032DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1033DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1034DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
1035
1036DECLARE_EVENT_CLASS(xfs_simple_io_class,
1037        TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1038        TP_ARGS(ip, offset, count),
1039        TP_STRUCT__entry(
1040                __field(dev_t, dev)
1041                __field(xfs_ino_t, ino)
1042                __field(loff_t, isize)
1043                __field(loff_t, disize)
1044                __field(loff_t, offset)
1045                __field(size_t, count)
1046        ),
1047        TP_fast_assign(
1048                __entry->dev = VFS_I(ip)->i_sb->s_dev;
1049                __entry->ino = ip->i_ino;
1050                __entry->isize = VFS_I(ip)->i_size;
1051                __entry->disize = ip->i_d.di_size;
1052                __entry->offset = offset;
1053                __entry->count = count;
1054        ),
1055        TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
1056                  "offset 0x%llx count %zd",
1057                  MAJOR(__entry->dev), MINOR(__entry->dev),
1058                  __entry->ino,
1059                  __entry->isize,
1060                  __entry->disize,
1061                  __entry->offset,
1062                  __entry->count)
1063);
1064
1065#define DEFINE_SIMPLE_IO_EVENT(name)    \
1066DEFINE_EVENT(xfs_simple_io_class, name, \
1067        TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),        \
1068        TP_ARGS(ip, offset, count))
1069DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1070DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
1071DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
1072DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
1073
1074DECLARE_EVENT_CLASS(xfs_itrunc_class,
1075        TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1076        TP_ARGS(ip, new_size),
1077        TP_STRUCT__entry(
1078                __field(dev_t, dev)
1079                __field(xfs_ino_t, ino)
1080                __field(xfs_fsize_t, size)
1081                __field(xfs_fsize_t, new_size)
1082        ),
1083        TP_fast_assign(
1084                __entry->dev = VFS_I(ip)->i_sb->s_dev;
1085                __entry->ino = ip->i_ino;
1086                __entry->size = ip->i_d.di_size;
1087                __entry->new_size = new_size;
1088        ),
1089        TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1090                  MAJOR(__entry->dev), MINOR(__entry->dev),
1091                  __entry->ino,
1092                  __entry->size,
1093                  __entry->new_size)
1094)
1095
1096#define DEFINE_ITRUNC_EVENT(name) \
1097DEFINE_EVENT(xfs_itrunc_class, name, \
1098        TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1099        TP_ARGS(ip, new_size))
1100DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1101DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
1102
1103TRACE_EVENT(xfs_pagecache_inval,
1104        TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1105        TP_ARGS(ip, start, finish),
1106        TP_STRUCT__entry(
1107                __field(dev_t, dev)
1108                __field(xfs_ino_t, ino)
1109                __field(xfs_fsize_t, size)
1110                __field(xfs_off_t, start)
1111                __field(xfs_off_t, finish)
1112        ),
1113        TP_fast_assign(
1114                __entry->dev = VFS_I(ip)->i_sb->s_dev;
1115                __entry->ino = ip->i_ino;
1116                __entry->size = ip->i_d.di_size;
1117                __entry->start = start;
1118                __entry->finish = finish;
1119        ),
1120        TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1121                  MAJOR(__entry->dev), MINOR(__entry->dev),
1122                  __entry->ino,
1123                  __entry->size,
1124                  __entry->start,
1125                  __entry->finish)
1126);
1127
1128TRACE_EVENT(xfs_bunmap,
1129        TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1130                 int flags, unsigned long caller_ip),
1131        TP_ARGS(ip, bno, len, flags, caller_ip),
1132        TP_STRUCT__entry(
1133                __field(dev_t, dev)
1134                __field(xfs_ino_t, ino)
1135                __field(xfs_fsize_t, size)
1136                __field(xfs_fileoff_t, bno)
1137                __field(xfs_filblks_t, len)
1138                __field(unsigned long, caller_ip)
1139                __field(int, flags)
1140        ),
1141        TP_fast_assign(
1142                __entry->dev = VFS_I(ip)->i_sb->s_dev;
1143                __entry->ino = ip->i_ino;
1144                __entry->size = ip->i_d.di_size;
1145                __entry->bno = bno;
1146                __entry->len = len;
1147                __entry->caller_ip = caller_ip;
1148                __entry->flags = flags;
1149        ),
1150        TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
1151                  "flags %s caller %pf",
1152                  MAJOR(__entry->dev), MINOR(__entry->dev),
1153                  __entry->ino,
1154                  __entry->size,
1155                  __entry->bno,
1156                  __entry->len,
1157                  __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1158                  (void *)__entry->caller_ip)
1159
1160);
1161
1162DECLARE_EVENT_CLASS(xfs_extent_busy_class,
1163        TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1164                 xfs_agblock_t agbno, xfs_extlen_t len),
1165        TP_ARGS(mp, agno, agbno, len),
1166        TP_STRUCT__entry(
1167                __field(dev_t, dev)
1168                __field(xfs_agnumber_t, agno)
1169                __field(xfs_agblock_t, agbno)
1170                __field(xfs_extlen_t, len)
1171        ),
1172        TP_fast_assign(
1173                __entry->dev = mp->m_super->s_dev;
1174                __entry->agno = agno;
1175                __entry->agbno = agbno;
1176                __entry->len = len;
1177        ),
1178        TP_printk("dev %d:%d agno %u agbno %u len %u",
1179                  MAJOR(__entry->dev), MINOR(__entry->dev),
1180                  __entry->agno,
1181                  __entry->agbno,
1182                  __entry->len)
1183);
1184#define DEFINE_BUSY_EVENT(name) \
1185DEFINE_EVENT(xfs_extent_busy_class, name, \
1186        TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1187                 xfs_agblock_t agbno, xfs_extlen_t len), \
1188        TP_ARGS(mp, agno, agbno, len))
1189DEFINE_BUSY_EVENT(xfs_extent_busy);
1190DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1191DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1192DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1193DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
1194
1195TRACE_EVENT(xfs_extent_busy_trim,
1196        TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1197                 xfs_agblock_t agbno, xfs_extlen_t len,
1198                 xfs_agblock_t tbno, xfs_extlen_t tlen),
1199        TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1200        TP_STRUCT__entry(
1201                __field(dev_t, dev)
1202                __field(xfs_agnumber_t, agno)
1203                __field(xfs_agblock_t, agbno)
1204                __field(xfs_extlen_t, len)
1205                __field(xfs_agblock_t, tbno)
1206                __field(xfs_extlen_t, tlen)
1207        ),
1208        TP_fast_assign(
1209                __entry->dev = mp->m_super->s_dev;
1210                __entry->agno = agno;
1211                __entry->agbno = agbno;
1212                __entry->len = len;
1213                __entry->tbno = tbno;
1214                __entry->tlen = tlen;
1215        ),
1216        TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1217                  MAJOR(__entry->dev), MINOR(__entry->dev),
1218                  __entry->agno,
1219                  __entry->agbno,
1220                  __entry->len,
1221                  __entry->tbno,
1222                  __entry->tlen)
1223);
1224
1225TRACE_EVENT(xfs_trans_commit_lsn,
1226        TP_PROTO(struct xfs_trans *trans),
1227        TP_ARGS(trans),
1228        TP_STRUCT__entry(
1229                __field(dev_t, dev)
1230                __field(struct xfs_trans *, tp)
1231                __field(xfs_lsn_t, lsn)
1232        ),
1233        TP_fast_assign(
1234                __entry->dev = trans->t_mountp->m_super->s_dev;
1235                __entry->tp = trans;
1236                __entry->lsn = trans->t_commit_lsn;
1237        ),
1238        TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
1239                  MAJOR(__entry->dev), MINOR(__entry->dev),
1240                  __entry->tp,
1241                  __entry->lsn)
1242);
1243
1244TRACE_EVENT(xfs_agf,
1245        TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1246                 unsigned long caller_ip),
1247        TP_ARGS(mp, agf, flags, caller_ip),
1248        TP_STRUCT__entry(
1249                __field(dev_t, dev)
1250                __field(xfs_agnumber_t, agno)
1251                __field(int, flags)
1252                __field(__u32, length)
1253                __field(__u32, bno_root)
1254                __field(__u32, cnt_root)
1255                __field(__u32, bno_level)
1256                __field(__u32, cnt_level)
1257                __field(__u32, flfirst)
1258                __field(__u32, fllast)
1259                __field(__u32, flcount)
1260                __field(__u32, freeblks)
1261                __field(__u32, longest)
1262                __field(unsigned long, caller_ip)
1263        ),
1264        TP_fast_assign(
1265                __entry->dev = mp->m_super->s_dev;
1266                __entry->agno = be32_to_cpu(agf->agf_seqno),
1267                __entry->flags = flags;
1268                __entry->length = be32_to_cpu(agf->agf_length),
1269                __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1270                __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1271                __entry->bno_level =
1272                                be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1273                __entry->cnt_level =
1274                                be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1275                __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1276                __entry->fllast = be32_to_cpu(agf->agf_fllast),
1277                __entry->flcount = be32_to_cpu(agf->agf_flcount),
1278                __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1279                __entry->longest = be32_to_cpu(agf->agf_longest);
1280                __entry->caller_ip = caller_ip;
1281        ),
1282        TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1283                  "levels b %u c %u flfirst %u fllast %u flcount %u "
1284                  "freeblks %u longest %u caller %pf",
1285                  MAJOR(__entry->dev), MINOR(__entry->dev),
1286                  __entry->agno,
1287                  __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1288                  __entry->length,
1289                  __entry->bno_root,
1290                  __entry->cnt_root,
1291                  __entry->bno_level,
1292                  __entry->cnt_level,
1293                  __entry->flfirst,
1294                  __entry->fllast,
1295                  __entry->flcount,
1296                  __entry->freeblks,
1297                  __entry->longest,
1298                  (void *)__entry->caller_ip)
1299);
1300
1301TRACE_EVENT(xfs_free_extent,
1302        TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1303                 xfs_extlen_t len, bool isfl, int haveleft, int haveright),
1304        TP_ARGS(mp, agno, agbno, len, isfl, haveleft, haveright),
1305        TP_STRUCT__entry(
1306                __field(dev_t, dev)
1307                __field(xfs_agnumber_t, agno)
1308                __field(xfs_agblock_t, agbno)
1309                __field(xfs_extlen_t, len)
1310                __field(int, isfl)
1311                __field(int, haveleft)
1312                __field(int, haveright)
1313        ),
1314        TP_fast_assign(
1315                __entry->dev = mp->m_super->s_dev;
1316                __entry->agno = agno;
1317                __entry->agbno = agbno;
1318                __entry->len = len;
1319                __entry->isfl = isfl;
1320                __entry->haveleft = haveleft;
1321                __entry->haveright = haveright;
1322        ),
1323        TP_printk("dev %d:%d agno %u agbno %u len %u isfl %d %s",
1324                  MAJOR(__entry->dev), MINOR(__entry->dev),
1325                  __entry->agno,
1326                  __entry->agbno,
1327                  __entry->len,
1328                  __entry->isfl,
1329                  __entry->haveleft ?
1330                        (__entry->haveright ? "both" : "left") :
1331                        (__entry->haveright ? "right" : "none"))
1332
1333);
1334
1335DECLARE_EVENT_CLASS(xfs_alloc_class,
1336        TP_PROTO(struct xfs_alloc_arg *args),
1337        TP_ARGS(args),
1338        TP_STRUCT__entry(
1339                __field(dev_t, dev)
1340                __field(xfs_agnumber_t, agno)
1341                __field(xfs_agblock_t, agbno)
1342                __field(xfs_extlen_t, minlen)
1343                __field(xfs_extlen_t, maxlen)
1344                __field(xfs_extlen_t, mod)
1345                __field(xfs_extlen_t, prod)
1346                __field(xfs_extlen_t, minleft)
1347                __field(xfs_extlen_t, total)
1348                __field(xfs_extlen_t, alignment)
1349                __field(xfs_extlen_t, minalignslop)
1350                __field(xfs_extlen_t, len)
1351                __field(short, type)
1352                __field(short, otype)
1353                __field(char, wasdel)
1354                __field(char, wasfromfl)
1355                __field(char, isfl)
1356                __field(char, userdata)
1357                __field(xfs_fsblock_t, firstblock)
1358        ),
1359        TP_fast_assign(
1360                __entry->dev = args->mp->m_super->s_dev;
1361                __entry->agno = args->agno;
1362                __entry->agbno = args->agbno;
1363                __entry->minlen = args->minlen;
1364                __entry->maxlen = args->maxlen;
1365                __entry->mod = args->mod;
1366                __entry->prod = args->prod;
1367                __entry->minleft = args->minleft;
1368                __entry->total = args->total;
1369                __entry->alignment = args->alignment;
1370                __entry->minalignslop = args->minalignslop;
1371                __entry->len = args->len;
1372                __entry->type = args->type;
1373                __entry->otype = args->otype;
1374                __entry->wasdel = args->wasdel;
1375                __entry->wasfromfl = args->wasfromfl;
1376                __entry->isfl = args->isfl;
1377                __entry->userdata = args->userdata;
1378                __entry->firstblock = args->firstblock;
1379        ),
1380        TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1381                  "prod %u minleft %u total %u alignment %u minalignslop %u "
1382                  "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d "
1383                  "userdata %d firstblock 0x%llx",
1384                  MAJOR(__entry->dev), MINOR(__entry->dev),
1385                  __entry->agno,
1386                  __entry->agbno,
1387                  __entry->minlen,
1388                  __entry->maxlen,
1389                  __entry->mod,
1390                  __entry->prod,
1391                  __entry->minleft,
1392                  __entry->total,
1393                  __entry->alignment,
1394                  __entry->minalignslop,
1395                  __entry->len,
1396                  __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1397                  __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1398                  __entry->wasdel,
1399                  __entry->wasfromfl,
1400                  __entry->isfl,
1401                  __entry->userdata,
1402                  (unsigned long long)__entry->firstblock)
1403)
1404
1405#define DEFINE_ALLOC_EVENT(name) \
1406DEFINE_EVENT(xfs_alloc_class, name, \
1407        TP_PROTO(struct xfs_alloc_arg *args), \
1408        TP_ARGS(args))
1409DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1410DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
1411DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1412DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1413DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1414DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1415DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1416DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1417DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1418DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
1419DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1420DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1421DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1422DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1423DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1424DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
1425DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1426DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1427DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1428DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1429DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1430DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1431DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1432DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1433DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1434
1435DECLARE_EVENT_CLASS(xfs_da_class,
1436        TP_PROTO(struct xfs_da_args *args),
1437        TP_ARGS(args),
1438        TP_STRUCT__entry(
1439                __field(dev_t, dev)
1440                __field(xfs_ino_t, ino)
1441                __dynamic_array(char, name, args->namelen)
1442                __field(int, namelen)
1443                __field(xfs_dahash_t, hashval)
1444                __field(xfs_ino_t, inumber)
1445                __field(int, op_flags)
1446        ),
1447        TP_fast_assign(
1448                __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1449                __entry->ino = args->dp->i_ino;
1450                if (args->namelen)
1451                        memcpy(__get_str(name), args->name, args->namelen);
1452                __entry->namelen = args->namelen;
1453                __entry->hashval = args->hashval;
1454                __entry->inumber = args->inumber;
1455                __entry->op_flags = args->op_flags;
1456        ),
1457        TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1458                  "inumber 0x%llx op_flags %s",
1459                  MAJOR(__entry->dev), MINOR(__entry->dev),
1460                  __entry->ino,
1461                  __entry->namelen,
1462                  __entry->namelen ? __get_str(name) : NULL,
1463                  __entry->namelen,
1464                  __entry->hashval,
1465                  __entry->inumber,
1466                  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1467)
1468
1469#define DEFINE_DIR2_EVENT(name) \
1470DEFINE_EVENT(xfs_da_class, name, \
1471        TP_PROTO(struct xfs_da_args *args), \
1472        TP_ARGS(args))
1473DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1474DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1475DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1476DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1477DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1478DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1479DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1480DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1481DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1482DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1483DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1484DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1485DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1486DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1487DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1488DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1489DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1490DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1491DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1492DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1493DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1494DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1495DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1496DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1497DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1498
1499#define DEFINE_ATTR_EVENT(name) \
1500DEFINE_EVENT(xfs_da_class, name, \
1501        TP_PROTO(struct xfs_da_args *args), \
1502        TP_ARGS(args))
1503DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1504DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1505DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1506DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1507DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
1508DEFINE_ATTR_EVENT(xfs_attr_sf_removename);
1509DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1510
1511DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1512DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1513DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
1514DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1515DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
1516DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1517DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
1518DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1519DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1520DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1521DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1522DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1523DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1524DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1525DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1526DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1527DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1528DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
1529
1530DEFINE_ATTR_EVENT(xfs_attr_node_addname);
1531DEFINE_ATTR_EVENT(xfs_attr_node_lookup);
1532DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1533DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1534
1535#define DEFINE_DA_EVENT(name) \
1536DEFINE_EVENT(xfs_da_class, name, \
1537        TP_PROTO(struct xfs_da_args *args), \
1538        TP_ARGS(args))
1539DEFINE_DA_EVENT(xfs_da_split);
1540DEFINE_DA_EVENT(xfs_da_join);
1541DEFINE_DA_EVENT(xfs_da_link_before);
1542DEFINE_DA_EVENT(xfs_da_link_after);
1543DEFINE_DA_EVENT(xfs_da_unlink_back);
1544DEFINE_DA_EVENT(xfs_da_unlink_forward);
1545DEFINE_DA_EVENT(xfs_da_root_split);
1546DEFINE_DA_EVENT(xfs_da_root_join);
1547DEFINE_DA_EVENT(xfs_da_node_add);
1548DEFINE_DA_EVENT(xfs_da_node_create);
1549DEFINE_DA_EVENT(xfs_da_node_split);
1550DEFINE_DA_EVENT(xfs_da_node_remove);
1551DEFINE_DA_EVENT(xfs_da_node_rebalance);
1552DEFINE_DA_EVENT(xfs_da_node_unbalance);
1553DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1554DEFINE_DA_EVENT(xfs_da_grow_inode);
1555DEFINE_DA_EVENT(xfs_da_shrink_inode);
1556
1557DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1558        TP_PROTO(struct xfs_da_args *args, int idx),
1559        TP_ARGS(args, idx),
1560        TP_STRUCT__entry(
1561                __field(dev_t, dev)
1562                __field(xfs_ino_t, ino)
1563                __field(int, op_flags)
1564                __field(int, idx)
1565        ),
1566        TP_fast_assign(
1567                __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1568                __entry->ino = args->dp->i_ino;
1569                __entry->op_flags = args->op_flags;
1570                __entry->idx = idx;
1571        ),
1572        TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1573                  MAJOR(__entry->dev), MINOR(__entry->dev),
1574                  __entry->ino,
1575                  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1576                  __entry->idx)
1577)
1578
1579#define DEFINE_DIR2_SPACE_EVENT(name) \
1580DEFINE_EVENT(xfs_dir2_space_class, name, \
1581        TP_PROTO(struct xfs_da_args *args, int idx), \
1582        TP_ARGS(args, idx))
1583DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1584DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1585DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1586DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
1587
1588TRACE_EVENT(xfs_dir2_leafn_moveents,
1589        TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1590        TP_ARGS(args, src_idx, dst_idx, count),
1591        TP_STRUCT__entry(
1592                __field(dev_t, dev)
1593                __field(xfs_ino_t, ino)
1594                __field(int, op_flags)
1595                __field(int, src_idx)
1596                __field(int, dst_idx)
1597                __field(int, count)
1598        ),
1599        TP_fast_assign(
1600                __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1601                __entry->ino = args->dp->i_ino;
1602                __entry->op_flags = args->op_flags;
1603                __entry->src_idx = src_idx;
1604                __entry->dst_idx = dst_idx;
1605                __entry->count = count;
1606        ),
1607        TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1608                  "src_idx %d dst_idx %d count %d",
1609                  MAJOR(__entry->dev), MINOR(__entry->dev),
1610                  __entry->ino,
1611                  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1612                  __entry->src_idx,
1613                  __entry->dst_idx,
1614                  __entry->count)
1615);
1616
1617#define XFS_SWAPEXT_INODES \
1618        { 0,    "target" }, \
1619        { 1,    "temp" }
1620
1621#define XFS_INODE_FORMAT_STR \
1622        { 0,    "invalid" }, \
1623        { 1,    "local" }, \
1624        { 2,    "extent" }, \
1625        { 3,    "btree" }
1626
1627DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1628        TP_PROTO(struct xfs_inode *ip, int which),
1629        TP_ARGS(ip, which),
1630        TP_STRUCT__entry(
1631                __field(dev_t, dev)
1632                __field(int, which)
1633                __field(xfs_ino_t, ino)
1634                __field(int, format)
1635                __field(int, nex)
1636                __field(int, broot_size)
1637                __field(int, fork_off)
1638        ),
1639        TP_fast_assign(
1640                __entry->dev = VFS_I(ip)->i_sb->s_dev;
1641                __entry->which = which;
1642                __entry->ino = ip->i_ino;
1643                __entry->format = ip->i_d.di_format;
1644                __entry->nex = ip->i_d.di_nextents;
1645                __entry->broot_size = ip->i_df.if_broot_bytes;
1646                __entry->fork_off = XFS_IFORK_BOFF(ip);
1647        ),
1648        TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
1649                  "broot size %d, fork offset %d",
1650                  MAJOR(__entry->dev), MINOR(__entry->dev),
1651                  __entry->ino,
1652                  __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1653                  __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1654                  __entry->nex,
1655                  __entry->broot_size,
1656                  __entry->fork_off)
1657)
1658
1659#define DEFINE_SWAPEXT_EVENT(name) \
1660DEFINE_EVENT(xfs_swap_extent_class, name, \
1661        TP_PROTO(struct xfs_inode *ip, int which), \
1662        TP_ARGS(ip, which))
1663
1664DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1665DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1666
1667DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
1668        TP_PROTO(struct xlog *log, struct xlog_recover *trans,
1669                struct xlog_recover_item *item, int pass),
1670        TP_ARGS(log, trans, item, pass),
1671        TP_STRUCT__entry(
1672                __field(dev_t, dev)
1673                __field(unsigned long, item)
1674                __field(xlog_tid_t, tid)
1675                __field(int, type)
1676                __field(int, pass)
1677                __field(int, count)
1678                __field(int, total)
1679        ),
1680        TP_fast_assign(
1681                __entry->dev = log->l_mp->m_super->s_dev;
1682                __entry->item = (unsigned long)item;
1683                __entry->tid = trans->r_log_tid;
1684                __entry->type = ITEM_TYPE(item);
1685                __entry->pass = pass;
1686                __entry->count = item->ri_cnt;
1687                __entry->total = item->ri_total;
1688        ),
1689        TP_printk("dev %d:%d trans 0x%x, pass %d, item 0x%p, item type %s "
1690                  "item region count/total %d/%d",
1691                  MAJOR(__entry->dev), MINOR(__entry->dev),
1692                  __entry->tid,
1693                  __entry->pass,
1694                  (void *)__entry->item,
1695                  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1696                  __entry->count,
1697                  __entry->total)
1698)
1699
1700#define DEFINE_LOG_RECOVER_ITEM(name) \
1701DEFINE_EVENT(xfs_log_recover_item_class, name, \
1702        TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
1703                struct xlog_recover_item *item, int pass), \
1704        TP_ARGS(log, trans, item, pass))
1705
1706DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
1707DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
1708DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
1709DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
1710DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
1711
1712DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
1713        TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
1714        TP_ARGS(log, buf_f),
1715        TP_STRUCT__entry(
1716                __field(dev_t, dev)
1717                __field(__int64_t, blkno)
1718                __field(unsigned short, len)
1719                __field(unsigned short, flags)
1720                __field(unsigned short, size)
1721                __field(unsigned int, map_size)
1722        ),
1723        TP_fast_assign(
1724                __entry->dev = log->l_mp->m_super->s_dev;
1725                __entry->blkno = buf_f->blf_blkno;
1726                __entry->len = buf_f->blf_len;
1727                __entry->flags = buf_f->blf_flags;
1728                __entry->size = buf_f->blf_size;
1729                __entry->map_size = buf_f->blf_map_size;
1730        ),
1731        TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
1732                        "map_size %d",
1733                  MAJOR(__entry->dev), MINOR(__entry->dev),
1734                  __entry->blkno,
1735                  __entry->len,
1736                  __entry->flags,
1737                  __entry->size,
1738                  __entry->map_size)
1739)
1740
1741#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
1742DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
1743        TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
1744        TP_ARGS(log, buf_f))
1745
1746DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
1747DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
1748DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
1749DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
1750DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
1751DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
1752DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
1753DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
1754
1755DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
1756        TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
1757        TP_ARGS(log, in_f),
1758        TP_STRUCT__entry(
1759                __field(dev_t, dev)
1760                __field(xfs_ino_t, ino)
1761                __field(unsigned short, size)
1762                __field(int, fields)
1763                __field(unsigned short, asize)
1764                __field(unsigned short, dsize)
1765                __field(__int64_t, blkno)
1766                __field(int, len)
1767                __field(int, boffset)
1768        ),
1769        TP_fast_assign(
1770                __entry->dev = log->l_mp->m_super->s_dev;
1771                __entry->ino = in_f->ilf_ino;
1772                __entry->size = in_f->ilf_size;
1773                __entry->fields = in_f->ilf_fields;
1774                __entry->asize = in_f->ilf_asize;
1775                __entry->dsize = in_f->ilf_dsize;
1776                __entry->blkno = in_f->ilf_blkno;
1777                __entry->len = in_f->ilf_len;
1778                __entry->boffset = in_f->ilf_boffset;
1779        ),
1780        TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
1781                        "dsize %d, blkno 0x%llx, len %d, boffset %d",
1782                  MAJOR(__entry->dev), MINOR(__entry->dev),
1783                  __entry->ino,
1784                  __entry->size,
1785                  __entry->fields,
1786                  __entry->asize,
1787                  __entry->dsize,
1788                  __entry->blkno,
1789                  __entry->len,
1790                  __entry->boffset)
1791)
1792#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
1793DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
1794        TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
1795        TP_ARGS(log, in_f))
1796
1797DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
1798DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
1799DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
1800
1801DECLARE_EVENT_CLASS(xfs_discard_class,
1802        TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1803                 xfs_agblock_t agbno, xfs_extlen_t len),
1804        TP_ARGS(mp, agno, agbno, len),
1805        TP_STRUCT__entry(
1806                __field(dev_t, dev)
1807                __field(xfs_agnumber_t, agno)
1808                __field(xfs_agblock_t, agbno)
1809                __field(xfs_extlen_t, len)
1810        ),
1811        TP_fast_assign(
1812                __entry->dev = mp->m_super->s_dev;
1813                __entry->agno = agno;
1814                __entry->agbno = agbno;
1815                __entry->len = len;
1816        ),
1817        TP_printk("dev %d:%d agno %u agbno %u len %u\n",
1818                  MAJOR(__entry->dev), MINOR(__entry->dev),
1819                  __entry->agno,
1820                  __entry->agbno,
1821                  __entry->len)
1822)
1823
1824#define DEFINE_DISCARD_EVENT(name) \
1825DEFINE_EVENT(xfs_discard_class, name, \
1826        TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1827                 xfs_agblock_t agbno, xfs_extlen_t len), \
1828        TP_ARGS(mp, agno, agbno, len))
1829DEFINE_DISCARD_EVENT(xfs_discard_extent);
1830DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
1831DEFINE_DISCARD_EVENT(xfs_discard_exclude);
1832DEFINE_DISCARD_EVENT(xfs_discard_busy);
1833
1834#endif /* _TRACE_XFS_H */
1835
1836#undef TRACE_INCLUDE_PATH
1837#define TRACE_INCLUDE_PATH .
1838#define TRACE_INCLUDE_FILE xfs_trace
1839#include <trace/define_trace.h>
1840
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.