xfs_trace.h 129.2 KB
Newer Older
D
Dave Chinner 已提交
1
// SPDX-License-Identifier: GPL-2.0
C
Christoph Hellwig 已提交
2 3 4
/*
 * Copyright (c) 2009, Christoph Hellwig
 * All Rights Reserved.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
 *
 * NOTE: none of these tracepoints shall be considered a stable kernel ABI
 * as they can change at any time.
 *
 * Current conventions for printing numbers measuring specific units:
 *
 * agno: allocation group number
 *
 * agino: per-AG inode number
 * ino: filesystem inode number
 *
 * agbno: per-AG block number in fs blocks
 * startblock: physical block number for file mappings.  This is either a
 *             segmented fsblock for data device mappings, or a rfsblock
 *             for realtime device mappings
 * fsbcount: number of blocks in an extent, in fs blocks
 *
 * daddr: physical block number in 512b blocks
 * bbcount: number of blocks in a physical extent, in 512b blocks
 *
 * owner: reverse-mapping owner, usually inodes
 *
 * fileoff: file offset, in fs blocks
 * pos: file offset, in bytes
 * bytecount: number of bytes
 *
 * disize: ondisk file size, in bytes
 * isize: incore file size, in bytes
 *
 * forkoff: inode fork offset, in bytes
 *
 * ireccount: number of inode records
 *
 * Numbers describing space allocations (blocks, extents, inodes) should be
 * formatted in hexadecimal.
C
Christoph Hellwig 已提交
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM xfs

#if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_XFS_H

#include <linux/tracepoint.h>

struct xfs_agf;
struct xfs_alloc_arg;
struct xfs_attr_list_context;
struct xfs_buf_log_item;
struct xfs_da_args;
struct xfs_da_node_entry;
struct xfs_dquot;
56
struct xfs_log_item;
57
struct xlog;
D
Dave Chinner 已提交
58
struct xlog_ticket;
59 60
struct xlog_recover;
struct xlog_recover_item;
61
struct xlog_rec_header;
D
Dave Chinner 已提交
62
struct xlog_in_core;
63 64
struct xfs_buf_log_format;
struct xfs_inode_log_format;
65
struct xfs_bmbt_irec;
66
struct xfs_btree_cur;
67
struct xfs_refcount_irec;
68 69
struct xfs_fsmap;
struct xfs_rmap_irec;
70 71 72 73
struct xfs_icreate_log;
struct xfs_owner_info;
struct xfs_trans_res;
struct xfs_inobt_rec_incore;
74
union xfs_btree_ptr;
75
struct xfs_dqtrx;
76
struct xfs_icwalk;
C
Christoph Hellwig 已提交
77

78 79
#define XFS_ATTR_FILTER_FLAGS \
	{ XFS_ATTR_ROOT,	"ROOT" }, \
80 81
	{ XFS_ATTR_SECURE,	"SECURE" }, \
	{ XFS_ATTR_INCOMPLETE,	"INCOMPLETE" }
82

C
Christoph Hellwig 已提交
83 84 85 86 87 88 89 90 91
DECLARE_EVENT_CLASS(xfs_attr_list_class,
	TP_PROTO(struct xfs_attr_list_context *ctx),
	TP_ARGS(ctx),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(u32, hashval)
		__field(u32, blkno)
		__field(u32, offset)
92
		__field(void *, buffer)
C
Christoph Hellwig 已提交
93 94 95 96
		__field(int, bufsize)
		__field(int, count)
		__field(int, firstu)
		__field(int, dupcnt)
97
		__field(unsigned int, attr_filter)
C
Christoph Hellwig 已提交
98 99 100 101
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
		__entry->ino = ctx->dp->i_ino;
102 103 104
		__entry->hashval = ctx->cursor.hashval;
		__entry->blkno = ctx->cursor.blkno;
		__entry->offset = ctx->cursor.offset;
105
		__entry->buffer = ctx->buffer;
C
Christoph Hellwig 已提交
106 107 108
		__entry->bufsize = ctx->bufsize;
		__entry->count = ctx->count;
		__entry->firstu = ctx->firstu;
109
		__entry->attr_filter = ctx->attr_filter;
C
Christoph Hellwig 已提交
110 111
	),
	TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
112
		  "buffer %p size %u count %u firstu %u filter %s",
C
Christoph Hellwig 已提交
113 114 115 116 117 118
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		   __entry->ino,
		   __entry->hashval,
		   __entry->blkno,
		   __entry->offset,
		   __entry->dupcnt,
119
		   __entry->buffer,
C
Christoph Hellwig 已提交
120 121 122
		   __entry->bufsize,
		   __entry->count,
		   __entry->firstu,
123 124
		   __print_flags(__entry->attr_filter, "|",
				 XFS_ATTR_FILTER_FLAGS)
C
Christoph Hellwig 已提交
125 126 127
	)
)

C
Christoph Hellwig 已提交
128
#define DEFINE_ATTR_LIST_EVENT(name) \
C
Christoph Hellwig 已提交
129
DEFINE_EVENT(xfs_attr_list_class, name, \
C
Christoph Hellwig 已提交
130
	TP_PROTO(struct xfs_attr_list_context *ctx), \
C
Christoph Hellwig 已提交
131
	TP_ARGS(ctx))
C
Christoph Hellwig 已提交
132 133 134 135 136 137 138 139
DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
140 141
DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
C
Christoph Hellwig 已提交
142

143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
TRACE_EVENT(xlog_intent_recovery_failed,
	TP_PROTO(struct xfs_mount *mp, int error, void *function),
	TP_ARGS(mp, error, function),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(int, error)
		__field(void *, function)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->error = error;
		__entry->function = function;
	),
	TP_printk("dev %d:%d error %d function %pS",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->error, __entry->function)
);

161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
DECLARE_EVENT_CLASS(xfs_perag_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
		 unsigned long caller_ip),
	TP_ARGS(mp, agno, refcount, caller_ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(int, refcount)
		__field(unsigned long, caller_ip)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->refcount = refcount;
		__entry->caller_ip = caller_ip;
	),
177
	TP_printk("dev %d:%d agno 0x%x refcount %d caller %pS",
178 179 180 181 182 183 184 185 186 187 188 189
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->refcount,
		  (char *)__entry->caller_ip)
);

#define DEFINE_PERAG_REF_EVENT(name)	\
DEFINE_EVENT(xfs_perag_class, name,	\
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,	\
		 unsigned long caller_ip),					\
	TP_ARGS(mp, agno, refcount, caller_ip))
DEFINE_PERAG_REF_EVENT(xfs_perag_get);
190
DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
191
DEFINE_PERAG_REF_EVENT(xfs_perag_put);
192 193
DEFINE_PERAG_REF_EVENT(xfs_perag_set_inode_tag);
DEFINE_PERAG_REF_EVENT(xfs_perag_clear_inode_tag);
194

195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
TRACE_EVENT(xfs_inodegc_worker,
	TP_PROTO(struct xfs_mount *mp, unsigned int shrinker_hits),
	TP_ARGS(mp, shrinker_hits),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(unsigned int, shrinker_hits)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->shrinker_hits = shrinker_hits;
	),
	TP_printk("dev %d:%d shrinker_hits %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->shrinker_hits)
);

211 212 213 214 215 216 217 218 219 220 221 222 223
DECLARE_EVENT_CLASS(xfs_fs_class,
	TP_PROTO(struct xfs_mount *mp, void *caller_ip),
	TP_ARGS(mp, caller_ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(unsigned long long, mflags)
		__field(unsigned long, opstate)
		__field(unsigned long, sbflags)
		__field(void *, caller_ip)
	),
	TP_fast_assign(
		if (mp) {
			__entry->dev = mp->m_super->s_dev;
224
			__entry->mflags = mp->m_features;
225 226 227 228 229
			__entry->opstate = mp->m_opstate;
			__entry->sbflags = mp->m_super->s_flags;
		}
		__entry->caller_ip = caller_ip;
	),
230
	TP_printk("dev %d:%d m_features 0x%llx opstate (%s) s_flags 0x%lx caller %pS",
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->mflags,
		  __print_flags(__entry->opstate, "|", XFS_OPSTATE_STRINGS),
		  __entry->sbflags,
		  __entry->caller_ip)
);

#define DEFINE_FS_EVENT(name)	\
DEFINE_EVENT(xfs_fs_class, name,					\
	TP_PROTO(struct xfs_mount *mp, void *caller_ip), \
	TP_ARGS(mp, caller_ip))
DEFINE_FS_EVENT(xfs_inodegc_flush);
DEFINE_FS_EVENT(xfs_inodegc_start);
DEFINE_FS_EVENT(xfs_inodegc_stop);
DEFINE_FS_EVENT(xfs_inodegc_queue);
DEFINE_FS_EVENT(xfs_inodegc_throttle);
DEFINE_FS_EVENT(xfs_fs_sync_fs);
248 249 250
DEFINE_FS_EVENT(xfs_blockgc_start);
DEFINE_FS_EVENT(xfs_blockgc_stop);
DEFINE_FS_EVENT(xfs_blockgc_worker);
251
DEFINE_FS_EVENT(xfs_blockgc_flush_all);
252

253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
TRACE_EVENT(xfs_inodegc_shrinker_scan,
	TP_PROTO(struct xfs_mount *mp, struct shrink_control *sc,
		 void *caller_ip),
	TP_ARGS(mp, sc, caller_ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(unsigned long, nr_to_scan)
		__field(void *, caller_ip)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->nr_to_scan = sc->nr_to_scan;
		__entry->caller_ip = caller_ip;
	),
	TP_printk("dev %d:%d nr_to_scan %lu caller %pS",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->nr_to_scan,
		  __entry->caller_ip)
);

273 274 275 276 277 278 279 280 281 282 283
DECLARE_EVENT_CLASS(xfs_ag_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
	TP_ARGS(mp, agno),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
	),
284
	TP_printk("dev %d:%d agno 0x%x",
285 286 287 288 289 290 291 292 293 294 295 296 297
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno)
);
#define DEFINE_AG_EVENT(name)	\
DEFINE_EVENT(xfs_ag_class, name,	\
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),	\
	TP_ARGS(mp, agno))

DEFINE_AG_EVENT(xfs_read_agf);
DEFINE_AG_EVENT(xfs_alloc_read_agf);
DEFINE_AG_EVENT(xfs_read_agi);
DEFINE_AG_EVENT(xfs_ialloc_read_agi);

C
Christoph Hellwig 已提交
298 299 300 301 302 303 304 305 306 307
TRACE_EVENT(xfs_attr_list_node_descend,
	TP_PROTO(struct xfs_attr_list_context *ctx,
		 struct xfs_da_node_entry *btree),
	TP_ARGS(ctx, btree),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(u32, hashval)
		__field(u32, blkno)
		__field(u32, offset)
308
		__field(void *, buffer)
C
Christoph Hellwig 已提交
309 310 311 312
		__field(int, bufsize)
		__field(int, count)
		__field(int, firstu)
		__field(int, dupcnt)
313
		__field(unsigned int, attr_filter)
C
Christoph Hellwig 已提交
314 315 316 317 318 319
		__field(u32, bt_hashval)
		__field(u32, bt_before)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
		__entry->ino = ctx->dp->i_ino;
320 321 322
		__entry->hashval = ctx->cursor.hashval;
		__entry->blkno = ctx->cursor.blkno;
		__entry->offset = ctx->cursor.offset;
323
		__entry->buffer = ctx->buffer;
C
Christoph Hellwig 已提交
324 325 326
		__entry->bufsize = ctx->bufsize;
		__entry->count = ctx->count;
		__entry->firstu = ctx->firstu;
327
		__entry->attr_filter = ctx->attr_filter;
C
Christoph Hellwig 已提交
328 329 330 331
		__entry->bt_hashval = be32_to_cpu(btree->hashval);
		__entry->bt_before = be32_to_cpu(btree->before);
	),
	TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
332
		  "buffer %p size %u count %u firstu %u filter %s "
C
Christoph Hellwig 已提交
333 334 335 336 337 338 339
		  "node hashval %u, node before %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		   __entry->ino,
		   __entry->hashval,
		   __entry->blkno,
		   __entry->offset,
		   __entry->dupcnt,
340
		   __entry->buffer,
C
Christoph Hellwig 已提交
341 342 343
		   __entry->bufsize,
		   __entry->count,
		   __entry->firstu,
344 345
		   __print_flags(__entry->attr_filter, "|",
				 XFS_ATTR_FILTER_FLAGS),
C
Christoph Hellwig 已提交
346 347 348 349
		   __entry->bt_hashval,
		   __entry->bt_before)
);

C
Christoph Hellwig 已提交
350
DECLARE_EVENT_CLASS(xfs_bmap_class,
351
	TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state,
C
Christoph Hellwig 已提交
352
		 unsigned long caller_ip),
353
	TP_ARGS(ip, cur, state, caller_ip),
C
Christoph Hellwig 已提交
354 355 356
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
P
Peter Zijlstra 已提交
357 358
		__field(void *, leaf)
		__field(int, pos)
C
Christoph Hellwig 已提交
359 360 361 362 363 364 365 366
		__field(xfs_fileoff_t, startoff)
		__field(xfs_fsblock_t, startblock)
		__field(xfs_filblks_t, blockcount)
		__field(xfs_exntst_t, state)
		__field(int, bmap_state)
		__field(unsigned long, caller_ip)
	),
	TP_fast_assign(
D
Darrick J. Wong 已提交
367
		struct xfs_ifork	*ifp;
C
Christoph Hellwig 已提交
368 369
		struct xfs_bmbt_irec	r;

D
Darrick J. Wong 已提交
370
		ifp = xfs_iext_state_to_fork(ip, state);
371
		xfs_iext_get_extent(ifp, cur, &r);
C
Christoph Hellwig 已提交
372 373
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
374 375
		__entry->leaf = cur->leaf;
		__entry->pos = cur->pos;
C
Christoph Hellwig 已提交
376 377 378 379 380 381 382
		__entry->startoff = r.br_startoff;
		__entry->startblock = r.br_startblock;
		__entry->blockcount = r.br_blockcount;
		__entry->state = r.br_state;
		__entry->bmap_state = state;
		__entry->caller_ip = caller_ip;
	),
383
	TP_printk("dev %d:%d ino 0x%llx state %s cur %p/%d "
384
		  "fileoff 0x%llx startblock 0x%llx fsbcount 0x%llx flag %d caller %pS",
C
Christoph Hellwig 已提交
385 386 387
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
388 389
		  __entry->leaf,
		  __entry->pos,
C
Christoph Hellwig 已提交
390
		  __entry->startoff,
391
		  (int64_t)__entry->startblock,
C
Christoph Hellwig 已提交
392 393 394 395 396
		  __entry->blockcount,
		  __entry->state,
		  (char *)__entry->caller_ip)
)

C
Christoph Hellwig 已提交
397
#define DEFINE_BMAP_EVENT(name) \
C
Christoph Hellwig 已提交
398
DEFINE_EVENT(xfs_bmap_class, name, \
399
	TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state, \
C
Christoph Hellwig 已提交
400
		 unsigned long caller_ip), \
401
	TP_ARGS(ip, cur, state, caller_ip))
402
DEFINE_BMAP_EVENT(xfs_iext_insert);
C
Christoph Hellwig 已提交
403 404 405
DEFINE_BMAP_EVENT(xfs_iext_remove);
DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
DEFINE_BMAP_EVENT(xfs_bmap_post_update);
406 407
DEFINE_BMAP_EVENT(xfs_read_extent);
DEFINE_BMAP_EVENT(xfs_write_extent);
C
Christoph Hellwig 已提交
408

C
Christoph Hellwig 已提交
409 410 411 412 413 414
DECLARE_EVENT_CLASS(xfs_buf_class,
	TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
	TP_ARGS(bp, caller_ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_daddr_t, bno)
415
		__field(int, nblks)
C
Christoph Hellwig 已提交
416 417 418 419 420
		__field(int, hold)
		__field(int, pincount)
		__field(unsigned, lockval)
		__field(unsigned, flags)
		__field(unsigned long, caller_ip)
421
		__field(const void *, buf_ops)
C
Christoph Hellwig 已提交
422 423 424
	),
	TP_fast_assign(
		__entry->dev = bp->b_target->bt_dev;
425
		__entry->bno = xfs_buf_daddr(bp);
426
		__entry->nblks = bp->b_length;
C
Christoph Hellwig 已提交
427 428
		__entry->hold = atomic_read(&bp->b_hold);
		__entry->pincount = atomic_read(&bp->b_pin_count);
429
		__entry->lockval = bp->b_sema.count;
C
Christoph Hellwig 已提交
430 431
		__entry->flags = bp->b_flags;
		__entry->caller_ip = caller_ip;
432
		__entry->buf_ops = bp->b_ops;
C
Christoph Hellwig 已提交
433
	),
434
	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
435
		  "lock %d flags %s bufops %pS caller %pS",
C
Christoph Hellwig 已提交
436 437
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long long)__entry->bno,
438
		  __entry->nblks,
C
Christoph Hellwig 已提交
439 440 441 442
		  __entry->hold,
		  __entry->pincount,
		  __entry->lockval,
		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
443
		  __entry->buf_ops,
C
Christoph Hellwig 已提交
444
		  (void *)__entry->caller_ip)
C
Christoph Hellwig 已提交
445
)
C
Christoph Hellwig 已提交
446 447 448 449 450

#define DEFINE_BUF_EVENT(name) \
DEFINE_EVENT(xfs_buf_class, name, \
	TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
	TP_ARGS(bp, caller_ip))
C
Christoph Hellwig 已提交
451 452 453 454 455
DEFINE_BUF_EVENT(xfs_buf_init);
DEFINE_BUF_EVENT(xfs_buf_free);
DEFINE_BUF_EVENT(xfs_buf_hold);
DEFINE_BUF_EVENT(xfs_buf_rele);
DEFINE_BUF_EVENT(xfs_buf_iodone);
456
DEFINE_BUF_EVENT(xfs_buf_submit);
C
Christoph Hellwig 已提交
457 458
DEFINE_BUF_EVENT(xfs_buf_lock);
DEFINE_BUF_EVENT(xfs_buf_lock_done);
459
DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
460
DEFINE_BUF_EVENT(xfs_buf_trylock);
C
Christoph Hellwig 已提交
461 462 463 464
DEFINE_BUF_EVENT(xfs_buf_unlock);
DEFINE_BUF_EVENT(xfs_buf_iowait);
DEFINE_BUF_EVENT(xfs_buf_iowait_done);
DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
465
DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
C
Christoph Hellwig 已提交
466
DEFINE_BUF_EVENT(xfs_buf_delwri_split);
467
DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf);
468
DEFINE_BUF_EVENT(xfs_buf_get_uncached);
C
Christoph Hellwig 已提交
469
DEFINE_BUF_EVENT(xfs_buf_item_relse);
470
DEFINE_BUF_EVENT(xfs_buf_iodone_async);
C
Christoph Hellwig 已提交
471
DEFINE_BUF_EVENT(xfs_buf_error_relse);
472
DEFINE_BUF_EVENT(xfs_buf_drain_buftarg);
C
Christoph Hellwig 已提交
473 474 475 476 477 478 479
DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);

/* not really buffer traces, but the buf provides useful information */
DEFINE_BUF_EVENT(xfs_btree_corrupt);
DEFINE_BUF_EVENT(xfs_reset_dqcounts);

