blob: e60b6fbd5ada1c6b18b2aba07e4aaee2cf4b8591 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Trond Myklebustc6d01c62013-08-09 11:51:26 -04002/*
3 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
4 */
5#undef TRACE_SYSTEM
6#define TRACE_SYSTEM nfs4
7
8#if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
9#define _TRACE_NFS4_H
10
11#include <linux/tracepoint.h>
12
Chuck Lever5b2095d2018-12-19 11:00:11 -050013TRACE_DEFINE_ENUM(EPERM);
14TRACE_DEFINE_ENUM(ENOENT);
15TRACE_DEFINE_ENUM(EIO);
16TRACE_DEFINE_ENUM(ENXIO);
17TRACE_DEFINE_ENUM(EACCES);
18TRACE_DEFINE_ENUM(EEXIST);
19TRACE_DEFINE_ENUM(EXDEV);
20TRACE_DEFINE_ENUM(ENOTDIR);
21TRACE_DEFINE_ENUM(EISDIR);
22TRACE_DEFINE_ENUM(EFBIG);
23TRACE_DEFINE_ENUM(ENOSPC);
24TRACE_DEFINE_ENUM(EROFS);
25TRACE_DEFINE_ENUM(EMLINK);
26TRACE_DEFINE_ENUM(ENAMETOOLONG);
27TRACE_DEFINE_ENUM(ENOTEMPTY);
28TRACE_DEFINE_ENUM(EDQUOT);
29TRACE_DEFINE_ENUM(ESTALE);
30TRACE_DEFINE_ENUM(EBADHANDLE);
31TRACE_DEFINE_ENUM(EBADCOOKIE);
32TRACE_DEFINE_ENUM(ENOTSUPP);
33TRACE_DEFINE_ENUM(ETOOSMALL);
34TRACE_DEFINE_ENUM(EREMOTEIO);
35TRACE_DEFINE_ENUM(EBADTYPE);
36TRACE_DEFINE_ENUM(EAGAIN);
37TRACE_DEFINE_ENUM(ELOOP);
38TRACE_DEFINE_ENUM(EOPNOTSUPP);
39TRACE_DEFINE_ENUM(EDEADLK);
40TRACE_DEFINE_ENUM(ENOMEM);
41TRACE_DEFINE_ENUM(EKEYEXPIRED);
42TRACE_DEFINE_ENUM(ETIMEDOUT);
43TRACE_DEFINE_ENUM(ERESTARTSYS);
44TRACE_DEFINE_ENUM(ECONNREFUSED);
45TRACE_DEFINE_ENUM(ECONNRESET);
46TRACE_DEFINE_ENUM(ENETUNREACH);
47TRACE_DEFINE_ENUM(EHOSTUNREACH);
48TRACE_DEFINE_ENUM(EHOSTDOWN);
49TRACE_DEFINE_ENUM(EPIPE);
50TRACE_DEFINE_ENUM(EPFNOSUPPORT);
51TRACE_DEFINE_ENUM(EPROTONOSUPPORT);
52
53TRACE_DEFINE_ENUM(NFS4_OK);
54TRACE_DEFINE_ENUM(NFS4ERR_ACCESS);
55TRACE_DEFINE_ENUM(NFS4ERR_ATTRNOTSUPP);
56TRACE_DEFINE_ENUM(NFS4ERR_ADMIN_REVOKED);
57TRACE_DEFINE_ENUM(NFS4ERR_BACK_CHAN_BUSY);
58TRACE_DEFINE_ENUM(NFS4ERR_BADCHAR);
59TRACE_DEFINE_ENUM(NFS4ERR_BADHANDLE);
60TRACE_DEFINE_ENUM(NFS4ERR_BADIOMODE);
61TRACE_DEFINE_ENUM(NFS4ERR_BADLAYOUT);
62TRACE_DEFINE_ENUM(NFS4ERR_BADLABEL);
63TRACE_DEFINE_ENUM(NFS4ERR_BADNAME);
64TRACE_DEFINE_ENUM(NFS4ERR_BADOWNER);
65TRACE_DEFINE_ENUM(NFS4ERR_BADSESSION);
66TRACE_DEFINE_ENUM(NFS4ERR_BADSLOT);
67TRACE_DEFINE_ENUM(NFS4ERR_BADTYPE);
68TRACE_DEFINE_ENUM(NFS4ERR_BADXDR);
69TRACE_DEFINE_ENUM(NFS4ERR_BAD_COOKIE);
70TRACE_DEFINE_ENUM(NFS4ERR_BAD_HIGH_SLOT);
71TRACE_DEFINE_ENUM(NFS4ERR_BAD_RANGE);
72TRACE_DEFINE_ENUM(NFS4ERR_BAD_SEQID);
73TRACE_DEFINE_ENUM(NFS4ERR_BAD_SESSION_DIGEST);
74TRACE_DEFINE_ENUM(NFS4ERR_BAD_STATEID);
75TRACE_DEFINE_ENUM(NFS4ERR_CB_PATH_DOWN);
76TRACE_DEFINE_ENUM(NFS4ERR_CLID_INUSE);
77TRACE_DEFINE_ENUM(NFS4ERR_CLIENTID_BUSY);
78TRACE_DEFINE_ENUM(NFS4ERR_COMPLETE_ALREADY);
79TRACE_DEFINE_ENUM(NFS4ERR_CONN_NOT_BOUND_TO_SESSION);
80TRACE_DEFINE_ENUM(NFS4ERR_DEADLOCK);
81TRACE_DEFINE_ENUM(NFS4ERR_DEADSESSION);
82TRACE_DEFINE_ENUM(NFS4ERR_DELAY);
83TRACE_DEFINE_ENUM(NFS4ERR_DELEG_ALREADY_WANTED);
84TRACE_DEFINE_ENUM(NFS4ERR_DELEG_REVOKED);
85TRACE_DEFINE_ENUM(NFS4ERR_DENIED);
86TRACE_DEFINE_ENUM(NFS4ERR_DIRDELEG_UNAVAIL);
87TRACE_DEFINE_ENUM(NFS4ERR_DQUOT);
88TRACE_DEFINE_ENUM(NFS4ERR_ENCR_ALG_UNSUPP);
89TRACE_DEFINE_ENUM(NFS4ERR_EXIST);
90TRACE_DEFINE_ENUM(NFS4ERR_EXPIRED);
91TRACE_DEFINE_ENUM(NFS4ERR_FBIG);
92TRACE_DEFINE_ENUM(NFS4ERR_FHEXPIRED);
93TRACE_DEFINE_ENUM(NFS4ERR_FILE_OPEN);
94TRACE_DEFINE_ENUM(NFS4ERR_GRACE);
95TRACE_DEFINE_ENUM(NFS4ERR_HASH_ALG_UNSUPP);
96TRACE_DEFINE_ENUM(NFS4ERR_INVAL);
97TRACE_DEFINE_ENUM(NFS4ERR_IO);
98TRACE_DEFINE_ENUM(NFS4ERR_ISDIR);
99TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTTRYLATER);
100TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTUNAVAILABLE);
101TRACE_DEFINE_ENUM(NFS4ERR_LEASE_MOVED);
102TRACE_DEFINE_ENUM(NFS4ERR_LOCKED);
103TRACE_DEFINE_ENUM(NFS4ERR_LOCKS_HELD);
104TRACE_DEFINE_ENUM(NFS4ERR_LOCK_RANGE);
105TRACE_DEFINE_ENUM(NFS4ERR_MINOR_VERS_MISMATCH);
106TRACE_DEFINE_ENUM(NFS4ERR_MLINK);
107TRACE_DEFINE_ENUM(NFS4ERR_MOVED);
108TRACE_DEFINE_ENUM(NFS4ERR_NAMETOOLONG);
109TRACE_DEFINE_ENUM(NFS4ERR_NOENT);
110TRACE_DEFINE_ENUM(NFS4ERR_NOFILEHANDLE);
111TRACE_DEFINE_ENUM(NFS4ERR_NOMATCHING_LAYOUT);
112TRACE_DEFINE_ENUM(NFS4ERR_NOSPC);
113TRACE_DEFINE_ENUM(NFS4ERR_NOTDIR);
114TRACE_DEFINE_ENUM(NFS4ERR_NOTEMPTY);
115TRACE_DEFINE_ENUM(NFS4ERR_NOTSUPP);
116TRACE_DEFINE_ENUM(NFS4ERR_NOT_ONLY_OP);
117TRACE_DEFINE_ENUM(NFS4ERR_NOT_SAME);
118TRACE_DEFINE_ENUM(NFS4ERR_NO_GRACE);
119TRACE_DEFINE_ENUM(NFS4ERR_NXIO);
120TRACE_DEFINE_ENUM(NFS4ERR_OLD_STATEID);
121TRACE_DEFINE_ENUM(NFS4ERR_OPENMODE);
122TRACE_DEFINE_ENUM(NFS4ERR_OP_ILLEGAL);
123TRACE_DEFINE_ENUM(NFS4ERR_OP_NOT_IN_SESSION);
124TRACE_DEFINE_ENUM(NFS4ERR_PERM);
125TRACE_DEFINE_ENUM(NFS4ERR_PNFS_IO_HOLE);
126TRACE_DEFINE_ENUM(NFS4ERR_PNFS_NO_LAYOUT);
127TRACE_DEFINE_ENUM(NFS4ERR_RECALLCONFLICT);
128TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_BAD);
129TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_CONFLICT);
130TRACE_DEFINE_ENUM(NFS4ERR_REJECT_DELEG);
131TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG);
132TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG_TO_CACHE);
133TRACE_DEFINE_ENUM(NFS4ERR_REQ_TOO_BIG);
134TRACE_DEFINE_ENUM(NFS4ERR_RESOURCE);
135TRACE_DEFINE_ENUM(NFS4ERR_RESTOREFH);
136TRACE_DEFINE_ENUM(NFS4ERR_RETRY_UNCACHED_REP);
137TRACE_DEFINE_ENUM(NFS4ERR_RETURNCONFLICT);
138TRACE_DEFINE_ENUM(NFS4ERR_ROFS);
139TRACE_DEFINE_ENUM(NFS4ERR_SAME);
140TRACE_DEFINE_ENUM(NFS4ERR_SHARE_DENIED);
141TRACE_DEFINE_ENUM(NFS4ERR_SEQUENCE_POS);
142TRACE_DEFINE_ENUM(NFS4ERR_SEQ_FALSE_RETRY);
143TRACE_DEFINE_ENUM(NFS4ERR_SEQ_MISORDERED);
144TRACE_DEFINE_ENUM(NFS4ERR_SERVERFAULT);
145TRACE_DEFINE_ENUM(NFS4ERR_STALE);
146TRACE_DEFINE_ENUM(NFS4ERR_STALE_CLIENTID);
147TRACE_DEFINE_ENUM(NFS4ERR_STALE_STATEID);
148TRACE_DEFINE_ENUM(NFS4ERR_SYMLINK);
149TRACE_DEFINE_ENUM(NFS4ERR_TOOSMALL);
150TRACE_DEFINE_ENUM(NFS4ERR_TOO_MANY_OPS);
151TRACE_DEFINE_ENUM(NFS4ERR_UNKNOWN_LAYOUTTYPE);
152TRACE_DEFINE_ENUM(NFS4ERR_UNSAFE_COMPOUND);
153TRACE_DEFINE_ENUM(NFS4ERR_WRONGSEC);
154TRACE_DEFINE_ENUM(NFS4ERR_WRONG_CRED);
155TRACE_DEFINE_ENUM(NFS4ERR_WRONG_TYPE);
156TRACE_DEFINE_ENUM(NFS4ERR_XDEV);
157
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400158#define show_nfsv4_errors(error) \
Chuck Lever96650e22019-06-19 10:33:53 -0400159 __print_symbolic(error, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400160 { NFS4_OK, "OK" }, \
161 /* Mapped by nfs4_stat_to_errno() */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500162 { EPERM, "EPERM" }, \
163 { ENOENT, "ENOENT" }, \
164 { EIO, "EIO" }, \
165 { ENXIO, "ENXIO" }, \
166 { EACCES, "EACCES" }, \
167 { EEXIST, "EEXIST" }, \
168 { EXDEV, "EXDEV" }, \
169 { ENOTDIR, "ENOTDIR" }, \
170 { EISDIR, "EISDIR" }, \
171 { EFBIG, "EFBIG" }, \
172 { ENOSPC, "ENOSPC" }, \
173 { EROFS, "EROFS" }, \
174 { EMLINK, "EMLINK" }, \
175 { ENAMETOOLONG, "ENAMETOOLONG" }, \
176 { ENOTEMPTY, "ENOTEMPTY" }, \
177 { EDQUOT, "EDQUOT" }, \
178 { ESTALE, "ESTALE" }, \
179 { EBADHANDLE, "EBADHANDLE" }, \
180 { EBADCOOKIE, "EBADCOOKIE" }, \
181 { ENOTSUPP, "ENOTSUPP" }, \
182 { ETOOSMALL, "ETOOSMALL" }, \
183 { EREMOTEIO, "EREMOTEIO" }, \
184 { EBADTYPE, "EBADTYPE" }, \
185 { EAGAIN, "EAGAIN" }, \
186 { ELOOP, "ELOOP" }, \
187 { EOPNOTSUPP, "EOPNOTSUPP" }, \
188 { EDEADLK, "EDEADLK" }, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400189 /* RPC errors */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500190 { ENOMEM, "ENOMEM" }, \
191 { EKEYEXPIRED, "EKEYEXPIRED" }, \
192 { ETIMEDOUT, "ETIMEDOUT" }, \
193 { ERESTARTSYS, "ERESTARTSYS" }, \
194 { ECONNREFUSED, "ECONNREFUSED" }, \
195 { ECONNRESET, "ECONNRESET" }, \
196 { ENETUNREACH, "ENETUNREACH" }, \
197 { EHOSTUNREACH, "EHOSTUNREACH" }, \
198 { EHOSTDOWN, "EHOSTDOWN" }, \
199 { EPIPE, "EPIPE" }, \
200 { EPFNOSUPPORT, "EPFNOSUPPORT" }, \
201 { EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400202 /* NFSv4 native errors */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500203 { NFS4ERR_ACCESS, "ACCESS" }, \
204 { NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \
205 { NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \
206 { NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \
207 { NFS4ERR_BADCHAR, "BADCHAR" }, \
208 { NFS4ERR_BADHANDLE, "BADHANDLE" }, \
209 { NFS4ERR_BADIOMODE, "BADIOMODE" }, \
210 { NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \
211 { NFS4ERR_BADLABEL, "BADLABEL" }, \
212 { NFS4ERR_BADNAME, "BADNAME" }, \
213 { NFS4ERR_BADOWNER, "BADOWNER" }, \
214 { NFS4ERR_BADSESSION, "BADSESSION" }, \
215 { NFS4ERR_BADSLOT, "BADSLOT" }, \
216 { NFS4ERR_BADTYPE, "BADTYPE" }, \
217 { NFS4ERR_BADXDR, "BADXDR" }, \
218 { NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \
219 { NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \
220 { NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \
221 { NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \
222 { NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \
223 { NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \
224 { NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
225 { NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \
226 { NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \
227 { NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \
228 { NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400229 "CONN_NOT_BOUND_TO_SESSION" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500230 { NFS4ERR_DEADLOCK, "DEADLOCK" }, \
231 { NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \
232 { NFS4ERR_DELAY, "DELAY" }, \
233 { NFS4ERR_DELEG_ALREADY_WANTED, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400234 "DELEG_ALREADY_WANTED" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500235 { NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \
236 { NFS4ERR_DENIED, "DENIED" }, \
237 { NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \
238 { NFS4ERR_DQUOT, "DQUOT" }, \
239 { NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \
240 { NFS4ERR_EXIST, "EXIST" }, \
241 { NFS4ERR_EXPIRED, "EXPIRED" }, \
242 { NFS4ERR_FBIG, "FBIG" }, \
243 { NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \
244 { NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \
245 { NFS4ERR_GRACE, "GRACE" }, \
246 { NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \
247 { NFS4ERR_INVAL, "INVAL" }, \
248 { NFS4ERR_IO, "IO" }, \
249 { NFS4ERR_ISDIR, "ISDIR" }, \
250 { NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \
251 { NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \
252 { NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \
253 { NFS4ERR_LOCKED, "LOCKED" }, \
254 { NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \
255 { NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \
256 { NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \
257 { NFS4ERR_MLINK, "MLINK" }, \
258 { NFS4ERR_MOVED, "MOVED" }, \
259 { NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \
260 { NFS4ERR_NOENT, "NOENT" }, \
261 { NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \
262 { NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \
263 { NFS4ERR_NOSPC, "NOSPC" }, \
264 { NFS4ERR_NOTDIR, "NOTDIR" }, \
265 { NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \
266 { NFS4ERR_NOTSUPP, "NOTSUPP" }, \
267 { NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \
268 { NFS4ERR_NOT_SAME, "NOT_SAME" }, \
269 { NFS4ERR_NO_GRACE, "NO_GRACE" }, \
270 { NFS4ERR_NXIO, "NXIO" }, \
271 { NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \
272 { NFS4ERR_OPENMODE, "OPENMODE" }, \
273 { NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \
274 { NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \
275 { NFS4ERR_PERM, "PERM" }, \
276 { NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \
277 { NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \
278 { NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \
279 { NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \
280 { NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \
281 { NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \
282 { NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \
283 { NFS4ERR_REP_TOO_BIG_TO_CACHE, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400284 "REP_TOO_BIG_TO_CACHE" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500285 { NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \
286 { NFS4ERR_RESOURCE, "RESOURCE" }, \
287 { NFS4ERR_RESTOREFH, "RESTOREFH" }, \
288 { NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \
289 { NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \
290 { NFS4ERR_ROFS, "ROFS" }, \
291 { NFS4ERR_SAME, "SAME" }, \
292 { NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \
293 { NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \
294 { NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \
295 { NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \
296 { NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \
297 { NFS4ERR_STALE, "STALE" }, \
298 { NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \
299 { NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \
300 { NFS4ERR_SYMLINK, "SYMLINK" }, \
301 { NFS4ERR_TOOSMALL, "TOOSMALL" }, \
302 { NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \
303 { NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \
304 { NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \
305 { NFS4ERR_WRONGSEC, "WRONGSEC" }, \
306 { NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
307 { NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
308 { NFS4ERR_XDEV, "XDEV" })
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400309
Trond Myklebust42113a72013-08-12 16:19:27 -0400310#define show_open_flags(flags) \
311 __print_flags(flags, "|", \
312 { O_CREAT, "O_CREAT" }, \
313 { O_EXCL, "O_EXCL" }, \
314 { O_TRUNC, "O_TRUNC" }, \
315 { O_DIRECT, "O_DIRECT" })
316
317#define show_fmode_flags(mode) \
318 __print_flags(mode, "|", \
319 { ((__force unsigned long)FMODE_READ), "READ" }, \
320 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
321 { ((__force unsigned long)FMODE_EXEC), "EXEC" })
322
Trond Myklebustb5f875a2013-08-13 13:01:39 -0400323#define show_nfs_fattr_flags(valid) \
324 __print_flags((unsigned long)valid, "|", \
325 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \
326 { NFS_ATTR_FATTR_MODE, "MODE" }, \
327 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \
328 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \
329 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \
330 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \
331 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \
332 { NFS_ATTR_FATTR_FSID, "FSID" }, \
333 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \
334 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \
335 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \
336 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \
337 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
338 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
339 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
340
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400341DECLARE_EVENT_CLASS(nfs4_clientid_event,
342 TP_PROTO(
343 const struct nfs_client *clp,
344 int error
345 ),
346
347 TP_ARGS(clp, error),
348
349 TP_STRUCT__entry(
Anna Schumaker39443692017-11-01 15:48:43 -0400350 __string(dstaddr, clp->cl_hostname)
Chuck Lever96650e22019-06-19 10:33:53 -0400351 __field(unsigned long, error)
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400352 ),
353
354 TP_fast_assign(
355 __entry->error = error;
Anna Schumaker39443692017-11-01 15:48:43 -0400356 __assign_str(dstaddr, clp->cl_hostname);
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400357 ),
358
359 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400360 "error=%ld (%s) dstaddr=%s",
361 -__entry->error,
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400362 show_nfsv4_errors(__entry->error),
363 __get_str(dstaddr)
364 )
365);
366#define DEFINE_NFS4_CLIENTID_EVENT(name) \
367 DEFINE_EVENT(nfs4_clientid_event, name, \
368 TP_PROTO( \
369 const struct nfs_client *clp, \
370 int error \
371 ), \
372 TP_ARGS(clp, error))
373DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
374DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
375DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
376DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
377#ifdef CONFIG_NFS_V4_1
378DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
379DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
380DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
381DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
382DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
383DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
384DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400385
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400386#define show_nfs4_sequence_status_flags(status) \
387 __print_flags((unsigned long)status, "|", \
388 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
389 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
390 "CB_GSS_CONTEXTS_EXPIRING" }, \
391 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
392 "CB_GSS_CONTEXTS_EXPIRED" }, \
393 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
394 "EXPIRED_ALL_STATE_REVOKED" }, \
395 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
396 "EXPIRED_SOME_STATE_REVOKED" }, \
397 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
398 "ADMIN_STATE_REVOKED" }, \
399 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
400 "RECALLABLE_STATE_REVOKED" }, \
401 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
402 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
403 "RESTART_RECLAIM_NEEDED" }, \
404 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
405 "CB_PATH_DOWN_SESSION" }, \
406 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
407 "BACKCHANNEL_FAULT" })
408
409TRACE_EVENT(nfs4_sequence_done,
410 TP_PROTO(
411 const struct nfs4_session *session,
412 const struct nfs4_sequence_res *res
413 ),
414 TP_ARGS(session, res),
415
416 TP_STRUCT__entry(
417 __field(unsigned int, session)
418 __field(unsigned int, slot_nr)
419 __field(unsigned int, seq_nr)
420 __field(unsigned int, highest_slotid)
421 __field(unsigned int, target_highest_slotid)
422 __field(unsigned int, status_flags)
Chuck Lever96650e22019-06-19 10:33:53 -0400423 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400424 ),
425
426 TP_fast_assign(
427 const struct nfs4_slot *sr_slot = res->sr_slot;
428 __entry->session = nfs_session_id_hash(&session->sess_id);
429 __entry->slot_nr = sr_slot->slot_nr;
430 __entry->seq_nr = sr_slot->seq_nr;
431 __entry->highest_slotid = res->sr_highest_slotid;
432 __entry->target_highest_slotid =
433 res->sr_target_highest_slotid;
Andrew Elble52618df2015-12-02 09:19:43 -0500434 __entry->status_flags = res->sr_status_flags;
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400435 __entry->error = res->sr_status;
436 ),
437 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400438 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400439 "highest_slotid=%u target_highest_slotid=%u "
440 "status_flags=%u (%s)",
Chuck Lever96650e22019-06-19 10:33:53 -0400441 -__entry->error,
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400442 show_nfsv4_errors(__entry->error),
443 __entry->session,
444 __entry->slot_nr,
445 __entry->seq_nr,
446 __entry->highest_slotid,
447 __entry->target_highest_slotid,
448 __entry->status_flags,
449 show_nfs4_sequence_status_flags(__entry->status_flags)
450 )
451);
452
453struct cb_sequenceargs;
454struct cb_sequenceres;
455
456TRACE_EVENT(nfs4_cb_sequence,
457 TP_PROTO(
458 const struct cb_sequenceargs *args,
459 const struct cb_sequenceres *res,
460 __be32 status
461 ),
462 TP_ARGS(args, res, status),
463
464 TP_STRUCT__entry(
465 __field(unsigned int, session)
466 __field(unsigned int, slot_nr)
467 __field(unsigned int, seq_nr)
468 __field(unsigned int, highest_slotid)
469 __field(unsigned int, cachethis)
Chuck Lever96650e22019-06-19 10:33:53 -0400470 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400471 ),
472
473 TP_fast_assign(
474 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
475 __entry->slot_nr = args->csa_slotid;
476 __entry->seq_nr = args->csa_sequenceid;
477 __entry->highest_slotid = args->csa_highestslotid;
478 __entry->cachethis = args->csa_cachethis;
Chuck Lever96650e22019-06-19 10:33:53 -0400479 __entry->error = be32_to_cpu(status);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400480 ),
481
482 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400483 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400484 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400485 -__entry->error,
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400486 show_nfsv4_errors(__entry->error),
487 __entry->session,
488 __entry->slot_nr,
489 __entry->seq_nr,
490 __entry->highest_slotid
491 )
492);
Chuck Leverc5833f02019-06-19 10:33:47 -0400493
494TRACE_EVENT(nfs4_cb_seqid_err,
495 TP_PROTO(
496 const struct cb_sequenceargs *args,
497 __be32 status
498 ),
499 TP_ARGS(args, status),
500
501 TP_STRUCT__entry(
502 __field(unsigned int, session)
503 __field(unsigned int, slot_nr)
504 __field(unsigned int, seq_nr)
505 __field(unsigned int, highest_slotid)
506 __field(unsigned int, cachethis)
Chuck Lever96650e22019-06-19 10:33:53 -0400507 __field(unsigned long, error)
Chuck Leverc5833f02019-06-19 10:33:47 -0400508 ),
509
510 TP_fast_assign(
511 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
512 __entry->slot_nr = args->csa_slotid;
513 __entry->seq_nr = args->csa_sequenceid;
514 __entry->highest_slotid = args->csa_highestslotid;
515 __entry->cachethis = args->csa_cachethis;
Chuck Lever96650e22019-06-19 10:33:53 -0400516 __entry->error = be32_to_cpu(status);
Chuck Leverc5833f02019-06-19 10:33:47 -0400517 ),
518
519 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400520 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Chuck Leverc5833f02019-06-19 10:33:47 -0400521 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400522 -__entry->error,
Chuck Leverc5833f02019-06-19 10:33:47 -0400523 show_nfsv4_errors(__entry->error),
524 __entry->session,
525 __entry->slot_nr,
526 __entry->seq_nr,
527 __entry->highest_slotid
528 )
529);
530
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400531#endif /* CONFIG_NFS_V4_1 */
532
Anna Schumakerad05cc02017-01-11 13:37:06 -0500533TRACE_EVENT(nfs4_setup_sequence,
534 TP_PROTO(
535 const struct nfs4_session *session,
536 const struct nfs4_sequence_args *args
537 ),
538 TP_ARGS(session, args),
539
540 TP_STRUCT__entry(
541 __field(unsigned int, session)
542 __field(unsigned int, slot_nr)
543 __field(unsigned int, seq_nr)
544 __field(unsigned int, highest_used_slotid)
545 ),
546
547 TP_fast_assign(
548 const struct nfs4_slot *sa_slot = args->sa_slot;
549 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
550 __entry->slot_nr = sa_slot->slot_nr;
551 __entry->seq_nr = sa_slot->seq_nr;
552 __entry->highest_used_slotid =
553 sa_slot->table->highest_used_slotid;
554 ),
555 TP_printk(
556 "session=0x%08x slot_nr=%u seq_nr=%u "
557 "highest_used_slotid=%u",
558 __entry->session,
559 __entry->slot_nr,
560 __entry->seq_nr,
561 __entry->highest_used_slotid
562 )
563);
564
Chuck Lever511ba522019-11-05 11:04:07 -0500565TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_RUNNING);
566TRACE_DEFINE_ENUM(NFS4CLNT_CHECK_LEASE);
567TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_EXPIRED);
568TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_REBOOT);
569TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_NOGRACE);
570TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN);
571TRACE_DEFINE_ENUM(NFS4CLNT_SESSION_RESET);
572TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_CONFIRM);
573TRACE_DEFINE_ENUM(NFS4CLNT_SERVER_SCOPE_MISMATCH);
574TRACE_DEFINE_ENUM(NFS4CLNT_PURGE_STATE);
575TRACE_DEFINE_ENUM(NFS4CLNT_BIND_CONN_TO_SESSION);
576TRACE_DEFINE_ENUM(NFS4CLNT_MOVED);
577TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_MOVED);
578TRACE_DEFINE_ENUM(NFS4CLNT_DELEGATION_EXPIRED);
579TRACE_DEFINE_ENUM(NFS4CLNT_RUN_MANAGER);
580TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN_RUNNING);
581
582#define show_nfs4_clp_state(state) \
583 __print_flags(state, "|", \
584 { NFS4CLNT_MANAGER_RUNNING, "MANAGER_RUNNING" }, \
585 { NFS4CLNT_CHECK_LEASE, "CHECK_LEASE" }, \
586 { NFS4CLNT_LEASE_EXPIRED, "LEASE_EXPIRED" }, \
587 { NFS4CLNT_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
588 { NFS4CLNT_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
589 { NFS4CLNT_DELEGRETURN, "DELEGRETURN" }, \
590 { NFS4CLNT_SESSION_RESET, "SESSION_RESET" }, \
591 { NFS4CLNT_LEASE_CONFIRM, "LEASE_CONFIRM" }, \
592 { NFS4CLNT_SERVER_SCOPE_MISMATCH, \
593 "SERVER_SCOPE_MISMATCH" }, \
594 { NFS4CLNT_PURGE_STATE, "PURGE_STATE" }, \
595 { NFS4CLNT_BIND_CONN_TO_SESSION, \
596 "BIND_CONN_TO_SESSION" }, \
597 { NFS4CLNT_MOVED, "MOVED" }, \
598 { NFS4CLNT_LEASE_MOVED, "LEASE_MOVED" }, \
599 { NFS4CLNT_DELEGATION_EXPIRED, "DELEGATION_EXPIRED" }, \
600 { NFS4CLNT_RUN_MANAGER, "RUN_MANAGER" }, \
601 { NFS4CLNT_DELEGRETURN_RUNNING, "DELEGRETURN_RUNNING" })
602
603TRACE_EVENT(nfs4_state_mgr,
604 TP_PROTO(
605 const struct nfs_client *clp
606 ),
607
608 TP_ARGS(clp),
609
610 TP_STRUCT__entry(
611 __field(unsigned long, state)
612 __string(hostname, clp->cl_hostname)
613 ),
614
615 TP_fast_assign(
616 __entry->state = clp->cl_state;
617 __assign_str(hostname, clp->cl_hostname)
618 ),
619
620 TP_printk(
621 "hostname=%s clp state=%s", __get_str(hostname),
622 show_nfs4_clp_state(__entry->state)
623 )
624)
625
626TRACE_EVENT(nfs4_state_mgr_failed,
627 TP_PROTO(
628 const struct nfs_client *clp,
629 const char *section,
630 int status
631 ),
632
633 TP_ARGS(clp, section, status),
634
635 TP_STRUCT__entry(
636 __field(unsigned long, error)
637 __field(unsigned long, state)
638 __string(hostname, clp->cl_hostname)
639 __string(section, section)
640 ),
641
642 TP_fast_assign(
643 __entry->error = status;
644 __entry->state = clp->cl_state;
645 __assign_str(hostname, clp->cl_hostname);
646 __assign_str(section, section);
647 ),
648
649 TP_printk(
650 "hostname=%s clp state=%s error=%ld (%s) section=%s",
651 __get_str(hostname),
652 show_nfs4_clp_state(__entry->state), -__entry->error,
653 show_nfsv4_errors(__entry->error), __get_str(section)
654
655 )
656)
657
Chuck Leverf23f6582019-02-11 11:24:26 -0500658TRACE_EVENT(nfs4_xdr_status,
659 TP_PROTO(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400660 const struct xdr_stream *xdr,
Chuck Leverf23f6582019-02-11 11:24:26 -0500661 u32 op,
662 int error
663 ),
664
Chuck Lever62a92ba2019-06-19 10:34:09 -0400665 TP_ARGS(xdr, op, error),
Chuck Leverf23f6582019-02-11 11:24:26 -0500666
667 TP_STRUCT__entry(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400668 __field(unsigned int, task_id)
669 __field(unsigned int, client_id)
670 __field(u32, xid)
Chuck Leverf23f6582019-02-11 11:24:26 -0500671 __field(u32, op)
Chuck Lever96650e22019-06-19 10:33:53 -0400672 __field(unsigned long, error)
Chuck Leverf23f6582019-02-11 11:24:26 -0500673 ),
674
675 TP_fast_assign(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400676 const struct rpc_rqst *rqstp = xdr->rqst;
677 const struct rpc_task *task = rqstp->rq_task;
678
679 __entry->task_id = task->tk_pid;
680 __entry->client_id = task->tk_client->cl_clid;
681 __entry->xid = be32_to_cpu(rqstp->rq_xid);
Chuck Leverf23f6582019-02-11 11:24:26 -0500682 __entry->op = op;
Chuck Lever96650e22019-06-19 10:33:53 -0400683 __entry->error = error;
Chuck Leverf23f6582019-02-11 11:24:26 -0500684 ),
685
686 TP_printk(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400687 "task:%u@%d xid=0x%08x error=%ld (%s) operation=%u",
688 __entry->task_id, __entry->client_id, __entry->xid,
Chuck Lever96650e22019-06-19 10:33:53 -0400689 -__entry->error, show_nfsv4_errors(__entry->error),
690 __entry->op
Chuck Leverf23f6582019-02-11 11:24:26 -0500691 )
692);
693
Trond Myklebust42113a72013-08-12 16:19:27 -0400694DECLARE_EVENT_CLASS(nfs4_open_event,
695 TP_PROTO(
696 const struct nfs_open_context *ctx,
697 int flags,
698 int error
699 ),
700
701 TP_ARGS(ctx, flags, error),
702
703 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400704 __field(unsigned long, error)
Trond Myklebust42113a72013-08-12 16:19:27 -0400705 __field(unsigned int, flags)
706 __field(unsigned int, fmode)
707 __field(dev_t, dev)
708 __field(u32, fhandle)
709 __field(u64, fileid)
710 __field(u64, dir)
711 __string(name, ctx->dentry->d_name.name)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500712 __field(int, stateid_seq)
713 __field(u32, stateid_hash)
714 __field(int, openstateid_seq)
715 __field(u32, openstateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400716 ),
717
718 TP_fast_assign(
719 const struct nfs4_state *state = ctx->state;
720 const struct inode *inode = NULL;
721
Chuck Lever96650e22019-06-19 10:33:53 -0400722 __entry->error = -error;
Trond Myklebust42113a72013-08-12 16:19:27 -0400723 __entry->flags = flags;
724 __entry->fmode = (__force unsigned int)ctx->mode;
725 __entry->dev = ctx->dentry->d_sb->s_dev;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500726 if (!IS_ERR_OR_NULL(state)) {
Trond Myklebust42113a72013-08-12 16:19:27 -0400727 inode = state->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500728 __entry->stateid_seq =
729 be32_to_cpu(state->stateid.seqid);
730 __entry->stateid_hash =
731 nfs_stateid_hash(&state->stateid);
732 __entry->openstateid_seq =
733 be32_to_cpu(state->open_stateid.seqid);
734 __entry->openstateid_hash =
735 nfs_stateid_hash(&state->open_stateid);
736 } else {
737 __entry->stateid_seq = 0;
738 __entry->stateid_hash = 0;
739 __entry->openstateid_seq = 0;
740 __entry->openstateid_hash = 0;
741 }
Trond Myklebust42113a72013-08-12 16:19:27 -0400742 if (inode != NULL) {
743 __entry->fileid = NFS_FILEID(inode);
744 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
745 } else {
746 __entry->fileid = 0;
747 __entry->fhandle = 0;
748 }
David Howells2b0143b2015-03-17 22:25:59 +0000749 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
Trond Myklebust42113a72013-08-12 16:19:27 -0400750 __assign_str(name, ctx->dentry->d_name.name);
751 ),
752
753 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400754 "error=%ld (%s) flags=%d (%s) fmode=%s "
Trond Myklebust42113a72013-08-12 16:19:27 -0400755 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500756 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
757 "openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400758 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400759 show_nfsv4_errors(__entry->error),
760 __entry->flags,
761 show_open_flags(__entry->flags),
762 show_fmode_flags(__entry->fmode),
763 MAJOR(__entry->dev), MINOR(__entry->dev),
764 (unsigned long long)__entry->fileid,
765 __entry->fhandle,
766 MAJOR(__entry->dev), MINOR(__entry->dev),
767 (unsigned long long)__entry->dir,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500768 __get_str(name),
769 __entry->stateid_seq, __entry->stateid_hash,
770 __entry->openstateid_seq, __entry->openstateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400771 )
772);
773
774#define DEFINE_NFS4_OPEN_EVENT(name) \
775 DEFINE_EVENT(nfs4_open_event, name, \
776 TP_PROTO( \
777 const struct nfs_open_context *ctx, \
778 int flags, \
779 int error \
780 ), \
781 TP_ARGS(ctx, flags, error))
782DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
783DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
784DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
785
Olga Kornievskaia9759b0f2015-11-24 13:29:42 -0500786TRACE_EVENT(nfs4_cached_open,
787 TP_PROTO(
788 const struct nfs4_state *state
789 ),
790 TP_ARGS(state),
791 TP_STRUCT__entry(
792 __field(dev_t, dev)
793 __field(u32, fhandle)
794 __field(u64, fileid)
795 __field(unsigned int, fmode)
796 __field(int, stateid_seq)
797 __field(u32, stateid_hash)
798 ),
799
800 TP_fast_assign(
801 const struct inode *inode = state->inode;
802
803 __entry->dev = inode->i_sb->s_dev;
804 __entry->fileid = NFS_FILEID(inode);
805 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
806 __entry->fmode = (__force unsigned int)state->state;
807 __entry->stateid_seq =
808 be32_to_cpu(state->stateid.seqid);
809 __entry->stateid_hash =
810 nfs_stateid_hash(&state->stateid);
811 ),
812
813 TP_printk(
814 "fmode=%s fileid=%02x:%02x:%llu "
815 "fhandle=0x%08x stateid=%d:0x%08x",
816 __entry->fmode ? show_fmode_flags(__entry->fmode) :
817 "closed",
818 MAJOR(__entry->dev), MINOR(__entry->dev),
819 (unsigned long long)__entry->fileid,
820 __entry->fhandle,
821 __entry->stateid_seq, __entry->stateid_hash
822 )
823);
824
Trond Myklebust42113a72013-08-12 16:19:27 -0400825TRACE_EVENT(nfs4_close,
826 TP_PROTO(
827 const struct nfs4_state *state,
828 const struct nfs_closeargs *args,
829 const struct nfs_closeres *res,
830 int error
831 ),
832
833 TP_ARGS(state, args, res, error),
834
835 TP_STRUCT__entry(
836 __field(dev_t, dev)
837 __field(u32, fhandle)
838 __field(u64, fileid)
839 __field(unsigned int, fmode)
Chuck Lever96650e22019-06-19 10:33:53 -0400840 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500841 __field(int, stateid_seq)
842 __field(u32, stateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400843 ),
844
845 TP_fast_assign(
846 const struct inode *inode = state->inode;
847
848 __entry->dev = inode->i_sb->s_dev;
849 __entry->fileid = NFS_FILEID(inode);
850 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
851 __entry->fmode = (__force unsigned int)state->state;
852 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500853 __entry->stateid_seq =
854 be32_to_cpu(args->stateid.seqid);
855 __entry->stateid_hash =
856 nfs_stateid_hash(&args->stateid);
Trond Myklebust42113a72013-08-12 16:19:27 -0400857 ),
858
859 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400860 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500861 "fhandle=0x%08x openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400862 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400863 show_nfsv4_errors(__entry->error),
864 __entry->fmode ? show_fmode_flags(__entry->fmode) :
865 "closed",
866 MAJOR(__entry->dev), MINOR(__entry->dev),
867 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500868 __entry->fhandle,
869 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400870 )
871);
872
Chuck Lever5b2095d2018-12-19 11:00:11 -0500873TRACE_DEFINE_ENUM(F_GETLK);
874TRACE_DEFINE_ENUM(F_SETLK);
875TRACE_DEFINE_ENUM(F_SETLKW);
876TRACE_DEFINE_ENUM(F_RDLCK);
877TRACE_DEFINE_ENUM(F_WRLCK);
878TRACE_DEFINE_ENUM(F_UNLCK);
879
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400880#define show_lock_cmd(type) \
881 __print_symbolic((int)type, \
882 { F_GETLK, "GETLK" }, \
883 { F_SETLK, "SETLK" }, \
884 { F_SETLKW, "SETLKW" })
885#define show_lock_type(type) \
886 __print_symbolic((int)type, \
887 { F_RDLCK, "RDLCK" }, \
888 { F_WRLCK, "WRLCK" }, \
889 { F_UNLCK, "UNLCK" })
890
891DECLARE_EVENT_CLASS(nfs4_lock_event,
892 TP_PROTO(
893 const struct file_lock *request,
894 const struct nfs4_state *state,
895 int cmd,
896 int error
897 ),
898
899 TP_ARGS(request, state, cmd, error),
900
901 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400902 __field(unsigned long, error)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400903 __field(int, cmd)
904 __field(char, type)
905 __field(loff_t, start)
906 __field(loff_t, end)
907 __field(dev_t, dev)
908 __field(u32, fhandle)
909 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500910 __field(int, stateid_seq)
911 __field(u32, stateid_hash)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400912 ),
913
914 TP_fast_assign(
915 const struct inode *inode = state->inode;
916
917 __entry->error = error;
918 __entry->cmd = cmd;
919 __entry->type = request->fl_type;
920 __entry->start = request->fl_start;
921 __entry->end = request->fl_end;
922 __entry->dev = inode->i_sb->s_dev;
923 __entry->fileid = NFS_FILEID(inode);
924 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500925 __entry->stateid_seq =
926 be32_to_cpu(state->stateid.seqid);
927 __entry->stateid_hash =
928 nfs_stateid_hash(&state->stateid);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400929 ),
930
931 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400932 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500933 "fileid=%02x:%02x:%llu fhandle=0x%08x "
934 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400935 -__entry->error,
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400936 show_nfsv4_errors(__entry->error),
937 show_lock_cmd(__entry->cmd),
938 show_lock_type(__entry->type),
939 (long long)__entry->start,
940 (long long)__entry->end,
941 MAJOR(__entry->dev), MINOR(__entry->dev),
942 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500943 __entry->fhandle,
944 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400945 )
946);
947
948#define DEFINE_NFS4_LOCK_EVENT(name) \
949 DEFINE_EVENT(nfs4_lock_event, name, \
950 TP_PROTO( \
951 const struct file_lock *request, \
952 const struct nfs4_state *state, \
953 int cmd, \
954 int error \
955 ), \
956 TP_ARGS(request, state, cmd, error))
957DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400958DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
959
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500960TRACE_EVENT(nfs4_set_lock,
961 TP_PROTO(
962 const struct file_lock *request,
963 const struct nfs4_state *state,
964 const nfs4_stateid *lockstateid,
965 int cmd,
966 int error
967 ),
968
969 TP_ARGS(request, state, lockstateid, cmd, error),
970
971 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400972 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500973 __field(int, cmd)
974 __field(char, type)
975 __field(loff_t, start)
976 __field(loff_t, end)
977 __field(dev_t, dev)
978 __field(u32, fhandle)
979 __field(u64, fileid)
980 __field(int, stateid_seq)
981 __field(u32, stateid_hash)
982 __field(int, lockstateid_seq)
983 __field(u32, lockstateid_hash)
984 ),
985
986 TP_fast_assign(
987 const struct inode *inode = state->inode;
988
989 __entry->error = error;
990 __entry->cmd = cmd;
991 __entry->type = request->fl_type;
992 __entry->start = request->fl_start;
993 __entry->end = request->fl_end;
994 __entry->dev = inode->i_sb->s_dev;
995 __entry->fileid = NFS_FILEID(inode);
996 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
997 __entry->stateid_seq =
998 be32_to_cpu(state->stateid.seqid);
999 __entry->stateid_hash =
1000 nfs_stateid_hash(&state->stateid);
1001 __entry->lockstateid_seq =
1002 be32_to_cpu(lockstateid->seqid);
1003 __entry->lockstateid_hash =
1004 nfs_stateid_hash(lockstateid);
1005 ),
1006
1007 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001008 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001009 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1010 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001011 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001012 show_nfsv4_errors(__entry->error),
1013 show_lock_cmd(__entry->cmd),
1014 show_lock_type(__entry->type),
1015 (long long)__entry->start,
1016 (long long)__entry->end,
1017 MAJOR(__entry->dev), MINOR(__entry->dev),
1018 (unsigned long long)__entry->fileid,
1019 __entry->fhandle,
1020 __entry->stateid_seq, __entry->stateid_hash,
1021 __entry->lockstateid_seq, __entry->lockstateid_hash
1022 )
1023);
1024
Chuck Lever21f86d22019-11-05 11:04:13 -05001025TRACE_DEFINE_ENUM(LK_STATE_IN_USE);
1026TRACE_DEFINE_ENUM(NFS_DELEGATED_STATE);
1027TRACE_DEFINE_ENUM(NFS_OPEN_STATE);
1028TRACE_DEFINE_ENUM(NFS_O_RDONLY_STATE);
1029TRACE_DEFINE_ENUM(NFS_O_WRONLY_STATE);
1030TRACE_DEFINE_ENUM(NFS_O_RDWR_STATE);
1031TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_REBOOT);
1032TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_NOGRACE);
1033TRACE_DEFINE_ENUM(NFS_STATE_POSIX_LOCKS);
1034TRACE_DEFINE_ENUM(NFS_STATE_RECOVERY_FAILED);
1035TRACE_DEFINE_ENUM(NFS_STATE_MAY_NOTIFY_LOCK);
1036TRACE_DEFINE_ENUM(NFS_STATE_CHANGE_WAIT);
1037TRACE_DEFINE_ENUM(NFS_CLNT_DST_SSC_COPY_STATE);
1038TRACE_DEFINE_ENUM(NFS_CLNT_SRC_SSC_COPY_STATE);
1039TRACE_DEFINE_ENUM(NFS_SRV_SSC_COPY_STATE);
1040
1041#define show_nfs4_state_flags(flags) \
1042 __print_flags(flags, "|", \
1043 { LK_STATE_IN_USE, "IN_USE" }, \
1044 { NFS_DELEGATED_STATE, "DELEGATED" }, \
1045 { NFS_OPEN_STATE, "OPEN" }, \
1046 { NFS_O_RDONLY_STATE, "O_RDONLY" }, \
1047 { NFS_O_WRONLY_STATE, "O_WRONLY" }, \
1048 { NFS_O_RDWR_STATE, "O_RDWR" }, \
1049 { NFS_STATE_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
1050 { NFS_STATE_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
1051 { NFS_STATE_POSIX_LOCKS, "POSIX_LOCKS" }, \
1052 { NFS_STATE_RECOVERY_FAILED, "RECOVERY_FAILED" }, \
1053 { NFS_STATE_MAY_NOTIFY_LOCK, "MAY_NOTIFY_LOCK" }, \
1054 { NFS_STATE_CHANGE_WAIT, "CHANGE_WAIT" }, \
1055 { NFS_CLNT_DST_SSC_COPY_STATE, "CLNT_DST_SSC_COPY" }, \
1056 { NFS_CLNT_SRC_SSC_COPY_STATE, "CLNT_SRC_SSC_COPY" }, \
1057 { NFS_SRV_SSC_COPY_STATE, "SRV_SSC_COPY" })
1058
1059#define show_nfs4_lock_flags(flags) \
1060 __print_flags(flags, "|", \
1061 { BIT(NFS_LOCK_INITIALIZED), "INITIALIZED" }, \
1062 { BIT(NFS_LOCK_LOST), "LOST" })
1063
1064TRACE_EVENT(nfs4_state_lock_reclaim,
1065 TP_PROTO(
1066 const struct nfs4_state *state,
1067 const struct nfs4_lock_state *lock
1068 ),
1069
1070 TP_ARGS(state, lock),
1071
1072 TP_STRUCT__entry(
1073 __field(dev_t, dev)
1074 __field(u32, fhandle)
1075 __field(u64, fileid)
1076 __field(unsigned long, state_flags)
1077 __field(unsigned long, lock_flags)
1078 __field(int, stateid_seq)
1079 __field(u32, stateid_hash)
1080 ),
1081
1082 TP_fast_assign(
1083 const struct inode *inode = state->inode;
1084
1085 __entry->dev = inode->i_sb->s_dev;
1086 __entry->fileid = NFS_FILEID(inode);
1087 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1088 __entry->state_flags = state->flags;
1089 __entry->lock_flags = lock->ls_flags;
1090 __entry->stateid_seq =
1091 be32_to_cpu(state->stateid.seqid);
1092 __entry->stateid_hash =
1093 nfs_stateid_hash(&state->stateid);
1094 ),
1095
1096 TP_printk(
1097 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1098 "stateid=%d:0x%08x state_flags=%s lock_flags=%s",
1099 MAJOR(__entry->dev), MINOR(__entry->dev),
1100 (unsigned long long)__entry->fileid, __entry->fhandle,
1101 __entry->stateid_seq, __entry->stateid_hash,
1102 show_nfs4_state_flags(__entry->state_flags),
1103 show_nfs4_lock_flags(__entry->lock_flags)
1104 )
1105)
1106
Trond Myklebustca8acf82013-08-13 10:36:56 -04001107DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
1108 TP_PROTO(
1109 const struct inode *inode,
1110 fmode_t fmode
1111 ),
1112
1113 TP_ARGS(inode, fmode),
1114
1115 TP_STRUCT__entry(
1116 __field(dev_t, dev)
1117 __field(u32, fhandle)
1118 __field(u64, fileid)
1119 __field(unsigned int, fmode)
1120 ),
1121
1122 TP_fast_assign(
1123 __entry->dev = inode->i_sb->s_dev;
1124 __entry->fileid = NFS_FILEID(inode);
1125 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1126 __entry->fmode = (__force unsigned int)fmode;
1127 ),
1128
1129 TP_printk(
1130 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
1131 show_fmode_flags(__entry->fmode),
1132 MAJOR(__entry->dev), MINOR(__entry->dev),
1133 (unsigned long long)__entry->fileid,
1134 __entry->fhandle
1135 )
1136);
1137#define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
1138 DEFINE_EVENT(nfs4_set_delegation_event, name, \
1139 TP_PROTO( \
1140 const struct inode *inode, \
1141 fmode_t fmode \
1142 ), \
1143 TP_ARGS(inode, fmode))
1144DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
1145DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
1146
1147TRACE_EVENT(nfs4_delegreturn_exit,
1148 TP_PROTO(
1149 const struct nfs4_delegreturnargs *args,
1150 const struct nfs4_delegreturnres *res,
1151 int error
1152 ),
1153
1154 TP_ARGS(args, res, error),
1155
1156 TP_STRUCT__entry(
1157 __field(dev_t, dev)
1158 __field(u32, fhandle)
Chuck Lever96650e22019-06-19 10:33:53 -04001159 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001160 __field(int, stateid_seq)
1161 __field(u32, stateid_hash)
Trond Myklebustca8acf82013-08-13 10:36:56 -04001162 ),
1163
1164 TP_fast_assign(
1165 __entry->dev = res->server->s_dev;
1166 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
1167 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001168 __entry->stateid_seq =
1169 be32_to_cpu(args->stateid->seqid);
1170 __entry->stateid_hash =
1171 nfs_stateid_hash(args->stateid);
Trond Myklebustca8acf82013-08-13 10:36:56 -04001172 ),
1173
1174 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001175 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001176 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001177 -__entry->error,
Trond Myklebustca8acf82013-08-13 10:36:56 -04001178 show_nfsv4_errors(__entry->error),
1179 MAJOR(__entry->dev), MINOR(__entry->dev),
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001180 __entry->fhandle,
1181 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustca8acf82013-08-13 10:36:56 -04001182 )
1183);
1184
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001185#ifdef CONFIG_NFS_V4_1
1186DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
1187 TP_PROTO(
1188 const struct nfs4_state *state,
1189 const struct nfs4_lock_state *lsp,
1190 int error
1191 ),
1192
1193 TP_ARGS(state, lsp, error),
1194
1195 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001196 __field(unsigned long, error)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001197 __field(dev_t, dev)
1198 __field(u32, fhandle)
1199 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001200 __field(int, stateid_seq)
1201 __field(u32, stateid_hash)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001202 ),
1203
1204 TP_fast_assign(
1205 const struct inode *inode = state->inode;
1206
1207 __entry->error = error;
1208 __entry->dev = inode->i_sb->s_dev;
1209 __entry->fileid = NFS_FILEID(inode);
1210 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001211 __entry->stateid_seq =
1212 be32_to_cpu(state->stateid.seqid);
1213 __entry->stateid_hash =
1214 nfs_stateid_hash(&state->stateid);
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001215 ),
1216
1217 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001218 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001219 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001220 -__entry->error,
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001221 show_nfsv4_errors(__entry->error),
1222 MAJOR(__entry->dev), MINOR(__entry->dev),
1223 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001224 __entry->fhandle,
1225 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001226 )
1227);
1228
1229#define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
1230 DEFINE_EVENT(nfs4_test_stateid_event, name, \
1231 TP_PROTO( \
1232 const struct nfs4_state *state, \
1233 const struct nfs4_lock_state *lsp, \
1234 int error \
1235 ), \
1236 TP_ARGS(state, lsp, error))
1237DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
1238DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
1239DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
1240#endif /* CONFIG_NFS_V4_1 */
1241
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001242DECLARE_EVENT_CLASS(nfs4_lookup_event,
1243 TP_PROTO(
1244 const struct inode *dir,
1245 const struct qstr *name,
1246 int error
1247 ),
1248
1249 TP_ARGS(dir, name, error),
1250
1251 TP_STRUCT__entry(
1252 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001253 __field(unsigned long, error)
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001254 __field(u64, dir)
1255 __string(name, name->name)
1256 ),
1257
1258 TP_fast_assign(
1259 __entry->dev = dir->i_sb->s_dev;
1260 __entry->dir = NFS_FILEID(dir);
Chuck Lever96650e22019-06-19 10:33:53 -04001261 __entry->error = -error;
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001262 __assign_str(name, name->name);
1263 ),
1264
1265 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001266 "error=%ld (%s) name=%02x:%02x:%llu/%s",
1267 -__entry->error,
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001268 show_nfsv4_errors(__entry->error),
1269 MAJOR(__entry->dev), MINOR(__entry->dev),
1270 (unsigned long long)__entry->dir,
1271 __get_str(name)
1272 )
1273);
1274
1275#define DEFINE_NFS4_LOOKUP_EVENT(name) \
1276 DEFINE_EVENT(nfs4_lookup_event, name, \
1277 TP_PROTO( \
1278 const struct inode *dir, \
1279 const struct qstr *name, \
1280 int error \
1281 ), \
1282 TP_ARGS(dir, name, error))
1283
1284DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
1285DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
1286DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
1287DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
1288DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
1289DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
1290DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
1291
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001292TRACE_EVENT(nfs4_lookupp,
1293 TP_PROTO(
1294 const struct inode *inode,
1295 int error
1296 ),
1297
1298 TP_ARGS(inode, error),
1299
1300 TP_STRUCT__entry(
1301 __field(dev_t, dev)
1302 __field(u64, ino)
Chuck Lever96650e22019-06-19 10:33:53 -04001303 __field(unsigned long, error)
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001304 ),
1305
1306 TP_fast_assign(
1307 __entry->dev = inode->i_sb->s_dev;
1308 __entry->ino = NFS_FILEID(inode);
1309 __entry->error = error;
1310 ),
1311
1312 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001313 "error=%ld (%s) inode=%02x:%02x:%llu",
1314 -__entry->error,
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001315 show_nfsv4_errors(__entry->error),
1316 MAJOR(__entry->dev), MINOR(__entry->dev),
1317 (unsigned long long)__entry->ino
1318 )
1319);
1320
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001321TRACE_EVENT(nfs4_rename,
1322 TP_PROTO(
1323 const struct inode *olddir,
1324 const struct qstr *oldname,
1325 const struct inode *newdir,
1326 const struct qstr *newname,
1327 int error
1328 ),
1329
1330 TP_ARGS(olddir, oldname, newdir, newname, error),
1331
1332 TP_STRUCT__entry(
1333 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001334 __field(unsigned long, error)
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001335 __field(u64, olddir)
1336 __string(oldname, oldname->name)
1337 __field(u64, newdir)
1338 __string(newname, newname->name)
1339 ),
1340
1341 TP_fast_assign(
1342 __entry->dev = olddir->i_sb->s_dev;
1343 __entry->olddir = NFS_FILEID(olddir);
1344 __entry->newdir = NFS_FILEID(newdir);
1345 __entry->error = error;
1346 __assign_str(oldname, oldname->name);
1347 __assign_str(newname, newname->name);
1348 ),
1349
1350 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001351 "error=%ld (%s) oldname=%02x:%02x:%llu/%s "
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001352 "newname=%02x:%02x:%llu/%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001353 -__entry->error,
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001354 show_nfsv4_errors(__entry->error),
1355 MAJOR(__entry->dev), MINOR(__entry->dev),
1356 (unsigned long long)__entry->olddir,
1357 __get_str(oldname),
1358 MAJOR(__entry->dev), MINOR(__entry->dev),
1359 (unsigned long long)__entry->newdir,
1360 __get_str(newname)
1361 )
1362);
1363
Trond Myklebustc1578b72013-08-12 16:58:42 -04001364DECLARE_EVENT_CLASS(nfs4_inode_event,
1365 TP_PROTO(
1366 const struct inode *inode,
1367 int error
1368 ),
1369
1370 TP_ARGS(inode, error),
1371
1372 TP_STRUCT__entry(
1373 __field(dev_t, dev)
1374 __field(u32, fhandle)
1375 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001376 __field(unsigned long, error)
Trond Myklebustc1578b72013-08-12 16:58:42 -04001377 ),
1378
1379 TP_fast_assign(
1380 __entry->dev = inode->i_sb->s_dev;
1381 __entry->fileid = NFS_FILEID(inode);
1382 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Chuck Lever96650e22019-06-19 10:33:53 -04001383 __entry->error = error < 0 ? -error : 0;
Trond Myklebustc1578b72013-08-12 16:58:42 -04001384 ),
1385
1386 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001387 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
1388 -__entry->error,
Trond Myklebustc1578b72013-08-12 16:58:42 -04001389 show_nfsv4_errors(__entry->error),
1390 MAJOR(__entry->dev), MINOR(__entry->dev),
1391 (unsigned long long)__entry->fileid,
1392 __entry->fhandle
1393 )
1394);
1395
1396#define DEFINE_NFS4_INODE_EVENT(name) \
1397 DEFINE_EVENT(nfs4_inode_event, name, \
1398 TP_PROTO( \
1399 const struct inode *inode, \
1400 int error \
1401 ), \
1402 TP_ARGS(inode, error))
1403
Trond Myklebustc1578b72013-08-12 16:58:42 -04001404DEFINE_NFS4_INODE_EVENT(nfs4_access);
1405DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
1406DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
1407DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
1408DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
1409#ifdef CONFIG_NFS_V4_SECURITY_LABEL
1410DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
1411DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
1412#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001413
1414DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
1415 TP_PROTO(
1416 const struct inode *inode,
1417 const nfs4_stateid *stateid,
1418 int error
1419 ),
1420
1421 TP_ARGS(inode, stateid, error),
1422
1423 TP_STRUCT__entry(
1424 __field(dev_t, dev)
1425 __field(u32, fhandle)
1426 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001427 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001428 __field(int, stateid_seq)
1429 __field(u32, stateid_hash)
1430 ),
1431
1432 TP_fast_assign(
1433 __entry->dev = inode->i_sb->s_dev;
1434 __entry->fileid = NFS_FILEID(inode);
1435 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1436 __entry->error = error;
1437 __entry->stateid_seq =
1438 be32_to_cpu(stateid->seqid);
1439 __entry->stateid_hash =
1440 nfs_stateid_hash(stateid);
1441 ),
1442
1443 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001444 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001445 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001446 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001447 show_nfsv4_errors(__entry->error),
1448 MAJOR(__entry->dev), MINOR(__entry->dev),
1449 (unsigned long long)__entry->fileid,
1450 __entry->fhandle,
1451 __entry->stateid_seq, __entry->stateid_hash
1452 )
1453);
1454
1455#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1456 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1457 TP_PROTO( \
1458 const struct inode *inode, \
1459 const nfs4_stateid *stateid, \
1460 int error \
1461 ), \
1462 TP_ARGS(inode, stateid, error))
1463
1464DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1465DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
Trond Myklebustad9e02d2017-11-06 15:28:02 -05001466DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
1467DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
Trond Myklebustc1578b72013-08-12 16:58:42 -04001468
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001469DECLARE_EVENT_CLASS(nfs4_getattr_event,
1470 TP_PROTO(
1471 const struct nfs_server *server,
1472 const struct nfs_fh *fhandle,
1473 const struct nfs_fattr *fattr,
1474 int error
1475 ),
1476
1477 TP_ARGS(server, fhandle, fattr, error),
1478
1479 TP_STRUCT__entry(
1480 __field(dev_t, dev)
1481 __field(u32, fhandle)
1482 __field(u64, fileid)
1483 __field(unsigned int, valid)
Chuck Lever96650e22019-06-19 10:33:53 -04001484 __field(unsigned long, error)
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001485 ),
1486
1487 TP_fast_assign(
1488 __entry->dev = server->s_dev;
1489 __entry->valid = fattr->valid;
1490 __entry->fhandle = nfs_fhandle_hash(fhandle);
1491 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
1492 __entry->error = error;
1493 ),
1494
1495 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001496 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001497 "valid=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001498 -__entry->error,
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001499 show_nfsv4_errors(__entry->error),
1500 MAJOR(__entry->dev), MINOR(__entry->dev),
1501 (unsigned long long)__entry->fileid,
1502 __entry->fhandle,
1503 show_nfs_fattr_flags(__entry->valid)
1504 )
1505);
1506
1507#define DEFINE_NFS4_GETATTR_EVENT(name) \
1508 DEFINE_EVENT(nfs4_getattr_event, name, \
1509 TP_PROTO( \
1510 const struct nfs_server *server, \
1511 const struct nfs_fh *fhandle, \
1512 const struct nfs_fattr *fattr, \
1513 int error \
1514 ), \
1515 TP_ARGS(server, fhandle, fattr, error))
1516DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1517DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1518DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1519
Trond Myklebust7cd14862015-08-20 20:07:54 -05001520DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1521 TP_PROTO(
1522 const struct nfs_client *clp,
1523 const struct nfs_fh *fhandle,
1524 const struct inode *inode,
1525 int error
1526 ),
1527
1528 TP_ARGS(clp, fhandle, inode, error),
1529
1530 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001531 __field(unsigned long, error)
Trond Myklebust7cd14862015-08-20 20:07:54 -05001532 __field(dev_t, dev)
1533 __field(u32, fhandle)
1534 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001535 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001536 ),
1537
1538 TP_fast_assign(
1539 __entry->error = error;
1540 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2edaead2018-09-05 14:07:13 -04001541 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebust7cd14862015-08-20 20:07:54 -05001542 __entry->fileid = NFS_FILEID(inode);
1543 __entry->dev = inode->i_sb->s_dev;
1544 } else {
1545 __entry->fileid = 0;
1546 __entry->dev = 0;
1547 }
Anna Schumaker39443692017-11-01 15:48:43 -04001548 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001549 ),
1550
1551 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001552 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust7cd14862015-08-20 20:07:54 -05001553 "dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001554 -__entry->error,
Trond Myklebust7cd14862015-08-20 20:07:54 -05001555 show_nfsv4_errors(__entry->error),
1556 MAJOR(__entry->dev), MINOR(__entry->dev),
1557 (unsigned long long)__entry->fileid,
1558 __entry->fhandle,
1559 __get_str(dstaddr)
1560 )
1561);
1562
1563#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1564 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1565 TP_PROTO( \
1566 const struct nfs_client *clp, \
1567 const struct nfs_fh *fhandle, \
1568 const struct inode *inode, \
1569 int error \
1570 ), \
1571 TP_ARGS(clp, fhandle, inode, error))
1572DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1573
Trond Myklebuste07db902015-12-28 14:07:23 -05001574DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1575 TP_PROTO(
1576 const struct nfs_client *clp,
1577 const struct nfs_fh *fhandle,
1578 const struct inode *inode,
1579 const nfs4_stateid *stateid,
1580 int error
1581 ),
1582
1583 TP_ARGS(clp, fhandle, inode, stateid, error),
1584
1585 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001586 __field(unsigned long, error)
Trond Myklebuste07db902015-12-28 14:07:23 -05001587 __field(dev_t, dev)
1588 __field(u32, fhandle)
1589 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001590 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001591 __field(int, stateid_seq)
1592 __field(u32, stateid_hash)
1593 ),
1594
1595 TP_fast_assign(
1596 __entry->error = error;
1597 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2a534a72018-08-23 11:02:49 -04001598 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebuste07db902015-12-28 14:07:23 -05001599 __entry->fileid = NFS_FILEID(inode);
1600 __entry->dev = inode->i_sb->s_dev;
1601 } else {
1602 __entry->fileid = 0;
1603 __entry->dev = 0;
1604 }
Anna Schumaker39443692017-11-01 15:48:43 -04001605 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001606 __entry->stateid_seq =
1607 be32_to_cpu(stateid->seqid);
1608 __entry->stateid_hash =
1609 nfs_stateid_hash(stateid);
1610 ),
1611
1612 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001613 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebuste07db902015-12-28 14:07:23 -05001614 "stateid=%d:0x%08x dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001615 -__entry->error,
Trond Myklebuste07db902015-12-28 14:07:23 -05001616 show_nfsv4_errors(__entry->error),
1617 MAJOR(__entry->dev), MINOR(__entry->dev),
1618 (unsigned long long)__entry->fileid,
1619 __entry->fhandle,
1620 __entry->stateid_seq, __entry->stateid_hash,
1621 __get_str(dstaddr)
1622 )
1623);
1624
1625#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1626 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1627 TP_PROTO( \
1628 const struct nfs_client *clp, \
1629 const struct nfs_fh *fhandle, \
1630 const struct inode *inode, \
1631 const nfs4_stateid *stateid, \
1632 int error \
1633 ), \
1634 TP_ARGS(clp, fhandle, inode, stateid, error))
1635DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1636DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
Trond Myklebust7cd14862015-08-20 20:07:54 -05001637
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001638DECLARE_EVENT_CLASS(nfs4_idmap_event,
1639 TP_PROTO(
1640 const char *name,
1641 int len,
1642 u32 id,
1643 int error
1644 ),
1645
1646 TP_ARGS(name, len, id, error),
1647
1648 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001649 __field(unsigned long, error)
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001650 __field(u32, id)
1651 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1652 ),
1653
1654 TP_fast_assign(
1655 if (len < 0)
1656 len = 0;
1657 __entry->error = error < 0 ? error : 0;
1658 __entry->id = id;
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -03001659 memcpy(__get_str(name), name, len);
1660 __get_str(name)[len] = 0;
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001661 ),
1662
1663 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001664 "error=%ld (%s) id=%u name=%s",
1665 -__entry->error, show_nfsv4_errors(__entry->error),
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001666 __entry->id,
1667 __get_str(name)
1668 )
1669);
1670#define DEFINE_NFS4_IDMAP_EVENT(name) \
1671 DEFINE_EVENT(nfs4_idmap_event, name, \
1672 TP_PROTO( \
1673 const char *name, \
1674 int len, \
1675 u32 id, \
1676 int error \
1677 ), \
1678 TP_ARGS(name, len, id, error))
1679DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1680DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1681DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1682DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1683
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001684DECLARE_EVENT_CLASS(nfs4_read_event,
1685 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001686 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001687 int error
1688 ),
1689
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001690 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001691
1692 TP_STRUCT__entry(
1693 __field(dev_t, dev)
1694 __field(u32, fhandle)
1695 __field(u64, fileid)
1696 __field(loff_t, offset)
1697 __field(size_t, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001698 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001699 __field(int, stateid_seq)
1700 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001701 ),
1702
1703 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001704 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001705 const struct nfs4_state *state =
1706 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001707 __entry->dev = inode->i_sb->s_dev;
1708 __entry->fileid = NFS_FILEID(inode);
1709 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001710 __entry->offset = hdr->args.offset;
1711 __entry->count = hdr->args.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001712 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001713 __entry->stateid_seq =
1714 be32_to_cpu(state->stateid.seqid);
1715 __entry->stateid_hash =
1716 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001717 ),
1718
1719 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001720 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001721 "offset=%lld count=%zu stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001722 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001723 show_nfsv4_errors(__entry->error),
1724 MAJOR(__entry->dev), MINOR(__entry->dev),
1725 (unsigned long long)__entry->fileid,
1726 __entry->fhandle,
1727 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001728 __entry->count,
1729 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001730 )
1731);
1732#define DEFINE_NFS4_READ_EVENT(name) \
1733 DEFINE_EVENT(nfs4_read_event, name, \
1734 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001735 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001736 int error \
1737 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001738 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001739DEFINE_NFS4_READ_EVENT(nfs4_read);
1740#ifdef CONFIG_NFS_V4_1
1741DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1742#endif /* CONFIG_NFS_V4_1 */
1743
1744DECLARE_EVENT_CLASS(nfs4_write_event,
1745 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001746 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001747 int error
1748 ),
1749
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001750 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001751
1752 TP_STRUCT__entry(
1753 __field(dev_t, dev)
1754 __field(u32, fhandle)
1755 __field(u64, fileid)
1756 __field(loff_t, offset)
1757 __field(size_t, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001758 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001759 __field(int, stateid_seq)
1760 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001761 ),
1762
1763 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001764 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001765 const struct nfs4_state *state =
1766 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001767 __entry->dev = inode->i_sb->s_dev;
1768 __entry->fileid = NFS_FILEID(inode);
1769 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001770 __entry->offset = hdr->args.offset;
1771 __entry->count = hdr->args.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001772 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001773 __entry->stateid_seq =
1774 be32_to_cpu(state->stateid.seqid);
1775 __entry->stateid_hash =
1776 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001777 ),
1778
1779 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001780 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001781 "offset=%lld count=%zu stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001782 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001783 show_nfsv4_errors(__entry->error),
1784 MAJOR(__entry->dev), MINOR(__entry->dev),
1785 (unsigned long long)__entry->fileid,
1786 __entry->fhandle,
1787 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001788 __entry->count,
1789 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001790 )
1791);
1792
1793#define DEFINE_NFS4_WRITE_EVENT(name) \
1794 DEFINE_EVENT(nfs4_write_event, name, \
1795 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001796 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001797 int error \
1798 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001799 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001800DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1801#ifdef CONFIG_NFS_V4_1
1802DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1803#endif /* CONFIG_NFS_V4_1 */
1804
1805DECLARE_EVENT_CLASS(nfs4_commit_event,
1806 TP_PROTO(
1807 const struct nfs_commit_data *data,
1808 int error
1809 ),
1810
1811 TP_ARGS(data, error),
1812
1813 TP_STRUCT__entry(
1814 __field(dev_t, dev)
1815 __field(u32, fhandle)
1816 __field(u64, fileid)
1817 __field(loff_t, offset)
1818 __field(size_t, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001819 __field(unsigned long, error)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001820 ),
1821
1822 TP_fast_assign(
1823 const struct inode *inode = data->inode;
1824 __entry->dev = inode->i_sb->s_dev;
1825 __entry->fileid = NFS_FILEID(inode);
1826 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1827 __entry->offset = data->args.offset;
1828 __entry->count = data->args.count;
1829 __entry->error = error;
1830 ),
1831
1832 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001833 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001834 "offset=%lld count=%zu",
Chuck Lever96650e22019-06-19 10:33:53 -04001835 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001836 show_nfsv4_errors(__entry->error),
1837 MAJOR(__entry->dev), MINOR(__entry->dev),
1838 (unsigned long long)__entry->fileid,
1839 __entry->fhandle,
1840 (long long)__entry->offset,
1841 __entry->count
1842 )
1843);
1844#define DEFINE_NFS4_COMMIT_EVENT(name) \
1845 DEFINE_EVENT(nfs4_commit_event, name, \
1846 TP_PROTO( \
1847 const struct nfs_commit_data *data, \
1848 int error \
1849 ), \
1850 TP_ARGS(data, error))
1851DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1852#ifdef CONFIG_NFS_V4_1
1853DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001854
Chuck Lever5b2095d2018-12-19 11:00:11 -05001855TRACE_DEFINE_ENUM(IOMODE_READ);
1856TRACE_DEFINE_ENUM(IOMODE_RW);
1857TRACE_DEFINE_ENUM(IOMODE_ANY);
1858
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001859#define show_pnfs_iomode(iomode) \
1860 __print_symbolic(iomode, \
1861 { IOMODE_READ, "READ" }, \
1862 { IOMODE_RW, "RW" }, \
1863 { IOMODE_ANY, "ANY" })
1864
1865TRACE_EVENT(nfs4_layoutget,
1866 TP_PROTO(
1867 const struct nfs_open_context *ctx,
1868 const struct pnfs_layout_range *args,
1869 const struct pnfs_layout_range *res,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001870 const nfs4_stateid *layout_stateid,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001871 int error
1872 ),
1873
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001874 TP_ARGS(ctx, args, res, layout_stateid, error),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001875
1876 TP_STRUCT__entry(
1877 __field(dev_t, dev)
1878 __field(u32, fhandle)
1879 __field(u64, fileid)
1880 __field(u32, iomode)
1881 __field(u64, offset)
1882 __field(u64, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001883 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001884 __field(int, stateid_seq)
1885 __field(u32, stateid_hash)
1886 __field(int, layoutstateid_seq)
1887 __field(u32, layoutstateid_hash)
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001888 ),
1889
1890 TP_fast_assign(
David Howells2b0143b2015-03-17 22:25:59 +00001891 const struct inode *inode = d_inode(ctx->dentry);
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001892 const struct nfs4_state *state = ctx->state;
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001893 __entry->dev = inode->i_sb->s_dev;
1894 __entry->fileid = NFS_FILEID(inode);
1895 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1896 __entry->iomode = args->iomode;
1897 __entry->offset = args->offset;
1898 __entry->count = args->length;
1899 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001900 __entry->stateid_seq =
1901 be32_to_cpu(state->stateid.seqid);
1902 __entry->stateid_hash =
1903 nfs_stateid_hash(&state->stateid);
1904 if (!error) {
1905 __entry->layoutstateid_seq =
1906 be32_to_cpu(layout_stateid->seqid);
1907 __entry->layoutstateid_hash =
1908 nfs_stateid_hash(layout_stateid);
1909 } else {
1910 __entry->layoutstateid_seq = 0;
1911 __entry->layoutstateid_hash = 0;
1912 }
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001913 ),
1914
1915 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001916 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001917 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1918 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001919 -__entry->error,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001920 show_nfsv4_errors(__entry->error),
1921 MAJOR(__entry->dev), MINOR(__entry->dev),
1922 (unsigned long long)__entry->fileid,
1923 __entry->fhandle,
1924 show_pnfs_iomode(__entry->iomode),
1925 (unsigned long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001926 (unsigned long long)__entry->count,
1927 __entry->stateid_seq, __entry->stateid_hash,
1928 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001929 )
1930);
1931
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001932DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1933DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
Trond Myklebust6a463beb2015-08-20 15:40:47 -05001934DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001935
Chuck Lever5b2095d2018-12-19 11:00:11 -05001936TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN);
1937TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS);
1938TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN);
1939TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH);
1940TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM);
1941TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL);
1942TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL);
1943TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED);
1944TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN);
1945TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED);
1946TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN);
1947TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY);
1948TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
Trond Myklebustd5b92162019-07-18 09:32:17 -04001949TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_EXIT);
Chuck Lever5b2095d2018-12-19 11:00:11 -05001950
Jeff Layton9a4bf312015-12-10 10:41:58 -05001951#define show_pnfs_update_layout_reason(reason) \
1952 __print_symbolic(reason, \
1953 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
1954 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
1955 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
1956 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
1957 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
1958 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
1959 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
1960 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
1961 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
1962 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
Jeff Layton183d9e72016-05-17 12:28:47 -04001963 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
1964 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
Trond Myklebustd5b92162019-07-18 09:32:17 -04001965 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }, \
1966 { PNFS_UPDATE_LAYOUT_EXIT, "exit" })
Jeff Layton9a4bf312015-12-10 10:41:58 -05001967
1968TRACE_EVENT(pnfs_update_layout,
1969 TP_PROTO(struct inode *inode,
1970 loff_t pos,
1971 u64 count,
1972 enum pnfs_iomode iomode,
Trond Myklebustf4848302015-12-26 18:03:07 -05001973 struct pnfs_layout_hdr *lo,
Jeff Layton183d9e72016-05-17 12:28:47 -04001974 struct pnfs_layout_segment *lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05001975 enum pnfs_update_layout_reason reason
1976 ),
Jeff Layton183d9e72016-05-17 12:28:47 -04001977 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
Jeff Layton9a4bf312015-12-10 10:41:58 -05001978 TP_STRUCT__entry(
1979 __field(dev_t, dev)
1980 __field(u64, fileid)
1981 __field(u32, fhandle)
1982 __field(loff_t, pos)
1983 __field(u64, count)
1984 __field(enum pnfs_iomode, iomode)
Trond Myklebustf4848302015-12-26 18:03:07 -05001985 __field(int, layoutstateid_seq)
1986 __field(u32, layoutstateid_hash)
Jeff Layton183d9e72016-05-17 12:28:47 -04001987 __field(long, lseg)
Jeff Layton9a4bf312015-12-10 10:41:58 -05001988 __field(enum pnfs_update_layout_reason, reason)
1989 ),
1990 TP_fast_assign(
1991 __entry->dev = inode->i_sb->s_dev;
1992 __entry->fileid = NFS_FILEID(inode);
1993 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1994 __entry->pos = pos;
1995 __entry->count = count;
1996 __entry->iomode = iomode;
Jeff Layton9a4bf312015-12-10 10:41:58 -05001997 __entry->reason = reason;
Trond Myklebustf4848302015-12-26 18:03:07 -05001998 if (lo != NULL) {
1999 __entry->layoutstateid_seq =
2000 be32_to_cpu(lo->plh_stateid.seqid);
2001 __entry->layoutstateid_hash =
2002 nfs_stateid_hash(&lo->plh_stateid);
2003 } else {
2004 __entry->layoutstateid_seq = 0;
2005 __entry->layoutstateid_hash = 0;
2006 }
Jeff Layton183d9e72016-05-17 12:28:47 -04002007 __entry->lseg = (long)lseg;
Jeff Layton9a4bf312015-12-10 10:41:58 -05002008 ),
2009 TP_printk(
2010 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustf4848302015-12-26 18:03:07 -05002011 "iomode=%s pos=%llu count=%llu "
Jeff Layton183d9e72016-05-17 12:28:47 -04002012 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
Jeff Layton9a4bf312015-12-10 10:41:58 -05002013 MAJOR(__entry->dev), MINOR(__entry->dev),
2014 (unsigned long long)__entry->fileid,
2015 __entry->fhandle,
2016 show_pnfs_iomode(__entry->iomode),
2017 (unsigned long long)__entry->pos,
Trond Myklebustf4848302015-12-26 18:03:07 -05002018 (unsigned long long)__entry->count,
2019 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
Jeff Layton183d9e72016-05-17 12:28:47 -04002020 __entry->lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05002021 show_pnfs_update_layout_reason(__entry->reason)
2022 )
2023);
2024
Trond Myklebustd5b92162019-07-18 09:32:17 -04002025DECLARE_EVENT_CLASS(pnfs_layout_event,
2026 TP_PROTO(struct inode *inode,
2027 loff_t pos,
2028 u64 count,
2029 enum pnfs_iomode iomode,
2030 struct pnfs_layout_hdr *lo,
2031 struct pnfs_layout_segment *lseg
2032 ),
2033 TP_ARGS(inode, pos, count, iomode, lo, lseg),
2034 TP_STRUCT__entry(
2035 __field(dev_t, dev)
2036 __field(u64, fileid)
2037 __field(u32, fhandle)
2038 __field(loff_t, pos)
2039 __field(u64, count)
2040 __field(enum pnfs_iomode, iomode)
2041 __field(int, layoutstateid_seq)
2042 __field(u32, layoutstateid_hash)
2043 __field(long, lseg)
2044 ),
2045 TP_fast_assign(
2046 __entry->dev = inode->i_sb->s_dev;
2047 __entry->fileid = NFS_FILEID(inode);
2048 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2049 __entry->pos = pos;
2050 __entry->count = count;
2051 __entry->iomode = iomode;
2052 if (lo != NULL) {
2053 __entry->layoutstateid_seq =
2054 be32_to_cpu(lo->plh_stateid.seqid);
2055 __entry->layoutstateid_hash =
2056 nfs_stateid_hash(&lo->plh_stateid);
2057 } else {
2058 __entry->layoutstateid_seq = 0;
2059 __entry->layoutstateid_hash = 0;
2060 }
2061 __entry->lseg = (long)lseg;
2062 ),
2063 TP_printk(
2064 "fileid=%02x:%02x:%llu fhandle=0x%08x "
2065 "iomode=%s pos=%llu count=%llu "
2066 "layoutstateid=%d:0x%08x lseg=0x%lx",
2067 MAJOR(__entry->dev), MINOR(__entry->dev),
2068 (unsigned long long)__entry->fileid,
2069 __entry->fhandle,
2070 show_pnfs_iomode(__entry->iomode),
2071 (unsigned long long)__entry->pos,
2072 (unsigned long long)__entry->count,
2073 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
2074 __entry->lseg
2075 )
2076);
2077
2078#define DEFINE_PNFS_LAYOUT_EVENT(name) \
2079 DEFINE_EVENT(pnfs_layout_event, name, \
2080 TP_PROTO(struct inode *inode, \
2081 loff_t pos, \
2082 u64 count, \
2083 enum pnfs_iomode iomode, \
2084 struct pnfs_layout_hdr *lo, \
2085 struct pnfs_layout_segment *lseg \
2086 ), \
2087 TP_ARGS(inode, pos, count, iomode, lo, lseg))
2088
2089DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_read);
2090DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_write);
2091DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_get_mirror_count);
2092DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_done);
2093DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done);
2094DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist);
2095DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist);
2096
Trond Myklebustcc668ab2013-08-14 15:31:28 -04002097#endif /* CONFIG_NFS_V4_1 */
2098
Trond Myklebustc6d01c62013-08-09 11:51:26 -04002099#endif /* _TRACE_NFS4_H */
2100
2101#undef TRACE_INCLUDE_PATH
2102#define TRACE_INCLUDE_PATH .
2103#define TRACE_INCLUDE_FILE nfs4trace
2104/* This part must be outside protection */
2105#include <trace/define_trace.h>