1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
6 #define TRACE_SYSTEM nfs4
8 #if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
11 #include <linux/tracepoint.h>
12 #include <trace/misc/sunrpc.h>
14 #include <trace/misc/fs.h>
15 #include <trace/misc/nfs.h>
17 #define show_nfs_fattr_flags(valid) \
18 __print_flags((unsigned long)valid, "|", \
19 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \
20 { NFS_ATTR_FATTR_MODE, "MODE" }, \
21 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \
22 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \
23 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \
24 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \
25 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \
26 { NFS_ATTR_FATTR_FSID, "FSID" }, \
27 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \
28 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \
29 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \
30 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \
31 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
32 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
33 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
35 DECLARE_EVENT_CLASS(nfs4_clientid_event,
37 const struct nfs_client *clp,
44 __string(dstaddr, clp->cl_hostname)
45 __field(unsigned long, error)
49 __entry->error = error < 0 ? -error : 0;
50 __assign_str(dstaddr, clp->cl_hostname);
54 "error=%ld (%s) dstaddr=%s",
56 show_nfs4_status(__entry->error),
60 #define DEFINE_NFS4_CLIENTID_EVENT(name) \
61 DEFINE_EVENT(nfs4_clientid_event, name, \
63 const struct nfs_client *clp, \
67 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
68 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
69 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
70 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
71 #ifdef CONFIG_NFS_V4_1
72 DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
73 DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
74 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
75 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
76 DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
77 DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
78 DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
80 TRACE_EVENT(nfs4_sequence_done,
82 const struct nfs4_session *session,
83 const struct nfs4_sequence_res *res
85 TP_ARGS(session, res),
88 __field(unsigned int, session)
89 __field(unsigned int, slot_nr)
90 __field(unsigned int, seq_nr)
91 __field(unsigned int, highest_slotid)
92 __field(unsigned int, target_highest_slotid)
93 __field(unsigned long, status_flags)
94 __field(unsigned long, error)
98 const struct nfs4_slot *sr_slot = res->sr_slot;
99 __entry->session = nfs_session_id_hash(&session->sess_id);
100 __entry->slot_nr = sr_slot->slot_nr;
101 __entry->seq_nr = sr_slot->seq_nr;
102 __entry->highest_slotid = res->sr_highest_slotid;
103 __entry->target_highest_slotid =
104 res->sr_target_highest_slotid;
105 __entry->status_flags = res->sr_status_flags;
106 __entry->error = res->sr_status < 0 ?
110 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
111 "highest_slotid=%u target_highest_slotid=%u "
112 "status_flags=0x%lx (%s)",
114 show_nfs4_status(__entry->error),
118 __entry->highest_slotid,
119 __entry->target_highest_slotid,
120 __entry->status_flags,
121 show_nfs4_seq4_status(__entry->status_flags)
125 struct cb_sequenceargs;
126 struct cb_sequenceres;
128 TRACE_EVENT(nfs4_cb_sequence,
130 const struct cb_sequenceargs *args,
131 const struct cb_sequenceres *res,
134 TP_ARGS(args, res, status),
137 __field(unsigned int, session)
138 __field(unsigned int, slot_nr)
139 __field(unsigned int, seq_nr)
140 __field(unsigned int, highest_slotid)
141 __field(unsigned int, cachethis)
142 __field(unsigned long, error)
146 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
147 __entry->slot_nr = args->csa_slotid;
148 __entry->seq_nr = args->csa_sequenceid;
149 __entry->highest_slotid = args->csa_highestslotid;
150 __entry->cachethis = args->csa_cachethis;
151 __entry->error = be32_to_cpu(status);
155 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
158 show_nfs4_status(__entry->error),
162 __entry->highest_slotid
166 TRACE_EVENT(nfs4_cb_seqid_err,
168 const struct cb_sequenceargs *args,
171 TP_ARGS(args, status),
174 __field(unsigned int, session)
175 __field(unsigned int, slot_nr)
176 __field(unsigned int, seq_nr)
177 __field(unsigned int, highest_slotid)
178 __field(unsigned int, cachethis)
179 __field(unsigned long, error)
183 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
184 __entry->slot_nr = args->csa_slotid;
185 __entry->seq_nr = args->csa_sequenceid;
186 __entry->highest_slotid = args->csa_highestslotid;
187 __entry->cachethis = args->csa_cachethis;
188 __entry->error = be32_to_cpu(status);
192 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
195 show_nfs4_status(__entry->error),
199 __entry->highest_slotid
203 TRACE_EVENT(nfs4_cb_offload,
205 const struct nfs_fh *cb_fh,
206 const nfs4_stateid *cb_stateid,
212 TP_ARGS(cb_fh, cb_stateid, cb_count, cb_error,
216 __field(unsigned long, error)
217 __field(u32, fhandle)
218 __field(loff_t, cb_count)
220 __field(int, cb_stateid_seq)
221 __field(u32, cb_stateid_hash)
225 __entry->error = cb_error < 0 ? -cb_error : 0;
226 __entry->fhandle = nfs_fhandle_hash(cb_fh);
227 __entry->cb_stateid_seq =
228 be32_to_cpu(cb_stateid->seqid);
229 __entry->cb_stateid_hash =
230 nfs_stateid_hash(cb_stateid);
231 __entry->cb_count = cb_count;
232 __entry->cb_how = cb_how_stable;
236 "error=%ld (%s) fhandle=0x%08x cb_stateid=%d:0x%08x "
237 "cb_count=%llu cb_how=%s",
239 show_nfs4_status(__entry->error),
241 __entry->cb_stateid_seq, __entry->cb_stateid_hash,
243 show_nfs_stable_how(__entry->cb_how)
246 #endif /* CONFIG_NFS_V4_1 */
248 TRACE_EVENT(nfs4_setup_sequence,
250 const struct nfs4_session *session,
251 const struct nfs4_sequence_args *args
253 TP_ARGS(session, args),
256 __field(unsigned int, session)
257 __field(unsigned int, slot_nr)
258 __field(unsigned int, seq_nr)
259 __field(unsigned int, highest_used_slotid)
263 const struct nfs4_slot *sa_slot = args->sa_slot;
264 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
265 __entry->slot_nr = sa_slot->slot_nr;
266 __entry->seq_nr = sa_slot->seq_nr;
267 __entry->highest_used_slotid =
268 sa_slot->table->highest_used_slotid;
271 "session=0x%08x slot_nr=%u seq_nr=%u "
272 "highest_used_slotid=%u",
276 __entry->highest_used_slotid
280 TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_RUNNING);
281 TRACE_DEFINE_ENUM(NFS4CLNT_CHECK_LEASE);
282 TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_EXPIRED);
283 TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_REBOOT);
284 TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_NOGRACE);
285 TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN);
286 TRACE_DEFINE_ENUM(NFS4CLNT_SESSION_RESET);
287 TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_CONFIRM);
288 TRACE_DEFINE_ENUM(NFS4CLNT_SERVER_SCOPE_MISMATCH);
289 TRACE_DEFINE_ENUM(NFS4CLNT_PURGE_STATE);
290 TRACE_DEFINE_ENUM(NFS4CLNT_BIND_CONN_TO_SESSION);
291 TRACE_DEFINE_ENUM(NFS4CLNT_MOVED);
292 TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_MOVED);
293 TRACE_DEFINE_ENUM(NFS4CLNT_DELEGATION_EXPIRED);
294 TRACE_DEFINE_ENUM(NFS4CLNT_RUN_MANAGER);
295 TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_AVAILABLE);
296 TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_RUNNING);
297 TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_READ);
298 TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_RW);
299 TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN_DELAYED);
301 #define show_nfs4_clp_state(state) \
302 __print_flags(state, "|", \
303 { BIT(NFS4CLNT_MANAGER_RUNNING), "MANAGER_RUNNING" }, \
304 { BIT(NFS4CLNT_CHECK_LEASE), "CHECK_LEASE" }, \
305 { BIT(NFS4CLNT_LEASE_EXPIRED), "LEASE_EXPIRED" }, \
306 { BIT(NFS4CLNT_RECLAIM_REBOOT), "RECLAIM_REBOOT" }, \
307 { BIT(NFS4CLNT_RECLAIM_NOGRACE), "RECLAIM_NOGRACE" }, \
308 { BIT(NFS4CLNT_DELEGRETURN), "DELEGRETURN" }, \
309 { BIT(NFS4CLNT_SESSION_RESET), "SESSION_RESET" }, \
310 { BIT(NFS4CLNT_LEASE_CONFIRM), "LEASE_CONFIRM" }, \
311 { BIT(NFS4CLNT_SERVER_SCOPE_MISMATCH), "SERVER_SCOPE_MISMATCH" }, \
312 { BIT(NFS4CLNT_PURGE_STATE), "PURGE_STATE" }, \
313 { BIT(NFS4CLNT_BIND_CONN_TO_SESSION), "BIND_CONN_TO_SESSION" }, \
314 { BIT(NFS4CLNT_MOVED), "MOVED" }, \
315 { BIT(NFS4CLNT_LEASE_MOVED), "LEASE_MOVED" }, \
316 { BIT(NFS4CLNT_DELEGATION_EXPIRED), "DELEGATION_EXPIRED" }, \
317 { BIT(NFS4CLNT_RUN_MANAGER), "RUN_MANAGER" }, \
318 { BIT(NFS4CLNT_MANAGER_AVAILABLE), "MANAGER_AVAILABLE" }, \
319 { BIT(NFS4CLNT_RECALL_RUNNING), "RECALL_RUNNING" }, \
320 { BIT(NFS4CLNT_RECALL_ANY_LAYOUT_READ), "RECALL_ANY_LAYOUT_READ" }, \
321 { BIT(NFS4CLNT_RECALL_ANY_LAYOUT_RW), "RECALL_ANY_LAYOUT_RW" }, \
322 { BIT(NFS4CLNT_DELEGRETURN_DELAYED), "DELERETURN_DELAYED" })
324 TRACE_EVENT(nfs4_state_mgr,
326 const struct nfs_client *clp
332 __field(unsigned long, state)
333 __string(hostname, clp->cl_hostname)
337 __entry->state = clp->cl_state;
338 __assign_str(hostname, clp->cl_hostname);
342 "hostname=%s clp state=%s", __get_str(hostname),
343 show_nfs4_clp_state(__entry->state)
347 TRACE_EVENT(nfs4_state_mgr_failed,
349 const struct nfs_client *clp,
354 TP_ARGS(clp, section, status),
357 __field(unsigned long, error)
358 __field(unsigned long, state)
359 __string(hostname, clp->cl_hostname)
360 __string(section, section)
364 __entry->error = status < 0 ? -status : 0;
365 __entry->state = clp->cl_state;
366 __assign_str(hostname, clp->cl_hostname);
367 __assign_str(section, section);
371 "hostname=%s clp state=%s error=%ld (%s) section=%s",
373 show_nfs4_clp_state(__entry->state), -__entry->error,
374 show_nfs4_status(__entry->error), __get_str(section)
379 TRACE_EVENT(nfs4_xdr_bad_operation,
381 const struct xdr_stream *xdr,
386 TP_ARGS(xdr, op, expected),
389 __field(unsigned int, task_id)
390 __field(unsigned int, client_id)
393 __field(u32, expected)
397 const struct rpc_rqst *rqstp = xdr->rqst;
398 const struct rpc_task *task = rqstp->rq_task;
400 __entry->task_id = task->tk_pid;
401 __entry->client_id = task->tk_client->cl_clid;
402 __entry->xid = be32_to_cpu(rqstp->rq_xid);
404 __entry->expected = expected;
407 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
408 " xid=0x%08x operation=%u, expected=%u",
409 __entry->task_id, __entry->client_id, __entry->xid,
410 __entry->op, __entry->expected
414 DECLARE_EVENT_CLASS(nfs4_xdr_event,
416 const struct xdr_stream *xdr,
421 TP_ARGS(xdr, op, error),
424 __field(unsigned int, task_id)
425 __field(unsigned int, client_id)
428 __field(unsigned long, error)
432 const struct rpc_rqst *rqstp = xdr->rqst;
433 const struct rpc_task *task = rqstp->rq_task;
435 __entry->task_id = task->tk_pid;
436 __entry->client_id = task->tk_client->cl_clid;
437 __entry->xid = be32_to_cpu(rqstp->rq_xid);
439 __entry->error = error;
442 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
443 " xid=0x%08x error=%ld (%s) operation=%u",
444 __entry->task_id, __entry->client_id, __entry->xid,
445 -__entry->error, show_nfs4_status(__entry->error),
449 #define DEFINE_NFS4_XDR_EVENT(name) \
450 DEFINE_EVENT(nfs4_xdr_event, name, \
452 const struct xdr_stream *xdr, \
456 TP_ARGS(xdr, op, error))
457 DEFINE_NFS4_XDR_EVENT(nfs4_xdr_status);
458 DEFINE_NFS4_XDR_EVENT(nfs4_xdr_bad_filehandle);
460 DECLARE_EVENT_CLASS(nfs4_cb_error_class,
466 TP_ARGS(xid, cb_ident),
470 __field(u32, cbident)
474 __entry->xid = be32_to_cpu(xid);
475 __entry->cbident = cb_ident;
479 "xid=0x%08x cb_ident=0x%08x",
480 __entry->xid, __entry->cbident
484 #define DEFINE_CB_ERROR_EVENT(name) \
485 DEFINE_EVENT(nfs4_cb_error_class, nfs_cb_##name, \
490 TP_ARGS(xid, cb_ident))
492 DEFINE_CB_ERROR_EVENT(no_clp);
493 DEFINE_CB_ERROR_EVENT(badprinc);
495 DECLARE_EVENT_CLASS(nfs4_open_event,
497 const struct nfs_open_context *ctx,
502 TP_ARGS(ctx, flags, error),
505 __field(unsigned long, error)
506 __field(unsigned long, flags)
507 __field(unsigned long, fmode)
509 __field(u32, fhandle)
512 __string(name, ctx->dentry->d_name.name)
513 __field(int, stateid_seq)
514 __field(u32, stateid_hash)
515 __field(int, openstateid_seq)
516 __field(u32, openstateid_hash)
520 const struct nfs4_state *state = ctx->state;
521 const struct inode *inode = NULL;
523 __entry->error = -error;
524 __entry->flags = flags;
525 __entry->fmode = (__force unsigned long)ctx->mode;
526 __entry->dev = ctx->dentry->d_sb->s_dev;
527 if (!IS_ERR_OR_NULL(state)) {
528 inode = state->inode;
529 __entry->stateid_seq =
530 be32_to_cpu(state->stateid.seqid);
531 __entry->stateid_hash =
532 nfs_stateid_hash(&state->stateid);
533 __entry->openstateid_seq =
534 be32_to_cpu(state->open_stateid.seqid);
535 __entry->openstateid_hash =
536 nfs_stateid_hash(&state->open_stateid);
538 __entry->stateid_seq = 0;
539 __entry->stateid_hash = 0;
540 __entry->openstateid_seq = 0;
541 __entry->openstateid_hash = 0;
544 __entry->fileid = NFS_FILEID(inode);
545 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
548 __entry->fhandle = 0;
550 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
551 __assign_str(name, ctx->dentry->d_name.name);
555 "error=%ld (%s) flags=%lu (%s) fmode=%s "
556 "fileid=%02x:%02x:%llu fhandle=0x%08x "
557 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
558 "openstateid=%d:0x%08x",
560 show_nfs4_status(__entry->error),
562 show_fs_fcntl_open_flags(__entry->flags),
563 show_fs_fmode_flags(__entry->fmode),
564 MAJOR(__entry->dev), MINOR(__entry->dev),
565 (unsigned long long)__entry->fileid,
567 MAJOR(__entry->dev), MINOR(__entry->dev),
568 (unsigned long long)__entry->dir,
570 __entry->stateid_seq, __entry->stateid_hash,
571 __entry->openstateid_seq, __entry->openstateid_hash
575 #define DEFINE_NFS4_OPEN_EVENT(name) \
576 DEFINE_EVENT(nfs4_open_event, name, \
578 const struct nfs_open_context *ctx, \
582 TP_ARGS(ctx, flags, error))
583 DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
584 DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
585 DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
587 TRACE_EVENT(nfs4_cached_open,
589 const struct nfs4_state *state
594 __field(u32, fhandle)
596 __field(unsigned int, fmode)
597 __field(int, stateid_seq)
598 __field(u32, stateid_hash)
602 const struct inode *inode = state->inode;
604 __entry->dev = inode->i_sb->s_dev;
605 __entry->fileid = NFS_FILEID(inode);
606 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
607 __entry->fmode = (__force unsigned int)state->state;
608 __entry->stateid_seq =
609 be32_to_cpu(state->stateid.seqid);
610 __entry->stateid_hash =
611 nfs_stateid_hash(&state->stateid);
615 "fmode=%s fileid=%02x:%02x:%llu "
616 "fhandle=0x%08x stateid=%d:0x%08x",
617 __entry->fmode ? show_fs_fmode_flags(__entry->fmode) :
619 MAJOR(__entry->dev), MINOR(__entry->dev),
620 (unsigned long long)__entry->fileid,
622 __entry->stateid_seq, __entry->stateid_hash
626 TRACE_EVENT(nfs4_close,
628 const struct nfs4_state *state,
629 const struct nfs_closeargs *args,
630 const struct nfs_closeres *res,
634 TP_ARGS(state, args, res, error),
638 __field(u32, fhandle)
640 __field(unsigned int, fmode)
641 __field(unsigned long, error)
642 __field(int, stateid_seq)
643 __field(u32, stateid_hash)
647 const struct inode *inode = state->inode;
649 __entry->dev = inode->i_sb->s_dev;
650 __entry->fileid = NFS_FILEID(inode);
651 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
652 __entry->fmode = (__force unsigned int)state->state;
653 __entry->error = error < 0 ? -error : 0;
654 __entry->stateid_seq =
655 be32_to_cpu(args->stateid.seqid);
656 __entry->stateid_hash =
657 nfs_stateid_hash(&args->stateid);
661 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu "
662 "fhandle=0x%08x openstateid=%d:0x%08x",
664 show_nfs4_status(__entry->error),
665 __entry->fmode ? show_fs_fmode_flags(__entry->fmode) :
667 MAJOR(__entry->dev), MINOR(__entry->dev),
668 (unsigned long long)__entry->fileid,
670 __entry->stateid_seq, __entry->stateid_hash
674 DECLARE_EVENT_CLASS(nfs4_lock_event,
676 const struct file_lock *request,
677 const struct nfs4_state *state,
682 TP_ARGS(request, state, cmd, error),
685 __field(unsigned long, error)
686 __field(unsigned long, cmd)
687 __field(unsigned long, type)
688 __field(loff_t, start)
691 __field(u32, fhandle)
693 __field(int, stateid_seq)
694 __field(u32, stateid_hash)
698 const struct inode *inode = state->inode;
700 __entry->error = error < 0 ? -error : 0;
702 __entry->type = request->fl_type;
703 __entry->start = request->fl_start;
704 __entry->end = request->fl_end;
705 __entry->dev = inode->i_sb->s_dev;
706 __entry->fileid = NFS_FILEID(inode);
707 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
708 __entry->stateid_seq =
709 be32_to_cpu(state->stateid.seqid);
710 __entry->stateid_hash =
711 nfs_stateid_hash(&state->stateid);
715 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
716 "fileid=%02x:%02x:%llu fhandle=0x%08x "
719 show_nfs4_status(__entry->error),
720 show_fs_fcntl_cmd(__entry->cmd),
721 show_fs_fcntl_lock_type(__entry->type),
722 (long long)__entry->start,
723 (long long)__entry->end,
724 MAJOR(__entry->dev), MINOR(__entry->dev),
725 (unsigned long long)__entry->fileid,
727 __entry->stateid_seq, __entry->stateid_hash
731 #define DEFINE_NFS4_LOCK_EVENT(name) \
732 DEFINE_EVENT(nfs4_lock_event, name, \
734 const struct file_lock *request, \
735 const struct nfs4_state *state, \
739 TP_ARGS(request, state, cmd, error))
740 DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
741 DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
743 TRACE_EVENT(nfs4_set_lock,
745 const struct file_lock *request,
746 const struct nfs4_state *state,
747 const nfs4_stateid *lockstateid,
752 TP_ARGS(request, state, lockstateid, cmd, error),
755 __field(unsigned long, error)
756 __field(unsigned long, cmd)
757 __field(unsigned long, type)
758 __field(loff_t, start)
761 __field(u32, fhandle)
763 __field(int, stateid_seq)
764 __field(u32, stateid_hash)
765 __field(int, lockstateid_seq)
766 __field(u32, lockstateid_hash)
770 const struct inode *inode = state->inode;
772 __entry->error = error < 0 ? -error : 0;
774 __entry->type = request->fl_type;
775 __entry->start = request->fl_start;
776 __entry->end = request->fl_end;
777 __entry->dev = inode->i_sb->s_dev;
778 __entry->fileid = NFS_FILEID(inode);
779 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
780 __entry->stateid_seq =
781 be32_to_cpu(state->stateid.seqid);
782 __entry->stateid_hash =
783 nfs_stateid_hash(&state->stateid);
784 __entry->lockstateid_seq =
785 be32_to_cpu(lockstateid->seqid);
786 __entry->lockstateid_hash =
787 nfs_stateid_hash(lockstateid);
791 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
792 "fileid=%02x:%02x:%llu fhandle=0x%08x "
793 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
795 show_nfs4_status(__entry->error),
796 show_fs_fcntl_cmd(__entry->cmd),
797 show_fs_fcntl_lock_type(__entry->type),
798 (long long)__entry->start,
799 (long long)__entry->end,
800 MAJOR(__entry->dev), MINOR(__entry->dev),
801 (unsigned long long)__entry->fileid,
803 __entry->stateid_seq, __entry->stateid_hash,
804 __entry->lockstateid_seq, __entry->lockstateid_hash
808 TRACE_DEFINE_ENUM(LK_STATE_IN_USE);
809 TRACE_DEFINE_ENUM(NFS_DELEGATED_STATE);
810 TRACE_DEFINE_ENUM(NFS_OPEN_STATE);
811 TRACE_DEFINE_ENUM(NFS_O_RDONLY_STATE);
812 TRACE_DEFINE_ENUM(NFS_O_WRONLY_STATE);
813 TRACE_DEFINE_ENUM(NFS_O_RDWR_STATE);
814 TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_REBOOT);
815 TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_NOGRACE);
816 TRACE_DEFINE_ENUM(NFS_STATE_POSIX_LOCKS);
817 TRACE_DEFINE_ENUM(NFS_STATE_RECOVERY_FAILED);
818 TRACE_DEFINE_ENUM(NFS_STATE_MAY_NOTIFY_LOCK);
819 TRACE_DEFINE_ENUM(NFS_STATE_CHANGE_WAIT);
820 TRACE_DEFINE_ENUM(NFS_CLNT_DST_SSC_COPY_STATE);
821 TRACE_DEFINE_ENUM(NFS_CLNT_SRC_SSC_COPY_STATE);
822 TRACE_DEFINE_ENUM(NFS_SRV_SSC_COPY_STATE);
824 #define show_nfs4_state_flags(flags) \
825 __print_flags(flags, "|", \
826 { LK_STATE_IN_USE, "IN_USE" }, \
827 { NFS_DELEGATED_STATE, "DELEGATED" }, \
828 { NFS_OPEN_STATE, "OPEN" }, \
829 { NFS_O_RDONLY_STATE, "O_RDONLY" }, \
830 { NFS_O_WRONLY_STATE, "O_WRONLY" }, \
831 { NFS_O_RDWR_STATE, "O_RDWR" }, \
832 { NFS_STATE_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
833 { NFS_STATE_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
834 { NFS_STATE_POSIX_LOCKS, "POSIX_LOCKS" }, \
835 { NFS_STATE_RECOVERY_FAILED, "RECOVERY_FAILED" }, \
836 { NFS_STATE_MAY_NOTIFY_LOCK, "MAY_NOTIFY_LOCK" }, \
837 { NFS_STATE_CHANGE_WAIT, "CHANGE_WAIT" }, \
838 { NFS_CLNT_DST_SSC_COPY_STATE, "CLNT_DST_SSC_COPY" }, \
839 { NFS_CLNT_SRC_SSC_COPY_STATE, "CLNT_SRC_SSC_COPY" }, \
840 { NFS_SRV_SSC_COPY_STATE, "SRV_SSC_COPY" })
842 #define show_nfs4_lock_flags(flags) \
843 __print_flags(flags, "|", \
844 { BIT(NFS_LOCK_INITIALIZED), "INITIALIZED" }, \
845 { BIT(NFS_LOCK_LOST), "LOST" })
847 TRACE_EVENT(nfs4_state_lock_reclaim,
849 const struct nfs4_state *state,
850 const struct nfs4_lock_state *lock
853 TP_ARGS(state, lock),
857 __field(u32, fhandle)
859 __field(unsigned long, state_flags)
860 __field(unsigned long, lock_flags)
861 __field(int, stateid_seq)
862 __field(u32, stateid_hash)
866 const struct inode *inode = state->inode;
868 __entry->dev = inode->i_sb->s_dev;
869 __entry->fileid = NFS_FILEID(inode);
870 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
871 __entry->state_flags = state->flags;
872 __entry->lock_flags = lock->ls_flags;
873 __entry->stateid_seq =
874 be32_to_cpu(state->stateid.seqid);
875 __entry->stateid_hash =
876 nfs_stateid_hash(&state->stateid);
880 "fileid=%02x:%02x:%llu fhandle=0x%08x "
881 "stateid=%d:0x%08x state_flags=%s lock_flags=%s",
882 MAJOR(__entry->dev), MINOR(__entry->dev),
883 (unsigned long long)__entry->fileid, __entry->fhandle,
884 __entry->stateid_seq, __entry->stateid_hash,
885 show_nfs4_state_flags(__entry->state_flags),
886 show_nfs4_lock_flags(__entry->lock_flags)
890 DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
892 const struct inode *inode,
896 TP_ARGS(inode, fmode),
900 __field(u32, fhandle)
902 __field(unsigned int, fmode)
906 __entry->dev = inode->i_sb->s_dev;
907 __entry->fileid = NFS_FILEID(inode);
908 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
909 __entry->fmode = (__force unsigned int)fmode;
913 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
914 show_fs_fmode_flags(__entry->fmode),
915 MAJOR(__entry->dev), MINOR(__entry->dev),
916 (unsigned long long)__entry->fileid,
920 #define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
921 DEFINE_EVENT(nfs4_set_delegation_event, name, \
923 const struct inode *inode, \
926 TP_ARGS(inode, fmode))
927 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
928 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
930 TRACE_EVENT(nfs4_delegreturn_exit,
932 const struct nfs4_delegreturnargs *args,
933 const struct nfs4_delegreturnres *res,
937 TP_ARGS(args, res, error),
941 __field(u32, fhandle)
942 __field(unsigned long, error)
943 __field(int, stateid_seq)
944 __field(u32, stateid_hash)
948 __entry->dev = res->server->s_dev;
949 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
950 __entry->error = error < 0 ? -error : 0;
951 __entry->stateid_seq =
952 be32_to_cpu(args->stateid->seqid);
953 __entry->stateid_hash =
954 nfs_stateid_hash(args->stateid);
958 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x "
961 show_nfs4_status(__entry->error),
962 MAJOR(__entry->dev), MINOR(__entry->dev),
964 __entry->stateid_seq, __entry->stateid_hash
968 #ifdef CONFIG_NFS_V4_1
969 DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
971 const struct nfs4_state *state,
972 const struct nfs4_lock_state *lsp,
976 TP_ARGS(state, lsp, error),
979 __field(unsigned long, error)
981 __field(u32, fhandle)
983 __field(int, stateid_seq)
984 __field(u32, stateid_hash)
988 const struct inode *inode = state->inode;
990 __entry->error = error < 0 ? -error : 0;
991 __entry->dev = inode->i_sb->s_dev;
992 __entry->fileid = NFS_FILEID(inode);
993 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
994 __entry->stateid_seq =
995 be32_to_cpu(state->stateid.seqid);
996 __entry->stateid_hash =
997 nfs_stateid_hash(&state->stateid);
1001 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1002 "stateid=%d:0x%08x",
1004 show_nfs4_status(__entry->error),
1005 MAJOR(__entry->dev), MINOR(__entry->dev),
1006 (unsigned long long)__entry->fileid,
1008 __entry->stateid_seq, __entry->stateid_hash
1012 #define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
1013 DEFINE_EVENT(nfs4_test_stateid_event, name, \
1015 const struct nfs4_state *state, \
1016 const struct nfs4_lock_state *lsp, \
1019 TP_ARGS(state, lsp, error))
1020 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
1021 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
1022 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
1023 #endif /* CONFIG_NFS_V4_1 */
1025 DECLARE_EVENT_CLASS(nfs4_lookup_event,
1027 const struct inode *dir,
1028 const struct qstr *name,
1032 TP_ARGS(dir, name, error),
1036 __field(unsigned long, error)
1038 __string(name, name->name)
1042 __entry->dev = dir->i_sb->s_dev;
1043 __entry->dir = NFS_FILEID(dir);
1044 __entry->error = -error;
1045 __assign_str(name, name->name);
1049 "error=%ld (%s) name=%02x:%02x:%llu/%s",
1051 show_nfs4_status(__entry->error),
1052 MAJOR(__entry->dev), MINOR(__entry->dev),
1053 (unsigned long long)__entry->dir,
1058 #define DEFINE_NFS4_LOOKUP_EVENT(name) \
1059 DEFINE_EVENT(nfs4_lookup_event, name, \
1061 const struct inode *dir, \
1062 const struct qstr *name, \
1065 TP_ARGS(dir, name, error))
1067 DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
1068 DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
1069 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
1070 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
1071 DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
1072 DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
1073 DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
1075 TRACE_EVENT(nfs4_lookupp,
1077 const struct inode *inode,
1081 TP_ARGS(inode, error),
1086 __field(unsigned long, error)
1090 __entry->dev = inode->i_sb->s_dev;
1091 __entry->ino = NFS_FILEID(inode);
1092 __entry->error = error < 0 ? -error : 0;
1096 "error=%ld (%s) inode=%02x:%02x:%llu",
1098 show_nfs4_status(__entry->error),
1099 MAJOR(__entry->dev), MINOR(__entry->dev),
1100 (unsigned long long)__entry->ino
1104 TRACE_EVENT(nfs4_rename,
1106 const struct inode *olddir,
1107 const struct qstr *oldname,
1108 const struct inode *newdir,
1109 const struct qstr *newname,
1113 TP_ARGS(olddir, oldname, newdir, newname, error),
1117 __field(unsigned long, error)
1118 __field(u64, olddir)
1119 __string(oldname, oldname->name)
1120 __field(u64, newdir)
1121 __string(newname, newname->name)
1125 __entry->dev = olddir->i_sb->s_dev;
1126 __entry->olddir = NFS_FILEID(olddir);
1127 __entry->newdir = NFS_FILEID(newdir);
1128 __entry->error = error < 0 ? -error : 0;
1129 __assign_str(oldname, oldname->name);
1130 __assign_str(newname, newname->name);
1134 "error=%ld (%s) oldname=%02x:%02x:%llu/%s "
1135 "newname=%02x:%02x:%llu/%s",
1137 show_nfs4_status(__entry->error),
1138 MAJOR(__entry->dev), MINOR(__entry->dev),
1139 (unsigned long long)__entry->olddir,
1141 MAJOR(__entry->dev), MINOR(__entry->dev),
1142 (unsigned long long)__entry->newdir,
1147 DECLARE_EVENT_CLASS(nfs4_inode_event,
1149 const struct inode *inode,
1153 TP_ARGS(inode, error),
1157 __field(u32, fhandle)
1158 __field(u64, fileid)
1159 __field(unsigned long, error)
1163 __entry->dev = inode->i_sb->s_dev;
1164 __entry->fileid = NFS_FILEID(inode);
1165 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1166 __entry->error = error < 0 ? -error : 0;
1170 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
1172 show_nfs4_status(__entry->error),
1173 MAJOR(__entry->dev), MINOR(__entry->dev),
1174 (unsigned long long)__entry->fileid,
1179 #define DEFINE_NFS4_INODE_EVENT(name) \
1180 DEFINE_EVENT(nfs4_inode_event, name, \
1182 const struct inode *inode, \
1185 TP_ARGS(inode, error))
1187 DEFINE_NFS4_INODE_EVENT(nfs4_access);
1188 DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
1189 DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
1190 DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
1191 DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
1192 #ifdef CONFIG_NFS_V4_SECURITY_LABEL
1193 DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
1194 DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
1195 #endif /* CONFIG_NFS_V4_SECURITY_LABEL */
1197 DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
1199 const struct inode *inode,
1200 const nfs4_stateid *stateid,
1204 TP_ARGS(inode, stateid, error),
1208 __field(u32, fhandle)
1209 __field(u64, fileid)
1210 __field(unsigned long, error)
1211 __field(int, stateid_seq)
1212 __field(u32, stateid_hash)
1216 __entry->dev = inode->i_sb->s_dev;
1217 __entry->fileid = NFS_FILEID(inode);
1218 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1219 __entry->error = error < 0 ? -error : 0;
1220 __entry->stateid_seq =
1221 be32_to_cpu(stateid->seqid);
1222 __entry->stateid_hash =
1223 nfs_stateid_hash(stateid);
1227 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1228 "stateid=%d:0x%08x",
1230 show_nfs4_status(__entry->error),
1231 MAJOR(__entry->dev), MINOR(__entry->dev),
1232 (unsigned long long)__entry->fileid,
1234 __entry->stateid_seq, __entry->stateid_hash
1238 #define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1239 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1241 const struct inode *inode, \
1242 const nfs4_stateid *stateid, \
1245 TP_ARGS(inode, stateid, error))
1247 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1248 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
1249 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
1250 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
1251 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_close_stateid_update_wait);
1253 DECLARE_EVENT_CLASS(nfs4_getattr_event,
1255 const struct nfs_server *server,
1256 const struct nfs_fh *fhandle,
1257 const struct nfs_fattr *fattr,
1261 TP_ARGS(server, fhandle, fattr, error),
1265 __field(u32, fhandle)
1266 __field(u64, fileid)
1267 __field(unsigned int, valid)
1268 __field(unsigned long, error)
1272 __entry->dev = server->s_dev;
1273 __entry->valid = fattr->valid;
1274 __entry->fhandle = nfs_fhandle_hash(fhandle);
1275 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
1276 __entry->error = error < 0 ? -error : 0;
1280 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1283 show_nfs4_status(__entry->error),
1284 MAJOR(__entry->dev), MINOR(__entry->dev),
1285 (unsigned long long)__entry->fileid,
1287 show_nfs_fattr_flags(__entry->valid)
1291 #define DEFINE_NFS4_GETATTR_EVENT(name) \
1292 DEFINE_EVENT(nfs4_getattr_event, name, \
1294 const struct nfs_server *server, \
1295 const struct nfs_fh *fhandle, \
1296 const struct nfs_fattr *fattr, \
1299 TP_ARGS(server, fhandle, fattr, error))
1300 DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1301 DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1302 DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1304 DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1306 const struct nfs_client *clp,
1307 const struct nfs_fh *fhandle,
1308 const struct inode *inode,
1312 TP_ARGS(clp, fhandle, inode, error),
1315 __field(unsigned long, error)
1317 __field(u32, fhandle)
1318 __field(u64, fileid)
1319 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
1323 __entry->error = error < 0 ? -error : 0;
1324 __entry->fhandle = nfs_fhandle_hash(fhandle);
1325 if (!IS_ERR_OR_NULL(inode)) {
1326 __entry->fileid = NFS_FILEID(inode);
1327 __entry->dev = inode->i_sb->s_dev;
1329 __entry->fileid = 0;
1332 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown");
1336 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1339 show_nfs4_status(__entry->error),
1340 MAJOR(__entry->dev), MINOR(__entry->dev),
1341 (unsigned long long)__entry->fileid,
1347 #define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1348 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1350 const struct nfs_client *clp, \
1351 const struct nfs_fh *fhandle, \
1352 const struct inode *inode, \
1355 TP_ARGS(clp, fhandle, inode, error))
1356 DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1358 DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1360 const struct nfs_client *clp,
1361 const struct nfs_fh *fhandle,
1362 const struct inode *inode,
1363 const nfs4_stateid *stateid,
1367 TP_ARGS(clp, fhandle, inode, stateid, error),
1370 __field(unsigned long, error)
1372 __field(u32, fhandle)
1373 __field(u64, fileid)
1374 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
1375 __field(int, stateid_seq)
1376 __field(u32, stateid_hash)
1380 __entry->error = error < 0 ? -error : 0;
1381 __entry->fhandle = nfs_fhandle_hash(fhandle);
1382 if (!IS_ERR_OR_NULL(inode)) {
1383 __entry->fileid = NFS_FILEID(inode);
1384 __entry->dev = inode->i_sb->s_dev;
1386 __entry->fileid = 0;
1389 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown");
1390 __entry->stateid_seq =
1391 be32_to_cpu(stateid->seqid);
1392 __entry->stateid_hash =
1393 nfs_stateid_hash(stateid);
1397 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1398 "stateid=%d:0x%08x dstaddr=%s",
1400 show_nfs4_status(__entry->error),
1401 MAJOR(__entry->dev), MINOR(__entry->dev),
1402 (unsigned long long)__entry->fileid,
1404 __entry->stateid_seq, __entry->stateid_hash,
1409 #define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1410 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1412 const struct nfs_client *clp, \
1413 const struct nfs_fh *fhandle, \
1414 const struct inode *inode, \
1415 const nfs4_stateid *stateid, \
1418 TP_ARGS(clp, fhandle, inode, stateid, error))
1419 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1420 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
1422 DECLARE_EVENT_CLASS(nfs4_idmap_event,
1430 TP_ARGS(name, len, id, error),
1433 __field(unsigned long, error)
1435 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1441 __entry->error = error < 0 ? error : 0;
1443 memcpy(__get_str(name), name, len);
1444 __get_str(name)[len] = 0;
1448 "error=%ld (%s) id=%u name=%s",
1449 -__entry->error, show_nfs4_status(__entry->error),
1454 #define DEFINE_NFS4_IDMAP_EVENT(name) \
1455 DEFINE_EVENT(nfs4_idmap_event, name, \
1462 TP_ARGS(name, len, id, error))
1463 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1464 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1465 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1466 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1468 #ifdef CONFIG_NFS_V4_1
1469 #define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) \
1470 (lseg ? nfs_stateid_hash(&lseg->pls_layout->plh_stateid) : 0)
1472 #define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) (0)
1475 DECLARE_EVENT_CLASS(nfs4_read_event,
1477 const struct nfs_pgio_header *hdr,
1481 TP_ARGS(hdr, error),
1485 __field(u32, fhandle)
1486 __field(u64, fileid)
1487 __field(loff_t, offset)
1488 __field(u32, arg_count)
1489 __field(u32, res_count)
1490 __field(unsigned long, error)
1491 __field(int, stateid_seq)
1492 __field(u32, stateid_hash)
1493 __field(int, layoutstateid_seq)
1494 __field(u32, layoutstateid_hash)
1498 const struct inode *inode = hdr->inode;
1499 const struct nfs_inode *nfsi = NFS_I(inode);
1500 const struct nfs_fh *fh = hdr->args.fh ?
1501 hdr->args.fh : &nfsi->fh;
1502 const struct nfs4_state *state =
1503 hdr->args.context->state;
1504 const struct pnfs_layout_segment *lseg = hdr->lseg;
1506 __entry->dev = inode->i_sb->s_dev;
1507 __entry->fileid = nfsi->fileid;
1508 __entry->fhandle = nfs_fhandle_hash(fh);
1509 __entry->offset = hdr->args.offset;
1510 __entry->arg_count = hdr->args.count;
1511 __entry->res_count = hdr->res.count;
1512 __entry->error = error < 0 ? -error : 0;
1513 __entry->stateid_seq =
1514 be32_to_cpu(state->stateid.seqid);
1515 __entry->stateid_hash =
1516 nfs_stateid_hash(&state->stateid);
1517 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1518 __entry->layoutstateid_hash =
1519 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
1523 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1524 "offset=%lld count=%u res=%u stateid=%d:0x%08x "
1525 "layoutstateid=%d:0x%08x",
1527 show_nfs4_status(__entry->error),
1528 MAJOR(__entry->dev), MINOR(__entry->dev),
1529 (unsigned long long)__entry->fileid,
1531 (long long)__entry->offset,
1532 __entry->arg_count, __entry->res_count,
1533 __entry->stateid_seq, __entry->stateid_hash,
1534 __entry->layoutstateid_seq, __entry->layoutstateid_hash
1537 #define DEFINE_NFS4_READ_EVENT(name) \
1538 DEFINE_EVENT(nfs4_read_event, name, \
1540 const struct nfs_pgio_header *hdr, \
1543 TP_ARGS(hdr, error))
1544 DEFINE_NFS4_READ_EVENT(nfs4_read);
1545 #ifdef CONFIG_NFS_V4_1
1546 DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1547 #endif /* CONFIG_NFS_V4_1 */
1549 DECLARE_EVENT_CLASS(nfs4_write_event,
1551 const struct nfs_pgio_header *hdr,
1555 TP_ARGS(hdr, error),
1559 __field(u32, fhandle)
1560 __field(u64, fileid)
1561 __field(loff_t, offset)
1562 __field(u32, arg_count)
1563 __field(u32, res_count)
1564 __field(unsigned long, error)
1565 __field(int, stateid_seq)
1566 __field(u32, stateid_hash)
1567 __field(int, layoutstateid_seq)
1568 __field(u32, layoutstateid_hash)
1572 const struct inode *inode = hdr->inode;
1573 const struct nfs_inode *nfsi = NFS_I(inode);
1574 const struct nfs_fh *fh = hdr->args.fh ?
1575 hdr->args.fh : &nfsi->fh;
1576 const struct nfs4_state *state =
1577 hdr->args.context->state;
1578 const struct pnfs_layout_segment *lseg = hdr->lseg;
1580 __entry->dev = inode->i_sb->s_dev;
1581 __entry->fileid = nfsi->fileid;
1582 __entry->fhandle = nfs_fhandle_hash(fh);
1583 __entry->offset = hdr->args.offset;
1584 __entry->arg_count = hdr->args.count;
1585 __entry->res_count = hdr->res.count;
1586 __entry->error = error < 0 ? -error : 0;
1587 __entry->stateid_seq =
1588 be32_to_cpu(state->stateid.seqid);
1589 __entry->stateid_hash =
1590 nfs_stateid_hash(&state->stateid);
1591 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1592 __entry->layoutstateid_hash =
1593 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
1597 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1598 "offset=%lld count=%u res=%u stateid=%d:0x%08x "
1599 "layoutstateid=%d:0x%08x",
1601 show_nfs4_status(__entry->error),
1602 MAJOR(__entry->dev), MINOR(__entry->dev),
1603 (unsigned long long)__entry->fileid,
1605 (long long)__entry->offset,
1606 __entry->arg_count, __entry->res_count,
1607 __entry->stateid_seq, __entry->stateid_hash,
1608 __entry->layoutstateid_seq, __entry->layoutstateid_hash
1612 #define DEFINE_NFS4_WRITE_EVENT(name) \
1613 DEFINE_EVENT(nfs4_write_event, name, \
1615 const struct nfs_pgio_header *hdr, \
1618 TP_ARGS(hdr, error))
1619 DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1620 #ifdef CONFIG_NFS_V4_1
1621 DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1622 #endif /* CONFIG_NFS_V4_1 */
1624 DECLARE_EVENT_CLASS(nfs4_commit_event,
1626 const struct nfs_commit_data *data,
1630 TP_ARGS(data, error),
1634 __field(u32, fhandle)
1635 __field(u64, fileid)
1636 __field(unsigned long, error)
1637 __field(loff_t, offset)
1639 __field(int, layoutstateid_seq)
1640 __field(u32, layoutstateid_hash)
1644 const struct inode *inode = data->inode;
1645 const struct nfs_inode *nfsi = NFS_I(inode);
1646 const struct nfs_fh *fh = data->args.fh ?
1647 data->args.fh : &nfsi->fh;
1648 const struct pnfs_layout_segment *lseg = data->lseg;
1650 __entry->dev = inode->i_sb->s_dev;
1651 __entry->fileid = nfsi->fileid;
1652 __entry->fhandle = nfs_fhandle_hash(fh);
1653 __entry->offset = data->args.offset;
1654 __entry->count = data->args.count;
1655 __entry->error = error < 0 ? -error : 0;
1656 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1657 __entry->layoutstateid_hash =
1658 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
1662 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1663 "offset=%lld count=%u layoutstateid=%d:0x%08x",
1665 show_nfs4_status(__entry->error),
1666 MAJOR(__entry->dev), MINOR(__entry->dev),
1667 (unsigned long long)__entry->fileid,
1669 (long long)__entry->offset,
1671 __entry->layoutstateid_seq, __entry->layoutstateid_hash
1674 #define DEFINE_NFS4_COMMIT_EVENT(name) \
1675 DEFINE_EVENT(nfs4_commit_event, name, \
1677 const struct nfs_commit_data *data, \
1680 TP_ARGS(data, error))
1681 DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1682 #ifdef CONFIG_NFS_V4_1
1683 DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
1685 TRACE_EVENT(nfs4_layoutget,
1687 const struct nfs_open_context *ctx,
1688 const struct pnfs_layout_range *args,
1689 const struct pnfs_layout_range *res,
1690 const nfs4_stateid *layout_stateid,
1694 TP_ARGS(ctx, args, res, layout_stateid, error),
1698 __field(u32, fhandle)
1699 __field(u64, fileid)
1700 __field(u32, iomode)
1701 __field(u64, offset)
1703 __field(unsigned long, error)
1704 __field(int, stateid_seq)
1705 __field(u32, stateid_hash)
1706 __field(int, layoutstateid_seq)
1707 __field(u32, layoutstateid_hash)
1711 const struct inode *inode = d_inode(ctx->dentry);
1712 const struct nfs4_state *state = ctx->state;
1713 __entry->dev = inode->i_sb->s_dev;
1714 __entry->fileid = NFS_FILEID(inode);
1715 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1716 __entry->iomode = args->iomode;
1717 __entry->offset = args->offset;
1718 __entry->count = args->length;
1719 __entry->error = error < 0 ? -error : 0;
1720 __entry->stateid_seq =
1721 be32_to_cpu(state->stateid.seqid);
1722 __entry->stateid_hash =
1723 nfs_stateid_hash(&state->stateid);
1725 __entry->layoutstateid_seq =
1726 be32_to_cpu(layout_stateid->seqid);
1727 __entry->layoutstateid_hash =
1728 nfs_stateid_hash(layout_stateid);
1730 __entry->layoutstateid_seq = 0;
1731 __entry->layoutstateid_hash = 0;
1736 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1737 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1738 "layoutstateid=%d:0x%08x",
1740 show_nfs4_status(__entry->error),
1741 MAJOR(__entry->dev), MINOR(__entry->dev),
1742 (unsigned long long)__entry->fileid,
1744 show_pnfs_layout_iomode(__entry->iomode),
1745 (unsigned long long)__entry->offset,
1746 (unsigned long long)__entry->count,
1747 __entry->stateid_seq, __entry->stateid_hash,
1748 __entry->layoutstateid_seq, __entry->layoutstateid_hash
1752 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1753 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
1754 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn_on_close);
1755 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layouterror);
1756 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutstats);
1758 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN);
1759 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS);
1760 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN);
1761 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH);
1762 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM);
1763 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL);
1764 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL);
1765 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED);
1766 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN);
1767 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED);
1768 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN);
1769 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY);
1770 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
1771 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_EXIT);
1773 #define show_pnfs_update_layout_reason(reason) \
1774 __print_symbolic(reason, \
1775 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
1776 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
1777 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
1778 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
1779 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
1780 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
1781 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
1782 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
1783 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
1784 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
1785 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
1786 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
1787 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }, \
1788 { PNFS_UPDATE_LAYOUT_EXIT, "exit" })
1790 TRACE_EVENT(pnfs_update_layout,
1791 TP_PROTO(struct inode *inode,
1794 enum pnfs_iomode iomode,
1795 struct pnfs_layout_hdr *lo,
1796 struct pnfs_layout_segment *lseg,
1797 enum pnfs_update_layout_reason reason
1799 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
1802 __field(u64, fileid)
1803 __field(u32, fhandle)
1804 __field(loff_t, pos)
1806 __field(enum pnfs_iomode, iomode)
1807 __field(int, layoutstateid_seq)
1808 __field(u32, layoutstateid_hash)
1810 __field(enum pnfs_update_layout_reason, reason)
1813 __entry->dev = inode->i_sb->s_dev;
1814 __entry->fileid = NFS_FILEID(inode);
1815 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1817 __entry->count = count;
1818 __entry->iomode = iomode;
1819 __entry->reason = reason;
1820 if (lo != NULL && pnfs_layout_is_valid(lo)) {
1821 __entry->layoutstateid_seq =
1822 be32_to_cpu(lo->plh_stateid.seqid);
1823 __entry->layoutstateid_hash =
1824 nfs_stateid_hash(&lo->plh_stateid);
1826 __entry->layoutstateid_seq = 0;
1827 __entry->layoutstateid_hash = 0;
1829 __entry->lseg = (long)lseg;
1832 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1833 "iomode=%s pos=%llu count=%llu "
1834 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
1835 MAJOR(__entry->dev), MINOR(__entry->dev),
1836 (unsigned long long)__entry->fileid,
1838 show_pnfs_layout_iomode(__entry->iomode),
1839 (unsigned long long)__entry->pos,
1840 (unsigned long long)__entry->count,
1841 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
1843 show_pnfs_update_layout_reason(__entry->reason)
1847 DECLARE_EVENT_CLASS(pnfs_layout_event,
1848 TP_PROTO(struct inode *inode,
1851 enum pnfs_iomode iomode,
1852 struct pnfs_layout_hdr *lo,
1853 struct pnfs_layout_segment *lseg
1855 TP_ARGS(inode, pos, count, iomode, lo, lseg),
1858 __field(u64, fileid)
1859 __field(u32, fhandle)
1860 __field(loff_t, pos)
1862 __field(enum pnfs_iomode, iomode)
1863 __field(int, layoutstateid_seq)
1864 __field(u32, layoutstateid_hash)
1868 __entry->dev = inode->i_sb->s_dev;
1869 __entry->fileid = NFS_FILEID(inode);
1870 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1872 __entry->count = count;
1873 __entry->iomode = iomode;
1874 if (lo != NULL && pnfs_layout_is_valid(lo)) {
1875 __entry->layoutstateid_seq =
1876 be32_to_cpu(lo->plh_stateid.seqid);
1877 __entry->layoutstateid_hash =
1878 nfs_stateid_hash(&lo->plh_stateid);
1880 __entry->layoutstateid_seq = 0;
1881 __entry->layoutstateid_hash = 0;
1883 __entry->lseg = (long)lseg;
1886 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1887 "iomode=%s pos=%llu count=%llu "
1888 "layoutstateid=%d:0x%08x lseg=0x%lx",
1889 MAJOR(__entry->dev), MINOR(__entry->dev),
1890 (unsigned long long)__entry->fileid,
1892 show_pnfs_layout_iomode(__entry->iomode),
1893 (unsigned long long)__entry->pos,
1894 (unsigned long long)__entry->count,
1895 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
1900 #define DEFINE_PNFS_LAYOUT_EVENT(name) \
1901 DEFINE_EVENT(pnfs_layout_event, name, \
1902 TP_PROTO(struct inode *inode, \
1905 enum pnfs_iomode iomode, \
1906 struct pnfs_layout_hdr *lo, \
1907 struct pnfs_layout_segment *lseg \
1909 TP_ARGS(inode, pos, count, iomode, lo, lseg))
1911 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_read);
1912 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_write);
1913 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_get_mirror_count);
1914 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_done);
1915 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done);
1916 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist);
1917 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist);
1919 DECLARE_EVENT_CLASS(nfs4_deviceid_event,
1921 const struct nfs_client *clp,
1922 const struct nfs4_deviceid *deviceid
1925 TP_ARGS(clp, deviceid),
1928 __string(dstaddr, clp->cl_hostname)
1929 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE)
1933 __assign_str(dstaddr, clp->cl_hostname);
1934 memcpy(__entry->deviceid, deviceid->data,
1935 NFS4_DEVICEID4_SIZE);
1939 "deviceid=%s, dstaddr=%s",
1940 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE),
1944 #define DEFINE_PNFS_DEVICEID_EVENT(name) \
1945 DEFINE_EVENT(nfs4_deviceid_event, name, \
1946 TP_PROTO(const struct nfs_client *clp, \
1947 const struct nfs4_deviceid *deviceid \
1949 TP_ARGS(clp, deviceid))
1950 DEFINE_PNFS_DEVICEID_EVENT(nfs4_deviceid_free);
1952 DECLARE_EVENT_CLASS(nfs4_deviceid_status,
1954 const struct nfs_server *server,
1955 const struct nfs4_deviceid *deviceid,
1959 TP_ARGS(server, deviceid, status),
1963 __field(int, status)
1964 __string(dstaddr, server->nfs_client->cl_hostname)
1965 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE)
1969 __entry->dev = server->s_dev;
1970 __entry->status = status;
1971 __assign_str(dstaddr, server->nfs_client->cl_hostname);
1972 memcpy(__entry->deviceid, deviceid->data,
1973 NFS4_DEVICEID4_SIZE);
1977 "dev=%02x:%02x: deviceid=%s, dstaddr=%s, status=%d",
1978 MAJOR(__entry->dev), MINOR(__entry->dev),
1979 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE),
1984 #define DEFINE_PNFS_DEVICEID_STATUS(name) \
1985 DEFINE_EVENT(nfs4_deviceid_status, name, \
1986 TP_PROTO(const struct nfs_server *server, \
1987 const struct nfs4_deviceid *deviceid, \
1990 TP_ARGS(server, deviceid, status))
1991 DEFINE_PNFS_DEVICEID_STATUS(nfs4_getdeviceinfo);
1992 DEFINE_PNFS_DEVICEID_STATUS(nfs4_find_deviceid);
1994 DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event,
1996 const struct nfs_pgio_header *hdr
2002 __field(unsigned long, error)
2004 __field(u32, fhandle)
2005 __field(u64, fileid)
2006 __field(loff_t, offset)
2008 __field(int, stateid_seq)
2009 __field(u32, stateid_hash)
2010 __string(dstaddr, hdr->ds_clp ?
2011 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
2012 RPC_DISPLAY_ADDR) : "unknown")
2016 const struct inode *inode = hdr->inode;
2018 __entry->error = hdr->res.op_status;
2019 __entry->fhandle = nfs_fhandle_hash(hdr->args.fh);
2020 __entry->fileid = NFS_FILEID(inode);
2021 __entry->dev = inode->i_sb->s_dev;
2022 __entry->offset = hdr->args.offset;
2023 __entry->count = hdr->args.count;
2024 __entry->stateid_seq =
2025 be32_to_cpu(hdr->args.stateid.seqid);
2026 __entry->stateid_hash =
2027 nfs_stateid_hash(&hdr->args.stateid);
2028 __assign_str(dstaddr, hdr->ds_clp ?
2029 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
2030 RPC_DISPLAY_ADDR) : "unknown");
2034 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2035 "offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s",
2037 show_nfs4_status(__entry->error),
2038 MAJOR(__entry->dev), MINOR(__entry->dev),
2039 (unsigned long long)__entry->fileid,
2041 __entry->offset, __entry->count,
2042 __entry->stateid_seq, __entry->stateid_hash,
2047 #define DEFINE_NFS4_FLEXFILES_IO_EVENT(name) \
2048 DEFINE_EVENT(nfs4_flexfiles_io_event, name, \
2050 const struct nfs_pgio_header *hdr \
2053 DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_read_error);
2054 DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_write_error);
2056 TRACE_EVENT(ff_layout_commit_error,
2058 const struct nfs_commit_data *data
2064 __field(unsigned long, error)
2066 __field(u32, fhandle)
2067 __field(u64, fileid)
2068 __field(loff_t, offset)
2070 __string(dstaddr, data->ds_clp ?
2071 rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
2072 RPC_DISPLAY_ADDR) : "unknown")
2076 const struct inode *inode = data->inode;
2078 __entry->error = data->res.op_status;
2079 __entry->fhandle = nfs_fhandle_hash(data->args.fh);
2080 __entry->fileid = NFS_FILEID(inode);
2081 __entry->dev = inode->i_sb->s_dev;
2082 __entry->offset = data->args.offset;
2083 __entry->count = data->args.count;
2084 __assign_str(dstaddr, data->ds_clp ?
2085 rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
2086 RPC_DISPLAY_ADDR) : "unknown");
2090 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2091 "offset=%llu count=%u dstaddr=%s",
2093 show_nfs4_status(__entry->error),
2094 MAJOR(__entry->dev), MINOR(__entry->dev),
2095 (unsigned long long)__entry->fileid,
2097 __entry->offset, __entry->count,
2102 #ifdef CONFIG_NFS_V4_2
2103 TRACE_DEFINE_ENUM(NFS4_CONTENT_DATA);
2104 TRACE_DEFINE_ENUM(NFS4_CONTENT_HOLE);
2106 #define show_llseek_mode(what) \
2107 __print_symbolic(what, \
2108 { NFS4_CONTENT_DATA, "DATA" }, \
2109 { NFS4_CONTENT_HOLE, "HOLE" })
2111 TRACE_EVENT(nfs4_llseek,
2113 const struct inode *inode,
2114 const struct nfs42_seek_args *args,
2115 const struct nfs42_seek_res *res,
2119 TP_ARGS(inode, args, res, error),
2122 __field(unsigned long, error)
2123 __field(u32, fhandle)
2124 __field(u32, fileid)
2126 __field(int, stateid_seq)
2127 __field(u32, stateid_hash)
2128 __field(loff_t, offset_s)
2130 __field(loff_t, offset_r)
2135 const struct nfs_inode *nfsi = NFS_I(inode);
2136 const struct nfs_fh *fh = args->sa_fh;
2138 __entry->fileid = nfsi->fileid;
2139 __entry->dev = inode->i_sb->s_dev;
2140 __entry->fhandle = nfs_fhandle_hash(fh);
2141 __entry->offset_s = args->sa_offset;
2142 __entry->stateid_seq =
2143 be32_to_cpu(args->sa_stateid.seqid);
2144 __entry->stateid_hash =
2145 nfs_stateid_hash(&args->sa_stateid);
2146 __entry->what = args->sa_what;
2148 __entry->error = -error;
2149 __entry->offset_r = 0;
2153 __entry->offset_r = res->sr_offset;
2154 __entry->eof = res->sr_eof;
2159 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2160 "stateid=%d:0x%08x offset_s=%llu what=%s "
2161 "offset_r=%llu eof=%u",
2163 show_nfs4_status(__entry->error),
2164 MAJOR(__entry->dev), MINOR(__entry->dev),
2165 (unsigned long long)__entry->fileid,
2167 __entry->stateid_seq, __entry->stateid_hash,
2169 show_llseek_mode(__entry->what),
2175 DECLARE_EVENT_CLASS(nfs4_sparse_event,
2177 const struct inode *inode,
2178 const struct nfs42_falloc_args *args,
2182 TP_ARGS(inode, args, error),
2185 __field(unsigned long, error)
2186 __field(loff_t, offset)
2187 __field(loff_t, len)
2189 __field(u32, fhandle)
2190 __field(u64, fileid)
2191 __field(int, stateid_seq)
2192 __field(u32, stateid_hash)
2196 __entry->error = error < 0 ? -error : 0;
2197 __entry->offset = args->falloc_offset;
2198 __entry->len = args->falloc_length;
2199 __entry->dev = inode->i_sb->s_dev;
2200 __entry->fileid = NFS_FILEID(inode);
2201 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2202 __entry->stateid_seq =
2203 be32_to_cpu(args->falloc_stateid.seqid);
2204 __entry->stateid_hash =
2205 nfs_stateid_hash(&args->falloc_stateid);
2209 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2210 "stateid=%d:0x%08x offset=%llu len=%llu",
2212 show_nfs4_status(__entry->error),
2213 MAJOR(__entry->dev), MINOR(__entry->dev),
2214 (unsigned long long)__entry->fileid,
2216 __entry->stateid_seq, __entry->stateid_hash,
2217 (long long)__entry->offset,
2218 (long long)__entry->len
2221 #define DEFINE_NFS4_SPARSE_EVENT(name) \
2222 DEFINE_EVENT(nfs4_sparse_event, name, \
2224 const struct inode *inode, \
2225 const struct nfs42_falloc_args *args, \
2228 TP_ARGS(inode, args, error))
2229 DEFINE_NFS4_SPARSE_EVENT(nfs4_fallocate);
2230 DEFINE_NFS4_SPARSE_EVENT(nfs4_deallocate);
2232 TRACE_EVENT(nfs4_copy,
2234 const struct inode *src_inode,
2235 const struct inode *dst_inode,
2236 const struct nfs42_copy_args *args,
2237 const struct nfs42_copy_res *res,
2238 const struct nl4_server *nss,
2242 TP_ARGS(src_inode, dst_inode, args, res, nss, error),
2245 __field(unsigned long, error)
2246 __field(u32, src_fhandle)
2247 __field(u32, src_fileid)
2248 __field(u32, dst_fhandle)
2249 __field(u32, dst_fileid)
2250 __field(dev_t, src_dev)
2251 __field(dev_t, dst_dev)
2252 __field(int, src_stateid_seq)
2253 __field(u32, src_stateid_hash)
2254 __field(int, dst_stateid_seq)
2255 __field(u32, dst_stateid_hash)
2256 __field(loff_t, src_offset)
2257 __field(loff_t, dst_offset)
2259 __field(loff_t, len)
2260 __field(int, res_stateid_seq)
2261 __field(u32, res_stateid_hash)
2262 __field(loff_t, res_count)
2263 __field(bool, res_sync)
2264 __field(bool, res_cons)
2265 __field(bool, intra)
2269 const struct nfs_inode *src_nfsi = NFS_I(src_inode);
2270 const struct nfs_inode *dst_nfsi = NFS_I(dst_inode);
2272 __entry->src_fileid = src_nfsi->fileid;
2273 __entry->src_dev = src_inode->i_sb->s_dev;
2274 __entry->src_fhandle = nfs_fhandle_hash(args->src_fh);
2275 __entry->src_offset = args->src_pos;
2276 __entry->dst_fileid = dst_nfsi->fileid;
2277 __entry->dst_dev = dst_inode->i_sb->s_dev;
2278 __entry->dst_fhandle = nfs_fhandle_hash(args->dst_fh);
2279 __entry->dst_offset = args->dst_pos;
2280 __entry->len = args->count;
2281 __entry->sync = args->sync;
2282 __entry->src_stateid_seq =
2283 be32_to_cpu(args->src_stateid.seqid);
2284 __entry->src_stateid_hash =
2285 nfs_stateid_hash(&args->src_stateid);
2286 __entry->dst_stateid_seq =
2287 be32_to_cpu(args->dst_stateid.seqid);
2288 __entry->dst_stateid_hash =
2289 nfs_stateid_hash(&args->dst_stateid);
2290 __entry->intra = nss ? 0 : 1;
2292 __entry->error = -error;
2293 __entry->res_stateid_seq = 0;
2294 __entry->res_stateid_hash = 0;
2295 __entry->res_count = 0;
2296 __entry->res_sync = 0;
2297 __entry->res_cons = 0;
2300 __entry->res_stateid_seq =
2301 be32_to_cpu(res->write_res.stateid.seqid);
2302 __entry->res_stateid_hash =
2303 nfs_stateid_hash(&res->write_res.stateid);
2304 __entry->res_count = res->write_res.count;
2305 __entry->res_sync = res->synchronous;
2306 __entry->res_cons = res->consecutive;
2311 "error=%ld (%s) intra=%d src_fileid=%02x:%02x:%llu "
2312 "src_fhandle=0x%08x dst_fileid=%02x:%02x:%llu "
2313 "dst_fhandle=0x%08x src_stateid=%d:0x%08x "
2314 "dst_stateid=%d:0x%08x src_offset=%llu dst_offset=%llu "
2315 "len=%llu sync=%d cb_stateid=%d:0x%08x res_sync=%d "
2316 "res_cons=%d res_count=%llu",
2318 show_nfs4_status(__entry->error),
2320 MAJOR(__entry->src_dev), MINOR(__entry->src_dev),
2321 (unsigned long long)__entry->src_fileid,
2322 __entry->src_fhandle,
2323 MAJOR(__entry->dst_dev), MINOR(__entry->dst_dev),
2324 (unsigned long long)__entry->dst_fileid,
2325 __entry->dst_fhandle,
2326 __entry->src_stateid_seq, __entry->src_stateid_hash,
2327 __entry->dst_stateid_seq, __entry->dst_stateid_hash,
2328 __entry->src_offset,
2329 __entry->dst_offset,
2332 __entry->res_stateid_seq, __entry->res_stateid_hash,
2339 TRACE_EVENT(nfs4_clone,
2341 const struct inode *src_inode,
2342 const struct inode *dst_inode,
2343 const struct nfs42_clone_args *args,
2347 TP_ARGS(src_inode, dst_inode, args, error),
2350 __field(unsigned long, error)
2351 __field(u32, src_fhandle)
2352 __field(u32, src_fileid)
2353 __field(u32, dst_fhandle)
2354 __field(u32, dst_fileid)
2355 __field(dev_t, src_dev)
2356 __field(dev_t, dst_dev)
2357 __field(loff_t, src_offset)
2358 __field(loff_t, dst_offset)
2359 __field(int, src_stateid_seq)
2360 __field(u32, src_stateid_hash)
2361 __field(int, dst_stateid_seq)
2362 __field(u32, dst_stateid_hash)
2363 __field(loff_t, len)
2367 const struct nfs_inode *src_nfsi = NFS_I(src_inode);
2368 const struct nfs_inode *dst_nfsi = NFS_I(dst_inode);
2370 __entry->src_fileid = src_nfsi->fileid;
2371 __entry->src_dev = src_inode->i_sb->s_dev;
2372 __entry->src_fhandle = nfs_fhandle_hash(args->src_fh);
2373 __entry->src_offset = args->src_offset;
2374 __entry->dst_fileid = dst_nfsi->fileid;
2375 __entry->dst_dev = dst_inode->i_sb->s_dev;
2376 __entry->dst_fhandle = nfs_fhandle_hash(args->dst_fh);
2377 __entry->dst_offset = args->dst_offset;
2378 __entry->len = args->count;
2379 __entry->error = error < 0 ? -error : 0;
2380 __entry->src_stateid_seq =
2381 be32_to_cpu(args->src_stateid.seqid);
2382 __entry->src_stateid_hash =
2383 nfs_stateid_hash(&args->src_stateid);
2384 __entry->dst_stateid_seq =
2385 be32_to_cpu(args->dst_stateid.seqid);
2386 __entry->dst_stateid_hash =
2387 nfs_stateid_hash(&args->dst_stateid);
2391 "error=%ld (%s) src_fileid=%02x:%02x:%llu "
2392 "src_fhandle=0x%08x dst_fileid=%02x:%02x:%llu "
2393 "dst_fhandle=0x%08x src_stateid=%d:0x%08x "
2394 "dst_stateid=%d:0x%08x src_offset=%llu "
2395 "dst_offset=%llu len=%llu",
2397 show_nfs4_status(__entry->error),
2398 MAJOR(__entry->src_dev), MINOR(__entry->src_dev),
2399 (unsigned long long)__entry->src_fileid,
2400 __entry->src_fhandle,
2401 MAJOR(__entry->dst_dev), MINOR(__entry->dst_dev),
2402 (unsigned long long)__entry->dst_fileid,
2403 __entry->dst_fhandle,
2404 __entry->src_stateid_seq, __entry->src_stateid_hash,
2405 __entry->dst_stateid_seq, __entry->dst_stateid_hash,
2406 __entry->src_offset,
2407 __entry->dst_offset,
2412 TRACE_EVENT(nfs4_copy_notify,
2414 const struct inode *inode,
2415 const struct nfs42_copy_notify_args *args,
2416 const struct nfs42_copy_notify_res *res,
2420 TP_ARGS(inode, args, res, error),
2423 __field(unsigned long, error)
2424 __field(u32, fhandle)
2425 __field(u32, fileid)
2427 __field(int, stateid_seq)
2428 __field(u32, stateid_hash)
2429 __field(int, res_stateid_seq)
2430 __field(u32, res_stateid_hash)
2434 const struct nfs_inode *nfsi = NFS_I(inode);
2436 __entry->fileid = nfsi->fileid;
2437 __entry->dev = inode->i_sb->s_dev;
2438 __entry->fhandle = nfs_fhandle_hash(args->cna_src_fh);
2439 __entry->stateid_seq =
2440 be32_to_cpu(args->cna_src_stateid.seqid);
2441 __entry->stateid_hash =
2442 nfs_stateid_hash(&args->cna_src_stateid);
2444 __entry->error = -error;
2445 __entry->res_stateid_seq = 0;
2446 __entry->res_stateid_hash = 0;
2449 __entry->res_stateid_seq =
2450 be32_to_cpu(res->cnr_stateid.seqid);
2451 __entry->res_stateid_hash =
2452 nfs_stateid_hash(&res->cnr_stateid);
2457 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2458 "stateid=%d:0x%08x res_stateid=%d:0x%08x",
2460 show_nfs4_status(__entry->error),
2461 MAJOR(__entry->dev), MINOR(__entry->dev),
2462 (unsigned long long)__entry->fileid,
2464 __entry->stateid_seq, __entry->stateid_hash,
2465 __entry->res_stateid_seq, __entry->res_stateid_hash
2469 TRACE_EVENT(nfs4_offload_cancel,
2471 const struct nfs42_offload_status_args *args,
2475 TP_ARGS(args, error),
2478 __field(unsigned long, error)
2479 __field(u32, fhandle)
2480 __field(int, stateid_seq)
2481 __field(u32, stateid_hash)
2485 __entry->fhandle = nfs_fhandle_hash(args->osa_src_fh);
2486 __entry->error = error < 0 ? -error : 0;
2487 __entry->stateid_seq =
2488 be32_to_cpu(args->osa_stateid.seqid);
2489 __entry->stateid_hash =
2490 nfs_stateid_hash(&args->osa_stateid);
2494 "error=%ld (%s) fhandle=0x%08x stateid=%d:0x%08x",
2496 show_nfs4_status(__entry->error),
2498 __entry->stateid_seq, __entry->stateid_hash
2502 DECLARE_EVENT_CLASS(nfs4_xattr_event,
2504 const struct inode *inode,
2509 TP_ARGS(inode, name, error),
2512 __field(unsigned long, error)
2514 __field(u32, fhandle)
2515 __field(u64, fileid)
2516 __string(name, name)
2520 __entry->error = error < 0 ? -error : 0;
2521 __entry->dev = inode->i_sb->s_dev;
2522 __entry->fileid = NFS_FILEID(inode);
2523 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2524 __assign_str(name, name);
2528 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2530 -__entry->error, show_nfs4_status(__entry->error),
2531 MAJOR(__entry->dev), MINOR(__entry->dev),
2532 (unsigned long long)__entry->fileid,
2533 __entry->fhandle, __get_str(name)
2536 #define DEFINE_NFS4_XATTR_EVENT(name) \
2537 DEFINE_EVENT(nfs4_xattr_event, name, \
2539 const struct inode *inode, \
2543 TP_ARGS(inode, name, error))
2544 DEFINE_NFS4_XATTR_EVENT(nfs4_getxattr);
2545 DEFINE_NFS4_XATTR_EVENT(nfs4_setxattr);
2546 DEFINE_NFS4_XATTR_EVENT(nfs4_removexattr);
2548 DEFINE_NFS4_INODE_EVENT(nfs4_listxattr);
2549 #endif /* CONFIG_NFS_V4_2 */
2551 #endif /* CONFIG_NFS_V4_1 */
2553 #endif /* _TRACE_NFS4_H */
2555 #undef TRACE_INCLUDE_PATH
2556 #define TRACE_INCLUDE_PATH .
2557 #define TRACE_INCLUDE_FILE nfs4trace
2558 /* This part must be outside protection */
2559 #include <trace/define_trace.h>