Linux 4.19.133
[linux/fpc-iii.git] / fs / nfs / nfs4trace.h
blobb1483b303e0bf35a268bccad1823fd6b89015e97
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
4 */
5 #undef TRACE_SYSTEM
6 #define TRACE_SYSTEM nfs4
8 #if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
9 #define _TRACE_NFS4_H
11 #include <linux/tracepoint.h>
13 #define show_nfsv4_errors(error) \
14 __print_symbolic(error, \
15 { NFS4_OK, "OK" }, \
16 /* Mapped by nfs4_stat_to_errno() */ \
17 { -EPERM, "EPERM" }, \
18 { -ENOENT, "ENOENT" }, \
19 { -EIO, "EIO" }, \
20 { -ENXIO, "ENXIO" }, \
21 { -EACCES, "EACCES" }, \
22 { -EEXIST, "EEXIST" }, \
23 { -EXDEV, "EXDEV" }, \
24 { -ENOTDIR, "ENOTDIR" }, \
25 { -EISDIR, "EISDIR" }, \
26 { -EFBIG, "EFBIG" }, \
27 { -ENOSPC, "ENOSPC" }, \
28 { -EROFS, "EROFS" }, \
29 { -EMLINK, "EMLINK" }, \
30 { -ENAMETOOLONG, "ENAMETOOLONG" }, \
31 { -ENOTEMPTY, "ENOTEMPTY" }, \
32 { -EDQUOT, "EDQUOT" }, \
33 { -ESTALE, "ESTALE" }, \
34 { -EBADHANDLE, "EBADHANDLE" }, \
35 { -EBADCOOKIE, "EBADCOOKIE" }, \
36 { -ENOTSUPP, "ENOTSUPP" }, \
37 { -ETOOSMALL, "ETOOSMALL" }, \
38 { -EREMOTEIO, "EREMOTEIO" }, \
39 { -EBADTYPE, "EBADTYPE" }, \
40 { -EAGAIN, "EAGAIN" }, \
41 { -ELOOP, "ELOOP" }, \
42 { -EOPNOTSUPP, "EOPNOTSUPP" }, \
43 { -EDEADLK, "EDEADLK" }, \
44 /* RPC errors */ \
45 { -ENOMEM, "ENOMEM" }, \
46 { -EKEYEXPIRED, "EKEYEXPIRED" }, \
47 { -ETIMEDOUT, "ETIMEDOUT" }, \
48 { -ERESTARTSYS, "ERESTARTSYS" }, \
49 { -ECONNREFUSED, "ECONNREFUSED" }, \
50 { -ECONNRESET, "ECONNRESET" }, \
51 { -ENETUNREACH, "ENETUNREACH" }, \
52 { -EHOSTUNREACH, "EHOSTUNREACH" }, \
53 { -EHOSTDOWN, "EHOSTDOWN" }, \
54 { -EPIPE, "EPIPE" }, \
55 { -EPFNOSUPPORT, "EPFNOSUPPORT" }, \
56 { -EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \
57 /* NFSv4 native errors */ \
58 { -NFS4ERR_ACCESS, "ACCESS" }, \
59 { -NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \
60 { -NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \
61 { -NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \
62 { -NFS4ERR_BADCHAR, "BADCHAR" }, \
63 { -NFS4ERR_BADHANDLE, "BADHANDLE" }, \
64 { -NFS4ERR_BADIOMODE, "BADIOMODE" }, \
65 { -NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \
66 { -NFS4ERR_BADLABEL, "BADLABEL" }, \
67 { -NFS4ERR_BADNAME, "BADNAME" }, \
68 { -NFS4ERR_BADOWNER, "BADOWNER" }, \
69 { -NFS4ERR_BADSESSION, "BADSESSION" }, \
70 { -NFS4ERR_BADSLOT, "BADSLOT" }, \
71 { -NFS4ERR_BADTYPE, "BADTYPE" }, \
72 { -NFS4ERR_BADXDR, "BADXDR" }, \
73 { -NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \
74 { -NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \
75 { -NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \
76 { -NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \
77 { -NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \
78 { -NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \
79 { -NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
80 { -NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \
81 { -NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \
82 { -NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \
83 { -NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \
84 "CONN_NOT_BOUND_TO_SESSION" }, \
85 { -NFS4ERR_DEADLOCK, "DEADLOCK" }, \
86 { -NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \
87 { -NFS4ERR_DELAY, "DELAY" }, \
88 { -NFS4ERR_DELEG_ALREADY_WANTED, \
89 "DELEG_ALREADY_WANTED" }, \
90 { -NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \
91 { -NFS4ERR_DENIED, "DENIED" }, \
92 { -NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \
93 { -NFS4ERR_DQUOT, "DQUOT" }, \
94 { -NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \
95 { -NFS4ERR_EXIST, "EXIST" }, \
96 { -NFS4ERR_EXPIRED, "EXPIRED" }, \
97 { -NFS4ERR_FBIG, "FBIG" }, \
98 { -NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \
99 { -NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \
100 { -NFS4ERR_GRACE, "GRACE" }, \
101 { -NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \
102 { -NFS4ERR_INVAL, "INVAL" }, \
103 { -NFS4ERR_IO, "IO" }, \
104 { -NFS4ERR_ISDIR, "ISDIR" }, \
105 { -NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \
106 { -NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \
107 { -NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \
108 { -NFS4ERR_LOCKED, "LOCKED" }, \
109 { -NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \
110 { -NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \
111 { -NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \
112 { -NFS4ERR_MLINK, "MLINK" }, \
113 { -NFS4ERR_MOVED, "MOVED" }, \
114 { -NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \
115 { -NFS4ERR_NOENT, "NOENT" }, \
116 { -NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \
117 { -NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \
118 { -NFS4ERR_NOSPC, "NOSPC" }, \
119 { -NFS4ERR_NOTDIR, "NOTDIR" }, \
120 { -NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \
121 { -NFS4ERR_NOTSUPP, "NOTSUPP" }, \
122 { -NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \
123 { -NFS4ERR_NOT_SAME, "NOT_SAME" }, \
124 { -NFS4ERR_NO_GRACE, "NO_GRACE" }, \
125 { -NFS4ERR_NXIO, "NXIO" }, \
126 { -NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \
127 { -NFS4ERR_OPENMODE, "OPENMODE" }, \
128 { -NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \
129 { -NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \
130 { -NFS4ERR_PERM, "PERM" }, \
131 { -NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \
132 { -NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \
133 { -NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \
134 { -NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \
135 { -NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \
136 { -NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \
137 { -NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \
138 { -NFS4ERR_REP_TOO_BIG_TO_CACHE, \
139 "REP_TOO_BIG_TO_CACHE" }, \
140 { -NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \
141 { -NFS4ERR_RESOURCE, "RESOURCE" }, \
142 { -NFS4ERR_RESTOREFH, "RESTOREFH" }, \
143 { -NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \
144 { -NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \
145 { -NFS4ERR_ROFS, "ROFS" }, \
146 { -NFS4ERR_SAME, "SAME" }, \
147 { -NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \
148 { -NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \
149 { -NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \
150 { -NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \
151 { -NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \
152 { -NFS4ERR_STALE, "STALE" }, \
153 { -NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \
154 { -NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \
155 { -NFS4ERR_SYMLINK, "SYMLINK" }, \
156 { -NFS4ERR_TOOSMALL, "TOOSMALL" }, \
157 { -NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \
158 { -NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \
159 { -NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \
160 { -NFS4ERR_WRONGSEC, "WRONGSEC" }, \
161 { -NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
162 { -NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
163 { -NFS4ERR_XDEV, "XDEV" })
165 #define show_open_flags(flags) \
166 __print_flags(flags, "|", \
167 { O_CREAT, "O_CREAT" }, \
168 { O_EXCL, "O_EXCL" }, \
169 { O_TRUNC, "O_TRUNC" }, \
170 { O_DIRECT, "O_DIRECT" })
172 #define show_fmode_flags(mode) \
173 __print_flags(mode, "|", \
174 { ((__force unsigned long)FMODE_READ), "READ" }, \
175 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
176 { ((__force unsigned long)FMODE_EXEC), "EXEC" })
178 #define show_nfs_fattr_flags(valid) \
179 __print_flags((unsigned long)valid, "|", \
180 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \
181 { NFS_ATTR_FATTR_MODE, "MODE" }, \
182 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \
183 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \
184 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \
185 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \
186 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \
187 { NFS_ATTR_FATTR_FSID, "FSID" }, \
188 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \
189 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \
190 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \
191 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \
192 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
193 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
194 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
196 DECLARE_EVENT_CLASS(nfs4_clientid_event,
197 TP_PROTO(
198 const struct nfs_client *clp,
199 int error
202 TP_ARGS(clp, error),
204 TP_STRUCT__entry(
205 __string(dstaddr, clp->cl_hostname)
206 __field(int, error)
209 TP_fast_assign(
210 __entry->error = error;
211 __assign_str(dstaddr, clp->cl_hostname);
214 TP_printk(
215 "error=%d (%s) dstaddr=%s",
216 __entry->error,
217 show_nfsv4_errors(__entry->error),
218 __get_str(dstaddr)
221 #define DEFINE_NFS4_CLIENTID_EVENT(name) \
222 DEFINE_EVENT(nfs4_clientid_event, name, \
223 TP_PROTO( \
224 const struct nfs_client *clp, \
225 int error \
226 ), \
227 TP_ARGS(clp, error))
228 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
229 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
230 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
231 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
232 #ifdef CONFIG_NFS_V4_1
233 DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
234 DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
235 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
236 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
237 DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
238 DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
239 DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
241 #define show_nfs4_sequence_status_flags(status) \
242 __print_flags((unsigned long)status, "|", \
243 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
244 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
245 "CB_GSS_CONTEXTS_EXPIRING" }, \
246 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
247 "CB_GSS_CONTEXTS_EXPIRED" }, \
248 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
249 "EXPIRED_ALL_STATE_REVOKED" }, \
250 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
251 "EXPIRED_SOME_STATE_REVOKED" }, \
252 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
253 "ADMIN_STATE_REVOKED" }, \
254 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
255 "RECALLABLE_STATE_REVOKED" }, \
256 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
257 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
258 "RESTART_RECLAIM_NEEDED" }, \
259 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
260 "CB_PATH_DOWN_SESSION" }, \
261 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
262 "BACKCHANNEL_FAULT" })
264 TRACE_EVENT(nfs4_sequence_done,
265 TP_PROTO(
266 const struct nfs4_session *session,
267 const struct nfs4_sequence_res *res
269 TP_ARGS(session, res),
271 TP_STRUCT__entry(
272 __field(unsigned int, session)
273 __field(unsigned int, slot_nr)
274 __field(unsigned int, seq_nr)
275 __field(unsigned int, highest_slotid)
276 __field(unsigned int, target_highest_slotid)
277 __field(unsigned int, status_flags)
278 __field(int, error)
281 TP_fast_assign(
282 const struct nfs4_slot *sr_slot = res->sr_slot;
283 __entry->session = nfs_session_id_hash(&session->sess_id);
284 __entry->slot_nr = sr_slot->slot_nr;
285 __entry->seq_nr = sr_slot->seq_nr;
286 __entry->highest_slotid = res->sr_highest_slotid;
287 __entry->target_highest_slotid =
288 res->sr_target_highest_slotid;
289 __entry->status_flags = res->sr_status_flags;
290 __entry->error = res->sr_status;
292 TP_printk(
293 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
294 "highest_slotid=%u target_highest_slotid=%u "
295 "status_flags=%u (%s)",
296 __entry->error,
297 show_nfsv4_errors(__entry->error),
298 __entry->session,
299 __entry->slot_nr,
300 __entry->seq_nr,
301 __entry->highest_slotid,
302 __entry->target_highest_slotid,
303 __entry->status_flags,
304 show_nfs4_sequence_status_flags(__entry->status_flags)
308 struct cb_sequenceargs;
309 struct cb_sequenceres;
311 TRACE_EVENT(nfs4_cb_sequence,
312 TP_PROTO(
313 const struct cb_sequenceargs *args,
314 const struct cb_sequenceres *res,
315 __be32 status
317 TP_ARGS(args, res, status),
319 TP_STRUCT__entry(
320 __field(unsigned int, session)
321 __field(unsigned int, slot_nr)
322 __field(unsigned int, seq_nr)
323 __field(unsigned int, highest_slotid)
324 __field(unsigned int, cachethis)
325 __field(int, error)
328 TP_fast_assign(
329 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
330 __entry->slot_nr = args->csa_slotid;
331 __entry->seq_nr = args->csa_sequenceid;
332 __entry->highest_slotid = args->csa_highestslotid;
333 __entry->cachethis = args->csa_cachethis;
334 __entry->error = -be32_to_cpu(status);
337 TP_printk(
338 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
339 "highest_slotid=%u",
340 __entry->error,
341 show_nfsv4_errors(__entry->error),
342 __entry->session,
343 __entry->slot_nr,
344 __entry->seq_nr,
345 __entry->highest_slotid
348 #endif /* CONFIG_NFS_V4_1 */
350 TRACE_EVENT(nfs4_setup_sequence,
351 TP_PROTO(
352 const struct nfs4_session *session,
353 const struct nfs4_sequence_args *args
355 TP_ARGS(session, args),
357 TP_STRUCT__entry(
358 __field(unsigned int, session)
359 __field(unsigned int, slot_nr)
360 __field(unsigned int, seq_nr)
361 __field(unsigned int, highest_used_slotid)
364 TP_fast_assign(
365 const struct nfs4_slot *sa_slot = args->sa_slot;
366 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
367 __entry->slot_nr = sa_slot->slot_nr;
368 __entry->seq_nr = sa_slot->seq_nr;
369 __entry->highest_used_slotid =
370 sa_slot->table->highest_used_slotid;
372 TP_printk(
373 "session=0x%08x slot_nr=%u seq_nr=%u "
374 "highest_used_slotid=%u",
375 __entry->session,
376 __entry->slot_nr,
377 __entry->seq_nr,
378 __entry->highest_used_slotid
382 DECLARE_EVENT_CLASS(nfs4_open_event,
383 TP_PROTO(
384 const struct nfs_open_context *ctx,
385 int flags,
386 int error
389 TP_ARGS(ctx, flags, error),
391 TP_STRUCT__entry(
392 __field(int, error)
393 __field(unsigned int, flags)
394 __field(unsigned int, fmode)
395 __field(dev_t, dev)
396 __field(u32, fhandle)
397 __field(u64, fileid)
398 __field(u64, dir)
399 __string(name, ctx->dentry->d_name.name)
400 __field(int, stateid_seq)
401 __field(u32, stateid_hash)
402 __field(int, openstateid_seq)
403 __field(u32, openstateid_hash)
406 TP_fast_assign(
407 const struct nfs4_state *state = ctx->state;
408 const struct inode *inode = NULL;
410 __entry->error = error;
411 __entry->flags = flags;
412 __entry->fmode = (__force unsigned int)ctx->mode;
413 __entry->dev = ctx->dentry->d_sb->s_dev;
414 if (!IS_ERR_OR_NULL(state)) {
415 inode = state->inode;
416 __entry->stateid_seq =
417 be32_to_cpu(state->stateid.seqid);
418 __entry->stateid_hash =
419 nfs_stateid_hash(&state->stateid);
420 __entry->openstateid_seq =
421 be32_to_cpu(state->open_stateid.seqid);
422 __entry->openstateid_hash =
423 nfs_stateid_hash(&state->open_stateid);
424 } else {
425 __entry->stateid_seq = 0;
426 __entry->stateid_hash = 0;
427 __entry->openstateid_seq = 0;
428 __entry->openstateid_hash = 0;
430 if (inode != NULL) {
431 __entry->fileid = NFS_FILEID(inode);
432 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
433 } else {
434 __entry->fileid = 0;
435 __entry->fhandle = 0;
437 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
438 __assign_str(name, ctx->dentry->d_name.name);
441 TP_printk(
442 "error=%d (%s) flags=%d (%s) fmode=%s "
443 "fileid=%02x:%02x:%llu fhandle=0x%08x "
444 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
445 "openstateid=%d:0x%08x",
446 __entry->error,
447 show_nfsv4_errors(__entry->error),
448 __entry->flags,
449 show_open_flags(__entry->flags),
450 show_fmode_flags(__entry->fmode),
451 MAJOR(__entry->dev), MINOR(__entry->dev),
452 (unsigned long long)__entry->fileid,
453 __entry->fhandle,
454 MAJOR(__entry->dev), MINOR(__entry->dev),
455 (unsigned long long)__entry->dir,
456 __get_str(name),
457 __entry->stateid_seq, __entry->stateid_hash,
458 __entry->openstateid_seq, __entry->openstateid_hash
462 #define DEFINE_NFS4_OPEN_EVENT(name) \
463 DEFINE_EVENT(nfs4_open_event, name, \
464 TP_PROTO( \
465 const struct nfs_open_context *ctx, \
466 int flags, \
467 int error \
468 ), \
469 TP_ARGS(ctx, flags, error))
470 DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
471 DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
472 DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
474 TRACE_EVENT(nfs4_cached_open,
475 TP_PROTO(
476 const struct nfs4_state *state
478 TP_ARGS(state),
479 TP_STRUCT__entry(
480 __field(dev_t, dev)
481 __field(u32, fhandle)
482 __field(u64, fileid)
483 __field(unsigned int, fmode)
484 __field(int, stateid_seq)
485 __field(u32, stateid_hash)
488 TP_fast_assign(
489 const struct inode *inode = state->inode;
491 __entry->dev = inode->i_sb->s_dev;
492 __entry->fileid = NFS_FILEID(inode);
493 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
494 __entry->fmode = (__force unsigned int)state->state;
495 __entry->stateid_seq =
496 be32_to_cpu(state->stateid.seqid);
497 __entry->stateid_hash =
498 nfs_stateid_hash(&state->stateid);
501 TP_printk(
502 "fmode=%s fileid=%02x:%02x:%llu "
503 "fhandle=0x%08x stateid=%d:0x%08x",
504 __entry->fmode ? show_fmode_flags(__entry->fmode) :
505 "closed",
506 MAJOR(__entry->dev), MINOR(__entry->dev),
507 (unsigned long long)__entry->fileid,
508 __entry->fhandle,
509 __entry->stateid_seq, __entry->stateid_hash
513 TRACE_EVENT(nfs4_close,
514 TP_PROTO(
515 const struct nfs4_state *state,
516 const struct nfs_closeargs *args,
517 const struct nfs_closeres *res,
518 int error
521 TP_ARGS(state, args, res, error),
523 TP_STRUCT__entry(
524 __field(dev_t, dev)
525 __field(u32, fhandle)
526 __field(u64, fileid)
527 __field(unsigned int, fmode)
528 __field(int, error)
529 __field(int, stateid_seq)
530 __field(u32, stateid_hash)
533 TP_fast_assign(
534 const struct inode *inode = state->inode;
536 __entry->dev = inode->i_sb->s_dev;
537 __entry->fileid = NFS_FILEID(inode);
538 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
539 __entry->fmode = (__force unsigned int)state->state;
540 __entry->error = error;
541 __entry->stateid_seq =
542 be32_to_cpu(args->stateid.seqid);
543 __entry->stateid_hash =
544 nfs_stateid_hash(&args->stateid);
547 TP_printk(
548 "error=%d (%s) fmode=%s fileid=%02x:%02x:%llu "
549 "fhandle=0x%08x openstateid=%d:0x%08x",
550 __entry->error,
551 show_nfsv4_errors(__entry->error),
552 __entry->fmode ? show_fmode_flags(__entry->fmode) :
553 "closed",
554 MAJOR(__entry->dev), MINOR(__entry->dev),
555 (unsigned long long)__entry->fileid,
556 __entry->fhandle,
557 __entry->stateid_seq, __entry->stateid_hash
561 #define show_lock_cmd(type) \
562 __print_symbolic((int)type, \
563 { F_GETLK, "GETLK" }, \
564 { F_SETLK, "SETLK" }, \
565 { F_SETLKW, "SETLKW" })
566 #define show_lock_type(type) \
567 __print_symbolic((int)type, \
568 { F_RDLCK, "RDLCK" }, \
569 { F_WRLCK, "WRLCK" }, \
570 { F_UNLCK, "UNLCK" })
572 DECLARE_EVENT_CLASS(nfs4_lock_event,
573 TP_PROTO(
574 const struct file_lock *request,
575 const struct nfs4_state *state,
576 int cmd,
577 int error
580 TP_ARGS(request, state, cmd, error),
582 TP_STRUCT__entry(
583 __field(int, error)
584 __field(int, cmd)
585 __field(char, type)
586 __field(loff_t, start)
587 __field(loff_t, end)
588 __field(dev_t, dev)
589 __field(u32, fhandle)
590 __field(u64, fileid)
591 __field(int, stateid_seq)
592 __field(u32, stateid_hash)
595 TP_fast_assign(
596 const struct inode *inode = state->inode;
598 __entry->error = error;
599 __entry->cmd = cmd;
600 __entry->type = request->fl_type;
601 __entry->start = request->fl_start;
602 __entry->end = request->fl_end;
603 __entry->dev = inode->i_sb->s_dev;
604 __entry->fileid = NFS_FILEID(inode);
605 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
606 __entry->stateid_seq =
607 be32_to_cpu(state->stateid.seqid);
608 __entry->stateid_hash =
609 nfs_stateid_hash(&state->stateid);
612 TP_printk(
613 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
614 "fileid=%02x:%02x:%llu fhandle=0x%08x "
615 "stateid=%d:0x%08x",
616 __entry->error,
617 show_nfsv4_errors(__entry->error),
618 show_lock_cmd(__entry->cmd),
619 show_lock_type(__entry->type),
620 (long long)__entry->start,
621 (long long)__entry->end,
622 MAJOR(__entry->dev), MINOR(__entry->dev),
623 (unsigned long long)__entry->fileid,
624 __entry->fhandle,
625 __entry->stateid_seq, __entry->stateid_hash
629 #define DEFINE_NFS4_LOCK_EVENT(name) \
630 DEFINE_EVENT(nfs4_lock_event, name, \
631 TP_PROTO( \
632 const struct file_lock *request, \
633 const struct nfs4_state *state, \
634 int cmd, \
635 int error \
636 ), \
637 TP_ARGS(request, state, cmd, error))
638 DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
639 DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
641 TRACE_EVENT(nfs4_set_lock,
642 TP_PROTO(
643 const struct file_lock *request,
644 const struct nfs4_state *state,
645 const nfs4_stateid *lockstateid,
646 int cmd,
647 int error
650 TP_ARGS(request, state, lockstateid, cmd, error),
652 TP_STRUCT__entry(
653 __field(int, error)
654 __field(int, cmd)
655 __field(char, type)
656 __field(loff_t, start)
657 __field(loff_t, end)
658 __field(dev_t, dev)
659 __field(u32, fhandle)
660 __field(u64, fileid)
661 __field(int, stateid_seq)
662 __field(u32, stateid_hash)
663 __field(int, lockstateid_seq)
664 __field(u32, lockstateid_hash)
667 TP_fast_assign(
668 const struct inode *inode = state->inode;
670 __entry->error = error;
671 __entry->cmd = cmd;
672 __entry->type = request->fl_type;
673 __entry->start = request->fl_start;
674 __entry->end = request->fl_end;
675 __entry->dev = inode->i_sb->s_dev;
676 __entry->fileid = NFS_FILEID(inode);
677 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
678 __entry->stateid_seq =
679 be32_to_cpu(state->stateid.seqid);
680 __entry->stateid_hash =
681 nfs_stateid_hash(&state->stateid);
682 __entry->lockstateid_seq =
683 be32_to_cpu(lockstateid->seqid);
684 __entry->lockstateid_hash =
685 nfs_stateid_hash(lockstateid);
688 TP_printk(
689 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
690 "fileid=%02x:%02x:%llu fhandle=0x%08x "
691 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
692 __entry->error,
693 show_nfsv4_errors(__entry->error),
694 show_lock_cmd(__entry->cmd),
695 show_lock_type(__entry->type),
696 (long long)__entry->start,
697 (long long)__entry->end,
698 MAJOR(__entry->dev), MINOR(__entry->dev),
699 (unsigned long long)__entry->fileid,
700 __entry->fhandle,
701 __entry->stateid_seq, __entry->stateid_hash,
702 __entry->lockstateid_seq, __entry->lockstateid_hash
706 DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
707 TP_PROTO(
708 const struct inode *inode,
709 fmode_t fmode
712 TP_ARGS(inode, fmode),
714 TP_STRUCT__entry(
715 __field(dev_t, dev)
716 __field(u32, fhandle)
717 __field(u64, fileid)
718 __field(unsigned int, fmode)
721 TP_fast_assign(
722 __entry->dev = inode->i_sb->s_dev;
723 __entry->fileid = NFS_FILEID(inode);
724 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
725 __entry->fmode = (__force unsigned int)fmode;
728 TP_printk(
729 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
730 show_fmode_flags(__entry->fmode),
731 MAJOR(__entry->dev), MINOR(__entry->dev),
732 (unsigned long long)__entry->fileid,
733 __entry->fhandle
736 #define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
737 DEFINE_EVENT(nfs4_set_delegation_event, name, \
738 TP_PROTO( \
739 const struct inode *inode, \
740 fmode_t fmode \
741 ), \
742 TP_ARGS(inode, fmode))
743 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
744 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
746 TRACE_EVENT(nfs4_delegreturn_exit,
747 TP_PROTO(
748 const struct nfs4_delegreturnargs *args,
749 const struct nfs4_delegreturnres *res,
750 int error
753 TP_ARGS(args, res, error),
755 TP_STRUCT__entry(
756 __field(dev_t, dev)
757 __field(u32, fhandle)
758 __field(int, error)
759 __field(int, stateid_seq)
760 __field(u32, stateid_hash)
763 TP_fast_assign(
764 __entry->dev = res->server->s_dev;
765 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
766 __entry->error = error;
767 __entry->stateid_seq =
768 be32_to_cpu(args->stateid->seqid);
769 __entry->stateid_hash =
770 nfs_stateid_hash(args->stateid);
773 TP_printk(
774 "error=%d (%s) dev=%02x:%02x fhandle=0x%08x "
775 "stateid=%d:0x%08x",
776 __entry->error,
777 show_nfsv4_errors(__entry->error),
778 MAJOR(__entry->dev), MINOR(__entry->dev),
779 __entry->fhandle,
780 __entry->stateid_seq, __entry->stateid_hash
784 #ifdef CONFIG_NFS_V4_1
785 DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
786 TP_PROTO(
787 const struct nfs4_state *state,
788 const struct nfs4_lock_state *lsp,
789 int error
792 TP_ARGS(state, lsp, error),
794 TP_STRUCT__entry(
795 __field(int, error)
796 __field(dev_t, dev)
797 __field(u32, fhandle)
798 __field(u64, fileid)
799 __field(int, stateid_seq)
800 __field(u32, stateid_hash)
803 TP_fast_assign(
804 const struct inode *inode = state->inode;
806 __entry->error = error;
807 __entry->dev = inode->i_sb->s_dev;
808 __entry->fileid = NFS_FILEID(inode);
809 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
810 __entry->stateid_seq =
811 be32_to_cpu(state->stateid.seqid);
812 __entry->stateid_hash =
813 nfs_stateid_hash(&state->stateid);
816 TP_printk(
817 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
818 "stateid=%d:0x%08x",
819 __entry->error,
820 show_nfsv4_errors(__entry->error),
821 MAJOR(__entry->dev), MINOR(__entry->dev),
822 (unsigned long long)__entry->fileid,
823 __entry->fhandle,
824 __entry->stateid_seq, __entry->stateid_hash
828 #define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
829 DEFINE_EVENT(nfs4_test_stateid_event, name, \
830 TP_PROTO( \
831 const struct nfs4_state *state, \
832 const struct nfs4_lock_state *lsp, \
833 int error \
834 ), \
835 TP_ARGS(state, lsp, error))
836 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
837 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
838 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
839 #endif /* CONFIG_NFS_V4_1 */
841 DECLARE_EVENT_CLASS(nfs4_lookup_event,
842 TP_PROTO(
843 const struct inode *dir,
844 const struct qstr *name,
845 int error
848 TP_ARGS(dir, name, error),
850 TP_STRUCT__entry(
851 __field(dev_t, dev)
852 __field(int, error)
853 __field(u64, dir)
854 __string(name, name->name)
857 TP_fast_assign(
858 __entry->dev = dir->i_sb->s_dev;
859 __entry->dir = NFS_FILEID(dir);
860 __entry->error = error;
861 __assign_str(name, name->name);
864 TP_printk(
865 "error=%d (%s) name=%02x:%02x:%llu/%s",
866 __entry->error,
867 show_nfsv4_errors(__entry->error),
868 MAJOR(__entry->dev), MINOR(__entry->dev),
869 (unsigned long long)__entry->dir,
870 __get_str(name)
874 #define DEFINE_NFS4_LOOKUP_EVENT(name) \
875 DEFINE_EVENT(nfs4_lookup_event, name, \
876 TP_PROTO( \
877 const struct inode *dir, \
878 const struct qstr *name, \
879 int error \
880 ), \
881 TP_ARGS(dir, name, error))
883 DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
884 DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
885 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
886 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
887 DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
888 DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
889 DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
891 TRACE_EVENT(nfs4_lookupp,
892 TP_PROTO(
893 const struct inode *inode,
894 int error
897 TP_ARGS(inode, error),
899 TP_STRUCT__entry(
900 __field(dev_t, dev)
901 __field(u64, ino)
902 __field(int, error)
905 TP_fast_assign(
906 __entry->dev = inode->i_sb->s_dev;
907 __entry->ino = NFS_FILEID(inode);
908 __entry->error = error;
911 TP_printk(
912 "error=%d (%s) inode=%02x:%02x:%llu",
913 __entry->error,
914 show_nfsv4_errors(__entry->error),
915 MAJOR(__entry->dev), MINOR(__entry->dev),
916 (unsigned long long)__entry->ino
920 TRACE_EVENT(nfs4_rename,
921 TP_PROTO(
922 const struct inode *olddir,
923 const struct qstr *oldname,
924 const struct inode *newdir,
925 const struct qstr *newname,
926 int error
929 TP_ARGS(olddir, oldname, newdir, newname, error),
931 TP_STRUCT__entry(
932 __field(dev_t, dev)
933 __field(int, error)
934 __field(u64, olddir)
935 __string(oldname, oldname->name)
936 __field(u64, newdir)
937 __string(newname, newname->name)
940 TP_fast_assign(
941 __entry->dev = olddir->i_sb->s_dev;
942 __entry->olddir = NFS_FILEID(olddir);
943 __entry->newdir = NFS_FILEID(newdir);
944 __entry->error = error;
945 __assign_str(oldname, oldname->name);
946 __assign_str(newname, newname->name);
949 TP_printk(
950 "error=%d (%s) oldname=%02x:%02x:%llu/%s "
951 "newname=%02x:%02x:%llu/%s",
952 __entry->error,
953 show_nfsv4_errors(__entry->error),
954 MAJOR(__entry->dev), MINOR(__entry->dev),
955 (unsigned long long)__entry->olddir,
956 __get_str(oldname),
957 MAJOR(__entry->dev), MINOR(__entry->dev),
958 (unsigned long long)__entry->newdir,
959 __get_str(newname)
963 DECLARE_EVENT_CLASS(nfs4_inode_event,
964 TP_PROTO(
965 const struct inode *inode,
966 int error
969 TP_ARGS(inode, error),
971 TP_STRUCT__entry(
972 __field(dev_t, dev)
973 __field(u32, fhandle)
974 __field(u64, fileid)
975 __field(int, error)
978 TP_fast_assign(
979 __entry->dev = inode->i_sb->s_dev;
980 __entry->fileid = NFS_FILEID(inode);
981 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
982 __entry->error = error;
985 TP_printk(
986 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
987 __entry->error,
988 show_nfsv4_errors(__entry->error),
989 MAJOR(__entry->dev), MINOR(__entry->dev),
990 (unsigned long long)__entry->fileid,
991 __entry->fhandle
995 #define DEFINE_NFS4_INODE_EVENT(name) \
996 DEFINE_EVENT(nfs4_inode_event, name, \
997 TP_PROTO( \
998 const struct inode *inode, \
999 int error \
1000 ), \
1001 TP_ARGS(inode, error))
1003 DEFINE_NFS4_INODE_EVENT(nfs4_access);
1004 DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
1005 DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
1006 DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
1007 DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
1008 #ifdef CONFIG_NFS_V4_SECURITY_LABEL
1009 DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
1010 DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
1011 #endif /* CONFIG_NFS_V4_SECURITY_LABEL */
1013 DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
1014 TP_PROTO(
1015 const struct inode *inode,
1016 const nfs4_stateid *stateid,
1017 int error
1020 TP_ARGS(inode, stateid, error),
1022 TP_STRUCT__entry(
1023 __field(dev_t, dev)
1024 __field(u32, fhandle)
1025 __field(u64, fileid)
1026 __field(int, error)
1027 __field(int, stateid_seq)
1028 __field(u32, stateid_hash)
1031 TP_fast_assign(
1032 __entry->dev = inode->i_sb->s_dev;
1033 __entry->fileid = NFS_FILEID(inode);
1034 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1035 __entry->error = error;
1036 __entry->stateid_seq =
1037 be32_to_cpu(stateid->seqid);
1038 __entry->stateid_hash =
1039 nfs_stateid_hash(stateid);
1042 TP_printk(
1043 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1044 "stateid=%d:0x%08x",
1045 __entry->error,
1046 show_nfsv4_errors(__entry->error),
1047 MAJOR(__entry->dev), MINOR(__entry->dev),
1048 (unsigned long long)__entry->fileid,
1049 __entry->fhandle,
1050 __entry->stateid_seq, __entry->stateid_hash
1054 #define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1055 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1056 TP_PROTO( \
1057 const struct inode *inode, \
1058 const nfs4_stateid *stateid, \
1059 int error \
1060 ), \
1061 TP_ARGS(inode, stateid, error))
1063 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1064 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
1065 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
1066 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
1068 DECLARE_EVENT_CLASS(nfs4_getattr_event,
1069 TP_PROTO(
1070 const struct nfs_server *server,
1071 const struct nfs_fh *fhandle,
1072 const struct nfs_fattr *fattr,
1073 int error
1076 TP_ARGS(server, fhandle, fattr, error),
1078 TP_STRUCT__entry(
1079 __field(dev_t, dev)
1080 __field(u32, fhandle)
1081 __field(u64, fileid)
1082 __field(unsigned int, valid)
1083 __field(int, error)
1086 TP_fast_assign(
1087 __entry->dev = server->s_dev;
1088 __entry->valid = fattr->valid;
1089 __entry->fhandle = nfs_fhandle_hash(fhandle);
1090 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
1091 __entry->error = error;
1094 TP_printk(
1095 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1096 "valid=%s",
1097 __entry->error,
1098 show_nfsv4_errors(__entry->error),
1099 MAJOR(__entry->dev), MINOR(__entry->dev),
1100 (unsigned long long)__entry->fileid,
1101 __entry->fhandle,
1102 show_nfs_fattr_flags(__entry->valid)
1106 #define DEFINE_NFS4_GETATTR_EVENT(name) \
1107 DEFINE_EVENT(nfs4_getattr_event, name, \
1108 TP_PROTO( \
1109 const struct nfs_server *server, \
1110 const struct nfs_fh *fhandle, \
1111 const struct nfs_fattr *fattr, \
1112 int error \
1113 ), \
1114 TP_ARGS(server, fhandle, fattr, error))
1115 DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1116 DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1117 DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1119 DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1120 TP_PROTO(
1121 const struct nfs_client *clp,
1122 const struct nfs_fh *fhandle,
1123 const struct inode *inode,
1124 int error
1127 TP_ARGS(clp, fhandle, inode, error),
1129 TP_STRUCT__entry(
1130 __field(int, error)
1131 __field(dev_t, dev)
1132 __field(u32, fhandle)
1133 __field(u64, fileid)
1134 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
1137 TP_fast_assign(
1138 __entry->error = error;
1139 __entry->fhandle = nfs_fhandle_hash(fhandle);
1140 if (!IS_ERR_OR_NULL(inode)) {
1141 __entry->fileid = NFS_FILEID(inode);
1142 __entry->dev = inode->i_sb->s_dev;
1143 } else {
1144 __entry->fileid = 0;
1145 __entry->dev = 0;
1147 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
1150 TP_printk(
1151 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1152 "dstaddr=%s",
1153 __entry->error,
1154 show_nfsv4_errors(__entry->error),
1155 MAJOR(__entry->dev), MINOR(__entry->dev),
1156 (unsigned long long)__entry->fileid,
1157 __entry->fhandle,
1158 __get_str(dstaddr)
1162 #define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1163 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1164 TP_PROTO( \
1165 const struct nfs_client *clp, \
1166 const struct nfs_fh *fhandle, \
1167 const struct inode *inode, \
1168 int error \
1169 ), \
1170 TP_ARGS(clp, fhandle, inode, error))
1171 DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1173 DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1174 TP_PROTO(
1175 const struct nfs_client *clp,
1176 const struct nfs_fh *fhandle,
1177 const struct inode *inode,
1178 const nfs4_stateid *stateid,
1179 int error
1182 TP_ARGS(clp, fhandle, inode, stateid, error),
1184 TP_STRUCT__entry(
1185 __field(int, error)
1186 __field(dev_t, dev)
1187 __field(u32, fhandle)
1188 __field(u64, fileid)
1189 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
1190 __field(int, stateid_seq)
1191 __field(u32, stateid_hash)
1194 TP_fast_assign(
1195 __entry->error = error;
1196 __entry->fhandle = nfs_fhandle_hash(fhandle);
1197 if (!IS_ERR_OR_NULL(inode)) {
1198 __entry->fileid = NFS_FILEID(inode);
1199 __entry->dev = inode->i_sb->s_dev;
1200 } else {
1201 __entry->fileid = 0;
1202 __entry->dev = 0;
1204 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
1205 __entry->stateid_seq =
1206 be32_to_cpu(stateid->seqid);
1207 __entry->stateid_hash =
1208 nfs_stateid_hash(stateid);
1211 TP_printk(
1212 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1213 "stateid=%d:0x%08x dstaddr=%s",
1214 __entry->error,
1215 show_nfsv4_errors(__entry->error),
1216 MAJOR(__entry->dev), MINOR(__entry->dev),
1217 (unsigned long long)__entry->fileid,
1218 __entry->fhandle,
1219 __entry->stateid_seq, __entry->stateid_hash,
1220 __get_str(dstaddr)
1224 #define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1225 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1226 TP_PROTO( \
1227 const struct nfs_client *clp, \
1228 const struct nfs_fh *fhandle, \
1229 const struct inode *inode, \
1230 const nfs4_stateid *stateid, \
1231 int error \
1232 ), \
1233 TP_ARGS(clp, fhandle, inode, stateid, error))
1234 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1235 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
1237 DECLARE_EVENT_CLASS(nfs4_idmap_event,
1238 TP_PROTO(
1239 const char *name,
1240 int len,
1241 u32 id,
1242 int error
1245 TP_ARGS(name, len, id, error),
1247 TP_STRUCT__entry(
1248 __field(int, error)
1249 __field(u32, id)
1250 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1253 TP_fast_assign(
1254 if (len < 0)
1255 len = 0;
1256 __entry->error = error < 0 ? error : 0;
1257 __entry->id = id;
1258 memcpy(__get_str(name), name, len);
1259 __get_str(name)[len] = 0;
1262 TP_printk(
1263 "error=%d id=%u name=%s",
1264 __entry->error,
1265 __entry->id,
1266 __get_str(name)
1269 #define DEFINE_NFS4_IDMAP_EVENT(name) \
1270 DEFINE_EVENT(nfs4_idmap_event, name, \
1271 TP_PROTO( \
1272 const char *name, \
1273 int len, \
1274 u32 id, \
1275 int error \
1276 ), \
1277 TP_ARGS(name, len, id, error))
1278 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1279 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1280 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1281 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1283 DECLARE_EVENT_CLASS(nfs4_read_event,
1284 TP_PROTO(
1285 const struct nfs_pgio_header *hdr,
1286 int error
1289 TP_ARGS(hdr, error),
1291 TP_STRUCT__entry(
1292 __field(dev_t, dev)
1293 __field(u32, fhandle)
1294 __field(u64, fileid)
1295 __field(loff_t, offset)
1296 __field(size_t, count)
1297 __field(int, error)
1298 __field(int, stateid_seq)
1299 __field(u32, stateid_hash)
1302 TP_fast_assign(
1303 const struct inode *inode = hdr->inode;
1304 const struct nfs4_state *state =
1305 hdr->args.context->state;
1306 __entry->dev = inode->i_sb->s_dev;
1307 __entry->fileid = NFS_FILEID(inode);
1308 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1309 __entry->offset = hdr->args.offset;
1310 __entry->count = hdr->args.count;
1311 __entry->error = error;
1312 __entry->stateid_seq =
1313 be32_to_cpu(state->stateid.seqid);
1314 __entry->stateid_hash =
1315 nfs_stateid_hash(&state->stateid);
1318 TP_printk(
1319 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1320 "offset=%lld count=%zu stateid=%d:0x%08x",
1321 __entry->error,
1322 show_nfsv4_errors(__entry->error),
1323 MAJOR(__entry->dev), MINOR(__entry->dev),
1324 (unsigned long long)__entry->fileid,
1325 __entry->fhandle,
1326 (long long)__entry->offset,
1327 __entry->count,
1328 __entry->stateid_seq, __entry->stateid_hash
1331 #define DEFINE_NFS4_READ_EVENT(name) \
1332 DEFINE_EVENT(nfs4_read_event, name, \
1333 TP_PROTO( \
1334 const struct nfs_pgio_header *hdr, \
1335 int error \
1336 ), \
1337 TP_ARGS(hdr, error))
1338 DEFINE_NFS4_READ_EVENT(nfs4_read);
1339 #ifdef CONFIG_NFS_V4_1
1340 DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1341 #endif /* CONFIG_NFS_V4_1 */
1343 DECLARE_EVENT_CLASS(nfs4_write_event,
1344 TP_PROTO(
1345 const struct nfs_pgio_header *hdr,
1346 int error
1349 TP_ARGS(hdr, error),
1351 TP_STRUCT__entry(
1352 __field(dev_t, dev)
1353 __field(u32, fhandle)
1354 __field(u64, fileid)
1355 __field(loff_t, offset)
1356 __field(size_t, count)
1357 __field(int, error)
1358 __field(int, stateid_seq)
1359 __field(u32, stateid_hash)
1362 TP_fast_assign(
1363 const struct inode *inode = hdr->inode;
1364 const struct nfs4_state *state =
1365 hdr->args.context->state;
1366 __entry->dev = inode->i_sb->s_dev;
1367 __entry->fileid = NFS_FILEID(inode);
1368 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1369 __entry->offset = hdr->args.offset;
1370 __entry->count = hdr->args.count;
1371 __entry->error = error;
1372 __entry->stateid_seq =
1373 be32_to_cpu(state->stateid.seqid);
1374 __entry->stateid_hash =
1375 nfs_stateid_hash(&state->stateid);
1378 TP_printk(
1379 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1380 "offset=%lld count=%zu stateid=%d:0x%08x",
1381 __entry->error,
1382 show_nfsv4_errors(__entry->error),
1383 MAJOR(__entry->dev), MINOR(__entry->dev),
1384 (unsigned long long)__entry->fileid,
1385 __entry->fhandle,
1386 (long long)__entry->offset,
1387 __entry->count,
1388 __entry->stateid_seq, __entry->stateid_hash
1392 #define DEFINE_NFS4_WRITE_EVENT(name) \
1393 DEFINE_EVENT(nfs4_write_event, name, \
1394 TP_PROTO( \
1395 const struct nfs_pgio_header *hdr, \
1396 int error \
1397 ), \
1398 TP_ARGS(hdr, error))
1399 DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1400 #ifdef CONFIG_NFS_V4_1
1401 DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1402 #endif /* CONFIG_NFS_V4_1 */
1404 DECLARE_EVENT_CLASS(nfs4_commit_event,
1405 TP_PROTO(
1406 const struct nfs_commit_data *data,
1407 int error
1410 TP_ARGS(data, error),
1412 TP_STRUCT__entry(
1413 __field(dev_t, dev)
1414 __field(u32, fhandle)
1415 __field(u64, fileid)
1416 __field(loff_t, offset)
1417 __field(size_t, count)
1418 __field(int, error)
1421 TP_fast_assign(
1422 const struct inode *inode = data->inode;
1423 __entry->dev = inode->i_sb->s_dev;
1424 __entry->fileid = NFS_FILEID(inode);
1425 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1426 __entry->offset = data->args.offset;
1427 __entry->count = data->args.count;
1428 __entry->error = error;
1431 TP_printk(
1432 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1433 "offset=%lld count=%zu",
1434 __entry->error,
1435 show_nfsv4_errors(__entry->error),
1436 MAJOR(__entry->dev), MINOR(__entry->dev),
1437 (unsigned long long)__entry->fileid,
1438 __entry->fhandle,
1439 (long long)__entry->offset,
1440 __entry->count
1443 #define DEFINE_NFS4_COMMIT_EVENT(name) \
1444 DEFINE_EVENT(nfs4_commit_event, name, \
1445 TP_PROTO( \
1446 const struct nfs_commit_data *data, \
1447 int error \
1448 ), \
1449 TP_ARGS(data, error))
1450 DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1451 #ifdef CONFIG_NFS_V4_1
1452 DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
1454 #define show_pnfs_iomode(iomode) \
1455 __print_symbolic(iomode, \
1456 { IOMODE_READ, "READ" }, \
1457 { IOMODE_RW, "RW" }, \
1458 { IOMODE_ANY, "ANY" })
1460 TRACE_EVENT(nfs4_layoutget,
1461 TP_PROTO(
1462 const struct nfs_open_context *ctx,
1463 const struct pnfs_layout_range *args,
1464 const struct pnfs_layout_range *res,
1465 const nfs4_stateid *layout_stateid,
1466 int error
1469 TP_ARGS(ctx, args, res, layout_stateid, error),
1471 TP_STRUCT__entry(
1472 __field(dev_t, dev)
1473 __field(u32, fhandle)
1474 __field(u64, fileid)
1475 __field(u32, iomode)
1476 __field(u64, offset)
1477 __field(u64, count)
1478 __field(int, error)
1479 __field(int, stateid_seq)
1480 __field(u32, stateid_hash)
1481 __field(int, layoutstateid_seq)
1482 __field(u32, layoutstateid_hash)
1485 TP_fast_assign(
1486 const struct inode *inode = d_inode(ctx->dentry);
1487 const struct nfs4_state *state = ctx->state;
1488 __entry->dev = inode->i_sb->s_dev;
1489 __entry->fileid = NFS_FILEID(inode);
1490 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1491 __entry->iomode = args->iomode;
1492 __entry->offset = args->offset;
1493 __entry->count = args->length;
1494 __entry->error = error;
1495 __entry->stateid_seq =
1496 be32_to_cpu(state->stateid.seqid);
1497 __entry->stateid_hash =
1498 nfs_stateid_hash(&state->stateid);
1499 if (!error) {
1500 __entry->layoutstateid_seq =
1501 be32_to_cpu(layout_stateid->seqid);
1502 __entry->layoutstateid_hash =
1503 nfs_stateid_hash(layout_stateid);
1504 } else {
1505 __entry->layoutstateid_seq = 0;
1506 __entry->layoutstateid_hash = 0;
1510 TP_printk(
1511 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1512 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1513 "layoutstateid=%d:0x%08x",
1514 __entry->error,
1515 show_nfsv4_errors(__entry->error),
1516 MAJOR(__entry->dev), MINOR(__entry->dev),
1517 (unsigned long long)__entry->fileid,
1518 __entry->fhandle,
1519 show_pnfs_iomode(__entry->iomode),
1520 (unsigned long long)__entry->offset,
1521 (unsigned long long)__entry->count,
1522 __entry->stateid_seq, __entry->stateid_hash,
1523 __entry->layoutstateid_seq, __entry->layoutstateid_hash
1527 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1528 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
1529 DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
1531 #define show_pnfs_update_layout_reason(reason) \
1532 __print_symbolic(reason, \
1533 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
1534 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
1535 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
1536 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
1537 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
1538 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
1539 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
1540 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
1541 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
1542 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
1543 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
1544 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
1545 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" })
1547 TRACE_EVENT(pnfs_update_layout,
1548 TP_PROTO(struct inode *inode,
1549 loff_t pos,
1550 u64 count,
1551 enum pnfs_iomode iomode,
1552 struct pnfs_layout_hdr *lo,
1553 struct pnfs_layout_segment *lseg,
1554 enum pnfs_update_layout_reason reason
1556 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
1557 TP_STRUCT__entry(
1558 __field(dev_t, dev)
1559 __field(u64, fileid)
1560 __field(u32, fhandle)
1561 __field(loff_t, pos)
1562 __field(u64, count)
1563 __field(enum pnfs_iomode, iomode)
1564 __field(int, layoutstateid_seq)
1565 __field(u32, layoutstateid_hash)
1566 __field(long, lseg)
1567 __field(enum pnfs_update_layout_reason, reason)
1569 TP_fast_assign(
1570 __entry->dev = inode->i_sb->s_dev;
1571 __entry->fileid = NFS_FILEID(inode);
1572 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1573 __entry->pos = pos;
1574 __entry->count = count;
1575 __entry->iomode = iomode;
1576 __entry->reason = reason;
1577 if (lo != NULL) {
1578 __entry->layoutstateid_seq =
1579 be32_to_cpu(lo->plh_stateid.seqid);
1580 __entry->layoutstateid_hash =
1581 nfs_stateid_hash(&lo->plh_stateid);
1582 } else {
1583 __entry->layoutstateid_seq = 0;
1584 __entry->layoutstateid_hash = 0;
1586 __entry->lseg = (long)lseg;
1588 TP_printk(
1589 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1590 "iomode=%s pos=%llu count=%llu "
1591 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
1592 MAJOR(__entry->dev), MINOR(__entry->dev),
1593 (unsigned long long)__entry->fileid,
1594 __entry->fhandle,
1595 show_pnfs_iomode(__entry->iomode),
1596 (unsigned long long)__entry->pos,
1597 (unsigned long long)__entry->count,
1598 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
1599 __entry->lseg,
1600 show_pnfs_update_layout_reason(__entry->reason)
1604 #endif /* CONFIG_NFS_V4_1 */
1606 #endif /* _TRACE_NFS4_H */
1608 #undef TRACE_INCLUDE_PATH
1609 #define TRACE_INCLUDE_PATH .
1610 #define TRACE_INCLUDE_FILE nfs4trace
1611 /* This part must be outside protection */
1612 #include <trace/define_trace.h>