blob: 9a39fd51c8e796feff6cc61cd1af980edfd3bdf5 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Trond Myklebustc6d01c62013-08-09 11:51:26 -04002/*
3 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
4 */
5#undef TRACE_SYSTEM
6#define TRACE_SYSTEM nfs4
7
8#if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
9#define _TRACE_NFS4_H
10
11#include <linux/tracepoint.h>
12
Chuck Lever5b2095d2018-12-19 11:00:11 -050013TRACE_DEFINE_ENUM(EPERM);
14TRACE_DEFINE_ENUM(ENOENT);
15TRACE_DEFINE_ENUM(EIO);
16TRACE_DEFINE_ENUM(ENXIO);
17TRACE_DEFINE_ENUM(EACCES);
18TRACE_DEFINE_ENUM(EEXIST);
19TRACE_DEFINE_ENUM(EXDEV);
20TRACE_DEFINE_ENUM(ENOTDIR);
21TRACE_DEFINE_ENUM(EISDIR);
22TRACE_DEFINE_ENUM(EFBIG);
23TRACE_DEFINE_ENUM(ENOSPC);
24TRACE_DEFINE_ENUM(EROFS);
25TRACE_DEFINE_ENUM(EMLINK);
26TRACE_DEFINE_ENUM(ENAMETOOLONG);
27TRACE_DEFINE_ENUM(ENOTEMPTY);
28TRACE_DEFINE_ENUM(EDQUOT);
29TRACE_DEFINE_ENUM(ESTALE);
30TRACE_DEFINE_ENUM(EBADHANDLE);
31TRACE_DEFINE_ENUM(EBADCOOKIE);
32TRACE_DEFINE_ENUM(ENOTSUPP);
33TRACE_DEFINE_ENUM(ETOOSMALL);
34TRACE_DEFINE_ENUM(EREMOTEIO);
35TRACE_DEFINE_ENUM(EBADTYPE);
36TRACE_DEFINE_ENUM(EAGAIN);
37TRACE_DEFINE_ENUM(ELOOP);
38TRACE_DEFINE_ENUM(EOPNOTSUPP);
39TRACE_DEFINE_ENUM(EDEADLK);
40TRACE_DEFINE_ENUM(ENOMEM);
41TRACE_DEFINE_ENUM(EKEYEXPIRED);
42TRACE_DEFINE_ENUM(ETIMEDOUT);
43TRACE_DEFINE_ENUM(ERESTARTSYS);
44TRACE_DEFINE_ENUM(ECONNREFUSED);
45TRACE_DEFINE_ENUM(ECONNRESET);
46TRACE_DEFINE_ENUM(ENETUNREACH);
47TRACE_DEFINE_ENUM(EHOSTUNREACH);
48TRACE_DEFINE_ENUM(EHOSTDOWN);
49TRACE_DEFINE_ENUM(EPIPE);
50TRACE_DEFINE_ENUM(EPFNOSUPPORT);
51TRACE_DEFINE_ENUM(EPROTONOSUPPORT);
52
53TRACE_DEFINE_ENUM(NFS4_OK);
54TRACE_DEFINE_ENUM(NFS4ERR_ACCESS);
55TRACE_DEFINE_ENUM(NFS4ERR_ATTRNOTSUPP);
56TRACE_DEFINE_ENUM(NFS4ERR_ADMIN_REVOKED);
57TRACE_DEFINE_ENUM(NFS4ERR_BACK_CHAN_BUSY);
58TRACE_DEFINE_ENUM(NFS4ERR_BADCHAR);
59TRACE_DEFINE_ENUM(NFS4ERR_BADHANDLE);
60TRACE_DEFINE_ENUM(NFS4ERR_BADIOMODE);
61TRACE_DEFINE_ENUM(NFS4ERR_BADLAYOUT);
62TRACE_DEFINE_ENUM(NFS4ERR_BADLABEL);
63TRACE_DEFINE_ENUM(NFS4ERR_BADNAME);
64TRACE_DEFINE_ENUM(NFS4ERR_BADOWNER);
65TRACE_DEFINE_ENUM(NFS4ERR_BADSESSION);
66TRACE_DEFINE_ENUM(NFS4ERR_BADSLOT);
67TRACE_DEFINE_ENUM(NFS4ERR_BADTYPE);
68TRACE_DEFINE_ENUM(NFS4ERR_BADXDR);
69TRACE_DEFINE_ENUM(NFS4ERR_BAD_COOKIE);
70TRACE_DEFINE_ENUM(NFS4ERR_BAD_HIGH_SLOT);
71TRACE_DEFINE_ENUM(NFS4ERR_BAD_RANGE);
72TRACE_DEFINE_ENUM(NFS4ERR_BAD_SEQID);
73TRACE_DEFINE_ENUM(NFS4ERR_BAD_SESSION_DIGEST);
74TRACE_DEFINE_ENUM(NFS4ERR_BAD_STATEID);
75TRACE_DEFINE_ENUM(NFS4ERR_CB_PATH_DOWN);
76TRACE_DEFINE_ENUM(NFS4ERR_CLID_INUSE);
77TRACE_DEFINE_ENUM(NFS4ERR_CLIENTID_BUSY);
78TRACE_DEFINE_ENUM(NFS4ERR_COMPLETE_ALREADY);
79TRACE_DEFINE_ENUM(NFS4ERR_CONN_NOT_BOUND_TO_SESSION);
80TRACE_DEFINE_ENUM(NFS4ERR_DEADLOCK);
81TRACE_DEFINE_ENUM(NFS4ERR_DEADSESSION);
82TRACE_DEFINE_ENUM(NFS4ERR_DELAY);
83TRACE_DEFINE_ENUM(NFS4ERR_DELEG_ALREADY_WANTED);
84TRACE_DEFINE_ENUM(NFS4ERR_DELEG_REVOKED);
85TRACE_DEFINE_ENUM(NFS4ERR_DENIED);
86TRACE_DEFINE_ENUM(NFS4ERR_DIRDELEG_UNAVAIL);
87TRACE_DEFINE_ENUM(NFS4ERR_DQUOT);
88TRACE_DEFINE_ENUM(NFS4ERR_ENCR_ALG_UNSUPP);
89TRACE_DEFINE_ENUM(NFS4ERR_EXIST);
90TRACE_DEFINE_ENUM(NFS4ERR_EXPIRED);
91TRACE_DEFINE_ENUM(NFS4ERR_FBIG);
92TRACE_DEFINE_ENUM(NFS4ERR_FHEXPIRED);
93TRACE_DEFINE_ENUM(NFS4ERR_FILE_OPEN);
94TRACE_DEFINE_ENUM(NFS4ERR_GRACE);
95TRACE_DEFINE_ENUM(NFS4ERR_HASH_ALG_UNSUPP);
96TRACE_DEFINE_ENUM(NFS4ERR_INVAL);
97TRACE_DEFINE_ENUM(NFS4ERR_IO);
98TRACE_DEFINE_ENUM(NFS4ERR_ISDIR);
99TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTTRYLATER);
100TRACE_DEFINE_ENUM(NFS4ERR_LAYOUTUNAVAILABLE);
101TRACE_DEFINE_ENUM(NFS4ERR_LEASE_MOVED);
102TRACE_DEFINE_ENUM(NFS4ERR_LOCKED);
103TRACE_DEFINE_ENUM(NFS4ERR_LOCKS_HELD);
104TRACE_DEFINE_ENUM(NFS4ERR_LOCK_RANGE);
105TRACE_DEFINE_ENUM(NFS4ERR_MINOR_VERS_MISMATCH);
106TRACE_DEFINE_ENUM(NFS4ERR_MLINK);
107TRACE_DEFINE_ENUM(NFS4ERR_MOVED);
108TRACE_DEFINE_ENUM(NFS4ERR_NAMETOOLONG);
109TRACE_DEFINE_ENUM(NFS4ERR_NOENT);
110TRACE_DEFINE_ENUM(NFS4ERR_NOFILEHANDLE);
111TRACE_DEFINE_ENUM(NFS4ERR_NOMATCHING_LAYOUT);
112TRACE_DEFINE_ENUM(NFS4ERR_NOSPC);
113TRACE_DEFINE_ENUM(NFS4ERR_NOTDIR);
114TRACE_DEFINE_ENUM(NFS4ERR_NOTEMPTY);
115TRACE_DEFINE_ENUM(NFS4ERR_NOTSUPP);
116TRACE_DEFINE_ENUM(NFS4ERR_NOT_ONLY_OP);
117TRACE_DEFINE_ENUM(NFS4ERR_NOT_SAME);
118TRACE_DEFINE_ENUM(NFS4ERR_NO_GRACE);
119TRACE_DEFINE_ENUM(NFS4ERR_NXIO);
120TRACE_DEFINE_ENUM(NFS4ERR_OLD_STATEID);
121TRACE_DEFINE_ENUM(NFS4ERR_OPENMODE);
122TRACE_DEFINE_ENUM(NFS4ERR_OP_ILLEGAL);
123TRACE_DEFINE_ENUM(NFS4ERR_OP_NOT_IN_SESSION);
124TRACE_DEFINE_ENUM(NFS4ERR_PERM);
125TRACE_DEFINE_ENUM(NFS4ERR_PNFS_IO_HOLE);
126TRACE_DEFINE_ENUM(NFS4ERR_PNFS_NO_LAYOUT);
127TRACE_DEFINE_ENUM(NFS4ERR_RECALLCONFLICT);
128TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_BAD);
129TRACE_DEFINE_ENUM(NFS4ERR_RECLAIM_CONFLICT);
130TRACE_DEFINE_ENUM(NFS4ERR_REJECT_DELEG);
131TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG);
132TRACE_DEFINE_ENUM(NFS4ERR_REP_TOO_BIG_TO_CACHE);
133TRACE_DEFINE_ENUM(NFS4ERR_REQ_TOO_BIG);
134TRACE_DEFINE_ENUM(NFS4ERR_RESOURCE);
135TRACE_DEFINE_ENUM(NFS4ERR_RESTOREFH);
136TRACE_DEFINE_ENUM(NFS4ERR_RETRY_UNCACHED_REP);
137TRACE_DEFINE_ENUM(NFS4ERR_RETURNCONFLICT);
138TRACE_DEFINE_ENUM(NFS4ERR_ROFS);
139TRACE_DEFINE_ENUM(NFS4ERR_SAME);
140TRACE_DEFINE_ENUM(NFS4ERR_SHARE_DENIED);
141TRACE_DEFINE_ENUM(NFS4ERR_SEQUENCE_POS);
142TRACE_DEFINE_ENUM(NFS4ERR_SEQ_FALSE_RETRY);
143TRACE_DEFINE_ENUM(NFS4ERR_SEQ_MISORDERED);
144TRACE_DEFINE_ENUM(NFS4ERR_SERVERFAULT);
145TRACE_DEFINE_ENUM(NFS4ERR_STALE);
146TRACE_DEFINE_ENUM(NFS4ERR_STALE_CLIENTID);
147TRACE_DEFINE_ENUM(NFS4ERR_STALE_STATEID);
148TRACE_DEFINE_ENUM(NFS4ERR_SYMLINK);
149TRACE_DEFINE_ENUM(NFS4ERR_TOOSMALL);
150TRACE_DEFINE_ENUM(NFS4ERR_TOO_MANY_OPS);
151TRACE_DEFINE_ENUM(NFS4ERR_UNKNOWN_LAYOUTTYPE);
152TRACE_DEFINE_ENUM(NFS4ERR_UNSAFE_COMPOUND);
153TRACE_DEFINE_ENUM(NFS4ERR_WRONGSEC);
154TRACE_DEFINE_ENUM(NFS4ERR_WRONG_CRED);
155TRACE_DEFINE_ENUM(NFS4ERR_WRONG_TYPE);
156TRACE_DEFINE_ENUM(NFS4ERR_XDEV);
157
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400158#define show_nfsv4_errors(error) \
Chuck Lever96650e22019-06-19 10:33:53 -0400159 __print_symbolic(error, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400160 { NFS4_OK, "OK" }, \
161 /* Mapped by nfs4_stat_to_errno() */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500162 { EPERM, "EPERM" }, \
163 { ENOENT, "ENOENT" }, \
164 { EIO, "EIO" }, \
165 { ENXIO, "ENXIO" }, \
166 { EACCES, "EACCES" }, \
167 { EEXIST, "EEXIST" }, \
168 { EXDEV, "EXDEV" }, \
169 { ENOTDIR, "ENOTDIR" }, \
170 { EISDIR, "EISDIR" }, \
171 { EFBIG, "EFBIG" }, \
172 { ENOSPC, "ENOSPC" }, \
173 { EROFS, "EROFS" }, \
174 { EMLINK, "EMLINK" }, \
175 { ENAMETOOLONG, "ENAMETOOLONG" }, \
176 { ENOTEMPTY, "ENOTEMPTY" }, \
177 { EDQUOT, "EDQUOT" }, \
178 { ESTALE, "ESTALE" }, \
179 { EBADHANDLE, "EBADHANDLE" }, \
180 { EBADCOOKIE, "EBADCOOKIE" }, \
181 { ENOTSUPP, "ENOTSUPP" }, \
182 { ETOOSMALL, "ETOOSMALL" }, \
183 { EREMOTEIO, "EREMOTEIO" }, \
184 { EBADTYPE, "EBADTYPE" }, \
185 { EAGAIN, "EAGAIN" }, \
186 { ELOOP, "ELOOP" }, \
187 { EOPNOTSUPP, "EOPNOTSUPP" }, \
188 { EDEADLK, "EDEADLK" }, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400189 /* RPC errors */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500190 { ENOMEM, "ENOMEM" }, \
191 { EKEYEXPIRED, "EKEYEXPIRED" }, \
192 { ETIMEDOUT, "ETIMEDOUT" }, \
193 { ERESTARTSYS, "ERESTARTSYS" }, \
194 { ECONNREFUSED, "ECONNREFUSED" }, \
195 { ECONNRESET, "ECONNRESET" }, \
196 { ENETUNREACH, "ENETUNREACH" }, \
197 { EHOSTUNREACH, "EHOSTUNREACH" }, \
198 { EHOSTDOWN, "EHOSTDOWN" }, \
199 { EPIPE, "EPIPE" }, \
200 { EPFNOSUPPORT, "EPFNOSUPPORT" }, \
201 { EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400202 /* NFSv4 native errors */ \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500203 { NFS4ERR_ACCESS, "ACCESS" }, \
204 { NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \
205 { NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \
206 { NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \
207 { NFS4ERR_BADCHAR, "BADCHAR" }, \
208 { NFS4ERR_BADHANDLE, "BADHANDLE" }, \
209 { NFS4ERR_BADIOMODE, "BADIOMODE" }, \
210 { NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \
211 { NFS4ERR_BADLABEL, "BADLABEL" }, \
212 { NFS4ERR_BADNAME, "BADNAME" }, \
213 { NFS4ERR_BADOWNER, "BADOWNER" }, \
214 { NFS4ERR_BADSESSION, "BADSESSION" }, \
215 { NFS4ERR_BADSLOT, "BADSLOT" }, \
216 { NFS4ERR_BADTYPE, "BADTYPE" }, \
217 { NFS4ERR_BADXDR, "BADXDR" }, \
218 { NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \
219 { NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \
220 { NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \
221 { NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \
222 { NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \
223 { NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \
224 { NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
225 { NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \
226 { NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \
227 { NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \
228 { NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400229 "CONN_NOT_BOUND_TO_SESSION" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500230 { NFS4ERR_DEADLOCK, "DEADLOCK" }, \
231 { NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \
232 { NFS4ERR_DELAY, "DELAY" }, \
233 { NFS4ERR_DELEG_ALREADY_WANTED, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400234 "DELEG_ALREADY_WANTED" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500235 { NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \
236 { NFS4ERR_DENIED, "DENIED" }, \
237 { NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \
238 { NFS4ERR_DQUOT, "DQUOT" }, \
239 { NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \
240 { NFS4ERR_EXIST, "EXIST" }, \
241 { NFS4ERR_EXPIRED, "EXPIRED" }, \
242 { NFS4ERR_FBIG, "FBIG" }, \
243 { NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \
244 { NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \
245 { NFS4ERR_GRACE, "GRACE" }, \
246 { NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \
247 { NFS4ERR_INVAL, "INVAL" }, \
248 { NFS4ERR_IO, "IO" }, \
249 { NFS4ERR_ISDIR, "ISDIR" }, \
250 { NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \
251 { NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \
252 { NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \
253 { NFS4ERR_LOCKED, "LOCKED" }, \
254 { NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \
255 { NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \
256 { NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \
257 { NFS4ERR_MLINK, "MLINK" }, \
258 { NFS4ERR_MOVED, "MOVED" }, \
259 { NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \
260 { NFS4ERR_NOENT, "NOENT" }, \
261 { NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \
262 { NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \
263 { NFS4ERR_NOSPC, "NOSPC" }, \
264 { NFS4ERR_NOTDIR, "NOTDIR" }, \
265 { NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \
266 { NFS4ERR_NOTSUPP, "NOTSUPP" }, \
267 { NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \
268 { NFS4ERR_NOT_SAME, "NOT_SAME" }, \
269 { NFS4ERR_NO_GRACE, "NO_GRACE" }, \
270 { NFS4ERR_NXIO, "NXIO" }, \
271 { NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \
272 { NFS4ERR_OPENMODE, "OPENMODE" }, \
273 { NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \
274 { NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \
275 { NFS4ERR_PERM, "PERM" }, \
276 { NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \
277 { NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \
278 { NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \
279 { NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \
280 { NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \
281 { NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \
282 { NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \
283 { NFS4ERR_REP_TOO_BIG_TO_CACHE, \
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400284 "REP_TOO_BIG_TO_CACHE" }, \
Chuck Lever5b2095d2018-12-19 11:00:11 -0500285 { NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \
286 { NFS4ERR_RESOURCE, "RESOURCE" }, \
287 { NFS4ERR_RESTOREFH, "RESTOREFH" }, \
288 { NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \
289 { NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \
290 { NFS4ERR_ROFS, "ROFS" }, \
291 { NFS4ERR_SAME, "SAME" }, \
292 { NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \
293 { NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \
294 { NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \
295 { NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \
296 { NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \
297 { NFS4ERR_STALE, "STALE" }, \
298 { NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \
299 { NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \
300 { NFS4ERR_SYMLINK, "SYMLINK" }, \
301 { NFS4ERR_TOOSMALL, "TOOSMALL" }, \
302 { NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \
303 { NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \
304 { NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \
305 { NFS4ERR_WRONGSEC, "WRONGSEC" }, \
306 { NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
307 { NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
308 { NFS4ERR_XDEV, "XDEV" })
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400309
Trond Myklebust42113a72013-08-12 16:19:27 -0400310#define show_open_flags(flags) \
311 __print_flags(flags, "|", \
312 { O_CREAT, "O_CREAT" }, \
313 { O_EXCL, "O_EXCL" }, \
314 { O_TRUNC, "O_TRUNC" }, \
315 { O_DIRECT, "O_DIRECT" })
316
317#define show_fmode_flags(mode) \
318 __print_flags(mode, "|", \
319 { ((__force unsigned long)FMODE_READ), "READ" }, \
320 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
321 { ((__force unsigned long)FMODE_EXEC), "EXEC" })
322
Trond Myklebustb5f875a2013-08-13 13:01:39 -0400323#define show_nfs_fattr_flags(valid) \
324 __print_flags((unsigned long)valid, "|", \
325 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \
326 { NFS_ATTR_FATTR_MODE, "MODE" }, \
327 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \
328 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \
329 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \
330 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \
331 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \
332 { NFS_ATTR_FATTR_FSID, "FSID" }, \
333 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \
334 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \
335 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \
336 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \
337 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
338 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
339 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
340
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400341DECLARE_EVENT_CLASS(nfs4_clientid_event,
342 TP_PROTO(
343 const struct nfs_client *clp,
344 int error
345 ),
346
347 TP_ARGS(clp, error),
348
349 TP_STRUCT__entry(
Anna Schumaker39443692017-11-01 15:48:43 -0400350 __string(dstaddr, clp->cl_hostname)
Chuck Lever96650e22019-06-19 10:33:53 -0400351 __field(unsigned long, error)
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400352 ),
353
354 TP_fast_assign(
355 __entry->error = error;
Anna Schumaker39443692017-11-01 15:48:43 -0400356 __assign_str(dstaddr, clp->cl_hostname);
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400357 ),
358
359 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400360 "error=%ld (%s) dstaddr=%s",
361 -__entry->error,
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400362 show_nfsv4_errors(__entry->error),
363 __get_str(dstaddr)
364 )
365);
366#define DEFINE_NFS4_CLIENTID_EVENT(name) \
367 DEFINE_EVENT(nfs4_clientid_event, name, \
368 TP_PROTO( \
369 const struct nfs_client *clp, \
370 int error \
371 ), \
372 TP_ARGS(clp, error))
373DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
374DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
375DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
376DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
377#ifdef CONFIG_NFS_V4_1
378DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
379DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
380DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
381DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
382DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
383DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
384DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400385
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400386#define show_nfs4_sequence_status_flags(status) \
387 __print_flags((unsigned long)status, "|", \
388 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
389 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
390 "CB_GSS_CONTEXTS_EXPIRING" }, \
391 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
392 "CB_GSS_CONTEXTS_EXPIRED" }, \
393 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
394 "EXPIRED_ALL_STATE_REVOKED" }, \
395 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
396 "EXPIRED_SOME_STATE_REVOKED" }, \
397 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
398 "ADMIN_STATE_REVOKED" }, \
399 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
400 "RECALLABLE_STATE_REVOKED" }, \
401 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
402 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
403 "RESTART_RECLAIM_NEEDED" }, \
404 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
405 "CB_PATH_DOWN_SESSION" }, \
406 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
407 "BACKCHANNEL_FAULT" })
408
409TRACE_EVENT(nfs4_sequence_done,
410 TP_PROTO(
411 const struct nfs4_session *session,
412 const struct nfs4_sequence_res *res
413 ),
414 TP_ARGS(session, res),
415
416 TP_STRUCT__entry(
417 __field(unsigned int, session)
418 __field(unsigned int, slot_nr)
419 __field(unsigned int, seq_nr)
420 __field(unsigned int, highest_slotid)
421 __field(unsigned int, target_highest_slotid)
422 __field(unsigned int, status_flags)
Chuck Lever96650e22019-06-19 10:33:53 -0400423 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400424 ),
425
426 TP_fast_assign(
427 const struct nfs4_slot *sr_slot = res->sr_slot;
428 __entry->session = nfs_session_id_hash(&session->sess_id);
429 __entry->slot_nr = sr_slot->slot_nr;
430 __entry->seq_nr = sr_slot->seq_nr;
431 __entry->highest_slotid = res->sr_highest_slotid;
432 __entry->target_highest_slotid =
433 res->sr_target_highest_slotid;
Andrew Elble52618df2015-12-02 09:19:43 -0500434 __entry->status_flags = res->sr_status_flags;
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400435 __entry->error = res->sr_status;
436 ),
437 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400438 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400439 "highest_slotid=%u target_highest_slotid=%u "
440 "status_flags=%u (%s)",
Chuck Lever96650e22019-06-19 10:33:53 -0400441 -__entry->error,
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400442 show_nfsv4_errors(__entry->error),
443 __entry->session,
444 __entry->slot_nr,
445 __entry->seq_nr,
446 __entry->highest_slotid,
447 __entry->target_highest_slotid,
448 __entry->status_flags,
449 show_nfs4_sequence_status_flags(__entry->status_flags)
450 )
451);
452
453struct cb_sequenceargs;
454struct cb_sequenceres;
455
456TRACE_EVENT(nfs4_cb_sequence,
457 TP_PROTO(
458 const struct cb_sequenceargs *args,
459 const struct cb_sequenceres *res,
460 __be32 status
461 ),
462 TP_ARGS(args, res, status),
463
464 TP_STRUCT__entry(
465 __field(unsigned int, session)
466 __field(unsigned int, slot_nr)
467 __field(unsigned int, seq_nr)
468 __field(unsigned int, highest_slotid)
469 __field(unsigned int, cachethis)
Chuck Lever96650e22019-06-19 10:33:53 -0400470 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400471 ),
472
473 TP_fast_assign(
474 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
475 __entry->slot_nr = args->csa_slotid;
476 __entry->seq_nr = args->csa_sequenceid;
477 __entry->highest_slotid = args->csa_highestslotid;
478 __entry->cachethis = args->csa_cachethis;
Chuck Lever96650e22019-06-19 10:33:53 -0400479 __entry->error = be32_to_cpu(status);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400480 ),
481
482 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400483 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400484 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400485 -__entry->error,
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400486 show_nfsv4_errors(__entry->error),
487 __entry->session,
488 __entry->slot_nr,
489 __entry->seq_nr,
490 __entry->highest_slotid
491 )
492);
Chuck Leverc5833f02019-06-19 10:33:47 -0400493
494TRACE_EVENT(nfs4_cb_seqid_err,
495 TP_PROTO(
496 const struct cb_sequenceargs *args,
497 __be32 status
498 ),
499 TP_ARGS(args, status),
500
501 TP_STRUCT__entry(
502 __field(unsigned int, session)
503 __field(unsigned int, slot_nr)
504 __field(unsigned int, seq_nr)
505 __field(unsigned int, highest_slotid)
506 __field(unsigned int, cachethis)
Chuck Lever96650e22019-06-19 10:33:53 -0400507 __field(unsigned long, error)
Chuck Leverc5833f02019-06-19 10:33:47 -0400508 ),
509
510 TP_fast_assign(
511 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
512 __entry->slot_nr = args->csa_slotid;
513 __entry->seq_nr = args->csa_sequenceid;
514 __entry->highest_slotid = args->csa_highestslotid;
515 __entry->cachethis = args->csa_cachethis;
Chuck Lever96650e22019-06-19 10:33:53 -0400516 __entry->error = be32_to_cpu(status);
Chuck Leverc5833f02019-06-19 10:33:47 -0400517 ),
518
519 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400520 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Chuck Leverc5833f02019-06-19 10:33:47 -0400521 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400522 -__entry->error,
Chuck Leverc5833f02019-06-19 10:33:47 -0400523 show_nfsv4_errors(__entry->error),
524 __entry->session,
525 __entry->slot_nr,
526 __entry->seq_nr,
527 __entry->highest_slotid
528 )
529);
530
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400531#endif /* CONFIG_NFS_V4_1 */
532
Anna Schumakerad05cc02017-01-11 13:37:06 -0500533TRACE_EVENT(nfs4_setup_sequence,
534 TP_PROTO(
535 const struct nfs4_session *session,
536 const struct nfs4_sequence_args *args
537 ),
538 TP_ARGS(session, args),
539
540 TP_STRUCT__entry(
541 __field(unsigned int, session)
542 __field(unsigned int, slot_nr)
543 __field(unsigned int, seq_nr)
544 __field(unsigned int, highest_used_slotid)
545 ),
546
547 TP_fast_assign(
548 const struct nfs4_slot *sa_slot = args->sa_slot;
549 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
550 __entry->slot_nr = sa_slot->slot_nr;
551 __entry->seq_nr = sa_slot->seq_nr;
552 __entry->highest_used_slotid =
553 sa_slot->table->highest_used_slotid;
554 ),
555 TP_printk(
556 "session=0x%08x slot_nr=%u seq_nr=%u "
557 "highest_used_slotid=%u",
558 __entry->session,
559 __entry->slot_nr,
560 __entry->seq_nr,
561 __entry->highest_used_slotid
562 )
563);
564
Chuck Leverf23f6582019-02-11 11:24:26 -0500565TRACE_EVENT(nfs4_xdr_status,
566 TP_PROTO(
567 u32 op,
568 int error
569 ),
570
571 TP_ARGS(op, error),
572
573 TP_STRUCT__entry(
574 __field(u32, op)
Chuck Lever96650e22019-06-19 10:33:53 -0400575 __field(unsigned long, error)
Chuck Leverf23f6582019-02-11 11:24:26 -0500576 ),
577
578 TP_fast_assign(
579 __entry->op = op;
Chuck Lever96650e22019-06-19 10:33:53 -0400580 __entry->error = error;
Chuck Leverf23f6582019-02-11 11:24:26 -0500581 ),
582
583 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400584 "error=%ld (%s) operation %d:",
585 -__entry->error, show_nfsv4_errors(__entry->error),
586 __entry->op
Chuck Leverf23f6582019-02-11 11:24:26 -0500587 )
588);
589
Trond Myklebust42113a72013-08-12 16:19:27 -0400590DECLARE_EVENT_CLASS(nfs4_open_event,
591 TP_PROTO(
592 const struct nfs_open_context *ctx,
593 int flags,
594 int error
595 ),
596
597 TP_ARGS(ctx, flags, error),
598
599 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400600 __field(unsigned long, error)
Trond Myklebust42113a72013-08-12 16:19:27 -0400601 __field(unsigned int, flags)
602 __field(unsigned int, fmode)
603 __field(dev_t, dev)
604 __field(u32, fhandle)
605 __field(u64, fileid)
606 __field(u64, dir)
607 __string(name, ctx->dentry->d_name.name)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500608 __field(int, stateid_seq)
609 __field(u32, stateid_hash)
610 __field(int, openstateid_seq)
611 __field(u32, openstateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400612 ),
613
614 TP_fast_assign(
615 const struct nfs4_state *state = ctx->state;
616 const struct inode *inode = NULL;
617
Chuck Lever96650e22019-06-19 10:33:53 -0400618 __entry->error = -error;
Trond Myklebust42113a72013-08-12 16:19:27 -0400619 __entry->flags = flags;
620 __entry->fmode = (__force unsigned int)ctx->mode;
621 __entry->dev = ctx->dentry->d_sb->s_dev;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500622 if (!IS_ERR_OR_NULL(state)) {
Trond Myklebust42113a72013-08-12 16:19:27 -0400623 inode = state->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500624 __entry->stateid_seq =
625 be32_to_cpu(state->stateid.seqid);
626 __entry->stateid_hash =
627 nfs_stateid_hash(&state->stateid);
628 __entry->openstateid_seq =
629 be32_to_cpu(state->open_stateid.seqid);
630 __entry->openstateid_hash =
631 nfs_stateid_hash(&state->open_stateid);
632 } else {
633 __entry->stateid_seq = 0;
634 __entry->stateid_hash = 0;
635 __entry->openstateid_seq = 0;
636 __entry->openstateid_hash = 0;
637 }
Trond Myklebust42113a72013-08-12 16:19:27 -0400638 if (inode != NULL) {
639 __entry->fileid = NFS_FILEID(inode);
640 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
641 } else {
642 __entry->fileid = 0;
643 __entry->fhandle = 0;
644 }
David Howells2b0143b2015-03-17 22:25:59 +0000645 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
Trond Myklebust42113a72013-08-12 16:19:27 -0400646 __assign_str(name, ctx->dentry->d_name.name);
647 ),
648
649 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400650 "error=%ld (%s) flags=%d (%s) fmode=%s "
Trond Myklebust42113a72013-08-12 16:19:27 -0400651 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500652 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
653 "openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400654 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400655 show_nfsv4_errors(__entry->error),
656 __entry->flags,
657 show_open_flags(__entry->flags),
658 show_fmode_flags(__entry->fmode),
659 MAJOR(__entry->dev), MINOR(__entry->dev),
660 (unsigned long long)__entry->fileid,
661 __entry->fhandle,
662 MAJOR(__entry->dev), MINOR(__entry->dev),
663 (unsigned long long)__entry->dir,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500664 __get_str(name),
665 __entry->stateid_seq, __entry->stateid_hash,
666 __entry->openstateid_seq, __entry->openstateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400667 )
668);
669
670#define DEFINE_NFS4_OPEN_EVENT(name) \
671 DEFINE_EVENT(nfs4_open_event, name, \
672 TP_PROTO( \
673 const struct nfs_open_context *ctx, \
674 int flags, \
675 int error \
676 ), \
677 TP_ARGS(ctx, flags, error))
678DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
679DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
680DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
681
Olga Kornievskaia9759b0f2015-11-24 13:29:42 -0500682TRACE_EVENT(nfs4_cached_open,
683 TP_PROTO(
684 const struct nfs4_state *state
685 ),
686 TP_ARGS(state),
687 TP_STRUCT__entry(
688 __field(dev_t, dev)
689 __field(u32, fhandle)
690 __field(u64, fileid)
691 __field(unsigned int, fmode)
692 __field(int, stateid_seq)
693 __field(u32, stateid_hash)
694 ),
695
696 TP_fast_assign(
697 const struct inode *inode = state->inode;
698
699 __entry->dev = inode->i_sb->s_dev;
700 __entry->fileid = NFS_FILEID(inode);
701 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
702 __entry->fmode = (__force unsigned int)state->state;
703 __entry->stateid_seq =
704 be32_to_cpu(state->stateid.seqid);
705 __entry->stateid_hash =
706 nfs_stateid_hash(&state->stateid);
707 ),
708
709 TP_printk(
710 "fmode=%s fileid=%02x:%02x:%llu "
711 "fhandle=0x%08x stateid=%d:0x%08x",
712 __entry->fmode ? show_fmode_flags(__entry->fmode) :
713 "closed",
714 MAJOR(__entry->dev), MINOR(__entry->dev),
715 (unsigned long long)__entry->fileid,
716 __entry->fhandle,
717 __entry->stateid_seq, __entry->stateid_hash
718 )
719);
720
Trond Myklebust42113a72013-08-12 16:19:27 -0400721TRACE_EVENT(nfs4_close,
722 TP_PROTO(
723 const struct nfs4_state *state,
724 const struct nfs_closeargs *args,
725 const struct nfs_closeres *res,
726 int error
727 ),
728
729 TP_ARGS(state, args, res, error),
730
731 TP_STRUCT__entry(
732 __field(dev_t, dev)
733 __field(u32, fhandle)
734 __field(u64, fileid)
735 __field(unsigned int, fmode)
Chuck Lever96650e22019-06-19 10:33:53 -0400736 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500737 __field(int, stateid_seq)
738 __field(u32, stateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400739 ),
740
741 TP_fast_assign(
742 const struct inode *inode = state->inode;
743
744 __entry->dev = inode->i_sb->s_dev;
745 __entry->fileid = NFS_FILEID(inode);
746 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
747 __entry->fmode = (__force unsigned int)state->state;
748 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500749 __entry->stateid_seq =
750 be32_to_cpu(args->stateid.seqid);
751 __entry->stateid_hash =
752 nfs_stateid_hash(&args->stateid);
Trond Myklebust42113a72013-08-12 16:19:27 -0400753 ),
754
755 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400756 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500757 "fhandle=0x%08x openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400758 -__entry->error,
Trond Myklebust42113a72013-08-12 16:19:27 -0400759 show_nfsv4_errors(__entry->error),
760 __entry->fmode ? show_fmode_flags(__entry->fmode) :
761 "closed",
762 MAJOR(__entry->dev), MINOR(__entry->dev),
763 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500764 __entry->fhandle,
765 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400766 )
767);
768
Chuck Lever5b2095d2018-12-19 11:00:11 -0500769TRACE_DEFINE_ENUM(F_GETLK);
770TRACE_DEFINE_ENUM(F_SETLK);
771TRACE_DEFINE_ENUM(F_SETLKW);
772TRACE_DEFINE_ENUM(F_RDLCK);
773TRACE_DEFINE_ENUM(F_WRLCK);
774TRACE_DEFINE_ENUM(F_UNLCK);
775
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400776#define show_lock_cmd(type) \
777 __print_symbolic((int)type, \
778 { F_GETLK, "GETLK" }, \
779 { F_SETLK, "SETLK" }, \
780 { F_SETLKW, "SETLKW" })
781#define show_lock_type(type) \
782 __print_symbolic((int)type, \
783 { F_RDLCK, "RDLCK" }, \
784 { F_WRLCK, "WRLCK" }, \
785 { F_UNLCK, "UNLCK" })
786
787DECLARE_EVENT_CLASS(nfs4_lock_event,
788 TP_PROTO(
789 const struct file_lock *request,
790 const struct nfs4_state *state,
791 int cmd,
792 int error
793 ),
794
795 TP_ARGS(request, state, cmd, error),
796
797 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400798 __field(unsigned long, error)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400799 __field(int, cmd)
800 __field(char, type)
801 __field(loff_t, start)
802 __field(loff_t, end)
803 __field(dev_t, dev)
804 __field(u32, fhandle)
805 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500806 __field(int, stateid_seq)
807 __field(u32, stateid_hash)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400808 ),
809
810 TP_fast_assign(
811 const struct inode *inode = state->inode;
812
813 __entry->error = error;
814 __entry->cmd = cmd;
815 __entry->type = request->fl_type;
816 __entry->start = request->fl_start;
817 __entry->end = request->fl_end;
818 __entry->dev = inode->i_sb->s_dev;
819 __entry->fileid = NFS_FILEID(inode);
820 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500821 __entry->stateid_seq =
822 be32_to_cpu(state->stateid.seqid);
823 __entry->stateid_hash =
824 nfs_stateid_hash(&state->stateid);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400825 ),
826
827 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400828 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500829 "fileid=%02x:%02x:%llu fhandle=0x%08x "
830 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400831 -__entry->error,
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400832 show_nfsv4_errors(__entry->error),
833 show_lock_cmd(__entry->cmd),
834 show_lock_type(__entry->type),
835 (long long)__entry->start,
836 (long long)__entry->end,
837 MAJOR(__entry->dev), MINOR(__entry->dev),
838 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500839 __entry->fhandle,
840 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400841 )
842);
843
844#define DEFINE_NFS4_LOCK_EVENT(name) \
845 DEFINE_EVENT(nfs4_lock_event, name, \
846 TP_PROTO( \
847 const struct file_lock *request, \
848 const struct nfs4_state *state, \
849 int cmd, \
850 int error \
851 ), \
852 TP_ARGS(request, state, cmd, error))
853DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400854DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
855
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500856TRACE_EVENT(nfs4_set_lock,
857 TP_PROTO(
858 const struct file_lock *request,
859 const struct nfs4_state *state,
860 const nfs4_stateid *lockstateid,
861 int cmd,
862 int error
863 ),
864
865 TP_ARGS(request, state, lockstateid, cmd, error),
866
867 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400868 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500869 __field(int, cmd)
870 __field(char, type)
871 __field(loff_t, start)
872 __field(loff_t, end)
873 __field(dev_t, dev)
874 __field(u32, fhandle)
875 __field(u64, fileid)
876 __field(int, stateid_seq)
877 __field(u32, stateid_hash)
878 __field(int, lockstateid_seq)
879 __field(u32, lockstateid_hash)
880 ),
881
882 TP_fast_assign(
883 const struct inode *inode = state->inode;
884
885 __entry->error = error;
886 __entry->cmd = cmd;
887 __entry->type = request->fl_type;
888 __entry->start = request->fl_start;
889 __entry->end = request->fl_end;
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->stateid_seq =
894 be32_to_cpu(state->stateid.seqid);
895 __entry->stateid_hash =
896 nfs_stateid_hash(&state->stateid);
897 __entry->lockstateid_seq =
898 be32_to_cpu(lockstateid->seqid);
899 __entry->lockstateid_hash =
900 nfs_stateid_hash(lockstateid);
901 ),
902
903 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400904 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500905 "fileid=%02x:%02x:%llu fhandle=0x%08x "
906 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400907 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500908 show_nfsv4_errors(__entry->error),
909 show_lock_cmd(__entry->cmd),
910 show_lock_type(__entry->type),
911 (long long)__entry->start,
912 (long long)__entry->end,
913 MAJOR(__entry->dev), MINOR(__entry->dev),
914 (unsigned long long)__entry->fileid,
915 __entry->fhandle,
916 __entry->stateid_seq, __entry->stateid_hash,
917 __entry->lockstateid_seq, __entry->lockstateid_hash
918 )
919);
920
Trond Myklebustca8acf82013-08-13 10:36:56 -0400921DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
922 TP_PROTO(
923 const struct inode *inode,
924 fmode_t fmode
925 ),
926
927 TP_ARGS(inode, fmode),
928
929 TP_STRUCT__entry(
930 __field(dev_t, dev)
931 __field(u32, fhandle)
932 __field(u64, fileid)
933 __field(unsigned int, fmode)
934 ),
935
936 TP_fast_assign(
937 __entry->dev = inode->i_sb->s_dev;
938 __entry->fileid = NFS_FILEID(inode);
939 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
940 __entry->fmode = (__force unsigned int)fmode;
941 ),
942
943 TP_printk(
944 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
945 show_fmode_flags(__entry->fmode),
946 MAJOR(__entry->dev), MINOR(__entry->dev),
947 (unsigned long long)__entry->fileid,
948 __entry->fhandle
949 )
950);
951#define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
952 DEFINE_EVENT(nfs4_set_delegation_event, name, \
953 TP_PROTO( \
954 const struct inode *inode, \
955 fmode_t fmode \
956 ), \
957 TP_ARGS(inode, fmode))
958DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
959DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
960
961TRACE_EVENT(nfs4_delegreturn_exit,
962 TP_PROTO(
963 const struct nfs4_delegreturnargs *args,
964 const struct nfs4_delegreturnres *res,
965 int error
966 ),
967
968 TP_ARGS(args, res, error),
969
970 TP_STRUCT__entry(
971 __field(dev_t, dev)
972 __field(u32, fhandle)
Chuck Lever96650e22019-06-19 10:33:53 -0400973 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500974 __field(int, stateid_seq)
975 __field(u32, stateid_hash)
Trond Myklebustca8acf82013-08-13 10:36:56 -0400976 ),
977
978 TP_fast_assign(
979 __entry->dev = res->server->s_dev;
980 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
981 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500982 __entry->stateid_seq =
983 be32_to_cpu(args->stateid->seqid);
984 __entry->stateid_hash =
985 nfs_stateid_hash(args->stateid);
Trond Myklebustca8acf82013-08-13 10:36:56 -0400986 ),
987
988 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400989 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500990 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400991 -__entry->error,
Trond Myklebustca8acf82013-08-13 10:36:56 -0400992 show_nfsv4_errors(__entry->error),
993 MAJOR(__entry->dev), MINOR(__entry->dev),
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500994 __entry->fhandle,
995 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustca8acf82013-08-13 10:36:56 -0400996 )
997);
998
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400999#ifdef CONFIG_NFS_V4_1
1000DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
1001 TP_PROTO(
1002 const struct nfs4_state *state,
1003 const struct nfs4_lock_state *lsp,
1004 int error
1005 ),
1006
1007 TP_ARGS(state, lsp, error),
1008
1009 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001010 __field(unsigned long, error)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001011 __field(dev_t, dev)
1012 __field(u32, fhandle)
1013 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001014 __field(int, stateid_seq)
1015 __field(u32, stateid_hash)
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001016 ),
1017
1018 TP_fast_assign(
1019 const struct inode *inode = state->inode;
1020
1021 __entry->error = error;
1022 __entry->dev = inode->i_sb->s_dev;
1023 __entry->fileid = NFS_FILEID(inode);
1024 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001025 __entry->stateid_seq =
1026 be32_to_cpu(state->stateid.seqid);
1027 __entry->stateid_hash =
1028 nfs_stateid_hash(&state->stateid);
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001029 ),
1030
1031 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001032 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001033 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001034 -__entry->error,
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001035 show_nfsv4_errors(__entry->error),
1036 MAJOR(__entry->dev), MINOR(__entry->dev),
1037 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001038 __entry->fhandle,
1039 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001040 )
1041);
1042
1043#define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
1044 DEFINE_EVENT(nfs4_test_stateid_event, name, \
1045 TP_PROTO( \
1046 const struct nfs4_state *state, \
1047 const struct nfs4_lock_state *lsp, \
1048 int error \
1049 ), \
1050 TP_ARGS(state, lsp, error))
1051DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
1052DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
1053DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
1054#endif /* CONFIG_NFS_V4_1 */
1055
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001056DECLARE_EVENT_CLASS(nfs4_lookup_event,
1057 TP_PROTO(
1058 const struct inode *dir,
1059 const struct qstr *name,
1060 int error
1061 ),
1062
1063 TP_ARGS(dir, name, error),
1064
1065 TP_STRUCT__entry(
1066 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001067 __field(unsigned long, error)
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001068 __field(u64, dir)
1069 __string(name, name->name)
1070 ),
1071
1072 TP_fast_assign(
1073 __entry->dev = dir->i_sb->s_dev;
1074 __entry->dir = NFS_FILEID(dir);
Chuck Lever96650e22019-06-19 10:33:53 -04001075 __entry->error = -error;
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001076 __assign_str(name, name->name);
1077 ),
1078
1079 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001080 "error=%ld (%s) name=%02x:%02x:%llu/%s",
1081 -__entry->error,
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001082 show_nfsv4_errors(__entry->error),
1083 MAJOR(__entry->dev), MINOR(__entry->dev),
1084 (unsigned long long)__entry->dir,
1085 __get_str(name)
1086 )
1087);
1088
1089#define DEFINE_NFS4_LOOKUP_EVENT(name) \
1090 DEFINE_EVENT(nfs4_lookup_event, name, \
1091 TP_PROTO( \
1092 const struct inode *dir, \
1093 const struct qstr *name, \
1094 int error \
1095 ), \
1096 TP_ARGS(dir, name, error))
1097
1098DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
1099DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
1100DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
1101DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
1102DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
1103DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
1104DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
1105
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001106TRACE_EVENT(nfs4_lookupp,
1107 TP_PROTO(
1108 const struct inode *inode,
1109 int error
1110 ),
1111
1112 TP_ARGS(inode, error),
1113
1114 TP_STRUCT__entry(
1115 __field(dev_t, dev)
1116 __field(u64, ino)
Chuck Lever96650e22019-06-19 10:33:53 -04001117 __field(unsigned long, error)
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001118 ),
1119
1120 TP_fast_assign(
1121 __entry->dev = inode->i_sb->s_dev;
1122 __entry->ino = NFS_FILEID(inode);
1123 __entry->error = error;
1124 ),
1125
1126 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001127 "error=%ld (%s) inode=%02x:%02x:%llu",
1128 -__entry->error,
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001129 show_nfsv4_errors(__entry->error),
1130 MAJOR(__entry->dev), MINOR(__entry->dev),
1131 (unsigned long long)__entry->ino
1132 )
1133);
1134
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001135TRACE_EVENT(nfs4_rename,
1136 TP_PROTO(
1137 const struct inode *olddir,
1138 const struct qstr *oldname,
1139 const struct inode *newdir,
1140 const struct qstr *newname,
1141 int error
1142 ),
1143
1144 TP_ARGS(olddir, oldname, newdir, newname, error),
1145
1146 TP_STRUCT__entry(
1147 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001148 __field(unsigned long, error)
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001149 __field(u64, olddir)
1150 __string(oldname, oldname->name)
1151 __field(u64, newdir)
1152 __string(newname, newname->name)
1153 ),
1154
1155 TP_fast_assign(
1156 __entry->dev = olddir->i_sb->s_dev;
1157 __entry->olddir = NFS_FILEID(olddir);
1158 __entry->newdir = NFS_FILEID(newdir);
1159 __entry->error = error;
1160 __assign_str(oldname, oldname->name);
1161 __assign_str(newname, newname->name);
1162 ),
1163
1164 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001165 "error=%ld (%s) oldname=%02x:%02x:%llu/%s "
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001166 "newname=%02x:%02x:%llu/%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001167 -__entry->error,
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001168 show_nfsv4_errors(__entry->error),
1169 MAJOR(__entry->dev), MINOR(__entry->dev),
1170 (unsigned long long)__entry->olddir,
1171 __get_str(oldname),
1172 MAJOR(__entry->dev), MINOR(__entry->dev),
1173 (unsigned long long)__entry->newdir,
1174 __get_str(newname)
1175 )
1176);
1177
Trond Myklebustc1578b72013-08-12 16:58:42 -04001178DECLARE_EVENT_CLASS(nfs4_inode_event,
1179 TP_PROTO(
1180 const struct inode *inode,
1181 int error
1182 ),
1183
1184 TP_ARGS(inode, error),
1185
1186 TP_STRUCT__entry(
1187 __field(dev_t, dev)
1188 __field(u32, fhandle)
1189 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001190 __field(unsigned long, error)
Trond Myklebustc1578b72013-08-12 16:58:42 -04001191 ),
1192
1193 TP_fast_assign(
1194 __entry->dev = inode->i_sb->s_dev;
1195 __entry->fileid = NFS_FILEID(inode);
1196 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Chuck Lever96650e22019-06-19 10:33:53 -04001197 __entry->error = error < 0 ? -error : 0;
Trond Myklebustc1578b72013-08-12 16:58:42 -04001198 ),
1199
1200 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001201 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
1202 -__entry->error,
Trond Myklebustc1578b72013-08-12 16:58:42 -04001203 show_nfsv4_errors(__entry->error),
1204 MAJOR(__entry->dev), MINOR(__entry->dev),
1205 (unsigned long long)__entry->fileid,
1206 __entry->fhandle
1207 )
1208);
1209
1210#define DEFINE_NFS4_INODE_EVENT(name) \
1211 DEFINE_EVENT(nfs4_inode_event, name, \
1212 TP_PROTO( \
1213 const struct inode *inode, \
1214 int error \
1215 ), \
1216 TP_ARGS(inode, error))
1217
Trond Myklebustc1578b72013-08-12 16:58:42 -04001218DEFINE_NFS4_INODE_EVENT(nfs4_access);
1219DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
1220DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
1221DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
1222DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
1223#ifdef CONFIG_NFS_V4_SECURITY_LABEL
1224DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
1225DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
1226#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001227
1228DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
1229 TP_PROTO(
1230 const struct inode *inode,
1231 const nfs4_stateid *stateid,
1232 int error
1233 ),
1234
1235 TP_ARGS(inode, stateid, error),
1236
1237 TP_STRUCT__entry(
1238 __field(dev_t, dev)
1239 __field(u32, fhandle)
1240 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001241 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001242 __field(int, stateid_seq)
1243 __field(u32, stateid_hash)
1244 ),
1245
1246 TP_fast_assign(
1247 __entry->dev = inode->i_sb->s_dev;
1248 __entry->fileid = NFS_FILEID(inode);
1249 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1250 __entry->error = error;
1251 __entry->stateid_seq =
1252 be32_to_cpu(stateid->seqid);
1253 __entry->stateid_hash =
1254 nfs_stateid_hash(stateid);
1255 ),
1256
1257 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001258 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001259 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001260 -__entry->error,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001261 show_nfsv4_errors(__entry->error),
1262 MAJOR(__entry->dev), MINOR(__entry->dev),
1263 (unsigned long long)__entry->fileid,
1264 __entry->fhandle,
1265 __entry->stateid_seq, __entry->stateid_hash
1266 )
1267);
1268
1269#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1270 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1271 TP_PROTO( \
1272 const struct inode *inode, \
1273 const nfs4_stateid *stateid, \
1274 int error \
1275 ), \
1276 TP_ARGS(inode, stateid, error))
1277
1278DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1279DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
Trond Myklebustad9e02d2017-11-06 15:28:02 -05001280DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
1281DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
Trond Myklebustc1578b72013-08-12 16:58:42 -04001282
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001283DECLARE_EVENT_CLASS(nfs4_getattr_event,
1284 TP_PROTO(
1285 const struct nfs_server *server,
1286 const struct nfs_fh *fhandle,
1287 const struct nfs_fattr *fattr,
1288 int error
1289 ),
1290
1291 TP_ARGS(server, fhandle, fattr, error),
1292
1293 TP_STRUCT__entry(
1294 __field(dev_t, dev)
1295 __field(u32, fhandle)
1296 __field(u64, fileid)
1297 __field(unsigned int, valid)
Chuck Lever96650e22019-06-19 10:33:53 -04001298 __field(unsigned long, error)
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001299 ),
1300
1301 TP_fast_assign(
1302 __entry->dev = server->s_dev;
1303 __entry->valid = fattr->valid;
1304 __entry->fhandle = nfs_fhandle_hash(fhandle);
1305 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
1306 __entry->error = error;
1307 ),
1308
1309 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001310 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001311 "valid=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001312 -__entry->error,
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001313 show_nfsv4_errors(__entry->error),
1314 MAJOR(__entry->dev), MINOR(__entry->dev),
1315 (unsigned long long)__entry->fileid,
1316 __entry->fhandle,
1317 show_nfs_fattr_flags(__entry->valid)
1318 )
1319);
1320
1321#define DEFINE_NFS4_GETATTR_EVENT(name) \
1322 DEFINE_EVENT(nfs4_getattr_event, name, \
1323 TP_PROTO( \
1324 const struct nfs_server *server, \
1325 const struct nfs_fh *fhandle, \
1326 const struct nfs_fattr *fattr, \
1327 int error \
1328 ), \
1329 TP_ARGS(server, fhandle, fattr, error))
1330DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1331DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1332DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1333
Trond Myklebust7cd14862015-08-20 20:07:54 -05001334DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1335 TP_PROTO(
1336 const struct nfs_client *clp,
1337 const struct nfs_fh *fhandle,
1338 const struct inode *inode,
1339 int error
1340 ),
1341
1342 TP_ARGS(clp, fhandle, inode, error),
1343
1344 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001345 __field(unsigned long, error)
Trond Myklebust7cd14862015-08-20 20:07:54 -05001346 __field(dev_t, dev)
1347 __field(u32, fhandle)
1348 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001349 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001350 ),
1351
1352 TP_fast_assign(
1353 __entry->error = error;
1354 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2edaead2018-09-05 14:07:13 -04001355 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebust7cd14862015-08-20 20:07:54 -05001356 __entry->fileid = NFS_FILEID(inode);
1357 __entry->dev = inode->i_sb->s_dev;
1358 } else {
1359 __entry->fileid = 0;
1360 __entry->dev = 0;
1361 }
Anna Schumaker39443692017-11-01 15:48:43 -04001362 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001363 ),
1364
1365 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001366 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust7cd14862015-08-20 20:07:54 -05001367 "dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001368 -__entry->error,
Trond Myklebust7cd14862015-08-20 20:07:54 -05001369 show_nfsv4_errors(__entry->error),
1370 MAJOR(__entry->dev), MINOR(__entry->dev),
1371 (unsigned long long)__entry->fileid,
1372 __entry->fhandle,
1373 __get_str(dstaddr)
1374 )
1375);
1376
1377#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1378 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1379 TP_PROTO( \
1380 const struct nfs_client *clp, \
1381 const struct nfs_fh *fhandle, \
1382 const struct inode *inode, \
1383 int error \
1384 ), \
1385 TP_ARGS(clp, fhandle, inode, error))
1386DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1387
Trond Myklebuste07db902015-12-28 14:07:23 -05001388DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1389 TP_PROTO(
1390 const struct nfs_client *clp,
1391 const struct nfs_fh *fhandle,
1392 const struct inode *inode,
1393 const nfs4_stateid *stateid,
1394 int error
1395 ),
1396
1397 TP_ARGS(clp, fhandle, inode, stateid, error),
1398
1399 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001400 __field(unsigned long, error)
Trond Myklebuste07db902015-12-28 14:07:23 -05001401 __field(dev_t, dev)
1402 __field(u32, fhandle)
1403 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001404 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001405 __field(int, stateid_seq)
1406 __field(u32, stateid_hash)
1407 ),
1408
1409 TP_fast_assign(
1410 __entry->error = error;
1411 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2a534a72018-08-23 11:02:49 -04001412 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebuste07db902015-12-28 14:07:23 -05001413 __entry->fileid = NFS_FILEID(inode);
1414 __entry->dev = inode->i_sb->s_dev;
1415 } else {
1416 __entry->fileid = 0;
1417 __entry->dev = 0;
1418 }
Anna Schumaker39443692017-11-01 15:48:43 -04001419 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001420 __entry->stateid_seq =
1421 be32_to_cpu(stateid->seqid);
1422 __entry->stateid_hash =
1423 nfs_stateid_hash(stateid);
1424 ),
1425
1426 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001427 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebuste07db902015-12-28 14:07:23 -05001428 "stateid=%d:0x%08x dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001429 -__entry->error,
Trond Myklebuste07db902015-12-28 14:07:23 -05001430 show_nfsv4_errors(__entry->error),
1431 MAJOR(__entry->dev), MINOR(__entry->dev),
1432 (unsigned long long)__entry->fileid,
1433 __entry->fhandle,
1434 __entry->stateid_seq, __entry->stateid_hash,
1435 __get_str(dstaddr)
1436 )
1437);
1438
1439#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1440 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1441 TP_PROTO( \
1442 const struct nfs_client *clp, \
1443 const struct nfs_fh *fhandle, \
1444 const struct inode *inode, \
1445 const nfs4_stateid *stateid, \
1446 int error \
1447 ), \
1448 TP_ARGS(clp, fhandle, inode, stateid, error))
1449DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1450DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
Trond Myklebust7cd14862015-08-20 20:07:54 -05001451
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001452DECLARE_EVENT_CLASS(nfs4_idmap_event,
1453 TP_PROTO(
1454 const char *name,
1455 int len,
1456 u32 id,
1457 int error
1458 ),
1459
1460 TP_ARGS(name, len, id, error),
1461
1462 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001463 __field(unsigned long, error)
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001464 __field(u32, id)
1465 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1466 ),
1467
1468 TP_fast_assign(
1469 if (len < 0)
1470 len = 0;
1471 __entry->error = error < 0 ? error : 0;
1472 __entry->id = id;
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -03001473 memcpy(__get_str(name), name, len);
1474 __get_str(name)[len] = 0;
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001475 ),
1476
1477 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001478 "error=%ld (%s) id=%u name=%s",
1479 -__entry->error, show_nfsv4_errors(__entry->error),
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001480 __entry->id,
1481 __get_str(name)
1482 )
1483);
1484#define DEFINE_NFS4_IDMAP_EVENT(name) \
1485 DEFINE_EVENT(nfs4_idmap_event, name, \
1486 TP_PROTO( \
1487 const char *name, \
1488 int len, \
1489 u32 id, \
1490 int error \
1491 ), \
1492 TP_ARGS(name, len, id, error))
1493DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1494DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1495DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1496DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1497
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001498DECLARE_EVENT_CLASS(nfs4_read_event,
1499 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001500 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001501 int error
1502 ),
1503
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001504 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001505
1506 TP_STRUCT__entry(
1507 __field(dev_t, dev)
1508 __field(u32, fhandle)
1509 __field(u64, fileid)
1510 __field(loff_t, offset)
1511 __field(size_t, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001512 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001513 __field(int, stateid_seq)
1514 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001515 ),
1516
1517 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001518 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001519 const struct nfs4_state *state =
1520 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001521 __entry->dev = inode->i_sb->s_dev;
1522 __entry->fileid = NFS_FILEID(inode);
1523 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001524 __entry->offset = hdr->args.offset;
1525 __entry->count = hdr->args.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001526 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001527 __entry->stateid_seq =
1528 be32_to_cpu(state->stateid.seqid);
1529 __entry->stateid_hash =
1530 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001531 ),
1532
1533 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001534 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001535 "offset=%lld count=%zu stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001536 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001537 show_nfsv4_errors(__entry->error),
1538 MAJOR(__entry->dev), MINOR(__entry->dev),
1539 (unsigned long long)__entry->fileid,
1540 __entry->fhandle,
1541 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001542 __entry->count,
1543 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001544 )
1545);
1546#define DEFINE_NFS4_READ_EVENT(name) \
1547 DEFINE_EVENT(nfs4_read_event, name, \
1548 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001549 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001550 int error \
1551 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001552 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001553DEFINE_NFS4_READ_EVENT(nfs4_read);
1554#ifdef CONFIG_NFS_V4_1
1555DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1556#endif /* CONFIG_NFS_V4_1 */
1557
1558DECLARE_EVENT_CLASS(nfs4_write_event,
1559 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001560 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001561 int error
1562 ),
1563
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001564 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001565
1566 TP_STRUCT__entry(
1567 __field(dev_t, dev)
1568 __field(u32, fhandle)
1569 __field(u64, fileid)
1570 __field(loff_t, offset)
1571 __field(size_t, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001572 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001573 __field(int, stateid_seq)
1574 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001575 ),
1576
1577 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001578 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001579 const struct nfs4_state *state =
1580 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001581 __entry->dev = inode->i_sb->s_dev;
1582 __entry->fileid = NFS_FILEID(inode);
1583 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001584 __entry->offset = hdr->args.offset;
1585 __entry->count = hdr->args.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001586 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001587 __entry->stateid_seq =
1588 be32_to_cpu(state->stateid.seqid);
1589 __entry->stateid_hash =
1590 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001591 ),
1592
1593 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001594 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001595 "offset=%lld count=%zu stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001596 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001597 show_nfsv4_errors(__entry->error),
1598 MAJOR(__entry->dev), MINOR(__entry->dev),
1599 (unsigned long long)__entry->fileid,
1600 __entry->fhandle,
1601 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001602 __entry->count,
1603 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001604 )
1605);
1606
1607#define DEFINE_NFS4_WRITE_EVENT(name) \
1608 DEFINE_EVENT(nfs4_write_event, name, \
1609 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001610 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001611 int error \
1612 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001613 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001614DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1615#ifdef CONFIG_NFS_V4_1
1616DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1617#endif /* CONFIG_NFS_V4_1 */
1618
1619DECLARE_EVENT_CLASS(nfs4_commit_event,
1620 TP_PROTO(
1621 const struct nfs_commit_data *data,
1622 int error
1623 ),
1624
1625 TP_ARGS(data, error),
1626
1627 TP_STRUCT__entry(
1628 __field(dev_t, dev)
1629 __field(u32, fhandle)
1630 __field(u64, fileid)
1631 __field(loff_t, offset)
1632 __field(size_t, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001633 __field(unsigned long, error)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001634 ),
1635
1636 TP_fast_assign(
1637 const struct inode *inode = data->inode;
1638 __entry->dev = inode->i_sb->s_dev;
1639 __entry->fileid = NFS_FILEID(inode);
1640 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1641 __entry->offset = data->args.offset;
1642 __entry->count = data->args.count;
1643 __entry->error = error;
1644 ),
1645
1646 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001647 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001648 "offset=%lld count=%zu",
Chuck Lever96650e22019-06-19 10:33:53 -04001649 -__entry->error,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001650 show_nfsv4_errors(__entry->error),
1651 MAJOR(__entry->dev), MINOR(__entry->dev),
1652 (unsigned long long)__entry->fileid,
1653 __entry->fhandle,
1654 (long long)__entry->offset,
1655 __entry->count
1656 )
1657);
1658#define DEFINE_NFS4_COMMIT_EVENT(name) \
1659 DEFINE_EVENT(nfs4_commit_event, name, \
1660 TP_PROTO( \
1661 const struct nfs_commit_data *data, \
1662 int error \
1663 ), \
1664 TP_ARGS(data, error))
1665DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1666#ifdef CONFIG_NFS_V4_1
1667DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001668
Chuck Lever5b2095d2018-12-19 11:00:11 -05001669TRACE_DEFINE_ENUM(IOMODE_READ);
1670TRACE_DEFINE_ENUM(IOMODE_RW);
1671TRACE_DEFINE_ENUM(IOMODE_ANY);
1672
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001673#define show_pnfs_iomode(iomode) \
1674 __print_symbolic(iomode, \
1675 { IOMODE_READ, "READ" }, \
1676 { IOMODE_RW, "RW" }, \
1677 { IOMODE_ANY, "ANY" })
1678
1679TRACE_EVENT(nfs4_layoutget,
1680 TP_PROTO(
1681 const struct nfs_open_context *ctx,
1682 const struct pnfs_layout_range *args,
1683 const struct pnfs_layout_range *res,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001684 const nfs4_stateid *layout_stateid,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001685 int error
1686 ),
1687
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001688 TP_ARGS(ctx, args, res, layout_stateid, error),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001689
1690 TP_STRUCT__entry(
1691 __field(dev_t, dev)
1692 __field(u32, fhandle)
1693 __field(u64, fileid)
1694 __field(u32, iomode)
1695 __field(u64, offset)
1696 __field(u64, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001697 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001698 __field(int, stateid_seq)
1699 __field(u32, stateid_hash)
1700 __field(int, layoutstateid_seq)
1701 __field(u32, layoutstateid_hash)
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001702 ),
1703
1704 TP_fast_assign(
David Howells2b0143b2015-03-17 22:25:59 +00001705 const struct inode *inode = d_inode(ctx->dentry);
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001706 const struct nfs4_state *state = ctx->state;
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001707 __entry->dev = inode->i_sb->s_dev;
1708 __entry->fileid = NFS_FILEID(inode);
1709 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1710 __entry->iomode = args->iomode;
1711 __entry->offset = args->offset;
1712 __entry->count = args->length;
1713 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001714 __entry->stateid_seq =
1715 be32_to_cpu(state->stateid.seqid);
1716 __entry->stateid_hash =
1717 nfs_stateid_hash(&state->stateid);
1718 if (!error) {
1719 __entry->layoutstateid_seq =
1720 be32_to_cpu(layout_stateid->seqid);
1721 __entry->layoutstateid_hash =
1722 nfs_stateid_hash(layout_stateid);
1723 } else {
1724 __entry->layoutstateid_seq = 0;
1725 __entry->layoutstateid_hash = 0;
1726 }
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001727 ),
1728
1729 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001730 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001731 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1732 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001733 -__entry->error,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001734 show_nfsv4_errors(__entry->error),
1735 MAJOR(__entry->dev), MINOR(__entry->dev),
1736 (unsigned long long)__entry->fileid,
1737 __entry->fhandle,
1738 show_pnfs_iomode(__entry->iomode),
1739 (unsigned long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001740 (unsigned long long)__entry->count,
1741 __entry->stateid_seq, __entry->stateid_hash,
1742 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001743 )
1744);
1745
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001746DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1747DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
Trond Myklebust6a463beb2015-08-20 15:40:47 -05001748DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001749
Chuck Lever5b2095d2018-12-19 11:00:11 -05001750TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN);
1751TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS);
1752TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN);
1753TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH);
1754TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM);
1755TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL);
1756TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL);
1757TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED);
1758TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN);
1759TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED);
1760TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN);
1761TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY);
1762TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
1763
Jeff Layton9a4bf312015-12-10 10:41:58 -05001764#define show_pnfs_update_layout_reason(reason) \
1765 __print_symbolic(reason, \
1766 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
1767 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
1768 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
1769 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
1770 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
1771 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
1772 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
1773 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
1774 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
1775 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
Jeff Layton183d9e72016-05-17 12:28:47 -04001776 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
1777 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
Jeff Layton9a4bf312015-12-10 10:41:58 -05001778 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" })
1779
1780TRACE_EVENT(pnfs_update_layout,
1781 TP_PROTO(struct inode *inode,
1782 loff_t pos,
1783 u64 count,
1784 enum pnfs_iomode iomode,
Trond Myklebustf4848302015-12-26 18:03:07 -05001785 struct pnfs_layout_hdr *lo,
Jeff Layton183d9e72016-05-17 12:28:47 -04001786 struct pnfs_layout_segment *lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05001787 enum pnfs_update_layout_reason reason
1788 ),
Jeff Layton183d9e72016-05-17 12:28:47 -04001789 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
Jeff Layton9a4bf312015-12-10 10:41:58 -05001790 TP_STRUCT__entry(
1791 __field(dev_t, dev)
1792 __field(u64, fileid)
1793 __field(u32, fhandle)
1794 __field(loff_t, pos)
1795 __field(u64, count)
1796 __field(enum pnfs_iomode, iomode)
Trond Myklebustf4848302015-12-26 18:03:07 -05001797 __field(int, layoutstateid_seq)
1798 __field(u32, layoutstateid_hash)
Jeff Layton183d9e72016-05-17 12:28:47 -04001799 __field(long, lseg)
Jeff Layton9a4bf312015-12-10 10:41:58 -05001800 __field(enum pnfs_update_layout_reason, reason)
1801 ),
1802 TP_fast_assign(
1803 __entry->dev = inode->i_sb->s_dev;
1804 __entry->fileid = NFS_FILEID(inode);
1805 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1806 __entry->pos = pos;
1807 __entry->count = count;
1808 __entry->iomode = iomode;
Jeff Layton9a4bf312015-12-10 10:41:58 -05001809 __entry->reason = reason;
Trond Myklebustf4848302015-12-26 18:03:07 -05001810 if (lo != NULL) {
1811 __entry->layoutstateid_seq =
1812 be32_to_cpu(lo->plh_stateid.seqid);
1813 __entry->layoutstateid_hash =
1814 nfs_stateid_hash(&lo->plh_stateid);
1815 } else {
1816 __entry->layoutstateid_seq = 0;
1817 __entry->layoutstateid_hash = 0;
1818 }
Jeff Layton183d9e72016-05-17 12:28:47 -04001819 __entry->lseg = (long)lseg;
Jeff Layton9a4bf312015-12-10 10:41:58 -05001820 ),
1821 TP_printk(
1822 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustf4848302015-12-26 18:03:07 -05001823 "iomode=%s pos=%llu count=%llu "
Jeff Layton183d9e72016-05-17 12:28:47 -04001824 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
Jeff Layton9a4bf312015-12-10 10:41:58 -05001825 MAJOR(__entry->dev), MINOR(__entry->dev),
1826 (unsigned long long)__entry->fileid,
1827 __entry->fhandle,
1828 show_pnfs_iomode(__entry->iomode),
1829 (unsigned long long)__entry->pos,
Trond Myklebustf4848302015-12-26 18:03:07 -05001830 (unsigned long long)__entry->count,
1831 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
Jeff Layton183d9e72016-05-17 12:28:47 -04001832 __entry->lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05001833 show_pnfs_update_layout_reason(__entry->reason)
1834 )
1835);
1836
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001837#endif /* CONFIG_NFS_V4_1 */
1838
Trond Myklebustc6d01c62013-08-09 11:51:26 -04001839#endif /* _TRACE_NFS4_H */
1840
1841#undef TRACE_INCLUDE_PATH
1842#define TRACE_INCLUDE_PATH .
1843#define TRACE_INCLUDE_FILE nfs4trace
1844/* This part must be outside protection */
1845#include <trace/define_trace.h>