Linux Audio

Check our new training course

Loading...
v5.4
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/*
   3 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
   4 */
   5#undef TRACE_SYSTEM
   6#define TRACE_SYSTEM nfs
   7
   8#if !defined(_TRACE_NFS_H) || defined(TRACE_HEADER_MULTI_READ)
   9#define _TRACE_NFS_H
  10
  11#include <linux/tracepoint.h>
  12#include <linux/iversion.h>
  13
  14TRACE_DEFINE_ENUM(DT_UNKNOWN);
  15TRACE_DEFINE_ENUM(DT_FIFO);
  16TRACE_DEFINE_ENUM(DT_CHR);
  17TRACE_DEFINE_ENUM(DT_DIR);
  18TRACE_DEFINE_ENUM(DT_BLK);
  19TRACE_DEFINE_ENUM(DT_REG);
  20TRACE_DEFINE_ENUM(DT_LNK);
  21TRACE_DEFINE_ENUM(DT_SOCK);
  22TRACE_DEFINE_ENUM(DT_WHT);
  23
  24#define nfs_show_file_type(ftype) \
  25	__print_symbolic(ftype, \
  26			{ DT_UNKNOWN, "UNKNOWN" }, \
  27			{ DT_FIFO, "FIFO" }, \
  28			{ DT_CHR, "CHR" }, \
  29			{ DT_DIR, "DIR" }, \
  30			{ DT_BLK, "BLK" }, \
  31			{ DT_REG, "REG" }, \
  32			{ DT_LNK, "LNK" }, \
  33			{ DT_SOCK, "SOCK" }, \
  34			{ DT_WHT, "WHT" })
  35
  36TRACE_DEFINE_ENUM(NFS_INO_INVALID_DATA);
  37TRACE_DEFINE_ENUM(NFS_INO_INVALID_ATIME);
  38TRACE_DEFINE_ENUM(NFS_INO_INVALID_ACCESS);
  39TRACE_DEFINE_ENUM(NFS_INO_INVALID_ACL);
  40TRACE_DEFINE_ENUM(NFS_INO_REVAL_PAGECACHE);
  41TRACE_DEFINE_ENUM(NFS_INO_REVAL_FORCED);
  42TRACE_DEFINE_ENUM(NFS_INO_INVALID_LABEL);
  43TRACE_DEFINE_ENUM(NFS_INO_INVALID_CHANGE);
  44TRACE_DEFINE_ENUM(NFS_INO_INVALID_CTIME);
  45TRACE_DEFINE_ENUM(NFS_INO_INVALID_MTIME);
  46TRACE_DEFINE_ENUM(NFS_INO_INVALID_SIZE);
  47TRACE_DEFINE_ENUM(NFS_INO_INVALID_OTHER);
  48
  49#define nfs_show_cache_validity(v) \
  50	__print_flags(v, "|", \
  51			{ NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
  52			{ NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
  53			{ NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
  54			{ NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
  55			{ NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \
  56			{ NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
  57			{ NFS_INO_INVALID_LABEL, "INVALID_LABEL" }, \
  58			{ NFS_INO_INVALID_CHANGE, "INVALID_CHANGE" }, \
  59			{ NFS_INO_INVALID_CTIME, "INVALID_CTIME" }, \
  60			{ NFS_INO_INVALID_MTIME, "INVALID_MTIME" }, \
  61			{ NFS_INO_INVALID_SIZE, "INVALID_SIZE" }, \
  62			{ NFS_INO_INVALID_OTHER, "INVALID_OTHER" })
  63
  64TRACE_DEFINE_ENUM(NFS_INO_ADVISE_RDPLUS);
  65TRACE_DEFINE_ENUM(NFS_INO_STALE);
  66TRACE_DEFINE_ENUM(NFS_INO_ACL_LRU_SET);
  67TRACE_DEFINE_ENUM(NFS_INO_INVALIDATING);
  68TRACE_DEFINE_ENUM(NFS_INO_FSCACHE);
  69TRACE_DEFINE_ENUM(NFS_INO_FSCACHE_LOCK);
  70TRACE_DEFINE_ENUM(NFS_INO_LAYOUTCOMMIT);
  71TRACE_DEFINE_ENUM(NFS_INO_LAYOUTCOMMITTING);
  72TRACE_DEFINE_ENUM(NFS_INO_LAYOUTSTATS);
  73TRACE_DEFINE_ENUM(NFS_INO_ODIRECT);
  74
  75#define nfs_show_nfsi_flags(v) \
  76	__print_flags(v, "|", \
  77			{ BIT(NFS_INO_ADVISE_RDPLUS), "ADVISE_RDPLUS" }, \
  78			{ BIT(NFS_INO_STALE), "STALE" }, \
  79			{ BIT(NFS_INO_ACL_LRU_SET), "ACL_LRU_SET" }, \
  80			{ BIT(NFS_INO_INVALIDATING), "INVALIDATING" }, \
  81			{ BIT(NFS_INO_FSCACHE), "FSCACHE" }, \
  82			{ BIT(NFS_INO_FSCACHE_LOCK), "FSCACHE_LOCK" }, \
  83			{ BIT(NFS_INO_LAYOUTCOMMIT), "NEED_LAYOUTCOMMIT" }, \
  84			{ BIT(NFS_INO_LAYOUTCOMMITTING), "LAYOUTCOMMIT" }, \
  85			{ BIT(NFS_INO_LAYOUTSTATS), "LAYOUTSTATS" }, \
  86			{ BIT(NFS_INO_ODIRECT), "ODIRECT" })
  87
  88DECLARE_EVENT_CLASS(nfs_inode_event,
  89		TP_PROTO(
  90			const struct inode *inode
  91		),
  92
  93		TP_ARGS(inode),
  94
  95		TP_STRUCT__entry(
  96			__field(dev_t, dev)
  97			__field(u32, fhandle)
  98			__field(u64, fileid)
  99			__field(u64, version)
 100		),
 101
 102		TP_fast_assign(
 103			const struct nfs_inode *nfsi = NFS_I(inode);
 104			__entry->dev = inode->i_sb->s_dev;
 105			__entry->fileid = nfsi->fileid;
 106			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 107			__entry->version = inode_peek_iversion_raw(inode);
 108		),
 109
 110		TP_printk(
 111			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
 112			MAJOR(__entry->dev), MINOR(__entry->dev),
 113			(unsigned long long)__entry->fileid,
 114			__entry->fhandle,
 115			(unsigned long long)__entry->version
 116		)
 117);
 118
 119DECLARE_EVENT_CLASS(nfs_inode_event_done,
 120		TP_PROTO(
 121			const struct inode *inode,
 122			int error
 123		),
 124
 125		TP_ARGS(inode, error),
 126
 127		TP_STRUCT__entry(
 128			__field(unsigned long, error)
 129			__field(dev_t, dev)
 130			__field(u32, fhandle)
 131			__field(unsigned char, type)
 132			__field(u64, fileid)
 133			__field(u64, version)
 134			__field(loff_t, size)
 135			__field(unsigned long, nfsi_flags)
 136			__field(unsigned long, cache_validity)
 137		),
 138
 139		TP_fast_assign(
 140			const struct nfs_inode *nfsi = NFS_I(inode);
 141			__entry->error = error < 0 ? -error : 0;
 142			__entry->dev = inode->i_sb->s_dev;
 143			__entry->fileid = nfsi->fileid;
 144			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 145			__entry->type = nfs_umode_to_dtype(inode->i_mode);
 146			__entry->version = inode_peek_iversion_raw(inode);
 147			__entry->size = i_size_read(inode);
 148			__entry->nfsi_flags = nfsi->flags;
 149			__entry->cache_validity = nfsi->cache_validity;
 150		),
 151
 152		TP_printk(
 153			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
 154			"type=%u (%s) version=%llu size=%lld "
 155			"cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s)",
 156			-__entry->error, nfs_show_status(__entry->error),
 157			MAJOR(__entry->dev), MINOR(__entry->dev),
 158			(unsigned long long)__entry->fileid,
 159			__entry->fhandle,
 160			__entry->type,
 161			nfs_show_file_type(__entry->type),
 162			(unsigned long long)__entry->version,
 163			(long long)__entry->size,
 164			__entry->cache_validity,
 165			nfs_show_cache_validity(__entry->cache_validity),
 166			__entry->nfsi_flags,
 167			nfs_show_nfsi_flags(__entry->nfsi_flags)
 168		)
 169);
 170
 171#define DEFINE_NFS_INODE_EVENT(name) \
 172	DEFINE_EVENT(nfs_inode_event, name, \
 173			TP_PROTO( \
 174				const struct inode *inode \
 175			), \
 176			TP_ARGS(inode))
 177#define DEFINE_NFS_INODE_EVENT_DONE(name) \
 178	DEFINE_EVENT(nfs_inode_event_done, name, \
 179			TP_PROTO( \
 180				const struct inode *inode, \
 181				int error \
 182			), \
 183			TP_ARGS(inode, error))
 
 184DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter);
 185DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit);
 186DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter);
 187DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit);
 188DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter);
 189DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit);
 190DEFINE_NFS_INODE_EVENT(nfs_getattr_enter);
 191DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit);
 192DEFINE_NFS_INODE_EVENT(nfs_setattr_enter);
 193DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit);
 194DEFINE_NFS_INODE_EVENT(nfs_writeback_page_enter);
 195DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_page_exit);
 196DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter);
 197DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit);
 198DEFINE_NFS_INODE_EVENT(nfs_fsync_enter);
 199DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
 200DEFINE_NFS_INODE_EVENT(nfs_access_enter);
 201DEFINE_NFS_INODE_EVENT_DONE(nfs_access_exit);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 202
 203TRACE_DEFINE_ENUM(LOOKUP_FOLLOW);
 204TRACE_DEFINE_ENUM(LOOKUP_DIRECTORY);
 205TRACE_DEFINE_ENUM(LOOKUP_AUTOMOUNT);
 206TRACE_DEFINE_ENUM(LOOKUP_PARENT);
 207TRACE_DEFINE_ENUM(LOOKUP_REVAL);
 208TRACE_DEFINE_ENUM(LOOKUP_RCU);
 209TRACE_DEFINE_ENUM(LOOKUP_NO_REVAL);
 210TRACE_DEFINE_ENUM(LOOKUP_OPEN);
 211TRACE_DEFINE_ENUM(LOOKUP_CREATE);
 212TRACE_DEFINE_ENUM(LOOKUP_EXCL);
 213TRACE_DEFINE_ENUM(LOOKUP_RENAME_TARGET);
 214TRACE_DEFINE_ENUM(LOOKUP_JUMPED);
 215TRACE_DEFINE_ENUM(LOOKUP_ROOT);
 216TRACE_DEFINE_ENUM(LOOKUP_EMPTY);
 217TRACE_DEFINE_ENUM(LOOKUP_DOWN);
 218
 219#define show_lookup_flags(flags) \
 220	__print_flags(flags, "|", \
 221			{ LOOKUP_FOLLOW, "FOLLOW" }, \
 222			{ LOOKUP_DIRECTORY, "DIRECTORY" }, \
 223			{ LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \
 224			{ LOOKUP_PARENT, "PARENT" }, \
 225			{ LOOKUP_REVAL, "REVAL" }, \
 226			{ LOOKUP_RCU, "RCU" }, \
 227			{ LOOKUP_NO_REVAL, "NO_REVAL" }, \
 228			{ LOOKUP_OPEN, "OPEN" }, \
 229			{ LOOKUP_CREATE, "CREATE" }, \
 230			{ LOOKUP_EXCL, "EXCL" }, \
 231			{ LOOKUP_RENAME_TARGET, "RENAME_TARGET" }, \
 232			{ LOOKUP_JUMPED, "JUMPED" }, \
 233			{ LOOKUP_ROOT, "ROOT" }, \
 234			{ LOOKUP_EMPTY, "EMPTY" }, \
 235			{ LOOKUP_DOWN, "DOWN" })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 236
 237DECLARE_EVENT_CLASS(nfs_lookup_event,
 238		TP_PROTO(
 239			const struct inode *dir,
 240			const struct dentry *dentry,
 241			unsigned int flags
 242		),
 243
 244		TP_ARGS(dir, dentry, flags),
 245
 246		TP_STRUCT__entry(
 247			__field(unsigned long, flags)
 248			__field(dev_t, dev)
 249			__field(u64, dir)
 
 250			__string(name, dentry->d_name.name)
 251		),
 252
 253		TP_fast_assign(
 254			__entry->dev = dir->i_sb->s_dev;
 255			__entry->dir = NFS_FILEID(dir);
 256			__entry->flags = flags;
 257			__assign_str(name, dentry->d_name.name);
 
 258		),
 259
 260		TP_printk(
 261			"flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
 262			__entry->flags,
 263			show_lookup_flags(__entry->flags),
 264			MAJOR(__entry->dev), MINOR(__entry->dev),
 265			(unsigned long long)__entry->dir,
 266			__get_str(name)
 
 267		)
 268);
 269
 270#define DEFINE_NFS_LOOKUP_EVENT(name) \
 271	DEFINE_EVENT(nfs_lookup_event, name, \
 272			TP_PROTO( \
 273				const struct inode *dir, \
 274				const struct dentry *dentry, \
 275				unsigned int flags \
 276			), \
 277			TP_ARGS(dir, dentry, flags))
 278
 279DECLARE_EVENT_CLASS(nfs_lookup_event_done,
 280		TP_PROTO(
 281			const struct inode *dir,
 282			const struct dentry *dentry,
 283			unsigned int flags,
 284			int error
 285		),
 286
 287		TP_ARGS(dir, dentry, flags, error),
 288
 289		TP_STRUCT__entry(
 290			__field(unsigned long, error)
 291			__field(unsigned long, flags)
 292			__field(dev_t, dev)
 293			__field(u64, dir)
 
 294			__string(name, dentry->d_name.name)
 295		),
 296
 297		TP_fast_assign(
 298			__entry->dev = dir->i_sb->s_dev;
 299			__entry->dir = NFS_FILEID(dir);
 300			__entry->error = error < 0 ? -error : 0;
 301			__entry->flags = flags;
 302			__assign_str(name, dentry->d_name.name);
 
 303		),
 304
 305		TP_printk(
 306			"error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
 307			-__entry->error, nfs_show_status(__entry->error),
 308			__entry->flags,
 309			show_lookup_flags(__entry->flags),
 310			MAJOR(__entry->dev), MINOR(__entry->dev),
 311			(unsigned long long)__entry->dir,
 312			__get_str(name)
 
 313		)
 314);
 315
 316#define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \
 317	DEFINE_EVENT(nfs_lookup_event_done, name, \
 318			TP_PROTO( \
 319				const struct inode *dir, \
 320				const struct dentry *dentry, \
 321				unsigned int flags, \
 322				int error \
 323			), \
 324			TP_ARGS(dir, dentry, flags, error))
 325
 326DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter);
 327DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
 328DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
 329DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
 330
 331TRACE_DEFINE_ENUM(O_WRONLY);
 332TRACE_DEFINE_ENUM(O_RDWR);
 333TRACE_DEFINE_ENUM(O_CREAT);
 334TRACE_DEFINE_ENUM(O_EXCL);
 335TRACE_DEFINE_ENUM(O_NOCTTY);
 336TRACE_DEFINE_ENUM(O_TRUNC);
 337TRACE_DEFINE_ENUM(O_APPEND);
 338TRACE_DEFINE_ENUM(O_NONBLOCK);
 339TRACE_DEFINE_ENUM(O_DSYNC);
 340TRACE_DEFINE_ENUM(O_DIRECT);
 341TRACE_DEFINE_ENUM(O_LARGEFILE);
 342TRACE_DEFINE_ENUM(O_DIRECTORY);
 343TRACE_DEFINE_ENUM(O_NOFOLLOW);
 344TRACE_DEFINE_ENUM(O_NOATIME);
 345TRACE_DEFINE_ENUM(O_CLOEXEC);
 346
 347#define show_open_flags(flags) \
 348	__print_flags(flags, "|", \
 349		{ O_WRONLY, "O_WRONLY" }, \
 350		{ O_RDWR, "O_RDWR" }, \
 351		{ O_CREAT, "O_CREAT" }, \
 352		{ O_EXCL, "O_EXCL" }, \
 353		{ O_NOCTTY, "O_NOCTTY" }, \
 354		{ O_TRUNC, "O_TRUNC" }, \
 355		{ O_APPEND, "O_APPEND" }, \
 356		{ O_NONBLOCK, "O_NONBLOCK" }, \
 357		{ O_DSYNC, "O_DSYNC" }, \
 358		{ O_DIRECT, "O_DIRECT" }, \
 359		{ O_LARGEFILE, "O_LARGEFILE" }, \
 360		{ O_DIRECTORY, "O_DIRECTORY" }, \
 361		{ O_NOFOLLOW, "O_NOFOLLOW" }, \
 362		{ O_NOATIME, "O_NOATIME" }, \
 363		{ O_CLOEXEC, "O_CLOEXEC" })
 364
 365TRACE_DEFINE_ENUM(FMODE_READ);
 366TRACE_DEFINE_ENUM(FMODE_WRITE);
 367TRACE_DEFINE_ENUM(FMODE_EXEC);
 368
 369#define show_fmode_flags(mode) \
 370	__print_flags(mode, "|", \
 371		{ ((__force unsigned long)FMODE_READ), "READ" }, \
 372		{ ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
 373		{ ((__force unsigned long)FMODE_EXEC), "EXEC" })
 374
 375TRACE_EVENT(nfs_atomic_open_enter,
 376		TP_PROTO(
 377			const struct inode *dir,
 378			const struct nfs_open_context *ctx,
 379			unsigned int flags
 380		),
 381
 382		TP_ARGS(dir, ctx, flags),
 383
 384		TP_STRUCT__entry(
 385			__field(unsigned long, flags)
 386			__field(unsigned int, fmode)
 387			__field(dev_t, dev)
 388			__field(u64, dir)
 389			__string(name, ctx->dentry->d_name.name)
 390		),
 391
 392		TP_fast_assign(
 393			__entry->dev = dir->i_sb->s_dev;
 394			__entry->dir = NFS_FILEID(dir);
 395			__entry->flags = flags;
 396			__entry->fmode = (__force unsigned int)ctx->mode;
 397			__assign_str(name, ctx->dentry->d_name.name);
 398		),
 399
 400		TP_printk(
 401			"flags=0x%lx (%s) fmode=%s name=%02x:%02x:%llu/%s",
 402			__entry->flags,
 403			show_open_flags(__entry->flags),
 404			show_fmode_flags(__entry->fmode),
 405			MAJOR(__entry->dev), MINOR(__entry->dev),
 406			(unsigned long long)__entry->dir,
 407			__get_str(name)
 408		)
 409);
 410
 411TRACE_EVENT(nfs_atomic_open_exit,
 412		TP_PROTO(
 413			const struct inode *dir,
 414			const struct nfs_open_context *ctx,
 415			unsigned int flags,
 416			int error
 417		),
 418
 419		TP_ARGS(dir, ctx, flags, error),
 420
 421		TP_STRUCT__entry(
 422			__field(unsigned long, error)
 423			__field(unsigned long, flags)
 424			__field(unsigned int, fmode)
 425			__field(dev_t, dev)
 426			__field(u64, dir)
 427			__string(name, ctx->dentry->d_name.name)
 428		),
 429
 430		TP_fast_assign(
 431			__entry->error = -error;
 432			__entry->dev = dir->i_sb->s_dev;
 433			__entry->dir = NFS_FILEID(dir);
 434			__entry->flags = flags;
 435			__entry->fmode = (__force unsigned int)ctx->mode;
 436			__assign_str(name, ctx->dentry->d_name.name);
 437		),
 438
 439		TP_printk(
 440			"error=%ld (%s) flags=0x%lx (%s) fmode=%s "
 441			"name=%02x:%02x:%llu/%s",
 442			-__entry->error, nfs_show_status(__entry->error),
 443			__entry->flags,
 444			show_open_flags(__entry->flags),
 445			show_fmode_flags(__entry->fmode),
 446			MAJOR(__entry->dev), MINOR(__entry->dev),
 447			(unsigned long long)__entry->dir,
 448			__get_str(name)
 449		)
 450);
 451
 452TRACE_EVENT(nfs_create_enter,
 453		TP_PROTO(
 454			const struct inode *dir,
 455			const struct dentry *dentry,
 456			unsigned int flags
 457		),
 458
 459		TP_ARGS(dir, dentry, flags),
 460
 461		TP_STRUCT__entry(
 462			__field(unsigned long, flags)
 463			__field(dev_t, dev)
 464			__field(u64, dir)
 465			__string(name, dentry->d_name.name)
 466		),
 467
 468		TP_fast_assign(
 469			__entry->dev = dir->i_sb->s_dev;
 470			__entry->dir = NFS_FILEID(dir);
 471			__entry->flags = flags;
 472			__assign_str(name, dentry->d_name.name);
 473		),
 474
 475		TP_printk(
 476			"flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
 477			__entry->flags,
 478			show_open_flags(__entry->flags),
 479			MAJOR(__entry->dev), MINOR(__entry->dev),
 480			(unsigned long long)__entry->dir,
 481			__get_str(name)
 482		)
 483);
 484
 485TRACE_EVENT(nfs_create_exit,
 486		TP_PROTO(
 487			const struct inode *dir,
 488			const struct dentry *dentry,
 489			unsigned int flags,
 490			int error
 491		),
 492
 493		TP_ARGS(dir, dentry, flags, error),
 494
 495		TP_STRUCT__entry(
 496			__field(unsigned long, error)
 497			__field(unsigned long, flags)
 498			__field(dev_t, dev)
 499			__field(u64, dir)
 500			__string(name, dentry->d_name.name)
 501		),
 502
 503		TP_fast_assign(
 504			__entry->error = -error;
 505			__entry->dev = dir->i_sb->s_dev;
 506			__entry->dir = NFS_FILEID(dir);
 507			__entry->flags = flags;
 508			__assign_str(name, dentry->d_name.name);
 509		),
 510
 511		TP_printk(
 512			"error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
 513			-__entry->error, nfs_show_status(__entry->error),
 514			__entry->flags,
 515			show_open_flags(__entry->flags),
 516			MAJOR(__entry->dev), MINOR(__entry->dev),
 517			(unsigned long long)__entry->dir,
 518			__get_str(name)
 519		)
 520);
 521
 522DECLARE_EVENT_CLASS(nfs_directory_event,
 523		TP_PROTO(
 524			const struct inode *dir,
 525			const struct dentry *dentry
 526		),
 527
 528		TP_ARGS(dir, dentry),
 529
 530		TP_STRUCT__entry(
 531			__field(dev_t, dev)
 532			__field(u64, dir)
 533			__string(name, dentry->d_name.name)
 534		),
 535
 536		TP_fast_assign(
 537			__entry->dev = dir->i_sb->s_dev;
 538			__entry->dir = NFS_FILEID(dir);
 539			__assign_str(name, dentry->d_name.name);
 540		),
 541
 542		TP_printk(
 543			"name=%02x:%02x:%llu/%s",
 544			MAJOR(__entry->dev), MINOR(__entry->dev),
 545			(unsigned long long)__entry->dir,
 546			__get_str(name)
 547		)
 548);
 549
 550#define DEFINE_NFS_DIRECTORY_EVENT(name) \
 551	DEFINE_EVENT(nfs_directory_event, name, \
 552			TP_PROTO( \
 553				const struct inode *dir, \
 554				const struct dentry *dentry \
 555			), \
 556			TP_ARGS(dir, dentry))
 557
 558DECLARE_EVENT_CLASS(nfs_directory_event_done,
 559		TP_PROTO(
 560			const struct inode *dir,
 561			const struct dentry *dentry,
 562			int error
 563		),
 564
 565		TP_ARGS(dir, dentry, error),
 566
 567		TP_STRUCT__entry(
 568			__field(unsigned long, error)
 569			__field(dev_t, dev)
 570			__field(u64, dir)
 571			__string(name, dentry->d_name.name)
 572		),
 573
 574		TP_fast_assign(
 575			__entry->dev = dir->i_sb->s_dev;
 576			__entry->dir = NFS_FILEID(dir);
 577			__entry->error = error < 0 ? -error : 0;
 578			__assign_str(name, dentry->d_name.name);
 579		),
 580
 581		TP_printk(
 582			"error=%ld (%s) name=%02x:%02x:%llu/%s",
 583			-__entry->error, nfs_show_status(__entry->error),
 584			MAJOR(__entry->dev), MINOR(__entry->dev),
 585			(unsigned long long)__entry->dir,
 586			__get_str(name)
 587		)
 588);
 589
 590#define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \
 591	DEFINE_EVENT(nfs_directory_event_done, name, \
 592			TP_PROTO( \
 593				const struct inode *dir, \
 594				const struct dentry *dentry, \
 595				int error \
 596			), \
 597			TP_ARGS(dir, dentry, error))
 598
 599DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter);
 600DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit);
 601DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter);
 602DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit);
 603DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter);
 604DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit);
 605DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter);
 606DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit);
 607DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter);
 608DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit);
 609DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter);
 610DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit);
 611
 612TRACE_EVENT(nfs_link_enter,
 613		TP_PROTO(
 614			const struct inode *inode,
 615			const struct inode *dir,
 616			const struct dentry *dentry
 617		),
 618
 619		TP_ARGS(inode, dir, dentry),
 620
 621		TP_STRUCT__entry(
 622			__field(dev_t, dev)
 623			__field(u64, fileid)
 624			__field(u64, dir)
 625			__string(name, dentry->d_name.name)
 626		),
 627
 628		TP_fast_assign(
 629			__entry->dev = inode->i_sb->s_dev;
 630			__entry->fileid = NFS_FILEID(inode);
 631			__entry->dir = NFS_FILEID(dir);
 632			__assign_str(name, dentry->d_name.name);
 633		),
 634
 635		TP_printk(
 636			"fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
 637			MAJOR(__entry->dev), MINOR(__entry->dev),
 638			__entry->fileid,
 639			MAJOR(__entry->dev), MINOR(__entry->dev),
 640			(unsigned long long)__entry->dir,
 641			__get_str(name)
 642		)
 643);
 644
 645TRACE_EVENT(nfs_link_exit,
 646		TP_PROTO(
 647			const struct inode *inode,
 648			const struct inode *dir,
 649			const struct dentry *dentry,
 650			int error
 651		),
 652
 653		TP_ARGS(inode, dir, dentry, error),
 654
 655		TP_STRUCT__entry(
 656			__field(unsigned long, error)
 657			__field(dev_t, dev)
 658			__field(u64, fileid)
 659			__field(u64, dir)
 660			__string(name, dentry->d_name.name)
 661		),
 662
 663		TP_fast_assign(
 664			__entry->dev = inode->i_sb->s_dev;
 665			__entry->fileid = NFS_FILEID(inode);
 666			__entry->dir = NFS_FILEID(dir);
 667			__entry->error = error < 0 ? -error : 0;
 668			__assign_str(name, dentry->d_name.name);
 669		),
 670
 671		TP_printk(
 672			"error=%ld (%s) fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
 673			-__entry->error, nfs_show_status(__entry->error),
 674			MAJOR(__entry->dev), MINOR(__entry->dev),
 675			__entry->fileid,
 676			MAJOR(__entry->dev), MINOR(__entry->dev),
 677			(unsigned long long)__entry->dir,
 678			__get_str(name)
 679		)
 680);
 681
 682DECLARE_EVENT_CLASS(nfs_rename_event,
 683		TP_PROTO(
 684			const struct inode *old_dir,
 685			const struct dentry *old_dentry,
 686			const struct inode *new_dir,
 687			const struct dentry *new_dentry
 688		),
 689
 690		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry),
 691
 692		TP_STRUCT__entry(
 693			__field(dev_t, dev)
 694			__field(u64, old_dir)
 695			__field(u64, new_dir)
 696			__string(old_name, old_dentry->d_name.name)
 697			__string(new_name, new_dentry->d_name.name)
 698		),
 699
 700		TP_fast_assign(
 701			__entry->dev = old_dir->i_sb->s_dev;
 702			__entry->old_dir = NFS_FILEID(old_dir);
 703			__entry->new_dir = NFS_FILEID(new_dir);
 704			__assign_str(old_name, old_dentry->d_name.name);
 705			__assign_str(new_name, new_dentry->d_name.name);
 706		),
 707
 708		TP_printk(
 709			"old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s",
 710			MAJOR(__entry->dev), MINOR(__entry->dev),
 711			(unsigned long long)__entry->old_dir,
 712			__get_str(old_name),
 713			MAJOR(__entry->dev), MINOR(__entry->dev),
 714			(unsigned long long)__entry->new_dir,
 715			__get_str(new_name)
 716		)
 717);
 718#define DEFINE_NFS_RENAME_EVENT(name) \
 719	DEFINE_EVENT(nfs_rename_event, name, \
 720			TP_PROTO( \
 721				const struct inode *old_dir, \
 722				const struct dentry *old_dentry, \
 723				const struct inode *new_dir, \
 724				const struct dentry *new_dentry \
 725			), \
 726			TP_ARGS(old_dir, old_dentry, new_dir, new_dentry))
 727
 728DECLARE_EVENT_CLASS(nfs_rename_event_done,
 729		TP_PROTO(
 730			const struct inode *old_dir,
 731			const struct dentry *old_dentry,
 732			const struct inode *new_dir,
 733			const struct dentry *new_dentry,
 734			int error
 735		),
 736
 737		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, error),
 738
 739		TP_STRUCT__entry(
 740			__field(dev_t, dev)
 741			__field(unsigned long, error)
 742			__field(u64, old_dir)
 743			__string(old_name, old_dentry->d_name.name)
 744			__field(u64, new_dir)
 745			__string(new_name, new_dentry->d_name.name)
 746		),
 747
 748		TP_fast_assign(
 749			__entry->dev = old_dir->i_sb->s_dev;
 750			__entry->error = -error;
 751			__entry->old_dir = NFS_FILEID(old_dir);
 752			__entry->new_dir = NFS_FILEID(new_dir);
 753			__assign_str(old_name, old_dentry->d_name.name);
 754			__assign_str(new_name, new_dentry->d_name.name);
 755		),
 756
 757		TP_printk(
 758			"error=%ld (%s) old_name=%02x:%02x:%llu/%s "
 759			"new_name=%02x:%02x:%llu/%s",
 760			-__entry->error, nfs_show_status(__entry->error),
 761			MAJOR(__entry->dev), MINOR(__entry->dev),
 762			(unsigned long long)__entry->old_dir,
 763			__get_str(old_name),
 764			MAJOR(__entry->dev), MINOR(__entry->dev),
 765			(unsigned long long)__entry->new_dir,
 766			__get_str(new_name)
 767		)
 768);
 769#define DEFINE_NFS_RENAME_EVENT_DONE(name) \
 770	DEFINE_EVENT(nfs_rename_event_done, name, \
 771			TP_PROTO( \
 772				const struct inode *old_dir, \
 773				const struct dentry *old_dentry, \
 774				const struct inode *new_dir, \
 775				const struct dentry *new_dentry, \
 776				int error \
 777			), \
 778			TP_ARGS(old_dir, old_dentry, new_dir, \
 779				new_dentry, error))
 780
 781DEFINE_NFS_RENAME_EVENT(nfs_rename_enter);
 782DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit);
 783
 784DEFINE_NFS_RENAME_EVENT_DONE(nfs_sillyrename_rename);
 785
 786TRACE_EVENT(nfs_sillyrename_unlink,
 787		TP_PROTO(
 788			const struct nfs_unlinkdata *data,
 789			int error
 790		),
 791
 792		TP_ARGS(data, error),
 793
 794		TP_STRUCT__entry(
 795			__field(dev_t, dev)
 796			__field(unsigned long, error)
 797			__field(u64, dir)
 798			__dynamic_array(char, name, data->args.name.len + 1)
 799		),
 800
 801		TP_fast_assign(
 802			struct inode *dir = d_inode(data->dentry->d_parent);
 803			size_t len = data->args.name.len;
 804			__entry->dev = dir->i_sb->s_dev;
 805			__entry->dir = NFS_FILEID(dir);
 806			__entry->error = -error;
 807			memcpy(__get_str(name),
 808				data->args.name.name, len);
 809			__get_str(name)[len] = 0;
 810		),
 811
 812		TP_printk(
 813			"error=%ld (%s) name=%02x:%02x:%llu/%s",
 814			-__entry->error, nfs_show_status(__entry->error),
 815			MAJOR(__entry->dev), MINOR(__entry->dev),
 816			(unsigned long long)__entry->dir,
 817			__get_str(name)
 818		)
 819);
 820
 821TRACE_EVENT(nfs_initiate_read,
 822		TP_PROTO(
 823			const struct inode *inode,
 824			loff_t offset, unsigned long count
 
 825		),
 826
 827		TP_ARGS(inode, offset, count),
 828
 829		TP_STRUCT__entry(
 830			__field(loff_t, offset)
 831			__field(unsigned long, count)
 832			__field(dev_t, dev)
 833			__field(u32, fhandle)
 834			__field(u64, fileid)
 
 
 
 835		),
 836
 837		TP_fast_assign(
 838			const struct nfs_inode *nfsi = NFS_I(inode);
 839
 840			__entry->offset = offset;
 
 
 
 
 841			__entry->count = count;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 842			__entry->dev = inode->i_sb->s_dev;
 843			__entry->fileid = nfsi->fileid;
 844			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 845		),
 846
 847		TP_printk(
 848			"fileid=%02x:%02x:%llu fhandle=0x%08x "
 849			"offset=%lld count=%lu",
 850			MAJOR(__entry->dev), MINOR(__entry->dev),
 851			(unsigned long long)__entry->fileid,
 852			__entry->fhandle,
 853			__entry->offset, __entry->count
 854		)
 855);
 856
 857TRACE_EVENT(nfs_readpage_done,
 858		TP_PROTO(
 859			const struct inode *inode,
 860			int status, loff_t offset, bool eof
 861		),
 862
 863		TP_ARGS(inode, status, offset, eof),
 864
 865		TP_STRUCT__entry(
 866			__field(int, status)
 
 
 867			__field(loff_t, offset)
 
 
 868			__field(bool, eof)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 869			__field(dev_t, dev)
 870			__field(u32, fhandle)
 871			__field(u64, fileid)
 
 
 
 
 
 872		),
 873
 874		TP_fast_assign(
 
 875			const struct nfs_inode *nfsi = NFS_I(inode);
 
 
 876
 877			__entry->status = status;
 878			__entry->offset = offset;
 879			__entry->eof = eof;
 
 
 880			__entry->dev = inode->i_sb->s_dev;
 881			__entry->fileid = nfsi->fileid;
 882			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 883		),
 884
 885		TP_printk(
 886			"fileid=%02x:%02x:%llu fhandle=0x%08x "
 887			"offset=%lld status=%d%s",
 888			MAJOR(__entry->dev), MINOR(__entry->dev),
 889			(unsigned long long)__entry->fileid,
 890			__entry->fhandle,
 891			__entry->offset, __entry->status,
 892			__entry->eof ? " eof" : ""
 893		)
 894);
 895
 896TRACE_DEFINE_ENUM(NFS_UNSTABLE);
 897TRACE_DEFINE_ENUM(NFS_DATA_SYNC);
 898TRACE_DEFINE_ENUM(NFS_FILE_SYNC);
 899
 900#define nfs_show_stable(stable) \
 901	__print_symbolic(stable, \
 902			{ NFS_UNSTABLE, "UNSTABLE" }, \
 903			{ NFS_DATA_SYNC, "DATA_SYNC" }, \
 904			{ NFS_FILE_SYNC, "FILE_SYNC" })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 905
 906TRACE_EVENT(nfs_initiate_write,
 907		TP_PROTO(
 908			const struct inode *inode,
 909			loff_t offset, unsigned long count,
 910			enum nfs3_stable_how stable
 911		),
 912
 913		TP_ARGS(inode, offset, count, stable),
 914
 915		TP_STRUCT__entry(
 916			__field(loff_t, offset)
 917			__field(unsigned long, count)
 918			__field(enum nfs3_stable_how, stable)
 919			__field(dev_t, dev)
 920			__field(u32, fhandle)
 921			__field(u64, fileid)
 
 
 
 922		),
 923
 924		TP_fast_assign(
 
 925			const struct nfs_inode *nfsi = NFS_I(inode);
 
 
 926
 927			__entry->offset = offset;
 928			__entry->count = count;
 929			__entry->stable = stable;
 930			__entry->dev = inode->i_sb->s_dev;
 931			__entry->fileid = nfsi->fileid;
 932			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 933		),
 934
 935		TP_printk(
 936			"fileid=%02x:%02x:%llu fhandle=0x%08x "
 937			"offset=%lld count=%lu stable=%s",
 938			MAJOR(__entry->dev), MINOR(__entry->dev),
 939			(unsigned long long)__entry->fileid,
 940			__entry->fhandle,
 941			__entry->offset, __entry->count,
 942			nfs_show_stable(__entry->stable)
 943		)
 944);
 945
 946TRACE_EVENT(nfs_writeback_done,
 947		TP_PROTO(
 948			const struct inode *inode,
 949			int status,
 950			loff_t offset,
 951			struct nfs_writeverf *writeverf
 952		),
 953
 954		TP_ARGS(inode, status, offset, writeverf),
 955
 956		TP_STRUCT__entry(
 957			__field(int, status)
 958			__field(loff_t, offset)
 959			__field(enum nfs3_stable_how, stable)
 960			__field(unsigned long long, verifier)
 961			__field(dev_t, dev)
 962			__field(u32, fhandle)
 963			__field(u64, fileid)
 
 
 
 
 
 
 964		),
 965
 966		TP_fast_assign(
 
 967			const struct nfs_inode *nfsi = NFS_I(inode);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 968
 969			__entry->status = status;
 970			__entry->offset = offset;
 971			__entry->stable = writeverf->committed;
 972			memcpy(&__entry->verifier, &writeverf->verifier,
 973			       sizeof(__entry->verifier));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 974			__entry->dev = inode->i_sb->s_dev;
 975			__entry->fileid = nfsi->fileid;
 976			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 
 
 
 977		),
 978
 979		TP_printk(
 980			"fileid=%02x:%02x:%llu fhandle=0x%08x "
 981			"offset=%lld status=%d stable=%s "
 982			"verifier 0x%016llx",
 983			MAJOR(__entry->dev), MINOR(__entry->dev),
 984			(unsigned long long)__entry->fileid,
 985			__entry->fhandle,
 986			__entry->offset, __entry->status,
 987			nfs_show_stable(__entry->stable),
 988			__entry->verifier
 989		)
 990);
 991
 
 
 
 
 
 
 
 
 
 
 
 
 
 992TRACE_EVENT(nfs_initiate_commit,
 993		TP_PROTO(
 994			const struct nfs_commit_data *data
 995		),
 996
 997		TP_ARGS(data),
 998
 999		TP_STRUCT__entry(
1000			__field(loff_t, offset)
1001			__field(unsigned long, count)
1002			__field(dev_t, dev)
1003			__field(u32, fhandle)
1004			__field(u64, fileid)
 
 
1005		),
1006
1007		TP_fast_assign(
1008			const struct inode *inode = data->inode;
1009			const struct nfs_inode *nfsi = NFS_I(inode);
 
 
1010
1011			__entry->offset = data->args.offset;
1012			__entry->count = data->args.count;
1013			__entry->dev = inode->i_sb->s_dev;
1014			__entry->fileid = nfsi->fileid;
1015			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1016		),
1017
1018		TP_printk(
1019			"fileid=%02x:%02x:%llu fhandle=0x%08x "
1020			"offset=%lld count=%lu",
1021			MAJOR(__entry->dev), MINOR(__entry->dev),
1022			(unsigned long long)__entry->fileid,
1023			__entry->fhandle,
1024			__entry->offset, __entry->count
1025		)
1026);
1027
1028TRACE_EVENT(nfs_commit_done,
1029		TP_PROTO(
 
1030			const struct nfs_commit_data *data
1031		),
1032
1033		TP_ARGS(data),
1034
1035		TP_STRUCT__entry(
1036			__field(int, status)
1037			__field(loff_t, offset)
1038			__field(unsigned long long, verifier)
1039			__field(dev_t, dev)
1040			__field(u32, fhandle)
1041			__field(u64, fileid)
 
 
 
 
1042		),
1043
1044		TP_fast_assign(
1045			const struct inode *inode = data->inode;
1046			const struct nfs_inode *nfsi = NFS_I(inode);
 
 
 
1047
1048			__entry->status = data->res.op_status;
1049			__entry->offset = data->args.offset;
1050			memcpy(&__entry->verifier, &data->verf.verifier,
1051			       sizeof(__entry->verifier));
 
 
1052			__entry->dev = inode->i_sb->s_dev;
1053			__entry->fileid = nfsi->fileid;
1054			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1055		),
1056
1057		TP_printk(
1058			"fileid=%02x:%02x:%llu fhandle=0x%08x "
1059			"offset=%lld status=%d verifier 0x%016llx",
1060			MAJOR(__entry->dev), MINOR(__entry->dev),
1061			(unsigned long long)__entry->fileid,
1062			__entry->fhandle,
1063			__entry->offset, __entry->status,
1064			__entry->verifier
 
1065		)
1066);
1067
1068TRACE_DEFINE_ENUM(NFS_OK);
1069TRACE_DEFINE_ENUM(NFSERR_PERM);
1070TRACE_DEFINE_ENUM(NFSERR_NOENT);
1071TRACE_DEFINE_ENUM(NFSERR_IO);
1072TRACE_DEFINE_ENUM(NFSERR_NXIO);
1073TRACE_DEFINE_ENUM(ECHILD);
1074TRACE_DEFINE_ENUM(NFSERR_EAGAIN);
1075TRACE_DEFINE_ENUM(NFSERR_ACCES);
1076TRACE_DEFINE_ENUM(NFSERR_EXIST);
1077TRACE_DEFINE_ENUM(NFSERR_XDEV);
1078TRACE_DEFINE_ENUM(NFSERR_NODEV);
1079TRACE_DEFINE_ENUM(NFSERR_NOTDIR);
1080TRACE_DEFINE_ENUM(NFSERR_ISDIR);
1081TRACE_DEFINE_ENUM(NFSERR_INVAL);
1082TRACE_DEFINE_ENUM(NFSERR_FBIG);
1083TRACE_DEFINE_ENUM(NFSERR_NOSPC);
1084TRACE_DEFINE_ENUM(NFSERR_ROFS);
1085TRACE_DEFINE_ENUM(NFSERR_MLINK);
1086TRACE_DEFINE_ENUM(NFSERR_OPNOTSUPP);
1087TRACE_DEFINE_ENUM(NFSERR_NAMETOOLONG);
1088TRACE_DEFINE_ENUM(NFSERR_NOTEMPTY);
1089TRACE_DEFINE_ENUM(NFSERR_DQUOT);
1090TRACE_DEFINE_ENUM(NFSERR_STALE);
1091TRACE_DEFINE_ENUM(NFSERR_REMOTE);
1092TRACE_DEFINE_ENUM(NFSERR_WFLUSH);
1093TRACE_DEFINE_ENUM(NFSERR_BADHANDLE);
1094TRACE_DEFINE_ENUM(NFSERR_NOT_SYNC);
1095TRACE_DEFINE_ENUM(NFSERR_BAD_COOKIE);
1096TRACE_DEFINE_ENUM(NFSERR_NOTSUPP);
1097TRACE_DEFINE_ENUM(NFSERR_TOOSMALL);
1098TRACE_DEFINE_ENUM(NFSERR_SERVERFAULT);
1099TRACE_DEFINE_ENUM(NFSERR_BADTYPE);
1100TRACE_DEFINE_ENUM(NFSERR_JUKEBOX);
1101
1102#define nfs_show_status(x) \
1103	__print_symbolic(x, \
1104			{ NFS_OK, "OK" }, \
1105			{ NFSERR_PERM, "PERM" }, \
1106			{ NFSERR_NOENT, "NOENT" }, \
1107			{ NFSERR_IO, "IO" }, \
1108			{ NFSERR_NXIO, "NXIO" }, \
1109			{ ECHILD, "CHILD" }, \
1110			{ NFSERR_EAGAIN, "AGAIN" }, \
1111			{ NFSERR_ACCES, "ACCES" }, \
1112			{ NFSERR_EXIST, "EXIST" }, \
1113			{ NFSERR_XDEV, "XDEV" }, \
1114			{ NFSERR_NODEV, "NODEV" }, \
1115			{ NFSERR_NOTDIR, "NOTDIR" }, \
1116			{ NFSERR_ISDIR, "ISDIR" }, \
1117			{ NFSERR_INVAL, "INVAL" }, \
1118			{ NFSERR_FBIG, "FBIG" }, \
1119			{ NFSERR_NOSPC, "NOSPC" }, \
1120			{ NFSERR_ROFS, "ROFS" }, \
1121			{ NFSERR_MLINK, "MLINK" }, \
1122			{ NFSERR_OPNOTSUPP, "OPNOTSUPP" }, \
1123			{ NFSERR_NAMETOOLONG, "NAMETOOLONG" }, \
1124			{ NFSERR_NOTEMPTY, "NOTEMPTY" }, \
1125			{ NFSERR_DQUOT, "DQUOT" }, \
1126			{ NFSERR_STALE, "STALE" }, \
1127			{ NFSERR_REMOTE, "REMOTE" }, \
1128			{ NFSERR_WFLUSH, "WFLUSH" }, \
1129			{ NFSERR_BADHANDLE, "BADHANDLE" }, \
1130			{ NFSERR_NOT_SYNC, "NOTSYNC" }, \
1131			{ NFSERR_BAD_COOKIE, "BADCOOKIE" }, \
1132			{ NFSERR_NOTSUPP, "NOTSUPP" }, \
1133			{ NFSERR_TOOSMALL, "TOOSMALL" }, \
1134			{ NFSERR_SERVERFAULT, "REMOTEIO" }, \
1135			{ NFSERR_BADTYPE, "BADTYPE" }, \
1136			{ NFSERR_JUKEBOX, "JUKEBOX" })
1137
1138TRACE_EVENT(nfs_xdr_status,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1139		TP_PROTO(
1140			const struct xdr_stream *xdr,
1141			int error
1142		),
1143
1144		TP_ARGS(xdr, error),
1145
1146		TP_STRUCT__entry(
1147			__field(unsigned int, task_id)
1148			__field(unsigned int, client_id)
1149			__field(u32, xid)
 
1150			__field(unsigned long, error)
 
 
 
 
1151		),
1152
1153		TP_fast_assign(
1154			const struct rpc_rqst *rqstp = xdr->rqst;
1155			const struct rpc_task *task = rqstp->rq_task;
1156
1157			__entry->task_id = task->tk_pid;
1158			__entry->client_id = task->tk_client->cl_clid;
1159			__entry->xid = be32_to_cpu(rqstp->rq_xid);
 
1160			__entry->error = error;
 
 
1161		),
1162
1163		TP_printk(
1164			"task:%u@%d xid=0x%08x error=%ld (%s)",
1165			__entry->task_id, __entry->client_id, __entry->xid,
1166			-__entry->error, nfs_show_status(__entry->error)
 
 
1167		)
1168);
 
 
 
 
 
 
 
 
 
