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