/* pass flags explicitly */
C
Christoph Hellwig 已提交
480 481 482 483 484 485
DECLARE_EVENT_CLASS(xfs_buf_flags_class,
	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
	TP_ARGS(bp, flags, caller_ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_daddr_t, bno)
486
		__field(unsigned int, length)
C
Christoph Hellwig 已提交
487 488 489 490 491 492 493 494
		__field(int, hold)
		__field(int, pincount)
		__field(unsigned, lockval)
		__field(unsigned, flags)
		__field(unsigned long, caller_ip)
	),
	TP_fast_assign(
		__entry->dev = bp->b_target->bt_dev;
495
		__entry->bno = xfs_buf_daddr(bp);
496
		__entry->length = bp->b_length;
C
Christoph Hellwig 已提交
497 498 499
		__entry->flags = flags;
		__entry->hold = atomic_read(&bp->b_hold);
		__entry->pincount = atomic_read(&bp->b_pin_count);
500
		__entry->lockval = bp->b_sema.count;
C
Christoph Hellwig 已提交
501 502
		__entry->caller_ip = caller_ip;
	),
503
	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
504
		  "lock %d flags %s caller %pS",
C
Christoph Hellwig 已提交
505 506
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long long)__entry->bno,
507
		  __entry->length,
C
Christoph Hellwig 已提交
508 509 510 511 512
		  __entry->hold,
		  __entry->pincount,
		  __entry->lockval,
		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
		  (void *)__entry->caller_ip)
C
Christoph Hellwig 已提交
513
)
C
Christoph Hellwig 已提交
514 515 516 517 518

#define DEFINE_BUF_FLAGS_EVENT(name) \
DEFINE_EVENT(xfs_buf_flags_class, name, \
	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
	TP_ARGS(bp, flags, caller_ip))
C
Christoph Hellwig 已提交
519 520 521 522 523
DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);

TRACE_EVENT(xfs_buf_ioerror,
524
	TP_PROTO(struct xfs_buf *bp, int error, xfs_failaddr_t caller_ip),
C
Christoph Hellwig 已提交
525 526 527 528
	TP_ARGS(bp, error, caller_ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_daddr_t, bno)
529
		__field(unsigned int, length)
C
Christoph Hellwig 已提交
530 531 532 533 534
		__field(unsigned, flags)
		__field(int, hold)
		__field(int, pincount)
		__field(unsigned, lockval)
		__field(int, error)
535
		__field(xfs_failaddr_t, caller_ip)
C
Christoph Hellwig 已提交
536 537 538
	),
	TP_fast_assign(
		__entry->dev = bp->b_target->bt_dev;
539
		__entry->bno = xfs_buf_daddr(bp);
540
		__entry->length = bp->b_length;
C
Christoph Hellwig 已提交
541 542
		__entry->hold = atomic_read(&bp->b_hold);
		__entry->pincount = atomic_read(&bp->b_pin_count);
543
		__entry->lockval = bp->b_sema.count;
C
Christoph Hellwig 已提交
544 545 546 547
		__entry->error = error;
		__entry->flags = bp->b_flags;
		__entry->caller_ip = caller_ip;
	),
548
	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
549
		  "lock %d error %d flags %s caller %pS",
C
Christoph Hellwig 已提交
550 551
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long long)__entry->bno,
552
		  __entry->length,
C
Christoph Hellwig 已提交
553 554 555 556 557 558 559 560
		  __entry->hold,
		  __entry->pincount,
		  __entry->lockval,
		  __entry->error,
		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
		  (void *)__entry->caller_ip)
);

C
Christoph Hellwig 已提交
561 562 563 564 565 566
DECLARE_EVENT_CLASS(xfs_buf_item_class,
	TP_PROTO(struct xfs_buf_log_item *bip),
	TP_ARGS(bip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_daddr_t, buf_bno)
567
		__field(unsigned int, buf_len)
C
Christoph Hellwig 已提交
568 569 570 571 572 573 574
		__field(int, buf_hold)
		__field(int, buf_pincount)
		__field(int, buf_lockval)
		__field(unsigned, buf_flags)
		__field(unsigned, bli_recur)
		__field(int, bli_refcount)
		__field(unsigned, bli_flags)
D
Dave Chinner 已提交
575
		__field(unsigned long, li_flags)
C
Christoph Hellwig 已提交
576 577 578 579 580 581
	),
	TP_fast_assign(
		__entry->dev = bip->bli_buf->b_target->bt_dev;
		__entry->bli_flags = bip->bli_flags;
		__entry->bli_recur = bip->bli_recur;
		__entry->bli_refcount = atomic_read(&bip->bli_refcount);
582
		__entry->buf_bno = xfs_buf_daddr(bip->bli_buf);
583
		__entry->buf_len = bip->bli_buf->b_length;
C
Christoph Hellwig 已提交
584 585 586
		__entry->buf_flags = bip->bli_buf->b_flags;
		__entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
		__entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
587
		__entry->buf_lockval = bip->bli_buf->b_sema.count;
C
Christoph Hellwig 已提交
588 589
		__entry->li_flags = bip->bli_item.li_flags;
	),
590
	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
C
Christoph Hellwig 已提交
591
		  "lock %d flags %s recur %d refcount %d bliflags %s "
592
		  "liflags %s",
C
Christoph Hellwig 已提交
593 594 595 596 597 598 599 600 601 602 603
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long long)__entry->buf_bno,
		  __entry->buf_len,
		  __entry->buf_hold,
		  __entry->buf_pincount,
		  __entry->buf_lockval,
		  __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
		  __entry->bli_recur,
		  __entry->bli_refcount,
		  __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
		  __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
C
Christoph Hellwig 已提交
604
)
C
Christoph Hellwig 已提交
605 606 607 608 609

#define DEFINE_BUF_ITEM_EVENT(name) \
DEFINE_EVENT(xfs_buf_item_class, name, \
	TP_PROTO(struct xfs_buf_log_item *bip), \
	TP_ARGS(bip))
C
Christoph Hellwig 已提交
610
DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
611
DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
C
Christoph Hellwig 已提交
612 613 614
DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
615
DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
C
Christoph Hellwig 已提交
616 617 618
DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
C
Christoph Hellwig 已提交
619
DEFINE_BUF_ITEM_EVENT(xfs_buf_item_release);
C
Christoph Hellwig 已提交
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634
DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);

635
DECLARE_EVENT_CLASS(xfs_filestream_class,
636 637
	TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno),
	TP_ARGS(mp, ino, agno),
638 639 640 641 642 643 644
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(xfs_agnumber_t, agno)
		__field(int, streams)
	),
	TP_fast_assign(
645 646
		__entry->dev = mp->m_super->s_dev;
		__entry->ino = ino;
647
		__entry->agno = agno;
648
		__entry->streams = xfs_filestream_peek_ag(mp, agno);
649
	),
650
	TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d",
651 652 653 654 655 656 657
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->agno,
		  __entry->streams)
)
#define DEFINE_FILESTREAM_EVENT(name) \
DEFINE_EVENT(xfs_filestream_class, name, \
658 659
	TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno), \
	TP_ARGS(mp, ino, agno))
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683
DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);

TRACE_EVENT(xfs_filestream_pick,
	TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
		 xfs_extlen_t free, int nscan),
	TP_ARGS(ip, agno, free, nscan),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(xfs_agnumber_t, agno)
		__field(int, streams)
		__field(xfs_extlen_t, free)
		__field(int, nscan)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
		__entry->agno = agno;
		__entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
		__entry->free = free;
		__entry->nscan = nscan;
	),
684
	TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d free %d nscan %d",
685 686 687 688 689 690 691 692
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->agno,
		  __entry->streams,
		  __entry->free,
		  __entry->nscan)
);

C
Christoph Hellwig 已提交
693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708
DECLARE_EVENT_CLASS(xfs_lock_class,
	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
		 unsigned long caller_ip),
	TP_ARGS(ip,  lock_flags, caller_ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(int, lock_flags)
		__field(unsigned long, caller_ip)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
		__entry->lock_flags = lock_flags;
		__entry->caller_ip = caller_ip;
	),
709
	TP_printk("dev %d:%d ino 0x%llx flags %s caller %pS",
C
Christoph Hellwig 已提交
710 711 712 713 714 715
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
		  (void *)__entry->caller_ip)
)

C
Christoph Hellwig 已提交
716
#define DEFINE_LOCK_EVENT(name) \
C
Christoph Hellwig 已提交
717
DEFINE_EVENT(xfs_lock_class, name, \
C
Christoph Hellwig 已提交
718 719
	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
		 unsigned long caller_ip), \
C
Christoph Hellwig 已提交
720
	TP_ARGS(ip,  lock_flags, caller_ip))
C
Christoph Hellwig 已提交
721 722 723 724 725
DEFINE_LOCK_EVENT(xfs_ilock);
DEFINE_LOCK_EVENT(xfs_ilock_nowait);
DEFINE_LOCK_EVENT(xfs_ilock_demote);
DEFINE_LOCK_EVENT(xfs_iunlock);

C
Christoph Hellwig 已提交
726
DECLARE_EVENT_CLASS(xfs_inode_class,
C
Christoph Hellwig 已提交
727 728 729 730 731
	TP_PROTO(struct xfs_inode *ip),
	TP_ARGS(ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
732
		__field(unsigned long, iflags)
C
Christoph Hellwig 已提交
733 734 735 736
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
737
		__entry->iflags = ip->i_flags;
C
Christoph Hellwig 已提交
738
	),
739
	TP_printk("dev %d:%d ino 0x%llx iflags 0x%lx",
C
Christoph Hellwig 已提交
740
		  MAJOR(__entry->dev), MINOR(__entry->dev),
741 742
		  __entry->ino,
		  __entry->iflags)
C
Christoph Hellwig 已提交
743 744
)

C
Christoph Hellwig 已提交
745 746
#define DEFINE_INODE_EVENT(name) \
DEFINE_EVENT(xfs_inode_class, name, \
C
Christoph Hellwig 已提交
747
	TP_PROTO(struct xfs_inode *ip), \
C
Christoph Hellwig 已提交
748
	TP_ARGS(ip))
C
Christoph Hellwig 已提交
749
DEFINE_INODE_EVENT(xfs_iget_skip);
750 751
DEFINE_INODE_EVENT(xfs_iget_recycle);
DEFINE_INODE_EVENT(xfs_iget_recycle_fail);
C
Christoph Hellwig 已提交
752 753
DEFINE_INODE_EVENT(xfs_iget_hit);
DEFINE_INODE_EVENT(xfs_iget_miss);
C
Christoph Hellwig 已提交
754

C
Christoph Hellwig 已提交
755 756 757
DEFINE_INODE_EVENT(xfs_getattr);
DEFINE_INODE_EVENT(xfs_setattr);
DEFINE_INODE_EVENT(xfs_readlink);
758
DEFINE_INODE_EVENT(xfs_inactive_symlink);
C
Christoph Hellwig 已提交
759 760
DEFINE_INODE_EVENT(xfs_alloc_file_space);
DEFINE_INODE_EVENT(xfs_free_file_space);
761
DEFINE_INODE_EVENT(xfs_zero_file_space);
762
DEFINE_INODE_EVENT(xfs_collapse_file_space);
763
DEFINE_INODE_EVENT(xfs_insert_file_space);
C
Christoph Hellwig 已提交
764
DEFINE_INODE_EVENT(xfs_readdir);
765
#ifdef CONFIG_XFS_POSIX_ACL
766
DEFINE_INODE_EVENT(xfs_get_acl);
767
#endif
C
Christoph Hellwig 已提交
768 769 770 771
DEFINE_INODE_EVENT(xfs_vm_bmap);
DEFINE_INODE_EVENT(xfs_file_ioctl);
DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
DEFINE_INODE_EVENT(xfs_ioctl_setattr);
772
DEFINE_INODE_EVENT(xfs_dir_fsync);
C
Christoph Hellwig 已提交
773 774
DEFINE_INODE_EVENT(xfs_file_fsync);
DEFINE_INODE_EVENT(xfs_destroy_inode);
C
Christoph Hellwig 已提交
775
DEFINE_INODE_EVENT(xfs_update_time);
C
Christoph Hellwig 已提交
776 777 778 779

DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
DEFINE_INODE_EVENT(xfs_dquot_dqdetach);

780 781
DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
782
DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
783 784 785
DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
786 787 788 789
DEFINE_INODE_EVENT(xfs_inode_set_reclaimable);
DEFINE_INODE_EVENT(xfs_inode_reclaiming);
DEFINE_INODE_EVENT(xfs_inode_set_need_inactive);
DEFINE_INODE_EVENT(xfs_inode_inactivating);
790

791 792 793 794 795 796 797 798 799 800
/*
 * ftrace's __print_symbolic requires that all enum values be wrapped in the
 * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace
 * ring buffer.  Somehow this was only worth mentioning in the ftrace sample
 * code.
 */
TRACE_DEFINE_ENUM(PE_SIZE_PTE);
TRACE_DEFINE_ENUM(PE_SIZE_PMD);
TRACE_DEFINE_ENUM(PE_SIZE_PUD);

801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826
TRACE_EVENT(xfs_filemap_fault,
	TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size,
		 bool write_fault),
	TP_ARGS(ip, pe_size, write_fault),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(enum page_entry_size, pe_size)
		__field(bool, write_fault)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
		__entry->pe_size = pe_size;
		__entry->write_fault = write_fault;
	),
	TP_printk("dev %d:%d ino 0x%llx %s write_fault %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __print_symbolic(__entry->pe_size,
			{ PE_SIZE_PTE,	"PTE" },
			{ PE_SIZE_PMD,	"PMD" },
			{ PE_SIZE_PUD,	"PUD" }),
		  __entry->write_fault)
)

C
Christoph Hellwig 已提交
827
DECLARE_EVENT_CLASS(xfs_iref_class,
C
Christoph Hellwig 已提交
828 829 830 831 832 833
	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
	TP_ARGS(ip, caller_ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(int, count)
834
		__field(int, pincount)
C
Christoph Hellwig 已提交
835 836 837 838 839 840
		__field(unsigned long, caller_ip)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
		__entry->count = atomic_read(&VFS_I(ip)->i_count);
841
		__entry->pincount = atomic_read(&ip->i_pincount);
C
Christoph Hellwig 已提交
842 843
		__entry->caller_ip = caller_ip;
	),
844
	TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS",
C
Christoph Hellwig 已提交
845 846 847
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->count,
848
		  __entry->pincount,
C
Christoph Hellwig 已提交
849
		  (char *)__entry->caller_ip)
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870
)

TRACE_EVENT(xfs_iomap_prealloc_size,
	TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
		 unsigned int writeio_blocks),
	TP_ARGS(ip, blocks, shift, writeio_blocks),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(xfs_fsblock_t, blocks)
		__field(int, shift)
		__field(unsigned int, writeio_blocks)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
		__entry->blocks = blocks;
		__entry->shift = shift;
		__entry->writeio_blocks = writeio_blocks;
	),
	TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
871
		  "m_allocsize_blocks %u",
872 873
		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
		  __entry->blocks, __entry->shift, __entry->writeio_blocks)
C
Christoph Hellwig 已提交
874 875
)

876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895
TRACE_EVENT(xfs_irec_merge_pre,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
		 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
	TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agino_t, agino)
		__field(uint16_t, holemask)
		__field(xfs_agino_t, nagino)
		__field(uint16_t, nholemask)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->agino = agino;
		__entry->holemask = holemask;
		__entry->nagino = nagino;
		__entry->nholemask = holemask;
	),
896
	TP_printk("dev %d:%d agno 0x%x agino 0x%x holemask 0x%x new_agino 0x%x new_holemask 0x%x",
897 898 899 900 901
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->agino,
		  __entry->holemask,
		  __entry->nagino,
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920
		  __entry->nholemask)
)

TRACE_EVENT(xfs_irec_merge_post,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
		 uint16_t holemask),
	TP_ARGS(mp, agno, agino, holemask),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agino_t, agino)
		__field(uint16_t, holemask)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->agino = agino;
		__entry->holemask = holemask;
	),
921
	TP_printk("dev %d:%d agno 0x%x agino 0x%x holemask 0x%x",
922 923 924 925
		  MAJOR(__entry->dev),
		  MINOR(__entry->dev),
		  __entry->agno,
		  __entry->agino,
926 927 928
		  __entry->holemask)
)

C
Christoph Hellwig 已提交
929 930
#define DEFINE_IREF_EVENT(name) \
DEFINE_EVENT(xfs_iref_class, name, \
C
Christoph Hellwig 已提交
931
	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
C
Christoph Hellwig 已提交
932
	TP_ARGS(ip, caller_ip))
C
Christoph Hellwig 已提交
933 934 935 936 937 938
DEFINE_IREF_EVENT(xfs_irele);
DEFINE_IREF_EVENT(xfs_inode_pin);
DEFINE_IREF_EVENT(xfs_inode_unpin);
DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);

