1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
6 #define TRACE_SYSTEM nfs
8 #if !defined(_TRACE_NFS_H) || defined(TRACE_HEADER_MULTI_READ)
11 #include <linux/tracepoint.h>
12 #include <linux/iversion.h>
14 #define nfs_show_file_type(ftype) \
15 __print_symbolic(ftype, \
16 { DT_UNKNOWN, "UNKNOWN" }, \
17 { DT_FIFO, "FIFO" }, \
23 { DT_SOCK, "SOCK" }, \
26 #define nfs_show_cache_validity(v) \
27 __print_flags(v, "|", \
28 { NFS_INO_INVALID_ATTR, "INVALID_ATTR" }, \
29 { NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
30 { NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
31 { NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
32 { NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
33 { NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \
34 { NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
35 { NFS_INO_INVALID_LABEL, "INVALID_LABEL" })
37 #define nfs_show_nfsi_flags(v) \
38 __print_flags(v, "|", \
39 { 1 << NFS_INO_ADVISE_RDPLUS, "ADVISE_RDPLUS" }, \
40 { 1 << NFS_INO_STALE, "STALE" }, \
41 { 1 << NFS_INO_INVALIDATING, "INVALIDATING" }, \
42 { 1 << NFS_INO_FSCACHE, "FSCACHE" }, \
43 { 1 << NFS_INO_LAYOUTCOMMIT, "NEED_LAYOUTCOMMIT" }, \
44 { 1 << NFS_INO_LAYOUTCOMMITTING, "LAYOUTCOMMIT" })
46 DECLARE_EVENT_CLASS(nfs_inode_event
,
48 const struct inode
*inode
61 const struct nfs_inode
*nfsi
= NFS_I(inode
);
62 __entry
->dev
= inode
->i_sb
->s_dev
;
63 __entry
->fileid
= nfsi
->fileid
;
64 __entry
->fhandle
= nfs_fhandle_hash(&nfsi
->fh
);
65 __entry
->version
= inode_peek_iversion_raw(inode
);
69 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
70 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
71 (unsigned long long)__entry
->fileid
,
73 (unsigned long long)__entry
->version
77 DECLARE_EVENT_CLASS(nfs_inode_event_done
,
79 const struct inode
*inode
,
83 TP_ARGS(inode
, error
),
89 __field(unsigned char, type
)
93 __field(unsigned long, nfsi_flags
)
94 __field(unsigned long, cache_validity
)
98 const struct nfs_inode
*nfsi
= NFS_I(inode
);
99 __entry
->error
= error
;
100 __entry
->dev
= inode
->i_sb
->s_dev
;
101 __entry
->fileid
= nfsi
->fileid
;
102 __entry
->fhandle
= nfs_fhandle_hash(&nfsi
->fh
);
103 __entry
->type
= nfs_umode_to_dtype(inode
->i_mode
);
104 __entry
->version
= inode_peek_iversion_raw(inode
);
105 __entry
->size
= i_size_read(inode
);
106 __entry
->nfsi_flags
= nfsi
->flags
;
107 __entry
->cache_validity
= nfsi
->cache_validity
;
111 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
112 "type=%u (%s) version=%llu size=%lld "
113 "cache_validity=%lu (%s) nfs_flags=%ld (%s)",
115 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
116 (unsigned long long)__entry
->fileid
,
119 nfs_show_file_type(__entry
->type
),
120 (unsigned long long)__entry
->version
,
121 (long long)__entry
->size
,
122 __entry
->cache_validity
,
123 nfs_show_cache_validity(__entry
->cache_validity
),
125 nfs_show_nfsi_flags(__entry
->nfsi_flags
)
129 #define DEFINE_NFS_INODE_EVENT(name) \
130 DEFINE_EVENT(nfs_inode_event, name, \
132 const struct inode *inode \
135 #define DEFINE_NFS_INODE_EVENT_DONE(name) \
136 DEFINE_EVENT(nfs_inode_event_done, name, \
138 const struct inode *inode, \
141 TP_ARGS(inode, error))
142 DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter
);
143 DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit
);
144 DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter
);
145 DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit
);
146 DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter
);
147 DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit
);
148 DEFINE_NFS_INODE_EVENT(nfs_getattr_enter
);
149 DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit
);
150 DEFINE_NFS_INODE_EVENT(nfs_setattr_enter
);
151 DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit
);
152 DEFINE_NFS_INODE_EVENT(nfs_writeback_page_enter
);
153 DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_page_exit
);
154 DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter
);
155 DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit
);
156 DEFINE_NFS_INODE_EVENT(nfs_fsync_enter
);
157 DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit
);
158 DEFINE_NFS_INODE_EVENT(nfs_access_enter
);
159 DEFINE_NFS_INODE_EVENT_DONE(nfs_access_exit
);
161 #define show_lookup_flags(flags) \
162 __print_flags((unsigned long)flags, "|", \
163 { LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \
164 { LOOKUP_DIRECTORY, "DIRECTORY" }, \
165 { LOOKUP_OPEN, "OPEN" }, \
166 { LOOKUP_CREATE, "CREATE" }, \
167 { LOOKUP_EXCL, "EXCL" })
169 DECLARE_EVENT_CLASS(nfs_lookup_event
,
171 const struct inode
*dir
,
172 const struct dentry
*dentry
,
176 TP_ARGS(dir
, dentry
, flags
),
179 __field(unsigned int, flags
)
182 __string(name
, dentry
->d_name
.name
)
186 __entry
->dev
= dir
->i_sb
->s_dev
;
187 __entry
->dir
= NFS_FILEID(dir
);
188 __entry
->flags
= flags
;
189 __assign_str(name
, dentry
->d_name
.name
);
193 "flags=%u (%s) name=%02x:%02x:%llu/%s",
195 show_lookup_flags(__entry
->flags
),
196 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
197 (unsigned long long)__entry
->dir
,
202 #define DEFINE_NFS_LOOKUP_EVENT(name) \
203 DEFINE_EVENT(nfs_lookup_event, name, \
205 const struct inode *dir, \
206 const struct dentry *dentry, \
209 TP_ARGS(dir, dentry, flags))
211 DECLARE_EVENT_CLASS(nfs_lookup_event_done
,
213 const struct inode
*dir
,
214 const struct dentry
*dentry
,
219 TP_ARGS(dir
, dentry
, flags
, error
),
223 __field(unsigned int, flags
)
226 __string(name
, dentry
->d_name
.name
)
230 __entry
->dev
= dir
->i_sb
->s_dev
;
231 __entry
->dir
= NFS_FILEID(dir
);
232 __entry
->error
= error
;
233 __entry
->flags
= flags
;
234 __assign_str(name
, dentry
->d_name
.name
);
238 "error=%d flags=%u (%s) name=%02x:%02x:%llu/%s",
241 show_lookup_flags(__entry
->flags
),
242 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
243 (unsigned long long)__entry
->dir
,
248 #define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \
249 DEFINE_EVENT(nfs_lookup_event_done, name, \
251 const struct inode *dir, \
252 const struct dentry *dentry, \
253 unsigned int flags, \
256 TP_ARGS(dir, dentry, flags, error))
258 DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter
);
259 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit
);
260 DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter
);
261 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit
);
263 #define show_open_flags(flags) \
264 __print_flags((unsigned long)flags, "|", \
265 { O_CREAT, "O_CREAT" }, \
266 { O_EXCL, "O_EXCL" }, \
267 { O_TRUNC, "O_TRUNC" }, \
268 { O_APPEND, "O_APPEND" }, \
269 { O_DSYNC, "O_DSYNC" }, \
270 { O_DIRECT, "O_DIRECT" }, \
271 { O_DIRECTORY, "O_DIRECTORY" })
273 #define show_fmode_flags(mode) \
274 __print_flags(mode, "|", \
275 { ((__force unsigned long)FMODE_READ), "READ" }, \
276 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
277 { ((__force unsigned long)FMODE_EXEC), "EXEC" })
279 TRACE_EVENT(nfs_atomic_open_enter
,
281 const struct inode
*dir
,
282 const struct nfs_open_context
*ctx
,
286 TP_ARGS(dir
, ctx
, flags
),
289 __field(unsigned int, flags
)
290 __field(unsigned int, fmode
)
293 __string(name
, ctx
->dentry
->d_name
.name
)
297 __entry
->dev
= dir
->i_sb
->s_dev
;
298 __entry
->dir
= NFS_FILEID(dir
);
299 __entry
->flags
= flags
;
300 __entry
->fmode
= (__force
unsigned int)ctx
->mode
;
301 __assign_str(name
, ctx
->dentry
->d_name
.name
);
305 "flags=%u (%s) fmode=%s name=%02x:%02x:%llu/%s",
307 show_open_flags(__entry
->flags
),
308 show_fmode_flags(__entry
->fmode
),
309 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
310 (unsigned long long)__entry
->dir
,
315 TRACE_EVENT(nfs_atomic_open_exit
,
317 const struct inode
*dir
,
318 const struct nfs_open_context
*ctx
,
323 TP_ARGS(dir
, ctx
, flags
, error
),
327 __field(unsigned int, flags
)
328 __field(unsigned int, fmode
)
331 __string(name
, ctx
->dentry
->d_name
.name
)
335 __entry
->error
= error
;
336 __entry
->dev
= dir
->i_sb
->s_dev
;
337 __entry
->dir
= NFS_FILEID(dir
);
338 __entry
->flags
= flags
;
339 __entry
->fmode
= (__force
unsigned int)ctx
->mode
;
340 __assign_str(name
, ctx
->dentry
->d_name
.name
);
344 "error=%d flags=%u (%s) fmode=%s "
345 "name=%02x:%02x:%llu/%s",
348 show_open_flags(__entry
->flags
),
349 show_fmode_flags(__entry
->fmode
),
350 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
351 (unsigned long long)__entry
->dir
,
356 TRACE_EVENT(nfs_create_enter
,
358 const struct inode
*dir
,
359 const struct dentry
*dentry
,
363 TP_ARGS(dir
, dentry
, flags
),
366 __field(unsigned int, flags
)
369 __string(name
, dentry
->d_name
.name
)
373 __entry
->dev
= dir
->i_sb
->s_dev
;
374 __entry
->dir
= NFS_FILEID(dir
);
375 __entry
->flags
= flags
;
376 __assign_str(name
, dentry
->d_name
.name
);
380 "flags=%u (%s) name=%02x:%02x:%llu/%s",
382 show_open_flags(__entry
->flags
),
383 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
384 (unsigned long long)__entry
->dir
,
389 TRACE_EVENT(nfs_create_exit
,
391 const struct inode
*dir
,
392 const struct dentry
*dentry
,
397 TP_ARGS(dir
, dentry
, flags
, error
),
401 __field(unsigned int, flags
)
404 __string(name
, dentry
->d_name
.name
)
408 __entry
->error
= error
;
409 __entry
->dev
= dir
->i_sb
->s_dev
;
410 __entry
->dir
= NFS_FILEID(dir
);
411 __entry
->flags
= flags
;
412 __assign_str(name
, dentry
->d_name
.name
);
416 "error=%d flags=%u (%s) name=%02x:%02x:%llu/%s",
419 show_open_flags(__entry
->flags
),
420 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
421 (unsigned long long)__entry
->dir
,
426 DECLARE_EVENT_CLASS(nfs_directory_event
,
428 const struct inode
*dir
,
429 const struct dentry
*dentry
432 TP_ARGS(dir
, dentry
),
437 __string(name
, dentry
->d_name
.name
)
441 __entry
->dev
= dir
->i_sb
->s_dev
;
442 __entry
->dir
= NFS_FILEID(dir
);
443 __assign_str(name
, dentry
->d_name
.name
);
447 "name=%02x:%02x:%llu/%s",
448 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
449 (unsigned long long)__entry
->dir
,
454 #define DEFINE_NFS_DIRECTORY_EVENT(name) \
455 DEFINE_EVENT(nfs_directory_event, name, \
457 const struct inode *dir, \
458 const struct dentry *dentry \
460 TP_ARGS(dir, dentry))
462 DECLARE_EVENT_CLASS(nfs_directory_event_done
,
464 const struct inode
*dir
,
465 const struct dentry
*dentry
,
469 TP_ARGS(dir
, dentry
, error
),
475 __string(name
, dentry
->d_name
.name
)
479 __entry
->dev
= dir
->i_sb
->s_dev
;
480 __entry
->dir
= NFS_FILEID(dir
);
481 __entry
->error
= error
;
482 __assign_str(name
, dentry
->d_name
.name
);
486 "error=%d name=%02x:%02x:%llu/%s",
488 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
489 (unsigned long long)__entry
->dir
,
494 #define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \
495 DEFINE_EVENT(nfs_directory_event_done, name, \
497 const struct inode *dir, \
498 const struct dentry *dentry, \
501 TP_ARGS(dir, dentry, error))
503 DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter
);
504 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit
);
505 DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter
);
506 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit
);
507 DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter
);
508 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit
);
509 DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter
);
510 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit
);
511 DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter
);
512 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit
);
513 DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter
);
514 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit
);
516 TRACE_EVENT(nfs_link_enter
,
518 const struct inode
*inode
,
519 const struct inode
*dir
,
520 const struct dentry
*dentry
523 TP_ARGS(inode
, dir
, dentry
),
529 __string(name
, dentry
->d_name
.name
)
533 __entry
->dev
= inode
->i_sb
->s_dev
;
534 __entry
->fileid
= NFS_FILEID(inode
);
535 __entry
->dir
= NFS_FILEID(dir
);
536 __assign_str(name
, dentry
->d_name
.name
);
540 "fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
541 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
543 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
544 (unsigned long long)__entry
->dir
,
549 TRACE_EVENT(nfs_link_exit
,
551 const struct inode
*inode
,
552 const struct inode
*dir
,
553 const struct dentry
*dentry
,
557 TP_ARGS(inode
, dir
, dentry
, error
),
564 __string(name
, dentry
->d_name
.name
)
568 __entry
->dev
= inode
->i_sb
->s_dev
;
569 __entry
->fileid
= NFS_FILEID(inode
);
570 __entry
->dir
= NFS_FILEID(dir
);
571 __entry
->error
= error
;
572 __assign_str(name
, dentry
->d_name
.name
);
576 "error=%d fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
578 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
580 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
581 (unsigned long long)__entry
->dir
,
586 DECLARE_EVENT_CLASS(nfs_rename_event
,
588 const struct inode
*old_dir
,
589 const struct dentry
*old_dentry
,
590 const struct inode
*new_dir
,
591 const struct dentry
*new_dentry
594 TP_ARGS(old_dir
, old_dentry
, new_dir
, new_dentry
),
598 __field(u64
, old_dir
)
599 __field(u64
, new_dir
)
600 __string(old_name
, old_dentry
->d_name
.name
)
601 __string(new_name
, new_dentry
->d_name
.name
)
605 __entry
->dev
= old_dir
->i_sb
->s_dev
;
606 __entry
->old_dir
= NFS_FILEID(old_dir
);
607 __entry
->new_dir
= NFS_FILEID(new_dir
);
608 __assign_str(old_name
, old_dentry
->d_name
.name
);
609 __assign_str(new_name
, new_dentry
->d_name
.name
);
613 "old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s",
614 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
615 (unsigned long long)__entry
->old_dir
,
617 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
618 (unsigned long long)__entry
->new_dir
,
622 #define DEFINE_NFS_RENAME_EVENT(name) \
623 DEFINE_EVENT(nfs_rename_event, name, \
625 const struct inode *old_dir, \
626 const struct dentry *old_dentry, \
627 const struct inode *new_dir, \
628 const struct dentry *new_dentry \
630 TP_ARGS(old_dir, old_dentry, new_dir, new_dentry))
632 DECLARE_EVENT_CLASS(nfs_rename_event_done
,
634 const struct inode
*old_dir
,
635 const struct dentry
*old_dentry
,
636 const struct inode
*new_dir
,
637 const struct dentry
*new_dentry
,
641 TP_ARGS(old_dir
, old_dentry
, new_dir
, new_dentry
, error
),
646 __field(u64
, old_dir
)
647 __string(old_name
, old_dentry
->d_name
.name
)
648 __field(u64
, new_dir
)
649 __string(new_name
, new_dentry
->d_name
.name
)
653 __entry
->dev
= old_dir
->i_sb
->s_dev
;
654 __entry
->old_dir
= NFS_FILEID(old_dir
);
655 __entry
->new_dir
= NFS_FILEID(new_dir
);
656 __entry
->error
= error
;
657 __assign_str(old_name
, old_dentry
->d_name
.name
);
658 __assign_str(new_name
, new_dentry
->d_name
.name
);
662 "error=%d old_name=%02x:%02x:%llu/%s "
663 "new_name=%02x:%02x:%llu/%s",
665 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
666 (unsigned long long)__entry
->old_dir
,
668 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
669 (unsigned long long)__entry
->new_dir
,
673 #define DEFINE_NFS_RENAME_EVENT_DONE(name) \
674 DEFINE_EVENT(nfs_rename_event_done, name, \
676 const struct inode *old_dir, \
677 const struct dentry *old_dentry, \
678 const struct inode *new_dir, \
679 const struct dentry *new_dentry, \
682 TP_ARGS(old_dir, old_dentry, new_dir, \
685 DEFINE_NFS_RENAME_EVENT(nfs_rename_enter
);
686 DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit
);
688 DEFINE_NFS_RENAME_EVENT_DONE(nfs_sillyrename_rename
);
690 TRACE_EVENT(nfs_sillyrename_unlink
,
692 const struct nfs_unlinkdata
*data
,
696 TP_ARGS(data
, error
),
702 __dynamic_array(char, name
, data
->args
.name
.len
+ 1)
706 struct inode
*dir
= d_inode(data
->dentry
->d_parent
);
707 size_t len
= data
->args
.name
.len
;
708 __entry
->dev
= dir
->i_sb
->s_dev
;
709 __entry
->dir
= NFS_FILEID(dir
);
710 __entry
->error
= error
;
711 memcpy(__get_str(name
),
712 data
->args
.name
.name
, len
);
713 __get_str(name
)[len
] = 0;
717 "error=%d name=%02x:%02x:%llu/%s",
719 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
720 (unsigned long long)__entry
->dir
,
725 TRACE_EVENT(nfs_initiate_read
,
727 const struct inode
*inode
,
728 loff_t offset
, unsigned long count
731 TP_ARGS(inode
, offset
, count
),
734 __field(loff_t
, offset
)
735 __field(unsigned long, count
)
737 __field(u32
, fhandle
)
742 const struct nfs_inode
*nfsi
= NFS_I(inode
);
744 __entry
->offset
= offset
;
745 __entry
->count
= count
;
746 __entry
->dev
= inode
->i_sb
->s_dev
;
747 __entry
->fileid
= nfsi
->fileid
;
748 __entry
->fhandle
= nfs_fhandle_hash(&nfsi
->fh
);
752 "fileid=%02x:%02x:%llu fhandle=0x%08x "
753 "offset=%lld count=%lu",
754 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
755 (unsigned long long)__entry
->fileid
,
757 __entry
->offset
, __entry
->count
761 TRACE_EVENT(nfs_readpage_done
,
763 const struct inode
*inode
,
764 int status
, loff_t offset
, bool eof
767 TP_ARGS(inode
, status
, offset
, eof
),
771 __field(loff_t
, offset
)
774 __field(u32
, fhandle
)
779 const struct nfs_inode
*nfsi
= NFS_I(inode
);
781 __entry
->status
= status
;
782 __entry
->offset
= offset
;
784 __entry
->dev
= inode
->i_sb
->s_dev
;
785 __entry
->fileid
= nfsi
->fileid
;
786 __entry
->fhandle
= nfs_fhandle_hash(&nfsi
->fh
);
790 "fileid=%02x:%02x:%llu fhandle=0x%08x "
791 "offset=%lld status=%d%s",
792 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
793 (unsigned long long)__entry
->fileid
,
795 __entry
->offset
, __entry
->status
,
796 __entry
->eof
? " eof" : ""
800 TRACE_DEFINE_ENUM(NFS_UNSTABLE
);
801 TRACE_DEFINE_ENUM(NFS_DATA_SYNC
);
802 TRACE_DEFINE_ENUM(NFS_FILE_SYNC
);
804 #define nfs_show_stable(stable) \
805 __print_symbolic(stable, \
806 { NFS_UNSTABLE, "UNSTABLE" }, \
807 { NFS_DATA_SYNC, "DATA_SYNC" }, \
808 { NFS_FILE_SYNC, "FILE_SYNC" })
810 TRACE_EVENT(nfs_initiate_write
,
812 const struct inode
*inode
,
813 loff_t offset
, unsigned long count
,
814 enum nfs3_stable_how stable
817 TP_ARGS(inode
, offset
, count
, stable
),
820 __field(loff_t
, offset
)
821 __field(unsigned long, count
)
822 __field(enum nfs3_stable_how
, stable
)
824 __field(u32
, fhandle
)
829 const struct nfs_inode
*nfsi
= NFS_I(inode
);
831 __entry
->offset
= offset
;
832 __entry
->count
= count
;
833 __entry
->stable
= stable
;
834 __entry
->dev
= inode
->i_sb
->s_dev
;
835 __entry
->fileid
= nfsi
->fileid
;
836 __entry
->fhandle
= nfs_fhandle_hash(&nfsi
->fh
);
840 "fileid=%02x:%02x:%llu fhandle=0x%08x "
841 "offset=%lld count=%lu stable=%s",
842 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
843 (unsigned long long)__entry
->fileid
,
845 __entry
->offset
, __entry
->count
,
846 nfs_show_stable(__entry
->stable
)
850 TRACE_EVENT(nfs_writeback_done
,
852 const struct inode
*inode
,
855 struct nfs_writeverf
*writeverf
858 TP_ARGS(inode
, status
, offset
, writeverf
),
862 __field(loff_t
, offset
)
863 __field(enum nfs3_stable_how
, stable
)
864 __field(unsigned long long, verifier
)
866 __field(u32
, fhandle
)
871 const struct nfs_inode
*nfsi
= NFS_I(inode
);
873 __entry
->status
= status
;
874 __entry
->offset
= offset
;
875 __entry
->stable
= writeverf
->committed
;
876 memcpy(&__entry
->verifier
, &writeverf
->verifier
,
877 sizeof(__entry
->verifier
));
878 __entry
->dev
= inode
->i_sb
->s_dev
;
879 __entry
->fileid
= nfsi
->fileid
;
880 __entry
->fhandle
= nfs_fhandle_hash(&nfsi
->fh
);
884 "fileid=%02x:%02x:%llu fhandle=0x%08x "
885 "offset=%lld status=%d stable=%s "
886 "verifier 0x%016llx",
887 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
888 (unsigned long long)__entry
->fileid
,
890 __entry
->offset
, __entry
->status
,
891 nfs_show_stable(__entry
->stable
),
896 TRACE_EVENT(nfs_initiate_commit
,
898 const struct nfs_commit_data
*data
904 __field(loff_t
, offset
)
905 __field(unsigned long, count
)
907 __field(u32
, fhandle
)
912 const struct inode
*inode
= data
->inode
;
913 const struct nfs_inode
*nfsi
= NFS_I(inode
);
915 __entry
->offset
= data
->args
.offset
;
916 __entry
->count
= data
->args
.count
;
917 __entry
->dev
= inode
->i_sb
->s_dev
;
918 __entry
->fileid
= nfsi
->fileid
;
919 __entry
->fhandle
= nfs_fhandle_hash(&nfsi
->fh
);
923 "fileid=%02x:%02x:%llu fhandle=0x%08x "
924 "offset=%lld count=%lu",
925 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
926 (unsigned long long)__entry
->fileid
,
928 __entry
->offset
, __entry
->count
932 TRACE_EVENT(nfs_commit_done
,
934 const struct nfs_commit_data
*data
941 __field(loff_t
, offset
)
942 __field(unsigned long long, verifier
)
944 __field(u32
, fhandle
)
949 const struct inode
*inode
= data
->inode
;
950 const struct nfs_inode
*nfsi
= NFS_I(inode
);
952 __entry
->status
= data
->res
.op_status
;
953 __entry
->offset
= data
->args
.offset
;
954 memcpy(&__entry
->verifier
, &data
->verf
.verifier
,
955 sizeof(__entry
->verifier
));
956 __entry
->dev
= inode
->i_sb
->s_dev
;
957 __entry
->fileid
= nfsi
->fileid
;
958 __entry
->fhandle
= nfs_fhandle_hash(&nfsi
->fh
);
962 "fileid=%02x:%02x:%llu fhandle=0x%08x "
963 "offset=%lld status=%d verifier 0x%016llx",
964 MAJOR(__entry
->dev
), MINOR(__entry
->dev
),
965 (unsigned long long)__entry
->fileid
,
967 __entry
->offset
, __entry
->status
,
972 #endif /* _TRACE_NFS_H */
974 #undef TRACE_INCLUDE_PATH
975 #define TRACE_INCLUDE_PATH .
976 #define TRACE_INCLUDE_FILE nfstrace
977 /* This part must be outside protection */
978 #include <trace/define_trace.h>