xref: /linux/fs/nfs/nfstrace.h (revision 78c14b385c195d4f25ab7c19186b8897a5b9ae3f)
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);
488a27c7ccSTrond Myklebust TRACE_DEFINE_ENUM(NFS_INO_DATA_INVAL_DEFER);
498a27c7ccSTrond Myklebust TRACE_DEFINE_ENUM(NFS_INO_INVALID_BLOCKS);
508a27c7ccSTrond Myklebust TRACE_DEFINE_ENUM(NFS_INO_INVALID_XATTR);
51fabf2b34STrond Myklebust TRACE_DEFINE_ENUM(NFS_INO_INVALID_NLINK);
52720869ebSTrond Myklebust TRACE_DEFINE_ENUM(NFS_INO_INVALID_MODE);
537d4006c1SChuck Lever 
54f4ce1299STrond Myklebust #define nfs_show_cache_validity(v) \
55f4ce1299STrond Myklebust 	__print_flags(v, "|", \
56f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
57f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
58f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
59f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
60f4ce1299STrond Myklebust 			{ NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \
61f4ce1299STrond Myklebust 			{ NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
627d4006c1SChuck Lever 			{ NFS_INO_INVALID_LABEL, "INVALID_LABEL" }, \
637d4006c1SChuck Lever 			{ NFS_INO_INVALID_CHANGE, "INVALID_CHANGE" }, \
647d4006c1SChuck Lever 			{ NFS_INO_INVALID_CTIME, "INVALID_CTIME" }, \
657d4006c1SChuck Lever 			{ NFS_INO_INVALID_MTIME, "INVALID_MTIME" }, \
667d4006c1SChuck Lever 			{ NFS_INO_INVALID_SIZE, "INVALID_SIZE" }, \
670f44da51SFrank van der Linden 			{ NFS_INO_INVALID_OTHER, "INVALID_OTHER" }, \
688a27c7ccSTrond Myklebust 			{ NFS_INO_DATA_INVAL_DEFER, "DATA_INVAL_DEFER" }, \
698a27c7ccSTrond Myklebust 			{ NFS_INO_INVALID_BLOCKS, "INVALID_BLOCKS" }, \
70fabf2b34STrond Myklebust 			{ NFS_INO_INVALID_XATTR, "INVALID_XATTR" }, \
71720869ebSTrond Myklebust 			{ NFS_INO_INVALID_NLINK, "INVALID_NLINK" }, \
72720869ebSTrond Myklebust 			{ NFS_INO_INVALID_MODE, "INVALID_MODE" })
737d4006c1SChuck Lever 
747d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_ADVISE_RDPLUS);
757d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_STALE);
767d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_ACL_LRU_SET);
777d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_INVALIDATING);
787d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_FSCACHE);
797d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_FSCACHE_LOCK);
807d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_LAYOUTCOMMIT);
817d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_LAYOUTCOMMITTING);
827d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_LAYOUTSTATS);
837d4006c1SChuck Lever TRACE_DEFINE_ENUM(NFS_INO_ODIRECT);
84f4ce1299STrond Myklebust 
85f4ce1299STrond Myklebust #define nfs_show_nfsi_flags(v) \
86f4ce1299STrond Myklebust 	__print_flags(v, "|", \
877d4006c1SChuck Lever 			{ BIT(NFS_INO_ADVISE_RDPLUS), "ADVISE_RDPLUS" }, \
887d4006c1SChuck Lever 			{ BIT(NFS_INO_STALE), "STALE" }, \
897d4006c1SChuck Lever 			{ BIT(NFS_INO_ACL_LRU_SET), "ACL_LRU_SET" }, \
907d4006c1SChuck Lever 			{ BIT(NFS_INO_INVALIDATING), "INVALIDATING" }, \
917d4006c1SChuck Lever 			{ BIT(NFS_INO_FSCACHE), "FSCACHE" }, \
927d4006c1SChuck Lever 			{ BIT(NFS_INO_FSCACHE_LOCK), "FSCACHE_LOCK" }, \
937d4006c1SChuck Lever 			{ BIT(NFS_INO_LAYOUTCOMMIT), "NEED_LAYOUTCOMMIT" }, \
947d4006c1SChuck Lever 			{ BIT(NFS_INO_LAYOUTCOMMITTING), "LAYOUTCOMMIT" }, \
957d4006c1SChuck Lever 			{ BIT(NFS_INO_LAYOUTSTATS), "LAYOUTSTATS" }, \
967d4006c1SChuck Lever 			{ BIT(NFS_INO_ODIRECT), "ODIRECT" })
97f4ce1299STrond Myklebust 
98f4ce1299STrond Myklebust DECLARE_EVENT_CLASS(nfs_inode_event,
99f4ce1299STrond Myklebust 		TP_PROTO(
100f4ce1299STrond Myklebust 			const struct inode *inode
101f4ce1299STrond Myklebust 		),
102f4ce1299STrond Myklebust 
103f4ce1299STrond Myklebust 		TP_ARGS(inode),
104f4ce1299STrond Myklebust 
105f4ce1299STrond Myklebust 		TP_STRUCT__entry(
106f4ce1299STrond Myklebust 			__field(dev_t, dev)
107f4ce1299STrond Myklebust 			__field(u32, fhandle)
108f4ce1299STrond Myklebust 			__field(u64, fileid)
109f4ce1299STrond Myklebust 			__field(u64, version)
110f4ce1299STrond Myklebust 		),
111f4ce1299STrond Myklebust 
112f4ce1299STrond Myklebust 		TP_fast_assign(
113f4ce1299STrond Myklebust 			const struct nfs_inode *nfsi = NFS_I(inode);
114f4ce1299STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
115f4ce1299STrond Myklebust 			__entry->fileid = nfsi->fileid;
116f4ce1299STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1171eb5d98fSJeff Layton 			__entry->version = inode_peek_iversion_raw(inode);
118f4ce1299STrond Myklebust 		),
119f4ce1299STrond Myklebust 
120f4ce1299STrond Myklebust 		TP_printk(
121f4ce1299STrond Myklebust 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
122f4ce1299STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
123f4ce1299STrond Myklebust 			(unsigned long long)__entry->fileid,
124f4ce1299STrond Myklebust 			__entry->fhandle,
125f4ce1299STrond Myklebust 			(unsigned long long)__entry->version
126f4ce1299STrond Myklebust 		)
127f4ce1299STrond Myklebust );
128f4ce1299STrond Myklebust 
129f4ce1299STrond Myklebust DECLARE_EVENT_CLASS(nfs_inode_event_done,
130f4ce1299STrond Myklebust 		TP_PROTO(
131f4ce1299STrond Myklebust 			const struct inode *inode,
132f4ce1299STrond Myklebust 			int error
133f4ce1299STrond Myklebust 		),
134f4ce1299STrond Myklebust 
135f4ce1299STrond Myklebust 		TP_ARGS(inode, error),
136f4ce1299STrond Myklebust 
137f4ce1299STrond Myklebust 		TP_STRUCT__entry(
13838a638a7SChuck Lever 			__field(unsigned long, error)
139f4ce1299STrond Myklebust 			__field(dev_t, dev)
140f4ce1299STrond Myklebust 			__field(u32, fhandle)
141f4ce1299STrond Myklebust 			__field(unsigned char, type)
142f4ce1299STrond Myklebust 			__field(u64, fileid)
143f4ce1299STrond Myklebust 			__field(u64, version)
144f4ce1299STrond Myklebust 			__field(loff_t, size)
145f4ce1299STrond Myklebust 			__field(unsigned long, nfsi_flags)
146f4ce1299STrond Myklebust 			__field(unsigned long, cache_validity)
147f4ce1299STrond Myklebust 		),
148f4ce1299STrond Myklebust 
149f4ce1299STrond Myklebust 		TP_fast_assign(
150f4ce1299STrond Myklebust 			const struct nfs_inode *nfsi = NFS_I(inode);
15138a638a7SChuck Lever 			__entry->error = error < 0 ? -error : 0;
152f4ce1299STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
153f4ce1299STrond Myklebust 			__entry->fileid = nfsi->fileid;
154f4ce1299STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
155f4ce1299STrond Myklebust 			__entry->type = nfs_umode_to_dtype(inode->i_mode);
1561eb5d98fSJeff Layton 			__entry->version = inode_peek_iversion_raw(inode);
157f4ce1299STrond Myklebust 			__entry->size = i_size_read(inode);
158f4ce1299STrond Myklebust 			__entry->nfsi_flags = nfsi->flags;
159f4ce1299STrond Myklebust 			__entry->cache_validity = nfsi->cache_validity;
160f4ce1299STrond Myklebust 		),
161f4ce1299STrond Myklebust 
162f4ce1299STrond Myklebust 		TP_printk(
16338a638a7SChuck Lever 			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
164f4ce1299STrond Myklebust 			"type=%u (%s) version=%llu size=%lld "
1657d4006c1SChuck Lever 			"cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s)",
16638a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
167f4ce1299STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
168f4ce1299STrond Myklebust 			(unsigned long long)__entry->fileid,
169f4ce1299STrond Myklebust 			__entry->fhandle,
170f4ce1299STrond Myklebust 			__entry->type,
171f4ce1299STrond Myklebust 			nfs_show_file_type(__entry->type),
172f4ce1299STrond Myklebust 			(unsigned long long)__entry->version,
173f4ce1299STrond Myklebust 			(long long)__entry->size,
174f4ce1299STrond Myklebust 			__entry->cache_validity,
175f4ce1299STrond Myklebust 			nfs_show_cache_validity(__entry->cache_validity),
176f4ce1299STrond Myklebust 			__entry->nfsi_flags,
177f4ce1299STrond Myklebust 			nfs_show_nfsi_flags(__entry->nfsi_flags)
178f4ce1299STrond Myklebust 		)
179f4ce1299STrond Myklebust );
180f4ce1299STrond Myklebust 
181f4ce1299STrond Myklebust #define DEFINE_NFS_INODE_EVENT(name) \
182f4ce1299STrond Myklebust 	DEFINE_EVENT(nfs_inode_event, name, \
183f4ce1299STrond Myklebust 			TP_PROTO( \
184f4ce1299STrond Myklebust 				const struct inode *inode \
185f4ce1299STrond Myklebust 			), \
186f4ce1299STrond Myklebust 			TP_ARGS(inode))
187f4ce1299STrond Myklebust #define DEFINE_NFS_INODE_EVENT_DONE(name) \
188f4ce1299STrond Myklebust 	DEFINE_EVENT(nfs_inode_event_done, name, \
189f4ce1299STrond Myklebust 			TP_PROTO( \
190f4ce1299STrond Myklebust 				const struct inode *inode, \
191f4ce1299STrond Myklebust 				int error \
192f4ce1299STrond Myklebust 			), \
193f4ce1299STrond Myklebust 			TP_ARGS(inode, error))
19493ce4af7STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_set_inode_stale);
195f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter);
196f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit);
197f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter);
198f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit);
199f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter);
200f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit);
201f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_getattr_enter);
202f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit);
203f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_setattr_enter);
204f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit);
205f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_writeback_page_enter);
206f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_page_exit);
207f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter);
208f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit);
209f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_fsync_enter);
210f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
211f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_access_enter);
212e8194b7dSTrond Myklebust 
213e8194b7dSTrond Myklebust TRACE_EVENT(nfs_access_exit,
214e8194b7dSTrond Myklebust 		TP_PROTO(
215e8194b7dSTrond Myklebust 			const struct inode *inode,
216e8194b7dSTrond Myklebust 			unsigned int mask,
217e8194b7dSTrond Myklebust 			unsigned int permitted,
218e8194b7dSTrond Myklebust 			int error
219e8194b7dSTrond Myklebust 		),
220e8194b7dSTrond Myklebust 
221e8194b7dSTrond Myklebust 		TP_ARGS(inode, mask, permitted, error),
222e8194b7dSTrond Myklebust 
223e8194b7dSTrond Myklebust 		TP_STRUCT__entry(
224e8194b7dSTrond Myklebust 			__field(unsigned long, error)
225e8194b7dSTrond Myklebust 			__field(dev_t, dev)
226e8194b7dSTrond Myklebust 			__field(u32, fhandle)
227e8194b7dSTrond Myklebust 			__field(unsigned char, type)
228e8194b7dSTrond Myklebust 			__field(u64, fileid)
229e8194b7dSTrond Myklebust 			__field(u64, version)
230e8194b7dSTrond Myklebust 			__field(loff_t, size)
231e8194b7dSTrond Myklebust 			__field(unsigned long, nfsi_flags)
232e8194b7dSTrond Myklebust 			__field(unsigned long, cache_validity)
233e8194b7dSTrond Myklebust 			__field(unsigned int, mask)
234e8194b7dSTrond Myklebust 			__field(unsigned int, permitted)
235e8194b7dSTrond Myklebust 		),
236e8194b7dSTrond Myklebust 
237e8194b7dSTrond Myklebust 		TP_fast_assign(
238e8194b7dSTrond Myklebust 			const struct nfs_inode *nfsi = NFS_I(inode);
239e8194b7dSTrond Myklebust 			__entry->error = error < 0 ? -error : 0;
240e8194b7dSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
241e8194b7dSTrond Myklebust 			__entry->fileid = nfsi->fileid;
242e8194b7dSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
243e8194b7dSTrond Myklebust 			__entry->type = nfs_umode_to_dtype(inode->i_mode);
244e8194b7dSTrond Myklebust 			__entry->version = inode_peek_iversion_raw(inode);
245e8194b7dSTrond Myklebust 			__entry->size = i_size_read(inode);
246e8194b7dSTrond Myklebust 			__entry->nfsi_flags = nfsi->flags;
247e8194b7dSTrond Myklebust 			__entry->cache_validity = nfsi->cache_validity;
248e8194b7dSTrond Myklebust 			__entry->mask = mask;
249e8194b7dSTrond Myklebust 			__entry->permitted = permitted;
250e8194b7dSTrond Myklebust 		),
251e8194b7dSTrond Myklebust 
252e8194b7dSTrond Myklebust 		TP_printk(
253e8194b7dSTrond Myklebust 			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
254e8194b7dSTrond Myklebust 			"type=%u (%s) version=%llu size=%lld "
255e8194b7dSTrond Myklebust 			"cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s) "
256e8194b7dSTrond Myklebust 			"mask=0x%x permitted=0x%x",
257e8194b7dSTrond Myklebust 			-__entry->error, nfs_show_status(__entry->error),
258e8194b7dSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
259e8194b7dSTrond Myklebust 			(unsigned long long)__entry->fileid,
260e8194b7dSTrond Myklebust 			__entry->fhandle,
261e8194b7dSTrond Myklebust 			__entry->type,
262e8194b7dSTrond Myklebust 			nfs_show_file_type(__entry->type),
263e8194b7dSTrond Myklebust 			(unsigned long long)__entry->version,
264e8194b7dSTrond Myklebust 			(long long)__entry->size,
265e8194b7dSTrond Myklebust 			__entry->cache_validity,
266e8194b7dSTrond Myklebust 			nfs_show_cache_validity(__entry->cache_validity),
267e8194b7dSTrond Myklebust 			__entry->nfsi_flags,
268e8194b7dSTrond Myklebust 			nfs_show_nfsi_flags(__entry->nfsi_flags),
269e8194b7dSTrond Myklebust 			__entry->mask, __entry->permitted
270e8194b7dSTrond Myklebust 		)
271e8194b7dSTrond Myklebust );
272f4ce1299STrond Myklebust 
2737d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_FOLLOW);
2747d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_DIRECTORY);
2757d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_AUTOMOUNT);
2767d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_PARENT);
2777d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_REVAL);
2787d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_RCU);
2797d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_OPEN);
2807d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_CREATE);
2817d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_EXCL);
2827d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_RENAME_TARGET);
2837d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_JUMPED);
2847d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_ROOT);
2857d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_EMPTY);
2867d4006c1SChuck Lever TRACE_DEFINE_ENUM(LOOKUP_DOWN);
2877d4006c1SChuck Lever 
2886e0d0be7STrond Myklebust #define show_lookup_flags(flags) \
2897d4006c1SChuck Lever 	__print_flags(flags, "|", \
2907d4006c1SChuck Lever 			{ LOOKUP_FOLLOW, "FOLLOW" }, \
2916e0d0be7STrond Myklebust 			{ LOOKUP_DIRECTORY, "DIRECTORY" }, \
2927d4006c1SChuck Lever 			{ LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \
2937d4006c1SChuck Lever 			{ LOOKUP_PARENT, "PARENT" }, \
2947d4006c1SChuck Lever 			{ LOOKUP_REVAL, "REVAL" }, \
2957d4006c1SChuck Lever 			{ LOOKUP_RCU, "RCU" }, \
2966e0d0be7STrond Myklebust 			{ LOOKUP_OPEN, "OPEN" }, \
2976e0d0be7STrond Myklebust 			{ LOOKUP_CREATE, "CREATE" }, \
2987d4006c1SChuck Lever 			{ LOOKUP_EXCL, "EXCL" }, \
2997d4006c1SChuck Lever 			{ LOOKUP_RENAME_TARGET, "RENAME_TARGET" }, \
3007d4006c1SChuck Lever 			{ LOOKUP_JUMPED, "JUMPED" }, \
3017d4006c1SChuck Lever 			{ LOOKUP_ROOT, "ROOT" }, \
3027d4006c1SChuck Lever 			{ LOOKUP_EMPTY, "EMPTY" }, \
3037d4006c1SChuck Lever 			{ LOOKUP_DOWN, "DOWN" })
3046e0d0be7STrond Myklebust 
3056e0d0be7STrond Myklebust DECLARE_EVENT_CLASS(nfs_lookup_event,
3066e0d0be7STrond Myklebust 		TP_PROTO(
3076e0d0be7STrond Myklebust 			const struct inode *dir,
3086e0d0be7STrond Myklebust 			const struct dentry *dentry,
3096e0d0be7STrond Myklebust 			unsigned int flags
3106e0d0be7STrond Myklebust 		),
3116e0d0be7STrond Myklebust 
3126e0d0be7STrond Myklebust 		TP_ARGS(dir, dentry, flags),
3136e0d0be7STrond Myklebust 
3146e0d0be7STrond Myklebust 		TP_STRUCT__entry(
3157d4006c1SChuck Lever 			__field(unsigned long, flags)
3166e0d0be7STrond Myklebust 			__field(dev_t, dev)
3176e0d0be7STrond Myklebust 			__field(u64, dir)
3186e0d0be7STrond Myklebust 			__string(name, dentry->d_name.name)
3196e0d0be7STrond Myklebust 		),
3206e0d0be7STrond Myklebust 
3216e0d0be7STrond Myklebust 		TP_fast_assign(
3226e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
3236e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
3246e0d0be7STrond Myklebust 			__entry->flags = flags;
3256e0d0be7STrond Myklebust 			__assign_str(name, dentry->d_name.name);
3266e0d0be7STrond Myklebust 		),
3276e0d0be7STrond Myklebust 
3286e0d0be7STrond Myklebust 		TP_printk(
3297d4006c1SChuck Lever 			"flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
3306e0d0be7STrond Myklebust 			__entry->flags,
3316e0d0be7STrond Myklebust 			show_lookup_flags(__entry->flags),
3326e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
3336e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
3346e0d0be7STrond Myklebust 			__get_str(name)
3356e0d0be7STrond Myklebust 		)
3366e0d0be7STrond Myklebust );
3376e0d0be7STrond Myklebust 
3386e0d0be7STrond Myklebust #define DEFINE_NFS_LOOKUP_EVENT(name) \
3396e0d0be7STrond Myklebust 	DEFINE_EVENT(nfs_lookup_event, name, \
3406e0d0be7STrond Myklebust 			TP_PROTO( \
3416e0d0be7STrond Myklebust 				const struct inode *dir, \
3426e0d0be7STrond Myklebust 				const struct dentry *dentry, \
3436e0d0be7STrond Myklebust 				unsigned int flags \
3446e0d0be7STrond Myklebust 			), \
3456e0d0be7STrond Myklebust 			TP_ARGS(dir, dentry, flags))
3466e0d0be7STrond Myklebust 
3476e0d0be7STrond Myklebust DECLARE_EVENT_CLASS(nfs_lookup_event_done,
3486e0d0be7STrond Myklebust 		TP_PROTO(
3496e0d0be7STrond Myklebust 			const struct inode *dir,
3506e0d0be7STrond Myklebust 			const struct dentry *dentry,
3516e0d0be7STrond Myklebust 			unsigned int flags,
3526e0d0be7STrond Myklebust 			int error
3536e0d0be7STrond Myklebust 		),
3546e0d0be7STrond Myklebust 
3556e0d0be7STrond Myklebust 		TP_ARGS(dir, dentry, flags, error),
3566e0d0be7STrond Myklebust 
3576e0d0be7STrond Myklebust 		TP_STRUCT__entry(
35838a638a7SChuck Lever 			__field(unsigned long, error)
3597d4006c1SChuck Lever 			__field(unsigned long, flags)
3606e0d0be7STrond Myklebust 			__field(dev_t, dev)
3616e0d0be7STrond Myklebust 			__field(u64, dir)
3626e0d0be7STrond Myklebust 			__string(name, dentry->d_name.name)
3636e0d0be7STrond Myklebust 		),
3646e0d0be7STrond Myklebust 
3656e0d0be7STrond Myklebust 		TP_fast_assign(
3666e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
3676e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
36838a638a7SChuck Lever 			__entry->error = error < 0 ? -error : 0;
3696e0d0be7STrond Myklebust 			__entry->flags = flags;
3706e0d0be7STrond Myklebust 			__assign_str(name, dentry->d_name.name);
3716e0d0be7STrond Myklebust 		),
3726e0d0be7STrond Myklebust 
3736e0d0be7STrond Myklebust 		TP_printk(
3747d4006c1SChuck Lever 			"error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
37538a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
3766e0d0be7STrond Myklebust 			__entry->flags,
3776e0d0be7STrond Myklebust 			show_lookup_flags(__entry->flags),
3786e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
3796e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
3806e0d0be7STrond Myklebust 			__get_str(name)
3816e0d0be7STrond Myklebust 		)
3826e0d0be7STrond Myklebust );
3836e0d0be7STrond Myklebust 
3846e0d0be7STrond Myklebust #define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \
3856e0d0be7STrond Myklebust 	DEFINE_EVENT(nfs_lookup_event_done, name, \
3866e0d0be7STrond Myklebust 			TP_PROTO( \
3876e0d0be7STrond Myklebust 				const struct inode *dir, \
3886e0d0be7STrond Myklebust 				const struct dentry *dentry, \
3896e0d0be7STrond Myklebust 				unsigned int flags, \
3906e0d0be7STrond Myklebust 				int error \
3916e0d0be7STrond Myklebust 			), \
3926e0d0be7STrond Myklebust 			TP_ARGS(dir, dentry, flags, error))
3936e0d0be7STrond Myklebust 
3946e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter);
3956e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
3966e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
3976e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
3986e0d0be7STrond Myklebust 
3997d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_WRONLY);
4007d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_RDWR);
4017d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_CREAT);
4027d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_EXCL);
4037d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_NOCTTY);
4047d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_TRUNC);
4057d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_APPEND);
4067d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_NONBLOCK);
4077d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_DSYNC);
4087d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_DIRECT);
4097d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_LARGEFILE);
4107d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_DIRECTORY);
4117d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_NOFOLLOW);
4127d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_NOATIME);
4137d4006c1SChuck Lever TRACE_DEFINE_ENUM(O_CLOEXEC);
4147d4006c1SChuck Lever 
4156e0d0be7STrond Myklebust #define show_open_flags(flags) \
4167d4006c1SChuck Lever 	__print_flags(flags, "|", \
4177d4006c1SChuck Lever 		{ O_WRONLY, "O_WRONLY" }, \
4187d4006c1SChuck Lever 		{ O_RDWR, "O_RDWR" }, \
4196e0d0be7STrond Myklebust 		{ O_CREAT, "O_CREAT" }, \
4206e0d0be7STrond Myklebust 		{ O_EXCL, "O_EXCL" }, \
4217d4006c1SChuck Lever 		{ O_NOCTTY, "O_NOCTTY" }, \
4226e0d0be7STrond Myklebust 		{ O_TRUNC, "O_TRUNC" }, \
4236e0d0be7STrond Myklebust 		{ O_APPEND, "O_APPEND" }, \
4247d4006c1SChuck Lever 		{ O_NONBLOCK, "O_NONBLOCK" }, \
4256e0d0be7STrond Myklebust 		{ O_DSYNC, "O_DSYNC" }, \
4266e0d0be7STrond Myklebust 		{ O_DIRECT, "O_DIRECT" }, \
4277d4006c1SChuck Lever 		{ O_LARGEFILE, "O_LARGEFILE" }, \
4287d4006c1SChuck Lever 		{ O_DIRECTORY, "O_DIRECTORY" }, \
4297d4006c1SChuck Lever 		{ O_NOFOLLOW, "O_NOFOLLOW" }, \
4307d4006c1SChuck Lever 		{ O_NOATIME, "O_NOATIME" }, \
4317d4006c1SChuck Lever 		{ O_CLOEXEC, "O_CLOEXEC" })
4327d4006c1SChuck Lever 
4337d4006c1SChuck Lever TRACE_DEFINE_ENUM(FMODE_READ);
4347d4006c1SChuck Lever TRACE_DEFINE_ENUM(FMODE_WRITE);
4357d4006c1SChuck Lever TRACE_DEFINE_ENUM(FMODE_EXEC);
4366e0d0be7STrond Myklebust 
4376e0d0be7STrond Myklebust #define show_fmode_flags(mode) \
4386e0d0be7STrond Myklebust 	__print_flags(mode, "|", \
4396e0d0be7STrond Myklebust 		{ ((__force unsigned long)FMODE_READ), "READ" }, \
4406e0d0be7STrond Myklebust 		{ ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
4416e0d0be7STrond Myklebust 		{ ((__force unsigned long)FMODE_EXEC), "EXEC" })
4426e0d0be7STrond Myklebust 
4436e0d0be7STrond Myklebust TRACE_EVENT(nfs_atomic_open_enter,
4446e0d0be7STrond Myklebust 		TP_PROTO(
4456e0d0be7STrond Myklebust 			const struct inode *dir,
4466e0d0be7STrond Myklebust 			const struct nfs_open_context *ctx,
4476e0d0be7STrond Myklebust 			unsigned int flags
4486e0d0be7STrond Myklebust 		),
4496e0d0be7STrond Myklebust 
4506e0d0be7STrond Myklebust 		TP_ARGS(dir, ctx, flags),
4516e0d0be7STrond Myklebust 
4526e0d0be7STrond Myklebust 		TP_STRUCT__entry(
4537d4006c1SChuck Lever 			__field(unsigned long, flags)
4546e0d0be7STrond Myklebust 			__field(unsigned int, fmode)
4556e0d0be7STrond Myklebust 			__field(dev_t, dev)
4566e0d0be7STrond Myklebust 			__field(u64, dir)
4576e0d0be7STrond Myklebust 			__string(name, ctx->dentry->d_name.name)
4586e0d0be7STrond Myklebust 		),
4596e0d0be7STrond Myklebust 
4606e0d0be7STrond Myklebust 		TP_fast_assign(
4616e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
4626e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
4636e0d0be7STrond Myklebust 			__entry->flags = flags;
4646e0d0be7STrond Myklebust 			__entry->fmode = (__force unsigned int)ctx->mode;
4656e0d0be7STrond Myklebust 			__assign_str(name, ctx->dentry->d_name.name);
4666e0d0be7STrond Myklebust 		),
4676e0d0be7STrond Myklebust 
4686e0d0be7STrond Myklebust 		TP_printk(
4697d4006c1SChuck Lever 			"flags=0x%lx (%s) fmode=%s name=%02x:%02x:%llu/%s",
4706e0d0be7STrond Myklebust 			__entry->flags,
4716e0d0be7STrond Myklebust 			show_open_flags(__entry->flags),
4726e0d0be7STrond Myklebust 			show_fmode_flags(__entry->fmode),
4736e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
4746e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
4756e0d0be7STrond Myklebust 			__get_str(name)
4766e0d0be7STrond Myklebust 		)
4776e0d0be7STrond Myklebust );
4786e0d0be7STrond Myklebust 
4796e0d0be7STrond Myklebust TRACE_EVENT(nfs_atomic_open_exit,
4806e0d0be7STrond Myklebust 		TP_PROTO(
4816e0d0be7STrond Myklebust 			const struct inode *dir,
4826e0d0be7STrond Myklebust 			const struct nfs_open_context *ctx,
4836e0d0be7STrond Myklebust 			unsigned int flags,
4846e0d0be7STrond Myklebust 			int error
4856e0d0be7STrond Myklebust 		),
4866e0d0be7STrond Myklebust 
4876e0d0be7STrond Myklebust 		TP_ARGS(dir, ctx, flags, error),
4886e0d0be7STrond Myklebust 
4896e0d0be7STrond Myklebust 		TP_STRUCT__entry(
49038a638a7SChuck Lever 			__field(unsigned long, error)
4917d4006c1SChuck Lever 			__field(unsigned long, flags)
4926e0d0be7STrond Myklebust 			__field(unsigned int, fmode)
4936e0d0be7STrond Myklebust 			__field(dev_t, dev)
4946e0d0be7STrond Myklebust 			__field(u64, dir)
4956e0d0be7STrond Myklebust 			__string(name, ctx->dentry->d_name.name)
4966e0d0be7STrond Myklebust 		),
4976e0d0be7STrond Myklebust 
4986e0d0be7STrond Myklebust 		TP_fast_assign(
49938a638a7SChuck Lever 			__entry->error = -error;
5006e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
5016e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
5026e0d0be7STrond Myklebust 			__entry->flags = flags;
5036e0d0be7STrond Myklebust 			__entry->fmode = (__force unsigned int)ctx->mode;
5046e0d0be7STrond Myklebust 			__assign_str(name, ctx->dentry->d_name.name);
5056e0d0be7STrond Myklebust 		),
5066e0d0be7STrond Myklebust 
5076e0d0be7STrond Myklebust 		TP_printk(
5087d4006c1SChuck Lever 			"error=%ld (%s) flags=0x%lx (%s) fmode=%s "
5096e0d0be7STrond Myklebust 			"name=%02x:%02x:%llu/%s",
51038a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
5116e0d0be7STrond Myklebust 			__entry->flags,
5126e0d0be7STrond Myklebust 			show_open_flags(__entry->flags),
5136e0d0be7STrond Myklebust 			show_fmode_flags(__entry->fmode),
5146e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
5156e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
5166e0d0be7STrond Myklebust 			__get_str(name)
5176e0d0be7STrond Myklebust 		)
5186e0d0be7STrond Myklebust );
5196e0d0be7STrond Myklebust 
5208b0ad3d4STrond Myklebust TRACE_EVENT(nfs_create_enter,
5218b0ad3d4STrond Myklebust 		TP_PROTO(
5228b0ad3d4STrond Myklebust 			const struct inode *dir,
5238b0ad3d4STrond Myklebust 			const struct dentry *dentry,
5248b0ad3d4STrond Myklebust 			unsigned int flags
5258b0ad3d4STrond Myklebust 		),
5268b0ad3d4STrond Myklebust 
5278b0ad3d4STrond Myklebust 		TP_ARGS(dir, dentry, flags),
5288b0ad3d4STrond Myklebust 
5298b0ad3d4STrond Myklebust 		TP_STRUCT__entry(
5307d4006c1SChuck Lever 			__field(unsigned long, flags)
5318b0ad3d4STrond Myklebust 			__field(dev_t, dev)
5328b0ad3d4STrond Myklebust 			__field(u64, dir)
5338b0ad3d4STrond Myklebust 			__string(name, dentry->d_name.name)
5348b0ad3d4STrond Myklebust 		),
5358b0ad3d4STrond Myklebust 
5368b0ad3d4STrond Myklebust 		TP_fast_assign(
5378b0ad3d4STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
5388b0ad3d4STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
5398b0ad3d4STrond Myklebust 			__entry->flags = flags;
5408b0ad3d4STrond Myklebust 			__assign_str(name, dentry->d_name.name);
5418b0ad3d4STrond Myklebust 		),
5428b0ad3d4STrond Myklebust 
5438b0ad3d4STrond Myklebust 		TP_printk(
5447d4006c1SChuck Lever 			"flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
5458b0ad3d4STrond Myklebust 			__entry->flags,
5468b0ad3d4STrond Myklebust 			show_open_flags(__entry->flags),
5478b0ad3d4STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
5488b0ad3d4STrond Myklebust 			(unsigned long long)__entry->dir,
5498b0ad3d4STrond Myklebust 			__get_str(name)
5508b0ad3d4STrond Myklebust 		)
5518b0ad3d4STrond Myklebust );
5528b0ad3d4STrond Myklebust 
5538b0ad3d4STrond Myklebust TRACE_EVENT(nfs_create_exit,
5548b0ad3d4STrond Myklebust 		TP_PROTO(
5558b0ad3d4STrond Myklebust 			const struct inode *dir,
5568b0ad3d4STrond Myklebust 			const struct dentry *dentry,
5578b0ad3d4STrond Myklebust 			unsigned int flags,
5588b0ad3d4STrond Myklebust 			int error
5598b0ad3d4STrond Myklebust 		),
5608b0ad3d4STrond Myklebust 
5618b0ad3d4STrond Myklebust 		TP_ARGS(dir, dentry, flags, error),
5628b0ad3d4STrond Myklebust 
5638b0ad3d4STrond Myklebust 		TP_STRUCT__entry(
56438a638a7SChuck Lever 			__field(unsigned long, error)
5657d4006c1SChuck Lever 			__field(unsigned long, flags)
5668b0ad3d4STrond Myklebust 			__field(dev_t, dev)
5678b0ad3d4STrond Myklebust 			__field(u64, dir)
5688b0ad3d4STrond Myklebust 			__string(name, dentry->d_name.name)
5698b0ad3d4STrond Myklebust 		),
5708b0ad3d4STrond Myklebust 
5718b0ad3d4STrond Myklebust 		TP_fast_assign(
57238a638a7SChuck Lever 			__entry->error = -error;
5738b0ad3d4STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
5748b0ad3d4STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
5758b0ad3d4STrond Myklebust 			__entry->flags = flags;
5768b0ad3d4STrond Myklebust 			__assign_str(name, dentry->d_name.name);
5778b0ad3d4STrond Myklebust 		),
5788b0ad3d4STrond Myklebust 
5798b0ad3d4STrond Myklebust 		TP_printk(
5807d4006c1SChuck Lever 			"error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
58138a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
5828b0ad3d4STrond Myklebust 			__entry->flags,
5838b0ad3d4STrond Myklebust 			show_open_flags(__entry->flags),
5848b0ad3d4STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
5858b0ad3d4STrond Myklebust 			(unsigned long long)__entry->dir,
5868b0ad3d4STrond Myklebust 			__get_str(name)
5878b0ad3d4STrond Myklebust 		)
5888b0ad3d4STrond Myklebust );
5898b0ad3d4STrond Myklebust 
5901ca42382STrond Myklebust DECLARE_EVENT_CLASS(nfs_directory_event,
5911ca42382STrond Myklebust 		TP_PROTO(
5921ca42382STrond Myklebust 			const struct inode *dir,
5931ca42382STrond Myklebust 			const struct dentry *dentry
5941ca42382STrond Myklebust 		),
5951ca42382STrond Myklebust 
5961ca42382STrond Myklebust 		TP_ARGS(dir, dentry),
5971ca42382STrond Myklebust 
5981ca42382STrond Myklebust 		TP_STRUCT__entry(
5991ca42382STrond Myklebust 			__field(dev_t, dev)
6001ca42382STrond Myklebust 			__field(u64, dir)
6011ca42382STrond Myklebust 			__string(name, dentry->d_name.name)
6021ca42382STrond Myklebust 		),
6031ca42382STrond Myklebust 
6041ca42382STrond Myklebust 		TP_fast_assign(
6051ca42382STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
6061ca42382STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
6071ca42382STrond Myklebust 			__assign_str(name, dentry->d_name.name);
6081ca42382STrond Myklebust 		),
6091ca42382STrond Myklebust 
6101ca42382STrond Myklebust 		TP_printk(
6111ca42382STrond Myklebust 			"name=%02x:%02x:%llu/%s",
6121ca42382STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
6131ca42382STrond Myklebust 			(unsigned long long)__entry->dir,
6141ca42382STrond Myklebust 			__get_str(name)
6151ca42382STrond Myklebust 		)
6161ca42382STrond Myklebust );
6171ca42382STrond Myklebust 
6181ca42382STrond Myklebust #define DEFINE_NFS_DIRECTORY_EVENT(name) \
6191ca42382STrond Myklebust 	DEFINE_EVENT(nfs_directory_event, name, \
6201ca42382STrond Myklebust 			TP_PROTO( \
6211ca42382STrond Myklebust 				const struct inode *dir, \
6221ca42382STrond Myklebust 				const struct dentry *dentry \
6231ca42382STrond Myklebust 			), \
6241ca42382STrond Myklebust 			TP_ARGS(dir, dentry))
6251ca42382STrond Myklebust 
6261ca42382STrond Myklebust DECLARE_EVENT_CLASS(nfs_directory_event_done,
6271ca42382STrond Myklebust 		TP_PROTO(
6281ca42382STrond Myklebust 			const struct inode *dir,
6291ca42382STrond Myklebust 			const struct dentry *dentry,
6301ca42382STrond Myklebust 			int error
6311ca42382STrond Myklebust 		),
6321ca42382STrond Myklebust 
6331ca42382STrond Myklebust 		TP_ARGS(dir, dentry, error),
6341ca42382STrond Myklebust 
6351ca42382STrond Myklebust 		TP_STRUCT__entry(
63638a638a7SChuck Lever 			__field(unsigned long, error)
6371ca42382STrond Myklebust 			__field(dev_t, dev)
6381ca42382STrond Myklebust 			__field(u64, dir)
6391ca42382STrond Myklebust 			__string(name, dentry->d_name.name)
6401ca42382STrond Myklebust 		),
6411ca42382STrond Myklebust 
6421ca42382STrond Myklebust 		TP_fast_assign(
6431ca42382STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
6441ca42382STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
64538a638a7SChuck Lever 			__entry->error = error < 0 ? -error : 0;
6461ca42382STrond Myklebust 			__assign_str(name, dentry->d_name.name);
6471ca42382STrond Myklebust 		),
6481ca42382STrond Myklebust 
6491ca42382STrond Myklebust 		TP_printk(
65038a638a7SChuck Lever 			"error=%ld (%s) name=%02x:%02x:%llu/%s",
65138a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
6521ca42382STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
6531ca42382STrond Myklebust 			(unsigned long long)__entry->dir,
6541ca42382STrond Myklebust 			__get_str(name)
6551ca42382STrond Myklebust 		)
6561ca42382STrond Myklebust );
6571ca42382STrond Myklebust 
6581ca42382STrond Myklebust #define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \
6591ca42382STrond Myklebust 	DEFINE_EVENT(nfs_directory_event_done, name, \
6601ca42382STrond Myklebust 			TP_PROTO( \
6611ca42382STrond Myklebust 				const struct inode *dir, \
6621ca42382STrond Myklebust 				const struct dentry *dentry, \
6631ca42382STrond Myklebust 				int error \
6641ca42382STrond Myklebust 			), \
6651ca42382STrond Myklebust 			TP_ARGS(dir, dentry, error))
6661ca42382STrond Myklebust 
6671ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter);
6681ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit);
6691ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter);
6701ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit);
6711ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter);
6721ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit);
6731ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter);
6741ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit);
6751ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter);
6761ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit);
6771ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter);
6781ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit);
6791ca42382STrond Myklebust 
6801fd1085bSTrond Myklebust TRACE_EVENT(nfs_link_enter,
6811fd1085bSTrond Myklebust 		TP_PROTO(
6821fd1085bSTrond Myklebust 			const struct inode *inode,
6831fd1085bSTrond Myklebust 			const struct inode *dir,
6841fd1085bSTrond Myklebust 			const struct dentry *dentry
6851fd1085bSTrond Myklebust 		),
6861fd1085bSTrond Myklebust 
6871fd1085bSTrond Myklebust 		TP_ARGS(inode, dir, dentry),
6881fd1085bSTrond Myklebust 
6891fd1085bSTrond Myklebust 		TP_STRUCT__entry(
6901fd1085bSTrond Myklebust 			__field(dev_t, dev)
6911fd1085bSTrond Myklebust 			__field(u64, fileid)
6921fd1085bSTrond Myklebust 			__field(u64, dir)
6931fd1085bSTrond Myklebust 			__string(name, dentry->d_name.name)
6941fd1085bSTrond Myklebust 		),
6951fd1085bSTrond Myklebust 
6961fd1085bSTrond Myklebust 		TP_fast_assign(
6971fd1085bSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
6981fd1085bSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
6991fd1085bSTrond Myklebust 			__entry->dir = NFS_FILEID(dir);
7001fd1085bSTrond Myklebust 			__assign_str(name, dentry->d_name.name);
7011fd1085bSTrond Myklebust 		),
7021fd1085bSTrond Myklebust 
7031fd1085bSTrond Myklebust 		TP_printk(
7041fd1085bSTrond Myklebust 			"fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
7051fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
7061fd1085bSTrond Myklebust 			__entry->fileid,
7071fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
7081fd1085bSTrond Myklebust 			(unsigned long long)__entry->dir,
7091fd1085bSTrond Myklebust 			__get_str(name)
7101fd1085bSTrond Myklebust 		)
7111fd1085bSTrond Myklebust );
7121fd1085bSTrond Myklebust 
7131fd1085bSTrond Myklebust TRACE_EVENT(nfs_link_exit,
7141fd1085bSTrond Myklebust 		TP_PROTO(
7151fd1085bSTrond Myklebust 			const struct inode *inode,
7161fd1085bSTrond Myklebust 			const struct inode *dir,
7171fd1085bSTrond Myklebust 			const struct dentry *dentry,
7181fd1085bSTrond Myklebust 			int error
7191fd1085bSTrond Myklebust 		),
7201fd1085bSTrond Myklebust 
7211fd1085bSTrond Myklebust 		TP_ARGS(inode, dir, dentry, error),
7221fd1085bSTrond Myklebust 
7231fd1085bSTrond Myklebust 		TP_STRUCT__entry(
72438a638a7SChuck Lever 			__field(unsigned long, error)
7251fd1085bSTrond Myklebust 			__field(dev_t, dev)
7261fd1085bSTrond Myklebust 			__field(u64, fileid)
7271fd1085bSTrond Myklebust 			__field(u64, dir)
7281fd1085bSTrond Myklebust 			__string(name, dentry->d_name.name)
7291fd1085bSTrond Myklebust 		),
7301fd1085bSTrond Myklebust 
7311fd1085bSTrond Myklebust 		TP_fast_assign(
7321fd1085bSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
7331fd1085bSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
7341fd1085bSTrond Myklebust 			__entry->dir = NFS_FILEID(dir);
73538a638a7SChuck Lever 			__entry->error = error < 0 ? -error : 0;
7361fd1085bSTrond Myklebust 			__assign_str(name, dentry->d_name.name);
7371fd1085bSTrond Myklebust 		),
7381fd1085bSTrond Myklebust 
7391fd1085bSTrond Myklebust 		TP_printk(
74038a638a7SChuck Lever 			"error=%ld (%s) fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
74138a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
7421fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
7431fd1085bSTrond Myklebust 			__entry->fileid,
7441fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
7451fd1085bSTrond Myklebust 			(unsigned long long)__entry->dir,
7461fd1085bSTrond Myklebust 			__get_str(name)
7471fd1085bSTrond Myklebust 		)
7481fd1085bSTrond Myklebust );
7491fd1085bSTrond Myklebust 
75070ded201STrond Myklebust DECLARE_EVENT_CLASS(nfs_rename_event,
75170ded201STrond Myklebust 		TP_PROTO(
75270ded201STrond Myklebust 			const struct inode *old_dir,
75370ded201STrond Myklebust 			const struct dentry *old_dentry,
75470ded201STrond Myklebust 			const struct inode *new_dir,
75570ded201STrond Myklebust 			const struct dentry *new_dentry
75670ded201STrond Myklebust 		),
75770ded201STrond Myklebust 
75870ded201STrond Myklebust 		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry),
75970ded201STrond Myklebust 
76070ded201STrond Myklebust 		TP_STRUCT__entry(
76170ded201STrond Myklebust 			__field(dev_t, dev)
76270ded201STrond Myklebust 			__field(u64, old_dir)
76370ded201STrond Myklebust 			__field(u64, new_dir)
76470ded201STrond Myklebust 			__string(old_name, old_dentry->d_name.name)
76570ded201STrond Myklebust 			__string(new_name, new_dentry->d_name.name)
76670ded201STrond Myklebust 		),
76770ded201STrond Myklebust 
76870ded201STrond Myklebust 		TP_fast_assign(
76970ded201STrond Myklebust 			__entry->dev = old_dir->i_sb->s_dev;
77070ded201STrond Myklebust 			__entry->old_dir = NFS_FILEID(old_dir);
77170ded201STrond Myklebust 			__entry->new_dir = NFS_FILEID(new_dir);
77270ded201STrond Myklebust 			__assign_str(old_name, old_dentry->d_name.name);
77370ded201STrond Myklebust 			__assign_str(new_name, new_dentry->d_name.name);
77470ded201STrond Myklebust 		),
77570ded201STrond Myklebust 
77670ded201STrond Myklebust 		TP_printk(
77770ded201STrond Myklebust 			"old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s",
77870ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
77970ded201STrond Myklebust 			(unsigned long long)__entry->old_dir,
78070ded201STrond Myklebust 			__get_str(old_name),
78170ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
78270ded201STrond Myklebust 			(unsigned long long)__entry->new_dir,
78370ded201STrond Myklebust 			__get_str(new_name)
78470ded201STrond Myklebust 		)
78570ded201STrond Myklebust );
78670ded201STrond Myklebust #define DEFINE_NFS_RENAME_EVENT(name) \
78770ded201STrond Myklebust 	DEFINE_EVENT(nfs_rename_event, name, \
78870ded201STrond Myklebust 			TP_PROTO( \
78970ded201STrond Myklebust 				const struct inode *old_dir, \
79070ded201STrond Myklebust 				const struct dentry *old_dentry, \
79170ded201STrond Myklebust 				const struct inode *new_dir, \
79270ded201STrond Myklebust 				const struct dentry *new_dentry \
79370ded201STrond Myklebust 			), \
79470ded201STrond Myklebust 			TP_ARGS(old_dir, old_dentry, new_dir, new_dentry))
79570ded201STrond Myklebust 
79670ded201STrond Myklebust DECLARE_EVENT_CLASS(nfs_rename_event_done,
79770ded201STrond Myklebust 		TP_PROTO(
79870ded201STrond Myklebust 			const struct inode *old_dir,
79970ded201STrond Myklebust 			const struct dentry *old_dentry,
80070ded201STrond Myklebust 			const struct inode *new_dir,
80170ded201STrond Myklebust 			const struct dentry *new_dentry,
80270ded201STrond Myklebust 			int error
80370ded201STrond Myklebust 		),
80470ded201STrond Myklebust 
80570ded201STrond Myklebust 		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, error),
80670ded201STrond Myklebust 
80770ded201STrond Myklebust 		TP_STRUCT__entry(
80870ded201STrond Myklebust 			__field(dev_t, dev)
80938a638a7SChuck Lever 			__field(unsigned long, error)
81070ded201STrond Myklebust 			__field(u64, old_dir)
81170ded201STrond Myklebust 			__string(old_name, old_dentry->d_name.name)
81270ded201STrond Myklebust 			__field(u64, new_dir)
81370ded201STrond Myklebust 			__string(new_name, new_dentry->d_name.name)
81470ded201STrond Myklebust 		),
81570ded201STrond Myklebust 
81670ded201STrond Myklebust 		TP_fast_assign(
81770ded201STrond Myklebust 			__entry->dev = old_dir->i_sb->s_dev;
81838a638a7SChuck Lever 			__entry->error = -error;
81970ded201STrond Myklebust 			__entry->old_dir = NFS_FILEID(old_dir);
82070ded201STrond Myklebust 			__entry->new_dir = NFS_FILEID(new_dir);
82170ded201STrond Myklebust 			__assign_str(old_name, old_dentry->d_name.name);
82270ded201STrond Myklebust 			__assign_str(new_name, new_dentry->d_name.name);
82370ded201STrond Myklebust 		),
82470ded201STrond Myklebust 
82570ded201STrond Myklebust 		TP_printk(
82638a638a7SChuck Lever 			"error=%ld (%s) old_name=%02x:%02x:%llu/%s "
82770ded201STrond Myklebust 			"new_name=%02x:%02x:%llu/%s",
82838a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
82970ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
83070ded201STrond Myklebust 			(unsigned long long)__entry->old_dir,
83170ded201STrond Myklebust 			__get_str(old_name),
83270ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
83370ded201STrond Myklebust 			(unsigned long long)__entry->new_dir,
83470ded201STrond Myklebust 			__get_str(new_name)
83570ded201STrond Myklebust 		)
83670ded201STrond Myklebust );
83770ded201STrond Myklebust #define DEFINE_NFS_RENAME_EVENT_DONE(name) \
83870ded201STrond Myklebust 	DEFINE_EVENT(nfs_rename_event_done, name, \
83970ded201STrond Myklebust 			TP_PROTO( \
84070ded201STrond Myklebust 				const struct inode *old_dir, \
84170ded201STrond Myklebust 				const struct dentry *old_dentry, \
84270ded201STrond Myklebust 				const struct inode *new_dir, \
84370ded201STrond Myklebust 				const struct dentry *new_dentry, \
84470ded201STrond Myklebust 				int error \
84570ded201STrond Myklebust 			), \
84670ded201STrond Myklebust 			TP_ARGS(old_dir, old_dentry, new_dir, \
84770ded201STrond Myklebust 				new_dentry, error))
84870ded201STrond Myklebust 
84970ded201STrond Myklebust DEFINE_NFS_RENAME_EVENT(nfs_rename_enter);
85070ded201STrond Myklebust DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit);
85170ded201STrond Myklebust 
85270ded201STrond Myklebust DEFINE_NFS_RENAME_EVENT_DONE(nfs_sillyrename_rename);
85370ded201STrond Myklebust 
85470ded201STrond Myklebust TRACE_EVENT(nfs_sillyrename_unlink,
85570ded201STrond Myklebust 		TP_PROTO(
85670ded201STrond Myklebust 			const struct nfs_unlinkdata *data,
85770ded201STrond Myklebust 			int error
85870ded201STrond Myklebust 		),
85970ded201STrond Myklebust 
86070ded201STrond Myklebust 		TP_ARGS(data, error),
86170ded201STrond Myklebust 
86270ded201STrond Myklebust 		TP_STRUCT__entry(
86370ded201STrond Myklebust 			__field(dev_t, dev)
86438a638a7SChuck Lever 			__field(unsigned long, error)
86570ded201STrond Myklebust 			__field(u64, dir)
86670ded201STrond Myklebust 			__dynamic_array(char, name, data->args.name.len + 1)
86770ded201STrond Myklebust 		),
86870ded201STrond Myklebust 
86970ded201STrond Myklebust 		TP_fast_assign(
870884be175SAl Viro 			struct inode *dir = d_inode(data->dentry->d_parent);
87170ded201STrond Myklebust 			size_t len = data->args.name.len;
87270ded201STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
87370ded201STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
87438a638a7SChuck Lever 			__entry->error = -error;
875752d596bSDaniel Bristot de Oliveira 			memcpy(__get_str(name),
87670ded201STrond Myklebust 				data->args.name.name, len);
877752d596bSDaniel Bristot de Oliveira 			__get_str(name)[len] = 0;
87870ded201STrond Myklebust 		),
87970ded201STrond Myklebust 
88070ded201STrond Myklebust 		TP_printk(
88138a638a7SChuck Lever 			"error=%ld (%s) name=%02x:%02x:%llu/%s",
88238a638a7SChuck Lever 			-__entry->error, nfs_show_status(__entry->error),
88370ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
88470ded201STrond Myklebust 			(unsigned long long)__entry->dir,
88570ded201STrond Myklebust 			__get_str(name)
88670ded201STrond Myklebust 		)
88770ded201STrond Myklebust );
8888224b273SChuck Lever 
8898224b273SChuck Lever TRACE_EVENT(nfs_initiate_read,
8908224b273SChuck Lever 		TP_PROTO(
8912343172dSTrond Myklebust 			const struct nfs_pgio_header *hdr
8928224b273SChuck Lever 		),
8938224b273SChuck Lever 
8942343172dSTrond Myklebust 		TP_ARGS(hdr),
8958224b273SChuck Lever 
8968224b273SChuck Lever 		TP_STRUCT__entry(
8978224b273SChuck Lever 			__field(dev_t, dev)
8988224b273SChuck Lever 			__field(u32, fhandle)
8998224b273SChuck Lever 			__field(u64, fileid)
9002343172dSTrond Myklebust 			__field(loff_t, offset)
9012343172dSTrond Myklebust 			__field(u32, count)
9028224b273SChuck Lever 		),
9038224b273SChuck Lever 
9048224b273SChuck Lever 		TP_fast_assign(
9052343172dSTrond Myklebust 			const struct inode *inode = hdr->inode;
9068224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
9072343172dSTrond Myklebust 			const struct nfs_fh *fh = hdr->args.fh ?
9082343172dSTrond Myklebust 						  hdr->args.fh : &nfsi->fh;
9098224b273SChuck Lever 
9102343172dSTrond Myklebust 			__entry->offset = hdr->args.offset;
9112343172dSTrond Myklebust 			__entry->count = hdr->args.count;
9128224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
9138224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
9142343172dSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
9158224b273SChuck Lever 		),
9168224b273SChuck Lever 
9178224b273SChuck Lever 		TP_printk(
9188224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
9192343172dSTrond Myklebust 			"offset=%lld count=%u",
9208224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
9218224b273SChuck Lever 			(unsigned long long)__entry->fileid,
9228224b273SChuck Lever 			__entry->fhandle,
9232343172dSTrond Myklebust 			(long long)__entry->offset, __entry->count
9248224b273SChuck Lever 		)
9258224b273SChuck Lever );
9268224b273SChuck Lever 
9278224b273SChuck Lever TRACE_EVENT(nfs_readpage_done,
9288224b273SChuck Lever 		TP_PROTO(
9292343172dSTrond Myklebust 			const struct rpc_task *task,
9302343172dSTrond Myklebust 			const struct nfs_pgio_header *hdr
9318224b273SChuck Lever 		),
9328224b273SChuck Lever 
9332343172dSTrond Myklebust 		TP_ARGS(task, hdr),
9348224b273SChuck Lever 
9358224b273SChuck Lever 		TP_STRUCT__entry(
9368224b273SChuck Lever 			__field(dev_t, dev)
9378224b273SChuck Lever 			__field(u32, fhandle)
9388224b273SChuck Lever 			__field(u64, fileid)
9392343172dSTrond Myklebust 			__field(loff_t, offset)
9402343172dSTrond Myklebust 			__field(u32, arg_count)
9412343172dSTrond Myklebust 			__field(u32, res_count)
9422343172dSTrond Myklebust 			__field(bool, eof)
9432343172dSTrond Myklebust 			__field(int, status)
9448224b273SChuck Lever 		),
9458224b273SChuck Lever 
9468224b273SChuck Lever 		TP_fast_assign(
9472343172dSTrond Myklebust 			const struct inode *inode = hdr->inode;
9488224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
9492343172dSTrond Myklebust 			const struct nfs_fh *fh = hdr->args.fh ?
9502343172dSTrond Myklebust 						  hdr->args.fh : &nfsi->fh;
9518224b273SChuck Lever 
9522343172dSTrond Myklebust 			__entry->status = task->tk_status;
9532343172dSTrond Myklebust 			__entry->offset = hdr->args.offset;
9542343172dSTrond Myklebust 			__entry->arg_count = hdr->args.count;
9552343172dSTrond Myklebust 			__entry->res_count = hdr->res.count;
9562343172dSTrond Myklebust 			__entry->eof = hdr->res.eof;
9578224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
9588224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
9592343172dSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
9608224b273SChuck Lever 		),
9618224b273SChuck Lever 
9628224b273SChuck Lever 		TP_printk(
9638224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
9642343172dSTrond Myklebust 			"offset=%lld count=%u res=%u status=%d%s",
9658224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
9668224b273SChuck Lever 			(unsigned long long)__entry->fileid,
9678224b273SChuck Lever 			__entry->fhandle,
9682343172dSTrond Myklebust 			(long long)__entry->offset, __entry->arg_count,
9692343172dSTrond Myklebust 			__entry->res_count, __entry->status,
9708224b273SChuck Lever 			__entry->eof ? " eof" : ""
9718224b273SChuck Lever 		)
9728224b273SChuck Lever );
9738224b273SChuck Lever 
974fd2b6121SChuck Lever TRACE_EVENT(nfs_readpage_short,
975fd2b6121SChuck Lever 		TP_PROTO(
976fd2b6121SChuck Lever 			const struct rpc_task *task,
977fd2b6121SChuck Lever 			const struct nfs_pgio_header *hdr
978fd2b6121SChuck Lever 		),
979fd2b6121SChuck Lever 
980fd2b6121SChuck Lever 		TP_ARGS(task, hdr),
981fd2b6121SChuck Lever 
982fd2b6121SChuck Lever 		TP_STRUCT__entry(
983fd2b6121SChuck Lever 			__field(dev_t, dev)
984fd2b6121SChuck Lever 			__field(u32, fhandle)
985fd2b6121SChuck Lever 			__field(u64, fileid)
986fd2b6121SChuck Lever 			__field(loff_t, offset)
987fd2b6121SChuck Lever 			__field(u32, arg_count)
988fd2b6121SChuck Lever 			__field(u32, res_count)
989fd2b6121SChuck Lever 			__field(bool, eof)
990fd2b6121SChuck Lever 			__field(int, status)
991fd2b6121SChuck Lever 		),
992fd2b6121SChuck Lever 
993fd2b6121SChuck Lever 		TP_fast_assign(
994fd2b6121SChuck Lever 			const struct inode *inode = hdr->inode;
995fd2b6121SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
996fd2b6121SChuck Lever 			const struct nfs_fh *fh = hdr->args.fh ?
997fd2b6121SChuck Lever 						  hdr->args.fh : &nfsi->fh;
998fd2b6121SChuck Lever 
999fd2b6121SChuck Lever 			__entry->status = task->tk_status;
1000fd2b6121SChuck Lever 			__entry->offset = hdr->args.offset;
1001fd2b6121SChuck Lever 			__entry->arg_count = hdr->args.count;
1002fd2b6121SChuck Lever 			__entry->res_count = hdr->res.count;
1003fd2b6121SChuck Lever 			__entry->eof = hdr->res.eof;
1004fd2b6121SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
1005fd2b6121SChuck Lever 			__entry->fileid = nfsi->fileid;
1006fd2b6121SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(fh);
1007fd2b6121SChuck Lever 		),
1008fd2b6121SChuck Lever 
1009fd2b6121SChuck Lever 		TP_printk(
1010fd2b6121SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
1011fd2b6121SChuck Lever 			"offset=%lld count=%u res=%u status=%d%s",
1012fd2b6121SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
1013fd2b6121SChuck Lever 			(unsigned long long)__entry->fileid,
1014fd2b6121SChuck Lever 			__entry->fhandle,
1015fd2b6121SChuck Lever 			(long long)__entry->offset, __entry->arg_count,
1016fd2b6121SChuck Lever 			__entry->res_count, __entry->status,
1017fd2b6121SChuck Lever 			__entry->eof ? " eof" : ""
1018fd2b6121SChuck Lever 		)
1019fd2b6121SChuck Lever );
1020fd2b6121SChuck Lever 
1021cd2ed9bdSChuck Lever TRACE_EVENT(nfs_pgio_error,
1022cd2ed9bdSChuck Lever 	TP_PROTO(
1023cd2ed9bdSChuck Lever 		const struct nfs_pgio_header *hdr,
1024cd2ed9bdSChuck Lever 		int error,
1025cd2ed9bdSChuck Lever 		loff_t pos
1026cd2ed9bdSChuck Lever 	),
1027cd2ed9bdSChuck Lever 
1028cd2ed9bdSChuck Lever 	TP_ARGS(hdr, error, pos),
1029cd2ed9bdSChuck Lever 
1030cd2ed9bdSChuck Lever 	TP_STRUCT__entry(
1031cd2ed9bdSChuck Lever 		__field(dev_t, dev)
1032cd2ed9bdSChuck Lever 		__field(u32, fhandle)
1033cd2ed9bdSChuck Lever 		__field(u64, fileid)
1034cd2ed9bdSChuck Lever 		__field(loff_t, offset)
1035cd2ed9bdSChuck Lever 		__field(u32, arg_count)
1036cd2ed9bdSChuck Lever 		__field(u32, res_count)
1037cd2ed9bdSChuck Lever 		__field(loff_t, pos)
1038cd2ed9bdSChuck Lever 		__field(int, status)
1039cd2ed9bdSChuck Lever 	),
1040cd2ed9bdSChuck Lever 
1041cd2ed9bdSChuck Lever 	TP_fast_assign(
1042cd2ed9bdSChuck Lever 		const struct inode *inode = hdr->inode;
1043cd2ed9bdSChuck Lever 		const struct nfs_inode *nfsi = NFS_I(inode);
1044cd2ed9bdSChuck Lever 		const struct nfs_fh *fh = hdr->args.fh ?
1045cd2ed9bdSChuck Lever 					  hdr->args.fh : &nfsi->fh;
1046cd2ed9bdSChuck Lever 
1047cd2ed9bdSChuck Lever 		__entry->status = error;
1048cd2ed9bdSChuck Lever 		__entry->offset = hdr->args.offset;
1049cd2ed9bdSChuck Lever 		__entry->arg_count = hdr->args.count;
1050cd2ed9bdSChuck Lever 		__entry->res_count = hdr->res.count;
1051cd2ed9bdSChuck Lever 		__entry->dev = inode->i_sb->s_dev;
1052cd2ed9bdSChuck Lever 		__entry->fileid = nfsi->fileid;
1053cd2ed9bdSChuck Lever 		__entry->fhandle = nfs_fhandle_hash(fh);
1054cd2ed9bdSChuck Lever 	),
1055cd2ed9bdSChuck Lever 
1056cd2ed9bdSChuck Lever 	TP_printk("fileid=%02x:%02x:%llu fhandle=0x%08x "
1057cd2ed9bdSChuck Lever 		  "offset=%lld count=%u res=%u pos=%llu status=%d",
1058cd2ed9bdSChuck Lever 		MAJOR(__entry->dev), MINOR(__entry->dev),
1059cd2ed9bdSChuck Lever 		(unsigned long long)__entry->fileid, __entry->fhandle,
1060cd2ed9bdSChuck Lever 		(long long)__entry->offset, __entry->arg_count, __entry->res_count,
1061cd2ed9bdSChuck Lever 		__entry->pos, __entry->status
1062cd2ed9bdSChuck Lever 	)
1063cd2ed9bdSChuck Lever );
1064cd2ed9bdSChuck Lever 
106506e19024SChuck Lever TRACE_DEFINE_ENUM(NFS_UNSTABLE);
106606e19024SChuck Lever TRACE_DEFINE_ENUM(NFS_DATA_SYNC);
106706e19024SChuck Lever TRACE_DEFINE_ENUM(NFS_FILE_SYNC);
106806e19024SChuck Lever 
10698224b273SChuck Lever #define nfs_show_stable(stable) \
10708224b273SChuck Lever 	__print_symbolic(stable, \
107106e19024SChuck Lever 			{ NFS_UNSTABLE, "UNSTABLE" }, \
107206e19024SChuck Lever 			{ NFS_DATA_SYNC, "DATA_SYNC" }, \
107306e19024SChuck Lever 			{ NFS_FILE_SYNC, "FILE_SYNC" })
10748224b273SChuck Lever 
10758224b273SChuck Lever TRACE_EVENT(nfs_initiate_write,
10768224b273SChuck Lever 		TP_PROTO(
10775bb2a7cbSTrond Myklebust 			const struct nfs_pgio_header *hdr
10788224b273SChuck Lever 		),
10798224b273SChuck Lever 
10805bb2a7cbSTrond Myklebust 		TP_ARGS(hdr),
10818224b273SChuck Lever 
10828224b273SChuck Lever 		TP_STRUCT__entry(
10838224b273SChuck Lever 			__field(dev_t, dev)
10848224b273SChuck Lever 			__field(u32, fhandle)
10858224b273SChuck Lever 			__field(u64, fileid)
10865bb2a7cbSTrond Myklebust 			__field(loff_t, offset)
10875bb2a7cbSTrond Myklebust 			__field(u32, count)
10885bb2a7cbSTrond Myklebust 			__field(enum nfs3_stable_how, stable)
10898224b273SChuck Lever 		),
10908224b273SChuck Lever 
10918224b273SChuck Lever 		TP_fast_assign(
10925bb2a7cbSTrond Myklebust 			const struct inode *inode = hdr->inode;
10938224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
10945bb2a7cbSTrond Myklebust 			const struct nfs_fh *fh = hdr->args.fh ?
10955bb2a7cbSTrond Myklebust 						  hdr->args.fh : &nfsi->fh;
10968224b273SChuck Lever 
10975bb2a7cbSTrond Myklebust 			__entry->offset = hdr->args.offset;
10985bb2a7cbSTrond Myklebust 			__entry->count = hdr->args.count;
10995bb2a7cbSTrond Myklebust 			__entry->stable = hdr->args.stable;
11008224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
11018224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
11025bb2a7cbSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
11038224b273SChuck Lever 		),
11048224b273SChuck Lever 
11058224b273SChuck Lever 		TP_printk(
11068224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
11075bb2a7cbSTrond Myklebust 			"offset=%lld count=%u stable=%s",
11088224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
11098224b273SChuck Lever 			(unsigned long long)__entry->fileid,
11108224b273SChuck Lever 			__entry->fhandle,
11115bb2a7cbSTrond Myklebust 			(long long)__entry->offset, __entry->count,
111206e19024SChuck Lever 			nfs_show_stable(__entry->stable)
11138224b273SChuck Lever 		)
11148224b273SChuck Lever );
11158224b273SChuck Lever 
11168224b273SChuck Lever TRACE_EVENT(nfs_writeback_done,
11178224b273SChuck Lever 		TP_PROTO(
11185bb2a7cbSTrond Myklebust 			const struct rpc_task *task,
11195bb2a7cbSTrond Myklebust 			const struct nfs_pgio_header *hdr
11208224b273SChuck Lever 		),
11218224b273SChuck Lever 
11225bb2a7cbSTrond Myklebust 		TP_ARGS(task, hdr),
11238224b273SChuck Lever 
11248224b273SChuck Lever 		TP_STRUCT__entry(
11258224b273SChuck Lever 			__field(dev_t, dev)
11268224b273SChuck Lever 			__field(u32, fhandle)
11278224b273SChuck Lever 			__field(u64, fileid)
11285bb2a7cbSTrond Myklebust 			__field(loff_t, offset)
11295bb2a7cbSTrond Myklebust 			__field(u32, arg_count)
11305bb2a7cbSTrond Myklebust 			__field(u32, res_count)
11315bb2a7cbSTrond Myklebust 			__field(int, status)
11325bb2a7cbSTrond Myklebust 			__field(enum nfs3_stable_how, stable)
11335bb2a7cbSTrond Myklebust 			__array(char, verifier, NFS4_VERIFIER_SIZE)
11348224b273SChuck Lever 		),
11358224b273SChuck Lever 
11368224b273SChuck Lever 		TP_fast_assign(
11375bb2a7cbSTrond Myklebust 			const struct inode *inode = hdr->inode;
11388224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
11395bb2a7cbSTrond Myklebust 			const struct nfs_fh *fh = hdr->args.fh ?
11405bb2a7cbSTrond Myklebust 						  hdr->args.fh : &nfsi->fh;
11415bb2a7cbSTrond Myklebust 			const struct nfs_writeverf *verf = hdr->res.verf;
11428224b273SChuck Lever 
11435bb2a7cbSTrond Myklebust 			__entry->status = task->tk_status;
11445bb2a7cbSTrond Myklebust 			__entry->offset = hdr->args.offset;
11455bb2a7cbSTrond Myklebust 			__entry->arg_count = hdr->args.count;
11465bb2a7cbSTrond Myklebust 			__entry->res_count = hdr->res.count;
11475bb2a7cbSTrond Myklebust 			__entry->stable = verf->committed;
11485bb2a7cbSTrond Myklebust 			memcpy(__entry->verifier,
11495bb2a7cbSTrond Myklebust 				&verf->verifier,
11505bb2a7cbSTrond Myklebust 				NFS4_VERIFIER_SIZE);
11518224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
11528224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
11535bb2a7cbSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
11548224b273SChuck Lever 		),
11558224b273SChuck Lever 
11568224b273SChuck Lever 		TP_printk(
11578224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
11585bb2a7cbSTrond Myklebust 			"offset=%lld count=%u res=%u status=%d stable=%s "
11595bb2a7cbSTrond Myklebust 			"verifier=%s",
11608224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
11618224b273SChuck Lever 			(unsigned long long)__entry->fileid,
11628224b273SChuck Lever 			__entry->fhandle,
11635bb2a7cbSTrond Myklebust 			(long long)__entry->offset, __entry->arg_count,
11645bb2a7cbSTrond Myklebust 			__entry->res_count, __entry->status,
116506e19024SChuck Lever 			nfs_show_stable(__entry->stable),
11665bb2a7cbSTrond Myklebust 			__print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE)
11678224b273SChuck Lever 		)
11688224b273SChuck Lever );
11698224b273SChuck Lever 
1170861e1671SChuck Lever DECLARE_EVENT_CLASS(nfs_page_error_class,
1171861e1671SChuck Lever 		TP_PROTO(
1172861e1671SChuck Lever 			const struct nfs_page *req,
1173861e1671SChuck Lever 			int error
1174861e1671SChuck Lever 		),
1175861e1671SChuck Lever 
1176861e1671SChuck Lever 		TP_ARGS(req, error),
1177861e1671SChuck Lever 
1178861e1671SChuck Lever 		TP_STRUCT__entry(
1179861e1671SChuck Lever 			__field(const void *, req)
1180861e1671SChuck Lever 			__field(pgoff_t, index)
1181861e1671SChuck Lever 			__field(unsigned int, offset)
1182861e1671SChuck Lever 			__field(unsigned int, pgbase)
1183861e1671SChuck Lever 			__field(unsigned int, bytes)
1184861e1671SChuck Lever 			__field(int, error)
1185861e1671SChuck Lever 		),
1186861e1671SChuck Lever 
1187861e1671SChuck Lever 		TP_fast_assign(
1188861e1671SChuck Lever 			__entry->req = req;
1189861e1671SChuck Lever 			__entry->index = req->wb_index;
1190861e1671SChuck Lever 			__entry->offset = req->wb_offset;
1191861e1671SChuck Lever 			__entry->pgbase = req->wb_pgbase;
1192861e1671SChuck Lever 			__entry->bytes = req->wb_bytes;
1193861e1671SChuck Lever 			__entry->error = error;
1194861e1671SChuck Lever 		),
1195861e1671SChuck Lever 
1196861e1671SChuck Lever 		TP_printk(
1197861e1671SChuck Lever 			"req=%p index=%lu offset=%u pgbase=%u bytes=%u error=%d",
1198861e1671SChuck Lever 			__entry->req, __entry->index, __entry->offset,
1199861e1671SChuck Lever 			__entry->pgbase, __entry->bytes, __entry->error
1200861e1671SChuck Lever 		)
1201861e1671SChuck Lever );
1202861e1671SChuck Lever 
1203861e1671SChuck Lever #define DEFINE_NFS_PAGEERR_EVENT(name) \
1204861e1671SChuck Lever 	DEFINE_EVENT(nfs_page_error_class, name, \
1205861e1671SChuck Lever 			TP_PROTO( \
1206861e1671SChuck Lever 				const struct nfs_page *req, \
1207861e1671SChuck Lever 				int error \
1208861e1671SChuck Lever 			), \
1209861e1671SChuck Lever 			TP_ARGS(req, error))
1210861e1671SChuck Lever 
1211861e1671SChuck Lever DEFINE_NFS_PAGEERR_EVENT(nfs_write_error);
1212861e1671SChuck Lever DEFINE_NFS_PAGEERR_EVENT(nfs_comp_error);
1213861e1671SChuck Lever DEFINE_NFS_PAGEERR_EVENT(nfs_commit_error);
1214861e1671SChuck Lever 
12158224b273SChuck Lever TRACE_EVENT(nfs_initiate_commit,
12168224b273SChuck Lever 		TP_PROTO(
12178224b273SChuck Lever 			const struct nfs_commit_data *data
12188224b273SChuck Lever 		),
12198224b273SChuck Lever 
12208224b273SChuck Lever 		TP_ARGS(data),
12218224b273SChuck Lever 
12228224b273SChuck Lever 		TP_STRUCT__entry(
12238224b273SChuck Lever 			__field(dev_t, dev)
12248224b273SChuck Lever 			__field(u32, fhandle)
12258224b273SChuck Lever 			__field(u64, fileid)
12267bdd297eSTrond Myklebust 			__field(loff_t, offset)
12277bdd297eSTrond Myklebust 			__field(u32, count)
12288224b273SChuck Lever 		),
12298224b273SChuck Lever 
12308224b273SChuck Lever 		TP_fast_assign(
12318224b273SChuck Lever 			const struct inode *inode = data->inode;
12328224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
12337bdd297eSTrond Myklebust 			const struct nfs_fh *fh = data->args.fh ?
12347bdd297eSTrond Myklebust 						  data->args.fh : &nfsi->fh;
12358224b273SChuck Lever 
12368224b273SChuck Lever 			__entry->offset = data->args.offset;
12378224b273SChuck Lever 			__entry->count = data->args.count;
12388224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
12398224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
12407bdd297eSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
12418224b273SChuck Lever 		),
12428224b273SChuck Lever 
12438224b273SChuck Lever 		TP_printk(
12448224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
12457bdd297eSTrond Myklebust 			"offset=%lld count=%u",
12468224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
12478224b273SChuck Lever 			(unsigned long long)__entry->fileid,
12488224b273SChuck Lever 			__entry->fhandle,
12497bdd297eSTrond Myklebust 			(long long)__entry->offset, __entry->count
12508224b273SChuck Lever 		)
12518224b273SChuck Lever );
12528224b273SChuck Lever 
12538224b273SChuck Lever TRACE_EVENT(nfs_commit_done,
12548224b273SChuck Lever 		TP_PROTO(
12557bdd297eSTrond Myklebust 			const struct rpc_task *task,
12568224b273SChuck Lever 			const struct nfs_commit_data *data
12578224b273SChuck Lever 		),
12588224b273SChuck Lever 
12597bdd297eSTrond Myklebust 		TP_ARGS(task, data),
12608224b273SChuck Lever 
12618224b273SChuck Lever 		TP_STRUCT__entry(
12628224b273SChuck Lever 			__field(dev_t, dev)
12638224b273SChuck Lever 			__field(u32, fhandle)
12648224b273SChuck Lever 			__field(u64, fileid)
12657bdd297eSTrond Myklebust 			__field(loff_t, offset)
12667bdd297eSTrond Myklebust 			__field(int, status)
12677bdd297eSTrond Myklebust 			__field(enum nfs3_stable_how, stable)
12687bdd297eSTrond Myklebust 			__array(char, verifier, NFS4_VERIFIER_SIZE)
12698224b273SChuck Lever 		),
12708224b273SChuck Lever 
12718224b273SChuck Lever 		TP_fast_assign(
12728224b273SChuck Lever 			const struct inode *inode = data->inode;
12738224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
12747bdd297eSTrond Myklebust 			const struct nfs_fh *fh = data->args.fh ?
12757bdd297eSTrond Myklebust 						  data->args.fh : &nfsi->fh;
12767bdd297eSTrond Myklebust 			const struct nfs_writeverf *verf = data->res.verf;
12778224b273SChuck Lever 
12787bdd297eSTrond Myklebust 			__entry->status = task->tk_status;
12798224b273SChuck Lever 			__entry->offset = data->args.offset;
12807bdd297eSTrond Myklebust 			__entry->stable = verf->committed;
12817bdd297eSTrond Myklebust 			memcpy(__entry->verifier,
12827bdd297eSTrond Myklebust 				&verf->verifier,
12837bdd297eSTrond Myklebust 				NFS4_VERIFIER_SIZE);
12848224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
12858224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
12867bdd297eSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
12878224b273SChuck Lever 		),
12888224b273SChuck Lever 
12898224b273SChuck Lever 		TP_printk(
12908224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
12917bdd297eSTrond Myklebust 			"offset=%lld status=%d stable=%s verifier=%s",
12928224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
12938224b273SChuck Lever 			(unsigned long long)__entry->fileid,
12948224b273SChuck Lever 			__entry->fhandle,
12957bdd297eSTrond Myklebust 			(long long)__entry->offset, __entry->status,
12967bdd297eSTrond Myklebust 			nfs_show_stable(__entry->stable),
12977bdd297eSTrond Myklebust 			__print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE)
12988224b273SChuck Lever 		)
12998224b273SChuck Lever );
13008224b273SChuck Lever 
130143622eabSTrond Myklebust TRACE_EVENT(nfs_fh_to_dentry,
130243622eabSTrond Myklebust 		TP_PROTO(
130343622eabSTrond Myklebust 			const struct super_block *sb,
130443622eabSTrond Myklebust 			const struct nfs_fh *fh,
130543622eabSTrond Myklebust 			u64 fileid,
130643622eabSTrond Myklebust 			int error
130743622eabSTrond Myklebust 		),
130843622eabSTrond Myklebust 
130943622eabSTrond Myklebust 		TP_ARGS(sb, fh, fileid, error),
131043622eabSTrond Myklebust 
131143622eabSTrond Myklebust 		TP_STRUCT__entry(
131243622eabSTrond Myklebust 			__field(int, error)
131343622eabSTrond Myklebust 			__field(dev_t, dev)
131443622eabSTrond Myklebust 			__field(u32, fhandle)
131543622eabSTrond Myklebust 			__field(u64, fileid)
131643622eabSTrond Myklebust 		),
131743622eabSTrond Myklebust 
131843622eabSTrond Myklebust 		TP_fast_assign(
131943622eabSTrond Myklebust 			__entry->error = error;
132043622eabSTrond Myklebust 			__entry->dev = sb->s_dev;
132143622eabSTrond Myklebust 			__entry->fileid = fileid;
132243622eabSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
132343622eabSTrond Myklebust 		),
132443622eabSTrond Myklebust 
132543622eabSTrond Myklebust 		TP_printk(
132643622eabSTrond Myklebust 			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x ",
132743622eabSTrond Myklebust 			__entry->error,
132843622eabSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
132943622eabSTrond Myklebust 			(unsigned long long)__entry->fileid,
133043622eabSTrond Myklebust 			__entry->fhandle
133143622eabSTrond Myklebust 		)
133243622eabSTrond Myklebust );
133343622eabSTrond Myklebust 
1334f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFS_OK);
1335f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_PERM);
1336f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NOENT);
1337f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_IO);
1338f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NXIO);
133938a638a7SChuck Lever TRACE_DEFINE_ENUM(ECHILD);
134038a638a7SChuck Lever TRACE_DEFINE_ENUM(NFSERR_EAGAIN);
1341f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_ACCES);
1342f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_EXIST);
1343f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_XDEV);
1344f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NODEV);
1345f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NOTDIR);
1346f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_ISDIR);
1347f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_INVAL);
1348f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_FBIG);
1349f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NOSPC);
1350f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_ROFS);
1351f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_MLINK);
135238a638a7SChuck Lever TRACE_DEFINE_ENUM(NFSERR_OPNOTSUPP);
1353f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NAMETOOLONG);
1354f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NOTEMPTY);
1355f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_DQUOT);
1356f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_STALE);
1357f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_REMOTE);
1358f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_WFLUSH);
1359f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_BADHANDLE);
1360f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NOT_SYNC);
1361f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_BAD_COOKIE);
1362f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_NOTSUPP);
1363f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_TOOSMALL);
1364f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_SERVERFAULT);
1365f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_BADTYPE);
1366f23f6584SChuck Lever TRACE_DEFINE_ENUM(NFSERR_JUKEBOX);
1367f23f6584SChuck Lever 
1368f23f6584SChuck Lever #define nfs_show_status(x) \
1369f23f6584SChuck Lever 	__print_symbolic(x, \
1370f23f6584SChuck Lever 			{ NFS_OK, "OK" }, \
1371f23f6584SChuck Lever 			{ NFSERR_PERM, "PERM" }, \
1372f23f6584SChuck Lever 			{ NFSERR_NOENT, "NOENT" }, \
1373f23f6584SChuck Lever 			{ NFSERR_IO, "IO" }, \
1374f23f6584SChuck Lever 			{ NFSERR_NXIO, "NXIO" }, \
137538a638a7SChuck Lever 			{ ECHILD, "CHILD" }, \
137638a638a7SChuck Lever 			{ NFSERR_EAGAIN, "AGAIN" }, \
1377f23f6584SChuck Lever 			{ NFSERR_ACCES, "ACCES" }, \
1378f23f6584SChuck Lever 			{ NFSERR_EXIST, "EXIST" }, \
1379f23f6584SChuck Lever 			{ NFSERR_XDEV, "XDEV" }, \
1380f23f6584SChuck Lever 			{ NFSERR_NODEV, "NODEV" }, \
1381f23f6584SChuck Lever 			{ NFSERR_NOTDIR, "NOTDIR" }, \
1382f23f6584SChuck Lever 			{ NFSERR_ISDIR, "ISDIR" }, \
1383f23f6584SChuck Lever 			{ NFSERR_INVAL, "INVAL" }, \
1384f23f6584SChuck Lever 			{ NFSERR_FBIG, "FBIG" }, \
1385f23f6584SChuck Lever 			{ NFSERR_NOSPC, "NOSPC" }, \
1386f23f6584SChuck Lever 			{ NFSERR_ROFS, "ROFS" }, \
1387f23f6584SChuck Lever 			{ NFSERR_MLINK, "MLINK" }, \
138838a638a7SChuck Lever 			{ NFSERR_OPNOTSUPP, "OPNOTSUPP" }, \
1389f23f6584SChuck Lever 			{ NFSERR_NAMETOOLONG, "NAMETOOLONG" }, \
1390f23f6584SChuck Lever 			{ NFSERR_NOTEMPTY, "NOTEMPTY" }, \
1391f23f6584SChuck Lever 			{ NFSERR_DQUOT, "DQUOT" }, \
1392f23f6584SChuck Lever 			{ NFSERR_STALE, "STALE" }, \
1393f23f6584SChuck Lever 			{ NFSERR_REMOTE, "REMOTE" }, \
1394f23f6584SChuck Lever 			{ NFSERR_WFLUSH, "WFLUSH" }, \
1395f23f6584SChuck Lever 			{ NFSERR_BADHANDLE, "BADHANDLE" }, \
1396f23f6584SChuck Lever 			{ NFSERR_NOT_SYNC, "NOTSYNC" }, \
1397f23f6584SChuck Lever 			{ NFSERR_BAD_COOKIE, "BADCOOKIE" }, \
1398f23f6584SChuck Lever 			{ NFSERR_NOTSUPP, "NOTSUPP" }, \
1399f23f6584SChuck Lever 			{ NFSERR_TOOSMALL, "TOOSMALL" }, \
1400f23f6584SChuck Lever 			{ NFSERR_SERVERFAULT, "REMOTEIO" }, \
1401f23f6584SChuck Lever 			{ NFSERR_BADTYPE, "BADTYPE" }, \
1402f23f6584SChuck Lever 			{ NFSERR_JUKEBOX, "JUKEBOX" })
1403f23f6584SChuck Lever 
14043d66bae1STrond Myklebust DECLARE_EVENT_CLASS(nfs_xdr_event,
1405f23f6584SChuck Lever 		TP_PROTO(
140662a92ba9SChuck Lever 			const struct xdr_stream *xdr,
1407f23f6584SChuck Lever 			int error
1408f23f6584SChuck Lever 		),
1409f23f6584SChuck Lever 
141062a92ba9SChuck Lever 		TP_ARGS(xdr, error),
1411f23f6584SChuck Lever 
1412f23f6584SChuck Lever 		TP_STRUCT__entry(
141362a92ba9SChuck Lever 			__field(unsigned int, task_id)
141462a92ba9SChuck Lever 			__field(unsigned int, client_id)
141562a92ba9SChuck Lever 			__field(u32, xid)
14165be59458SChuck Lever 			__field(int, version)
141738a638a7SChuck Lever 			__field(unsigned long, error)
14185be59458SChuck Lever 			__string(program,
14195be59458SChuck Lever 				 xdr->rqst->rq_task->tk_client->cl_program->name)
14205be59458SChuck Lever 			__string(procedure,
14215be59458SChuck Lever 				 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
1422f23f6584SChuck Lever 		),
1423f23f6584SChuck Lever 
1424f23f6584SChuck Lever 		TP_fast_assign(
142562a92ba9SChuck Lever 			const struct rpc_rqst *rqstp = xdr->rqst;
142662a92ba9SChuck Lever 			const struct rpc_task *task = rqstp->rq_task;
142762a92ba9SChuck Lever 
142862a92ba9SChuck Lever 			__entry->task_id = task->tk_pid;
142962a92ba9SChuck Lever 			__entry->client_id = task->tk_client->cl_clid;
143062a92ba9SChuck Lever 			__entry->xid = be32_to_cpu(rqstp->rq_xid);
14315be59458SChuck Lever 			__entry->version = task->tk_client->cl_vers;
1432f23f6584SChuck Lever 			__entry->error = error;
14335be59458SChuck Lever 			__assign_str(program,
1434*78c14b38SJoe Perches 				     task->tk_client->cl_program->name);
1435*78c14b38SJoe Perches 			__assign_str(procedure, task->tk_msg.rpc_proc->p_name);
1436f23f6584SChuck Lever 		),
1437f23f6584SChuck Lever 
1438f23f6584SChuck Lever 		TP_printk(
14395be59458SChuck Lever 			"task:%u@%d xid=0x%08x %sv%d %s error=%ld (%s)",
144062a92ba9SChuck Lever 			__entry->task_id, __entry->client_id, __entry->xid,
14415be59458SChuck Lever 			__get_str(program), __entry->version,
14425be59458SChuck Lever 			__get_str(procedure), -__entry->error,
14435be59458SChuck Lever 			nfs_show_status(__entry->error)
1444f23f6584SChuck Lever 		)
1445f23f6584SChuck Lever );
14463d66bae1STrond Myklebust #define DEFINE_NFS_XDR_EVENT(name) \
14473d66bae1STrond Myklebust 	DEFINE_EVENT(nfs_xdr_event, name, \
14483d66bae1STrond Myklebust 			TP_PROTO( \
14493d66bae1STrond Myklebust 				const struct xdr_stream *xdr, \
14503d66bae1STrond Myklebust 				int error \
14513d66bae1STrond Myklebust 			), \
14523d66bae1STrond Myklebust 			TP_ARGS(xdr, error))
14533d66bae1STrond Myklebust DEFINE_NFS_XDR_EVENT(nfs_xdr_status);
1454eb3d58c6STrond Myklebust DEFINE_NFS_XDR_EVENT(nfs_xdr_bad_filehandle);
1455f23f6584SChuck Lever 
1456f4ce1299STrond Myklebust #endif /* _TRACE_NFS_H */
1457f4ce1299STrond Myklebust 
1458f4ce1299STrond Myklebust #undef TRACE_INCLUDE_PATH
1459f4ce1299STrond Myklebust #define TRACE_INCLUDE_PATH .
1460f4ce1299STrond Myklebust #define TRACE_INCLUDE_FILE nfstrace
1461f4ce1299STrond Myklebust /* This part must be outside protection */
1462f4ce1299STrond Myklebust #include <trace/define_trace.h>
1463