blob: 1e97e5e04cb43ba671c491b6433174e8c1552e0a [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);
587TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN_RUNNING);
588
589#define show_nfs4_clp_state(state) \
590 __print_flags(state, "|", \
591 { NFS4CLNT_MANAGER_RUNNING, "MANAGER_RUNNING" }, \
592 { NFS4CLNT_CHECK_LEASE, "CHECK_LEASE" }, \
593 { NFS4CLNT_LEASE_EXPIRED, "LEASE_EXPIRED" }, \
594 { NFS4CLNT_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
595 { NFS4CLNT_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
596 { NFS4CLNT_DELEGRETURN, "DELEGRETURN" }, \
597 { NFS4CLNT_SESSION_RESET, "SESSION_RESET" }, \
598 { NFS4CLNT_LEASE_CONFIRM, "LEASE_CONFIRM" }, \
599 { NFS4CLNT_SERVER_SCOPE_MISMATCH, \
600 "SERVER_SCOPE_MISMATCH" }, \
601 { NFS4CLNT_PURGE_STATE, "PURGE_STATE" }, \
602 { NFS4CLNT_BIND_CONN_TO_SESSION, \
603 "BIND_CONN_TO_SESSION" }, \
604 { NFS4CLNT_MOVED, "MOVED" }, \
605 { NFS4CLNT_LEASE_MOVED, "LEASE_MOVED" }, \
606 { NFS4CLNT_DELEGATION_EXPIRED, "DELEGATION_EXPIRED" }, \
607 { NFS4CLNT_RUN_MANAGER, "RUN_MANAGER" }, \
608 { NFS4CLNT_DELEGRETURN_RUNNING, "DELEGRETURN_RUNNING" })
609
610TRACE_EVENT(nfs4_state_mgr,
611 TP_PROTO(
612 const struct nfs_client *clp
613 ),
614
615 TP_ARGS(clp),
616
617 TP_STRUCT__entry(
618 __field(unsigned long, state)
619 __string(hostname, clp->cl_hostname)
620 ),
621
622 TP_fast_assign(
623 __entry->state = clp->cl_state;
624 __assign_str(hostname, clp->cl_hostname)
625 ),
626
627 TP_printk(
628 "hostname=%s clp state=%s", __get_str(hostname),
629 show_nfs4_clp_state(__entry->state)
630 )
631)
632
633TRACE_EVENT(nfs4_state_mgr_failed,
634 TP_PROTO(
635 const struct nfs_client *clp,
636 const char *section,
637 int status
638 ),
639
640 TP_ARGS(clp, section, status),
641
642 TP_STRUCT__entry(
643 __field(unsigned long, error)
644 __field(unsigned long, state)
645 __string(hostname, clp->cl_hostname)
646 __string(section, section)
647 ),
648
649 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -0500650 __entry->error = status < 0 ? -status : 0;
Chuck Lever511ba522019-11-05 11:04:07 -0500651 __entry->state = clp->cl_state;
652 __assign_str(hostname, clp->cl_hostname);
653 __assign_str(section, section);
654 ),
655
656 TP_printk(
657 "hostname=%s clp state=%s error=%ld (%s) section=%s",
658 __get_str(hostname),
659 show_nfs4_clp_state(__entry->state), -__entry->error,
660 show_nfsv4_errors(__entry->error), __get_str(section)
661
662 )
663)
664
Chuck Leverf23f6582019-02-11 11:24:26 -0500665TRACE_EVENT(nfs4_xdr_status,
666 TP_PROTO(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400667 const struct xdr_stream *xdr,
Chuck Leverf23f6582019-02-11 11:24:26 -0500668 u32 op,
Trond Myklebust118b6292020-01-06 15:25:06 -0500669 u32 error
Chuck Leverf23f6582019-02-11 11:24:26 -0500670 ),
671
Chuck Lever62a92ba2019-06-19 10:34:09 -0400672 TP_ARGS(xdr, op, error),
Chuck Leverf23f6582019-02-11 11:24:26 -0500673
674 TP_STRUCT__entry(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400675 __field(unsigned int, task_id)
676 __field(unsigned int, client_id)
677 __field(u32, xid)
Chuck Leverf23f6582019-02-11 11:24:26 -0500678 __field(u32, op)
Chuck Lever96650e22019-06-19 10:33:53 -0400679 __field(unsigned long, error)
Chuck Leverf23f6582019-02-11 11:24:26 -0500680 ),
681
682 TP_fast_assign(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400683 const struct rpc_rqst *rqstp = xdr->rqst;
684 const struct rpc_task *task = rqstp->rq_task;
685
686 __entry->task_id = task->tk_pid;
687 __entry->client_id = task->tk_client->cl_clid;
688 __entry->xid = be32_to_cpu(rqstp->rq_xid);
Chuck Leverf23f6582019-02-11 11:24:26 -0500689 __entry->op = op;
Chuck Lever96650e22019-06-19 10:33:53 -0400690 __entry->error = error;
Chuck Leverf23f6582019-02-11 11:24:26 -0500691 ),
692
693 TP_printk(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400694 "task:%u@%d xid=0x%08x error=%ld (%s) operation=%u",
695 __entry->task_id, __entry->client_id, __entry->xid,
Chuck Lever96650e22019-06-19 10:33:53 -0400696 -__entry->error, show_nfsv4_errors(__entry->error),
697 __entry->op
Chuck Leverf23f6582019-02-11 11:24:26 -0500698 )
699);
700
Chuck Lever2bb50aa2019-12-23 10:28:38 -0500701DECLARE_EVENT_CLASS(nfs4_cb_error_class,
702 TP_PROTO(
703 __be32 xid,
704 u32 cb_ident
705 ),
706
707 TP_ARGS(xid, cb_ident),
708
709 TP_STRUCT__entry(
710 __field(u32, xid)
711 __field(u32, cbident)
712 ),
713
714 TP_fast_assign(
715 __entry->xid = be32_to_cpu(xid);
716 __entry->cbident = cb_ident;
717 ),
718
719 TP_printk(
720 "xid=0x%08x cb_ident=0x%08x",
721 __entry->xid, __entry->cbident
722 )
723);
724
725#define DEFINE_CB_ERROR_EVENT(name) \
726 DEFINE_EVENT(nfs4_cb_error_class, nfs_cb_##name, \
727 TP_PROTO( \
728 __be32 xid, \
729 u32 cb_ident \
730 ), \
731 TP_ARGS(xid, cb_ident))
732
733DEFINE_CB_ERROR_EVENT(no_clp);
734DEFINE_CB_ERROR_EVENT(badprinc);
735
Trond Myklebust42113a72013-08-12 16:19:27 -0400736DECLARE_EVENT_CLASS(nfs4_open_event,
737 TP_PROTO(
738 const struct nfs_open_context *ctx,
739 int flags,
740 int error
741 ),
742
743 TP_ARGS(ctx, flags, error),
744
745 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400746 __field(unsigned long, error)
Trond Myklebust42113a72013-08-12 16:19:27 -0400747 __field(unsigned int, flags)
748 __field(unsigned int, fmode)
749 __field(dev_t, dev)
750 __field(u32, fhandle)
751 __field(u64, fileid)
752 __field(u64, dir)
753 __string(name, ctx->dentry->d_name.name)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500754 __field(int, stateid_seq)
755 __field(u32, stateid_hash)
756 __field(int, openstateid_seq)
757 __field(u32, openstateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400758 ),
759
760 TP_fast_assign(
761 const struct nfs4_state *state = ctx->state;
762 const struct inode *inode = NULL;
763
Chuck Lever96650e22019-06-19 10:33:53 -0400764 __entry->error = -error;
Trond Myklebust42113a72013-08-12 16:19:27 -0400765 __entry->flags = flags;
766 __entry->fmode = (__force unsigned int)ctx->mode;
767 __entry->dev = ctx->dentry->d_sb->s_dev;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500768 if (!IS_ERR_OR_NULL(state)) {
Trond Myklebust42113a72013-08-12 16:19:27 -0400769 inode = state->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500770 __entry->stateid_seq =
771 be32_to_cpu(state->stateid.seqid);
772 __entry->stateid_hash =
773 nfs_stateid_hash(&state->stateid);
774 __entry->openstateid_seq =
775 be32_to_cpu(state->open_stateid.seqid);
776 __entry->openstateid_hash =
777 nfs_stateid_hash(&state->open_stateid);
778 } else {
779 __entry->stateid_seq = 0;
780 __entry->stateid_hash = 0;
781 __entry->openstateid_seq = 0;
782 __entry->openstateid_hash = 0;
783 }
Trond Myklebust42113a72013-08-12 16:19:27 -0400784 if (inode != NULL) {
785 __entry->fileid = NFS_FILEID(inode);
786 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
787 } else {
788 __entry->fileid = 0;
789 __entry->fhandle = 0;
790 }
David Howells2b0143b2015-03-17 22:25:59 +0000791 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
Trond Myklebust42113a72013-08-12 16:19:27 -0400792 __assign_str(name, ctx->dentry->d_name.name);
793 ),
794
795 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400796 "error=%ld (%s) flags=%d (%s) fmode=%s "
Trond Myklebust42113a72013-08-12 16:19:27 -0400797 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500798 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
799 "openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400800 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400801 show_nfsv4_errors(__entry->error),
802 __entry->flags,
803 show_open_flags(__entry->flags),
804 show_fmode_flags(__entry->fmode),
805 MAJOR(__entry->dev), MINOR(__entry->dev),
806 (unsigned long long)__entry->fileid,
807 __entry->fhandle,
808 MAJOR(__entry->dev), MINOR(__entry->dev),
809 (unsigned long long)__entry->dir,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500810 __get_str(name),
811 __entry->stateid_seq, __entry->stateid_hash,
812 __entry->openstateid_seq, __entry->openstateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400813 )
814);
815
816#define DEFINE_NFS4_OPEN_EVENT(name) \
817 DEFINE_EVENT(nfs4_open_event, name, \
818 TP_PROTO( \
819 const struct nfs_open_context *ctx, \
820 int flags, \
821 int error \
822 ), \
823 TP_ARGS(ctx, flags, error))
824DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
825DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
826DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
827
Olga Kornievskaia9759b0f2015-11-24 13:29:42 -0500828TRACE_EVENT(nfs4_cached_open,
829 TP_PROTO(
830 const struct nfs4_state *state
831 ),
832 TP_ARGS(state),
833 TP_STRUCT__entry(
834 __field(dev_t, dev)
835 __field(u32, fhandle)
836 __field(u64, fileid)
837 __field(unsigned int, fmode)
838 __field(int, stateid_seq)
839 __field(u32, stateid_hash)
840 ),
841
842 TP_fast_assign(
843 const struct inode *inode = state->inode;
844
845 __entry->dev = inode->i_sb->s_dev;
846 __entry->fileid = NFS_FILEID(inode);
847 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
848 __entry->fmode = (__force unsigned int)state->state;
849 __entry->stateid_seq =
850 be32_to_cpu(state->stateid.seqid);
851 __entry->stateid_hash =
852 nfs_stateid_hash(&state->stateid);
853 ),
854
855 TP_printk(
856 "fmode=%s fileid=%02x:%02x:%llu "
857 "fhandle=0x%08x stateid=%d:0x%08x",
858 __entry->fmode ? show_fmode_flags(__entry->fmode) :
859 "closed",
860 MAJOR(__entry->dev), MINOR(__entry->dev),
861 (unsigned long long)__entry->fileid,
862 __entry->fhandle,
863 __entry->stateid_seq, __entry->stateid_hash
864 )
865);
866
Trond Myklebust42113a72013-08-12 16:19:27 -0400867TRACE_EVENT(nfs4_close,
868 TP_PROTO(
869 const struct nfs4_state *state,
870 const struct nfs_closeargs *args,
871 const struct nfs_closeres *res,
872 int error
873 ),
874
875 TP_ARGS(state, args, res, error),
876
877 TP_STRUCT__entry(
878 __field(dev_t, dev)
879 __field(u32, fhandle)
880 __field(u64, fileid)
881 __field(unsigned int, fmode)
Chuck Lever96650e22019-06-19 10:33:53 -0400882 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500883 __field(int, stateid_seq)
884 __field(u32, stateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400885 ),
886
887 TP_fast_assign(
888 const struct inode *inode = state->inode;
889
890 __entry->dev = inode->i_sb->s_dev;
891 __entry->fileid = NFS_FILEID(inode);
892 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
893 __entry->fmode = (__force unsigned int)state->state;
Trond Myklebust118b6292020-01-06 15:25:06 -0500894 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500895 __entry->stateid_seq =
896 be32_to_cpu(args->stateid.seqid);
897 __entry->stateid_hash =
898 nfs_stateid_hash(&args->stateid);
Trond Myklebust42113a72013-08-12 16:19:27 -0400899 ),
900
901 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400902 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500903 "fhandle=0x%08x openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400904 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400905 show_nfsv4_errors(__entry->error),
906 __entry->fmode ? show_fmode_flags(__entry->fmode) :
907 "closed",
908 MAJOR(__entry->dev), MINOR(__entry->dev),
909 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500910 __entry->fhandle,
911 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400912 )
913);
914
Chuck Lever5b2095d2018-12-19 11:00:11 -0500915TRACE_DEFINE_ENUM(F_GETLK);
916TRACE_DEFINE_ENUM(F_SETLK);
917TRACE_DEFINE_ENUM(F_SETLKW);
918TRACE_DEFINE_ENUM(F_RDLCK);
919TRACE_DEFINE_ENUM(F_WRLCK);
920TRACE_DEFINE_ENUM(F_UNLCK);
921
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400922#define show_lock_cmd(type) \
923 __print_symbolic((int)type, \
924 { F_GETLK, "GETLK" }, \
925 { F_SETLK, "SETLK" }, \
926 { F_SETLKW, "SETLKW" })
927#define show_lock_type(type) \
928 __print_symbolic((int)type, \
929 { F_RDLCK, "RDLCK" }, \
930 { F_WRLCK, "WRLCK" }, \
931 { F_UNLCK, "UNLCK" })
932
933DECLARE_EVENT_CLASS(nfs4_lock_event,
934 TP_PROTO(
935 const struct file_lock *request,
936 const struct nfs4_state *state,
937 int cmd,
938 int error
939 ),
940
941 TP_ARGS(request, state, cmd, error),
942
943 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400944 __field(unsigned long, error)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400945 __field(int, cmd)
946 __field(char, type)
947 __field(loff_t, start)
948 __field(loff_t, end)
949 __field(dev_t, dev)
950 __field(u32, fhandle)
951 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500952 __field(int, stateid_seq)
953 __field(u32, stateid_hash)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400954 ),
955
956 TP_fast_assign(
957 const struct inode *inode = state->inode;
958
Trond Myklebust118b6292020-01-06 15:25:06 -0500959 __entry->error = error < 0 ? -error : 0;
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400960 __entry->cmd = cmd;
961 __entry->type = request->fl_type;
962 __entry->start = request->fl_start;
963 __entry->end = request->fl_end;
964 __entry->dev = inode->i_sb->s_dev;
965 __entry->fileid = NFS_FILEID(inode);
966 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500967 __entry->stateid_seq =
968 be32_to_cpu(state->stateid.seqid);
969 __entry->stateid_hash =
970 nfs_stateid_hash(&state->stateid);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400971 ),
972
973 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400974 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500975 "fileid=%02x:%02x:%llu fhandle=0x%08x "
976 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400977 -__entry->error,
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400978 show_nfsv4_errors(__entry->error),
979 show_lock_cmd(__entry->cmd),
980 show_lock_type(__entry->type),
981 (long long)__entry->start,
982 (long long)__entry->end,
983 MAJOR(__entry->dev), MINOR(__entry->dev),
984 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500985 __entry->fhandle,
986 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400987 )
988);
989
990#define DEFINE_NFS4_LOCK_EVENT(name) \
991 DEFINE_EVENT(nfs4_lock_event, name, \
992 TP_PROTO( \
993 const struct file_lock *request, \
994 const struct nfs4_state *state, \
995 int cmd, \
996 int error \
997 ), \
998 TP_ARGS(request, state, cmd, error))
999DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
Trond Myklebustd1b748a2013-08-12 16:35:20 -04001000DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
1001
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001002TRACE_EVENT(nfs4_set_lock,
1003 TP_PROTO(
1004 const struct file_lock *request,
1005 const struct nfs4_state *state,
1006 const nfs4_stateid *lockstateid,
1007 int cmd,
1008 int error
1009 ),
1010
1011 TP_ARGS(request, state, lockstateid, cmd, error),
1012
1013 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001014 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001015 __field(int, cmd)
1016 __field(char, type)
1017 __field(loff_t, start)
1018 __field(loff_t, end)
1019 __field(dev_t, dev)
1020 __field(u32, fhandle)
1021 __field(u64, fileid)
1022 __field(int, stateid_seq)
1023 __field(u32, stateid_hash)
1024 __field(int, lockstateid_seq)
1025 __field(u32, lockstateid_hash)
1026 ),
1027
1028 TP_fast_assign(
1029 const struct inode *inode = state->inode;
1030
Trond Myklebust118b6292020-01-06 15:25:06 -05001031 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001032 __entry->cmd = cmd;
1033 __entry->type = request->fl_type;
1034 __entry->start = request->fl_start;
1035 __entry->end = request->fl_end;
1036 __entry->dev = inode->i_sb->s_dev;
1037 __entry->fileid = NFS_FILEID(inode);
1038 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1039 __entry->stateid_seq =
1040 be32_to_cpu(state->stateid.seqid);
1041 __entry->stateid_hash =
1042 nfs_stateid_hash(&state->stateid);
1043 __entry->lockstateid_seq =
1044 be32_to_cpu(lockstateid->seqid);
1045 __entry->lockstateid_hash =
1046 nfs_stateid_hash(lockstateid);
1047 ),
1048
1049 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001050 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001051 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1052 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001053 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001054 show_nfsv4_errors(__entry->error),
1055 show_lock_cmd(__entry->cmd),
1056 show_lock_type(__entry->type),
1057 (long long)__entry->start,
1058 (long long)__entry->end,
1059 MAJOR(__entry->dev), MINOR(__entry->dev),
1060 (unsigned long long)__entry->fileid,
1061 __entry->fhandle,
1062 __entry->stateid_seq, __entry->stateid_hash,
1063 __entry->lockstateid_seq, __entry->lockstateid_hash
1064 )
1065);
1066
Chuck Lever21f86d22019-11-05 11:04:13 -05001067TRACE_DEFINE_ENUM(LK_STATE_IN_USE);
1068TRACE_DEFINE_ENUM(NFS_DELEGATED_STATE);
1069TRACE_DEFINE_ENUM(NFS_OPEN_STATE);
1070TRACE_DEFINE_ENUM(NFS_O_RDONLY_STATE);
1071TRACE_DEFINE_ENUM(NFS_O_WRONLY_STATE);
1072TRACE_DEFINE_ENUM(NFS_O_RDWR_STATE);
1073TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_REBOOT);
1074TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_NOGRACE);
1075TRACE_DEFINE_ENUM(NFS_STATE_POSIX_LOCKS);
1076TRACE_DEFINE_ENUM(NFS_STATE_RECOVERY_FAILED);
1077TRACE_DEFINE_ENUM(NFS_STATE_MAY_NOTIFY_LOCK);
1078TRACE_DEFINE_ENUM(NFS_STATE_CHANGE_WAIT);
1079TRACE_DEFINE_ENUM(NFS_CLNT_DST_SSC_COPY_STATE);
1080TRACE_DEFINE_ENUM(NFS_CLNT_SRC_SSC_COPY_STATE);
1081TRACE_DEFINE_ENUM(NFS_SRV_SSC_COPY_STATE);
1082
1083#define show_nfs4_state_flags(flags) \
1084 __print_flags(flags, "|", \
1085 { LK_STATE_IN_USE, "IN_USE" }, \
1086 { NFS_DELEGATED_STATE, "DELEGATED" }, \
1087 { NFS_OPEN_STATE, "OPEN" }, \
1088 { NFS_O_RDONLY_STATE, "O_RDONLY" }, \
1089 { NFS_O_WRONLY_STATE, "O_WRONLY" }, \
1090 { NFS_O_RDWR_STATE, "O_RDWR" }, \
1091 { NFS_STATE_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
1092 { NFS_STATE_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
1093 { NFS_STATE_POSIX_LOCKS, "POSIX_LOCKS" }, \
1094 { NFS_STATE_RECOVERY_FAILED, "RECOVERY_FAILED" }, \
1095 { NFS_STATE_MAY_NOTIFY_LOCK, "MAY_NOTIFY_LOCK" }, \
1096 { NFS_STATE_CHANGE_WAIT, "CHANGE_WAIT" }, \
1097 { NFS_CLNT_DST_SSC_COPY_STATE, "CLNT_DST_SSC_COPY" }, \
1098 { NFS_CLNT_SRC_SSC_COPY_STATE, "CLNT_SRC_SSC_COPY" }, \
1099 { NFS_SRV_SSC_COPY_STATE, "SRV_SSC_COPY" })
1100
1101#define show_nfs4_lock_flags(flags) \
1102 __print_flags(flags, "|", \
1103 { BIT(NFS_LOCK_INITIALIZED), "INITIALIZED" }, \
1104 { BIT(NFS_LOCK_LOST), "LOST" })
1105
1106TRACE_EVENT(nfs4_state_lock_reclaim,
1107 TP_PROTO(
1108 const struct nfs4_state *state,
1109 const struct nfs4_lock_state *lock
1110 ),
1111
1112 TP_ARGS(state, lock),
1113
1114 TP_STRUCT__entry(
1115 __field(dev_t, dev)
1116 __field(u32, fhandle)
1117 __field(u64, fileid)
1118 __field(unsigned long, state_flags)
1119 __field(unsigned long, lock_flags)
1120 __field(int, stateid_seq)
1121 __field(u32, stateid_hash)
1122 ),
1123
1124 TP_fast_assign(
1125 const struct inode *inode = state->inode;
1126
1127 __entry->dev = inode->i_sb->s_dev;
1128 __entry->fileid = NFS_FILEID(inode);
1129 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1130 __entry->state_flags = state->flags;
1131 __entry->lock_flags = lock->ls_flags;
1132 __entry->stateid_seq =
1133 be32_to_cpu(state->stateid.seqid);
1134 __entry->stateid_hash =
1135 nfs_stateid_hash(&state->stateid);
1136 ),
1137
1138 TP_printk(
1139 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1140 "stateid=%d:0x%08x state_flags=%s lock_flags=%s",
1141 MAJOR(__entry->dev), MINOR(__entry->dev),
1142 (unsigned long long)__entry->fileid, __entry->fhandle,
1143 __entry->stateid_seq, __entry->stateid_hash,
1144 show_nfs4_state_flags(__entry->state_flags),
1145 show_nfs4_lock_flags(__entry->lock_flags)
1146 )
1147)
1148
Trond Myklebustca8acf82013-08-13 10:36:56 -04001149DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
1150 TP_PROTO(
1151 const struct inode *inode,
1152 fmode_t fmode
1153 ),
1154
1155 TP_ARGS(inode, fmode),
1156
1157 TP_STRUCT__entry(
1158 __field(dev_t, dev)
1159 __field(u32, fhandle)
1160 __field(u64, fileid)
1161 __field(unsigned int, fmode)
1162 ),
1163
1164 TP_fast_assign(
1165 __entry->dev = inode->i_sb->s_dev;
1166 __entry->fileid = NFS_FILEID(inode);
1167 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1168 __entry->fmode = (__force unsigned int)fmode;
1169 ),
1170
1171 TP_printk(
1172 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
1173 show_fmode_flags(__entry->fmode),
1174 MAJOR(__entry->dev), MINOR(__entry->dev),
1175 (unsigned long long)__entry->fileid,
1176 __entry->fhandle
1177 )
1178);
1179#define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
1180 DEFINE_EVENT(nfs4_set_delegation_event, name, \
1181 TP_PROTO( \
1182 const struct inode *inode, \
1183 fmode_t fmode \
1184 ), \
1185 TP_ARGS(inode, fmode))
1186DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
1187DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
1188
1189TRACE_EVENT(nfs4_delegreturn_exit,
1190 TP_PROTO(
1191 const struct nfs4_delegreturnargs *args,
1192 const struct nfs4_delegreturnres *res,
1193 int error
1194 ),
1195
1196 TP_ARGS(args, res, error),
1197
1198 TP_STRUCT__entry(
1199 __field(dev_t, dev)
1200 __field(u32, fhandle)
Chuck Lever96650e22019-06-19 10:33:53 -04001201 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001202 __field(int, stateid_seq)
1203 __field(u32, stateid_hash)
Trond Myklebustca8acf82013-08-13 10:36:56 -04001204 ),
1205
1206 TP_fast_assign(
1207 __entry->dev = res->server->s_dev;
1208 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
Trond Myklebust118b6292020-01-06 15:25:06 -05001209 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001210 __entry->stateid_seq =
1211 be32_to_cpu(args->stateid->seqid);
1212 __entry->stateid_hash =
1213 nfs_stateid_hash(args->stateid);
Trond Myklebustca8acf82013-08-13 10:36:56 -04001214 ),
1215
1216 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001217 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001218 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001219 -__entry->error,
Trond Myklebustca8acf82013-08-13 10:36:56 -04001220 show_nfsv4_errors(__entry->error),
1221 MAJOR(__entry->dev), MINOR(__entry->dev),
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001222 __entry->fhandle,
1223 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustca8acf82013-08-13 10:36:56 -04001224 )
1225);
1226
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001227#ifdef CONFIG_NFS_V4_1
1228DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
1229 TP_PROTO(
1230 const struct nfs4_state *state,
1231 const struct nfs4_lock_state *lsp,
1232 int error
1233 ),
1234
1235 TP_ARGS(state, lsp, error),
1236
1237 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001238 __field(unsigned long, error)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001239 __field(dev_t, dev)
1240 __field(u32, fhandle)
1241 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001242 __field(int, stateid_seq)
1243 __field(u32, stateid_hash)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001244 ),
1245
1246 TP_fast_assign(
1247 const struct inode *inode = state->inode;
1248
Trond Myklebust118b6292020-01-06 15:25:06 -05001249 __entry->error = error < 0 ? -error : 0;
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001250 __entry->dev = inode->i_sb->s_dev;
1251 __entry->fileid = NFS_FILEID(inode);
1252 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001253 __entry->stateid_seq =
1254 be32_to_cpu(state->stateid.seqid);
1255 __entry->stateid_hash =
1256 nfs_stateid_hash(&state->stateid);
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001257 ),
1258
1259 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001260 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001261 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001262 -__entry->error,
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001263 show_nfsv4_errors(__entry->error),
1264 MAJOR(__entry->dev), MINOR(__entry->dev),
1265 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001266 __entry->fhandle,
1267 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001268 )
1269);
1270
1271#define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
1272 DEFINE_EVENT(nfs4_test_stateid_event, name, \
1273 TP_PROTO( \
1274 const struct nfs4_state *state, \
1275 const struct nfs4_lock_state *lsp, \
1276 int error \
1277 ), \
1278 TP_ARGS(state, lsp, error))
1279DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
1280DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
1281DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
1282#endif /* CONFIG_NFS_V4_1 */
1283
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001284DECLARE_EVENT_CLASS(nfs4_lookup_event,
1285 TP_PROTO(
1286 const struct inode *dir,
1287 const struct qstr *name,
1288 int error
1289 ),
1290
1291 TP_ARGS(dir, name, error),
1292
1293 TP_STRUCT__entry(
1294 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001295 __field(unsigned long, error)
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001296 __field(u64, dir)
1297 __string(name, name->name)
1298 ),
1299
1300 TP_fast_assign(
1301 __entry->dev = dir->i_sb->s_dev;
1302 __entry->dir = NFS_FILEID(dir);
Chuck Lever96650e22019-06-19 10:33:53 -04001303 __entry->error = -error;
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001304 __assign_str(name, name->name);
1305 ),
1306
1307 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001308 "error=%ld (%s) name=%02x:%02x:%llu/%s",
1309 -__entry->error,
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001310 show_nfsv4_errors(__entry->error),
1311 MAJOR(__entry->dev), MINOR(__entry->dev),
1312 (unsigned long long)__entry->dir,
1313 __get_str(name)
1314 )
1315);
1316
1317#define DEFINE_NFS4_LOOKUP_EVENT(name) \
1318 DEFINE_EVENT(nfs4_lookup_event, name, \
1319 TP_PROTO( \
1320 const struct inode *dir, \
1321 const struct qstr *name, \
1322 int error \
1323 ), \
1324 TP_ARGS(dir, name, error))
1325
1326DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
1327DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
1328DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
1329DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
1330DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
1331DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
1332DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
1333
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001334TRACE_EVENT(nfs4_lookupp,
1335 TP_PROTO(
1336 const struct inode *inode,
1337 int error
1338 ),
1339
1340 TP_ARGS(inode, error),
1341
1342 TP_STRUCT__entry(
1343 __field(dev_t, dev)
1344 __field(u64, ino)
Chuck Lever96650e22019-06-19 10:33:53 -04001345 __field(unsigned long, error)
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001346 ),
1347
1348 TP_fast_assign(
1349 __entry->dev = inode->i_sb->s_dev;
1350 __entry->ino = NFS_FILEID(inode);
Trond Myklebust118b6292020-01-06 15:25:06 -05001351 __entry->error = error < 0 ? -error : 0;
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001352 ),
1353
1354 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001355 "error=%ld (%s) inode=%02x:%02x:%llu",
1356 -__entry->error,
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001357 show_nfsv4_errors(__entry->error),
1358 MAJOR(__entry->dev), MINOR(__entry->dev),
1359 (unsigned long long)__entry->ino
1360 )
1361);
1362
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001363TRACE_EVENT(nfs4_rename,
1364 TP_PROTO(
1365 const struct inode *olddir,
1366 const struct qstr *oldname,
1367 const struct inode *newdir,
1368 const struct qstr *newname,
1369 int error
1370 ),
1371
1372 TP_ARGS(olddir, oldname, newdir, newname, error),
1373
1374 TP_STRUCT__entry(
1375 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001376 __field(unsigned long, error)
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001377 __field(u64, olddir)
1378 __string(oldname, oldname->name)
1379 __field(u64, newdir)
1380 __string(newname, newname->name)
1381 ),
1382
1383 TP_fast_assign(
1384 __entry->dev = olddir->i_sb->s_dev;
1385 __entry->olddir = NFS_FILEID(olddir);
1386 __entry->newdir = NFS_FILEID(newdir);
Trond Myklebust118b6292020-01-06 15:25:06 -05001387 __entry->error = error < 0 ? -error : 0;
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001388 __assign_str(oldname, oldname->name);
1389 __assign_str(newname, newname->name);
1390 ),
1391
1392 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001393 "error=%ld (%s) oldname=%02x:%02x:%llu/%s "
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001394 "newname=%02x:%02x:%llu/%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001395 -__entry->error,
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001396 show_nfsv4_errors(__entry->error),
1397 MAJOR(__entry->dev), MINOR(__entry->dev),
1398 (unsigned long long)__entry->olddir,
1399 __get_str(oldname),
1400 MAJOR(__entry->dev), MINOR(__entry->dev),
1401 (unsigned long long)__entry->newdir,
1402 __get_str(newname)
1403 )
1404);
1405
Trond Myklebustc1578b72013-08-12 16:58:42 -04001406DECLARE_EVENT_CLASS(nfs4_inode_event,
1407 TP_PROTO(
1408 const struct inode *inode,
1409 int error
1410 ),
1411
1412 TP_ARGS(inode, error),
1413
1414 TP_STRUCT__entry(
1415 __field(dev_t, dev)
1416 __field(u32, fhandle)
1417 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001418 __field(unsigned long, error)
Trond Myklebustc1578b72013-08-12 16:58:42 -04001419 ),
1420
1421 TP_fast_assign(
1422 __entry->dev = inode->i_sb->s_dev;
1423 __entry->fileid = NFS_FILEID(inode);
1424 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Chuck Lever96650e22019-06-19 10:33:53 -04001425 __entry->error = error < 0 ? -error : 0;
Trond Myklebustc1578b72013-08-12 16:58:42 -04001426 ),
1427
1428 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001429 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
1430 -__entry->error,
Trond Myklebustc1578b72013-08-12 16:58:42 -04001431 show_nfsv4_errors(__entry->error),
1432 MAJOR(__entry->dev), MINOR(__entry->dev),
1433 (unsigned long long)__entry->fileid,
1434 __entry->fhandle
1435 )
1436);
1437
1438#define DEFINE_NFS4_INODE_EVENT(name) \
1439 DEFINE_EVENT(nfs4_inode_event, name, \
1440 TP_PROTO( \
1441 const struct inode *inode, \
1442 int error \
1443 ), \
1444 TP_ARGS(inode, error))
1445
Trond Myklebustc1578b72013-08-12 16:58:42 -04001446DEFINE_NFS4_INODE_EVENT(nfs4_access);
1447DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
1448DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
1449DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
1450DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
1451#ifdef CONFIG_NFS_V4_SECURITY_LABEL
1452DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
1453DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
1454#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001455
1456DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
1457 TP_PROTO(
1458 const struct inode *inode,
1459 const nfs4_stateid *stateid,
1460 int error
1461 ),
1462
1463 TP_ARGS(inode, stateid, error),
1464
1465 TP_STRUCT__entry(
1466 __field(dev_t, dev)
1467 __field(u32, fhandle)
1468 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001469 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001470 __field(int, stateid_seq)
1471 __field(u32, stateid_hash)
1472 ),
1473
1474 TP_fast_assign(
1475 __entry->dev = inode->i_sb->s_dev;
1476 __entry->fileid = NFS_FILEID(inode);
1477 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Trond Myklebust118b6292020-01-06 15:25:06 -05001478 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001479 __entry->stateid_seq =
1480 be32_to_cpu(stateid->seqid);
1481 __entry->stateid_hash =
1482 nfs_stateid_hash(stateid);
1483 ),
1484
1485 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001486 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001487 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001488 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001489 show_nfsv4_errors(__entry->error),
1490 MAJOR(__entry->dev), MINOR(__entry->dev),
1491 (unsigned long long)__entry->fileid,
1492 __entry->fhandle,
1493 __entry->stateid_seq, __entry->stateid_hash
1494 )
1495);
1496
1497#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1498 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1499 TP_PROTO( \
1500 const struct inode *inode, \
1501 const nfs4_stateid *stateid, \
1502 int error \
1503 ), \
1504 TP_ARGS(inode, stateid, error))
1505
1506DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1507DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
Trond Myklebustad9e02d2017-11-06 15:28:02 -05001508DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
1509DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
Trond Myklebustc1578b72013-08-12 16:58:42 -04001510
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001511DECLARE_EVENT_CLASS(nfs4_getattr_event,
1512 TP_PROTO(
1513 const struct nfs_server *server,
1514 const struct nfs_fh *fhandle,
1515 const struct nfs_fattr *fattr,
1516 int error
1517 ),
1518
1519 TP_ARGS(server, fhandle, fattr, error),
1520
1521 TP_STRUCT__entry(
1522 __field(dev_t, dev)
1523 __field(u32, fhandle)
1524 __field(u64, fileid)
1525 __field(unsigned int, valid)
Chuck Lever96650e22019-06-19 10:33:53 -04001526 __field(unsigned long, error)
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001527 ),
1528
1529 TP_fast_assign(
1530 __entry->dev = server->s_dev;
1531 __entry->valid = fattr->valid;
1532 __entry->fhandle = nfs_fhandle_hash(fhandle);
1533 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
Trond Myklebust118b6292020-01-06 15:25:06 -05001534 __entry->error = error < 0 ? -error : 0;
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001535 ),
1536
1537 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001538 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001539 "valid=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001540 -__entry->error,
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001541 show_nfsv4_errors(__entry->error),
1542 MAJOR(__entry->dev), MINOR(__entry->dev),
1543 (unsigned long long)__entry->fileid,
1544 __entry->fhandle,
1545 show_nfs_fattr_flags(__entry->valid)
1546 )
1547);
1548
1549#define DEFINE_NFS4_GETATTR_EVENT(name) \
1550 DEFINE_EVENT(nfs4_getattr_event, name, \
1551 TP_PROTO( \
1552 const struct nfs_server *server, \
1553 const struct nfs_fh *fhandle, \
1554 const struct nfs_fattr *fattr, \
1555 int error \
1556 ), \
1557 TP_ARGS(server, fhandle, fattr, error))
1558DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1559DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1560DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1561
Trond Myklebust7cd14862015-08-20 20:07:54 -05001562DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1563 TP_PROTO(
1564 const struct nfs_client *clp,
1565 const struct nfs_fh *fhandle,
1566 const struct inode *inode,
1567 int error
1568 ),
1569
1570 TP_ARGS(clp, fhandle, inode, error),
1571
1572 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001573 __field(unsigned long, error)
Trond Myklebust7cd14862015-08-20 20:07:54 -05001574 __field(dev_t, dev)
1575 __field(u32, fhandle)
1576 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001577 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001578 ),
1579
1580 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -05001581 __entry->error = error < 0 ? -error : 0;
Trond Myklebust7cd14862015-08-20 20:07:54 -05001582 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2edaead2018-09-05 14:07:13 -04001583 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebust7cd14862015-08-20 20:07:54 -05001584 __entry->fileid = NFS_FILEID(inode);
1585 __entry->dev = inode->i_sb->s_dev;
1586 } else {
1587 __entry->fileid = 0;
1588 __entry->dev = 0;
1589 }
Anna Schumaker39443692017-11-01 15:48:43 -04001590 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001591 ),
1592
1593 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001594 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust7cd14862015-08-20 20:07:54 -05001595 "dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001596 -__entry->error,
Trond Myklebust7cd14862015-08-20 20:07:54 -05001597 show_nfsv4_errors(__entry->error),
1598 MAJOR(__entry->dev), MINOR(__entry->dev),
1599 (unsigned long long)__entry->fileid,
1600 __entry->fhandle,
1601 __get_str(dstaddr)
1602 )
1603);
1604
1605#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1606 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1607 TP_PROTO( \
1608 const struct nfs_client *clp, \
1609 const struct nfs_fh *fhandle, \
1610 const struct inode *inode, \
1611 int error \
1612 ), \
1613 TP_ARGS(clp, fhandle, inode, error))
1614DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1615
Trond Myklebuste07db902015-12-28 14:07:23 -05001616DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1617 TP_PROTO(
1618 const struct nfs_client *clp,
1619 const struct nfs_fh *fhandle,
1620 const struct inode *inode,
1621 const nfs4_stateid *stateid,
1622 int error
1623 ),
1624
1625 TP_ARGS(clp, fhandle, inode, stateid, error),
1626
1627 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001628 __field(unsigned long, error)
Trond Myklebuste07db902015-12-28 14:07:23 -05001629 __field(dev_t, dev)
1630 __field(u32, fhandle)
1631 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001632 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001633 __field(int, stateid_seq)
1634 __field(u32, stateid_hash)
1635 ),
1636
1637 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -05001638 __entry->error = error < 0 ? -error : 0;
Trond Myklebuste07db902015-12-28 14:07:23 -05001639 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2a534a72018-08-23 11:02:49 -04001640 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebuste07db902015-12-28 14:07:23 -05001641 __entry->fileid = NFS_FILEID(inode);
1642 __entry->dev = inode->i_sb->s_dev;
1643 } else {
1644 __entry->fileid = 0;
1645 __entry->dev = 0;
1646 }
Anna Schumaker39443692017-11-01 15:48:43 -04001647 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001648 __entry->stateid_seq =
1649 be32_to_cpu(stateid->seqid);
1650 __entry->stateid_hash =
1651 nfs_stateid_hash(stateid);
1652 ),
1653
1654 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001655 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebuste07db902015-12-28 14:07:23 -05001656 "stateid=%d:0x%08x dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001657 -__entry->error,
Trond Myklebuste07db902015-12-28 14:07:23 -05001658 show_nfsv4_errors(__entry->error),
1659 MAJOR(__entry->dev), MINOR(__entry->dev),
1660 (unsigned long long)__entry->fileid,
1661 __entry->fhandle,
1662 __entry->stateid_seq, __entry->stateid_hash,
1663 __get_str(dstaddr)
1664 )
1665);
1666
1667#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1668 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1669 TP_PROTO( \
1670 const struct nfs_client *clp, \
1671 const struct nfs_fh *fhandle, \
1672 const struct inode *inode, \
1673 const nfs4_stateid *stateid, \
1674 int error \
1675 ), \
1676 TP_ARGS(clp, fhandle, inode, stateid, error))
1677DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1678DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
Trond Myklebust7cd14862015-08-20 20:07:54 -05001679
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001680DECLARE_EVENT_CLASS(nfs4_idmap_event,
1681 TP_PROTO(
1682 const char *name,
1683 int len,
1684 u32 id,
1685 int error
1686 ),
1687
1688 TP_ARGS(name, len, id, error),
1689
1690 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001691 __field(unsigned long, error)
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001692 __field(u32, id)
1693 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1694 ),
1695
1696 TP_fast_assign(
1697 if (len < 0)
1698 len = 0;
1699 __entry->error = error < 0 ? error : 0;
1700 __entry->id = id;
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -03001701 memcpy(__get_str(name), name, len);
1702 __get_str(name)[len] = 0;
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001703 ),
1704
1705 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001706 "error=%ld (%s) id=%u name=%s",
1707 -__entry->error, show_nfsv4_errors(__entry->error),
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001708 __entry->id,
1709 __get_str(name)
1710 )
1711);
1712#define DEFINE_NFS4_IDMAP_EVENT(name) \
1713 DEFINE_EVENT(nfs4_idmap_event, name, \
1714 TP_PROTO( \
1715 const char *name, \
1716 int len, \
1717 u32 id, \
1718 int error \
1719 ), \
1720 TP_ARGS(name, len, id, error))
1721DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1722DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1723DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1724DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1725
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001726DECLARE_EVENT_CLASS(nfs4_read_event,
1727 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001728 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001729 int error
1730 ),
1731
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001732 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001733
1734 TP_STRUCT__entry(
1735 __field(dev_t, dev)
1736 __field(u32, fhandle)
1737 __field(u64, fileid)
1738 __field(loff_t, offset)
Trond Myklebust25925b02020-01-06 15:25:05 -05001739 __field(u32, arg_count)
1740 __field(u32, res_count)
Chuck Lever96650e22019-06-19 10:33:53 -04001741 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001742 __field(int, stateid_seq)
1743 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001744 ),
1745
1746 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001747 const struct inode *inode = hdr->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001748 const struct nfs_inode *nfsi = NFS_I(inode);
1749 const struct nfs_fh *fh = hdr->args.fh ?
1750 hdr->args.fh : &nfsi->fh;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001751 const struct nfs4_state *state =
1752 hdr->args.context->state;
Trond Myklebust25925b02020-01-06 15:25:05 -05001753
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001754 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001755 __entry->fileid = nfsi->fileid;
1756 __entry->fhandle = nfs_fhandle_hash(fh);
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001757 __entry->offset = hdr->args.offset;
Trond Myklebust25925b02020-01-06 15:25:05 -05001758 __entry->arg_count = hdr->args.count;
1759 __entry->res_count = hdr->res.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001760 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001761 __entry->stateid_seq =
1762 be32_to_cpu(state->stateid.seqid);
1763 __entry->stateid_hash =
1764 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001765 ),
1766
1767 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001768 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust25925b02020-01-06 15:25:05 -05001769 "offset=%lld count=%u res=%u stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001770 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001771 show_nfsv4_errors(__entry->error),
1772 MAJOR(__entry->dev), MINOR(__entry->dev),
1773 (unsigned long long)__entry->fileid,
1774 __entry->fhandle,
1775 (long long)__entry->offset,
Trond Myklebust25925b02020-01-06 15:25:05 -05001776 __entry->arg_count, __entry->res_count,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001777 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001778 )
1779);
1780#define DEFINE_NFS4_READ_EVENT(name) \
1781 DEFINE_EVENT(nfs4_read_event, name, \
1782 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001783 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001784 int error \
1785 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001786 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001787DEFINE_NFS4_READ_EVENT(nfs4_read);
1788#ifdef CONFIG_NFS_V4_1
1789DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1790#endif /* CONFIG_NFS_V4_1 */
1791
1792DECLARE_EVENT_CLASS(nfs4_write_event,
1793 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001794 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001795 int error
1796 ),
1797
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001798 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001799
1800 TP_STRUCT__entry(
1801 __field(dev_t, dev)
1802 __field(u32, fhandle)
1803 __field(u64, fileid)
1804 __field(loff_t, offset)
Trond Myklebust25925b02020-01-06 15:25:05 -05001805 __field(u32, arg_count)
1806 __field(u32, res_count)
Chuck Lever96650e22019-06-19 10:33:53 -04001807 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001808 __field(int, stateid_seq)
1809 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001810 ),
1811
1812 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001813 const struct inode *inode = hdr->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001814 const struct nfs_inode *nfsi = NFS_I(inode);
1815 const struct nfs_fh *fh = hdr->args.fh ?
1816 hdr->args.fh : &nfsi->fh;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001817 const struct nfs4_state *state =
1818 hdr->args.context->state;
Trond Myklebust25925b02020-01-06 15:25:05 -05001819
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001820 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001821 __entry->fileid = nfsi->fileid;
1822 __entry->fhandle = nfs_fhandle_hash(fh);
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001823 __entry->offset = hdr->args.offset;
Trond Myklebust25925b02020-01-06 15:25:05 -05001824 __entry->arg_count = hdr->args.count;
1825 __entry->res_count = hdr->res.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001826 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001827 __entry->stateid_seq =
1828 be32_to_cpu(state->stateid.seqid);
1829 __entry->stateid_hash =
1830 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001831 ),
1832
1833 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001834 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust25925b02020-01-06 15:25:05 -05001835 "offset=%lld count=%u res=%u stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001836 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001837 show_nfsv4_errors(__entry->error),
1838 MAJOR(__entry->dev), MINOR(__entry->dev),
1839 (unsigned long long)__entry->fileid,
1840 __entry->fhandle,
1841 (long long)__entry->offset,
Trond Myklebust25925b02020-01-06 15:25:05 -05001842 __entry->arg_count, __entry->res_count,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001843 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001844 )
1845);
1846
1847#define DEFINE_NFS4_WRITE_EVENT(name) \
1848 DEFINE_EVENT(nfs4_write_event, name, \
1849 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001850 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001851 int error \
1852 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001853 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001854DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1855#ifdef CONFIG_NFS_V4_1
1856DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1857#endif /* CONFIG_NFS_V4_1 */
1858
1859DECLARE_EVENT_CLASS(nfs4_commit_event,
1860 TP_PROTO(
1861 const struct nfs_commit_data *data,
1862 int error
1863 ),
1864
1865 TP_ARGS(data, error),
1866
1867 TP_STRUCT__entry(
1868 __field(dev_t, dev)
1869 __field(u32, fhandle)
1870 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001871 __field(unsigned long, error)
Trond Myklebust25925b02020-01-06 15:25:05 -05001872 __field(loff_t, offset)
1873 __field(u32, count)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001874 ),
1875
1876 TP_fast_assign(
1877 const struct inode *inode = data->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001878 const struct nfs_inode *nfsi = NFS_I(inode);
1879 const struct nfs_fh *fh = data->args.fh ?
1880 data->args.fh : &nfsi->fh;
1881
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001882 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001883 __entry->fileid = nfsi->fileid;
1884 __entry->fhandle = nfs_fhandle_hash(fh);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001885 __entry->offset = data->args.offset;
1886 __entry->count = data->args.count;
Trond Myklebust25925b02020-01-06 15:25:05 -05001887 __entry->error = error < 0 ? -error : 0;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001888 ),
1889
1890 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001891 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust25925b02020-01-06 15:25:05 -05001892 "offset=%lld count=%u",
Chuck Lever96650e22019-06-19 10:33:53 -04001893 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001894 show_nfsv4_errors(__entry->error),
1895 MAJOR(__entry->dev), MINOR(__entry->dev),
1896 (unsigned long long)__entry->fileid,
1897 __entry->fhandle,
1898 (long long)__entry->offset,
1899 __entry->count
1900 )
1901);
1902#define DEFINE_NFS4_COMMIT_EVENT(name) \
1903 DEFINE_EVENT(nfs4_commit_event, name, \
1904 TP_PROTO( \
1905 const struct nfs_commit_data *data, \
1906 int error \
1907 ), \
1908 TP_ARGS(data, error))
1909DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1910#ifdef CONFIG_NFS_V4_1
1911DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001912
Chuck Lever5b2095d2018-12-19 11:00:11 -05001913TRACE_DEFINE_ENUM(IOMODE_READ);
1914TRACE_DEFINE_ENUM(IOMODE_RW);
1915TRACE_DEFINE_ENUM(IOMODE_ANY);
1916
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001917#define show_pnfs_iomode(iomode) \
1918 __print_symbolic(iomode, \
1919 { IOMODE_READ, "READ" }, \
1920 { IOMODE_RW, "RW" }, \
1921 { IOMODE_ANY, "ANY" })
1922
1923TRACE_EVENT(nfs4_layoutget,
1924 TP_PROTO(
1925 const struct nfs_open_context *ctx,
1926 const struct pnfs_layout_range *args,
1927 const struct pnfs_layout_range *res,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001928 const nfs4_stateid *layout_stateid,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001929 int error
1930 ),
1931
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001932 TP_ARGS(ctx, args, res, layout_stateid, error),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001933
1934 TP_STRUCT__entry(
1935 __field(dev_t, dev)
1936 __field(u32, fhandle)
1937 __field(u64, fileid)
1938 __field(u32, iomode)
1939 __field(u64, offset)
1940 __field(u64, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001941 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001942 __field(int, stateid_seq)
1943 __field(u32, stateid_hash)
1944 __field(int, layoutstateid_seq)
1945 __field(u32, layoutstateid_hash)
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001946 ),
1947
1948 TP_fast_assign(
David Howells2b0143b2015-03-17 22:25:59 +00001949 const struct inode *inode = d_inode(ctx->dentry);
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001950 const struct nfs4_state *state = ctx->state;
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001951 __entry->dev = inode->i_sb->s_dev;
1952 __entry->fileid = NFS_FILEID(inode);
1953 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1954 __entry->iomode = args->iomode;
1955 __entry->offset = args->offset;
1956 __entry->count = args->length;
Trond Myklebust118b6292020-01-06 15:25:06 -05001957 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001958 __entry->stateid_seq =
1959 be32_to_cpu(state->stateid.seqid);
1960 __entry->stateid_hash =
1961 nfs_stateid_hash(&state->stateid);
1962 if (!error) {
1963 __entry->layoutstateid_seq =
1964 be32_to_cpu(layout_stateid->seqid);
1965 __entry->layoutstateid_hash =
1966 nfs_stateid_hash(layout_stateid);
1967 } else {
1968 __entry->layoutstateid_seq = 0;
1969 __entry->layoutstateid_hash = 0;
1970 }
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001971 ),
1972
1973 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001974 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001975 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1976 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001977 -__entry->error,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001978 show_nfsv4_errors(__entry->error),
1979 MAJOR(__entry->dev), MINOR(__entry->dev),
1980 (unsigned long long)__entry->fileid,
1981 __entry->fhandle,
1982 show_pnfs_iomode(__entry->iomode),
1983 (unsigned long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001984 (unsigned long long)__entry->count,
1985 __entry->stateid_seq, __entry->stateid_hash,
1986 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001987 )
1988);
1989
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001990DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1991DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
Trond Myklebust6a463beb2015-08-20 15:40:47 -05001992DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001993
Chuck Lever5b2095d2018-12-19 11:00:11 -05001994TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN);
1995TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS);
1996TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN);
1997TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH);
1998TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM);
1999TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL);
2000TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL);
2001TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED);
2002TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN);
2003TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED);
2004TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN);
2005TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY);
2006TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
Trond Myklebustd5b92162019-07-18 09:32:17 -04002007TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_EXIT);
Chuck Lever5b2095d2018-12-19 11:00:11 -05002008
Jeff Layton9a4bf312015-12-10 10:41:58 -05002009#define show_pnfs_update_layout_reason(reason) \
2010 __print_symbolic(reason, \
2011 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
2012 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
2013 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
2014 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
2015 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
2016 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
2017 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
2018 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
2019 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
2020 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
Jeff Layton183d9e72016-05-17 12:28:47 -04002021 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
2022 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
Trond Myklebustd5b92162019-07-18 09:32:17 -04002023 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }, \
2024 { PNFS_UPDATE_LAYOUT_EXIT, "exit" })
Jeff Layton9a4bf312015-12-10 10:41:58 -05002025
2026TRACE_EVENT(pnfs_update_layout,
2027 TP_PROTO(struct inode *inode,
2028 loff_t pos,
2029 u64 count,
2030 enum pnfs_iomode iomode,
Trond Myklebustf4848302015-12-26 18:03:07 -05002031 struct pnfs_layout_hdr *lo,
Jeff Layton183d9e72016-05-17 12:28:47 -04002032 struct pnfs_layout_segment *lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05002033 enum pnfs_update_layout_reason reason
2034 ),
Jeff Layton183d9e72016-05-17 12:28:47 -04002035 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
Jeff Layton9a4bf312015-12-10 10:41:58 -05002036 TP_STRUCT__entry(
2037 __field(dev_t, dev)
2038 __field(u64, fileid)
2039 __field(u32, fhandle)
2040 __field(loff_t, pos)
2041 __field(u64, count)
2042 __field(enum pnfs_iomode, iomode)
Trond Myklebustf4848302015-12-26 18:03:07 -05002043 __field(int, layoutstateid_seq)
2044 __field(u32, layoutstateid_hash)
Jeff Layton183d9e72016-05-17 12:28:47 -04002045 __field(long, lseg)
Jeff Layton9a4bf312015-12-10 10:41:58 -05002046 __field(enum pnfs_update_layout_reason, reason)
2047 ),
2048 TP_fast_assign(
2049 __entry->dev = inode->i_sb->s_dev;
2050 __entry->fileid = NFS_FILEID(inode);
2051 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2052 __entry->pos = pos;
2053 __entry->count = count;
2054 __entry->iomode = iomode;
Jeff Layton9a4bf312015-12-10 10:41:58 -05002055 __entry->reason = reason;
Trond Myklebustf4848302015-12-26 18:03:07 -05002056 if (lo != NULL) {
2057 __entry->layoutstateid_seq =
2058 be32_to_cpu(lo->plh_stateid.seqid);
2059 __entry->layoutstateid_hash =
2060 nfs_stateid_hash(&lo->plh_stateid);
2061 } else {
2062 __entry->layoutstateid_seq = 0;
2063 __entry->layoutstateid_hash = 0;
2064 }
Jeff Layton183d9e72016-05-17 12:28:47 -04002065 __entry->lseg = (long)lseg;
Jeff Layton9a4bf312015-12-10 10:41:58 -05002066 ),
2067 TP_printk(
2068 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustf4848302015-12-26 18:03:07 -05002069 "iomode=%s pos=%llu count=%llu "
Jeff Layton183d9e72016-05-17 12:28:47 -04002070 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
Jeff Layton9a4bf312015-12-10 10:41:58 -05002071 MAJOR(__entry->dev), MINOR(__entry->dev),
2072 (unsigned long long)__entry->fileid,
2073 __entry->fhandle,
2074 show_pnfs_iomode(__entry->iomode),
2075 (unsigned long long)__entry->pos,
Trond Myklebustf4848302015-12-26 18:03:07 -05002076 (unsigned long long)__entry->count,
2077 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
Jeff Layton183d9e72016-05-17 12:28:47 -04002078 __entry->lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05002079 show_pnfs_update_layout_reason(__entry->reason)
2080 )
2081);
2082
Trond Myklebustd5b92162019-07-18 09:32:17 -04002083DECLARE_EVENT_CLASS(pnfs_layout_event,
2084 TP_PROTO(struct inode *inode,
2085 loff_t pos,
2086 u64 count,
2087 enum pnfs_iomode iomode,
2088 struct pnfs_layout_hdr *lo,
2089 struct pnfs_layout_segment *lseg
2090 ),
2091 TP_ARGS(inode, pos, count, iomode, lo, lseg),
2092 TP_STRUCT__entry(
2093 __field(dev_t, dev)
2094 __field(u64, fileid)
2095 __field(u32, fhandle)
2096 __field(loff_t, pos)
2097 __field(u64, count)
2098 __field(enum pnfs_iomode, iomode)
2099 __field(int, layoutstateid_seq)
2100 __field(u32, layoutstateid_hash)
2101 __field(long, lseg)
2102 ),
2103 TP_fast_assign(
2104 __entry->dev = inode->i_sb->s_dev;
2105 __entry->fileid = NFS_FILEID(inode);
2106 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2107 __entry->pos = pos;
2108 __entry->count = count;
2109 __entry->iomode = iomode;
2110 if (lo != NULL) {
2111 __entry->layoutstateid_seq =
2112 be32_to_cpu(lo->plh_stateid.seqid);
2113 __entry->layoutstateid_hash =
2114 nfs_stateid_hash(&lo->plh_stateid);
2115 } else {
2116 __entry->layoutstateid_seq = 0;
2117 __entry->layoutstateid_hash = 0;
2118 }
2119 __entry->lseg = (long)lseg;
2120 ),
2121 TP_printk(
2122 "fileid=%02x:%02x:%llu fhandle=0x%08x "
2123 "iomode=%s pos=%llu count=%llu "
2124 "layoutstateid=%d:0x%08x lseg=0x%lx",
2125 MAJOR(__entry->dev), MINOR(__entry->dev),
2126 (unsigned long long)__entry->fileid,
2127 __entry->fhandle,
2128 show_pnfs_iomode(__entry->iomode),
2129 (unsigned long long)__entry->pos,
2130 (unsigned long long)__entry->count,
2131 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
2132 __entry->lseg
2133 )
2134);
2135
2136#define DEFINE_PNFS_LAYOUT_EVENT(name) \
2137 DEFINE_EVENT(pnfs_layout_event, name, \
2138 TP_PROTO(struct inode *inode, \
2139 loff_t pos, \
2140 u64 count, \
2141 enum pnfs_iomode iomode, \
2142 struct pnfs_layout_hdr *lo, \
2143 struct pnfs_layout_segment *lseg \
2144 ), \
2145 TP_ARGS(inode, pos, count, iomode, lo, lseg))
2146
2147DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_read);
2148DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_write);
2149DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_get_mirror_count);
2150DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_done);
2151DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done);
2152DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist);
2153DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist);
2154
Trond Myklebust088f3e62020-01-06 15:25:11 -05002155DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event,
2156 TP_PROTO(
2157 const struct nfs_pgio_header *hdr
2158 ),
2159
2160 TP_ARGS(hdr),
2161
2162 TP_STRUCT__entry(
2163 __field(unsigned long, error)
2164 __field(dev_t, dev)
2165 __field(u32, fhandle)
2166 __field(u64, fileid)
2167 __field(loff_t, offset)
2168 __field(u32, count)
2169 __field(int, stateid_seq)
2170 __field(u32, stateid_hash)
2171 __string(dstaddr, hdr->ds_clp ?
2172 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
2173 RPC_DISPLAY_ADDR) : "unknown")
2174 ),
2175
2176 TP_fast_assign(
2177 const struct inode *inode = hdr->inode;
2178
2179 __entry->error = hdr->res.op_status;
2180 __entry->fhandle = nfs_fhandle_hash(hdr->args.fh);
2181 __entry->fileid = NFS_FILEID(inode);
2182 __entry->dev = inode->i_sb->s_dev;
2183 __entry->offset = hdr->args.offset;
2184 __entry->count = hdr->args.count;
2185 __entry->stateid_seq =
2186 be32_to_cpu(hdr->args.stateid.seqid);
2187 __entry->stateid_hash =
2188 nfs_stateid_hash(&hdr->args.stateid);
2189 __assign_str(dstaddr, hdr->ds_clp ?
2190 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
2191 RPC_DISPLAY_ADDR) : "unknown");
2192 ),
2193
2194 TP_printk(
2195 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2196 "offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s",
2197 -__entry->error,
2198 show_nfsv4_errors(__entry->error),
2199 MAJOR(__entry->dev), MINOR(__entry->dev),
2200 (unsigned long long)__entry->fileid,
2201 __entry->fhandle,
2202 __entry->offset, __entry->count,
2203 __entry->stateid_seq, __entry->stateid_hash,
2204 __get_str(dstaddr)
2205 )
2206);
2207
2208#define DEFINE_NFS4_FLEXFILES_IO_EVENT(name) \
2209 DEFINE_EVENT(nfs4_flexfiles_io_event, name, \
2210 TP_PROTO( \
2211 const struct nfs_pgio_header *hdr \
2212 ), \
2213 TP_ARGS(hdr))
2214DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_read_error);
2215DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_write_error);
2216
2217TRACE_EVENT(ff_layout_commit_error,
2218 TP_PROTO(
2219 const struct nfs_commit_data *data
2220 ),
2221
2222 TP_ARGS(data),
2223
2224 TP_STRUCT__entry(
2225 __field(unsigned long, error)
2226 __field(dev_t, dev)
2227 __field(u32, fhandle)
2228 __field(u64, fileid)
2229 __field(loff_t, offset)
2230 __field(u32, count)
2231 __string(dstaddr, data->ds_clp ?
2232 rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
2233 RPC_DISPLAY_ADDR) : "unknown")
2234 ),
2235
2236 TP_fast_assign(
2237 const struct inode *inode = data->inode;
2238
2239 __entry->error = data->res.op_status;
2240 __entry->fhandle = nfs_fhandle_hash(data->args.fh);
2241 __entry->fileid = NFS_FILEID(inode);
2242 __entry->dev = inode->i_sb->s_dev;
2243 __entry->offset = data->args.offset;
2244 __entry->count = data->args.count;
2245 __assign_str(dstaddr, data->ds_clp ?
2246 rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
2247 RPC_DISPLAY_ADDR) : "unknown");
2248 ),
2249
2250 TP_printk(
2251 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2252 "offset=%llu count=%u dstaddr=%s",
2253 -__entry->error,
2254 show_nfsv4_errors(__entry->error),
2255 MAJOR(__entry->dev), MINOR(__entry->dev),
2256 (unsigned long long)__entry->fileid,
2257 __entry->fhandle,
2258 __entry->offset, __entry->count,
2259 __get_str(dstaddr)
2260 )
2261);
2262
2263
Trond Myklebustcc668ab2013-08-14 15:31:28 -04002264#endif /* CONFIG_NFS_V4_1 */
2265
Trond Myklebustc6d01c62013-08-09 11:51:26 -04002266#endif /* _TRACE_NFS4_H */
2267
2268#undef TRACE_INCLUDE_PATH
2269#define TRACE_INCLUDE_PATH .
2270#define TRACE_INCLUDE_FILE nfs4trace
2271/* This part must be outside protection */
2272#include <trace/define_trace.h>