blob: 6ee6ad3674a29734bdb7b3bcda5134684634acc8 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Trond Myklebustc6d01c62013-08-09 11:51:26 -04002/*
3 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
4 */
5#undef TRACE_SYSTEM
6#define TRACE_SYSTEM nfs4
7
8#if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
9#define _TRACE_NFS4_H
10
11#include <linux/tracepoint.h>
Chuck Leverb4776a32021-10-16 18:02:24 -040012#include <trace/events/sunrpc_base.h>
Trond Myklebustc6d01c62013-08-09 11:51:26 -040013
Chuck Lever9d2d48b2021-10-22 16:16:56 -040014#include <trace/events/fs.h>
Chuck Lever87915452021-10-22 16:17:03 -040015#include <trace/events/nfs.h>
Trond Myklebustc6d01c62013-08-09 11:51:26 -040016
Trond Myklebustb5f875a2013-08-13 13:01:39 -040017#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" })
34
Trond Myklebustc6d01c62013-08-09 11:51:26 -040035DECLARE_EVENT_CLASS(nfs4_clientid_event,
36 TP_PROTO(
37 const struct nfs_client *clp,
38 int error
39 ),
40
41 TP_ARGS(clp, error),
42
43 TP_STRUCT__entry(
Anna Schumaker39443692017-11-01 15:48:43 -040044 __string(dstaddr, clp->cl_hostname)
Chuck Lever96650e22019-06-19 10:33:53 -040045 __field(unsigned long, error)
Trond Myklebustc6d01c62013-08-09 11:51:26 -040046 ),
47
48 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -050049 __entry->error = error < 0 ? -error : 0;
Anna Schumaker39443692017-11-01 15:48:43 -040050 __assign_str(dstaddr, clp->cl_hostname);
Trond Myklebustc6d01c62013-08-09 11:51:26 -040051 ),
52
53 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -040054 "error=%ld (%s) dstaddr=%s",
55 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -040056 show_nfs4_status(__entry->error),
Trond Myklebustc6d01c62013-08-09 11:51:26 -040057 __get_str(dstaddr)
58 )
59);
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))
67DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
68DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
69DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
70DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
71#ifdef CONFIG_NFS_V4_1
72DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
73DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
74DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
75DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
76DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
77DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
78DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
Trond Myklebust2f92ae32013-08-14 17:58:28 -040079
Trond Myklebust2f92ae32013-08-14 17:58:28 -040080TRACE_EVENT(nfs4_sequence_done,
81 TP_PROTO(
82 const struct nfs4_session *session,
83 const struct nfs4_sequence_res *res
84 ),
85 TP_ARGS(session, res),
86
87 TP_STRUCT__entry(
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)
Chuck Lever87915452021-10-22 16:17:03 -040093 __field(unsigned long, status_flags)
Chuck Lever96650e22019-06-19 10:33:53 -040094 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -040095 ),
96
97 TP_fast_assign(
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;
Andrew Elble52618df2015-12-02 09:19:43 -0500105 __entry->status_flags = res->sr_status_flags;
Trond Myklebust118b6292020-01-06 15:25:06 -0500106 __entry->error = res->sr_status < 0 ?
107 -res->sr_status : 0;
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400108 ),
109 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400110 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400111 "highest_slotid=%u target_highest_slotid=%u "
Chuck Lever87915452021-10-22 16:17:03 -0400112 "status_flags=0x%lx (%s)",
Chuck Lever96650e22019-06-19 10:33:53 -0400113 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -0400114 show_nfs4_status(__entry->error),
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400115 __entry->session,
116 __entry->slot_nr,
117 __entry->seq_nr,
118 __entry->highest_slotid,
119 __entry->target_highest_slotid,
120 __entry->status_flags,
Chuck Lever87915452021-10-22 16:17:03 -0400121 show_nfs4_seq4_status(__entry->status_flags)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400122 )
123);
124
125struct cb_sequenceargs;
126struct cb_sequenceres;
127
128TRACE_EVENT(nfs4_cb_sequence,
129 TP_PROTO(
130 const struct cb_sequenceargs *args,
131 const struct cb_sequenceres *res,
132 __be32 status
133 ),
134 TP_ARGS(args, res, status),
135
136 TP_STRUCT__entry(
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)
Chuck Lever96650e22019-06-19 10:33:53 -0400142 __field(unsigned long, error)
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400143 ),
144
145 TP_fast_assign(
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;
Chuck Lever96650e22019-06-19 10:33:53 -0400151 __entry->error = be32_to_cpu(status);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400152 ),
153
154 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400155 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400156 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400157 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -0400158 show_nfs4_status(__entry->error),
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400159 __entry->session,
160 __entry->slot_nr,
161 __entry->seq_nr,
162 __entry->highest_slotid
163 )
164);
Chuck Leverc5833f02019-06-19 10:33:47 -0400165
166TRACE_EVENT(nfs4_cb_seqid_err,
167 TP_PROTO(
168 const struct cb_sequenceargs *args,
169 __be32 status
170 ),
171 TP_ARGS(args, status),
172
173 TP_STRUCT__entry(
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)
Chuck Lever96650e22019-06-19 10:33:53 -0400179 __field(unsigned long, error)
Chuck Leverc5833f02019-06-19 10:33:47 -0400180 ),
181
182 TP_fast_assign(
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;
Chuck Lever96650e22019-06-19 10:33:53 -0400188 __entry->error = be32_to_cpu(status);
Chuck Leverc5833f02019-06-19 10:33:47 -0400189 ),
190
191 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400192 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u "
Chuck Leverc5833f02019-06-19 10:33:47 -0400193 "highest_slotid=%u",
Chuck Lever96650e22019-06-19 10:33:53 -0400194 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -0400195 show_nfs4_status(__entry->error),
Chuck Leverc5833f02019-06-19 10:33:47 -0400196 __entry->session,
197 __entry->slot_nr,
198 __entry->seq_nr,
199 __entry->highest_slotid
200 )
201);
202
Olga Kornievskaia8db744c2021-11-04 10:57:12 -0400203TRACE_EVENT(nfs4_cb_offload,
204 TP_PROTO(
205 const struct nfs_fh *cb_fh,
206 const nfs4_stateid *cb_stateid,
207 uint64_t cb_count,
208 int cb_error,
209 int cb_how_stable
210 ),
211
212 TP_ARGS(cb_fh, cb_stateid, cb_count, cb_error,
213 cb_how_stable),
214
215 TP_STRUCT__entry(
216 __field(unsigned long, error)
217 __field(u32, fhandle)
218 __field(loff_t, cb_count)
219 __field(int, cb_how)
220 __field(int, cb_stateid_seq)
221 __field(u32, cb_stateid_hash)
222 ),
223
224 TP_fast_assign(
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;
233 ),
234
235 TP_printk(
236 "error=%ld (%s) fhandle=0x%08x cb_stateid=%d:0x%08x "
237 "cb_count=%llu cb_how=%s",
238 -__entry->error,
239 show_nfs4_status(__entry->error),
240 __entry->fhandle,
241 __entry->cb_stateid_seq, __entry->cb_stateid_hash,
242 __entry->cb_count,
243 show_nfs_stable_how(__entry->cb_how)
244 )
245);
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400246#endif /* CONFIG_NFS_V4_1 */
247
Anna Schumakerad05cc02017-01-11 13:37:06 -0500248TRACE_EVENT(nfs4_setup_sequence,
249 TP_PROTO(
250 const struct nfs4_session *session,
251 const struct nfs4_sequence_args *args
252 ),
253 TP_ARGS(session, args),
254
255 TP_STRUCT__entry(
256 __field(unsigned int, session)
257 __field(unsigned int, slot_nr)
258 __field(unsigned int, seq_nr)
259 __field(unsigned int, highest_used_slotid)
260 ),
261
262 TP_fast_assign(
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;
269 ),
270 TP_printk(
271 "session=0x%08x slot_nr=%u seq_nr=%u "
272 "highest_used_slotid=%u",
273 __entry->session,
274 __entry->slot_nr,
275 __entry->seq_nr,
276 __entry->highest_used_slotid
277 )
278);
279
Chuck Lever511ba522019-11-05 11:04:07 -0500280TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_RUNNING);
281TRACE_DEFINE_ENUM(NFS4CLNT_CHECK_LEASE);
282TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_EXPIRED);
283TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_REBOOT);
284TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_NOGRACE);
285TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN);
286TRACE_DEFINE_ENUM(NFS4CLNT_SESSION_RESET);
287TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_CONFIRM);
288TRACE_DEFINE_ENUM(NFS4CLNT_SERVER_SCOPE_MISMATCH);
289TRACE_DEFINE_ENUM(NFS4CLNT_PURGE_STATE);
290TRACE_DEFINE_ENUM(NFS4CLNT_BIND_CONN_TO_SESSION);
291TRACE_DEFINE_ENUM(NFS4CLNT_MOVED);
292TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_MOVED);
293TRACE_DEFINE_ENUM(NFS4CLNT_DELEGATION_EXPIRED);
294TRACE_DEFINE_ENUM(NFS4CLNT_RUN_MANAGER);
Trond Myklebustb5fdf842020-02-18 15:58:31 -0500295TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_RUNNING);
296TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_READ);
297TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_RW);
Chuck Lever511ba522019-11-05 11:04:07 -0500298
299#define show_nfs4_clp_state(state) \
300 __print_flags(state, "|", \
301 { NFS4CLNT_MANAGER_RUNNING, "MANAGER_RUNNING" }, \
302 { NFS4CLNT_CHECK_LEASE, "CHECK_LEASE" }, \
303 { NFS4CLNT_LEASE_EXPIRED, "LEASE_EXPIRED" }, \
304 { NFS4CLNT_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
305 { NFS4CLNT_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
306 { NFS4CLNT_DELEGRETURN, "DELEGRETURN" }, \
307 { NFS4CLNT_SESSION_RESET, "SESSION_RESET" }, \
308 { NFS4CLNT_LEASE_CONFIRM, "LEASE_CONFIRM" }, \
309 { NFS4CLNT_SERVER_SCOPE_MISMATCH, \
310 "SERVER_SCOPE_MISMATCH" }, \
311 { NFS4CLNT_PURGE_STATE, "PURGE_STATE" }, \
312 { NFS4CLNT_BIND_CONN_TO_SESSION, \
313 "BIND_CONN_TO_SESSION" }, \
314 { NFS4CLNT_MOVED, "MOVED" }, \
315 { NFS4CLNT_LEASE_MOVED, "LEASE_MOVED" }, \
316 { NFS4CLNT_DELEGATION_EXPIRED, "DELEGATION_EXPIRED" }, \
317 { NFS4CLNT_RUN_MANAGER, "RUN_MANAGER" }, \
Trond Myklebustb5fdf842020-02-18 15:58:31 -0500318 { NFS4CLNT_RECALL_RUNNING, "RECALL_RUNNING" }, \
319 { NFS4CLNT_RECALL_ANY_LAYOUT_READ, "RECALL_ANY_LAYOUT_READ" }, \
320 { NFS4CLNT_RECALL_ANY_LAYOUT_RW, "RECALL_ANY_LAYOUT_RW" })
Chuck Lever511ba522019-11-05 11:04:07 -0500321
322TRACE_EVENT(nfs4_state_mgr,
323 TP_PROTO(
324 const struct nfs_client *clp
325 ),
326
327 TP_ARGS(clp),
328
329 TP_STRUCT__entry(
330 __field(unsigned long, state)
331 __string(hostname, clp->cl_hostname)
332 ),
333
334 TP_fast_assign(
335 __entry->state = clp->cl_state;
Joe Perches78c14b32021-06-12 08:42:27 -0700336 __assign_str(hostname, clp->cl_hostname);
Chuck Lever511ba522019-11-05 11:04:07 -0500337 ),
338
339 TP_printk(
340 "hostname=%s clp state=%s", __get_str(hostname),
341 show_nfs4_clp_state(__entry->state)
342 )
343)
344
345TRACE_EVENT(nfs4_state_mgr_failed,
346 TP_PROTO(
347 const struct nfs_client *clp,
348 const char *section,
349 int status
350 ),
351
352 TP_ARGS(clp, section, status),
353
354 TP_STRUCT__entry(
355 __field(unsigned long, error)
356 __field(unsigned long, state)
357 __string(hostname, clp->cl_hostname)
358 __string(section, section)
359 ),
360
361 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -0500362 __entry->error = status < 0 ? -status : 0;
Chuck Lever511ba522019-11-05 11:04:07 -0500363 __entry->state = clp->cl_state;
364 __assign_str(hostname, clp->cl_hostname);
365 __assign_str(section, section);
366 ),
367
368 TP_printk(
369 "hostname=%s clp state=%s error=%ld (%s) section=%s",
370 __get_str(hostname),
371 show_nfs4_clp_state(__entry->state), -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -0400372 show_nfs4_status(__entry->error), __get_str(section)
Chuck Lever511ba522019-11-05 11:04:07 -0500373
374 )
375)
376
Trond Myklebustda934ae2021-04-01 14:38:13 -0400377TRACE_EVENT(nfs4_xdr_bad_operation,
378 TP_PROTO(
379 const struct xdr_stream *xdr,
380 u32 op,
381 u32 expected
382 ),
383
384 TP_ARGS(xdr, op, expected),
385
386 TP_STRUCT__entry(
387 __field(unsigned int, task_id)
388 __field(unsigned int, client_id)
389 __field(u32, xid)
390 __field(u32, op)
391 __field(u32, expected)
392 ),
393
394 TP_fast_assign(
395 const struct rpc_rqst *rqstp = xdr->rqst;
396 const struct rpc_task *task = rqstp->rq_task;
397
398 __entry->task_id = task->tk_pid;
399 __entry->client_id = task->tk_client->cl_clid;
400 __entry->xid = be32_to_cpu(rqstp->rq_xid);
401 __entry->op = op;
402 __entry->expected = expected;
403 ),
404
Chuck Leverb4776a32021-10-16 18:02:24 -0400405 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
406 " xid=0x%08x operation=%u, expected=%u",
Trond Myklebustda934ae2021-04-01 14:38:13 -0400407 __entry->task_id, __entry->client_id, __entry->xid,
408 __entry->op, __entry->expected
409 )
410);
411
Trond Myklebust3d66bae2021-04-01 13:54:19 -0400412DECLARE_EVENT_CLASS(nfs4_xdr_event,
Chuck Leverf23f6582019-02-11 11:24:26 -0500413 TP_PROTO(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400414 const struct xdr_stream *xdr,
Chuck Leverf23f6582019-02-11 11:24:26 -0500415 u32 op,
Trond Myklebust118b6292020-01-06 15:25:06 -0500416 u32 error
Chuck Leverf23f6582019-02-11 11:24:26 -0500417 ),
418
Chuck Lever62a92ba2019-06-19 10:34:09 -0400419 TP_ARGS(xdr, op, error),
Chuck Leverf23f6582019-02-11 11:24:26 -0500420
421 TP_STRUCT__entry(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400422 __field(unsigned int, task_id)
423 __field(unsigned int, client_id)
424 __field(u32, xid)
Chuck Leverf23f6582019-02-11 11:24:26 -0500425 __field(u32, op)
Chuck Lever96650e22019-06-19 10:33:53 -0400426 __field(unsigned long, error)
Chuck Leverf23f6582019-02-11 11:24:26 -0500427 ),
428
429 TP_fast_assign(
Chuck Lever62a92ba2019-06-19 10:34:09 -0400430 const struct rpc_rqst *rqstp = xdr->rqst;
431 const struct rpc_task *task = rqstp->rq_task;
432
433 __entry->task_id = task->tk_pid;
434 __entry->client_id = task->tk_client->cl_clid;
435 __entry->xid = be32_to_cpu(rqstp->rq_xid);
Chuck Leverf23f6582019-02-11 11:24:26 -0500436 __entry->op = op;
Chuck Lever96650e22019-06-19 10:33:53 -0400437 __entry->error = error;
Chuck Leverf23f6582019-02-11 11:24:26 -0500438 ),
439
Chuck Leverb4776a32021-10-16 18:02:24 -0400440 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
441 " xid=0x%08x error=%ld (%s) operation=%u",
Chuck Lever62a92ba2019-06-19 10:34:09 -0400442 __entry->task_id, __entry->client_id, __entry->xid,
Chuck Lever87915452021-10-22 16:17:03 -0400443 -__entry->error, show_nfs4_status(__entry->error),
Chuck Lever96650e22019-06-19 10:33:53 -0400444 __entry->op
Chuck Leverf23f6582019-02-11 11:24:26 -0500445 )
446);
Trond Myklebust3d66bae2021-04-01 13:54:19 -0400447#define DEFINE_NFS4_XDR_EVENT(name) \
448 DEFINE_EVENT(nfs4_xdr_event, name, \
449 TP_PROTO( \
450 const struct xdr_stream *xdr, \
451 u32 op, \
452 u32 error \
453 ), \
454 TP_ARGS(xdr, op, error))
455DEFINE_NFS4_XDR_EVENT(nfs4_xdr_status);
Trond Myklebusteb3d58c2021-04-01 14:03:26 -0400456DEFINE_NFS4_XDR_EVENT(nfs4_xdr_bad_filehandle);
Chuck Leverf23f6582019-02-11 11:24:26 -0500457
Chuck Lever2bb50aa2019-12-23 10:28:38 -0500458DECLARE_EVENT_CLASS(nfs4_cb_error_class,
459 TP_PROTO(
460 __be32 xid,
461 u32 cb_ident
462 ),
463
464 TP_ARGS(xid, cb_ident),
465
466 TP_STRUCT__entry(
467 __field(u32, xid)
468 __field(u32, cbident)
469 ),
470
471 TP_fast_assign(
472 __entry->xid = be32_to_cpu(xid);
473 __entry->cbident = cb_ident;
474 ),
475
476 TP_printk(
477 "xid=0x%08x cb_ident=0x%08x",
478 __entry->xid, __entry->cbident
479 )
480);
481
482#define DEFINE_CB_ERROR_EVENT(name) \
483 DEFINE_EVENT(nfs4_cb_error_class, nfs_cb_##name, \
484 TP_PROTO( \
485 __be32 xid, \
486 u32 cb_ident \
487 ), \
488 TP_ARGS(xid, cb_ident))
489
490DEFINE_CB_ERROR_EVENT(no_clp);
491DEFINE_CB_ERROR_EVENT(badprinc);
492
Trond Myklebust42113a72013-08-12 16:19:27 -0400493DECLARE_EVENT_CLASS(nfs4_open_event,
494 TP_PROTO(
495 const struct nfs_open_context *ctx,
496 int flags,
497 int error
498 ),
499
500 TP_ARGS(ctx, flags, error),
501
502 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400503 __field(unsigned long, error)
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400504 __field(unsigned long, flags)
505 __field(unsigned long, fmode)
Trond Myklebust42113a72013-08-12 16:19:27 -0400506 __field(dev_t, dev)
507 __field(u32, fhandle)
508 __field(u64, fileid)
509 __field(u64, dir)
510 __string(name, ctx->dentry->d_name.name)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500511 __field(int, stateid_seq)
512 __field(u32, stateid_hash)
513 __field(int, openstateid_seq)
514 __field(u32, openstateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400515 ),
516
517 TP_fast_assign(
518 const struct nfs4_state *state = ctx->state;
519 const struct inode *inode = NULL;
520
Chuck Lever96650e22019-06-19 10:33:53 -0400521 __entry->error = -error;
Trond Myklebust42113a72013-08-12 16:19:27 -0400522 __entry->flags = flags;
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400523 __entry->fmode = (__force unsigned long)ctx->mode;
Trond Myklebust42113a72013-08-12 16:19:27 -0400524 __entry->dev = ctx->dentry->d_sb->s_dev;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500525 if (!IS_ERR_OR_NULL(state)) {
Trond Myklebust42113a72013-08-12 16:19:27 -0400526 inode = state->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500527 __entry->stateid_seq =
528 be32_to_cpu(state->stateid.seqid);
529 __entry->stateid_hash =
530 nfs_stateid_hash(&state->stateid);
531 __entry->openstateid_seq =
532 be32_to_cpu(state->open_stateid.seqid);
533 __entry->openstateid_hash =
534 nfs_stateid_hash(&state->open_stateid);
535 } else {
536 __entry->stateid_seq = 0;
537 __entry->stateid_hash = 0;
538 __entry->openstateid_seq = 0;
539 __entry->openstateid_hash = 0;
540 }
Trond Myklebust42113a72013-08-12 16:19:27 -0400541 if (inode != NULL) {
542 __entry->fileid = NFS_FILEID(inode);
543 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
544 } else {
545 __entry->fileid = 0;
546 __entry->fhandle = 0;
547 }
David Howells2b0143b2015-03-17 22:25:59 +0000548 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
Trond Myklebust42113a72013-08-12 16:19:27 -0400549 __assign_str(name, ctx->dentry->d_name.name);
550 ),
551
552 TP_printk(
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400553 "error=%ld (%s) flags=%lu (%s) fmode=%s "
Trond Myklebust42113a72013-08-12 16:19:27 -0400554 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500555 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
556 "openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400557 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -0400558 show_nfs4_status(__entry->error),
Trond Myklebust42113a72013-08-12 16:19:27 -0400559 __entry->flags,
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400560 show_fs_fcntl_open_flags(__entry->flags),
561 show_fs_fmode_flags(__entry->fmode),
Trond Myklebust42113a72013-08-12 16:19:27 -0400562 MAJOR(__entry->dev), MINOR(__entry->dev),
563 (unsigned long long)__entry->fileid,
564 __entry->fhandle,
565 MAJOR(__entry->dev), MINOR(__entry->dev),
566 (unsigned long long)__entry->dir,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500567 __get_str(name),
568 __entry->stateid_seq, __entry->stateid_hash,
569 __entry->openstateid_seq, __entry->openstateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400570 )
571);
572
573#define DEFINE_NFS4_OPEN_EVENT(name) \
574 DEFINE_EVENT(nfs4_open_event, name, \
575 TP_PROTO( \
576 const struct nfs_open_context *ctx, \
577 int flags, \
578 int error \
579 ), \
580 TP_ARGS(ctx, flags, error))
581DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
582DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
583DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
584
Olga Kornievskaia9759b0f2015-11-24 13:29:42 -0500585TRACE_EVENT(nfs4_cached_open,
586 TP_PROTO(
587 const struct nfs4_state *state
588 ),
589 TP_ARGS(state),
590 TP_STRUCT__entry(
591 __field(dev_t, dev)
592 __field(u32, fhandle)
593 __field(u64, fileid)
594 __field(unsigned int, fmode)
595 __field(int, stateid_seq)
596 __field(u32, stateid_hash)
597 ),
598
599 TP_fast_assign(
600 const struct inode *inode = state->inode;
601
602 __entry->dev = inode->i_sb->s_dev;
603 __entry->fileid = NFS_FILEID(inode);
604 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
605 __entry->fmode = (__force unsigned int)state->state;
606 __entry->stateid_seq =
607 be32_to_cpu(state->stateid.seqid);
608 __entry->stateid_hash =
609 nfs_stateid_hash(&state->stateid);
610 ),
611
612 TP_printk(
613 "fmode=%s fileid=%02x:%02x:%llu "
614 "fhandle=0x%08x stateid=%d:0x%08x",
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400615 __entry->fmode ? show_fs_fmode_flags(__entry->fmode) :
Olga Kornievskaia9759b0f2015-11-24 13:29:42 -0500616 "closed",
617 MAJOR(__entry->dev), MINOR(__entry->dev),
618 (unsigned long long)__entry->fileid,
619 __entry->fhandle,
620 __entry->stateid_seq, __entry->stateid_hash
621 )
622);
623
Trond Myklebust42113a72013-08-12 16:19:27 -0400624TRACE_EVENT(nfs4_close,
625 TP_PROTO(
626 const struct nfs4_state *state,
627 const struct nfs_closeargs *args,
628 const struct nfs_closeres *res,
629 int error
630 ),
631
632 TP_ARGS(state, args, res, error),
633
634 TP_STRUCT__entry(
635 __field(dev_t, dev)
636 __field(u32, fhandle)
637 __field(u64, fileid)
638 __field(unsigned int, fmode)
Chuck Lever96650e22019-06-19 10:33:53 -0400639 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500640 __field(int, stateid_seq)
641 __field(u32, stateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400642 ),
643
644 TP_fast_assign(
645 const struct inode *inode = state->inode;
646
647 __entry->dev = inode->i_sb->s_dev;
648 __entry->fileid = NFS_FILEID(inode);
649 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
650 __entry->fmode = (__force unsigned int)state->state;
Trond Myklebust118b6292020-01-06 15:25:06 -0500651 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500652 __entry->stateid_seq =
653 be32_to_cpu(args->stateid.seqid);
654 __entry->stateid_hash =
655 nfs_stateid_hash(&args->stateid);
Trond Myklebust42113a72013-08-12 16:19:27 -0400656 ),
657
658 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400659 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500660 "fhandle=0x%08x openstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400661 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -0400662 show_nfs4_status(__entry->error),
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400663 __entry->fmode ? show_fs_fmode_flags(__entry->fmode) :
Trond Myklebust42113a72013-08-12 16:19:27 -0400664 "closed",
665 MAJOR(__entry->dev), MINOR(__entry->dev),
666 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500667 __entry->fhandle,
668 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400669 )
670);
671
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400672DECLARE_EVENT_CLASS(nfs4_lock_event,
673 TP_PROTO(
674 const struct file_lock *request,
675 const struct nfs4_state *state,
676 int cmd,
677 int error
678 ),
679
680 TP_ARGS(request, state, cmd, error),
681
682 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400683 __field(unsigned long, error)
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400684 __field(unsigned long, cmd)
685 __field(unsigned long, type)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400686 __field(loff_t, start)
687 __field(loff_t, end)
688 __field(dev_t, dev)
689 __field(u32, fhandle)
690 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500691 __field(int, stateid_seq)
692 __field(u32, stateid_hash)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400693 ),
694
695 TP_fast_assign(
696 const struct inode *inode = state->inode;
697
Trond Myklebust118b6292020-01-06 15:25:06 -0500698 __entry->error = error < 0 ? -error : 0;
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400699 __entry->cmd = cmd;
700 __entry->type = request->fl_type;
701 __entry->start = request->fl_start;
702 __entry->end = request->fl_end;
703 __entry->dev = inode->i_sb->s_dev;
704 __entry->fileid = NFS_FILEID(inode);
705 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500706 __entry->stateid_seq =
707 be32_to_cpu(state->stateid.seqid);
708 __entry->stateid_hash =
709 nfs_stateid_hash(&state->stateid);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400710 ),
711
712 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400713 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500714 "fileid=%02x:%02x:%llu fhandle=0x%08x "
715 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400716 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -0400717 show_nfs4_status(__entry->error),
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400718 show_fs_fcntl_cmd(__entry->cmd),
719 show_fs_fcntl_lock_type(__entry->type),
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400720 (long long)__entry->start,
721 (long long)__entry->end,
722 MAJOR(__entry->dev), MINOR(__entry->dev),
723 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500724 __entry->fhandle,
725 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400726 )
727);
728
729#define DEFINE_NFS4_LOCK_EVENT(name) \
730 DEFINE_EVENT(nfs4_lock_event, name, \
731 TP_PROTO( \
732 const struct file_lock *request, \
733 const struct nfs4_state *state, \
734 int cmd, \
735 int error \
736 ), \
737 TP_ARGS(request, state, cmd, error))
738DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400739DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
740
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500741TRACE_EVENT(nfs4_set_lock,
742 TP_PROTO(
743 const struct file_lock *request,
744 const struct nfs4_state *state,
745 const nfs4_stateid *lockstateid,
746 int cmd,
747 int error
748 ),
749
750 TP_ARGS(request, state, lockstateid, cmd, error),
751
752 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400753 __field(unsigned long, error)
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400754 __field(unsigned long, cmd)
755 __field(unsigned long, type)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500756 __field(loff_t, start)
757 __field(loff_t, end)
758 __field(dev_t, dev)
759 __field(u32, fhandle)
760 __field(u64, fileid)
761 __field(int, stateid_seq)
762 __field(u32, stateid_hash)
763 __field(int, lockstateid_seq)
764 __field(u32, lockstateid_hash)
765 ),
766
767 TP_fast_assign(
768 const struct inode *inode = state->inode;
769
Trond Myklebust118b6292020-01-06 15:25:06 -0500770 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500771 __entry->cmd = cmd;
772 __entry->type = request->fl_type;
773 __entry->start = request->fl_start;
774 __entry->end = request->fl_end;
775 __entry->dev = inode->i_sb->s_dev;
776 __entry->fileid = NFS_FILEID(inode);
777 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
778 __entry->stateid_seq =
779 be32_to_cpu(state->stateid.seqid);
780 __entry->stateid_hash =
781 nfs_stateid_hash(&state->stateid);
782 __entry->lockstateid_seq =
783 be32_to_cpu(lockstateid->seqid);
784 __entry->lockstateid_hash =
785 nfs_stateid_hash(lockstateid);
786 ),
787
788 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400789 "error=%ld (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500790 "fileid=%02x:%02x:%llu fhandle=0x%08x "
791 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400792 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -0400793 show_nfs4_status(__entry->error),
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400794 show_fs_fcntl_cmd(__entry->cmd),
795 show_fs_fcntl_lock_type(__entry->type),
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500796 (long long)__entry->start,
797 (long long)__entry->end,
798 MAJOR(__entry->dev), MINOR(__entry->dev),
799 (unsigned long long)__entry->fileid,
800 __entry->fhandle,
801 __entry->stateid_seq, __entry->stateid_hash,
802 __entry->lockstateid_seq, __entry->lockstateid_hash
803 )
804);
805
Chuck Lever21f86d22019-11-05 11:04:13 -0500806TRACE_DEFINE_ENUM(LK_STATE_IN_USE);
807TRACE_DEFINE_ENUM(NFS_DELEGATED_STATE);
808TRACE_DEFINE_ENUM(NFS_OPEN_STATE);
809TRACE_DEFINE_ENUM(NFS_O_RDONLY_STATE);
810TRACE_DEFINE_ENUM(NFS_O_WRONLY_STATE);
811TRACE_DEFINE_ENUM(NFS_O_RDWR_STATE);
812TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_REBOOT);
813TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_NOGRACE);
814TRACE_DEFINE_ENUM(NFS_STATE_POSIX_LOCKS);
815TRACE_DEFINE_ENUM(NFS_STATE_RECOVERY_FAILED);
816TRACE_DEFINE_ENUM(NFS_STATE_MAY_NOTIFY_LOCK);
817TRACE_DEFINE_ENUM(NFS_STATE_CHANGE_WAIT);
818TRACE_DEFINE_ENUM(NFS_CLNT_DST_SSC_COPY_STATE);
819TRACE_DEFINE_ENUM(NFS_CLNT_SRC_SSC_COPY_STATE);
820TRACE_DEFINE_ENUM(NFS_SRV_SSC_COPY_STATE);
821
822#define show_nfs4_state_flags(flags) \
823 __print_flags(flags, "|", \
824 { LK_STATE_IN_USE, "IN_USE" }, \
825 { NFS_DELEGATED_STATE, "DELEGATED" }, \
826 { NFS_OPEN_STATE, "OPEN" }, \
827 { NFS_O_RDONLY_STATE, "O_RDONLY" }, \
828 { NFS_O_WRONLY_STATE, "O_WRONLY" }, \
829 { NFS_O_RDWR_STATE, "O_RDWR" }, \
830 { NFS_STATE_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \
831 { NFS_STATE_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \
832 { NFS_STATE_POSIX_LOCKS, "POSIX_LOCKS" }, \
833 { NFS_STATE_RECOVERY_FAILED, "RECOVERY_FAILED" }, \
834 { NFS_STATE_MAY_NOTIFY_LOCK, "MAY_NOTIFY_LOCK" }, \
835 { NFS_STATE_CHANGE_WAIT, "CHANGE_WAIT" }, \
836 { NFS_CLNT_DST_SSC_COPY_STATE, "CLNT_DST_SSC_COPY" }, \
837 { NFS_CLNT_SRC_SSC_COPY_STATE, "CLNT_SRC_SSC_COPY" }, \
838 { NFS_SRV_SSC_COPY_STATE, "SRV_SSC_COPY" })
839
840#define show_nfs4_lock_flags(flags) \
841 __print_flags(flags, "|", \
842 { BIT(NFS_LOCK_INITIALIZED), "INITIALIZED" }, \
843 { BIT(NFS_LOCK_LOST), "LOST" })
844
845TRACE_EVENT(nfs4_state_lock_reclaim,
846 TP_PROTO(
847 const struct nfs4_state *state,
848 const struct nfs4_lock_state *lock
849 ),
850
851 TP_ARGS(state, lock),
852
853 TP_STRUCT__entry(
854 __field(dev_t, dev)
855 __field(u32, fhandle)
856 __field(u64, fileid)
857 __field(unsigned long, state_flags)
858 __field(unsigned long, lock_flags)
859 __field(int, stateid_seq)
860 __field(u32, stateid_hash)
861 ),
862
863 TP_fast_assign(
864 const struct inode *inode = state->inode;
865
866 __entry->dev = inode->i_sb->s_dev;
867 __entry->fileid = NFS_FILEID(inode);
868 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
869 __entry->state_flags = state->flags;
870 __entry->lock_flags = lock->ls_flags;
871 __entry->stateid_seq =
872 be32_to_cpu(state->stateid.seqid);
873 __entry->stateid_hash =
874 nfs_stateid_hash(&state->stateid);
875 ),
876
877 TP_printk(
878 "fileid=%02x:%02x:%llu fhandle=0x%08x "
879 "stateid=%d:0x%08x state_flags=%s lock_flags=%s",
880 MAJOR(__entry->dev), MINOR(__entry->dev),
881 (unsigned long long)__entry->fileid, __entry->fhandle,
882 __entry->stateid_seq, __entry->stateid_hash,
883 show_nfs4_state_flags(__entry->state_flags),
884 show_nfs4_lock_flags(__entry->lock_flags)
885 )
886)
887
Trond Myklebustca8acf82013-08-13 10:36:56 -0400888DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
889 TP_PROTO(
890 const struct inode *inode,
891 fmode_t fmode
892 ),
893
894 TP_ARGS(inode, fmode),
895
896 TP_STRUCT__entry(
897 __field(dev_t, dev)
898 __field(u32, fhandle)
899 __field(u64, fileid)
900 __field(unsigned int, fmode)
901 ),
902
903 TP_fast_assign(
904 __entry->dev = inode->i_sb->s_dev;
905 __entry->fileid = NFS_FILEID(inode);
906 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
907 __entry->fmode = (__force unsigned int)fmode;
908 ),
909
910 TP_printk(
911 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
Chuck Lever9d2d48b2021-10-22 16:16:56 -0400912 show_fs_fmode_flags(__entry->fmode),
Trond Myklebustca8acf82013-08-13 10:36:56 -0400913 MAJOR(__entry->dev), MINOR(__entry->dev),
914 (unsigned long long)__entry->fileid,
915 __entry->fhandle
916 )
917);
918#define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
919 DEFINE_EVENT(nfs4_set_delegation_event, name, \
920 TP_PROTO( \
921 const struct inode *inode, \
922 fmode_t fmode \
923 ), \
924 TP_ARGS(inode, fmode))
925DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
926DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
927
928TRACE_EVENT(nfs4_delegreturn_exit,
929 TP_PROTO(
930 const struct nfs4_delegreturnargs *args,
931 const struct nfs4_delegreturnres *res,
932 int error
933 ),
934
935 TP_ARGS(args, res, error),
936
937 TP_STRUCT__entry(
938 __field(dev_t, dev)
939 __field(u32, fhandle)
Chuck Lever96650e22019-06-19 10:33:53 -0400940 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500941 __field(int, stateid_seq)
942 __field(u32, stateid_hash)
Trond Myklebustca8acf82013-08-13 10:36:56 -0400943 ),
944
945 TP_fast_assign(
946 __entry->dev = res->server->s_dev;
947 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
Trond Myklebust118b6292020-01-06 15:25:06 -0500948 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500949 __entry->stateid_seq =
950 be32_to_cpu(args->stateid->seqid);
951 __entry->stateid_hash =
952 nfs_stateid_hash(args->stateid);
Trond Myklebustca8acf82013-08-13 10:36:56 -0400953 ),
954
955 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400956 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500957 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -0400958 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -0400959 show_nfs4_status(__entry->error),
Trond Myklebustca8acf82013-08-13 10:36:56 -0400960 MAJOR(__entry->dev), MINOR(__entry->dev),
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500961 __entry->fhandle,
962 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustca8acf82013-08-13 10:36:56 -0400963 )
964);
965
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400966#ifdef CONFIG_NFS_V4_1
967DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
968 TP_PROTO(
969 const struct nfs4_state *state,
970 const struct nfs4_lock_state *lsp,
971 int error
972 ),
973
974 TP_ARGS(state, lsp, error),
975
976 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -0400977 __field(unsigned long, error)
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400978 __field(dev_t, dev)
979 __field(u32, fhandle)
980 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500981 __field(int, stateid_seq)
982 __field(u32, stateid_hash)
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400983 ),
984
985 TP_fast_assign(
986 const struct inode *inode = state->inode;
987
Trond Myklebust118b6292020-01-06 15:25:06 -0500988 __entry->error = error < 0 ? -error : 0;
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400989 __entry->dev = inode->i_sb->s_dev;
990 __entry->fileid = NFS_FILEID(inode);
991 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500992 __entry->stateid_seq =
993 be32_to_cpu(state->stateid.seqid);
994 __entry->stateid_hash =
995 nfs_stateid_hash(&state->stateid);
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400996 ),
997
998 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -0400999 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001000 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001001 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04001002 show_nfs4_status(__entry->error),
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001003 MAJOR(__entry->dev), MINOR(__entry->dev),
1004 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001005 __entry->fhandle,
1006 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust08cb47f2013-08-20 21:59:40 -04001007 )
1008);
1009
1010#define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
1011 DEFINE_EVENT(nfs4_test_stateid_event, name, \
1012 TP_PROTO( \
1013 const struct nfs4_state *state, \
1014 const struct nfs4_lock_state *lsp, \
1015 int error \
1016 ), \
1017 TP_ARGS(state, lsp, error))
1018DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
1019DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
1020DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
1021#endif /* CONFIG_NFS_V4_1 */
1022
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001023DECLARE_EVENT_CLASS(nfs4_lookup_event,
1024 TP_PROTO(
1025 const struct inode *dir,
1026 const struct qstr *name,
1027 int error
1028 ),
1029
1030 TP_ARGS(dir, name, error),
1031
1032 TP_STRUCT__entry(
1033 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001034 __field(unsigned long, error)
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001035 __field(u64, dir)
1036 __string(name, name->name)
1037 ),
1038
1039 TP_fast_assign(
1040 __entry->dev = dir->i_sb->s_dev;
1041 __entry->dir = NFS_FILEID(dir);
Chuck Lever96650e22019-06-19 10:33:53 -04001042 __entry->error = -error;
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001043 __assign_str(name, name->name);
1044 ),
1045
1046 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001047 "error=%ld (%s) name=%02x:%02x:%llu/%s",
1048 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04001049 show_nfs4_status(__entry->error),
Trond Myklebust078ea3d2013-08-12 16:45:55 -04001050 MAJOR(__entry->dev), MINOR(__entry->dev),
1051 (unsigned long long)__entry->dir,
1052 __get_str(name)
1053 )
1054);
1055
1056#define DEFINE_NFS4_LOOKUP_EVENT(name) \
1057 DEFINE_EVENT(nfs4_lookup_event, name, \
1058 TP_PROTO( \
1059 const struct inode *dir, \
1060 const struct qstr *name, \
1061 int error \
1062 ), \
1063 TP_ARGS(dir, name, error))
1064
1065DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
1066DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
1067DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
1068DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
1069DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
1070DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
1071DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
1072
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001073TRACE_EVENT(nfs4_lookupp,
1074 TP_PROTO(
1075 const struct inode *inode,
1076 int error
1077 ),
1078
1079 TP_ARGS(inode, error),
1080
1081 TP_STRUCT__entry(
1082 __field(dev_t, dev)
1083 __field(u64, ino)
Chuck Lever96650e22019-06-19 10:33:53 -04001084 __field(unsigned long, error)
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001085 ),
1086
1087 TP_fast_assign(
1088 __entry->dev = inode->i_sb->s_dev;
1089 __entry->ino = NFS_FILEID(inode);
Trond Myklebust118b6292020-01-06 15:25:06 -05001090 __entry->error = error < 0 ? -error : 0;
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001091 ),
1092
1093 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001094 "error=%ld (%s) inode=%02x:%02x:%llu",
1095 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04001096 show_nfs4_status(__entry->error),
Jeff Layton5b5faaf2017-06-29 06:34:52 -07001097 MAJOR(__entry->dev), MINOR(__entry->dev),
1098 (unsigned long long)__entry->ino
1099 )
1100);
1101
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001102TRACE_EVENT(nfs4_rename,
1103 TP_PROTO(
1104 const struct inode *olddir,
1105 const struct qstr *oldname,
1106 const struct inode *newdir,
1107 const struct qstr *newname,
1108 int error
1109 ),
1110
1111 TP_ARGS(olddir, oldname, newdir, newname, error),
1112
1113 TP_STRUCT__entry(
1114 __field(dev_t, dev)
Chuck Lever96650e22019-06-19 10:33:53 -04001115 __field(unsigned long, error)
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001116 __field(u64, olddir)
1117 __string(oldname, oldname->name)
1118 __field(u64, newdir)
1119 __string(newname, newname->name)
1120 ),
1121
1122 TP_fast_assign(
1123 __entry->dev = olddir->i_sb->s_dev;
1124 __entry->olddir = NFS_FILEID(olddir);
1125 __entry->newdir = NFS_FILEID(newdir);
Trond Myklebust118b6292020-01-06 15:25:06 -05001126 __entry->error = error < 0 ? -error : 0;
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001127 __assign_str(oldname, oldname->name);
1128 __assign_str(newname, newname->name);
1129 ),
1130
1131 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001132 "error=%ld (%s) oldname=%02x:%02x:%llu/%s "
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001133 "newname=%02x:%02x:%llu/%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001134 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04001135 show_nfs4_status(__entry->error),
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -04001136 MAJOR(__entry->dev), MINOR(__entry->dev),
1137 (unsigned long long)__entry->olddir,
1138 __get_str(oldname),
1139 MAJOR(__entry->dev), MINOR(__entry->dev),
1140 (unsigned long long)__entry->newdir,
1141 __get_str(newname)
1142 )
1143);
1144
Trond Myklebustc1578b72013-08-12 16:58:42 -04001145DECLARE_EVENT_CLASS(nfs4_inode_event,
1146 TP_PROTO(
1147 const struct inode *inode,
1148 int error
1149 ),
1150
1151 TP_ARGS(inode, error),
1152
1153 TP_STRUCT__entry(
1154 __field(dev_t, dev)
1155 __field(u32, fhandle)
1156 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001157 __field(unsigned long, error)
Trond Myklebustc1578b72013-08-12 16:58:42 -04001158 ),
1159
1160 TP_fast_assign(
1161 __entry->dev = inode->i_sb->s_dev;
1162 __entry->fileid = NFS_FILEID(inode);
1163 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Chuck Lever96650e22019-06-19 10:33:53 -04001164 __entry->error = error < 0 ? -error : 0;
Trond Myklebustc1578b72013-08-12 16:58:42 -04001165 ),
1166
1167 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001168 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
1169 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04001170 show_nfs4_status(__entry->error),
Trond Myklebustc1578b72013-08-12 16:58:42 -04001171 MAJOR(__entry->dev), MINOR(__entry->dev),
1172 (unsigned long long)__entry->fileid,
1173 __entry->fhandle
1174 )
1175);
1176
1177#define DEFINE_NFS4_INODE_EVENT(name) \
1178 DEFINE_EVENT(nfs4_inode_event, name, \
1179 TP_PROTO( \
1180 const struct inode *inode, \
1181 int error \
1182 ), \
1183 TP_ARGS(inode, error))
1184
Trond Myklebustc1578b72013-08-12 16:58:42 -04001185DEFINE_NFS4_INODE_EVENT(nfs4_access);
1186DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
1187DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
1188DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
1189DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
1190#ifdef CONFIG_NFS_V4_SECURITY_LABEL
1191DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
1192DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
1193#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001194
1195DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
1196 TP_PROTO(
1197 const struct inode *inode,
1198 const nfs4_stateid *stateid,
1199 int error
1200 ),
1201
1202 TP_ARGS(inode, stateid, error),
1203
1204 TP_STRUCT__entry(
1205 __field(dev_t, dev)
1206 __field(u32, fhandle)
1207 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001208 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001209 __field(int, stateid_seq)
1210 __field(u32, stateid_hash)
1211 ),
1212
1213 TP_fast_assign(
1214 __entry->dev = inode->i_sb->s_dev;
1215 __entry->fileid = NFS_FILEID(inode);
1216 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Trond Myklebust118b6292020-01-06 15:25:06 -05001217 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001218 __entry->stateid_seq =
1219 be32_to_cpu(stateid->seqid);
1220 __entry->stateid_hash =
1221 nfs_stateid_hash(stateid);
1222 ),
1223
1224 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001225 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001226 "stateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001227 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04001228 show_nfs4_status(__entry->error),
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001229 MAJOR(__entry->dev), MINOR(__entry->dev),
1230 (unsigned long long)__entry->fileid,
1231 __entry->fhandle,
1232 __entry->stateid_seq, __entry->stateid_hash
1233 )
1234);
1235
1236#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1237 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1238 TP_PROTO( \
1239 const struct inode *inode, \
1240 const nfs4_stateid *stateid, \
1241 int error \
1242 ), \
1243 TP_ARGS(inode, stateid, error))
1244
1245DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1246DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
Trond Myklebustad9e02d2017-11-06 15:28:02 -05001247DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update);
1248DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait);
Benjamin Coddingtonb4868b42020-09-25 15:48:39 -04001249DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_close_stateid_update_wait);
Trond Myklebustc1578b72013-08-12 16:58:42 -04001250
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001251DECLARE_EVENT_CLASS(nfs4_getattr_event,
1252 TP_PROTO(
1253 const struct nfs_server *server,
1254 const struct nfs_fh *fhandle,
1255 const struct nfs_fattr *fattr,
1256 int error
1257 ),
1258
1259 TP_ARGS(server, fhandle, fattr, error),
1260
1261 TP_STRUCT__entry(
1262 __field(dev_t, dev)
1263 __field(u32, fhandle)
1264 __field(u64, fileid)
1265 __field(unsigned int, valid)
Chuck Lever96650e22019-06-19 10:33:53 -04001266 __field(unsigned long, error)
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001267 ),
1268
1269 TP_fast_assign(
1270 __entry->dev = server->s_dev;
1271 __entry->valid = fattr->valid;
1272 __entry->fhandle = nfs_fhandle_hash(fhandle);
1273 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
Trond Myklebust118b6292020-01-06 15:25:06 -05001274 __entry->error = error < 0 ? -error : 0;
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001275 ),
1276
1277 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001278 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001279 "valid=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001280 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04001281 show_nfs4_status(__entry->error),
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001282 MAJOR(__entry->dev), MINOR(__entry->dev),
1283 (unsigned long long)__entry->fileid,
1284 __entry->fhandle,
1285 show_nfs_fattr_flags(__entry->valid)
1286 )
1287);
1288
1289#define DEFINE_NFS4_GETATTR_EVENT(name) \
1290 DEFINE_EVENT(nfs4_getattr_event, name, \
1291 TP_PROTO( \
1292 const struct nfs_server *server, \
1293 const struct nfs_fh *fhandle, \
1294 const struct nfs_fattr *fattr, \
1295 int error \
1296 ), \
1297 TP_ARGS(server, fhandle, fattr, error))
1298DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1299DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1300DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1301
Trond Myklebust7cd14862015-08-20 20:07:54 -05001302DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1303 TP_PROTO(
1304 const struct nfs_client *clp,
1305 const struct nfs_fh *fhandle,
1306 const struct inode *inode,
1307 int error
1308 ),
1309
1310 TP_ARGS(clp, fhandle, inode, error),
1311
1312 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001313 __field(unsigned long, error)
Trond Myklebust7cd14862015-08-20 20:07:54 -05001314 __field(dev_t, dev)
1315 __field(u32, fhandle)
1316 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001317 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001318 ),
1319
1320 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -05001321 __entry->error = error < 0 ? -error : 0;
Trond Myklebust7cd14862015-08-20 20:07:54 -05001322 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2edaead2018-09-05 14:07:13 -04001323 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebust7cd14862015-08-20 20:07:54 -05001324 __entry->fileid = NFS_FILEID(inode);
1325 __entry->dev = inode->i_sb->s_dev;
1326 } else {
1327 __entry->fileid = 0;
1328 __entry->dev = 0;
1329 }
Joe Perches78c14b32021-06-12 08:42:27 -07001330 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown");
Trond Myklebust7cd14862015-08-20 20:07:54 -05001331 ),
1332
1333 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001334 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust7cd14862015-08-20 20:07:54 -05001335 "dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001336 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04001337 show_nfs4_status(__entry->error),
Trond Myklebust7cd14862015-08-20 20:07:54 -05001338 MAJOR(__entry->dev), MINOR(__entry->dev),
1339 (unsigned long long)__entry->fileid,
1340 __entry->fhandle,
1341 __get_str(dstaddr)
1342 )
1343);
1344
1345#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1346 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1347 TP_PROTO( \
1348 const struct nfs_client *clp, \
1349 const struct nfs_fh *fhandle, \
1350 const struct inode *inode, \
1351 int error \
1352 ), \
1353 TP_ARGS(clp, fhandle, inode, error))
1354DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1355
Trond Myklebuste07db902015-12-28 14:07:23 -05001356DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1357 TP_PROTO(
1358 const struct nfs_client *clp,
1359 const struct nfs_fh *fhandle,
1360 const struct inode *inode,
1361 const nfs4_stateid *stateid,
1362 int error
1363 ),
1364
1365 TP_ARGS(clp, fhandle, inode, stateid, error),
1366
1367 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001368 __field(unsigned long, error)
Trond Myklebuste07db902015-12-28 14:07:23 -05001369 __field(dev_t, dev)
1370 __field(u32, fhandle)
1371 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001372 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001373 __field(int, stateid_seq)
1374 __field(u32, stateid_hash)
1375 ),
1376
1377 TP_fast_assign(
Trond Myklebust118b6292020-01-06 15:25:06 -05001378 __entry->error = error < 0 ? -error : 0;
Trond Myklebuste07db902015-12-28 14:07:23 -05001379 __entry->fhandle = nfs_fhandle_hash(fhandle);
Trond Myklebust2a534a72018-08-23 11:02:49 -04001380 if (!IS_ERR_OR_NULL(inode)) {
Trond Myklebuste07db902015-12-28 14:07:23 -05001381 __entry->fileid = NFS_FILEID(inode);
1382 __entry->dev = inode->i_sb->s_dev;
1383 } else {
1384 __entry->fileid = 0;
1385 __entry->dev = 0;
1386 }
Joe Perches78c14b32021-06-12 08:42:27 -07001387 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown");
Trond Myklebuste07db902015-12-28 14:07:23 -05001388 __entry->stateid_seq =
1389 be32_to_cpu(stateid->seqid);
1390 __entry->stateid_hash =
1391 nfs_stateid_hash(stateid);
1392 ),
1393
1394 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001395 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebuste07db902015-12-28 14:07:23 -05001396 "stateid=%d:0x%08x dstaddr=%s",
Chuck Lever96650e22019-06-19 10:33:53 -04001397 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04001398 show_nfs4_status(__entry->error),
Trond Myklebuste07db902015-12-28 14:07:23 -05001399 MAJOR(__entry->dev), MINOR(__entry->dev),
1400 (unsigned long long)__entry->fileid,
1401 __entry->fhandle,
1402 __entry->stateid_seq, __entry->stateid_hash,
1403 __get_str(dstaddr)
1404 )
1405);
1406
1407#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1408 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1409 TP_PROTO( \
1410 const struct nfs_client *clp, \
1411 const struct nfs_fh *fhandle, \
1412 const struct inode *inode, \
1413 const nfs4_stateid *stateid, \
1414 int error \
1415 ), \
1416 TP_ARGS(clp, fhandle, inode, stateid, error))
1417DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1418DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
Trond Myklebust7cd14862015-08-20 20:07:54 -05001419
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001420DECLARE_EVENT_CLASS(nfs4_idmap_event,
1421 TP_PROTO(
1422 const char *name,
1423 int len,
1424 u32 id,
1425 int error
1426 ),
1427
1428 TP_ARGS(name, len, id, error),
1429
1430 TP_STRUCT__entry(
Chuck Lever96650e22019-06-19 10:33:53 -04001431 __field(unsigned long, error)
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001432 __field(u32, id)
1433 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1434 ),
1435
1436 TP_fast_assign(
1437 if (len < 0)
1438 len = 0;
1439 __entry->error = error < 0 ? error : 0;
1440 __entry->id = id;
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -03001441 memcpy(__get_str(name), name, len);
1442 __get_str(name)[len] = 0;
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001443 ),
1444
1445 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001446 "error=%ld (%s) id=%u name=%s",
Chuck Lever87915452021-10-22 16:17:03 -04001447 -__entry->error, show_nfs4_status(__entry->error),
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001448 __entry->id,
1449 __get_str(name)
1450 )
1451);
1452#define DEFINE_NFS4_IDMAP_EVENT(name) \
1453 DEFINE_EVENT(nfs4_idmap_event, name, \
1454 TP_PROTO( \
1455 const char *name, \
1456 int len, \
1457 u32 id, \
1458 int error \
1459 ), \
1460 TP_ARGS(name, len, id, error))
1461DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1462DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1463DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1464DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1465
Trond Myklebust54898f72020-08-04 22:16:06 -04001466#ifdef CONFIG_NFS_V4_1
1467#define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) \
1468 (lseg ? nfs_stateid_hash(&lseg->pls_layout->plh_stateid) : 0)
1469#else
1470#define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) (0)
1471#endif
1472
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001473DECLARE_EVENT_CLASS(nfs4_read_event,
1474 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001475 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001476 int error
1477 ),
1478
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001479 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001480
1481 TP_STRUCT__entry(
1482 __field(dev_t, dev)
1483 __field(u32, fhandle)
1484 __field(u64, fileid)
1485 __field(loff_t, offset)
Trond Myklebust25925b02020-01-06 15:25:05 -05001486 __field(u32, arg_count)
1487 __field(u32, res_count)
Chuck Lever96650e22019-06-19 10:33:53 -04001488 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001489 __field(int, stateid_seq)
1490 __field(u32, stateid_hash)
Trond Myklebust54898f72020-08-04 22:16:06 -04001491 __field(int, layoutstateid_seq)
1492 __field(u32, layoutstateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001493 ),
1494
1495 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001496 const struct inode *inode = hdr->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001497 const struct nfs_inode *nfsi = NFS_I(inode);
1498 const struct nfs_fh *fh = hdr->args.fh ?
1499 hdr->args.fh : &nfsi->fh;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001500 const struct nfs4_state *state =
1501 hdr->args.context->state;
Trond Myklebust54898f72020-08-04 22:16:06 -04001502 const struct pnfs_layout_segment *lseg = hdr->lseg;
Trond Myklebust25925b02020-01-06 15:25:05 -05001503
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001504 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001505 __entry->fileid = nfsi->fileid;
1506 __entry->fhandle = nfs_fhandle_hash(fh);
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001507 __entry->offset = hdr->args.offset;
Trond Myklebust25925b02020-01-06 15:25:05 -05001508 __entry->arg_count = hdr->args.count;
1509 __entry->res_count = hdr->res.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001510 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001511 __entry->stateid_seq =
1512 be32_to_cpu(state->stateid.seqid);
1513 __entry->stateid_hash =
1514 nfs_stateid_hash(&state->stateid);
Trond Myklebust54898f72020-08-04 22:16:06 -04001515 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1516 __entry->layoutstateid_hash =
1517 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001518 ),
1519
1520 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001521 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust54898f72020-08-04 22:16:06 -04001522 "offset=%lld count=%u res=%u stateid=%d:0x%08x "
1523 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001524 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04001525 show_nfs4_status(__entry->error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001526 MAJOR(__entry->dev), MINOR(__entry->dev),
1527 (unsigned long long)__entry->fileid,
1528 __entry->fhandle,
1529 (long long)__entry->offset,
Trond Myklebust25925b02020-01-06 15:25:05 -05001530 __entry->arg_count, __entry->res_count,
Trond Myklebust54898f72020-08-04 22:16:06 -04001531 __entry->stateid_seq, __entry->stateid_hash,
1532 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001533 )
1534);
1535#define DEFINE_NFS4_READ_EVENT(name) \
1536 DEFINE_EVENT(nfs4_read_event, name, \
1537 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001538 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001539 int error \
1540 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001541 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001542DEFINE_NFS4_READ_EVENT(nfs4_read);
1543#ifdef CONFIG_NFS_V4_1
1544DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1545#endif /* CONFIG_NFS_V4_1 */
1546
1547DECLARE_EVENT_CLASS(nfs4_write_event,
1548 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001549 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001550 int error
1551 ),
1552
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001553 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001554
1555 TP_STRUCT__entry(
1556 __field(dev_t, dev)
1557 __field(u32, fhandle)
1558 __field(u64, fileid)
1559 __field(loff_t, offset)
Trond Myklebust25925b02020-01-06 15:25:05 -05001560 __field(u32, arg_count)
1561 __field(u32, res_count)
Chuck Lever96650e22019-06-19 10:33:53 -04001562 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001563 __field(int, stateid_seq)
1564 __field(u32, stateid_hash)
Trond Myklebust54898f72020-08-04 22:16:06 -04001565 __field(int, layoutstateid_seq)
1566 __field(u32, layoutstateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001567 ),
1568
1569 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001570 const struct inode *inode = hdr->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001571 const struct nfs_inode *nfsi = NFS_I(inode);
1572 const struct nfs_fh *fh = hdr->args.fh ?
1573 hdr->args.fh : &nfsi->fh;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001574 const struct nfs4_state *state =
1575 hdr->args.context->state;
Trond Myklebust54898f72020-08-04 22:16:06 -04001576 const struct pnfs_layout_segment *lseg = hdr->lseg;
Trond Myklebust25925b02020-01-06 15:25:05 -05001577
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001578 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001579 __entry->fileid = nfsi->fileid;
1580 __entry->fhandle = nfs_fhandle_hash(fh);
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001581 __entry->offset = hdr->args.offset;
Trond Myklebust25925b02020-01-06 15:25:05 -05001582 __entry->arg_count = hdr->args.count;
1583 __entry->res_count = hdr->res.count;
Chuck Lever96650e22019-06-19 10:33:53 -04001584 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001585 __entry->stateid_seq =
1586 be32_to_cpu(state->stateid.seqid);
1587 __entry->stateid_hash =
1588 nfs_stateid_hash(&state->stateid);
Trond Myklebust54898f72020-08-04 22:16:06 -04001589 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1590 __entry->layoutstateid_hash =
1591 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001592 ),
1593
1594 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001595 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust54898f72020-08-04 22:16:06 -04001596 "offset=%lld count=%u res=%u stateid=%d:0x%08x "
1597 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001598 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04001599 show_nfs4_status(__entry->error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001600 MAJOR(__entry->dev), MINOR(__entry->dev),
1601 (unsigned long long)__entry->fileid,
1602 __entry->fhandle,
1603 (long long)__entry->offset,
Trond Myklebust25925b02020-01-06 15:25:05 -05001604 __entry->arg_count, __entry->res_count,
Trond Myklebust54898f72020-08-04 22:16:06 -04001605 __entry->stateid_seq, __entry->stateid_hash,
1606 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001607 )
1608);
1609
1610#define DEFINE_NFS4_WRITE_EVENT(name) \
1611 DEFINE_EVENT(nfs4_write_event, name, \
1612 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001613 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001614 int error \
1615 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001616 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001617DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1618#ifdef CONFIG_NFS_V4_1
1619DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1620#endif /* CONFIG_NFS_V4_1 */
1621
1622DECLARE_EVENT_CLASS(nfs4_commit_event,
1623 TP_PROTO(
1624 const struct nfs_commit_data *data,
1625 int error
1626 ),
1627
1628 TP_ARGS(data, error),
1629
1630 TP_STRUCT__entry(
1631 __field(dev_t, dev)
1632 __field(u32, fhandle)
1633 __field(u64, fileid)
Chuck Lever96650e22019-06-19 10:33:53 -04001634 __field(unsigned long, error)
Trond Myklebust25925b02020-01-06 15:25:05 -05001635 __field(loff_t, offset)
1636 __field(u32, count)
Trond Myklebust54898f72020-08-04 22:16:06 -04001637 __field(int, layoutstateid_seq)
1638 __field(u32, layoutstateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001639 ),
1640
1641 TP_fast_assign(
1642 const struct inode *inode = data->inode;
Trond Myklebust25925b02020-01-06 15:25:05 -05001643 const struct nfs_inode *nfsi = NFS_I(inode);
1644 const struct nfs_fh *fh = data->args.fh ?
1645 data->args.fh : &nfsi->fh;
Trond Myklebust54898f72020-08-04 22:16:06 -04001646 const struct pnfs_layout_segment *lseg = data->lseg;
Trond Myklebust25925b02020-01-06 15:25:05 -05001647
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001648 __entry->dev = inode->i_sb->s_dev;
Trond Myklebust25925b02020-01-06 15:25:05 -05001649 __entry->fileid = nfsi->fileid;
1650 __entry->fhandle = nfs_fhandle_hash(fh);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001651 __entry->offset = data->args.offset;
1652 __entry->count = data->args.count;
Trond Myklebust25925b02020-01-06 15:25:05 -05001653 __entry->error = error < 0 ? -error : 0;
Trond Myklebust54898f72020-08-04 22:16:06 -04001654 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0;
1655 __entry->layoutstateid_hash =
1656 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001657 ),
1658
1659 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001660 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust54898f72020-08-04 22:16:06 -04001661 "offset=%lld count=%u layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001662 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04001663 show_nfs4_status(__entry->error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001664 MAJOR(__entry->dev), MINOR(__entry->dev),
1665 (unsigned long long)__entry->fileid,
1666 __entry->fhandle,
1667 (long long)__entry->offset,
Trond Myklebust54898f72020-08-04 22:16:06 -04001668 __entry->count,
1669 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001670 )
1671);
1672#define DEFINE_NFS4_COMMIT_EVENT(name) \
1673 DEFINE_EVENT(nfs4_commit_event, name, \
1674 TP_PROTO( \
1675 const struct nfs_commit_data *data, \
1676 int error \
1677 ), \
1678 TP_ARGS(data, error))
1679DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1680#ifdef CONFIG_NFS_V4_1
1681DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001682
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001683TRACE_EVENT(nfs4_layoutget,
1684 TP_PROTO(
1685 const struct nfs_open_context *ctx,
1686 const struct pnfs_layout_range *args,
1687 const struct pnfs_layout_range *res,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001688 const nfs4_stateid *layout_stateid,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001689 int error
1690 ),
1691
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001692 TP_ARGS(ctx, args, res, layout_stateid, error),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001693
1694 TP_STRUCT__entry(
1695 __field(dev_t, dev)
1696 __field(u32, fhandle)
1697 __field(u64, fileid)
1698 __field(u32, iomode)
1699 __field(u64, offset)
1700 __field(u64, count)
Chuck Lever96650e22019-06-19 10:33:53 -04001701 __field(unsigned long, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001702 __field(int, stateid_seq)
1703 __field(u32, stateid_hash)
1704 __field(int, layoutstateid_seq)
1705 __field(u32, layoutstateid_hash)
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001706 ),
1707
1708 TP_fast_assign(
David Howells2b0143b2015-03-17 22:25:59 +00001709 const struct inode *inode = d_inode(ctx->dentry);
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001710 const struct nfs4_state *state = ctx->state;
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001711 __entry->dev = inode->i_sb->s_dev;
1712 __entry->fileid = NFS_FILEID(inode);
1713 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1714 __entry->iomode = args->iomode;
1715 __entry->offset = args->offset;
1716 __entry->count = args->length;
Trond Myklebust118b6292020-01-06 15:25:06 -05001717 __entry->error = error < 0 ? -error : 0;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001718 __entry->stateid_seq =
1719 be32_to_cpu(state->stateid.seqid);
1720 __entry->stateid_hash =
1721 nfs_stateid_hash(&state->stateid);
1722 if (!error) {
1723 __entry->layoutstateid_seq =
1724 be32_to_cpu(layout_stateid->seqid);
1725 __entry->layoutstateid_hash =
1726 nfs_stateid_hash(layout_stateid);
1727 } else {
1728 __entry->layoutstateid_seq = 0;
1729 __entry->layoutstateid_hash = 0;
1730 }
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001731 ),
1732
1733 TP_printk(
Chuck Lever96650e22019-06-19 10:33:53 -04001734 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001735 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1736 "layoutstateid=%d:0x%08x",
Chuck Lever96650e22019-06-19 10:33:53 -04001737 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04001738 show_nfs4_status(__entry->error),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001739 MAJOR(__entry->dev), MINOR(__entry->dev),
1740 (unsigned long long)__entry->fileid,
1741 __entry->fhandle,
Chuck Lever87915452021-10-22 16:17:03 -04001742 show_pnfs_layout_iomode(__entry->iomode),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001743 (unsigned long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001744 (unsigned long long)__entry->count,
1745 __entry->stateid_seq, __entry->stateid_hash,
1746 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001747 )
1748);
1749
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001750DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1751DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
Trond Myklebusta19b4782020-08-03 18:32:28 -04001752DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn_on_close);
Trond Myklebust638037b2020-08-04 11:02:44 -04001753DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layouterror);
1754DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutstats);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001755
Chuck Lever5b2095d2018-12-19 11:00:11 -05001756TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN);
1757TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS);
1758TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN);
1759TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH);
1760TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM);
1761TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL);
1762TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL);
1763TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED);
1764TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN);
1765TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED);
1766TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN);
1767TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY);
1768TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET);
Trond Myklebustd5b92162019-07-18 09:32:17 -04001769TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_EXIT);
Chuck Lever5b2095d2018-12-19 11:00:11 -05001770
Jeff Layton9a4bf312015-12-10 10:41:58 -05001771#define show_pnfs_update_layout_reason(reason) \
1772 __print_symbolic(reason, \
1773 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
1774 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
1775 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
1776 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
1777 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
1778 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
1779 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
1780 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
1781 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
1782 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
Jeff Layton183d9e72016-05-17 12:28:47 -04001783 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
1784 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
Trond Myklebustd5b92162019-07-18 09:32:17 -04001785 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }, \
1786 { PNFS_UPDATE_LAYOUT_EXIT, "exit" })
Jeff Layton9a4bf312015-12-10 10:41:58 -05001787
1788TRACE_EVENT(pnfs_update_layout,
1789 TP_PROTO(struct inode *inode,
1790 loff_t pos,
1791 u64 count,
1792 enum pnfs_iomode iomode,
Trond Myklebustf4848302015-12-26 18:03:07 -05001793 struct pnfs_layout_hdr *lo,
Jeff Layton183d9e72016-05-17 12:28:47 -04001794 struct pnfs_layout_segment *lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05001795 enum pnfs_update_layout_reason reason
1796 ),
Jeff Layton183d9e72016-05-17 12:28:47 -04001797 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
Jeff Layton9a4bf312015-12-10 10:41:58 -05001798 TP_STRUCT__entry(
1799 __field(dev_t, dev)
1800 __field(u64, fileid)
1801 __field(u32, fhandle)
1802 __field(loff_t, pos)
1803 __field(u64, count)
1804 __field(enum pnfs_iomode, iomode)
Trond Myklebustf4848302015-12-26 18:03:07 -05001805 __field(int, layoutstateid_seq)
1806 __field(u32, layoutstateid_hash)
Jeff Layton183d9e72016-05-17 12:28:47 -04001807 __field(long, lseg)
Jeff Layton9a4bf312015-12-10 10:41:58 -05001808 __field(enum pnfs_update_layout_reason, reason)
1809 ),
1810 TP_fast_assign(
1811 __entry->dev = inode->i_sb->s_dev;
1812 __entry->fileid = NFS_FILEID(inode);
1813 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1814 __entry->pos = pos;
1815 __entry->count = count;
1816 __entry->iomode = iomode;
Jeff Layton9a4bf312015-12-10 10:41:58 -05001817 __entry->reason = reason;
Trond Myklebustf4848302015-12-26 18:03:07 -05001818 if (lo != NULL) {
1819 __entry->layoutstateid_seq =
1820 be32_to_cpu(lo->plh_stateid.seqid);
1821 __entry->layoutstateid_hash =
1822 nfs_stateid_hash(&lo->plh_stateid);
1823 } else {
1824 __entry->layoutstateid_seq = 0;
1825 __entry->layoutstateid_hash = 0;
1826 }
Jeff Layton183d9e72016-05-17 12:28:47 -04001827 __entry->lseg = (long)lseg;
Jeff Layton9a4bf312015-12-10 10:41:58 -05001828 ),
1829 TP_printk(
1830 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustf4848302015-12-26 18:03:07 -05001831 "iomode=%s pos=%llu count=%llu "
Jeff Layton183d9e72016-05-17 12:28:47 -04001832 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
Jeff Layton9a4bf312015-12-10 10:41:58 -05001833 MAJOR(__entry->dev), MINOR(__entry->dev),
1834 (unsigned long long)__entry->fileid,
1835 __entry->fhandle,
Chuck Lever87915452021-10-22 16:17:03 -04001836 show_pnfs_layout_iomode(__entry->iomode),
Jeff Layton9a4bf312015-12-10 10:41:58 -05001837 (unsigned long long)__entry->pos,
Trond Myklebustf4848302015-12-26 18:03:07 -05001838 (unsigned long long)__entry->count,
1839 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
Jeff Layton183d9e72016-05-17 12:28:47 -04001840 __entry->lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05001841 show_pnfs_update_layout_reason(__entry->reason)
1842 )
1843);
1844
Trond Myklebustd5b92162019-07-18 09:32:17 -04001845DECLARE_EVENT_CLASS(pnfs_layout_event,
1846 TP_PROTO(struct inode *inode,
1847 loff_t pos,
1848 u64 count,
1849 enum pnfs_iomode iomode,
1850 struct pnfs_layout_hdr *lo,
1851 struct pnfs_layout_segment *lseg
1852 ),
1853 TP_ARGS(inode, pos, count, iomode, lo, lseg),
1854 TP_STRUCT__entry(
1855 __field(dev_t, dev)
1856 __field(u64, fileid)
1857 __field(u32, fhandle)
1858 __field(loff_t, pos)
1859 __field(u64, count)
1860 __field(enum pnfs_iomode, iomode)
1861 __field(int, layoutstateid_seq)
1862 __field(u32, layoutstateid_hash)
1863 __field(long, lseg)
1864 ),
1865 TP_fast_assign(
1866 __entry->dev = inode->i_sb->s_dev;
1867 __entry->fileid = NFS_FILEID(inode);
1868 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1869 __entry->pos = pos;
1870 __entry->count = count;
1871 __entry->iomode = iomode;
1872 if (lo != NULL) {
1873 __entry->layoutstateid_seq =
1874 be32_to_cpu(lo->plh_stateid.seqid);
1875 __entry->layoutstateid_hash =
1876 nfs_stateid_hash(&lo->plh_stateid);
1877 } else {
1878 __entry->layoutstateid_seq = 0;
1879 __entry->layoutstateid_hash = 0;
1880 }
1881 __entry->lseg = (long)lseg;
1882 ),
1883 TP_printk(
1884 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1885 "iomode=%s pos=%llu count=%llu "
1886 "layoutstateid=%d:0x%08x lseg=0x%lx",
1887 MAJOR(__entry->dev), MINOR(__entry->dev),
1888 (unsigned long long)__entry->fileid,
1889 __entry->fhandle,
Chuck Lever87915452021-10-22 16:17:03 -04001890 show_pnfs_layout_iomode(__entry->iomode),
Trond Myklebustd5b92162019-07-18 09:32:17 -04001891 (unsigned long long)__entry->pos,
1892 (unsigned long long)__entry->count,
1893 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
1894 __entry->lseg
1895 )
1896);
1897
1898#define DEFINE_PNFS_LAYOUT_EVENT(name) \
1899 DEFINE_EVENT(pnfs_layout_event, name, \
1900 TP_PROTO(struct inode *inode, \
1901 loff_t pos, \
1902 u64 count, \
1903 enum pnfs_iomode iomode, \
1904 struct pnfs_layout_hdr *lo, \
1905 struct pnfs_layout_segment *lseg \
1906 ), \
1907 TP_ARGS(inode, pos, count, iomode, lo, lseg))
1908
1909DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_read);
1910DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_write);
1911DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_get_mirror_count);
1912DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_done);
1913DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done);
1914DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist);
1915DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist);
1916
Trond Myklebustcac1d3a2020-12-16 16:31:26 -05001917DECLARE_EVENT_CLASS(nfs4_deviceid_event,
1918 TP_PROTO(
1919 const struct nfs_client *clp,
1920 const struct nfs4_deviceid *deviceid
1921 ),
1922
1923 TP_ARGS(clp, deviceid),
1924
1925 TP_STRUCT__entry(
1926 __string(dstaddr, clp->cl_hostname)
1927 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE)
1928 ),
1929
1930 TP_fast_assign(
1931 __assign_str(dstaddr, clp->cl_hostname);
1932 memcpy(__entry->deviceid, deviceid->data,
1933 NFS4_DEVICEID4_SIZE);
1934 ),
1935
1936 TP_printk(
1937 "deviceid=%s, dstaddr=%s",
1938 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE),
1939 __get_str(dstaddr)
1940 )
1941);
1942#define DEFINE_PNFS_DEVICEID_EVENT(name) \
1943 DEFINE_EVENT(nfs4_deviceid_event, name, \
1944 TP_PROTO(const struct nfs_client *clp, \
1945 const struct nfs4_deviceid *deviceid \
1946 ), \
1947 TP_ARGS(clp, deviceid))
1948DEFINE_PNFS_DEVICEID_EVENT(nfs4_deviceid_free);
1949
1950DECLARE_EVENT_CLASS(nfs4_deviceid_status,
1951 TP_PROTO(
1952 const struct nfs_server *server,
1953 const struct nfs4_deviceid *deviceid,
1954 int status
1955 ),
1956
1957 TP_ARGS(server, deviceid, status),
1958
1959 TP_STRUCT__entry(
1960 __field(dev_t, dev)
1961 __field(int, status)
1962 __string(dstaddr, server->nfs_client->cl_hostname)
1963 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE)
1964 ),
1965
1966 TP_fast_assign(
1967 __entry->dev = server->s_dev;
1968 __entry->status = status;
1969 __assign_str(dstaddr, server->nfs_client->cl_hostname);
1970 memcpy(__entry->deviceid, deviceid->data,
1971 NFS4_DEVICEID4_SIZE);
1972 ),
1973
1974 TP_printk(
1975 "dev=%02x:%02x: deviceid=%s, dstaddr=%s, status=%d",
1976 MAJOR(__entry->dev), MINOR(__entry->dev),
1977 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE),
1978 __get_str(dstaddr),
1979 __entry->status
1980 )
1981);
1982#define DEFINE_PNFS_DEVICEID_STATUS(name) \
1983 DEFINE_EVENT(nfs4_deviceid_status, name, \
1984 TP_PROTO(const struct nfs_server *server, \
1985 const struct nfs4_deviceid *deviceid, \
1986 int status \
1987 ), \
1988 TP_ARGS(server, deviceid, status))
1989DEFINE_PNFS_DEVICEID_STATUS(nfs4_getdeviceinfo);
1990DEFINE_PNFS_DEVICEID_STATUS(nfs4_find_deviceid);
1991
Trond Myklebust088f3e62020-01-06 15:25:11 -05001992DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event,
1993 TP_PROTO(
1994 const struct nfs_pgio_header *hdr
1995 ),
1996
1997 TP_ARGS(hdr),
1998
1999 TP_STRUCT__entry(
2000 __field(unsigned long, error)
2001 __field(dev_t, dev)
2002 __field(u32, fhandle)
2003 __field(u64, fileid)
2004 __field(loff_t, offset)
2005 __field(u32, count)
2006 __field(int, stateid_seq)
2007 __field(u32, stateid_hash)
2008 __string(dstaddr, hdr->ds_clp ?
2009 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
2010 RPC_DISPLAY_ADDR) : "unknown")
2011 ),
2012
2013 TP_fast_assign(
2014 const struct inode *inode = hdr->inode;
2015
2016 __entry->error = hdr->res.op_status;
2017 __entry->fhandle = nfs_fhandle_hash(hdr->args.fh);
2018 __entry->fileid = NFS_FILEID(inode);
2019 __entry->dev = inode->i_sb->s_dev;
2020 __entry->offset = hdr->args.offset;
2021 __entry->count = hdr->args.count;
2022 __entry->stateid_seq =
2023 be32_to_cpu(hdr->args.stateid.seqid);
2024 __entry->stateid_hash =
2025 nfs_stateid_hash(&hdr->args.stateid);
2026 __assign_str(dstaddr, hdr->ds_clp ?
2027 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient,
2028 RPC_DISPLAY_ADDR) : "unknown");
2029 ),
2030
2031 TP_printk(
2032 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2033 "offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s",
2034 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04002035 show_nfs4_status(__entry->error),
Trond Myklebust088f3e62020-01-06 15:25:11 -05002036 MAJOR(__entry->dev), MINOR(__entry->dev),
2037 (unsigned long long)__entry->fileid,
2038 __entry->fhandle,
2039 __entry->offset, __entry->count,
2040 __entry->stateid_seq, __entry->stateid_hash,
2041 __get_str(dstaddr)
2042 )
2043);
2044
2045#define DEFINE_NFS4_FLEXFILES_IO_EVENT(name) \
2046 DEFINE_EVENT(nfs4_flexfiles_io_event, name, \
2047 TP_PROTO( \
2048 const struct nfs_pgio_header *hdr \
2049 ), \
2050 TP_ARGS(hdr))
2051DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_read_error);
2052DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_write_error);
2053
2054TRACE_EVENT(ff_layout_commit_error,
2055 TP_PROTO(
2056 const struct nfs_commit_data *data
2057 ),
2058
2059 TP_ARGS(data),
2060
2061 TP_STRUCT__entry(
2062 __field(unsigned long, error)
2063 __field(dev_t, dev)
2064 __field(u32, fhandle)
2065 __field(u64, fileid)
2066 __field(loff_t, offset)
2067 __field(u32, count)
2068 __string(dstaddr, data->ds_clp ?
2069 rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
2070 RPC_DISPLAY_ADDR) : "unknown")
2071 ),
2072
2073 TP_fast_assign(
2074 const struct inode *inode = data->inode;
2075
2076 __entry->error = data->res.op_status;
2077 __entry->fhandle = nfs_fhandle_hash(data->args.fh);
2078 __entry->fileid = NFS_FILEID(inode);
2079 __entry->dev = inode->i_sb->s_dev;
2080 __entry->offset = data->args.offset;
2081 __entry->count = data->args.count;
2082 __assign_str(dstaddr, data->ds_clp ?
2083 rpc_peeraddr2str(data->ds_clp->cl_rpcclient,
2084 RPC_DISPLAY_ADDR) : "unknown");
2085 ),
2086
2087 TP_printk(
2088 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2089 "offset=%llu count=%u dstaddr=%s",
2090 -__entry->error,
Chuck Lever87915452021-10-22 16:17:03 -04002091 show_nfs4_status(__entry->error),
Trond Myklebust088f3e62020-01-06 15:25:11 -05002092 MAJOR(__entry->dev), MINOR(__entry->dev),
2093 (unsigned long long)__entry->fileid,
2094 __entry->fhandle,
2095 __entry->offset, __entry->count,
2096 __get_str(dstaddr)
2097 )
2098);
2099
Olga Kornievskaiaf628d462021-11-04 10:57:08 -04002100TRACE_DEFINE_ENUM(NFS4_CONTENT_DATA);
2101TRACE_DEFINE_ENUM(NFS4_CONTENT_HOLE);
2102
2103#define show_llseek_mode(what) \
2104 __print_symbolic(what, \
2105 { NFS4_CONTENT_DATA, "DATA" }, \
2106 { NFS4_CONTENT_HOLE, "HOLE" })
2107
2108#ifdef CONFIG_NFS_V4_2
2109TRACE_EVENT(nfs4_llseek,
2110 TP_PROTO(
2111 const struct inode *inode,
2112 const struct nfs42_seek_args *args,
2113 const struct nfs42_seek_res *res,
2114 int error
2115 ),
2116
2117 TP_ARGS(inode, args, res, error),
2118
2119 TP_STRUCT__entry(
2120 __field(unsigned long, error)
2121 __field(u32, fhandle)
2122 __field(u32, fileid)
2123 __field(dev_t, dev)
2124 __field(int, stateid_seq)
2125 __field(u32, stateid_hash)
2126 __field(loff_t, offset_s)
2127 __field(u32, what)
2128 __field(loff_t, offset_r)
2129 __field(u32, eof)
2130 ),
2131
2132 TP_fast_assign(
2133 const struct nfs_inode *nfsi = NFS_I(inode);
2134 const struct nfs_fh *fh = args->sa_fh;
2135
2136 __entry->fileid = nfsi->fileid;
2137 __entry->dev = inode->i_sb->s_dev;
2138 __entry->fhandle = nfs_fhandle_hash(fh);
2139 __entry->offset_s = args->sa_offset;
2140 __entry->stateid_seq =
2141 be32_to_cpu(args->sa_stateid.seqid);
2142 __entry->stateid_hash =
2143 nfs_stateid_hash(&args->sa_stateid);
2144 __entry->what = args->sa_what;
2145 if (error) {
2146 __entry->error = -error;
2147 __entry->offset_r = 0;
2148 __entry->eof = 0;
2149 } else {
2150 __entry->error = 0;
2151 __entry->offset_r = res->sr_offset;
2152 __entry->eof = res->sr_eof;
2153 }
2154 ),
2155
2156 TP_printk(
2157 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2158 "stateid=%d:0x%08x offset_s=%llu what=%s "
2159 "offset_r=%llu eof=%u",
2160 -__entry->error,
2161 show_nfs4_status(__entry->error),
2162 MAJOR(__entry->dev), MINOR(__entry->dev),
2163 (unsigned long long)__entry->fileid,
2164 __entry->fhandle,
2165 __entry->stateid_seq, __entry->stateid_hash,
2166 __entry->offset_s,
2167 show_llseek_mode(__entry->what),
2168 __entry->offset_r,
2169 __entry->eof
2170 )
2171);
2172
Olga Kornievskaia40a82412021-11-04 10:57:09 -04002173DECLARE_EVENT_CLASS(nfs4_sparse_event,
2174 TP_PROTO(
2175 const struct inode *inode,
2176 const struct nfs42_falloc_args *args,
2177 int error
2178 ),
2179
2180 TP_ARGS(inode, args, error),
2181
2182 TP_STRUCT__entry(
2183 __field(unsigned long, error)
2184 __field(loff_t, offset)
2185 __field(loff_t, len)
2186 __field(dev_t, dev)
2187 __field(u32, fhandle)
2188 __field(u64, fileid)
2189 __field(int, stateid_seq)
2190 __field(u32, stateid_hash)
2191 ),
2192
2193 TP_fast_assign(
2194 __entry->error = error < 0 ? -error : 0;
2195 __entry->offset = args->falloc_offset;
2196 __entry->len = args->falloc_length;
2197 __entry->dev = inode->i_sb->s_dev;
2198 __entry->fileid = NFS_FILEID(inode);
2199 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
2200 __entry->stateid_seq =
2201 be32_to_cpu(args->falloc_stateid.seqid);
2202 __entry->stateid_hash =
2203 nfs_stateid_hash(&args->falloc_stateid);
2204 ),
2205
2206 TP_printk(
2207 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2208 "stateid=%d:0x%08x offset=%llu len=%llu",
2209 -__entry->error,
2210 show_nfs4_status(__entry->error),
2211 MAJOR(__entry->dev), MINOR(__entry->dev),
2212 (unsigned long long)__entry->fileid,
2213 __entry->fhandle,
2214 __entry->stateid_seq, __entry->stateid_hash,
2215 (long long)__entry->offset,
2216 (long long)__entry->len
2217 )
2218);
2219#define DEFINE_NFS4_SPARSE_EVENT(name) \
2220 DEFINE_EVENT(nfs4_sparse_event, name, \
2221 TP_PROTO( \
2222 const struct inode *inode, \
2223 const struct nfs42_falloc_args *args, \
2224 int error \
2225 ), \
2226 TP_ARGS(inode, args, error))
2227DEFINE_NFS4_SPARSE_EVENT(nfs4_fallocate);
2228DEFINE_NFS4_SPARSE_EVENT(nfs4_deallocate);
Olga Kornievskaiace7cea12021-11-04 10:57:10 -04002229
2230TRACE_EVENT(nfs4_copy,
2231 TP_PROTO(
2232 const struct inode *src_inode,
2233 const struct inode *dst_inode,
2234 const struct nfs42_copy_args *args,
2235 const struct nfs42_copy_res *res,
2236 const struct nl4_server *nss,
2237 int error
2238 ),
2239
2240 TP_ARGS(src_inode, dst_inode, args, res, nss, error),
2241
2242 TP_STRUCT__entry(
2243 __field(unsigned long, error)
2244 __field(u32, src_fhandle)
2245 __field(u32, src_fileid)
2246 __field(u32, dst_fhandle)
2247 __field(u32, dst_fileid)
2248 __field(dev_t, src_dev)
2249 __field(dev_t, dst_dev)
2250 __field(int, src_stateid_seq)
2251 __field(u32, src_stateid_hash)
2252 __field(int, dst_stateid_seq)
2253 __field(u32, dst_stateid_hash)
2254 __field(loff_t, src_offset)
2255 __field(loff_t, dst_offset)
2256 __field(bool, sync)
2257 __field(loff_t, len)
2258 __field(int, res_stateid_seq)
2259 __field(u32, res_stateid_hash)
2260 __field(loff_t, res_count)
2261 __field(bool, res_sync)
2262 __field(bool, res_cons)
2263 __field(bool, intra)
2264 ),
2265
2266 TP_fast_assign(
2267 const struct nfs_inode *src_nfsi = NFS_I(src_inode);
2268 const struct nfs_inode *dst_nfsi = NFS_I(dst_inode);
2269
2270 __entry->src_fileid = src_nfsi->fileid;
2271 __entry->src_dev = src_inode->i_sb->s_dev;
2272 __entry->src_fhandle = nfs_fhandle_hash(args->src_fh);
2273 __entry->src_offset = args->src_pos;
2274 __entry->dst_fileid = dst_nfsi->fileid;
2275 __entry->dst_dev = dst_inode->i_sb->s_dev;
2276 __entry->dst_fhandle = nfs_fhandle_hash(args->dst_fh);
2277 __entry->dst_offset = args->dst_pos;
2278 __entry->len = args->count;
2279 __entry->sync = args->sync;
2280 __entry->src_stateid_seq =
2281 be32_to_cpu(args->src_stateid.seqid);
2282 __entry->src_stateid_hash =
2283 nfs_stateid_hash(&args->src_stateid);
2284 __entry->dst_stateid_seq =
2285 be32_to_cpu(args->dst_stateid.seqid);
2286 __entry->dst_stateid_hash =
2287 nfs_stateid_hash(&args->dst_stateid);
2288 __entry->intra = nss ? 0 : 1;
2289 if (error) {
2290 __entry->error = -error;
2291 __entry->res_stateid_seq = 0;
2292 __entry->res_stateid_hash = 0;
2293 __entry->res_count = 0;
2294 __entry->res_sync = 0;
2295 __entry->res_cons = 0;
2296 } else {
2297 __entry->error = 0;
2298 __entry->res_stateid_seq =
2299 be32_to_cpu(res->write_res.stateid.seqid);
2300 __entry->res_stateid_hash =
2301 nfs_stateid_hash(&res->write_res.stateid);
2302 __entry->res_count = res->write_res.count;
2303 __entry->res_sync = res->synchronous;
2304 __entry->res_cons = res->consecutive;
2305 }
2306 ),
2307
2308 TP_printk(
2309 "error=%ld (%s) intra=%d src_fileid=%02x:%02x:%llu "
2310 "src_fhandle=0x%08x dst_fileid=%02x:%02x:%llu "
2311 "dst_fhandle=0x%08x src_stateid=%d:0x%08x "
2312 "dst_stateid=%d:0x%08x src_offset=%llu dst_offset=%llu "
2313 "len=%llu sync=%d cb_stateid=%d:0x%08x res_sync=%d "
2314 "res_cons=%d res_count=%llu",
2315 -__entry->error,
2316 show_nfs4_status(__entry->error),
2317 __entry->intra,
2318 MAJOR(__entry->src_dev), MINOR(__entry->src_dev),
2319 (unsigned long long)__entry->src_fileid,
2320 __entry->src_fhandle,
2321 MAJOR(__entry->dst_dev), MINOR(__entry->dst_dev),
2322 (unsigned long long)__entry->dst_fileid,
2323 __entry->dst_fhandle,
2324 __entry->src_stateid_seq, __entry->src_stateid_hash,
2325 __entry->dst_stateid_seq, __entry->dst_stateid_hash,
2326 __entry->src_offset,
2327 __entry->dst_offset,
2328 __entry->len,
2329 __entry->sync,
2330 __entry->res_stateid_seq, __entry->res_stateid_hash,
2331 __entry->res_sync,
2332 __entry->res_cons,
2333 __entry->res_count
2334 )
2335);
Olga Kornievskaia2a65ca82021-11-04 10:57:11 -04002336
2337TRACE_EVENT(nfs4_clone,
2338 TP_PROTO(
2339 const struct inode *src_inode,
2340 const struct inode *dst_inode,
2341 const struct nfs42_clone_args *args,
2342 int error
2343 ),
2344
2345 TP_ARGS(src_inode, dst_inode, args, error),
2346
2347 TP_STRUCT__entry(
2348 __field(unsigned long, error)
2349 __field(u32, src_fhandle)
2350 __field(u32, src_fileid)
2351 __field(u32, dst_fhandle)
2352 __field(u32, dst_fileid)
2353 __field(dev_t, src_dev)
2354 __field(dev_t, dst_dev)
2355 __field(loff_t, src_offset)
2356 __field(loff_t, dst_offset)
2357 __field(int, src_stateid_seq)
2358 __field(u32, src_stateid_hash)
2359 __field(int, dst_stateid_seq)
2360 __field(u32, dst_stateid_hash)
2361 __field(loff_t, len)
2362 ),
2363
2364 TP_fast_assign(
2365 const struct nfs_inode *src_nfsi = NFS_I(src_inode);
2366 const struct nfs_inode *dst_nfsi = NFS_I(dst_inode);
2367
2368 __entry->src_fileid = src_nfsi->fileid;
2369 __entry->src_dev = src_inode->i_sb->s_dev;
2370 __entry->src_fhandle = nfs_fhandle_hash(args->src_fh);
2371 __entry->src_offset = args->src_offset;
2372 __entry->dst_fileid = dst_nfsi->fileid;
2373 __entry->dst_dev = dst_inode->i_sb->s_dev;
2374 __entry->dst_fhandle = nfs_fhandle_hash(args->dst_fh);
2375 __entry->dst_offset = args->dst_offset;
2376 __entry->len = args->count;
2377 __entry->error = error < 0 ? -error : 0;
2378 __entry->src_stateid_seq =
2379 be32_to_cpu(args->src_stateid.seqid);
2380 __entry->src_stateid_hash =
2381 nfs_stateid_hash(&args->src_stateid);
2382 __entry->dst_stateid_seq =
2383 be32_to_cpu(args->dst_stateid.seqid);
2384 __entry->dst_stateid_hash =
2385 nfs_stateid_hash(&args->dst_stateid);
2386 ),
2387
2388 TP_printk(
2389 "error=%ld (%s) src_fileid=%02x:%02x:%llu "
2390 "src_fhandle=0x%08x dst_fileid=%02x:%02x:%llu "
2391 "dst_fhandle=0x%08x src_stateid=%d:0x%08x "
2392 "dst_stateid=%d:0x%08x src_offset=%llu "
2393 "dst_offset=%llu len=%llu",
2394 -__entry->error,
2395 show_nfs4_status(__entry->error),
2396 MAJOR(__entry->src_dev), MINOR(__entry->src_dev),
2397 (unsigned long long)__entry->src_fileid,
2398 __entry->src_fhandle,
2399 MAJOR(__entry->dst_dev), MINOR(__entry->dst_dev),
2400 (unsigned long long)__entry->dst_fileid,
2401 __entry->dst_fhandle,
2402 __entry->src_stateid_seq, __entry->src_stateid_hash,
2403 __entry->dst_stateid_seq, __entry->dst_stateid_hash,
2404 __entry->src_offset,
2405 __entry->dst_offset,
2406 __entry->len
2407 )
2408);
Olga Kornievskaia488b1702021-11-04 10:57:13 -04002409
2410TRACE_EVENT(nfs4_copy_notify,
2411 TP_PROTO(
2412 const struct inode *inode,
2413 const struct nfs42_copy_notify_args *args,
2414 const struct nfs42_copy_notify_res *res,
2415 int error
2416 ),
2417
2418 TP_ARGS(inode, args, res, error),
2419
2420 TP_STRUCT__entry(
2421 __field(unsigned long, error)
2422 __field(u32, fhandle)
2423 __field(u32, fileid)
2424 __field(dev_t, dev)
2425 __field(int, stateid_seq)
2426 __field(u32, stateid_hash)
2427 __field(int, res_stateid_seq)
2428 __field(u32, res_stateid_hash)
2429 ),
2430
2431 TP_fast_assign(
2432 const struct nfs_inode *nfsi = NFS_I(inode);
2433
2434 __entry->fileid = nfsi->fileid;
2435 __entry->dev = inode->i_sb->s_dev;
2436 __entry->fhandle = nfs_fhandle_hash(args->cna_src_fh);
2437 __entry->stateid_seq =
2438 be32_to_cpu(args->cna_src_stateid.seqid);
2439 __entry->stateid_hash =
2440 nfs_stateid_hash(&args->cna_src_stateid);
2441 if (error) {
2442 __entry->error = -error;
2443 __entry->res_stateid_seq = 0;
2444 __entry->res_stateid_hash = 0;
2445 } else {
2446 __entry->error = 0;
2447 __entry->res_stateid_seq =
2448 be32_to_cpu(res->cnr_stateid.seqid);
2449 __entry->res_stateid_hash =
2450 nfs_stateid_hash(&res->cnr_stateid);
2451 }
2452 ),
2453
2454 TP_printk(
2455 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
2456 "stateid=%d:0x%08x res_stateid=%d:0x%08x",
2457 -__entry->error,
2458 show_nfs4_status(__entry->error),
2459 MAJOR(__entry->dev), MINOR(__entry->dev),
2460 (unsigned long long)__entry->fileid,
2461 __entry->fhandle,
2462 __entry->stateid_seq, __entry->stateid_hash,
2463 __entry->res_stateid_seq, __entry->res_stateid_hash
2464 )
2465);
Olga Kornievskaia127beca2021-11-04 10:57:14 -04002466
2467TRACE_EVENT(nfs4_offload_cancel,
2468 TP_PROTO(
2469 const struct nfs42_offload_status_args *args,
2470 int error
2471 ),
2472
2473 TP_ARGS(args, error),
2474
2475 TP_STRUCT__entry(
2476 __field(unsigned long, error)
2477 __field(u32, fhandle)
2478 __field(int, stateid_seq)
2479 __field(u32, stateid_hash)
2480 ),
2481
2482 TP_fast_assign(
2483 __entry->fhandle = nfs_fhandle_hash(args->osa_src_fh);
2484 __entry->error = error < 0 ? -error : 0;
2485 __entry->stateid_seq =
2486 be32_to_cpu(args->osa_stateid.seqid);
2487 __entry->stateid_hash =
2488 nfs_stateid_hash(&args->osa_stateid);
2489 ),
2490
2491 TP_printk(
2492 "error=%ld (%s) fhandle=0x%08x stateid=%d:0x%08x",
2493 -__entry->error,
2494 show_nfs4_status(__entry->error),
2495 __entry->fhandle,
2496 __entry->stateid_seq, __entry->stateid_hash
2497 )
2498);
Olga Kornievskaiaf628d462021-11-04 10:57:08 -04002499#endif /* CONFIG_NFS_V4_2 */
Trond Myklebust088f3e62020-01-06 15:25:11 -05002500
Trond Myklebustcc668ab2013-08-14 15:31:28 -04002501#endif /* CONFIG_NFS_V4_1 */
2502
Trond Myklebustc6d01c62013-08-09 11:51:26 -04002503#endif /* _TRACE_NFS4_H */
2504
2505#undef TRACE_INCLUDE_PATH
2506#define TRACE_INCLUDE_PATH .
2507#define TRACE_INCLUDE_FILE nfs4trace
2508/* This part must be outside protection */
2509#include <trace/define_trace.h>