DECLARE_EVENT_CLASS(xfs_namespace_class,
939
	TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name),
C
Christoph Hellwig 已提交
940 941 942 943
	TP_ARGS(dp, name),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, dp_ino)
944
		__field(int, namelen)
C
Christoph Hellwig 已提交
945 946 947 948 949
		__dynamic_array(char, name, name->len)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(dp)->i_sb->s_dev;
		__entry->dp_ino = dp->i_ino;
950
		__entry->namelen = name->len;
C
Christoph Hellwig 已提交
951 952
		memcpy(__get_str(name), name->name, name->len);
	),
953
	TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
C
Christoph Hellwig 已提交
954 955
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->dp_ino,
956
		  __entry->namelen,
C
Christoph Hellwig 已提交
957 958 959 960 961
		  __get_str(name))
)

#define DEFINE_NAMESPACE_EVENT(name) \
DEFINE_EVENT(xfs_namespace_class, name, \
962
	TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name), \
C
Christoph Hellwig 已提交
963 964 965 966 967 968
	TP_ARGS(dp, name))
DEFINE_NAMESPACE_EVENT(xfs_remove);
DEFINE_NAMESPACE_EVENT(xfs_link);
DEFINE_NAMESPACE_EVENT(xfs_lookup);
DEFINE_NAMESPACE_EVENT(xfs_create);
DEFINE_NAMESPACE_EVENT(xfs_symlink);
969

C
Christoph Hellwig 已提交
970 971 972 973 974 975 976 977
TRACE_EVENT(xfs_rename,
	TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
		 struct xfs_name *src_name, struct xfs_name *target_name),
	TP_ARGS(src_dp, target_dp, src_name, target_name),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, src_dp_ino)
		__field(xfs_ino_t, target_dp_ino)
978 979
		__field(int, src_namelen)
		__field(int, target_namelen)
C
Christoph Hellwig 已提交
980 981 982 983 984 985 986
		__dynamic_array(char, src_name, src_name->len)
		__dynamic_array(char, target_name, target_name->len)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(src_dp)->i_sb->s_dev;
		__entry->src_dp_ino = src_dp->i_ino;
		__entry->target_dp_ino = target_dp->i_ino;
987 988
		__entry->src_namelen = src_name->len;
		__entry->target_namelen = target_name->len;
C
Christoph Hellwig 已提交
989
		memcpy(__get_str(src_name), src_name->name, src_name->len);
990 991
		memcpy(__get_str(target_name), target_name->name,
			target_name->len);
C
Christoph Hellwig 已提交
992 993
	),
	TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
994
		  " src name %.*s target name %.*s",
C
Christoph Hellwig 已提交
995 996 997
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->src_dp_ino,
		  __entry->target_dp_ino,
998
		  __entry->src_namelen,
C
Christoph Hellwig 已提交
999
		  __get_str(src_name),
1000
		  __entry->target_namelen,
C
Christoph Hellwig 已提交
1001 1002
		  __get_str(target_name))
)
C
Christoph Hellwig 已提交
1003

C
Christoph Hellwig 已提交
1004 1005 1006 1007 1008
DECLARE_EVENT_CLASS(xfs_dquot_class,
	TP_PROTO(struct xfs_dquot *dqp),
	TP_ARGS(dqp),
	TP_STRUCT__entry(
		__field(dev_t, dev)
C
Christoph Hellwig 已提交
1009
		__field(u32, id)
1010
		__field(xfs_dqtype_t, type)
C
Christoph Hellwig 已提交
1011 1012 1013
		__field(unsigned, flags)
		__field(unsigned, nrefs)
		__field(unsigned long long, res_bcount)
1014 1015 1016
		__field(unsigned long long, res_rtbcount)
		__field(unsigned long long, res_icount)

C
Christoph Hellwig 已提交
1017
		__field(unsigned long long, bcount)
1018
		__field(unsigned long long, rtbcount)
C
Christoph Hellwig 已提交
1019
		__field(unsigned long long, icount)
1020

C
Christoph Hellwig 已提交
1021 1022
		__field(unsigned long long, blk_hardlimit)
		__field(unsigned long long, blk_softlimit)
1023 1024
		__field(unsigned long long, rtb_hardlimit)
		__field(unsigned long long, rtb_softlimit)
C
Christoph Hellwig 已提交
1025 1026
		__field(unsigned long long, ino_hardlimit)
		__field(unsigned long long, ino_softlimit)
1027
	),
C
Christoph Hellwig 已提交
1028 1029
	TP_fast_assign(
		__entry->dev = dqp->q_mount->m_super->s_dev;
1030
		__entry->id = dqp->q_id;
1031 1032
		__entry->type = dqp->q_type;
		__entry->flags = dqp->q_flags;
C
Christoph Hellwig 已提交
1033
		__entry->nrefs = dqp->q_nrefs;
1034

1035
		__entry->res_bcount = dqp->q_blk.reserved;
1036 1037 1038
		__entry->res_rtbcount = dqp->q_rtb.reserved;
		__entry->res_icount = dqp->q_ino.reserved;

1039
		__entry->bcount = dqp->q_blk.count;
1040
		__entry->rtbcount = dqp->q_rtb.count;
1041
		__entry->icount = dqp->q_ino.count;
1042

1043 1044
		__entry->blk_hardlimit = dqp->q_blk.hardlimit;
		__entry->blk_softlimit = dqp->q_blk.softlimit;
1045 1046
		__entry->rtb_hardlimit = dqp->q_rtb.hardlimit;
		__entry->rtb_softlimit = dqp->q_rtb.softlimit;
1047 1048
		__entry->ino_hardlimit = dqp->q_ino.hardlimit;
		__entry->ino_softlimit = dqp->q_ino.softlimit;
C
Christoph Hellwig 已提交
1049
	),
1050
	TP_printk("dev %d:%d id 0x%x type %s flags %s nrefs %u "
1051
		  "res_bc 0x%llx res_rtbc 0x%llx res_ic 0x%llx "
C
Christoph Hellwig 已提交
1052
		  "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
1053
		  "rtbcnt 0x%llx rtbhardlimit 0x%llx rtbsoftlimit 0x%llx "
C
Christoph Hellwig 已提交
1054
		  "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
C
Christoph Hellwig 已提交
1055
		  MAJOR(__entry->dev), MINOR(__entry->dev),
C
Christoph Hellwig 已提交
1056
		  __entry->id,
1057
		  __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
1058
		  __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
C
Christoph Hellwig 已提交
1059 1060
		  __entry->nrefs,
		  __entry->res_bcount,
1061 1062
		  __entry->res_rtbcount,
		  __entry->res_icount,
C
Christoph Hellwig 已提交
1063 1064 1065
		  __entry->bcount,
		  __entry->blk_hardlimit,
		  __entry->blk_softlimit,
1066 1067 1068
		  __entry->rtbcount,
		  __entry->rtb_hardlimit,
		  __entry->rtb_softlimit,
C
Christoph Hellwig 已提交
1069 1070 1071
		  __entry->icount,
		  __entry->ino_hardlimit,
		  __entry->ino_softlimit)
C
Christoph Hellwig 已提交
1072
)
C
Christoph Hellwig 已提交
1073 1074 1075 1076 1077

#define DEFINE_DQUOT_EVENT(name) \
DEFINE_EVENT(xfs_dquot_class, name, \
	TP_PROTO(struct xfs_dquot *dqp), \
	TP_ARGS(dqp))
C
Christoph Hellwig 已提交
1078 1079 1080
DEFINE_DQUOT_EVENT(xfs_dqadjust);
DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
1081 1082
DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
C
Christoph Hellwig 已提交
1083 1084 1085 1086 1087 1088 1089 1090
DEFINE_DQUOT_EVENT(xfs_dqattach_found);
DEFINE_DQUOT_EVENT(xfs_dqattach_get);
DEFINE_DQUOT_EVENT(xfs_dqalloc);
DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
DEFINE_DQUOT_EVENT(xfs_dqread);
DEFINE_DQUOT_EVENT(xfs_dqread_fail);
DEFINE_DQUOT_EVENT(xfs_dqget_hit);
DEFINE_DQUOT_EVENT(xfs_dqget_miss);
1091 1092
DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
DEFINE_DQUOT_EVENT(xfs_dqget_dup);
C
Christoph Hellwig 已提交
1093 1094 1095 1096 1097 1098
DEFINE_DQUOT_EVENT(xfs_dqput);
DEFINE_DQUOT_EVENT(xfs_dqput_free);
DEFINE_DQUOT_EVENT(xfs_dqrele);
DEFINE_DQUOT_EVENT(xfs_dqflush);
DEFINE_DQUOT_EVENT(xfs_dqflush_force);
DEFINE_DQUOT_EVENT(xfs_dqflush_done);
1099 1100 1101 1102 1103 1104 1105 1106 1107
DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_before);
DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_after);

TRACE_EVENT(xfs_trans_mod_dquot,
	TP_PROTO(struct xfs_trans *tp, struct xfs_dquot *dqp,
		 unsigned int field, int64_t delta),
	TP_ARGS(tp, dqp, field, delta),
	TP_STRUCT__entry(
		__field(dev_t, dev)
1108
		__field(xfs_dqtype_t, type)
1109 1110 1111 1112 1113 1114 1115
		__field(unsigned int, flags)
		__field(unsigned int, dqid)
		__field(unsigned int, field)
		__field(int64_t, delta)
	),
	TP_fast_assign(
		__entry->dev = tp->t_mountp->m_super->s_dev;
1116 1117
		__entry->type = dqp->q_type;
		__entry->flags = dqp->q_flags;
1118 1119 1120 1121
		__entry->dqid = dqp->q_id;
		__entry->field = field;
		__entry->delta = delta;
	),
1122
	TP_printk("dev %d:%d dquot id 0x%x type %s flags %s field %s delta %lld",
1123 1124
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->dqid,
1125
		  __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
1126 1127 1128 1129 1130 1131 1132 1133 1134 1135
		  __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
		  __print_flags(__entry->field, "|", XFS_QMOPT_FLAGS),
		  __entry->delta)
);

DECLARE_EVENT_CLASS(xfs_dqtrx_class,
	TP_PROTO(struct xfs_dqtrx *qtrx),
	TP_ARGS(qtrx),
	TP_STRUCT__entry(
		__field(dev_t, dev)
1136
		__field(xfs_dqtype_t, type)
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154
		__field(unsigned int, flags)
		__field(u32, dqid)

		__field(uint64_t, blk_res)
		__field(int64_t,  bcount_delta)
		__field(int64_t,  delbcnt_delta)

		__field(uint64_t, rtblk_res)
		__field(uint64_t, rtblk_res_used)
		__field(int64_t,  rtbcount_delta)
		__field(int64_t,  delrtb_delta)

		__field(uint64_t, ino_res)
		__field(uint64_t, ino_res_used)
		__field(int64_t,  icount_delta)
	),
	TP_fast_assign(
		__entry->dev = qtrx->qt_dquot->q_mount->m_super->s_dev;
1155 1156
		__entry->type = qtrx->qt_dquot->q_type;
		__entry->flags = qtrx->qt_dquot->q_flags;
1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171
		__entry->dqid = qtrx->qt_dquot->q_id;

		__entry->blk_res = qtrx->qt_blk_res;
		__entry->bcount_delta = qtrx->qt_bcount_delta;
		__entry->delbcnt_delta = qtrx->qt_delbcnt_delta;

		__entry->rtblk_res = qtrx->qt_rtblk_res;
		__entry->rtblk_res_used = qtrx->qt_rtblk_res_used;
		__entry->rtbcount_delta = qtrx->qt_rtbcount_delta;
		__entry->delrtb_delta = qtrx->qt_delrtb_delta;

		__entry->ino_res = qtrx->qt_ino_res;
		__entry->ino_res_used = qtrx->qt_ino_res_used;
		__entry->icount_delta = qtrx->qt_icount_delta;
	),
1172
	TP_printk("dev %d:%d dquot id 0x%x type %s flags %s"
1173 1174 1175 1176 1177
		  "blk_res %llu bcount_delta %lld delbcnt_delta %lld "
		  "rtblk_res %llu rtblk_res_used %llu rtbcount_delta %lld delrtb_delta %lld "
		  "ino_res %llu ino_res_used %llu icount_delta %lld",
		MAJOR(__entry->dev), MINOR(__entry->dev),
		__entry->dqid,
1178
		  __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201
		  __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),

		__entry->blk_res,
		__entry->bcount_delta,
		__entry->delbcnt_delta,

		__entry->rtblk_res,
		__entry->rtblk_res_used,
		__entry->rtbcount_delta,
		__entry->delrtb_delta,

		__entry->ino_res,
		__entry->ino_res_used,
		__entry->icount_delta)
)

#define DEFINE_DQTRX_EVENT(name) \
DEFINE_EVENT(xfs_dqtrx_class, name, \
	TP_PROTO(struct xfs_dqtrx *qtrx), \
	TP_ARGS(qtrx))
DEFINE_DQTRX_EVENT(xfs_trans_apply_dquot_deltas);
DEFINE_DQTRX_EVENT(xfs_trans_mod_dquot_before);
DEFINE_DQTRX_EVENT(xfs_trans_mod_dquot_after);
C
Christoph Hellwig 已提交
1202

C
Christoph Hellwig 已提交
1203
DECLARE_EVENT_CLASS(xfs_loggrant_class,
1204
	TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
C
Christoph Hellwig 已提交
1205 1206 1207 1208 1209 1210 1211 1212
	TP_ARGS(log, tic),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(char, ocnt)
		__field(char, cnt)
		__field(int, curr_res)
		__field(int, unit_res)
		__field(unsigned int, flags)
1213 1214
		__field(int, reserveq)
		__field(int, writeq)
C
Christoph Hellwig 已提交
1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229
		__field(int, grant_reserve_cycle)
		__field(int, grant_reserve_bytes)
		__field(int, grant_write_cycle)
		__field(int, grant_write_bytes)
		__field(int, curr_cycle)
		__field(int, curr_block)
		__field(xfs_lsn_t, tail_lsn)
	),
	TP_fast_assign(
		__entry->dev = log->l_mp->m_super->s_dev;
		__entry->ocnt = tic->t_ocnt;
		__entry->cnt = tic->t_cnt;
		__entry->curr_res = tic->t_curr_res;
		__entry->unit_res = tic->t_unit_res;
		__entry->flags = tic->t_flags;
1230 1231 1232
		__entry->reserveq = list_empty(&log->l_reserve_head.waiters);
		__entry->writeq = list_empty(&log->l_write_head.waiters);
		xlog_crack_grant_head(&log->l_reserve_head.grant,
1233 1234
				&__entry->grant_reserve_cycle,
				&__entry->grant_reserve_bytes);
1235
		xlog_crack_grant_head(&log->l_write_head.grant,
1236 1237
				&__entry->grant_write_cycle,
				&__entry->grant_write_bytes);
C
Christoph Hellwig 已提交
1238 1239
		__entry->curr_cycle = log->l_curr_cycle;
		__entry->curr_block = log->l_curr_block;
1240
		__entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
C
Christoph Hellwig 已提交
1241
	),
1242
	TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
1243 1244
		  "t_unit_res %u t_flags %s reserveq %s "
		  "writeq %s grant_reserve_cycle %d "
C
Christoph Hellwig 已提交
1245 1246 1247 1248 1249 1250 1251 1252 1253
		  "grant_reserve_bytes %d grant_write_cycle %d "
		  "grant_write_bytes %d curr_cycle %d curr_block %d "
		  "tail_cycle %d tail_block %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ocnt,
		  __entry->cnt,
		  __entry->curr_res,
		  __entry->unit_res,
		  __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
1254 1255
		  __entry->reserveq ? "empty" : "active",
		  __entry->writeq ? "empty" : "active",
C
Christoph Hellwig 已提交
1256 1257 1258 1259 1260 1261 1262 1263 1264 1265
		  __entry->grant_reserve_cycle,
		  __entry->grant_reserve_bytes,
		  __entry->grant_write_cycle,
		  __entry->grant_write_bytes,
		  __entry->curr_cycle,
		  __entry->curr_block,
		  CYCLE_LSN(__entry->tail_lsn),
		  BLOCK_LSN(__entry->tail_lsn)
	)
)
C
Christoph Hellwig 已提交
1266

C
Christoph Hellwig 已提交
1267 1268
#define DEFINE_LOGGRANT_EVENT(name) \
DEFINE_EVENT(xfs_loggrant_class, name, \
1269
	TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
C
Christoph Hellwig 已提交
1270
	TP_ARGS(log, tic))
C
Christoph Hellwig 已提交
1271
DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
1272 1273
DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
1274
DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
1275 1276 1277 1278
DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
C
Christoph Hellwig 已提交
1279 1280 1281 1282 1283 1284
DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant);
DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant_exit);
DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant_sub);
DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant);
DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant_sub);
DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant_exit);
1285
DEFINE_LOGGRANT_EVENT(xfs_log_cil_wait);
C
Christoph Hellwig 已提交
1286

1287 1288 1289 1290 1291 1292 1293
DECLARE_EVENT_CLASS(xfs_log_item_class,
	TP_PROTO(struct xfs_log_item *lip),
	TP_ARGS(lip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(void *, lip)
		__field(uint, type)
D
Dave Chinner 已提交
1294
		__field(unsigned long, flags)
1295 1296 1297
		__field(xfs_lsn_t, lsn)
	),
	TP_fast_assign(
1298
		__entry->dev = lip->li_log->l_mp->m_super->s_dev;
1299 1300 1301 1302 1303
		__entry->lip = lip;
		__entry->type = lip->li_type;
		__entry->flags = lip->li_flags;
		__entry->lsn = lip->li_lsn;
	),
1304
	TP_printk("dev %d:%d lip %p lsn %d/%d type %s flags %s",
1305 1306 1307 1308 1309 1310 1311
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->lip,
		  CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
)

1312
TRACE_EVENT(xfs_log_force,
1313 1314
	TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
	TP_ARGS(mp, lsn, caller_ip),
1315 1316 1317
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_lsn_t, lsn)
1318
		__field(unsigned long, caller_ip)
1319 1320 1321 1322
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->lsn = lsn;
1323
		__entry->caller_ip = caller_ip;
1324
	),
