2 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
5 #define TRACE_SYSTEM nfs4
7 #if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
10 #include <linux/tracepoint.h>
12 #define show_nfsv4_errors(error) \
13 __print_symbolic(error, \
15 /* Mapped by nfs4_stat_to_errno() */ \
16 { -EPERM, "EPERM" }, \
17 { -ENOENT, "ENOENT" }, \
19 { -ENXIO, "ENXIO" }, \
20 { -EACCES, "EACCES" }, \
21 { -EEXIST, "EEXIST" }, \
22 { -EXDEV, "EXDEV" }, \
23 { -ENOTDIR, "ENOTDIR" }, \
24 { -EISDIR, "EISDIR" }, \
25 { -EFBIG, "EFBIG" }, \
26 { -ENOSPC, "ENOSPC" }, \
27 { -EROFS, "EROFS" }, \
28 { -EMLINK, "EMLINK" }, \
29 { -ENAMETOOLONG, "ENAMETOOLONG" }, \
30 { -ENOTEMPTY, "ENOTEMPTY" }, \
31 { -EDQUOT, "EDQUOT" }, \
32 { -ESTALE, "ESTALE" }, \
33 { -EBADHANDLE, "EBADHANDLE" }, \
34 { -EBADCOOKIE, "EBADCOOKIE" }, \
35 { -ENOTSUPP, "ENOTSUPP" }, \
36 { -ETOOSMALL, "ETOOSMALL" }, \
37 { -EREMOTEIO, "EREMOTEIO" }, \
38 { -EBADTYPE, "EBADTYPE" }, \
39 { -EAGAIN, "EAGAIN" }, \
40 { -ELOOP, "ELOOP" }, \
41 { -EOPNOTSUPP, "EOPNOTSUPP" }, \
42 { -EDEADLK, "EDEADLK" }, \
44 { -ENOMEM, "ENOMEM" }, \
45 { -EKEYEXPIRED, "EKEYEXPIRED" }, \
46 { -ETIMEDOUT, "ETIMEDOUT" }, \
47 { -ERESTARTSYS, "ERESTARTSYS" }, \
48 { -ECONNREFUSED, "ECONNREFUSED" }, \
49 { -ECONNRESET, "ECONNRESET" }, \
50 { -ENETUNREACH, "ENETUNREACH" }, \
51 { -EHOSTUNREACH, "EHOSTUNREACH" }, \
52 { -EHOSTDOWN, "EHOSTDOWN" }, \
53 { -EPIPE, "EPIPE" }, \
54 { -EPFNOSUPPORT, "EPFNOSUPPORT" }, \
55 { -EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \
56 /* NFSv4 native errors */ \
57 { -NFS4ERR_ACCESS, "ACCESS" }, \
58 { -NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \
59 { -NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \
60 { -NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \
61 { -NFS4ERR_BADCHAR, "BADCHAR" }, \
62 { -NFS4ERR_BADHANDLE, "BADHANDLE" }, \
63 { -NFS4ERR_BADIOMODE, "BADIOMODE" }, \
64 { -NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \
65 { -NFS4ERR_BADLABEL, "BADLABEL" }, \
66 { -NFS4ERR_BADNAME, "BADNAME" }, \
67 { -NFS4ERR_BADOWNER, "BADOWNER" }, \
68 { -NFS4ERR_BADSESSION, "BADSESSION" }, \
69 { -NFS4ERR_BADSLOT, "BADSLOT" }, \
70 { -NFS4ERR_BADTYPE, "BADTYPE" }, \
71 { -NFS4ERR_BADXDR, "BADXDR" }, \
72 { -NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \
73 { -NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \
74 { -NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \
75 { -NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \
76 { -NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \
77 { -NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \
78 { -NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
79 { -NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \
80 { -NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \
81 { -NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \
82 { -NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \
83 "CONN_NOT_BOUND_TO_SESSION" }, \
84 { -NFS4ERR_DEADLOCK, "DEADLOCK" }, \
85 { -NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \
86 { -NFS4ERR_DELAY, "DELAY" }, \
87 { -NFS4ERR_DELEG_ALREADY_WANTED, \
88 "DELEG_ALREADY_WANTED" }, \
89 { -NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \
90 { -NFS4ERR_DENIED, "DENIED" }, \
91 { -NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \
92 { -NFS4ERR_DQUOT, "DQUOT" }, \
93 { -NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \
94 { -NFS4ERR_EXIST, "EXIST" }, \
95 { -NFS4ERR_EXPIRED, "EXPIRED" }, \
96 { -NFS4ERR_FBIG, "FBIG" }, \
97 { -NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \
98 { -NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \
99 { -NFS4ERR_GRACE, "GRACE" }, \
100 { -NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \
101 { -NFS4ERR_INVAL, "INVAL" }, \
102 { -NFS4ERR_IO, "IO" }, \
103 { -NFS4ERR_ISDIR, "ISDIR" }, \
104 { -NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \
105 { -NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \
106 { -NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \
107 { -NFS4ERR_LOCKED, "LOCKED" }, \
108 { -NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \
109 { -NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \
110 { -NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \
111 { -NFS4ERR_MLINK, "MLINK" }, \
112 { -NFS4ERR_MOVED, "MOVED" }, \
113 { -NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \
114 { -NFS4ERR_NOENT, "NOENT" }, \
115 { -NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \
116 { -NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \
117 { -NFS4ERR_NOSPC, "NOSPC" }, \
118 { -NFS4ERR_NOTDIR, "NOTDIR" }, \
119 { -NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \
120 { -NFS4ERR_NOTSUPP, "NOTSUPP" }, \
121 { -NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \
122 { -NFS4ERR_NOT_SAME, "NOT_SAME" }, \
123 { -NFS4ERR_NO_GRACE, "NO_GRACE" }, \
124 { -NFS4ERR_NXIO, "NXIO" }, \
125 { -NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \
126 { -NFS4ERR_OPENMODE, "OPENMODE" }, \
127 { -NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \
128 { -NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \
129 { -NFS4ERR_PERM, "PERM" }, \
130 { -NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \
131 { -NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \
132 { -NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \
133 { -NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \
134 { -NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \
135 { -NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \
136 { -NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \
137 { -NFS4ERR_REP_TOO_BIG_TO_CACHE, \
138 "REP_TOO_BIG_TO_CACHE" }, \
139 { -NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \
140 { -NFS4ERR_RESOURCE, "RESOURCE" }, \
141 { -NFS4ERR_RESTOREFH, "RESTOREFH" }, \
142 { -NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \
143 { -NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \
144 { -NFS4ERR_ROFS, "ROFS" }, \
145 { -NFS4ERR_SAME, "SAME" }, \
146 { -NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \
147 { -NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \
148 { -NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \
149 { -NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \
150 { -NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \
151 { -NFS4ERR_STALE, "STALE" }, \
152 { -NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \
153 { -NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \
154 { -NFS4ERR_SYMLINK, "SYMLINK" }, \
155 { -NFS4ERR_TOOSMALL, "TOOSMALL" }, \
156 { -NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \
157 { -NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \
158 { -NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \
159 { -NFS4ERR_WRONGSEC, "WRONGSEC" }, \
160 { -NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
161 { -NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
162 { -NFS4ERR_XDEV, "XDEV" })
164 #define show_open_flags(flags) \
165 __print_flags(flags, "|", \
166 { O_CREAT, "O_CREAT" }, \
167 { O_EXCL, "O_EXCL" }, \
168 { O_TRUNC, "O_TRUNC" }, \
169 { O_DIRECT, "O_DIRECT" })
171 #define show_fmode_flags(mode) \
172 __print_flags(mode, "|", \
173 { ((__force unsigned long)FMODE_READ), "READ" }, \
174 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
175 { ((__force unsigned long)FMODE_EXEC), "EXEC" })
177 #define show_nfs_fattr_flags(valid) \
178 __print_flags((unsigned long)valid, "|", \
179 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \
180 { NFS_ATTR_FATTR_MODE, "MODE" }, \
181 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \
182 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \
183 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \
184 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \
185 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \
186 { NFS_ATTR_FATTR_FSID, "FSID" }, \
187 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \
188 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \
189 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \
190 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \
191 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
192 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
193 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
195 DECLARE_EVENT_CLASS(nfs4_clientid_event,
197 const struct nfs_client *clp,
205 rpc_peeraddr2str(clp->cl_rpcclient,
211 __entry->error = error;
212 __assign_str(dstaddr,
213 rpc_peeraddr2str(clp->cl_rpcclient,
218 "error=%d (%s) dstaddr=%s",
220 show_nfsv4_errors(__entry->error),
224 #define DEFINE_NFS4_CLIENTID_EVENT(name) \
225 DEFINE_EVENT(nfs4_clientid_event, name, \
227 const struct nfs_client *clp, \
231 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
232 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
233 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
234 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
235 #ifdef CONFIG_NFS_V4_1
236 DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
237 DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
238 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
239 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
240 DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
241 DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
242 DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
244 #define show_nfs4_sequence_status_flags(status) \
245 __print_flags((unsigned long)status, "|", \
246 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
247 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
248 "CB_GSS_CONTEXTS_EXPIRING" }, \
249 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
250 "CB_GSS_CONTEXTS_EXPIRED" }, \
251 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
252 "EXPIRED_ALL_STATE_REVOKED" }, \
253 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
254 "EXPIRED_SOME_STATE_REVOKED" }, \
255 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
256 "ADMIN_STATE_REVOKED" }, \
257 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
258 "RECALLABLE_STATE_REVOKED" }, \
259 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
260 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
261 "RESTART_RECLAIM_NEEDED" }, \
262 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
263 "CB_PATH_DOWN_SESSION" }, \
264 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
265 "BACKCHANNEL_FAULT" })
267 TRACE_EVENT(nfs4_sequence_done,
269 const struct nfs4_session *session,
270 const struct nfs4_sequence_res *res
272 TP_ARGS(session, res),
275 __field(unsigned int, session)
276 __field(unsigned int, slot_nr)
277 __field(unsigned int, seq_nr)
278 __field(unsigned int, highest_slotid)
279 __field(unsigned int, target_highest_slotid)
280 __field(unsigned int, status_flags)
285 const struct nfs4_slot *sr_slot = res->sr_slot;
286 __entry->session = nfs_session_id_hash(&session->sess_id);
287 __entry->slot_nr = sr_slot->slot_nr;
288 __entry->seq_nr = sr_slot->seq_nr;
289 __entry->highest_slotid = res->sr_highest_slotid;
290 __entry->target_highest_slotid =
291 res->sr_target_highest_slotid;
292 __entry->status_flags = res->sr_status_flags;
293 __entry->error = res->sr_status;
296 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
297 "highest_slotid=%u target_highest_slotid=%u "
298 "status_flags=%u (%s)",
300 show_nfsv4_errors(__entry->error),
304 __entry->highest_slotid,
305 __entry->target_highest_slotid,
306 __entry->status_flags,
307 show_nfs4_sequence_status_flags(__entry->status_flags)
311 struct cb_sequenceargs;
312 struct cb_sequenceres;
314 TRACE_EVENT(nfs4_cb_sequence,
316 const struct cb_sequenceargs *args,
317 const struct cb_sequenceres *res,
320 TP_ARGS(args, res, status),
323 __field(unsigned int, session)
324 __field(unsigned int, slot_nr)
325 __field(unsigned int, seq_nr)
326 __field(unsigned int, highest_slotid)
327 __field(unsigned int, cachethis)
332 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
333 __entry->slot_nr = args->csa_slotid;
334 __entry->seq_nr = args->csa_sequenceid;
335 __entry->highest_slotid = args->csa_highestslotid;
336 __entry->cachethis = args->csa_cachethis;
337 __entry->error = -be32_to_cpu(status);
341 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
344 show_nfsv4_errors(__entry->error),
348 __entry->highest_slotid
351 #endif /* CONFIG_NFS_V4_1 */
353 TRACE_EVENT(nfs4_setup_sequence,
355 const struct nfs4_session *session,
356 const struct nfs4_sequence_args *args
358 TP_ARGS(session, args),
361 __field(unsigned int, session)
362 __field(unsigned int, slot_nr)
363 __field(unsigned int, seq_nr)
364 __field(unsigned int, highest_used_slotid)
368 const struct nfs4_slot *sa_slot = args->sa_slot;
369 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
370 __entry->slot_nr = sa_slot->slot_nr;
371 __entry->seq_nr = sa_slot->seq_nr;
372 __entry->highest_used_slotid =
373 sa_slot->table->highest_used_slotid;
376 "session=0x%08x slot_nr=%u seq_nr=%u "
377 "highest_used_slotid=%u",
381 __entry->highest_used_slotid
385 DECLARE_EVENT_CLASS(nfs4_open_event,
387 const struct nfs_open_context *ctx,
392 TP_ARGS(ctx, flags, error),
396 __field(unsigned int, flags)
397 __field(unsigned int, fmode)
399 __field(u32, fhandle)
402 __string(name, ctx->dentry->d_name.name)
403 __field(int, stateid_seq)
404 __field(u32, stateid_hash)
405 __field(int, openstateid_seq)
406 __field(u32, openstateid_hash)
410 const struct nfs4_state *state = ctx->state;
411 const struct inode *inode = NULL;
413 __entry->error = error;
414 __entry->flags = flags;
415 __entry->fmode = (__force unsigned int)ctx->mode;
416 __entry->dev = ctx->dentry->d_sb->s_dev;
417 if (!IS_ERR_OR_NULL(state)) {
418 inode = state->inode;
419 __entry->stateid_seq =
420 be32_to_cpu(state->stateid.seqid);
421 __entry->stateid_hash =
422 nfs_stateid_hash(&state->stateid);
423 __entry->openstateid_seq =
424 be32_to_cpu(state->open_stateid.seqid);
425 __entry->openstateid_hash =
426 nfs_stateid_hash(&state->open_stateid);
428 __entry->stateid_seq = 0;
429 __entry->stateid_hash = 0;
430 __entry->openstateid_seq = 0;
431 __entry->openstateid_hash = 0;
434 __entry->fileid = NFS_FILEID(inode);
435 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
438 __entry->fhandle = 0;
440 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
441 __assign_str(name, ctx->dentry->d_name.name);
445 "error=%d (%s) flags=%d (%s) fmode=%s "
446 "fileid=%02x:%02x:%llu fhandle=0x%08x "
447 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
448 "openstateid=%d:0x%08x",
450 show_nfsv4_errors(__entry->error),
452 show_open_flags(__entry->flags),
453 show_fmode_flags(__entry->fmode),
454 MAJOR(__entry->dev), MINOR(__entry->dev),
455 (unsigned long long)__entry->fileid,
457 MAJOR(__entry->dev), MINOR(__entry->dev),
458 (unsigned long long)__entry->dir,
460 __entry->stateid_seq, __entry->stateid_hash,
461 __entry->openstateid_seq, __entry->openstateid_hash
465 #define DEFINE_NFS4_OPEN_EVENT(name) \
466 DEFINE_EVENT(nfs4_open_event, name, \
468 const struct nfs_open_context *ctx, \
472 TP_ARGS(ctx, flags, error))
473 DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
474 DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
475 DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
477 TRACE_EVENT(nfs4_cached_open,
479 const struct nfs4_state *state
484 __field(u32, fhandle)
486 __field(unsigned int, fmode)
487 __field(int, stateid_seq)
488 __field(u32, stateid_hash)
492 const struct inode *inode = state->inode;
494 __entry->dev = inode->i_sb->s_dev;
495 __entry->fileid = NFS_FILEID(inode);
496 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
497 __entry->fmode = (__force unsigned int)state->state;
498 __entry->stateid_seq =
499 be32_to_cpu(state->stateid.seqid);
500 __entry->stateid_hash =
501 nfs_stateid_hash(&state->stateid);
505 "fmode=%s fileid=%02x:%02x:%llu "
506 "fhandle=0x%08x stateid=%d:0x%08x",
507 __entry->fmode ? show_fmode_flags(__entry->fmode) :
509 MAJOR(__entry->dev), MINOR(__entry->dev),
510 (unsigned long long)__entry->fileid,
512 __entry->stateid_seq, __entry->stateid_hash
516 TRACE_EVENT(nfs4_close,
518 const struct nfs4_state *state,
519 const struct nfs_closeargs *args,
520 const struct nfs_closeres *res,
524 TP_ARGS(state, args, res, error),
528 __field(u32, fhandle)
530 __field(unsigned int, fmode)
532 __field(int, stateid_seq)
533 __field(u32, stateid_hash)
537 const struct inode *inode = state->inode;
539 __entry->dev = inode->i_sb->s_dev;
540 __entry->fileid = NFS_FILEID(inode);
541 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
542 __entry->fmode = (__force unsigned int)state->state;
543 __entry->error = error;
544 __entry->stateid_seq =
545 be32_to_cpu(args->stateid.seqid);
546 __entry->stateid_hash =
547 nfs_stateid_hash(&args->stateid);
551 "error=%d (%s) fmode=%s fileid=%02x:%02x:%llu "
552 "fhandle=0x%08x openstateid=%d:0x%08x",
554 show_nfsv4_errors(__entry->error),
555 __entry->fmode ? show_fmode_flags(__entry->fmode) :
557 MAJOR(__entry->dev), MINOR(__entry->dev),
558 (unsigned long long)__entry->fileid,
560 __entry->stateid_seq, __entry->stateid_hash
564 #define show_lock_cmd(type) \
565 __print_symbolic((int)type, \
566 { F_GETLK, "GETLK" }, \
567 { F_SETLK, "SETLK" }, \
568 { F_SETLKW, "SETLKW" })
569 #define show_lock_type(type) \
570 __print_symbolic((int)type, \
571 { F_RDLCK, "RDLCK" }, \
572 { F_WRLCK, "WRLCK" }, \
573 { F_UNLCK, "UNLCK" })
575 DECLARE_EVENT_CLASS(nfs4_lock_event,
577 const struct file_lock *request,
578 const struct nfs4_state *state,
583 TP_ARGS(request, state, cmd, error),
589 __field(loff_t, start)
592 __field(u32, fhandle)
594 __field(int, stateid_seq)
595 __field(u32, stateid_hash)
599 const struct inode *inode = state->inode;
601 __entry->error = error;
603 __entry->type = request->fl_type;
604 __entry->start = request->fl_start;
605 __entry->end = request->fl_end;
606 __entry->dev = inode->i_sb->s_dev;
607 __entry->fileid = NFS_FILEID(inode);
608 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
609 __entry->stateid_seq =
610 be32_to_cpu(state->stateid.seqid);
611 __entry->stateid_hash =
612 nfs_stateid_hash(&state->stateid);
616 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
617 "fileid=%02x:%02x:%llu fhandle=0x%08x "
620 show_nfsv4_errors(__entry->error),
621 show_lock_cmd(__entry->cmd),
622 show_lock_type(__entry->type),
623 (long long)__entry->start,
624 (long long)__entry->end,
625 MAJOR(__entry->dev), MINOR(__entry->dev),
626 (unsigned long long)__entry->fileid,
628 __entry->stateid_seq, __entry->stateid_hash
632 #define DEFINE_NFS4_LOCK_EVENT(name) \
633 DEFINE_EVENT(nfs4_lock_event, name, \
635 const struct file_lock *request, \
636 const struct nfs4_state *state, \
640 TP_ARGS(request, state, cmd, error))
641 DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
642 DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
644 TRACE_EVENT(nfs4_set_lock,
646 const struct file_lock *request,
647 const struct nfs4_state *state,
648 const nfs4_stateid *lockstateid,
653 TP_ARGS(request, state, lockstateid, cmd, error),
659 __field(loff_t, start)
662 __field(u32, fhandle)
664 __field(int, stateid_seq)
665 __field(u32, stateid_hash)
666 __field(int, lockstateid_seq)
667 __field(u32, lockstateid_hash)
671 const struct inode *inode = state->inode;
673 __entry->error = error;
675 __entry->type = request->fl_type;
676 __entry->start = request->fl_start;
677 __entry->end = request->fl_end;
678 __entry->dev = inode->i_sb->s_dev;
679 __entry->fileid = NFS_FILEID(inode);
680 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
681 __entry->stateid_seq =
682 be32_to_cpu(state->stateid.seqid);
683 __entry->stateid_hash =
684 nfs_stateid_hash(&state->stateid);
685 __entry->lockstateid_seq =
686 be32_to_cpu(lockstateid->seqid);
687 __entry->lockstateid_hash =
688 nfs_stateid_hash(lockstateid);
692 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
693 "fileid=%02x:%02x:%llu fhandle=0x%08x "
694 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
696 show_nfsv4_errors(__entry->error),
697 show_lock_cmd(__entry->cmd),
698 show_lock_type(__entry->type),
699 (long long)__entry->start,
700 (long long)__entry->end,
701 MAJOR(__entry->dev), MINOR(__entry->dev),
702 (unsigned long long)__entry->fileid,
704 __entry->stateid_seq, __entry->stateid_hash,
705 __entry->lockstateid_seq, __entry->lockstateid_hash
709 DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
711 const struct inode *inode,
715 TP_ARGS(inode, fmode),
719 __field(u32, fhandle)
721 __field(unsigned int, fmode)
725 __entry->dev = inode->i_sb->s_dev;
726 __entry->fileid = NFS_FILEID(inode);
727 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
728 __entry->fmode = (__force unsigned int)fmode;
732 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
733 show_fmode_flags(__entry->fmode),
734 MAJOR(__entry->dev), MINOR(__entry->dev),
735 (unsigned long long)__entry->fileid,
739 #define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
740 DEFINE_EVENT(nfs4_set_delegation_event, name, \
742 const struct inode *inode, \
745 TP_ARGS(inode, fmode))
746 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
747 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
749 TRACE_EVENT(nfs4_delegreturn_exit,
751 const struct nfs4_delegreturnargs *args,
752 const struct nfs4_delegreturnres *res,
756 TP_ARGS(args, res, error),
760 __field(u32, fhandle)
762 __field(int, stateid_seq)
763 __field(u32, stateid_hash)
767 __entry->dev = res->server->s_dev;
768 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
769 __entry->error = error;
770 __entry->stateid_seq =
771 be32_to_cpu(args->stateid->seqid);
772 __entry->stateid_hash =
773 nfs_stateid_hash(args->stateid);
777 "error=%d (%s) dev=%02x:%02x fhandle=0x%08x "
780 show_nfsv4_errors(__entry->error),
781 MAJOR(__entry->dev), MINOR(__entry->dev),
783 __entry->stateid_seq, __entry->stateid_hash
787 #ifdef CONFIG_NFS_V4_1
788 DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
790 const struct nfs4_state *state,
791 const struct nfs4_lock_state *lsp,
795 TP_ARGS(state, lsp, error),
800 __field(u32, fhandle)
802 __field(int, stateid_seq)
803 __field(u32, stateid_hash)
807 const struct inode *inode = state->inode;
809 __entry->error = error;
810 __entry->dev = inode->i_sb->s_dev;
811 __entry->fileid = NFS_FILEID(inode);
812 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
813 __entry->stateid_seq =
814 be32_to_cpu(state->stateid.seqid);
815 __entry->stateid_hash =
816 nfs_stateid_hash(&state->stateid);
820 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
823 show_nfsv4_errors(__entry->error),
824 MAJOR(__entry->dev), MINOR(__entry->dev),
825 (unsigned long long)__entry->fileid,
827 __entry->stateid_seq, __entry->stateid_hash
831 #define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
832 DEFINE_EVENT(nfs4_test_stateid_event, name, \
834 const struct nfs4_state *state, \
835 const struct nfs4_lock_state *lsp, \
838 TP_ARGS(state, lsp, error))
839 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
840 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
841 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
842 #endif /* CONFIG_NFS_V4_1 */
844 DECLARE_EVENT_CLASS(nfs4_lookup_event,
846 const struct inode *dir,
847 const struct qstr *name,
851 TP_ARGS(dir, name, error),
857 __string(name, name->name)
861 __entry->dev = dir->i_sb->s_dev;
862 __entry->dir = NFS_FILEID(dir);
863 __entry->error = error;
864 __assign_str(name, name->name);
868 "error=%d (%s) name=%02x:%02x:%llu/%s",
870 show_nfsv4_errors(__entry->error),
871 MAJOR(__entry->dev), MINOR(__entry->dev),
872 (unsigned long long)__entry->dir,
877 #define DEFINE_NFS4_LOOKUP_EVENT(name) \
878 DEFINE_EVENT(nfs4_lookup_event, name, \
880 const struct inode *dir, \
881 const struct qstr *name, \
884 TP_ARGS(dir, name, error))
886 DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
887 DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
888 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
889 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
890 DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
891 DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
892 DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
894 TRACE_EVENT(nfs4_rename,
896 const struct inode *olddir,
897 const struct qstr *oldname,
898 const struct inode *newdir,
899 const struct qstr *newname,
903 TP_ARGS(olddir, oldname, newdir, newname, error),
909 __string(oldname, oldname->name)
911 __string(newname, newname->name)
915 __entry->dev = olddir->i_sb->s_dev;
916 __entry->olddir = NFS_FILEID(olddir);
917 __entry->newdir = NFS_FILEID(newdir);
918 __entry->error = error;
919 __assign_str(oldname, oldname->name);
920 __assign_str(newname, newname->name);
924 "error=%d (%s) oldname=%02x:%02x:%llu/%s "
925 "newname=%02x:%02x:%llu/%s",
927 show_nfsv4_errors(__entry->error),
928 MAJOR(__entry->dev), MINOR(__entry->dev),
929 (unsigned long long)__entry->olddir,
931 MAJOR(__entry->dev), MINOR(__entry->dev),
932 (unsigned long long)__entry->newdir,
937 DECLARE_EVENT_CLASS(nfs4_inode_event,
939 const struct inode *inode,
943 TP_ARGS(inode, error),
947 __field(u32, fhandle)
953 __entry->dev = inode->i_sb->s_dev;
954 __entry->fileid = NFS_FILEID(inode);
955 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
956 __entry->error = error;
960 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
962 show_nfsv4_errors(__entry->error),
963 MAJOR(__entry->dev), MINOR(__entry->dev),
964 (unsigned long long)__entry->fileid,
969 #define DEFINE_NFS4_INODE_EVENT(name) \
970 DEFINE_EVENT(nfs4_inode_event, name, \
972 const struct inode *inode, \
975 TP_ARGS(inode, error))
977 DEFINE_NFS4_INODE_EVENT(nfs4_access);
978 DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
979 DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
980 DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
981 DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
982 #ifdef CONFIG_NFS_V4_SECURITY_LABEL
983 DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
984 DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
985 #endif /* CONFIG_NFS_V4_SECURITY_LABEL */
987 DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
989 const struct inode *inode,
990 const nfs4_stateid *stateid,
994 TP_ARGS(inode, stateid, error),
998 __field(u32, fhandle)
1001 __field(int, stateid_seq)
1002 __field(u32, stateid_hash)
1006 __entry->dev = inode->i_sb->s_dev;
1007 __entry->fileid = NFS_FILEID(inode);
1008 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1009 __entry->error = error;
1010 __entry->stateid_seq =
1011 be32_to_cpu(stateid->seqid);
1012 __entry->stateid_hash =
1013 nfs_stateid_hash(stateid);
1017 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1018 "stateid=%d:0x%08x",
1020 show_nfsv4_errors(__entry->error),
1021 MAJOR(__entry->dev), MINOR(__entry->dev),
1022 (unsigned long long)__entry->fileid,
1024 __entry->stateid_seq, __entry->stateid_hash
1028 #define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1029 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1031 const struct inode *inode, \
1032 const nfs4_stateid *stateid, \
1035 TP_ARGS(inode, stateid, error))
1037 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1038 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
1040 DECLARE_EVENT_CLASS(nfs4_getattr_event,
1042 const struct nfs_server *server,
1043 const struct nfs_fh *fhandle,
1044 const struct nfs_fattr *fattr,
1048 TP_ARGS(server, fhandle, fattr, error),
1052 __field(u32, fhandle)
1053 __field(u64, fileid)
1054 __field(unsigned int, valid)
1059 __entry->dev = server->s_dev;
1060 __entry->valid = fattr->valid;
1061 __entry->fhandle = nfs_fhandle_hash(fhandle);
1062 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
1063 __entry->error = error;
1067 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1070 show_nfsv4_errors(__entry->error),
1071 MAJOR(__entry->dev), MINOR(__entry->dev),
1072 (unsigned long long)__entry->fileid,
1074 show_nfs_fattr_flags(__entry->valid)
1078 #define DEFINE_NFS4_GETATTR_EVENT(name) \
1079 DEFINE_EVENT(nfs4_getattr_event, name, \
1081 const struct nfs_server *server, \
1082 const struct nfs_fh *fhandle, \
1083 const struct nfs_fattr *fattr, \
1086 TP_ARGS(server, fhandle, fattr, error))
1087 DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1088 DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1089 DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1091 DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1093 const struct nfs_client *clp,
1094 const struct nfs_fh *fhandle,
1095 const struct inode *inode,
1099 TP_ARGS(clp, fhandle, inode, error),
1104 __field(u32, fhandle)
1105 __field(u64, fileid)
1106 __string(dstaddr, clp ?
1107 rpc_peeraddr2str(clp->cl_rpcclient,
1108 RPC_DISPLAY_ADDR) : "unknown")
1112 __entry->error = error;
1113 __entry->fhandle = nfs_fhandle_hash(fhandle);
1114 if (inode != NULL) {
1115 __entry->fileid = NFS_FILEID(inode);
1116 __entry->dev = inode->i_sb->s_dev;
1118 __entry->fileid = 0;
1121 __assign_str(dstaddr, clp ?
1122 rpc_peeraddr2str(clp->cl_rpcclient,
1123 RPC_DISPLAY_ADDR) : "unknown")
1127 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1130 show_nfsv4_errors(__entry->error),
1131 MAJOR(__entry->dev), MINOR(__entry->dev),
1132 (unsigned long long)__entry->fileid,
1138 #define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1139 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1141 const struct nfs_client *clp, \
1142 const struct nfs_fh *fhandle, \
1143 const struct inode *inode, \
1146 TP_ARGS(clp, fhandle, inode, error))
1147 DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1149 DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1151 const struct nfs_client *clp,
1152 const struct nfs_fh *fhandle,
1153 const struct inode *inode,
1154 const nfs4_stateid *stateid,
1158 TP_ARGS(clp, fhandle, inode, stateid, error),
1163 __field(u32, fhandle)
1164 __field(u64, fileid)
1165 __string(dstaddr, clp ?
1166 rpc_peeraddr2str(clp->cl_rpcclient,
1167 RPC_DISPLAY_ADDR) : "unknown")
1168 __field(int, stateid_seq)
1169 __field(u32, stateid_hash)
1173 __entry->error = error;
1174 __entry->fhandle = nfs_fhandle_hash(fhandle);
1175 if (inode != NULL) {
1176 __entry->fileid = NFS_FILEID(inode);
1177 __entry->dev = inode->i_sb->s_dev;
1179 __entry->fileid = 0;
1182 __assign_str(dstaddr, clp ?
1183 rpc_peeraddr2str(clp->cl_rpcclient,
1184 RPC_DISPLAY_ADDR) : "unknown")
1185 __entry->stateid_seq =
1186 be32_to_cpu(stateid->seqid);
1187 __entry->stateid_hash =
1188 nfs_stateid_hash(stateid);
1192 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1193 "stateid=%d:0x%08x dstaddr=%s",
1195 show_nfsv4_errors(__entry->error),
1196 MAJOR(__entry->dev), MINOR(__entry->dev),
1197 (unsigned long long)__entry->fileid,
1199 __entry->stateid_seq, __entry->stateid_hash,
1204 #define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1205 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1207 const struct nfs_client *clp, \
1208 const struct nfs_fh *fhandle, \
1209 const struct inode *inode, \
1210 const nfs4_stateid *stateid, \
1213 TP_ARGS(clp, fhandle, inode, stateid, error))
1214 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1215 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
1217 DECLARE_EVENT_CLASS(nfs4_idmap_event,
1225 TP_ARGS(name, len, id, error),
1230 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1236 __entry->error = error < 0 ? error : 0;
1238 memcpy(__get_str(name), name, len);
1239 __get_str(name)[len] = 0;
1243 "error=%d id=%u name=%s",
1249 #define DEFINE_NFS4_IDMAP_EVENT(name) \
1250 DEFINE_EVENT(nfs4_idmap_event, name, \
1257 TP_ARGS(name, len, id, error))
1258 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1259 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1260 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1261 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1263 DECLARE_EVENT_CLASS(nfs4_read_event,
1265 const struct nfs_pgio_header *hdr,
1269 TP_ARGS(hdr, error),
1273 __field(u32, fhandle)
1274 __field(u64, fileid)
1275 __field(loff_t, offset)
1276 __field(size_t, count)
1278 __field(int, stateid_seq)
1279 __field(u32, stateid_hash)
1283 const struct inode *inode = hdr->inode;
1284 const struct nfs4_state *state =
1285 hdr->args.context->state;
1286 __entry->dev = inode->i_sb->s_dev;
1287 __entry->fileid = NFS_FILEID(inode);
1288 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1289 __entry->offset = hdr->args.offset;
1290 __entry->count = hdr->args.count;
1291 __entry->error = error;
1292 __entry->stateid_seq =
1293 be32_to_cpu(state->stateid.seqid);
1294 __entry->stateid_hash =
1295 nfs_stateid_hash(&state->stateid);
1299 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1300 "offset=%lld count=%zu stateid=%d:0x%08x",
1302 show_nfsv4_errors(__entry->error),
1303 MAJOR(__entry->dev), MINOR(__entry->dev),
1304 (unsigned long long)__entry->fileid,
1306 (long long)__entry->offset,
1308 __entry->stateid_seq, __entry->stateid_hash
1311 #define DEFINE_NFS4_READ_EVENT(name) \
1312 DEFINE_EVENT(nfs4_read_event, name, \
1314 const struct nfs_pgio_header *hdr, \
1317 TP_ARGS(hdr, error))
1318 DEFINE_NFS4_READ_EVENT(nfs4_read);
1319 #ifdef CONFIG_NFS_V4_1
1320 DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1321 #endif /* CONFIG_NFS_V4_1 */
1323 DECLARE_EVENT_CLASS(nfs4_write_event,
1325 const struct nfs_pgio_header *hdr,
1329 TP_ARGS(hdr, error),
1333 __field(u32, fhandle)
1334 __field(u64, fileid)
1335 __field(loff_t, offset)
1336 __field(size_t, count)
1338 __field(int, stateid_seq)
1339 __field(u32, stateid_hash)
1343 const struct inode *inode = hdr->inode;
1344 const struct nfs4_state *state =
1345 hdr->args.context->state;
1346 __entry->dev = inode->i_sb->s_dev;
1347 __entry->fileid = NFS_FILEID(inode);
1348 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1349 __entry->offset = hdr->args.offset;
1350 __entry->count = hdr->args.count;
1351 __entry->error = error;
1352 __entry->stateid_seq =
1353 be32_to_cpu(state->stateid.seqid);
1354 __entry->stateid_hash =
1355 nfs_stateid_hash(&state->stateid);
1359 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1360 "offset=%lld count=%zu stateid=%d:0x%08x",
1362 show_nfsv4_errors(__entry->error),
1363 MAJOR(__entry->dev), MINOR(__entry->dev),
1364 (unsigned long long)__entry->fileid,
1366 (long long)__entry->offset,
1368 __entry->stateid_seq, __entry->stateid_hash
1372 #define DEFINE_NFS4_WRITE_EVENT(name) \
1373 DEFINE_EVENT(nfs4_write_event, name, \
1375 const struct nfs_pgio_header *hdr, \
1378 TP_ARGS(hdr, error))
1379 DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1380 #ifdef CONFIG_NFS_V4_1
1381 DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1382 #endif /* CONFIG_NFS_V4_1 */
1384 DECLARE_EVENT_CLASS(nfs4_commit_event,
1386 const struct nfs_commit_data *data,
1390 TP_ARGS(data, error),
1394 __field(u32, fhandle)
1395 __field(u64, fileid)
1396 __field(loff_t, offset)
1397 __field(size_t, count)
1402 const struct inode *inode = data->inode;
1403 __entry->dev = inode->i_sb->s_dev;
1404 __entry->fileid = NFS_FILEID(inode);
1405 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1406 __entry->offset = data->args.offset;
1407 __entry->count = data->args.count;
1408 __entry->error = error;
1412 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1413 "offset=%lld count=%zu",
1415 show_nfsv4_errors(__entry->error),
1416 MAJOR(__entry->dev), MINOR(__entry->dev),
1417 (unsigned long long)__entry->fileid,
1419 (long long)__entry->offset,
1423 #define DEFINE_NFS4_COMMIT_EVENT(name) \
1424 DEFINE_EVENT(nfs4_commit_event, name, \
1426 const struct nfs_commit_data *data, \
1429 TP_ARGS(data, error))
1430 DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1431 #ifdef CONFIG_NFS_V4_1
1432 DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
1434 #define show_pnfs_iomode(iomode) \
1435 __print_symbolic(iomode, \
1436 { IOMODE_READ, "READ" }, \
1437 { IOMODE_RW, "RW" }, \
1438 { IOMODE_ANY, "ANY" })
1440 TRACE_EVENT(nfs4_layoutget,
1442 const struct nfs_open_context *ctx,
1443 const struct pnfs_layout_range *args,
1444 const struct pnfs_layout_range *res,
1445 const nfs4_stateid *layout_stateid,
1449 TP_ARGS(ctx, args, res, layout_stateid, error),
1453 __field(u32, fhandle)
1454 __field(u64, fileid)
1455 __field(u32, iomode)
1456 __field(u64, offset)
1459 __field(int, stateid_seq)
1460 __field(u32, stateid_hash)
1461 __field(int, layoutstateid_seq)
1462 __field(u32, layoutstateid_hash)
1466 const struct inode *inode = d_inode(ctx->dentry);
1467 const struct nfs4_state *state = ctx->state;
1468 __entry->dev = inode->i_sb->s_dev;
1469 __entry->fileid = NFS_FILEID(inode);
1470 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1471 __entry->iomode = args->iomode;
1472 __entry->offset = args->offset;
1473 __entry->count = args->length;
1474 __entry->error = error;
1475 __entry->stateid_seq =
1476 be32_to_cpu(state->stateid.seqid);
1477 __entry->stateid_hash =
1478 nfs_stateid_hash(&state->stateid);
1480 __entry->layoutstateid_seq =
1481 be32_to_cpu(layout_stateid->seqid);
1482 __entry->layoutstateid_hash =
1483 nfs_stateid_hash(layout_stateid);
1485 __entry->layoutstateid_seq = 0;
1486 __entry->layoutstateid_hash = 0;
1491 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1492 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1493 "layoutstateid=%d:0x%08x",
1495 show_nfsv4_errors(__entry->error),
1496 MAJOR(__entry->dev), MINOR(__entry->dev),
1497 (unsigned long long)__entry->fileid,
1499 show_pnfs_iomode(__entry->iomode),
1500 (unsigned long long)__entry->offset,
1501 (unsigned long long)__entry->count,
1502 __entry->stateid_seq, __entry->stateid_hash,
1503 __entry->layoutstateid_seq, __entry->layoutstateid_hash
1507 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1508 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
1509 DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
1511 #define show_pnfs_update_layout_reason(reason) \
1512 __print_symbolic(reason, \
1513 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
1514 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
1515 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
1516 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
1517 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
1518 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
1519 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
1520 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
1521 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
1522 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
1523 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
1524 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
1525 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" })
1527 TRACE_EVENT(pnfs_update_layout,
1528 TP_PROTO(struct inode *inode,
1531 enum pnfs_iomode iomode,
1532 struct pnfs_layout_hdr *lo,
1533 struct pnfs_layout_segment *lseg,
1534 enum pnfs_update_layout_reason reason
1536 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
1539 __field(u64, fileid)
1540 __field(u32, fhandle)
1541 __field(loff_t, pos)
1543 __field(enum pnfs_iomode, iomode)
1544 __field(int, layoutstateid_seq)
1545 __field(u32, layoutstateid_hash)
1547 __field(enum pnfs_update_layout_reason, reason)
1550 __entry->dev = inode->i_sb->s_dev;
1551 __entry->fileid = NFS_FILEID(inode);
1552 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1554 __entry->count = count;
1555 __entry->iomode = iomode;
1556 __entry->reason = reason;
1558 __entry->layoutstateid_seq =
1559 be32_to_cpu(lo->plh_stateid.seqid);
1560 __entry->layoutstateid_hash =
1561 nfs_stateid_hash(&lo->plh_stateid);
1563 __entry->layoutstateid_seq = 0;
1564 __entry->layoutstateid_hash = 0;
1566 __entry->lseg = (long)lseg;
1569 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1570 "iomode=%s pos=%llu count=%llu "
1571 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
1572 MAJOR(__entry->dev), MINOR(__entry->dev),
1573 (unsigned long long)__entry->fileid,
1575 show_pnfs_iomode(__entry->iomode),
1576 (unsigned long long)__entry->pos,
1577 (unsigned long long)__entry->count,
1578 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
1580 show_pnfs_update_layout_reason(__entry->reason)
1584 #endif /* CONFIG_NFS_V4_1 */
1586 #endif /* _TRACE_NFS4_H */
1588 #undef TRACE_INCLUDE_PATH
1589 #define TRACE_INCLUDE_PATH .
1590 #define TRACE_INCLUDE_FILE nfs4trace
1591 /* This part must be outside protection */
1592 #include <trace/define_trace.h>