1169
1170#endif /* _TRACE_NFS_H */
1171
1172#undef TRACE_INCLUDE_PATH
1173#define TRACE_INCLUDE_PATH .
1174#define TRACE_INCLUDE_FILE nfstrace
1175/* This part must be outside protection */
1176#include <trace/define_trace.h>
v6.13.7
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/*
   3 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
   4 */
   5#undef TRACE_SYSTEM
   6#define TRACE_SYSTEM nfs
   7
   8#if !defined(_TRACE_NFS_H) || defined(TRACE_HEADER_MULTI_READ)
   9#define _TRACE_NFS_H
  10
  11#include <linux/tracepoint.h>
  12#include <linux/iversion.h>
  13
  14#include <trace/misc/fs.h>
  15#include <trace/misc/nfs.h>
  16#include <trace/misc/sunrpc.h>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  17
  18#define nfs_show_cache_validity(v) \
  19	__print_flags(v, "|", \
  20			{ NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
  21			{ NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
  22			{ NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
  23			{ NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
 
  24			{ NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
  25			{ NFS_INO_INVALID_LABEL, "INVALID_LABEL" }, \
  26			{ NFS_INO_INVALID_CHANGE, "INVALID_CHANGE" }, \
  27			{ NFS_INO_INVALID_CTIME, "INVALID_CTIME" }, \
  28			{ NFS_INO_INVALID_MTIME, "INVALID_MTIME" }, \
  29			{ NFS_INO_INVALID_SIZE, "INVALID_SIZE" }, \
  30			{ NFS_INO_INVALID_OTHER, "INVALID_OTHER" }, \
  31			{ NFS_INO_DATA_INVAL_DEFER, "DATA_INVAL_DEFER" }, \
  32			{ NFS_INO_INVALID_BLOCKS, "INVALID_BLOCKS" }, \
  33			{ NFS_INO_INVALID_XATTR, "INVALID_XATTR" }, \
  34			{ NFS_INO_INVALID_NLINK, "INVALID_NLINK" }, \
  35			{ NFS_INO_INVALID_MODE, "INVALID_MODE" })
 
 
 
 
 
 
  36
  37#define nfs_show_nfsi_flags(v) \
  38	__print_flags(v, "|", \
 
  39			{ BIT(NFS_INO_STALE), "STALE" }, \
  40			{ BIT(NFS_INO_ACL_LRU_SET), "ACL_LRU_SET" }, \
  41			{ BIT(NFS_INO_INVALIDATING), "INVALIDATING" }, \
 
 
  42			{ BIT(NFS_INO_LAYOUTCOMMIT), "NEED_LAYOUTCOMMIT" }, \
  43			{ BIT(NFS_INO_LAYOUTCOMMITTING), "LAYOUTCOMMIT" }, \
  44			{ BIT(NFS_INO_LAYOUTSTATS), "LAYOUTSTATS" }, \
  45			{ BIT(NFS_INO_ODIRECT), "ODIRECT" })
  46
  47DECLARE_EVENT_CLASS(nfs_inode_event,
  48		TP_PROTO(
  49			const struct inode *inode
  50		),
  51
  52		TP_ARGS(inode),
  53
  54		TP_STRUCT__entry(
  55			__field(dev_t, dev)
  56			__field(u32, fhandle)
  57			__field(u64, fileid)
  58			__field(u64, version)
  59		),
  60
  61		TP_fast_assign(
  62			const struct nfs_inode *nfsi = NFS_I(inode);
  63			__entry->dev = inode->i_sb->s_dev;
  64			__entry->fileid = nfsi->fileid;
  65			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
  66			__entry->version = inode_peek_iversion_raw(inode);
  67		),
  68
  69		TP_printk(
  70			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
  71			MAJOR(__entry->dev), MINOR(__entry->dev),
  72			(unsigned long long)__entry->fileid,
  73			__entry->fhandle,
  74			(unsigned long long)__entry->version
  75		)
  76);
  77
  78DECLARE_EVENT_CLASS(nfs_inode_event_done,
  79		TP_PROTO(
  80			const struct inode *inode,
  81			int error
  82		),
  83
  84		TP_ARGS(inode, error),
  85
  86		TP_STRUCT__entry(
  87			__field(unsigned long, error)
  88			__field(dev_t, dev)
  89			__field(u32, fhandle)
  90			__field(unsigned char, type)
  91			__field(u64, fileid)
  92			__field(u64, version)
  93			__field(loff_t, size)
  94			__field(unsigned long, nfsi_flags)
  95			__field(unsigned long, cache_validity)
  96		),
  97
  98		TP_fast_assign(
  99			const struct nfs_inode *nfsi = NFS_I(inode);
 100			__entry->error = error < 0 ? -error : 0;
 101			__entry->dev = inode->i_sb->s_dev;
 102			__entry->fileid = nfsi->fileid;
 103			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 104			__entry->type = nfs_umode_to_dtype(inode->i_mode);
 105			__entry->version = inode_peek_iversion_raw(inode);
 106			__entry->size = i_size_read(inode);
 107			__entry->nfsi_flags = nfsi->flags;
 108			__entry->cache_validity = nfsi->cache_validity;
 109		),
 110
 111		TP_printk(
 112			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
 113			"type=%u (%s) version=%llu size=%lld "
 114			"cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s)",
 115			-__entry->error, show_nfs_status(__entry->error),
 116			MAJOR(__entry->dev), MINOR(__entry->dev),
 117			(unsigned long long)__entry->fileid,
 118			__entry->fhandle,
 119			__entry->type,
 120			show_fs_dirent_type(__entry->type),
 121			(unsigned long long)__entry->version,
 122			(long long)__entry->size,
 123			__entry->cache_validity,
 124			nfs_show_cache_validity(__entry->cache_validity),
 125			__entry->nfsi_flags,
 126			nfs_show_nfsi_flags(__entry->nfsi_flags)
 127		)
 128);
 129
 130#define DEFINE_NFS_INODE_EVENT(name) \
 131	DEFINE_EVENT(nfs_inode_event, name, \
 132			TP_PROTO( \
 133				const struct inode *inode \
 134			), \
 135			TP_ARGS(inode))
 136#define DEFINE_NFS_INODE_EVENT_DONE(name) \
 137	DEFINE_EVENT(nfs_inode_event_done, name, \
 138			TP_PROTO( \
 139				const struct inode *inode, \
 140				int error \
 141			), \
 142			TP_ARGS(inode, error))
 143DEFINE_NFS_INODE_EVENT(nfs_set_inode_stale);
 144DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter);
 145DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit);
 146DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter);
 147DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit);
 148DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter);
 149DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit);
 150DEFINE_NFS_INODE_EVENT(nfs_getattr_enter);
 151DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit);
 152DEFINE_NFS_INODE_EVENT(nfs_setattr_enter);
 153DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit);
 
 
 154DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter);
 155DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit);
 156DEFINE_NFS_INODE_EVENT(nfs_fsync_enter);
 157DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
 158DEFINE_NFS_INODE_EVENT(nfs_access_enter);
 159DEFINE_NFS_INODE_EVENT_DONE(nfs_set_cache_invalid);
 160DEFINE_NFS_INODE_EVENT(nfs_readdir_force_readdirplus);
 161DEFINE_NFS_INODE_EVENT_DONE(nfs_readdir_cache_fill_done);
 162DEFINE_NFS_INODE_EVENT_DONE(nfs_readdir_uncached_done);
 163
 164TRACE_EVENT(nfs_access_exit,
 165		TP_PROTO(
 166			const struct inode *inode,
 167			unsigned int mask,
 168			unsigned int permitted,
 169			int error
 170		),
 171
 172		TP_ARGS(inode, mask, permitted, error),
 173
 174		TP_STRUCT__entry(
 175			__field(unsigned long, error)
 176			__field(dev_t, dev)
 177			__field(u32, fhandle)
 178			__field(unsigned char, type)
 179			__field(u64, fileid)
 180			__field(u64, version)
 181			__field(loff_t, size)
 182			__field(unsigned long, nfsi_flags)
 183			__field(unsigned long, cache_validity)
 184			__field(unsigned int, mask)
 185			__field(unsigned int, permitted)
 186		),
 187
 188		TP_fast_assign(
 189			const struct nfs_inode *nfsi = NFS_I(inode);
 190			__entry->error = error < 0 ? -error : 0;
 191			__entry->dev = inode->i_sb->s_dev;
 192			__entry->fileid = nfsi->fileid;
 193			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 194			__entry->type = nfs_umode_to_dtype(inode->i_mode);
 195			__entry->version = inode_peek_iversion_raw(inode);
 196			__entry->size = i_size_read(inode);
 197			__entry->nfsi_flags = nfsi->flags;
 198			__entry->cache_validity = nfsi->cache_validity;
 199			__entry->mask = mask;
 200			__entry->permitted = permitted;
 201		),
 202
 203		TP_printk(
 204			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
 205			"type=%u (%s) version=%llu size=%lld "
 206			"cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s) "
 207			"mask=0x%x permitted=0x%x",
 208			-__entry->error, show_nfs_status(__entry->error),
 209			MAJOR(__entry->dev), MINOR(__entry->dev),
 210			(unsigned long long)__entry->fileid,
 211			__entry->fhandle,
 212			__entry->type,
 213			show_fs_dirent_type(__entry->type),
 214			(unsigned long long)__entry->version,
 215			(long long)__entry->size,
 216			__entry->cache_validity,
 217			nfs_show_cache_validity(__entry->cache_validity),
 218			__entry->nfsi_flags,
 219			nfs_show_nfsi_flags(__entry->nfsi_flags),
 220			__entry->mask, __entry->permitted
 221		)
 222);
 223
 224DECLARE_EVENT_CLASS(nfs_update_size_class,
 225		TP_PROTO(
 226			const struct inode *inode,
 227			loff_t new_size
 228		),
 229
 230		TP_ARGS(inode, new_size),
 231
 232		TP_STRUCT__entry(
 233			__field(dev_t, dev)
 234			__field(u32, fhandle)
 235			__field(u64, fileid)
 236			__field(u64, version)
 237			__field(loff_t, cur_size)
 238			__field(loff_t, new_size)
 239		),
 240
 241		TP_fast_assign(
 242			const struct nfs_inode *nfsi = NFS_I(inode);
 243
 244			__entry->dev = inode->i_sb->s_dev;
 245			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 246			__entry->fileid = nfsi->fileid;
 247			__entry->version = inode_peek_iversion_raw(inode);
 248			__entry->cur_size = i_size_read(inode);
 249			__entry->new_size = new_size;
 250		),
 251
 252		TP_printk(
 253			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu cursize=%lld newsize=%lld",
 254			MAJOR(__entry->dev), MINOR(__entry->dev),
 255			(unsigned long long)__entry->fileid,
 256			__entry->fhandle, __entry->version,
 257			__entry->cur_size, __entry->new_size
 258		)
 259);
 260
 261#define DEFINE_NFS_UPDATE_SIZE_EVENT(name) \
 262	DEFINE_EVENT(nfs_update_size_class, nfs_size_##name, \
 263			TP_PROTO( \
 264				const struct inode *inode, \
 265				loff_t new_size \
 266			), \
 267			TP_ARGS(inode, new_size))
 268
 269DEFINE_NFS_UPDATE_SIZE_EVENT(truncate);
 270DEFINE_NFS_UPDATE_SIZE_EVENT(wcc);
 271DEFINE_NFS_UPDATE_SIZE_EVENT(update);
 272DEFINE_NFS_UPDATE_SIZE_EVENT(grow);
 273
 274DECLARE_EVENT_CLASS(nfs_inode_range_event,
 275		TP_PROTO(
 276			const struct inode *inode,
 277			loff_t range_start,
 278			loff_t range_end
 279		),
 280
 281		TP_ARGS(inode, range_start, range_end),
 282
 283		TP_STRUCT__entry(
 284			__field(dev_t, dev)
 285			__field(u32, fhandle)
 286			__field(u64, fileid)
 287			__field(u64, version)
 288			__field(loff_t, range_start)
 289			__field(loff_t, range_end)
 290		),
 291
 292		TP_fast_assign(
 293			const struct nfs_inode *nfsi = NFS_I(inode);
 294
 295			__entry->dev = inode->i_sb->s_dev;
 296			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 297			__entry->fileid = nfsi->fileid;
 298			__entry->version = inode_peek_iversion_raw(inode);
 299			__entry->range_start = range_start;
 300			__entry->range_end = range_end;
 301		),
 302
 303		TP_printk(
 304			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu "
 305			"range=[%lld, %lld]",
 306			MAJOR(__entry->dev), MINOR(__entry->dev),
 307			(unsigned long long)__entry->fileid,
 308			__entry->fhandle, __entry->version,
 309			__entry->range_start, __entry->range_end
 310		)
 311);
 312
 313#define DEFINE_NFS_INODE_RANGE_EVENT(name) \
 314	DEFINE_EVENT(nfs_inode_range_event, name, \
 315			TP_PROTO( \
 316				const struct inode *inode, \
 317				loff_t range_start, \
 318				loff_t range_end \
 319			), \
 320			TP_ARGS(inode, range_start, range_end))
 321
 322DEFINE_NFS_INODE_RANGE_EVENT(nfs_readdir_invalidate_cache_range);
 323
 324DECLARE_EVENT_CLASS(nfs_readdir_event,
 325		TP_PROTO(
 326			const struct file *file,
 327			const __be32 *verifier,
 328			u64 cookie,
 329			pgoff_t page_index,
 330			unsigned int dtsize
 331		),
 332
 333		TP_ARGS(file, verifier, cookie, page_index, dtsize),
 334
 335		TP_STRUCT__entry(
 336			__field(dev_t, dev)
 337			__field(u32, fhandle)
 338			__field(u64, fileid)
 339			__field(u64, version)
 340			__array(char, verifier, NFS4_VERIFIER_SIZE)
 341			__field(u64, cookie)
 342			__field(pgoff_t, index)
 343			__field(unsigned int, dtsize)
 344		),
 345
 346		TP_fast_assign(
 347			const struct inode *dir = file_inode(file);
 348			const struct nfs_inode *nfsi = NFS_I(dir);
 349
 350			__entry->dev = dir->i_sb->s_dev;
 351			__entry->fileid = nfsi->fileid;
 352			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 353			__entry->version = inode_peek_iversion_raw(dir);
 354			if (cookie != 0)
 355				memcpy(__entry->verifier, verifier,
 356				       NFS4_VERIFIER_SIZE);
 357			else
 358				memset(__entry->verifier, 0,
 359				       NFS4_VERIFIER_SIZE);
 360			__entry->cookie = cookie;
 361			__entry->index = page_index;
 362			__entry->dtsize = dtsize;
 363		),
 364
 365		TP_printk(
 366			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu "
 367			"cookie=%s:0x%llx cache_index=%lu dtsize=%u",
 368			MAJOR(__entry->dev), MINOR(__entry->dev),
 369			(unsigned long long)__entry->fileid, __entry->fhandle,
 370			__entry->version, show_nfs4_verifier(__entry->verifier),
 371			(unsigned long long)__entry->cookie, __entry->index,
 372			__entry->dtsize
 373		)
 374);
 375
 376#define DEFINE_NFS_READDIR_EVENT(name) \
 377	DEFINE_EVENT(nfs_readdir_event, name, \
 378			TP_PROTO( \
 379				const struct file *file, \
 380				const __be32 *verifier, \
 381				u64 cookie, \
 382				pgoff_t page_index, \
 383				unsigned int dtsize \
 384				), \
 385			TP_ARGS(file, verifier, cookie, page_index, dtsize))
 386
 387DEFINE_NFS_READDIR_EVENT(nfs_readdir_cache_fill);
 388DEFINE_NFS_READDIR_EVENT(nfs_readdir_uncached);
 389
 390DECLARE_EVENT_CLASS(nfs_lookup_event,
 391		TP_PROTO(
 392			const struct inode *dir,
 393			const struct dentry *dentry,
 394			unsigned int flags
 395		),
 396
 397		TP_ARGS(dir, dentry, flags),
 398
 399		TP_STRUCT__entry(
 400			__field(unsigned long, flags)
 401			__field(dev_t, dev)
 402			__field(u64, dir)
 403			__field(u64, fileid)
 404			__string(name, dentry->d_name.name)
 405		),
 406
 407		TP_fast_assign(
 408			__entry->dev = dir->i_sb->s_dev;
 409			__entry->dir = NFS_FILEID(dir);
 410			__entry->flags = flags;
 411			__entry->fileid = d_is_negative(dentry) ? 0 : NFS_FILEID(d_inode(dentry));
 412			__assign_str(name);
 413		),
 414
 415		TP_printk(
 416			"flags=0x%lx (%s) name=%02x:%02x:%llu/%s fileid=%llu",
 417			__entry->flags,
 418			show_fs_lookup_flags(__entry->flags),
 419			MAJOR(__entry->dev), MINOR(__entry->dev),
 420			(unsigned long long)__entry->dir,
 421			__get_str(name),
 422			__entry->fileid
 423		)
 424);
 425
 426#define DEFINE_NFS_LOOKUP_EVENT(name) \
 427	DEFINE_EVENT(nfs_lookup_event, name, \
 428			TP_PROTO( \
 429				const struct inode *dir, \
 430				const struct dentry *dentry, \
 431				unsigned int flags \
 432			), \
 433			TP_ARGS(dir, dentry, flags))
 434
 435DECLARE_EVENT_CLASS(nfs_lookup_event_done,
 436		TP_PROTO(
 437			const struct inode *dir,
 438			const struct dentry *dentry,
 439			unsigned int flags,
 440			int error
 441		),
 442
 443		TP_ARGS(dir, dentry, flags, error),
 444
 445		TP_STRUCT__entry(
 446			__field(unsigned long, error)
 447			__field(unsigned long, flags)
 448			__field(dev_t, dev)
 449			__field(u64, dir)
 450			__field(u64, fileid)
 451			__string(name, dentry->d_name.name)
 452		),
 453
 454		TP_fast_assign(
 455			__entry->dev = dir->i_sb->s_dev;
 456			__entry->dir = NFS_FILEID(dir);
 457			__entry->error = error < 0 ? -error : 0;
 458			__entry->flags = flags;
 459			__entry->fileid = d_is_negative(dentry) ? 0 : NFS_FILEID(d_inode(dentry));
 460			__assign_str(name);
 461		),
 462
 463		TP_printk(
 464			"error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s fileid=%llu",
 465			-__entry->error, show_nfs_status(__entry->error),
 466			__entry->flags,
 467			show_fs_lookup_flags(__entry->flags),
 468			MAJOR(__entry->dev), MINOR(__entry->dev),
 469			(unsigned long long)__entry->dir,
 470			__get_str(name),
 471			__entry->fileid
 472		)
 473);
 474
 475#define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \
 476	DEFINE_EVENT(nfs_lookup_event_done, name, \
 477			TP_PROTO( \
 478				const struct inode *dir, \
 479				const struct dentry *dentry, \
 480				unsigned int flags, \
 481				int error \
 482			), \
 483			TP_ARGS(dir, dentry, flags, error))
 484
 485DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter);
 486DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
 487DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
 488DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
 489DEFINE_NFS_LOOKUP_EVENT(nfs_readdir_lookup);
 490DEFINE_NFS_LOOKUP_EVENT(nfs_readdir_lookup_revalidate_failed);
 491DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_readdir_lookup_revalidate);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 492
 493TRACE_EVENT(nfs_atomic_open_enter,
 494		TP_PROTO(
 495			const struct inode *dir,
 496			const struct nfs_open_context *ctx,
 497			unsigned int flags
 498		),
 499
 500		TP_ARGS(dir, ctx, flags),
 501
 502		TP_STRUCT__entry(
 503			__field(unsigned long, flags)
 504			__field(unsigned long, fmode)
 505			__field(dev_t, dev)
 506			__field(u64, dir)
 507			__string(name, ctx->dentry->d_name.name)
 508		),
 509
 510		TP_fast_assign(
 511			__entry->dev = dir->i_sb->s_dev;
 512			__entry->dir = NFS_FILEID(dir);
 513			__entry->flags = flags;
 514			__entry->fmode = (__force unsigned long)ctx->mode;
 515			__assign_str(name);
 516		),
 517
 518		TP_printk(
 519			"flags=0x%lx (%s) fmode=%s name=%02x:%02x:%llu/%s",
 520			__entry->flags,
 521			show_fs_fcntl_open_flags(__entry->flags),
 522			show_fs_fmode_flags(__entry->fmode),
 523			MAJOR(__entry->dev), MINOR(__entry->dev),
 524			(unsigned long long)__entry->dir,
 525			__get_str(name)
 526		)
 527);
 528
 529TRACE_EVENT(nfs_atomic_open_exit,
 530		TP_PROTO(
 531			const struct inode *dir,
 532			const struct nfs_open_context *ctx,
 533			unsigned int flags,
 534			int error
 535		),
 536
 537		TP_ARGS(dir, ctx, flags, error),
 538
 539		TP_STRUCT__entry(
 540			__field(unsigned long, error)
 541			__field(unsigned long, flags)
 542			__field(unsigned long, fmode)
 543			__field(dev_t, dev)
 544			__field(u64, dir)
 545			__string(name, ctx->dentry->d_name.name)
 546		),
 547
 548		TP_fast_assign(
 549			__entry->error = -error;
 550			__entry->dev = dir->i_sb->s_dev;
 551			__entry->dir = NFS_FILEID(dir);
 552			__entry->flags = flags;
 553			__entry->fmode = (__force unsigned long)ctx->mode;
 554			__assign_str(name);
 555		),
 556
 557		TP_printk(
 558			"error=%ld (%s) flags=0x%lx (%s) fmode=%s "
 559			"name=%02x:%02x:%llu/%s",
 560			-__entry->error, show_nfs_status(__entry->error),
 561			__entry->flags,
 562			show_fs_fcntl_open_flags(__entry->flags),
 563			show_fs_fmode_flags(__entry->fmode),
 564			MAJOR(__entry->dev), MINOR(__entry->dev),
 565			(unsigned long long)__entry->dir,
 566			__get_str(name)
 567		)
 568);
 569
 570TRACE_EVENT(nfs_create_enter,
 571		TP_PROTO(
 572			const struct inode *dir,
 573			const struct dentry *dentry,
 574			unsigned int flags
 575		),
 576
 577		TP_ARGS(dir, dentry, flags),
 578
 579		TP_STRUCT__entry(
 580			__field(unsigned long, flags)
 581			__field(dev_t, dev)
 582			__field(u64, dir)
 583			__string(name, dentry->d_name.name)
 584		),
 585
 586		TP_fast_assign(
 587			__entry->dev = dir->i_sb->s_dev;
 588			__entry->dir = NFS_FILEID(dir);
 589			__entry->flags = flags;
 590			__assign_str(name);
 591		),
 592
 593		TP_printk(
 594			"flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
 595			__entry->flags,
 596			show_fs_fcntl_open_flags(__entry->flags),
 597			MAJOR(__entry->dev), MINOR(__entry->dev),
 598			(unsigned long long)__entry->dir,
 599			__get_str(name)
 600		)
 601);
 602
 603TRACE_EVENT(nfs_create_exit,
 604		TP_PROTO(
 605			const struct inode *dir,
 606			const struct dentry *dentry,
 607			unsigned int flags,
 608			int error
 609		),
 610
 611		TP_ARGS(dir, dentry, flags, error),
 612
 613		TP_STRUCT__entry(
 614			__field(unsigned long, error)
 615			__field(unsigned long, flags)
 616			__field(dev_t, dev)
 617			__field(u64, dir)
 618			__string(name, dentry->d_name.name)
 619		),
 620
 621		TP_fast_assign(
 622			__entry->error = -error;
 623			__entry->dev = dir->i_sb->s_dev;
 624			__entry->dir = NFS_FILEID(dir);
 625			__entry->flags = flags;
 626			__assign_str(name);
 627		),
 628
 629		TP_printk(
 630			"error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
 631			-__entry->error, show_nfs_status(__entry->error),
 632			__entry->flags,
 633			show_fs_fcntl_open_flags(__entry->flags),
 634			MAJOR(__entry->dev), MINOR(__entry->dev),
 635			(unsigned long long)__entry->dir,
 636			__get_str(name)
 637		)
 638);
 639
 640DECLARE_EVENT_CLASS(nfs_directory_event,
 641		TP_PROTO(
 642			const struct inode *dir,
 643			const struct dentry *dentry
 644		),
 645
 646		TP_ARGS(dir, dentry),
 647
 648		TP_STRUCT__entry(
 649			__field(dev_t, dev)
 650			__field(u64, dir)
 651			__string(name, dentry->d_name.name)
 652		),
 653
 654		TP_fast_assign(
 655			__entry->dev = dir->i_sb->s_dev;
 656			__entry->dir = NFS_FILEID(dir);
 657			__assign_str(name);
 658		),
 659
 660		TP_printk(
 661			"name=%02x:%02x:%llu/%s",
 662			MAJOR(__entry->dev), MINOR(__entry->dev),
 663			(unsigned long long)__entry->dir,
 664			__get_str(name)
 665		)
 666);
 667
 668#define DEFINE_NFS_DIRECTORY_EVENT(name) \
 669	DEFINE_EVENT(nfs_directory_event, name, \
 670			TP_PROTO( \
 671				const struct inode *dir, \
 672				const struct dentry *dentry \
 673			), \
 674			TP_ARGS(dir, dentry))
 675
 676DECLARE_EVENT_CLASS(nfs_directory_event_done,
 677		TP_PROTO(
 678			const struct inode *dir,
 679			const struct dentry *dentry,
 680			int error
 681		),
 682
 683		TP_ARGS(dir, dentry, error),
 684
 685		TP_STRUCT__entry(
 686			__field(unsigned long, error)
 687			__field(dev_t, dev)
 688			__field(u64, dir)
 689			__string(name, dentry->d_name.name)
 690		),
 691
 692		TP_fast_assign(
 693			__entry->dev = dir->i_sb->s_dev;
 694			__entry->dir = NFS_FILEID(dir);
 695			__entry->error = error < 0 ? -error : 0;
 696			__assign_str(name);
 697		),
 698
 699		TP_printk(
 700			"error=%ld (%s) name=%02x:%02x:%llu/%s",
 701			-__entry->error, show_nfs_status(__entry->error),
 702			MAJOR(__entry->dev), MINOR(__entry->dev),
 703			(unsigned long long)__entry->dir,
 704			__get_str(name)
 705		)
 706);
 707
 708#define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \
 709	DEFINE_EVENT(nfs_directory_event_done, name, \
 710			TP_PROTO( \
 711				const struct inode *dir, \
 712				const struct dentry *dentry, \
 713				int error \
 714			), \
 715			TP_ARGS(dir, dentry, error))
 716
 717DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter);
 718DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit);
 719DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter);
 720DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit);
 721DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter);
 722DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit);
 723DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter);
 724DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit);
 725DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter);
 726DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit);
 727DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter);
 728DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit);
 729
 730TRACE_EVENT(nfs_link_enter,
 731		TP_PROTO(
 732			const struct inode *inode,
 733			const struct inode *dir,
 734			const struct dentry *dentry
 735		),
 736
 737		TP_ARGS(inode, dir, dentry),
 738
 739		TP_STRUCT__entry(
 740			__field(dev_t, dev)
 741			__field(u64, fileid)
 742			__field(u64, dir)
 743			__string(name, dentry->d_name.name)
 744		),
 745
 746		TP_fast_assign(
 747			__entry->dev = inode->i_sb->s_dev;
 748			__entry->fileid = NFS_FILEID(inode);
 749			__entry->dir = NFS_FILEID(dir);
 750			__assign_str(name);
 751		),
 752
 753		TP_printk(
 754			"fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
 755			MAJOR(__entry->dev), MINOR(__entry->dev),
 756			__entry->fileid,
 757			MAJOR(__entry->dev), MINOR(__entry->dev),
 758			(unsigned long long)__entry->dir,
 759			__get_str(name)
 760		)
 761);
 762
 763TRACE_EVENT(nfs_link_exit,
 764		TP_PROTO(
 765			const struct inode *inode,
 766			const struct inode *dir,
 767			const struct dentry *dentry,
 768			int error
 769		),
 770
 771		TP_ARGS(inode, dir, dentry, error),
 772
 773		TP_STRUCT__entry(
 774			__field(unsigned long, error)
 775			__field(dev_t, dev)
 776			__field(u64, fileid)
 777			__field(u64, dir)
 778			__string(name, dentry->d_name.name)
 779		),
 780
 781		TP_fast_assign(
 782			__entry->dev = inode->i_sb->s_dev;
 783			__entry->fileid = NFS_FILEID(inode);
 784			__entry->dir = NFS_FILEID(dir);
 785			__entry->error = error < 0 ? -error : 0;
 786			__assign_str(name);
 787		),
 788
 789		TP_printk(
 790			"error=%ld (%s) fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
 791			-__entry->error, show_nfs_status(__entry->error),
 792			MAJOR(__entry->dev), MINOR(__entry->dev),
 793			__entry->fileid,
 794			MAJOR(__entry->dev), MINOR(__entry->dev),
 795			(unsigned long long)__entry->dir,
 796			__get_str(name)
 797		)
 798);
 799
 800DECLARE_EVENT_CLASS(nfs_rename_event,
 801		TP_PROTO(
 802			const struct inode *old_dir,
 803			const struct dentry *old_dentry,
 804			const struct inode *new_dir,
 805			const struct dentry *new_dentry
 806		),
 807
 808		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry),
 809
 810		TP_STRUCT__entry(
 811			__field(dev_t, dev)
 812			__field(u64, old_dir)
 813			__field(u64, new_dir)
 814			__string(old_name, old_dentry->d_name.name)
 815			__string(new_name, new_dentry->d_name.name)
 816		),
 817
 818		TP_fast_assign(
 819			__entry->dev = old_dir->i_sb->s_dev;
 820			__entry->old_dir = NFS_FILEID(old_dir);
 821			__entry->new_dir = NFS_FILEID(new_dir);
 822			__assign_str(old_name);
 823			__assign_str(new_name);
 824		),
 825
 826		TP_printk(
 827			"old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s",
 828			MAJOR(__entry->dev), MINOR(__entry->dev),
 829			(unsigned long long)__entry->old_dir,
 830			__get_str(old_name),
 831			MAJOR(__entry->dev), MINOR(__entry->dev),
 832			(unsigned long long)__entry->new_dir,
 833			__get_str(new_name)
 834		)
 835);
 836#define DEFINE_NFS_RENAME_EVENT(name) \
 837	DEFINE_EVENT(nfs_rename_event, name, \
 838			TP_PROTO( \
 839				const struct inode *old_dir, \
 840				const struct dentry *old_dentry, \
 841				const struct inode *new_dir, \
 842				const struct dentry *new_dentry \
 843			), \
 844			TP_ARGS(old_dir, old_dentry, new_dir, new_dentry))
 845
 846DECLARE_EVENT_CLASS(nfs_rename_event_done,
 847		TP_PROTO(
 848			const struct inode *old_dir,
 849			const struct dentry *old_dentry,
 850			const struct inode *new_dir,
 851			const struct dentry *new_dentry,
 852			int error
 853		),
 854
 855		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, error),
 856
 857		TP_STRUCT__entry(
 858			__field(dev_t, dev)
 859			__field(unsigned long, error)
 860			__field(u64, old_dir)
 861			__string(old_name, old_dentry->d_name.name)
 862			__field(u64, new_dir)
 863			__string(new_name, new_dentry->d_name.name)
 864		),
 865
 866		TP_fast_assign(
 867			__entry->dev = old_dir->i_sb->s_dev;
 868			__entry->error = -error;
 869			__entry->old_dir = NFS_FILEID(old_dir);
 870			__entry->new_dir = NFS_FILEID(new_dir);
 871			__assign_str(old_name);
 872			__assign_str(new_name);
 873		),
 874
 875		TP_printk(
 876			"error=%ld (%s) old_name=%02x:%02x:%llu/%s "
 877			"new_name=%02x:%02x:%llu/%s",
 878			-__entry->error, show_nfs_status(__entry->error),
 879			MAJOR(__entry->dev), MINOR(__entry->dev),
 880			(unsigned long long)__entry->old_dir,
 881			__get_str(old_name),
 882			MAJOR(__entry->dev), MINOR(__entry->dev),
 883			(unsigned long long)__entry->new_dir,
 884			__get_str(new_name)
 885		)
 886);
 887#define DEFINE_NFS_RENAME_EVENT_DONE(name) \
 888	DEFINE_EVENT(nfs_rename_event_done, name, \
 889			TP_PROTO( \
 890				const struct inode *old_dir, \
 891				const struct dentry *old_dentry, \
 892				const struct inode *new_dir, \
 893				const struct dentry *new_dentry, \
 894				int error \
 895			), \
 896			TP_ARGS(old_dir, old_dentry, new_dir, \
 897				new_dentry, error))
 898
 899DEFINE_NFS_RENAME_EVENT(nfs_rename_enter);
 900DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit);
 901
 902DEFINE_NFS_RENAME_EVENT_DONE(nfs_async_rename_done);
 903
 904TRACE_EVENT(nfs_sillyrename_unlink,
 905		TP_PROTO(
 906			const struct nfs_unlinkdata *data,
 907			int error
 908		),
 909
 910		TP_ARGS(data, error),
 911
 912		TP_STRUCT__entry(
 913			__field(dev_t, dev)
 914			__field(unsigned long, error)
 915			__field(u64, dir)
 916			__dynamic_array(char, name, data->args.name.len + 1)
 917		),
 918
 919		TP_fast_assign(
 920			struct inode *dir = d_inode(data->dentry->d_parent);
 921			size_t len = data->args.name.len;
 922			__entry->dev = dir->i_sb->s_dev;
 923			__entry->dir = NFS_FILEID(dir);
 924			__entry->error = -error;
 925			memcpy(__get_str(name),
 926				data->args.name.name, len);
 927			__get_str(name)[len] = 0;
 928		),
 929
 930		TP_printk(
 931			"error=%ld (%s) name=%02x:%02x:%llu/%s",
 932			-__entry->error, show_nfs_status(__entry->error),
 933			MAJOR(__entry->dev), MINOR(__entry->dev),
 934			(unsigned long long)__entry->dir,
 935			__get_str(name)
 936		)
 937);
 938
 939DECLARE_EVENT_CLASS(nfs_folio_event,
 940		TP_PROTO(
 941			const struct inode *inode,
 942			loff_t offset,
 943			size_t count
 944		),
 945
 946		TP_ARGS(inode, offset, count),
 947
 948		TP_STRUCT__entry(
 
 
 949			__field(dev_t, dev)
 950			__field(u32, fhandle)
 951			__field(u64, fileid)
 952			__field(u64, version)
 953			__field(loff_t, offset)
 954			__field(size_t, count)
 955		),
 956
 957		TP_fast_assign(
 958			const struct nfs_inode *nfsi = NFS_I(inode);
 959
 960			__entry->dev = inode->i_sb->s_dev;
 961			__entry->fileid = nfsi->fileid;
 962			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
 963			__entry->version = inode_peek_iversion_raw(inode);
 964			__entry->offset = offset,
 965			__entry->count = count;
 966		),
 967
 968		TP_printk(
 969			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu "
 970			"offset=%lld count=%zu",
 971			MAJOR(__entry->dev), MINOR(__entry->dev),
 972			(unsigned long long)__entry->fileid,
 973			__entry->fhandle, __entry->version,
 974			__entry->offset, __entry->count
 975		)
 976);
 977
 978#define DEFINE_NFS_FOLIO_EVENT(name) \
 979	DEFINE_EVENT(nfs_folio_event, name, \
 980			TP_PROTO( \
 981				const struct inode *inode, \
 982				loff_t offset, \
 983				size_t count \
 984			), \
 985			TP_ARGS(inode, offset, count))
 986
 987DECLARE_EVENT_CLASS(nfs_folio_event_done,
 988		TP_PROTO(
 989			const struct inode *inode,
 990			loff_t offset,
 991			size_t count,
 992			int ret
 993		),
 994
 995		TP_ARGS(inode, offset, count, ret),
 996
 997		TP_STRUCT__entry(
 998			__field(dev_t, dev)
 999			__field(u32, fhandle)
1000			__field(int, ret)
1001			__field(u64, fileid)
1002			__field(u64, version)
1003			__field(loff_t, offset)
1004			__field(size_t, count)
1005		),
1006
1007		TP_fast_assign(
1008			const struct nfs_inode *nfsi = NFS_I(inode);
1009
1010			__entry->dev = inode->i_sb->s_dev;
1011			__entry->fileid = nfsi->fileid;
1012			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1013			__entry->version = inode_peek_iversion_raw(inode);
1014			__entry->offset = offset,
1015			__entry->count = count,
1016			__entry->ret = ret;
1017		),
1018
1019		TP_printk(
1020			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu "
1021			"offset=%lld count=%zu ret=%d",
1022			MAJOR(__entry->dev), MINOR(__entry->dev),
1023			(unsigned long long)__entry->fileid,
1024			__entry->fhandle, __entry->version,
1025			__entry->offset, __entry->count, __entry->ret
1026		)
1027);
1028
1029#define DEFINE_NFS_FOLIO_EVENT_DONE(name) \
1030	DEFINE_EVENT(nfs_folio_event_done, name, \
1031			TP_PROTO( \
1032				const struct inode *inode, \
1033				loff_t offset, \
1034				size_t count, \
1035				int ret \
1036			), \
1037			TP_ARGS(inode, offset, count, ret))
1038
1039DEFINE_NFS_FOLIO_EVENT(nfs_aop_readpage);
1040DEFINE_NFS_FOLIO_EVENT_DONE(nfs_aop_readpage_done);
1041
1042DEFINE_NFS_FOLIO_EVENT(nfs_writeback_folio);
1043DEFINE_NFS_FOLIO_EVENT_DONE(nfs_writeback_folio_done);
1044
1045DEFINE_NFS_FOLIO_EVENT(nfs_invalidate_folio);
1046DEFINE_NFS_FOLIO_EVENT_DONE(nfs_launder_folio_done);
1047
1048TRACE_EVENT(nfs_aop_readahead,
1049		TP_PROTO(
1050			const struct inode *inode,
1051			loff_t pos,
1052			unsigned int nr_pages
1053		),
1054
1055		TP_ARGS(inode, pos, nr_pages),
1056
1057		TP_STRUCT__entry(
1058			__field(dev_t, dev)
1059			__field(u32, fhandle)
1060			__field(u64, fileid)
1061			__field(u64, version)
1062			__field(loff_t, offset)
1063			__field(unsigned int, nr_pages)
1064		),
1065
1066		TP_fast_assign(
1067			const struct nfs_inode *nfsi = NFS_I(inode);
1068
1069			__entry->dev = inode->i_sb->s_dev;
1070			__entry->fileid = nfsi->fileid;
1071			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1072			__entry->version = inode_peek_iversion_raw(inode);
1073			__entry->offset = pos;
1074			__entry->nr_pages = nr_pages;
1075		),
1076
1077		TP_printk(
1078			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu offset=%lld nr_pages=%u",
1079			MAJOR(__entry->dev), MINOR(__entry->dev),
1080			(unsigned long long)__entry->fileid,
1081			__entry->fhandle, __entry->version,
1082			__entry->offset, __entry->nr_pages
1083		)
1084);
1085
1086TRACE_EVENT(nfs_aop_readahead_done,
1087		TP_PROTO(
1088			const struct inode *inode,
1089			unsigned int nr_pages,
1090			int ret
1091		),
1092
1093		TP_ARGS(inode, nr_pages, ret),
1094
1095		TP_STRUCT__entry(
1096			__field(dev_t, dev)
1097			__field(u32, fhandle)
1098			__field(int, ret)
1099			__field(u64, fileid)
1100			__field(u64, version)
1101			__field(loff_t, offset)
1102			__field(unsigned int, nr_pages)
1103		),
1104
1105		TP_fast_assign(
1106			const struct nfs_inode *nfsi = NFS_I(inode);
1107
1108			__entry->dev = inode->i_sb->s_dev;
1109			__entry->fileid = nfsi->fileid;
1110			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1111			__entry->version = inode_peek_iversion_raw(inode);
1112			__entry->nr_pages = nr_pages;
1113			__entry->ret = ret;
1114		),
1115
1116		TP_printk(
1117			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu nr_pages=%u ret=%d",
1118			MAJOR(__entry->dev), MINOR(__entry->dev),
1119			(unsigned long long)__entry->fileid,
1120			__entry->fhandle, __entry->version,
1121			__entry->nr_pages, __entry->ret
1122		)
1123);
1124
1125TRACE_EVENT(nfs_initiate_read,
1126		TP_PROTO(
1127			const struct nfs_pgio_header *hdr
1128		),
1129
1130		TP_ARGS(hdr),
1131
1132		TP_STRUCT__entry(
1133			__field(dev_t, dev)
1134			__field(u32, fhandle)
1135			__field(u64, fileid)
1136			__field(loff_t, offset)
1137			__field(u32, count)
1138		),
1139
1140		TP_fast_assign(
1141			const struct inode *inode = hdr->inode;
1142			const struct nfs_inode *nfsi = NFS_I(inode);
1143			const struct nfs_fh *fh = hdr->args.fh ?
1144						  hdr->args.fh : &nfsi->fh;
1145
1146			__entry->offset = hdr->args.offset;
1147			__entry->count = hdr->args.count;
1148			__entry->dev = inode->i_sb->s_dev;
1149			__entry->fileid = nfsi->fileid;
1150			__entry->fhandle = nfs_fhandle_hash(fh);
1151		),
1152
1153		TP_printk(
1154			"fileid=%02x:%02x:%llu fhandle=0x%08x "
1155			"offset=%lld count=%u",
1156			MAJOR(__entry->dev), MINOR(__entry->dev),
1157			(unsigned long long)__entry->fileid,
1158			__entry->fhandle,
1159			(long long)__entry->offset, __entry->count
1160		)
1161);
1162
1163TRACE_EVENT(nfs_readpage_done,
1164		TP_PROTO(
1165			const struct rpc_task *task,
1166			const struct nfs_pgio_header *hdr
1167		),
1168
1169		TP_ARGS(task, hdr),
1170
1171		TP_STRUCT__entry(
1172			__field(dev_t, dev)
1173			__field(u32, fhandle)
1174			__field(u64, fileid)
1175			__field(loff_t, offset)
1176			__field(u32, arg_count)
1177			__field(u32, res_count)
1178			__field(bool, eof)
1179			__field(int, error)
1180		),
1181
1182		TP_fast_assign(
1183			const struct inode *inode = hdr->inode;
1184			const struct nfs_inode *nfsi = NFS_I(inode);
1185			const struct nfs_fh *fh = hdr->args.fh ?
1186						  hdr->args.fh : &nfsi->fh;
1187
1188			__entry->error = task->tk_status;
1189			__entry->offset = hdr->args.offset;
1190			__entry->arg_count = hdr->args.count;
1191			__entry->res_count = hdr->res.count;
1192			__entry->eof = hdr->res.eof;
1193			__entry->dev = inode->i_sb->s_dev;
1194			__entry->fileid = nfsi->fileid;
1195			__entry->fhandle = nfs_fhandle_hash(fh);
1196		),
1197
1198		TP_printk(
1199			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
1200			"offset=%lld count=%u res=%u%s", __entry->error,
1201			MAJOR(__entry->dev), MINOR(__entry->dev),
1202			(unsigned long long)__entry->fileid,
1203			__entry->fhandle,
1204			(long long)__entry->offset, __entry->arg_count,
1205			__entry->res_count, __entry->eof ? " eof" : ""
1206		)
1207);
1208
1209TRACE_EVENT(nfs_readpage_short,
1210		TP_PROTO(
1211			const struct rpc_task *task,
1212			const struct nfs_pgio_header *hdr
1213		),
1214
1215		TP_ARGS(task, hdr),
1216
1217		TP_STRUCT__entry(
1218			__field(dev_t, dev)
1219			__field(u32, fhandle)
1220			__field(u64, fileid)
1221			__field(loff_t, offset)
1222			__field(u32, arg_count)
1223			__field(u32, res_count)
1224			__field(bool, eof)
1225			__field(int, error)
1226		),
1227
1228		TP_fast_assign(
1229			const struct inode *inode = hdr->inode;
1230			const struct nfs_inode *nfsi = NFS_I(inode);
1231			const struct nfs_fh *fh = hdr->args.fh ?
1232						  hdr->args.fh : &nfsi->fh;
1233
1234			__entry->error = task->tk_status;
1235			__entry->offset = hdr->args.offset;
1236			__entry->arg_count = hdr->args.count;
1237			__entry->res_count = hdr->res.count;
1238			__entry->eof = hdr->res.eof;
1239			__entry->dev = inode->i_sb->s_dev;
1240			__entry->fileid = nfsi->fileid;
1241			__entry->fhandle = nfs_fhandle_hash(fh);
1242		),
1243
1244		TP_printk(
1245			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
1246			"offset=%lld count=%u res=%u%s", __entry->error,
1247			MAJOR(__entry->dev), MINOR(__entry->dev),
1248			(unsigned long long)__entry->fileid,
1249			__entry->fhandle,
1250			(long long)__entry->offset, __entry->arg_count,
1251			__entry->res_count, __entry->eof ? " eof" : ""
1252		)
1253);
1254
 
 
 