1325
	TP_printk("dev %d:%d lsn 0x%llx caller %pS",
1326
		  MAJOR(__entry->dev), MINOR(__entry->dev),
1327
		  __entry->lsn, (void *)__entry->caller_ip)
1328 1329
)

1330 1331 1332 1333 1334 1335 1336
#define DEFINE_LOG_ITEM_EVENT(name) \
DEFINE_EVENT(xfs_log_item_class, name, \
	TP_PROTO(struct xfs_log_item *lip), \
	TP_ARGS(lip))
DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
1337
DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
D
Dave Chinner 已提交
1338 1339 1340
DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_mark);
DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_skip);
DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_unpin);
1341

D
Dave Chinner 已提交
1342 1343 1344 1345 1346 1347 1348
DECLARE_EVENT_CLASS(xfs_ail_class,
	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
	TP_ARGS(lip, old_lsn, new_lsn),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(void *, lip)
		__field(uint, type)
D
Dave Chinner 已提交
1349
		__field(unsigned long, flags)
D
Dave Chinner 已提交
1350 1351 1352 1353
		__field(xfs_lsn_t, old_lsn)
		__field(xfs_lsn_t, new_lsn)
	),
	TP_fast_assign(
1354
		__entry->dev = lip->li_log->l_mp->m_super->s_dev;
D
Dave Chinner 已提交
1355 1356 1357 1358 1359 1360
		__entry->lip = lip;
		__entry->type = lip->li_type;
		__entry->flags = lip->li_flags;
		__entry->old_lsn = old_lsn;
		__entry->new_lsn = new_lsn;
	),
1361
	TP_printk("dev %d:%d lip %p old lsn %d/%d new lsn %d/%d type %s flags %s",
D
Dave Chinner 已提交
1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->lip,
		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
)

#define DEFINE_AIL_EVENT(name) \
DEFINE_EVENT(xfs_ail_class, name, \
	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
	TP_ARGS(lip, old_lsn, new_lsn))
DEFINE_AIL_EVENT(xfs_ail_insert);
DEFINE_AIL_EVENT(xfs_ail_move);
DEFINE_AIL_EVENT(xfs_ail_delete);

TRACE_EVENT(xfs_log_assign_tail_lsn,
	TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
	TP_ARGS(log, new_lsn),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_lsn_t, new_lsn)
		__field(xfs_lsn_t, old_lsn)
		__field(xfs_lsn_t, last_sync_lsn)
	),
	TP_fast_assign(
		__entry->dev = log->l_mp->m_super->s_dev;
		__entry->new_lsn = new_lsn;
		__entry->old_lsn = atomic64_read(&log->l_tail_lsn);
		__entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
	),
	TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
		  CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
)
1399

1400
DECLARE_EVENT_CLASS(xfs_file_class,
1401 1402
	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter),
	TP_ARGS(iocb, iter),
1403 1404 1405 1406 1407 1408 1409 1410
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(xfs_fsize_t, size)
		__field(loff_t, offset)
		__field(size_t, count)
	),
	TP_fast_assign(
1411 1412
		__entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev;
		__entry->ino = XFS_I(file_inode(iocb->ki_filp))->i_ino;
1413
		__entry->size = XFS_I(file_inode(iocb->ki_filp))->i_disk_size;
1414 1415
		__entry->offset = iocb->ki_pos;
		__entry->count = iov_iter_count(iter);
1416
	),
1417
	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx pos 0x%llx bytecount 0x%zx",
1418 1419 1420 1421
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->size,
		  __entry->offset,
C
Christoph Hellwig 已提交
1422
		  __entry->count)
C
Christoph Hellwig 已提交
1423
)
1424 1425 1426

#define DEFINE_RW_EVENT(name)		\
DEFINE_EVENT(xfs_file_class, name,	\
1427 1428
	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter),		\
	TP_ARGS(iocb, iter))
C
Christoph Hellwig 已提交
1429 1430
DEFINE_RW_EVENT(xfs_file_buffered_read);
DEFINE_RW_EVENT(xfs_file_direct_read);
1431
DEFINE_RW_EVENT(xfs_file_dax_read);
C
Christoph Hellwig 已提交
1432 1433
DEFINE_RW_EVENT(xfs_file_buffered_write);
DEFINE_RW_EVENT(xfs_file_direct_write);
1434
DEFINE_RW_EVENT(xfs_file_dax_write);
1435 1436
DEFINE_RW_EVENT(xfs_reflink_bounce_dio_write);

C
Christoph Hellwig 已提交
1437

C
Christoph Hellwig 已提交
1438
DECLARE_EVENT_CLASS(xfs_imap_class,
1439
	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
1440 1441
		 int whichfork, struct xfs_bmbt_irec *irec),
	TP_ARGS(ip, offset, count, whichfork, irec),
1442 1443 1444 1445 1446 1447
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(loff_t, size)
		__field(loff_t, offset)
		__field(size_t, count)
1448
		__field(int, whichfork)
1449 1450 1451 1452 1453 1454 1455
		__field(xfs_fileoff_t, startoff)
		__field(xfs_fsblock_t, startblock)
		__field(xfs_filblks_t, blockcount)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
1456
		__entry->size = ip->i_disk_size;
1457 1458
		__entry->offset = offset;
		__entry->count = count;
1459
		__entry->whichfork = whichfork;
1460 1461 1462 1463
		__entry->startoff = irec ? irec->br_startoff : 0;
		__entry->startblock = irec ? irec->br_startblock : 0;
		__entry->blockcount = irec ? irec->br_blockcount : 0;
	),
1464
	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx pos 0x%llx bytecount 0x%zx "
1465
		  "fork %s startoff 0x%llx startblock 0x%llx fsbcount 0x%llx",
1466 1467 1468 1469 1470
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->size,
		  __entry->offset,
		  __entry->count,
1471
		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
1472
		  __entry->startoff,
1473
		  (int64_t)__entry->startblock,
1474
		  __entry->blockcount)
C
Christoph Hellwig 已提交
1475
)
1476

1477
#define DEFINE_IMAP_EVENT(name)	\
C
Christoph Hellwig 已提交
1478
DEFINE_EVENT(xfs_imap_class, name,	\
1479
	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,	\
1480 1481 1482 1483 1484 1485
		 int whichfork, struct xfs_bmbt_irec *irec),		\
	TP_ARGS(ip, offset, count, whichfork, irec))
DEFINE_IMAP_EVENT(xfs_map_blocks_found);
DEFINE_IMAP_EVENT(xfs_map_blocks_alloc);
DEFINE_IMAP_EVENT(xfs_iomap_alloc);
DEFINE_IMAP_EVENT(xfs_iomap_found);
C
Christoph Hellwig 已提交
1486

1487 1488 1489 1490 1491 1492
DECLARE_EVENT_CLASS(xfs_simple_io_class,
	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
	TP_ARGS(ip, offset, count),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
1493 1494
		__field(loff_t, isize)
		__field(loff_t, disize)
1495 1496 1497 1498 1499 1500
		__field(loff_t, offset)
		__field(size_t, count)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
1501
		__entry->isize = VFS_I(ip)->i_size;
1502
		__entry->disize = ip->i_disk_size;
1503 1504 1505
		__entry->offset = offset;
		__entry->count = count;
	),
1506
	TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
1507
		  "pos 0x%llx bytecount 0x%zx",
1508 1509
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
1510 1511
		  __entry->isize,
		  __entry->disize,
1512 1513
		  __entry->offset,
		  __entry->count)
C
Christoph Hellwig 已提交
1514
);
1515 1516 1517 1518 1519

#define DEFINE_SIMPLE_IO_EVENT(name)	\
DEFINE_EVENT(xfs_simple_io_class, name,	\
	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),	\
	TP_ARGS(ip, offset, count))
C
Christoph Hellwig 已提交
1520 1521
DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
1522
DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
1523
DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
1524 1525 1526
DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
C
Christoph Hellwig 已提交
1527

C
Christoph Hellwig 已提交
1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539
DECLARE_EVENT_CLASS(xfs_itrunc_class,
	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
	TP_ARGS(ip, new_size),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(xfs_fsize_t, size)
		__field(xfs_fsize_t, new_size)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
1540
		__entry->size = ip->i_disk_size;
C
Christoph Hellwig 已提交
1541 1542
		__entry->new_size = new_size;
	),
1543
	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx new_size 0x%llx",
C
Christoph Hellwig 已提交
1544 1545 1546 1547 1548 1549
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->size,
		  __entry->new_size)
)

C
Christoph Hellwig 已提交
1550
#define DEFINE_ITRUNC_EVENT(name) \
C
Christoph Hellwig 已提交
1551
DEFINE_EVENT(xfs_itrunc_class, name, \
C
Christoph Hellwig 已提交
1552
	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
C
Christoph Hellwig 已提交
1553
	TP_ARGS(ip, new_size))
1554 1555
DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
C
Christoph Hellwig 已提交
1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569

TRACE_EVENT(xfs_pagecache_inval,
	TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
	TP_ARGS(ip, start, finish),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(xfs_fsize_t, size)
		__field(xfs_off_t, start)
		__field(xfs_off_t, finish)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
1570
		__entry->size = ip->i_disk_size;
C
Christoph Hellwig 已提交
1571 1572 1573
		__entry->start = start;
		__entry->finish = finish;
	),
1574
	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx start 0x%llx finish 0x%llx",
C
Christoph Hellwig 已提交
1575 1576 1577 1578 1579 1580 1581 1582
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->size,
		  __entry->start,
		  __entry->finish)
);

TRACE_EVENT(xfs_bunmap,
1583
	TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t fileoff, xfs_filblks_t len,
C
Christoph Hellwig 已提交
1584
		 int flags, unsigned long caller_ip),
1585
	TP_ARGS(ip, fileoff, len, flags, caller_ip),
C
Christoph Hellwig 已提交
1586 1587 1588 1589
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(xfs_fsize_t, size)
1590
		__field(xfs_fileoff_t, fileoff)
C
Christoph Hellwig 已提交
1591 1592 1593 1594 1595 1596 1597
		__field(xfs_filblks_t, len)
		__field(unsigned long, caller_ip)
		__field(int, flags)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
1598
		__entry->size = ip->i_disk_size;
1599
		__entry->fileoff = fileoff;
C
Christoph Hellwig 已提交
1600 1601 1602 1603
		__entry->len = len;
		__entry->caller_ip = caller_ip;
		__entry->flags = flags;
	),
1604
	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx fileoff 0x%llx fsbcount 0x%llx"
1605
		  "flags %s caller %pS",
C
Christoph Hellwig 已提交
1606 1607 1608
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->size,
1609
		  __entry->fileoff,
C
Christoph Hellwig 已提交
1610 1611 1612 1613 1614 1615
		  __entry->len,
		  __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
		  (void *)__entry->caller_ip)

);

D
Dave Chinner 已提交
1616
DECLARE_EVENT_CLASS(xfs_extent_busy_class,
C
Christoph Hellwig 已提交
1617
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1618 1619
		 xfs_agblock_t agbno, xfs_extlen_t len),
	TP_ARGS(mp, agno, agbno, len),
C
Christoph Hellwig 已提交
1620 1621 1622
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
1623 1624
		__field(xfs_agblock_t, agbno)
		__field(xfs_extlen_t, len)
C
Christoph Hellwig 已提交
1625 1626 1627 1628
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
1629 1630
		__entry->agbno = agbno;
		__entry->len = len;
C
Christoph Hellwig 已提交
1631
	),
1632
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
C
Christoph Hellwig 已提交
1633 1634
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
1635 1636
		  __entry->agbno,
		  __entry->len)
C
Christoph Hellwig 已提交
1637
);
1638
#define DEFINE_BUSY_EVENT(name) \
D
Dave Chinner 已提交
1639
DEFINE_EVENT(xfs_extent_busy_class, name, \
1640 1641 1642
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
		 xfs_agblock_t agbno, xfs_extlen_t len), \
	TP_ARGS(mp, agno, agbno, len))
D
Dave Chinner 已提交
1643 1644 1645 1646 1647
DEFINE_BUSY_EVENT(xfs_extent_busy);
DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
DEFINE_BUSY_EVENT(xfs_extent_busy_force);
DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
1648

D
Dave Chinner 已提交
1649
TRACE_EVENT(xfs_extent_busy_trim,
1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 xfs_agblock_t agbno, xfs_extlen_t len,
		 xfs_agblock_t tbno, xfs_extlen_t tlen),
	TP_ARGS(mp, agno, agbno, len, tbno, tlen),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, agbno)
		__field(xfs_extlen_t, len)
		__field(xfs_agblock_t, tbno)
		__field(xfs_extlen_t, tlen)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->agbno = agbno;
		__entry->len = len;
		__entry->tbno = tbno;
		__entry->tlen = tlen;
	),
1670
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x found_agbno 0x%x found_fsbcount 0x%x",
1671 1672 1673 1674 1675 1676 1677 1678
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->agbno,
		  __entry->len,
		  __entry->tbno,
		  __entry->tlen)
);

1679
DECLARE_EVENT_CLASS(xfs_agf_class,
C
Christoph Hellwig 已提交
1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716
	TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
		 unsigned long caller_ip),
	TP_ARGS(mp, agf, flags, caller_ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(int, flags)
		__field(__u32, length)
		__field(__u32, bno_root)
		__field(__u32, cnt_root)
		__field(__u32, bno_level)
		__field(__u32, cnt_level)
		__field(__u32, flfirst)
		__field(__u32, fllast)
		__field(__u32, flcount)
		__field(__u32, freeblks)
		__field(__u32, longest)
		__field(unsigned long, caller_ip)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = be32_to_cpu(agf->agf_seqno),
		__entry->flags = flags;
		__entry->length = be32_to_cpu(agf->agf_length),
		__entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
		__entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
		__entry->bno_level =
				be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
		__entry->cnt_level =
				be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
		__entry->flfirst = be32_to_cpu(agf->agf_flfirst),
		__entry->fllast = be32_to_cpu(agf->agf_fllast),
		__entry->flcount = be32_to_cpu(agf->agf_flcount),
		__entry->freeblks = be32_to_cpu(agf->agf_freeblks),
		__entry->longest = be32_to_cpu(agf->agf_longest);
		__entry->caller_ip = caller_ip;
	),
1717
	TP_printk("dev %d:%d agno 0x%x flags %s length %u roots b %u c %u "
C
Christoph Hellwig 已提交
1718
		  "levels b %u c %u flfirst %u fllast %u flcount %u "
1719
		  "freeblks %u longest %u caller %pS",
C
Christoph Hellwig 已提交
1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
		  __entry->length,
		  __entry->bno_root,
		  __entry->cnt_root,
		  __entry->bno_level,
		  __entry->cnt_level,
		  __entry->flfirst,
		  __entry->fllast,
		  __entry->flcount,
		  __entry->freeblks,
		  __entry->longest,
		  (void *)__entry->caller_ip)
);
1735 1736 1737 1738 1739 1740 1741
#define DEFINE_AGF_EVENT(name) \
DEFINE_EVENT(xfs_agf_class, name, \
	TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags, \
		 unsigned long caller_ip), \
	TP_ARGS(mp, agf, flags, caller_ip))
DEFINE_AGF_EVENT(xfs_agf);
DEFINE_AGF_EVENT(xfs_agfl_reset);
C
Christoph Hellwig 已提交
1742 1743 1744

TRACE_EVENT(xfs_free_extent,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1745 1746 1747
		 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
		 int haveright),
	TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
C
Christoph Hellwig 已提交
1748 1749 1750 1751 1752
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, agbno)
		__field(xfs_extlen_t, len)
1753
		__field(int, resv)
C
Christoph Hellwig 已提交
1754 1755 1756 1757 1758 1759 1760 1761
		__field(int, haveleft)
		__field(int, haveright)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->agbno = agbno;
		__entry->len = len;
1762
		__entry->resv = resv;
C
Christoph Hellwig 已提交
1763 1764 1765
		__entry->haveleft = haveleft;
		__entry->haveright = haveright;
	),
1766
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x resv %d %s",
C
Christoph Hellwig 已提交
1767 1768 1769 1770
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->agbno,
		  __entry->len,
1771
		  __entry->resv,
C
Christoph Hellwig 已提交
1772 1773 1774 1775 1776 1777
		  __entry->haveleft ?
			(__entry->haveright ? "both" : "left") :
			(__entry->haveright ? "right" : "none"))

);

C
Christoph Hellwig 已提交
1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797
DECLARE_EVENT_CLASS(xfs_alloc_class,
	TP_PROTO(struct xfs_alloc_arg *args),
	TP_ARGS(args),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, agbno)
		__field(xfs_extlen_t, minlen)
		__field(xfs_extlen_t, maxlen)
		__field(xfs_extlen_t, mod)
		__field(xfs_extlen_t, prod)
		__field(xfs_extlen_t, minleft)
		__field(xfs_extlen_t, total)
		__field(xfs_extlen_t, alignment)
		__field(xfs_extlen_t, minalignslop)
		__field(xfs_extlen_t, len)
		__field(short, type)
		__field(short, otype)
		__field(char, wasdel)
		__field(char, wasfromfl)
1798
		__field(int, resv)
1799
		__field(int, datatype)
C
Christoph Hellwig 已提交
1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818
		__field(xfs_fsblock_t, firstblock)
	),
	TP_fast_assign(
		__entry->dev = args->mp->m_super->s_dev;
		__entry->agno = args->agno;
		__entry->agbno = args->agbno;
		__entry->minlen = args->minlen;
		__entry->maxlen = args->maxlen;
		__entry->mod = args->mod;
		__entry->prod = args->prod;
		__entry->minleft = args->minleft;
		__entry->total = args->total;
		__entry->alignment = args->alignment;
		__entry->minalignslop = args->minalignslop;
		__entry->len = args->len;
		__entry->type = args->type;
		__entry->otype = args->otype;
		__entry->wasdel = args->wasdel;
		__entry->wasfromfl = args->wasfromfl;
1819
		__entry->resv = args->resv;
1820
		__entry->datatype = args->datatype;
1821
		__entry->firstblock = args->tp->t_firstblock;
C
Christoph Hellwig 已提交
1822
	),
