xref: /openbmc/linux/fs/nfs/nfstrace.h (revision 2cf1c348)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
4  */
5 #undef TRACE_SYSTEM
6 #define TRACE_SYSTEM nfs
7 
8 #if !defined(_TRACE_NFS_H) || defined(TRACE_HEADER_MULTI_READ)
9 #define _TRACE_NFS_H
10 
11 #include <linux/tracepoint.h>
12 #include <linux/iversion.h>
13 
14 #include <trace/events/fs.h>
15 #include <trace/events/nfs.h>
16 #include <trace/events/sunrpc_base.h>
17 
18 #define nfs_show_cache_validity(v) \
19 	__print_flags(v, "|", \
20 			{ NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
21 			{ NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
22 			{ NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
23 			{ NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
24 			{ NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \
25 			{ NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
26 			{ NFS_INO_INVALID_LABEL, "INVALID_LABEL" }, \
27 			{ NFS_INO_INVALID_CHANGE, "INVALID_CHANGE" }, \
28 			{ NFS_INO_INVALID_CTIME, "INVALID_CTIME" }, \
29 			{ NFS_INO_INVALID_MTIME, "INVALID_MTIME" }, \
30 			{ NFS_INO_INVALID_SIZE, "INVALID_SIZE" }, \
31 			{ NFS_INO_INVALID_OTHER, "INVALID_OTHER" }, \
32 			{ NFS_INO_DATA_INVAL_DEFER, "DATA_INVAL_DEFER" }, \
33 			{ NFS_INO_INVALID_BLOCKS, "INVALID_BLOCKS" }, \
34 			{ NFS_INO_INVALID_XATTR, "INVALID_XATTR" }, \
35 			{ NFS_INO_INVALID_NLINK, "INVALID_NLINK" }, \
36 			{ NFS_INO_INVALID_MODE, "INVALID_MODE" })
37 
38 #define nfs_show_nfsi_flags(v) \
39 	__print_flags(v, "|", \
40 			{ BIT(NFS_INO_ADVISE_RDPLUS), "ADVISE_RDPLUS" }, \
41 			{ BIT(NFS_INO_STALE), "STALE" }, \
42 			{ BIT(NFS_INO_ACL_LRU_SET), "ACL_LRU_SET" }, \
43 			{ BIT(NFS_INO_INVALIDATING), "INVALIDATING" }, \
44 			{ BIT(NFS_INO_FSCACHE), "FSCACHE" }, \
45 			{ BIT(NFS_INO_LAYOUTCOMMIT), "NEED_LAYOUTCOMMIT" }, \
46 			{ BIT(NFS_INO_LAYOUTCOMMITTING), "LAYOUTCOMMIT" }, \
47 			{ BIT(NFS_INO_LAYOUTSTATS), "LAYOUTSTATS" }, \
48 			{ BIT(NFS_INO_ODIRECT), "ODIRECT" })
49 
50 DECLARE_EVENT_CLASS(nfs_inode_event,
51 		TP_PROTO(
52 			const struct inode *inode
53 		),
54 
55 		TP_ARGS(inode),
56 
57 		TP_STRUCT__entry(
58 			__field(dev_t, dev)
59 			__field(u32, fhandle)
60 			__field(u64, fileid)
61 			__field(u64, version)
62 		),
63 
64 		TP_fast_assign(
65 			const struct nfs_inode *nfsi = NFS_I(inode);
66 			__entry->dev = inode->i_sb->s_dev;
67 			__entry->fileid = nfsi->fileid;
68 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
69 			__entry->version = inode_peek_iversion_raw(inode);
70 		),
71 
72 		TP_printk(
73 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
74 			MAJOR(__entry->dev), MINOR(__entry->dev),
75 			(unsigned long long)__entry->fileid,
76 			__entry->fhandle,
77 			(unsigned long long)__entry->version
78 		)
79 );
80 
81 DECLARE_EVENT_CLASS(nfs_inode_event_done,
82 		TP_PROTO(
83 			const struct inode *inode,
84 			int error
85 		),
86 
87 		TP_ARGS(inode, error),
88 
89 		TP_STRUCT__entry(
90 			__field(unsigned long, error)
91 			__field(dev_t, dev)
92 			__field(u32, fhandle)
93 			__field(unsigned char, type)
94 			__field(u64, fileid)
95 			__field(u64, version)
96 			__field(loff_t, size)
97 			__field(unsigned long, nfsi_flags)
98 			__field(unsigned long, cache_validity)
99 		),
100 
101 		TP_fast_assign(
102 			const struct nfs_inode *nfsi = NFS_I(inode);
103 			__entry->error = error < 0 ? -error : 0;
104 			__entry->dev = inode->i_sb->s_dev;
105 			__entry->fileid = nfsi->fileid;
106 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
107 			__entry->type = nfs_umode_to_dtype(inode->i_mode);
108 			__entry->version = inode_peek_iversion_raw(inode);
109 			__entry->size = i_size_read(inode);
110 			__entry->nfsi_flags = nfsi->flags;
111 			__entry->cache_validity = nfsi->cache_validity;
112 		),
113 
114 		TP_printk(
115 			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
116 			"type=%u (%s) version=%llu size=%lld "
117 			"cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s)",
118 			-__entry->error, show_nfs_status(__entry->error),
119 			MAJOR(__entry->dev), MINOR(__entry->dev),
120 			(unsigned long long)__entry->fileid,
121 			__entry->fhandle,
122 			__entry->type,
123 			show_fs_dirent_type(__entry->type),
124 			(unsigned long long)__entry->version,
125 			(long long)__entry->size,
126 			__entry->cache_validity,
127 			nfs_show_cache_validity(__entry->cache_validity),
128 			__entry->nfsi_flags,
129 			nfs_show_nfsi_flags(__entry->nfsi_flags)
130 		)
131 );
132 
133 #define DEFINE_NFS_INODE_EVENT(name) \
134 	DEFINE_EVENT(nfs_inode_event, name, \
135 			TP_PROTO( \
136 				const struct inode *inode \
137 			), \
138 			TP_ARGS(inode))
139 #define DEFINE_NFS_INODE_EVENT_DONE(name) \
140 	DEFINE_EVENT(nfs_inode_event_done, name, \
141 			TP_PROTO( \
142 				const struct inode *inode, \
143 				int error \
144 			), \
145 			TP_ARGS(inode, error))
146 DEFINE_NFS_INODE_EVENT(nfs_set_inode_stale);
147 DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter);
148 DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit);
149 DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter);
150 DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit);
151 DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter);
152 DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit);
153 DEFINE_NFS_INODE_EVENT(nfs_getattr_enter);
154 DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit);
155 DEFINE_NFS_INODE_EVENT(nfs_setattr_enter);
156 DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit);
157 DEFINE_NFS_INODE_EVENT(nfs_writeback_page_enter);
158 DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_page_exit);
159 DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter);
160 DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit);
161 DEFINE_NFS_INODE_EVENT(nfs_fsync_enter);
162 DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
163 DEFINE_NFS_INODE_EVENT(nfs_access_enter);
164 DEFINE_NFS_INODE_EVENT_DONE(nfs_set_cache_invalid);
165 
166 TRACE_EVENT(nfs_access_exit,
167 		TP_PROTO(
168 			const struct inode *inode,
169 			unsigned int mask,
170 			unsigned int permitted,
171 			int error
172 		),
173 
174 		TP_ARGS(inode, mask, permitted, error),
175 
176 		TP_STRUCT__entry(
177 			__field(unsigned long, error)
178 			__field(dev_t, dev)
179 			__field(u32, fhandle)
180 			__field(unsigned char, type)
181 			__field(u64, fileid)
182 			__field(u64, version)
183 			__field(loff_t, size)
184 			__field(unsigned long, nfsi_flags)
185 			__field(unsigned long, cache_validity)
186 			__field(unsigned int, mask)
187 			__field(unsigned int, permitted)
188 		),
189 
190 		TP_fast_assign(
191 			const struct nfs_inode *nfsi = NFS_I(inode);
192 			__entry->error = error < 0 ? -error : 0;
193 			__entry->dev = inode->i_sb->s_dev;
194 			__entry->fileid = nfsi->fileid;
195 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
196 			__entry->type = nfs_umode_to_dtype(inode->i_mode);
197 			__entry->version = inode_peek_iversion_raw(inode);
198 			__entry->size = i_size_read(inode);
199 			__entry->nfsi_flags = nfsi->flags;
200 			__entry->cache_validity = nfsi->cache_validity;
201 			__entry->mask = mask;
202 			__entry->permitted = permitted;
203 		),
204 
205 		TP_printk(
206 			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
207 			"type=%u (%s) version=%llu size=%lld "
208 			"cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s) "
209 			"mask=0x%x permitted=0x%x",
210 			-__entry->error, show_nfs_status(__entry->error),
211 			MAJOR(__entry->dev), MINOR(__entry->dev),
212 			(unsigned long long)__entry->fileid,
213 			__entry->fhandle,
214 			__entry->type,
215 			show_fs_dirent_type(__entry->type),
216 			(unsigned long long)__entry->version,
217 			(long long)__entry->size,
218 			__entry->cache_validity,
219 			nfs_show_cache_validity(__entry->cache_validity),
220 			__entry->nfsi_flags,
221 			nfs_show_nfsi_flags(__entry->nfsi_flags),
222 			__entry->mask, __entry->permitted
223 		)
224 );
225 
226 DECLARE_EVENT_CLASS(nfs_update_size_class,
227 		TP_PROTO(
228 			const struct inode *inode,
229 			loff_t new_size
230 		),
231 
232 		TP_ARGS(inode, new_size),
233 
234 		TP_STRUCT__entry(
235 			__field(dev_t, dev)
236 			__field(u32, fhandle)
237 			__field(u64, fileid)
238 			__field(u64, version)
239 			__field(loff_t, cur_size)
240 			__field(loff_t, new_size)
241 		),
242 
243 		TP_fast_assign(
244 			const struct nfs_inode *nfsi = NFS_I(inode);
245 
246 			__entry->dev = inode->i_sb->s_dev;
247 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
248 			__entry->fileid = nfsi->fileid;
249 			__entry->version = inode_peek_iversion_raw(inode);
250 			__entry->cur_size = i_size_read(inode);
251 			__entry->new_size = new_size;
252 		),
253 
254 		TP_printk(
255 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu cursize=%lld newsize=%lld",
256 			MAJOR(__entry->dev), MINOR(__entry->dev),
257 			(unsigned long long)__entry->fileid,
258 			__entry->fhandle, __entry->version,
259 			__entry->cur_size, __entry->new_size
260 		)
261 );
262 
263 #define DEFINE_NFS_UPDATE_SIZE_EVENT(name) \
264 	DEFINE_EVENT(nfs_update_size_class, nfs_size_##name, \
265 			TP_PROTO( \
266 				const struct inode *inode, \
267 				loff_t new_size \
268 			), \
269 			TP_ARGS(inode, new_size))
270 
271 DEFINE_NFS_UPDATE_SIZE_EVENT(truncate);
272 DEFINE_NFS_UPDATE_SIZE_EVENT(wcc);
273 DEFINE_NFS_UPDATE_SIZE_EVENT(update);
274 DEFINE_NFS_UPDATE_SIZE_EVENT(grow);
275 
276 DECLARE_EVENT_CLASS(nfs_lookup_event,
277 		TP_PROTO(
278 			const struct inode *dir,
279 			const struct dentry *dentry,
280 			unsigned int flags
281 		),
282 
283 		TP_ARGS(dir, dentry, flags),
284 
285 		TP_STRUCT__entry(
286 			__field(unsigned long, flags)
287 			__field(dev_t, dev)
288 			__field(u64, dir)
289 			__string(name, dentry->d_name.name)
290 		),
291 
292 		TP_fast_assign(
293 			__entry->dev = dir->i_sb->s_dev;
294 			__entry->dir = NFS_FILEID(dir);
295 			__entry->flags = flags;
296 			__assign_str(name, dentry->d_name.name);
297 		),
298 
299 		TP_printk(
300 			"flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
301 			__entry->flags,
302 			show_fs_lookup_flags(__entry->flags),
303 			MAJOR(__entry->dev), MINOR(__entry->dev),
304 			(unsigned long long)__entry->dir,
305 			__get_str(name)
306 		)
307 );
308 
309 #define DEFINE_NFS_LOOKUP_EVENT(name) \
310 	DEFINE_EVENT(nfs_lookup_event, name, \
311 			TP_PROTO( \
312 				const struct inode *dir, \
313 				const struct dentry *dentry, \
314 				unsigned int flags \
315 			), \
316 			TP_ARGS(dir, dentry, flags))
317 
318 DECLARE_EVENT_CLASS(nfs_lookup_event_done,
319 		TP_PROTO(
320 			const struct inode *dir,
321 			const struct dentry *dentry,
322 			unsigned int flags,
323 			int error
324 		),
325 
326 		TP_ARGS(dir, dentry, flags, error),
327 
328 		TP_STRUCT__entry(
329 			__field(unsigned long, error)
330 			__field(unsigned long, flags)
331 			__field(dev_t, dev)
332 			__field(u64, dir)
333 			__string(name, dentry->d_name.name)
334 		),
335 
336 		TP_fast_assign(
337 			__entry->dev = dir->i_sb->s_dev;
338 			__entry->dir = NFS_FILEID(dir);
339 			__entry->error = error < 0 ? -error : 0;
340 			__entry->flags = flags;
341 			__assign_str(name, dentry->d_name.name);
342 		),
343 
344 		TP_printk(
345 			"error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
346 			-__entry->error, show_nfs_status(__entry->error),
347 			__entry->flags,
348 			show_fs_lookup_flags(__entry->flags),
349 			MAJOR(__entry->dev), MINOR(__entry->dev),
350 			(unsigned long long)__entry->dir,
351 			__get_str(name)
352 		)
353 );
354 
355 #define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \
356 	DEFINE_EVENT(nfs_lookup_event_done, name, \
357 			TP_PROTO( \
358 				const struct inode *dir, \
359 				const struct dentry *dentry, \
360 				unsigned int flags, \
361 				int error \
362 			), \
363 			TP_ARGS(dir, dentry, flags, error))
364 
365 DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter);
366 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
367 DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
368 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
369 
370 TRACE_EVENT(nfs_atomic_open_enter,
371 		TP_PROTO(
372 			const struct inode *dir,
373 			const struct nfs_open_context *ctx,
374 			unsigned int flags
375 		),
376 
377 		TP_ARGS(dir, ctx, flags),
378 
379 		TP_STRUCT__entry(
380 			__field(unsigned long, flags)
381 			__field(unsigned long, fmode)
382 			__field(dev_t, dev)
383 			__field(u64, dir)
384 			__string(name, ctx->dentry->d_name.name)
385 		),
386 
387 		TP_fast_assign(
388 			__entry->dev = dir->i_sb->s_dev;
389 			__entry->dir = NFS_FILEID(dir);
390 			__entry->flags = flags;
391 			__entry->fmode = (__force unsigned long)ctx->mode;
392 			__assign_str(name, ctx->dentry->d_name.name);
393 		),
394 
395 		TP_printk(
396 			"flags=0x%lx (%s) fmode=%s name=%02x:%02x:%llu/%s",
397 			__entry->flags,
398 			show_fs_fcntl_open_flags(__entry->flags),
399 			show_fs_fmode_flags(__entry->fmode),
400 			MAJOR(__entry->dev), MINOR(__entry->dev),
401 			(unsigned long long)__entry->dir,
402 			__get_str(name)
403 		)
404 );
405 
406 TRACE_EVENT(nfs_atomic_open_exit,
407 		TP_PROTO(
408 			const struct inode *dir,
409 			const struct nfs_open_context *ctx,
410 			unsigned int flags,
411 			int error
412 		),
413 
414 		TP_ARGS(dir, ctx, flags, error),
415 
416 		TP_STRUCT__entry(
417 			__field(unsigned long, error)
418 			__field(unsigned long, flags)
419 			__field(unsigned long, fmode)
420 			__field(dev_t, dev)
421 			__field(u64, dir)
422 			__string(name, ctx->dentry->d_name.name)
423 		),
424 
425 		TP_fast_assign(
426 			__entry->error = -error;
427 			__entry->dev = dir->i_sb->s_dev;
428 			__entry->dir = NFS_FILEID(dir);
429 			__entry->flags = flags;
430 			__entry->fmode = (__force unsigned long)ctx->mode;
431 			__assign_str(name, ctx->dentry->d_name.name);
432 		),
433 
434 		TP_printk(
435 			"error=%ld (%s) flags=0x%lx (%s) fmode=%s "
436 			"name=%02x:%02x:%llu/%s",
437 			-__entry->error, show_nfs_status(__entry->error),
438 			__entry->flags,
439 			show_fs_fcntl_open_flags(__entry->flags),
440 			show_fs_fmode_flags(__entry->fmode),
441 			MAJOR(__entry->dev), MINOR(__entry->dev),
442 			(unsigned long long)__entry->dir,
443 			__get_str(name)
444 		)
445 );
446 
447 TRACE_EVENT(nfs_create_enter,
448 		TP_PROTO(
449 			const struct inode *dir,
450 			const struct dentry *dentry,
451 			unsigned int flags
452 		),
453 
454 		TP_ARGS(dir, dentry, flags),
455 
456 		TP_STRUCT__entry(
457 			__field(unsigned long, flags)
458 			__field(dev_t, dev)
459 			__field(u64, dir)
460 			__string(name, dentry->d_name.name)
461 		),
462 
463 		TP_fast_assign(
464 			__entry->dev = dir->i_sb->s_dev;
465 			__entry->dir = NFS_FILEID(dir);
466 			__entry->flags = flags;
467 			__assign_str(name, dentry->d_name.name);
468 		),
469 
470 		TP_printk(
471 			"flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
472 			__entry->flags,
473 			show_fs_fcntl_open_flags(__entry->flags),
474 			MAJOR(__entry->dev), MINOR(__entry->dev),
475 			(unsigned long long)__entry->dir,
476 			__get_str(name)
477 		)
478 );
479 
480 TRACE_EVENT(nfs_create_exit,
481 		TP_PROTO(
482 			const struct inode *dir,
483 			const struct dentry *dentry,
484 			unsigned int flags,
485 			int error
486 		),
487 
488 		TP_ARGS(dir, dentry, flags, error),
489 
490 		TP_STRUCT__entry(
491 			__field(unsigned long, error)
492 			__field(unsigned long, flags)
493 			__field(dev_t, dev)
494 			__field(u64, dir)
495 			__string(name, dentry->d_name.name)
496 		),
497 
498 		TP_fast_assign(
499 			__entry->error = -error;
500 			__entry->dev = dir->i_sb->s_dev;
501 			__entry->dir = NFS_FILEID(dir);
502 			__entry->flags = flags;
503 			__assign_str(name, dentry->d_name.name);
504 		),
505 
506 		TP_printk(
507 			"error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
508 			-__entry->error, show_nfs_status(__entry->error),
509 			__entry->flags,
510 			show_fs_fcntl_open_flags(__entry->flags),
511 			MAJOR(__entry->dev), MINOR(__entry->dev),
512 			(unsigned long long)__entry->dir,
513 			__get_str(name)
514 		)
515 );
516 
517 DECLARE_EVENT_CLASS(nfs_directory_event,
518 		TP_PROTO(
519 			const struct inode *dir,
520 			const struct dentry *dentry
521 		),
522 
523 		TP_ARGS(dir, dentry),
524 
525 		TP_STRUCT__entry(
526 			__field(dev_t, dev)
527 			__field(u64, dir)
528 			__string(name, dentry->d_name.name)
529 		),
530 
531 		TP_fast_assign(
532 			__entry->dev = dir->i_sb->s_dev;
533 			__entry->dir = NFS_FILEID(dir);
534 			__assign_str(name, dentry->d_name.name);
535 		),
536 
537 		TP_printk(
538 			"name=%02x:%02x:%llu/%s",
539 			MAJOR(__entry->dev), MINOR(__entry->dev),
540 			(unsigned long long)__entry->dir,
541 			__get_str(name)
542 		)
543 );
544 
545 #define DEFINE_NFS_DIRECTORY_EVENT(name) \
546 	DEFINE_EVENT(nfs_directory_event, name, \
547 			TP_PROTO( \
548 				const struct inode *dir, \
549 				const struct dentry *dentry \
550 			), \
551 			TP_ARGS(dir, dentry))
552 
553 DECLARE_EVENT_CLASS(nfs_directory_event_done,
554 		TP_PROTO(
555 			const struct inode *dir,
556 			const struct dentry *dentry,
557 			int error
558 		),
559 
560 		TP_ARGS(dir, dentry, error),
561 
562 		TP_STRUCT__entry(
563 			__field(unsigned long, error)
564 			__field(dev_t, dev)
565 			__field(u64, dir)
566 			__string(name, dentry->d_name.name)
567 		),
568 
569 		TP_fast_assign(
570 			__entry->dev = dir->i_sb->s_dev;
571 			__entry->dir = NFS_FILEID(dir);
572 			__entry->error = error < 0 ? -error : 0;
573 			__assign_str(name, dentry->d_name.name);
574 		),
575 
576 		TP_printk(
577 			"error=%ld (%s) name=%02x:%02x:%llu/%s",
578 			-__entry->error, show_nfs_status(__entry->error),
579 			MAJOR(__entry->dev), MINOR(__entry->dev),
580 			(unsigned long long)__entry->dir,
581 			__get_str(name)
582 		)
583 );
584 
585 #define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \
586 	DEFINE_EVENT(nfs_directory_event_done, name, \
587 			TP_PROTO( \
588 				const struct inode *dir, \
589 				const struct dentry *dentry, \
590 				int error \
591 			), \
592 			TP_ARGS(dir, dentry, error))
593 
594 DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter);
595 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit);
596 DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter);
597 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit);
598 DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter);
599 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit);
600 DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter);
601 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit);
602 DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter);
603 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit);
604 DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter);
605 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit);
606 
607 TRACE_EVENT(nfs_link_enter,
608 		TP_PROTO(
609 			const struct inode *inode,
610 			const struct inode *dir,
611 			const struct dentry *dentry
612 		),
613 
614 		TP_ARGS(inode, dir, dentry),
615 
616 		TP_STRUCT__entry(
617 			__field(dev_t, dev)
618 			__field(u64, fileid)
619 			__field(u64, dir)
620 			__string(name, dentry->d_name.name)
621 		),
622 
623 		TP_fast_assign(
624 			__entry->dev = inode->i_sb->s_dev;
625 			__entry->fileid = NFS_FILEID(inode);
626 			__entry->dir = NFS_FILEID(dir);
627 			__assign_str(name, dentry->d_name.name);
628 		),
629 
630 		TP_printk(
631 			"fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
632 			MAJOR(__entry->dev), MINOR(__entry->dev),
633 			__entry->fileid,
634 			MAJOR(__entry->dev), MINOR(__entry->dev),
635 			(unsigned long long)__entry->dir,
636 			__get_str(name)
637 		)
638 );
639 
640 TRACE_EVENT(nfs_link_exit,
641 		TP_PROTO(
642 			const struct inode *inode,
643 			const struct inode *dir,
644 			const struct dentry *dentry,
645 			int error
646 		),
647 
648 		TP_ARGS(inode, dir, dentry, error),
649 
650 		TP_STRUCT__entry(
651 			__field(unsigned long, error)
652 			__field(dev_t, dev)
653 			__field(u64, fileid)
654 			__field(u64, dir)
655 			__string(name, dentry->d_name.name)
656 		),
657 
658 		TP_fast_assign(
659 			__entry->dev = inode->i_sb->s_dev;
660 			__entry->fileid = NFS_FILEID(inode);
661 			__entry->dir = NFS_FILEID(dir);
662 			__entry->error = error < 0 ? -error : 0;
663 			__assign_str(name, dentry->d_name.name);
664 		),
665 
666 		TP_printk(
667 			"error=%ld (%s) fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
668 			-__entry->error, show_nfs_status(__entry->error),
669 			MAJOR(__entry->dev), MINOR(__entry->dev),
670 			__entry->fileid,
671 			MAJOR(__entry->dev), MINOR(__entry->dev),
672 			(unsigned long long)__entry->dir,
673 			__get_str(name)
674 		)
675 );
676 
677 DECLARE_EVENT_CLASS(nfs_rename_event,
678 		TP_PROTO(
679 			const struct inode *old_dir,
680 			const struct dentry *old_dentry,
681 			const struct inode *new_dir,
682 			const struct dentry *new_dentry
683 		),
684 
685 		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry),
686 
687 		TP_STRUCT__entry(
688 			__field(dev_t, dev)
689 			__field(u64, old_dir)
690 			__field(u64, new_dir)
691 			__string(old_name, old_dentry->d_name.name)
692 			__string(new_name, new_dentry->d_name.name)
693 		),
694 
695 		TP_fast_assign(
696 			__entry->dev = old_dir->i_sb->s_dev;
697 			__entry->old_dir = NFS_FILEID(old_dir);
698 			__entry->new_dir = NFS_FILEID(new_dir);
699 			__assign_str(old_name, old_dentry->d_name.name);
700 			__assign_str(new_name, new_dentry->d_name.name);
701 		),
702 
703 		TP_printk(
704 			"old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s",
705 			MAJOR(__entry->dev), MINOR(__entry->dev),
706 			(unsigned long long)__entry->old_dir,
707 			__get_str(old_name),
708 			MAJOR(__entry->dev), MINOR(__entry->dev),
709 			(unsigned long long)__entry->new_dir,
710 			__get_str(new_name)
711 		)
712 );
713 #define DEFINE_NFS_RENAME_EVENT(name) \
714 	DEFINE_EVENT(nfs_rename_event, name, \
715 			TP_PROTO( \
716 				const struct inode *old_dir, \
717 				const struct dentry *old_dentry, \
718 				const struct inode *new_dir, \
719 				const struct dentry *new_dentry \
720 			), \
721 			TP_ARGS(old_dir, old_dentry, new_dir, new_dentry))
722 
723 DECLARE_EVENT_CLASS(nfs_rename_event_done,
724 		TP_PROTO(
725 			const struct inode *old_dir,
726 			const struct dentry *old_dentry,
727 			const struct inode *new_dir,
728 			const struct dentry *new_dentry,
729 			int error
730 		),
731 
732 		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, error),
733 
734 		TP_STRUCT__entry(
735 			__field(dev_t, dev)
736 			__field(unsigned long, error)
737 			__field(u64, old_dir)
738 			__string(old_name, old_dentry->d_name.name)
739 			__field(u64, new_dir)
740 			__string(new_name, new_dentry->d_name.name)
741 		),
742 
743 		TP_fast_assign(
744 			__entry->dev = old_dir->i_sb->s_dev;
745 			__entry->error = -error;
746 			__entry->old_dir = NFS_FILEID(old_dir);
747 			__entry->new_dir = NFS_FILEID(new_dir);
748 			__assign_str(old_name, old_dentry->d_name.name);
749 			__assign_str(new_name, new_dentry->d_name.name);
750 		),
751 
752 		TP_printk(
753 			"error=%ld (%s) old_name=%02x:%02x:%llu/%s "
754 			"new_name=%02x:%02x:%llu/%s",
755 			-__entry->error, show_nfs_status(__entry->error),
756 			MAJOR(__entry->dev), MINOR(__entry->dev),
757 			(unsigned long long)__entry->old_dir,
758 			__get_str(old_name),
759 			MAJOR(__entry->dev), MINOR(__entry->dev),
760 			(unsigned long long)__entry->new_dir,
761 			__get_str(new_name)
762 		)
763 );
764 #define DEFINE_NFS_RENAME_EVENT_DONE(name) \
765 	DEFINE_EVENT(nfs_rename_event_done, name, \
766 			TP_PROTO( \
767 				const struct inode *old_dir, \
768 				const struct dentry *old_dentry, \
769 				const struct inode *new_dir, \
770 				const struct dentry *new_dentry, \
771 				int error \
772 			), \
773 			TP_ARGS(old_dir, old_dentry, new_dir, \
774 				new_dentry, error))
775 
776 DEFINE_NFS_RENAME_EVENT(nfs_rename_enter);
777 DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit);
778 
779 DEFINE_NFS_RENAME_EVENT_DONE(nfs_sillyrename_rename);
780 
781 TRACE_EVENT(nfs_sillyrename_unlink,
782 		TP_PROTO(
783 			const struct nfs_unlinkdata *data,
784 			int error
785 		),
786 
787 		TP_ARGS(data, error),
788 
789 		TP_STRUCT__entry(
790 			__field(dev_t, dev)
791 			__field(unsigned long, error)
792 			__field(u64, dir)
793 			__dynamic_array(char, name, data->args.name.len + 1)
794 		),
795 
796 		TP_fast_assign(
797 			struct inode *dir = d_inode(data->dentry->d_parent);
798 			size_t len = data->args.name.len;
799 			__entry->dev = dir->i_sb->s_dev;
800 			__entry->dir = NFS_FILEID(dir);
801 			__entry->error = -error;
802 			memcpy(__get_str(name),
803 				data->args.name.name, len);
804 			__get_str(name)[len] = 0;
805 		),
806 
807 		TP_printk(
808 			"error=%ld (%s) name=%02x:%02x:%llu/%s",
809 			-__entry->error, show_nfs_status(__entry->error),
810 			MAJOR(__entry->dev), MINOR(__entry->dev),
811 			(unsigned long long)__entry->dir,
812 			__get_str(name)
813 		)
814 );
815 
816 TRACE_EVENT(nfs_aop_readpage,
817 		TP_PROTO(
818 			const struct inode *inode,
819 			struct page *page
820 		),
821 
822 		TP_ARGS(inode, page),
823 
824 		TP_STRUCT__entry(
825 			__field(dev_t, dev)
826 			__field(u32, fhandle)
827 			__field(u64, fileid)
828 			__field(u64, version)
829 			__field(loff_t, offset)
830 		),
831 
832 		TP_fast_assign(
833 			const struct nfs_inode *nfsi = NFS_I(inode);
834 
835 			__entry->dev = inode->i_sb->s_dev;
836 			__entry->fileid = nfsi->fileid;
837 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
838 			__entry->version = inode_peek_iversion_raw(inode);
839 			__entry->offset = page_index(page) << PAGE_SHIFT;
840 		),
841 
842 		TP_printk(
843 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu offset=%lld",
844 			MAJOR(__entry->dev), MINOR(__entry->dev),
845 			(unsigned long long)__entry->fileid,
846 			__entry->fhandle, __entry->version,
847 			__entry->offset
848 		)
849 );
850 
851 TRACE_EVENT(nfs_aop_readpage_done,
852 		TP_PROTO(
853 			const struct inode *inode,
854 			struct page *page,
855 			int ret
856 		),
857 
858 		TP_ARGS(inode, page, ret),
859 
860 		TP_STRUCT__entry(
861 			__field(dev_t, dev)
862 			__field(u32, fhandle)
863 			__field(int, ret)
864 			__field(u64, fileid)
865 			__field(u64, version)
866 			__field(loff_t, offset)
867 		),
868 
869 		TP_fast_assign(
870 			const struct nfs_inode *nfsi = NFS_I(inode);
871 
872 			__entry->dev = inode->i_sb->s_dev;
873 			__entry->fileid = nfsi->fileid;
874 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
875 			__entry->version = inode_peek_iversion_raw(inode);
876 			__entry->offset = page_index(page) << PAGE_SHIFT;
877 			__entry->ret = ret;
878 		),
879 
880 		TP_printk(
881 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu offset=%lld ret=%d",
882 			MAJOR(__entry->dev), MINOR(__entry->dev),
883 			(unsigned long long)__entry->fileid,
884 			__entry->fhandle, __entry->version,
885 			__entry->offset, __entry->ret
886 		)
887 );
888 
889 TRACE_EVENT(nfs_aop_readahead,
890 		TP_PROTO(
891 			const struct inode *inode,
892 			struct page *page,
893 			unsigned int nr_pages
894 		),
895 
896 		TP_ARGS(inode, page, nr_pages),
897 
898 		TP_STRUCT__entry(
899 			__field(dev_t, dev)
900 			__field(u32, fhandle)
901 			__field(u64, fileid)
902 			__field(u64, version)
903 			__field(loff_t, offset)
904 			__field(unsigned int, nr_pages)
905 		),
906 
907 		TP_fast_assign(
908 			const struct nfs_inode *nfsi = NFS_I(inode);
909 
910 			__entry->dev = inode->i_sb->s_dev;
911 			__entry->fileid = nfsi->fileid;
912 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
913 			__entry->version = inode_peek_iversion_raw(inode);
914 			__entry->offset = page_index(page) << PAGE_SHIFT;
915 			__entry->nr_pages = nr_pages;
916 		),
917 
918 		TP_printk(
919 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu offset=%lld nr_pages=%u",
920 			MAJOR(__entry->dev), MINOR(__entry->dev),
921 			(unsigned long long)__entry->fileid,
922 			__entry->fhandle, __entry->version,
923 			__entry->offset, __entry->nr_pages
924 		)
925 );
926 
927 TRACE_EVENT(nfs_aop_readahead_done,
928 		TP_PROTO(
929 			const struct inode *inode,
930 			unsigned int nr_pages,
931 			int ret
932 		),
933 
934 		TP_ARGS(inode, nr_pages, ret),
935 
936 		TP_STRUCT__entry(
937 			__field(dev_t, dev)
938 			__field(u32, fhandle)
939 			__field(int, ret)
940 			__field(u64, fileid)
941 			__field(u64, version)
942 			__field(loff_t, offset)
943 			__field(unsigned int, nr_pages)
944 		),
945 
946 		TP_fast_assign(
947 			const struct nfs_inode *nfsi = NFS_I(inode);
948 
949 			__entry->dev = inode->i_sb->s_dev;
950 			__entry->fileid = nfsi->fileid;
951 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
952 			__entry->version = inode_peek_iversion_raw(inode);
953 			__entry->nr_pages = nr_pages;
954 			__entry->ret = ret;
955 		),
956 
957 		TP_printk(
958 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu nr_pages=%u ret=%d",
959 			MAJOR(__entry->dev), MINOR(__entry->dev),
960 			(unsigned long long)__entry->fileid,
961 			__entry->fhandle, __entry->version,
962 			__entry->nr_pages, __entry->ret
963 		)
964 );
965 
966 TRACE_EVENT(nfs_initiate_read,
967 		TP_PROTO(
968 			const struct nfs_pgio_header *hdr
969 		),
970 
971 		TP_ARGS(hdr),
972 
973 		TP_STRUCT__entry(
974 			__field(dev_t, dev)
975 			__field(u32, fhandle)
976 			__field(u64, fileid)
977 			__field(loff_t, offset)
978 			__field(u32, count)
979 		),
980 
981 		TP_fast_assign(
982 			const struct inode *inode = hdr->inode;
983 			const struct nfs_inode *nfsi = NFS_I(inode);
984 			const struct nfs_fh *fh = hdr->args.fh ?
985 						  hdr->args.fh : &nfsi->fh;
986 
987 			__entry->offset = hdr->args.offset;
988 			__entry->count = hdr->args.count;
989 			__entry->dev = inode->i_sb->s_dev;
990 			__entry->fileid = nfsi->fileid;
991 			__entry->fhandle = nfs_fhandle_hash(fh);
992 		),
993 
994 		TP_printk(
995 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
996 			"offset=%lld count=%u",
997 			MAJOR(__entry->dev), MINOR(__entry->dev),
998 			(unsigned long long)__entry->fileid,
999 			__entry->fhandle,
1000 			(long long)__entry->offset, __entry->count
1001 		)
1002 );
1003 
1004 TRACE_EVENT(nfs_readpage_done,
1005 		TP_PROTO(
1006 			const struct rpc_task *task,
1007 			const struct nfs_pgio_header *hdr
1008 		),
1009 
1010 		TP_ARGS(task, hdr),
1011 
1012 		TP_STRUCT__entry(
1013 			__field(dev_t, dev)
1014 			__field(u32, fhandle)
1015 			__field(u64, fileid)
1016 			__field(loff_t, offset)
1017 			__field(u32, arg_count)
1018 			__field(u32, res_count)
1019 			__field(bool, eof)
1020 			__field(int, status)
1021 		),
1022 
1023 		TP_fast_assign(
1024 			const struct inode *inode = hdr->inode;
1025 			const struct nfs_inode *nfsi = NFS_I(inode);
1026 			const struct nfs_fh *fh = hdr->args.fh ?
1027 						  hdr->args.fh : &nfsi->fh;
1028 
1029 			__entry->status = task->tk_status;
1030 			__entry->offset = hdr->args.offset;
1031 			__entry->arg_count = hdr->args.count;
1032 			__entry->res_count = hdr->res.count;
1033 			__entry->eof = hdr->res.eof;
1034 			__entry->dev = inode->i_sb->s_dev;
1035 			__entry->fileid = nfsi->fileid;
1036 			__entry->fhandle = nfs_fhandle_hash(fh);
1037 		),
1038 
1039 		TP_printk(
1040 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
1041 			"offset=%lld count=%u res=%u status=%d%s",
1042 			MAJOR(__entry->dev), MINOR(__entry->dev),
1043 			(unsigned long long)__entry->fileid,
1044 			__entry->fhandle,
1045 			(long long)__entry->offset, __entry->arg_count,
1046 			__entry->res_count, __entry->status,
1047 			__entry->eof ? " eof" : ""
1048 		)
1049 );
1050 
1051 TRACE_EVENT(nfs_readpage_short,
1052 		TP_PROTO(
1053 			const struct rpc_task *task,
1054 			const struct nfs_pgio_header *hdr
1055 		),
1056 
1057 		TP_ARGS(task, hdr),
1058 
1059 		TP_STRUCT__entry(
1060 			__field(dev_t, dev)
1061 			__field(u32, fhandle)
1062 			__field(u64, fileid)
1063 			__field(loff_t, offset)
1064 			__field(u32, arg_count)
1065 			__field(u32, res_count)
1066 			__field(bool, eof)
1067 			__field(int, status)
1068 		),
1069 
1070 		TP_fast_assign(
1071 			const struct inode *inode = hdr->inode;
1072 			const struct nfs_inode *nfsi = NFS_I(inode);
1073 			const struct nfs_fh *fh = hdr->args.fh ?
1074 						  hdr->args.fh : &nfsi->fh;
1075 
1076 			__entry->status = task->tk_status;
1077 			__entry->offset = hdr->args.offset;
1078 			__entry->arg_count = hdr->args.count;
1079 			__entry->res_count = hdr->res.count;
1080 			__entry->eof = hdr->res.eof;
1081 			__entry->dev = inode->i_sb->s_dev;
1082 			__entry->fileid = nfsi->fileid;
1083 			__entry->fhandle = nfs_fhandle_hash(fh);
1084 		),
1085 
1086 		TP_printk(
1087 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
1088 			"offset=%lld count=%u res=%u status=%d%s",
1089 			MAJOR(__entry->dev), MINOR(__entry->dev),
1090 			(unsigned long long)__entry->fileid,
1091 			__entry->fhandle,
1092 			(long long)__entry->offset, __entry->arg_count,
1093 			__entry->res_count, __entry->status,
1094 			__entry->eof ? " eof" : ""
1095 		)
1096 );
1097 
1098 TRACE_EVENT(nfs_pgio_error,
1099 	TP_PROTO(
1100 		const struct nfs_pgio_header *hdr,
1101 		int error,
1102 		loff_t pos
1103 	),
1104 
1105 	TP_ARGS(hdr, error, pos),
1106 
1107 	TP_STRUCT__entry(
1108 		__field(dev_t, dev)
1109 		__field(u32, fhandle)
1110 		__field(u64, fileid)
1111 		__field(loff_t, offset)
1112 		__field(u32, arg_count)
1113 		__field(u32, res_count)
1114 		__field(loff_t, pos)
1115 		__field(int, status)
1116 	),
1117 
1118 	TP_fast_assign(
1119 		const struct inode *inode = hdr->inode;
1120 		const struct nfs_inode *nfsi = NFS_I(inode);
1121 		const struct nfs_fh *fh = hdr->args.fh ?
1122 					  hdr->args.fh : &nfsi->fh;
1123 
1124 		__entry->status = error;
1125 		__entry->offset = hdr->args.offset;
1126 		__entry->arg_count = hdr->args.count;
1127 		__entry->res_count = hdr->res.count;
1128 		__entry->dev = inode->i_sb->s_dev;
1129 		__entry->fileid = nfsi->fileid;
1130 		__entry->fhandle = nfs_fhandle_hash(fh);
1131 	),
1132 
1133 	TP_printk("fileid=%02x:%02x:%llu fhandle=0x%08x "
1134 		  "offset=%lld count=%u res=%u pos=%llu status=%d",
1135 		MAJOR(__entry->dev), MINOR(__entry->dev),
1136 		(unsigned long long)__entry->fileid, __entry->fhandle,
1137 		(long long)__entry->offset, __entry->arg_count, __entry->res_count,
1138 		__entry->pos, __entry->status
1139 	)
1140 );
1141 
1142 TRACE_EVENT(nfs_initiate_write,
1143 		TP_PROTO(
1144 			const struct nfs_pgio_header *hdr
1145 		),
1146 
1147 		TP_ARGS(hdr),
1148 
1149 		TP_STRUCT__entry(
1150 			__field(dev_t, dev)
1151 			__field(u32, fhandle)
1152 			__field(u64, fileid)
1153 			__field(loff_t, offset)
1154 			__field(u32, count)
1155 			__field(unsigned long, stable)
1156 		),
1157 
1158 		TP_fast_assign(
1159 			const struct inode *inode = hdr->inode;
1160 			const struct nfs_inode *nfsi = NFS_I(inode);
1161 			const struct nfs_fh *fh = hdr->args.fh ?
1162 						  hdr->args.fh : &nfsi->fh;
1163 
1164 			__entry->offset = hdr->args.offset;
1165 			__entry->count = hdr->args.count;
1166 			__entry->stable = hdr->args.stable;
1167 			__entry->dev = inode->i_sb->s_dev;
1168 			__entry->fileid = nfsi->fileid;
1169 			__entry->fhandle = nfs_fhandle_hash(fh);
1170 		),
1171 
1172 		TP_printk(
1173 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
1174 			"offset=%lld count=%u stable=%s",
1175 			MAJOR(__entry->dev), MINOR(__entry->dev),
1176 			(unsigned long long)__entry->fileid,
1177 			__entry->fhandle,
1178 			(long long)__entry->offset, __entry->count,
1179 			show_nfs_stable_how(__entry->stable)
1180 		)
1181 );
1182 
1183 TRACE_EVENT(nfs_writeback_done,
1184 		TP_PROTO(
1185 			const struct rpc_task *task,
1186 			const struct nfs_pgio_header *hdr
1187 		),
1188 
1189 		TP_ARGS(task, hdr),
1190 
1191 		TP_STRUCT__entry(
1192 			__field(dev_t, dev)
1193 			__field(u32, fhandle)
1194 			__field(u64, fileid)
1195 			__field(loff_t, offset)
1196 			__field(u32, arg_count)
1197 			__field(u32, res_count)
1198 			__field(int, status)
1199 			__field(unsigned long, stable)
1200 			__array(char, verifier, NFS4_VERIFIER_SIZE)
1201 		),
1202 
1203 		TP_fast_assign(
1204 			const struct inode *inode = hdr->inode;
1205 			const struct nfs_inode *nfsi = NFS_I(inode);
1206 			const struct nfs_fh *fh = hdr->args.fh ?
1207 						  hdr->args.fh : &nfsi->fh;
1208 			const struct nfs_writeverf *verf = hdr->res.verf;
1209 
1210 			__entry->status = task->tk_status;
1211 			__entry->offset = hdr->args.offset;
1212 			__entry->arg_count = hdr->args.count;
1213 			__entry->res_count = hdr->res.count;
1214 			__entry->stable = verf->committed;
1215 			memcpy(__entry->verifier,
1216 				&verf->verifier,
1217 				NFS4_VERIFIER_SIZE);
1218 			__entry->dev = inode->i_sb->s_dev;
1219 			__entry->fileid = nfsi->fileid;
1220 			__entry->fhandle = nfs_fhandle_hash(fh);
1221 		),
1222 
1223 		TP_printk(
1224 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
1225 			"offset=%lld count=%u res=%u status=%d stable=%s "
1226 			"verifier=%s",
1227 			MAJOR(__entry->dev), MINOR(__entry->dev),
1228 			(unsigned long long)__entry->fileid,
1229 			__entry->fhandle,
1230 			(long long)__entry->offset, __entry->arg_count,
1231 			__entry->res_count, __entry->status,
1232 			show_nfs_stable_how(__entry->stable),
1233 			show_nfs4_verifier(__entry->verifier)
1234 		)
1235 );
1236 
1237 DECLARE_EVENT_CLASS(nfs_page_error_class,
1238 		TP_PROTO(
1239 			const struct nfs_page *req,
1240 			int error
1241 		),
1242 
1243 		TP_ARGS(req, error),
1244 
1245 		TP_STRUCT__entry(
1246 			__field(const void *, req)
1247 			__field(pgoff_t, index)
1248 			__field(unsigned int, offset)
1249 			__field(unsigned int, pgbase)
1250 			__field(unsigned int, bytes)
1251 			__field(int, error)
1252 		),
1253 
1254 		TP_fast_assign(
1255 			__entry->req = req;
1256 			__entry->index = req->wb_index;
1257 			__entry->offset = req->wb_offset;
1258 			__entry->pgbase = req->wb_pgbase;
1259 			__entry->bytes = req->wb_bytes;
1260 			__entry->error = error;
1261 		),
1262 
1263 		TP_printk(
1264 			"req=%p index=%lu offset=%u pgbase=%u bytes=%u error=%d",
1265 			__entry->req, __entry->index, __entry->offset,
1266 			__entry->pgbase, __entry->bytes, __entry->error
1267 		)
1268 );
1269 
1270 #define DEFINE_NFS_PAGEERR_EVENT(name) \
1271 	DEFINE_EVENT(nfs_page_error_class, name, \
1272 			TP_PROTO( \
1273 				const struct nfs_page *req, \
1274 				int error \
1275 			), \
1276 			TP_ARGS(req, error))
1277 
1278 DEFINE_NFS_PAGEERR_EVENT(nfs_write_error);
1279 DEFINE_NFS_PAGEERR_EVENT(nfs_comp_error);
1280 DEFINE_NFS_PAGEERR_EVENT(nfs_commit_error);
1281 
1282 TRACE_EVENT(nfs_initiate_commit,
1283 		TP_PROTO(
1284 			const struct nfs_commit_data *data
1285 		),
1286 
1287 		TP_ARGS(data),
1288 
1289 		TP_STRUCT__entry(
1290 			__field(dev_t, dev)
1291 			__field(u32, fhandle)
1292 			__field(u64, fileid)
1293 			__field(loff_t, offset)
1294 			__field(u32, count)
1295 		),
1296 
1297 		TP_fast_assign(
1298 			const struct inode *inode = data->inode;
1299 			const struct nfs_inode *nfsi = NFS_I(inode);
1300 			const struct nfs_fh *fh = data->args.fh ?
1301 						  data->args.fh : &nfsi->fh;
1302 
1303 			__entry->offset = data->args.offset;
1304 			__entry->count = data->args.count;
1305 			__entry->dev = inode->i_sb->s_dev;
1306 			__entry->fileid = nfsi->fileid;
1307 			__entry->fhandle = nfs_fhandle_hash(fh);
1308 		),
1309 
1310 		TP_printk(
1311 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
1312 			"offset=%lld count=%u",
1313 			MAJOR(__entry->dev), MINOR(__entry->dev),
1314 			(unsigned long long)__entry->fileid,
1315 			__entry->fhandle,
1316 			(long long)__entry->offset, __entry->count
1317 		)
1318 );
1319 
1320 TRACE_EVENT(nfs_commit_done,
1321 		TP_PROTO(
1322 			const struct rpc_task *task,
1323 			const struct nfs_commit_data *data
1324 		),
1325 
1326 		TP_ARGS(task, data),
1327 
1328 		TP_STRUCT__entry(
1329 			__field(dev_t, dev)
1330 			__field(u32, fhandle)
1331 			__field(u64, fileid)
1332 			__field(loff_t, offset)
1333 			__field(int, status)
1334 			__field(unsigned long, stable)
1335 			__array(char, verifier, NFS4_VERIFIER_SIZE)
1336 		),
1337 
1338 		TP_fast_assign(
1339 			const struct inode *inode = data->inode;
1340 			const struct nfs_inode *nfsi = NFS_I(inode);
1341 			const struct nfs_fh *fh = data->args.fh ?
1342 						  data->args.fh : &nfsi->fh;
1343 			const struct nfs_writeverf *verf = data->res.verf;
1344 
1345 			__entry->status = task->tk_status;
1346 			__entry->offset = data->args.offset;
1347 			__entry->stable = verf->committed;
1348 			memcpy(__entry->verifier,
1349 				&verf->verifier,
1350 				NFS4_VERIFIER_SIZE);
1351 			__entry->dev = inode->i_sb->s_dev;
1352 			__entry->fileid = nfsi->fileid;
1353 			__entry->fhandle = nfs_fhandle_hash(fh);
1354 		),
1355 
1356 		TP_printk(
1357 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
1358 			"offset=%lld status=%d stable=%s verifier=%s",
1359 			MAJOR(__entry->dev), MINOR(__entry->dev),
1360 			(unsigned long long)__entry->fileid,
1361 			__entry->fhandle,
1362 			(long long)__entry->offset, __entry->status,
1363 			show_nfs_stable_how(__entry->stable),
1364 			show_nfs4_verifier(__entry->verifier)
1365 		)
1366 );
1367 
1368 TRACE_EVENT(nfs_fh_to_dentry,
1369 		TP_PROTO(
1370 			const struct super_block *sb,
1371 			const struct nfs_fh *fh,
1372 			u64 fileid,
1373 			int error
1374 		),
1375 
1376 		TP_ARGS(sb, fh, fileid, error),
1377 
1378 		TP_STRUCT__entry(
1379 			__field(int, error)
1380 			__field(dev_t, dev)
1381 			__field(u32, fhandle)
1382 			__field(u64, fileid)
1383 		),
1384 
1385 		TP_fast_assign(
1386 			__entry->error = error;
1387 			__entry->dev = sb->s_dev;
1388 			__entry->fileid = fileid;
1389 			__entry->fhandle = nfs_fhandle_hash(fh);
1390 		),
1391 
1392 		TP_printk(
1393 			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x ",
1394 			__entry->error,
1395 			MAJOR(__entry->dev), MINOR(__entry->dev),
1396 			(unsigned long long)__entry->fileid,
1397 			__entry->fhandle
1398 		)
1399 );
1400 
1401 DECLARE_EVENT_CLASS(nfs_xdr_event,
1402 		TP_PROTO(
1403 			const struct xdr_stream *xdr,
1404 			int error
1405 		),
1406 
1407 		TP_ARGS(xdr, error),
1408 
1409 		TP_STRUCT__entry(
1410 			__field(unsigned int, task_id)
1411 			__field(unsigned int, client_id)
1412 			__field(u32, xid)
1413 			__field(int, version)
1414 			__field(unsigned long, error)
1415 			__string(program,
1416 				 xdr->rqst->rq_task->tk_client->cl_program->name)
1417 			__string(procedure,
1418 				 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
1419 		),
1420 
1421 		TP_fast_assign(
1422 			const struct rpc_rqst *rqstp = xdr->rqst;
1423 			const struct rpc_task *task = rqstp->rq_task;
1424 
1425 			__entry->task_id = task->tk_pid;
1426 			__entry->client_id = task->tk_client->cl_clid;
1427 			__entry->xid = be32_to_cpu(rqstp->rq_xid);
1428 			__entry->version = task->tk_client->cl_vers;
1429 			__entry->error = error;
1430 			__assign_str(program,
1431 				     task->tk_client->cl_program->name);
1432 			__assign_str(procedure, task->tk_msg.rpc_proc->p_name);
1433 		),
1434 
1435 		TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
1436 			  " xid=0x%08x %sv%d %s error=%ld (%s)",
1437 			__entry->task_id, __entry->client_id, __entry->xid,
1438 			__get_str(program), __entry->version,
1439 			__get_str(procedure), -__entry->error,
1440 			show_nfs_status(__entry->error)
1441 		)
1442 );
1443 #define DEFINE_NFS_XDR_EVENT(name) \
1444 	DEFINE_EVENT(nfs_xdr_event, name, \
1445 			TP_PROTO( \
1446 				const struct xdr_stream *xdr, \
1447 				int error \
1448 			), \
1449 			TP_ARGS(xdr, error))
1450 DEFINE_NFS_XDR_EVENT(nfs_xdr_status);
1451 DEFINE_NFS_XDR_EVENT(nfs_xdr_bad_filehandle);
1452 
1453 #endif /* _TRACE_NFS_H */
1454 
1455 #undef TRACE_INCLUDE_PATH
1456 #define TRACE_INCLUDE_PATH .
1457 #define TRACE_INCLUDE_FILE nfstrace
1458 /* This part must be outside protection */
1459 #include <trace/define_trace.h>
1460