xref: /openbmc/linux/fs/nfs/nfs4trace.h (revision 52618df9)
1c6d01c6fSTrond Myklebust /*
2c6d01c6fSTrond Myklebust  * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
3c6d01c6fSTrond Myklebust  */
4c6d01c6fSTrond Myklebust #undef TRACE_SYSTEM
5c6d01c6fSTrond Myklebust #define TRACE_SYSTEM nfs4
6c6d01c6fSTrond Myklebust 
7c6d01c6fSTrond Myklebust #if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
8c6d01c6fSTrond Myklebust #define _TRACE_NFS4_H
9c6d01c6fSTrond Myklebust 
10c6d01c6fSTrond Myklebust #include <linux/tracepoint.h>
11c6d01c6fSTrond Myklebust 
12c6d01c6fSTrond Myklebust #define show_nfsv4_errors(error) \
13c6d01c6fSTrond Myklebust 	__print_symbolic(error, \
14c6d01c6fSTrond Myklebust 		{ NFS4_OK, "OK" }, \
15c6d01c6fSTrond Myklebust 		/* Mapped by nfs4_stat_to_errno() */ \
16c6d01c6fSTrond Myklebust 		{ -EPERM, "EPERM" }, \
17c6d01c6fSTrond Myklebust 		{ -ENOENT, "ENOENT" }, \
18c6d01c6fSTrond Myklebust 		{ -EIO, "EIO" }, \
19c6d01c6fSTrond Myklebust 		{ -ENXIO, "ENXIO" }, \
20c6d01c6fSTrond Myklebust 		{ -EACCES, "EACCES" }, \
21c6d01c6fSTrond Myklebust 		{ -EEXIST, "EEXIST" }, \
22c6d01c6fSTrond Myklebust 		{ -EXDEV, "EXDEV" }, \
23c6d01c6fSTrond Myklebust 		{ -ENOTDIR, "ENOTDIR" }, \
24c6d01c6fSTrond Myklebust 		{ -EISDIR, "EISDIR" }, \
25c6d01c6fSTrond Myklebust 		{ -EFBIG, "EFBIG" }, \
26c6d01c6fSTrond Myklebust 		{ -ENOSPC, "ENOSPC" }, \
27c6d01c6fSTrond Myklebust 		{ -EROFS, "EROFS" }, \
28c6d01c6fSTrond Myklebust 		{ -EMLINK, "EMLINK" }, \
29c6d01c6fSTrond Myklebust 		{ -ENAMETOOLONG, "ENAMETOOLONG" }, \
30c6d01c6fSTrond Myklebust 		{ -ENOTEMPTY, "ENOTEMPTY" }, \
31c6d01c6fSTrond Myklebust 		{ -EDQUOT, "EDQUOT" }, \
32c6d01c6fSTrond Myklebust 		{ -ESTALE, "ESTALE" }, \
33c6d01c6fSTrond Myklebust 		{ -EBADHANDLE, "EBADHANDLE" }, \
34c6d01c6fSTrond Myklebust 		{ -EBADCOOKIE, "EBADCOOKIE" }, \
35c6d01c6fSTrond Myklebust 		{ -ENOTSUPP, "ENOTSUPP" }, \
36c6d01c6fSTrond Myklebust 		{ -ETOOSMALL, "ETOOSMALL" }, \
37c6d01c6fSTrond Myklebust 		{ -EREMOTEIO, "EREMOTEIO" }, \
38c6d01c6fSTrond Myklebust 		{ -EBADTYPE, "EBADTYPE" }, \
39c6d01c6fSTrond Myklebust 		{ -EAGAIN, "EAGAIN" }, \
40c6d01c6fSTrond Myklebust 		{ -ELOOP, "ELOOP" }, \
41c6d01c6fSTrond Myklebust 		{ -EOPNOTSUPP, "EOPNOTSUPP" }, \
42c6d01c6fSTrond Myklebust 		{ -EDEADLK, "EDEADLK" }, \
43c6d01c6fSTrond Myklebust 		/* RPC errors */ \
44c6d01c6fSTrond Myklebust 		{ -ENOMEM, "ENOMEM" }, \
45c6d01c6fSTrond Myklebust 		{ -EKEYEXPIRED, "EKEYEXPIRED" }, \
46c6d01c6fSTrond Myklebust 		{ -ETIMEDOUT, "ETIMEDOUT" }, \
47c6d01c6fSTrond Myklebust 		{ -ERESTARTSYS, "ERESTARTSYS" }, \
48c6d01c6fSTrond Myklebust 		{ -ECONNREFUSED, "ECONNREFUSED" }, \
49c6d01c6fSTrond Myklebust 		{ -ECONNRESET, "ECONNRESET" }, \
50c6d01c6fSTrond Myklebust 		{ -ENETUNREACH, "ENETUNREACH" }, \
51c6d01c6fSTrond Myklebust 		{ -EHOSTUNREACH, "EHOSTUNREACH" }, \
52c6d01c6fSTrond Myklebust 		{ -EHOSTDOWN, "EHOSTDOWN" }, \
53c6d01c6fSTrond Myklebust 		{ -EPIPE, "EPIPE" }, \
54c6d01c6fSTrond Myklebust 		{ -EPFNOSUPPORT, "EPFNOSUPPORT" }, \
55c6d01c6fSTrond Myklebust 		{ -EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \
56c6d01c6fSTrond Myklebust 		/* NFSv4 native errors */ \
57c6d01c6fSTrond Myklebust 		{ -NFS4ERR_ACCESS, "ACCESS" }, \
58c6d01c6fSTrond Myklebust 		{ -NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \
59c6d01c6fSTrond Myklebust 		{ -NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \
60c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \
61c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BADCHAR, "BADCHAR" }, \
62c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BADHANDLE, "BADHANDLE" }, \
63c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BADIOMODE, "BADIOMODE" }, \
64c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \
65c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BADLABEL, "BADLABEL" }, \
66c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BADNAME, "BADNAME" }, \
67c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BADOWNER, "BADOWNER" }, \
68c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BADSESSION, "BADSESSION" }, \
69c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BADSLOT, "BADSLOT" }, \
70c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BADTYPE, "BADTYPE" }, \
71c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BADXDR, "BADXDR" }, \
72c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \
73c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \
74c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \
75c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \
76c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \
77c6d01c6fSTrond Myklebust 		{ -NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \
78c6d01c6fSTrond Myklebust 		{ -NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
79c6d01c6fSTrond Myklebust 		{ -NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \
80c6d01c6fSTrond Myklebust 		{ -NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \
81c6d01c6fSTrond Myklebust 		{ -NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \
82c6d01c6fSTrond Myklebust 		{ -NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \
83c6d01c6fSTrond Myklebust 			"CONN_NOT_BOUND_TO_SESSION" }, \
84c6d01c6fSTrond Myklebust 		{ -NFS4ERR_DEADLOCK, "DEADLOCK" }, \
85c6d01c6fSTrond Myklebust 		{ -NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \
86c6d01c6fSTrond Myklebust 		{ -NFS4ERR_DELAY, "DELAY" }, \
87c6d01c6fSTrond Myklebust 		{ -NFS4ERR_DELEG_ALREADY_WANTED, \
88c6d01c6fSTrond Myklebust 			"DELEG_ALREADY_WANTED" }, \
89c6d01c6fSTrond Myklebust 		{ -NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \
90c6d01c6fSTrond Myklebust 		{ -NFS4ERR_DENIED, "DENIED" }, \
91c6d01c6fSTrond Myklebust 		{ -NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \
92c6d01c6fSTrond Myklebust 		{ -NFS4ERR_DQUOT, "DQUOT" }, \
93c6d01c6fSTrond Myklebust 		{ -NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \
94c6d01c6fSTrond Myklebust 		{ -NFS4ERR_EXIST, "EXIST" }, \
95c6d01c6fSTrond Myklebust 		{ -NFS4ERR_EXPIRED, "EXPIRED" }, \
96c6d01c6fSTrond Myklebust 		{ -NFS4ERR_FBIG, "FBIG" }, \
97c6d01c6fSTrond Myklebust 		{ -NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \
98c6d01c6fSTrond Myklebust 		{ -NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \
99c6d01c6fSTrond Myklebust 		{ -NFS4ERR_GRACE, "GRACE" }, \
100c6d01c6fSTrond Myklebust 		{ -NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \
101c6d01c6fSTrond Myklebust 		{ -NFS4ERR_INVAL, "INVAL" }, \
102c6d01c6fSTrond Myklebust 		{ -NFS4ERR_IO, "IO" }, \
103c6d01c6fSTrond Myklebust 		{ -NFS4ERR_ISDIR, "ISDIR" }, \
104c6d01c6fSTrond Myklebust 		{ -NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \
105c6d01c6fSTrond Myklebust 		{ -NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \
106c6d01c6fSTrond Myklebust 		{ -NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \
107c6d01c6fSTrond Myklebust 		{ -NFS4ERR_LOCKED, "LOCKED" }, \
108c6d01c6fSTrond Myklebust 		{ -NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \
109c6d01c6fSTrond Myklebust 		{ -NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \
110c6d01c6fSTrond Myklebust 		{ -NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \
111c6d01c6fSTrond Myklebust 		{ -NFS4ERR_MLINK, "MLINK" }, \
112c6d01c6fSTrond Myklebust 		{ -NFS4ERR_MOVED, "MOVED" }, \
113c6d01c6fSTrond Myklebust 		{ -NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \
114c6d01c6fSTrond Myklebust 		{ -NFS4ERR_NOENT, "NOENT" }, \
115c6d01c6fSTrond Myklebust 		{ -NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \
116c6d01c6fSTrond Myklebust 		{ -NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \
117c6d01c6fSTrond Myklebust 		{ -NFS4ERR_NOSPC, "NOSPC" }, \
118c6d01c6fSTrond Myklebust 		{ -NFS4ERR_NOTDIR, "NOTDIR" }, \
119c6d01c6fSTrond Myklebust 		{ -NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \
120c6d01c6fSTrond Myklebust 		{ -NFS4ERR_NOTSUPP, "NOTSUPP" }, \
121c6d01c6fSTrond Myklebust 		{ -NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \
122c6d01c6fSTrond Myklebust 		{ -NFS4ERR_NOT_SAME, "NOT_SAME" }, \
123c6d01c6fSTrond Myklebust 		{ -NFS4ERR_NO_GRACE, "NO_GRACE" }, \
124c6d01c6fSTrond Myklebust 		{ -NFS4ERR_NXIO, "NXIO" }, \
125c6d01c6fSTrond Myklebust 		{ -NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \
126c6d01c6fSTrond Myklebust 		{ -NFS4ERR_OPENMODE, "OPENMODE" }, \
127c6d01c6fSTrond Myklebust 		{ -NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \
128c6d01c6fSTrond Myklebust 		{ -NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \
129c6d01c6fSTrond Myklebust 		{ -NFS4ERR_PERM, "PERM" }, \
130c6d01c6fSTrond Myklebust 		{ -NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \
131c6d01c6fSTrond Myklebust 		{ -NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \
132c6d01c6fSTrond Myklebust 		{ -NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \
133c6d01c6fSTrond Myklebust 		{ -NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \
134c6d01c6fSTrond Myklebust 		{ -NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \
135c6d01c6fSTrond Myklebust 		{ -NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \
136c6d01c6fSTrond Myklebust 		{ -NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \
137c6d01c6fSTrond Myklebust 		{ -NFS4ERR_REP_TOO_BIG_TO_CACHE, \
138c6d01c6fSTrond Myklebust 			"REP_TOO_BIG_TO_CACHE" }, \
139c6d01c6fSTrond Myklebust 		{ -NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \
140c6d01c6fSTrond Myklebust 		{ -NFS4ERR_RESOURCE, "RESOURCE" }, \
141c6d01c6fSTrond Myklebust 		{ -NFS4ERR_RESTOREFH, "RESTOREFH" }, \
142c6d01c6fSTrond Myklebust 		{ -NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \
143c6d01c6fSTrond Myklebust 		{ -NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \
144c6d01c6fSTrond Myklebust 		{ -NFS4ERR_ROFS, "ROFS" }, \
145c6d01c6fSTrond Myklebust 		{ -NFS4ERR_SAME, "SAME" }, \
146c6d01c6fSTrond Myklebust 		{ -NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \
147c6d01c6fSTrond Myklebust 		{ -NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \
148c6d01c6fSTrond Myklebust 		{ -NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \
149c6d01c6fSTrond Myklebust 		{ -NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \
150c6d01c6fSTrond Myklebust 		{ -NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \
151c6d01c6fSTrond Myklebust 		{ -NFS4ERR_STALE, "STALE" }, \
152c6d01c6fSTrond Myklebust 		{ -NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \
153c6d01c6fSTrond Myklebust 		{ -NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \
154c6d01c6fSTrond Myklebust 		{ -NFS4ERR_SYMLINK, "SYMLINK" }, \
155c6d01c6fSTrond Myklebust 		{ -NFS4ERR_TOOSMALL, "TOOSMALL" }, \
156c6d01c6fSTrond Myklebust 		{ -NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \
157c6d01c6fSTrond Myklebust 		{ -NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \
158c6d01c6fSTrond Myklebust 		{ -NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \
159c6d01c6fSTrond Myklebust 		{ -NFS4ERR_WRONGSEC, "WRONGSEC" }, \
160c6d01c6fSTrond Myklebust 		{ -NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
161c6d01c6fSTrond Myklebust 		{ -NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
162c6d01c6fSTrond Myklebust 		{ -NFS4ERR_XDEV, "XDEV" })
163c6d01c6fSTrond Myklebust 
16442113a75STrond Myklebust #define show_open_flags(flags) \
16542113a75STrond Myklebust 	__print_flags(flags, "|", \
16642113a75STrond Myklebust 		{ O_CREAT, "O_CREAT" }, \
16742113a75STrond Myklebust 		{ O_EXCL, "O_EXCL" }, \
16842113a75STrond Myklebust 		{ O_TRUNC, "O_TRUNC" }, \
16942113a75STrond Myklebust 		{ O_DIRECT, "O_DIRECT" })
17042113a75STrond Myklebust 
17142113a75STrond Myklebust #define show_fmode_flags(mode) \
17242113a75STrond Myklebust 	__print_flags(mode, "|", \
17342113a75STrond Myklebust 		{ ((__force unsigned long)FMODE_READ), "READ" }, \
17442113a75STrond Myklebust 		{ ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
17542113a75STrond Myklebust 		{ ((__force unsigned long)FMODE_EXEC), "EXEC" })
17642113a75STrond Myklebust 
177b5f875a9STrond Myklebust #define show_nfs_fattr_flags(valid) \
178b5f875a9STrond Myklebust 	__print_flags((unsigned long)valid, "|", \
179b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_TYPE, "TYPE" }, \
180b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_MODE, "MODE" }, \
181b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_NLINK, "NLINK" }, \
182b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_OWNER, "OWNER" }, \
183b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_GROUP, "GROUP" }, \
184b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_RDEV, "RDEV" }, \
185b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_SIZE, "SIZE" }, \
186b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_FSID, "FSID" }, \
187b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_FILEID, "FILEID" }, \
188b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_ATIME, "ATIME" }, \
189b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_MTIME, "MTIME" }, \
190b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_CTIME, "CTIME" }, \
191b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
192b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
193b5f875a9STrond Myklebust 		{ NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
194b5f875a9STrond Myklebust 
195c6d01c6fSTrond Myklebust DECLARE_EVENT_CLASS(nfs4_clientid_event,
196c6d01c6fSTrond Myklebust 		TP_PROTO(
197c6d01c6fSTrond Myklebust 			const struct nfs_client *clp,
198c6d01c6fSTrond Myklebust 			int error
199c6d01c6fSTrond Myklebust 		),
200c6d01c6fSTrond Myklebust 
201c6d01c6fSTrond Myklebust 		TP_ARGS(clp, error),
202c6d01c6fSTrond Myklebust 
203c6d01c6fSTrond Myklebust 		TP_STRUCT__entry(
204c6d01c6fSTrond Myklebust 			__string(dstaddr,
205c6d01c6fSTrond Myklebust 				rpc_peeraddr2str(clp->cl_rpcclient,
206c6d01c6fSTrond Myklebust 					RPC_DISPLAY_ADDR))
207c6d01c6fSTrond Myklebust 			__field(int, error)
208c6d01c6fSTrond Myklebust 		),
209c6d01c6fSTrond Myklebust 
210c6d01c6fSTrond Myklebust 		TP_fast_assign(
211c6d01c6fSTrond Myklebust 			__entry->error = error;
212c6d01c6fSTrond Myklebust 			__assign_str(dstaddr,
213c6d01c6fSTrond Myklebust 				rpc_peeraddr2str(clp->cl_rpcclient,
214c6d01c6fSTrond Myklebust 						RPC_DISPLAY_ADDR));
215c6d01c6fSTrond Myklebust 		),
216c6d01c6fSTrond Myklebust 
217c6d01c6fSTrond Myklebust 		TP_printk(
218c6d01c6fSTrond Myklebust 			"error=%d (%s) dstaddr=%s",
219c6d01c6fSTrond Myklebust 			__entry->error,
220c6d01c6fSTrond Myklebust 			show_nfsv4_errors(__entry->error),
221c6d01c6fSTrond Myklebust 			__get_str(dstaddr)
222c6d01c6fSTrond Myklebust 		)
223c6d01c6fSTrond Myklebust );
224c6d01c6fSTrond Myklebust #define DEFINE_NFS4_CLIENTID_EVENT(name) \
225c6d01c6fSTrond Myklebust 	DEFINE_EVENT(nfs4_clientid_event, name,	 \
226c6d01c6fSTrond Myklebust 			TP_PROTO( \
227c6d01c6fSTrond Myklebust 				const struct nfs_client *clp, \
228c6d01c6fSTrond Myklebust 				int error \
229c6d01c6fSTrond Myklebust 			), \
230c6d01c6fSTrond Myklebust 			TP_ARGS(clp, error))
231c6d01c6fSTrond Myklebust DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
232c6d01c6fSTrond Myklebust DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
233c6d01c6fSTrond Myklebust DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
234c6d01c6fSTrond Myklebust DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
235c6d01c6fSTrond Myklebust #ifdef CONFIG_NFS_V4_1
236c6d01c6fSTrond Myklebust DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
237c6d01c6fSTrond Myklebust DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
238c6d01c6fSTrond Myklebust DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
239c6d01c6fSTrond Myklebust DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
240c6d01c6fSTrond Myklebust DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
241c6d01c6fSTrond Myklebust DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
242c6d01c6fSTrond Myklebust DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
2432f92ae34STrond Myklebust 
2442f92ae34STrond Myklebust TRACE_EVENT(nfs4_setup_sequence,
2452f92ae34STrond Myklebust 		TP_PROTO(
2462f92ae34STrond Myklebust 			const struct nfs4_session *session,
2472f92ae34STrond Myklebust 			const struct nfs4_sequence_args *args
2482f92ae34STrond Myklebust 		),
2492f92ae34STrond Myklebust 		TP_ARGS(session, args),
2502f92ae34STrond Myklebust 
2512f92ae34STrond Myklebust 		TP_STRUCT__entry(
2522f92ae34STrond Myklebust 			__field(unsigned int, session)
2532f92ae34STrond Myklebust 			__field(unsigned int, slot_nr)
2542f92ae34STrond Myklebust 			__field(unsigned int, seq_nr)
2552f92ae34STrond Myklebust 			__field(unsigned int, highest_used_slotid)
2562f92ae34STrond Myklebust 		),
2572f92ae34STrond Myklebust 
2582f92ae34STrond Myklebust 		TP_fast_assign(
2592f92ae34STrond Myklebust 			const struct nfs4_slot *sa_slot = args->sa_slot;
2602f92ae34STrond Myklebust 			__entry->session = nfs_session_id_hash(&session->sess_id);
2612f92ae34STrond Myklebust 			__entry->slot_nr = sa_slot->slot_nr;
2622f92ae34STrond Myklebust 			__entry->seq_nr = sa_slot->seq_nr;
2632f92ae34STrond Myklebust 			__entry->highest_used_slotid =
2642f92ae34STrond Myklebust 					sa_slot->table->highest_used_slotid;
2652f92ae34STrond Myklebust 		),
2662f92ae34STrond Myklebust 		TP_printk(
2672f92ae34STrond Myklebust 			"session=0x%08x slot_nr=%u seq_nr=%u "
2682f92ae34STrond Myklebust 			"highest_used_slotid=%u",
2692f92ae34STrond Myklebust 			__entry->session,
2702f92ae34STrond Myklebust 			__entry->slot_nr,
2712f92ae34STrond Myklebust 			__entry->seq_nr,
2722f92ae34STrond Myklebust 			__entry->highest_used_slotid
2732f92ae34STrond Myklebust 		)
2742f92ae34STrond Myklebust );
2752f92ae34STrond Myklebust 
2762f92ae34STrond Myklebust #define show_nfs4_sequence_status_flags(status) \
2772f92ae34STrond Myklebust 	__print_flags((unsigned long)status, "|", \
2782f92ae34STrond Myklebust 		{ SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
2792f92ae34STrond Myklebust 		{ SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
2802f92ae34STrond Myklebust 			"CB_GSS_CONTEXTS_EXPIRING" }, \
2812f92ae34STrond Myklebust 		{ SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
2822f92ae34STrond Myklebust 			"CB_GSS_CONTEXTS_EXPIRED" }, \
2832f92ae34STrond Myklebust 		{ SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
2842f92ae34STrond Myklebust 			"EXPIRED_ALL_STATE_REVOKED" }, \
2852f92ae34STrond Myklebust 		{ SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
2862f92ae34STrond Myklebust 			"EXPIRED_SOME_STATE_REVOKED" }, \
2872f92ae34STrond Myklebust 		{ SEQ4_STATUS_ADMIN_STATE_REVOKED, \
2882f92ae34STrond Myklebust 			"ADMIN_STATE_REVOKED" }, \
2892f92ae34STrond Myklebust 		{ SEQ4_STATUS_RECALLABLE_STATE_REVOKED,	 \
2902f92ae34STrond Myklebust 			"RECALLABLE_STATE_REVOKED" }, \
2912f92ae34STrond Myklebust 		{ SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
2922f92ae34STrond Myklebust 		{ SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
2932f92ae34STrond Myklebust 			"RESTART_RECLAIM_NEEDED" }, \
2942f92ae34STrond Myklebust 		{ SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
2952f92ae34STrond Myklebust 			"CB_PATH_DOWN_SESSION" }, \
2962f92ae34STrond Myklebust 		{ SEQ4_STATUS_BACKCHANNEL_FAULT, \
2972f92ae34STrond Myklebust 			"BACKCHANNEL_FAULT" })
2982f92ae34STrond Myklebust 
2992f92ae34STrond Myklebust TRACE_EVENT(nfs4_sequence_done,
3002f92ae34STrond Myklebust 		TP_PROTO(
3012f92ae34STrond Myklebust 			const struct nfs4_session *session,
3022f92ae34STrond Myklebust 			const struct nfs4_sequence_res *res
3032f92ae34STrond Myklebust 		),
3042f92ae34STrond Myklebust 		TP_ARGS(session, res),
3052f92ae34STrond Myklebust 
3062f92ae34STrond Myklebust 		TP_STRUCT__entry(
3072f92ae34STrond Myklebust 			__field(unsigned int, session)
3082f92ae34STrond Myklebust 			__field(unsigned int, slot_nr)
3092f92ae34STrond Myklebust 			__field(unsigned int, seq_nr)
3102f92ae34STrond Myklebust 			__field(unsigned int, highest_slotid)
3112f92ae34STrond Myklebust 			__field(unsigned int, target_highest_slotid)
3122f92ae34STrond Myklebust 			__field(unsigned int, status_flags)
3132f92ae34STrond Myklebust 			__field(int, error)
3142f92ae34STrond Myklebust 		),
3152f92ae34STrond Myklebust 
3162f92ae34STrond Myklebust 		TP_fast_assign(
3172f92ae34STrond Myklebust 			const struct nfs4_slot *sr_slot = res->sr_slot;
3182f92ae34STrond Myklebust 			__entry->session = nfs_session_id_hash(&session->sess_id);
3192f92ae34STrond Myklebust 			__entry->slot_nr = sr_slot->slot_nr;
3202f92ae34STrond Myklebust 			__entry->seq_nr = sr_slot->seq_nr;
3212f92ae34STrond Myklebust 			__entry->highest_slotid = res->sr_highest_slotid;
3222f92ae34STrond Myklebust 			__entry->target_highest_slotid =
3232f92ae34STrond Myklebust 					res->sr_target_highest_slotid;
32452618df9SAndrew Elble 			__entry->status_flags = res->sr_status_flags;
3252f92ae34STrond Myklebust 			__entry->error = res->sr_status;
3262f92ae34STrond Myklebust 		),
3272f92ae34STrond Myklebust 		TP_printk(
3282f92ae34STrond Myklebust 			"error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
3292f92ae34STrond Myklebust 			"highest_slotid=%u target_highest_slotid=%u "
3302f92ae34STrond Myklebust 			"status_flags=%u (%s)",
3312f92ae34STrond Myklebust 			__entry->error,
3322f92ae34STrond Myklebust 			show_nfsv4_errors(__entry->error),
3332f92ae34STrond Myklebust 			__entry->session,
3342f92ae34STrond Myklebust 			__entry->slot_nr,
3352f92ae34STrond Myklebust 			__entry->seq_nr,
3362f92ae34STrond Myklebust 			__entry->highest_slotid,
3372f92ae34STrond Myklebust 			__entry->target_highest_slotid,
3382f92ae34STrond Myklebust 			__entry->status_flags,
3392f92ae34STrond Myklebust 			show_nfs4_sequence_status_flags(__entry->status_flags)
3402f92ae34STrond Myklebust 		)
3412f92ae34STrond Myklebust );
3422f92ae34STrond Myklebust 
3432f92ae34STrond Myklebust struct cb_sequenceargs;
3442f92ae34STrond Myklebust struct cb_sequenceres;
3452f92ae34STrond Myklebust 
3462f92ae34STrond Myklebust TRACE_EVENT(nfs4_cb_sequence,
3472f92ae34STrond Myklebust 		TP_PROTO(
3482f92ae34STrond Myklebust 			const struct cb_sequenceargs *args,
3492f92ae34STrond Myklebust 			const struct cb_sequenceres *res,
3502f92ae34STrond Myklebust 			__be32 status
3512f92ae34STrond Myklebust 		),
3522f92ae34STrond Myklebust 		TP_ARGS(args, res, status),
3532f92ae34STrond Myklebust 
3542f92ae34STrond Myklebust 		TP_STRUCT__entry(
3552f92ae34STrond Myklebust 			__field(unsigned int, session)
3562f92ae34STrond Myklebust 			__field(unsigned int, slot_nr)
3572f92ae34STrond Myklebust 			__field(unsigned int, seq_nr)
3582f92ae34STrond Myklebust 			__field(unsigned int, highest_slotid)
3592f92ae34STrond Myklebust 			__field(unsigned int, cachethis)
3602f92ae34STrond Myklebust 			__field(int, error)
3612f92ae34STrond Myklebust 		),
3622f92ae34STrond Myklebust 
3632f92ae34STrond Myklebust 		TP_fast_assign(
3642f92ae34STrond Myklebust 			__entry->session = nfs_session_id_hash(&args->csa_sessionid);
3652f92ae34STrond Myklebust 			__entry->slot_nr = args->csa_slotid;
3662f92ae34STrond Myklebust 			__entry->seq_nr = args->csa_sequenceid;
3672f92ae34STrond Myklebust 			__entry->highest_slotid = args->csa_highestslotid;
3682f92ae34STrond Myklebust 			__entry->cachethis = args->csa_cachethis;
3692f92ae34STrond Myklebust 			__entry->error = -be32_to_cpu(status);
3702f92ae34STrond Myklebust 		),
3712f92ae34STrond Myklebust 
3722f92ae34STrond Myklebust 		TP_printk(
3732f92ae34STrond Myklebust 			"error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
3742f92ae34STrond Myklebust 			"highest_slotid=%u",
3752f92ae34STrond Myklebust 			__entry->error,
3762f92ae34STrond Myklebust 			show_nfsv4_errors(__entry->error),
3772f92ae34STrond Myklebust 			__entry->session,
3782f92ae34STrond Myklebust 			__entry->slot_nr,
3792f92ae34STrond Myklebust 			__entry->seq_nr,
3802f92ae34STrond Myklebust 			__entry->highest_slotid
3812f92ae34STrond Myklebust 		)
3822f92ae34STrond Myklebust );
383c6d01c6fSTrond Myklebust #endif /* CONFIG_NFS_V4_1 */
384c6d01c6fSTrond Myklebust 
38542113a75STrond Myklebust DECLARE_EVENT_CLASS(nfs4_open_event,
38642113a75STrond Myklebust 		TP_PROTO(
38742113a75STrond Myklebust 			const struct nfs_open_context *ctx,
38842113a75STrond Myklebust 			int flags,
38942113a75STrond Myklebust 			int error
39042113a75STrond Myklebust 		),
39142113a75STrond Myklebust 
39242113a75STrond Myklebust 		TP_ARGS(ctx, flags, error),
39342113a75STrond Myklebust 
39442113a75STrond Myklebust 		TP_STRUCT__entry(
39542113a75STrond Myklebust 			__field(int, error)
39642113a75STrond Myklebust 			__field(unsigned int, flags)
39742113a75STrond Myklebust 			__field(unsigned int, fmode)
39842113a75STrond Myklebust 			__field(dev_t, dev)
39942113a75STrond Myklebust 			__field(u32, fhandle)
40042113a75STrond Myklebust 			__field(u64, fileid)
40142113a75STrond Myklebust 			__field(u64, dir)
40242113a75STrond Myklebust 			__string(name, ctx->dentry->d_name.name)
40342113a75STrond Myklebust 		),
40442113a75STrond Myklebust 
40542113a75STrond Myklebust 		TP_fast_assign(
40642113a75STrond Myklebust 			const struct nfs4_state *state = ctx->state;
40742113a75STrond Myklebust 			const struct inode *inode = NULL;
40842113a75STrond Myklebust 
40942113a75STrond Myklebust 			__entry->error = error;
41042113a75STrond Myklebust 			__entry->flags = flags;
41142113a75STrond Myklebust 			__entry->fmode = (__force unsigned int)ctx->mode;
41242113a75STrond Myklebust 			__entry->dev = ctx->dentry->d_sb->s_dev;
41339d0d3bdSAnna Schumaker 			if (!IS_ERR_OR_NULL(state))
41442113a75STrond Myklebust 				inode = state->inode;
41542113a75STrond Myklebust 			if (inode != NULL) {
41642113a75STrond Myklebust 				__entry->fileid = NFS_FILEID(inode);
41742113a75STrond Myklebust 				__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
41842113a75STrond Myklebust 			} else {
41942113a75STrond Myklebust 				__entry->fileid = 0;
42042113a75STrond Myklebust 				__entry->fhandle = 0;
42142113a75STrond Myklebust 			}
4222b0143b5SDavid Howells 			__entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
42342113a75STrond Myklebust 			__assign_str(name, ctx->dentry->d_name.name);
42442113a75STrond Myklebust 		),
42542113a75STrond Myklebust 
42642113a75STrond Myklebust 		TP_printk(
42742113a75STrond Myklebust 			"error=%d (%s) flags=%d (%s) fmode=%s "
42842113a75STrond Myklebust 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
42942113a75STrond Myklebust 			"name=%02x:%02x:%llu/%s",
43042113a75STrond Myklebust 			 __entry->error,
43142113a75STrond Myklebust 			 show_nfsv4_errors(__entry->error),
43242113a75STrond Myklebust 			 __entry->flags,
43342113a75STrond Myklebust 			 show_open_flags(__entry->flags),
43442113a75STrond Myklebust 			 show_fmode_flags(__entry->fmode),
43542113a75STrond Myklebust 			 MAJOR(__entry->dev), MINOR(__entry->dev),
43642113a75STrond Myklebust 			 (unsigned long long)__entry->fileid,
43742113a75STrond Myklebust 			 __entry->fhandle,
43842113a75STrond Myklebust 			 MAJOR(__entry->dev), MINOR(__entry->dev),
43942113a75STrond Myklebust 			 (unsigned long long)__entry->dir,
44042113a75STrond Myklebust 			 __get_str(name)
44142113a75STrond Myklebust 		)
44242113a75STrond Myklebust );
44342113a75STrond Myklebust 
44442113a75STrond Myklebust #define DEFINE_NFS4_OPEN_EVENT(name) \
44542113a75STrond Myklebust 	DEFINE_EVENT(nfs4_open_event, name, \
44642113a75STrond Myklebust 			TP_PROTO( \
44742113a75STrond Myklebust 				const struct nfs_open_context *ctx, \
44842113a75STrond Myklebust 				int flags, \
44942113a75STrond Myklebust 				int error \
45042113a75STrond Myklebust 			), \
45142113a75STrond Myklebust 			TP_ARGS(ctx, flags, error))
45242113a75STrond Myklebust DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
45342113a75STrond Myklebust DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
45442113a75STrond Myklebust DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
45542113a75STrond Myklebust 
45642113a75STrond Myklebust TRACE_EVENT(nfs4_close,
45742113a75STrond Myklebust 		TP_PROTO(
45842113a75STrond Myklebust 			const struct nfs4_state *state,
45942113a75STrond Myklebust 			const struct nfs_closeargs *args,
46042113a75STrond Myklebust 			const struct nfs_closeres *res,
46142113a75STrond Myklebust 			int error
46242113a75STrond Myklebust 		),
46342113a75STrond Myklebust 
46442113a75STrond Myklebust 		TP_ARGS(state, args, res, error),
46542113a75STrond Myklebust 
46642113a75STrond Myklebust 		TP_STRUCT__entry(
46742113a75STrond Myklebust 			__field(dev_t, dev)
46842113a75STrond Myklebust 			__field(u32, fhandle)
46942113a75STrond Myklebust 			__field(u64, fileid)
47042113a75STrond Myklebust 			__field(unsigned int, fmode)
47142113a75STrond Myklebust 			__field(int, error)
47242113a75STrond Myklebust 		),
47342113a75STrond Myklebust 
47442113a75STrond Myklebust 		TP_fast_assign(
47542113a75STrond Myklebust 			const struct inode *inode = state->inode;
47642113a75STrond Myklebust 
47742113a75STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
47842113a75STrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
47942113a75STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
48042113a75STrond Myklebust 			__entry->fmode = (__force unsigned int)state->state;
48142113a75STrond Myklebust 			__entry->error = error;
48242113a75STrond Myklebust 		),
48342113a75STrond Myklebust 
48442113a75STrond Myklebust 		TP_printk(
48542113a75STrond Myklebust 			"error=%d (%s) fmode=%s fileid=%02x:%02x:%llu "
48642113a75STrond Myklebust 			"fhandle=0x%08x",
48742113a75STrond Myklebust 			__entry->error,
48842113a75STrond Myklebust 			show_nfsv4_errors(__entry->error),
48942113a75STrond Myklebust 			__entry->fmode ?  show_fmode_flags(__entry->fmode) :
49042113a75STrond Myklebust 					  "closed",
49142113a75STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
49242113a75STrond Myklebust 			(unsigned long long)__entry->fileid,
49342113a75STrond Myklebust 			__entry->fhandle
49442113a75STrond Myklebust 		)
49542113a75STrond Myklebust );
49642113a75STrond Myklebust 
497d1b748a5STrond Myklebust #define show_lock_cmd(type) \
498d1b748a5STrond Myklebust 	__print_symbolic((int)type, \
499d1b748a5STrond Myklebust 		{ F_GETLK, "GETLK" }, \
500d1b748a5STrond Myklebust 		{ F_SETLK, "SETLK" }, \
501d1b748a5STrond Myklebust 		{ F_SETLKW, "SETLKW" })
502d1b748a5STrond Myklebust #define show_lock_type(type) \
503d1b748a5STrond Myklebust 	__print_symbolic((int)type, \
504d1b748a5STrond Myklebust 		{ F_RDLCK, "RDLCK" }, \
505d1b748a5STrond Myklebust 		{ F_WRLCK, "WRLCK" }, \
506d1b748a5STrond Myklebust 		{ F_UNLCK, "UNLCK" })
507d1b748a5STrond Myklebust 
508d1b748a5STrond Myklebust DECLARE_EVENT_CLASS(nfs4_lock_event,
509d1b748a5STrond Myklebust 		TP_PROTO(
510d1b748a5STrond Myklebust 			const struct file_lock *request,
511d1b748a5STrond Myklebust 			const struct nfs4_state *state,
512d1b748a5STrond Myklebust 			int cmd,
513d1b748a5STrond Myklebust 			int error
514d1b748a5STrond Myklebust 		),
515d1b748a5STrond Myklebust 
516d1b748a5STrond Myklebust 		TP_ARGS(request, state, cmd, error),
517d1b748a5STrond Myklebust 
518d1b748a5STrond Myklebust 		TP_STRUCT__entry(
519d1b748a5STrond Myklebust 			__field(int, error)
520d1b748a5STrond Myklebust 			__field(int, cmd)
521d1b748a5STrond Myklebust 			__field(char, type)
522d1b748a5STrond Myklebust 			__field(loff_t, start)
523d1b748a5STrond Myklebust 			__field(loff_t, end)
524d1b748a5STrond Myklebust 			__field(dev_t, dev)
525d1b748a5STrond Myklebust 			__field(u32, fhandle)
526d1b748a5STrond Myklebust 			__field(u64, fileid)
527d1b748a5STrond Myklebust 		),
528d1b748a5STrond Myklebust 
529d1b748a5STrond Myklebust 		TP_fast_assign(
530d1b748a5STrond Myklebust 			const struct inode *inode = state->inode;
531d1b748a5STrond Myklebust 
532d1b748a5STrond Myklebust 			__entry->error = error;
533d1b748a5STrond Myklebust 			__entry->cmd = cmd;
534d1b748a5STrond Myklebust 			__entry->type = request->fl_type;
535d1b748a5STrond Myklebust 			__entry->start = request->fl_start;
536d1b748a5STrond Myklebust 			__entry->end = request->fl_end;
537d1b748a5STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
538d1b748a5STrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
539d1b748a5STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
540d1b748a5STrond Myklebust 		),
541d1b748a5STrond Myklebust 
542d1b748a5STrond Myklebust 		TP_printk(
543d1b748a5STrond Myklebust 			"error=%d (%s) cmd=%s:%s range=%lld:%lld "
544d1b748a5STrond Myklebust 			"fileid=%02x:%02x:%llu fhandle=0x%08x",
545d1b748a5STrond Myklebust 			__entry->error,
546d1b748a5STrond Myklebust 			show_nfsv4_errors(__entry->error),
547d1b748a5STrond Myklebust 			show_lock_cmd(__entry->cmd),
548d1b748a5STrond Myklebust 			show_lock_type(__entry->type),
549d1b748a5STrond Myklebust 			(long long)__entry->start,
550d1b748a5STrond Myklebust 			(long long)__entry->end,
551d1b748a5STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
552d1b748a5STrond Myklebust 			(unsigned long long)__entry->fileid,
553d1b748a5STrond Myklebust 			__entry->fhandle
554d1b748a5STrond Myklebust 		)
555d1b748a5STrond Myklebust );
556d1b748a5STrond Myklebust 
557d1b748a5STrond Myklebust #define DEFINE_NFS4_LOCK_EVENT(name) \
558d1b748a5STrond Myklebust 	DEFINE_EVENT(nfs4_lock_event, name, \
559d1b748a5STrond Myklebust 			TP_PROTO( \
560d1b748a5STrond Myklebust 				const struct file_lock *request, \
561d1b748a5STrond Myklebust 				const struct nfs4_state *state, \
562d1b748a5STrond Myklebust 				int cmd, \
563d1b748a5STrond Myklebust 				int error \
564d1b748a5STrond Myklebust 			), \
565d1b748a5STrond Myklebust 			TP_ARGS(request, state, cmd, error))
566d1b748a5STrond Myklebust DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
567d1b748a5STrond Myklebust DEFINE_NFS4_LOCK_EVENT(nfs4_set_lock);
568d1b748a5STrond Myklebust DEFINE_NFS4_LOCK_EVENT(nfs4_lock_reclaim);
569d1b748a5STrond Myklebust DEFINE_NFS4_LOCK_EVENT(nfs4_lock_expired);
570d1b748a5STrond Myklebust DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
571d1b748a5STrond Myklebust 
572ca8acf8dSTrond Myklebust DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
573ca8acf8dSTrond Myklebust 		TP_PROTO(
574ca8acf8dSTrond Myklebust 			const struct inode *inode,
575ca8acf8dSTrond Myklebust 			fmode_t fmode
576ca8acf8dSTrond Myklebust 		),
577ca8acf8dSTrond Myklebust 
578ca8acf8dSTrond Myklebust 		TP_ARGS(inode, fmode),
579ca8acf8dSTrond Myklebust 
580ca8acf8dSTrond Myklebust 		TP_STRUCT__entry(
581ca8acf8dSTrond Myklebust 			__field(dev_t, dev)
582ca8acf8dSTrond Myklebust 			__field(u32, fhandle)
583ca8acf8dSTrond Myklebust 			__field(u64, fileid)
584ca8acf8dSTrond Myklebust 			__field(unsigned int, fmode)
585ca8acf8dSTrond Myklebust 		),
586ca8acf8dSTrond Myklebust 
587ca8acf8dSTrond Myklebust 		TP_fast_assign(
588ca8acf8dSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
589ca8acf8dSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
590ca8acf8dSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
591ca8acf8dSTrond Myklebust 			__entry->fmode = (__force unsigned int)fmode;
592ca8acf8dSTrond Myklebust 		),
593ca8acf8dSTrond Myklebust 
594ca8acf8dSTrond Myklebust 		TP_printk(
595ca8acf8dSTrond Myklebust 			"fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
596ca8acf8dSTrond Myklebust 			show_fmode_flags(__entry->fmode),
597ca8acf8dSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
598ca8acf8dSTrond Myklebust 			(unsigned long long)__entry->fileid,
599ca8acf8dSTrond Myklebust 			__entry->fhandle
600ca8acf8dSTrond Myklebust 		)
601ca8acf8dSTrond Myklebust );
602ca8acf8dSTrond Myklebust #define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
603ca8acf8dSTrond Myklebust 	DEFINE_EVENT(nfs4_set_delegation_event, name, \
604ca8acf8dSTrond Myklebust 			TP_PROTO( \
605ca8acf8dSTrond Myklebust 				const struct inode *inode, \
606ca8acf8dSTrond Myklebust 				fmode_t fmode \
607ca8acf8dSTrond Myklebust 			), \
608ca8acf8dSTrond Myklebust 			TP_ARGS(inode, fmode))
609ca8acf8dSTrond Myklebust DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
610ca8acf8dSTrond Myklebust DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
611ca8acf8dSTrond Myklebust 
612ca8acf8dSTrond Myklebust TRACE_EVENT(nfs4_delegreturn_exit,
613ca8acf8dSTrond Myklebust 		TP_PROTO(
614ca8acf8dSTrond Myklebust 			const struct nfs4_delegreturnargs *args,
615ca8acf8dSTrond Myklebust 			const struct nfs4_delegreturnres *res,
616ca8acf8dSTrond Myklebust 			int error
617ca8acf8dSTrond Myklebust 		),
618ca8acf8dSTrond Myklebust 
619ca8acf8dSTrond Myklebust 		TP_ARGS(args, res, error),
620ca8acf8dSTrond Myklebust 
621ca8acf8dSTrond Myklebust 		TP_STRUCT__entry(
622ca8acf8dSTrond Myklebust 			__field(dev_t, dev)
623ca8acf8dSTrond Myklebust 			__field(u32, fhandle)
624ca8acf8dSTrond Myklebust 			__field(int, error)
625ca8acf8dSTrond Myklebust 		),
626ca8acf8dSTrond Myklebust 
627ca8acf8dSTrond Myklebust 		TP_fast_assign(
628ca8acf8dSTrond Myklebust 			__entry->dev = res->server->s_dev;
629ca8acf8dSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(args->fhandle);
630ca8acf8dSTrond Myklebust 			__entry->error = error;
631ca8acf8dSTrond Myklebust 		),
632ca8acf8dSTrond Myklebust 
633ca8acf8dSTrond Myklebust 		TP_printk(
634ca8acf8dSTrond Myklebust 			"error=%d (%s) dev=%02x:%02x fhandle=0x%08x",
635ca8acf8dSTrond Myklebust 			__entry->error,
636ca8acf8dSTrond Myklebust 			show_nfsv4_errors(__entry->error),
637ca8acf8dSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
638ca8acf8dSTrond Myklebust 			__entry->fhandle
639ca8acf8dSTrond Myklebust 		)
640ca8acf8dSTrond Myklebust );
641ca8acf8dSTrond Myklebust 
64208cb47faSTrond Myklebust #ifdef CONFIG_NFS_V4_1
64308cb47faSTrond Myklebust DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
64408cb47faSTrond Myklebust 		TP_PROTO(
64508cb47faSTrond Myklebust 			const struct nfs4_state *state,
64608cb47faSTrond Myklebust 			const struct nfs4_lock_state *lsp,
64708cb47faSTrond Myklebust 			int error
64808cb47faSTrond Myklebust 		),
64908cb47faSTrond Myklebust 
65008cb47faSTrond Myklebust 		TP_ARGS(state, lsp, error),
65108cb47faSTrond Myklebust 
65208cb47faSTrond Myklebust 		TP_STRUCT__entry(
65308cb47faSTrond Myklebust 			__field(int, error)
65408cb47faSTrond Myklebust 			__field(dev_t, dev)
65508cb47faSTrond Myklebust 			__field(u32, fhandle)
65608cb47faSTrond Myklebust 			__field(u64, fileid)
65708cb47faSTrond Myklebust 		),
65808cb47faSTrond Myklebust 
65908cb47faSTrond Myklebust 		TP_fast_assign(
66008cb47faSTrond Myklebust 			const struct inode *inode = state->inode;
66108cb47faSTrond Myklebust 
66208cb47faSTrond Myklebust 			__entry->error = error;
66308cb47faSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
66408cb47faSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
66508cb47faSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
66608cb47faSTrond Myklebust 		),
66708cb47faSTrond Myklebust 
66808cb47faSTrond Myklebust 		TP_printk(
66908cb47faSTrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
67008cb47faSTrond Myklebust 			__entry->error,
67108cb47faSTrond Myklebust 			show_nfsv4_errors(__entry->error),
67208cb47faSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
67308cb47faSTrond Myklebust 			(unsigned long long)__entry->fileid,
67408cb47faSTrond Myklebust 			__entry->fhandle
67508cb47faSTrond Myklebust 		)
67608cb47faSTrond Myklebust );
67708cb47faSTrond Myklebust 
67808cb47faSTrond Myklebust #define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
67908cb47faSTrond Myklebust 	DEFINE_EVENT(nfs4_test_stateid_event, name, \
68008cb47faSTrond Myklebust 			TP_PROTO( \
68108cb47faSTrond Myklebust 				const struct nfs4_state *state, \
68208cb47faSTrond Myklebust 				const struct nfs4_lock_state *lsp, \
68308cb47faSTrond Myklebust 				int error \
68408cb47faSTrond Myklebust 			), \
68508cb47faSTrond Myklebust 			TP_ARGS(state, lsp, error))
68608cb47faSTrond Myklebust DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
68708cb47faSTrond Myklebust DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
68808cb47faSTrond Myklebust DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
68908cb47faSTrond Myklebust #endif /* CONFIG_NFS_V4_1 */
69008cb47faSTrond Myklebust 
691078ea3dfSTrond Myklebust DECLARE_EVENT_CLASS(nfs4_lookup_event,
692078ea3dfSTrond Myklebust 		TP_PROTO(
693078ea3dfSTrond Myklebust 			const struct inode *dir,
694078ea3dfSTrond Myklebust 			const struct qstr *name,
695078ea3dfSTrond Myklebust 			int error
696078ea3dfSTrond Myklebust 		),
697078ea3dfSTrond Myklebust 
698078ea3dfSTrond Myklebust 		TP_ARGS(dir, name, error),
699078ea3dfSTrond Myklebust 
700078ea3dfSTrond Myklebust 		TP_STRUCT__entry(
701078ea3dfSTrond Myklebust 			__field(dev_t, dev)
702078ea3dfSTrond Myklebust 			__field(int, error)
703078ea3dfSTrond Myklebust 			__field(u64, dir)
704078ea3dfSTrond Myklebust 			__string(name, name->name)
705078ea3dfSTrond Myklebust 		),
706078ea3dfSTrond Myklebust 
707078ea3dfSTrond Myklebust 		TP_fast_assign(
708078ea3dfSTrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
709078ea3dfSTrond Myklebust 			__entry->dir = NFS_FILEID(dir);
710078ea3dfSTrond Myklebust 			__entry->error = error;
711078ea3dfSTrond Myklebust 			__assign_str(name, name->name);
712078ea3dfSTrond Myklebust 		),
713078ea3dfSTrond Myklebust 
714078ea3dfSTrond Myklebust 		TP_printk(
715078ea3dfSTrond Myklebust 			"error=%d (%s) name=%02x:%02x:%llu/%s",
716078ea3dfSTrond Myklebust 			__entry->error,
717078ea3dfSTrond Myklebust 			show_nfsv4_errors(__entry->error),
718078ea3dfSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
719078ea3dfSTrond Myklebust 			(unsigned long long)__entry->dir,
720078ea3dfSTrond Myklebust 			__get_str(name)
721078ea3dfSTrond Myklebust 		)
722078ea3dfSTrond Myklebust );
723078ea3dfSTrond Myklebust 
724078ea3dfSTrond Myklebust #define DEFINE_NFS4_LOOKUP_EVENT(name) \
725078ea3dfSTrond Myklebust 	DEFINE_EVENT(nfs4_lookup_event, name, \
726078ea3dfSTrond Myklebust 			TP_PROTO( \
727078ea3dfSTrond Myklebust 				const struct inode *dir, \
728078ea3dfSTrond Myklebust 				const struct qstr *name, \
729078ea3dfSTrond Myklebust 				int error \
730078ea3dfSTrond Myklebust 			), \
731078ea3dfSTrond Myklebust 			TP_ARGS(dir, name, error))
732078ea3dfSTrond Myklebust 
733078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
734078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
735078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
736078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
737078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
738078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
739078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
740078ea3dfSTrond Myklebust 
741fbc6f7c2STrond Myklebust TRACE_EVENT(nfs4_rename,
742fbc6f7c2STrond Myklebust 		TP_PROTO(
743fbc6f7c2STrond Myklebust 			const struct inode *olddir,
744fbc6f7c2STrond Myklebust 			const struct qstr *oldname,
745fbc6f7c2STrond Myklebust 			const struct inode *newdir,
746fbc6f7c2STrond Myklebust 			const struct qstr *newname,
747fbc6f7c2STrond Myklebust 			int error
748fbc6f7c2STrond Myklebust 		),
749fbc6f7c2STrond Myklebust 
750fbc6f7c2STrond Myklebust 		TP_ARGS(olddir, oldname, newdir, newname, error),
751fbc6f7c2STrond Myklebust 
752fbc6f7c2STrond Myklebust 		TP_STRUCT__entry(
753fbc6f7c2STrond Myklebust 			__field(dev_t, dev)
754fbc6f7c2STrond Myklebust 			__field(int, error)
755fbc6f7c2STrond Myklebust 			__field(u64, olddir)
756fbc6f7c2STrond Myklebust 			__string(oldname, oldname->name)
757fbc6f7c2STrond Myklebust 			__field(u64, newdir)
758fbc6f7c2STrond Myklebust 			__string(newname, newname->name)
759fbc6f7c2STrond Myklebust 		),
760fbc6f7c2STrond Myklebust 
761fbc6f7c2STrond Myklebust 		TP_fast_assign(
762fbc6f7c2STrond Myklebust 			__entry->dev = olddir->i_sb->s_dev;
763fbc6f7c2STrond Myklebust 			__entry->olddir = NFS_FILEID(olddir);
764fbc6f7c2STrond Myklebust 			__entry->newdir = NFS_FILEID(newdir);
765fbc6f7c2STrond Myklebust 			__entry->error = error;
766fbc6f7c2STrond Myklebust 			__assign_str(oldname, oldname->name);
767fbc6f7c2STrond Myklebust 			__assign_str(newname, newname->name);
768fbc6f7c2STrond Myklebust 		),
769fbc6f7c2STrond Myklebust 
770fbc6f7c2STrond Myklebust 		TP_printk(
771fbc6f7c2STrond Myklebust 			"error=%d (%s) oldname=%02x:%02x:%llu/%s "
772fbc6f7c2STrond Myklebust 			"newname=%02x:%02x:%llu/%s",
773fbc6f7c2STrond Myklebust 			__entry->error,
774fbc6f7c2STrond Myklebust 			show_nfsv4_errors(__entry->error),
775fbc6f7c2STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
776fbc6f7c2STrond Myklebust 			(unsigned long long)__entry->olddir,
777fbc6f7c2STrond Myklebust 			__get_str(oldname),
778fbc6f7c2STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
779fbc6f7c2STrond Myklebust 			(unsigned long long)__entry->newdir,
780fbc6f7c2STrond Myklebust 			__get_str(newname)
781fbc6f7c2STrond Myklebust 		)
782fbc6f7c2STrond Myklebust );
783fbc6f7c2STrond Myklebust 
784c1578b76STrond Myklebust DECLARE_EVENT_CLASS(nfs4_inode_event,
785c1578b76STrond Myklebust 		TP_PROTO(
786c1578b76STrond Myklebust 			const struct inode *inode,
787c1578b76STrond Myklebust 			int error
788c1578b76STrond Myklebust 		),
789c1578b76STrond Myklebust 
790c1578b76STrond Myklebust 		TP_ARGS(inode, error),
791c1578b76STrond Myklebust 
792c1578b76STrond Myklebust 		TP_STRUCT__entry(
793c1578b76STrond Myklebust 			__field(dev_t, dev)
794c1578b76STrond Myklebust 			__field(u32, fhandle)
795c1578b76STrond Myklebust 			__field(u64, fileid)
796c1578b76STrond Myklebust 			__field(int, error)
797c1578b76STrond Myklebust 		),
798c1578b76STrond Myklebust 
799c1578b76STrond Myklebust 		TP_fast_assign(
800c1578b76STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
801c1578b76STrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
802c1578b76STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
803c1578b76STrond Myklebust 			__entry->error = error;
804c1578b76STrond Myklebust 		),
805c1578b76STrond Myklebust 
806c1578b76STrond Myklebust 		TP_printk(
807c1578b76STrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
808c1578b76STrond Myklebust 			__entry->error,
809c1578b76STrond Myklebust 			show_nfsv4_errors(__entry->error),
810c1578b76STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
811c1578b76STrond Myklebust 			(unsigned long long)__entry->fileid,
812c1578b76STrond Myklebust 			__entry->fhandle
813c1578b76STrond Myklebust 		)
814c1578b76STrond Myklebust );
815c1578b76STrond Myklebust 
816c1578b76STrond Myklebust #define DEFINE_NFS4_INODE_EVENT(name) \
817c1578b76STrond Myklebust 	DEFINE_EVENT(nfs4_inode_event, name, \
818c1578b76STrond Myklebust 			TP_PROTO( \
819c1578b76STrond Myklebust 				const struct inode *inode, \
820c1578b76STrond Myklebust 				int error \
821c1578b76STrond Myklebust 			), \
822c1578b76STrond Myklebust 			TP_ARGS(inode, error))
823c1578b76STrond Myklebust 
824c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_setattr);
825c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_access);
826c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
827c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
828c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
829c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
830c1578b76STrond Myklebust #ifdef CONFIG_NFS_V4_SECURITY_LABEL
831c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
832c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
833c1578b76STrond Myklebust #endif /* CONFIG_NFS_V4_SECURITY_LABEL */
834ca8acf8dSTrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_recall_delegation);
835ca8acf8dSTrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_delegreturn);
836c1578b76STrond Myklebust 
837b5f875a9STrond Myklebust DECLARE_EVENT_CLASS(nfs4_getattr_event,
838b5f875a9STrond Myklebust 		TP_PROTO(
839b5f875a9STrond Myklebust 			const struct nfs_server *server,
840b5f875a9STrond Myklebust 			const struct nfs_fh *fhandle,
841b5f875a9STrond Myklebust 			const struct nfs_fattr *fattr,
842b5f875a9STrond Myklebust 			int error
843b5f875a9STrond Myklebust 		),
844b5f875a9STrond Myklebust 
845b5f875a9STrond Myklebust 		TP_ARGS(server, fhandle, fattr, error),
846b5f875a9STrond Myklebust 
847b5f875a9STrond Myklebust 		TP_STRUCT__entry(
848b5f875a9STrond Myklebust 			__field(dev_t, dev)
849b5f875a9STrond Myklebust 			__field(u32, fhandle)
850b5f875a9STrond Myklebust 			__field(u64, fileid)
851b5f875a9STrond Myklebust 			__field(unsigned int, valid)
852b5f875a9STrond Myklebust 			__field(int, error)
853b5f875a9STrond Myklebust 		),
854b5f875a9STrond Myklebust 
855b5f875a9STrond Myklebust 		TP_fast_assign(
856b5f875a9STrond Myklebust 			__entry->dev = server->s_dev;
857b5f875a9STrond Myklebust 			__entry->valid = fattr->valid;
858b5f875a9STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fhandle);
859b5f875a9STrond Myklebust 			__entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
860b5f875a9STrond Myklebust 			__entry->error = error;
861b5f875a9STrond Myklebust 		),
862b5f875a9STrond Myklebust 
863b5f875a9STrond Myklebust 		TP_printk(
864b5f875a9STrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
865b5f875a9STrond Myklebust 			"valid=%s",
866b5f875a9STrond Myklebust 			__entry->error,
867b5f875a9STrond Myklebust 			show_nfsv4_errors(__entry->error),
868b5f875a9STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
869b5f875a9STrond Myklebust 			(unsigned long long)__entry->fileid,
870b5f875a9STrond Myklebust 			__entry->fhandle,
871b5f875a9STrond Myklebust 			show_nfs_fattr_flags(__entry->valid)
872b5f875a9STrond Myklebust 		)
873b5f875a9STrond Myklebust );
874b5f875a9STrond Myklebust 
875b5f875a9STrond Myklebust #define DEFINE_NFS4_GETATTR_EVENT(name) \
876b5f875a9STrond Myklebust 	DEFINE_EVENT(nfs4_getattr_event, name, \
877b5f875a9STrond Myklebust 			TP_PROTO( \
878b5f875a9STrond Myklebust 				const struct nfs_server *server, \
879b5f875a9STrond Myklebust 				const struct nfs_fh *fhandle, \
880b5f875a9STrond Myklebust 				const struct nfs_fattr *fattr, \
881b5f875a9STrond Myklebust 				int error \
882b5f875a9STrond Myklebust 			), \
883b5f875a9STrond Myklebust 			TP_ARGS(server, fhandle, fattr, error))
884b5f875a9STrond Myklebust DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
885b5f875a9STrond Myklebust DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
886b5f875a9STrond Myklebust DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
887b5f875a9STrond Myklebust 
8887cd14861STrond Myklebust DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
8897cd14861STrond Myklebust 		TP_PROTO(
8907cd14861STrond Myklebust 			const struct nfs_client *clp,
8917cd14861STrond Myklebust 			const struct nfs_fh *fhandle,
8927cd14861STrond Myklebust 			const struct inode *inode,
8937cd14861STrond Myklebust 			int error
8947cd14861STrond Myklebust 		),
8957cd14861STrond Myklebust 
8967cd14861STrond Myklebust 		TP_ARGS(clp, fhandle, inode, error),
8977cd14861STrond Myklebust 
8987cd14861STrond Myklebust 		TP_STRUCT__entry(
8997cd14861STrond Myklebust 			__field(int, error)
9007cd14861STrond Myklebust 			__field(dev_t, dev)
9017cd14861STrond Myklebust 			__field(u32, fhandle)
9027cd14861STrond Myklebust 			__field(u64, fileid)
9037cd14861STrond Myklebust 			__string(dstaddr, clp ?
9047cd14861STrond Myklebust 				rpc_peeraddr2str(clp->cl_rpcclient,
9057cd14861STrond Myklebust 					RPC_DISPLAY_ADDR) : "unknown")
9067cd14861STrond Myklebust 		),
9077cd14861STrond Myklebust 
9087cd14861STrond Myklebust 		TP_fast_assign(
9097cd14861STrond Myklebust 			__entry->error = error;
9107cd14861STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fhandle);
9117cd14861STrond Myklebust 			if (inode != NULL) {
9127cd14861STrond Myklebust 				__entry->fileid = NFS_FILEID(inode);
9137cd14861STrond Myklebust 				__entry->dev = inode->i_sb->s_dev;
9147cd14861STrond Myklebust 			} else {
9157cd14861STrond Myklebust 				__entry->fileid = 0;
9167cd14861STrond Myklebust 				__entry->dev = 0;
9177cd14861STrond Myklebust 			}
9187cd14861STrond Myklebust 			__assign_str(dstaddr, clp ?
9197cd14861STrond Myklebust 				rpc_peeraddr2str(clp->cl_rpcclient,
9207cd14861STrond Myklebust 					RPC_DISPLAY_ADDR) : "unknown")
9217cd14861STrond Myklebust 		),
9227cd14861STrond Myklebust 
9237cd14861STrond Myklebust 		TP_printk(
9247cd14861STrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
9257cd14861STrond Myklebust 			"dstaddr=%s",
9267cd14861STrond Myklebust 			__entry->error,
9277cd14861STrond Myklebust 			show_nfsv4_errors(__entry->error),
9287cd14861STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
9297cd14861STrond Myklebust 			(unsigned long long)__entry->fileid,
9307cd14861STrond Myklebust 			__entry->fhandle,
9317cd14861STrond Myklebust 			__get_str(dstaddr)
9327cd14861STrond Myklebust 		)
9337cd14861STrond Myklebust );
9347cd14861STrond Myklebust 
9357cd14861STrond Myklebust #define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
9367cd14861STrond Myklebust 	DEFINE_EVENT(nfs4_inode_callback_event, name, \
9377cd14861STrond Myklebust 			TP_PROTO( \
9387cd14861STrond Myklebust 				const struct nfs_client *clp, \
9397cd14861STrond Myklebust 				const struct nfs_fh *fhandle, \
9407cd14861STrond Myklebust 				const struct inode *inode, \
9417cd14861STrond Myklebust 				int error \
9427cd14861STrond Myklebust 			), \
9437cd14861STrond Myklebust 			TP_ARGS(clp, fhandle, inode, error))
9447cd14861STrond Myklebust DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
945249b2eefSTrond Myklebust DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_layoutrecall_inode);
9467cd14861STrond Myklebust 
9477cd14861STrond Myklebust 
9481f2d30b5STrond Myklebust DECLARE_EVENT_CLASS(nfs4_idmap_event,
9491f2d30b5STrond Myklebust 		TP_PROTO(
9501f2d30b5STrond Myklebust 			const char *name,
9511f2d30b5STrond Myklebust 			int len,
9521f2d30b5STrond Myklebust 			u32 id,
9531f2d30b5STrond Myklebust 			int error
9541f2d30b5STrond Myklebust 		),
9551f2d30b5STrond Myklebust 
9561f2d30b5STrond Myklebust 		TP_ARGS(name, len, id, error),
9571f2d30b5STrond Myklebust 
9581f2d30b5STrond Myklebust 		TP_STRUCT__entry(
9591f2d30b5STrond Myklebust 			__field(int, error)
9601f2d30b5STrond Myklebust 			__field(u32, id)
9611f2d30b5STrond Myklebust 			__dynamic_array(char, name, len > 0 ? len + 1 : 1)
9621f2d30b5STrond Myklebust 		),
9631f2d30b5STrond Myklebust 
9641f2d30b5STrond Myklebust 		TP_fast_assign(
9651f2d30b5STrond Myklebust 			if (len < 0)
9661f2d30b5STrond Myklebust 				len = 0;
9671f2d30b5STrond Myklebust 			__entry->error = error < 0 ? error : 0;
9681f2d30b5STrond Myklebust 			__entry->id = id;
9691f2d30b5STrond Myklebust 			memcpy(__get_dynamic_array(name), name, len);
9701f2d30b5STrond Myklebust 			((char *)__get_dynamic_array(name))[len] = 0;
9711f2d30b5STrond Myklebust 		),
9721f2d30b5STrond Myklebust 
9731f2d30b5STrond Myklebust 		TP_printk(
9741f2d30b5STrond Myklebust 			"error=%d id=%u name=%s",
9751f2d30b5STrond Myklebust 			__entry->error,
9761f2d30b5STrond Myklebust 			__entry->id,
9771f2d30b5STrond Myklebust 			__get_str(name)
9781f2d30b5STrond Myklebust 		)
9791f2d30b5STrond Myklebust );
9801f2d30b5STrond Myklebust #define DEFINE_NFS4_IDMAP_EVENT(name) \
9811f2d30b5STrond Myklebust 	DEFINE_EVENT(nfs4_idmap_event, name, \
9821f2d30b5STrond Myklebust 			TP_PROTO( \
9831f2d30b5STrond Myklebust 				const char *name, \
9841f2d30b5STrond Myklebust 				int len, \
9851f2d30b5STrond Myklebust 				u32 id, \
9861f2d30b5STrond Myklebust 				int error \
9871f2d30b5STrond Myklebust 			), \
9881f2d30b5STrond Myklebust 			TP_ARGS(name, len, id, error))
9891f2d30b5STrond Myklebust DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
9901f2d30b5STrond Myklebust DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
9911f2d30b5STrond Myklebust DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
9921f2d30b5STrond Myklebust DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
9931f2d30b5STrond Myklebust 
994cc668ab3STrond Myklebust DECLARE_EVENT_CLASS(nfs4_read_event,
995cc668ab3STrond Myklebust 		TP_PROTO(
996d45f60c6SWeston Andros Adamson 			const struct nfs_pgio_header *hdr,
997cc668ab3STrond Myklebust 			int error
998cc668ab3STrond Myklebust 		),
999cc668ab3STrond Myklebust 
1000d45f60c6SWeston Andros Adamson 		TP_ARGS(hdr, error),
1001cc668ab3STrond Myklebust 
1002cc668ab3STrond Myklebust 		TP_STRUCT__entry(
1003cc668ab3STrond Myklebust 			__field(dev_t, dev)
1004cc668ab3STrond Myklebust 			__field(u32, fhandle)
1005cc668ab3STrond Myklebust 			__field(u64, fileid)
1006cc668ab3STrond Myklebust 			__field(loff_t, offset)
1007cc668ab3STrond Myklebust 			__field(size_t, count)
1008cc668ab3STrond Myklebust 			__field(int, error)
1009cc668ab3STrond Myklebust 		),
1010cc668ab3STrond Myklebust 
1011cc668ab3STrond Myklebust 		TP_fast_assign(
1012d45f60c6SWeston Andros Adamson 			const struct inode *inode = hdr->inode;
1013cc668ab3STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
1014cc668ab3STrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
1015cc668ab3STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1016d45f60c6SWeston Andros Adamson 			__entry->offset = hdr->args.offset;
1017d45f60c6SWeston Andros Adamson 			__entry->count = hdr->args.count;
1018cc668ab3STrond Myklebust 			__entry->error = error;
1019cc668ab3STrond Myklebust 		),
1020cc668ab3STrond Myklebust 
1021cc668ab3STrond Myklebust 		TP_printk(
1022cc668ab3STrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1023cc668ab3STrond Myklebust 			"offset=%lld count=%zu",
1024cc668ab3STrond Myklebust 			__entry->error,
1025cc668ab3STrond Myklebust 			show_nfsv4_errors(__entry->error),
1026cc668ab3STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
1027cc668ab3STrond Myklebust 			(unsigned long long)__entry->fileid,
1028cc668ab3STrond Myklebust 			__entry->fhandle,
1029cc668ab3STrond Myklebust 			(long long)__entry->offset,
1030cc668ab3STrond Myklebust 			__entry->count
1031cc668ab3STrond Myklebust 		)
1032cc668ab3STrond Myklebust );
1033cc668ab3STrond Myklebust #define DEFINE_NFS4_READ_EVENT(name) \
1034cc668ab3STrond Myklebust 	DEFINE_EVENT(nfs4_read_event, name, \
1035cc668ab3STrond Myklebust 			TP_PROTO( \
1036d45f60c6SWeston Andros Adamson 				const struct nfs_pgio_header *hdr, \
1037cc668ab3STrond Myklebust 				int error \
1038cc668ab3STrond Myklebust 			), \
1039d45f60c6SWeston Andros Adamson 			TP_ARGS(hdr, error))
1040cc668ab3STrond Myklebust DEFINE_NFS4_READ_EVENT(nfs4_read);
1041cc668ab3STrond Myklebust #ifdef CONFIG_NFS_V4_1
1042cc668ab3STrond Myklebust DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1043cc668ab3STrond Myklebust #endif /* CONFIG_NFS_V4_1 */
1044cc668ab3STrond Myklebust 
1045cc668ab3STrond Myklebust DECLARE_EVENT_CLASS(nfs4_write_event,
1046cc668ab3STrond Myklebust 		TP_PROTO(
1047d45f60c6SWeston Andros Adamson 			const struct nfs_pgio_header *hdr,
1048cc668ab3STrond Myklebust 			int error
1049cc668ab3STrond Myklebust 		),
1050cc668ab3STrond Myklebust 
1051d45f60c6SWeston Andros Adamson 		TP_ARGS(hdr, error),
1052cc668ab3STrond Myklebust 
1053cc668ab3STrond Myklebust 		TP_STRUCT__entry(
1054cc668ab3STrond Myklebust 			__field(dev_t, dev)
1055cc668ab3STrond Myklebust 			__field(u32, fhandle)
1056cc668ab3STrond Myklebust 			__field(u64, fileid)
1057cc668ab3STrond Myklebust 			__field(loff_t, offset)
1058cc668ab3STrond Myklebust 			__field(size_t, count)
1059cc668ab3STrond Myklebust 			__field(int, error)
1060cc668ab3STrond Myklebust 		),
1061cc668ab3STrond Myklebust 
1062cc668ab3STrond Myklebust 		TP_fast_assign(
1063d45f60c6SWeston Andros Adamson 			const struct inode *inode = hdr->inode;
1064cc668ab3STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
1065cc668ab3STrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
1066cc668ab3STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1067d45f60c6SWeston Andros Adamson 			__entry->offset = hdr->args.offset;
1068d45f60c6SWeston Andros Adamson 			__entry->count = hdr->args.count;
1069cc668ab3STrond Myklebust 			__entry->error = error;
1070cc668ab3STrond Myklebust 		),
1071cc668ab3STrond Myklebust 
1072cc668ab3STrond Myklebust 		TP_printk(
1073cc668ab3STrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1074cc668ab3STrond Myklebust 			"offset=%lld count=%zu",
1075cc668ab3STrond Myklebust 			__entry->error,
1076cc668ab3STrond Myklebust 			show_nfsv4_errors(__entry->error),
1077cc668ab3STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
1078cc668ab3STrond Myklebust 			(unsigned long long)__entry->fileid,
1079cc668ab3STrond Myklebust 			__entry->fhandle,
1080cc668ab3STrond Myklebust 			(long long)__entry->offset,
1081cc668ab3STrond Myklebust 			__entry->count
1082cc668ab3STrond Myklebust 		)
1083cc668ab3STrond Myklebust );
1084cc668ab3STrond Myklebust 
1085cc668ab3STrond Myklebust #define DEFINE_NFS4_WRITE_EVENT(name) \
1086cc668ab3STrond Myklebust 	DEFINE_EVENT(nfs4_write_event, name, \
1087cc668ab3STrond Myklebust 			TP_PROTO( \
1088d45f60c6SWeston Andros Adamson 				const struct nfs_pgio_header *hdr, \
1089cc668ab3STrond Myklebust 				int error \
1090cc668ab3STrond Myklebust 			), \
1091d45f60c6SWeston Andros Adamson 			TP_ARGS(hdr, error))
1092cc668ab3STrond Myklebust DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1093cc668ab3STrond Myklebust #ifdef CONFIG_NFS_V4_1
1094cc668ab3STrond Myklebust DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1095cc668ab3STrond Myklebust #endif /* CONFIG_NFS_V4_1 */
1096cc668ab3STrond Myklebust 
1097cc668ab3STrond Myklebust DECLARE_EVENT_CLASS(nfs4_commit_event,
1098cc668ab3STrond Myklebust 		TP_PROTO(
1099cc668ab3STrond Myklebust 			const struct nfs_commit_data *data,
1100cc668ab3STrond Myklebust 			int error
1101cc668ab3STrond Myklebust 		),
1102cc668ab3STrond Myklebust 
1103cc668ab3STrond Myklebust 		TP_ARGS(data, error),
1104cc668ab3STrond Myklebust 
1105cc668ab3STrond Myklebust 		TP_STRUCT__entry(
1106cc668ab3STrond Myklebust 			__field(dev_t, dev)
1107cc668ab3STrond Myklebust 			__field(u32, fhandle)
1108cc668ab3STrond Myklebust 			__field(u64, fileid)
1109cc668ab3STrond Myklebust 			__field(loff_t, offset)
1110cc668ab3STrond Myklebust 			__field(size_t, count)
1111cc668ab3STrond Myklebust 			__field(int, error)
1112cc668ab3STrond Myklebust 		),
1113cc668ab3STrond Myklebust 
1114cc668ab3STrond Myklebust 		TP_fast_assign(
1115cc668ab3STrond Myklebust 			const struct inode *inode = data->inode;
1116cc668ab3STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
1117cc668ab3STrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
1118cc668ab3STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1119cc668ab3STrond Myklebust 			__entry->offset = data->args.offset;
1120cc668ab3STrond Myklebust 			__entry->count = data->args.count;
1121cc668ab3STrond Myklebust 			__entry->error = error;
1122cc668ab3STrond Myklebust 		),
1123cc668ab3STrond Myklebust 
1124cc668ab3STrond Myklebust 		TP_printk(
1125cc668ab3STrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1126cc668ab3STrond Myklebust 			"offset=%lld count=%zu",
1127cc668ab3STrond Myklebust 			__entry->error,
1128cc668ab3STrond Myklebust 			show_nfsv4_errors(__entry->error),
1129cc668ab3STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
1130cc668ab3STrond Myklebust 			(unsigned long long)__entry->fileid,
1131cc668ab3STrond Myklebust 			__entry->fhandle,
1132cc668ab3STrond Myklebust 			(long long)__entry->offset,
1133cc668ab3STrond Myklebust 			__entry->count
1134cc668ab3STrond Myklebust 		)
1135cc668ab3STrond Myklebust );
1136cc668ab3STrond Myklebust #define DEFINE_NFS4_COMMIT_EVENT(name) \
1137cc668ab3STrond Myklebust 	DEFINE_EVENT(nfs4_commit_event, name, \
1138cc668ab3STrond Myklebust 			TP_PROTO( \
1139cc668ab3STrond Myklebust 				const struct nfs_commit_data *data, \
1140cc668ab3STrond Myklebust 				int error \
1141cc668ab3STrond Myklebust 			), \
1142cc668ab3STrond Myklebust 			TP_ARGS(data, error))
1143cc668ab3STrond Myklebust DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1144cc668ab3STrond Myklebust #ifdef CONFIG_NFS_V4_1
1145cc668ab3STrond Myklebust DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
11461037e6eaSTrond Myklebust 
11471037e6eaSTrond Myklebust #define show_pnfs_iomode(iomode) \
11481037e6eaSTrond Myklebust 	__print_symbolic(iomode, \
11491037e6eaSTrond Myklebust 		{ IOMODE_READ, "READ" }, \
11501037e6eaSTrond Myklebust 		{ IOMODE_RW, "RW" }, \
11511037e6eaSTrond Myklebust 		{ IOMODE_ANY, "ANY" })
11521037e6eaSTrond Myklebust 
11531037e6eaSTrond Myklebust TRACE_EVENT(nfs4_layoutget,
11541037e6eaSTrond Myklebust 		TP_PROTO(
11551037e6eaSTrond Myklebust 			const struct nfs_open_context *ctx,
11561037e6eaSTrond Myklebust 			const struct pnfs_layout_range *args,
11571037e6eaSTrond Myklebust 			const struct pnfs_layout_range *res,
11581037e6eaSTrond Myklebust 			int error
11591037e6eaSTrond Myklebust 		),
11601037e6eaSTrond Myklebust 
11611037e6eaSTrond Myklebust 		TP_ARGS(ctx, args, res, error),
11621037e6eaSTrond Myklebust 
11631037e6eaSTrond Myklebust 		TP_STRUCT__entry(
11641037e6eaSTrond Myklebust 			__field(dev_t, dev)
11651037e6eaSTrond Myklebust 			__field(u32, fhandle)
11661037e6eaSTrond Myklebust 			__field(u64, fileid)
11671037e6eaSTrond Myklebust 			__field(u32, iomode)
11681037e6eaSTrond Myklebust 			__field(u64, offset)
11691037e6eaSTrond Myklebust 			__field(u64, count)
11701037e6eaSTrond Myklebust 			__field(int, error)
11711037e6eaSTrond Myklebust 		),
11721037e6eaSTrond Myklebust 
11731037e6eaSTrond Myklebust 		TP_fast_assign(
11742b0143b5SDavid Howells 			const struct inode *inode = d_inode(ctx->dentry);
11751037e6eaSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
11761037e6eaSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
11771037e6eaSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
11781037e6eaSTrond Myklebust 			__entry->iomode = args->iomode;
11791037e6eaSTrond Myklebust 			__entry->offset = args->offset;
11801037e6eaSTrond Myklebust 			__entry->count = args->length;
11811037e6eaSTrond Myklebust 			__entry->error = error;
11821037e6eaSTrond Myklebust 		),
11831037e6eaSTrond Myklebust 
11841037e6eaSTrond Myklebust 		TP_printk(
11851037e6eaSTrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
11861037e6eaSTrond Myklebust 			"iomode=%s offset=%llu count=%llu",
11871037e6eaSTrond Myklebust 			__entry->error,
11881037e6eaSTrond Myklebust 			show_nfsv4_errors(__entry->error),
11891037e6eaSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
11901037e6eaSTrond Myklebust 			(unsigned long long)__entry->fileid,
11911037e6eaSTrond Myklebust 			__entry->fhandle,
11921037e6eaSTrond Myklebust 			show_pnfs_iomode(__entry->iomode),
11931037e6eaSTrond Myklebust 			(unsigned long long)__entry->offset,
11941037e6eaSTrond Myklebust 			(unsigned long long)__entry->count
11951037e6eaSTrond Myklebust 		)
11961037e6eaSTrond Myklebust );
11971037e6eaSTrond Myklebust 
11981037e6eaSTrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_layoutcommit);
11991037e6eaSTrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn);
12006a463bebSTrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
12011037e6eaSTrond Myklebust 
1202cc668ab3STrond Myklebust #endif /* CONFIG_NFS_V4_1 */
1203cc668ab3STrond Myklebust 
1204c6d01c6fSTrond Myklebust #endif /* _TRACE_NFS4_H */
1205c6d01c6fSTrond Myklebust 
1206c6d01c6fSTrond Myklebust #undef TRACE_INCLUDE_PATH
1207c6d01c6fSTrond Myklebust #define TRACE_INCLUDE_PATH .
1208c6d01c6fSTrond Myklebust #define TRACE_INCLUDE_FILE nfs4trace
1209c6d01c6fSTrond Myklebust /* This part must be outside protection */
1210c6d01c6fSTrond Myklebust #include <trace/define_trace.h>
1211