1823
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x minlen %u maxlen %u mod %u "
C
Christoph Hellwig 已提交
1824
		  "prod %u minleft %u total %u alignment %u minalignslop %u "
1825
		  "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
1826
		  "datatype 0x%x firstblock 0x%llx",
C
Christoph Hellwig 已提交
1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->agbno,
		  __entry->minlen,
		  __entry->maxlen,
		  __entry->mod,
		  __entry->prod,
		  __entry->minleft,
		  __entry->total,
		  __entry->alignment,
		  __entry->minalignslop,
		  __entry->len,
		  __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
		  __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
		  __entry->wasdel,
		  __entry->wasfromfl,
1843
		  __entry->resv,
1844
		  __entry->datatype,
1845
		  (unsigned long long)__entry->firstblock)
C
Christoph Hellwig 已提交
1846 1847
)

C
Christoph Hellwig 已提交
1848 1849 1850 1851
#define DEFINE_ALLOC_EVENT(name) \
DEFINE_EVENT(xfs_alloc_class, name, \
	TP_PROTO(struct xfs_alloc_arg *args), \
	TP_ARGS(args))
C
Christoph Hellwig 已提交
1852
DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1853
DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
C
Christoph Hellwig 已提交
1854 1855 1856
DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1857
DEFINE_ALLOC_EVENT(xfs_alloc_cur);
1858 1859
DEFINE_ALLOC_EVENT(xfs_alloc_cur_right);
DEFINE_ALLOC_EVENT(xfs_alloc_cur_left);
1860 1861
DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup);
DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup_done);
C
Christoph Hellwig 已提交
1862
DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1863 1864
DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
C
Christoph Hellwig 已提交
1865 1866 1867 1868 1869
DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1870
DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
C
Christoph Hellwig 已提交
1871 1872 1873 1874 1875 1876 1877 1878 1879 1880
DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);

1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900
TRACE_EVENT(xfs_alloc_cur_check,
	TP_PROTO(struct xfs_mount *mp, xfs_btnum_t btnum, xfs_agblock_t bno,
		 xfs_extlen_t len, xfs_extlen_t diff, bool new),
	TP_ARGS(mp, btnum, bno, len, diff, new),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_btnum_t, btnum)
		__field(xfs_agblock_t, bno)
		__field(xfs_extlen_t, len)
		__field(xfs_extlen_t, diff)
		__field(bool, new)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->btnum = btnum;
		__entry->bno = bno;
		__entry->len = len;
		__entry->diff = diff;
		__entry->new = new;
	),
1901
	TP_printk("dev %d:%d btree %s agbno 0x%x fsbcount 0x%x diff 0x%x new %d",
1902 1903 1904 1905 1906
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
		  __entry->bno, __entry->len, __entry->diff, __entry->new)
)

1907
DECLARE_EVENT_CLASS(xfs_da_class,
C
Christoph Hellwig 已提交
1908 1909 1910 1911 1912 1913 1914 1915 1916
	TP_PROTO(struct xfs_da_args *args),
	TP_ARGS(args),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__dynamic_array(char, name, args->namelen)
		__field(int, namelen)
		__field(xfs_dahash_t, hashval)
		__field(xfs_ino_t, inumber)
1917
		__field(uint32_t, op_flags)
C
Christoph Hellwig 已提交
1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941
	),
	TP_fast_assign(
		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
		__entry->ino = args->dp->i_ino;
		if (args->namelen)
			memcpy(__get_str(name), args->name, args->namelen);
		__entry->namelen = args->namelen;
		__entry->hashval = args->hashval;
		__entry->inumber = args->inumber;
		__entry->op_flags = args->op_flags;
	),
	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
		  "inumber 0x%llx op_flags %s",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->namelen,
		  __entry->namelen ? __get_str(name) : NULL,
		  __entry->namelen,
		  __entry->hashval,
		  __entry->inumber,
		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
)

#define DEFINE_DIR2_EVENT(name) \
1942
DEFINE_EVENT(xfs_da_class, name, \
C
Christoph Hellwig 已提交
1943
	TP_PROTO(struct xfs_da_args *args), \
C
Christoph Hellwig 已提交
1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970
	TP_ARGS(args))
DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);

1971 1972 1973 1974 1975 1976 1977 1978 1979 1980
DECLARE_EVENT_CLASS(xfs_attr_class,
	TP_PROTO(struct xfs_da_args *args),
	TP_ARGS(args),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__dynamic_array(char, name, args->namelen)
		__field(int, namelen)
		__field(int, valuelen)
		__field(xfs_dahash_t, hashval)
1981 1982
		__field(unsigned int, attr_filter)
		__field(unsigned int, attr_flags)
1983
		__field(uint32_t, op_flags)
1984 1985 1986 1987 1988 1989 1990 1991 1992
	),
	TP_fast_assign(
		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
		__entry->ino = args->dp->i_ino;
		if (args->namelen)
			memcpy(__get_str(name), args->name, args->namelen);
		__entry->namelen = args->namelen;
		__entry->valuelen = args->valuelen;
		__entry->hashval = args->hashval;
1993 1994
		__entry->attr_filter = args->attr_filter;
		__entry->attr_flags = args->attr_flags;
1995 1996 1997
		__entry->op_flags = args->op_flags;
	),
	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1998
		  "hashval 0x%x filter %s flags %s op_flags %s",
1999 2000 2001 2002 2003 2004 2005
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->namelen,
		  __entry->namelen ? __get_str(name) : NULL,
		  __entry->namelen,
		  __entry->valuelen,
		  __entry->hashval,
2006 2007 2008 2009 2010
		  __print_flags(__entry->attr_filter, "|",
				XFS_ATTR_FILTER_FLAGS),
		   __print_flags(__entry->attr_flags, "|",
				{ XATTR_CREATE,		"CREATE" },
				{ XATTR_REPLACE,	"REPLACE" }),
2011 2012 2013
		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
)

2014
#define DEFINE_ATTR_EVENT(name) \
2015
DEFINE_EVENT(xfs_attr_class, name, \
2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027
	TP_PROTO(struct xfs_da_args *args), \
	TP_ARGS(args))
DEFINE_ATTR_EVENT(xfs_attr_sf_add);
DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
DEFINE_ATTR_EVENT(xfs_attr_sf_create);
DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);

DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
2028
DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
2029
DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
2030 2031
DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
2032 2033
DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
2034
DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045
DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
2046
DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
2047 2048

DEFINE_ATTR_EVENT(xfs_attr_node_addname);
2049
DEFINE_ATTR_EVENT(xfs_attr_node_get);
2050 2051 2052
DEFINE_ATTR_EVENT(xfs_attr_node_replace);
DEFINE_ATTR_EVENT(xfs_attr_node_removename);

2053 2054 2055 2056 2057 2058
DEFINE_ATTR_EVENT(xfs_attr_fillstate);
DEFINE_ATTR_EVENT(xfs_attr_refillstate);

DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);

2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076
#define DEFINE_DA_EVENT(name) \
DEFINE_EVENT(xfs_da_class, name, \
	TP_PROTO(struct xfs_da_args *args), \
	TP_ARGS(args))
DEFINE_DA_EVENT(xfs_da_split);
DEFINE_DA_EVENT(xfs_da_join);
DEFINE_DA_EVENT(xfs_da_link_before);
DEFINE_DA_EVENT(xfs_da_link_after);
DEFINE_DA_EVENT(xfs_da_unlink_back);
DEFINE_DA_EVENT(xfs_da_unlink_forward);
DEFINE_DA_EVENT(xfs_da_root_split);
DEFINE_DA_EVENT(xfs_da_root_join);
DEFINE_DA_EVENT(xfs_da_node_add);
DEFINE_DA_EVENT(xfs_da_node_create);
DEFINE_DA_EVENT(xfs_da_node_split);
DEFINE_DA_EVENT(xfs_da_node_remove);
DEFINE_DA_EVENT(xfs_da_node_rebalance);
DEFINE_DA_EVENT(xfs_da_node_unbalance);
2077
DEFINE_DA_EVENT(xfs_da_node_toosmall);
2078 2079 2080
DEFINE_DA_EVENT(xfs_da_swap_lastblock);
DEFINE_DA_EVENT(xfs_da_grow_inode);
DEFINE_DA_EVENT(xfs_da_shrink_inode);
2081 2082
DEFINE_DA_EVENT(xfs_da_fixhashpath);
DEFINE_DA_EVENT(xfs_da_path_shift);
2083

C
Christoph Hellwig 已提交
2084 2085 2086 2087 2088 2089
DECLARE_EVENT_CLASS(xfs_dir2_space_class,
	TP_PROTO(struct xfs_da_args *args, int idx),
	TP_ARGS(args, idx),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
2090
		__field(uint32_t, op_flags)
C
Christoph Hellwig 已提交
2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103
		__field(int, idx)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
		__entry->ino = args->dp->i_ino;
		__entry->op_flags = args->op_flags;
		__entry->idx = idx;
	),
	TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
		  __entry->idx)
C
Christoph Hellwig 已提交
2104 2105
)

C
Christoph Hellwig 已提交
2106 2107
#define DEFINE_DIR2_SPACE_EVENT(name) \
DEFINE_EVENT(xfs_dir2_space_class, name, \
C
Christoph Hellwig 已提交
2108
	TP_PROTO(struct xfs_da_args *args, int idx), \
C
Christoph Hellwig 已提交
2109 2110 2111 2112 2113
	TP_ARGS(args, idx))
DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
C
Christoph Hellwig 已提交
2114 2115 2116 2117 2118 2119 2120

TRACE_EVENT(xfs_dir2_leafn_moveents,
	TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
	TP_ARGS(args, src_idx, dst_idx, count),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
2121
		__field(uint32_t, op_flags)
C
Christoph Hellwig 已提交
2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143
		__field(int, src_idx)
		__field(int, dst_idx)
		__field(int, count)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
		__entry->ino = args->dp->i_ino;
		__entry->op_flags = args->op_flags;
		__entry->src_idx = src_idx;
		__entry->dst_idx = dst_idx;
		__entry->count = count;
	),
	TP_printk("dev %d:%d ino 0x%llx op_flags %s "
		  "src_idx %d dst_idx %d count %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
		  __entry->src_idx,
		  __entry->dst_idx,
		  __entry->count)
);

2144 2145 2146 2147
#define XFS_SWAPEXT_INODES \
	{ 0,	"target" }, \
	{ 1,	"temp" }

2148 2149 2150 2151 2152
TRACE_DEFINE_ENUM(XFS_DINODE_FMT_DEV);
TRACE_DEFINE_ENUM(XFS_DINODE_FMT_LOCAL);
TRACE_DEFINE_ENUM(XFS_DINODE_FMT_EXTENTS);
TRACE_DEFINE_ENUM(XFS_DINODE_FMT_BTREE);
TRACE_DEFINE_ENUM(XFS_DINODE_FMT_UUID);
2153 2154 2155 2156 2157 2158 2159 2160 2161

DECLARE_EVENT_CLASS(xfs_swap_extent_class,
	TP_PROTO(struct xfs_inode *ip, int which),
	TP_ARGS(ip, which),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(int, which)
		__field(xfs_ino_t, ino)
		__field(int, format)
2162
		__field(xfs_extnum_t, nex)
2163 2164 2165 2166 2167 2168 2169
		__field(int, broot_size)
		__field(int, fork_off)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->which = which;
		__entry->ino = ip->i_ino;
2170
		__entry->format = ip->i_df.if_format;
2171
		__entry->nex = ip->i_df.if_nextents;
2172 2173 2174
		__entry->broot_size = ip->i_df.if_broot_bytes;
		__entry->fork_off = XFS_IFORK_BOFF(ip);
	),
2175
	TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %llu, "
2176
		  "broot size %d, forkoff 0x%x",
2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
		  __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
		  __entry->nex,
		  __entry->broot_size,
		  __entry->fork_off)
)

#define DEFINE_SWAPEXT_EVENT(name) \
DEFINE_EVENT(xfs_swap_extent_class, name, \
	TP_PROTO(struct xfs_inode *ip, int which), \
	TP_ARGS(ip, which))

DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);

2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211
TRACE_EVENT(xfs_log_recover,
	TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
	TP_ARGS(log, headblk, tailblk),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_daddr_t, headblk)
		__field(xfs_daddr_t, tailblk)
	),
	TP_fast_assign(
		__entry->dev = log->l_mp->m_super->s_dev;
		__entry->headblk = headblk;
		__entry->tailblk = tailblk;
	),
	TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
		  __entry->tailblk)
)

2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234
TRACE_EVENT(xfs_log_recover_record,
	TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
	TP_ARGS(log, rhead, pass),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_lsn_t, lsn)
		__field(int, len)
		__field(int, num_logops)
		__field(int, pass)
	),
	TP_fast_assign(
		__entry->dev = log->l_mp->m_super->s_dev;
		__entry->lsn = be64_to_cpu(rhead->h_lsn);
		__entry->len = be32_to_cpu(rhead->h_len);
		__entry->num_logops = be32_to_cpu(rhead->h_num_logops);
		__entry->pass = pass;
	),
	TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->lsn, __entry->len, __entry->num_logops,
		   __entry->pass)
)

2235
DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
2236
	TP_PROTO(struct xlog *log, struct xlog_recover *trans,
2237 2238 2239 2240 2241 2242
		struct xlog_recover_item *item, int pass),
	TP_ARGS(log, trans, item, pass),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(unsigned long, item)
		__field(xlog_tid_t, tid)
2243
		__field(xfs_lsn_t, lsn)
2244 2245 2246 2247 2248 2249 2250 2251 2252
		__field(int, type)
		__field(int, pass)
		__field(int, count)
		__field(int, total)
	),
	TP_fast_assign(
		__entry->dev = log->l_mp->m_super->s_dev;
		__entry->item = (unsigned long)item;
		__entry->tid = trans->r_log_tid;
2253
		__entry->lsn = trans->r_lsn;
2254 2255 2256 2257 2258
		__entry->type = ITEM_TYPE(item);
		__entry->pass = pass;
		__entry->count = item->ri_cnt;
		__entry->total = item->ri_total;
	),
2259
	TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
2260
		  "item type %s item region count/total %d/%d",
2261 2262
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->tid,
2263
		  __entry->lsn,
2264 2265 2266 2267 2268 2269 2270 2271 2272
		  __entry->pass,
		  (void *)__entry->item,
		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
		  __entry->count,
		  __entry->total)
)

#define DEFINE_LOG_RECOVER_ITEM(name) \
DEFINE_EVENT(xfs_log_recover_item_class, name, \
2273
	TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
2274 2275 2276 2277 2278 2279 2280 2281 2282 2283
		struct xlog_recover_item *item, int pass), \
	TP_ARGS(log, trans, item, pass))

DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);

DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
2284
	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
2285 2286 2287
	TP_ARGS(log, buf_f),
	TP_STRUCT__entry(
		__field(dev_t, dev)
2288
		__field(int64_t, blkno)
2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301
		__field(unsigned short, len)
		__field(unsigned short, flags)
		__field(unsigned short, size)
		__field(unsigned int, map_size)
	),
	TP_fast_assign(
		__entry->dev = log->l_mp->m_super->s_dev;
		__entry->blkno = buf_f->blf_blkno;
		__entry->len = buf_f->blf_len;
		__entry->flags = buf_f->blf_flags;
		__entry->size = buf_f->blf_size;
		__entry->map_size = buf_f->blf_map_size;
	),
2302
	TP_printk("dev %d:%d daddr 0x%llx, bbcount 0x%x, flags 0x%x, size %d, "
2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313
			"map_size %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->blkno,
		  __entry->len,
		  __entry->flags,
		  __entry->size,
		  __entry->map_size)
)

#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
2314
	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
2315 2316 2317 2318 2319 2320 2321
	TP_ARGS(log, buf_f))

DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
2322
DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
2323 2324 2325 2326 2327
DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);

DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
2328
	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
2329 2330 2331 2332 2333 2334 2335 2336
	TP_ARGS(log, in_f),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(unsigned short, size)
		__field(int, fields)
		__field(unsigned short, asize)
		__field(unsigned short, dsize)
2337
		__field(int64_t, blkno)
2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352
		__field(int, len)
		__field(int, boffset)
	),
	TP_fast_assign(
		__entry->dev = log->l_mp->m_super->s_dev;
		__entry->ino = in_f->ilf_ino;
		__entry->size = in_f->ilf_size;
		__entry->fields = in_f->ilf_fields;
		__entry->asize = in_f->ilf_asize;
		__entry->dsize = in_f->ilf_dsize;
		__entry->blkno = in_f->ilf_blkno;
		__entry->len = in_f->ilf_len;
		__entry->boffset = in_f->ilf_boffset;
	),
	TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2353
			"dsize %d, daddr 0x%llx, bbcount 0x%x, boffset %d",
2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->size,
		  __entry->fields,
		  __entry->asize,
		  __entry->dsize,
		  __entry->blkno,
		  __entry->len,
		  __entry->boffset)
)
#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
2366
	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
2367 2368 2369 2370 2371 2372
	TP_ARGS(log, in_f))

DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);

2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393
DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
	TP_ARGS(log, in_f),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, agbno)
		__field(unsigned int, count)
		__field(unsigned int, isize)
		__field(xfs_agblock_t, length)
		__field(unsigned int, gen)
	),
	TP_fast_assign(
		__entry->dev = log->l_mp->m_super->s_dev;
		__entry->agno = be32_to_cpu(in_f->icl_ag);
		__entry->agbno = be32_to_cpu(in_f->icl_agbno);
		__entry->count = be32_to_cpu(in_f->icl_count);
		__entry->isize = be32_to_cpu(in_f->icl_isize);
		__entry->length = be32_to_cpu(in_f->icl_length);
		__entry->gen = be32_to_cpu(in_f->icl_gen);
	),
2394
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x ireccount %u isize %u gen 0x%x",
2395 2396 2397 2398 2399 2400 2401
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->agbno,
		  __entry->length,
		  __entry->count,
		  __entry->isize,
		  __entry->gen)
2402 2403 2404 2405 2406 2407 2408 2409 2410
)
#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
	TP_ARGS(log, in_f))

DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);

