blob: 484c1da96dea2f40b5a69d93ac1441ca29748ffa [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 Myklebust0722dc92020-01-06 15:25:07 -0500158TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_MDS);
159TRACE_DEFINE_ENUM(NFS4ERR_RESET_TO_PNFS);
160
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400161#define show_nfsv4_errors(error) \
Chuck Lever96650e22019-06-19 10:33:53 -0400162 __print_symbolic(error, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400163 { NFS4_OK, "OK" }, \
164 /* Mapped by nfs4_stat_to_errno() */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500165 { EPERM, "EPERM" }, \
166 { ENOENT, "ENOENT" }, \
167 { EIO, "EIO" }, \
168 { ENXIO, "ENXIO" }, \
169 { EACCES, "EACCES" }, \
170 { EEXIST, "EEXIST" }, \
171 { EXDEV, "EXDEV" }, \
172 { ENOTDIR, "ENOTDIR" }, \
173 { EISDIR, "EISDIR" }, \
174 { EFBIG, "EFBIG" }, \
175 { ENOSPC, "ENOSPC" }, \
176 { EROFS, "EROFS" }, \
177 { EMLINK, "EMLINK" }, \
178 { ENAMETOOLONG, "ENAMETOOLONG" }, \
179 { ENOTEMPTY, "ENOTEMPTY" }, \
180 { EDQUOT, "EDQUOT" }, \
181 { ESTALE, "ESTALE" }, \
182 { EBADHANDLE, "EBADHANDLE" }, \
183 { EBADCOOKIE, "EBADCOOKIE" }, \
184 { ENOTSUPP, "ENOTSUPP" }, \
185 { ETOOSMALL, "ETOOSMALL" }, \
186 { EREMOTEIO, "EREMOTEIO" }, \
187 { EBADTYPE, "EBADTYPE" }, \
188 { EAGAIN, "EAGAIN" }, \
189 { ELOOP, "ELOOP" }, \
190 { EOPNOTSUPP, "EOPNOTSUPP" }, \
191 { EDEADLK, "EDEADLK" }, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400192 /* RPC errors */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500193 { ENOMEM, "ENOMEM" }, \
194 { EKEYEXPIRED, "EKEYEXPIRED" }, \
195 { ETIMEDOUT, "ETIMEDOUT" }, \
196 { ERESTARTSYS, "ERESTARTSYS" }, \
197 { ECONNREFUSED, "ECONNREFUSED" }, \
198 { ECONNRESET, "ECONNRESET" }, \
199 { ENETUNREACH, "ENETUNREACH" }, \
200 { EHOSTUNREACH, "EHOSTUNREACH" }, \
201 { EHOSTDOWN, "EHOSTDOWN" }, \
202 { EPIPE, "EPIPE" }, \
203 { EPFNOSUPPORT, "EPFNOSUPPORT" }, \
204 { EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400205 /* NFSv4 native errors */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500206 { NFS4ERR_ACCESS, "ACCESS" }, \
207 { NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \
208 { NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \
209 { NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \
210 { NFS4ERR_BADCHAR, "BADCHAR" }, \
211 { NFS4ERR_BADHANDLE, "BADHANDLE" }, \
212 { NFS4ERR_BADIOMODE, "BADIOMODE" }, \
213 { NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \
214 { NFS4ERR_BADLABEL, "BADLABEL" }, \
215 { NFS4ERR_BADNAME, "BADNAME" }, \
216 { NFS4ERR_BADOWNER, "BADOWNER" }, \
217 { NFS4ERR_BADSESSION, "BADSESSION" }, \
218 { NFS4ERR_BADSLOT, "BADSLOT" }, \
219 { NFS4ERR_BADTYPE, "BADTYPE" }, \
220 { NFS4ERR_BADXDR, "BADXDR" }, \
221 { NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \
222 { NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \
223 { NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \
224 { NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \
225 { NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \
226 { NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \
227 { NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
228 { NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \
229 { NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \
230 { NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \
231 { NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400232 "CONN_NOT_BOUND_TO_SESSION" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500233 { NFS4ERR_DEADLOCK, "DEADLOCK" }, \
234 { NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \
235 { NFS4ERR_DELAY, "DELAY" }, \
236 { NFS4ERR_DELEG_ALREADY_WANTED, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400237 "DELEG_ALREADY_WANTED" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500238 { NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \
239 { NFS4ERR_DENIED, "DENIED" }, \
240 { NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \
241 { NFS4ERR_DQUOT, "DQUOT" }, \
242 { NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \
243 { NFS4ERR_EXIST, "EXIST" }, \
244 { NFS4ERR_EXPIRED, "EXPIRED" }, \
245 { NFS4ERR_FBIG, "FBIG" }, \
246 { NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \
247 { NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \
248 { NFS4ERR_GRACE, "GRACE" }, \
249 { NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \
250 { NFS4ERR_INVAL, "INVAL" }, \
251 { NFS4ERR_IO, "IO" }, \
252 { NFS4ERR_ISDIR, "ISDIR" }, \
253 { NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \
254 { NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \
255 { NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \
256 { NFS4ERR_LOCKED, "LOCKED" }, \
257 { NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \
258 { NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \
259 { NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \
260 { NFS4ERR_MLINK, "MLINK" }, \
261 { NFS4ERR_MOVED, "MOVED" }, \
262 { NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \
263 { NFS4ERR_NOENT, "NOENT" }, \
264 { NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \
265 { NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \
266 { NFS4ERR_NOSPC, "NOSPC" }, \
267 { NFS4ERR_NOTDIR, "NOTDIR" }, \
268 { NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \
269 { NFS4ERR_NOTSUPP, "NOTSUPP" }, \
270 { NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \
271 { NFS4ERR_NOT_SAME, "NOT_SAME" }, \
272 { NFS4ERR_NO_GRACE, "NO_GRACE" }, \
273 { NFS4ERR_NXIO, "NXIO" }, \
274 { NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \
275 { NFS4ERR_OPENMODE, "OPENMODE" }, \
276 { NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \
277 { NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \
278 { NFS4ERR_PERM, "PERM" }, \
279 { NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \
280 { NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \
281 { NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \
282 { NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \
283 { NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \
284 { NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \
285 { NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \
286 { NFS4ERR_REP_TOO_BIG_TO_CACHE, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400287 "REP_TOO_BIG_TO_CACHE" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500288 { NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \
289 { NFS4ERR_RESOURCE, "RESOURCE" }, \
290 { NFS4ERR_RESTOREFH, "RESTOREFH" }, \
291 { NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \
292 { NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \
293 { NFS4ERR_ROFS, "ROFS" }, \
294 { NFS4ERR_SAME, "SAME" }, \
295 { NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \
296 { NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \
297 { NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \
298 { NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \
299 { NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \
300 { NFS4ERR_STALE, "STALE" }, \
301 { NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \
302 { NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \
303 { NFS4ERR_SYMLINK, "SYMLINK" }, \
304 { NFS4ERR_TOOSMALL, "TOOSMALL" }, \
305 { NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \
306 { NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \
307 { NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \
308 { NFS4ERR_WRONGSEC, "WRONGSEC" }, \
309 { NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
310 { NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
Trond Myklebust0722dc92020-01-06 15:25:07 -0500311 { NFS4ERR_XDEV, "XDEV" }, \
312 /* ***** Internal to Linux NFS client ***** */ \
313 { NFS4ERR_RESET_TO_MDS, "RESET_TO_MDS" }, \
314 { NFS4ERR_RESET_TO_PNFS, "RESET_TO_PNFS" })
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400315
Trond Myklebust42113a72013-08-12 16:19:27 -0400316#define show_open_flags(flags) \
317 __print_flags(flags, "|", \
318 { O_CREAT, "O_CREAT" }, \
319 { O_EXCL, "O_EXCL" }, \
320 { O_TRUNC, "O_TRUNC" }, \
321 { O_DIRECT, "O_DIRECT" })
322
323#define show_fmode_flags(mode) \
324 __print_flags(mode, "|", \
325 { ((__force unsigned long)FMODE_READ), "READ" }, \
326 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
327 { ((__force unsigned long)FMODE_EXEC), "EXEC" })
328
Trond Myklebustb5f875a2013-08-13 13:01:39 -0400329#define show_nfs_fattr_flags(valid) \
330 __print_flags((unsigned long)valid, "|", \
331 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \
332 { NFS_ATTR_FATTR_MODE, "MODE" }, \
333 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \
334 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \
335 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \
336 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \
337 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \
338 { NFS_ATTR_FATTR_FSID, "FSID" }, \
339 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \
340 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \
341 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \
342 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \
343 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
344 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
345 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
346
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400347DECLARE_EVENT_CLASS(nfs4_clientid_event,
348 TP_PROTO(
349 const struct nfs_client *clp,
350 int error
351 ),
352
353 TP_ARGS(clp, error),
354
355 TP_STRUCT__entry(
Anna Schumaker39443692017-11-01 15:48:43 -0400356 __string(dstaddr, clp->cl_hostname)
Chuck Lever96650e22019-06-19 10:33:53 -0400357 __field(unsigned long, error)
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400358 ),
359
360 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -0500361 __entry->error = error < 0 ? -error : 0;
Anna Schumaker39443692017-11-01 15:48:43 -0400362 __assign_str(dstaddr, clp->cl_hostname);
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400363 ),
364
365 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400366 "error=%ld (%s) dstaddr=%s",
367 -__entry->error,
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400368 show_nfsv4_errors(__entry->error),
369 __get_str(dstaddr)
370 )
371);
372#define DEFINE_NFS4_CLIENTID_EVENT(name) \
373 DEFINE_EVENT(nfs4_clientid_event, name, \
374 TP_PROTO( \
375 const struct nfs_client *clp, \
376 int error \
377 ), \
378 TP_ARGS(clp, error))
379DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
380DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
381DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
382DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
383#ifdef CONFIG_NFS_V4_1
384DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
385DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
386DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
387DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
388DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
389DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
390DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400391
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400392#define show_nfs4_sequence_status_flags(status) \
393 __print_flags((unsigned long)status, "|", \
394 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
395 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
396 "CB_GSS_CONTEXTS_EXPIRING" }, \
397 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
398 "CB_GSS_CONTEXTS_EXPIRED" }, \
399 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
400 "EXPIRED_ALL_STATE_REVOKED" }, \
401 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
402 "EXPIRED_SOME_STATE_REVOKED" }, \
403 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
404 "ADMIN_STATE_REVOKED" }, \
405 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
406 "RECALLABLE_STATE_REVOKED" }, \
407 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
408 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
409 "RESTART_RECLAIM_NEEDED" }, \
410 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
411 "CB_PATH_DOWN_SESSION" }, \
412 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
413 "BACKCHANNEL_FAULT" })
414
415TRACE_EVENT(nfs4_sequence_done,
416 TP_PROTO(
417 const struct nfs4_session *session,
418 const struct nfs4_sequence_res *res
419 ),
420 TP_ARGS(session, res),
421
422 TP_STRUCT__entry(
423 __field(unsigned int, session)
424 __field(unsigned int, slot_nr)
425 __field(unsigned int, seq_nr)
426 __field(unsigned int, highest_slotid)
427 __field(unsigned int, target_highest_slotid)
428 __field(unsigned int, status_flags)
Chuck Lever96650e22019-06-19 10:33:53 -0400429 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400430 ),
431
432 TP_fast_assign(
433 const struct nfs4_slot *sr_slot = res->sr_slot;
434 __entry->session = nfs_session_id_hash(&session->sess_id);
435 __entry->slot_nr = sr_slot->slot_nr;
436 __entry->seq_nr = sr_slot->seq_nr;
437 __entry->highest_slotid = res->sr_highest_slotid;
438 __entry->target_highest_slotid =
439 res->sr_target_highest_slotid;
Andrew Elble52618df2015-12-02 09:19:43 -0500440 __entry->status_flags = res->sr_status_flags;
Trond Myklebust118b6292020-01-06 15:25:06 -0500441 __entry->error = res->sr_status < 0 ?
442 -res->sr_status : 0;
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400443 ),
444 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400445 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400446 "highest_slotid=%u target_highest_slotid=%u "
447 "status_flags=%u (%s)",
Chuck Lever96650e22019-06-19 10:33:53 -0400448 -__entry->error,
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400449 show_nfsv4_errors(__entry->error),
450 __entry->session,
451 __entry->slot_nr,
452 __entry->seq_nr,
453 __entry->highest_slotid,
454 __entry->target_highest_slotid,
455 __entry->status_flags,
456 show_nfs4_sequence_status_flags(__entry->status_flags)
457 )
458);
459
460struct cb_sequenceargs;
461struct cb_sequenceres;
462
463TRACE_EVENT(nfs4_cb_sequence,
464 TP_PROTO(
465 const struct cb_sequenceargs *args,
466 const struct cb_sequenceres *res,
467 __be32 status
468 ),
469 TP_ARGS(args, res, status),
470
471 TP_STRUCT__entry(
472 __field(unsigned int, session)
473 __field(unsigned int, slot_nr)
474 __field(unsigned int, seq_nr)
475 __field(unsigned int, highest_slotid)
476 __field(unsigned int, cachethis)
Chuck Lever96650e22019-06-19 10:33:53 -0400477 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400478 ),
479
480 TP_fast_assign(
481 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
482 __entry->slot_nr = args->csa_slotid;
483 __entry->seq_nr = args->csa_sequenceid;
484 __entry->highest_slotid = args->csa_highestslotid;
485 __entry->cachethis = args->csa_cachethis;
Chuck Lever96650e22019-06-19 10:33:53 -0400486 __entry->error = be32_to_cpu(status);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400487 ),
488
489 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400490 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400491 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400492 -__entry->error,
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400493 show_nfsv4_errors(__entry->error),
494 __entry->session,
495 __entry->slot_nr,
496 __entry->seq_nr,
497 __entry->highest_slotid
498 )
499);
Chuck Leverc5833f02019-06-19 10:33:47 -0400500
501TRACE_EVENT(nfs4_cb_seqid_err,
502 TP_PROTO(
503 const struct cb_sequenceargs *args,
504 __be32 status
505 ),
506 TP_ARGS(args, status),
507
508 TP_STRUCT__entry(
509 __field(unsigned int, session)
510 __field(unsigned int, slot_nr)
511 __field(unsigned int, seq_nr)
512 __field(unsigned int, highest_slotid)
513 __field(unsigned int, cachethis)
Chuck Lever96650e22019-06-19 10:33:53 -0400514 __field(unsigned long, error)
Chuck Leverc5833f02019-06-19 10:33:47 -0400515 ),
516
517 TP_fast_assign(
518 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
519 __entry->slot_nr = args->csa_slotid;
520 __entry->seq_nr = args->csa_sequenceid;
521 __entry->highest_slotid = args->csa_highestslotid;
522 __entry->cachethis = args->csa_cachethis;
Chuck Lever96650e22019-06-19 10:33:53 -0400523 __entry->error = be32_to_cpu(status);
Chuck Leverc5833f02019-06-19 10:33:47 -0400524 ),
525
526 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400527 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Chuck Leverc5833f02019-06-19 10:33:47 -0400528 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400529 -__entry->error,
Chuck Leverc5833f02019-06-19 10:33:47 -0400530 show_nfsv4_errors(__entry->error),
531 __entry->session,
532 __entry->slot_nr,
533 __entry->seq_nr,
534 __entry->highest_slotid
535 )
536);
537
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400538#endif /* CONFIG_NFS_V4_1 */
539
Anna Schumakerad05cc02017-01-11 13:37:06 -0500540TRACE_EVENT(nfs4_setup_sequence,
541 TP_PROTO(
542 const struct nfs4_session *session,
543 const struct nfs4_sequence_args *args
544 ),
545 TP_ARGS(session, args),
546
547 TP_STRUCT__entry(
548 __field(unsigned int, session)
549 __field(unsigned int, slot_nr)
550 __field(unsigned int, seq_nr)
551 __field(unsigned int, highest_used_slotid)
552 ),
553
554 TP_fast_assign(
555 const struct nfs4_slot *sa_slot = args->sa_slot;
556 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
557 __entry->slot_nr = sa_slot->slot_nr;
558 __entry->seq_nr = sa_slot->seq_nr;
559 __entry->highest_used_slotid =
560 sa_slot->table->highest_used_slotid;
561 ),
562 TP_printk(
563 "session=0x%08x slot_nr=%u seq_nr=%u "
564 "highest_used_slotid=%u",
565 __entry->session,
566 __entry->slot_nr,
567 __entry->seq_nr,
568 __entry->highest_used_slotid
569 )
570);
571
Chuck Lever511ba522019-11-05 11:04:07 -0500572TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_RUNNING);
573TRACE_DEFINE_ENUM(NFS4CLNT_CHECK_LEASE);
574TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_EXPIRED);
575TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_REBOOT);
576TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_NOGRACE);
577TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN);
578TRACE_DEFINE_ENUM(NFS4CLNT_SESSION_RESET);
579TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_CONFIRM);
580TRACE_DEFINE_ENUM(NFS4CLNT_SERVER_SCOPE_MISMATCH);
581TRACE_DEFINE_ENUM(NFS4CLNT_PURGE_STATE);
582TRACE_DEFINE_ENUM(NFS4CLNT_BIND_CONN_TO_SESSION);
583TRACE_DEFINE_ENUM(NFS4CLNT_MOVED);
584TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_MOVED);
585TRACE_DEFINE_ENUM(NFS4CLNT_DELEGATION_EXPIRED);
586TRACE_DEFINE_ENUM(NFS4CLNT_RUN_MANAGER);
Trond Myklebustb5fdf842020-02-18 15:58:31 -0500587TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_RUNNING);
588TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_READ);
589TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_RW);
Chuck Lever511ba522019-11-05 11:04:07 -0500590
591#define show_nfs4_clp_state(state) \
592 __print_flags(state, "|", \
593 { NFS4CLNT_MANAGER_RUNNING, "MANAGER_RUNNING" }, \
594 { NFS4CLNT_CHECK_LEASE, "CHECK_LEASE" }, \
595 { NFS4CLNT_LEASE_EXPIRED, "LEASE_EXPIRED" }, \
596 { NFS4CLNT_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
597 { NFS4CLNT_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
598 { NFS4CLNT_DELEGRETURN, "DELEGRETURN" }, \
599 { NFS4CLNT_SESSION_RESET, "SESSION_RESET" }, \
600 { NFS4CLNT_LEASE_CONFIRM, "LEASE_CONFIRM" }, \
601 { NFS4CLNT_SERVER_SCOPE_MISMATCH, \
602 "SERVER_SCOPE_MISMATCH" }, \
603 { NFS4CLNT_PURGE_STATE, "PURGE_STATE" }, \
604 { NFS4CLNT_BIND_CONN_TO_SESSION, \
605 "BIND_CONN_TO_SESSION" }, \
606 { NFS4CLNT_MOVED, "MOVED" }, \
607 { NFS4CLNT_LEASE_MOVED, "LEASE_MOVED" }, \
608 { NFS4CLNT_DELEGATION_EXPIRED, "DELEGATION_EXPIRED" }, \
609 { NFS4CLNT_RUN_MANAGER, "RUN_MANAGER" }, \
Trond Myklebustb5fdf842020-02-18 15:58:31 -0500610 { NFS4CLNT_RECALL_RUNNING, "RECALL_RUNNING" }, \
611 { NFS4CLNT_RECALL_ANY_LAYOUT_READ, "RECALL_ANY_LAYOUT_READ" }, \
612 { NFS4CLNT_RECALL_ANY_LAYOUT_RW, "RECALL_ANY_LAYOUT_RW" })
Chuck Lever511ba522019-11-05 11:04:07 -0500613
614TRACE_EVENT(nfs4_state_mgr,
615 TP_PROTO(
616 const struct nfs_client *clp
617 ),
618
619 TP_ARGS(clp),
620
621 TP_STRUCT__entry(
622 __field(unsigned long, state)
623 __string(hostname, clp->cl_hostname)
624 ),
625
626 TP_fast_assign(
627 __entry->state = clp->cl_state;
628 __assign_str(hostname, clp->cl_hostname)
629 ),
630
631 TP_printk(
632 "hostname=%s clp state=%s", __get_str(hostname),
633 show_nfs4_clp_state(__entry->state)
634 )
635)
636
637TRACE_EVENT(nfs4_state_mgr_failed,
638 TP_PROTO(
639 const struct nfs_client *clp,
640 const char *section,
641 int status
642 ),
643
644 TP_ARGS(clp, section, status),
645
646 TP_STRUCT__entry(
647 __field(unsigned long, error)
648 __field(unsigned long, state)
649 __string(hostname, clp->cl_hostname)
650 __string(section, section)
651 ),
652
653 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -0500654 __entry->error = status < 0 ? -status : 0;
Chuck Lever511ba522019-11-05 11:04:07 -0500655 __entry->state = clp->cl_state;
656 __assign_str(hostname, clp->cl_hostname);
657 __assign_str(section, section);
658 ),
659
660 TP_printk(
661 "hostname=%s clp state=%s error=%ld (%s) section=%s",
662 __get_str(hostname),
663 show_nfs4_clp_state(__entry->state), -__entry->error,
664 show_nfsv4_errors(__entry->error), __get_str(section)
665
666 )
667)
668
Chuck Leverf23f6582019-02-11 11:24:26 -0500669TRACE_EVENT(nfs4_xdr_status,
670 TP_PROTO(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400671 const struct xdr_stream *xdr,
Chuck Leverf23f6582019-02-11 11:24:26 -0500672 u32 op,
Trond Myklebust118b6292020-01-06 15:25:06 -0500673 u32 error
Chuck Leverf23f6582019-02-11 11:24:26 -0500674 ),
675
Chuck Lever62a92ba2019-06-19 10:34:09 -0400676 TP_ARGS(xdr, op, error),
Chuck Leverf23f6582019-02-11 11:24:26 -0500677
678 TP_STRUCT__entry(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400679 __field(unsigned int, task_id)
680 __field(unsigned int, client_id)
681 __field(u32, xid)
Chuck Leverf23f6582019-02-11 11:24:26 -0500682 __field(u32, op)
Chuck Lever96650e22019-06-19 10:33:53 -0400683 __field(unsigned long, error)
Chuck Leverf23f6582019-02-11 11:24:26 -0500684 ),
685
686 TP_fast_assign(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400687 const struct rpc_rqst *rqstp = xdr->rqst;
688 const struct rpc_task *task = rqstp->rq_task;
689
690 __entry->task_id = task->tk_pid;
691 __entry->client_id = task->tk_client->cl_clid;
692 __entry->xid = be32_to_cpu(rqstp->rq_xid);
Chuck Leverf23f6582019-02-11 11:24:26 -0500693 __entry->op = op;
Chuck Lever96650e22019-06-19 10:33:53 -0400694 __entry->error = error;
Chuck Leverf23f6582019-02-11 11:24:26 -0500695 ),
696
697 TP_printk(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400698 "task:%u@%d xid=0x%08x error=%ld (%s) operation=%u",
699 __entry->task_id, __entry->client_id, __entry->xid,
Chuck Lever96650e22019-06-19 10:33:53 -0400700 -__entry->error, show_nfsv4_errors(__entry->error),
701 __entry->op
Chuck Leverf23f6582019-02-11 11:24:26 -0500702 )
703);
704
Chuck Lever2bb50aa2019-12-23 10:28:38 -0500705DECLARE_EVENT_CLASS(nfs4_cb_error_class,
706 TP_PROTO(
707 __be32 xid,
708 u32 cb_ident
709 ),
710
711 TP_ARGS(xid, cb_ident),
712
713 TP_STRUCT__entry(
714 __field(u32, xid)
715 __field(u32, cbident)
716 ),
717
718 TP_fast_assign(
719 __entry->xid = be32_to_cpu(xid);
720 __entry->cbident = cb_ident;
721 ),
722
723 TP_printk(
724 "xid=0x%08x cb_ident=0x%08x",
725 __entry->xid, __entry->cbident
726 )
727);
728
729#define DEFINE_CB_ERROR_EVENT(name) \
730 DEFINE_EVENT(nfs4_cb_error_class, nfs_cb_##name, \
731 TP_PROTO( \
732 __be32 xid, \
733 u32 cb_ident \
734 ), \
735 TP_ARGS(xid, cb_ident))
736
737DEFINE_CB_ERROR_EVENT(no_clp);
738DEFINE_CB_ERROR_EVENT(badprinc);
739
Trond Myklebust42113a72013-08-12 16:19:27 -0400740DECLARE_EVENT_CLASS(nfs4_open_event,
741 TP_PROTO(
742 const struct nfs_open_context *ctx,
743 int flags,
744 int error
745 ),
746
747 TP_ARGS(ctx, flags, error),
748
749 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400750 __field(unsigned long, error)
Trond Myklebust42113a72013-08-12 16:19:27 -0400751 __field(unsigned int, flags)
752 __field(unsigned int, fmode)
753 __field(dev_t, dev)
754 __field(u32, fhandle)
755 __field(u64, fileid)
756 __field(u64, dir)
757 __string(name, ctx->dentry->d_name.name)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500758 __field(int, stateid_seq)
759 __field(u32, stateid_hash)
760 __field(int, openstateid_seq)
761 __field(u32, openstateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400762 ),
763
764 TP_fast_assign(
765 const struct nfs4_state *state = ctx->state;
766 const struct inode *inode = NULL;
767
Chuck Lever96650e22019-06-19 10:33:53 -0400768 __entry->error = -error;
Trond Myklebust42113a72013-08-12 16:19:27 -0400769 __entry->flags = flags;
770 __entry->fmode = (__force unsigned int)ctx->mode;
771 __entry->dev = ctx->dentry->d_sb->s_dev;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500772 if (!IS_ERR_OR_NULL(state)) {
Trond Myklebust42113a72013-08-12 16:19:27 -0400773 inode = state->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500774 __entry->stateid_seq =
775 be32_to_cpu(state->stateid.seqid);
776 __entry->stateid_hash =
777 nfs_stateid_hash(&state->stateid);
778 __entry->openstateid_seq =
779 be32_to_cpu(state->open_stateid.seqid);
780 __entry->openstateid_hash =
781 nfs_stateid_hash(&state->open_stateid);
782 } else {
783 __entry->stateid_seq = 0;
784 __entry->stateid_hash = 0;
785 __entry->openstateid_seq = 0;
786 __entry->openstateid_hash = 0;
787 }
Trond Myklebust42113a72013-08-12 16:19:27 -0400788 if (inode != NULL) {
789 __entry->fileid = NFS_FILEID(inode);
790 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
791 } else {
792 __entry->fileid = 0;
793 __entry->fhandle = 0;
794 }
David Howells2b0143b2015-03-17 22:25:59 +0000795 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
Trond Myklebust42113a72013-08-12 16:19:27 -0400796 __assign_str(name, ctx->dentry->d_name.name);
797 ),
798
799 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400800 "error=%ld (%s) flags=%d (%s) fmode=%s "
Trond Myklebust42113a72013-08-12 16:19:27 -0400801 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500802 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
803 "openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400804 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400805 show_nfsv4_errors(__entry->error),
806 __entry->flags,
807 show_open_flags(__entry->flags),
808 show_fmode_flags(__entry->fmode),
809 MAJOR(__entry->dev), MINOR(__entry->dev),
810 (unsigned long long)__entry->fileid,
811 __entry->fhandle,
812 MAJOR(__entry->dev), MINOR(__entry->dev),
813 (unsigned long long)__entry->dir,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500814 __get_str(name),
815 __entry->stateid_seq, __entry->stateid_hash,
816 __entry->openstateid_seq, __entry->openstateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400817 )
818);
819
820#define DEFINE_NFS4_OPEN_EVENT(name) \
821 DEFINE_EVENT(nfs4_open_event, name, \
822 TP_PROTO( \
823 const struct nfs_open_context *ctx, \
824 int flags, \
825 int error \
826 ), \
827 TP_ARGS(ctx, flags, error))
828DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
829DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
830DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
831
Olga Kornievskaia9759b0f2015-11-24 13:29:42 -0500832TRACE_EVENT(nfs4_cached_open,
833 TP_PROTO(
834 const struct nfs4_state *state
835 ),
836 TP_ARGS(state),
837 TP_STRUCT__entry(
838 __field(dev_t, dev)
839 __field(u32, fhandle)
840 __field(u64, fileid)
841 __field(unsigned int, fmode)
842 __field(int, stateid_seq)
843 __field(u32, stateid_hash)
844 ),
845
846 TP_fast_assign(
847 const struct inode *inode = state->inode;
848
849 __entry->dev = inode->i_sb->s_dev;
850 __entry->fileid = NFS_FILEID(inode);
851 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
852 __entry->fmode = (__force unsigned int)state->state;
853 __entry->stateid_seq =
854 be32_to_cpu(state->stateid.seqid);
855 __entry->stateid_hash =
856 nfs_stateid_hash(&state->stateid);
857 ),
858
859 TP_printk(
860 "fmode=%s fileid=%02x:%02x:%llu "
861 "fhandle=0x%08x stateid=%d:0x%08x",
862 __entry->fmode ? show_fmode_flags(__entry->fmode) :
863 "closed",
864 MAJOR(__entry->dev), MINOR(__entry->dev),
865 (unsigned long long)__entry->fileid,
866 __entry->fhandle,
867 __entry->stateid_seq, __entry->stateid_hash
868 )
869);
870
Trond Myklebust42113a72013-08-12 16:19:27 -0400871TRACE_EVENT(nfs4_close,
872 TP_PROTO(
873 const struct nfs4_state *state,
874 const struct nfs_closeargs *args,
875 const struct nfs_closeres *res,
876 int error
877 ),
878
879 TP_ARGS(state, args, res, error),
880
881 TP_STRUCT__entry(
882 __field(dev_t, dev)
883 __field(u32, fhandle)
884 __field(u64, fileid)
885 __field(unsigned int, fmode)
Chuck Lever96650e22019-06-19 10:33:53 -0400886 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500887 __field(int, stateid_seq)
888 __field(u32, stateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400889 ),
890
891 TP_fast_assign(
892 const struct inode *inode = state->inode;
893
894 __entry->dev = inode->i_sb->s_dev;
895 __entry->fileid = NFS_FILEID(inode);
896 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
897 __entry->fmode = (__force unsigned int)state->state;
Trond Myklebust118b6292020-01-06 15:25:06 -0500898 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500899 __entry->stateid_seq =
900 be32_to_cpu(args->stateid.seqid);
901 __entry->stateid_hash =
902 nfs_stateid_hash(&args->stateid);
Trond Myklebust42113a72013-08-12 16:19:27 -0400903 ),
904
905 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400906 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500907 "fhandle=0x%08x openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400908 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400909 show_nfsv4_errors(__entry->error),
910 __entry->fmode ? show_fmode_flags(__entry->fmode) :
911 "closed",
912 MAJOR(__entry->dev), MINOR(__entry->dev),
913 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500914 __entry->fhandle,
915 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400916 )
917);
918
Chuck Lever5b2095d2018-12-19 11:00:11 -0500919TRACE_DEFINE_ENUM(F_GETLK);
920TRACE_DEFINE_ENUM(F_SETLK);
921TRACE_DEFINE_ENUM(F_SETLKW);
922TRACE_DEFINE_ENUM(F_RDLCK);
923TRACE_DEFINE_ENUM(F_WRLCK);
924TRACE_DEFINE_ENUM(F_UNLCK);
925
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400926#define show_lock_cmd(type) \
927 __print_symbolic((int)type, \
928 { F_GETLK, "GETLK" }, \
929 { F_SETLK, "SETLK" }, \
930 { F_SETLKW, "SETLKW" })
931#define show_lock_type(type) \
932 __print_symbolic((int)type, \
933 { F_RDLCK, "RDLCK" }, \
934 { F_WRLCK, "WRLCK" }, \
935 { F_UNLCK, "UNLCK" })
936
937DECLARE_EVENT_CLASS(nfs4_lock_event,
938 TP_PROTO(
939 const struct file_lock *request,
940 const struct nfs4_state *state,
941 int cmd,
942 int error
943 ),
944
945 TP_ARGS(request, state, cmd, error),
946
947 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400948 __field(unsigned long, error)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400949 __field(int, cmd)
950 __field(char, type)
951 __field(loff_t, start)
952 __field(loff_t, end)
953 __field(dev_t, dev)
954 __field(u32, fhandle)
955 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500956 __field(int, stateid_seq)
957 __field(u32, stateid_hash)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400958 ),
959
960 TP_fast_assign(
961 const struct inode *inode = state->inode;
962
Trond Myklebust118b6292020-01-06 15:25:06 -0500963 __entry->error = error < 0 ? -error : 0;
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400964 __entry->cmd = cmd;
965 __entry->type = request->fl_type;
966 __entry->start = request->fl_start;
967 __entry->end = request->fl_end;
968 __entry->dev = inode->i_sb->s_dev;
969 __entry->fileid = NFS_FILEID(inode);
970 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500971 __entry->stateid_seq =
972 be32_to_cpu(state->stateid.seqid);
973 __entry->stateid_hash =
974 nfs_stateid_hash(&state->stateid);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400975 ),
976
977 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400978 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500979 "fileid=%02x:%02x:%llu fhandle=0x%08x "
980 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400981 -__entry->error,
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400982 show_nfsv4_errors(__entry->error),
983 show_lock_cmd(__entry->cmd),
984 show_lock_type(__entry->type),
985 (long long)__entry->start,
986 (long long)__entry->end,
987 MAJOR(__entry->dev), MINOR(__entry->dev),
988 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500989 __entry->fhandle,
990 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400991 )
992);
993
994#define DEFINE_NFS4_LOCK_EVENT(name) \
995 DEFINE_EVENT(nfs4_lock_event, name, \
996 TP_PROTO( \
997 const struct file_lock *request, \
998 const struct nfs4_state *state, \
999 int cmd, \
1000 int error \
1001 ), \
1002 TP_ARGS(request, state, cmd, error))
1003DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
Trond Myklebustd1b748a2013-08-12 16:35:20 -04001004DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
1005
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001006TRACE_EVENT(nfs4_set_lock,
1007 TP_PROTO(
1008 const struct file_lock *request,
1009 const struct nfs4_state *state,
1010 const nfs4_stateid *lockstateid,
1011 int cmd,
1012 int error
1013 ),
1014
1015 TP_ARGS(request, state, lockstateid, cmd, error),
1016
1017 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001018 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001019 __field(int, cmd)
1020 __field(char, type)
1021 __field(loff_t, start)
1022 __field(loff_t, end)
1023 __field(dev_t, dev)
1024 __field(u32, fhandle)
1025 __field(u64, fileid)
1026 __field(int, stateid_seq)
1027 __field(u32, stateid_hash)
1028 __field(int, lockstateid_seq)
1029 __field(u32, lockstateid_hash)
1030 ),
1031
1032 TP_fast_assign(
1033 const struct inode *inode = state->inode;
1034
Trond Myklebust118b6292020-01-06 15:25:06 -05001035 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001036 __entry->cmd = cmd;
1037 __entry->type = request->fl_type;
1038 __entry->start = request->fl_start;
1039 __entry->end = request->fl_end;
1040 __entry->dev = inode->i_sb->s_dev;
1041 __entry->fileid = NFS_FILEID(inode);
1042 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1043 __entry->stateid_seq =
1044 be32_to_cpu(state->stateid.seqid);
1045 __entry->stateid_hash =
1046 nfs_stateid_hash(&state->stateid);
1047 __entry->lockstateid_seq =
1048 be32_to_cpu(lockstateid->seqid);
1049 __entry->lockstateid_hash =
1050 nfs_stateid_hash(lockstateid);
1051 ),
1052
1053 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001054 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001055 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1056 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001057 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001058 show_nfsv4_errors(__entry->error),
1059 show_lock_cmd(__entry->cmd),
1060 show_lock_type(__entry->type),
1061 (long long)__entry->start,
1062 (long long)__entry->end,
1063 MAJOR(__entry->dev), MINOR(__entry->dev),
1064 (unsigned long long)__entry->fileid,
1065 __entry->fhandle,
1066 __entry->stateid_seq, __entry->stateid_hash,
1067 __entry->lockstateid_seq, __entry->lockstateid_hash
1068 )
1069);
1070
Chuck Lever21f86d22019-11-05 11:04:13 -05001071TRACE_DEFINE_ENUM(LK_STATE_IN_USE);
1072TRACE_DEFINE_ENUM(NFS_DELEGATED_STATE);
1073TRACE_DEFINE_ENUM(NFS_OPEN_STATE);
1074TRACE_DEFINE_ENUM(NFS_O_RDONLY_STATE);
1075TRACE_DEFINE_ENUM(NFS_O_WRONLY_STATE);
1076TRACE_DEFINE_ENUM(NFS_O_RDWR_STATE);
1077TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_REBOOT);
1078TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_NOGRACE);
1079TRACE_DEFINE_ENUM(NFS_STATE_POSIX_LOCKS);
1080TRACE_DEFINE_ENUM(NFS_STATE_RECOVERY_FAILED);
1081TRACE_DEFINE_ENUM(NFS_STATE_MAY_NOTIFY_LOCK);
1082TRACE_DEFINE_ENUM(NFS_STATE_CHANGE_WAIT);
1083TRACE_DEFINE_ENUM(NFS_CLNT_DST_SSC_COPY_STATE);
1084TRACE_DEFINE_ENUM(NFS_CLNT_SRC_SSC_COPY_STATE);
1085TRACE_DEFINE_ENUM(NFS_SRV_SSC_COPY_STATE);
1086
1087#define show_nfs4_state_flags(flags) \
1088 __print_flags(flags, "|", \
1089 { LK_STATE_IN_USE, "IN_USE" }, \
1090 { NFS_DELEGATED_STATE, "DELEGATED" }, \
1091 { NFS_OPEN_STATE, "OPEN" }, \
1092 { NFS_O_RDONLY_STATE, "O_RDONLY" }, \
1093 { NFS_O_WRONLY_STATE, "O_WRONLY" }, \
1094 { NFS_O_RDWR_STATE, "O_RDWR" }, \
1095 { NFS_STATE_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
1096 { NFS_STATE_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
1097 { NFS_STATE_POSIX_LOCKS, "POSIX_LOCKS" }, \
1098 { NFS_STATE_RECOVERY_FAILED, "RECOVERY_FAILED" }, \
1099 { NFS_STATE_MAY_NOTIFY_LOCK, "MAY_NOTIFY_LOCK" }, \
1100 { NFS_STATE_CHANGE_WAIT, "CHANGE_WAIT" }, \
1101 { NFS_CLNT_DST_SSC_COPY_STATE, "CLNT_DST_SSC_COPY" }, \
1102 { NFS_CLNT_SRC_SSC_COPY_STATE, "CLNT_SRC_SSC_COPY" }, \
1103 { NFS_SRV_SSC_COPY_STATE, "SRV_SSC_COPY" })
1104
1105#define show_nfs4_lock_flags(flags) \
1106 __print_flags(flags, "|", \
1107 { BIT(NFS_LOCK_INITIALIZED), "INITIALIZED" }, \
1108 { BIT(NFS_LOCK_LOST), "LOST" })
1109
1110TRACE_EVENT(nfs4_state_lock_reclaim,
1111 TP_PROTO(
1112 const struct nfs4_state *state,
1113 const struct nfs4_lock_state *lock
1114 ),
1115
1116 TP_ARGS(state, lock),
1117
1118 TP_STRUCT__entry(
1119 __field(dev_t, dev)
1120 __field(u32, fhandle)
1121 __field(u64, fileid)
1122 __field(unsigned long, state_flags)
1123 __field(unsigned long, lock_flags)
1124 __field(int, stateid_seq)
1125 __field(u32, stateid_hash)
1126 ),
1127
1128 TP_fast_assign(
1129 const struct inode *inode = state->inode;
1130
1131 __entry->dev = inode->i_sb->s_dev;
1132 __entry->fileid = NFS_FILEID(inode);
1133 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1134 __entry->state_flags = state->flags;
1135 __entry->lock_flags = lock->ls_flags;
1136 __entry->stateid_seq =
1137 be32_to_cpu(state->stateid.seqid);
1138 __entry->stateid_hash =
1139 nfs_stateid_hash(&state->stateid);
1140 ),
1141
1142 TP_printk(
1143 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1144 "stateid=%d:0x%08x state_flags=%s lock_flags=%s",
1145 MAJOR(__entry->dev), MINOR(__entry->dev),
1146 (unsigned long long)__entry->fileid, __entry->fhandle,
1147 __entry->stateid_seq, __entry->stateid_hash,
1148 show_nfs4_state_flags(__entry->state_flags),
1149 show_nfs4_lock_flags(__entry->lock_flags)
1150 )
1151)
1152
Trond Myklebustca8acf82013-08-13 10:36:56 -04001153DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
1154 TP_PROTO(
1155 const struct inode *inode,
1156 fmode_t fmode
1157 ),
1158
1159 TP_ARGS(inode, fmode),
1160
1161 TP_STRUCT__entry(
1162 __field(dev_t, dev)
1163 __field(u32, fhandle)
1164 __field(u64, fileid)
1165 __field(unsigned int, fmode)
1166 ),
1167
1168 TP_fast_assign(
1169 __entry->dev = inode->i_sb->s_dev;
1170 __entry->fileid = NFS_FILEID(inode);
1171 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1172 __entry->fmode = (__force unsigned int)fmode;
1173 ),
1174
1175 TP_printk(
1176 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
1177 show_fmode_flags(__entry->fmode),
1178 MAJOR(__entry->dev), MINOR(__entry->dev),
1179 (unsigned long long)__entry->fileid,
1180 __entry->fhandle
1181 )
1182);
1183#define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
1184 DEFINE_EVENT(nfs4_set_delegation_event, name, \
1185 TP_PROTO( \
1186 const struct inode *inode, \
1187 fmode_t fmode \
1188 ), \
1189 TP_ARGS(inode, fmode))
1190DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
1191DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
1192
1193TRACE_EVENT(nfs4_delegreturn_exit,
1194 TP_PROTO(
1195 const struct nfs4_delegreturnargs *args,
1196 const struct nfs4_delegreturnres *res,
1197 int error
1198 ),
1199
1200 TP_ARGS(args, res, error),
1201
1202 TP_STRUCT__entry(
1203 __field(dev_t, dev)
1204 __field(u32, fhandle)
Chuck Lever96650e22019-06-19 10:33:53 -04001205 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001206 __field(int, stateid_seq)
1207 __field(u32, stateid_hash)
Trond Myklebustca8acf82013-08-13 10:36:56 -04001208 ),
1209
1210 TP_fast_assign(
1211 __entry->dev = res->server->s_dev;
1212 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
Trond Myklebust118b6292020-01-06 15:25:06 -05001213 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001214 __entry->stateid_seq =
1215 be32_to_cpu(args->stateid->seqid);
1216 __entry->stateid_hash =
1217 nfs_stateid_hash(args->stateid);
Trond Myklebustca8acf82013-08-13 10:36:56 -04001218 ),
1219
1220 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001221 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001222 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001223 -__entry->error,
Trond Myklebustca8acf82013-08-13 10:36:56 -04001224 show_nfsv4_errors(__entry->error),
1225 MAJOR(__entry->dev), MINOR(__entry->dev),
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001226 __entry->fhandle,
1227 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustca8acf82013-08-13 10:36:56 -04001228 )
1229);
1230
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001231#ifdef CONFIG_NFS_V4_1
1232DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
1233 TP_PROTO(
1234 const struct nfs4_state *state,
1235 const struct nfs4_lock_state *lsp,
1236 int error
1237 ),
1238
1239 TP_ARGS(state, lsp, error),
1240
1241 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001242 __field(unsigned long, error)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001243 __field(dev_t, dev)
1244 __field(u32, fhandle)
1245 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001246 __field(int, stateid_seq)
1247 __field(u32, stateid_hash)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001248 ),
1249
1250 TP_fast_assign(
1251 const struct inode *inode = state->inode;
1252
Trond Myklebust118b6292020-01-06 15:25:06 -05001253 __entry->error = error < 0 ? -error : 0;
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001254 __entry->dev = inode->i_sb->s_dev;
1255 __entry->fileid = NFS_FILEID(inode);
1256 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001257 __entry->stateid_seq =
1258 be32_to_cpu(state->stateid.seqid);
1259 __entry->stateid_hash =
1260 nfs_stateid_hash(&state->stateid);
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001261 ),
1262
1263 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001264 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001265 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001266 -__entry->error,
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001267 show_nfsv4_errors(__entry->error),
1268 MAJOR(__entry->dev), MINOR(__entry->dev),
1269 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001270 __entry->fhandle,
1271 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001272 )
1273);
1274
1275#define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
1276 DEFINE_EVENT(nfs4_test_stateid_event, name, \
1277 TP_PROTO( \
1278 const struct nfs4_state *state, \
1279 const struct nfs4_lock_state *lsp, \
1280 int error \
1281 ), \
1282 TP_ARGS(state, lsp, error))
1283DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
1284DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
1285DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
1286#endif /* CONFIG_NFS_V4_1 */
1287
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001288DECLARE_EVENT_CLASS(nfs4_lookup_event,
1289 TP_PROTO(
1290 const struct inode *dir,
1291 const struct qstr *name,
1292 int error
1293 ),
1294
1295 TP_ARGS(dir, name, error),
1296
1297 TP_STRUCT__entry(
1298 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001299 __field(unsigned long, error)
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001300 __field(u64, dir)
1301 __string(name, name->name)
1302 ),
1303
1304 TP_fast_assign(
1305 __entry->dev = dir->i_sb->s_dev;
1306 __entry->dir = NFS_FILEID(dir);
Chuck Lever96650e22019-06-19 10:33:53 -04001307 __entry->error = -error;
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001308 __assign_str(name, name->name);
1309 ),
1310
1311 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001312 "error=%ld (%s) name=%02x:%02x:%llu/%s",
1313 -__entry->error,
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001314 show_nfsv4_errors(__entry->error),
1315 MAJOR(__entry->dev), MINOR(__entry->dev),
1316 (unsigned long long)__entry->dir,
1317 __get_str(name)
1318 )
1319);
1320
1321#define DEFINE_NFS4_LOOKUP_EVENT(name) \
1322 DEFINE_EVENT(nfs4_lookup_event, name, \
1323 TP_PROTO( \
1324 const struct inode *dir, \
1325 const struct qstr *name, \
1326 int error \
1327 ), \
1328 TP_ARGS(dir, name, error))
1329
1330DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
1331DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
1332DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
1333DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
1334DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
1335DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
1336DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
1337
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001338TRACE_EVENT(nfs4_lookupp,
1339 TP_PROTO(
1340 const struct inode *inode,
1341 int error
1342 ),
1343
1344 TP_ARGS(inode, error),
1345
1346 TP_STRUCT__entry(
1347 __field(dev_t, dev)
1348 __field(u64, ino)
Chuck Lever96650e22019-06-19 10:33:53 -04001349 __field(unsigned long, error)
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001350 ),
1351
1352 TP_fast_assign(
1353 __entry->dev = inode->i_sb->s_dev;
1354 __entry->ino = NFS_FILEID(inode);
Trond Myklebust118b6292020-01-06 15:25:06 -05001355 __entry->error = error < 0 ? -error : 0;
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001356 ),
1357
1358 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001359 "error=%ld (%s) inode=%02x:%02x:%llu",
1360 -__entry->error,
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001361 show_nfsv4_errors(__entry->error),
1362 MAJOR(__entry->dev), MINOR(__entry->dev),
1363 (unsigned long long)__entry->ino
1364 )
1365);
1366
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001367TRACE_EVENT(nfs4_rename,
1368 TP_PROTO(
1369 const struct inode *olddir,
1370 const struct qstr *oldname,
1371 const struct inode *newdir,
1372 const struct qstr *newname,
1373 int error
1374 ),
1375
1376 TP_ARGS(olddir, oldname, newdir, newname, error),
1377
1378 TP_STRUCT__entry(
1379 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001380 __field(unsigned long, error)
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001381 __field(u64, olddir)
1382 __string(oldname, oldname->name)
1383 __field(u64, newdir)
1384 __string(newname, newname->name)
1385 ),
1386
1387 TP_fast_assign(
1388 __entry->dev = olddir->i_sb->s_dev;
1389 __entry->olddir = NFS_FILEID(olddir);
1390 __entry->newdir = NFS_FILEID(newdir);
Trond Myklebust118b6292020-01-06 15:25:06 -05001391 __entry->error = error < 0 ? -error : 0;
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001392 __assign_str(oldname, oldname->name);
1393 __assign_str(newname, newname->name);
1394 ),
1395
1396 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001397 "error=%ld (%s) oldname=%02x:%02x:%llu/%s "
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001398 "newname=%02x:%02x:%llu/%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001399 -__entry->error,
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001400 show_nfsv4_errors(__entry->error),
1401 MAJOR(__entry->dev), MINOR(__entry->dev),
1402 (unsigned long long)__entry->olddir,
1403 __get_str(oldname),
1404 MAJOR(__entry->dev), MINOR(__entry->dev),
1405 (unsigned long long)__entry->newdir,
1406 __get_str(newname)
1407 )
1408);
1409
Trond Myklebustc1578b72013-08-12 16:58:42 -04001410DECLARE_EVENT_CLASS(nfs4_inode_event,
1411 TP_PROTO(
1412 const struct inode *inode,
1413 int error
1414 ),
1415
1416 TP_ARGS(inode, error),
1417
1418 TP_STRUCT__entry(
1419 __field(dev_t, dev)
1420 __field(u32, fhandle)
1421 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001422 __field(unsigned long, error)
Trond Myklebustc1578b72013-08-12 16:58:42 -04001423 ),
1424
1425 TP_fast_assign(
1426 __entry->dev = inode->i_sb->s_dev;
1427 __entry->fileid = NFS_FILEID(inode);
1428 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Chuck Lever96650e22019-06-19 10:33:53 -04001429 __entry->error = error < 0 ? -error : 0;
Trond Myklebustc1578b72013-08-12 16:58:42 -04001430 ),
1431
1432 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001433 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
1434 -__entry->error,
Trond Myklebustc1578b72013-08-12 16:58:42 -04001435 show_nfsv4_errors(__entry->error),
1436 MAJOR(__entry->dev), MINOR(__entry->dev),
1437 (unsigned long long)__entry->fileid,
1438 __entry->fhandle
1439 )
1440);
1441
1442#define DEFINE_NFS4_INODE_EVENT(name) \
1443 DEFINE_EVENT(nfs4_inode_event, name, \
1444 TP_PROTO( \
1445 const struct inode *inode, \
1446 int error \
1447 ), \
1448 TP_ARGS(inode, error))
1449
Trond Myklebustc1578b72013-08-12 16:58:42 -04001450DEFINE_NFS4_INODE_EVENT(nfs4_access);
1451DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
1452DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
1453DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
1454DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
1455#ifdef CONFIG_NFS_V4_SECURITY_LABEL
1456DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
1457DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
1458#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001459
1460DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
1461 TP_PROTO(
1462 const struct inode *inode,
1463 const nfs4_stateid *stateid,
1464 int error
1465 ),
1466
1467 TP_ARGS(inode, stateid, error),
1468
1469 TP_STRUCT__entry(
1470 __field(dev_t, dev)
1471 __field(u32, fhandle)
1472 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001473 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001474 __field(int, stateid_seq)
1475 __field(u32, stateid_hash)
1476 ),
1477
1478 TP_fast_assign(
1479 __entry->dev = inode->i_sb->s_dev;
1480 __entry->fileid = NFS_FILEID(inode);
1481 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Trond Myklebust118b6292020-01-06 15:25:06 -05001482 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001483 __entry->stateid_seq =
1484 be32_to_cpu(stateid->seqid);
1485 __entry->stateid_hash =
1486 nfs_stateid_hash(stateid);
1487 ),
1488
1489 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001490 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001491 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001492 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001493 show_nfsv4_errors(__entry->error),
1494 MAJOR(__entry->dev), MINOR(__entry->dev),
1495 (unsigned long long)__entry->fileid,
1496 __entry->fhandle,
1497 __entry->stateid_seq, __entry->stateid_hash
1498 )
1499);
1500
1501#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1502 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1503 TP_PROTO( \
1504 const struct inode *inode, \
1505 const nfs4_stateid *stateid, \
1506 int error \
1507 ), \
1508 TP_ARGS(inode, stateid, error))
1509
1510DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1511DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
Trond Myklebustad9e02d2017-11-06 15:28:02 -05001512DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
1513DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
Benjamin Coddingtonb4868b42020-09-25 15:48:39 -04001514DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_close_stateid_update_wait);
Trond Myklebustc1578b72013-08-12 16:58:42 -04001515
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001516DECLARE_EVENT_CLASS(nfs4_getattr_event,
1517 TP_PROTO(
1518 const struct nfs_server *server,
1519 const struct nfs_fh *fhandle,
1520 const struct nfs_fattr *fattr,
1521 int error
1522 ),
1523
1524 TP_ARGS(server, fhandle, fattr, error),
1525
1526 TP_STRUCT__entry(
1527 __field(dev_t, dev)
1528 __field(u32, fhandle)
1529 __field(u64, fileid)
1530 __field(unsigned int, valid)
Chuck Lever96650e22019-06-19 10:33:53 -04001531 __field(unsigned long, error)
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001532 ),
1533
1534 TP_fast_assign(
1535 __entry->dev = server->s_dev;
1536 __entry->valid = fattr->valid;
1537 __entry->fhandle = nfs_fhandle_hash(fhandle);
1538 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
Trond Myklebust118b6292020-01-06 15:25:06 -05001539 __entry->error = error < 0 ? -error : 0;
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001540 ),
1541
1542 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001543 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001544 "valid=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001545 -__entry->error,
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001546 show_nfsv4_errors(__entry->error),
1547 MAJOR(__entry->dev), MINOR(__entry->dev),
1548 (unsigned long long)__entry->fileid,
1549 __entry->fhandle,
1550 show_nfs_fattr_flags(__entry->valid)
1551 )
1552);
1553
1554#define DEFINE_NFS4_GETATTR_EVENT(name) \
1555 DEFINE_EVENT(nfs4_getattr_event, name, \
1556 TP_PROTO( \
1557 const struct nfs_server *server, \
1558 const struct nfs_fh *fhandle, \
1559 const struct nfs_fattr *fattr, \
1560 int error \
1561 ), \
1562 TP_ARGS(server, fhandle, fattr, error))
1563DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1564DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1565DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1566
Trond Myklebust7cd14862015-08-20 20:07:54 -05001567DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1568 TP_PROTO(
1569 const struct nfs_client *clp,
1570 const struct nfs_fh *fhandle,
1571 const struct inode *inode,
1572 int error
1573 ),
1574
1575 TP_ARGS(clp, fhandle, inode, error),
1576
1577 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001578 __field(unsigned long, error)
Trond Myklebust7cd14862015-08-20 20:07:54 -05001579 __field(dev_t, dev)
1580 __field(u32, fhandle)
1581 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001582 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001583 ),
1584
1585 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -05001586 __entry->error = error < 0 ? -error : 0;
Trond Myklebust7cd14862015-08-20 20:07:54 -05001587 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2edaead2018-09-05 14:07:13 -04001588 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebust7cd14862015-08-20 20:07:54 -05001589 __entry->fileid = NFS_FILEID(inode);
1590 __entry->dev = inode->i_sb->s_dev;
1591 } else {
1592 __entry->fileid = 0;
1593 __entry->dev = 0;
1594 }
Anna Schumaker39443692017-11-01 15:48:43 -04001595 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001596 ),
1597
1598 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001599 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust7cd14862015-08-20 20:07:54 -05001600 "dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001601 -__entry->error,
Trond Myklebust7cd14862015-08-20 20:07:54 -05001602 show_nfsv4_errors(__entry->error),
1603 MAJOR(__entry->dev), MINOR(__entry->dev),
1604 (unsigned long long)__entry->fileid,
1605 __entry->fhandle,
1606 __get_str(dstaddr)
1607 )
1608);
1609
1610#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1611 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1612 TP_PROTO( \
1613 const struct nfs_client *clp, \
1614 const struct nfs_fh *fhandle, \
1615 const struct inode *inode, \
1616 int error \
1617 ), \
1618 TP_ARGS(clp, fhandle, inode, error))
1619DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1620
Trond Myklebuste07db902015-12-28 14:07:23 -05001621DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1622 TP_PROTO(
1623 const struct nfs_client *clp,
1624 const struct nfs_fh *fhandle,
1625 const struct inode *inode,
1626 const nfs4_stateid *stateid,
1627 int error
1628 ),
1629
1630 TP_ARGS(clp, fhandle, inode, stateid, error),
1631
1632 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001633 __field(unsigned long, error)
Trond Myklebuste07db902015-12-28 14:07:23 -05001634 __field(dev_t, dev)
1635 __field(u32, fhandle)
1636 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001637 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001638 __field(int, stateid_seq)
1639 __field(u32, stateid_hash)
1640 ),
1641
1642 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -05001643 __entry->error = error < 0 ? -error : 0;
Trond Myklebuste07db902015-12-28 14:07:23 -05001644 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2a534a72018-08-23 11:02:49 -04001645 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebuste07db902015-12-28 14:07:23 -05001646 __entry->fileid = NFS_FILEID(inode);
1647 __entry->dev = inode->i_sb->s_dev;
1648 } else {
1649 __entry->fileid = 0;
1650 __entry->dev = 0;
1651 }
Anna Schumaker39443692017-11-01 15:48:43 -04001652 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001653 __entry->stateid_seq =
1654 be32_to_cpu(stateid->seqid);
1655 __entry->stateid_hash =
1656 nfs_stateid_hash(stateid);
1657 ),
1658
1659 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001660 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebuste07db902015-12-28 14:07:23 -05001661 "stateid=%d:0x%08x dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001662 -__entry->error,
Trond Myklebuste07db902015-12-28 14:07:23 -05001663 show_nfsv4_errors(__entry->error),
1664 MAJOR(__entry->dev), MINOR(__entry->dev),
1665 (unsigned long long)__entry->fileid,
1666 __entry->fhandle,
1667 __entry->stateid_seq, __entry->stateid_hash,
1668 __get_str(dstaddr)
1669 )
1670);
1671
1672#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1673 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1674 TP_PROTO( \
1675 const struct nfs_client *clp, \
1676 const struct nfs_fh *fhandle, \
1677 const struct inode *inode, \
1678 const nfs4_stateid *stateid, \
1679 int error \
1680 ), \
1681 TP_ARGS(clp, fhandle, inode, stateid, error))
1682DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1683DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
Trond Myklebust7cd14862015-08-20 20:07:54 -05001684
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001685DECLARE_EVENT_CLASS(nfs4_idmap_event,
1686 TP_PROTO(
1687 const char *name,
1688 int len,
1689 u32 id,
1690 int error
1691 ),
1692
1693 TP_ARGS(name, len, id, error),
1694
1695 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001696 __field(unsigned long, error)
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001697 __field(u32, id)
1698 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1699 ),
1700
1701 TP_fast_assign(
1702 if (len < 0)
1703 len = 0;
1704 __entry->error = error < 0 ? error : 0;
1705 __entry->id = id;
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -03001706 memcpy(__get_str(name), name, len);
1707 __get_str(name)[len] = 0;
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001708 ),
1709
1710 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001711 "error=%ld (%s) id=%u name=%s",
1712 -__entry->error, show_nfsv4_errors(__entry->error),
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001713 __entry->id,
1714 __get_str(name)
1715 )
1716);
1717#define DEFINE_NFS4_IDMAP_EVENT(name) \
1718 DEFINE_EVENT(nfs4_idmap_event, name, \
1719 TP_PROTO( \
1720 const char *name, \
1721 int len, \
1722 u32 id, \
1723 int error \
1724 ), \
1725 TP_ARGS(name, len, id, error))
1726DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1727DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1728DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1729DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1730
Trond Myklebust54898f72020-08-04 22:16:06 -04001731#ifdef CONFIG_NFS_V4_1
1732#define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) \
1733 (lseg ? nfs_stateid_hash(&lseg->pls_layout->plh_stateid) : 0)
1734#else
1735#define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) (0)
1736#endif
1737
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001738DECLARE_EVENT_CLASS(nfs4_read_event,
1739 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001740 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001741 int error
1742 ),
1743
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001744 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001745
1746 TP_STRUCT__entry(
1747 __field(dev_t, dev)
1748 __field(u32, fhandle)
1749 __field(u64, fileid)
1750 __field(loff_t, offset)
Trond Myklebust25925b02020-01-06 15:25:05 -05001751 __field(u32, arg_count)
1752 __field(u32, res_count)
Chuck Lever96650e22019-06-19 10:33:53 -04001753 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001754 __field(int, stateid_seq)
1755 __field(u32, stateid_hash)
Trond Myklebust54898f72020-08-04 22:16:06 -04001756 __field(int, layoutstateid_seq)
1757 __field(u32, layoutstateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001758 ),
1759
1760 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001761 const struct inode *inode = hdr->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001762 const struct nfs_inode *nfsi = NFS_I(inode);
1763 const struct nfs_fh *fh = hdr->args.fh ?
1764 hdr->args.fh : &nfsi->fh;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001765 const struct nfs4_state *state =
1766 hdr->args.context->state;
Trond Myklebust54898f72020-08-04 22:16:06 -04001767 const struct pnfs_layout_segment *lseg = hdr->lseg;
Trond Myklebust25925b02020-01-06 15:25:05 -05001768
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001769 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001770 __entry->fileid = nfsi->fileid;
1771 __entry->fhandle = nfs_fhandle_hash(fh);
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001772 __entry->offset = hdr->args.offset;
Trond Myklebust25925b02020-01-06 15:25:05 -05001773 __entry->arg_count = hdr->args.count;
1774 __entry->res_count = hdr->res.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001775 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001776 __entry->stateid_seq =
1777 be32_to_cpu(state->stateid.seqid);
1778 __entry->stateid_hash =
1779 nfs_stateid_hash(&state->stateid);
Trond Myklebust54898f72020-08-04 22:16:06 -04001780 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1781 __entry->layoutstateid_hash =
1782 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001783 ),
1784
1785 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001786 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust54898f72020-08-04 22:16:06 -04001787 "offset=%lld count=%u res=%u stateid=%d:0x%08x "
1788 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001789 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001790 show_nfsv4_errors(__entry->error),
1791 MAJOR(__entry->dev), MINOR(__entry->dev),
1792 (unsigned long long)__entry->fileid,
1793 __entry->fhandle,
1794 (long long)__entry->offset,
Trond Myklebust25925b02020-01-06 15:25:05 -05001795 __entry->arg_count, __entry->res_count,
Trond Myklebust54898f72020-08-04 22:16:06 -04001796 __entry->stateid_seq, __entry->stateid_hash,
1797 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001798 )
1799);
1800#define DEFINE_NFS4_READ_EVENT(name) \
1801 DEFINE_EVENT(nfs4_read_event, name, \
1802 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001803 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001804 int error \
1805 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001806 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001807DEFINE_NFS4_READ_EVENT(nfs4_read);
1808#ifdef CONFIG_NFS_V4_1
1809DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1810#endif /* CONFIG_NFS_V4_1 */
1811
1812DECLARE_EVENT_CLASS(nfs4_write_event,
1813 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001814 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001815 int error
1816 ),
1817
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001818 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001819
1820 TP_STRUCT__entry(
1821 __field(dev_t, dev)
1822 __field(u32, fhandle)
1823 __field(u64, fileid)
1824 __field(loff_t, offset)
Trond Myklebust25925b02020-01-06 15:25:05 -05001825 __field(u32, arg_count)
1826 __field(u32, res_count)
Chuck Lever96650e22019-06-19 10:33:53 -04001827 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001828 __field(int, stateid_seq)
1829 __field(u32, stateid_hash)
Trond Myklebust54898f72020-08-04 22:16:06 -04001830 __field(int, layoutstateid_seq)
1831 __field(u32, layoutstateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001832 ),
1833
1834 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001835 const struct inode *inode = hdr->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001836 const struct nfs_inode *nfsi = NFS_I(inode);
1837 const struct nfs_fh *fh = hdr->args.fh ?
1838 hdr->args.fh : &nfsi->fh;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001839 const struct nfs4_state *state =
1840 hdr->args.context->state;
Trond Myklebust54898f72020-08-04 22:16:06 -04001841 const struct pnfs_layout_segment *lseg = hdr->lseg;
Trond Myklebust25925b02020-01-06 15:25:05 -05001842
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001843 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001844 __entry->fileid = nfsi->fileid;
1845 __entry->fhandle = nfs_fhandle_hash(fh);
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001846 __entry->offset = hdr->args.offset;
Trond Myklebust25925b02020-01-06 15:25:05 -05001847 __entry->arg_count = hdr->args.count;
1848 __entry->res_count = hdr->res.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001849 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001850 __entry->stateid_seq =
1851 be32_to_cpu(state->stateid.seqid);
1852 __entry->stateid_hash =
1853 nfs_stateid_hash(&state->stateid);
Trond Myklebust54898f72020-08-04 22:16:06 -04001854 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1855 __entry->layoutstateid_hash =
1856 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001857 ),
1858
1859 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001860 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust54898f72020-08-04 22:16:06 -04001861 "offset=%lld count=%u res=%u stateid=%d:0x%08x "
1862 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001863 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001864 show_nfsv4_errors(__entry->error),
1865 MAJOR(__entry->dev), MINOR(__entry->dev),
1866 (unsigned long long)__entry->fileid,
1867 __entry->fhandle,
1868 (long long)__entry->offset,
Trond Myklebust25925b02020-01-06 15:25:05 -05001869 __entry->arg_count, __entry->res_count,
Trond Myklebust54898f72020-08-04 22:16:06 -04001870 __entry->stateid_seq, __entry->stateid_hash,
1871 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001872 )
1873);
1874
1875#define DEFINE_NFS4_WRITE_EVENT(name) \
1876 DEFINE_EVENT(nfs4_write_event, name, \
1877 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001878 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001879 int error \
1880 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001881 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001882DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1883#ifdef CONFIG_NFS_V4_1
1884DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1885#endif /* CONFIG_NFS_V4_1 */
1886
1887DECLARE_EVENT_CLASS(nfs4_commit_event,
1888 TP_PROTO(
1889 const struct nfs_commit_data *data,
1890 int error
1891 ),
1892
1893 TP_ARGS(data, error),
1894
1895 TP_STRUCT__entry(
1896 __field(dev_t, dev)
1897 __field(u32, fhandle)
1898 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001899 __field(unsigned long, error)
Trond Myklebust25925b02020-01-06 15:25:05 -05001900 __field(loff_t, offset)
1901 __field(u32, count)
Trond Myklebust54898f72020-08-04 22:16:06 -04001902 __field(int, layoutstateid_seq)
1903 __field(u32, layoutstateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001904 ),
1905
1906 TP_fast_assign(
1907 const struct inode *inode = data->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001908 const struct nfs_inode *nfsi = NFS_I(inode);
1909 const struct nfs_fh *fh = data->args.fh ?
1910 data->args.fh : &nfsi->fh;
Trond Myklebust54898f72020-08-04 22:16:06 -04001911 const struct pnfs_layout_segment *lseg = data->lseg;
Trond Myklebust25925b02020-01-06 15:25:05 -05001912
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001913 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001914 __entry->fileid = nfsi->fileid;
1915 __entry->fhandle = nfs_fhandle_hash(fh);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001916 __entry->offset = data->args.offset;
1917 __entry->count = data->args.count;
Trond Myklebust25925b02020-01-06 15:25:05 -05001918 __entry->error = error < 0 ? -error : 0;
Trond Myklebust54898f72020-08-04 22:16:06 -04001919 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1920 __entry->layoutstateid_hash =
1921 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001922 ),
1923
1924 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001925 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust54898f72020-08-04 22:16:06 -04001926 "offset=%lld count=%u layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001927 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001928 show_nfsv4_errors(__entry->error),
1929 MAJOR(__entry->dev), MINOR(__entry->dev),
1930 (unsigned long long)__entry->fileid,
1931 __entry->fhandle,
1932 (long long)__entry->offset,
Trond Myklebust54898f72020-08-04 22:16:06 -04001933 __entry->count,
1934 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001935 )
1936);
1937#define DEFINE_NFS4_COMMIT_EVENT(name) \
1938 DEFINE_EVENT(nfs4_commit_event, name, \
1939 TP_PROTO( \
1940 const struct nfs_commit_data *data, \
1941 int error \
1942 ), \
1943 TP_ARGS(data, error))
1944DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1945#ifdef CONFIG_NFS_V4_1
1946DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001947
Chuck Lever5b2095d2018-12-19 11:00:11 -05001948TRACE_DEFINE_ENUM(IOMODE_READ);
1949TRACE_DEFINE_ENUM(IOMODE_RW);
1950TRACE_DEFINE_ENUM(IOMODE_ANY);
1951
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001952#define show_pnfs_iomode(iomode) \
1953 __print_symbolic(iomode, \
1954 { IOMODE_READ, "READ" }, \
1955 { IOMODE_RW, "RW" }, \
1956 { IOMODE_ANY, "ANY" })
1957
1958TRACE_EVENT(nfs4_layoutget,
1959 TP_PROTO(
1960 const struct nfs_open_context *ctx,
1961 const struct pnfs_layout_range *args,
1962 const struct pnfs_layout_range *res,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001963 const nfs4_stateid *layout_stateid,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001964 int error
1965 ),
1966
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001967 TP_ARGS(ctx, args, res, layout_stateid, error),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001968
1969 TP_STRUCT__entry(
1970 __field(dev_t, dev)
1971 __field(u32, fhandle)
1972 __field(u64, fileid)
1973 __field(u32, iomode)
1974 __field(u64, offset)
1975 __field(u64, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001976 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001977 __field(int, stateid_seq)
1978 __field(u32, stateid_hash)
1979 __field(int, layoutstateid_seq)
1980 __field(u32, layoutstateid_hash)
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001981 ),
1982
1983 TP_fast_assign(
David Howells2b0143b2015-03-17 22:25:59 +00001984 const struct inode *inode = d_inode(ctx->dentry);
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001985 const struct nfs4_state *state = ctx->state;
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001986 __entry->dev = inode->i_sb->s_dev;
1987 __entry->fileid = NFS_FILEID(inode);
1988 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1989 __entry->iomode = args->iomode;
1990 __entry->offset = args->offset;
1991 __entry->count = args->length;
Trond Myklebust118b6292020-01-06 15:25:06 -05001992 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001993 __entry->stateid_seq =
1994 be32_to_cpu(state->stateid.seqid);
1995 __entry->stateid_hash =
1996 nfs_stateid_hash(&state->stateid);
1997 if (!error) {
1998 __entry->layoutstateid_seq =
1999 be32_to_cpu(layout_stateid->seqid);
2000 __entry->layoutstateid_hash =
2001 nfs_stateid_hash(layout_stateid);
2002 } else {
2003 __entry->layoutstateid_seq = 0;
2004 __entry->layoutstateid_hash = 0;
2005 }
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002006 ),
2007
2008 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04002009 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002010 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
2011 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04002012 -__entry->error,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002013 show_nfsv4_errors(__entry->error),
2014 MAJOR(__entry->dev), MINOR(__entry->dev),
2015 (unsigned long long)__entry->fileid,
2016 __entry->fhandle,
2017 show_pnfs_iomode(__entry->iomode),
2018 (unsigned long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002019 (unsigned long long)__entry->count,
2020 __entry->stateid_seq, __entry->stateid_hash,
2021 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002022 )
2023);
2024
Olga Kornievskaia48c95792015-11-24 13:29:41 -05002025DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
2026DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
Trond Myklebusta19b4782020-08-03 18:32:28 -04002027DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn_on_close);
Trond Myklebust638037b2020-08-04 11:02:44 -04002028DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layouterror);
2029DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutstats);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04002030
Chuck Lever5b2095d2018-12-19 11:00:11 -05002031TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN);
2032TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS);
2033TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN);
2034TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH);
2035TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM);
2036TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL);
2037TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL);
2038TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED);
2039TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN);
2040TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED);
2041TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN);
2042TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY);
2043TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
Trond Myklebustd5b92162019-07-18 09:32:17 -04002044TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_EXIT);
Chuck Lever5b2095d2018-12-19 11:00:11 -05002045
Jeff Layton9a4bf312015-12-10 10:41:58 -05002046#define show_pnfs_update_layout_reason(reason) \
2047 __print_symbolic(reason, \
2048 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
2049 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
2050 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
2051 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
2052 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
2053 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
2054 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
2055 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
2056 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
2057 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
Jeff Layton183d9e72016-05-17 12:28:47 -04002058 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
2059 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
Trond Myklebustd5b92162019-07-18 09:32:17 -04002060 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }, \
2061 { PNFS_UPDATE_LAYOUT_EXIT, "exit" })
Jeff Layton9a4bf312015-12-10 10:41:58 -05002062
2063TRACE_EVENT(pnfs_update_layout,
2064 TP_PROTO(struct inode *inode,
2065 loff_t pos,
2066 u64 count,
2067 enum pnfs_iomode iomode,
Trond Myklebustf4848302015-12-26 18:03:07 -05002068 struct pnfs_layout_hdr *lo,
Jeff Layton183d9e72016-05-17 12:28:47 -04002069 struct pnfs_layout_segment *lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05002070 enum pnfs_update_layout_reason reason
2071 ),
Jeff Layton183d9e72016-05-17 12:28:47 -04002072 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
Jeff Layton9a4bf312015-12-10 10:41:58 -05002073 TP_STRUCT__entry(
2074 __field(dev_t, dev)
2075 __field(u64, fileid)
2076 __field(u32, fhandle)
2077 __field(loff_t, pos)
2078 __field(u64, count)
2079 __field(enum pnfs_iomode, iomode)
Trond Myklebustf4848302015-12-26 18:03:07 -05002080 __field(int, layoutstateid_seq)
2081 __field(u32, layoutstateid_hash)
Jeff Layton183d9e72016-05-17 12:28:47 -04002082 __field(long, lseg)
Jeff Layton9a4bf312015-12-10 10:41:58 -05002083 __field(enum pnfs_update_layout_reason, reason)
2084 ),
2085 TP_fast_assign(
2086 __entry->dev = inode->i_sb->s_dev;
2087 __entry->fileid = NFS_FILEID(inode);
2088 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2089 __entry->pos = pos;
2090 __entry->count = count;
2091 __entry->iomode = iomode;
Jeff Layton9a4bf312015-12-10 10:41:58 -05002092 __entry->reason = reason;
Trond Myklebustf4848302015-12-26 18:03:07 -05002093 if (lo != NULL) {
2094 __entry->layoutstateid_seq =
2095 be32_to_cpu(lo->plh_stateid.seqid);
2096 __entry->layoutstateid_hash =
2097 nfs_stateid_hash(&lo->plh_stateid);
2098 } else {
2099 __entry->layoutstateid_seq = 0;
2100 __entry->layoutstateid_hash = 0;
2101 }
Jeff Layton183d9e72016-05-17 12:28:47 -04002102 __entry->lseg = (long)lseg;
Jeff Layton9a4bf312015-12-10 10:41:58 -05002103 ),
2104 TP_printk(
2105 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustf4848302015-12-26 18:03:07 -05002106 "iomode=%s pos=%llu count=%llu "
Jeff Layton183d9e72016-05-17 12:28:47 -04002107 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
Jeff Layton9a4bf312015-12-10 10:41:58 -05002108 MAJOR(__entry->dev), MINOR(__entry->dev),
2109 (unsigned long long)__entry->fileid,
2110 __entry->fhandle,
2111 show_pnfs_iomode(__entry->iomode),
2112 (unsigned long long)__entry->pos,
Trond Myklebustf4848302015-12-26 18:03:07 -05002113 (unsigned long long)__entry->count,
2114 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
Jeff Layton183d9e72016-05-17 12:28:47 -04002115 __entry->lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05002116 show_pnfs_update_layout_reason(__entry->reason)
2117 )
2118);
2119
Trond Myklebustd5b92162019-07-18 09:32:17 -04002120DECLARE_EVENT_CLASS(pnfs_layout_event,
2121 TP_PROTO(struct inode *inode,
2122 loff_t pos,
2123 u64 count,
2124 enum pnfs_iomode iomode,
2125 struct pnfs_layout_hdr *lo,
2126 struct pnfs_layout_segment *lseg
2127 ),
2128 TP_ARGS(inode, pos, count, iomode, lo, lseg),
2129 TP_STRUCT__entry(
2130 __field(dev_t, dev)
2131 __field(u64, fileid)
2132 __field(u32, fhandle)
2133 __field(loff_t, pos)
2134 __field(u64, count)
2135 __field(enum pnfs_iomode, iomode)
2136 __field(int, layoutstateid_seq)
2137 __field(u32, layoutstateid_hash)
2138 __field(long, lseg)
2139 ),
2140 TP_fast_assign(
2141 __entry->dev = inode->i_sb->s_dev;
2142 __entry->fileid = NFS_FILEID(inode);
2143 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2144 __entry->pos = pos;
2145 __entry->count = count;
2146 __entry->iomode = iomode;
2147 if (lo != NULL) {
2148 __entry->layoutstateid_seq =
2149 be32_to_cpu(lo->plh_stateid.seqid);
2150 __entry->layoutstateid_hash =
2151 nfs_stateid_hash(&lo->plh_stateid);
2152 } else {
2153 __entry->layoutstateid_seq = 0;
2154 __entry->layoutstateid_hash = 0;
2155 }
2156 __entry->lseg = (long)lseg;
2157 ),
2158 TP_printk(
2159 "fileid=%02x:%02x:%llu fhandle=0x%08x "
2160 "iomode=%s pos=%llu count=%llu "
2161 "layoutstateid=%d:0x%08x lseg=0x%lx",
2162 MAJOR(__entry->dev), MINOR(__entry->dev),
2163 (unsigned long long)__entry->fileid,
2164 __entry->fhandle,
2165 show_pnfs_iomode(__entry->iomode),
2166 (unsigned long long)__entry->pos,
2167 (unsigned long long)__entry->count,
2168 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
2169 __entry->lseg
2170 )
2171);
2172
2173#define DEFINE_PNFS_LAYOUT_EVENT(name) \
2174 DEFINE_EVENT(pnfs_layout_event, name, \
2175 TP_PROTO(struct inode *inode, \
2176 loff_t pos, \
2177 u64 count, \
2178 enum pnfs_iomode iomode, \
2179 struct pnfs_layout_hdr *lo, \
2180 struct pnfs_layout_segment *lseg \
2181 ), \
2182 TP_ARGS(inode, pos, count, iomode, lo, lseg))
2183
2184DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_read);
2185DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_write);
2186DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_get_mirror_count);
2187DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_done);
2188DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done);
2189DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist);
2190DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist);
2191
Trond Myklebust088f3e62020-01-06 15:25:11 -05002192DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event,
2193 TP_PROTO(
2194 const struct nfs_pgio_header *hdr
2195 ),
2196
2197 TP_ARGS(hdr),
2198
2199 TP_STRUCT__entry(
2200 __field(unsigned long, error)
2201 __field(dev_t, dev)
2202 __field(u32, fhandle)
2203 __field(u64, fileid)
2204 __field(loff_t, offset)
2205 __field(u32, count)
2206 __field(int, stateid_seq)
2207 __field(u32, stateid_hash)
2208 __string(dstaddr, hdr->ds_clp ?
2209 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
2210 RPC_DISPLAY_ADDR) : "unknown")
2211 ),
2212
2213 TP_fast_assign(
2214 const struct inode *inode = hdr->inode;
2215
2216 __entry->error = hdr->res.op_status;
2217 __entry->fhandle = nfs_fhandle_hash(hdr->args.fh);
2218 __entry->fileid = NFS_FILEID(inode);
2219 __entry->dev = inode->i_sb->s_dev;
2220 __entry->offset = hdr->args.offset;
2221 __entry->count = hdr->args.count;
2222 __entry->stateid_seq =
2223 be32_to_cpu(hdr->args.stateid.seqid);
2224 __entry->stateid_hash =
2225 nfs_stateid_hash(&hdr->args.stateid);
2226 __assign_str(dstaddr, hdr->ds_clp ?
2227 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
2228 RPC_DISPLAY_ADDR) : "unknown");
2229 ),
2230
2231 TP_printk(
2232 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2233 "offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s",
2234 -__entry->error,
2235 show_nfsv4_errors(__entry->error),
2236 MAJOR(__entry->dev), MINOR(__entry->dev),
2237 (unsigned long long)__entry->fileid,
2238 __entry->fhandle,
2239 __entry->offset, __entry->count,
2240 __entry->stateid_seq, __entry->stateid_hash,
2241 __get_str(dstaddr)
2242 )
2243);
2244
2245#define DEFINE_NFS4_FLEXFILES_IO_EVENT(name) \
2246 DEFINE_EVENT(nfs4_flexfiles_io_event, name, \
2247 TP_PROTO( \
2248 const struct nfs_pgio_header *hdr \
2249 ), \
2250 TP_ARGS(hdr))
2251DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_read_error);
2252DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_write_error);
2253
2254TRACE_EVENT(ff_layout_commit_error,
2255 TP_PROTO(
2256 const struct nfs_commit_data *data
2257 ),
2258
2259 TP_ARGS(data),
2260
2261 TP_STRUCT__entry(
2262 __field(unsigned long, error)
2263 __field(dev_t, dev)
2264 __field(u32, fhandle)
2265 __field(u64, fileid)
2266 __field(loff_t, offset)
2267 __field(u32, count)
2268 __string(dstaddr, data->ds_clp ?
2269 rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
2270 RPC_DISPLAY_ADDR) : "unknown")
2271 ),
2272
2273 TP_fast_assign(
2274 const struct inode *inode = data->inode;
2275
2276 __entry->error = data->res.op_status;
2277 __entry->fhandle = nfs_fhandle_hash(data->args.fh);
2278 __entry->fileid = NFS_FILEID(inode);
2279 __entry->dev = inode->i_sb->s_dev;
2280 __entry->offset = data->args.offset;
2281 __entry->count = data->args.count;
2282 __assign_str(dstaddr, data->ds_clp ?
2283 rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
2284 RPC_DISPLAY_ADDR) : "unknown");
2285 ),
2286
2287 TP_printk(
2288 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2289 "offset=%llu count=%u dstaddr=%s",
2290 -__entry->error,
2291 show_nfsv4_errors(__entry->error),
2292 MAJOR(__entry->dev), MINOR(__entry->dev),
2293 (unsigned long long)__entry->fileid,
2294 __entry->fhandle,
2295 __entry->offset, __entry->count,
2296 __get_str(dstaddr)
2297 )
2298);
2299
2300
Trond Myklebustcc668ab2013-08-14 15:31:28 -04002301#endif /* CONFIG_NFS_V4_1 */
2302
Trond Myklebustc6d01c62013-08-09 11:51:26 -04002303#endif /* _TRACE_NFS4_H */
2304
2305#undef TRACE_INCLUDE_PATH
2306#define TRACE_INCLUDE_PATH .
2307#define TRACE_INCLUDE_FILE nfs4trace
2308/* This part must be outside protection */
2309#include <trace/define_trace.h>