cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

nfs4trace.h (68801B)


      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 nfs4
      7
      8#if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
      9#define _TRACE_NFS4_H
     10
     11#include <linux/tracepoint.h>
     12#include <trace/events/sunrpc_base.h>
     13
     14#include <trace/events/fs.h>
     15#include <trace/events/nfs.h>
     16
     17#define show_nfs_fattr_flags(valid) \
     18	__print_flags((unsigned long)valid, "|", \
     19		{ NFS_ATTR_FATTR_TYPE, "TYPE" }, \
     20		{ NFS_ATTR_FATTR_MODE, "MODE" }, \
     21		{ NFS_ATTR_FATTR_NLINK, "NLINK" }, \
     22		{ NFS_ATTR_FATTR_OWNER, "OWNER" }, \
     23		{ NFS_ATTR_FATTR_GROUP, "GROUP" }, \
     24		{ NFS_ATTR_FATTR_RDEV, "RDEV" }, \
     25		{ NFS_ATTR_FATTR_SIZE, "SIZE" }, \
     26		{ NFS_ATTR_FATTR_FSID, "FSID" }, \
     27		{ NFS_ATTR_FATTR_FILEID, "FILEID" }, \
     28		{ NFS_ATTR_FATTR_ATIME, "ATIME" }, \
     29		{ NFS_ATTR_FATTR_MTIME, "MTIME" }, \
     30		{ NFS_ATTR_FATTR_CTIME, "CTIME" }, \
     31		{ NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
     32		{ NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
     33		{ NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
     34
     35DECLARE_EVENT_CLASS(nfs4_clientid_event,
     36		TP_PROTO(
     37			const struct nfs_client *clp,
     38			int error
     39		),
     40
     41		TP_ARGS(clp, error),
     42
     43		TP_STRUCT__entry(
     44			__string(dstaddr, clp->cl_hostname)
     45			__field(unsigned long, error)
     46		),
     47
     48		TP_fast_assign(
     49			__entry->error = error < 0 ? -error : 0;
     50			__assign_str(dstaddr, clp->cl_hostname);
     51		),
     52
     53		TP_printk(
     54			"error=%ld (%s) dstaddr=%s",
     55			-__entry->error,
     56			show_nfs4_status(__entry->error),
     57			__get_str(dstaddr)
     58		)
     59);
     60#define DEFINE_NFS4_CLIENTID_EVENT(name) \
     61	DEFINE_EVENT(nfs4_clientid_event, name,	 \
     62			TP_PROTO( \
     63				const struct nfs_client *clp, \
     64				int error \
     65			), \
     66			TP_ARGS(clp, error))
     67DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
     68DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
     69DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
     70DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
     71#ifdef CONFIG_NFS_V4_1
     72DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
     73DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
     74DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
     75DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
     76DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
     77DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
     78DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
     79
     80TRACE_EVENT(nfs4_sequence_done,
     81		TP_PROTO(
     82			const struct nfs4_session *session,
     83			const struct nfs4_sequence_res *res
     84		),
     85		TP_ARGS(session, res),
     86
     87		TP_STRUCT__entry(
     88			__field(unsigned int, session)
     89			__field(unsigned int, slot_nr)
     90			__field(unsigned int, seq_nr)
     91			__field(unsigned int, highest_slotid)
     92			__field(unsigned int, target_highest_slotid)
     93			__field(unsigned long, status_flags)
     94			__field(unsigned long, error)
     95		),
     96
     97		TP_fast_assign(
     98			const struct nfs4_slot *sr_slot = res->sr_slot;
     99			__entry->session = nfs_session_id_hash(&session->sess_id);
    100			__entry->slot_nr = sr_slot->slot_nr;
    101			__entry->seq_nr = sr_slot->seq_nr;
    102			__entry->highest_slotid = res->sr_highest_slotid;
    103			__entry->target_highest_slotid =
    104					res->sr_target_highest_slotid;
    105			__entry->status_flags = res->sr_status_flags;
    106			__entry->error = res->sr_status < 0 ?
    107					-res->sr_status : 0;
    108		),
    109		TP_printk(
    110			"error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
    111			"highest_slotid=%u target_highest_slotid=%u "
    112			"status_flags=0x%lx (%s)",
    113			-__entry->error,
    114			show_nfs4_status(__entry->error),
    115			__entry->session,
    116			__entry->slot_nr,
    117			__entry->seq_nr,
    118			__entry->highest_slotid,
    119			__entry->target_highest_slotid,
    120			__entry->status_flags,
    121			show_nfs4_seq4_status(__entry->status_flags)
    122		)
    123);
    124
    125struct cb_sequenceargs;
    126struct cb_sequenceres;
    127
    128TRACE_EVENT(nfs4_cb_sequence,
    129		TP_PROTO(
    130			const struct cb_sequenceargs *args,
    131			const struct cb_sequenceres *res,
    132			__be32 status
    133		),
    134		TP_ARGS(args, res, status),
    135
    136		TP_STRUCT__entry(
    137			__field(unsigned int, session)
    138			__field(unsigned int, slot_nr)
    139			__field(unsigned int, seq_nr)
    140			__field(unsigned int, highest_slotid)
    141			__field(unsigned int, cachethis)
    142			__field(unsigned long, error)
    143		),
    144
    145		TP_fast_assign(
    146			__entry->session = nfs_session_id_hash(&args->csa_sessionid);
    147			__entry->slot_nr = args->csa_slotid;
    148			__entry->seq_nr = args->csa_sequenceid;
    149			__entry->highest_slotid = args->csa_highestslotid;
    150			__entry->cachethis = args->csa_cachethis;
    151			__entry->error = be32_to_cpu(status);
    152		),
    153
    154		TP_printk(
    155			"error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
    156			"highest_slotid=%u",
    157			-__entry->error,
    158			show_nfs4_status(__entry->error),
    159			__entry->session,
    160			__entry->slot_nr,
    161			__entry->seq_nr,
    162			__entry->highest_slotid
    163		)
    164);
    165
    166TRACE_EVENT(nfs4_cb_seqid_err,
    167		TP_PROTO(
    168			const struct cb_sequenceargs *args,
    169			__be32 status
    170		),
    171		TP_ARGS(args, status),
    172
    173		TP_STRUCT__entry(
    174			__field(unsigned int, session)
    175			__field(unsigned int, slot_nr)
    176			__field(unsigned int, seq_nr)
    177			__field(unsigned int, highest_slotid)
    178			__field(unsigned int, cachethis)
    179			__field(unsigned long, error)
    180		),
    181
    182		TP_fast_assign(
    183			__entry->session = nfs_session_id_hash(&args->csa_sessionid);
    184			__entry->slot_nr = args->csa_slotid;
    185			__entry->seq_nr = args->csa_sequenceid;
    186			__entry->highest_slotid = args->csa_highestslotid;
    187			__entry->cachethis = args->csa_cachethis;
    188			__entry->error = be32_to_cpu(status);
    189		),
    190
    191		TP_printk(
    192			"error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
    193			"highest_slotid=%u",
    194			-__entry->error,
    195			show_nfs4_status(__entry->error),
    196			__entry->session,
    197			__entry->slot_nr,
    198			__entry->seq_nr,
    199			__entry->highest_slotid
    200		)
    201);
    202
    203TRACE_EVENT(nfs4_cb_offload,
    204		TP_PROTO(
    205			const struct nfs_fh *cb_fh,
    206			const nfs4_stateid *cb_stateid,
    207			uint64_t cb_count,
    208			int cb_error,
    209			int cb_how_stable
    210		),
    211
    212		TP_ARGS(cb_fh, cb_stateid, cb_count, cb_error,
    213			cb_how_stable),
    214
    215		TP_STRUCT__entry(
    216			__field(unsigned long, error)
    217			__field(u32, fhandle)
    218			__field(loff_t, cb_count)
    219			__field(int, cb_how)
    220			__field(int, cb_stateid_seq)
    221			__field(u32, cb_stateid_hash)
    222		),
    223
    224		TP_fast_assign(
    225			__entry->error = cb_error < 0 ? -cb_error : 0;
    226			__entry->fhandle = nfs_fhandle_hash(cb_fh);
    227			__entry->cb_stateid_seq =
    228				be32_to_cpu(cb_stateid->seqid);
    229			__entry->cb_stateid_hash =
    230				nfs_stateid_hash(cb_stateid);
    231			__entry->cb_count = cb_count;
    232			__entry->cb_how = cb_how_stable;
    233		),
    234
    235		TP_printk(
    236			"error=%ld (%s) fhandle=0x%08x cb_stateid=%d:0x%08x "
    237			"cb_count=%llu cb_how=%s",
    238			-__entry->error,
    239			show_nfs4_status(__entry->error),
    240			__entry->fhandle,
    241			__entry->cb_stateid_seq, __entry->cb_stateid_hash,
    242			__entry->cb_count,
    243			show_nfs_stable_how(__entry->cb_how)
    244		)
    245);
    246#endif /* CONFIG_NFS_V4_1 */
    247
    248TRACE_EVENT(nfs4_setup_sequence,
    249		TP_PROTO(
    250			const struct nfs4_session *session,
    251			const struct nfs4_sequence_args *args
    252		),
    253		TP_ARGS(session, args),
    254
    255		TP_STRUCT__entry(
    256			__field(unsigned int, session)
    257			__field(unsigned int, slot_nr)
    258			__field(unsigned int, seq_nr)
    259			__field(unsigned int, highest_used_slotid)
    260		),
    261
    262		TP_fast_assign(
    263			const struct nfs4_slot *sa_slot = args->sa_slot;
    264			__entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
    265			__entry->slot_nr = sa_slot->slot_nr;
    266			__entry->seq_nr = sa_slot->seq_nr;
    267			__entry->highest_used_slotid =
    268					sa_slot->table->highest_used_slotid;
    269		),
    270		TP_printk(
    271			"session=0x%08x slot_nr=%u seq_nr=%u "
    272			"highest_used_slotid=%u",
    273			__entry->session,
    274			__entry->slot_nr,
    275			__entry->seq_nr,
    276			__entry->highest_used_slotid
    277		)
    278);
    279
    280TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_RUNNING);
    281TRACE_DEFINE_ENUM(NFS4CLNT_CHECK_LEASE);
    282TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_EXPIRED);
    283TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_REBOOT);
    284TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_NOGRACE);
    285TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN);
    286TRACE_DEFINE_ENUM(NFS4CLNT_SESSION_RESET);
    287TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_CONFIRM);
    288TRACE_DEFINE_ENUM(NFS4CLNT_SERVER_SCOPE_MISMATCH);
    289TRACE_DEFINE_ENUM(NFS4CLNT_PURGE_STATE);
    290TRACE_DEFINE_ENUM(NFS4CLNT_BIND_CONN_TO_SESSION);
    291TRACE_DEFINE_ENUM(NFS4CLNT_MOVED);
    292TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_MOVED);
    293TRACE_DEFINE_ENUM(NFS4CLNT_DELEGATION_EXPIRED);
    294TRACE_DEFINE_ENUM(NFS4CLNT_RUN_MANAGER);
    295TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_RUNNING);
    296TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_READ);
    297TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_RW);
    298
    299#define show_nfs4_clp_state(state) \
    300	__print_flags(state, "|", \
    301		{ NFS4CLNT_MANAGER_RUNNING,	"MANAGER_RUNNING" }, \
    302		{ NFS4CLNT_CHECK_LEASE,		"CHECK_LEASE" }, \
    303		{ NFS4CLNT_LEASE_EXPIRED,	"LEASE_EXPIRED" }, \
    304		{ NFS4CLNT_RECLAIM_REBOOT,	"RECLAIM_REBOOT" }, \
    305		{ NFS4CLNT_RECLAIM_NOGRACE,	"RECLAIM_NOGRACE" }, \
    306		{ NFS4CLNT_DELEGRETURN,		"DELEGRETURN" }, \
    307		{ NFS4CLNT_SESSION_RESET,	"SESSION_RESET" }, \
    308		{ NFS4CLNT_LEASE_CONFIRM,	"LEASE_CONFIRM" }, \
    309		{ NFS4CLNT_SERVER_SCOPE_MISMATCH, \
    310						"SERVER_SCOPE_MISMATCH" }, \
    311		{ NFS4CLNT_PURGE_STATE,		"PURGE_STATE" }, \
    312		{ NFS4CLNT_BIND_CONN_TO_SESSION, \
    313						"BIND_CONN_TO_SESSION" }, \
    314		{ NFS4CLNT_MOVED,		"MOVED" }, \
    315		{ NFS4CLNT_LEASE_MOVED,		"LEASE_MOVED" }, \
    316		{ NFS4CLNT_DELEGATION_EXPIRED,	"DELEGATION_EXPIRED" }, \
    317		{ NFS4CLNT_RUN_MANAGER,		"RUN_MANAGER" }, \
    318		{ NFS4CLNT_RECALL_RUNNING,	"RECALL_RUNNING" }, \
    319		{ NFS4CLNT_RECALL_ANY_LAYOUT_READ, "RECALL_ANY_LAYOUT_READ" }, \
    320		{ NFS4CLNT_RECALL_ANY_LAYOUT_RW, "RECALL_ANY_LAYOUT_RW" })
    321
    322TRACE_EVENT(nfs4_state_mgr,
    323		TP_PROTO(
    324			const struct nfs_client *clp
    325		),
    326
    327		TP_ARGS(clp),
    328
    329		TP_STRUCT__entry(
    330			__field(unsigned long, state)
    331			__string(hostname, clp->cl_hostname)
    332		),
    333
    334		TP_fast_assign(
    335			__entry->state = clp->cl_state;
    336			__assign_str(hostname, clp->cl_hostname);
    337		),
    338
    339		TP_printk(
    340			"hostname=%s clp state=%s", __get_str(hostname),
    341			show_nfs4_clp_state(__entry->state)
    342		)
    343)
    344
    345TRACE_EVENT(nfs4_state_mgr_failed,
    346		TP_PROTO(
    347			const struct nfs_client *clp,
    348			const char *section,
    349			int status
    350		),
    351
    352		TP_ARGS(clp, section, status),
    353
    354		TP_STRUCT__entry(
    355			__field(unsigned long, error)
    356			__field(unsigned long, state)
    357			__string(hostname, clp->cl_hostname)
    358			__string(section, section)
    359		),
    360
    361		TP_fast_assign(
    362			__entry->error = status < 0 ? -status : 0;
    363			__entry->state = clp->cl_state;
    364			__assign_str(hostname, clp->cl_hostname);
    365			__assign_str(section, section);
    366		),
    367
    368		TP_printk(
    369			"hostname=%s clp state=%s error=%ld (%s) section=%s",
    370			__get_str(hostname),
    371			show_nfs4_clp_state(__entry->state), -__entry->error,
    372			show_nfs4_status(__entry->error), __get_str(section)
    373
    374		)
    375)
    376
    377TRACE_EVENT(nfs4_xdr_bad_operation,
    378		TP_PROTO(
    379			const struct xdr_stream *xdr,
    380			u32 op,
    381			u32 expected
    382		),
    383
    384		TP_ARGS(xdr, op, expected),
    385
    386		TP_STRUCT__entry(
    387			__field(unsigned int, task_id)
    388			__field(unsigned int, client_id)
    389			__field(u32, xid)
    390			__field(u32, op)
    391			__field(u32, expected)
    392		),
    393
    394		TP_fast_assign(
    395			const struct rpc_rqst *rqstp = xdr->rqst;
    396			const struct rpc_task *task = rqstp->rq_task;
    397
    398			__entry->task_id = task->tk_pid;
    399			__entry->client_id = task->tk_client->cl_clid;
    400			__entry->xid = be32_to_cpu(rqstp->rq_xid);
    401			__entry->op = op;
    402			__entry->expected = expected;
    403		),
    404
    405		TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
    406			  " xid=0x%08x operation=%u, expected=%u",
    407			__entry->task_id, __entry->client_id, __entry->xid,
    408			__entry->op, __entry->expected
    409		)
    410);
    411
    412DECLARE_EVENT_CLASS(nfs4_xdr_event,
    413		TP_PROTO(
    414			const struct xdr_stream *xdr,
    415			u32 op,
    416			u32 error
    417		),
    418
    419		TP_ARGS(xdr, op, error),
    420
    421		TP_STRUCT__entry(
    422			__field(unsigned int, task_id)
    423			__field(unsigned int, client_id)
    424			__field(u32, xid)
    425			__field(u32, op)
    426			__field(unsigned long, error)
    427		),
    428
    429		TP_fast_assign(
    430			const struct rpc_rqst *rqstp = xdr->rqst;
    431			const struct rpc_task *task = rqstp->rq_task;
    432
    433			__entry->task_id = task->tk_pid;
    434			__entry->client_id = task->tk_client->cl_clid;
    435			__entry->xid = be32_to_cpu(rqstp->rq_xid);
    436			__entry->op = op;
    437			__entry->error = error;
    438		),
    439
    440		TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
    441			  " xid=0x%08x error=%ld (%s) operation=%u",
    442			__entry->task_id, __entry->client_id, __entry->xid,
    443			-__entry->error, show_nfs4_status(__entry->error),
    444			__entry->op
    445		)
    446);
    447#define DEFINE_NFS4_XDR_EVENT(name) \
    448	DEFINE_EVENT(nfs4_xdr_event, name, \
    449			TP_PROTO( \
    450				const struct xdr_stream *xdr, \
    451				u32 op, \
    452				u32 error \
    453			), \
    454			TP_ARGS(xdr, op, error))
    455DEFINE_NFS4_XDR_EVENT(nfs4_xdr_status);
    456DEFINE_NFS4_XDR_EVENT(nfs4_xdr_bad_filehandle);
    457
    458DECLARE_EVENT_CLASS(nfs4_cb_error_class,
    459		TP_PROTO(
    460			__be32 xid,
    461			u32 cb_ident
    462		),
    463
    464		TP_ARGS(xid, cb_ident),
    465
    466		TP_STRUCT__entry(
    467			__field(u32, xid)
    468			__field(u32, cbident)
    469		),
    470
    471		TP_fast_assign(
    472			__entry->xid = be32_to_cpu(xid);
    473			__entry->cbident = cb_ident;
    474		),
    475
    476		TP_printk(
    477			"xid=0x%08x cb_ident=0x%08x",
    478			__entry->xid, __entry->cbident
    479		)
    480);
    481
    482#define DEFINE_CB_ERROR_EVENT(name) \
    483	DEFINE_EVENT(nfs4_cb_error_class, nfs_cb_##name, \
    484			TP_PROTO( \
    485				__be32 xid, \
    486				u32 cb_ident \
    487			), \
    488			TP_ARGS(xid, cb_ident))
    489
    490DEFINE_CB_ERROR_EVENT(no_clp);
    491DEFINE_CB_ERROR_EVENT(badprinc);
    492
    493DECLARE_EVENT_CLASS(nfs4_open_event,
    494		TP_PROTO(
    495			const struct nfs_open_context *ctx,
    496			int flags,
    497			int error
    498		),
    499
    500		TP_ARGS(ctx, flags, error),
    501
    502		TP_STRUCT__entry(
    503			__field(unsigned long, error)
    504			__field(unsigned long, flags)
    505			__field(unsigned long, fmode)
    506			__field(dev_t, dev)
    507			__field(u32, fhandle)
    508			__field(u64, fileid)
    509			__field(u64, dir)
    510			__string(name, ctx->dentry->d_name.name)
    511			__field(int, stateid_seq)
    512			__field(u32, stateid_hash)
    513			__field(int, openstateid_seq)
    514			__field(u32, openstateid_hash)
    515		),
    516
    517		TP_fast_assign(
    518			const struct nfs4_state *state = ctx->state;
    519			const struct inode *inode = NULL;
    520
    521			__entry->error = -error;
    522			__entry->flags = flags;
    523			__entry->fmode = (__force unsigned long)ctx->mode;
    524			__entry->dev = ctx->dentry->d_sb->s_dev;
    525			if (!IS_ERR_OR_NULL(state)) {
    526				inode = state->inode;
    527				__entry->stateid_seq =
    528					be32_to_cpu(state->stateid.seqid);
    529				__entry->stateid_hash =
    530					nfs_stateid_hash(&state->stateid);
    531				__entry->openstateid_seq =
    532					be32_to_cpu(state->open_stateid.seqid);
    533				__entry->openstateid_hash =
    534					nfs_stateid_hash(&state->open_stateid);
    535			} else {
    536				__entry->stateid_seq = 0;
    537				__entry->stateid_hash = 0;
    538				__entry->openstateid_seq = 0;
    539				__entry->openstateid_hash = 0;
    540			}
    541			if (inode != NULL) {
    542				__entry->fileid = NFS_FILEID(inode);
    543				__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
    544			} else {
    545				__entry->fileid = 0;
    546				__entry->fhandle = 0;
    547			}
    548			__entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
    549			__assign_str(name, ctx->dentry->d_name.name);
    550		),
    551
    552		TP_printk(
    553			"error=%ld (%s) flags=%lu (%s) fmode=%s "
    554			"fileid=%02x:%02x:%llu fhandle=0x%08x "
    555			"name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
    556			"openstateid=%d:0x%08x",
    557			 -__entry->error,
    558			 show_nfs4_status(__entry->error),
    559			 __entry->flags,
    560			 show_fs_fcntl_open_flags(__entry->flags),
    561			 show_fs_fmode_flags(__entry->fmode),
    562			 MAJOR(__entry->dev), MINOR(__entry->dev),
    563			 (unsigned long long)__entry->fileid,
    564			 __entry->fhandle,
    565			 MAJOR(__entry->dev), MINOR(__entry->dev),
    566			 (unsigned long long)__entry->dir,
    567			 __get_str(name),
    568			 __entry->stateid_seq, __entry->stateid_hash,
    569			 __entry->openstateid_seq, __entry->openstateid_hash
    570		)
    571);
    572
    573#define DEFINE_NFS4_OPEN_EVENT(name) \
    574	DEFINE_EVENT(nfs4_open_event, name, \
    575			TP_PROTO( \
    576				const struct nfs_open_context *ctx, \
    577				int flags, \
    578				int error \
    579			), \
    580			TP_ARGS(ctx, flags, error))
    581DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
    582DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
    583DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
    584
    585TRACE_EVENT(nfs4_cached_open,
    586		TP_PROTO(
    587			const struct nfs4_state *state
    588		),
    589		TP_ARGS(state),
    590		TP_STRUCT__entry(
    591			__field(dev_t, dev)
    592			__field(u32, fhandle)
    593			__field(u64, fileid)
    594			__field(unsigned int, fmode)
    595			__field(int, stateid_seq)
    596			__field(u32, stateid_hash)
    597		),
    598
    599		TP_fast_assign(
    600			const struct inode *inode = state->inode;
    601
    602			__entry->dev = inode->i_sb->s_dev;
    603			__entry->fileid = NFS_FILEID(inode);
    604			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
    605			__entry->fmode = (__force unsigned int)state->state;
    606			__entry->stateid_seq =
    607				be32_to_cpu(state->stateid.seqid);
    608			__entry->stateid_hash =
    609				nfs_stateid_hash(&state->stateid);
    610		),
    611
    612		TP_printk(
    613			"fmode=%s fileid=%02x:%02x:%llu "
    614			"fhandle=0x%08x stateid=%d:0x%08x",
    615			__entry->fmode ?  show_fs_fmode_flags(__entry->fmode) :
    616					  "closed",
    617			MAJOR(__entry->dev), MINOR(__entry->dev),
    618			(unsigned long long)__entry->fileid,
    619			__entry->fhandle,
    620			__entry->stateid_seq, __entry->stateid_hash
    621		)
    622);
    623
    624TRACE_EVENT(nfs4_close,
    625		TP_PROTO(
    626			const struct nfs4_state *state,
    627			const struct nfs_closeargs *args,
    628			const struct nfs_closeres *res,
    629			int error
    630		),
    631
    632		TP_ARGS(state, args, res, error),
    633
    634		TP_STRUCT__entry(
    635			__field(dev_t, dev)
    636			__field(u32, fhandle)
    637			__field(u64, fileid)
    638			__field(unsigned int, fmode)
    639			__field(unsigned long, error)
    640			__field(int, stateid_seq)
    641			__field(u32, stateid_hash)
    642		),
    643
    644		TP_fast_assign(
    645			const struct inode *inode = state->inode;
    646
    647			__entry->dev = inode->i_sb->s_dev;
    648			__entry->fileid = NFS_FILEID(inode);
    649			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
    650			__entry->fmode = (__force unsigned int)state->state;
    651			__entry->error = error < 0 ? -error : 0;
    652			__entry->stateid_seq =
    653				be32_to_cpu(args->stateid.seqid);
    654			__entry->stateid_hash =
    655				nfs_stateid_hash(&args->stateid);
    656		),
    657
    658		TP_printk(
    659			"error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu "
    660			"fhandle=0x%08x openstateid=%d:0x%08x",
    661			-__entry->error,
    662			show_nfs4_status(__entry->error),
    663			__entry->fmode ?  show_fs_fmode_flags(__entry->fmode) :
    664					  "closed",
    665			MAJOR(__entry->dev), MINOR(__entry->dev),
    666			(unsigned long long)__entry->fileid,
    667			__entry->fhandle,
    668			__entry->stateid_seq, __entry->stateid_hash
    669		)
    670);
    671
    672DECLARE_EVENT_CLASS(nfs4_lock_event,
    673		TP_PROTO(
    674			const struct file_lock *request,
    675			const struct nfs4_state *state,
    676			int cmd,
    677			int error
    678		),
    679
    680		TP_ARGS(request, state, cmd, error),
    681
    682		TP_STRUCT__entry(
    683			__field(unsigned long, error)
    684			__field(unsigned long, cmd)
    685			__field(unsigned long, type)
    686			__field(loff_t, start)
    687			__field(loff_t, end)
    688			__field(dev_t, dev)
    689			__field(u32, fhandle)
    690			__field(u64, fileid)
    691			__field(int, stateid_seq)
    692			__field(u32, stateid_hash)
    693		),
    694
    695		TP_fast_assign(
    696			const struct inode *inode = state->inode;
    697
    698			__entry->error = error < 0 ? -error : 0;
    699			__entry->cmd = cmd;
    700			__entry->type = request->fl_type;
    701			__entry->start = request->fl_start;
    702			__entry->end = request->fl_end;
    703			__entry->dev = inode->i_sb->s_dev;
    704			__entry->fileid = NFS_FILEID(inode);
    705			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
    706			__entry->stateid_seq =
    707				be32_to_cpu(state->stateid.seqid);
    708			__entry->stateid_hash =
    709				nfs_stateid_hash(&state->stateid);
    710		),
    711
    712		TP_printk(
    713			"error=%ld (%s) cmd=%s:%s range=%lld:%lld "
    714			"fileid=%02x:%02x:%llu fhandle=0x%08x "
    715			"stateid=%d:0x%08x",
    716			-__entry->error,
    717			show_nfs4_status(__entry->error),
    718			show_fs_fcntl_cmd(__entry->cmd),
    719			show_fs_fcntl_lock_type(__entry->type),
    720			(long long)__entry->start,
    721			(long long)__entry->end,
    722			MAJOR(__entry->dev), MINOR(__entry->dev),
    723			(unsigned long long)__entry->fileid,
    724			__entry->fhandle,
    725			__entry->stateid_seq, __entry->stateid_hash
    726		)
    727);
    728
    729#define DEFINE_NFS4_LOCK_EVENT(name) \
    730	DEFINE_EVENT(nfs4_lock_event, name, \
    731			TP_PROTO( \
    732				const struct file_lock *request, \
    733				const struct nfs4_state *state, \
    734				int cmd, \
    735				int error \
    736			), \
    737			TP_ARGS(request, state, cmd, error))
    738DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
    739DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
    740
    741TRACE_EVENT(nfs4_set_lock,
    742		TP_PROTO(
    743			const struct file_lock *request,
    744			const struct nfs4_state *state,
    745			const nfs4_stateid *lockstateid,
    746			int cmd,
    747			int error
    748		),
    749
    750		TP_ARGS(request, state, lockstateid, cmd, error),
    751
    752		TP_STRUCT__entry(
    753			__field(unsigned long, error)
    754			__field(unsigned long, cmd)
    755			__field(unsigned long, type)
    756			__field(loff_t, start)
    757			__field(loff_t, end)
    758			__field(dev_t, dev)
    759			__field(u32, fhandle)
    760			__field(u64, fileid)
    761			__field(int, stateid_seq)
    762			__field(u32, stateid_hash)
    763			__field(int, lockstateid_seq)
    764			__field(u32, lockstateid_hash)
    765		),
    766
    767		TP_fast_assign(
    768			const struct inode *inode = state->inode;
    769
    770			__entry->error = error < 0 ? -error : 0;
    771			__entry->cmd = cmd;
    772			__entry->type = request->fl_type;
    773			__entry->start = request->fl_start;
    774			__entry->end = request->fl_end;
    775			__entry->dev = inode->i_sb->s_dev;
    776			__entry->fileid = NFS_FILEID(inode);
    777			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
    778			__entry->stateid_seq =
    779				be32_to_cpu(state->stateid.seqid);
    780			__entry->stateid_hash =
    781				nfs_stateid_hash(&state->stateid);
    782			__entry->lockstateid_seq =
    783				be32_to_cpu(lockstateid->seqid);
    784			__entry->lockstateid_hash =
    785				nfs_stateid_hash(lockstateid);
    786		),
    787
    788		TP_printk(
    789			"error=%ld (%s) cmd=%s:%s range=%lld:%lld "
    790			"fileid=%02x:%02x:%llu fhandle=0x%08x "
    791			"stateid=%d:0x%08x lockstateid=%d:0x%08x",
    792			-__entry->error,
    793			show_nfs4_status(__entry->error),
    794			show_fs_fcntl_cmd(__entry->cmd),
    795			show_fs_fcntl_lock_type(__entry->type),
    796			(long long)__entry->start,
    797			(long long)__entry->end,
    798			MAJOR(__entry->dev), MINOR(__entry->dev),
    799			(unsigned long long)__entry->fileid,
    800			__entry->fhandle,
    801			__entry->stateid_seq, __entry->stateid_hash,
    802			__entry->lockstateid_seq, __entry->lockstateid_hash
    803		)
    804);
    805
    806TRACE_DEFINE_ENUM(LK_STATE_IN_USE);
    807TRACE_DEFINE_ENUM(NFS_DELEGATED_STATE);
    808TRACE_DEFINE_ENUM(NFS_OPEN_STATE);
    809TRACE_DEFINE_ENUM(NFS_O_RDONLY_STATE);
    810TRACE_DEFINE_ENUM(NFS_O_WRONLY_STATE);
    811TRACE_DEFINE_ENUM(NFS_O_RDWR_STATE);
    812TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_REBOOT);
    813TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_NOGRACE);
    814TRACE_DEFINE_ENUM(NFS_STATE_POSIX_LOCKS);
    815TRACE_DEFINE_ENUM(NFS_STATE_RECOVERY_FAILED);
    816TRACE_DEFINE_ENUM(NFS_STATE_MAY_NOTIFY_LOCK);
    817TRACE_DEFINE_ENUM(NFS_STATE_CHANGE_WAIT);
    818TRACE_DEFINE_ENUM(NFS_CLNT_DST_SSC_COPY_STATE);
    819TRACE_DEFINE_ENUM(NFS_CLNT_SRC_SSC_COPY_STATE);
    820TRACE_DEFINE_ENUM(NFS_SRV_SSC_COPY_STATE);
    821
    822#define show_nfs4_state_flags(flags) \
    823	__print_flags(flags, "|", \
    824		{ LK_STATE_IN_USE,		"IN_USE" }, \
    825		{ NFS_DELEGATED_STATE,		"DELEGATED" }, \
    826		{ NFS_OPEN_STATE,		"OPEN" }, \
    827		{ NFS_O_RDONLY_STATE,		"O_RDONLY" }, \
    828		{ NFS_O_WRONLY_STATE,		"O_WRONLY" }, \
    829		{ NFS_O_RDWR_STATE,		"O_RDWR" }, \
    830		{ NFS_STATE_RECLAIM_REBOOT,	"RECLAIM_REBOOT" }, \
    831		{ NFS_STATE_RECLAIM_NOGRACE,	"RECLAIM_NOGRACE" }, \
    832		{ NFS_STATE_POSIX_LOCKS,	"POSIX_LOCKS" }, \
    833		{ NFS_STATE_RECOVERY_FAILED,	"RECOVERY_FAILED" }, \
    834		{ NFS_STATE_MAY_NOTIFY_LOCK,	"MAY_NOTIFY_LOCK" }, \
    835		{ NFS_STATE_CHANGE_WAIT,	"CHANGE_WAIT" }, \
    836		{ NFS_CLNT_DST_SSC_COPY_STATE,	"CLNT_DST_SSC_COPY" }, \
    837		{ NFS_CLNT_SRC_SSC_COPY_STATE,	"CLNT_SRC_SSC_COPY" }, \
    838		{ NFS_SRV_SSC_COPY_STATE,	"SRV_SSC_COPY" })
    839
    840#define show_nfs4_lock_flags(flags) \
    841	__print_flags(flags, "|", \
    842		{ BIT(NFS_LOCK_INITIALIZED),	"INITIALIZED" }, \
    843		{ BIT(NFS_LOCK_LOST),		"LOST" })
    844
    845TRACE_EVENT(nfs4_state_lock_reclaim,
    846		TP_PROTO(
    847			const struct nfs4_state *state,
    848			const struct nfs4_lock_state *lock
    849		),
    850
    851		TP_ARGS(state, lock),
    852
    853		TP_STRUCT__entry(
    854			__field(dev_t, dev)
    855			__field(u32, fhandle)
    856			__field(u64, fileid)
    857			__field(unsigned long, state_flags)
    858			__field(unsigned long, lock_flags)
    859			__field(int, stateid_seq)
    860			__field(u32, stateid_hash)
    861		),
    862
    863		TP_fast_assign(
    864			const struct inode *inode = state->inode;
    865
    866			__entry->dev = inode->i_sb->s_dev;
    867			__entry->fileid = NFS_FILEID(inode);
    868			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
    869			__entry->state_flags = state->flags;
    870			__entry->lock_flags = lock->ls_flags;
    871			__entry->stateid_seq =
    872				be32_to_cpu(state->stateid.seqid);
    873			__entry->stateid_hash =
    874				nfs_stateid_hash(&state->stateid);
    875		),
    876
    877		TP_printk(
    878			"fileid=%02x:%02x:%llu fhandle=0x%08x "
    879			"stateid=%d:0x%08x state_flags=%s lock_flags=%s",
    880			MAJOR(__entry->dev), MINOR(__entry->dev),
    881			(unsigned long long)__entry->fileid, __entry->fhandle,
    882			__entry->stateid_seq, __entry->stateid_hash,
    883			show_nfs4_state_flags(__entry->state_flags),
    884			show_nfs4_lock_flags(__entry->lock_flags)
    885		)
    886)
    887
    888DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
    889		TP_PROTO(
    890			const struct inode *inode,
    891			fmode_t fmode
    892		),
    893
    894		TP_ARGS(inode, fmode),
    895
    896		TP_STRUCT__entry(
    897			__field(dev_t, dev)
    898			__field(u32, fhandle)
    899			__field(u64, fileid)
    900			__field(unsigned int, fmode)
    901		),
    902
    903		TP_fast_assign(
    904			__entry->dev = inode->i_sb->s_dev;
    905			__entry->fileid = NFS_FILEID(inode);
    906			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
    907			__entry->fmode = (__force unsigned int)fmode;
    908		),
    909
    910		TP_printk(
    911			"fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
    912			show_fs_fmode_flags(__entry->fmode),
    913			MAJOR(__entry->dev), MINOR(__entry->dev),
    914			(unsigned long long)__entry->fileid,
    915			__entry->fhandle
    916		)
    917);
    918#define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
    919	DEFINE_EVENT(nfs4_set_delegation_event, name, \
    920			TP_PROTO( \
    921				const struct inode *inode, \
    922				fmode_t fmode \
    923			), \
    924			TP_ARGS(inode, fmode))
    925DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
    926DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
    927
    928TRACE_EVENT(nfs4_delegreturn_exit,
    929		TP_PROTO(
    930			const struct nfs4_delegreturnargs *args,
    931			const struct nfs4_delegreturnres *res,
    932			int error
    933		),
    934
    935		TP_ARGS(args, res, error),
    936
    937		TP_STRUCT__entry(
    938			__field(dev_t, dev)
    939			__field(u32, fhandle)
    940			__field(unsigned long, error)
    941			__field(int, stateid_seq)
    942			__field(u32, stateid_hash)
    943		),
    944
    945		TP_fast_assign(
    946			__entry->dev = res->server->s_dev;
    947			__entry->fhandle = nfs_fhandle_hash(args->fhandle);
    948			__entry->error = error < 0 ? -error : 0;
    949			__entry->stateid_seq =
    950				be32_to_cpu(args->stateid->seqid);
    951			__entry->stateid_hash =
    952				nfs_stateid_hash(args->stateid);
    953		),
    954
    955		TP_printk(
    956			"error=%ld (%s) dev=%02x:%02x fhandle=0x%08x "
    957			"stateid=%d:0x%08x",
    958			-__entry->error,
    959			show_nfs4_status(__entry->error),
    960			MAJOR(__entry->dev), MINOR(__entry->dev),
    961			__entry->fhandle,
    962			__entry->stateid_seq, __entry->stateid_hash
    963		)
    964);
    965
    966#ifdef CONFIG_NFS_V4_1
    967DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
    968		TP_PROTO(
    969			const struct nfs4_state *state,
    970			const struct nfs4_lock_state *lsp,
    971			int error
    972		),
    973
    974		TP_ARGS(state, lsp, error),
    975
    976		TP_STRUCT__entry(
    977			__field(unsigned long, error)
    978			__field(dev_t, dev)
    979			__field(u32, fhandle)
    980			__field(u64, fileid)
    981			__field(int, stateid_seq)
    982			__field(u32, stateid_hash)
    983		),
    984
    985		TP_fast_assign(
    986			const struct inode *inode = state->inode;
    987
    988			__entry->error = error < 0 ? -error : 0;
    989			__entry->dev = inode->i_sb->s_dev;
    990			__entry->fileid = NFS_FILEID(inode);
    991			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
    992			__entry->stateid_seq =
    993				be32_to_cpu(state->stateid.seqid);
    994			__entry->stateid_hash =
    995				nfs_stateid_hash(&state->stateid);
    996		),
    997
    998		TP_printk(
    999			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   1000			"stateid=%d:0x%08x",
   1001			-__entry->error,
   1002			show_nfs4_status(__entry->error),
   1003			MAJOR(__entry->dev), MINOR(__entry->dev),
   1004			(unsigned long long)__entry->fileid,
   1005			__entry->fhandle,
   1006			__entry->stateid_seq, __entry->stateid_hash
   1007		)
   1008);
   1009
   1010#define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
   1011	DEFINE_EVENT(nfs4_test_stateid_event, name, \
   1012			TP_PROTO( \
   1013				const struct nfs4_state *state, \
   1014				const struct nfs4_lock_state *lsp, \
   1015				int error \
   1016			), \
   1017			TP_ARGS(state, lsp, error))
   1018DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
   1019DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
   1020DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
   1021#endif /* CONFIG_NFS_V4_1 */
   1022
   1023DECLARE_EVENT_CLASS(nfs4_lookup_event,
   1024		TP_PROTO(
   1025			const struct inode *dir,
   1026			const struct qstr *name,
   1027			int error
   1028		),
   1029
   1030		TP_ARGS(dir, name, error),
   1031
   1032		TP_STRUCT__entry(
   1033			__field(dev_t, dev)
   1034			__field(unsigned long, error)
   1035			__field(u64, dir)
   1036			__string(name, name->name)
   1037		),
   1038
   1039		TP_fast_assign(
   1040			__entry->dev = dir->i_sb->s_dev;
   1041			__entry->dir = NFS_FILEID(dir);
   1042			__entry->error = -error;
   1043			__assign_str(name, name->name);
   1044		),
   1045
   1046		TP_printk(
   1047			"error=%ld (%s) name=%02x:%02x:%llu/%s",
   1048			-__entry->error,
   1049			show_nfs4_status(__entry->error),
   1050			MAJOR(__entry->dev), MINOR(__entry->dev),
   1051			(unsigned long long)__entry->dir,
   1052			__get_str(name)
   1053		)
   1054);
   1055
   1056#define DEFINE_NFS4_LOOKUP_EVENT(name) \
   1057	DEFINE_EVENT(nfs4_lookup_event, name, \
   1058			TP_PROTO( \
   1059				const struct inode *dir, \
   1060				const struct qstr *name, \
   1061				int error \
   1062			), \
   1063			TP_ARGS(dir, name, error))
   1064
   1065DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
   1066DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
   1067DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
   1068DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
   1069DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
   1070DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
   1071DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
   1072
   1073TRACE_EVENT(nfs4_lookupp,
   1074		TP_PROTO(
   1075			const struct inode *inode,
   1076			int error
   1077		),
   1078
   1079		TP_ARGS(inode, error),
   1080
   1081		TP_STRUCT__entry(
   1082			__field(dev_t, dev)
   1083			__field(u64, ino)
   1084			__field(unsigned long, error)
   1085		),
   1086
   1087		TP_fast_assign(
   1088			__entry->dev = inode->i_sb->s_dev;
   1089			__entry->ino = NFS_FILEID(inode);
   1090			__entry->error = error < 0 ? -error : 0;
   1091		),
   1092
   1093		TP_printk(
   1094			"error=%ld (%s) inode=%02x:%02x:%llu",
   1095			-__entry->error,
   1096			show_nfs4_status(__entry->error),
   1097			MAJOR(__entry->dev), MINOR(__entry->dev),
   1098			(unsigned long long)__entry->ino
   1099		)
   1100);
   1101
   1102TRACE_EVENT(nfs4_rename,
   1103		TP_PROTO(
   1104			const struct inode *olddir,
   1105			const struct qstr *oldname,
   1106			const struct inode *newdir,
   1107			const struct qstr *newname,
   1108			int error
   1109		),
   1110
   1111		TP_ARGS(olddir, oldname, newdir, newname, error),
   1112
   1113		TP_STRUCT__entry(
   1114			__field(dev_t, dev)
   1115			__field(unsigned long, error)
   1116			__field(u64, olddir)
   1117			__string(oldname, oldname->name)
   1118			__field(u64, newdir)
   1119			__string(newname, newname->name)
   1120		),
   1121
   1122		TP_fast_assign(
   1123			__entry->dev = olddir->i_sb->s_dev;
   1124			__entry->olddir = NFS_FILEID(olddir);
   1125			__entry->newdir = NFS_FILEID(newdir);
   1126			__entry->error = error < 0 ? -error : 0;
   1127			__assign_str(oldname, oldname->name);
   1128			__assign_str(newname, newname->name);
   1129		),
   1130
   1131		TP_printk(
   1132			"error=%ld (%s) oldname=%02x:%02x:%llu/%s "
   1133			"newname=%02x:%02x:%llu/%s",
   1134			-__entry->error,
   1135			show_nfs4_status(__entry->error),
   1136			MAJOR(__entry->dev), MINOR(__entry->dev),
   1137			(unsigned long long)__entry->olddir,
   1138			__get_str(oldname),
   1139			MAJOR(__entry->dev), MINOR(__entry->dev),
   1140			(unsigned long long)__entry->newdir,
   1141			__get_str(newname)
   1142		)
   1143);
   1144
   1145DECLARE_EVENT_CLASS(nfs4_inode_event,
   1146		TP_PROTO(
   1147			const struct inode *inode,
   1148			int error
   1149		),
   1150
   1151		TP_ARGS(inode, error),
   1152
   1153		TP_STRUCT__entry(
   1154			__field(dev_t, dev)
   1155			__field(u32, fhandle)
   1156			__field(u64, fileid)
   1157			__field(unsigned long, error)
   1158		),
   1159
   1160		TP_fast_assign(
   1161			__entry->dev = inode->i_sb->s_dev;
   1162			__entry->fileid = NFS_FILEID(inode);
   1163			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
   1164			__entry->error = error < 0 ? -error : 0;
   1165		),
   1166
   1167		TP_printk(
   1168			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
   1169			-__entry->error,
   1170			show_nfs4_status(__entry->error),
   1171			MAJOR(__entry->dev), MINOR(__entry->dev),
   1172			(unsigned long long)__entry->fileid,
   1173			__entry->fhandle
   1174		)
   1175);
   1176
   1177#define DEFINE_NFS4_INODE_EVENT(name) \
   1178	DEFINE_EVENT(nfs4_inode_event, name, \
   1179			TP_PROTO( \
   1180				const struct inode *inode, \
   1181				int error \
   1182			), \
   1183			TP_ARGS(inode, error))
   1184
   1185DEFINE_NFS4_INODE_EVENT(nfs4_access);
   1186DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
   1187DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
   1188DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
   1189DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
   1190#ifdef CONFIG_NFS_V4_SECURITY_LABEL
   1191DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
   1192DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
   1193#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
   1194
   1195DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
   1196		TP_PROTO(
   1197			const struct inode *inode,
   1198			const nfs4_stateid *stateid,
   1199			int error
   1200		),
   1201
   1202		TP_ARGS(inode, stateid, error),
   1203
   1204		TP_STRUCT__entry(
   1205			__field(dev_t, dev)
   1206			__field(u32, fhandle)
   1207			__field(u64, fileid)
   1208			__field(unsigned long, error)
   1209			__field(int, stateid_seq)
   1210			__field(u32, stateid_hash)
   1211		),
   1212
   1213		TP_fast_assign(
   1214			__entry->dev = inode->i_sb->s_dev;
   1215			__entry->fileid = NFS_FILEID(inode);
   1216			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
   1217			__entry->error = error < 0 ? -error : 0;
   1218			__entry->stateid_seq =
   1219				be32_to_cpu(stateid->seqid);
   1220			__entry->stateid_hash =
   1221				nfs_stateid_hash(stateid);
   1222		),
   1223
   1224		TP_printk(
   1225			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   1226			"stateid=%d:0x%08x",
   1227			-__entry->error,
   1228			show_nfs4_status(__entry->error),
   1229			MAJOR(__entry->dev), MINOR(__entry->dev),
   1230			(unsigned long long)__entry->fileid,
   1231			__entry->fhandle,
   1232			__entry->stateid_seq, __entry->stateid_hash
   1233		)
   1234);
   1235
   1236#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
   1237	DEFINE_EVENT(nfs4_inode_stateid_event, name, \
   1238			TP_PROTO( \
   1239				const struct inode *inode, \
   1240				const nfs4_stateid *stateid, \
   1241				int error \
   1242			), \
   1243			TP_ARGS(inode, stateid, error))
   1244
   1245DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
   1246DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
   1247DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
   1248DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
   1249DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_close_stateid_update_wait);
   1250
   1251DECLARE_EVENT_CLASS(nfs4_getattr_event,
   1252		TP_PROTO(
   1253			const struct nfs_server *server,
   1254			const struct nfs_fh *fhandle,
   1255			const struct nfs_fattr *fattr,
   1256			int error
   1257		),
   1258
   1259		TP_ARGS(server, fhandle, fattr, error),
   1260
   1261		TP_STRUCT__entry(
   1262			__field(dev_t, dev)
   1263			__field(u32, fhandle)
   1264			__field(u64, fileid)
   1265			__field(unsigned int, valid)
   1266			__field(unsigned long, error)
   1267		),
   1268
   1269		TP_fast_assign(
   1270			__entry->dev = server->s_dev;
   1271			__entry->valid = fattr->valid;
   1272			__entry->fhandle = nfs_fhandle_hash(fhandle);
   1273			__entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
   1274			__entry->error = error < 0 ? -error : 0;
   1275		),
   1276
   1277		TP_printk(
   1278			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   1279			"valid=%s",
   1280			-__entry->error,
   1281			show_nfs4_status(__entry->error),
   1282			MAJOR(__entry->dev), MINOR(__entry->dev),
   1283			(unsigned long long)__entry->fileid,
   1284			__entry->fhandle,
   1285			show_nfs_fattr_flags(__entry->valid)
   1286		)
   1287);
   1288
   1289#define DEFINE_NFS4_GETATTR_EVENT(name) \
   1290	DEFINE_EVENT(nfs4_getattr_event, name, \
   1291			TP_PROTO( \
   1292				const struct nfs_server *server, \
   1293				const struct nfs_fh *fhandle, \
   1294				const struct nfs_fattr *fattr, \
   1295				int error \
   1296			), \
   1297			TP_ARGS(server, fhandle, fattr, error))
   1298DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
   1299DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
   1300DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
   1301
   1302DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
   1303		TP_PROTO(
   1304			const struct nfs_client *clp,
   1305			const struct nfs_fh *fhandle,
   1306			const struct inode *inode,
   1307			int error
   1308		),
   1309
   1310		TP_ARGS(clp, fhandle, inode, error),
   1311
   1312		TP_STRUCT__entry(
   1313			__field(unsigned long, error)
   1314			__field(dev_t, dev)
   1315			__field(u32, fhandle)
   1316			__field(u64, fileid)
   1317			__string(dstaddr, clp ? clp->cl_hostname : "unknown")
   1318		),
   1319
   1320		TP_fast_assign(
   1321			__entry->error = error < 0 ? -error : 0;
   1322			__entry->fhandle = nfs_fhandle_hash(fhandle);
   1323			if (!IS_ERR_OR_NULL(inode)) {
   1324				__entry->fileid = NFS_FILEID(inode);
   1325				__entry->dev = inode->i_sb->s_dev;
   1326			} else {
   1327				__entry->fileid = 0;
   1328				__entry->dev = 0;
   1329			}
   1330			__assign_str(dstaddr, clp ? clp->cl_hostname : "unknown");
   1331		),
   1332
   1333		TP_printk(
   1334			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   1335			"dstaddr=%s",
   1336			-__entry->error,
   1337			show_nfs4_status(__entry->error),
   1338			MAJOR(__entry->dev), MINOR(__entry->dev),
   1339			(unsigned long long)__entry->fileid,
   1340			__entry->fhandle,
   1341			__get_str(dstaddr)
   1342		)
   1343);
   1344
   1345#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
   1346	DEFINE_EVENT(nfs4_inode_callback_event, name, \
   1347			TP_PROTO( \
   1348				const struct nfs_client *clp, \
   1349				const struct nfs_fh *fhandle, \
   1350				const struct inode *inode, \
   1351				int error \
   1352			), \
   1353			TP_ARGS(clp, fhandle, inode, error))
   1354DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
   1355
   1356DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
   1357		TP_PROTO(
   1358			const struct nfs_client *clp,
   1359			const struct nfs_fh *fhandle,
   1360			const struct inode *inode,
   1361			const nfs4_stateid *stateid,
   1362			int error
   1363		),
   1364
   1365		TP_ARGS(clp, fhandle, inode, stateid, error),
   1366
   1367		TP_STRUCT__entry(
   1368			__field(unsigned long, error)
   1369			__field(dev_t, dev)
   1370			__field(u32, fhandle)
   1371			__field(u64, fileid)
   1372			__string(dstaddr, clp ? clp->cl_hostname : "unknown")
   1373			__field(int, stateid_seq)
   1374			__field(u32, stateid_hash)
   1375		),
   1376
   1377		TP_fast_assign(
   1378			__entry->error = error < 0 ? -error : 0;
   1379			__entry->fhandle = nfs_fhandle_hash(fhandle);
   1380			if (!IS_ERR_OR_NULL(inode)) {
   1381				__entry->fileid = NFS_FILEID(inode);
   1382				__entry->dev = inode->i_sb->s_dev;
   1383			} else {
   1384				__entry->fileid = 0;
   1385				__entry->dev = 0;
   1386			}
   1387			__assign_str(dstaddr, clp ? clp->cl_hostname : "unknown");
   1388			__entry->stateid_seq =
   1389				be32_to_cpu(stateid->seqid);
   1390			__entry->stateid_hash =
   1391				nfs_stateid_hash(stateid);
   1392		),
   1393
   1394		TP_printk(
   1395			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   1396			"stateid=%d:0x%08x dstaddr=%s",
   1397			-__entry->error,
   1398			show_nfs4_status(__entry->error),
   1399			MAJOR(__entry->dev), MINOR(__entry->dev),
   1400			(unsigned long long)__entry->fileid,
   1401			__entry->fhandle,
   1402			__entry->stateid_seq, __entry->stateid_hash,
   1403			__get_str(dstaddr)
   1404		)
   1405);
   1406
   1407#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
   1408	DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
   1409			TP_PROTO( \
   1410				const struct nfs_client *clp, \
   1411				const struct nfs_fh *fhandle, \
   1412				const struct inode *inode, \
   1413				const nfs4_stateid *stateid, \
   1414				int error \
   1415			), \
   1416			TP_ARGS(clp, fhandle, inode, stateid, error))
   1417DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
   1418DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
   1419
   1420DECLARE_EVENT_CLASS(nfs4_idmap_event,
   1421		TP_PROTO(
   1422			const char *name,
   1423			int len,
   1424			u32 id,
   1425			int error
   1426		),
   1427
   1428		TP_ARGS(name, len, id, error),
   1429
   1430		TP_STRUCT__entry(
   1431			__field(unsigned long, error)
   1432			__field(u32, id)
   1433			__dynamic_array(char, name, len > 0 ? len + 1 : 1)
   1434		),
   1435
   1436		TP_fast_assign(
   1437			if (len < 0)
   1438				len = 0;
   1439			__entry->error = error < 0 ? error : 0;
   1440			__entry->id = id;
   1441			memcpy(__get_str(name), name, len);
   1442			__get_str(name)[len] = 0;
   1443		),
   1444
   1445		TP_printk(
   1446			"error=%ld (%s) id=%u name=%s",
   1447			-__entry->error, show_nfs4_status(__entry->error),
   1448			__entry->id,
   1449			__get_str(name)
   1450		)
   1451);
   1452#define DEFINE_NFS4_IDMAP_EVENT(name) \
   1453	DEFINE_EVENT(nfs4_idmap_event, name, \
   1454			TP_PROTO( \
   1455				const char *name, \
   1456				int len, \
   1457				u32 id, \
   1458				int error \
   1459			), \
   1460			TP_ARGS(name, len, id, error))
   1461DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
   1462DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
   1463DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
   1464DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
   1465
   1466#ifdef CONFIG_NFS_V4_1
   1467#define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) \
   1468	(lseg ? nfs_stateid_hash(&lseg->pls_layout->plh_stateid) : 0)
   1469#else
   1470#define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) (0)
   1471#endif
   1472
   1473DECLARE_EVENT_CLASS(nfs4_read_event,
   1474		TP_PROTO(
   1475			const struct nfs_pgio_header *hdr,
   1476			int error
   1477		),
   1478
   1479		TP_ARGS(hdr, error),
   1480
   1481		TP_STRUCT__entry(
   1482			__field(dev_t, dev)
   1483			__field(u32, fhandle)
   1484			__field(u64, fileid)
   1485			__field(loff_t, offset)
   1486			__field(u32, arg_count)
   1487			__field(u32, res_count)
   1488			__field(unsigned long, error)
   1489			__field(int, stateid_seq)
   1490			__field(u32, stateid_hash)
   1491			__field(int, layoutstateid_seq)
   1492			__field(u32, layoutstateid_hash)
   1493		),
   1494
   1495		TP_fast_assign(
   1496			const struct inode *inode = hdr->inode;
   1497			const struct nfs_inode *nfsi = NFS_I(inode);
   1498			const struct nfs_fh *fh = hdr->args.fh ?
   1499						  hdr->args.fh : &nfsi->fh;
   1500			const struct nfs4_state *state =
   1501				hdr->args.context->state;
   1502			const struct pnfs_layout_segment *lseg = hdr->lseg;
   1503
   1504			__entry->dev = inode->i_sb->s_dev;
   1505			__entry->fileid = nfsi->fileid;
   1506			__entry->fhandle = nfs_fhandle_hash(fh);
   1507			__entry->offset = hdr->args.offset;
   1508			__entry->arg_count = hdr->args.count;
   1509			__entry->res_count = hdr->res.count;
   1510			__entry->error = error < 0 ? -error : 0;
   1511			__entry->stateid_seq =
   1512				be32_to_cpu(state->stateid.seqid);
   1513			__entry->stateid_hash =
   1514				nfs_stateid_hash(&state->stateid);
   1515			__entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
   1516			__entry->layoutstateid_hash =
   1517				NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
   1518		),
   1519
   1520		TP_printk(
   1521			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   1522			"offset=%lld count=%u res=%u stateid=%d:0x%08x "
   1523			"layoutstateid=%d:0x%08x",
   1524			-__entry->error,
   1525			show_nfs4_status(__entry->error),
   1526			MAJOR(__entry->dev), MINOR(__entry->dev),
   1527			(unsigned long long)__entry->fileid,
   1528			__entry->fhandle,
   1529			(long long)__entry->offset,
   1530			__entry->arg_count, __entry->res_count,
   1531			__entry->stateid_seq, __entry->stateid_hash,
   1532			__entry->layoutstateid_seq, __entry->layoutstateid_hash
   1533		)
   1534);
   1535#define DEFINE_NFS4_READ_EVENT(name) \
   1536	DEFINE_EVENT(nfs4_read_event, name, \
   1537			TP_PROTO( \
   1538				const struct nfs_pgio_header *hdr, \
   1539				int error \
   1540			), \
   1541			TP_ARGS(hdr, error))
   1542DEFINE_NFS4_READ_EVENT(nfs4_read);
   1543#ifdef CONFIG_NFS_V4_1
   1544DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
   1545#endif /* CONFIG_NFS_V4_1 */
   1546
   1547DECLARE_EVENT_CLASS(nfs4_write_event,
   1548		TP_PROTO(
   1549			const struct nfs_pgio_header *hdr,
   1550			int error
   1551		),
   1552
   1553		TP_ARGS(hdr, error),
   1554
   1555		TP_STRUCT__entry(
   1556			__field(dev_t, dev)
   1557			__field(u32, fhandle)
   1558			__field(u64, fileid)
   1559			__field(loff_t, offset)
   1560			__field(u32, arg_count)
   1561			__field(u32, res_count)
   1562			__field(unsigned long, error)
   1563			__field(int, stateid_seq)
   1564			__field(u32, stateid_hash)
   1565			__field(int, layoutstateid_seq)
   1566			__field(u32, layoutstateid_hash)
   1567		),
   1568
   1569		TP_fast_assign(
   1570			const struct inode *inode = hdr->inode;
   1571			const struct nfs_inode *nfsi = NFS_I(inode);
   1572			const struct nfs_fh *fh = hdr->args.fh ?
   1573						  hdr->args.fh : &nfsi->fh;
   1574			const struct nfs4_state *state =
   1575				hdr->args.context->state;
   1576			const struct pnfs_layout_segment *lseg = hdr->lseg;
   1577
   1578			__entry->dev = inode->i_sb->s_dev;
   1579			__entry->fileid = nfsi->fileid;
   1580			__entry->fhandle = nfs_fhandle_hash(fh);
   1581			__entry->offset = hdr->args.offset;
   1582			__entry->arg_count = hdr->args.count;
   1583			__entry->res_count = hdr->res.count;
   1584			__entry->error = error < 0 ? -error : 0;
   1585			__entry->stateid_seq =
   1586				be32_to_cpu(state->stateid.seqid);
   1587			__entry->stateid_hash =
   1588				nfs_stateid_hash(&state->stateid);
   1589			__entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
   1590			__entry->layoutstateid_hash =
   1591				NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
   1592		),
   1593
   1594		TP_printk(
   1595			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   1596			"offset=%lld count=%u res=%u stateid=%d:0x%08x "
   1597			"layoutstateid=%d:0x%08x",
   1598			-__entry->error,
   1599			show_nfs4_status(__entry->error),
   1600			MAJOR(__entry->dev), MINOR(__entry->dev),
   1601			(unsigned long long)__entry->fileid,
   1602			__entry->fhandle,
   1603			(long long)__entry->offset,
   1604			__entry->arg_count, __entry->res_count,
   1605			__entry->stateid_seq, __entry->stateid_hash,
   1606			__entry->layoutstateid_seq, __entry->layoutstateid_hash
   1607		)
   1608);
   1609
   1610#define DEFINE_NFS4_WRITE_EVENT(name) \
   1611	DEFINE_EVENT(nfs4_write_event, name, \
   1612			TP_PROTO( \
   1613				const struct nfs_pgio_header *hdr, \
   1614				int error \
   1615			), \
   1616			TP_ARGS(hdr, error))
   1617DEFINE_NFS4_WRITE_EVENT(nfs4_write);
   1618#ifdef CONFIG_NFS_V4_1
   1619DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
   1620#endif /* CONFIG_NFS_V4_1 */
   1621
   1622DECLARE_EVENT_CLASS(nfs4_commit_event,
   1623		TP_PROTO(
   1624			const struct nfs_commit_data *data,
   1625			int error
   1626		),
   1627
   1628		TP_ARGS(data, error),
   1629
   1630		TP_STRUCT__entry(
   1631			__field(dev_t, dev)
   1632			__field(u32, fhandle)
   1633			__field(u64, fileid)
   1634			__field(unsigned long, error)
   1635			__field(loff_t, offset)
   1636			__field(u32, count)
   1637			__field(int, layoutstateid_seq)
   1638			__field(u32, layoutstateid_hash)
   1639		),
   1640
   1641		TP_fast_assign(
   1642			const struct inode *inode = data->inode;
   1643			const struct nfs_inode *nfsi = NFS_I(inode);
   1644			const struct nfs_fh *fh = data->args.fh ?
   1645						  data->args.fh : &nfsi->fh;
   1646			const struct pnfs_layout_segment *lseg = data->lseg;
   1647
   1648			__entry->dev = inode->i_sb->s_dev;
   1649			__entry->fileid = nfsi->fileid;
   1650			__entry->fhandle = nfs_fhandle_hash(fh);
   1651			__entry->offset = data->args.offset;
   1652			__entry->count = data->args.count;
   1653			__entry->error = error < 0 ? -error : 0;
   1654			__entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
   1655			__entry->layoutstateid_hash =
   1656				NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
   1657		),
   1658
   1659		TP_printk(
   1660			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   1661			"offset=%lld count=%u layoutstateid=%d:0x%08x",
   1662			-__entry->error,
   1663			show_nfs4_status(__entry->error),
   1664			MAJOR(__entry->dev), MINOR(__entry->dev),
   1665			(unsigned long long)__entry->fileid,
   1666			__entry->fhandle,
   1667			(long long)__entry->offset,
   1668			__entry->count,
   1669			__entry->layoutstateid_seq, __entry->layoutstateid_hash
   1670		)
   1671);
   1672#define DEFINE_NFS4_COMMIT_EVENT(name) \
   1673	DEFINE_EVENT(nfs4_commit_event, name, \
   1674			TP_PROTO( \
   1675				const struct nfs_commit_data *data, \
   1676				int error \
   1677			), \
   1678			TP_ARGS(data, error))
   1679DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
   1680#ifdef CONFIG_NFS_V4_1
   1681DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
   1682
   1683TRACE_EVENT(nfs4_layoutget,
   1684		TP_PROTO(
   1685			const struct nfs_open_context *ctx,
   1686			const struct pnfs_layout_range *args,
   1687			const struct pnfs_layout_range *res,
   1688			const nfs4_stateid *layout_stateid,
   1689			int error
   1690		),
   1691
   1692		TP_ARGS(ctx, args, res, layout_stateid, error),
   1693
   1694		TP_STRUCT__entry(
   1695			__field(dev_t, dev)
   1696			__field(u32, fhandle)
   1697			__field(u64, fileid)
   1698			__field(u32, iomode)
   1699			__field(u64, offset)
   1700			__field(u64, count)
   1701			__field(unsigned long, error)
   1702			__field(int, stateid_seq)
   1703			__field(u32, stateid_hash)
   1704			__field(int, layoutstateid_seq)
   1705			__field(u32, layoutstateid_hash)
   1706		),
   1707
   1708		TP_fast_assign(
   1709			const struct inode *inode = d_inode(ctx->dentry);
   1710			const struct nfs4_state *state = ctx->state;
   1711			__entry->dev = inode->i_sb->s_dev;
   1712			__entry->fileid = NFS_FILEID(inode);
   1713			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
   1714			__entry->iomode = args->iomode;
   1715			__entry->offset = args->offset;
   1716			__entry->count = args->length;
   1717			__entry->error = error < 0 ? -error : 0;
   1718			__entry->stateid_seq =
   1719				be32_to_cpu(state->stateid.seqid);
   1720			__entry->stateid_hash =
   1721				nfs_stateid_hash(&state->stateid);
   1722			if (!error) {
   1723				__entry->layoutstateid_seq =
   1724				be32_to_cpu(layout_stateid->seqid);
   1725				__entry->layoutstateid_hash =
   1726				nfs_stateid_hash(layout_stateid);
   1727			} else {
   1728				__entry->layoutstateid_seq = 0;
   1729				__entry->layoutstateid_hash = 0;
   1730			}
   1731		),
   1732
   1733		TP_printk(
   1734			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   1735			"iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
   1736			"layoutstateid=%d:0x%08x",
   1737			-__entry->error,
   1738			show_nfs4_status(__entry->error),
   1739			MAJOR(__entry->dev), MINOR(__entry->dev),
   1740			(unsigned long long)__entry->fileid,
   1741			__entry->fhandle,
   1742			show_pnfs_layout_iomode(__entry->iomode),
   1743			(unsigned long long)__entry->offset,
   1744			(unsigned long long)__entry->count,
   1745			__entry->stateid_seq, __entry->stateid_hash,
   1746			__entry->layoutstateid_seq, __entry->layoutstateid_hash
   1747		)
   1748);
   1749
   1750DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
   1751DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
   1752DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn_on_close);
   1753DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layouterror);
   1754DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutstats);
   1755
   1756TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN);
   1757TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS);
   1758TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN);
   1759TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH);
   1760TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM);
   1761TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL);
   1762TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL);
   1763TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED);
   1764TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN);
   1765TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED);
   1766TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN);
   1767TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY);
   1768TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
   1769TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_EXIT);
   1770
   1771#define show_pnfs_update_layout_reason(reason)				\
   1772	__print_symbolic(reason,					\
   1773		{ PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" },		\
   1774		{ PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" },		\
   1775		{ PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" },	\
   1776		{ PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" },		\
   1777		{ PNFS_UPDATE_LAYOUT_NOMEM, "nomem" },			\
   1778		{ PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" },	\
   1779		{ PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" },	\
   1780		{ PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" },	\
   1781		{ PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" },		\
   1782		{ PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" },	\
   1783		{ PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" },	\
   1784		{ PNFS_UPDATE_LAYOUT_RETRY, "retrying" },	\
   1785		{ PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }, \
   1786		{ PNFS_UPDATE_LAYOUT_EXIT, "exit" })
   1787
   1788TRACE_EVENT(pnfs_update_layout,
   1789		TP_PROTO(struct inode *inode,
   1790			loff_t pos,
   1791			u64 count,
   1792			enum pnfs_iomode iomode,
   1793			struct pnfs_layout_hdr *lo,
   1794			struct pnfs_layout_segment *lseg,
   1795			enum pnfs_update_layout_reason reason
   1796		),
   1797		TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
   1798		TP_STRUCT__entry(
   1799			__field(dev_t, dev)
   1800			__field(u64, fileid)
   1801			__field(u32, fhandle)
   1802			__field(loff_t, pos)
   1803			__field(u64, count)
   1804			__field(enum pnfs_iomode, iomode)
   1805			__field(int, layoutstateid_seq)
   1806			__field(u32, layoutstateid_hash)
   1807			__field(long, lseg)
   1808			__field(enum pnfs_update_layout_reason, reason)
   1809		),
   1810		TP_fast_assign(
   1811			__entry->dev = inode->i_sb->s_dev;
   1812			__entry->fileid = NFS_FILEID(inode);
   1813			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
   1814			__entry->pos = pos;
   1815			__entry->count = count;
   1816			__entry->iomode = iomode;
   1817			__entry->reason = reason;
   1818			if (lo != NULL) {
   1819				__entry->layoutstateid_seq =
   1820				be32_to_cpu(lo->plh_stateid.seqid);
   1821				__entry->layoutstateid_hash =
   1822				nfs_stateid_hash(&lo->plh_stateid);
   1823			} else {
   1824				__entry->layoutstateid_seq = 0;
   1825				__entry->layoutstateid_hash = 0;
   1826			}
   1827			__entry->lseg = (long)lseg;
   1828		),
   1829		TP_printk(
   1830			"fileid=%02x:%02x:%llu fhandle=0x%08x "
   1831			"iomode=%s pos=%llu count=%llu "
   1832			"layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
   1833			MAJOR(__entry->dev), MINOR(__entry->dev),
   1834			(unsigned long long)__entry->fileid,
   1835			__entry->fhandle,
   1836			show_pnfs_layout_iomode(__entry->iomode),
   1837			(unsigned long long)__entry->pos,
   1838			(unsigned long long)__entry->count,
   1839			__entry->layoutstateid_seq, __entry->layoutstateid_hash,
   1840			__entry->lseg,
   1841			show_pnfs_update_layout_reason(__entry->reason)
   1842		)
   1843);
   1844
   1845DECLARE_EVENT_CLASS(pnfs_layout_event,
   1846		TP_PROTO(struct inode *inode,
   1847			loff_t pos,
   1848			u64 count,
   1849			enum pnfs_iomode iomode,
   1850			struct pnfs_layout_hdr *lo,
   1851			struct pnfs_layout_segment *lseg
   1852		),
   1853		TP_ARGS(inode, pos, count, iomode, lo, lseg),
   1854		TP_STRUCT__entry(
   1855			__field(dev_t, dev)
   1856			__field(u64, fileid)
   1857			__field(u32, fhandle)
   1858			__field(loff_t, pos)
   1859			__field(u64, count)
   1860			__field(enum pnfs_iomode, iomode)
   1861			__field(int, layoutstateid_seq)
   1862			__field(u32, layoutstateid_hash)
   1863			__field(long, lseg)
   1864		),
   1865		TP_fast_assign(
   1866			__entry->dev = inode->i_sb->s_dev;
   1867			__entry->fileid = NFS_FILEID(inode);
   1868			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
   1869			__entry->pos = pos;
   1870			__entry->count = count;
   1871			__entry->iomode = iomode;
   1872			if (lo != NULL) {
   1873				__entry->layoutstateid_seq =
   1874				be32_to_cpu(lo->plh_stateid.seqid);
   1875				__entry->layoutstateid_hash =
   1876				nfs_stateid_hash(&lo->plh_stateid);
   1877			} else {
   1878				__entry->layoutstateid_seq = 0;
   1879				__entry->layoutstateid_hash = 0;
   1880			}
   1881			__entry->lseg = (long)lseg;
   1882		),
   1883		TP_printk(
   1884			"fileid=%02x:%02x:%llu fhandle=0x%08x "
   1885			"iomode=%s pos=%llu count=%llu "
   1886			"layoutstateid=%d:0x%08x lseg=0x%lx",
   1887			MAJOR(__entry->dev), MINOR(__entry->dev),
   1888			(unsigned long long)__entry->fileid,
   1889			__entry->fhandle,
   1890			show_pnfs_layout_iomode(__entry->iomode),
   1891			(unsigned long long)__entry->pos,
   1892			(unsigned long long)__entry->count,
   1893			__entry->layoutstateid_seq, __entry->layoutstateid_hash,
   1894			__entry->lseg
   1895		)
   1896);
   1897
   1898#define DEFINE_PNFS_LAYOUT_EVENT(name) \
   1899	DEFINE_EVENT(pnfs_layout_event, name, \
   1900		TP_PROTO(struct inode *inode, \
   1901			loff_t pos, \
   1902			u64 count, \
   1903			enum pnfs_iomode iomode, \
   1904			struct pnfs_layout_hdr *lo, \
   1905			struct pnfs_layout_segment *lseg \
   1906		), \
   1907		TP_ARGS(inode, pos, count, iomode, lo, lseg))
   1908
   1909DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_read);
   1910DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_write);
   1911DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_get_mirror_count);
   1912DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_done);
   1913DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done);
   1914DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist);
   1915DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist);
   1916
   1917DECLARE_EVENT_CLASS(nfs4_deviceid_event,
   1918		TP_PROTO(
   1919			const struct nfs_client *clp,
   1920			const struct nfs4_deviceid *deviceid
   1921		),
   1922
   1923		TP_ARGS(clp, deviceid),
   1924
   1925		TP_STRUCT__entry(
   1926			__string(dstaddr, clp->cl_hostname)
   1927			__array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE)
   1928		),
   1929
   1930		TP_fast_assign(
   1931			__assign_str(dstaddr, clp->cl_hostname);
   1932			memcpy(__entry->deviceid, deviceid->data,
   1933			       NFS4_DEVICEID4_SIZE);
   1934		),
   1935
   1936		TP_printk(
   1937			"deviceid=%s, dstaddr=%s",
   1938			__print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE),
   1939			__get_str(dstaddr)
   1940		)
   1941);
   1942#define DEFINE_PNFS_DEVICEID_EVENT(name) \
   1943	DEFINE_EVENT(nfs4_deviceid_event, name, \
   1944			TP_PROTO(const struct nfs_client *clp, \
   1945				const struct nfs4_deviceid *deviceid \
   1946			), \
   1947			TP_ARGS(clp, deviceid))
   1948DEFINE_PNFS_DEVICEID_EVENT(nfs4_deviceid_free);
   1949
   1950DECLARE_EVENT_CLASS(nfs4_deviceid_status,
   1951		TP_PROTO(
   1952			const struct nfs_server *server,
   1953			const struct nfs4_deviceid *deviceid,
   1954			int status
   1955		),
   1956
   1957		TP_ARGS(server, deviceid, status),
   1958
   1959		TP_STRUCT__entry(
   1960			__field(dev_t, dev)
   1961			__field(int, status)
   1962			__string(dstaddr, server->nfs_client->cl_hostname)
   1963			__array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE)
   1964		),
   1965
   1966		TP_fast_assign(
   1967			__entry->dev = server->s_dev;
   1968			__entry->status = status;
   1969			__assign_str(dstaddr, server->nfs_client->cl_hostname);
   1970			memcpy(__entry->deviceid, deviceid->data,
   1971			       NFS4_DEVICEID4_SIZE);
   1972		),
   1973
   1974		TP_printk(
   1975			"dev=%02x:%02x: deviceid=%s, dstaddr=%s, status=%d",
   1976			MAJOR(__entry->dev), MINOR(__entry->dev),
   1977			__print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE),
   1978			__get_str(dstaddr),
   1979			__entry->status
   1980		)
   1981);
   1982#define DEFINE_PNFS_DEVICEID_STATUS(name) \
   1983	DEFINE_EVENT(nfs4_deviceid_status, name, \
   1984			TP_PROTO(const struct nfs_server *server, \
   1985				const struct nfs4_deviceid *deviceid, \
   1986				int status \
   1987			), \
   1988			TP_ARGS(server, deviceid, status))
   1989DEFINE_PNFS_DEVICEID_STATUS(nfs4_getdeviceinfo);
   1990DEFINE_PNFS_DEVICEID_STATUS(nfs4_find_deviceid);
   1991
   1992DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event,
   1993		TP_PROTO(
   1994			const struct nfs_pgio_header *hdr
   1995		),
   1996
   1997		TP_ARGS(hdr),
   1998
   1999		TP_STRUCT__entry(
   2000			__field(unsigned long, error)
   2001			__field(dev_t, dev)
   2002			__field(u32, fhandle)
   2003			__field(u64, fileid)
   2004			__field(loff_t, offset)
   2005			__field(u32, count)
   2006			__field(int, stateid_seq)
   2007			__field(u32, stateid_hash)
   2008			__string(dstaddr, hdr->ds_clp ?
   2009				rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
   2010					RPC_DISPLAY_ADDR) : "unknown")
   2011		),
   2012
   2013		TP_fast_assign(
   2014			const struct inode *inode = hdr->inode;
   2015
   2016			__entry->error = hdr->res.op_status;
   2017			__entry->fhandle = nfs_fhandle_hash(hdr->args.fh);
   2018			__entry->fileid = NFS_FILEID(inode);
   2019			__entry->dev = inode->i_sb->s_dev;
   2020			__entry->offset = hdr->args.offset;
   2021			__entry->count = hdr->args.count;
   2022			__entry->stateid_seq =
   2023				be32_to_cpu(hdr->args.stateid.seqid);
   2024			__entry->stateid_hash =
   2025				nfs_stateid_hash(&hdr->args.stateid);
   2026			__assign_str(dstaddr, hdr->ds_clp ?
   2027				rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
   2028					RPC_DISPLAY_ADDR) : "unknown");
   2029		),
   2030
   2031		TP_printk(
   2032			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   2033			"offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s",
   2034			-__entry->error,
   2035			show_nfs4_status(__entry->error),
   2036			MAJOR(__entry->dev), MINOR(__entry->dev),
   2037			(unsigned long long)__entry->fileid,
   2038			__entry->fhandle,
   2039			__entry->offset, __entry->count,
   2040			__entry->stateid_seq, __entry->stateid_hash,
   2041			__get_str(dstaddr)
   2042		)
   2043);
   2044
   2045#define DEFINE_NFS4_FLEXFILES_IO_EVENT(name) \
   2046	DEFINE_EVENT(nfs4_flexfiles_io_event, name, \
   2047			TP_PROTO( \
   2048				const struct nfs_pgio_header *hdr \
   2049			), \
   2050			TP_ARGS(hdr))
   2051DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_read_error);
   2052DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_write_error);
   2053
   2054TRACE_EVENT(ff_layout_commit_error,
   2055		TP_PROTO(
   2056			const struct nfs_commit_data *data
   2057		),
   2058
   2059		TP_ARGS(data),
   2060
   2061		TP_STRUCT__entry(
   2062			__field(unsigned long, error)
   2063			__field(dev_t, dev)
   2064			__field(u32, fhandle)
   2065			__field(u64, fileid)
   2066			__field(loff_t, offset)
   2067			__field(u32, count)
   2068			__string(dstaddr, data->ds_clp ?
   2069				rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
   2070					RPC_DISPLAY_ADDR) : "unknown")
   2071		),
   2072
   2073		TP_fast_assign(
   2074			const struct inode *inode = data->inode;
   2075
   2076			__entry->error = data->res.op_status;
   2077			__entry->fhandle = nfs_fhandle_hash(data->args.fh);
   2078			__entry->fileid = NFS_FILEID(inode);
   2079			__entry->dev = inode->i_sb->s_dev;
   2080			__entry->offset = data->args.offset;
   2081			__entry->count = data->args.count;
   2082			__assign_str(dstaddr, data->ds_clp ?
   2083				rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
   2084					RPC_DISPLAY_ADDR) : "unknown");
   2085		),
   2086
   2087		TP_printk(
   2088			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   2089			"offset=%llu count=%u dstaddr=%s",
   2090			-__entry->error,
   2091			show_nfs4_status(__entry->error),
   2092			MAJOR(__entry->dev), MINOR(__entry->dev),
   2093			(unsigned long long)__entry->fileid,
   2094			__entry->fhandle,
   2095			__entry->offset, __entry->count,
   2096			__get_str(dstaddr)
   2097		)
   2098);
   2099
   2100TRACE_DEFINE_ENUM(NFS4_CONTENT_DATA);
   2101TRACE_DEFINE_ENUM(NFS4_CONTENT_HOLE);
   2102
   2103#define show_llseek_mode(what)			\
   2104	__print_symbolic(what,			\
   2105		{ NFS4_CONTENT_DATA, "DATA" },		\
   2106		{ NFS4_CONTENT_HOLE, "HOLE" })
   2107
   2108#ifdef CONFIG_NFS_V4_2
   2109TRACE_EVENT(nfs4_llseek,
   2110		TP_PROTO(
   2111			const struct inode *inode,
   2112			const struct nfs42_seek_args *args,
   2113			const struct nfs42_seek_res *res,
   2114			int error
   2115		),
   2116
   2117		TP_ARGS(inode, args, res, error),
   2118
   2119		TP_STRUCT__entry(
   2120			__field(unsigned long, error)
   2121			__field(u32, fhandle)
   2122			__field(u32, fileid)
   2123			__field(dev_t, dev)
   2124			__field(int, stateid_seq)
   2125			__field(u32, stateid_hash)
   2126			__field(loff_t, offset_s)
   2127			__field(u32, what)
   2128			__field(loff_t, offset_r)
   2129			__field(u32, eof)
   2130		),
   2131
   2132		TP_fast_assign(
   2133			const struct nfs_inode *nfsi = NFS_I(inode);
   2134			const struct nfs_fh *fh = args->sa_fh;
   2135
   2136			__entry->fileid = nfsi->fileid;
   2137			__entry->dev = inode->i_sb->s_dev;
   2138			__entry->fhandle = nfs_fhandle_hash(fh);
   2139			__entry->offset_s = args->sa_offset;
   2140			__entry->stateid_seq =
   2141				be32_to_cpu(args->sa_stateid.seqid);
   2142			__entry->stateid_hash =
   2143				nfs_stateid_hash(&args->sa_stateid);
   2144			__entry->what = args->sa_what;
   2145			if (error) {
   2146				__entry->error = -error;
   2147				__entry->offset_r = 0;
   2148				__entry->eof = 0;
   2149			} else {
   2150				__entry->error = 0;
   2151				__entry->offset_r = res->sr_offset;
   2152				__entry->eof = res->sr_eof;
   2153			}
   2154		),
   2155
   2156		TP_printk(
   2157			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   2158			"stateid=%d:0x%08x offset_s=%llu what=%s "
   2159			"offset_r=%llu eof=%u",
   2160			-__entry->error,
   2161			show_nfs4_status(__entry->error),
   2162			MAJOR(__entry->dev), MINOR(__entry->dev),
   2163			(unsigned long long)__entry->fileid,
   2164			__entry->fhandle,
   2165			__entry->stateid_seq, __entry->stateid_hash,
   2166			__entry->offset_s,
   2167			show_llseek_mode(__entry->what),
   2168			__entry->offset_r,
   2169			__entry->eof
   2170		)
   2171);
   2172
   2173DECLARE_EVENT_CLASS(nfs4_sparse_event,
   2174		TP_PROTO(
   2175			const struct inode *inode,
   2176			const struct nfs42_falloc_args *args,
   2177			int error
   2178		),
   2179
   2180		TP_ARGS(inode, args, error),
   2181
   2182		TP_STRUCT__entry(
   2183			__field(unsigned long, error)
   2184			__field(loff_t, offset)
   2185			__field(loff_t, len)
   2186			__field(dev_t, dev)
   2187			__field(u32, fhandle)
   2188			__field(u64, fileid)
   2189			__field(int, stateid_seq)
   2190			__field(u32, stateid_hash)
   2191		),
   2192
   2193		TP_fast_assign(
   2194			__entry->error = error < 0 ? -error : 0;
   2195			__entry->offset = args->falloc_offset;
   2196			__entry->len = args->falloc_length;
   2197			__entry->dev = inode->i_sb->s_dev;
   2198			__entry->fileid = NFS_FILEID(inode);
   2199			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
   2200			__entry->stateid_seq =
   2201				be32_to_cpu(args->falloc_stateid.seqid);
   2202			__entry->stateid_hash =
   2203				nfs_stateid_hash(&args->falloc_stateid);
   2204		),
   2205
   2206		TP_printk(
   2207			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   2208			"stateid=%d:0x%08x offset=%llu len=%llu",
   2209			-__entry->error,
   2210			show_nfs4_status(__entry->error),
   2211			MAJOR(__entry->dev), MINOR(__entry->dev),
   2212			(unsigned long long)__entry->fileid,
   2213			__entry->fhandle,
   2214			__entry->stateid_seq, __entry->stateid_hash,
   2215			(long long)__entry->offset,
   2216			(long long)__entry->len
   2217		)
   2218);
   2219#define DEFINE_NFS4_SPARSE_EVENT(name) \
   2220	DEFINE_EVENT(nfs4_sparse_event, name, \
   2221			TP_PROTO( \
   2222				const struct inode *inode, \
   2223				const struct nfs42_falloc_args *args, \
   2224				int error \
   2225			), \
   2226			TP_ARGS(inode, args, error))
   2227DEFINE_NFS4_SPARSE_EVENT(nfs4_fallocate);
   2228DEFINE_NFS4_SPARSE_EVENT(nfs4_deallocate);
   2229
   2230TRACE_EVENT(nfs4_copy,
   2231		TP_PROTO(
   2232			const struct inode *src_inode,
   2233			const struct inode *dst_inode,
   2234			const struct nfs42_copy_args *args,
   2235			const struct nfs42_copy_res *res,
   2236			const struct nl4_server *nss,
   2237			int error
   2238		),
   2239
   2240		TP_ARGS(src_inode, dst_inode, args, res, nss, error),
   2241
   2242		TP_STRUCT__entry(
   2243			__field(unsigned long, error)
   2244			__field(u32, src_fhandle)
   2245			__field(u32, src_fileid)
   2246			__field(u32, dst_fhandle)
   2247			__field(u32, dst_fileid)
   2248			__field(dev_t, src_dev)
   2249			__field(dev_t, dst_dev)
   2250			__field(int, src_stateid_seq)
   2251			__field(u32, src_stateid_hash)
   2252			__field(int, dst_stateid_seq)
   2253			__field(u32, dst_stateid_hash)
   2254			__field(loff_t, src_offset)
   2255			__field(loff_t, dst_offset)
   2256			__field(bool, sync)
   2257			__field(loff_t, len)
   2258			__field(int, res_stateid_seq)
   2259			__field(u32, res_stateid_hash)
   2260			__field(loff_t, res_count)
   2261			__field(bool, res_sync)
   2262			__field(bool, res_cons)
   2263			__field(bool, intra)
   2264		),
   2265
   2266		TP_fast_assign(
   2267			const struct nfs_inode *src_nfsi = NFS_I(src_inode);
   2268			const struct nfs_inode *dst_nfsi = NFS_I(dst_inode);
   2269
   2270			__entry->src_fileid = src_nfsi->fileid;
   2271			__entry->src_dev = src_inode->i_sb->s_dev;
   2272			__entry->src_fhandle = nfs_fhandle_hash(args->src_fh);
   2273			__entry->src_offset = args->src_pos;
   2274			__entry->dst_fileid = dst_nfsi->fileid;
   2275			__entry->dst_dev = dst_inode->i_sb->s_dev;
   2276			__entry->dst_fhandle = nfs_fhandle_hash(args->dst_fh);
   2277			__entry->dst_offset = args->dst_pos;
   2278			__entry->len = args->count;
   2279			__entry->sync = args->sync;
   2280			__entry->src_stateid_seq =
   2281				be32_to_cpu(args->src_stateid.seqid);
   2282			__entry->src_stateid_hash =
   2283				nfs_stateid_hash(&args->src_stateid);
   2284			__entry->dst_stateid_seq =
   2285				be32_to_cpu(args->dst_stateid.seqid);
   2286			__entry->dst_stateid_hash =
   2287				nfs_stateid_hash(&args->dst_stateid);
   2288			__entry->intra = nss ? 0 : 1;
   2289			if (error) {
   2290				__entry->error = -error;
   2291				__entry->res_stateid_seq = 0;
   2292				__entry->res_stateid_hash = 0;
   2293				__entry->res_count = 0;
   2294				__entry->res_sync = 0;
   2295				__entry->res_cons = 0;
   2296			} else {
   2297				__entry->error = 0;
   2298				__entry->res_stateid_seq =
   2299					be32_to_cpu(res->write_res.stateid.seqid);
   2300				__entry->res_stateid_hash =
   2301					nfs_stateid_hash(&res->write_res.stateid);
   2302				__entry->res_count = res->write_res.count;
   2303				__entry->res_sync = res->synchronous;
   2304				__entry->res_cons = res->consecutive;
   2305			}
   2306		),
   2307
   2308		TP_printk(
   2309			"error=%ld (%s) intra=%d src_fileid=%02x:%02x:%llu "
   2310			"src_fhandle=0x%08x dst_fileid=%02x:%02x:%llu "
   2311			"dst_fhandle=0x%08x src_stateid=%d:0x%08x "
   2312			"dst_stateid=%d:0x%08x src_offset=%llu dst_offset=%llu "
   2313			"len=%llu sync=%d cb_stateid=%d:0x%08x res_sync=%d "
   2314			"res_cons=%d res_count=%llu",
   2315			-__entry->error,
   2316			show_nfs4_status(__entry->error),
   2317			__entry->intra,
   2318			MAJOR(__entry->src_dev), MINOR(__entry->src_dev),
   2319			(unsigned long long)__entry->src_fileid,
   2320			__entry->src_fhandle,
   2321			MAJOR(__entry->dst_dev), MINOR(__entry->dst_dev),
   2322			(unsigned long long)__entry->dst_fileid,
   2323			__entry->dst_fhandle,
   2324			__entry->src_stateid_seq, __entry->src_stateid_hash,
   2325			__entry->dst_stateid_seq, __entry->dst_stateid_hash,
   2326			__entry->src_offset,
   2327			__entry->dst_offset,
   2328			__entry->len,
   2329			__entry->sync,
   2330			__entry->res_stateid_seq, __entry->res_stateid_hash,
   2331			__entry->res_sync,
   2332			__entry->res_cons,
   2333			__entry->res_count
   2334		)
   2335);
   2336
   2337TRACE_EVENT(nfs4_clone,
   2338		TP_PROTO(
   2339			const struct inode *src_inode,
   2340			const struct inode *dst_inode,
   2341			const struct nfs42_clone_args *args,
   2342			int error
   2343		),
   2344
   2345		TP_ARGS(src_inode, dst_inode, args, error),
   2346
   2347		TP_STRUCT__entry(
   2348			__field(unsigned long, error)
   2349			__field(u32, src_fhandle)
   2350			__field(u32, src_fileid)
   2351			__field(u32, dst_fhandle)
   2352			__field(u32, dst_fileid)
   2353			__field(dev_t, src_dev)
   2354			__field(dev_t, dst_dev)
   2355			__field(loff_t, src_offset)
   2356			__field(loff_t, dst_offset)
   2357			__field(int, src_stateid_seq)
   2358			__field(u32, src_stateid_hash)
   2359			__field(int, dst_stateid_seq)
   2360			__field(u32, dst_stateid_hash)
   2361			__field(loff_t, len)
   2362		),
   2363
   2364		TP_fast_assign(
   2365			const struct nfs_inode *src_nfsi = NFS_I(src_inode);
   2366			const struct nfs_inode *dst_nfsi = NFS_I(dst_inode);
   2367
   2368			__entry->src_fileid = src_nfsi->fileid;
   2369			__entry->src_dev = src_inode->i_sb->s_dev;
   2370			__entry->src_fhandle = nfs_fhandle_hash(args->src_fh);
   2371			__entry->src_offset = args->src_offset;
   2372			__entry->dst_fileid = dst_nfsi->fileid;
   2373			__entry->dst_dev = dst_inode->i_sb->s_dev;
   2374			__entry->dst_fhandle = nfs_fhandle_hash(args->dst_fh);
   2375			__entry->dst_offset = args->dst_offset;
   2376			__entry->len = args->count;
   2377			__entry->error = error < 0 ? -error : 0;
   2378			__entry->src_stateid_seq =
   2379				be32_to_cpu(args->src_stateid.seqid);
   2380			__entry->src_stateid_hash =
   2381				nfs_stateid_hash(&args->src_stateid);
   2382			__entry->dst_stateid_seq =
   2383				be32_to_cpu(args->dst_stateid.seqid);
   2384			__entry->dst_stateid_hash =
   2385				nfs_stateid_hash(&args->dst_stateid);
   2386		),
   2387
   2388		TP_printk(
   2389			"error=%ld (%s) src_fileid=%02x:%02x:%llu "
   2390			"src_fhandle=0x%08x dst_fileid=%02x:%02x:%llu "
   2391			"dst_fhandle=0x%08x src_stateid=%d:0x%08x "
   2392			"dst_stateid=%d:0x%08x src_offset=%llu "
   2393			"dst_offset=%llu len=%llu",
   2394			-__entry->error,
   2395			show_nfs4_status(__entry->error),
   2396			MAJOR(__entry->src_dev), MINOR(__entry->src_dev),
   2397			(unsigned long long)__entry->src_fileid,
   2398			__entry->src_fhandle,
   2399			MAJOR(__entry->dst_dev), MINOR(__entry->dst_dev),
   2400			(unsigned long long)__entry->dst_fileid,
   2401			__entry->dst_fhandle,
   2402			__entry->src_stateid_seq, __entry->src_stateid_hash,
   2403			__entry->dst_stateid_seq, __entry->dst_stateid_hash,
   2404			__entry->src_offset,
   2405			__entry->dst_offset,
   2406			__entry->len
   2407		)
   2408);
   2409
   2410TRACE_EVENT(nfs4_copy_notify,
   2411		TP_PROTO(
   2412			const struct inode *inode,
   2413			const struct nfs42_copy_notify_args *args,
   2414			const struct nfs42_copy_notify_res *res,
   2415			int error
   2416		),
   2417
   2418		TP_ARGS(inode, args, res, error),
   2419
   2420		TP_STRUCT__entry(
   2421			__field(unsigned long, error)
   2422			__field(u32, fhandle)
   2423			__field(u32, fileid)
   2424			__field(dev_t, dev)
   2425			__field(int, stateid_seq)
   2426			__field(u32, stateid_hash)
   2427			__field(int, res_stateid_seq)
   2428			__field(u32, res_stateid_hash)
   2429		),
   2430
   2431		TP_fast_assign(
   2432			const struct nfs_inode *nfsi = NFS_I(inode);
   2433
   2434			__entry->fileid = nfsi->fileid;
   2435			__entry->dev = inode->i_sb->s_dev;
   2436			__entry->fhandle = nfs_fhandle_hash(args->cna_src_fh);
   2437			__entry->stateid_seq =
   2438				be32_to_cpu(args->cna_src_stateid.seqid);
   2439			__entry->stateid_hash =
   2440				nfs_stateid_hash(&args->cna_src_stateid);
   2441			if (error) {
   2442				__entry->error = -error;
   2443				__entry->res_stateid_seq = 0;
   2444				__entry->res_stateid_hash = 0;
   2445			} else {
   2446				__entry->error = 0;
   2447				__entry->res_stateid_seq =
   2448					be32_to_cpu(res->cnr_stateid.seqid);
   2449				__entry->res_stateid_hash =
   2450					nfs_stateid_hash(&res->cnr_stateid);
   2451			}
   2452		),
   2453
   2454		TP_printk(
   2455			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
   2456			"stateid=%d:0x%08x res_stateid=%d:0x%08x",
   2457			-__entry->error,
   2458			show_nfs4_status(__entry->error),
   2459			MAJOR(__entry->dev), MINOR(__entry->dev),
   2460			(unsigned long long)__entry->fileid,
   2461			__entry->fhandle,
   2462			__entry->stateid_seq, __entry->stateid_hash,
   2463			__entry->res_stateid_seq, __entry->res_stateid_hash
   2464		)
   2465);
   2466
   2467TRACE_EVENT(nfs4_offload_cancel,
   2468		TP_PROTO(
   2469			const struct nfs42_offload_status_args *args,
   2470			int error
   2471		),
   2472
   2473		TP_ARGS(args, error),
   2474
   2475		TP_STRUCT__entry(
   2476			__field(unsigned long, error)
   2477			__field(u32, fhandle)
   2478			__field(int, stateid_seq)
   2479			__field(u32, stateid_hash)
   2480		),
   2481
   2482		TP_fast_assign(
   2483			__entry->fhandle = nfs_fhandle_hash(args->osa_src_fh);
   2484			__entry->error = error < 0 ? -error : 0;
   2485			__entry->stateid_seq =
   2486				be32_to_cpu(args->osa_stateid.seqid);
   2487			__entry->stateid_hash =
   2488				nfs_stateid_hash(&args->osa_stateid);
   2489		),
   2490
   2491		TP_printk(
   2492			"error=%ld (%s) fhandle=0x%08x stateid=%d:0x%08x",
   2493			-__entry->error,
   2494			show_nfs4_status(__entry->error),
   2495			__entry->fhandle,
   2496			__entry->stateid_seq, __entry->stateid_hash
   2497		)
   2498);
   2499#endif /* CONFIG_NFS_V4_2 */
   2500
   2501#endif /* CONFIG_NFS_V4_1 */
   2502
   2503#endif /* _TRACE_NFS4_H */
   2504
   2505#undef TRACE_INCLUDE_PATH
   2506#define TRACE_INCLUDE_PATH .
   2507#define TRACE_INCLUDE_FILE nfs4trace
   2508/* This part must be outside protection */
   2509#include <trace/define_trace.h>