C
Christoph Hellwig 已提交
2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426
DECLARE_EVENT_CLASS(xfs_discard_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 xfs_agblock_t agbno, xfs_extlen_t len),
	TP_ARGS(mp, agno, agbno, len),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, agbno)
		__field(xfs_extlen_t, len)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->agbno = agbno;
		__entry->len = len;
	),
2427
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
C
Christoph Hellwig 已提交
2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->agbno,
		  __entry->len)
)

#define DEFINE_DISCARD_EVENT(name) \
DEFINE_EVENT(xfs_discard_class, name, \
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
		 xfs_agblock_t agbno, xfs_extlen_t len), \
	TP_ARGS(mp, agno, agbno, len))
DEFINE_DISCARD_EVENT(xfs_discard_extent);
DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
DEFINE_DISCARD_EVENT(xfs_discard_exclude);
DEFINE_DISCARD_EVENT(xfs_discard_busy);

2444
/* btree cursor events */
2445 2446 2447 2448 2449 2450 2451 2452
TRACE_DEFINE_ENUM(XFS_BTNUM_BNOi);
TRACE_DEFINE_ENUM(XFS_BTNUM_CNTi);
TRACE_DEFINE_ENUM(XFS_BTNUM_BMAPi);
TRACE_DEFINE_ENUM(XFS_BTNUM_INOi);
TRACE_DEFINE_ENUM(XFS_BTNUM_FINOi);
TRACE_DEFINE_ENUM(XFS_BTNUM_RMAPi);
TRACE_DEFINE_ENUM(XFS_BTNUM_REFCi);

2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468
DECLARE_EVENT_CLASS(xfs_btree_cur_class,
	TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
	TP_ARGS(cur, level, bp),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_btnum_t, btnum)
		__field(int, level)
		__field(int, nlevels)
		__field(int, ptr)
		__field(xfs_daddr_t, daddr)
	),
	TP_fast_assign(
		__entry->dev = cur->bc_mp->m_super->s_dev;
		__entry->btnum = cur->bc_btnum;
		__entry->level = level;
		__entry->nlevels = cur->bc_nlevels;
2469
		__entry->ptr = cur->bc_levels[level].ptr;
2470
		__entry->daddr = bp ? xfs_buf_daddr(bp) : -1;
2471
	),
2472
	TP_printk("dev %d:%d btree %s level %d/%d ptr %d daddr 0x%llx",
2473
		  MAJOR(__entry->dev), MINOR(__entry->dev),
2474
		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485
		  __entry->level,
		  __entry->nlevels,
		  __entry->ptr,
		  (unsigned long long)__entry->daddr)
)

#define DEFINE_BTREE_CUR_EVENT(name) \
DEFINE_EVENT(xfs_btree_cur_class, name, \
	TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
	TP_ARGS(cur, level, bp))
DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
2486
DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
2487

2488 2489 2490 2491
/* deferred ops */
struct xfs_defer_pending;

DECLARE_EVENT_CLASS(xfs_defer_class,
2492 2493
	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
	TP_ARGS(tp, caller_ip),
2494 2495
	TP_STRUCT__entry(
		__field(dev_t, dev)
2496
		__field(struct xfs_trans *, tp)
2497
		__field(char, committed)
2498
		__field(unsigned long, caller_ip)
2499 2500
	),
	TP_fast_assign(
2501 2502
		__entry->dev = tp->t_mountp->m_super->s_dev;
		__entry->tp = tp;
2503
		__entry->caller_ip = caller_ip;
2504
	),
2505
	TP_printk("dev %d:%d tp %p caller %pS",
2506
		  MAJOR(__entry->dev), MINOR(__entry->dev),
2507
		  __entry->tp,
2508
		  (char *)__entry->caller_ip)
2509 2510 2511
)
#define DEFINE_DEFER_EVENT(name) \
DEFINE_EVENT(xfs_defer_class, name, \
2512 2513
	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
	TP_ARGS(tp, caller_ip))
2514 2515

DECLARE_EVENT_CLASS(xfs_defer_error_class,
2516 2517
	TP_PROTO(struct xfs_trans *tp, int error),
	TP_ARGS(tp, error),
2518 2519
	TP_STRUCT__entry(
		__field(dev_t, dev)
2520
		__field(struct xfs_trans *, tp)
2521
		__field(char, committed)
2522 2523 2524
		__field(int, error)
	),
	TP_fast_assign(
2525 2526
		__entry->dev = tp->t_mountp->m_super->s_dev;
		__entry->tp = tp;
2527 2528
		__entry->error = error;
	),
2529
	TP_printk("dev %d:%d tp %p err %d",
2530
		  MAJOR(__entry->dev), MINOR(__entry->dev),
2531
		  __entry->tp,
2532 2533 2534 2535
		  __entry->error)
)
#define DEFINE_DEFER_ERROR_EVENT(name) \
DEFINE_EVENT(xfs_defer_error_class, name, \
2536 2537
	TP_PROTO(struct xfs_trans *tp, int error), \
	TP_ARGS(tp, error))
2538 2539 2540 2541 2542 2543 2544 2545

DECLARE_EVENT_CLASS(xfs_defer_pending_class,
	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
	TP_ARGS(mp, dfp),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(int, type)
		__field(void *, intent)
2546
		__field(char, committed)
2547 2548 2549 2550
		__field(int, nr)
	),
	TP_fast_assign(
		__entry->dev = mp ? mp->m_super->s_dev : 0;
2551
		__entry->type = dfp->dfp_type;
2552
		__entry->intent = dfp->dfp_intent;
2553
		__entry->committed = dfp->dfp_done != NULL;
2554 2555
		__entry->nr = dfp->dfp_count;
	),
2556
	TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->type,
		  __entry->intent,
		  __entry->committed,
		  __entry->nr)
)
#define DEFINE_DEFER_PENDING_EVENT(name) \
DEFINE_EVENT(xfs_defer_pending_class, name, \
	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
	TP_ARGS(mp, dfp))

DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 int type, xfs_agblock_t agbno, xfs_extlen_t len),
	TP_ARGS(mp, agno, type, agbno, len),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(int, type)
		__field(xfs_agblock_t, agbno)
		__field(xfs_extlen_t, len)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->type = type;
		__entry->agbno = agbno;
		__entry->len = len;
	),
2586
	TP_printk("dev %d:%d op %d agno 0x%x agbno 0x%x fsbcount 0x%x",
2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->type,
		  __entry->agno,
		  __entry->agbno,
		  __entry->len)
);
#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
		 int type, \
		 xfs_agblock_t bno, \
		 xfs_extlen_t len), \
	TP_ARGS(mp, agno, type, bno, len))

DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 int op,
		 xfs_agblock_t agbno,
		 xfs_ino_t ino,
		 int whichfork,
		 xfs_fileoff_t offset,
		 xfs_filblks_t len,
		 xfs_exntst_t state),
	TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_ino_t, ino)
		__field(xfs_agblock_t, agbno)
		__field(int, whichfork)
		__field(xfs_fileoff_t, l_loff)
		__field(xfs_filblks_t, l_len)
		__field(xfs_exntst_t, l_state)
		__field(int, op)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->ino = ino;
		__entry->agbno = agbno;
		__entry->whichfork = whichfork;
		__entry->l_loff = offset;
		__entry->l_len = len;
		__entry->l_state = state;
		__entry->op = op;
	),
2633
	TP_printk("dev %d:%d op %d agno 0x%x agbno 0x%x owner 0x%llx %s fileoff 0x%llx fsbcount 0x%llx state %d",
2634 2635 2636 2637 2638
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->op,
		  __entry->agno,
		  __entry->agbno,
		  __entry->ino,
2639
		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664
		  __entry->l_loff,
		  __entry->l_len,
		  __entry->l_state)
);
#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
		 int op, \
		 xfs_agblock_t agbno, \
		 xfs_ino_t ino, \
		 int whichfork, \
		 xfs_fileoff_t offset, \
		 xfs_filblks_t len, \
		 xfs_exntst_t state), \
	TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))

DEFINE_DEFER_EVENT(xfs_defer_cancel);
DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
DEFINE_DEFER_EVENT(xfs_defer_finish);
DEFINE_DEFER_EVENT(xfs_defer_finish_done);

DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);

2665 2666
DEFINE_DEFER_PENDING_EVENT(xfs_defer_create_intent);
DEFINE_DEFER_PENDING_EVENT(xfs_defer_cancel_list);
2667 2668
DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2669
DEFINE_DEFER_PENDING_EVENT(xfs_defer_relog_intent);
2670

2671 2672 2673
#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
2674 2675
DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_defer);
DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred);
2676

2677 2678 2679 2680
/* rmap tracepoints */
DECLARE_EVENT_CLASS(xfs_rmap_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2681
		 const struct xfs_owner_info *oinfo),
2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699
	TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, agbno)
		__field(xfs_extlen_t, len)
		__field(uint64_t, owner)
		__field(uint64_t, offset)
		__field(unsigned long, flags)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->agbno = agbno;
		__entry->len = len;
		__entry->owner = oinfo->oi_owner;
		__entry->offset = oinfo->oi_offset;
		__entry->flags = oinfo->oi_flags;
2700 2701
		if (unwritten)
			__entry->flags |= XFS_RMAP_UNWRITTEN;
2702
	),
2703
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%lx",
2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->agbno,
		  __entry->len,
		  __entry->owner,
		  __entry->offset,
		  __entry->flags)
);
#define DEFINE_RMAP_EVENT(name) \
DEFINE_EVENT(xfs_rmap_class, name, \
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
		 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2716
		 const struct xfs_owner_info *oinfo), \
2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735
	TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))

/* simple AG-based error/%ip tracepoint class */
DECLARE_EVENT_CLASS(xfs_ag_error_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
		 unsigned long caller_ip),
	TP_ARGS(mp, agno, error, caller_ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(int, error)
		__field(unsigned long, caller_ip)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->error = error;
		__entry->caller_ip = caller_ip;
	),
2736
	TP_printk("dev %d:%d agno 0x%x error %d caller %pS",
2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->error,
		  (char *)__entry->caller_ip)
);

#define DEFINE_AG_ERROR_EVENT(name) \
DEFINE_EVENT(xfs_ag_error_class, name, \
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
		 unsigned long caller_ip), \
	TP_ARGS(mp, agno, error, caller_ip))

DEFINE_RMAP_EVENT(xfs_rmap_unmap);
DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
DEFINE_RMAP_EVENT(xfs_rmap_map);
DEFINE_RMAP_EVENT(xfs_rmap_map_done);
DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
2755 2756 2757 2758
DEFINE_RMAP_EVENT(xfs_rmap_convert);
DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
2759

2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782
DECLARE_EVENT_CLASS(xfs_rmapbt_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 xfs_agblock_t agbno, xfs_extlen_t len,
		 uint64_t owner, uint64_t offset, unsigned int flags),
	TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, agbno)
		__field(xfs_extlen_t, len)
		__field(uint64_t, owner)
		__field(uint64_t, offset)
		__field(unsigned int, flags)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->agbno = agbno;
		__entry->len = len;
		__entry->owner = owner;
		__entry->offset = offset;
		__entry->flags = flags;
	),
2783
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->agbno,
		  __entry->len,
		  __entry->owner,
		  __entry->offset,
		  __entry->flags)
);
#define DEFINE_RMAPBT_EVENT(name) \
DEFINE_EVENT(xfs_rmapbt_class, name, \
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
		 xfs_agblock_t agbno, xfs_extlen_t len, \
		 uint64_t owner, uint64_t offset, unsigned int flags), \
	TP_ARGS(mp, agno, agbno, len, owner, offset, flags))

#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);

D
Darrick J. Wong 已提交
2803 2804
DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
2805 2806 2807 2808 2809 2810
DEFINE_RMAPBT_EVENT(xfs_rmap_update);
DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
2811 2812 2813 2814 2815

DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
2816 2817
DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
2818
DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
D
Darrick J. Wong 已提交
2819

2820 2821 2822 2823 2824
/* deferred bmbt updates */
#define DEFINE_BMAP_DEFERRED_EVENT	DEFINE_RMAP_DEFERRED_EVENT
DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);

2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851
/* per-AG reservation */
DECLARE_EVENT_CLASS(xfs_ag_resv_class,
	TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
		 xfs_extlen_t len),
	TP_ARGS(pag, resv, len),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(int, resv)
		__field(xfs_extlen_t, freeblks)
		__field(xfs_extlen_t, flcount)
		__field(xfs_extlen_t, reserved)
		__field(xfs_extlen_t, asked)
		__field(xfs_extlen_t, len)
	),
	TP_fast_assign(
		struct xfs_ag_resv	*r = xfs_perag_resv(pag, resv);

		__entry->dev = pag->pag_mount->m_super->s_dev;
		__entry->agno = pag->pag_agno;
		__entry->resv = resv;
		__entry->freeblks = pag->pagf_freeblks;
		__entry->flcount = pag->pagf_flcount;
		__entry->reserved = r ? r->ar_reserved : 0;
		__entry->asked = r ? r->ar_asked : 0;
		__entry->len = len;
	),
2852
	TP_printk("dev %d:%d agno 0x%x resv %d freeblks %u flcount %u "
2853
		  "resv %u ask %u len %u",
2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->resv,
		  __entry->freeblks,
		  __entry->flcount,
		  __entry->reserved,
		  __entry->asked,
		  __entry->len)
)
#define DEFINE_AG_RESV_EVENT(name) \
DEFINE_EVENT(xfs_ag_resv_class, name, \
	TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
		 xfs_extlen_t len), \
	TP_ARGS(pag, type, len))

/* per-AG reservation tracepoints */
DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);

DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);

2880 2881 2882 2883 2884 2885
/* refcount tracepoint classes */

/* reuse the discard trace class for agbno/aglen-based traces */
#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)

/* ag btree lookup tracepoint class */
2886 2887 2888
TRACE_DEFINE_ENUM(XFS_LOOKUP_EQi);
TRACE_DEFINE_ENUM(XFS_LOOKUP_LEi);
TRACE_DEFINE_ENUM(XFS_LOOKUP_GEi);
2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904
DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 xfs_agblock_t agbno, xfs_lookup_t dir),
	TP_ARGS(mp, agno, agbno, dir),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, agbno)
		__field(xfs_lookup_t, dir)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->agbno = agbno;
		__entry->dir = dir;
	),
2905
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x cmp %s(%d)",
2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->agbno,
		  __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
		  __entry->dir)
)

#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
		 xfs_agblock_t agbno, xfs_lookup_t dir), \
	TP_ARGS(mp, agno, agbno, dir))

/* single-rcext tracepoint class */
DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 struct xfs_refcount_irec *irec),
	TP_ARGS(mp, agno, irec),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, startblock)
		__field(xfs_extlen_t, blockcount)
		__field(xfs_nlink_t, refcount)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->startblock = irec->rc_startblock;
		__entry->blockcount = irec->rc_blockcount;
		__entry->refcount = irec->rc_refcount;
	),
2938
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u",
2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->startblock,
		  __entry->blockcount,
		  __entry->refcount)
)

#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
DEFINE_EVENT(xfs_refcount_extent_class, name, \
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
		 struct xfs_refcount_irec *irec), \
	TP_ARGS(mp, agno, irec))

/* single-rcext and an agbno tracepoint class */
DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
	TP_ARGS(mp, agno, irec, agbno),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, startblock)
		__field(xfs_extlen_t, blockcount)
		__field(xfs_nlink_t, refcount)
		__field(xfs_agblock_t, agbno)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->startblock = irec->rc_startblock;
		__entry->blockcount = irec->rc_blockcount;
		__entry->refcount = irec->rc_refcount;
		__entry->agbno = agbno;
	),
2973
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x",
2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->startblock,
		  __entry->blockcount,
		  __entry->refcount,
		  __entry->agbno)
)

#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
		 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
	TP_ARGS(mp, agno, irec, agbno))

/* double-rcext tracepoint class */
DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
	TP_ARGS(mp, agno, i1, i2),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, i1_startblock)
		__field(xfs_extlen_t, i1_blockcount)
		__field(xfs_nlink_t, i1_refcount)
		__field(xfs_agblock_t, i2_startblock)
		__field(xfs_extlen_t, i2_blockcount)
		__field(xfs_nlink_t, i2_refcount)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->i1_startblock = i1->rc_startblock;
		__entry->i1_blockcount = i1->rc_blockcount;
		__entry->i1_refcount = i1->rc_refcount;
		__entry->i2_startblock = i2->rc_startblock;
		__entry->i2_blockcount = i2->rc_blockcount;
		__entry->i2_refcount = i2->rc_refcount;
	),
3013 3014
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u -- "
		  "agbno 0x%x fsbcount 0x%x refcount %u",
3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->i1_startblock,
		  __entry->i1_blockcount,
		  __entry->i1_refcount,
		  __entry->i2_startblock,
		  __entry->i2_blockcount,
		  __entry->i2_refcount)
)

#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
	TP_ARGS(mp, agno, i1, i2))

/* double-rcext and an agbno tracepoint class */
DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
		 xfs_agblock_t agbno),
	TP_ARGS(mp, agno, i1, i2, agbno),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, i1_startblock)
		__field(xfs_extlen_t, i1_blockcount)
		__field(xfs_nlink_t, i1_refcount)
		__field(xfs_agblock_t, i2_startblock)
		__field(xfs_extlen_t, i2_blockcount)
		__field(xfs_nlink_t, i2_refcount)
		__field(xfs_agblock_t, agbno)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->i1_startblock = i1->rc_startblock;
		__entry->i1_blockcount = i1->rc_blockcount;
		__entry->i1_refcount = i1->rc_refcount;
		__entry->i2_startblock = i2->rc_startblock;
		__entry->i2_blockcount = i2->rc_blockcount;
		__entry->i2_refcount = i2->rc_refcount;
		__entry->agbno = agbno;
	),
3059 3060
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u -- "
		  "agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x",
3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->i1_startblock,
		  __entry->i1_blockcount,
		  __entry->i1_refcount,
		  __entry->i2_startblock,
		  __entry->i2_blockcount,
		  __entry->i2_refcount,
		  __entry->agbno)
)

