xref: /linux/fs/nfs/nfstrace.h (revision b6ebbac51bedf9e98e837688bc838f400196da5e)
1 /*
2  * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
3  */
4 #undef TRACE_SYSTEM
5 #define TRACE_SYSTEM nfs
6 
7 #if !defined(_TRACE_NFS_H) || defined(TRACE_HEADER_MULTI_READ)
8 #define _TRACE_NFS_H
9 
10 #include <linux/tracepoint.h>
11 
12 #define nfs_show_file_type(ftype) \
13 	__print_symbolic(ftype, \
14 			{ DT_UNKNOWN, "UNKNOWN" }, \
15 			{ DT_FIFO, "FIFO" }, \
16 			{ DT_CHR, "CHR" }, \
17 			{ DT_DIR, "DIR" }, \
18 			{ DT_BLK, "BLK" }, \
19 			{ DT_REG, "REG" }, \
20 			{ DT_LNK, "LNK" }, \
21 			{ DT_SOCK, "SOCK" }, \
22 			{ DT_WHT, "WHT" })
23 
24 #define nfs_show_cache_validity(v) \
25 	__print_flags(v, "|", \
26 			{ NFS_INO_INVALID_ATTR, "INVALID_ATTR" }, \
27 			{ NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
28 			{ NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
29 			{ NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
30 			{ NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
31 			{ NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \
32 			{ NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
33 			{ NFS_INO_INVALID_LABEL, "INVALID_LABEL" })
34 
35 #define nfs_show_nfsi_flags(v) \
36 	__print_flags(v, "|", \
37 			{ 1 << NFS_INO_ADVISE_RDPLUS, "ADVISE_RDPLUS" }, \
38 			{ 1 << NFS_INO_STALE, "STALE" }, \
39 			{ 1 << NFS_INO_INVALIDATING, "INVALIDATING" }, \
40 			{ 1 << NFS_INO_FSCACHE, "FSCACHE" }, \
41 			{ 1 << NFS_INO_LAYOUTCOMMIT, "NEED_LAYOUTCOMMIT" }, \
42 			{ 1 << NFS_INO_LAYOUTCOMMITTING, "LAYOUTCOMMIT" })
43 
44 DECLARE_EVENT_CLASS(nfs_inode_event,
45 		TP_PROTO(
46 			const struct inode *inode
47 		),
48 
49 		TP_ARGS(inode),
50 
51 		TP_STRUCT__entry(
52 			__field(dev_t, dev)
53 			__field(u32, fhandle)
54 			__field(u64, fileid)
55 			__field(u64, version)
56 		),
57 
58 		TP_fast_assign(
59 			const struct nfs_inode *nfsi = NFS_I(inode);
60 			__entry->dev = inode->i_sb->s_dev;
61 			__entry->fileid = nfsi->fileid;
62 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
63 			__entry->version = inode->i_version;
64 		),
65 
66 		TP_printk(
67 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
68 			MAJOR(__entry->dev), MINOR(__entry->dev),
69 			(unsigned long long)__entry->fileid,
70 			__entry->fhandle,
71 			(unsigned long long)__entry->version
72 		)
73 );
74 
75 DECLARE_EVENT_CLASS(nfs_inode_event_done,
76 		TP_PROTO(
77 			const struct inode *inode,
78 			int error
79 		),
80 
81 		TP_ARGS(inode, error),
82 
83 		TP_STRUCT__entry(
84 			__field(int, error)
85 			__field(dev_t, dev)
86 			__field(u32, fhandle)
87 			__field(unsigned char, type)
88 			__field(u64, fileid)
89 			__field(u64, version)
90 			__field(loff_t, size)
91 			__field(unsigned long, nfsi_flags)
92 			__field(unsigned long, cache_validity)
93 		),
94 
95 		TP_fast_assign(
96 			const struct nfs_inode *nfsi = NFS_I(inode);
97 			__entry->error = error;
98 			__entry->dev = inode->i_sb->s_dev;
99 			__entry->fileid = nfsi->fileid;
100 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
101 			__entry->type = nfs_umode_to_dtype(inode->i_mode);
102 			__entry->version = inode->i_version;
103 			__entry->size = i_size_read(inode);
104 			__entry->nfsi_flags = nfsi->flags;
105 			__entry->cache_validity = nfsi->cache_validity;
106 		),
107 
108 		TP_printk(
109 			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
110 			"type=%u (%s) version=%llu size=%lld "
111 			"cache_validity=%lu (%s) nfs_flags=%ld (%s)",
112 			__entry->error,
113 			MAJOR(__entry->dev), MINOR(__entry->dev),
114 			(unsigned long long)__entry->fileid,
115 			__entry->fhandle,
116 			__entry->type,
117 			nfs_show_file_type(__entry->type),
118 			(unsigned long long)__entry->version,
119 			(long long)__entry->size,
120 			__entry->cache_validity,
121 			nfs_show_cache_validity(__entry->cache_validity),
122 			__entry->nfsi_flags,
123 			nfs_show_nfsi_flags(__entry->nfsi_flags)
124 		)
125 );
126 
127 #define DEFINE_NFS_INODE_EVENT(name) \
128 	DEFINE_EVENT(nfs_inode_event, name, \
129 			TP_PROTO( \
130 				const struct inode *inode \
131 			), \
132 			TP_ARGS(inode))
133 #define DEFINE_NFS_INODE_EVENT_DONE(name) \
134 	DEFINE_EVENT(nfs_inode_event_done, name, \
135 			TP_PROTO( \
136 				const struct inode *inode, \
137 				int error \
138 			), \
139 			TP_ARGS(inode, error))
140 DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter);
141 DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit);
142 DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter);
143 DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit);
144 DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter);
145 DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit);
146 DEFINE_NFS_INODE_EVENT(nfs_getattr_enter);
147 DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit);
148 DEFINE_NFS_INODE_EVENT(nfs_setattr_enter);
149 DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit);
150 DEFINE_NFS_INODE_EVENT(nfs_writeback_page_enter);
151 DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_page_exit);
152 DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter);
153 DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit);
154 DEFINE_NFS_INODE_EVENT(nfs_fsync_enter);
155 DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
156 DEFINE_NFS_INODE_EVENT(nfs_access_enter);
157 DEFINE_NFS_INODE_EVENT_DONE(nfs_access_exit);
158 
159 #define show_lookup_flags(flags) \
160 	__print_flags((unsigned long)flags, "|", \
161 			{ LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \
162 			{ LOOKUP_DIRECTORY, "DIRECTORY" }, \
163 			{ LOOKUP_OPEN, "OPEN" }, \
164 			{ LOOKUP_CREATE, "CREATE" }, \
165 			{ LOOKUP_EXCL, "EXCL" })
166 
167 DECLARE_EVENT_CLASS(nfs_lookup_event,
168 		TP_PROTO(
169 			const struct inode *dir,
170 			const struct dentry *dentry,
171 			unsigned int flags
172 		),
173 
174 		TP_ARGS(dir, dentry, flags),
175 
176 		TP_STRUCT__entry(
177 			__field(unsigned int, flags)
178 			__field(dev_t, dev)
179 			__field(u64, dir)
180 			__string(name, dentry->d_name.name)
181 		),
182 
183 		TP_fast_assign(
184 			__entry->dev = dir->i_sb->s_dev;
185 			__entry->dir = NFS_FILEID(dir);
186 			__entry->flags = flags;
187 			__assign_str(name, dentry->d_name.name);
188 		),
189 
190 		TP_printk(
191 			"flags=%u (%s) name=%02x:%02x:%llu/%s",
192 			__entry->flags,
193 			show_lookup_flags(__entry->flags),
194 			MAJOR(__entry->dev), MINOR(__entry->dev),
195 			(unsigned long long)__entry->dir,
196 			__get_str(name)
197 		)
198 );
199 
200 #define DEFINE_NFS_LOOKUP_EVENT(name) \
201 	DEFINE_EVENT(nfs_lookup_event, name, \
202 			TP_PROTO( \
203 				const struct inode *dir, \
204 				const struct dentry *dentry, \
205 				unsigned int flags \
206 			), \
207 			TP_ARGS(dir, dentry, flags))
208 
209 DECLARE_EVENT_CLASS(nfs_lookup_event_done,
210 		TP_PROTO(
211 			const struct inode *dir,
212 			const struct dentry *dentry,
213 			unsigned int flags,
214 			int error
215 		),
216 
217 		TP_ARGS(dir, dentry, flags, error),
218 
219 		TP_STRUCT__entry(
220 			__field(int, error)
221 			__field(unsigned int, flags)
222 			__field(dev_t, dev)
223 			__field(u64, dir)
224 			__string(name, dentry->d_name.name)
225 		),
226 
227 		TP_fast_assign(
228 			__entry->dev = dir->i_sb->s_dev;
229 			__entry->dir = NFS_FILEID(dir);
230 			__entry->error = error;
231 			__entry->flags = flags;
232 			__assign_str(name, dentry->d_name.name);
233 		),
234 
235 		TP_printk(
236 			"error=%d flags=%u (%s) name=%02x:%02x:%llu/%s",
237 			__entry->error,
238 			__entry->flags,
239 			show_lookup_flags(__entry->flags),
240 			MAJOR(__entry->dev), MINOR(__entry->dev),
241 			(unsigned long long)__entry->dir,
242 			__get_str(name)
243 		)
244 );
245 
246 #define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \
247 	DEFINE_EVENT(nfs_lookup_event_done, name, \
248 			TP_PROTO( \
249 				const struct inode *dir, \
250 				const struct dentry *dentry, \
251 				unsigned int flags, \
252 				int error \
253 			), \
254 			TP_ARGS(dir, dentry, flags, error))
255 
256 DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter);
257 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
258 DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
259 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
260 
261 #define show_open_flags(flags) \
262 	__print_flags((unsigned long)flags, "|", \
263 		{ O_CREAT, "O_CREAT" }, \
264 		{ O_EXCL, "O_EXCL" }, \
265 		{ O_TRUNC, "O_TRUNC" }, \
266 		{ O_APPEND, "O_APPEND" }, \
267 		{ O_DSYNC, "O_DSYNC" }, \
268 		{ O_DIRECT, "O_DIRECT" }, \
269 		{ O_DIRECTORY, "O_DIRECTORY" })
270 
271 #define show_fmode_flags(mode) \
272 	__print_flags(mode, "|", \
273 		{ ((__force unsigned long)FMODE_READ), "READ" }, \
274 		{ ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
275 		{ ((__force unsigned long)FMODE_EXEC), "EXEC" })
276 
277 TRACE_EVENT(nfs_atomic_open_enter,
278 		TP_PROTO(
279 			const struct inode *dir,
280 			const struct nfs_open_context *ctx,
281 			unsigned int flags
282 		),
283 
284 		TP_ARGS(dir, ctx, flags),
285 
286 		TP_STRUCT__entry(
287 			__field(unsigned int, flags)
288 			__field(unsigned int, fmode)
289 			__field(dev_t, dev)
290 			__field(u64, dir)
291 			__string(name, ctx->dentry->d_name.name)
292 		),
293 
294 		TP_fast_assign(
295 			__entry->dev = dir->i_sb->s_dev;
296 			__entry->dir = NFS_FILEID(dir);
297 			__entry->flags = flags;
298 			__entry->fmode = (__force unsigned int)ctx->mode;
299 			__assign_str(name, ctx->dentry->d_name.name);
300 		),
301 
302 		TP_printk(
303 			"flags=%u (%s) fmode=%s name=%02x:%02x:%llu/%s",
304 			__entry->flags,
305 			show_open_flags(__entry->flags),
306 			show_fmode_flags(__entry->fmode),
307 			MAJOR(__entry->dev), MINOR(__entry->dev),
308 			(unsigned long long)__entry->dir,
309 			__get_str(name)
310 		)
311 );
312 
313 TRACE_EVENT(nfs_atomic_open_exit,
314 		TP_PROTO(
315 			const struct inode *dir,
316 			const struct nfs_open_context *ctx,
317 			unsigned int flags,
318 			int error
319 		),
320 
321 		TP_ARGS(dir, ctx, flags, error),
322 
323 		TP_STRUCT__entry(
324 			__field(int, error)
325 			__field(unsigned int, flags)
326 			__field(unsigned int, fmode)
327 			__field(dev_t, dev)
328 			__field(u64, dir)
329 			__string(name, ctx->dentry->d_name.name)
330 		),
331 
332 		TP_fast_assign(
333 			__entry->error = error;
334 			__entry->dev = dir->i_sb->s_dev;
335 			__entry->dir = NFS_FILEID(dir);
336 			__entry->flags = flags;
337 			__entry->fmode = (__force unsigned int)ctx->mode;
338 			__assign_str(name, ctx->dentry->d_name.name);
339 		),
340 
341 		TP_printk(
342 			"error=%d flags=%u (%s) fmode=%s "
343 			"name=%02x:%02x:%llu/%s",
344 			__entry->error,
345 			__entry->flags,
346 			show_open_flags(__entry->flags),
347 			show_fmode_flags(__entry->fmode),
348 			MAJOR(__entry->dev), MINOR(__entry->dev),
349 			(unsigned long long)__entry->dir,
350 			__get_str(name)
351 		)
352 );
353 
354 TRACE_EVENT(nfs_create_enter,
355 		TP_PROTO(
356 			const struct inode *dir,
357 			const struct dentry *dentry,
358 			unsigned int flags
359 		),
360 
361 		TP_ARGS(dir, dentry, flags),
362 
363 		TP_STRUCT__entry(
364 			__field(unsigned int, flags)
365 			__field(dev_t, dev)
366 			__field(u64, dir)
367 			__string(name, dentry->d_name.name)
368 		),
369 
370 		TP_fast_assign(
371 			__entry->dev = dir->i_sb->s_dev;
372 			__entry->dir = NFS_FILEID(dir);
373 			__entry->flags = flags;
374 			__assign_str(name, dentry->d_name.name);
375 		),
376 
377 		TP_printk(
378 			"flags=%u (%s) name=%02x:%02x:%llu/%s",
379 			__entry->flags,
380 			show_open_flags(__entry->flags),
381 			MAJOR(__entry->dev), MINOR(__entry->dev),
382 			(unsigned long long)__entry->dir,
383 			__get_str(name)
384 		)
385 );
386 
387 TRACE_EVENT(nfs_create_exit,
388 		TP_PROTO(
389 			const struct inode *dir,
390 			const struct dentry *dentry,
391 			unsigned int flags,
392 			int error
393 		),
394 
395 		TP_ARGS(dir, dentry, flags, error),
396 
397 		TP_STRUCT__entry(
398 			__field(int, error)
399 			__field(unsigned int, flags)
400 			__field(dev_t, dev)
401 			__field(u64, dir)
402 			__string(name, dentry->d_name.name)
403 		),
404 
405 		TP_fast_assign(
406 			__entry->error = error;
407 			__entry->dev = dir->i_sb->s_dev;
408 			__entry->dir = NFS_FILEID(dir);
409 			__entry->flags = flags;
410 			__assign_str(name, dentry->d_name.name);
411 		),
412 
413 		TP_printk(
414 			"error=%d flags=%u (%s) name=%02x:%02x:%llu/%s",
415 			__entry->error,
416 			__entry->flags,
417 			show_open_flags(__entry->flags),
418 			MAJOR(__entry->dev), MINOR(__entry->dev),
419 			(unsigned long long)__entry->dir,
420 			__get_str(name)
421 		)
422 );
423 
424 DECLARE_EVENT_CLASS(nfs_directory_event,
425 		TP_PROTO(
426 			const struct inode *dir,
427 			const struct dentry *dentry
428 		),
429 
430 		TP_ARGS(dir, dentry),
431 
432 		TP_STRUCT__entry(
433 			__field(dev_t, dev)
434 			__field(u64, dir)
435 			__string(name, dentry->d_name.name)
436 		),
437 
438 		TP_fast_assign(
439 			__entry->dev = dir->i_sb->s_dev;
440 			__entry->dir = NFS_FILEID(dir);
441 			__assign_str(name, dentry->d_name.name);
442 		),
443 
444 		TP_printk(
445 			"name=%02x:%02x:%llu/%s",
446 			MAJOR(__entry->dev), MINOR(__entry->dev),
447 			(unsigned long long)__entry->dir,
448 			__get_str(name)
449 		)
450 );
451 
452 #define DEFINE_NFS_DIRECTORY_EVENT(name) \
453 	DEFINE_EVENT(nfs_directory_event, name, \
454 			TP_PROTO( \
455 				const struct inode *dir, \
456 				const struct dentry *dentry \
457 			), \
458 			TP_ARGS(dir, dentry))
459 
460 DECLARE_EVENT_CLASS(nfs_directory_event_done,
461 		TP_PROTO(
462 			const struct inode *dir,
463 			const struct dentry *dentry,
464 			int error
465 		),
466 
467 		TP_ARGS(dir, dentry, error),
468 
469 		TP_STRUCT__entry(
470 			__field(int, error)
471 			__field(dev_t, dev)
472 			__field(u64, dir)
473 			__string(name, dentry->d_name.name)
474 		),
475 
476 		TP_fast_assign(
477 			__entry->dev = dir->i_sb->s_dev;
478 			__entry->dir = NFS_FILEID(dir);
479 			__entry->error = error;
480 			__assign_str(name, dentry->d_name.name);
481 		),
482 
483 		TP_printk(
484 			"error=%d name=%02x:%02x:%llu/%s",
485 			__entry->error,
486 			MAJOR(__entry->dev), MINOR(__entry->dev),
487 			(unsigned long long)__entry->dir,
488 			__get_str(name)
489 		)
490 );
491 
492 #define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \
493 	DEFINE_EVENT(nfs_directory_event_done, name, \
494 			TP_PROTO( \
495 				const struct inode *dir, \
496 				const struct dentry *dentry, \
497 				int error \
498 			), \
499 			TP_ARGS(dir, dentry, error))
500 
501 DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter);
502 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit);
503 DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter);
504 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit);
505 DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter);
506 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit);
507 DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter);
508 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit);
509 DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter);
510 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit);
511 DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter);
512 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit);
513 
514 TRACE_EVENT(nfs_link_enter,
515 		TP_PROTO(
516 			const struct inode *inode,
517 			const struct inode *dir,
518 			const struct dentry *dentry
519 		),
520 
521 		TP_ARGS(inode, dir, dentry),
522 
523 		TP_STRUCT__entry(
524 			__field(dev_t, dev)
525 			__field(u64, fileid)
526 			__field(u64, dir)
527 			__string(name, dentry->d_name.name)
528 		),
529 
530 		TP_fast_assign(
531 			__entry->dev = inode->i_sb->s_dev;
532 			__entry->fileid = NFS_FILEID(inode);
533 			__entry->dir = NFS_FILEID(dir);
534 			__assign_str(name, dentry->d_name.name);
535 		),
536 
537 		TP_printk(
538 			"fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
539 			MAJOR(__entry->dev), MINOR(__entry->dev),
540 			__entry->fileid,
541 			MAJOR(__entry->dev), MINOR(__entry->dev),
542 			(unsigned long long)__entry->dir,
543 			__get_str(name)
544 		)
545 );
546 
547 TRACE_EVENT(nfs_link_exit,
548 		TP_PROTO(
549 			const struct inode *inode,
550 			const struct inode *dir,
551 			const struct dentry *dentry,
552 			int error
553 		),
554 
555 		TP_ARGS(inode, dir, dentry, error),
556 
557 		TP_STRUCT__entry(
558 			__field(int, error)
559 			__field(dev_t, dev)
560 			__field(u64, fileid)
561 			__field(u64, dir)
562 			__string(name, dentry->d_name.name)
563 		),
564 
565 		TP_fast_assign(
566 			__entry->dev = inode->i_sb->s_dev;
567 			__entry->fileid = NFS_FILEID(inode);
568 			__entry->dir = NFS_FILEID(dir);
569 			__entry->error = error;
570 			__assign_str(name, dentry->d_name.name);
571 		),
572 
573 		TP_printk(
574 			"error=%d fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
575 			__entry->error,
576 			MAJOR(__entry->dev), MINOR(__entry->dev),
577 			__entry->fileid,
578 			MAJOR(__entry->dev), MINOR(__entry->dev),
579 			(unsigned long long)__entry->dir,
580 			__get_str(name)
581 		)
582 );
583 
584 DECLARE_EVENT_CLASS(nfs_rename_event,
585 		TP_PROTO(
586 			const struct inode *old_dir,
587 			const struct dentry *old_dentry,
588 			const struct inode *new_dir,
589 			const struct dentry *new_dentry
590 		),
591 
592 		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry),
593 
594 		TP_STRUCT__entry(
595 			__field(dev_t, dev)
596 			__field(u64, old_dir)
597 			__field(u64, new_dir)
598 			__string(old_name, old_dentry->d_name.name)
599 			__string(new_name, new_dentry->d_name.name)
600 		),
601 
602 		TP_fast_assign(
603 			__entry->dev = old_dir->i_sb->s_dev;
604 			__entry->old_dir = NFS_FILEID(old_dir);
605 			__entry->new_dir = NFS_FILEID(new_dir);
606 			__assign_str(old_name, old_dentry->d_name.name);
607 			__assign_str(new_name, new_dentry->d_name.name);
608 		),
609 
610 		TP_printk(
611 			"old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s",
612 			MAJOR(__entry->dev), MINOR(__entry->dev),
613 			(unsigned long long)__entry->old_dir,
614 			__get_str(old_name),
615 			MAJOR(__entry->dev), MINOR(__entry->dev),
616 			(unsigned long long)__entry->new_dir,
617 			__get_str(new_name)
618 		)
619 );
620 #define DEFINE_NFS_RENAME_EVENT(name) \
621 	DEFINE_EVENT(nfs_rename_event, name, \
622 			TP_PROTO( \
623 				const struct inode *old_dir, \
624 				const struct dentry *old_dentry, \
625 				const struct inode *new_dir, \
626 				const struct dentry *new_dentry \
627 			), \
628 			TP_ARGS(old_dir, old_dentry, new_dir, new_dentry))
629 
630 DECLARE_EVENT_CLASS(nfs_rename_event_done,
631 		TP_PROTO(
632 			const struct inode *old_dir,
633 			const struct dentry *old_dentry,
634 			const struct inode *new_dir,
635 			const struct dentry *new_dentry,
636 			int error
637 		),
638 
639 		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, error),
640 
641 		TP_STRUCT__entry(
642 			__field(dev_t, dev)
643 			__field(int, error)
644 			__field(u64, old_dir)
645 			__string(old_name, old_dentry->d_name.name)
646 			__field(u64, new_dir)
647 			__string(new_name, new_dentry->d_name.name)
648 		),
649 
650 		TP_fast_assign(
651 			__entry->dev = old_dir->i_sb->s_dev;
652 			__entry->old_dir = NFS_FILEID(old_dir);
653 			__entry->new_dir = NFS_FILEID(new_dir);
654 			__entry->error = error;
655 			__assign_str(old_name, old_dentry->d_name.name);
656 			__assign_str(new_name, new_dentry->d_name.name);
657 		),
658 
659 		TP_printk(
660 			"error=%d old_name=%02x:%02x:%llu/%s "
661 			"new_name=%02x:%02x:%llu/%s",
662 			__entry->error,
663 			MAJOR(__entry->dev), MINOR(__entry->dev),
664 			(unsigned long long)__entry->old_dir,
665 			__get_str(old_name),
666 			MAJOR(__entry->dev), MINOR(__entry->dev),
667 			(unsigned long long)__entry->new_dir,
668 			__get_str(new_name)
669 		)
670 );
671 #define DEFINE_NFS_RENAME_EVENT_DONE(name) \
672 	DEFINE_EVENT(nfs_rename_event_done, name, \
673 			TP_PROTO( \
674 				const struct inode *old_dir, \
675 				const struct dentry *old_dentry, \
676 				const struct inode *new_dir, \
677 				const struct dentry *new_dentry, \
678 				int error \
679 			), \
680 			TP_ARGS(old_dir, old_dentry, new_dir, \
681 				new_dentry, error))
682 
683 DEFINE_NFS_RENAME_EVENT(nfs_rename_enter);
684 DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit);
685 
686 DEFINE_NFS_RENAME_EVENT_DONE(nfs_sillyrename_rename);
687 
688 TRACE_EVENT(nfs_sillyrename_unlink,
689 		TP_PROTO(
690 			const struct nfs_unlinkdata *data,
691 			int error
692 		),
693 
694 		TP_ARGS(data, error),
695 
696 		TP_STRUCT__entry(
697 			__field(dev_t, dev)
698 			__field(int, error)
699 			__field(u64, dir)
700 			__dynamic_array(char, name, data->args.name.len + 1)
701 		),
702 
703 		TP_fast_assign(
704 			struct inode *dir = d_inode(data->dentry->d_parent);
705 			size_t len = data->args.name.len;
706 			__entry->dev = dir->i_sb->s_dev;
707 			__entry->dir = NFS_FILEID(dir);
708 			__entry->error = error;
709 			memcpy(__get_str(name),
710 				data->args.name.name, len);
711 			__get_str(name)[len] = 0;
712 		),
713 
714 		TP_printk(
715 			"error=%d name=%02x:%02x:%llu/%s",
716 			__entry->error,
717 			MAJOR(__entry->dev), MINOR(__entry->dev),
718 			(unsigned long long)__entry->dir,
719 			__get_str(name)
720 		)
721 );
722 #endif /* _TRACE_NFS_H */
723 
724 #undef TRACE_INCLUDE_PATH
725 #define TRACE_INCLUDE_PATH .
726 #define TRACE_INCLUDE_FILE nfstrace
727 /* This part must be outside protection */
728 #include <trace/define_trace.h>
729