xref: /openbmc/linux/fs/nfsd/trace.h (revision 11c416e3)
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 		 loff_t		offset,
179 		 unsigned long	len),
180 	TP_ARGS(rqstp, fhp, offset, len),
181 	TP_STRUCT__entry(
182 		__field(u32, xid)
183 		__field(u32, fh_hash)
184 		__field(loff_t, offset)
185 		__field(unsigned long, 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=%lld len=%lu",
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 		 loff_t		offset,		\
203 		 unsigned long	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(deleg_open);
293 DEFINE_STATEID_EVENT(deleg_none);
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 DECLARE_EVENT_CLASS(nfsd_clid_class,
372 	TP_PROTO(const struct nfsd_net *nn,
373 		 unsigned int namelen,
374 		 const unsigned char *namedata),
375 	TP_ARGS(nn, namelen, namedata),
376 	TP_STRUCT__entry(
377 		__field(unsigned long long, boot_time)
378 		__field(unsigned int, namelen)
379 		__dynamic_array(unsigned char,  name, namelen)
380 	),
381 	TP_fast_assign(
382 		__entry->boot_time = nn->boot_time;
383 		__entry->namelen = namelen;
384 		memcpy(__get_dynamic_array(name), namedata, namelen);
385 	),
386 	TP_printk("boot_time=%16llx nfs4_clientid=%.*s",
387 		__entry->boot_time, __entry->namelen, __get_str(name))
388 )
389 
390 #define DEFINE_CLID_EVENT(name) \
391 DEFINE_EVENT(nfsd_clid_class, nfsd_clid_##name, \
392 	TP_PROTO(const struct nfsd_net *nn, \
393 		 unsigned int namelen, \
394 		 const unsigned char *namedata), \
395 	TP_ARGS(nn, namelen, namedata))
396 
397 DEFINE_CLID_EVENT(find);
398 DEFINE_CLID_EVENT(reclaim);
399 
400 TRACE_EVENT(nfsd_clid_inuse_err,
401 	TP_PROTO(const struct nfs4_client *clp),
402 	TP_ARGS(clp),
403 	TP_STRUCT__entry(
404 		__field(u32, cl_boot)
405 		__field(u32, cl_id)
406 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
407 		__field(unsigned int, namelen)
408 		__dynamic_array(unsigned char, name, clp->cl_name.len)
409 	),
410 	TP_fast_assign(
411 		__entry->cl_boot = clp->cl_clientid.cl_boot;
412 		__entry->cl_id = clp->cl_clientid.cl_id;
413 		memcpy(__entry->addr, &clp->cl_addr,
414 			sizeof(struct sockaddr_in6));
415 		__entry->namelen = clp->cl_name.len;
416 		memcpy(__get_dynamic_array(name), clp->cl_name.data,
417 			clp->cl_name.len);
418 	),
419 	TP_printk("nfs4_clientid %.*s already in use by %pISpc, client %08x:%08x",
420 		__entry->namelen, __get_str(name), __entry->addr,
421 		__entry->cl_boot, __entry->cl_id)
422 )
423 
424 TRACE_DEFINE_ENUM(NFSD_FILE_HASHED);
425 TRACE_DEFINE_ENUM(NFSD_FILE_PENDING);
426 TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_READ);
427 TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_WRITE);
428 TRACE_DEFINE_ENUM(NFSD_FILE_REFERENCED);
429 
430 #define show_nf_flags(val)						\
431 	__print_flags(val, "|",						\
432 		{ 1 << NFSD_FILE_HASHED,	"HASHED" },		\
433 		{ 1 << NFSD_FILE_PENDING,	"PENDING" },		\
434 		{ 1 << NFSD_FILE_BREAK_READ,	"BREAK_READ" },		\
435 		{ 1 << NFSD_FILE_BREAK_WRITE,	"BREAK_WRITE" },	\
436 		{ 1 << NFSD_FILE_REFERENCED,	"REFERENCED"})
437 
438 /* FIXME: This should probably be fleshed out in the future. */
439 #define show_nf_may(val)						\
440 	__print_flags(val, "|",						\
441 		{ NFSD_MAY_READ,		"READ" },		\
442 		{ NFSD_MAY_WRITE,		"WRITE" },		\
443 		{ NFSD_MAY_NOT_BREAK_LEASE,	"NOT_BREAK_LEASE" })
444 
445 DECLARE_EVENT_CLASS(nfsd_file_class,
446 	TP_PROTO(struct nfsd_file *nf),
447 	TP_ARGS(nf),
448 	TP_STRUCT__entry(
449 		__field(unsigned int, nf_hashval)
450 		__field(void *, nf_inode)
451 		__field(int, nf_ref)
452 		__field(unsigned long, nf_flags)
453 		__field(unsigned char, nf_may)
454 		__field(struct file *, nf_file)
455 	),
456 	TP_fast_assign(
457 		__entry->nf_hashval = nf->nf_hashval;
458 		__entry->nf_inode = nf->nf_inode;
459 		__entry->nf_ref = refcount_read(&nf->nf_ref);
460 		__entry->nf_flags = nf->nf_flags;
461 		__entry->nf_may = nf->nf_may;
462 		__entry->nf_file = nf->nf_file;
463 	),
464 	TP_printk("hash=0x%x inode=0x%p ref=%d flags=%s may=%s file=%p",
465 		__entry->nf_hashval,
466 		__entry->nf_inode,
467 		__entry->nf_ref,
468 		show_nf_flags(__entry->nf_flags),
469 		show_nf_may(__entry->nf_may),
470 		__entry->nf_file)
471 )
472 
473 #define DEFINE_NFSD_FILE_EVENT(name) \
474 DEFINE_EVENT(nfsd_file_class, name, \
475 	TP_PROTO(struct nfsd_file *nf), \
476 	TP_ARGS(nf))
477 
478 DEFINE_NFSD_FILE_EVENT(nfsd_file_alloc);
479 DEFINE_NFSD_FILE_EVENT(nfsd_file_put_final);
480 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash);
481 DEFINE_NFSD_FILE_EVENT(nfsd_file_put);
482 DEFINE_NFSD_FILE_EVENT(nfsd_file_unhash_and_release_locked);
483 
484 TRACE_EVENT(nfsd_file_acquire,
485 	TP_PROTO(struct svc_rqst *rqstp, unsigned int hash,
486 		 struct inode *inode, unsigned int may_flags,
487 		 struct nfsd_file *nf, __be32 status),
488 
489 	TP_ARGS(rqstp, hash, inode, may_flags, nf, status),
490 
491 	TP_STRUCT__entry(
492 		__field(u32, xid)
493 		__field(unsigned int, hash)
494 		__field(void *, inode)
495 		__field(unsigned int, may_flags)
496 		__field(int, nf_ref)
497 		__field(unsigned long, nf_flags)
498 		__field(unsigned char, nf_may)
499 		__field(struct file *, nf_file)
500 		__field(u32, status)
501 	),
502 
503 	TP_fast_assign(
504 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
505 		__entry->hash = hash;
506 		__entry->inode = inode;
507 		__entry->may_flags = may_flags;
508 		__entry->nf_ref = nf ? refcount_read(&nf->nf_ref) : 0;
509 		__entry->nf_flags = nf ? nf->nf_flags : 0;
510 		__entry->nf_may = nf ? nf->nf_may : 0;
511 		__entry->nf_file = nf ? nf->nf_file : NULL;
512 		__entry->status = be32_to_cpu(status);
513 	),
514 
515 	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",
516 			__entry->xid, __entry->hash, __entry->inode,
517 			show_nf_may(__entry->may_flags), __entry->nf_ref,
518 			show_nf_flags(__entry->nf_flags),
519 			show_nf_may(__entry->nf_may), __entry->nf_file,
520 			__entry->status)
521 );
522 
523 DECLARE_EVENT_CLASS(nfsd_file_search_class,
524 	TP_PROTO(struct inode *inode, unsigned int hash, int found),
525 	TP_ARGS(inode, hash, found),
526 	TP_STRUCT__entry(
527 		__field(struct inode *, inode)
528 		__field(unsigned int, hash)
529 		__field(int, found)
530 	),
531 	TP_fast_assign(
532 		__entry->inode = inode;
533 		__entry->hash = hash;
534 		__entry->found = found;
535 	),
536 	TP_printk("hash=0x%x inode=0x%p found=%d", __entry->hash,
537 			__entry->inode, __entry->found)
538 );
539 
540 #define DEFINE_NFSD_FILE_SEARCH_EVENT(name)				\
541 DEFINE_EVENT(nfsd_file_search_class, name,				\
542 	TP_PROTO(struct inode *inode, unsigned int hash, int found),	\
543 	TP_ARGS(inode, hash, found))
544 
545 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode_sync);
546 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_close_inode);
547 DEFINE_NFSD_FILE_SEARCH_EVENT(nfsd_file_is_cached);
548 
549 TRACE_EVENT(nfsd_file_fsnotify_handle_event,
550 	TP_PROTO(struct inode *inode, u32 mask),
551 	TP_ARGS(inode, mask),
552 	TP_STRUCT__entry(
553 		__field(struct inode *, inode)
554 		__field(unsigned int, nlink)
555 		__field(umode_t, mode)
556 		__field(u32, mask)
557 	),
558 	TP_fast_assign(
559 		__entry->inode = inode;
560 		__entry->nlink = inode->i_nlink;
561 		__entry->mode = inode->i_mode;
562 		__entry->mask = mask;
563 	),
564 	TP_printk("inode=0x%p nlink=%u mode=0%ho mask=0x%x", __entry->inode,
565 			__entry->nlink, __entry->mode, __entry->mask)
566 );
567 
568 #include "cache.h"
569 
570 TRACE_DEFINE_ENUM(RC_DROPIT);
571 TRACE_DEFINE_ENUM(RC_REPLY);
572 TRACE_DEFINE_ENUM(RC_DOIT);
573 
574 #define show_drc_retval(x)						\
575 	__print_symbolic(x,						\
576 		{ RC_DROPIT, "DROPIT" },				\
577 		{ RC_REPLY, "REPLY" },					\
578 		{ RC_DOIT, "DOIT" })
579 
580 TRACE_EVENT(nfsd_drc_found,
581 	TP_PROTO(
582 		const struct nfsd_net *nn,
583 		const struct svc_rqst *rqstp,
584 		int result
585 	),
586 	TP_ARGS(nn, rqstp, result),
587 	TP_STRUCT__entry(
588 		__field(unsigned long long, boot_time)
589 		__field(unsigned long, result)
590 		__field(u32, xid)
591 	),
592 	TP_fast_assign(
593 		__entry->boot_time = nn->boot_time;
594 		__entry->result = result;
595 		__entry->xid = be32_to_cpu(rqstp->rq_xid);
596 	),
597 	TP_printk("boot_time=%16llx xid=0x%08x result=%s",
598 		__entry->boot_time, __entry->xid,
599 		show_drc_retval(__entry->result))
600 
601 );
602 
603 TRACE_EVENT(nfsd_drc_mismatch,
604 	TP_PROTO(
605 		const struct nfsd_net *nn,
606 		const struct svc_cacherep *key,
607 		const struct svc_cacherep *rp
608 	),
609 	TP_ARGS(nn, key, rp),
610 	TP_STRUCT__entry(
611 		__field(unsigned long long, boot_time)
612 		__field(u32, xid)
613 		__field(u32, cached)
614 		__field(u32, ingress)
615 	),
616 	TP_fast_assign(
617 		__entry->boot_time = nn->boot_time;
618 		__entry->xid = be32_to_cpu(key->c_key.k_xid);
619 		__entry->cached = (__force u32)key->c_key.k_csum;
620 		__entry->ingress = (__force u32)rp->c_key.k_csum;
621 	),
622 	TP_printk("boot_time=%16llx xid=0x%08x cached-csum=0x%08x ingress-csum=0x%08x",
623 		__entry->boot_time, __entry->xid, __entry->cached,
624 		__entry->ingress)
625 );
626 
627 TRACE_EVENT(nfsd_cb_args,
628 	TP_PROTO(
629 		const struct nfs4_client *clp,
630 		const struct nfs4_cb_conn *conn
631 	),
632 	TP_ARGS(clp, conn),
633 	TP_STRUCT__entry(
634 		__field(u32, cl_boot)
635 		__field(u32, cl_id)
636 		__field(u32, prog)
637 		__field(u32, ident)
638 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
639 	),
640 	TP_fast_assign(
641 		__entry->cl_boot = clp->cl_clientid.cl_boot;
642 		__entry->cl_id = clp->cl_clientid.cl_id;
643 		__entry->prog = conn->cb_prog;
644 		__entry->ident = conn->cb_ident;
645 		memcpy(__entry->addr, &conn->cb_addr,
646 			sizeof(struct sockaddr_in6));
647 	),
648 	TP_printk("client %08x:%08x callback addr=%pISpc prog=%u ident=%u",
649 		__entry->cl_boot, __entry->cl_id,
650 		__entry->addr, __entry->prog, __entry->ident)
651 );
652 
653 TRACE_EVENT(nfsd_cb_nodelegs,
654 	TP_PROTO(const struct nfs4_client *clp),
655 	TP_ARGS(clp),
656 	TP_STRUCT__entry(
657 		__field(u32, cl_boot)
658 		__field(u32, cl_id)
659 	),
660 	TP_fast_assign(
661 		__entry->cl_boot = clp->cl_clientid.cl_boot;
662 		__entry->cl_id = clp->cl_clientid.cl_id;
663 	),
664 	TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id)
665 )
666 
667 TRACE_DEFINE_ENUM(NFSD4_CB_UP);
668 TRACE_DEFINE_ENUM(NFSD4_CB_UNKNOWN);
669 TRACE_DEFINE_ENUM(NFSD4_CB_DOWN);
670 TRACE_DEFINE_ENUM(NFSD4_CB_FAULT);
671 
672 #define show_cb_state(val)						\
673 	__print_symbolic(val,						\
674 		{ NFSD4_CB_UP,		"UP" },				\
675 		{ NFSD4_CB_UNKNOWN,	"UNKNOWN" },			\
676 		{ NFSD4_CB_DOWN,	"DOWN" },			\
677 		{ NFSD4_CB_FAULT,	"FAULT"})
678 
679 DECLARE_EVENT_CLASS(nfsd_cb_class,
680 	TP_PROTO(const struct nfs4_client *clp),
681 	TP_ARGS(clp),
682 	TP_STRUCT__entry(
683 		__field(unsigned long, state)
684 		__field(u32, cl_boot)
685 		__field(u32, cl_id)
686 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
687 	),
688 	TP_fast_assign(
689 		__entry->state = clp->cl_cb_state;
690 		__entry->cl_boot = clp->cl_clientid.cl_boot;
691 		__entry->cl_id = clp->cl_clientid.cl_id;
692 		memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
693 			sizeof(struct sockaddr_in6));
694 	),
695 	TP_printk("addr=%pISpc client %08x:%08x state=%s",
696 		__entry->addr, __entry->cl_boot, __entry->cl_id,
697 		show_cb_state(__entry->state))
698 );
699 
700 #define DEFINE_NFSD_CB_EVENT(name)			\
701 DEFINE_EVENT(nfsd_cb_class, nfsd_cb_##name,		\
702 	TP_PROTO(const struct nfs4_client *clp),	\
703 	TP_ARGS(clp))
704 
705 DEFINE_NFSD_CB_EVENT(setup);
706 DEFINE_NFSD_CB_EVENT(state);
707 DEFINE_NFSD_CB_EVENT(shutdown);
708 
709 TRACE_EVENT(nfsd_cb_setup_err,
710 	TP_PROTO(
711 		const struct nfs4_client *clp,
712 		long error
713 	),
714 	TP_ARGS(clp, error),
715 	TP_STRUCT__entry(
716 		__field(long, error)
717 		__field(u32, cl_boot)
718 		__field(u32, cl_id)
719 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
720 	),
721 	TP_fast_assign(
722 		__entry->error = error;
723 		__entry->cl_boot = clp->cl_clientid.cl_boot;
724 		__entry->cl_id = clp->cl_clientid.cl_id;
725 		memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
726 			sizeof(struct sockaddr_in6));
727 	),
728 	TP_printk("addr=%pISpc client %08x:%08x error=%ld",
729 		__entry->addr, __entry->cl_boot, __entry->cl_id, __entry->error)
730 );
731 
732 TRACE_EVENT(nfsd_cb_work,
733 	TP_PROTO(
734 		const struct nfs4_client *clp,
735 		const char *procedure
736 	),
737 	TP_ARGS(clp, procedure),
738 	TP_STRUCT__entry(
739 		__field(u32, cl_boot)
740 		__field(u32, cl_id)
741 		__string(procedure, procedure)
742 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
743 	),
744 	TP_fast_assign(
745 		__entry->cl_boot = clp->cl_clientid.cl_boot;
746 		__entry->cl_id = clp->cl_clientid.cl_id;
747 		__assign_str(procedure, procedure)
748 		memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
749 			sizeof(struct sockaddr_in6));
750 	),
751 	TP_printk("addr=%pISpc client %08x:%08x procedure=%s",
752 		__entry->addr, __entry->cl_boot, __entry->cl_id,
753 		__get_str(procedure))
754 );
755 
756 TRACE_EVENT(nfsd_cb_done,
757 	TP_PROTO(
758 		const struct nfs4_client *clp,
759 		int status
760 	),
761 	TP_ARGS(clp, status),
762 	TP_STRUCT__entry(
763 		__field(u32, cl_boot)
764 		__field(u32, cl_id)
765 		__field(int, status)
766 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
767 	),
768 	TP_fast_assign(
769 		__entry->cl_boot = clp->cl_clientid.cl_boot;
770 		__entry->cl_id = clp->cl_clientid.cl_id;
771 		__entry->status = status;
772 		memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
773 			sizeof(struct sockaddr_in6));
774 	),
775 	TP_printk("addr=%pISpc client %08x:%08x status=%d",
776 		__entry->addr, __entry->cl_boot, __entry->cl_id,
777 		__entry->status)
778 );
779 
780 #endif /* _NFSD_TRACE_H */
781 
782 #undef TRACE_INCLUDE_PATH
783 #define TRACE_INCLUDE_PATH .
784 #define TRACE_INCLUDE_FILE trace
785 #include <trace/define_trace.h>
786