#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
		 xfs_agblock_t agbno), \
	TP_ARGS(mp, agno, i1, i2, agbno))

/* triple-rcext tracepoint class */
DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
		 struct xfs_refcount_irec *i3),
	TP_ARGS(mp, agno, i1, i2, i3),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, i1_startblock)
		__field(xfs_extlen_t, i1_blockcount)
		__field(xfs_nlink_t, i1_refcount)
		__field(xfs_agblock_t, i2_startblock)
		__field(xfs_extlen_t, i2_blockcount)
		__field(xfs_nlink_t, i2_refcount)
		__field(xfs_agblock_t, i3_startblock)
		__field(xfs_extlen_t, i3_blockcount)
		__field(xfs_nlink_t, i3_refcount)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->i1_startblock = i1->rc_startblock;
		__entry->i1_blockcount = i1->rc_blockcount;
		__entry->i1_refcount = i1->rc_refcount;
		__entry->i2_startblock = i2->rc_startblock;
		__entry->i2_blockcount = i2->rc_blockcount;
		__entry->i2_refcount = i2->rc_refcount;
		__entry->i3_startblock = i3->rc_startblock;
		__entry->i3_blockcount = i3->rc_blockcount;
		__entry->i3_refcount = i3->rc_refcount;
	),
3111 3112 3113
	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u -- "
		  "agbno 0x%x fsbcount 0x%x refcount %u -- "
		  "agbno 0x%x fsbcount 0x%x refcount %u",
3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->i1_startblock,
		  __entry->i1_blockcount,
		  __entry->i1_refcount,
		  __entry->i2_startblock,
		  __entry->i2_blockcount,
		  __entry->i2_refcount,
		  __entry->i3_startblock,
		  __entry->i3_blockcount,
		  __entry->i3_refcount)
);

#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
		 struct xfs_refcount_irec *i3), \
	TP_ARGS(mp, agno, i1, i2, i3))

/* refcount btree tracepoints */
DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);

/* refcount adjustment tracepoints */
DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
3149 3150
DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
3151 3152
DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
3153
DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
3154 3155 3156 3157 3158 3159
DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
3160
DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172
DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);

/* reflink helpers */
DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
3173 3174 3175
#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
3176

D
Darrick J. Wong 已提交
3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199
TRACE_EVENT(xfs_refcount_finish_one_leftover,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 int type, xfs_agblock_t agbno, xfs_extlen_t len,
		 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
	TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(int, type)
		__field(xfs_agblock_t, agbno)
		__field(xfs_extlen_t, len)
		__field(xfs_agblock_t, new_agbno)
		__field(xfs_extlen_t, new_len)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->type = type;
		__entry->agbno = agbno;
		__entry->len = len;
		__entry->new_agbno = new_agbno;
		__entry->new_len = new_len;
	),
3200
	TP_printk("dev %d:%d type %d agno 0x%x agbno 0x%x fsbcount 0x%x new_agbno 0x%x new_fsbcount 0x%x",
D
Darrick J. Wong 已提交
3201 3202 3203 3204 3205 3206 3207 3208 3209
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->type,
		  __entry->agno,
		  __entry->agbno,
		  __entry->len,
		  __entry->new_agbno,
		  __entry->new_len)
);

3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225
/* simple inode-based error/%ip tracepoint class */
DECLARE_EVENT_CLASS(xfs_inode_error_class,
	TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
	TP_ARGS(ip, error, caller_ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(int, error)
		__field(unsigned long, caller_ip)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
		__entry->error = error;
		__entry->caller_ip = caller_ip;
	),
3226
	TP_printk("dev %d:%d ino 0x%llx error %d caller %pS",
3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->error,
		  (char *)__entry->caller_ip)
);

#define DEFINE_INODE_ERROR_EVENT(name) \
DEFINE_EVENT(xfs_inode_error_class, name, \
	TP_PROTO(struct xfs_inode *ip, int error, \
		 unsigned long caller_ip), \
	TP_ARGS(ip, error, caller_ip))

3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251
/* reflink tracepoint classes */

/* two-file io tracepoint class */
DECLARE_EVENT_CLASS(xfs_double_io_class,
	TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
		 struct xfs_inode *dest, xfs_off_t doffset),
	TP_ARGS(src, soffset, len, dest, doffset),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, src_ino)
		__field(loff_t, src_isize)
		__field(loff_t, src_disize)
		__field(loff_t, src_offset)
3252
		__field(long long, len)
3253 3254 3255 3256 3257 3258 3259 3260 3261
		__field(xfs_ino_t, dest_ino)
		__field(loff_t, dest_isize)
		__field(loff_t, dest_disize)
		__field(loff_t, dest_offset)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(src)->i_sb->s_dev;
		__entry->src_ino = src->i_ino;
		__entry->src_isize = VFS_I(src)->i_size;
3262
		__entry->src_disize = src->i_disk_size;
3263 3264 3265 3266
		__entry->src_offset = soffset;
		__entry->len = len;
		__entry->dest_ino = dest->i_ino;
		__entry->dest_isize = VFS_I(dest)->i_size;
3267
		__entry->dest_disize = dest->i_disk_size;
3268 3269
		__entry->dest_offset = doffset;
	),
3270
	TP_printk("dev %d:%d bytecount 0x%llx "
3271 3272
		  "ino 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx -> "
		  "ino 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx",
3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->len,
		  __entry->src_ino,
		  __entry->src_isize,
		  __entry->src_disize,
		  __entry->src_offset,
		  __entry->dest_ino,
		  __entry->dest_isize,
		  __entry->dest_disize,
		  __entry->dest_offset)
)

#define DEFINE_DOUBLE_IO_EVENT(name)	\
DEFINE_EVENT(xfs_double_io_class, name,	\
	TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
		 struct xfs_inode *dest, xfs_off_t doffset), \
	TP_ARGS(src, soffset, len, dest, doffset))

/* inode/irec events */
DECLARE_EVENT_CLASS(xfs_inode_irec_class,
	TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
	TP_ARGS(ip, irec),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(xfs_fileoff_t, lblk)
		__field(xfs_extlen_t, len)
		__field(xfs_fsblock_t, pblk)
3301
		__field(int, state)
3302 3303 3304 3305 3306 3307 3308
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->ino = ip->i_ino;
		__entry->lblk = irec->br_startoff;
		__entry->len = irec->br_blockcount;
		__entry->pblk = irec->br_startblock;
3309
		__entry->state = irec->br_state;
3310
	),
3311
	TP_printk("dev %d:%d ino 0x%llx fileoff 0x%llx fsbcount 0x%x startblock 0x%llx st %d",
3312 3313 3314 3315
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino,
		  __entry->lblk,
		  __entry->len,
3316 3317
		  __entry->pblk,
		  __entry->state)
3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329
);
#define DEFINE_INODE_IREC_EVENT(name) \
DEFINE_EVENT(xfs_inode_irec_class, name, \
	TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
	TP_ARGS(ip, irec))

/* refcount/reflink tracepoint definitions */

/* reflink tracepoints */
DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3330
TRACE_EVENT(xfs_reflink_remap_blocks,
3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350
	TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
		 xfs_filblks_t len, struct xfs_inode *dest,
		 xfs_fileoff_t doffset),
	TP_ARGS(src, soffset, len, dest, doffset),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, src_ino)
		__field(xfs_fileoff_t, src_lblk)
		__field(xfs_filblks_t, len)
		__field(xfs_ino_t, dest_ino)
		__field(xfs_fileoff_t, dest_lblk)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(src)->i_sb->s_dev;
		__entry->src_ino = src->i_ino;
		__entry->src_lblk = soffset;
		__entry->len = len;
		__entry->dest_ino = dest->i_ino;
		__entry->dest_lblk = doffset;
	),
3351
	TP_printk("dev %d:%d fsbcount 0x%llx "
3352
		  "ino 0x%llx fileoff 0x%llx -> ino 0x%llx fileoff 0x%llx",
3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->len,
		  __entry->src_ino,
		  __entry->src_lblk,
		  __entry->dest_ino,
		  __entry->dest_lblk)
);
DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3366 3367
DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_src);
DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_dest);
3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390

/* dedupe tracepoints */
DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);

/* ioctl tracepoints */
TRACE_EVENT(xfs_ioctl_clone,
	TP_PROTO(struct inode *src, struct inode *dest),
	TP_ARGS(src, dest),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(unsigned long, src_ino)
		__field(loff_t, src_isize)
		__field(unsigned long, dest_ino)
		__field(loff_t, dest_isize)
	),
	TP_fast_assign(
		__entry->dev = src->i_sb->s_dev;
		__entry->src_ino = src->i_ino;
		__entry->src_isize = i_size_read(src);
		__entry->dest_ino = dest->i_ino;
		__entry->dest_isize = i_size_read(dest);
	),
3391
	TP_printk("dev %d:%d ino 0x%lx isize 0x%llx -> ino 0x%lx isize 0x%llx",
3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->src_ino,
		  __entry->src_isize,
		  __entry->dest_ino,
		  __entry->dest_isize)
);

/* unshare tracepoints */
DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);

/* copy on write */
DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
3405 3406
DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
3407
DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
3408 3409 3410

DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3411 3412
DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_from);
DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_to);
3413 3414 3415 3416 3417 3418 3419

DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);


DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);

3420 3421 3422 3423 3424
/* rmap swapext tracepoints */
DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);

3425 3426 3427
/* fsmap traces */
DECLARE_EVENT_CLASS(xfs_fsmap_class,
	TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3428
		 const struct xfs_rmap_irec *rmap),
3429 3430 3431 3432 3433 3434 3435
	TP_ARGS(mp, keydev, agno, rmap),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(dev_t, keydev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_fsblock_t, bno)
		__field(xfs_filblks_t, len)
3436 3437
		__field(uint64_t, owner)
		__field(uint64_t, offset)
3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449
		__field(unsigned int, flags)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->keydev = new_decode_dev(keydev);
		__entry->agno = agno;
		__entry->bno = rmap->rm_startblock;
		__entry->len = rmap->rm_blockcount;
		__entry->owner = rmap->rm_owner;
		__entry->offset = rmap->rm_offset;
		__entry->flags = rmap->rm_flags;
	),
3450
	TP_printk("dev %d:%d keydev %d:%d agno 0x%x startblock 0x%llx fsbcount 0x%llx owner 0x%llx fileoff 0x%llx flags 0x%x",
3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
		  __entry->agno,
		  __entry->bno,
		  __entry->len,
		  __entry->owner,
		  __entry->offset,
		  __entry->flags)
)
#define DEFINE_FSMAP_EVENT(name) \
DEFINE_EVENT(xfs_fsmap_class, name, \
	TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3463
		 const struct xfs_rmap_irec *rmap), \
3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476
	TP_ARGS(mp, keydev, agno, rmap))
DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);

DECLARE_EVENT_CLASS(xfs_getfsmap_class,
	TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
	TP_ARGS(mp, fsmap),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(dev_t, keydev)
		__field(xfs_daddr_t, block)
		__field(xfs_daddr_t, len)
3477 3478 3479
		__field(uint64_t, owner)
		__field(uint64_t, offset)
		__field(uint64_t, flags)
3480 3481 3482 3483 3484 3485 3486 3487 3488 3489
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->keydev = new_decode_dev(fsmap->fmr_device);
		__entry->block = fsmap->fmr_physical;
		__entry->len = fsmap->fmr_length;
		__entry->owner = fsmap->fmr_owner;
		__entry->offset = fsmap->fmr_offset;
		__entry->flags = fsmap->fmr_flags;
	),
3490
	TP_printk("dev %d:%d keydev %d:%d daddr 0x%llx bbcount 0x%llx owner 0x%llx fileoff_daddr 0x%llx flags 0x%llx",
3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
		  __entry->block,
		  __entry->len,
		  __entry->owner,
		  __entry->offset,
		  __entry->flags)
)
#define DEFINE_GETFSMAP_EVENT(name) \
DEFINE_EVENT(xfs_getfsmap_class, name, \
	TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
	TP_ARGS(mp, fsmap))
DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);

3507
DECLARE_EVENT_CLASS(xfs_trans_resv_class,
3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530
	TP_PROTO(struct xfs_mount *mp, unsigned int type,
		 struct xfs_trans_res *res),
	TP_ARGS(mp, type, res),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(int, type)
		__field(uint, logres)
		__field(int, logcount)
		__field(int, logflags)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->type = type;
		__entry->logres = res->tr_logres;
		__entry->logcount = res->tr_logcount;
		__entry->logflags = res->tr_logflags;
	),
	TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->type,
		  __entry->logres,
		  __entry->logcount,
		  __entry->logflags)
3531 3532 3533 3534 3535 3536 3537 3538 3539
)

#define DEFINE_TRANS_RESV_EVENT(name) \
DEFINE_EVENT(xfs_trans_resv_class, name, \
	TP_PROTO(struct xfs_mount *mp, unsigned int type, \
		 struct xfs_trans_res *res), \
	TP_ARGS(mp, type, res))
DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc);
DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc_minlogsize);
3540

3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557
TRACE_EVENT(xfs_log_get_max_trans_res,
	TP_PROTO(struct xfs_mount *mp, const struct xfs_trans_res *res),
	TP_ARGS(mp, res),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(uint, logres)
		__field(int, logcount)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->logres = res->tr_logres;
		__entry->logcount = res->tr_logcount;
	),
	TP_printk("dev %d:%d logres %u logcount %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->logres,
		  __entry->logcount)
3558 3559
);

3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594
DECLARE_EVENT_CLASS(xfs_trans_class,
	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
	TP_ARGS(tp, caller_ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(uint32_t, tid)
		__field(uint32_t, flags)
		__field(unsigned long, caller_ip)
	),
	TP_fast_assign(
		__entry->dev = tp->t_mountp->m_super->s_dev;
		__entry->tid = 0;
		if (tp->t_ticket)
			__entry->tid = tp->t_ticket->t_tid;
		__entry->flags = tp->t_flags;
		__entry->caller_ip = caller_ip;
	),
	TP_printk("dev %d:%d trans %x flags 0x%x caller %pS",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->tid,
		  __entry->flags,
		  (char *)__entry->caller_ip)
)

#define DEFINE_TRANS_EVENT(name) \
DEFINE_EVENT(xfs_trans_class, name, \
	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
	TP_ARGS(tp, caller_ip))
DEFINE_TRANS_EVENT(xfs_trans_alloc);
DEFINE_TRANS_EVENT(xfs_trans_cancel);
DEFINE_TRANS_EVENT(xfs_trans_commit);
DEFINE_TRANS_EVENT(xfs_trans_dup);
DEFINE_TRANS_EVENT(xfs_trans_free);
DEFINE_TRANS_EVENT(xfs_trans_roll);
DEFINE_TRANS_EVENT(xfs_trans_add_item);
3595
DEFINE_TRANS_EVENT(xfs_trans_commit_items);
3596 3597
DEFINE_TRANS_EVENT(xfs_trans_free_items);

3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615
TRACE_EVENT(xfs_iunlink_update_bucket,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int bucket,
		 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
	TP_ARGS(mp, agno, bucket, old_ptr, new_ptr),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(unsigned int, bucket)
		__field(xfs_agino_t, old_ptr)
		__field(xfs_agino_t, new_ptr)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->bucket = bucket;
		__entry->old_ptr = old_ptr;
		__entry->new_ptr = new_ptr;
	),
3616
	TP_printk("dev %d:%d agno 0x%x bucket %u old 0x%x new 0x%x",
3617 3618 3619 3620 3621 3622 3623
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->bucket,
		  __entry->old_ptr,
		  __entry->new_ptr)
);

3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641
TRACE_EVENT(xfs_iunlink_update_dinode,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
		 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
	TP_ARGS(mp, agno, agino, old_ptr, new_ptr),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agino_t, agino)
		__field(xfs_agino_t, old_ptr)
		__field(xfs_agino_t, new_ptr)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->agino = agino;
		__entry->old_ptr = old_ptr;
		__entry->new_ptr = new_ptr;
	),
3642
	TP_printk("dev %d:%d agno 0x%x agino 0x%x old 0x%x new 0x%x",
3643 3644 3645 3646 3647 3648 3649
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno,
		  __entry->agino,
		  __entry->old_ptr,
		  __entry->new_ptr)
);

3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662
DECLARE_EVENT_CLASS(xfs_ag_inode_class,
	TP_PROTO(struct xfs_inode *ip),
	TP_ARGS(ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agino_t, agino)
	),
	TP_fast_assign(
		__entry->dev = VFS_I(ip)->i_sb->s_dev;
		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
	),
3663
	TP_printk("dev %d:%d agno 0x%x agino 0x%x",
3664 3665 3666 3667 3668 3669 3670 3671 3672 3673
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno, __entry->agino)
)

#define DEFINE_AGINODE_EVENT(name) \
DEFINE_EVENT(xfs_ag_inode_class, name, \
	TP_PROTO(struct xfs_inode *ip), \
	TP_ARGS(ip))
DEFINE_AGINODE_EVENT(xfs_iunlink);
DEFINE_AGINODE_EVENT(xfs_iunlink_remove);
3674
DEFINE_AG_EVENT(xfs_iunlink_map_prev_fallback);
3675

3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696
DECLARE_EVENT_CLASS(xfs_fs_corrupt_class,
	TP_PROTO(struct xfs_mount *mp, unsigned int flags),
	TP_ARGS(mp, flags),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(unsigned int, flags)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->flags = flags;
	),
	TP_printk("dev %d:%d flags 0x%x",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->flags)
);
#define DEFINE_FS_CORRUPT_EVENT(name)	\
DEFINE_EVENT(xfs_fs_corrupt_class, name,	\
	TP_PROTO(struct xfs_mount *mp, unsigned int flags), \
	TP_ARGS(mp, flags))
DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_sick);
DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_healthy);
3697
DEFINE_FS_CORRUPT_EVENT(xfs_fs_unfixed_corruption);
3698 3699
DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_sick);
DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_healthy);
3700
DEFINE_FS_CORRUPT_EVENT(xfs_rt_unfixed_corruption);
3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714

DECLARE_EVENT_CLASS(xfs_ag_corrupt_class,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int flags),
	TP_ARGS(mp, agno, flags),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(unsigned int, flags)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->flags = flags;
	),
