• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2014 Christoph Hellwig.
4  */
5 #undef TRACE_SYSTEM
6 #define TRACE_SYSTEM nfsd
7 
8 #if !defined(_NFSD_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
9 #define _NFSD_TRACE_H
10 
11 #include <linux/tracepoint.h>
12 #include "export.h"
13 #include "nfsfh.h"
14 
15 TRACE_EVENT(nfsd_compound,
16 	TP_PROTO(const struct svc_rqst *rqst,
17 		 u32 args_opcnt),
18 	TP_ARGS(rqst, args_opcnt),
19 	TP_STRUCT__entry(
20 		__field(u32, xid)
21 		__field(u32, args_opcnt)
22 	),
23 	TP_fast_assign(
24 		__entry->xid = be32_to_cpu(rqst->rq_xid);
25 		__entry->args_opcnt = args_opcnt;
26 	),
27 	TP_printk("xid=0x%08x opcnt=%u",
28 		__entry->xid, __entry->args_opcnt)
29 )
30 
31 TRACE_EVENT(nfsd_compound_status,
32 	TP_PROTO(u32 args_opcnt,
33 		 u32 resp_opcnt,
34 		 __be32 status,
35 		 const char *name),
36 	TP_ARGS(args_opcnt, resp_opcnt, status, name),
37 	TP_STRUCT__entry(
38 		__field(u32, args_opcnt)
39 		__field(u32, resp_opcnt)
40 		__field(int, status)
41 		__string(name, name)
42 	),
43 	TP_fast_assign(
44 		__entry->args_opcnt = args_opcnt;
45 		__entry->resp_opcnt = resp_opcnt;
46 		__entry->status = be32_to_cpu(status);
47 		__assign_str(name, name);
48 	),
49 	TP_printk("op=%u/%u %s status=%d",
50 		__entry->resp_opcnt, __entry->args_opcnt,
51 		__get_str(name), __entry->status)
52 )
53 
54 DECLARE_EVENT_CLASS(nfsd_fh_err_class,
55 	TP_PROTO(struct svc_rqst *rqstp,
56 		 struct svc_fh	*fhp,
57 		 int		status),
58 	TP_ARGS(rqstp, fhp, status),
59 	TP_STRUCT__entry(
60 		__field(u32, xid)
61 		__field(u32, fh_hash)
62 		__field(int, status)
63 	),
64 	TP_fast_assign(
65 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
66 		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
67 		__entry->status = status;
68 	),
69 	TP_printk("xid=0x%08x fh_hash=0x%08x status=%d",
70 		  __entry->xid, __entry->fh_hash,
71 		  __entry->status)
72 )
73 
74 #define DEFINE_NFSD_FH_ERR_EVENT(name)		\
75 DEFINE_EVENT(nfsd_fh_err_class, nfsd_##name,	\
76 	TP_PROTO(struct svc_rqst *rqstp,	\
77 		 struct svc_fh	*fhp,		\
78 		 int		status),	\
79 	TP_ARGS(rqstp, fhp, status))
80 
81 DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badexport);
82 DEFINE_NFSD_FH_ERR_EVENT(set_fh_dentry_badhandle);
83 
84 TRACE_EVENT(nfsd_exp_find_key,
85 	TP_PROTO(const struct svc_expkey *key,
86 		 int status),
87 	TP_ARGS(key, status),
88 	TP_STRUCT__entry(
89 		__field(int, fsidtype)
90 		__array(u32, fsid, 6)
91 		__string(auth_domain, key->ek_client->name)
92 		__field(int, status)
93 	),
94 	TP_fast_assign(
95 		__entry->fsidtype = key->ek_fsidtype;
96 		memcpy(__entry->fsid, key->ek_fsid, 4*6);
97 		__assign_str(auth_domain, key->ek_client->name);
98 		__entry->status = status;
99 	),
100 	TP_printk("fsid=%x::%s domain=%s status=%d",
101 		__entry->fsidtype,
102 		__print_array(__entry->fsid, 6, 4),
103 		__get_str(auth_domain),
104 		__entry->status
105 	)
106 );
107 
108 TRACE_EVENT(nfsd_expkey_update,
109 	TP_PROTO(const struct svc_expkey *key, const char *exp_path),
110 	TP_ARGS(key, exp_path),
111 	TP_STRUCT__entry(
112 		__field(int, fsidtype)
113 		__array(u32, fsid, 6)
114 		__string(auth_domain, key->ek_client->name)
115 		__string(path, exp_path)
116 		__field(bool, cache)
117 	),
118 	TP_fast_assign(
119 		__entry->fsidtype = key->ek_fsidtype;
120 		memcpy(__entry->fsid, key->ek_fsid, 4*6);
121 		__assign_str(auth_domain, key->ek_client->name);
122 		__assign_str(path, exp_path);
123 		__entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags);
124 	),
125 	TP_printk("fsid=%x::%s domain=%s path=%s cache=%s",
126 		__entry->fsidtype,
127 		__print_array(__entry->fsid, 6, 4),
128 		__get_str(auth_domain),
129 		__get_str(path),
130 		__entry->cache ? "pos" : "neg"
131 	)
132 );
133 
134 TRACE_EVENT(nfsd_exp_get_by_name,
135 	TP_PROTO(const struct svc_export *key,
136 		 int status),
137 	TP_ARGS(key, status),
138 	TP_STRUCT__entry(
139 		__string(path, key->ex_path.dentry->d_name.name)
140 		__string(auth_domain, key->ex_client->name)
141 		__field(int, status)
142 	),
143 	TP_fast_assign(
144 		__assign_str(path, key->ex_path.dentry->d_name.name);
145 		__assign_str(auth_domain, key->ex_client->name);
146 		__entry->status = status;
147 	),
148 	TP_printk("path=%s domain=%s status=%d",
149 		__get_str(path),
150 		__get_str(auth_domain),
151 		__entry->status
152 	)
153 );
154 
155 TRACE_EVENT(nfsd_export_update,
156 	TP_PROTO(const struct svc_export *key),
157 	TP_ARGS(key),
158 	TP_STRUCT__entry(
159 		__string(path, key->ex_path.dentry->d_name.name)
160 		__string(auth_domain, key->ex_client->name)
161 		__field(bool, cache)
162 	),
163 	TP_fast_assign(
164 		__assign_str(path, key->ex_path.dentry->d_name.name);
165 		__assign_str(auth_domain, key->ex_client->name);
166 		__entry->cache = !test_bit(CACHE_NEGATIVE, &key->h.flags);
167 	),
168 	TP_printk("path=%s domain=%s cache=%s",
169 		__get_str(path),
170 		__get_str(auth_domain),
171 		__entry->cache ? "pos" : "neg"
172 	)
173 );
174 
175 DECLARE_EVENT_CLASS(nfsd_io_class,
176 	TP_PROTO(struct svc_rqst *rqstp,
177 		 struct svc_fh	*fhp,
178 		 u64		offset,
179 		 u32		len),
180 	TP_ARGS(rqstp, fhp, offset, len),
181 	TP_STRUCT__entry(
182 		__field(u32, xid)
183 		__field(u32, fh_hash)
184 		__field(u64, offset)
185 		__field(u32, len)
186 	),
187 	TP_fast_assign(
188 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
189 		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
190 		__entry->offset = offset;
191 		__entry->len = len;
192 	),
193 	TP_printk("xid=0x%08x fh_hash=0x%08x offset=%llu len=%u",
194 		  __entry->xid, __entry->fh_hash,
195 		  __entry->offset, __entry->len)
196 )
197 
198 #define DEFINE_NFSD_IO_EVENT(name)		\
199 DEFINE_EVENT(nfsd_io_class, nfsd_##name,	\
200 	TP_PROTO(struct svc_rqst *rqstp,	\
201 		 struct svc_fh	*fhp,		\
202 		 u64		offset,		\
203 		 u32		len),		\
204 	TP_ARGS(rqstp, fhp, offset, len))
205 
206 DEFINE_NFSD_IO_EVENT(read_start);
207 DEFINE_NFSD_IO_EVENT(read_splice);
208 DEFINE_NFSD_IO_EVENT(read_vector);
209 DEFINE_NFSD_IO_EVENT(read_io_done);
210 DEFINE_NFSD_IO_EVENT(read_done);
211 DEFINE_NFSD_IO_EVENT(write_start);
212 DEFINE_NFSD_IO_EVENT(write_opened);
213 DEFINE_NFSD_IO_EVENT(write_io_done);
214 DEFINE_NFSD_IO_EVENT(write_done);
215 
216 DECLARE_EVENT_CLASS(nfsd_err_class,
217 	TP_PROTO(struct svc_rqst *rqstp,
218 		 struct svc_fh	*fhp,
219 		 loff_t		offset,
220 		 int		status),
221 	TP_ARGS(rqstp, fhp, offset, status),
222 	TP_STRUCT__entry(
223 		__field(u32, xid)
224 		__field(u32, fh_hash)
225 		__field(loff_t, offset)
226 		__field(int, status)
227 	),
228 	TP_fast_assign(
229 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
230 		__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
231 		__entry->offset = offset;
232 		__entry->status = status;
233 	),
234 	TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld status=%d",
235 		  __entry->xid, __entry->fh_hash,
236 		  __entry->offset, __entry->status)
237 )
238 
239 #define DEFINE_NFSD_ERR_EVENT(name)		\
240 DEFINE_EVENT(nfsd_err_class, nfsd_##name,	\
241 	TP_PROTO(struct svc_rqst *rqstp,	\
242 		 struct svc_fh	*fhp,		\
243 		 loff_t		offset,		\
244 		 int		len),		\
245 	TP_ARGS(rqstp, fhp, offset, len))
246 
247 DEFINE_NFSD_ERR_EVENT(read_err);
248 DEFINE_NFSD_ERR_EVENT(write_err);
249 
250 #include "state.h"
251 #include "filecache.h"
252 #include "vfs.h"
253 
254 DECLARE_EVENT_CLASS(nfsd_stateid_class,
255 	TP_PROTO(stateid_t *stp),
256 	TP_ARGS(stp),
257 	TP_STRUCT__entry(
258 		__field(u32, cl_boot)
259 		__field(u32, cl_id)
260 		__field(u32, si_id)
261 		__field(u32, si_generation)
262 	),
263 	TP_fast_assign(
264 		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
265 		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
266 		__entry->si_id = stp->si_opaque.so_id;
267 		__entry->si_generation = stp->si_generation;
268 	),
269 	TP_printk("client %08x:%08x stateid %08x:%08x",
270 		__entry->cl_boot,
271 		__entry->cl_id,
272 		__entry->si_id,
273 		__entry->si_generation)
274 )
275 
276 #define DEFINE_STATEID_EVENT(name) \
277 DEFINE_EVENT(nfsd_stateid_class, nfsd_##name, \
278 	TP_PROTO(stateid_t *stp), \
279 	TP_ARGS(stp))
280 
281 DEFINE_STATEID_EVENT(layoutstate_alloc);
282 DEFINE_STATEID_EVENT(layoutstate_unhash);
283 DEFINE_STATEID_EVENT(layoutstate_free);
284 DEFINE_STATEID_EVENT(layout_get_lookup_fail);
285 DEFINE_STATEID_EVENT(layout_commit_lookup_fail);
286 DEFINE_STATEID_EVENT(layout_return_lookup_fail);
287 DEFINE_STATEID_EVENT(layout_recall);
288 DEFINE_STATEID_EVENT(layout_recall_done);
289 DEFINE_STATEID_EVENT(layout_recall_fail);
290 DEFINE_STATEID_EVENT(layout_recall_release);
291 
292 DEFINE_STATEID_EVENT(open);
293 DEFINE_STATEID_EVENT(deleg_read);
294 DEFINE_STATEID_EVENT(deleg_break);
295 DEFINE_STATEID_EVENT(deleg_recall);
296 
297 DECLARE_EVENT_CLASS(nfsd_stateseqid_class,
298 	TP_PROTO(u32 seqid, const stateid_t *stp),
299 	TP_ARGS(seqid, stp),
300 	TP_STRUCT__entry(
301 		__field(u32, seqid)
302 		__field(u32, cl_boot)
303 		__field(u32, cl_id)
304 		__field(u32, si_id)
305 		__field(u32, si_generation)
306 	),
307 	TP_fast_assign(
308 		__entry->seqid = seqid;
309 		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
310 		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
311 		__entry->si_id = stp->si_opaque.so_id;
312 		__entry->si_generation = stp->si_generation;
313 	),
314 	TP_printk("seqid=%u client %08x:%08x stateid %08x:%08x",
315 		__entry->seqid, __entry->cl_boot, __entry->cl_id,
316 		__entry->si_id, __entry->si_generation)
317 )
318 
319 #define DEFINE_STATESEQID_EVENT(name) \
320 DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \
321 	TP_PROTO(u32 seqid, const stateid_t *stp), \
322 	TP_ARGS(seqid, stp))
323 
324 DEFINE_STATESEQID_EVENT(preprocess);
325 DEFINE_STATESEQID_EVENT(open_confirm);
326 
327 DECLARE_EVENT_CLASS(nfsd_clientid_class,
328 	TP_PROTO(const clientid_t *clid),
329 	TP_ARGS(clid),
330 	TP_STRUCT__entry(
331 		__field(u32, cl_boot)
332 		__field(u32, cl_id)
333 	),
334 	TP_fast_assign(
335 		__entry->cl_boot = clid->cl_boot;
336 		__entry->cl_id = clid->cl_id;
337 	),
338 	TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id)
339 )
340 
341 #define DEFINE_CLIENTID_EVENT(name) \
342 DEFINE_EVENT(nfsd_clientid_class, nfsd_clid_##name, \
343 	TP_PROTO(const clientid_t *clid), \
344 	TP_ARGS(clid))
345 
346 DEFINE_CLIENTID_EVENT(expired);
347 DEFINE_CLIENTID_EVENT(purged);
348 DEFINE_CLIENTID_EVENT(renew);
349 DEFINE_CLIENTID_EVENT(stale);
350 
351 DECLARE_EVENT_CLASS(nfsd_net_class,
352 	TP_PROTO(const struct nfsd_net *nn),
353 	TP_ARGS(nn),
354 	TP_STRUCT__entry(
355 		__field(unsigned long long, boot_time)
356 	),
357 	TP_fast_assign(
358 		__entry->boot_time = nn->boot_time;
359 	),
360 	TP_printk("boot_time=%16llx", __entry->boot_time)
361 )
362 
363 #define DEFINE_NET_EVENT(name) \
364 DEFINE_EVENT(nfsd_net_class, nfsd_##name, \
365 	TP_PROTO(const struct nfsd_net *nn), \
366 	TP_ARGS(nn))
367 
368 DEFINE_NET_EVENT(grace_start);
369 DEFINE_NET_EVENT(grace_complete);
370 
371 TRACE_EVENT(nfsd_clid_inuse_err,
372 	TP_PROTO(const struct nfs4_client *clp),
373 	TP_ARGS(clp),
374 	TP_STRUCT__entry(
375 		__field(u32, cl_boot)
376 		__field(u32, cl_id)
377 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
378 		__field(unsigned int, namelen)
379 		__dynamic_array(unsigned char, name, clp->cl_name.len)
380 	),
381 	TP_fast_assign(
382 		__entry->cl_boot = clp->cl_clientid.cl_boot;
383 		__entry->cl_id = clp->cl_clientid.cl_id;
384 		memcpy(__entry->addr, &clp->cl_addr,
385 			sizeof(struct sockaddr_in6));
386 		__entry->namelen = clp->cl_name.len;
387 		memcpy(__get_dynamic_array(name), clp->cl_name.data,
388 			clp->cl_name.len);
389 	),
390 	TP_printk("nfs4_clientid %.*s already in use by %pISpc, client %08x:%08x",
391 		__entry->namelen, __get_str(name), __entry->addr,
392 		__entry->cl_boot, __entry->cl_id)
393 )
394 
395 TRACE_DEFINE_ENUM(NFSD_FILE_HASHED);
396 TRACE_DEFINE_ENUM(NFSD_FILE_PENDING);
397 TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_READ);
398 TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_WRITE);
399 TRACE_DEFINE_ENUM(NFSD_FILE_REFERENCED);
400 
401 #define show_nf_flags(val)						\
402 	__print_flags(val, "|",						\
403 		{ 1 << NFSD_FILE_HASHED,	"HASHED" },		\
404 		{ 1 << NFSD_FILE_PENDING,	"PENDING" },		\
405 		{ 1 << NFSD_FILE_BREAK_READ,	"BREAK_READ" },		\
406 		{ 1 << NFSD_FILE_BREAK_WRITE,	"BREAK_WRITE" },	\
407 		{ 1 << NFSD_FILE_REFERENCED,	"REFERENCED"})
408 
409 /* FIXME: This should probably be fleshed out in the future. */
410 #define show_nf_may(val)						\
411 	__print_flags(val, "|",						\
412 		{ NFSD_MAY_READ,		"READ" },		\
413 		{ NFSD_MAY_WRITE,		"WRITE" },		\
414 		{ NFSD_MAY_NOT_BREAK_LEASE,	"NOT_BREAK_LEASE" })
415 
416 DECLARE_EVENT_CLASS(nfsd_file_class,
417 	TP_PROTO(struct nfsd_file *nf),
418 	TP_ARGS(nf),
419 	TP_STRUCT__entry(
420 		__field(unsigned int, nf_hashval)
421 		__field(void *, nf_inode)
422 		__field(int, nf_ref)
423 		__field(unsigned long, nf_flags)
424 		__field(unsigned char, nf_may)
425 		__field(struct file *, nf_file)
426 	),
427 	TP_fast_assign(
428 		__entry->nf_hashval = nf->nf_hashval;
429 		__entry->nf_inode = nf->nf_inode;
430 		__entry->nf_ref = refcount_read(&nf->nf_ref);
431 		__entry->nf_flags = nf->nf_flags;
432 		__entry->nf_may = nf->nf_may;
433 		__entry->nf_file = nf->nf_file;
434 	),
435 	TP_printk("hash=0x%x inode=0x%p ref=%d flags=%s may=%s file=%p",
436 		__entry->nf_hashval,
437 		__entry->nf_inode,
438 		__entry->nf_ref,
439 		show_nf_flags(__entry->nf_flags),
440 		show_nf_may(__entry->nf_may),
441 		__entry->nf_file)
442 )
443 
444 #define DEFINE_NFSD_FILE_EVENT(name) \
445 DEFINE_EVENT(nfsd_file_class, name, \
446 	TP_PROTO(struct nfsd_file *nf), \
447 	TP_ARGS(nf))
448 
449 DEFINE_NFSD_FILE_EVENT(nfsd_file_alloc);
450 DEFINE_NFSD_FILE_EVENT(nfsd_file_put_final);
451 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash);
452 DEFINE_NFSD_FILE_EVENT(nfsd_file_put);
453 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash_and_release_locked);
454 
455 TRACE_EVENT(nfsd_file_acquire,
456 	TP_PROTO(struct svc_rqst *rqstp, unsigned int hash,
457 		 struct inode *inode, unsigned int may_flags,
458 		 struct nfsd_file *nf, __be32 status),
459 
460 	TP_ARGS(rqstp, hash, inode, may_flags, nf, status),
461 
462 	TP_STRUCT__entry(
463 		__field(u32, xid)
464 		__field(unsigned int, hash)
465 		__field(void *, inode)
466 		__field(unsigned int, may_flags)
467 		__field(int, nf_ref)
468 		__field(unsigned long, nf_flags)
469 		__field(unsigned char, nf_may)
470 		__field(struct file *, nf_file)
471 		__field(u32, status)
472 	),
473 
474 	TP_fast_assign(
475 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
476 		__entry->hash = hash;
477 		__entry->inode = inode;
478 		__entry->may_flags = may_flags;
479 		__entry->nf_ref = nf ? refcount_read(&nf->nf_ref) : 0;
480 		__entry->nf_flags = nf ? nf->nf_flags : 0;
481 		__entry->nf_may = nf ? nf->nf_may : 0;
482 		__entry->nf_file = nf ? nf->nf_file : NULL;
483 		__entry->status = be32_to_cpu(status);
484 	),
485 
486 	TP_printk("xid=0x%x hash=0x%x inode=0x%p may_flags=%s ref=%d nf_flags=%s nf_may=%s nf_file=0x%p status=%u",
487 			__entry->xid, __entry->hash, __entry->inode,
488 			show_nf_may(__entry->may_flags), __entry->nf_ref,
489 			show_nf_flags(__entry->nf_flags),
490 			show_nf_may(__entry->nf_may), __entry->nf_file,
491 			__entry->status)
492 );
493 
494 DECLARE_EVENT_CLASS(nfsd_file_search_class,
495 	TP_PROTO(struct inode *inode, unsigned int hash, int found),
496 	TP_ARGS(inode, hash, found),
497 	TP_STRUCT__entry(
498 		__field(struct inode *, inode)
499 		__field(unsigned int, hash)
500 		__field(int, found)
501 	),
502 	TP_fast_assign(
503 		__entry->inode = inode;
504 		__entry->hash = hash;
505 		__entry->found = found;
506 	),
507 	TP_printk("hash=0x%x inode=0x%p found=%d", __entry->hash,
508 			__entry->inode, __entry->found)
509 );
510 
511 #define DEFINE_NFSD_FILE_SEARCH_EVENT(name)				\
512 DEFINE_EVENT(nfsd_file_search_class, name,				\
513 	TP_PROTO(struct inode *inode, unsigned int hash, int found),	\
514 	TP_ARGS(inode, hash, found))
515 
516 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode_sync);
517 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode);
518 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_is_cached);
519 
520 TRACE_EVENT(nfsd_file_fsnotify_handle_event,
521 	TP_PROTO(struct inode *inode, u32 mask),
522 	TP_ARGS(inode, mask),
523 	TP_STRUCT__entry(
524 		__field(struct inode *, inode)
525 		__field(unsigned int, nlink)
526 		__field(umode_t, mode)
527 		__field(u32, mask)
528 	),
529 	TP_fast_assign(
530 		__entry->inode = inode;
531 		__entry->nlink = inode->i_nlink;
532 		__entry->mode = inode->i_mode;
533 		__entry->mask = mask;
534 	),
535 	TP_printk("inode=0x%p nlink=%u mode=0%ho mask=0x%x", __entry->inode,
536 			__entry->nlink, __entry->mode, __entry->mask)
537 );
538 
539 #include "cache.h"
540 
541 TRACE_DEFINE_ENUM(RC_DROPIT);
542 TRACE_DEFINE_ENUM(RC_REPLY);
543 TRACE_DEFINE_ENUM(RC_DOIT);
544 
545 #define show_drc_retval(x)						\
546 	__print_symbolic(x,						\
547 		{ RC_DROPIT, "DROPIT" },				\
548 		{ RC_REPLY, "REPLY" },					\
549 		{ RC_DOIT, "DOIT" })
550 
551 TRACE_EVENT(nfsd_drc_found,
552 	TP_PROTO(
553 		const struct nfsd_net *nn,
554 		const struct svc_rqst *rqstp,
555 		int result
556 	),
557 	TP_ARGS(nn, rqstp, result),
558 	TP_STRUCT__entry(
559 		__field(unsigned long long, boot_time)
560 		__field(unsigned long, result)
561 		__field(u32, xid)
562 	),
563 	TP_fast_assign(
564 		__entry->boot_time = nn->boot_time;
565 		__entry->result = result;
566 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
567 	),
568 	TP_printk("boot_time=%16llx xid=0x%08x result=%s",
569 		__entry->boot_time, __entry->xid,
570 		show_drc_retval(__entry->result))
571 
572 );
573 
574 TRACE_EVENT(nfsd_drc_mismatch,
575 	TP_PROTO(
576 		const struct nfsd_net *nn,
577 		const struct svc_cacherep *key,
578 		const struct svc_cacherep *rp
579 	),
580 	TP_ARGS(nn, key, rp),
581 	TP_STRUCT__entry(
582 		__field(unsigned long long, boot_time)
583 		__field(u32, xid)
584 		__field(u32, cached)
585 		__field(u32, ingress)
586 	),
587 	TP_fast_assign(
588 		__entry->boot_time = nn->boot_time;
589 		__entry->xid = be32_to_cpu(key->c_key.k_xid);
590 		__entry->cached = (__force u32)key->c_key.k_csum;
591 		__entry->ingress = (__force u32)rp->c_key.k_csum;
592 	),
593 	TP_printk("boot_time=%16llx xid=0x%08x cached-csum=0x%08x ingress-csum=0x%08x",
594 		__entry->boot_time, __entry->xid, __entry->cached,
595 		__entry->ingress)
596 );
597 
598 TRACE_EVENT(nfsd_cb_args,
599 	TP_PROTO(
600 		const struct nfs4_client *clp,
601 		const struct nfs4_cb_conn *conn
602 	),
603 	TP_ARGS(clp, conn),
604 	TP_STRUCT__entry(
605 		__field(u32, cl_boot)
606 		__field(u32, cl_id)
607 		__field(u32, prog)
608 		__field(u32, ident)
609 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
610 	),
611 	TP_fast_assign(
612 		__entry->cl_boot = clp->cl_clientid.cl_boot;
613 		__entry->cl_id = clp->cl_clientid.cl_id;
614 		__entry->prog = conn->cb_prog;
615 		__entry->ident = conn->cb_ident;
616 		memcpy(__entry->addr, &conn->cb_addr,
617 			sizeof(struct sockaddr_in6));
618 	),
619 	TP_printk("client %08x:%08x callback addr=%pISpc prog=%u ident=%u",
620 		__entry->cl_boot, __entry->cl_id,
621 		__entry->addr, __entry->prog, __entry->ident)
622 );
623 
624 TRACE_EVENT(nfsd_cb_nodelegs,
625 	TP_PROTO(const struct nfs4_client *clp),
626 	TP_ARGS(clp),
627 	TP_STRUCT__entry(
628 		__field(u32, cl_boot)
629 		__field(u32, cl_id)
630 	),
631 	TP_fast_assign(
632 		__entry->cl_boot = clp->cl_clientid.cl_boot;
633 		__entry->cl_id = clp->cl_clientid.cl_id;
634 	),
635 	TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id)
636 )
637 
638 TRACE_DEFINE_ENUM(NFSD4_CB_UP);
639 TRACE_DEFINE_ENUM(NFSD4_CB_UNKNOWN);
640 TRACE_DEFINE_ENUM(NFSD4_CB_DOWN);
641 TRACE_DEFINE_ENUM(NFSD4_CB_FAULT);
642 
643 #define show_cb_state(val)						\
644 	__print_symbolic(val,						\
645 		{ NFSD4_CB_UP,		"UP" },				\
646 		{ NFSD4_CB_UNKNOWN,	"UNKNOWN" },			\
647 		{ NFSD4_CB_DOWN,	"DOWN" },			\
648 		{ NFSD4_CB_FAULT,	"FAULT"})
649 
650 DECLARE_EVENT_CLASS(nfsd_cb_class,
651 	TP_PROTO(const struct nfs4_client *clp),
652 	TP_ARGS(clp),
653 	TP_STRUCT__entry(
654 		__field(unsigned long, state)
655 		__field(u32, cl_boot)
656 		__field(u32, cl_id)
657 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
658 	),
659 	TP_fast_assign(
660 		__entry->state = clp->cl_cb_state;
661 		__entry->cl_boot = clp->cl_clientid.cl_boot;
662 		__entry->cl_id = clp->cl_clientid.cl_id;
663 		memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
664 			sizeof(struct sockaddr_in6));
665 	),
666 	TP_printk("addr=%pISpc client %08x:%08x state=%s",
667 		__entry->addr, __entry->cl_boot, __entry->cl_id,
668 		show_cb_state(__entry->state))
669 );
670 
671 #define DEFINE_NFSD_CB_EVENT(name)			\
672 DEFINE_EVENT(nfsd_cb_class, nfsd_cb_##name,		\
673 	TP_PROTO(const struct nfs4_client *clp),	\
674 	TP_ARGS(clp))
675 
676 DEFINE_NFSD_CB_EVENT(setup);
677 DEFINE_NFSD_CB_EVENT(state);
678 DEFINE_NFSD_CB_EVENT(shutdown);
679 
680 TRACE_EVENT(nfsd_cb_setup_err,
681 	TP_PROTO(
682 		const struct nfs4_client *clp,
683 		long error
684 	),
685 	TP_ARGS(clp, error),
686 	TP_STRUCT__entry(
687 		__field(long, error)
688 		__field(u32, cl_boot)
689 		__field(u32, cl_id)
690 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
691 	),
692 	TP_fast_assign(
693 		__entry->error = error;
694 		__entry->cl_boot = clp->cl_clientid.cl_boot;
695 		__entry->cl_id = clp->cl_clientid.cl_id;
696 		memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
697 			sizeof(struct sockaddr_in6));
698 	),
699 	TP_printk("addr=%pISpc client %08x:%08x error=%ld",
700 		__entry->addr, __entry->cl_boot, __entry->cl_id, __entry->error)
701 );
702 
703 TRACE_EVENT(nfsd_cb_work,
704 	TP_PROTO(
705 		const struct nfs4_client *clp,
706 		const char *procedure
707 	),
708 	TP_ARGS(clp, procedure),
709 	TP_STRUCT__entry(
710 		__field(u32, cl_boot)
711 		__field(u32, cl_id)
712 		__string(procedure, procedure)
713 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
714 	),
715 	TP_fast_assign(
716 		__entry->cl_boot = clp->cl_clientid.cl_boot;
717 		__entry->cl_id = clp->cl_clientid.cl_id;
718 		__assign_str(procedure, procedure)
719 		memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
720 			sizeof(struct sockaddr_in6));
721 	),
722 	TP_printk("addr=%pISpc client %08x:%08x procedure=%s",
723 		__entry->addr, __entry->cl_boot, __entry->cl_id,
724 		__get_str(procedure))
725 );
726 
727 TRACE_EVENT(nfsd_cb_done,
728 	TP_PROTO(
729 		const struct nfs4_client *clp,
730 		int status
731 	),
732 	TP_ARGS(clp, status),
733 	TP_STRUCT__entry(
734 		__field(u32, cl_boot)
735 		__field(u32, cl_id)
736 		__field(int, status)
737 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
738 	),
739 	TP_fast_assign(
740 		__entry->cl_boot = clp->cl_clientid.cl_boot;
741 		__entry->cl_id = clp->cl_clientid.cl_id;
742 		__entry->status = status;
743 		memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
744 			sizeof(struct sockaddr_in6));
745 	),
746 	TP_printk("addr=%pISpc client %08x:%08x status=%d",
747 		__entry->addr, __entry->cl_boot, __entry->cl_id,
748 		__entry->status)
749 );
750 
751 #endif /* _NFSD_TRACE_H */
752 
753 #undef TRACE_INCLUDE_PATH
754 #define TRACE_INCLUDE_PATH .
755 #define TRACE_INCLUDE_FILE trace
756 #include <trace/define_trace.h>
757