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