printf: Remove unused 'bprintf'
[drm/drm-misc.git] / fs / nfs / nfs4trace.h
blob22c973316f0bdd83bddf324e9a78bdfab76c5847
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
4 */
5 #undef TRACE_SYSTEM
6 #define TRACE_SYSTEM nfs4
8 #if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
9 #define _TRACE_NFS4_H
11 #include <linux/tracepoint.h>
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,
36 TP_PROTO(
37 const struct nfs_client *clp,
38 int error
41 TP_ARGS(clp, error),
43 TP_STRUCT__entry(
44 __string(dstaddr, clp->cl_hostname)
45 __field(unsigned long, error)
48 TP_fast_assign(
49 __entry->error = error < 0 ? -error : 0;
50 __assign_str(dstaddr);
53 TP_printk(
54 "error=%ld (%s) dstaddr=%s",
55 -__entry->error,
56 show_nfs4_status(__entry->error),
57 __get_str(dstaddr)
60 #define DEFINE_NFS4_CLIENTID_EVENT(name) \
61 DEFINE_EVENT(nfs4_clientid_event, name, \
62 TP_PROTO( \
63 const struct nfs_client *clp, \
64 int error \
65 ), \
66 TP_ARGS(clp, error))
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_trunked_exchange_id,
81 TP_PROTO(
82 const struct nfs_client *clp,
83 const char *addr,
84 int error
87 TP_ARGS(clp, addr, error),
89 TP_STRUCT__entry(
90 __string(main_addr, clp->cl_hostname)
91 __string(trunk_addr, addr)
92 __field(unsigned long, error)
95 TP_fast_assign(
96 __entry->error = error < 0 ? -error : 0;
97 __assign_str(main_addr);
98 __assign_str(trunk_addr);
101 TP_printk(
102 "error=%ld (%s) main_addr=%s trunk_addr=%s",
103 -__entry->error,
104 show_nfs4_status(__entry->error),
105 __get_str(main_addr),
106 __get_str(trunk_addr)
110 TRACE_EVENT(nfs4_sequence_done,
111 TP_PROTO(
112 const struct nfs4_session *session,
113 const struct nfs4_sequence_res *res
115 TP_ARGS(session, res),
117 TP_STRUCT__entry(
118 __field(unsigned int, session)
119 __field(unsigned int, slot_nr)
120 __field(unsigned int, seq_nr)
121 __field(unsigned int, highest_slotid)
122 __field(unsigned int, target_highest_slotid)
123 __field(unsigned long, status_flags)
124 __field(unsigned long, error)
127 TP_fast_assign(
128 const struct nfs4_slot *sr_slot = res->sr_slot;
129 __entry->session = nfs_session_id_hash(&session->sess_id);
130 __entry->slot_nr = sr_slot->slot_nr;
131 __entry->seq_nr = sr_slot->seq_nr;
132 __entry->highest_slotid = res->sr_highest_slotid;
133 __entry->target_highest_slotid =
134 res->sr_target_highest_slotid;
135 __entry->status_flags = res->sr_status_flags;
136 __entry->error = res->sr_status < 0 ?
137 -res->sr_status : 0;
139 TP_printk(
140 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
141 "highest_slotid=%u target_highest_slotid=%u "
142 "status_flags=0x%lx (%s)",
143 -__entry->error,
144 show_nfs4_status(__entry->error),
145 __entry->session,
146 __entry->slot_nr,
147 __entry->seq_nr,
148 __entry->highest_slotid,
149 __entry->target_highest_slotid,
150 __entry->status_flags,
151 show_nfs4_seq4_status(__entry->status_flags)
155 struct cb_sequenceargs;
156 struct cb_sequenceres;
158 TRACE_EVENT(nfs4_cb_sequence,
159 TP_PROTO(
160 const struct cb_sequenceargs *args,
161 const struct cb_sequenceres *res,
162 __be32 status
164 TP_ARGS(args, res, status),
166 TP_STRUCT__entry(
167 __field(unsigned int, session)
168 __field(unsigned int, slot_nr)
169 __field(unsigned int, seq_nr)
170 __field(unsigned int, highest_slotid)
171 __field(unsigned int, cachethis)
172 __field(unsigned long, error)
175 TP_fast_assign(
176 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
177 __entry->slot_nr = args->csa_slotid;
178 __entry->seq_nr = args->csa_sequenceid;
179 __entry->highest_slotid = args->csa_highestslotid;
180 __entry->cachethis = args->csa_cachethis;
181 __entry->error = be32_to_cpu(status);
184 TP_printk(
185 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
186 "highest_slotid=%u",
187 -__entry->error,
188 show_nfs4_status(__entry->error),
189 __entry->session,
190 __entry->slot_nr,
191 __entry->seq_nr,
192 __entry->highest_slotid
196 TRACE_EVENT(nfs4_cb_seqid_err,
197 TP_PROTO(
198 const struct cb_sequenceargs *args,
199 __be32 status
201 TP_ARGS(args, status),
203 TP_STRUCT__entry(
204 __field(unsigned int, session)
205 __field(unsigned int, slot_nr)
206 __field(unsigned int, seq_nr)
207 __field(unsigned int, highest_slotid)
208 __field(unsigned int, cachethis)
209 __field(unsigned long, error)
212 TP_fast_assign(
213 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
214 __entry->slot_nr = args->csa_slotid;
215 __entry->seq_nr = args->csa_sequenceid;
216 __entry->highest_slotid = args->csa_highestslotid;
217 __entry->cachethis = args->csa_cachethis;
218 __entry->error = be32_to_cpu(status);
221 TP_printk(
222 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
223 "highest_slotid=%u",
224 -__entry->error,
225 show_nfs4_status(__entry->error),
226 __entry->session,
227 __entry->slot_nr,
228 __entry->seq_nr,
229 __entry->highest_slotid
233 TRACE_EVENT(nfs4_cb_offload,
234 TP_PROTO(
235 const struct nfs_fh *cb_fh,
236 const nfs4_stateid *cb_stateid,
237 uint64_t cb_count,
238 int cb_error,
239 int cb_how_stable
242 TP_ARGS(cb_fh, cb_stateid, cb_count, cb_error,
243 cb_how_stable),
245 TP_STRUCT__entry(
246 __field(unsigned long, error)
247 __field(u32, fhandle)
248 __field(loff_t, cb_count)
249 __field(int, cb_how)
250 __field(int, cb_stateid_seq)
251 __field(u32, cb_stateid_hash)
254 TP_fast_assign(
255 __entry->error = cb_error < 0 ? -cb_error : 0;
256 __entry->fhandle = nfs_fhandle_hash(cb_fh);
257 __entry->cb_stateid_seq =
258 be32_to_cpu(cb_stateid->seqid);
259 __entry->cb_stateid_hash =
260 nfs_stateid_hash(cb_stateid);
261 __entry->cb_count = cb_count;
262 __entry->cb_how = cb_how_stable;
265 TP_printk(
266 "error=%ld (%s) fhandle=0x%08x cb_stateid=%d:0x%08x "
267 "cb_count=%llu cb_how=%s",
268 -__entry->error,
269 show_nfs4_status(__entry->error),
270 __entry->fhandle,
271 __entry->cb_stateid_seq, __entry->cb_stateid_hash,
272 __entry->cb_count,
273 show_nfs_stable_how(__entry->cb_how)
276 #endif /* CONFIG_NFS_V4_1 */
278 TRACE_EVENT(nfs4_setup_sequence,
279 TP_PROTO(
280 const struct nfs4_session *session,
281 const struct nfs4_sequence_args *args
283 TP_ARGS(session, args),
285 TP_STRUCT__entry(
286 __field(unsigned int, session)
287 __field(unsigned int, slot_nr)
288 __field(unsigned int, seq_nr)
289 __field(unsigned int, highest_used_slotid)
292 TP_fast_assign(
293 const struct nfs4_slot *sa_slot = args->sa_slot;
294 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
295 __entry->slot_nr = sa_slot->slot_nr;
296 __entry->seq_nr = sa_slot->seq_nr;
297 __entry->highest_used_slotid =
298 sa_slot->table->highest_used_slotid;
300 TP_printk(
301 "session=0x%08x slot_nr=%u seq_nr=%u "
302 "highest_used_slotid=%u",
303 __entry->session,
304 __entry->slot_nr,
305 __entry->seq_nr,
306 __entry->highest_used_slotid
310 TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_RUNNING);
311 TRACE_DEFINE_ENUM(NFS4CLNT_CHECK_LEASE);
312 TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_EXPIRED);
313 TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_REBOOT);
314 TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_NOGRACE);
315 TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN);
316 TRACE_DEFINE_ENUM(NFS4CLNT_SESSION_RESET);
317 TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_CONFIRM);
318 TRACE_DEFINE_ENUM(NFS4CLNT_SERVER_SCOPE_MISMATCH);
319 TRACE_DEFINE_ENUM(NFS4CLNT_PURGE_STATE);
320 TRACE_DEFINE_ENUM(NFS4CLNT_BIND_CONN_TO_SESSION);
321 TRACE_DEFINE_ENUM(NFS4CLNT_MOVED);
322 TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_MOVED);
323 TRACE_DEFINE_ENUM(NFS4CLNT_DELEGATION_EXPIRED);
324 TRACE_DEFINE_ENUM(NFS4CLNT_RUN_MANAGER);
325 TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_AVAILABLE);
326 TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_RUNNING);
327 TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_READ);
328 TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_RW);
329 TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN_DELAYED);
331 #define show_nfs4_clp_state(state) \
332 __print_flags(state, "|", \
333 { BIT(NFS4CLNT_MANAGER_RUNNING), "MANAGER_RUNNING" }, \
334 { BIT(NFS4CLNT_CHECK_LEASE), "CHECK_LEASE" }, \
335 { BIT(NFS4CLNT_LEASE_EXPIRED), "LEASE_EXPIRED" }, \
336 { BIT(NFS4CLNT_RECLAIM_REBOOT), "RECLAIM_REBOOT" }, \
337 { BIT(NFS4CLNT_RECLAIM_NOGRACE), "RECLAIM_NOGRACE" }, \
338 { BIT(NFS4CLNT_DELEGRETURN), "DELEGRETURN" }, \
339 { BIT(NFS4CLNT_SESSION_RESET), "SESSION_RESET" }, \
340 { BIT(NFS4CLNT_LEASE_CONFIRM), "LEASE_CONFIRM" }, \
341 { BIT(NFS4CLNT_SERVER_SCOPE_MISMATCH), "SERVER_SCOPE_MISMATCH" }, \
342 { BIT(NFS4CLNT_PURGE_STATE), "PURGE_STATE" }, \
343 { BIT(NFS4CLNT_BIND_CONN_TO_SESSION), "BIND_CONN_TO_SESSION" }, \
344 { BIT(NFS4CLNT_MOVED), "MOVED" }, \
345 { BIT(NFS4CLNT_LEASE_MOVED), "LEASE_MOVED" }, \
346 { BIT(NFS4CLNT_DELEGATION_EXPIRED), "DELEGATION_EXPIRED" }, \
347 { BIT(NFS4CLNT_RUN_MANAGER), "RUN_MANAGER" }, \
348 { BIT(NFS4CLNT_MANAGER_AVAILABLE), "MANAGER_AVAILABLE" }, \
349 { BIT(NFS4CLNT_RECALL_RUNNING), "RECALL_RUNNING" }, \
350 { BIT(NFS4CLNT_RECALL_ANY_LAYOUT_READ), "RECALL_ANY_LAYOUT_READ" }, \
351 { BIT(NFS4CLNT_RECALL_ANY_LAYOUT_RW), "RECALL_ANY_LAYOUT_RW" }, \
352 { BIT(NFS4CLNT_DELEGRETURN_DELAYED), "DELERETURN_DELAYED" })
354 TRACE_EVENT(nfs4_state_mgr,
355 TP_PROTO(
356 const struct nfs_client *clp
359 TP_ARGS(clp),
361 TP_STRUCT__entry(
362 __field(unsigned long, state)
363 __string(hostname, clp->cl_hostname)
366 TP_fast_assign(
367 __entry->state = clp->cl_state;
368 __assign_str(hostname);
371 TP_printk(
372 "hostname=%s clp state=%s", __get_str(hostname),
373 show_nfs4_clp_state(__entry->state)
377 TRACE_EVENT(nfs4_state_mgr_failed,
378 TP_PROTO(
379 const struct nfs_client *clp,
380 const char *section,
381 int status
384 TP_ARGS(clp, section, status),
386 TP_STRUCT__entry(
387 __field(unsigned long, error)
388 __field(unsigned long, state)
389 __string(hostname, clp->cl_hostname)
390 __string(section, section)
393 TP_fast_assign(
394 __entry->error = status < 0 ? -status : 0;
395 __entry->state = clp->cl_state;
396 __assign_str(hostname);
397 __assign_str(section);
400 TP_printk(
401 "hostname=%s clp state=%s error=%ld (%s) section=%s",
402 __get_str(hostname),
403 show_nfs4_clp_state(__entry->state), -__entry->error,
404 show_nfs4_status(__entry->error), __get_str(section)
409 TRACE_EVENT(nfs4_xdr_bad_operation,
410 TP_PROTO(
411 const struct xdr_stream *xdr,
412 u32 op,
413 u32 expected
416 TP_ARGS(xdr, op, expected),
418 TP_STRUCT__entry(
419 __field(unsigned int, task_id)
420 __field(unsigned int, client_id)
421 __field(u32, xid)
422 __field(u32, op)
423 __field(u32, expected)
426 TP_fast_assign(
427 const struct rpc_rqst *rqstp = xdr->rqst;
428 const struct rpc_task *task = rqstp->rq_task;
430 __entry->task_id = task->tk_pid;
431 __entry->client_id = task->tk_client->cl_clid;
432 __entry->xid = be32_to_cpu(rqstp->rq_xid);
433 __entry->op = op;
434 __entry->expected = expected;
437 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
438 " xid=0x%08x operation=%u, expected=%u",
439 __entry->task_id, __entry->client_id, __entry->xid,
440 __entry->op, __entry->expected
444 DECLARE_EVENT_CLASS(nfs4_xdr_event,
445 TP_PROTO(
446 const struct xdr_stream *xdr,
447 u32 op,
448 u32 error
451 TP_ARGS(xdr, op, error),
453 TP_STRUCT__entry(
454 __field(unsigned int, task_id)
455 __field(unsigned int, client_id)
456 __field(u32, xid)
457 __field(u32, op)
458 __field(unsigned long, error)
461 TP_fast_assign(
462 const struct rpc_rqst *rqstp = xdr->rqst;
463 const struct rpc_task *task = rqstp->rq_task;
465 __entry->task_id = task->tk_pid;
466 __entry->client_id = task->tk_client->cl_clid;
467 __entry->xid = be32_to_cpu(rqstp->rq_xid);
468 __entry->op = op;
469 __entry->error = error;
472 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
473 " xid=0x%08x error=%ld (%s) operation=%u",
474 __entry->task_id, __entry->client_id, __entry->xid,
475 -__entry->error, show_nfs4_status(__entry->error),
476 __entry->op
479 #define DEFINE_NFS4_XDR_EVENT(name) \
480 DEFINE_EVENT(nfs4_xdr_event, name, \
481 TP_PROTO( \
482 const struct xdr_stream *xdr, \
483 u32 op, \
484 u32 error \
485 ), \
486 TP_ARGS(xdr, op, error))
487 DEFINE_NFS4_XDR_EVENT(nfs4_xdr_status);
488 DEFINE_NFS4_XDR_EVENT(nfs4_xdr_bad_filehandle);
490 DECLARE_EVENT_CLASS(nfs4_cb_error_class,
491 TP_PROTO(
492 __be32 xid,
493 u32 cb_ident
496 TP_ARGS(xid, cb_ident),
498 TP_STRUCT__entry(
499 __field(u32, xid)
500 __field(u32, cbident)
503 TP_fast_assign(
504 __entry->xid = be32_to_cpu(xid);
505 __entry->cbident = cb_ident;
508 TP_printk(
509 "xid=0x%08x cb_ident=0x%08x",
510 __entry->xid, __entry->cbident
514 #define DEFINE_CB_ERROR_EVENT(name) \
515 DEFINE_EVENT(nfs4_cb_error_class, nfs_cb_##name, \
516 TP_PROTO( \
517 __be32 xid, \
518 u32 cb_ident \
519 ), \
520 TP_ARGS(xid, cb_ident))
522 DEFINE_CB_ERROR_EVENT(no_clp);
523 DEFINE_CB_ERROR_EVENT(badprinc);
525 DECLARE_EVENT_CLASS(nfs4_open_event,
526 TP_PROTO(
527 const struct nfs_open_context *ctx,
528 int flags,
529 int error
532 TP_ARGS(ctx, flags, error),
534 TP_STRUCT__entry(
535 __field(unsigned long, error)
536 __field(unsigned long, flags)
537 __field(unsigned long, fmode)
538 __field(dev_t, dev)
539 __field(u32, fhandle)
540 __field(u64, fileid)
541 __field(u64, dir)
542 __string(name, ctx->dentry->d_name.name)
543 __field(int, stateid_seq)
544 __field(u32, stateid_hash)
545 __field(int, openstateid_seq)
546 __field(u32, openstateid_hash)
549 TP_fast_assign(
550 const struct nfs4_state *state = ctx->state;
551 const struct inode *inode = NULL;
553 __entry->error = -error;
554 __entry->flags = flags;
555 __entry->fmode = (__force unsigned long)ctx->mode;
556 __entry->dev = ctx->dentry->d_sb->s_dev;
557 if (!IS_ERR_OR_NULL(state)) {
558 inode = state->inode;
559 __entry->stateid_seq =
560 be32_to_cpu(state->stateid.seqid);
561 __entry->stateid_hash =
562 nfs_stateid_hash(&state->stateid);
563 __entry->openstateid_seq =
564 be32_to_cpu(state->open_stateid.seqid);
565 __entry->openstateid_hash =
566 nfs_stateid_hash(&state->open_stateid);
567 } else {
568 __entry->stateid_seq = 0;
569 __entry->stateid_hash = 0;
570 __entry->openstateid_seq = 0;
571 __entry->openstateid_hash = 0;
573 if (inode != NULL) {
574 __entry->fileid = NFS_FILEID(inode);
575 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
576 } else {
577 __entry->fileid = 0;
578 __entry->fhandle = 0;
580 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
581 __assign_str(name);
584 TP_printk(
585 "error=%ld (%s) flags=%lu (%s) fmode=%s "
586 "fileid=%02x:%02x:%llu fhandle=0x%08x "
587 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
588 "openstateid=%d:0x%08x",
589 -__entry->error,
590 show_nfs4_status(__entry->error),
591 __entry->flags,
592 show_fs_fcntl_open_flags(__entry->flags),
593 show_fs_fmode_flags(__entry->fmode),
594 MAJOR(__entry->dev), MINOR(__entry->dev),
595 (unsigned long long)__entry->fileid,
596 __entry->fhandle,
597 MAJOR(__entry->dev), MINOR(__entry->dev),
598 (unsigned long long)__entry->dir,
599 __get_str(name),
600 __entry->stateid_seq, __entry->stateid_hash,
601 __entry->openstateid_seq, __entry->openstateid_hash
605 #define DEFINE_NFS4_OPEN_EVENT(name) \
606 DEFINE_EVENT(nfs4_open_event, name, \
607 TP_PROTO( \
608 const struct nfs_open_context *ctx, \
609 int flags, \
610 int error \
611 ), \
612 TP_ARGS(ctx, flags, error))
613 DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
614 DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
615 DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
617 TRACE_EVENT(nfs4_cached_open,
618 TP_PROTO(
619 const struct nfs4_state *state
621 TP_ARGS(state),
622 TP_STRUCT__entry(
623 __field(dev_t, dev)
624 __field(u32, fhandle)
625 __field(u64, fileid)
626 __field(unsigned int, fmode)
627 __field(int, stateid_seq)
628 __field(u32, stateid_hash)
631 TP_fast_assign(
632 const struct inode *inode = state->inode;
634 __entry->dev = inode->i_sb->s_dev;
635 __entry->fileid = NFS_FILEID(inode);
636 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
637 __entry->fmode = (__force unsigned int)state->state;
638 __entry->stateid_seq =
639 be32_to_cpu(state->stateid.seqid);
640 __entry->stateid_hash =
641 nfs_stateid_hash(&state->stateid);
644 TP_printk(
645 "fmode=%s fileid=%02x:%02x:%llu "
646 "fhandle=0x%08x stateid=%d:0x%08x",
647 __entry->fmode ? show_fs_fmode_flags(__entry->fmode) :
648 "closed",
649 MAJOR(__entry->dev), MINOR(__entry->dev),
650 (unsigned long long)__entry->fileid,
651 __entry->fhandle,
652 __entry->stateid_seq, __entry->stateid_hash
656 TRACE_EVENT(nfs4_close,
657 TP_PROTO(
658 const struct nfs4_state *state,
659 const struct nfs_closeargs *args,
660 const struct nfs_closeres *res,
661 int error
664 TP_ARGS(state, args, res, error),
666 TP_STRUCT__entry(
667 __field(dev_t, dev)
668 __field(u32, fhandle)
669 __field(u64, fileid)
670 __field(unsigned int, fmode)
671 __field(unsigned long, error)
672 __field(int, stateid_seq)
673 __field(u32, stateid_hash)
676 TP_fast_assign(
677 const struct inode *inode = state->inode;
679 __entry->dev = inode->i_sb->s_dev;
680 __entry->fileid = NFS_FILEID(inode);
681 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
682 __entry->fmode = (__force unsigned int)state->state;
683 __entry->error = error < 0 ? -error : 0;
684 __entry->stateid_seq =
685 be32_to_cpu(args->stateid.seqid);
686 __entry->stateid_hash =
687 nfs_stateid_hash(&args->stateid);
690 TP_printk(
691 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu "
692 "fhandle=0x%08x openstateid=%d:0x%08x",
693 -__entry->error,
694 show_nfs4_status(__entry->error),
695 __entry->fmode ? show_fs_fmode_flags(__entry->fmode) :
696 "closed",
697 MAJOR(__entry->dev), MINOR(__entry->dev),
698 (unsigned long long)__entry->fileid,
699 __entry->fhandle,
700 __entry->stateid_seq, __entry->stateid_hash
704 DECLARE_EVENT_CLASS(nfs4_lock_event,
705 TP_PROTO(
706 const struct file_lock *request,
707 const struct nfs4_state *state,
708 int cmd,
709 int error
712 TP_ARGS(request, state, cmd, error),
714 TP_STRUCT__entry(
715 __field(unsigned long, error)
716 __field(unsigned long, cmd)
717 __field(unsigned long, type)
718 __field(loff_t, start)
719 __field(loff_t, end)
720 __field(dev_t, dev)
721 __field(u32, fhandle)
722 __field(u64, fileid)
723 __field(int, stateid_seq)
724 __field(u32, stateid_hash)
727 TP_fast_assign(
728 const struct inode *inode = state->inode;
730 __entry->error = error < 0 ? -error : 0;
731 __entry->cmd = cmd;
732 __entry->type = request->c.flc_type;
733 __entry->start = request->fl_start;
734 __entry->end = request->fl_end;
735 __entry->dev = inode->i_sb->s_dev;
736 __entry->fileid = NFS_FILEID(inode);
737 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
738 __entry->stateid_seq =
739 be32_to_cpu(state->stateid.seqid);
740 __entry->stateid_hash =
741 nfs_stateid_hash(&state->stateid);
744 TP_printk(
745 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
746 "fileid=%02x:%02x:%llu fhandle=0x%08x "
747 "stateid=%d:0x%08x",
748 -__entry->error,
749 show_nfs4_status(__entry->error),
750 show_fs_fcntl_cmd(__entry->cmd),
751 show_fs_fcntl_lock_type(__entry->type),
752 (long long)__entry->start,
753 (long long)__entry->end,
754 MAJOR(__entry->dev), MINOR(__entry->dev),
755 (unsigned long long)__entry->fileid,
756 __entry->fhandle,
757 __entry->stateid_seq, __entry->stateid_hash
761 #define DEFINE_NFS4_LOCK_EVENT(name) \
762 DEFINE_EVENT(nfs4_lock_event, name, \
763 TP_PROTO( \
764 const struct file_lock *request, \
765 const struct nfs4_state *state, \
766 int cmd, \
767 int error \
768 ), \
769 TP_ARGS(request, state, cmd, error))
770 DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
771 DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
773 TRACE_EVENT(nfs4_set_lock,
774 TP_PROTO(
775 const struct file_lock *request,
776 const struct nfs4_state *state,
777 const nfs4_stateid *lockstateid,
778 int cmd,
779 int error
782 TP_ARGS(request, state, lockstateid, cmd, error),
784 TP_STRUCT__entry(
785 __field(unsigned long, error)
786 __field(unsigned long, cmd)
787 __field(unsigned long, type)
788 __field(loff_t, start)
789 __field(loff_t, end)
790 __field(dev_t, dev)
791 __field(u32, fhandle)
792 __field(u64, fileid)
793 __field(int, stateid_seq)
794 __field(u32, stateid_hash)
795 __field(int, lockstateid_seq)
796 __field(u32, lockstateid_hash)
799 TP_fast_assign(
800 const struct inode *inode = state->inode;
802 __entry->error = error < 0 ? -error : 0;
803 __entry->cmd = cmd;
804 __entry->type = request->c.flc_type;
805 __entry->start = request->fl_start;
806 __entry->end = request->fl_end;
807 __entry->dev = inode->i_sb->s_dev;
808 __entry->fileid = NFS_FILEID(inode);
809 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
810 __entry->stateid_seq =
811 be32_to_cpu(state->stateid.seqid);
812 __entry->stateid_hash =
813 nfs_stateid_hash(&state->stateid);
814 __entry->lockstateid_seq =
815 be32_to_cpu(lockstateid->seqid);
816 __entry->lockstateid_hash =
817 nfs_stateid_hash(lockstateid);
820 TP_printk(
821 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
822 "fileid=%02x:%02x:%llu fhandle=0x%08x "
823 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
824 -__entry->error,
825 show_nfs4_status(__entry->error),
826 show_fs_fcntl_cmd(__entry->cmd),
827 show_fs_fcntl_lock_type(__entry->type),
828 (long long)__entry->start,
829 (long long)__entry->end,
830 MAJOR(__entry->dev), MINOR(__entry->dev),
831 (unsigned long long)__entry->fileid,
832 __entry->fhandle,
833 __entry->stateid_seq, __entry->stateid_hash,
834 __entry->lockstateid_seq, __entry->lockstateid_hash
838 TRACE_DEFINE_ENUM(LK_STATE_IN_USE);
839 TRACE_DEFINE_ENUM(NFS_DELEGATED_STATE);
840 TRACE_DEFINE_ENUM(NFS_OPEN_STATE);
841 TRACE_DEFINE_ENUM(NFS_O_RDONLY_STATE);
842 TRACE_DEFINE_ENUM(NFS_O_WRONLY_STATE);
843 TRACE_DEFINE_ENUM(NFS_O_RDWR_STATE);
844 TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_REBOOT);
845 TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_NOGRACE);
846 TRACE_DEFINE_ENUM(NFS_STATE_POSIX_LOCKS);
847 TRACE_DEFINE_ENUM(NFS_STATE_RECOVERY_FAILED);
848 TRACE_DEFINE_ENUM(NFS_STATE_MAY_NOTIFY_LOCK);
849 TRACE_DEFINE_ENUM(NFS_STATE_CHANGE_WAIT);
850 TRACE_DEFINE_ENUM(NFS_CLNT_DST_SSC_COPY_STATE);
851 TRACE_DEFINE_ENUM(NFS_CLNT_SRC_SSC_COPY_STATE);
852 TRACE_DEFINE_ENUM(NFS_SRV_SSC_COPY_STATE);
854 #define show_nfs4_state_flags(flags) \
855 __print_flags(flags, "|", \
856 { LK_STATE_IN_USE, "IN_USE" }, \
857 { NFS_DELEGATED_STATE, "DELEGATED" }, \
858 { NFS_OPEN_STATE, "OPEN" }, \
859 { NFS_O_RDONLY_STATE, "O_RDONLY" }, \
860 { NFS_O_WRONLY_STATE, "O_WRONLY" }, \
861 { NFS_O_RDWR_STATE, "O_RDWR" }, \
862 { NFS_STATE_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
863 { NFS_STATE_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
864 { NFS_STATE_POSIX_LOCKS, "POSIX_LOCKS" }, \
865 { NFS_STATE_RECOVERY_FAILED, "RECOVERY_FAILED" }, \
866 { NFS_STATE_MAY_NOTIFY_LOCK, "MAY_NOTIFY_LOCK" }, \
867 { NFS_STATE_CHANGE_WAIT, "CHANGE_WAIT" }, \
868 { NFS_CLNT_DST_SSC_COPY_STATE, "CLNT_DST_SSC_COPY" }, \
869 { NFS_CLNT_SRC_SSC_COPY_STATE, "CLNT_SRC_SSC_COPY" }, \
870 { NFS_SRV_SSC_COPY_STATE, "SRV_SSC_COPY" })
872 #define show_nfs4_lock_flags(flags) \
873 __print_flags(flags, "|", \
874 { BIT(NFS_LOCK_INITIALIZED), "INITIALIZED" }, \
875 { BIT(NFS_LOCK_LOST), "LOST" })
877 TRACE_EVENT(nfs4_state_lock_reclaim,
878 TP_PROTO(
879 const struct nfs4_state *state,
880 const struct nfs4_lock_state *lock
883 TP_ARGS(state, lock),
885 TP_STRUCT__entry(
886 __field(dev_t, dev)
887 __field(u32, fhandle)
888 __field(u64, fileid)
889 __field(unsigned long, state_flags)
890 __field(unsigned long, lock_flags)
891 __field(int, stateid_seq)
892 __field(u32, stateid_hash)
895 TP_fast_assign(
896 const struct inode *inode = state->inode;
898 __entry->dev = inode->i_sb->s_dev;
899 __entry->fileid = NFS_FILEID(inode);
900 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
901 __entry->state_flags = state->flags;
902 __entry->lock_flags = lock->ls_flags;
903 __entry->stateid_seq =
904 be32_to_cpu(state->stateid.seqid);
905 __entry->stateid_hash =
906 nfs_stateid_hash(&state->stateid);
909 TP_printk(
910 "fileid=%02x:%02x:%llu fhandle=0x%08x "
911 "stateid=%d:0x%08x state_flags=%s lock_flags=%s",
912 MAJOR(__entry->dev), MINOR(__entry->dev),
913 (unsigned long long)__entry->fileid, __entry->fhandle,
914 __entry->stateid_seq, __entry->stateid_hash,
915 show_nfs4_state_flags(__entry->state_flags),
916 show_nfs4_lock_flags(__entry->lock_flags)
920 DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
921 TP_PROTO(
922 const struct inode *inode,
923 fmode_t fmode
926 TP_ARGS(inode, fmode),
928 TP_STRUCT__entry(
929 __field(dev_t, dev)
930 __field(u32, fhandle)
931 __field(u64, fileid)
932 __field(unsigned int, fmode)
935 TP_fast_assign(
936 __entry->dev = inode->i_sb->s_dev;
937 __entry->fileid = NFS_FILEID(inode);
938 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
939 __entry->fmode = (__force unsigned int)fmode;
942 TP_printk(
943 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
944 show_fs_fmode_flags(__entry->fmode),
945 MAJOR(__entry->dev), MINOR(__entry->dev),
946 (unsigned long long)__entry->fileid,
947 __entry->fhandle
950 #define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
951 DEFINE_EVENT(nfs4_set_delegation_event, name, \
952 TP_PROTO( \
953 const struct inode *inode, \
954 fmode_t fmode \
955 ), \
956 TP_ARGS(inode, fmode))
957 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
958 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
960 TRACE_EVENT(nfs4_delegreturn_exit,
961 TP_PROTO(
962 const struct nfs4_delegreturnargs *args,
963 const struct nfs4_delegreturnres *res,
964 int error
967 TP_ARGS(args, res, error),
969 TP_STRUCT__entry(
970 __field(dev_t, dev)
971 __field(u32, fhandle)
972 __field(unsigned long, error)
973 __field(int, stateid_seq)
974 __field(u32, stateid_hash)
977 TP_fast_assign(
978 __entry->dev = res->server->s_dev;
979 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
980 __entry->error = error < 0 ? -error : 0;
981 __entry->stateid_seq =
982 be32_to_cpu(args->stateid->seqid);
983 __entry->stateid_hash =
984 nfs_stateid_hash(args->stateid);
987 TP_printk(
988 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x "
989 "stateid=%d:0x%08x",
990 -__entry->error,
991 show_nfs4_status(__entry->error),
992 MAJOR(__entry->dev), MINOR(__entry->dev),
993 __entry->fhandle,
994 __entry->stateid_seq, __entry->stateid_hash
998 #ifdef CONFIG_NFS_V4_1
999 DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
1000 TP_PROTO(
1001 const struct nfs4_state *state,
1002 const struct nfs4_lock_state *lsp,
1003 int error
1006 TP_ARGS(state, lsp, error),
1008 TP_STRUCT__entry(
1009 __field(unsigned long, error)
1010 __field(dev_t, dev)
1011 __field(u32, fhandle)
1012 __field(u64, fileid)
1013 __field(int, stateid_seq)
1014 __field(u32, stateid_hash)
1017 TP_fast_assign(
1018 const struct inode *inode = state->inode;
1020 __entry->error = error < 0 ? -error : 0;
1021 __entry->dev = inode->i_sb->s_dev;
1022 __entry->fileid = NFS_FILEID(inode);
1023 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1024 __entry->stateid_seq =
1025 be32_to_cpu(state->stateid.seqid);
1026 __entry->stateid_hash =
1027 nfs_stateid_hash(&state->stateid);
1030 TP_printk(
1031 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1032 "stateid=%d:0x%08x",
1033 -__entry->error,
1034 show_nfs4_status(__entry->error),
1035 MAJOR(__entry->dev), MINOR(__entry->dev),
1036 (unsigned long long)__entry->fileid,
1037 __entry->fhandle,
1038 __entry->stateid_seq, __entry->stateid_hash
1042 #define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
1043 DEFINE_EVENT(nfs4_test_stateid_event, name, \
1044 TP_PROTO( \
1045 const struct nfs4_state *state, \
1046 const struct nfs4_lock_state *lsp, \
1047 int error \
1048 ), \
1049 TP_ARGS(state, lsp, error))
1050 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
1051 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
1052 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
1053 #endif /* CONFIG_NFS_V4_1 */
1055 DECLARE_EVENT_CLASS(nfs4_lookup_event,
1056 TP_PROTO(
1057 const struct inode *dir,
1058 const struct qstr *name,
1059 int error
1062 TP_ARGS(dir, name, error),
1064 TP_STRUCT__entry(
1065 __field(dev_t, dev)
1066 __field(unsigned long, error)
1067 __field(u64, dir)
1068 __string(name, name->name)
1071 TP_fast_assign(
1072 __entry->dev = dir->i_sb->s_dev;
1073 __entry->dir = NFS_FILEID(dir);
1074 __entry->error = -error;
1075 __assign_str(name);
1078 TP_printk(
1079 "error=%ld (%s) name=%02x:%02x:%llu/%s",
1080 -__entry->error,
1081 show_nfs4_status(__entry->error),
1082 MAJOR(__entry->dev), MINOR(__entry->dev),
1083 (unsigned long long)__entry->dir,
1084 __get_str(name)
1088 #define DEFINE_NFS4_LOOKUP_EVENT(name) \
1089 DEFINE_EVENT(nfs4_lookup_event, name, \
1090 TP_PROTO( \
1091 const struct inode *dir, \
1092 const struct qstr *name, \
1093 int error \
1094 ), \
1095 TP_ARGS(dir, name, error))
1097 DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
1098 DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
1099 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
1100 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
1101 DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
1102 DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
1103 DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
1105 TRACE_EVENT(nfs4_lookupp,
1106 TP_PROTO(
1107 const struct inode *inode,
1108 int error
1111 TP_ARGS(inode, error),
1113 TP_STRUCT__entry(
1114 __field(dev_t, dev)
1115 __field(u64, ino)
1116 __field(unsigned long, error)
1119 TP_fast_assign(
1120 __entry->dev = inode->i_sb->s_dev;
1121 __entry->ino = NFS_FILEID(inode);
1122 __entry->error = error < 0 ? -error : 0;
1125 TP_printk(
1126 "error=%ld (%s) inode=%02x:%02x:%llu",
1127 -__entry->error,
1128 show_nfs4_status(__entry->error),
1129 MAJOR(__entry->dev), MINOR(__entry->dev),
1130 (unsigned long long)__entry->ino
1134 TRACE_EVENT(nfs4_rename,
1135 TP_PROTO(
1136 const struct inode *olddir,
1137 const struct qstr *oldname,
1138 const struct inode *newdir,
1139 const struct qstr *newname,
1140 int error
1143 TP_ARGS(olddir, oldname, newdir, newname, error),
1145 TP_STRUCT__entry(
1146 __field(dev_t, dev)
1147 __field(unsigned long, error)
1148 __field(u64, olddir)
1149 __string(oldname, oldname->name)
1150 __field(u64, newdir)
1151 __string(newname, newname->name)
1154 TP_fast_assign(
1155 __entry->dev = olddir->i_sb->s_dev;
1156 __entry->olddir = NFS_FILEID(olddir);
1157 __entry->newdir = NFS_FILEID(newdir);
1158 __entry->error = error < 0 ? -error : 0;
1159 __assign_str(oldname);
1160 __assign_str(newname);
1163 TP_printk(
1164 "error=%ld (%s) oldname=%02x:%02x:%llu/%s "
1165 "newname=%02x:%02x:%llu/%s",
1166 -__entry->error,
1167 show_nfs4_status(__entry->error),
1168 MAJOR(__entry->dev), MINOR(__entry->dev),
1169 (unsigned long long)__entry->olddir,
1170 __get_str(oldname),
1171 MAJOR(__entry->dev), MINOR(__entry->dev),
1172 (unsigned long long)__entry->newdir,
1173 __get_str(newname)
1177 DECLARE_EVENT_CLASS(nfs4_inode_event,
1178 TP_PROTO(
1179 const struct inode *inode,
1180 int error
1183 TP_ARGS(inode, error),
1185 TP_STRUCT__entry(
1186 __field(dev_t, dev)
1187 __field(u32, fhandle)
1188 __field(u64, fileid)
1189 __field(unsigned long, error)
1192 TP_fast_assign(
1193 __entry->dev = inode->i_sb->s_dev;
1194 __entry->fileid = NFS_FILEID(inode);
1195 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1196 __entry->error = error < 0 ? -error : 0;
1199 TP_printk(
1200 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
1201 -__entry->error,
1202 show_nfs4_status(__entry->error),
1203 MAJOR(__entry->dev), MINOR(__entry->dev),
1204 (unsigned long long)__entry->fileid,
1205 __entry->fhandle
1209 #define DEFINE_NFS4_INODE_EVENT(name) \
1210 DEFINE_EVENT(nfs4_inode_event, name, \
1211 TP_PROTO( \
1212 const struct inode *inode, \
1213 int error \
1214 ), \
1215 TP_ARGS(inode, error))
1217 DEFINE_NFS4_INODE_EVENT(nfs4_access);
1218 DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
1219 DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
1220 DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
1221 DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
1222 #ifdef CONFIG_NFS_V4_SECURITY_LABEL
1223 DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
1224 DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
1225 #endif /* CONFIG_NFS_V4_SECURITY_LABEL */
1227 DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
1228 TP_PROTO(
1229 const struct inode *inode,
1230 const nfs4_stateid *stateid,
1231 int error
1234 TP_ARGS(inode, stateid, error),
1236 TP_STRUCT__entry(
1237 __field(dev_t, dev)
1238 __field(u32, fhandle)
1239 __field(u64, fileid)
1240 __field(unsigned long, error)
1241 __field(int, stateid_seq)
1242 __field(u32, stateid_hash)
1245 TP_fast_assign(
1246 __entry->dev = inode->i_sb->s_dev;
1247 __entry->fileid = NFS_FILEID(inode);
1248 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1249 __entry->error = error < 0 ? -error : 0;
1250 __entry->stateid_seq =
1251 be32_to_cpu(stateid->seqid);
1252 __entry->stateid_hash =
1253 nfs_stateid_hash(stateid);
1256 TP_printk(
1257 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1258 "stateid=%d:0x%08x",
1259 -__entry->error,
1260 show_nfs4_status(__entry->error),
1261 MAJOR(__entry->dev), MINOR(__entry->dev),
1262 (unsigned long long)__entry->fileid,
1263 __entry->fhandle,
1264 __entry->stateid_seq, __entry->stateid_hash
1268 #define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1269 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1270 TP_PROTO( \
1271 const struct inode *inode, \
1272 const nfs4_stateid *stateid, \
1273 int error \
1274 ), \
1275 TP_ARGS(inode, stateid, error))
1277 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1278 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
1279 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
1280 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
1281 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_close_stateid_update_wait);
1283 DECLARE_EVENT_CLASS(nfs4_getattr_event,
1284 TP_PROTO(
1285 const struct nfs_server *server,
1286 const struct nfs_fh *fhandle,
1287 const struct nfs_fattr *fattr,
1288 int error
1291 TP_ARGS(server, fhandle, fattr, error),
1293 TP_STRUCT__entry(
1294 __field(dev_t, dev)
1295 __field(u32, fhandle)
1296 __field(u64, fileid)
1297 __field(unsigned int, valid)
1298 __field(unsigned long, error)
1301 TP_fast_assign(
1302 __entry->dev = server->s_dev;
1303 __entry->valid = fattr->valid;
1304 __entry->fhandle = nfs_fhandle_hash(fhandle);
1305 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
1306 __entry->error = error < 0 ? -error : 0;
1309 TP_printk(
1310 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1311 "valid=%s",
1312 -__entry->error,
1313 show_nfs4_status(__entry->error),
1314 MAJOR(__entry->dev), MINOR(__entry->dev),
1315 (unsigned long long)__entry->fileid,
1316 __entry->fhandle,
1317 show_nfs_fattr_flags(__entry->valid)
1321 #define DEFINE_NFS4_GETATTR_EVENT(name) \
1322 DEFINE_EVENT(nfs4_getattr_event, name, \
1323 TP_PROTO( \
1324 const struct nfs_server *server, \
1325 const struct nfs_fh *fhandle, \
1326 const struct nfs_fattr *fattr, \
1327 int error \
1328 ), \
1329 TP_ARGS(server, fhandle, fattr, error))
1330 DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1331 DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1332 DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1334 DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1335 TP_PROTO(
1336 const struct nfs_client *clp,
1337 const struct nfs_fh *fhandle,
1338 const struct inode *inode,
1339 int error
1342 TP_ARGS(clp, fhandle, inode, error),
1344 TP_STRUCT__entry(
1345 __field(unsigned long, error)
1346 __field(dev_t, dev)
1347 __field(u32, fhandle)
1348 __field(u64, fileid)
1349 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
1352 TP_fast_assign(
1353 __entry->error = error < 0 ? -error : 0;
1354 __entry->fhandle = nfs_fhandle_hash(fhandle);
1355 if (!IS_ERR_OR_NULL(inode)) {
1356 __entry->fileid = NFS_FILEID(inode);
1357 __entry->dev = inode->i_sb->s_dev;
1358 } else {
1359 __entry->fileid = 0;
1360 __entry->dev = 0;
1362 __assign_str(dstaddr);
1365 TP_printk(
1366 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1367 "dstaddr=%s",
1368 -__entry->error,
1369 show_nfs4_status(__entry->error),
1370 MAJOR(__entry->dev), MINOR(__entry->dev),
1371 (unsigned long long)__entry->fileid,
1372 __entry->fhandle,
1373 __get_str(dstaddr)
1377 #define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1378 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1379 TP_PROTO( \
1380 const struct nfs_client *clp, \
1381 const struct nfs_fh *fhandle, \
1382 const struct inode *inode, \
1383 int error \
1384 ), \
1385 TP_ARGS(clp, fhandle, inode, error))
1386 DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1388 DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1389 TP_PROTO(
1390 const struct nfs_client *clp,
1391 const struct nfs_fh *fhandle,
1392 const struct inode *inode,
1393 const nfs4_stateid *stateid,
1394 int error
1397 TP_ARGS(clp, fhandle, inode, stateid, error),
1399 TP_STRUCT__entry(
1400 __field(unsigned long, error)
1401 __field(dev_t, dev)
1402 __field(u32, fhandle)
1403 __field(u64, fileid)
1404 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
1405 __field(int, stateid_seq)
1406 __field(u32, stateid_hash)
1409 TP_fast_assign(
1410 __entry->error = error < 0 ? -error : 0;
1411 __entry->fhandle = nfs_fhandle_hash(fhandle);
1412 if (!IS_ERR_OR_NULL(inode)) {
1413 __entry->fileid = NFS_FILEID(inode);
1414 __entry->dev = inode->i_sb->s_dev;
1415 } else {
1416 __entry->fileid = 0;
1417 __entry->dev = 0;
1419 __assign_str(dstaddr);
1420 __entry->stateid_seq =
1421 be32_to_cpu(stateid->seqid);
1422 __entry->stateid_hash =
1423 nfs_stateid_hash(stateid);
1426 TP_printk(
1427 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1428 "stateid=%d:0x%08x dstaddr=%s",
1429 -__entry->error,
1430 show_nfs4_status(__entry->error),
1431 MAJOR(__entry->dev), MINOR(__entry->dev),
1432 (unsigned long long)__entry->fileid,
1433 __entry->fhandle,
1434 __entry->stateid_seq, __entry->stateid_hash,
1435 __get_str(dstaddr)
1439 #define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1440 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1441 TP_PROTO( \
1442 const struct nfs_client *clp, \
1443 const struct nfs_fh *fhandle, \
1444 const struct inode *inode, \
1445 const nfs4_stateid *stateid, \
1446 int error \
1447 ), \
1448 TP_ARGS(clp, fhandle, inode, stateid, error))
1449 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1450 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
1452 DECLARE_EVENT_CLASS(nfs4_idmap_event,
1453 TP_PROTO(
1454 const char *name,
1455 int len,
1456 u32 id,
1457 int error
1460 TP_ARGS(name, len, id, error),
1462 TP_STRUCT__entry(
1463 __field(unsigned long, error)
1464 __field(u32, id)
1465 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1468 TP_fast_assign(
1469 if (len < 0)
1470 len = 0;
1471 __entry->error = error < 0 ? error : 0;
1472 __entry->id = id;
1473 memcpy(__get_str(name), name, len);
1474 __get_str(name)[len] = 0;
1477 TP_printk(
1478 "error=%ld (%s) id=%u name=%s",
1479 -__entry->error, show_nfs4_status(__entry->error),
1480 __entry->id,
1481 __get_str(name)
1484 #define DEFINE_NFS4_IDMAP_EVENT(name) \
1485 DEFINE_EVENT(nfs4_idmap_event, name, \
1486 TP_PROTO( \
1487 const char *name, \
1488 int len, \
1489 u32 id, \
1490 int error \
1491 ), \
1492 TP_ARGS(name, len, id, error))
1493 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1494 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1495 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1496 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1498 #ifdef CONFIG_NFS_V4_1
1499 #define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) \
1500 (lseg ? nfs_stateid_hash(&lseg->pls_layout->plh_stateid) : 0)
1501 #else
1502 #define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) (0)
1503 #endif
1505 DECLARE_EVENT_CLASS(nfs4_read_event,
1506 TP_PROTO(
1507 const struct nfs_pgio_header *hdr,
1508 int error
1511 TP_ARGS(hdr, error),
1513 TP_STRUCT__entry(
1514 __field(dev_t, dev)
1515 __field(u32, fhandle)
1516 __field(u64, fileid)
1517 __field(loff_t, offset)
1518 __field(u32, arg_count)
1519 __field(u32, res_count)
1520 __field(unsigned long, error)
1521 __field(int, stateid_seq)
1522 __field(u32, stateid_hash)
1523 __field(int, layoutstateid_seq)
1524 __field(u32, layoutstateid_hash)
1527 TP_fast_assign(
1528 const struct inode *inode = hdr->inode;
1529 const struct nfs_inode *nfsi = NFS_I(inode);
1530 const struct nfs_fh *fh = hdr->args.fh ?
1531 hdr->args.fh : &nfsi->fh;
1532 const struct nfs4_state *state =
1533 hdr->args.context->state;
1534 const struct pnfs_layout_segment *lseg = hdr->lseg;
1536 __entry->dev = inode->i_sb->s_dev;
1537 __entry->fileid = nfsi->fileid;
1538 __entry->fhandle = nfs_fhandle_hash(fh);
1539 __entry->offset = hdr->args.offset;
1540 __entry->arg_count = hdr->args.count;
1541 __entry->res_count = hdr->res.count;
1542 __entry->error = error < 0 ? -error : 0;
1543 __entry->stateid_seq =
1544 be32_to_cpu(state->stateid.seqid);
1545 __entry->stateid_hash =
1546 nfs_stateid_hash(&state->stateid);
1547 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1548 __entry->layoutstateid_hash =
1549 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
1552 TP_printk(
1553 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1554 "offset=%lld count=%u res=%u stateid=%d:0x%08x "
1555 "layoutstateid=%d:0x%08x",
1556 -__entry->error,
1557 show_nfs4_status(__entry->error),
1558 MAJOR(__entry->dev), MINOR(__entry->dev),
1559 (unsigned long long)__entry->fileid,
1560 __entry->fhandle,
1561 (long long)__entry->offset,
1562 __entry->arg_count, __entry->res_count,
1563 __entry->stateid_seq, __entry->stateid_hash,
1564 __entry->layoutstateid_seq, __entry->layoutstateid_hash
1567 #define DEFINE_NFS4_READ_EVENT(name) \
1568 DEFINE_EVENT(nfs4_read_event, name, \
1569 TP_PROTO( \
1570 const struct nfs_pgio_header *hdr, \
1571 int error \
1572 ), \
1573 TP_ARGS(hdr, error))
1574 DEFINE_NFS4_READ_EVENT(nfs4_read);
1575 #ifdef CONFIG_NFS_V4_1
1576 DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1577 #endif /* CONFIG_NFS_V4_1 */
1579 DECLARE_EVENT_CLASS(nfs4_write_event,
1580 TP_PROTO(
1581 const struct nfs_pgio_header *hdr,
1582 int error
1585 TP_ARGS(hdr, error),
1587 TP_STRUCT__entry(
1588 __field(dev_t, dev)
1589 __field(u32, fhandle)
1590 __field(u64, fileid)
1591 __field(loff_t, offset)
1592 __field(u32, arg_count)
1593 __field(u32, res_count)
1594 __field(unsigned long, error)
1595 __field(int, stateid_seq)
1596 __field(u32, stateid_hash)
1597 __field(int, layoutstateid_seq)
1598 __field(u32, layoutstateid_hash)
1601 TP_fast_assign(
1602 const struct inode *inode = hdr->inode;
1603 const struct nfs_inode *nfsi = NFS_I(inode);
1604 const struct nfs_fh *fh = hdr->args.fh ?
1605 hdr->args.fh : &nfsi->fh;
1606 const struct nfs4_state *state =
1607 hdr->args.context->state;
1608 const struct pnfs_layout_segment *lseg = hdr->lseg;
1610 __entry->dev = inode->i_sb->s_dev;
1611 __entry->fileid = nfsi->fileid;
1612 __entry->fhandle = nfs_fhandle_hash(fh);
1613 __entry->offset = hdr->args.offset;
1614 __entry->arg_count = hdr->args.count;
1615 __entry->res_count = hdr->res.count;
1616 __entry->error = error < 0 ? -error : 0;
1617 __entry->stateid_seq =
1618 be32_to_cpu(state->stateid.seqid);
1619 __entry->stateid_hash =
1620 nfs_stateid_hash(&state->stateid);
1621 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1622 __entry->layoutstateid_hash =
1623 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
1626 TP_printk(
1627 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1628 "offset=%lld count=%u res=%u stateid=%d:0x%08x "
1629 "layoutstateid=%d:0x%08x",
1630 -__entry->error,
1631 show_nfs4_status(__entry->error),
1632 MAJOR(__entry->dev), MINOR(__entry->dev),
1633 (unsigned long long)__entry->fileid,
1634 __entry->fhandle,
1635 (long long)__entry->offset,
1636 __entry->arg_count, __entry->res_count,
1637 __entry->stateid_seq, __entry->stateid_hash,
1638 __entry->layoutstateid_seq, __entry->layoutstateid_hash
1642 #define DEFINE_NFS4_WRITE_EVENT(name) \
1643 DEFINE_EVENT(nfs4_write_event, name, \
1644 TP_PROTO( \
1645 const struct nfs_pgio_header *hdr, \
1646 int error \
1647 ), \
1648 TP_ARGS(hdr, error))
1649 DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1650 #ifdef CONFIG_NFS_V4_1
1651 DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1652 #endif /* CONFIG_NFS_V4_1 */
1654 DECLARE_EVENT_CLASS(nfs4_commit_event,
1655 TP_PROTO(
1656 const struct nfs_commit_data *data,
1657 int error
1660 TP_ARGS(data, error),
1662 TP_STRUCT__entry(
1663 __field(dev_t, dev)
1664 __field(u32, fhandle)
1665 __field(u64, fileid)
1666 __field(unsigned long, error)
1667 __field(loff_t, offset)
1668 __field(u32, count)
1669 __field(int, layoutstateid_seq)
1670 __field(u32, layoutstateid_hash)
1673 TP_fast_assign(
1674 const struct inode *inode = data->inode;
1675 const struct nfs_inode *nfsi = NFS_I(inode);
1676 const struct nfs_fh *fh = data->args.fh ?
1677 data->args.fh : &nfsi->fh;
1678 const struct pnfs_layout_segment *lseg = data->lseg;
1680 __entry->dev = inode->i_sb->s_dev;
1681 __entry->fileid = nfsi->fileid;
1682 __entry->fhandle = nfs_fhandle_hash(fh);
1683 __entry->offset = data->args.offset;
1684 __entry->count = data->args.count;
1685 __entry->error = error < 0 ? -error : 0;
1686 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1687 __entry->layoutstateid_hash =
1688 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
1691 TP_printk(
1692 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1693 "offset=%lld count=%u layoutstateid=%d:0x%08x",
1694 -__entry->error,
1695 show_nfs4_status(__entry->error),
1696 MAJOR(__entry->dev), MINOR(__entry->dev),
1697 (unsigned long long)__entry->fileid,
1698 __entry->fhandle,
1699 (long long)__entry->offset,
1700 __entry->count,
1701 __entry->layoutstateid_seq, __entry->layoutstateid_hash
1704 #define DEFINE_NFS4_COMMIT_EVENT(name) \
1705 DEFINE_EVENT(nfs4_commit_event, name, \
1706 TP_PROTO( \
1707 const struct nfs_commit_data *data, \
1708 int error \
1709 ), \
1710 TP_ARGS(data, error))
1711 DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1712 #ifdef CONFIG_NFS_V4_1
1713 DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
1715 TRACE_EVENT(nfs4_layoutget,
1716 TP_PROTO(
1717 const struct nfs_open_context *ctx,
1718 const struct pnfs_layout_range *args,
1719 const struct pnfs_layout_range *res,
1720 const nfs4_stateid *layout_stateid,
1721 int error
1724 TP_ARGS(ctx, args, res, layout_stateid, error),
1726 TP_STRUCT__entry(
1727 __field(dev_t, dev)
1728 __field(u32, fhandle)
1729 __field(u64, fileid)
1730 __field(u32, iomode)
1731 __field(u64, offset)
1732 __field(u64, count)
1733 __field(unsigned long, error)
1734 __field(int, stateid_seq)
1735 __field(u32, stateid_hash)
1736 __field(int, layoutstateid_seq)
1737 __field(u32, layoutstateid_hash)
1740 TP_fast_assign(
1741 const struct inode *inode = d_inode(ctx->dentry);
1742 const struct nfs4_state *state = ctx->state;
1743 __entry->dev = inode->i_sb->s_dev;
1744 __entry->fileid = NFS_FILEID(inode);
1745 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1746 __entry->iomode = args->iomode;
1747 __entry->offset = args->offset;
1748 __entry->count = args->length;
1749 __entry->error = error < 0 ? -error : 0;
1750 __entry->stateid_seq =
1751 be32_to_cpu(state->stateid.seqid);
1752 __entry->stateid_hash =
1753 nfs_stateid_hash(&state->stateid);
1754 if (!error) {
1755 __entry->layoutstateid_seq =
1756 be32_to_cpu(layout_stateid->seqid);
1757 __entry->layoutstateid_hash =
1758 nfs_stateid_hash(layout_stateid);
1759 } else {
1760 __entry->layoutstateid_seq = 0;
1761 __entry->layoutstateid_hash = 0;
1765 TP_printk(
1766 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1767 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1768 "layoutstateid=%d:0x%08x",
1769 -__entry->error,
1770 show_nfs4_status(__entry->error),
1771 MAJOR(__entry->dev), MINOR(__entry->dev),
1772 (unsigned long long)__entry->fileid,
1773 __entry->fhandle,
1774 show_pnfs_layout_iomode(__entry->iomode),
1775 (unsigned long long)__entry->offset,
1776 (unsigned long long)__entry->count,
1777 __entry->stateid_seq, __entry->stateid_hash,
1778 __entry->layoutstateid_seq, __entry->layoutstateid_hash
1782 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1783 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
1784 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn_on_close);
1785 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layouterror);
1786 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutstats);
1788 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN);
1789 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS);
1790 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN);
1791 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH);
1792 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM);
1793 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL);
1794 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL);
1795 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED);
1796 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN);
1797 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED);
1798 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN);
1799 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY);
1800 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
1801 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_EXIT);
1803 #define show_pnfs_update_layout_reason(reason) \
1804 __print_symbolic(reason, \
1805 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
1806 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
1807 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
1808 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
1809 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
1810 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
1811 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
1812 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
1813 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
1814 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
1815 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
1816 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
1817 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }, \
1818 { PNFS_UPDATE_LAYOUT_EXIT, "exit" })
1820 TRACE_EVENT(pnfs_update_layout,
1821 TP_PROTO(struct inode *inode,
1822 loff_t pos,
1823 u64 count,
1824 enum pnfs_iomode iomode,
1825 struct pnfs_layout_hdr *lo,
1826 struct pnfs_layout_segment *lseg,
1827 enum pnfs_update_layout_reason reason
1829 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
1830 TP_STRUCT__entry(
1831 __field(dev_t, dev)
1832 __field(u64, fileid)
1833 __field(u32, fhandle)
1834 __field(loff_t, pos)
1835 __field(u64, count)
1836 __field(enum pnfs_iomode, iomode)
1837 __field(int, layoutstateid_seq)
1838 __field(u32, layoutstateid_hash)
1839 __field(long, lseg)
1840 __field(enum pnfs_update_layout_reason, reason)
1842 TP_fast_assign(
1843 __entry->dev = inode->i_sb->s_dev;
1844 __entry->fileid = NFS_FILEID(inode);
1845 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1846 __entry->pos = pos;
1847 __entry->count = count;
1848 __entry->iomode = iomode;
1849 __entry->reason = reason;
1850 if (lo != NULL && pnfs_layout_is_valid(lo)) {
1851 __entry->layoutstateid_seq =
1852 be32_to_cpu(lo->plh_stateid.seqid);
1853 __entry->layoutstateid_hash =
1854 nfs_stateid_hash(&lo->plh_stateid);
1855 } else {
1856 __entry->layoutstateid_seq = 0;
1857 __entry->layoutstateid_hash = 0;
1859 __entry->lseg = (long)lseg;
1861 TP_printk(
1862 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1863 "iomode=%s pos=%llu count=%llu "
1864 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
1865 MAJOR(__entry->dev), MINOR(__entry->dev),
1866 (unsigned long long)__entry->fileid,
1867 __entry->fhandle,
1868 show_pnfs_layout_iomode(__entry->iomode),
1869 (unsigned long long)__entry->pos,
1870 (unsigned long long)__entry->count,
1871 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
1872 __entry->lseg,
1873 show_pnfs_update_layout_reason(__entry->reason)
1877 DECLARE_EVENT_CLASS(pnfs_layout_event,
1878 TP_PROTO(struct inode *inode,
1879 loff_t pos,
1880 u64 count,
1881 enum pnfs_iomode iomode,
1882 struct pnfs_layout_hdr *lo,
1883 struct pnfs_layout_segment *lseg
1885 TP_ARGS(inode, pos, count, iomode, lo, lseg),
1886 TP_STRUCT__entry(
1887 __field(dev_t, dev)
1888 __field(u64, fileid)
1889 __field(u32, fhandle)
1890 __field(loff_t, pos)
1891 __field(u64, count)
1892 __field(enum pnfs_iomode, iomode)
1893 __field(int, layoutstateid_seq)
1894 __field(u32, layoutstateid_hash)
1895 __field(long, lseg)
1897 TP_fast_assign(
1898 __entry->dev = inode->i_sb->s_dev;
1899 __entry->fileid = NFS_FILEID(inode);
1900 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1901 __entry->pos = pos;
1902 __entry->count = count;
1903 __entry->iomode = iomode;
1904 if (lo != NULL && pnfs_layout_is_valid(lo)) {
1905 __entry->layoutstateid_seq =
1906 be32_to_cpu(lo->plh_stateid.seqid);
1907 __entry->layoutstateid_hash =
1908 nfs_stateid_hash(&lo->plh_stateid);
1909 } else {
1910 __entry->layoutstateid_seq = 0;
1911 __entry->layoutstateid_hash = 0;
1913 __entry->lseg = (long)lseg;
1915 TP_printk(
1916 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1917 "iomode=%s pos=%llu count=%llu "
1918 "layoutstateid=%d:0x%08x lseg=0x%lx",
1919 MAJOR(__entry->dev), MINOR(__entry->dev),
1920 (unsigned long long)__entry->fileid,
1921 __entry->fhandle,
1922 show_pnfs_layout_iomode(__entry->iomode),
1923 (unsigned long long)__entry->pos,
1924 (unsigned long long)__entry->count,
1925 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
1926 __entry->lseg
1930 #define DEFINE_PNFS_LAYOUT_EVENT(name) \
1931 DEFINE_EVENT(pnfs_layout_event, name, \
1932 TP_PROTO(struct inode *inode, \
1933 loff_t pos, \
1934 u64 count, \
1935 enum pnfs_iomode iomode, \
1936 struct pnfs_layout_hdr *lo, \
1937 struct pnfs_layout_segment *lseg \
1938 ), \
1939 TP_ARGS(inode, pos, count, iomode, lo, lseg))
1941 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_read);
1942 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_write);
1943 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_get_mirror_count);
1944 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_done);
1945 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done);
1946 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist);
1947 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist);
1949 DECLARE_EVENT_CLASS(nfs4_deviceid_event,
1950 TP_PROTO(
1951 const struct nfs_client *clp,
1952 const struct nfs4_deviceid *deviceid
1955 TP_ARGS(clp, deviceid),
1957 TP_STRUCT__entry(
1958 __string(dstaddr, clp->cl_hostname)
1959 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE)
1962 TP_fast_assign(
1963 __assign_str(dstaddr);
1964 memcpy(__entry->deviceid, deviceid->data,
1965 NFS4_DEVICEID4_SIZE);
1968 TP_printk(
1969 "deviceid=%s, dstaddr=%s",
1970 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE),
1971 __get_str(dstaddr)
1974 #define DEFINE_PNFS_DEVICEID_EVENT(name) \
1975 DEFINE_EVENT(nfs4_deviceid_event, name, \
1976 TP_PROTO(const struct nfs_client *clp, \
1977 const struct nfs4_deviceid *deviceid \
1978 ), \
1979 TP_ARGS(clp, deviceid))
1980 DEFINE_PNFS_DEVICEID_EVENT(nfs4_deviceid_free);
1982 DECLARE_EVENT_CLASS(nfs4_deviceid_status,
1983 TP_PROTO(
1984 const struct nfs_server *server,
1985 const struct nfs4_deviceid *deviceid,
1986 int status
1989 TP_ARGS(server, deviceid, status),
1991 TP_STRUCT__entry(
1992 __field(dev_t, dev)
1993 __field(int, status)
1994 __string(dstaddr, server->nfs_client->cl_hostname)
1995 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE)
1998 TP_fast_assign(
1999 __entry->dev = server->s_dev;
2000 __entry->status = status;
2001 __assign_str(dstaddr);
2002 memcpy(__entry->deviceid, deviceid->data,
2003 NFS4_DEVICEID4_SIZE);
2006 TP_printk(
2007 "dev=%02x:%02x: deviceid=%s, dstaddr=%s, status=%d",
2008 MAJOR(__entry->dev), MINOR(__entry->dev),
2009 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE),
2010 __get_str(dstaddr),
2011 __entry->status
2014 #define DEFINE_PNFS_DEVICEID_STATUS(name) \
2015 DEFINE_EVENT(nfs4_deviceid_status, name, \
2016 TP_PROTO(const struct nfs_server *server, \
2017 const struct nfs4_deviceid *deviceid, \
2018 int status \
2019 ), \
2020 TP_ARGS(server, deviceid, status))
2021 DEFINE_PNFS_DEVICEID_STATUS(nfs4_getdeviceinfo);
2022 DEFINE_PNFS_DEVICEID_STATUS(nfs4_find_deviceid);
2024 TRACE_EVENT(fl_getdevinfo,
2025 TP_PROTO(
2026 const struct nfs_server *server,
2027 const struct nfs4_deviceid *deviceid,
2028 char *ds_remotestr
2030 TP_ARGS(server, deviceid, ds_remotestr),
2032 TP_STRUCT__entry(
2033 __string(mds_addr, server->nfs_client->cl_hostname)
2034 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE)
2035 __string(ds_ips, ds_remotestr)
2038 TP_fast_assign(
2039 __assign_str(mds_addr);
2040 __assign_str(ds_ips);
2041 memcpy(__entry->deviceid, deviceid->data,
2042 NFS4_DEVICEID4_SIZE);
2044 TP_printk(
2045 "deviceid=%s, mds_addr=%s, ds_ips=%s",
2046 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE),
2047 __get_str(mds_addr),
2048 __get_str(ds_ips)
2052 DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event,
2053 TP_PROTO(
2054 const struct nfs_pgio_header *hdr
2057 TP_ARGS(hdr),
2059 TP_STRUCT__entry(
2060 __field(unsigned long, error)
2061 __field(dev_t, dev)
2062 __field(u32, fhandle)
2063 __field(u64, fileid)
2064 __field(loff_t, offset)
2065 __field(u32, count)
2066 __field(int, stateid_seq)
2067 __field(u32, stateid_hash)
2068 __string(dstaddr, hdr->ds_clp ?
2069 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
2070 RPC_DISPLAY_ADDR) : "unknown")
2073 TP_fast_assign(
2074 const struct inode *inode = hdr->inode;
2076 __entry->error = hdr->res.op_status;
2077 __entry->fhandle = nfs_fhandle_hash(hdr->args.fh);
2078 __entry->fileid = NFS_FILEID(inode);
2079 __entry->dev = inode->i_sb->s_dev;
2080 __entry->offset = hdr->args.offset;
2081 __entry->count = hdr->args.count;
2082 __entry->stateid_seq =
2083 be32_to_cpu(hdr->args.stateid.seqid);
2084 __entry->stateid_hash =
2085 nfs_stateid_hash(&hdr->args.stateid);
2086 __assign_str(dstaddr);
2089 TP_printk(
2090 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2091 "offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s",
2092 -__entry->error,
2093 show_nfs4_status(__entry->error),
2094 MAJOR(__entry->dev), MINOR(__entry->dev),
2095 (unsigned long long)__entry->fileid,
2096 __entry->fhandle,
2097 __entry->offset, __entry->count,
2098 __entry->stateid_seq, __entry->stateid_hash,
2099 __get_str(dstaddr)
2103 #define DEFINE_NFS4_FLEXFILES_IO_EVENT(name) \
2104 DEFINE_EVENT(nfs4_flexfiles_io_event, name, \
2105 TP_PROTO( \
2106 const struct nfs_pgio_header *hdr \
2107 ), \
2108 TP_ARGS(hdr))
2109 DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_read_error);
2110 DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_write_error);
2112 TRACE_EVENT(ff_layout_commit_error,
2113 TP_PROTO(
2114 const struct nfs_commit_data *data
2117 TP_ARGS(data),
2119 TP_STRUCT__entry(
2120 __field(unsigned long, error)
2121 __field(dev_t, dev)
2122 __field(u32, fhandle)
2123 __field(u64, fileid)
2124 __field(loff_t, offset)
2125 __field(u32, count)
2126 __string(dstaddr, data->ds_clp ?
2127 rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
2128 RPC_DISPLAY_ADDR) : "unknown")
2131 TP_fast_assign(
2132 const struct inode *inode = data->inode;
2134 __entry->error = data->res.op_status;
2135 __entry->fhandle = nfs_fhandle_hash(data->args.fh);
2136 __entry->fileid = NFS_FILEID(inode);
2137 __entry->dev = inode->i_sb->s_dev;
2138 __entry->offset = data->args.offset;
2139 __entry->count = data->args.count;
2140 __assign_str(dstaddr);
2143 TP_printk(
2144 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2145 "offset=%llu count=%u dstaddr=%s",
2146 -__entry->error,
2147 show_nfs4_status(__entry->error),
2148 MAJOR(__entry->dev), MINOR(__entry->dev),
2149 (unsigned long long)__entry->fileid,
2150 __entry->fhandle,
2151 __entry->offset, __entry->count,
2152 __get_str(dstaddr)
2156 DECLARE_EVENT_CLASS(pnfs_bl_pr_key_class,
2157 TP_PROTO(
2158 const struct block_device *bdev,
2159 u64 key
2161 TP_ARGS(bdev, key),
2162 TP_STRUCT__entry(
2163 __field(u64, key)
2164 __field(dev_t, dev)
2165 __string(device, bdev->bd_disk->disk_name)
2167 TP_fast_assign(
2168 __entry->key = key;
2169 __entry->dev = bdev->bd_dev;
2170 __assign_str(device);
2172 TP_printk("dev=%d,%d (%s) key=0x%016llx",
2173 MAJOR(__entry->dev), MINOR(__entry->dev),
2174 __get_str(device), __entry->key
2178 #define DEFINE_NFS4_BLOCK_PRKEY_EVENT(name) \
2179 DEFINE_EVENT(pnfs_bl_pr_key_class, name, \
2180 TP_PROTO( \
2181 const struct block_device *bdev, \
2182 u64 key \
2183 ), \
2184 TP_ARGS(bdev, key))
2185 DEFINE_NFS4_BLOCK_PRKEY_EVENT(bl_pr_key_reg);
2186 DEFINE_NFS4_BLOCK_PRKEY_EVENT(bl_pr_key_unreg);
2189 * From uapi/linux/pr.h
2191 TRACE_DEFINE_ENUM(PR_STS_SUCCESS);
2192 TRACE_DEFINE_ENUM(PR_STS_IOERR);
2193 TRACE_DEFINE_ENUM(PR_STS_RESERVATION_CONFLICT);
2194 TRACE_DEFINE_ENUM(PR_STS_RETRY_PATH_FAILURE);
2195 TRACE_DEFINE_ENUM(PR_STS_PATH_FAST_FAILED);
2196 TRACE_DEFINE_ENUM(PR_STS_PATH_FAILED);
2198 #define show_pr_status(x) \
2199 __print_symbolic(x, \
2200 { PR_STS_SUCCESS, "SUCCESS" }, \
2201 { PR_STS_IOERR, "IOERR" }, \
2202 { PR_STS_RESERVATION_CONFLICT, "RESERVATION_CONFLICT" }, \
2203 { PR_STS_RETRY_PATH_FAILURE, "RETRY_PATH_FAILURE" }, \
2204 { PR_STS_PATH_FAST_FAILED, "PATH_FAST_FAILED" }, \
2205 { PR_STS_PATH_FAILED, "PATH_FAILED" })
2207 DECLARE_EVENT_CLASS(pnfs_bl_pr_key_err_class,
2208 TP_PROTO(
2209 const struct block_device *bdev,
2210 u64 key,
2211 int status
2213 TP_ARGS(bdev, key, status),
2214 TP_STRUCT__entry(
2215 __field(u64, key)
2216 __field(dev_t, dev)
2217 __field(unsigned long, status)
2218 __string(device, bdev->bd_disk->disk_name)
2220 TP_fast_assign(
2221 __entry->key = key;
2222 __entry->dev = bdev->bd_dev;
2223 __entry->status = status;
2224 __assign_str(device);
2226 TP_printk("dev=%d,%d (%s) key=0x%016llx status=%s",
2227 MAJOR(__entry->dev), MINOR(__entry->dev),
2228 __get_str(device), __entry->key,
2229 show_pr_status(__entry->status)
2233 #define DEFINE_NFS4_BLOCK_PRKEY_ERR_EVENT(name) \
2234 DEFINE_EVENT(pnfs_bl_pr_key_err_class, name, \
2235 TP_PROTO( \
2236 const struct block_device *bdev, \
2237 u64 key, \
2238 int status \
2239 ), \
2240 TP_ARGS(bdev, key, status))
2241 DEFINE_NFS4_BLOCK_PRKEY_ERR_EVENT(bl_pr_key_reg_err);
2242 DEFINE_NFS4_BLOCK_PRKEY_ERR_EVENT(bl_pr_key_unreg_err);
2244 #ifdef CONFIG_NFS_V4_2
2245 TRACE_DEFINE_ENUM(NFS4_CONTENT_DATA);
2246 TRACE_DEFINE_ENUM(NFS4_CONTENT_HOLE);
2248 #define show_llseek_mode(what) \
2249 __print_symbolic(what, \
2250 { NFS4_CONTENT_DATA, "DATA" }, \
2251 { NFS4_CONTENT_HOLE, "HOLE" })
2253 TRACE_EVENT(nfs4_llseek,
2254 TP_PROTO(
2255 const struct inode *inode,
2256 const struct nfs42_seek_args *args,
2257 const struct nfs42_seek_res *res,
2258 int error
2261 TP_ARGS(inode, args, res, error),
2263 TP_STRUCT__entry(
2264 __field(unsigned long, error)
2265 __field(u32, fhandle)
2266 __field(u32, fileid)
2267 __field(dev_t, dev)
2268 __field(int, stateid_seq)
2269 __field(u32, stateid_hash)
2270 __field(loff_t, offset_s)
2271 __field(u32, what)
2272 __field(loff_t, offset_r)
2273 __field(u32, eof)
2276 TP_fast_assign(
2277 const struct nfs_inode *nfsi = NFS_I(inode);
2278 const struct nfs_fh *fh = args->sa_fh;
2280 __entry->fileid = nfsi->fileid;
2281 __entry->dev = inode->i_sb->s_dev;
2282 __entry->fhandle = nfs_fhandle_hash(fh);
2283 __entry->offset_s = args->sa_offset;
2284 __entry->stateid_seq =
2285 be32_to_cpu(args->sa_stateid.seqid);
2286 __entry->stateid_hash =
2287 nfs_stateid_hash(&args->sa_stateid);
2288 __entry->what = args->sa_what;
2289 if (error) {
2290 __entry->error = -error;
2291 __entry->offset_r = 0;
2292 __entry->eof = 0;
2293 } else {
2294 __entry->error = 0;
2295 __entry->offset_r = res->sr_offset;
2296 __entry->eof = res->sr_eof;
2300 TP_printk(
2301 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2302 "stateid=%d:0x%08x offset_s=%llu what=%s "
2303 "offset_r=%llu eof=%u",
2304 -__entry->error,
2305 show_nfs4_status(__entry->error),
2306 MAJOR(__entry->dev), MINOR(__entry->dev),
2307 (unsigned long long)__entry->fileid,
2308 __entry->fhandle,
2309 __entry->stateid_seq, __entry->stateid_hash,
2310 __entry->offset_s,
2311 show_llseek_mode(__entry->what),
2312 __entry->offset_r,
2313 __entry->eof
2317 DECLARE_EVENT_CLASS(nfs4_sparse_event,
2318 TP_PROTO(
2319 const struct inode *inode,
2320 const struct nfs42_falloc_args *args,
2321 int error
2324 TP_ARGS(inode, args, error),
2326 TP_STRUCT__entry(
2327 __field(unsigned long, error)
2328 __field(loff_t, offset)
2329 __field(loff_t, len)
2330 __field(dev_t, dev)
2331 __field(u32, fhandle)
2332 __field(u64, fileid)
2333 __field(int, stateid_seq)
2334 __field(u32, stateid_hash)
2337 TP_fast_assign(
2338 __entry->error = error < 0 ? -error : 0;
2339 __entry->offset = args->falloc_offset;
2340 __entry->len = args->falloc_length;
2341 __entry->dev = inode->i_sb->s_dev;
2342 __entry->fileid = NFS_FILEID(inode);
2343 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2344 __entry->stateid_seq =
2345 be32_to_cpu(args->falloc_stateid.seqid);
2346 __entry->stateid_hash =
2347 nfs_stateid_hash(&args->falloc_stateid);
2350 TP_printk(
2351 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2352 "stateid=%d:0x%08x offset=%llu len=%llu",
2353 -__entry->error,
2354 show_nfs4_status(__entry->error),
2355 MAJOR(__entry->dev), MINOR(__entry->dev),
2356 (unsigned long long)__entry->fileid,
2357 __entry->fhandle,
2358 __entry->stateid_seq, __entry->stateid_hash,
2359 (long long)__entry->offset,
2360 (long long)__entry->len
2363 #define DEFINE_NFS4_SPARSE_EVENT(name) \
2364 DEFINE_EVENT(nfs4_sparse_event, name, \
2365 TP_PROTO( \
2366 const struct inode *inode, \
2367 const struct nfs42_falloc_args *args, \
2368 int error \
2369 ), \
2370 TP_ARGS(inode, args, error))
2371 DEFINE_NFS4_SPARSE_EVENT(nfs4_fallocate);
2372 DEFINE_NFS4_SPARSE_EVENT(nfs4_deallocate);
2374 TRACE_EVENT(nfs4_copy,
2375 TP_PROTO(
2376 const struct inode *src_inode,
2377 const struct inode *dst_inode,
2378 const struct nfs42_copy_args *args,
2379 const struct nfs42_copy_res *res,
2380 const struct nl4_server *nss,
2381 int error
2384 TP_ARGS(src_inode, dst_inode, args, res, nss, error),
2386 TP_STRUCT__entry(
2387 __field(unsigned long, error)
2388 __field(u32, src_fhandle)
2389 __field(u32, src_fileid)
2390 __field(u32, dst_fhandle)
2391 __field(u32, dst_fileid)
2392 __field(dev_t, src_dev)
2393 __field(dev_t, dst_dev)
2394 __field(int, src_stateid_seq)
2395 __field(u32, src_stateid_hash)
2396 __field(int, dst_stateid_seq)
2397 __field(u32, dst_stateid_hash)
2398 __field(loff_t, src_offset)
2399 __field(loff_t, dst_offset)
2400 __field(bool, sync)
2401 __field(loff_t, len)
2402 __field(int, res_stateid_seq)
2403 __field(u32, res_stateid_hash)
2404 __field(loff_t, res_count)
2405 __field(bool, res_sync)
2406 __field(bool, res_cons)
2407 __field(bool, intra)
2410 TP_fast_assign(
2411 const struct nfs_inode *src_nfsi = NFS_I(src_inode);
2412 const struct nfs_inode *dst_nfsi = NFS_I(dst_inode);
2414 __entry->src_fileid = src_nfsi->fileid;
2415 __entry->src_dev = src_inode->i_sb->s_dev;
2416 __entry->src_fhandle = nfs_fhandle_hash(args->src_fh);
2417 __entry->src_offset = args->src_pos;
2418 __entry->dst_fileid = dst_nfsi->fileid;
2419 __entry->dst_dev = dst_inode->i_sb->s_dev;
2420 __entry->dst_fhandle = nfs_fhandle_hash(args->dst_fh);
2421 __entry->dst_offset = args->dst_pos;
2422 __entry->len = args->count;
2423 __entry->sync = args->sync;
2424 __entry->src_stateid_seq =
2425 be32_to_cpu(args->src_stateid.seqid);
2426 __entry->src_stateid_hash =
2427 nfs_stateid_hash(&args->src_stateid);
2428 __entry->dst_stateid_seq =
2429 be32_to_cpu(args->dst_stateid.seqid);
2430 __entry->dst_stateid_hash =
2431 nfs_stateid_hash(&args->dst_stateid);
2432 __entry->intra = nss ? 0 : 1;
2433 if (error) {
2434 __entry->error = -error;
2435 __entry->res_stateid_seq = 0;
2436 __entry->res_stateid_hash = 0;
2437 __entry->res_count = 0;
2438 __entry->res_sync = 0;
2439 __entry->res_cons = 0;
2440 } else {
2441 __entry->error = 0;
2442 __entry->res_stateid_seq =
2443 be32_to_cpu(res->write_res.stateid.seqid);
2444 __entry->res_stateid_hash =
2445 nfs_stateid_hash(&res->write_res.stateid);
2446 __entry->res_count = res->write_res.count;
2447 __entry->res_sync = res->synchronous;
2448 __entry->res_cons = res->consecutive;
2452 TP_printk(
2453 "error=%ld (%s) intra=%d src_fileid=%02x:%02x:%llu "
2454 "src_fhandle=0x%08x dst_fileid=%02x:%02x:%llu "
2455 "dst_fhandle=0x%08x src_stateid=%d:0x%08x "
2456 "dst_stateid=%d:0x%08x src_offset=%llu dst_offset=%llu "
2457 "len=%llu sync=%d cb_stateid=%d:0x%08x res_sync=%d "
2458 "res_cons=%d res_count=%llu",
2459 -__entry->error,
2460 show_nfs4_status(__entry->error),
2461 __entry->intra,
2462 MAJOR(__entry->src_dev), MINOR(__entry->src_dev),
2463 (unsigned long long)__entry->src_fileid,
2464 __entry->src_fhandle,
2465 MAJOR(__entry->dst_dev), MINOR(__entry->dst_dev),
2466 (unsigned long long)__entry->dst_fileid,
2467 __entry->dst_fhandle,
2468 __entry->src_stateid_seq, __entry->src_stateid_hash,
2469 __entry->dst_stateid_seq, __entry->dst_stateid_hash,
2470 __entry->src_offset,
2471 __entry->dst_offset,
2472 __entry->len,
2473 __entry->sync,
2474 __entry->res_stateid_seq, __entry->res_stateid_hash,
2475 __entry->res_sync,
2476 __entry->res_cons,
2477 __entry->res_count
2481 TRACE_EVENT(nfs4_clone,
2482 TP_PROTO(
2483 const struct inode *src_inode,
2484 const struct inode *dst_inode,
2485 const struct nfs42_clone_args *args,
2486 int error
2489 TP_ARGS(src_inode, dst_inode, args, error),
2491 TP_STRUCT__entry(
2492 __field(unsigned long, error)
2493 __field(u32, src_fhandle)
2494 __field(u32, src_fileid)
2495 __field(u32, dst_fhandle)
2496 __field(u32, dst_fileid)
2497 __field(dev_t, src_dev)
2498 __field(dev_t, dst_dev)
2499 __field(loff_t, src_offset)
2500 __field(loff_t, dst_offset)
2501 __field(int, src_stateid_seq)
2502 __field(u32, src_stateid_hash)
2503 __field(int, dst_stateid_seq)
2504 __field(u32, dst_stateid_hash)
2505 __field(loff_t, len)
2508 TP_fast_assign(
2509 const struct nfs_inode *src_nfsi = NFS_I(src_inode);
2510 const struct nfs_inode *dst_nfsi = NFS_I(dst_inode);
2512 __entry->src_fileid = src_nfsi->fileid;
2513 __entry->src_dev = src_inode->i_sb->s_dev;
2514 __entry->src_fhandle = nfs_fhandle_hash(args->src_fh);
2515 __entry->src_offset = args->src_offset;
2516 __entry->dst_fileid = dst_nfsi->fileid;
2517 __entry->dst_dev = dst_inode->i_sb->s_dev;
2518 __entry->dst_fhandle = nfs_fhandle_hash(args->dst_fh);
2519 __entry->dst_offset = args->dst_offset;
2520 __entry->len = args->count;
2521 __entry->error = error < 0 ? -error : 0;
2522 __entry->src_stateid_seq =
2523 be32_to_cpu(args->src_stateid.seqid);
2524 __entry->src_stateid_hash =
2525 nfs_stateid_hash(&args->src_stateid);
2526 __entry->dst_stateid_seq =
2527 be32_to_cpu(args->dst_stateid.seqid);
2528 __entry->dst_stateid_hash =
2529 nfs_stateid_hash(&args->dst_stateid);
2532 TP_printk(
2533 "error=%ld (%s) src_fileid=%02x:%02x:%llu "
2534 "src_fhandle=0x%08x dst_fileid=%02x:%02x:%llu "
2535 "dst_fhandle=0x%08x src_stateid=%d:0x%08x "
2536 "dst_stateid=%d:0x%08x src_offset=%llu "
2537 "dst_offset=%llu len=%llu",
2538 -__entry->error,
2539 show_nfs4_status(__entry->error),
2540 MAJOR(__entry->src_dev), MINOR(__entry->src_dev),
2541 (unsigned long long)__entry->src_fileid,
2542 __entry->src_fhandle,
2543 MAJOR(__entry->dst_dev), MINOR(__entry->dst_dev),
2544 (unsigned long long)__entry->dst_fileid,
2545 __entry->dst_fhandle,
2546 __entry->src_stateid_seq, __entry->src_stateid_hash,
2547 __entry->dst_stateid_seq, __entry->dst_stateid_hash,
2548 __entry->src_offset,
2549 __entry->dst_offset,
2550 __entry->len
2554 TRACE_EVENT(nfs4_copy_notify,
2555 TP_PROTO(
2556 const struct inode *inode,
2557 const struct nfs42_copy_notify_args *args,
2558 const struct nfs42_copy_notify_res *res,
2559 int error
2562 TP_ARGS(inode, args, res, error),
2564 TP_STRUCT__entry(
2565 __field(unsigned long, error)
2566 __field(u32, fhandle)
2567 __field(u32, fileid)
2568 __field(dev_t, dev)
2569 __field(int, stateid_seq)
2570 __field(u32, stateid_hash)
2571 __field(int, res_stateid_seq)
2572 __field(u32, res_stateid_hash)
2575 TP_fast_assign(
2576 const struct nfs_inode *nfsi = NFS_I(inode);
2578 __entry->fileid = nfsi->fileid;
2579 __entry->dev = inode->i_sb->s_dev;
2580 __entry->fhandle = nfs_fhandle_hash(args->cna_src_fh);
2581 __entry->stateid_seq =
2582 be32_to_cpu(args->cna_src_stateid.seqid);
2583 __entry->stateid_hash =
2584 nfs_stateid_hash(&args->cna_src_stateid);
2585 if (error) {
2586 __entry->error = -error;
2587 __entry->res_stateid_seq = 0;
2588 __entry->res_stateid_hash = 0;
2589 } else {
2590 __entry->error = 0;
2591 __entry->res_stateid_seq =
2592 be32_to_cpu(res->cnr_stateid.seqid);
2593 __entry->res_stateid_hash =
2594 nfs_stateid_hash(&res->cnr_stateid);
2598 TP_printk(
2599 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2600 "stateid=%d:0x%08x res_stateid=%d:0x%08x",
2601 -__entry->error,
2602 show_nfs4_status(__entry->error),
2603 MAJOR(__entry->dev), MINOR(__entry->dev),
2604 (unsigned long long)__entry->fileid,
2605 __entry->fhandle,
2606 __entry->stateid_seq, __entry->stateid_hash,
2607 __entry->res_stateid_seq, __entry->res_stateid_hash
2611 TRACE_EVENT(nfs4_offload_cancel,
2612 TP_PROTO(
2613 const struct nfs42_offload_status_args *args,
2614 int error
2617 TP_ARGS(args, error),
2619 TP_STRUCT__entry(
2620 __field(unsigned long, error)
2621 __field(u32, fhandle)
2622 __field(int, stateid_seq)
2623 __field(u32, stateid_hash)
2626 TP_fast_assign(
2627 __entry->fhandle = nfs_fhandle_hash(args->osa_src_fh);
2628 __entry->error = error < 0 ? -error : 0;
2629 __entry->stateid_seq =
2630 be32_to_cpu(args->osa_stateid.seqid);
2631 __entry->stateid_hash =
2632 nfs_stateid_hash(&args->osa_stateid);
2635 TP_printk(
2636 "error=%ld (%s) fhandle=0x%08x stateid=%d:0x%08x",
2637 -__entry->error,
2638 show_nfs4_status(__entry->error),
2639 __entry->fhandle,
2640 __entry->stateid_seq, __entry->stateid_hash
2644 DECLARE_EVENT_CLASS(nfs4_xattr_event,
2645 TP_PROTO(
2646 const struct inode *inode,
2647 const char *name,
2648 int error
2651 TP_ARGS(inode, name, error),
2653 TP_STRUCT__entry(
2654 __field(unsigned long, error)
2655 __field(dev_t, dev)
2656 __field(u32, fhandle)
2657 __field(u64, fileid)
2658 __string(name, name)
2661 TP_fast_assign(
2662 __entry->error = error < 0 ? -error : 0;
2663 __entry->dev = inode->i_sb->s_dev;
2664 __entry->fileid = NFS_FILEID(inode);
2665 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2666 __assign_str(name);
2669 TP_printk(
2670 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2671 "name=%s",
2672 -__entry->error, show_nfs4_status(__entry->error),
2673 MAJOR(__entry->dev), MINOR(__entry->dev),
2674 (unsigned long long)__entry->fileid,
2675 __entry->fhandle, __get_str(name)
2678 #define DEFINE_NFS4_XATTR_EVENT(name) \
2679 DEFINE_EVENT(nfs4_xattr_event, name, \
2680 TP_PROTO( \
2681 const struct inode *inode, \
2682 const char *name, \
2683 int error \
2684 ), \
2685 TP_ARGS(inode, name, error))
2686 DEFINE_NFS4_XATTR_EVENT(nfs4_getxattr);
2687 DEFINE_NFS4_XATTR_EVENT(nfs4_setxattr);
2688 DEFINE_NFS4_XATTR_EVENT(nfs4_removexattr);
2690 DEFINE_NFS4_INODE_EVENT(nfs4_listxattr);
2691 #endif /* CONFIG_NFS_V4_2 */
2693 #endif /* CONFIG_NFS_V4_1 */
2695 #endif /* _TRACE_NFS4_H */
2697 #undef TRACE_INCLUDE_PATH
2698 #define TRACE_INCLUDE_PATH .
2699 #define TRACE_INCLUDE_FILE nfs4trace
2700 /* This part must be outside protection */
2701 #include <trace/define_trace.h>