xref: /openbmc/linux/fs/nfs/nfs4trace.h (revision 08cb47fa)
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;
3242f92ae34STrond Myklebust 			__entry->error = res->sr_status;
3252f92ae34STrond Myklebust 		),
3262f92ae34STrond Myklebust 		TP_printk(
3272f92ae34STrond Myklebust 			"error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
3282f92ae34STrond Myklebust 			"highest_slotid=%u target_highest_slotid=%u "
3292f92ae34STrond Myklebust 			"status_flags=%u (%s)",
3302f92ae34STrond Myklebust 			__entry->error,
3312f92ae34STrond Myklebust 			show_nfsv4_errors(__entry->error),
3322f92ae34STrond Myklebust 			__entry->session,
3332f92ae34STrond Myklebust 			__entry->slot_nr,
3342f92ae34STrond Myklebust 			__entry->seq_nr,
3352f92ae34STrond Myklebust 			__entry->highest_slotid,
3362f92ae34STrond Myklebust 			__entry->target_highest_slotid,
3372f92ae34STrond Myklebust 			__entry->status_flags,
3382f92ae34STrond Myklebust 			show_nfs4_sequence_status_flags(__entry->status_flags)
3392f92ae34STrond Myklebust 		)
3402f92ae34STrond Myklebust );
3412f92ae34STrond Myklebust 
3422f92ae34STrond Myklebust struct cb_sequenceargs;
3432f92ae34STrond Myklebust struct cb_sequenceres;
3442f92ae34STrond Myklebust 
3452f92ae34STrond Myklebust TRACE_EVENT(nfs4_cb_sequence,
3462f92ae34STrond Myklebust 		TP_PROTO(
3472f92ae34STrond Myklebust 			const struct cb_sequenceargs *args,
3482f92ae34STrond Myklebust 			const struct cb_sequenceres *res,
3492f92ae34STrond Myklebust 			__be32 status
3502f92ae34STrond Myklebust 		),
3512f92ae34STrond Myklebust 		TP_ARGS(args, res, status),
3522f92ae34STrond Myklebust 
3532f92ae34STrond Myklebust 		TP_STRUCT__entry(
3542f92ae34STrond Myklebust 			__field(unsigned int, session)
3552f92ae34STrond Myklebust 			__field(unsigned int, slot_nr)
3562f92ae34STrond Myklebust 			__field(unsigned int, seq_nr)
3572f92ae34STrond Myklebust 			__field(unsigned int, highest_slotid)
3582f92ae34STrond Myklebust 			__field(unsigned int, cachethis)
3592f92ae34STrond Myklebust 			__field(int, error)
3602f92ae34STrond Myklebust 		),
3612f92ae34STrond Myklebust 
3622f92ae34STrond Myklebust 		TP_fast_assign(
3632f92ae34STrond Myklebust 			__entry->session = nfs_session_id_hash(&args->csa_sessionid);
3642f92ae34STrond Myklebust 			__entry->slot_nr = args->csa_slotid;
3652f92ae34STrond Myklebust 			__entry->seq_nr = args->csa_sequenceid;
3662f92ae34STrond Myklebust 			__entry->highest_slotid = args->csa_highestslotid;
3672f92ae34STrond Myklebust 			__entry->cachethis = args->csa_cachethis;
3682f92ae34STrond Myklebust 			__entry->error = -be32_to_cpu(status);
3692f92ae34STrond Myklebust 		),
3702f92ae34STrond Myklebust 
3712f92ae34STrond Myklebust 		TP_printk(
3722f92ae34STrond Myklebust 			"error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
3732f92ae34STrond Myklebust 			"highest_slotid=%u",
3742f92ae34STrond Myklebust 			__entry->error,
3752f92ae34STrond Myklebust 			show_nfsv4_errors(__entry->error),
3762f92ae34STrond Myklebust 			__entry->session,
3772f92ae34STrond Myklebust 			__entry->slot_nr,
3782f92ae34STrond Myklebust 			__entry->seq_nr,
3792f92ae34STrond Myklebust 			__entry->highest_slotid
3802f92ae34STrond Myklebust 		)
3812f92ae34STrond Myklebust );
382c6d01c6fSTrond Myklebust #endif /* CONFIG_NFS_V4_1 */
383c6d01c6fSTrond Myklebust 
38442113a75STrond Myklebust DECLARE_EVENT_CLASS(nfs4_open_event,
38542113a75STrond Myklebust 		TP_PROTO(
38642113a75STrond Myklebust 			const struct nfs_open_context *ctx,
38742113a75STrond Myklebust 			int flags,
38842113a75STrond Myklebust 			int error
38942113a75STrond Myklebust 		),
39042113a75STrond Myklebust 
39142113a75STrond Myklebust 		TP_ARGS(ctx, flags, error),
39242113a75STrond Myklebust 
39342113a75STrond Myklebust 		TP_STRUCT__entry(
39442113a75STrond Myklebust 			__field(int, error)
39542113a75STrond Myklebust 			__field(unsigned int, flags)
39642113a75STrond Myklebust 			__field(unsigned int, fmode)
39742113a75STrond Myklebust 			__field(dev_t, dev)
39842113a75STrond Myklebust 			__field(u32, fhandle)
39942113a75STrond Myklebust 			__field(u64, fileid)
40042113a75STrond Myklebust 			__field(u64, dir)
40142113a75STrond Myklebust 			__string(name, ctx->dentry->d_name.name)
40242113a75STrond Myklebust 		),
40342113a75STrond Myklebust 
40442113a75STrond Myklebust 		TP_fast_assign(
40542113a75STrond Myklebust 			const struct nfs4_state *state = ctx->state;
40642113a75STrond Myklebust 			const struct inode *inode = NULL;
40742113a75STrond Myklebust 
40842113a75STrond Myklebust 			__entry->error = error;
40942113a75STrond Myklebust 			__entry->flags = flags;
41042113a75STrond Myklebust 			__entry->fmode = (__force unsigned int)ctx->mode;
41142113a75STrond Myklebust 			__entry->dev = ctx->dentry->d_sb->s_dev;
41242113a75STrond Myklebust 			if (!IS_ERR(state))
41342113a75STrond Myklebust 				inode = state->inode;
41442113a75STrond Myklebust 			if (inode != NULL) {
41542113a75STrond Myklebust 				__entry->fileid = NFS_FILEID(inode);
41642113a75STrond Myklebust 				__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
41742113a75STrond Myklebust 			} else {
41842113a75STrond Myklebust 				__entry->fileid = 0;
41942113a75STrond Myklebust 				__entry->fhandle = 0;
42042113a75STrond Myklebust 			}
42142113a75STrond Myklebust 			__entry->dir = NFS_FILEID(ctx->dentry->d_parent->d_inode);
42242113a75STrond Myklebust 			__assign_str(name, ctx->dentry->d_name.name);
42342113a75STrond Myklebust 		),
42442113a75STrond Myklebust 
42542113a75STrond Myklebust 		TP_printk(
42642113a75STrond Myklebust 			"error=%d (%s) flags=%d (%s) fmode=%s "
42742113a75STrond Myklebust 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
42842113a75STrond Myklebust 			"name=%02x:%02x:%llu/%s",
42942113a75STrond Myklebust 			 __entry->error,
43042113a75STrond Myklebust 			 show_nfsv4_errors(__entry->error),
43142113a75STrond Myklebust 			 __entry->flags,
43242113a75STrond Myklebust 			 show_open_flags(__entry->flags),
43342113a75STrond Myklebust 			 show_fmode_flags(__entry->fmode),
43442113a75STrond Myklebust 			 MAJOR(__entry->dev), MINOR(__entry->dev),
43542113a75STrond Myklebust 			 (unsigned long long)__entry->fileid,
43642113a75STrond Myklebust 			 __entry->fhandle,
43742113a75STrond Myklebust 			 MAJOR(__entry->dev), MINOR(__entry->dev),
43842113a75STrond Myklebust 			 (unsigned long long)__entry->dir,
43942113a75STrond Myklebust 			 __get_str(name)
44042113a75STrond Myklebust 		)
44142113a75STrond Myklebust );
44242113a75STrond Myklebust 
44342113a75STrond Myklebust #define DEFINE_NFS4_OPEN_EVENT(name) \
44442113a75STrond Myklebust 	DEFINE_EVENT(nfs4_open_event, name, \
44542113a75STrond Myklebust 			TP_PROTO( \
44642113a75STrond Myklebust 				const struct nfs_open_context *ctx, \
44742113a75STrond Myklebust 				int flags, \
44842113a75STrond Myklebust 				int error \
44942113a75STrond Myklebust 			), \
45042113a75STrond Myklebust 			TP_ARGS(ctx, flags, error))
45142113a75STrond Myklebust DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
45242113a75STrond Myklebust DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
45342113a75STrond Myklebust DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
45442113a75STrond Myklebust 
45542113a75STrond Myklebust TRACE_EVENT(nfs4_close,
45642113a75STrond Myklebust 		TP_PROTO(
45742113a75STrond Myklebust 			const struct nfs4_state *state,
45842113a75STrond Myklebust 			const struct nfs_closeargs *args,
45942113a75STrond Myklebust 			const struct nfs_closeres *res,
46042113a75STrond Myklebust 			int error
46142113a75STrond Myklebust 		),
46242113a75STrond Myklebust 
46342113a75STrond Myklebust 		TP_ARGS(state, args, res, error),
46442113a75STrond Myklebust 
46542113a75STrond Myklebust 		TP_STRUCT__entry(
46642113a75STrond Myklebust 			__field(dev_t, dev)
46742113a75STrond Myklebust 			__field(u32, fhandle)
46842113a75STrond Myklebust 			__field(u64, fileid)
46942113a75STrond Myklebust 			__field(unsigned int, fmode)
47042113a75STrond Myklebust 			__field(int, error)
47142113a75STrond Myklebust 		),
47242113a75STrond Myklebust 
47342113a75STrond Myklebust 		TP_fast_assign(
47442113a75STrond Myklebust 			const struct inode *inode = state->inode;
47542113a75STrond Myklebust 
47642113a75STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
47742113a75STrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
47842113a75STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
47942113a75STrond Myklebust 			__entry->fmode = (__force unsigned int)state->state;
48042113a75STrond Myklebust 			__entry->error = error;
48142113a75STrond Myklebust 		),
48242113a75STrond Myklebust 
48342113a75STrond Myklebust 		TP_printk(
48442113a75STrond Myklebust 			"error=%d (%s) fmode=%s fileid=%02x:%02x:%llu "
48542113a75STrond Myklebust 			"fhandle=0x%08x",
48642113a75STrond Myklebust 			__entry->error,
48742113a75STrond Myklebust 			show_nfsv4_errors(__entry->error),
48842113a75STrond Myklebust 			__entry->fmode ?  show_fmode_flags(__entry->fmode) :
48942113a75STrond Myklebust 					  "closed",
49042113a75STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
49142113a75STrond Myklebust 			(unsigned long long)__entry->fileid,
49242113a75STrond Myklebust 			__entry->fhandle
49342113a75STrond Myklebust 		)
49442113a75STrond Myklebust );
49542113a75STrond Myklebust 
496d1b748a5STrond Myklebust #define show_lock_cmd(type) \
497d1b748a5STrond Myklebust 	__print_symbolic((int)type, \
498d1b748a5STrond Myklebust 		{ F_GETLK, "GETLK" }, \
499d1b748a5STrond Myklebust 		{ F_SETLK, "SETLK" }, \
500d1b748a5STrond Myklebust 		{ F_SETLKW, "SETLKW" })
501d1b748a5STrond Myklebust #define show_lock_type(type) \
502d1b748a5STrond Myklebust 	__print_symbolic((int)type, \
503d1b748a5STrond Myklebust 		{ F_RDLCK, "RDLCK" }, \
504d1b748a5STrond Myklebust 		{ F_WRLCK, "WRLCK" }, \
505d1b748a5STrond Myklebust 		{ F_UNLCK, "UNLCK" })
506d1b748a5STrond Myklebust 
507d1b748a5STrond Myklebust DECLARE_EVENT_CLASS(nfs4_lock_event,
508d1b748a5STrond Myklebust 		TP_PROTO(
509d1b748a5STrond Myklebust 			const struct file_lock *request,
510d1b748a5STrond Myklebust 			const struct nfs4_state *state,
511d1b748a5STrond Myklebust 			int cmd,
512d1b748a5STrond Myklebust 			int error
513d1b748a5STrond Myklebust 		),
514d1b748a5STrond Myklebust 
515d1b748a5STrond Myklebust 		TP_ARGS(request, state, cmd, error),
516d1b748a5STrond Myklebust 
517d1b748a5STrond Myklebust 		TP_STRUCT__entry(
518d1b748a5STrond Myklebust 			__field(int, error)
519d1b748a5STrond Myklebust 			__field(int, cmd)
520d1b748a5STrond Myklebust 			__field(char, type)
521d1b748a5STrond Myklebust 			__field(loff_t, start)
522d1b748a5STrond Myklebust 			__field(loff_t, end)
523d1b748a5STrond Myklebust 			__field(dev_t, dev)
524d1b748a5STrond Myklebust 			__field(u32, fhandle)
525d1b748a5STrond Myklebust 			__field(u64, fileid)
526d1b748a5STrond Myklebust 		),
527d1b748a5STrond Myklebust 
528d1b748a5STrond Myklebust 		TP_fast_assign(
529d1b748a5STrond Myklebust 			const struct inode *inode = state->inode;
530d1b748a5STrond Myklebust 
531d1b748a5STrond Myklebust 			__entry->error = error;
532d1b748a5STrond Myklebust 			__entry->cmd = cmd;
533d1b748a5STrond Myklebust 			__entry->type = request->fl_type;
534d1b748a5STrond Myklebust 			__entry->start = request->fl_start;
535d1b748a5STrond Myklebust 			__entry->end = request->fl_end;
536d1b748a5STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
537d1b748a5STrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
538d1b748a5STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
539d1b748a5STrond Myklebust 		),
540d1b748a5STrond Myklebust 
541d1b748a5STrond Myklebust 		TP_printk(
542d1b748a5STrond Myklebust 			"error=%d (%s) cmd=%s:%s range=%lld:%lld "
543d1b748a5STrond Myklebust 			"fileid=%02x:%02x:%llu fhandle=0x%08x",
544d1b748a5STrond Myklebust 			__entry->error,
545d1b748a5STrond Myklebust 			show_nfsv4_errors(__entry->error),
546d1b748a5STrond Myklebust 			show_lock_cmd(__entry->cmd),
547d1b748a5STrond Myklebust 			show_lock_type(__entry->type),
548d1b748a5STrond Myklebust 			(long long)__entry->start,
549d1b748a5STrond Myklebust 			(long long)__entry->end,
550d1b748a5STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
551d1b748a5STrond Myklebust 			(unsigned long long)__entry->fileid,
552d1b748a5STrond Myklebust 			__entry->fhandle
553d1b748a5STrond Myklebust 		)
554d1b748a5STrond Myklebust );
555d1b748a5STrond Myklebust 
556d1b748a5STrond Myklebust #define DEFINE_NFS4_LOCK_EVENT(name) \
557d1b748a5STrond Myklebust 	DEFINE_EVENT(nfs4_lock_event, name, \
558d1b748a5STrond Myklebust 			TP_PROTO( \
559d1b748a5STrond Myklebust 				const struct file_lock *request, \
560d1b748a5STrond Myklebust 				const struct nfs4_state *state, \
561d1b748a5STrond Myklebust 				int cmd, \
562d1b748a5STrond Myklebust 				int error \
563d1b748a5STrond Myklebust 			), \
564d1b748a5STrond Myklebust 			TP_ARGS(request, state, cmd, error))
565d1b748a5STrond Myklebust DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
566d1b748a5STrond Myklebust DEFINE_NFS4_LOCK_EVENT(nfs4_set_lock);
567d1b748a5STrond Myklebust DEFINE_NFS4_LOCK_EVENT(nfs4_lock_reclaim);
568d1b748a5STrond Myklebust DEFINE_NFS4_LOCK_EVENT(nfs4_lock_expired);
569d1b748a5STrond Myklebust DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
570d1b748a5STrond Myklebust 
571ca8acf8dSTrond Myklebust DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
572ca8acf8dSTrond Myklebust 		TP_PROTO(
573ca8acf8dSTrond Myklebust 			const struct inode *inode,
574ca8acf8dSTrond Myklebust 			fmode_t fmode
575ca8acf8dSTrond Myklebust 		),
576ca8acf8dSTrond Myklebust 
577ca8acf8dSTrond Myklebust 		TP_ARGS(inode, fmode),
578ca8acf8dSTrond Myklebust 
579ca8acf8dSTrond Myklebust 		TP_STRUCT__entry(
580ca8acf8dSTrond Myklebust 			__field(dev_t, dev)
581ca8acf8dSTrond Myklebust 			__field(u32, fhandle)
582ca8acf8dSTrond Myklebust 			__field(u64, fileid)
583ca8acf8dSTrond Myklebust 			__field(unsigned int, fmode)
584ca8acf8dSTrond Myklebust 		),
585ca8acf8dSTrond Myklebust 
586ca8acf8dSTrond Myklebust 		TP_fast_assign(
587ca8acf8dSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
588ca8acf8dSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
589ca8acf8dSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
590ca8acf8dSTrond Myklebust 			__entry->fmode = (__force unsigned int)fmode;
591ca8acf8dSTrond Myklebust 		),
592ca8acf8dSTrond Myklebust 
593ca8acf8dSTrond Myklebust 		TP_printk(
594ca8acf8dSTrond Myklebust 			"fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
595ca8acf8dSTrond Myklebust 			show_fmode_flags(__entry->fmode),
596ca8acf8dSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
597ca8acf8dSTrond Myklebust 			(unsigned long long)__entry->fileid,
598ca8acf8dSTrond Myklebust 			__entry->fhandle
599ca8acf8dSTrond Myklebust 		)
600ca8acf8dSTrond Myklebust );
601ca8acf8dSTrond Myklebust #define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
602ca8acf8dSTrond Myklebust 	DEFINE_EVENT(nfs4_set_delegation_event, name, \
603ca8acf8dSTrond Myklebust 			TP_PROTO( \
604ca8acf8dSTrond Myklebust 				const struct inode *inode, \
605ca8acf8dSTrond Myklebust 				fmode_t fmode \
606ca8acf8dSTrond Myklebust 			), \
607ca8acf8dSTrond Myklebust 			TP_ARGS(inode, fmode))
608ca8acf8dSTrond Myklebust DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
609ca8acf8dSTrond Myklebust DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
610ca8acf8dSTrond Myklebust 
611ca8acf8dSTrond Myklebust TRACE_EVENT(nfs4_delegreturn_exit,
612ca8acf8dSTrond Myklebust 		TP_PROTO(
613ca8acf8dSTrond Myklebust 			const struct nfs4_delegreturnargs *args,
614ca8acf8dSTrond Myklebust 			const struct nfs4_delegreturnres *res,
615ca8acf8dSTrond Myklebust 			int error
616ca8acf8dSTrond Myklebust 		),
617ca8acf8dSTrond Myklebust 
618ca8acf8dSTrond Myklebust 		TP_ARGS(args, res, error),
619ca8acf8dSTrond Myklebust 
620ca8acf8dSTrond Myklebust 		TP_STRUCT__entry(
621ca8acf8dSTrond Myklebust 			__field(dev_t, dev)
622ca8acf8dSTrond Myklebust 			__field(u32, fhandle)
623ca8acf8dSTrond Myklebust 			__field(int, error)
624ca8acf8dSTrond Myklebust 		),
625ca8acf8dSTrond Myklebust 
626ca8acf8dSTrond Myklebust 		TP_fast_assign(
627ca8acf8dSTrond Myklebust 			__entry->dev = res->server->s_dev;
628ca8acf8dSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(args->fhandle);
629ca8acf8dSTrond Myklebust 			__entry->error = error;
630ca8acf8dSTrond Myklebust 		),
631ca8acf8dSTrond Myklebust 
632ca8acf8dSTrond Myklebust 		TP_printk(
633ca8acf8dSTrond Myklebust 			"error=%d (%s) dev=%02x:%02x fhandle=0x%08x",
634ca8acf8dSTrond Myklebust 			__entry->error,
635ca8acf8dSTrond Myklebust 			show_nfsv4_errors(__entry->error),
636ca8acf8dSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
637ca8acf8dSTrond Myklebust 			__entry->fhandle
638ca8acf8dSTrond Myklebust 		)
639ca8acf8dSTrond Myklebust );
640ca8acf8dSTrond Myklebust 
64108cb47faSTrond Myklebust #ifdef CONFIG_NFS_V4_1
64208cb47faSTrond Myklebust DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
64308cb47faSTrond Myklebust 		TP_PROTO(
64408cb47faSTrond Myklebust 			const struct nfs4_state *state,
64508cb47faSTrond Myklebust 			const struct nfs4_lock_state *lsp,
64608cb47faSTrond Myklebust 			int error
64708cb47faSTrond Myklebust 		),
64808cb47faSTrond Myklebust 
64908cb47faSTrond Myklebust 		TP_ARGS(state, lsp, error),
65008cb47faSTrond Myklebust 
65108cb47faSTrond Myklebust 		TP_STRUCT__entry(
65208cb47faSTrond Myklebust 			__field(int, error)
65308cb47faSTrond Myklebust 			__field(dev_t, dev)
65408cb47faSTrond Myklebust 			__field(u32, fhandle)
65508cb47faSTrond Myklebust 			__field(u64, fileid)
65608cb47faSTrond Myklebust 		),
65708cb47faSTrond Myklebust 
65808cb47faSTrond Myklebust 		TP_fast_assign(
65908cb47faSTrond Myklebust 			const struct inode *inode = state->inode;
66008cb47faSTrond Myklebust 
66108cb47faSTrond Myklebust 			__entry->error = error;
66208cb47faSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
66308cb47faSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
66408cb47faSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
66508cb47faSTrond Myklebust 		),
66608cb47faSTrond Myklebust 
66708cb47faSTrond Myklebust 		TP_printk(
66808cb47faSTrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
66908cb47faSTrond Myklebust 			__entry->error,
67008cb47faSTrond Myklebust 			show_nfsv4_errors(__entry->error),
67108cb47faSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
67208cb47faSTrond Myklebust 			(unsigned long long)__entry->fileid,
67308cb47faSTrond Myklebust 			__entry->fhandle
67408cb47faSTrond Myklebust 		)
67508cb47faSTrond Myklebust );
67608cb47faSTrond Myklebust 
67708cb47faSTrond Myklebust #define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
67808cb47faSTrond Myklebust 	DEFINE_EVENT(nfs4_test_stateid_event, name, \
67908cb47faSTrond Myklebust 			TP_PROTO( \
68008cb47faSTrond Myklebust 				const struct nfs4_state *state, \
68108cb47faSTrond Myklebust 				const struct nfs4_lock_state *lsp, \
68208cb47faSTrond Myklebust 				int error \
68308cb47faSTrond Myklebust 			), \
68408cb47faSTrond Myklebust 			TP_ARGS(state, lsp, error))
68508cb47faSTrond Myklebust DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
68608cb47faSTrond Myklebust DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
68708cb47faSTrond Myklebust DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
68808cb47faSTrond Myklebust #endif /* CONFIG_NFS_V4_1 */
68908cb47faSTrond Myklebust 
690078ea3dfSTrond Myklebust DECLARE_EVENT_CLASS(nfs4_lookup_event,
691078ea3dfSTrond Myklebust 		TP_PROTO(
692078ea3dfSTrond Myklebust 			const struct inode *dir,
693078ea3dfSTrond Myklebust 			const struct qstr *name,
694078ea3dfSTrond Myklebust 			int error
695078ea3dfSTrond Myklebust 		),
696078ea3dfSTrond Myklebust 
697078ea3dfSTrond Myklebust 		TP_ARGS(dir, name, error),
698078ea3dfSTrond Myklebust 
699078ea3dfSTrond Myklebust 		TP_STRUCT__entry(
700078ea3dfSTrond Myklebust 			__field(dev_t, dev)
701078ea3dfSTrond Myklebust 			__field(int, error)
702078ea3dfSTrond Myklebust 			__field(u64, dir)
703078ea3dfSTrond Myklebust 			__string(name, name->name)
704078ea3dfSTrond Myklebust 		),
705078ea3dfSTrond Myklebust 
706078ea3dfSTrond Myklebust 		TP_fast_assign(
707078ea3dfSTrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
708078ea3dfSTrond Myklebust 			__entry->dir = NFS_FILEID(dir);
709078ea3dfSTrond Myklebust 			__entry->error = error;
710078ea3dfSTrond Myklebust 			__assign_str(name, name->name);
711078ea3dfSTrond Myklebust 		),
712078ea3dfSTrond Myklebust 
713078ea3dfSTrond Myklebust 		TP_printk(
714078ea3dfSTrond Myklebust 			"error=%d (%s) name=%02x:%02x:%llu/%s",
715078ea3dfSTrond Myklebust 			__entry->error,
716078ea3dfSTrond Myklebust 			show_nfsv4_errors(__entry->error),
717078ea3dfSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
718078ea3dfSTrond Myklebust 			(unsigned long long)__entry->dir,
719078ea3dfSTrond Myklebust 			__get_str(name)
720078ea3dfSTrond Myklebust 		)
721078ea3dfSTrond Myklebust );
722078ea3dfSTrond Myklebust 
723078ea3dfSTrond Myklebust #define DEFINE_NFS4_LOOKUP_EVENT(name) \
724078ea3dfSTrond Myklebust 	DEFINE_EVENT(nfs4_lookup_event, name, \
725078ea3dfSTrond Myklebust 			TP_PROTO( \
726078ea3dfSTrond Myklebust 				const struct inode *dir, \
727078ea3dfSTrond Myklebust 				const struct qstr *name, \
728078ea3dfSTrond Myklebust 				int error \
729078ea3dfSTrond Myklebust 			), \
730078ea3dfSTrond Myklebust 			TP_ARGS(dir, name, error))
731078ea3dfSTrond Myklebust 
732078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
733078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
734078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
735078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
736078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
737078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
738078ea3dfSTrond Myklebust DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
739078ea3dfSTrond Myklebust 
740fbc6f7c2STrond Myklebust TRACE_EVENT(nfs4_rename,
741fbc6f7c2STrond Myklebust 		TP_PROTO(
742fbc6f7c2STrond Myklebust 			const struct inode *olddir,
743fbc6f7c2STrond Myklebust 			const struct qstr *oldname,
744fbc6f7c2STrond Myklebust 			const struct inode *newdir,
745fbc6f7c2STrond Myklebust 			const struct qstr *newname,
746fbc6f7c2STrond Myklebust 			int error
747fbc6f7c2STrond Myklebust 		),
748fbc6f7c2STrond Myklebust 
749fbc6f7c2STrond Myklebust 		TP_ARGS(olddir, oldname, newdir, newname, error),
750fbc6f7c2STrond Myklebust 
751fbc6f7c2STrond Myklebust 		TP_STRUCT__entry(
752fbc6f7c2STrond Myklebust 			__field(dev_t, dev)
753fbc6f7c2STrond Myklebust 			__field(int, error)
754fbc6f7c2STrond Myklebust 			__field(u64, olddir)
755fbc6f7c2STrond Myklebust 			__string(oldname, oldname->name)
756fbc6f7c2STrond Myklebust 			__field(u64, newdir)
757fbc6f7c2STrond Myklebust 			__string(newname, newname->name)
758fbc6f7c2STrond Myklebust 		),
759fbc6f7c2STrond Myklebust 
760fbc6f7c2STrond Myklebust 		TP_fast_assign(
761fbc6f7c2STrond Myklebust 			__entry->dev = olddir->i_sb->s_dev;
762fbc6f7c2STrond Myklebust 			__entry->olddir = NFS_FILEID(olddir);
763fbc6f7c2STrond Myklebust 			__entry->newdir = NFS_FILEID(newdir);
764fbc6f7c2STrond Myklebust 			__entry->error = error;
765fbc6f7c2STrond Myklebust 			__assign_str(oldname, oldname->name);
766fbc6f7c2STrond Myklebust 			__assign_str(newname, newname->name);
767fbc6f7c2STrond Myklebust 		),
768fbc6f7c2STrond Myklebust 
769fbc6f7c2STrond Myklebust 		TP_printk(
770fbc6f7c2STrond Myklebust 			"error=%d (%s) oldname=%02x:%02x:%llu/%s "
771fbc6f7c2STrond Myklebust 			"newname=%02x:%02x:%llu/%s",
772fbc6f7c2STrond Myklebust 			__entry->error,
773fbc6f7c2STrond Myklebust 			show_nfsv4_errors(__entry->error),
774fbc6f7c2STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
775fbc6f7c2STrond Myklebust 			(unsigned long long)__entry->olddir,
776fbc6f7c2STrond Myklebust 			__get_str(oldname),
777fbc6f7c2STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
778fbc6f7c2STrond Myklebust 			(unsigned long long)__entry->newdir,
779fbc6f7c2STrond Myklebust 			__get_str(newname)
780fbc6f7c2STrond Myklebust 		)
781fbc6f7c2STrond Myklebust );
782fbc6f7c2STrond Myklebust 
783c1578b76STrond Myklebust DECLARE_EVENT_CLASS(nfs4_inode_event,
784c1578b76STrond Myklebust 		TP_PROTO(
785c1578b76STrond Myklebust 			const struct inode *inode,
786c1578b76STrond Myklebust 			int error
787c1578b76STrond Myklebust 		),
788c1578b76STrond Myklebust 
789c1578b76STrond Myklebust 		TP_ARGS(inode, error),
790c1578b76STrond Myklebust 
791c1578b76STrond Myklebust 		TP_STRUCT__entry(
792c1578b76STrond Myklebust 			__field(dev_t, dev)
793c1578b76STrond Myklebust 			__field(u32, fhandle)
794c1578b76STrond Myklebust 			__field(u64, fileid)
795c1578b76STrond Myklebust 			__field(int, error)
796c1578b76STrond Myklebust 		),
797c1578b76STrond Myklebust 
798c1578b76STrond Myklebust 		TP_fast_assign(
799c1578b76STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
800c1578b76STrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
801c1578b76STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
802c1578b76STrond Myklebust 			__entry->error = error;
803c1578b76STrond Myklebust 		),
804c1578b76STrond Myklebust 
805c1578b76STrond Myklebust 		TP_printk(
806c1578b76STrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
807c1578b76STrond Myklebust 			__entry->error,
808c1578b76STrond Myklebust 			show_nfsv4_errors(__entry->error),
809c1578b76STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
810c1578b76STrond Myklebust 			(unsigned long long)__entry->fileid,
811c1578b76STrond Myklebust 			__entry->fhandle
812c1578b76STrond Myklebust 		)
813c1578b76STrond Myklebust );
814c1578b76STrond Myklebust 
815c1578b76STrond Myklebust #define DEFINE_NFS4_INODE_EVENT(name) \
816c1578b76STrond Myklebust 	DEFINE_EVENT(nfs4_inode_event, name, \
817c1578b76STrond Myklebust 			TP_PROTO( \
818c1578b76STrond Myklebust 				const struct inode *inode, \
819c1578b76STrond Myklebust 				int error \
820c1578b76STrond Myklebust 			), \
821c1578b76STrond Myklebust 			TP_ARGS(inode, error))
822c1578b76STrond Myklebust 
823c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_setattr);
824c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_access);
825c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
826c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
827c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
828c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
829c1578b76STrond Myklebust #ifdef CONFIG_NFS_V4_SECURITY_LABEL
830c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
831c1578b76STrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
832c1578b76STrond Myklebust #endif /* CONFIG_NFS_V4_SECURITY_LABEL */
833ca8acf8dSTrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_recall_delegation);
834ca8acf8dSTrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_delegreturn);
835c1578b76STrond Myklebust 
836b5f875a9STrond Myklebust DECLARE_EVENT_CLASS(nfs4_getattr_event,
837b5f875a9STrond Myklebust 		TP_PROTO(
838b5f875a9STrond Myklebust 			const struct nfs_server *server,
839b5f875a9STrond Myklebust 			const struct nfs_fh *fhandle,
840b5f875a9STrond Myklebust 			const struct nfs_fattr *fattr,
841b5f875a9STrond Myklebust 			int error
842b5f875a9STrond Myklebust 		),
843b5f875a9STrond Myklebust 
844b5f875a9STrond Myklebust 		TP_ARGS(server, fhandle, fattr, error),
845b5f875a9STrond Myklebust 
846b5f875a9STrond Myklebust 		TP_STRUCT__entry(
847b5f875a9STrond Myklebust 			__field(dev_t, dev)
848b5f875a9STrond Myklebust 			__field(u32, fhandle)
849b5f875a9STrond Myklebust 			__field(u64, fileid)
850b5f875a9STrond Myklebust 			__field(unsigned int, valid)
851b5f875a9STrond Myklebust 			__field(int, error)
852b5f875a9STrond Myklebust 		),
853b5f875a9STrond Myklebust 
854b5f875a9STrond Myklebust 		TP_fast_assign(
855b5f875a9STrond Myklebust 			__entry->dev = server->s_dev;
856b5f875a9STrond Myklebust 			__entry->valid = fattr->valid;
857b5f875a9STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fhandle);
858b5f875a9STrond Myklebust 			__entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
859b5f875a9STrond Myklebust 			__entry->error = error;
860b5f875a9STrond Myklebust 		),
861b5f875a9STrond Myklebust 
862b5f875a9STrond Myklebust 		TP_printk(
863b5f875a9STrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
864b5f875a9STrond Myklebust 			"valid=%s",
865b5f875a9STrond Myklebust 			__entry->error,
866b5f875a9STrond Myklebust 			show_nfsv4_errors(__entry->error),
867b5f875a9STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
868b5f875a9STrond Myklebust 			(unsigned long long)__entry->fileid,
869b5f875a9STrond Myklebust 			__entry->fhandle,
870b5f875a9STrond Myklebust 			show_nfs_fattr_flags(__entry->valid)
871b5f875a9STrond Myklebust 		)
872b5f875a9STrond Myklebust );
873b5f875a9STrond Myklebust 
874b5f875a9STrond Myklebust #define DEFINE_NFS4_GETATTR_EVENT(name) \
875b5f875a9STrond Myklebust 	DEFINE_EVENT(nfs4_getattr_event, name, \
876b5f875a9STrond Myklebust 			TP_PROTO( \
877b5f875a9STrond Myklebust 				const struct nfs_server *server, \
878b5f875a9STrond Myklebust 				const struct nfs_fh *fhandle, \
879b5f875a9STrond Myklebust 				const struct nfs_fattr *fattr, \
880b5f875a9STrond Myklebust 				int error \
881b5f875a9STrond Myklebust 			), \
882b5f875a9STrond Myklebust 			TP_ARGS(server, fhandle, fattr, error))
883b5f875a9STrond Myklebust DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
884b5f875a9STrond Myklebust DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
885b5f875a9STrond Myklebust DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
886b5f875a9STrond Myklebust 
8871f2d30b5STrond Myklebust DECLARE_EVENT_CLASS(nfs4_idmap_event,
8881f2d30b5STrond Myklebust 		TP_PROTO(
8891f2d30b5STrond Myklebust 			const char *name,
8901f2d30b5STrond Myklebust 			int len,
8911f2d30b5STrond Myklebust 			u32 id,
8921f2d30b5STrond Myklebust 			int error
8931f2d30b5STrond Myklebust 		),
8941f2d30b5STrond Myklebust 
8951f2d30b5STrond Myklebust 		TP_ARGS(name, len, id, error),
8961f2d30b5STrond Myklebust 
8971f2d30b5STrond Myklebust 		TP_STRUCT__entry(
8981f2d30b5STrond Myklebust 			__field(int, error)
8991f2d30b5STrond Myklebust 			__field(u32, id)
9001f2d30b5STrond Myklebust 			__dynamic_array(char, name, len > 0 ? len + 1 : 1)
9011f2d30b5STrond Myklebust 		),
9021f2d30b5STrond Myklebust 
9031f2d30b5STrond Myklebust 		TP_fast_assign(
9041f2d30b5STrond Myklebust 			if (len < 0)
9051f2d30b5STrond Myklebust 				len = 0;
9061f2d30b5STrond Myklebust 			__entry->error = error < 0 ? error : 0;
9071f2d30b5STrond Myklebust 			__entry->id = id;
9081f2d30b5STrond Myklebust 			memcpy(__get_dynamic_array(name), name, len);
9091f2d30b5STrond Myklebust 			((char *)__get_dynamic_array(name))[len] = 0;
9101f2d30b5STrond Myklebust 		),
9111f2d30b5STrond Myklebust 
9121f2d30b5STrond Myklebust 		TP_printk(
9131f2d30b5STrond Myklebust 			"error=%d id=%u name=%s",
9141f2d30b5STrond Myklebust 			__entry->error,
9151f2d30b5STrond Myklebust 			__entry->id,
9161f2d30b5STrond Myklebust 			__get_str(name)
9171f2d30b5STrond Myklebust 		)
9181f2d30b5STrond Myklebust );
9191f2d30b5STrond Myklebust #define DEFINE_NFS4_IDMAP_EVENT(name) \
9201f2d30b5STrond Myklebust 	DEFINE_EVENT(nfs4_idmap_event, name, \
9211f2d30b5STrond Myklebust 			TP_PROTO( \
9221f2d30b5STrond Myklebust 				const char *name, \
9231f2d30b5STrond Myklebust 				int len, \
9241f2d30b5STrond Myklebust 				u32 id, \
9251f2d30b5STrond Myklebust 				int error \
9261f2d30b5STrond Myklebust 			), \
9271f2d30b5STrond Myklebust 			TP_ARGS(name, len, id, error))
9281f2d30b5STrond Myklebust DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
9291f2d30b5STrond Myklebust DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
9301f2d30b5STrond Myklebust DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
9311f2d30b5STrond Myklebust DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
9321f2d30b5STrond Myklebust 
933cc668ab3STrond Myklebust DECLARE_EVENT_CLASS(nfs4_read_event,
934cc668ab3STrond Myklebust 		TP_PROTO(
935cc668ab3STrond Myklebust 			const struct nfs_read_data *data,
936cc668ab3STrond Myklebust 			int error
937cc668ab3STrond Myklebust 		),
938cc668ab3STrond Myklebust 
939cc668ab3STrond Myklebust 		TP_ARGS(data, error),
940cc668ab3STrond Myklebust 
941cc668ab3STrond Myklebust 		TP_STRUCT__entry(
942cc668ab3STrond Myklebust 			__field(dev_t, dev)
943cc668ab3STrond Myklebust 			__field(u32, fhandle)
944cc668ab3STrond Myklebust 			__field(u64, fileid)
945cc668ab3STrond Myklebust 			__field(loff_t, offset)
946cc668ab3STrond Myklebust 			__field(size_t, count)
947cc668ab3STrond Myklebust 			__field(int, error)
948cc668ab3STrond Myklebust 		),
949cc668ab3STrond Myklebust 
950cc668ab3STrond Myklebust 		TP_fast_assign(
951cc668ab3STrond Myklebust 			const struct inode *inode = data->header->inode;
952cc668ab3STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
953cc668ab3STrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
954cc668ab3STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
955cc668ab3STrond Myklebust 			__entry->offset = data->args.offset;
956cc668ab3STrond Myklebust 			__entry->count = data->args.count;
957cc668ab3STrond Myklebust 			__entry->error = error;
958cc668ab3STrond Myklebust 		),
959cc668ab3STrond Myklebust 
960cc668ab3STrond Myklebust 		TP_printk(
961cc668ab3STrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
962cc668ab3STrond Myklebust 			"offset=%lld count=%zu",
963cc668ab3STrond Myklebust 			__entry->error,
964cc668ab3STrond Myklebust 			show_nfsv4_errors(__entry->error),
965cc668ab3STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
966cc668ab3STrond Myklebust 			(unsigned long long)__entry->fileid,
967cc668ab3STrond Myklebust 			__entry->fhandle,
968cc668ab3STrond Myklebust 			(long long)__entry->offset,
969cc668ab3STrond Myklebust 			__entry->count
970cc668ab3STrond Myklebust 		)
971cc668ab3STrond Myklebust );
972cc668ab3STrond Myklebust #define DEFINE_NFS4_READ_EVENT(name) \
973cc668ab3STrond Myklebust 	DEFINE_EVENT(nfs4_read_event, name, \
974cc668ab3STrond Myklebust 			TP_PROTO( \
975cc668ab3STrond Myklebust 				const struct nfs_read_data *data, \
976cc668ab3STrond Myklebust 				int error \
977cc668ab3STrond Myklebust 			), \
978cc668ab3STrond Myklebust 			TP_ARGS(data, error))
979cc668ab3STrond Myklebust DEFINE_NFS4_READ_EVENT(nfs4_read);
980cc668ab3STrond Myklebust #ifdef CONFIG_NFS_V4_1
981cc668ab3STrond Myklebust DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
982cc668ab3STrond Myklebust #endif /* CONFIG_NFS_V4_1 */
983cc668ab3STrond Myklebust 
984cc668ab3STrond Myklebust DECLARE_EVENT_CLASS(nfs4_write_event,
985cc668ab3STrond Myklebust 		TP_PROTO(
986cc668ab3STrond Myklebust 			const struct nfs_write_data *data,
987cc668ab3STrond Myklebust 			int error
988cc668ab3STrond Myklebust 		),
989cc668ab3STrond Myklebust 
990cc668ab3STrond Myklebust 		TP_ARGS(data, error),
991cc668ab3STrond Myklebust 
992cc668ab3STrond Myklebust 		TP_STRUCT__entry(
993cc668ab3STrond Myklebust 			__field(dev_t, dev)
994cc668ab3STrond Myklebust 			__field(u32, fhandle)
995cc668ab3STrond Myklebust 			__field(u64, fileid)
996cc668ab3STrond Myklebust 			__field(loff_t, offset)
997cc668ab3STrond Myklebust 			__field(size_t, count)
998cc668ab3STrond Myklebust 			__field(int, error)
999cc668ab3STrond Myklebust 		),
1000cc668ab3STrond Myklebust 
1001cc668ab3STrond Myklebust 		TP_fast_assign(
1002cc668ab3STrond Myklebust 			const struct inode *inode = data->header->inode;
1003cc668ab3STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
1004cc668ab3STrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
1005cc668ab3STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1006cc668ab3STrond Myklebust 			__entry->offset = data->args.offset;
1007cc668ab3STrond Myklebust 			__entry->count = data->args.count;
1008cc668ab3STrond Myklebust 			__entry->error = error;
1009cc668ab3STrond Myklebust 		),
1010cc668ab3STrond Myklebust 
1011cc668ab3STrond Myklebust 		TP_printk(
1012cc668ab3STrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1013cc668ab3STrond Myklebust 			"offset=%lld count=%zu",
1014cc668ab3STrond Myklebust 			__entry->error,
1015cc668ab3STrond Myklebust 			show_nfsv4_errors(__entry->error),
1016cc668ab3STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
1017cc668ab3STrond Myklebust 			(unsigned long long)__entry->fileid,
1018cc668ab3STrond Myklebust 			__entry->fhandle,
1019cc668ab3STrond Myklebust 			(long long)__entry->offset,
1020cc668ab3STrond Myklebust 			__entry->count
1021cc668ab3STrond Myklebust 		)
1022cc668ab3STrond Myklebust );
1023cc668ab3STrond Myklebust 
1024cc668ab3STrond Myklebust #define DEFINE_NFS4_WRITE_EVENT(name) \
1025cc668ab3STrond Myklebust 	DEFINE_EVENT(nfs4_write_event, name, \
1026cc668ab3STrond Myklebust 			TP_PROTO( \
1027cc668ab3STrond Myklebust 				const struct nfs_write_data *data, \
1028cc668ab3STrond Myklebust 				int error \
1029cc668ab3STrond Myklebust 			), \
1030cc668ab3STrond Myklebust 			TP_ARGS(data, error))
1031cc668ab3STrond Myklebust DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1032cc668ab3STrond Myklebust #ifdef CONFIG_NFS_V4_1
1033cc668ab3STrond Myklebust DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1034cc668ab3STrond Myklebust #endif /* CONFIG_NFS_V4_1 */
1035cc668ab3STrond Myklebust 
1036cc668ab3STrond Myklebust DECLARE_EVENT_CLASS(nfs4_commit_event,
1037cc668ab3STrond Myklebust 		TP_PROTO(
1038cc668ab3STrond Myklebust 			const struct nfs_commit_data *data,
1039cc668ab3STrond Myklebust 			int error
1040cc668ab3STrond Myklebust 		),
1041cc668ab3STrond Myklebust 
1042cc668ab3STrond Myklebust 		TP_ARGS(data, error),
1043cc668ab3STrond Myklebust 
1044cc668ab3STrond Myklebust 		TP_STRUCT__entry(
1045cc668ab3STrond Myklebust 			__field(dev_t, dev)
1046cc668ab3STrond Myklebust 			__field(u32, fhandle)
1047cc668ab3STrond Myklebust 			__field(u64, fileid)
1048cc668ab3STrond Myklebust 			__field(loff_t, offset)
1049cc668ab3STrond Myklebust 			__field(size_t, count)
1050cc668ab3STrond Myklebust 			__field(int, error)
1051cc668ab3STrond Myklebust 		),
1052cc668ab3STrond Myklebust 
1053cc668ab3STrond Myklebust 		TP_fast_assign(
1054cc668ab3STrond Myklebust 			const struct inode *inode = data->inode;
1055cc668ab3STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
1056cc668ab3STrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
1057cc668ab3STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1058cc668ab3STrond Myklebust 			__entry->offset = data->args.offset;
1059cc668ab3STrond Myklebust 			__entry->count = data->args.count;
1060cc668ab3STrond Myklebust 			__entry->error = error;
1061cc668ab3STrond Myklebust 		),
1062cc668ab3STrond Myklebust 
1063cc668ab3STrond Myklebust 		TP_printk(
1064cc668ab3STrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1065cc668ab3STrond Myklebust 			"offset=%lld count=%zu",
1066cc668ab3STrond Myklebust 			__entry->error,
1067cc668ab3STrond Myklebust 			show_nfsv4_errors(__entry->error),
1068cc668ab3STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
1069cc668ab3STrond Myklebust 			(unsigned long long)__entry->fileid,
1070cc668ab3STrond Myklebust 			__entry->fhandle,
1071cc668ab3STrond Myklebust 			(long long)__entry->offset,
1072cc668ab3STrond Myklebust 			__entry->count
1073cc668ab3STrond Myklebust 		)
1074cc668ab3STrond Myklebust );
1075cc668ab3STrond Myklebust #define DEFINE_NFS4_COMMIT_EVENT(name) \
1076cc668ab3STrond Myklebust 	DEFINE_EVENT(nfs4_commit_event, name, \
1077cc668ab3STrond Myklebust 			TP_PROTO( \
1078cc668ab3STrond Myklebust 				const struct nfs_commit_data *data, \
1079cc668ab3STrond Myklebust 				int error \
1080cc668ab3STrond Myklebust 			), \
1081cc668ab3STrond Myklebust 			TP_ARGS(data, error))
1082cc668ab3STrond Myklebust DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1083cc668ab3STrond Myklebust #ifdef CONFIG_NFS_V4_1
1084cc668ab3STrond Myklebust DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
10851037e6eaSTrond Myklebust 
10861037e6eaSTrond Myklebust #define show_pnfs_iomode(iomode) \
10871037e6eaSTrond Myklebust 	__print_symbolic(iomode, \
10881037e6eaSTrond Myklebust 		{ IOMODE_READ, "READ" }, \
10891037e6eaSTrond Myklebust 		{ IOMODE_RW, "RW" }, \
10901037e6eaSTrond Myklebust 		{ IOMODE_ANY, "ANY" })
10911037e6eaSTrond Myklebust 
10921037e6eaSTrond Myklebust TRACE_EVENT(nfs4_layoutget,
10931037e6eaSTrond Myklebust 		TP_PROTO(
10941037e6eaSTrond Myklebust 			const struct nfs_open_context *ctx,
10951037e6eaSTrond Myklebust 			const struct pnfs_layout_range *args,
10961037e6eaSTrond Myklebust 			const struct pnfs_layout_range *res,
10971037e6eaSTrond Myklebust 			int error
10981037e6eaSTrond Myklebust 		),
10991037e6eaSTrond Myklebust 
11001037e6eaSTrond Myklebust 		TP_ARGS(ctx, args, res, error),
11011037e6eaSTrond Myklebust 
11021037e6eaSTrond Myklebust 		TP_STRUCT__entry(
11031037e6eaSTrond Myklebust 			__field(dev_t, dev)
11041037e6eaSTrond Myklebust 			__field(u32, fhandle)
11051037e6eaSTrond Myklebust 			__field(u64, fileid)
11061037e6eaSTrond Myklebust 			__field(u32, iomode)
11071037e6eaSTrond Myklebust 			__field(u64, offset)
11081037e6eaSTrond Myklebust 			__field(u64, count)
11091037e6eaSTrond Myklebust 			__field(int, error)
11101037e6eaSTrond Myklebust 		),
11111037e6eaSTrond Myklebust 
11121037e6eaSTrond Myklebust 		TP_fast_assign(
11131037e6eaSTrond Myklebust 			const struct inode *inode = ctx->dentry->d_inode;
11141037e6eaSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
11151037e6eaSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
11161037e6eaSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
11171037e6eaSTrond Myklebust 			__entry->iomode = args->iomode;
11181037e6eaSTrond Myklebust 			__entry->offset = args->offset;
11191037e6eaSTrond Myklebust 			__entry->count = args->length;
11201037e6eaSTrond Myklebust 			__entry->error = error;
11211037e6eaSTrond Myklebust 		),
11221037e6eaSTrond Myklebust 
11231037e6eaSTrond Myklebust 		TP_printk(
11241037e6eaSTrond Myklebust 			"error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
11251037e6eaSTrond Myklebust 			"iomode=%s offset=%llu count=%llu",
11261037e6eaSTrond Myklebust 			__entry->error,
11271037e6eaSTrond Myklebust 			show_nfsv4_errors(__entry->error),
11281037e6eaSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
11291037e6eaSTrond Myklebust 			(unsigned long long)__entry->fileid,
11301037e6eaSTrond Myklebust 			__entry->fhandle,
11311037e6eaSTrond Myklebust 			show_pnfs_iomode(__entry->iomode),
11321037e6eaSTrond Myklebust 			(unsigned long long)__entry->offset,
11331037e6eaSTrond Myklebust 			(unsigned long long)__entry->count
11341037e6eaSTrond Myklebust 		)
11351037e6eaSTrond Myklebust );
11361037e6eaSTrond Myklebust 
11371037e6eaSTrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_layoutcommit);
11381037e6eaSTrond Myklebust DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn);
11391037e6eaSTrond Myklebust 
1140cc668ab3STrond Myklebust #endif /* CONFIG_NFS_V4_1 */
1141cc668ab3STrond Myklebust 
1142c6d01c6fSTrond Myklebust #endif /* _TRACE_NFS4_H */
1143c6d01c6fSTrond Myklebust 
1144c6d01c6fSTrond Myklebust #undef TRACE_INCLUDE_PATH
1145c6d01c6fSTrond Myklebust #define TRACE_INCLUDE_PATH .
1146c6d01c6fSTrond Myklebust #define TRACE_INCLUDE_FILE nfs4trace
1147c6d01c6fSTrond Myklebust /* This part must be outside protection */
1148c6d01c6fSTrond Myklebust #include <trace/define_trace.h>
1149