xref: /linux/fs/nfs/nfstrace.h (revision 5bb2a7cb9fe58d2b1efedd6058d442c7871c45ec)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2f4ce1299STrond Myklebust /*
3f4ce1299STrond Myklebust  * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
4f4ce1299STrond Myklebust  */
5f4ce1299STrond Myklebust #undef TRACE_SYSTEM
6f4ce1299STrond Myklebust #define TRACE_SYSTEM nfs
7f4ce1299STrond Myklebust 
8f4ce1299STrond Myklebust #if !defined(_TRACE_NFS_H) || defined(TRACE_HEADER_MULTI_READ)
9f4ce1299STrond Myklebust #define _TRACE_NFS_H
10f4ce1299STrond Myklebust 
11f4ce1299STrond Myklebust #include <linux/tracepoint.h>
121eb5d98fSJeff Layton #include <linux/iversion.h>
13f4ce1299STrond Myklebust 
147d4006c1SChuck Lever TRACE_DEFINE_ENUM(DT_UNKNOWN);
157d4006c1SChuck Lever TRACE_DEFINE_ENUM(DT_FIFO);
167d4006c1SChuck Lever TRACE_DEFINE_ENUM(DT_CHR);
177d4006c1SChuck Lever TRACE_DEFINE_ENUM(DT_DIR);
187d4006c1SChuck Lever TRACE_DEFINE_ENUM(DT_BLK);
197d4006c1SChuck Lever TRACE_DEFINE_ENUM(DT_REG);
207d4006c1SChuck Lever TRACE_DEFINE_ENUM(DT_LNK);
217d4006c1SChuck Lever TRACE_DEFINE_ENUM(DT_SOCK);
227d4006c1SChuck Lever TRACE_DEFINE_ENUM(DT_WHT);
237d4006c1SChuck Lever 
24f4ce1299STrond Myklebust #define nfs_show_file_type(ftype) \
25f4ce1299STrond Myklebust 	__print_symbolic(ftype, \
26f4ce1299STrond Myklebust 			{ DT_UNKNOWN, "UNKNOWN" }, \
27f4ce1299STrond Myklebust 			{ DT_FIFO, "FIFO" }, \
28f4ce1299STrond Myklebust 			{ DT_CHR, "CHR" }, \
29f4ce1299STrond Myklebust 			{ DT_DIR, "DIR" }, \
30f4ce1299STrond Myklebust 			{ DT_BLK, "BLK" }, \
31f4ce1299STrond Myklebust 			{ DT_REG, "REG" }, \
32f4ce1299STrond Myklebust 			{ DT_LNK, "LNK" }, \
33f4ce1299STrond Myklebust 			{ DT_SOCK, "SOCK" }, \
34f4ce1299STrond Myklebust 			{ DT_WHT, "WHT" })
35f4ce1299STrond Myklebust 
367d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_INVALID_DATA);
377d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_INVALID_ATIME);
387d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_INVALID_ACCESS);
397d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_INVALID_ACL);
407d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_REVAL_PAGECACHE);
417d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_REVAL_FORCED);
427d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_INVALID_LABEL);
437d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_INVALID_CHANGE);
447d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_INVALID_CTIME);
457d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_INVALID_MTIME);
467d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_INVALID_SIZE);
477d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_INVALID_OTHER);
487d4006c1SChuck Lever 
49f4ce1299STrond Myklebust #define nfs_show_cache_validity(v) \
50f4ce1299STrond Myklebust 	__print_flags(v, "|", \
51f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
52f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
53f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
54f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
55f4ce1299STrond Myklebust 			{ NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \
56f4ce1299STrond Myklebust 			{ NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
577d4006c1SChuck Lever 			{ NFS_INO_INVALID_LABEL, "INVALID_LABEL" }, \
587d4006c1SChuck Lever 			{ NFS_INO_INVALID_CHANGE, "INVALID_CHANGE" }, \
597d4006c1SChuck Lever 			{ NFS_INO_INVALID_CTIME, "INVALID_CTIME" }, \
607d4006c1SChuck Lever 			{ NFS_INO_INVALID_MTIME, "INVALID_MTIME" }, \
617d4006c1SChuck Lever 			{ NFS_INO_INVALID_SIZE, "INVALID_SIZE" }, \
627d4006c1SChuck Lever 			{ NFS_INO_INVALID_OTHER, "INVALID_OTHER" })
637d4006c1SChuck Lever 
647d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_ADVISE_RDPLUS);
657d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_STALE);
667d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_ACL_LRU_SET);
677d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_INVALIDATING);
687d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_FSCACHE);
697d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_FSCACHE_LOCK);
707d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_LAYOUTCOMMIT);
717d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_LAYOUTCOMMITTING);
727d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_LAYOUTSTATS);
737d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_ODIRECT);
74f4ce1299STrond Myklebust 
75f4ce1299STrond Myklebust #define nfs_show_nfsi_flags(v) \
76f4ce1299STrond Myklebust 	__print_flags(v, "|", \
777d4006c1SChuck Lever 			{ BIT(NFS_INO_ADVISE_RDPLUS), "ADVISE_RDPLUS" }, \
787d4006c1SChuck Lever 			{ BIT(NFS_INO_STALE), "STALE" }, \
797d4006c1SChuck Lever 			{ BIT(NFS_INO_ACL_LRU_SET), "ACL_LRU_SET" }, \
807d4006c1SChuck Lever 			{ BIT(NFS_INO_INVALIDATING), "INVALIDATING" }, \
817d4006c1SChuck Lever 			{ BIT(NFS_INO_FSCACHE), "FSCACHE" }, \
827d4006c1SChuck Lever 			{ BIT(NFS_INO_FSCACHE_LOCK), "FSCACHE_LOCK" }, \
837d4006c1SChuck Lever 			{ BIT(NFS_INO_LAYOUTCOMMIT), "NEED_LAYOUTCOMMIT" }, \
847d4006c1SChuck Lever 			{ BIT(NFS_INO_LAYOUTCOMMITTING), "LAYOUTCOMMIT" }, \
857d4006c1SChuck Lever 			{ BIT(NFS_INO_LAYOUTSTATS), "LAYOUTSTATS" }, \
867d4006c1SChuck Lever 			{ BIT(NFS_INO_ODIRECT), "ODIRECT" })
87f4ce1299STrond Myklebust 
88f4ce1299STrond Myklebust DECLARE_EVENT_CLASS(nfs_inode_event,
89f4ce1299STrond Myklebust 		TP_PROTO(
90f4ce1299STrond Myklebust 			const struct inode *inode
91f4ce1299STrond Myklebust 		),
92f4ce1299STrond Myklebust 
93f4ce1299STrond Myklebust 		TP_ARGS(inode),
94f4ce1299STrond Myklebust 
95f4ce1299STrond Myklebust 		TP_STRUCT__entry(
96f4ce1299STrond Myklebust 			__field(dev_t, dev)
97f4ce1299STrond Myklebust 			__field(u32, fhandle)
98f4ce1299STrond Myklebust 			__field(u64, fileid)
99f4ce1299STrond Myklebust 			__field(u64, version)
100f4ce1299STrond Myklebust 		),
101f4ce1299STrond Myklebust 
102f4ce1299STrond Myklebust 		TP_fast_assign(
103f4ce1299STrond Myklebust 			const struct nfs_inode *nfsi = NFS_I(inode);
104f4ce1299STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
105f4ce1299STrond Myklebust 			__entry->fileid = nfsi->fileid;
106f4ce1299STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1071eb5d98fSJeff Layton 			__entry->version = inode_peek_iversion_raw(inode);
108f4ce1299STrond Myklebust 		),
109f4ce1299STrond Myklebust 
110f4ce1299STrond Myklebust 		TP_printk(
111f4ce1299STrond Myklebust 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
112f4ce1299STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
113f4ce1299STrond Myklebust 			(unsigned long long)__entry->fileid,
114f4ce1299STrond Myklebust 			__entry->fhandle,
115f4ce1299STrond Myklebust 			(unsigned long long)__entry->version
116f4ce1299STrond Myklebust 		)
117f4ce1299STrond Myklebust );
118f4ce1299STrond Myklebust 
119f4ce1299STrond Myklebust DECLARE_EVENT_CLASS(nfs_inode_event_done,
120f4ce1299STrond Myklebust 		TP_PROTO(
121f4ce1299STrond Myklebust 			const struct inode *inode,
122f4ce1299STrond Myklebust 			int error
123f4ce1299STrond Myklebust 		),
124f4ce1299STrond Myklebust 
125f4ce1299STrond Myklebust 		TP_ARGS(inode, error),
126f4ce1299STrond Myklebust 
127f4ce1299STrond Myklebust 		TP_STRUCT__entry(
12838a638a7SChuck Lever 			__field(unsigned long, error)
129f4ce1299STrond Myklebust 			__field(dev_t, dev)
130f4ce1299STrond Myklebust 			__field(u32, fhandle)
131f4ce1299STrond Myklebust 			__field(unsigned char, type)
132f4ce1299STrond Myklebust 			__field(u64, fileid)
133f4ce1299STrond Myklebust 			__field(u64, version)
134f4ce1299STrond Myklebust 			__field(loff_t, size)
135f4ce1299STrond Myklebust 			__field(unsigned long, nfsi_flags)
136f4ce1299STrond Myklebust 			__field(unsigned long, cache_validity)
137f4ce1299STrond Myklebust 		),
138f4ce1299STrond Myklebust 
139f4ce1299STrond Myklebust 		TP_fast_assign(
140f4ce1299STrond Myklebust 			const struct nfs_inode *nfsi = NFS_I(inode);
14138a638a7SChuck Lever 			__entry->error = error < 0 ? -error : 0;
142f4ce1299STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
143f4ce1299STrond Myklebust 			__entry->fileid = nfsi->fileid;
144f4ce1299STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
145f4ce1299STrond Myklebust 			__entry->type = nfs_umode_to_dtype(inode->i_mode);
1461eb5d98fSJeff Layton 			__entry->version = inode_peek_iversion_raw(inode);
147f4ce1299STrond Myklebust 			__entry->size = i_size_read(inode);
148f4ce1299STrond Myklebust 			__entry->nfsi_flags = nfsi->flags;
149f4ce1299STrond Myklebust 			__entry->cache_validity = nfsi->cache_validity;
150f4ce1299STrond Myklebust 		),
151f4ce1299STrond Myklebust 
152f4ce1299STrond Myklebust 		TP_printk(
15338a638a7SChuck Lever 			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
154f4ce1299STrond Myklebust 			"type=%u (%s) version=%llu size=%lld "
1557d4006c1SChuck Lever 			"cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s)",
15638a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
157f4ce1299STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
158f4ce1299STrond Myklebust 			(unsigned long long)__entry->fileid,
159f4ce1299STrond Myklebust 			__entry->fhandle,
160f4ce1299STrond Myklebust 			__entry->type,
161f4ce1299STrond Myklebust 			nfs_show_file_type(__entry->type),
162f4ce1299STrond Myklebust 			(unsigned long long)__entry->version,
163f4ce1299STrond Myklebust 			(long long)__entry->size,
164f4ce1299STrond Myklebust 			__entry->cache_validity,
165f4ce1299STrond Myklebust 			nfs_show_cache_validity(__entry->cache_validity),
166f4ce1299STrond Myklebust 			__entry->nfsi_flags,
167f4ce1299STrond Myklebust 			nfs_show_nfsi_flags(__entry->nfsi_flags)
168f4ce1299STrond Myklebust 		)
169f4ce1299STrond Myklebust );
170f4ce1299STrond Myklebust 
171f4ce1299STrond Myklebust #define DEFINE_NFS_INODE_EVENT(name) \
172f4ce1299STrond Myklebust 	DEFINE_EVENT(nfs_inode_event, name, \
173f4ce1299STrond Myklebust 			TP_PROTO( \
174f4ce1299STrond Myklebust 				const struct inode *inode \
175f4ce1299STrond Myklebust 			), \
176f4ce1299STrond Myklebust 			TP_ARGS(inode))
177f4ce1299STrond Myklebust #define DEFINE_NFS_INODE_EVENT_DONE(name) \
178f4ce1299STrond Myklebust 	DEFINE_EVENT(nfs_inode_event_done, name, \
179f4ce1299STrond Myklebust 			TP_PROTO( \
180f4ce1299STrond Myklebust 				const struct inode *inode, \
181f4ce1299STrond Myklebust 				int error \
182f4ce1299STrond Myklebust 			), \
183f4ce1299STrond Myklebust 			TP_ARGS(inode, error))
184f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter);
185f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit);
186f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter);
187f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit);
188f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter);
189f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit);
190f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_getattr_enter);
191f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit);
192f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_setattr_enter);
193f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit);
194f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_writeback_page_enter);
195f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_page_exit);
196f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter);
197f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit);
198f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_fsync_enter);
199f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
200f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_access_enter);
201f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_access_exit);
202f4ce1299STrond Myklebust 
2037d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_FOLLOW);
2047d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_DIRECTORY);
2057d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_AUTOMOUNT);
2067d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_PARENT);
2077d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_REVAL);
2087d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_RCU);
2097d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_NO_REVAL);
2107d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_OPEN);
2117d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_CREATE);
2127d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_EXCL);
2137d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_RENAME_TARGET);
2147d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_JUMPED);
2157d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_ROOT);
2167d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_EMPTY);
2177d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_DOWN);
2187d4006c1SChuck Lever 
2196e0d0be7STrond Myklebust #define show_lookup_flags(flags) \
2207d4006c1SChuck Lever 	__print_flags(flags, "|", \
2217d4006c1SChuck Lever 			{ LOOKUP_FOLLOW, "FOLLOW" }, \
2226e0d0be7STrond Myklebust 			{ LOOKUP_DIRECTORY, "DIRECTORY" }, \
2237d4006c1SChuck Lever 			{ LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \
2247d4006c1SChuck Lever 			{ LOOKUP_PARENT, "PARENT" }, \
2257d4006c1SChuck Lever 			{ LOOKUP_REVAL, "REVAL" }, \
2267d4006c1SChuck Lever 			{ LOOKUP_RCU, "RCU" }, \
2277d4006c1SChuck Lever 			{ LOOKUP_NO_REVAL, "NO_REVAL" }, \
2286e0d0be7STrond Myklebust 			{ LOOKUP_OPEN, "OPEN" }, \
2296e0d0be7STrond Myklebust 			{ LOOKUP_CREATE, "CREATE" }, \
2307d4006c1SChuck Lever 			{ LOOKUP_EXCL, "EXCL" }, \
2317d4006c1SChuck Lever 			{ LOOKUP_RENAME_TARGET, "RENAME_TARGET" }, \
2327d4006c1SChuck Lever 			{ LOOKUP_JUMPED, "JUMPED" }, \
2337d4006c1SChuck Lever 			{ LOOKUP_ROOT, "ROOT" }, \
2347d4006c1SChuck Lever 			{ LOOKUP_EMPTY, "EMPTY" }, \
2357d4006c1SChuck Lever 			{ LOOKUP_DOWN, "DOWN" })
2366e0d0be7STrond Myklebust 
2376e0d0be7STrond Myklebust DECLARE_EVENT_CLASS(nfs_lookup_event,
2386e0d0be7STrond Myklebust 		TP_PROTO(
2396e0d0be7STrond Myklebust 			const struct inode *dir,
2406e0d0be7STrond Myklebust 			const struct dentry *dentry,
2416e0d0be7STrond Myklebust 			unsigned int flags
2426e0d0be7STrond Myklebust 		),
2436e0d0be7STrond Myklebust 
2446e0d0be7STrond Myklebust 		TP_ARGS(dir, dentry, flags),
2456e0d0be7STrond Myklebust 
2466e0d0be7STrond Myklebust 		TP_STRUCT__entry(
2477d4006c1SChuck Lever 			__field(unsigned long, flags)
2486e0d0be7STrond Myklebust 			__field(dev_t, dev)
2496e0d0be7STrond Myklebust 			__field(u64, dir)
2506e0d0be7STrond Myklebust 			__string(name, dentry->d_name.name)
2516e0d0be7STrond Myklebust 		),
2526e0d0be7STrond Myklebust 
2536e0d0be7STrond Myklebust 		TP_fast_assign(
2546e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
2556e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
2566e0d0be7STrond Myklebust 			__entry->flags = flags;
2576e0d0be7STrond Myklebust 			__assign_str(name, dentry->d_name.name);
2586e0d0be7STrond Myklebust 		),
2596e0d0be7STrond Myklebust 
2606e0d0be7STrond Myklebust 		TP_printk(
2617d4006c1SChuck Lever 			"flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
2626e0d0be7STrond Myklebust 			__entry->flags,
2636e0d0be7STrond Myklebust 			show_lookup_flags(__entry->flags),
2646e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
2656e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
2666e0d0be7STrond Myklebust 			__get_str(name)
2676e0d0be7STrond Myklebust 		)
2686e0d0be7STrond Myklebust );
2696e0d0be7STrond Myklebust 
2706e0d0be7STrond Myklebust #define DEFINE_NFS_LOOKUP_EVENT(name) \
2716e0d0be7STrond Myklebust 	DEFINE_EVENT(nfs_lookup_event, name, \
2726e0d0be7STrond Myklebust 			TP_PROTO( \
2736e0d0be7STrond Myklebust 				const struct inode *dir, \
2746e0d0be7STrond Myklebust 				const struct dentry *dentry, \
2756e0d0be7STrond Myklebust 				unsigned int flags \
2766e0d0be7STrond Myklebust 			), \
2776e0d0be7STrond Myklebust 			TP_ARGS(dir, dentry, flags))
2786e0d0be7STrond Myklebust 
2796e0d0be7STrond Myklebust DECLARE_EVENT_CLASS(nfs_lookup_event_done,
2806e0d0be7STrond Myklebust 		TP_PROTO(
2816e0d0be7STrond Myklebust 			const struct inode *dir,
2826e0d0be7STrond Myklebust 			const struct dentry *dentry,
2836e0d0be7STrond Myklebust 			unsigned int flags,
2846e0d0be7STrond Myklebust 			int error
2856e0d0be7STrond Myklebust 		),
2866e0d0be7STrond Myklebust 
2876e0d0be7STrond Myklebust 		TP_ARGS(dir, dentry, flags, error),
2886e0d0be7STrond Myklebust 
2896e0d0be7STrond Myklebust 		TP_STRUCT__entry(
29038a638a7SChuck Lever 			__field(unsigned long, error)
2917d4006c1SChuck Lever 			__field(unsigned long, flags)
2926e0d0be7STrond Myklebust 			__field(dev_t, dev)
2936e0d0be7STrond Myklebust 			__field(u64, dir)
2946e0d0be7STrond Myklebust 			__string(name, dentry->d_name.name)
2956e0d0be7STrond Myklebust 		),
2966e0d0be7STrond Myklebust 
2976e0d0be7STrond Myklebust 		TP_fast_assign(
2986e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
2996e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
30038a638a7SChuck Lever 			__entry->error = error < 0 ? -error : 0;
3016e0d0be7STrond Myklebust 			__entry->flags = flags;
3026e0d0be7STrond Myklebust 			__assign_str(name, dentry->d_name.name);
3036e0d0be7STrond Myklebust 		),
3046e0d0be7STrond Myklebust 
3056e0d0be7STrond Myklebust 		TP_printk(
3067d4006c1SChuck Lever 			"error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
30738a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
3086e0d0be7STrond Myklebust 			__entry->flags,
3096e0d0be7STrond Myklebust 			show_lookup_flags(__entry->flags),
3106e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
3116e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
3126e0d0be7STrond Myklebust 			__get_str(name)
3136e0d0be7STrond Myklebust 		)
3146e0d0be7STrond Myklebust );
3156e0d0be7STrond Myklebust 
3166e0d0be7STrond Myklebust #define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \
3176e0d0be7STrond Myklebust 	DEFINE_EVENT(nfs_lookup_event_done, name, \
3186e0d0be7STrond Myklebust 			TP_PROTO( \
3196e0d0be7STrond Myklebust 				const struct inode *dir, \
3206e0d0be7STrond Myklebust 				const struct dentry *dentry, \
3216e0d0be7STrond Myklebust 				unsigned int flags, \
3226e0d0be7STrond Myklebust 				int error \
3236e0d0be7STrond Myklebust 			), \
3246e0d0be7STrond Myklebust 			TP_ARGS(dir, dentry, flags, error))
3256e0d0be7STrond Myklebust 
3266e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter);
3276e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
3286e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
3296e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
3306e0d0be7STrond Myklebust 
3317d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_WRONLY);
3327d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_RDWR);
3337d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_CREAT);
3347d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_EXCL);
3357d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_NOCTTY);
3367d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_TRUNC);
3377d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_APPEND);
3387d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_NONBLOCK);
3397d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_DSYNC);
3407d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_DIRECT);
3417d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_LARGEFILE);
3427d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_DIRECTORY);
3437d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_NOFOLLOW);
3447d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_NOATIME);
3457d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_CLOEXEC);
3467d4006c1SChuck Lever 
3476e0d0be7STrond Myklebust #define show_open_flags(flags) \
3487d4006c1SChuck Lever 	__print_flags(flags, "|", \
3497d4006c1SChuck Lever 		{ O_WRONLY, "O_WRONLY" }, \
3507d4006c1SChuck Lever 		{ O_RDWR, "O_RDWR" }, \
3516e0d0be7STrond Myklebust 		{ O_CREAT, "O_CREAT" }, \
3526e0d0be7STrond Myklebust 		{ O_EXCL, "O_EXCL" }, \
3537d4006c1SChuck Lever 		{ O_NOCTTY, "O_NOCTTY" }, \
3546e0d0be7STrond Myklebust 		{ O_TRUNC, "O_TRUNC" }, \
3556e0d0be7STrond Myklebust 		{ O_APPEND, "O_APPEND" }, \
3567d4006c1SChuck Lever 		{ O_NONBLOCK, "O_NONBLOCK" }, \
3576e0d0be7STrond Myklebust 		{ O_DSYNC, "O_DSYNC" }, \
3586e0d0be7STrond Myklebust 		{ O_DIRECT, "O_DIRECT" }, \
3597d4006c1SChuck Lever 		{ O_LARGEFILE, "O_LARGEFILE" }, \
3607d4006c1SChuck Lever 		{ O_DIRECTORY, "O_DIRECTORY" }, \
3617d4006c1SChuck Lever 		{ O_NOFOLLOW, "O_NOFOLLOW" }, \
3627d4006c1SChuck Lever 		{ O_NOATIME, "O_NOATIME" }, \
3637d4006c1SChuck Lever 		{ O_CLOEXEC, "O_CLOEXEC" })
3647d4006c1SChuck Lever 
3657d4006c1SChuck Lever TRACE_DEFINE_ENUM(FMODE_READ);
3667d4006c1SChuck Lever TRACE_DEFINE_ENUM(FMODE_WRITE);
3677d4006c1SChuck Lever TRACE_DEFINE_ENUM(FMODE_EXEC);
3686e0d0be7STrond Myklebust 
3696e0d0be7STrond Myklebust #define show_fmode_flags(mode) \
3706e0d0be7STrond Myklebust 	__print_flags(mode, "|", \
3716e0d0be7STrond Myklebust 		{ ((__force unsigned long)FMODE_READ), "READ" }, \
3726e0d0be7STrond Myklebust 		{ ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
3736e0d0be7STrond Myklebust 		{ ((__force unsigned long)FMODE_EXEC), "EXEC" })
3746e0d0be7STrond Myklebust 
3756e0d0be7STrond Myklebust TRACE_EVENT(nfs_atomic_open_enter,
3766e0d0be7STrond Myklebust 		TP_PROTO(
3776e0d0be7STrond Myklebust 			const struct inode *dir,
3786e0d0be7STrond Myklebust 			const struct nfs_open_context *ctx,
3796e0d0be7STrond Myklebust 			unsigned int flags
3806e0d0be7STrond Myklebust 		),
3816e0d0be7STrond Myklebust 
3826e0d0be7STrond Myklebust 		TP_ARGS(dir, ctx, flags),
3836e0d0be7STrond Myklebust 
3846e0d0be7STrond Myklebust 		TP_STRUCT__entry(
3857d4006c1SChuck Lever 			__field(unsigned long, flags)
3866e0d0be7STrond Myklebust 			__field(unsigned int, fmode)
3876e0d0be7STrond Myklebust 			__field(dev_t, dev)
3886e0d0be7STrond Myklebust 			__field(u64, dir)
3896e0d0be7STrond Myklebust 			__string(name, ctx->dentry->d_name.name)
3906e0d0be7STrond Myklebust 		),
3916e0d0be7STrond Myklebust 
3926e0d0be7STrond Myklebust 		TP_fast_assign(
3936e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
3946e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
3956e0d0be7STrond Myklebust 			__entry->flags = flags;
3966e0d0be7STrond Myklebust 			__entry->fmode = (__force unsigned int)ctx->mode;
3976e0d0be7STrond Myklebust 			__assign_str(name, ctx->dentry->d_name.name);
3986e0d0be7STrond Myklebust 		),
3996e0d0be7STrond Myklebust 
4006e0d0be7STrond Myklebust 		TP_printk(
4017d4006c1SChuck Lever 			"flags=0x%lx (%s) fmode=%s name=%02x:%02x:%llu/%s",
4026e0d0be7STrond Myklebust 			__entry->flags,
4036e0d0be7STrond Myklebust 			show_open_flags(__entry->flags),
4046e0d0be7STrond Myklebust 			show_fmode_flags(__entry->fmode),
4056e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
4066e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
4076e0d0be7STrond Myklebust 			__get_str(name)
4086e0d0be7STrond Myklebust 		)
4096e0d0be7STrond Myklebust );
4106e0d0be7STrond Myklebust 
4116e0d0be7STrond Myklebust TRACE_EVENT(nfs_atomic_open_exit,
4126e0d0be7STrond Myklebust 		TP_PROTO(
4136e0d0be7STrond Myklebust 			const struct inode *dir,
4146e0d0be7STrond Myklebust 			const struct nfs_open_context *ctx,
4156e0d0be7STrond Myklebust 			unsigned int flags,
4166e0d0be7STrond Myklebust 			int error
4176e0d0be7STrond Myklebust 		),
4186e0d0be7STrond Myklebust 
4196e0d0be7STrond Myklebust 		TP_ARGS(dir, ctx, flags, error),
4206e0d0be7STrond Myklebust 
4216e0d0be7STrond Myklebust 		TP_STRUCT__entry(
42238a638a7SChuck Lever 			__field(unsigned long, error)
4237d4006c1SChuck Lever 			__field(unsigned long, flags)
4246e0d0be7STrond Myklebust 			__field(unsigned int, fmode)
4256e0d0be7STrond Myklebust 			__field(dev_t, dev)
4266e0d0be7STrond Myklebust 			__field(u64, dir)
4276e0d0be7STrond Myklebust 			__string(name, ctx->dentry->d_name.name)
4286e0d0be7STrond Myklebust 		),
4296e0d0be7STrond Myklebust 
4306e0d0be7STrond Myklebust 		TP_fast_assign(
43138a638a7SChuck Lever 			__entry->error = -error;
4326e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
4336e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
4346e0d0be7STrond Myklebust 			__entry->flags = flags;
4356e0d0be7STrond Myklebust 			__entry->fmode = (__force unsigned int)ctx->mode;
4366e0d0be7STrond Myklebust 			__assign_str(name, ctx->dentry->d_name.name);
4376e0d0be7STrond Myklebust 		),
4386e0d0be7STrond Myklebust 
4396e0d0be7STrond Myklebust 		TP_printk(
4407d4006c1SChuck Lever 			"error=%ld (%s) flags=0x%lx (%s) fmode=%s "
4416e0d0be7STrond Myklebust 			"name=%02x:%02x:%llu/%s",
44238a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
4436e0d0be7STrond Myklebust 			__entry->flags,
4446e0d0be7STrond Myklebust 			show_open_flags(__entry->flags),
4456e0d0be7STrond Myklebust 			show_fmode_flags(__entry->fmode),
4466e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
4476e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
4486e0d0be7STrond Myklebust 			__get_str(name)
4496e0d0be7STrond Myklebust 		)
4506e0d0be7STrond Myklebust );
4516e0d0be7STrond Myklebust 
4528b0ad3d4STrond Myklebust TRACE_EVENT(nfs_create_enter,
4538b0ad3d4STrond Myklebust 		TP_PROTO(
4548b0ad3d4STrond Myklebust 			const struct inode *dir,
4558b0ad3d4STrond Myklebust 			const struct dentry *dentry,
4568b0ad3d4STrond Myklebust 			unsigned int flags
4578b0ad3d4STrond Myklebust 		),
4588b0ad3d4STrond Myklebust 
4598b0ad3d4STrond Myklebust 		TP_ARGS(dir, dentry, flags),
4608b0ad3d4STrond Myklebust 
4618b0ad3d4STrond Myklebust 		TP_STRUCT__entry(
4627d4006c1SChuck Lever 			__field(unsigned long, flags)
4638b0ad3d4STrond Myklebust 			__field(dev_t, dev)
4648b0ad3d4STrond Myklebust 			__field(u64, dir)
4658b0ad3d4STrond Myklebust 			__string(name, dentry->d_name.name)
4668b0ad3d4STrond Myklebust 		),
4678b0ad3d4STrond Myklebust 
4688b0ad3d4STrond Myklebust 		TP_fast_assign(
4698b0ad3d4STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
4708b0ad3d4STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
4718b0ad3d4STrond Myklebust 			__entry->flags = flags;
4728b0ad3d4STrond Myklebust 			__assign_str(name, dentry->d_name.name);
4738b0ad3d4STrond Myklebust 		),
4748b0ad3d4STrond Myklebust 
4758b0ad3d4STrond Myklebust 		TP_printk(
4767d4006c1SChuck Lever 			"flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
4778b0ad3d4STrond Myklebust 			__entry->flags,
4788b0ad3d4STrond Myklebust 			show_open_flags(__entry->flags),
4798b0ad3d4STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
4808b0ad3d4STrond Myklebust 			(unsigned long long)__entry->dir,
4818b0ad3d4STrond Myklebust 			__get_str(name)
4828b0ad3d4STrond Myklebust 		)
4838b0ad3d4STrond Myklebust );
4848b0ad3d4STrond Myklebust 
4858b0ad3d4STrond Myklebust TRACE_EVENT(nfs_create_exit,
4868b0ad3d4STrond Myklebust 		TP_PROTO(
4878b0ad3d4STrond Myklebust 			const struct inode *dir,
4888b0ad3d4STrond Myklebust 			const struct dentry *dentry,
4898b0ad3d4STrond Myklebust 			unsigned int flags,
4908b0ad3d4STrond Myklebust 			int error
4918b0ad3d4STrond Myklebust 		),
4928b0ad3d4STrond Myklebust 
4938b0ad3d4STrond Myklebust 		TP_ARGS(dir, dentry, flags, error),
4948b0ad3d4STrond Myklebust 
4958b0ad3d4STrond Myklebust 		TP_STRUCT__entry(
49638a638a7SChuck Lever 			__field(unsigned long, error)
4977d4006c1SChuck Lever 			__field(unsigned long, flags)
4988b0ad3d4STrond Myklebust 			__field(dev_t, dev)
4998b0ad3d4STrond Myklebust 			__field(u64, dir)
5008b0ad3d4STrond Myklebust 			__string(name, dentry->d_name.name)
5018b0ad3d4STrond Myklebust 		),
5028b0ad3d4STrond Myklebust 
5038b0ad3d4STrond Myklebust 		TP_fast_assign(
50438a638a7SChuck Lever 			__entry->error = -error;
5058b0ad3d4STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
5068b0ad3d4STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
5078b0ad3d4STrond Myklebust 			__entry->flags = flags;
5088b0ad3d4STrond Myklebust 			__assign_str(name, dentry->d_name.name);
5098b0ad3d4STrond Myklebust 		),
5108b0ad3d4STrond Myklebust 
5118b0ad3d4STrond Myklebust 		TP_printk(
5127d4006c1SChuck Lever 			"error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
51338a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
5148b0ad3d4STrond Myklebust 			__entry->flags,
5158b0ad3d4STrond Myklebust 			show_open_flags(__entry->flags),
5168b0ad3d4STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
5178b0ad3d4STrond Myklebust 			(unsigned long long)__entry->dir,
5188b0ad3d4STrond Myklebust 			__get_str(name)
5198b0ad3d4STrond Myklebust 		)
5208b0ad3d4STrond Myklebust );
5218b0ad3d4STrond Myklebust 
5221ca42382STrond Myklebust DECLARE_EVENT_CLASS(nfs_directory_event,
5231ca42382STrond Myklebust 		TP_PROTO(
5241ca42382STrond Myklebust 			const struct inode *dir,
5251ca42382STrond Myklebust 			const struct dentry *dentry
5261ca42382STrond Myklebust 		),
5271ca42382STrond Myklebust 
5281ca42382STrond Myklebust 		TP_ARGS(dir, dentry),
5291ca42382STrond Myklebust 
5301ca42382STrond Myklebust 		TP_STRUCT__entry(
5311ca42382STrond Myklebust 			__field(dev_t, dev)
5321ca42382STrond Myklebust 			__field(u64, dir)
5331ca42382STrond Myklebust 			__string(name, dentry->d_name.name)
5341ca42382STrond Myklebust 		),
5351ca42382STrond Myklebust 
5361ca42382STrond Myklebust 		TP_fast_assign(
5371ca42382STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
5381ca42382STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
5391ca42382STrond Myklebust 			__assign_str(name, dentry->d_name.name);
5401ca42382STrond Myklebust 		),
5411ca42382STrond Myklebust 
5421ca42382STrond Myklebust 		TP_printk(
5431ca42382STrond Myklebust 			"name=%02x:%02x:%llu/%s",
5441ca42382STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
5451ca42382STrond Myklebust 			(unsigned long long)__entry->dir,
5461ca42382STrond Myklebust 			__get_str(name)
5471ca42382STrond Myklebust 		)
5481ca42382STrond Myklebust );
5491ca42382STrond Myklebust 
5501ca42382STrond Myklebust #define DEFINE_NFS_DIRECTORY_EVENT(name) \
5511ca42382STrond Myklebust 	DEFINE_EVENT(nfs_directory_event, name, \
5521ca42382STrond Myklebust 			TP_PROTO( \
5531ca42382STrond Myklebust 				const struct inode *dir, \
5541ca42382STrond Myklebust 				const struct dentry *dentry \
5551ca42382STrond Myklebust 			), \
5561ca42382STrond Myklebust 			TP_ARGS(dir, dentry))
5571ca42382STrond Myklebust 
5581ca42382STrond Myklebust DECLARE_EVENT_CLASS(nfs_directory_event_done,
5591ca42382STrond Myklebust 		TP_PROTO(
5601ca42382STrond Myklebust 			const struct inode *dir,
5611ca42382STrond Myklebust 			const struct dentry *dentry,
5621ca42382STrond Myklebust 			int error
5631ca42382STrond Myklebust 		),
5641ca42382STrond Myklebust 
5651ca42382STrond Myklebust 		TP_ARGS(dir, dentry, error),
5661ca42382STrond Myklebust 
5671ca42382STrond Myklebust 		TP_STRUCT__entry(
56838a638a7SChuck Lever 			__field(unsigned long, error)
5691ca42382STrond Myklebust 			__field(dev_t, dev)
5701ca42382STrond Myklebust 			__field(u64, dir)
5711ca42382STrond Myklebust 			__string(name, dentry->d_name.name)
5721ca42382STrond Myklebust 		),
5731ca42382STrond Myklebust 
5741ca42382STrond Myklebust 		TP_fast_assign(
5751ca42382STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
5761ca42382STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
57738a638a7SChuck Lever 			__entry->error = error < 0 ? -error : 0;
5781ca42382STrond Myklebust 			__assign_str(name, dentry->d_name.name);
5791ca42382STrond Myklebust 		),
5801ca42382STrond Myklebust 
5811ca42382STrond Myklebust 		TP_printk(
58238a638a7SChuck Lever 			"error=%ld (%s) name=%02x:%02x:%llu/%s",
58338a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
5841ca42382STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
5851ca42382STrond Myklebust 			(unsigned long long)__entry->dir,
5861ca42382STrond Myklebust 			__get_str(name)
5871ca42382STrond Myklebust 		)
5881ca42382STrond Myklebust );
5891ca42382STrond Myklebust 
5901ca42382STrond Myklebust #define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \
5911ca42382STrond Myklebust 	DEFINE_EVENT(nfs_directory_event_done, name, \
5921ca42382STrond Myklebust 			TP_PROTO( \
5931ca42382STrond Myklebust 				const struct inode *dir, \
5941ca42382STrond Myklebust 				const struct dentry *dentry, \
5951ca42382STrond Myklebust 				int error \
5961ca42382STrond Myklebust 			), \
5971ca42382STrond Myklebust 			TP_ARGS(dir, dentry, error))
5981ca42382STrond Myklebust 
5991ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter);
6001ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit);
6011ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter);
6021ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit);
6031ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter);
6041ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit);
6051ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter);
6061ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit);
6071ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter);
6081ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit);
6091ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter);
6101ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit);
6111ca42382STrond Myklebust 
6121fd1085bSTrond Myklebust TRACE_EVENT(nfs_link_enter,
6131fd1085bSTrond Myklebust 		TP_PROTO(
6141fd1085bSTrond Myklebust 			const struct inode *inode,
6151fd1085bSTrond Myklebust 			const struct inode *dir,
6161fd1085bSTrond Myklebust 			const struct dentry *dentry
6171fd1085bSTrond Myklebust 		),
6181fd1085bSTrond Myklebust 
6191fd1085bSTrond Myklebust 		TP_ARGS(inode, dir, dentry),
6201fd1085bSTrond Myklebust 
6211fd1085bSTrond Myklebust 		TP_STRUCT__entry(
6221fd1085bSTrond Myklebust 			__field(dev_t, dev)
6231fd1085bSTrond Myklebust 			__field(u64, fileid)
6241fd1085bSTrond Myklebust 			__field(u64, dir)
6251fd1085bSTrond Myklebust 			__string(name, dentry->d_name.name)
6261fd1085bSTrond Myklebust 		),
6271fd1085bSTrond Myklebust 
6281fd1085bSTrond Myklebust 		TP_fast_assign(
6291fd1085bSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
6301fd1085bSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
6311fd1085bSTrond Myklebust 			__entry->dir = NFS_FILEID(dir);
6321fd1085bSTrond Myklebust 			__assign_str(name, dentry->d_name.name);
6331fd1085bSTrond Myklebust 		),
6341fd1085bSTrond Myklebust 
6351fd1085bSTrond Myklebust 		TP_printk(
6361fd1085bSTrond Myklebust 			"fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
6371fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
6381fd1085bSTrond Myklebust 			__entry->fileid,
6391fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
6401fd1085bSTrond Myklebust 			(unsigned long long)__entry->dir,
6411fd1085bSTrond Myklebust 			__get_str(name)
6421fd1085bSTrond Myklebust 		)
6431fd1085bSTrond Myklebust );
6441fd1085bSTrond Myklebust 
6451fd1085bSTrond Myklebust TRACE_EVENT(nfs_link_exit,
6461fd1085bSTrond Myklebust 		TP_PROTO(
6471fd1085bSTrond Myklebust 			const struct inode *inode,
6481fd1085bSTrond Myklebust 			const struct inode *dir,
6491fd1085bSTrond Myklebust 			const struct dentry *dentry,
6501fd1085bSTrond Myklebust 			int error
6511fd1085bSTrond Myklebust 		),
6521fd1085bSTrond Myklebust 
6531fd1085bSTrond Myklebust 		TP_ARGS(inode, dir, dentry, error),
6541fd1085bSTrond Myklebust 
6551fd1085bSTrond Myklebust 		TP_STRUCT__entry(
65638a638a7SChuck Lever 			__field(unsigned long, error)
6571fd1085bSTrond Myklebust 			__field(dev_t, dev)
6581fd1085bSTrond Myklebust 			__field(u64, fileid)
6591fd1085bSTrond Myklebust 			__field(u64, dir)
6601fd1085bSTrond Myklebust 			__string(name, dentry->d_name.name)
6611fd1085bSTrond Myklebust 		),
6621fd1085bSTrond Myklebust 
6631fd1085bSTrond Myklebust 		TP_fast_assign(
6641fd1085bSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
6651fd1085bSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
6661fd1085bSTrond Myklebust 			__entry->dir = NFS_FILEID(dir);
66738a638a7SChuck Lever 			__entry->error = error < 0 ? -error : 0;
6681fd1085bSTrond Myklebust 			__assign_str(name, dentry->d_name.name);
6691fd1085bSTrond Myklebust 		),
6701fd1085bSTrond Myklebust 
6711fd1085bSTrond Myklebust 		TP_printk(
67238a638a7SChuck Lever 			"error=%ld (%s) fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
67338a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
6741fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
6751fd1085bSTrond Myklebust 			__entry->fileid,
6761fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
6771fd1085bSTrond Myklebust 			(unsigned long long)__entry->dir,
6781fd1085bSTrond Myklebust 			__get_str(name)
6791fd1085bSTrond Myklebust 		)
6801fd1085bSTrond Myklebust );
6811fd1085bSTrond Myklebust 
68270ded201STrond Myklebust DECLARE_EVENT_CLASS(nfs_rename_event,
68370ded201STrond Myklebust 		TP_PROTO(
68470ded201STrond Myklebust 			const struct inode *old_dir,
68570ded201STrond Myklebust 			const struct dentry *old_dentry,
68670ded201STrond Myklebust 			const struct inode *new_dir,
68770ded201STrond Myklebust 			const struct dentry *new_dentry
68870ded201STrond Myklebust 		),
68970ded201STrond Myklebust 
69070ded201STrond Myklebust 		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry),
69170ded201STrond Myklebust 
69270ded201STrond Myklebust 		TP_STRUCT__entry(
69370ded201STrond Myklebust 			__field(dev_t, dev)
69470ded201STrond Myklebust 			__field(u64, old_dir)
69570ded201STrond Myklebust 			__field(u64, new_dir)
69670ded201STrond Myklebust 			__string(old_name, old_dentry->d_name.name)
69770ded201STrond Myklebust 			__string(new_name, new_dentry->d_name.name)
69870ded201STrond Myklebust 		),
69970ded201STrond Myklebust 
70070ded201STrond Myklebust 		TP_fast_assign(
70170ded201STrond Myklebust 			__entry->dev = old_dir->i_sb->s_dev;
70270ded201STrond Myklebust 			__entry->old_dir = NFS_FILEID(old_dir);
70370ded201STrond Myklebust 			__entry->new_dir = NFS_FILEID(new_dir);
70470ded201STrond Myklebust 			__assign_str(old_name, old_dentry->d_name.name);
70570ded201STrond Myklebust 			__assign_str(new_name, new_dentry->d_name.name);
70670ded201STrond Myklebust 		),
70770ded201STrond Myklebust 
70870ded201STrond Myklebust 		TP_printk(
70970ded201STrond Myklebust 			"old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s",
71070ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
71170ded201STrond Myklebust 			(unsigned long long)__entry->old_dir,
71270ded201STrond Myklebust 			__get_str(old_name),
71370ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
71470ded201STrond Myklebust 			(unsigned long long)__entry->new_dir,
71570ded201STrond Myklebust 			__get_str(new_name)
71670ded201STrond Myklebust 		)
71770ded201STrond Myklebust );
71870ded201STrond Myklebust #define DEFINE_NFS_RENAME_EVENT(name) \
71970ded201STrond Myklebust 	DEFINE_EVENT(nfs_rename_event, name, \
72070ded201STrond Myklebust 			TP_PROTO( \
72170ded201STrond Myklebust 				const struct inode *old_dir, \
72270ded201STrond Myklebust 				const struct dentry *old_dentry, \
72370ded201STrond Myklebust 				const struct inode *new_dir, \
72470ded201STrond Myklebust 				const struct dentry *new_dentry \
72570ded201STrond Myklebust 			), \
72670ded201STrond Myklebust 			TP_ARGS(old_dir, old_dentry, new_dir, new_dentry))
72770ded201STrond Myklebust 
72870ded201STrond Myklebust DECLARE_EVENT_CLASS(nfs_rename_event_done,
72970ded201STrond Myklebust 		TP_PROTO(
73070ded201STrond Myklebust 			const struct inode *old_dir,
73170ded201STrond Myklebust 			const struct dentry *old_dentry,
73270ded201STrond Myklebust 			const struct inode *new_dir,
73370ded201STrond Myklebust 			const struct dentry *new_dentry,
73470ded201STrond Myklebust 			int error
73570ded201STrond Myklebust 		),
73670ded201STrond Myklebust 
73770ded201STrond Myklebust 		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, error),
73870ded201STrond Myklebust 
73970ded201STrond Myklebust 		TP_STRUCT__entry(
74070ded201STrond Myklebust 			__field(dev_t, dev)
74138a638a7SChuck Lever 			__field(unsigned long, error)
74270ded201STrond Myklebust 			__field(u64, old_dir)
74370ded201STrond Myklebust 			__string(old_name, old_dentry->d_name.name)
74470ded201STrond Myklebust 			__field(u64, new_dir)
74570ded201STrond Myklebust 			__string(new_name, new_dentry->d_name.name)
74670ded201STrond Myklebust 		),
74770ded201STrond Myklebust 
74870ded201STrond Myklebust 		TP_fast_assign(
74970ded201STrond Myklebust 			__entry->dev = old_dir->i_sb->s_dev;
75038a638a7SChuck Lever 			__entry->error = -error;
75170ded201STrond Myklebust 			__entry->old_dir = NFS_FILEID(old_dir);
75270ded201STrond Myklebust 			__entry->new_dir = NFS_FILEID(new_dir);
75370ded201STrond Myklebust 			__assign_str(old_name, old_dentry->d_name.name);
75470ded201STrond Myklebust 			__assign_str(new_name, new_dentry->d_name.name);
75570ded201STrond Myklebust 		),
75670ded201STrond Myklebust 
75770ded201STrond Myklebust 		TP_printk(
75838a638a7SChuck Lever 			"error=%ld (%s) old_name=%02x:%02x:%llu/%s "
75970ded201STrond Myklebust 			"new_name=%02x:%02x:%llu/%s",
76038a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
76170ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
76270ded201STrond Myklebust 			(unsigned long long)__entry->old_dir,
76370ded201STrond Myklebust 			__get_str(old_name),
76470ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
76570ded201STrond Myklebust 			(unsigned long long)__entry->new_dir,
76670ded201STrond Myklebust 			__get_str(new_name)
76770ded201STrond Myklebust 		)
76870ded201STrond Myklebust );
76970ded201STrond Myklebust #define DEFINE_NFS_RENAME_EVENT_DONE(name) \
77070ded201STrond Myklebust 	DEFINE_EVENT(nfs_rename_event_done, name, \
77170ded201STrond Myklebust 			TP_PROTO( \
77270ded201STrond Myklebust 				const struct inode *old_dir, \
77370ded201STrond Myklebust 				const struct dentry *old_dentry, \
77470ded201STrond Myklebust 				const struct inode *new_dir, \
77570ded201STrond Myklebust 				const struct dentry *new_dentry, \
77670ded201STrond Myklebust 				int error \
77770ded201STrond Myklebust 			), \
77870ded201STrond Myklebust 			TP_ARGS(old_dir, old_dentry, new_dir, \
77970ded201STrond Myklebust 				new_dentry, error))
78070ded201STrond Myklebust 
78170ded201STrond Myklebust DEFINE_NFS_RENAME_EVENT(nfs_rename_enter);
78270ded201STrond Myklebust DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit);
78370ded201STrond Myklebust 
78470ded201STrond Myklebust DEFINE_NFS_RENAME_EVENT_DONE(nfs_sillyrename_rename);
78570ded201STrond Myklebust 
78670ded201STrond Myklebust TRACE_EVENT(nfs_sillyrename_unlink,
78770ded201STrond Myklebust 		TP_PROTO(
78870ded201STrond Myklebust 			const struct nfs_unlinkdata *data,
78970ded201STrond Myklebust 			int error
79070ded201STrond Myklebust 		),
79170ded201STrond Myklebust 
79270ded201STrond Myklebust 		TP_ARGS(data, error),
79370ded201STrond Myklebust 
79470ded201STrond Myklebust 		TP_STRUCT__entry(
79570ded201STrond Myklebust 			__field(dev_t, dev)
79638a638a7SChuck Lever 			__field(unsigned long, error)
79770ded201STrond Myklebust 			__field(u64, dir)
79870ded201STrond Myklebust 			__dynamic_array(char, name, data->args.name.len + 1)
79970ded201STrond Myklebust 		),
80070ded201STrond Myklebust 
80170ded201STrond Myklebust 		TP_fast_assign(
802884be175SAl Viro 			struct inode *dir = d_inode(data->dentry->d_parent);
80370ded201STrond Myklebust 			size_t len = data->args.name.len;
80470ded201STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
80570ded201STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
80638a638a7SChuck Lever 			__entry->error = -error;
807752d596bSDaniel Bristot de Oliveira 			memcpy(__get_str(name),
80870ded201STrond Myklebust 				data->args.name.name, len);
809752d596bSDaniel Bristot de Oliveira 			__get_str(name)[len] = 0;
81070ded201STrond Myklebust 		),
81170ded201STrond Myklebust 
81270ded201STrond Myklebust 		TP_printk(
81338a638a7SChuck Lever 			"error=%ld (%s) name=%02x:%02x:%llu/%s",
81438a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
81570ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
81670ded201STrond Myklebust 			(unsigned long long)__entry->dir,
81770ded201STrond Myklebust 			__get_str(name)
81870ded201STrond Myklebust 		)
81970ded201STrond Myklebust );
8208224b273SChuck Lever 
8218224b273SChuck Lever TRACE_EVENT(nfs_initiate_read,
8228224b273SChuck Lever 		TP_PROTO(
8232343172dSTrond Myklebust 			const struct nfs_pgio_header *hdr
8248224b273SChuck Lever 		),
8258224b273SChuck Lever 
8262343172dSTrond Myklebust 		TP_ARGS(hdr),
8278224b273SChuck Lever 
8288224b273SChuck Lever 		TP_STRUCT__entry(
8298224b273SChuck Lever 			__field(dev_t, dev)
8308224b273SChuck Lever 			__field(u32, fhandle)
8318224b273SChuck Lever 			__field(u64, fileid)
8322343172dSTrond Myklebust 			__field(loff_t, offset)
8332343172dSTrond Myklebust 			__field(u32, count)
8348224b273SChuck Lever 		),
8358224b273SChuck Lever 
8368224b273SChuck Lever 		TP_fast_assign(
8372343172dSTrond Myklebust 			const struct inode *inode = hdr->inode;
8388224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
8392343172dSTrond Myklebust 			const struct nfs_fh *fh = hdr->args.fh ?
8402343172dSTrond Myklebust 						  hdr->args.fh : &nfsi->fh;
8418224b273SChuck Lever 
8422343172dSTrond Myklebust 			__entry->offset = hdr->args.offset;
8432343172dSTrond Myklebust 			__entry->count = hdr->args.count;
8448224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
8458224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
8462343172dSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
8478224b273SChuck Lever 		),
8488224b273SChuck Lever 
8498224b273SChuck Lever 		TP_printk(
8508224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
8512343172dSTrond Myklebust 			"offset=%lld count=%u",
8528224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
8538224b273SChuck Lever 			(unsigned long long)__entry->fileid,
8548224b273SChuck Lever 			__entry->fhandle,
8552343172dSTrond Myklebust 			(long long)__entry->offset, __entry->count
8568224b273SChuck Lever 		)
8578224b273SChuck Lever );
8588224b273SChuck Lever 
8598224b273SChuck Lever TRACE_EVENT(nfs_readpage_done,
8608224b273SChuck Lever 		TP_PROTO(
8612343172dSTrond Myklebust 			const struct rpc_task *task,
8622343172dSTrond Myklebust 			const struct nfs_pgio_header *hdr
8638224b273SChuck Lever 		),
8648224b273SChuck Lever 
8652343172dSTrond Myklebust 		TP_ARGS(task, hdr),
8668224b273SChuck Lever 
8678224b273SChuck Lever 		TP_STRUCT__entry(
8688224b273SChuck Lever 			__field(dev_t, dev)
8698224b273SChuck Lever 			__field(u32, fhandle)
8708224b273SChuck Lever 			__field(u64, fileid)
8712343172dSTrond Myklebust 			__field(loff_t, offset)
8722343172dSTrond Myklebust 			__field(u32, arg_count)
8732343172dSTrond Myklebust 			__field(u32, res_count)
8742343172dSTrond Myklebust 			__field(bool, eof)
8752343172dSTrond Myklebust 			__field(int, status)
8768224b273SChuck Lever 		),
8778224b273SChuck Lever 
8788224b273SChuck Lever 		TP_fast_assign(
8792343172dSTrond Myklebust 			const struct inode *inode = hdr->inode;
8808224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
8812343172dSTrond Myklebust 			const struct nfs_fh *fh = hdr->args.fh ?
8822343172dSTrond Myklebust 						  hdr->args.fh : &nfsi->fh;
8838224b273SChuck Lever 
8842343172dSTrond Myklebust 			__entry->status = task->tk_status;
8852343172dSTrond Myklebust 			__entry->offset = hdr->args.offset;
8862343172dSTrond Myklebust 			__entry->arg_count = hdr->args.count;
8872343172dSTrond Myklebust 			__entry->res_count = hdr->res.count;
8882343172dSTrond Myklebust 			__entry->eof = hdr->res.eof;
8898224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
8908224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
8912343172dSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
8928224b273SChuck Lever 		),
8938224b273SChuck Lever 
8948224b273SChuck Lever 		TP_printk(
8958224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
8962343172dSTrond Myklebust 			"offset=%lld count=%u res=%u status=%d%s",
8978224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
8988224b273SChuck Lever 			(unsigned long long)__entry->fileid,
8998224b273SChuck Lever 			__entry->fhandle,
9002343172dSTrond Myklebust 			(long long)__entry->offset, __entry->arg_count,
9012343172dSTrond Myklebust 			__entry->res_count, __entry->status,
9028224b273SChuck Lever 			__entry->eof ? " eof" : ""
9038224b273SChuck Lever 		)
9048224b273SChuck Lever );
9058224b273SChuck Lever 
90606e19024SChuck Lever TRACE_DEFINE_ENUM(NFS_UNSTABLE);
90706e19024SChuck Lever TRACE_DEFINE_ENUM(NFS_DATA_SYNC);
90806e19024SChuck Lever TRACE_DEFINE_ENUM(NFS_FILE_SYNC);
90906e19024SChuck Lever 
9108224b273SChuck Lever #define nfs_show_stable(stable) \
9118224b273SChuck Lever 	__print_symbolic(stable, \
91206e19024SChuck Lever 			{ NFS_UNSTABLE, "UNSTABLE" }, \
91306e19024SChuck Lever 			{ NFS_DATA_SYNC, "DATA_SYNC" }, \
91406e19024SChuck Lever 			{ NFS_FILE_SYNC, "FILE_SYNC" })
9158224b273SChuck Lever 
9168224b273SChuck Lever TRACE_EVENT(nfs_initiate_write,
9178224b273SChuck Lever 		TP_PROTO(
918*5bb2a7cbSTrond Myklebust 			const struct nfs_pgio_header *hdr
9198224b273SChuck Lever 		),
9208224b273SChuck Lever 
921*5bb2a7cbSTrond Myklebust 		TP_ARGS(hdr),
9228224b273SChuck Lever 
9238224b273SChuck Lever 		TP_STRUCT__entry(
9248224b273SChuck Lever 			__field(dev_t, dev)
9258224b273SChuck Lever 			__field(u32, fhandle)
9268224b273SChuck Lever 			__field(u64, fileid)
927*5bb2a7cbSTrond Myklebust 			__field(loff_t, offset)
928*5bb2a7cbSTrond Myklebust 			__field(u32, count)
929*5bb2a7cbSTrond Myklebust 			__field(enum nfs3_stable_how, stable)
9308224b273SChuck Lever 		),
9318224b273SChuck Lever 
9328224b273SChuck Lever 		TP_fast_assign(
933*5bb2a7cbSTrond Myklebust 			const struct inode *inode = hdr->inode;
9348224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
935*5bb2a7cbSTrond Myklebust 			const struct nfs_fh *fh = hdr->args.fh ?
936*5bb2a7cbSTrond Myklebust 						  hdr->args.fh : &nfsi->fh;
9378224b273SChuck Lever 
938*5bb2a7cbSTrond Myklebust 			__entry->offset = hdr->args.offset;
939*5bb2a7cbSTrond Myklebust 			__entry->count = hdr->args.count;
940*5bb2a7cbSTrond Myklebust 			__entry->stable = hdr->args.stable;
9418224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
9428224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
943*5bb2a7cbSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
9448224b273SChuck Lever 		),
9458224b273SChuck Lever 
9468224b273SChuck Lever 		TP_printk(
9478224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
948*5bb2a7cbSTrond Myklebust 			"offset=%lld count=%u stable=%s",
9498224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
9508224b273SChuck Lever 			(unsigned long long)__entry->fileid,
9518224b273SChuck Lever 			__entry->fhandle,
952*5bb2a7cbSTrond Myklebust 			(long long)__entry->offset, __entry->count,
95306e19024SChuck Lever 			nfs_show_stable(__entry->stable)
9548224b273SChuck Lever 		)
9558224b273SChuck Lever );
9568224b273SChuck Lever 
9578224b273SChuck Lever TRACE_EVENT(nfs_writeback_done,
9588224b273SChuck Lever 		TP_PROTO(
959*5bb2a7cbSTrond Myklebust 			const struct rpc_task *task,
960*5bb2a7cbSTrond Myklebust 			const struct nfs_pgio_header *hdr
9618224b273SChuck Lever 		),
9628224b273SChuck Lever 
963*5bb2a7cbSTrond Myklebust 		TP_ARGS(task, hdr),
9648224b273SChuck Lever 
9658224b273SChuck Lever 		TP_STRUCT__entry(
9668224b273SChuck Lever 			__field(dev_t, dev)
9678224b273SChuck Lever 			__field(u32, fhandle)
9688224b273SChuck Lever 			__field(u64, fileid)
969*5bb2a7cbSTrond Myklebust 			__field(loff_t, offset)
970*5bb2a7cbSTrond Myklebust 			__field(u32, arg_count)
971*5bb2a7cbSTrond Myklebust 			__field(u32, res_count)
972*5bb2a7cbSTrond Myklebust 			__field(int, status)
973*5bb2a7cbSTrond Myklebust 			__field(enum nfs3_stable_how, stable)
974*5bb2a7cbSTrond Myklebust 			__array(char, verifier, NFS4_VERIFIER_SIZE)
9758224b273SChuck Lever 		),
9768224b273SChuck Lever 
9778224b273SChuck Lever 		TP_fast_assign(
978*5bb2a7cbSTrond Myklebust 			const struct inode *inode = hdr->inode;
9798224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
980*5bb2a7cbSTrond Myklebust 			const struct nfs_fh *fh = hdr->args.fh ?
981*5bb2a7cbSTrond Myklebust 						  hdr->args.fh : &nfsi->fh;
982*5bb2a7cbSTrond Myklebust 			const struct nfs_writeverf *verf = hdr->res.verf;
9838224b273SChuck Lever 
984*5bb2a7cbSTrond Myklebust 			__entry->status = task->tk_status;
985*5bb2a7cbSTrond Myklebust 			__entry->offset = hdr->args.offset;
986*5bb2a7cbSTrond Myklebust 			__entry->arg_count = hdr->args.count;
987*5bb2a7cbSTrond Myklebust 			__entry->res_count = hdr->res.count;
988*5bb2a7cbSTrond Myklebust 			__entry->stable = verf->committed;
989*5bb2a7cbSTrond Myklebust 			memcpy(__entry->verifier,
990*5bb2a7cbSTrond Myklebust 				&verf->verifier,
991*5bb2a7cbSTrond Myklebust 				NFS4_VERIFIER_SIZE);
9928224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
9938224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
994*5bb2a7cbSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
9958224b273SChuck Lever 		),
9968224b273SChuck Lever 
9978224b273SChuck Lever 		TP_printk(
9988224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
999*5bb2a7cbSTrond Myklebust 			"offset=%lld count=%u res=%u status=%d stable=%s "
1000*5bb2a7cbSTrond Myklebust 			"verifier=%s",
10018224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
10028224b273SChuck Lever 			(unsigned long long)__entry->fileid,
10038224b273SChuck Lever 			__entry->fhandle,
1004*5bb2a7cbSTrond Myklebust 			(long long)__entry->offset, __entry->arg_count,
1005*5bb2a7cbSTrond Myklebust 			__entry->res_count, __entry->status,
100606e19024SChuck Lever 			nfs_show_stable(__entry->stable),
1007*5bb2a7cbSTrond Myklebust 			__print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE)
10088224b273SChuck Lever 		)
10098224b273SChuck Lever );
10108224b273SChuck Lever 
1011861e1671SChuck Lever DECLARE_EVENT_CLASS(nfs_page_error_class,
1012861e1671SChuck Lever 		TP_PROTO(
1013861e1671SChuck Lever 			const struct nfs_page *req,
1014861e1671SChuck Lever 			int error
1015861e1671SChuck Lever 		),
1016861e1671SChuck Lever 
1017861e1671SChuck Lever 		TP_ARGS(req, error),
1018861e1671SChuck Lever 
1019861e1671SChuck Lever 		TP_STRUCT__entry(
1020861e1671SChuck Lever 			__field(const void *, req)
1021861e1671SChuck Lever 			__field(pgoff_t, index)
1022861e1671SChuck Lever 			__field(unsigned int, offset)
1023861e1671SChuck Lever 			__field(unsigned int, pgbase)
1024861e1671SChuck Lever 			__field(unsigned int, bytes)
1025861e1671SChuck Lever 			__field(int, error)
1026861e1671SChuck Lever 		),
1027861e1671SChuck Lever 
1028861e1671SChuck Lever 		TP_fast_assign(
1029861e1671SChuck Lever 			__entry->req = req;
1030861e1671SChuck Lever 			__entry->index = req->wb_index;
1031861e1671SChuck Lever 			__entry->offset = req->wb_offset;
1032861e1671SChuck Lever 			__entry->pgbase = req->wb_pgbase;
1033861e1671SChuck Lever 			__entry->bytes = req->wb_bytes;
1034861e1671SChuck Lever 			__entry->error = error;
1035861e1671SChuck Lever 		),
1036861e1671SChuck Lever 
1037861e1671SChuck Lever 		TP_printk(
1038861e1671SChuck Lever 			"req=%p index=%lu offset=%u pgbase=%u bytes=%u error=%d",
1039861e1671SChuck Lever 			__entry->req, __entry->index, __entry->offset,
1040861e1671SChuck Lever 			__entry->pgbase, __entry->bytes, __entry->error
1041861e1671SChuck Lever 		)
1042861e1671SChuck Lever );
1043861e1671SChuck Lever 
1044861e1671SChuck Lever #define DEFINE_NFS_PAGEERR_EVENT(name) \
1045861e1671SChuck Lever 	DEFINE_EVENT(nfs_page_error_class, name, \
1046861e1671SChuck Lever 			TP_PROTO( \
1047861e1671SChuck Lever 				const struct nfs_page *req, \
1048861e1671SChuck Lever 				int error \
1049861e1671SChuck Lever 			), \
1050861e1671SChuck Lever 			TP_ARGS(req, error))
1051861e1671SChuck Lever 
1052861e1671SChuck Lever DEFINE_NFS_PAGEERR_EVENT(nfs_write_error);
1053861e1671SChuck Lever DEFINE_NFS_PAGEERR_EVENT(nfs_comp_error);
1054861e1671SChuck Lever DEFINE_NFS_PAGEERR_EVENT(nfs_commit_error);
1055861e1671SChuck Lever 
10568224b273SChuck Lever TRACE_EVENT(nfs_initiate_commit,
10578224b273SChuck Lever 		TP_PROTO(
10588224b273SChuck Lever 			const struct nfs_commit_data *data
10598224b273SChuck Lever 		),
10608224b273SChuck Lever 
10618224b273SChuck Lever 		TP_ARGS(data),
10628224b273SChuck Lever 
10638224b273SChuck Lever 		TP_STRUCT__entry(
10648224b273SChuck Lever 			__field(loff_t, offset)
10658224b273SChuck Lever 			__field(unsigned long, count)
10668224b273SChuck Lever 			__field(dev_t, dev)
10678224b273SChuck Lever 			__field(u32, fhandle)
10688224b273SChuck Lever 			__field(u64, fileid)
10698224b273SChuck Lever 		),
10708224b273SChuck Lever 
10718224b273SChuck Lever 		TP_fast_assign(
10728224b273SChuck Lever 			const struct inode *inode = data->inode;
10738224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
10748224b273SChuck Lever 
10758224b273SChuck Lever 			__entry->offset = data->args.offset;
10768224b273SChuck Lever 			__entry->count = data->args.count;
10778224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
10788224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
10798224b273SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
10808224b273SChuck Lever 		),
10818224b273SChuck Lever 
10828224b273SChuck Lever 		TP_printk(
10838224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
10848224b273SChuck Lever 			"offset=%lld count=%lu",
10858224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
10868224b273SChuck Lever 			(unsigned long long)__entry->fileid,
10878224b273SChuck Lever 			__entry->fhandle,
10888224b273SChuck Lever 			__entry->offset, __entry->count
10898224b273SChuck Lever 		)
10908224b273SChuck Lever );
10918224b273SChuck Lever 
10928224b273SChuck Lever TRACE_EVENT(nfs_commit_done,
10938224b273SChuck Lever 		TP_PROTO(
10948224b273SChuck Lever 			const struct nfs_commit_data *data
10958224b273SChuck Lever 		),
10968224b273SChuck Lever 
10978224b273SChuck Lever 		TP_ARGS(data),
10988224b273SChuck Lever 
10998224b273SChuck Lever 		TP_STRUCT__entry(
11008224b273SChuck Lever 			__field(int, status)
11018224b273SChuck Lever 			__field(loff_t, offset)
11028224b273SChuck Lever 			__field(unsigned long long, verifier)
11038224b273SChuck Lever 			__field(dev_t, dev)
11048224b273SChuck Lever 			__field(u32, fhandle)
11058224b273SChuck Lever 			__field(u64, fileid)
11068224b273SChuck Lever 		),
11078224b273SChuck Lever 
11088224b273SChuck Lever 		TP_fast_assign(
11098224b273SChuck Lever 			const struct inode *inode = data->inode;
11108224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
11118224b273SChuck Lever 
11128224b273SChuck Lever 			__entry->status = data->res.op_status;
11138224b273SChuck Lever 			__entry->offset = data->args.offset;
11148224b273SChuck Lever 			memcpy(&__entry->verifier, &data->verf.verifier,
11158224b273SChuck Lever 			       sizeof(__entry->verifier));
11168224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
11178224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
11188224b273SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
11198224b273SChuck Lever 		),
11208224b273SChuck Lever 
11218224b273SChuck Lever 		TP_printk(
11228224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
11238224b273SChuck Lever 			"offset=%lld status=%d verifier 0x%016llx",
11248224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
11258224b273SChuck Lever 			(unsigned long long)__entry->fileid,
11268224b273SChuck Lever 			__entry->fhandle,
11278224b273SChuck Lever 			__entry->offset, __entry->status,
11288224b273SChuck Lever 			__entry->verifier
11298224b273SChuck Lever 		)
11308224b273SChuck Lever );
11318224b273SChuck Lever 
113243622eabSTrond Myklebust TRACE_EVENT(nfs_fh_to_dentry,
113343622eabSTrond Myklebust 		TP_PROTO(
113443622eabSTrond Myklebust 			const struct super_block *sb,
113543622eabSTrond Myklebust 			const struct nfs_fh *fh,
113643622eabSTrond Myklebust 			u64 fileid,
113743622eabSTrond Myklebust 			int error
113843622eabSTrond Myklebust 		),
113943622eabSTrond Myklebust 
114043622eabSTrond Myklebust 		TP_ARGS(sb, fh, fileid, error),
114143622eabSTrond Myklebust 
114243622eabSTrond Myklebust 		TP_STRUCT__entry(
114343622eabSTrond Myklebust 			__field(int, error)
114443622eabSTrond Myklebust 			__field(dev_t, dev)
114543622eabSTrond Myklebust 			__field(u32, fhandle)
114643622eabSTrond Myklebust 			__field(u64, fileid)
114743622eabSTrond Myklebust 		),
114843622eabSTrond Myklebust 
114943622eabSTrond Myklebust 		TP_fast_assign(
115043622eabSTrond Myklebust 			__entry->error = error;
115143622eabSTrond Myklebust 			__entry->dev = sb->s_dev;
115243622eabSTrond Myklebust 			__entry->fileid = fileid;
115343622eabSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
115443622eabSTrond Myklebust 		),
115543622eabSTrond Myklebust 
115643622eabSTrond Myklebust 		TP_printk(
115743622eabSTrond Myklebust 			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x ",
115843622eabSTrond Myklebust 			__entry->error,
115943622eabSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
116043622eabSTrond Myklebust 			(unsigned long long)__entry->fileid,
116143622eabSTrond Myklebust 			__entry->fhandle
116243622eabSTrond Myklebust 		)
116343622eabSTrond Myklebust );
116443622eabSTrond Myklebust 
1165f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFS_OK);
1166f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_PERM);
1167f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NOENT);
1168f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_IO);
1169f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NXIO);
117038a638a7SChuck Lever TRACE_DEFINE_ENUM(ECHILD);
117138a638a7SChuck Lever TRACE_DEFINE_ENUM(NFSERR_EAGAIN);
1172f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_ACCES);
1173f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_EXIST);
1174f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_XDEV);
1175f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NODEV);
1176f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NOTDIR);
1177f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_ISDIR);
1178f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_INVAL);
1179f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_FBIG);
1180f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NOSPC);
1181f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_ROFS);
1182f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_MLINK);
118338a638a7SChuck Lever TRACE_DEFINE_ENUM(NFSERR_OPNOTSUPP);
1184f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NAMETOOLONG);
1185f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NOTEMPTY);
1186f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_DQUOT);
1187f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_STALE);
1188f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_REMOTE);
1189f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_WFLUSH);
1190f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_BADHANDLE);
1191f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NOT_SYNC);
1192f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_BAD_COOKIE);
1193f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NOTSUPP);
1194f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_TOOSMALL);
1195f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_SERVERFAULT);
1196f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_BADTYPE);
1197f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_JUKEBOX);
1198f23f6584SChuck Lever 
1199f23f6584SChuck Lever #define nfs_show_status(x) \
1200f23f6584SChuck Lever 	__print_symbolic(x, \
1201f23f6584SChuck Lever 			{ NFS_OK, "OK" }, \
1202f23f6584SChuck Lever 			{ NFSERR_PERM, "PERM" }, \
1203f23f6584SChuck Lever 			{ NFSERR_NOENT, "NOENT" }, \
1204f23f6584SChuck Lever 			{ NFSERR_IO, "IO" }, \
1205f23f6584SChuck Lever 			{ NFSERR_NXIO, "NXIO" }, \
120638a638a7SChuck Lever 			{ ECHILD, "CHILD" }, \
120738a638a7SChuck Lever 			{ NFSERR_EAGAIN, "AGAIN" }, \
1208f23f6584SChuck Lever 			{ NFSERR_ACCES, "ACCES" }, \
1209f23f6584SChuck Lever 			{ NFSERR_EXIST, "EXIST" }, \
1210f23f6584SChuck Lever 			{ NFSERR_XDEV, "XDEV" }, \
1211f23f6584SChuck Lever 			{ NFSERR_NODEV, "NODEV" }, \
1212f23f6584SChuck Lever 			{ NFSERR_NOTDIR, "NOTDIR" }, \
1213f23f6584SChuck Lever 			{ NFSERR_ISDIR, "ISDIR" }, \
1214f23f6584SChuck Lever 			{ NFSERR_INVAL, "INVAL" }, \
1215f23f6584SChuck Lever 			{ NFSERR_FBIG, "FBIG" }, \
1216f23f6584SChuck Lever 			{ NFSERR_NOSPC, "NOSPC" }, \
1217f23f6584SChuck Lever 			{ NFSERR_ROFS, "ROFS" }, \
1218f23f6584SChuck Lever 			{ NFSERR_MLINK, "MLINK" }, \
121938a638a7SChuck Lever 			{ NFSERR_OPNOTSUPP, "OPNOTSUPP" }, \
1220f23f6584SChuck Lever 			{ NFSERR_NAMETOOLONG, "NAMETOOLONG" }, \
1221f23f6584SChuck Lever 			{ NFSERR_NOTEMPTY, "NOTEMPTY" }, \
1222f23f6584SChuck Lever 			{ NFSERR_DQUOT, "DQUOT" }, \
1223f23f6584SChuck Lever 			{ NFSERR_STALE, "STALE" }, \
1224f23f6584SChuck Lever 			{ NFSERR_REMOTE, "REMOTE" }, \
1225f23f6584SChuck Lever 			{ NFSERR_WFLUSH, "WFLUSH" }, \
1226f23f6584SChuck Lever 			{ NFSERR_BADHANDLE, "BADHANDLE" }, \
1227f23f6584SChuck Lever 			{ NFSERR_NOT_SYNC, "NOTSYNC" }, \
1228f23f6584SChuck Lever 			{ NFSERR_BAD_COOKIE, "BADCOOKIE" }, \
1229f23f6584SChuck Lever 			{ NFSERR_NOTSUPP, "NOTSUPP" }, \
1230f23f6584SChuck Lever 			{ NFSERR_TOOSMALL, "TOOSMALL" }, \
1231f23f6584SChuck Lever 			{ NFSERR_SERVERFAULT, "REMOTEIO" }, \
1232f23f6584SChuck Lever 			{ NFSERR_BADTYPE, "BADTYPE" }, \
1233f23f6584SChuck Lever 			{ NFSERR_JUKEBOX, "JUKEBOX" })
1234f23f6584SChuck Lever 
1235f23f6584SChuck Lever TRACE_EVENT(nfs_xdr_status,
1236f23f6584SChuck Lever 		TP_PROTO(
123762a92ba9SChuck Lever 			const struct xdr_stream *xdr,
1238f23f6584SChuck Lever 			int error
1239f23f6584SChuck Lever 		),
1240f23f6584SChuck Lever 
124162a92ba9SChuck Lever 		TP_ARGS(xdr, error),
1242f23f6584SChuck Lever 
1243f23f6584SChuck Lever 		TP_STRUCT__entry(
124462a92ba9SChuck Lever 			__field(unsigned int, task_id)
124562a92ba9SChuck Lever 			__field(unsigned int, client_id)
124662a92ba9SChuck Lever 			__field(u32, xid)
124738a638a7SChuck Lever 			__field(unsigned long, error)
1248f23f6584SChuck Lever 		),
1249f23f6584SChuck Lever 
1250f23f6584SChuck Lever 		TP_fast_assign(
125162a92ba9SChuck Lever 			const struct rpc_rqst *rqstp = xdr->rqst;
125262a92ba9SChuck Lever 			const struct rpc_task *task = rqstp->rq_task;
125362a92ba9SChuck Lever 
125462a92ba9SChuck Lever 			__entry->task_id = task->tk_pid;
125562a92ba9SChuck Lever 			__entry->client_id = task->tk_client->cl_clid;
125662a92ba9SChuck Lever 			__entry->xid = be32_to_cpu(rqstp->rq_xid);
1257f23f6584SChuck Lever 			__entry->error = error;
1258f23f6584SChuck Lever 		),
1259f23f6584SChuck Lever 
1260f23f6584SChuck Lever 		TP_printk(
126162a92ba9SChuck Lever 			"task:%u@%d xid=0x%08x error=%ld (%s)",
126262a92ba9SChuck Lever 			__entry->task_id, __entry->client_id, __entry->xid,
126338a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error)
1264f23f6584SChuck Lever 		)
1265f23f6584SChuck Lever );
1266f23f6584SChuck Lever 
1267f4ce1299STrond Myklebust #endif /* _TRACE_NFS_H */
1268f4ce1299STrond Myklebust 
1269f4ce1299STrond Myklebust #undef TRACE_INCLUDE_PATH
1270f4ce1299STrond Myklebust #define TRACE_INCLUDE_PATH .
1271f4ce1299STrond Myklebust #define TRACE_INCLUDE_FILE nfstrace
1272f4ce1299STrond Myklebust /* This part must be outside protection */
1273f4ce1299STrond Myklebust #include <trace/define_trace.h>
1274