1255
1256TRACE_EVENT(nfs_pgio_error,
1257	TP_PROTO(
1258		const struct nfs_pgio_header *hdr,
1259		int error,
1260		loff_t pos
1261	),
1262
1263	TP_ARGS(hdr, error, pos),
1264
1265	TP_STRUCT__entry(
1266		__field(dev_t, dev)
1267		__field(u32, fhandle)
1268		__field(u64, fileid)
1269		__field(loff_t, offset)
1270		__field(u32, arg_count)
1271		__field(u32, res_count)
1272		__field(loff_t, pos)
1273		__field(int, error)
1274	),
1275
1276	TP_fast_assign(
1277		const struct inode *inode = hdr->inode;
1278		const struct nfs_inode *nfsi = NFS_I(inode);
1279		const struct nfs_fh *fh = hdr->args.fh ?
1280					  hdr->args.fh : &nfsi->fh;
1281
1282		__entry->error = error;
1283		__entry->offset = hdr->args.offset;
1284		__entry->arg_count = hdr->args.count;
1285		__entry->res_count = hdr->res.count;
1286		__entry->dev = inode->i_sb->s_dev;
1287		__entry->fileid = nfsi->fileid;
1288		__entry->fhandle = nfs_fhandle_hash(fh);
1289	),
1290
1291	TP_printk("error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
1292		  "offset=%lld count=%u res=%u pos=%llu", __entry->error,
1293		MAJOR(__entry->dev), MINOR(__entry->dev),
1294		(unsigned long long)__entry->fileid, __entry->fhandle,
1295		(long long)__entry->offset, __entry->arg_count, __entry->res_count,
1296		__entry->pos
1297	)
1298);
1299
1300TRACE_EVENT(nfs_initiate_write,
1301		TP_PROTO(
1302			const struct nfs_pgio_header *hdr
 
 
1303		),
1304
1305		TP_ARGS(hdr),
1306
1307		TP_STRUCT__entry(
 
 
 
1308			__field(dev_t, dev)
1309			__field(u32, fhandle)
1310			__field(u64, fileid)
1311			__field(loff_t, offset)
1312			__field(u32, count)
1313			__field(unsigned long, stable)
1314		),
1315
1316		TP_fast_assign(
1317			const struct inode *inode = hdr->inode;
1318			const struct nfs_inode *nfsi = NFS_I(inode);
1319			const struct nfs_fh *fh = hdr->args.fh ?
1320						  hdr->args.fh : &nfsi->fh;
1321
1322			__entry->offset = hdr->args.offset;
1323			__entry->count = hdr->args.count;
1324			__entry->stable = hdr->args.stable;
1325			__entry->dev = inode->i_sb->s_dev;
1326			__entry->fileid = nfsi->fileid;
1327			__entry->fhandle = nfs_fhandle_hash(fh);
1328		),
1329
1330		TP_printk(
1331			"fileid=%02x:%02x:%llu fhandle=0x%08x "
1332			"offset=%lld count=%u stable=%s",
1333			MAJOR(__entry->dev), MINOR(__entry->dev),
1334			(unsigned long long)__entry->fileid,
1335			__entry->fhandle,
1336			(long long)__entry->offset, __entry->count,
1337			show_nfs_stable_how(__entry->stable)
1338		)
1339);
1340
1341TRACE_EVENT(nfs_writeback_done,
1342		TP_PROTO(
1343			const struct rpc_task *task,
1344			const struct nfs_pgio_header *hdr
 
 
1345		),
1346
1347		TP_ARGS(task, hdr),
1348
1349		TP_STRUCT__entry(
 
 
 
 
1350			__field(dev_t, dev)
1351			__field(u32, fhandle)
1352			__field(u64, fileid)
1353			__field(loff_t, offset)
1354			__field(u32, arg_count)
1355			__field(u32, res_count)
1356			__field(int, error)
1357			__field(unsigned long, stable)
1358			__array(char, verifier, NFS4_VERIFIER_SIZE)
1359		),
1360
1361		TP_fast_assign(
1362			const struct inode *inode = hdr->inode;
1363			const struct nfs_inode *nfsi = NFS_I(inode);
1364			const struct nfs_fh *fh = hdr->args.fh ?
1365						  hdr->args.fh : &nfsi->fh;
1366			const struct nfs_writeverf *verf = hdr->res.verf;
1367
1368			__entry->error = task->tk_status;
1369			__entry->offset = hdr->args.offset;
1370			__entry->arg_count = hdr->args.count;
1371			__entry->res_count = hdr->res.count;
1372			__entry->stable = verf->committed;
1373			memcpy(__entry->verifier,
1374				&verf->verifier,
1375				NFS4_VERIFIER_SIZE);
1376			__entry->dev = inode->i_sb->s_dev;
1377			__entry->fileid = nfsi->fileid;
1378			__entry->fhandle = nfs_fhandle_hash(fh);
1379		),
1380
1381		TP_printk(
1382			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
1383			"offset=%lld count=%u res=%u stable=%s "
1384			"verifier=%s", __entry->error,
1385			MAJOR(__entry->dev), MINOR(__entry->dev),
1386			(unsigned long long)__entry->fileid,
1387			__entry->fhandle,
1388			(long long)__entry->offset, __entry->arg_count,
1389			__entry->res_count,
1390			show_nfs_stable_how(__entry->stable),
1391			show_nfs4_verifier(__entry->verifier)
1392		)
1393);
1394
1395DECLARE_EVENT_CLASS(nfs_page_error_class,
1396		TP_PROTO(
1397			const struct inode *inode,
1398			const struct nfs_page *req,
1399			int error
1400		),
1401
1402		TP_ARGS(inode, req, error),
1403
1404		TP_STRUCT__entry(
1405			__field(dev_t, dev)
1406			__field(u32, fhandle)
1407			__field(u64, fileid)
1408			__field(loff_t, offset)
1409			__field(unsigned int, count)
1410			__field(int, error)
1411		),
1412
1413		TP_fast_assign(
1414			const struct nfs_inode *nfsi = NFS_I(inode);
1415			__entry->dev = inode->i_sb->s_dev;
1416			__entry->fileid = nfsi->fileid;
1417			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1418			__entry->offset = req_offset(req);
1419			__entry->count = req->wb_bytes;
1420			__entry->error = error;
1421		),
1422
1423		TP_printk(
1424			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
1425			"offset=%lld count=%u", __entry->error,
 
1426			MAJOR(__entry->dev), MINOR(__entry->dev),
1427			(unsigned long long)__entry->fileid,
1428			__entry->fhandle, __entry->offset,
1429			__entry->count
 
 
1430		)
1431);
1432
1433#define DEFINE_NFS_PAGEERR_EVENT(name) \
1434	DEFINE_EVENT(nfs_page_error_class, name, \
1435			TP_PROTO( \
1436				const struct inode *inode, \
1437				const struct nfs_page *req, \
1438				int error \
1439			), \
1440			TP_ARGS(inode, req, error))
1441
1442DEFINE_NFS_PAGEERR_EVENT(nfs_write_error);
1443DEFINE_NFS_PAGEERR_EVENT(nfs_comp_error);
1444DEFINE_NFS_PAGEERR_EVENT(nfs_commit_error);
1445
1446TRACE_EVENT(nfs_initiate_commit,
1447		TP_PROTO(
1448			const struct nfs_commit_data *data
1449		),
1450
1451		TP_ARGS(data),
1452
1453		TP_STRUCT__entry(
 
 
1454			__field(dev_t, dev)
1455			__field(u32, fhandle)
1456			__field(u64, fileid)
1457			__field(loff_t, offset)
1458			__field(u32, count)
1459		),
1460
1461		TP_fast_assign(
1462			const struct inode *inode = data->inode;
1463			const struct nfs_inode *nfsi = NFS_I(inode);
1464			const struct nfs_fh *fh = data->args.fh ?
1465						  data->args.fh : &nfsi->fh;
1466
1467			__entry->offset = data->args.offset;
1468			__entry->count = data->args.count;
1469			__entry->dev = inode->i_sb->s_dev;
1470			__entry->fileid = nfsi->fileid;
1471			__entry->fhandle = nfs_fhandle_hash(fh);
1472		),
1473
1474		TP_printk(
1475			"fileid=%02x:%02x:%llu fhandle=0x%08x "
1476			"offset=%lld count=%u",
1477			MAJOR(__entry->dev), MINOR(__entry->dev),
1478			(unsigned long long)__entry->fileid,
1479			__entry->fhandle,
1480			(long long)__entry->offset, __entry->count
1481		)
1482);
1483
1484TRACE_EVENT(nfs_commit_done,
1485		TP_PROTO(
1486			const struct rpc_task *task,
1487			const struct nfs_commit_data *data
1488		),
1489
1490		TP_ARGS(task, data),
1491
1492		TP_STRUCT__entry(
 
 
 
1493			__field(dev_t, dev)
1494			__field(u32, fhandle)
1495			__field(u64, fileid)
1496			__field(loff_t, offset)
1497			__field(int, error)
1498			__field(unsigned long, stable)
1499			__array(char, verifier, NFS4_VERIFIER_SIZE)
1500		),
1501
1502		TP_fast_assign(
1503			const struct inode *inode = data->inode;
1504			const struct nfs_inode *nfsi = NFS_I(inode);
1505			const struct nfs_fh *fh = data->args.fh ?
1506						  data->args.fh : &nfsi->fh;
1507			const struct nfs_writeverf *verf = data->res.verf;
1508
1509			__entry->error = task->tk_status;
1510			__entry->offset = data->args.offset;
1511			__entry->stable = verf->committed;
1512			memcpy(__entry->verifier,
1513				&verf->verifier,
1514				NFS4_VERIFIER_SIZE);
1515			__entry->dev = inode->i_sb->s_dev;
1516			__entry->fileid = nfsi->fileid;
1517			__entry->fhandle = nfs_fhandle_hash(fh);
1518		),
1519
1520		TP_printk(
1521			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
1522			"offset=%lld stable=%s verifier=%s", __entry->error,
1523			MAJOR(__entry->dev), MINOR(__entry->dev),
1524			(unsigned long long)__entry->fileid,
1525			__entry->fhandle,
1526			(long long)__entry->offset,
1527			show_nfs_stable_how(__entry->stable),
1528			show_nfs4_verifier(__entry->verifier)
1529		)
1530);
1531
1532#define nfs_show_direct_req_flags(v) \
1533	__print_flags(v, "|", \
1534			{ NFS_ODIRECT_DO_COMMIT, "DO_COMMIT" }, \
1535			{ NFS_ODIRECT_RESCHED_WRITES, "RESCHED_WRITES" }, \
1536			{ NFS_ODIRECT_SHOULD_DIRTY, "SHOULD DIRTY" }, \
1537			{ NFS_ODIRECT_DONE, "DONE" } )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1538
1539DECLARE_EVENT_CLASS(nfs_direct_req_class,
1540		TP_PROTO(
1541			const struct nfs_direct_req *dreq
1542		),
1543
1544		TP_ARGS(dreq),
1545
1546		TP_STRUCT__entry(
1547			__field(dev_t, dev)
1548			__field(u64, fileid)
1549			__field(u32, fhandle)
1550			__field(loff_t, offset)
1551			__field(ssize_t, count)
1552			__field(ssize_t, error)
1553			__field(int, flags)
1554		),
1555
1556		TP_fast_assign(
1557			const struct inode *inode = dreq->inode;
1558			const struct nfs_inode *nfsi = NFS_I(inode);
1559			const struct nfs_fh *fh = &nfsi->fh;
1560
1561			__entry->dev = inode->i_sb->s_dev;
1562			__entry->fileid = nfsi->fileid;
1563			__entry->fhandle = nfs_fhandle_hash(fh);
1564			__entry->offset = dreq->io_start;
1565			__entry->count = dreq->count;
1566			__entry->error = dreq->error;
1567			__entry->flags = dreq->flags;
1568		),
1569
1570		TP_printk(
1571			"error=%zd fileid=%02x:%02x:%llu fhandle=0x%08x "
1572			"offset=%lld count=%zd flags=%s",
1573			__entry->error, MAJOR(__entry->dev),
1574			MINOR(__entry->dev),
1575			(unsigned long long)__entry->fileid,
1576			__entry->fhandle, __entry->offset,
1577			__entry->count,
1578			nfs_show_direct_req_flags(__entry->flags)
1579		)
1580);
1581
1582#define DEFINE_NFS_DIRECT_REQ_EVENT(name) \
1583	DEFINE_EVENT(nfs_direct_req_class, name, \
1584			TP_PROTO( \
1585				const struct nfs_direct_req *dreq \
1586			), \
1587			TP_ARGS(dreq))
1588
1589DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_commit_complete);
1590DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_resched_write);
1591DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_complete);
1592DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_completion);
1593DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_schedule_iovec);
1594DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_reschedule_io);
1595
1596TRACE_EVENT(nfs_fh_to_dentry,
1597		TP_PROTO(
1598			const struct super_block *sb,
1599			const struct nfs_fh *fh,
1600			u64 fileid,
1601			int error
1602		),
1603
1604		TP_ARGS(sb, fh, fileid, error),
1605
1606		TP_STRUCT__entry(
1607			__field(int, error)
1608			__field(dev_t, dev)
1609			__field(u32, fhandle)
1610			__field(u64, fileid)
1611		),
1612
1613		TP_fast_assign(
1614			__entry->error = error;
1615			__entry->dev = sb->s_dev;
1616			__entry->fileid = fileid;
1617			__entry->fhandle = nfs_fhandle_hash(fh);
1618		),
1619
1620		TP_printk(
1621			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x ",
1622			__entry->error,
1623			MAJOR(__entry->dev), MINOR(__entry->dev),
1624			(unsigned long long)__entry->fileid,
1625			__entry->fhandle
1626		)
1627);
1628
1629TRACE_EVENT(nfs_mount_assign,
1630	TP_PROTO(
1631		const char *option,
1632		const char *value
1633	),
1634
1635	TP_ARGS(option, value),
1636
1637	TP_STRUCT__entry(
1638		__string(option, option)
1639		__string(value, value)
1640	),
1641
1642	TP_fast_assign(
1643		__assign_str(option);
1644		__assign_str(value);
1645	),
1646
1647	TP_printk("option %s=%s",
1648		__get_str(option), __get_str(value)
1649	)
1650);
1651
1652TRACE_EVENT(nfs_mount_option,
1653	TP_PROTO(
1654		const struct fs_parameter *param
1655	),
1656
1657	TP_ARGS(param),
1658
1659	TP_STRUCT__entry(
1660		__string(option, param->key)
1661	),
1662
1663	TP_fast_assign(
1664		__assign_str(option);
1665	),
1666
1667	TP_printk("option %s", __get_str(option))
1668);
1669
1670TRACE_EVENT(nfs_mount_path,
1671	TP_PROTO(
1672		const char *path
1673	),
1674
1675	TP_ARGS(path),
1676
1677	TP_STRUCT__entry(
1678		__string(path, path)
1679	),
1680
1681	TP_fast_assign(
1682		__assign_str(path);
1683	),
1684
1685	TP_printk("path='%s'", __get_str(path))
1686);
1687
1688TRACE_EVENT(nfs_local_open_fh,
1689		TP_PROTO(
1690			const struct nfs_fh *fh,
1691			fmode_t fmode,
1692			int error
1693		),
1694
1695		TP_ARGS(fh, fmode, error),
1696
1697		TP_STRUCT__entry(
1698			__field(int, error)
1699			__field(u32, fhandle)
1700			__field(unsigned int, fmode)
1701		),
1702
1703		TP_fast_assign(
1704			__entry->error = error;
1705			__entry->fhandle = nfs_fhandle_hash(fh);
1706			__entry->fmode = (__force unsigned int)fmode;
1707		),
1708
1709		TP_printk(
1710			"error=%d fhandle=0x%08x mode=%s",
1711			__entry->error,
1712			__entry->fhandle,
1713			show_fs_fmode_flags(__entry->fmode)
1714		)
1715);
1716
1717DECLARE_EVENT_CLASS(nfs_local_client_event,
1718		TP_PROTO(
1719			const struct nfs_client *clp
1720		),
1721
1722		TP_ARGS(clp),
1723
1724		TP_STRUCT__entry(
1725			__field(unsigned int, protocol)
1726			__string(server, clp->cl_hostname)
1727		),
1728
1729		TP_fast_assign(
1730			__entry->protocol = clp->rpc_ops->version;
1731			__assign_str(server);
1732		),
1733
1734		TP_printk(
1735			"server=%s NFSv%u", __get_str(server), __entry->protocol
1736		)
1737);
1738
1739#define DEFINE_NFS_LOCAL_CLIENT_EVENT(name) \
1740	DEFINE_EVENT(nfs_local_client_event, name, \
1741			TP_PROTO( \
1742				const struct nfs_client *clp \
1743			), \
1744			TP_ARGS(clp))
1745
1746DEFINE_NFS_LOCAL_CLIENT_EVENT(nfs_local_enable);
1747DEFINE_NFS_LOCAL_CLIENT_EVENT(nfs_local_disable);
1748
1749DECLARE_EVENT_CLASS(nfs_xdr_event,
1750		TP_PROTO(
1751			const struct xdr_stream *xdr,
1752			int error
1753		),
1754
1755		TP_ARGS(xdr, error),
1756
1757		TP_STRUCT__entry(
1758			__field(unsigned int, task_id)
1759			__field(unsigned int, client_id)
1760			__field(u32, xid)
1761			__field(int, version)
1762			__field(unsigned long, error)
1763			__string(program,
1764				 xdr->rqst->rq_task->tk_client->cl_program->name)
1765			__string(procedure,
1766				 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
1767		),
1768
1769		TP_fast_assign(
1770			const struct rpc_rqst *rqstp = xdr->rqst;
1771			const struct rpc_task *task = rqstp->rq_task;
1772
1773			__entry->task_id = task->tk_pid;
1774			__entry->client_id = task->tk_client->cl_clid;
1775			__entry->xid = be32_to_cpu(rqstp->rq_xid);
1776			__entry->version = task->tk_client->cl_vers;
1777			__entry->error = error;
1778			__assign_str(program);
1779			__assign_str(procedure);
1780		),
1781
1782		TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
1783			  " xid=0x%08x %sv%d %s error=%ld (%s)",
1784			__entry->task_id, __entry->client_id, __entry->xid,
1785			__get_str(program), __entry->version,
1786			__get_str(procedure), -__entry->error,
1787			show_nfs_status(__entry->error)
1788		)
1789);
1790#define DEFINE_NFS_XDR_EVENT(name) \
1791	DEFINE_EVENT(nfs_xdr_event, name, \
1792			TP_PROTO( \
1793				const struct xdr_stream *xdr, \
1794				int error \
1795			), \
1796			TP_ARGS(xdr, error))
1797DEFINE_NFS_XDR_EVENT(nfs_xdr_status);
1798DEFINE_NFS_XDR_EVENT(nfs_xdr_bad_filehandle);
1799
1800#endif /* _TRACE_NFS_H */
1801
1802#undef TRACE_INCLUDE_PATH
1803#define TRACE_INCLUDE_PATH .
1804#define TRACE_INCLUDE_FILE nfstrace
1805/* This part must be outside protection */
1806#include <trace/define_trace.h>