3715
	TP_printk("dev %d:%d agno 0x%x flags 0x%x",
3716 3717 3718 3719 3720 3721 3722 3723 3724 3725
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->agno, __entry->flags)
);
#define DEFINE_AG_CORRUPT_EVENT(name)	\
DEFINE_EVENT(xfs_ag_corrupt_class, name,	\
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
		 unsigned int flags), \
	TP_ARGS(mp, agno, flags))
DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_sick);
DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_healthy);
3726
DEFINE_AG_CORRUPT_EVENT(xfs_ag_unfixed_corruption);
3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751

DECLARE_EVENT_CLASS(xfs_inode_corrupt_class,
	TP_PROTO(struct xfs_inode *ip, unsigned int flags),
	TP_ARGS(ip, flags),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_ino_t, ino)
		__field(unsigned int, flags)
	),
	TP_fast_assign(
		__entry->dev = ip->i_mount->m_super->s_dev;
		__entry->ino = ip->i_ino;
		__entry->flags = flags;
	),
	TP_printk("dev %d:%d ino 0x%llx flags 0x%x",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->ino, __entry->flags)
);
#define DEFINE_INODE_CORRUPT_EVENT(name)	\
DEFINE_EVENT(xfs_inode_corrupt_class, name,	\
	TP_PROTO(struct xfs_inode *ip, unsigned int flags), \
	TP_ARGS(ip, flags))
DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_sick);
DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_healthy);

3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765
TRACE_EVENT(xfs_iwalk_ag,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 xfs_agino_t startino),
	TP_ARGS(mp, agno, startino),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agino_t, startino)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->startino = startino;
	),
3766
	TP_printk("dev %d:%d agno 0x%x startino 0x%x",
3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786
		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
		  __entry->startino)
)

TRACE_EVENT(xfs_iwalk_ag_rec,
	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
		 struct xfs_inobt_rec_incore *irec),
	TP_ARGS(mp, agno, irec),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agino_t, startino)
		__field(uint64_t, freemask)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->agno = agno;
		__entry->startino = irec->ir_startino;
		__entry->freemask = irec->ir_free;
	),
3787
	TP_printk("dev %d:%d agno 0x%x startino 0x%x freemask 0x%llx",
3788 3789 3790 3791
		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
		  __entry->startino, __entry->freemask)
)

3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809
TRACE_EVENT(xfs_pwork_init,
	TP_PROTO(struct xfs_mount *mp, unsigned int nr_threads, pid_t pid),
	TP_ARGS(mp, nr_threads, pid),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(unsigned int, nr_threads)
		__field(pid_t, pid)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->nr_threads = nr_threads;
		__entry->pid = pid;
	),
	TP_printk("dev %d:%d nr_threads %u pid %u",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->nr_threads, __entry->pid)
)

3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834
DECLARE_EVENT_CLASS(xfs_kmem_class,
	TP_PROTO(ssize_t size, int flags, unsigned long caller_ip),
	TP_ARGS(size, flags, caller_ip),
	TP_STRUCT__entry(
		__field(ssize_t, size)
		__field(int, flags)
		__field(unsigned long, caller_ip)
	),
	TP_fast_assign(
		__entry->size = size;
		__entry->flags = flags;
		__entry->caller_ip = caller_ip;
	),
	TP_printk("size %zd flags 0x%x caller %pS",
		  __entry->size,
		  __entry->flags,
		  (char *)__entry->caller_ip)
)

#define DEFINE_KMEM_EVENT(name) \
DEFINE_EVENT(xfs_kmem_class, name, \
	TP_PROTO(ssize_t size, int flags, unsigned long caller_ip), \
	TP_ARGS(size, flags, caller_ip))
DEFINE_KMEM_EVENT(kmem_alloc);

3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849
TRACE_EVENT(xfs_check_new_dalign,
	TP_PROTO(struct xfs_mount *mp, int new_dalign, xfs_ino_t calc_rootino),
	TP_ARGS(mp, new_dalign, calc_rootino),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(int, new_dalign)
		__field(xfs_ino_t, sb_rootino)
		__field(xfs_ino_t, calc_rootino)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->new_dalign = new_dalign;
		__entry->sb_rootino = mp->m_sb.sb_rootino;
		__entry->calc_rootino = calc_rootino;
	),
3850
	TP_printk("dev %d:%d new_dalign %d sb_rootino 0x%llx calc_rootino 0x%llx",
3851 3852 3853 3854 3855
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->new_dalign, __entry->sb_rootino,
		  __entry->calc_rootino)
)

3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869
TRACE_EVENT(xfs_btree_commit_afakeroot,
	TP_PROTO(struct xfs_btree_cur *cur),
	TP_ARGS(cur),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_btnum_t, btnum)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, agbno)
		__field(unsigned int, levels)
		__field(unsigned int, blocks)
	),
	TP_fast_assign(
		__entry->dev = cur->bc_mp->m_super->s_dev;
		__entry->btnum = cur->bc_btnum;
3870
		__entry->agno = cur->bc_ag.pag->pag_agno;
3871 3872 3873 3874
		__entry->agbno = cur->bc_ag.afake->af_root;
		__entry->levels = cur->bc_ag.afake->af_levels;
		__entry->blocks = cur->bc_ag.afake->af_blocks;
	),
3875
	TP_printk("dev %d:%d btree %s agno 0x%x levels %u blocks %u root %u",
3876 3877 3878 3879 3880 3881 3882 3883
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
		  __entry->agno,
		  __entry->levels,
		  __entry->blocks,
		  __entry->agbno)
)

3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906
TRACE_EVENT(xfs_btree_commit_ifakeroot,
	TP_PROTO(struct xfs_btree_cur *cur),
	TP_ARGS(cur),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_btnum_t, btnum)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agino_t, agino)
		__field(unsigned int, levels)
		__field(unsigned int, blocks)
		__field(int, whichfork)
	),
	TP_fast_assign(
		__entry->dev = cur->bc_mp->m_super->s_dev;
		__entry->btnum = cur->bc_btnum;
		__entry->agno = XFS_INO_TO_AGNO(cur->bc_mp,
					cur->bc_ino.ip->i_ino);
		__entry->agino = XFS_INO_TO_AGINO(cur->bc_mp,
					cur->bc_ino.ip->i_ino);
		__entry->levels = cur->bc_ino.ifake->if_levels;
		__entry->blocks = cur->bc_ino.ifake->if_blocks;
		__entry->whichfork = cur->bc_ino.whichfork;
	),
3907
	TP_printk("dev %d:%d btree %s agno 0x%x agino 0x%x whichfork %s levels %u blocks %u",
3908 3909 3910 3911
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
		  __entry->agno,
		  __entry->agino,
3912
		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
3913 3914 3915 3916
		  __entry->levels,
		  __entry->blocks)
)

3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984
TRACE_EVENT(xfs_btree_bload_level_geometry,
	TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
		 uint64_t nr_this_level, unsigned int nr_per_block,
		 unsigned int desired_npb, uint64_t blocks,
		 uint64_t blocks_with_extra),
	TP_ARGS(cur, level, nr_this_level, nr_per_block, desired_npb, blocks,
		blocks_with_extra),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_btnum_t, btnum)
		__field(unsigned int, level)
		__field(unsigned int, nlevels)
		__field(uint64_t, nr_this_level)
		__field(unsigned int, nr_per_block)
		__field(unsigned int, desired_npb)
		__field(unsigned long long, blocks)
		__field(unsigned long long, blocks_with_extra)
	),
	TP_fast_assign(
		__entry->dev = cur->bc_mp->m_super->s_dev;
		__entry->btnum = cur->bc_btnum;
		__entry->level = level;
		__entry->nlevels = cur->bc_nlevels;
		__entry->nr_this_level = nr_this_level;
		__entry->nr_per_block = nr_per_block;
		__entry->desired_npb = desired_npb;
		__entry->blocks = blocks;
		__entry->blocks_with_extra = blocks_with_extra;
	),
	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",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
		  __entry->level,
		  __entry->nlevels,
		  __entry->nr_this_level,
		  __entry->nr_per_block,
		  __entry->desired_npb,
		  __entry->blocks,
		  __entry->blocks_with_extra)
)

TRACE_EVENT(xfs_btree_bload_block,
	TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
		 uint64_t block_idx, uint64_t nr_blocks,
		 union xfs_btree_ptr *ptr, unsigned int nr_records),
	TP_ARGS(cur, level, block_idx, nr_blocks, ptr, nr_records),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(xfs_btnum_t, btnum)
		__field(unsigned int, level)
		__field(unsigned long long, block_idx)
		__field(unsigned long long, nr_blocks)
		__field(xfs_agnumber_t, agno)
		__field(xfs_agblock_t, agbno)
		__field(unsigned int, nr_records)
	),
	TP_fast_assign(
		__entry->dev = cur->bc_mp->m_super->s_dev;
		__entry->btnum = cur->bc_btnum;
		__entry->level = level;
		__entry->block_idx = block_idx;
		__entry->nr_blocks = nr_blocks;
		if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
			xfs_fsblock_t	fsb = be64_to_cpu(ptr->l);

			__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsb);
			__entry->agbno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsb);
		} else {
3985
			__entry->agno = cur->bc_ag.pag->pag_agno;
3986 3987 3988 3989
			__entry->agbno = be32_to_cpu(ptr->s);
		}
		__entry->nr_records = nr_records;
	),
3990
	TP_printk("dev %d:%d btree %s level %u block %llu/%llu agno 0x%x agbno 0x%x recs %u",
3991 3992 3993 3994 3995 3996 3997 3998 3999 4000
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
		  __entry->level,
		  __entry->block_idx,
		  __entry->nr_blocks,
		  __entry->agno,
		  __entry->agbno,
		  __entry->nr_records)
)

D
Darrick J. Wong 已提交
4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026
DECLARE_EVENT_CLASS(xfs_timestamp_range_class,
	TP_PROTO(struct xfs_mount *mp, time64_t min, time64_t max),
	TP_ARGS(mp, min, max),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(long long, min)
		__field(long long, max)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->min = min;
		__entry->max = max;
	),
	TP_printk("dev %d:%d min %lld max %lld",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->min,
		  __entry->max)
)

#define DEFINE_TIMESTAMP_RANGE_EVENT(name) \
DEFINE_EVENT(xfs_timestamp_range_class, name, \
	TP_PROTO(struct xfs_mount *mp, long long min, long long max), \
	TP_ARGS(mp, min, max))
DEFINE_TIMESTAMP_RANGE_EVENT(xfs_inode_timestamp_range);
DEFINE_TIMESTAMP_RANGE_EVENT(xfs_quota_expiry_range);

4027 4028
DECLARE_EVENT_CLASS(xfs_icwalk_class,
	TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw,
4029
		 unsigned long caller_ip),
4030
	TP_ARGS(mp, icw, caller_ip),
4031 4032 4033 4034 4035 4036 4037
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(__u32, flags)
		__field(uint32_t, uid)
		__field(uint32_t, gid)
		__field(prid_t, prid)
		__field(__u64, min_file_size)
4038
		__field(long, scan_limit)
4039 4040 4041 4042
		__field(unsigned long, caller_ip)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
4043 4044 4045 4046 4047 4048 4049 4050
		__entry->flags = icw ? icw->icw_flags : 0;
		__entry->uid = icw ? from_kuid(mp->m_super->s_user_ns,
						icw->icw_uid) : 0;
		__entry->gid = icw ? from_kgid(mp->m_super->s_user_ns,
						icw->icw_gid) : 0;
		__entry->prid = icw ? icw->icw_prid : 0;
		__entry->min_file_size = icw ? icw->icw_min_file_size : 0;
		__entry->scan_limit = icw ? icw->icw_scan_limit : 0;
4051 4052
		__entry->caller_ip = caller_ip;
	),
4053
	TP_printk("dev %d:%d flags 0x%x uid %u gid %u prid %u minsize %llu scan_limit %ld caller %pS",
4054 4055 4056 4057 4058 4059
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->flags,
		  __entry->uid,
		  __entry->gid,
		  __entry->prid,
		  __entry->min_file_size,
4060
		  __entry->scan_limit,
4061 4062
		  (char *)__entry->caller_ip)
);
4063 4064 4065
#define DEFINE_ICWALK_EVENT(name)	\
DEFINE_EVENT(xfs_icwalk_class, name,	\
	TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw, \
4066
		 unsigned long caller_ip), \
4067 4068 4069
	TP_ARGS(mp, icw, caller_ip))
DEFINE_ICWALK_EVENT(xfs_ioc_free_eofblocks);
DEFINE_ICWALK_EVENT(xfs_blockgc_free_space);
4070

D
Dave Chinner 已提交
4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085
TRACE_DEFINE_ENUM(XLOG_STATE_ACTIVE);
TRACE_DEFINE_ENUM(XLOG_STATE_WANT_SYNC);
TRACE_DEFINE_ENUM(XLOG_STATE_SYNCING);
TRACE_DEFINE_ENUM(XLOG_STATE_DONE_SYNC);
TRACE_DEFINE_ENUM(XLOG_STATE_CALLBACK);
TRACE_DEFINE_ENUM(XLOG_STATE_DIRTY);

DECLARE_EVENT_CLASS(xlog_iclog_class,
	TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip),
	TP_ARGS(iclog, caller_ip),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(uint32_t, state)
		__field(int32_t, refcount)
		__field(uint32_t, offset)
4086
		__field(uint32_t, flags)
D
Dave Chinner 已提交
4087 4088 4089 4090 4091 4092 4093 4094
		__field(unsigned long long, lsn)
		__field(unsigned long, caller_ip)
	),
	TP_fast_assign(
		__entry->dev = iclog->ic_log->l_mp->m_super->s_dev;
		__entry->state = iclog->ic_state;
		__entry->refcount = atomic_read(&iclog->ic_refcnt);
		__entry->offset = iclog->ic_offset;
4095
		__entry->flags = iclog->ic_flags;
D
Dave Chinner 已提交
4096 4097 4098
		__entry->lsn = be64_to_cpu(iclog->ic_header.h_lsn);
		__entry->caller_ip = caller_ip;
	),
4099
	TP_printk("dev %d:%d state %s refcnt %d offset %u lsn 0x%llx flags %s caller %pS",
D
Dave Chinner 已提交
4100 4101 4102 4103 4104
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __print_symbolic(__entry->state, XLOG_STATE_STRINGS),
		  __entry->refcount,
		  __entry->offset,
		  __entry->lsn,
4105
		  __print_flags(__entry->flags, "|", XLOG_ICL_STRINGS),
D
Dave Chinner 已提交
4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131
		  (char *)__entry->caller_ip)

);

#define DEFINE_ICLOG_EVENT(name)	\
DEFINE_EVENT(xlog_iclog_class, name,	\
	TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip), \
	TP_ARGS(iclog, caller_ip))

DEFINE_ICLOG_EVENT(xlog_iclog_activate);
DEFINE_ICLOG_EVENT(xlog_iclog_clean);
DEFINE_ICLOG_EVENT(xlog_iclog_callback);
DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_start);
DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_done);
DEFINE_ICLOG_EVENT(xlog_iclog_force);
DEFINE_ICLOG_EVENT(xlog_iclog_force_lsn);
DEFINE_ICLOG_EVENT(xlog_iclog_get_space);
DEFINE_ICLOG_EVENT(xlog_iclog_release);
DEFINE_ICLOG_EVENT(xlog_iclog_switch);
DEFINE_ICLOG_EVENT(xlog_iclog_sync);
DEFINE_ICLOG_EVENT(xlog_iclog_syncing);
DEFINE_ICLOG_EVENT(xlog_iclog_sync_done);
DEFINE_ICLOG_EVENT(xlog_iclog_want_sync);
DEFINE_ICLOG_EVENT(xlog_iclog_wait_on);
DEFINE_ICLOG_EVENT(xlog_iclog_write);

4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152
DECLARE_EVENT_CLASS(xfs_das_state_class,
	TP_PROTO(int das, struct xfs_inode *ip),
	TP_ARGS(das, ip),
	TP_STRUCT__entry(
		__field(int, das)
		__field(xfs_ino_t, ino)
	),
	TP_fast_assign(
		__entry->das = das;
		__entry->ino = ip->i_ino;
	),
	TP_printk("state change %d ino 0x%llx",
		  __entry->das, __entry->ino)
)

#define DEFINE_DAS_STATE_EVENT(name) \
DEFINE_EVENT(xfs_das_state_class, name, \
	TP_PROTO(int das, struct xfs_inode *ip), \
	TP_ARGS(das, ip))
DEFINE_DAS_STATE_EVENT(xfs_attr_sf_addname_return);
DEFINE_DAS_STATE_EVENT(xfs_attr_set_iter_return);
4153
DEFINE_DAS_STATE_EVENT(xfs_attr_leaf_addname_return);
4154 4155 4156
DEFINE_DAS_STATE_EVENT(xfs_attr_node_addname_return);
DEFINE_DAS_STATE_EVENT(xfs_attr_remove_iter_return);
DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_remove_return);
4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183

TRACE_EVENT(xfs_force_shutdown,
	TP_PROTO(struct xfs_mount *mp, int ptag, int flags, const char *fname,
		 int line_num),
	TP_ARGS(mp, ptag, flags, fname, line_num),
	TP_STRUCT__entry(
		__field(dev_t, dev)
		__field(int, ptag)
		__field(int, flags)
		__string(fname, fname)
		__field(int, line_num)
	),
	TP_fast_assign(
		__entry->dev = mp->m_super->s_dev;
		__entry->ptag = ptag;
		__entry->flags = flags;
		__assign_str(fname, fname);
		__entry->line_num = line_num;
	),
	TP_printk("dev %d:%d tag %s flags %s file %s line_num %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		__print_flags(__entry->ptag, "|", XFS_PTAG_STRINGS),
		__print_flags(__entry->flags, "|", XFS_SHUTDOWN_STRINGS),
		__get_str(fname),
		__entry->line_num)
);

C
Christoph Hellwig 已提交
4184 4185 4186 4187 4188 4189
#endif /* _TRACE_XFS_H */

#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#define TRACE_INCLUDE_FILE xfs_trace
#include <trace/define_trace.h>