xref: /linux/fs/nfs/nfstrace.h (revision 684a64bf32b6e488004e0ad7f0d7e922798f65b6)
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 
14247c01ffSChuck Lever #include <trace/misc/fs.h>
15247c01ffSChuck Lever #include <trace/misc/nfs.h>
16247c01ffSChuck Lever #include <trace/misc/sunrpc.h>
17b4776a34SChuck Lever 
18f4ce1299STrond Myklebust #define nfs_show_cache_validity(v) \
19f4ce1299STrond Myklebust 	__print_flags(v, "|", \
20f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
21f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
22f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
23f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
24f4ce1299STrond Myklebust 			{ NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
257d4006c1SChuck Lever 			{ NFS_INO_INVALID_LABEL, "INVALID_LABEL" }, \
267d4006c1SChuck Lever 			{ NFS_INO_INVALID_CHANGE, "INVALID_CHANGE" }, \
277d4006c1SChuck Lever 			{ NFS_INO_INVALID_CTIME, "INVALID_CTIME" }, \
287d4006c1SChuck Lever 			{ NFS_INO_INVALID_MTIME, "INVALID_MTIME" }, \
297d4006c1SChuck Lever 			{ NFS_INO_INVALID_SIZE, "INVALID_SIZE" }, \
300f44da51SFrank van der Linden 			{ NFS_INO_INVALID_OTHER, "INVALID_OTHER" }, \
318a27c7ccSTrond Myklebust 			{ NFS_INO_DATA_INVAL_DEFER, "DATA_INVAL_DEFER" }, \
328a27c7ccSTrond Myklebust 			{ NFS_INO_INVALID_BLOCKS, "INVALID_BLOCKS" }, \
33fabf2b34STrond Myklebust 			{ NFS_INO_INVALID_XATTR, "INVALID_XATTR" }, \
34720869ebSTrond Myklebust 			{ NFS_INO_INVALID_NLINK, "INVALID_NLINK" }, \
35720869ebSTrond Myklebust 			{ NFS_INO_INVALID_MODE, "INVALID_MODE" })
367d4006c1SChuck Lever 
37f4ce1299STrond Myklebust #define nfs_show_nfsi_flags(v) \
38f4ce1299STrond Myklebust 	__print_flags(v, "|", \
397d4006c1SChuck Lever 			{ BIT(NFS_INO_STALE), "STALE" }, \
407d4006c1SChuck Lever 			{ BIT(NFS_INO_ACL_LRU_SET), "ACL_LRU_SET" }, \
417d4006c1SChuck Lever 			{ BIT(NFS_INO_INVALIDATING), "INVALIDATING" }, \
427d4006c1SChuck Lever 			{ BIT(NFS_INO_LAYOUTCOMMIT), "NEED_LAYOUTCOMMIT" }, \
437d4006c1SChuck Lever 			{ BIT(NFS_INO_LAYOUTCOMMITTING), "LAYOUTCOMMIT" }, \
447d4006c1SChuck Lever 			{ BIT(NFS_INO_LAYOUTSTATS), "LAYOUTSTATS" }, \
457d4006c1SChuck Lever 			{ BIT(NFS_INO_ODIRECT), "ODIRECT" })
46f4ce1299STrond Myklebust 
47f4ce1299STrond Myklebust DECLARE_EVENT_CLASS(nfs_inode_event,
48f4ce1299STrond Myklebust 		TP_PROTO(
49f4ce1299STrond Myklebust 			const struct inode *inode
50f4ce1299STrond Myklebust 		),
51f4ce1299STrond Myklebust 
52f4ce1299STrond Myklebust 		TP_ARGS(inode),
53f4ce1299STrond Myklebust 
54f4ce1299STrond Myklebust 		TP_STRUCT__entry(
55f4ce1299STrond Myklebust 			__field(dev_t, dev)
56f4ce1299STrond Myklebust 			__field(u32, fhandle)
57f4ce1299STrond Myklebust 			__field(u64, fileid)
58f4ce1299STrond Myklebust 			__field(u64, version)
59f4ce1299STrond Myklebust 		),
60f4ce1299STrond Myklebust 
61f4ce1299STrond Myklebust 		TP_fast_assign(
62f4ce1299STrond Myklebust 			const struct nfs_inode *nfsi = NFS_I(inode);
63f4ce1299STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
64f4ce1299STrond Myklebust 			__entry->fileid = nfsi->fileid;
65f4ce1299STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
661eb5d98fSJeff Layton 			__entry->version = inode_peek_iversion_raw(inode);
67f4ce1299STrond Myklebust 		),
68f4ce1299STrond Myklebust 
69f4ce1299STrond Myklebust 		TP_printk(
70f4ce1299STrond Myklebust 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
71f4ce1299STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
72f4ce1299STrond Myklebust 			(unsigned long long)__entry->fileid,
73f4ce1299STrond Myklebust 			__entry->fhandle,
74f4ce1299STrond Myklebust 			(unsigned long long)__entry->version
75f4ce1299STrond Myklebust 		)
76f4ce1299STrond Myklebust );
77f4ce1299STrond Myklebust 
78f4ce1299STrond Myklebust DECLARE_EVENT_CLASS(nfs_inode_event_done,
79f4ce1299STrond Myklebust 		TP_PROTO(
80f4ce1299STrond Myklebust 			const struct inode *inode,
81f4ce1299STrond Myklebust 			int error
82f4ce1299STrond Myklebust 		),
83f4ce1299STrond Myklebust 
84f4ce1299STrond Myklebust 		TP_ARGS(inode, error),
85f4ce1299STrond Myklebust 
86f4ce1299STrond Myklebust 		TP_STRUCT__entry(
8738a638a7SChuck Lever 			__field(unsigned long, error)
88f4ce1299STrond Myklebust 			__field(dev_t, dev)
89f4ce1299STrond Myklebust 			__field(u32, fhandle)
90f4ce1299STrond Myklebust 			__field(unsigned char, type)
91f4ce1299STrond Myklebust 			__field(u64, fileid)
92f4ce1299STrond Myklebust 			__field(u64, version)
93f4ce1299STrond Myklebust 			__field(loff_t, size)
94f4ce1299STrond Myklebust 			__field(unsigned long, nfsi_flags)
95f4ce1299STrond Myklebust 			__field(unsigned long, cache_validity)
96f4ce1299STrond Myklebust 		),
97f4ce1299STrond Myklebust 
98f4ce1299STrond Myklebust 		TP_fast_assign(
99f4ce1299STrond Myklebust 			const struct nfs_inode *nfsi = NFS_I(inode);
10038a638a7SChuck Lever 			__entry->error = error < 0 ? -error : 0;
101f4ce1299STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
102f4ce1299STrond Myklebust 			__entry->fileid = nfsi->fileid;
103f4ce1299STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
104f4ce1299STrond Myklebust 			__entry->type = nfs_umode_to_dtype(inode->i_mode);
1051eb5d98fSJeff Layton 			__entry->version = inode_peek_iversion_raw(inode);
106f4ce1299STrond Myklebust 			__entry->size = i_size_read(inode);
107f4ce1299STrond Myklebust 			__entry->nfsi_flags = nfsi->flags;
108f4ce1299STrond Myklebust 			__entry->cache_validity = nfsi->cache_validity;
109f4ce1299STrond Myklebust 		),
110f4ce1299STrond Myklebust 
111f4ce1299STrond Myklebust 		TP_printk(
11238a638a7SChuck Lever 			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
113f4ce1299STrond Myklebust 			"type=%u (%s) version=%llu size=%lld "
1147d4006c1SChuck Lever 			"cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s)",
1158791545eSChuck Lever 			-__entry->error, show_nfs_status(__entry->error),
116f4ce1299STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
117f4ce1299STrond Myklebust 			(unsigned long long)__entry->fileid,
118f4ce1299STrond Myklebust 			__entry->fhandle,
119f4ce1299STrond Myklebust 			__entry->type,
1209d2d48bbSChuck Lever 			show_fs_dirent_type(__entry->type),
121f4ce1299STrond Myklebust 			(unsigned long long)__entry->version,
122f4ce1299STrond Myklebust 			(long long)__entry->size,
123f4ce1299STrond Myklebust 			__entry->cache_validity,
124f4ce1299STrond Myklebust 			nfs_show_cache_validity(__entry->cache_validity),
125f4ce1299STrond Myklebust 			__entry->nfsi_flags,
126f4ce1299STrond Myklebust 			nfs_show_nfsi_flags(__entry->nfsi_flags)
127f4ce1299STrond Myklebust 		)
128f4ce1299STrond Myklebust );
129f4ce1299STrond Myklebust 
130f4ce1299STrond Myklebust #define DEFINE_NFS_INODE_EVENT(name) \
131f4ce1299STrond Myklebust 	DEFINE_EVENT(nfs_inode_event, name, \
132f4ce1299STrond Myklebust 			TP_PROTO( \
133f4ce1299STrond Myklebust 				const struct inode *inode \
134f4ce1299STrond Myklebust 			), \
135f4ce1299STrond Myklebust 			TP_ARGS(inode))
136f4ce1299STrond Myklebust #define DEFINE_NFS_INODE_EVENT_DONE(name) \
137f4ce1299STrond Myklebust 	DEFINE_EVENT(nfs_inode_event_done, name, \
138f4ce1299STrond Myklebust 			TP_PROTO( \
139f4ce1299STrond Myklebust 				const struct inode *inode, \
140f4ce1299STrond Myklebust 				int error \
141f4ce1299STrond Myklebust 			), \
142f4ce1299STrond Myklebust 			TP_ARGS(inode, error))
14393ce4af7STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_set_inode_stale);
144f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter);
145f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit);
146f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter);
147f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit);
148f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter);
149f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit);
150f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_getattr_enter);
151f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit);
152f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_setattr_enter);
153f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit);
154f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter);
155f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit);
156f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_fsync_enter);
157f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
158f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_access_enter);
15993c2e5e0SBenjamin Coddington DEFINE_NFS_INODE_EVENT_DONE(nfs_set_cache_invalid);
160b0365ccbSTrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_readdir_force_readdirplus);
161310e3187STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_readdir_cache_fill_done);
162310e3187STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_readdir_uncached_done);
163e8194b7dSTrond Myklebust 
164e8194b7dSTrond Myklebust TRACE_EVENT(nfs_access_exit,
165e8194b7dSTrond Myklebust 		TP_PROTO(
166e8194b7dSTrond Myklebust 			const struct inode *inode,
167e8194b7dSTrond Myklebust 			unsigned int mask,
168e8194b7dSTrond Myklebust 			unsigned int permitted,
169e8194b7dSTrond Myklebust 			int error
170e8194b7dSTrond Myklebust 		),
171e8194b7dSTrond Myklebust 
172e8194b7dSTrond Myklebust 		TP_ARGS(inode, mask, permitted, error),
173e8194b7dSTrond Myklebust 
174e8194b7dSTrond Myklebust 		TP_STRUCT__entry(
175e8194b7dSTrond Myklebust 			__field(unsigned long, error)
176e8194b7dSTrond Myklebust 			__field(dev_t, dev)
177e8194b7dSTrond Myklebust 			__field(u32, fhandle)
178e8194b7dSTrond Myklebust 			__field(unsigned char, type)
179e8194b7dSTrond Myklebust 			__field(u64, fileid)
180e8194b7dSTrond Myklebust 			__field(u64, version)
181e8194b7dSTrond Myklebust 			__field(loff_t, size)
182e8194b7dSTrond Myklebust 			__field(unsigned long, nfsi_flags)
183e8194b7dSTrond Myklebust 			__field(unsigned long, cache_validity)
184e8194b7dSTrond Myklebust 			__field(unsigned int, mask)
185e8194b7dSTrond Myklebust 			__field(unsigned int, permitted)
186e8194b7dSTrond Myklebust 		),
187e8194b7dSTrond Myklebust 
188e8194b7dSTrond Myklebust 		TP_fast_assign(
189e8194b7dSTrond Myklebust 			const struct nfs_inode *nfsi = NFS_I(inode);
190e8194b7dSTrond Myklebust 			__entry->error = error < 0 ? -error : 0;
191e8194b7dSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
192e8194b7dSTrond Myklebust 			__entry->fileid = nfsi->fileid;
193e8194b7dSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
194e8194b7dSTrond Myklebust 			__entry->type = nfs_umode_to_dtype(inode->i_mode);
195e8194b7dSTrond Myklebust 			__entry->version = inode_peek_iversion_raw(inode);
196e8194b7dSTrond Myklebust 			__entry->size = i_size_read(inode);
197e8194b7dSTrond Myklebust 			__entry->nfsi_flags = nfsi->flags;
198e8194b7dSTrond Myklebust 			__entry->cache_validity = nfsi->cache_validity;
199e8194b7dSTrond Myklebust 			__entry->mask = mask;
200e8194b7dSTrond Myklebust 			__entry->permitted = permitted;
201e8194b7dSTrond Myklebust 		),
202e8194b7dSTrond Myklebust 
203e8194b7dSTrond Myklebust 		TP_printk(
204e8194b7dSTrond Myklebust 			"error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
205e8194b7dSTrond Myklebust 			"type=%u (%s) version=%llu size=%lld "
206e8194b7dSTrond Myklebust 			"cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s) "
207e8194b7dSTrond Myklebust 			"mask=0x%x permitted=0x%x",
2088791545eSChuck Lever 			-__entry->error, show_nfs_status(__entry->error),
209e8194b7dSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
210e8194b7dSTrond Myklebust 			(unsigned long long)__entry->fileid,
211e8194b7dSTrond Myklebust 			__entry->fhandle,
212e8194b7dSTrond Myklebust 			__entry->type,
2139d2d48bbSChuck Lever 			show_fs_dirent_type(__entry->type),
214e8194b7dSTrond Myklebust 			(unsigned long long)__entry->version,
215e8194b7dSTrond Myklebust 			(long long)__entry->size,
216e8194b7dSTrond Myklebust 			__entry->cache_validity,
217e8194b7dSTrond Myklebust 			nfs_show_cache_validity(__entry->cache_validity),
218e8194b7dSTrond Myklebust 			__entry->nfsi_flags,
219e8194b7dSTrond Myklebust 			nfs_show_nfsi_flags(__entry->nfsi_flags),
220e8194b7dSTrond Myklebust 			__entry->mask, __entry->permitted
221e8194b7dSTrond Myklebust 		)
222e8194b7dSTrond Myklebust );
223f4ce1299STrond Myklebust 
224110cb2d2SChuck Lever DECLARE_EVENT_CLASS(nfs_update_size_class,
225110cb2d2SChuck Lever 		TP_PROTO(
226110cb2d2SChuck Lever 			const struct inode *inode,
227110cb2d2SChuck Lever 			loff_t new_size
228110cb2d2SChuck Lever 		),
229110cb2d2SChuck Lever 
230110cb2d2SChuck Lever 		TP_ARGS(inode, new_size),
231110cb2d2SChuck Lever 
232110cb2d2SChuck Lever 		TP_STRUCT__entry(
233110cb2d2SChuck Lever 			__field(dev_t, dev)
234110cb2d2SChuck Lever 			__field(u32, fhandle)
235110cb2d2SChuck Lever 			__field(u64, fileid)
236110cb2d2SChuck Lever 			__field(u64, version)
237110cb2d2SChuck Lever 			__field(loff_t, cur_size)
238110cb2d2SChuck Lever 			__field(loff_t, new_size)
239110cb2d2SChuck Lever 		),
240110cb2d2SChuck Lever 
241110cb2d2SChuck Lever 		TP_fast_assign(
242110cb2d2SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
243110cb2d2SChuck Lever 
244110cb2d2SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
245110cb2d2SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
246110cb2d2SChuck Lever 			__entry->fileid = nfsi->fileid;
247110cb2d2SChuck Lever 			__entry->version = inode_peek_iversion_raw(inode);
248110cb2d2SChuck Lever 			__entry->cur_size = i_size_read(inode);
249110cb2d2SChuck Lever 			__entry->new_size = new_size;
250110cb2d2SChuck Lever 		),
251110cb2d2SChuck Lever 
252110cb2d2SChuck Lever 		TP_printk(
253110cb2d2SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu cursize=%lld newsize=%lld",
254110cb2d2SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
255110cb2d2SChuck Lever 			(unsigned long long)__entry->fileid,
256110cb2d2SChuck Lever 			__entry->fhandle, __entry->version,
257110cb2d2SChuck Lever 			__entry->cur_size, __entry->new_size
258110cb2d2SChuck Lever 		)
259110cb2d2SChuck Lever );
260110cb2d2SChuck Lever 
261110cb2d2SChuck Lever #define DEFINE_NFS_UPDATE_SIZE_EVENT(name) \
262110cb2d2SChuck Lever 	DEFINE_EVENT(nfs_update_size_class, nfs_size_##name, \
263110cb2d2SChuck Lever 			TP_PROTO( \
264110cb2d2SChuck Lever 				const struct inode *inode, \
265110cb2d2SChuck Lever 				loff_t new_size \
266110cb2d2SChuck Lever 			), \
267110cb2d2SChuck Lever 			TP_ARGS(inode, new_size))
268110cb2d2SChuck Lever 
269110cb2d2SChuck Lever DEFINE_NFS_UPDATE_SIZE_EVENT(truncate);
270110cb2d2SChuck Lever DEFINE_NFS_UPDATE_SIZE_EVENT(wcc);
271110cb2d2SChuck Lever DEFINE_NFS_UPDATE_SIZE_EVENT(update);
272110cb2d2SChuck Lever DEFINE_NFS_UPDATE_SIZE_EVENT(grow);
273110cb2d2SChuck Lever 
27411d03d0aSTrond Myklebust DECLARE_EVENT_CLASS(nfs_inode_range_event,
27511d03d0aSTrond Myklebust 		TP_PROTO(
27611d03d0aSTrond Myklebust 			const struct inode *inode,
27711d03d0aSTrond Myklebust 			loff_t range_start,
27811d03d0aSTrond Myklebust 			loff_t range_end
27911d03d0aSTrond Myklebust 		),
28011d03d0aSTrond Myklebust 
28111d03d0aSTrond Myklebust 		TP_ARGS(inode, range_start, range_end),
28211d03d0aSTrond Myklebust 
28311d03d0aSTrond Myklebust 		TP_STRUCT__entry(
28411d03d0aSTrond Myklebust 			__field(dev_t, dev)
28511d03d0aSTrond Myklebust 			__field(u32, fhandle)
28611d03d0aSTrond Myklebust 			__field(u64, fileid)
28711d03d0aSTrond Myklebust 			__field(u64, version)
28811d03d0aSTrond Myklebust 			__field(loff_t, range_start)
28911d03d0aSTrond Myklebust 			__field(loff_t, range_end)
29011d03d0aSTrond Myklebust 		),
29111d03d0aSTrond Myklebust 
29211d03d0aSTrond Myklebust 		TP_fast_assign(
29311d03d0aSTrond Myklebust 			const struct nfs_inode *nfsi = NFS_I(inode);
29411d03d0aSTrond Myklebust 
29511d03d0aSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
29611d03d0aSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
29711d03d0aSTrond Myklebust 			__entry->fileid = nfsi->fileid;
29811d03d0aSTrond Myklebust 			__entry->version = inode_peek_iversion_raw(inode);
29911d03d0aSTrond Myklebust 			__entry->range_start = range_start;
30011d03d0aSTrond Myklebust 			__entry->range_end = range_end;
30111d03d0aSTrond Myklebust 		),
30211d03d0aSTrond Myklebust 
30311d03d0aSTrond Myklebust 		TP_printk(
30411d03d0aSTrond Myklebust 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu "
30511d03d0aSTrond Myklebust 			"range=[%lld, %lld]",
30611d03d0aSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
30711d03d0aSTrond Myklebust 			(unsigned long long)__entry->fileid,
30811d03d0aSTrond Myklebust 			__entry->fhandle, __entry->version,
30911d03d0aSTrond Myklebust 			__entry->range_start, __entry->range_end
31011d03d0aSTrond Myklebust 		)
31111d03d0aSTrond Myklebust );
31211d03d0aSTrond Myklebust 
31311d03d0aSTrond Myklebust #define DEFINE_NFS_INODE_RANGE_EVENT(name) \
31411d03d0aSTrond Myklebust 	DEFINE_EVENT(nfs_inode_range_event, name, \
31511d03d0aSTrond Myklebust 			TP_PROTO( \
31611d03d0aSTrond Myklebust 				const struct inode *inode, \
31711d03d0aSTrond Myklebust 				loff_t range_start, \
31811d03d0aSTrond Myklebust 				loff_t range_end \
31911d03d0aSTrond Myklebust 			), \
32011d03d0aSTrond Myklebust 			TP_ARGS(inode, range_start, range_end))
32111d03d0aSTrond Myklebust 
32211d03d0aSTrond Myklebust DEFINE_NFS_INODE_RANGE_EVENT(nfs_readdir_invalidate_cache_range);
32311d03d0aSTrond Myklebust 
324310e3187STrond Myklebust DECLARE_EVENT_CLASS(nfs_readdir_event,
325310e3187STrond Myklebust 		TP_PROTO(
326310e3187STrond Myklebust 			const struct file *file,
327310e3187STrond Myklebust 			const __be32 *verifier,
328310e3187STrond Myklebust 			u64 cookie,
329310e3187STrond Myklebust 			pgoff_t page_index,
330310e3187STrond Myklebust 			unsigned int dtsize
331310e3187STrond Myklebust 		),
332310e3187STrond Myklebust 
333310e3187STrond Myklebust 		TP_ARGS(file, verifier, cookie, page_index, dtsize),
334310e3187STrond Myklebust 
335310e3187STrond Myklebust 		TP_STRUCT__entry(
336310e3187STrond Myklebust 			__field(dev_t, dev)
337310e3187STrond Myklebust 			__field(u32, fhandle)
338310e3187STrond Myklebust 			__field(u64, fileid)
339310e3187STrond Myklebust 			__field(u64, version)
340310e3187STrond Myklebust 			__array(char, verifier, NFS4_VERIFIER_SIZE)
341310e3187STrond Myklebust 			__field(u64, cookie)
342310e3187STrond Myklebust 			__field(pgoff_t, index)
343310e3187STrond Myklebust 			__field(unsigned int, dtsize)
344310e3187STrond Myklebust 		),
345310e3187STrond Myklebust 
346310e3187STrond Myklebust 		TP_fast_assign(
347310e3187STrond Myklebust 			const struct inode *dir = file_inode(file);
348310e3187STrond Myklebust 			const struct nfs_inode *nfsi = NFS_I(dir);
349310e3187STrond Myklebust 
350310e3187STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
351310e3187STrond Myklebust 			__entry->fileid = nfsi->fileid;
352310e3187STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
353310e3187STrond Myklebust 			__entry->version = inode_peek_iversion_raw(dir);
354310e3187STrond Myklebust 			if (cookie != 0)
355310e3187STrond Myklebust 				memcpy(__entry->verifier, verifier,
356310e3187STrond Myklebust 				       NFS4_VERIFIER_SIZE);
357310e3187STrond Myklebust 			else
358310e3187STrond Myklebust 				memset(__entry->verifier, 0,
359310e3187STrond Myklebust 				       NFS4_VERIFIER_SIZE);
360310e3187STrond Myklebust 			__entry->cookie = cookie;
361310e3187STrond Myklebust 			__entry->index = page_index;
362310e3187STrond Myklebust 			__entry->dtsize = dtsize;
363310e3187STrond Myklebust 		),
364310e3187STrond Myklebust 
365310e3187STrond Myklebust 		TP_printk(
366310e3187STrond Myklebust 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu "
367310e3187STrond Myklebust 			"cookie=%s:0x%llx cache_index=%lu dtsize=%u",
368310e3187STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
369310e3187STrond Myklebust 			(unsigned long long)__entry->fileid, __entry->fhandle,
370310e3187STrond Myklebust 			__entry->version, show_nfs4_verifier(__entry->verifier),
371310e3187STrond Myklebust 			(unsigned long long)__entry->cookie, __entry->index,
372310e3187STrond Myklebust 			__entry->dtsize
373310e3187STrond Myklebust 		)
374310e3187STrond Myklebust );
375310e3187STrond Myklebust 
376310e3187STrond Myklebust #define DEFINE_NFS_READDIR_EVENT(name) \
377310e3187STrond Myklebust 	DEFINE_EVENT(nfs_readdir_event, name, \
378310e3187STrond Myklebust 			TP_PROTO( \
379310e3187STrond Myklebust 				const struct file *file, \
380310e3187STrond Myklebust 				const __be32 *verifier, \
381310e3187STrond Myklebust 				u64 cookie, \
382310e3187STrond Myklebust 				pgoff_t page_index, \
383310e3187STrond Myklebust 				unsigned int dtsize \
384310e3187STrond Myklebust 				), \
385310e3187STrond Myklebust 			TP_ARGS(file, verifier, cookie, page_index, dtsize))
386310e3187STrond Myklebust 
387310e3187STrond Myklebust DEFINE_NFS_READDIR_EVENT(nfs_readdir_cache_fill);
388310e3187STrond Myklebust DEFINE_NFS_READDIR_EVENT(nfs_readdir_uncached);
389310e3187STrond Myklebust 
3906e0d0be7STrond Myklebust DECLARE_EVENT_CLASS(nfs_lookup_event,
3916e0d0be7STrond Myklebust 		TP_PROTO(
3926e0d0be7STrond Myklebust 			const struct inode *dir,
3936e0d0be7STrond Myklebust 			const struct dentry *dentry,
3946e0d0be7STrond Myklebust 			unsigned int flags
3956e0d0be7STrond Myklebust 		),
3966e0d0be7STrond Myklebust 
3976e0d0be7STrond Myklebust 		TP_ARGS(dir, dentry, flags),
3986e0d0be7STrond Myklebust 
3996e0d0be7STrond Myklebust 		TP_STRUCT__entry(
4007d4006c1SChuck Lever 			__field(unsigned long, flags)
4016e0d0be7STrond Myklebust 			__field(dev_t, dev)
4026e0d0be7STrond Myklebust 			__field(u64, dir)
403f6e70c59SJeff Layton 			__field(u64, fileid)
4046e0d0be7STrond Myklebust 			__string(name, dentry->d_name.name)
4056e0d0be7STrond Myklebust 		),
4066e0d0be7STrond Myklebust 
4076e0d0be7STrond Myklebust 		TP_fast_assign(
4086e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
4096e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
4106e0d0be7STrond Myklebust 			__entry->flags = flags;
411f6e70c59SJeff Layton 			__entry->fileid = d_is_negative(dentry) ? 0 : NFS_FILEID(d_inode(dentry));
4122c92ca84SSteven Rostedt (Google) 			__assign_str(name);
4136e0d0be7STrond Myklebust 		),
4146e0d0be7STrond Myklebust 
4156e0d0be7STrond Myklebust 		TP_printk(
416f6e70c59SJeff Layton 			"flags=0x%lx (%s) name=%02x:%02x:%llu/%s fileid=%llu",
4176e0d0be7STrond Myklebust 			__entry->flags,
4189d2d48bbSChuck Lever 			show_fs_lookup_flags(__entry->flags),
4196e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
4206e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
421f6e70c59SJeff Layton 			__get_str(name),
422f6e70c59SJeff Layton 			__entry->fileid
4236e0d0be7STrond Myklebust 		)
4246e0d0be7STrond Myklebust );
4256e0d0be7STrond Myklebust 
4266e0d0be7STrond Myklebust #define DEFINE_NFS_LOOKUP_EVENT(name) \
4276e0d0be7STrond Myklebust 	DEFINE_EVENT(nfs_lookup_event, name, \
4286e0d0be7STrond Myklebust 			TP_PROTO( \
4296e0d0be7STrond Myklebust 				const struct inode *dir, \
4306e0d0be7STrond Myklebust 				const struct dentry *dentry, \
4316e0d0be7STrond Myklebust 				unsigned int flags \
4326e0d0be7STrond Myklebust 			), \
4336e0d0be7STrond Myklebust 			TP_ARGS(dir, dentry, flags))
4346e0d0be7STrond Myklebust 
4356e0d0be7STrond Myklebust DECLARE_EVENT_CLASS(nfs_lookup_event_done,
4366e0d0be7STrond Myklebust 		TP_PROTO(
4376e0d0be7STrond Myklebust 			const struct inode *dir,
4386e0d0be7STrond Myklebust 			const struct dentry *dentry,
4396e0d0be7STrond Myklebust 			unsigned int flags,
4406e0d0be7STrond Myklebust 			int error
4416e0d0be7STrond Myklebust 		),
4426e0d0be7STrond Myklebust 
4436e0d0be7STrond Myklebust 		TP_ARGS(dir, dentry, flags, error),
4446e0d0be7STrond Myklebust 
4456e0d0be7STrond Myklebust 		TP_STRUCT__entry(
44638a638a7SChuck Lever 			__field(unsigned long, error)
4477d4006c1SChuck Lever 			__field(unsigned long, flags)
4486e0d0be7STrond Myklebust 			__field(dev_t, dev)
4496e0d0be7STrond Myklebust 			__field(u64, dir)
450f6e70c59SJeff Layton 			__field(u64, fileid)
4516e0d0be7STrond Myklebust 			__string(name, dentry->d_name.name)
4526e0d0be7STrond Myklebust 		),
4536e0d0be7STrond Myklebust 
4546e0d0be7STrond Myklebust 		TP_fast_assign(
4556e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
4566e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
45738a638a7SChuck Lever 			__entry->error = error < 0 ? -error : 0;
4586e0d0be7STrond Myklebust 			__entry->flags = flags;
459f6e70c59SJeff Layton 			__entry->fileid = d_is_negative(dentry) ? 0 : NFS_FILEID(d_inode(dentry));
4602c92ca84SSteven Rostedt (Google) 			__assign_str(name);
4616e0d0be7STrond Myklebust 		),
4626e0d0be7STrond Myklebust 
4636e0d0be7STrond Myklebust 		TP_printk(
464f6e70c59SJeff Layton 			"error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s fileid=%llu",
4658791545eSChuck Lever 			-__entry->error, show_nfs_status(__entry->error),
4666e0d0be7STrond Myklebust 			__entry->flags,
4679d2d48bbSChuck Lever 			show_fs_lookup_flags(__entry->flags),
4686e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
4696e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
470f6e70c59SJeff Layton 			__get_str(name),
471f6e70c59SJeff Layton 			__entry->fileid
4726e0d0be7STrond Myklebust 		)
4736e0d0be7STrond Myklebust );
4746e0d0be7STrond Myklebust 
4756e0d0be7STrond Myklebust #define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \
4766e0d0be7STrond Myklebust 	DEFINE_EVENT(nfs_lookup_event_done, name, \
4776e0d0be7STrond Myklebust 			TP_PROTO( \
4786e0d0be7STrond Myklebust 				const struct inode *dir, \
4796e0d0be7STrond Myklebust 				const struct dentry *dentry, \
4806e0d0be7STrond Myklebust 				unsigned int flags, \
4816e0d0be7STrond Myklebust 				int error \
4826e0d0be7STrond Myklebust 			), \
4836e0d0be7STrond Myklebust 			TP_ARGS(dir, dentry, flags, error))
4846e0d0be7STrond Myklebust 
4856e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter);
4866e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
4876e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
4886e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
489eace45a1STrond Myklebust DEFINE_NFS_LOOKUP_EVENT(nfs_readdir_lookup);
490eace45a1STrond Myklebust DEFINE_NFS_LOOKUP_EVENT(nfs_readdir_lookup_revalidate_failed);
491eace45a1STrond Myklebust DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_readdir_lookup_revalidate);
4926e0d0be7STrond Myklebust 
4936e0d0be7STrond Myklebust TRACE_EVENT(nfs_atomic_open_enter,
4946e0d0be7STrond Myklebust 		TP_PROTO(
4956e0d0be7STrond Myklebust 			const struct inode *dir,
4966e0d0be7STrond Myklebust 			const struct nfs_open_context *ctx,
4976e0d0be7STrond Myklebust 			unsigned int flags
4986e0d0be7STrond Myklebust 		),
4996e0d0be7STrond Myklebust 
5006e0d0be7STrond Myklebust 		TP_ARGS(dir, ctx, flags),
5016e0d0be7STrond Myklebust 
5026e0d0be7STrond Myklebust 		TP_STRUCT__entry(
5037d4006c1SChuck Lever 			__field(unsigned long, flags)
5049d2d48bbSChuck Lever 			__field(unsigned long, fmode)
5056e0d0be7STrond Myklebust 			__field(dev_t, dev)
5066e0d0be7STrond Myklebust 			__field(u64, dir)
5076e0d0be7STrond Myklebust 			__string(name, ctx->dentry->d_name.name)
5086e0d0be7STrond Myklebust 		),
5096e0d0be7STrond Myklebust 
5106e0d0be7STrond Myklebust 		TP_fast_assign(
5116e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
5126e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
5136e0d0be7STrond Myklebust 			__entry->flags = flags;
5149d2d48bbSChuck Lever 			__entry->fmode = (__force unsigned long)ctx->mode;
5152c92ca84SSteven Rostedt (Google) 			__assign_str(name);
5166e0d0be7STrond Myklebust 		),
5176e0d0be7STrond Myklebust 
5186e0d0be7STrond Myklebust 		TP_printk(
5197d4006c1SChuck Lever 			"flags=0x%lx (%s) fmode=%s name=%02x:%02x:%llu/%s",
5206e0d0be7STrond Myklebust 			__entry->flags,
5219d2d48bbSChuck Lever 			show_fs_fcntl_open_flags(__entry->flags),
5229d2d48bbSChuck Lever 			show_fs_fmode_flags(__entry->fmode),
5236e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
5246e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
5256e0d0be7STrond Myklebust 			__get_str(name)
5266e0d0be7STrond Myklebust 		)
5276e0d0be7STrond Myklebust );
5286e0d0be7STrond Myklebust 
5296e0d0be7STrond Myklebust TRACE_EVENT(nfs_atomic_open_exit,
5306e0d0be7STrond Myklebust 		TP_PROTO(
5316e0d0be7STrond Myklebust 			const struct inode *dir,
5326e0d0be7STrond Myklebust 			const struct nfs_open_context *ctx,
5336e0d0be7STrond Myklebust 			unsigned int flags,
5346e0d0be7STrond Myklebust 			int error
5356e0d0be7STrond Myklebust 		),
5366e0d0be7STrond Myklebust 
5376e0d0be7STrond Myklebust 		TP_ARGS(dir, ctx, flags, error),
5386e0d0be7STrond Myklebust 
5396e0d0be7STrond Myklebust 		TP_STRUCT__entry(
54038a638a7SChuck Lever 			__field(unsigned long, error)
5417d4006c1SChuck Lever 			__field(unsigned long, flags)
5429d2d48bbSChuck Lever 			__field(unsigned long, fmode)
5436e0d0be7STrond Myklebust 			__field(dev_t, dev)
5446e0d0be7STrond Myklebust 			__field(u64, dir)
5456e0d0be7STrond Myklebust 			__string(name, ctx->dentry->d_name.name)
5466e0d0be7STrond Myklebust 		),
5476e0d0be7STrond Myklebust 
5486e0d0be7STrond Myklebust 		TP_fast_assign(
54938a638a7SChuck Lever 			__entry->error = -error;
5506e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
5516e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
5526e0d0be7STrond Myklebust 			__entry->flags = flags;
5539d2d48bbSChuck Lever 			__entry->fmode = (__force unsigned long)ctx->mode;
5542c92ca84SSteven Rostedt (Google) 			__assign_str(name);
5556e0d0be7STrond Myklebust 		),
5566e0d0be7STrond Myklebust 
5576e0d0be7STrond Myklebust 		TP_printk(
5587d4006c1SChuck Lever 			"error=%ld (%s) flags=0x%lx (%s) fmode=%s "
5596e0d0be7STrond Myklebust 			"name=%02x:%02x:%llu/%s",
5608791545eSChuck Lever 			-__entry->error, show_nfs_status(__entry->error),
5616e0d0be7STrond Myklebust 			__entry->flags,
5629d2d48bbSChuck Lever 			show_fs_fcntl_open_flags(__entry->flags),
5639d2d48bbSChuck Lever 			show_fs_fmode_flags(__entry->fmode),
5646e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
5656e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
5666e0d0be7STrond Myklebust 			__get_str(name)
5676e0d0be7STrond Myklebust 		)
5686e0d0be7STrond Myklebust );
5696e0d0be7STrond Myklebust 
5708b0ad3d4STrond Myklebust TRACE_EVENT(nfs_create_enter,
5718b0ad3d4STrond Myklebust 		TP_PROTO(
5728b0ad3d4STrond Myklebust 			const struct inode *dir,
5738b0ad3d4STrond Myklebust 			const struct dentry *dentry,
5748b0ad3d4STrond Myklebust 			unsigned int flags
5758b0ad3d4STrond Myklebust 		),
5768b0ad3d4STrond Myklebust 
5778b0ad3d4STrond Myklebust 		TP_ARGS(dir, dentry, flags),
5788b0ad3d4STrond Myklebust 
5798b0ad3d4STrond Myklebust 		TP_STRUCT__entry(
5807d4006c1SChuck Lever 			__field(unsigned long, flags)
5818b0ad3d4STrond Myklebust 			__field(dev_t, dev)
5828b0ad3d4STrond Myklebust 			__field(u64, dir)
5838b0ad3d4STrond Myklebust 			__string(name, dentry->d_name.name)
5848b0ad3d4STrond Myklebust 		),
5858b0ad3d4STrond Myklebust 
5868b0ad3d4STrond Myklebust 		TP_fast_assign(
5878b0ad3d4STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
5888b0ad3d4STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
5898b0ad3d4STrond Myklebust 			__entry->flags = flags;
5902c92ca84SSteven Rostedt (Google) 			__assign_str(name);
5918b0ad3d4STrond Myklebust 		),
5928b0ad3d4STrond Myklebust 
5938b0ad3d4STrond Myklebust 		TP_printk(
5947d4006c1SChuck Lever 			"flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
5958b0ad3d4STrond Myklebust 			__entry->flags,
5969d2d48bbSChuck Lever 			show_fs_fcntl_open_flags(__entry->flags),
5978b0ad3d4STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
5988b0ad3d4STrond Myklebust 			(unsigned long long)__entry->dir,
5998b0ad3d4STrond Myklebust 			__get_str(name)
6008b0ad3d4STrond Myklebust 		)
6018b0ad3d4STrond Myklebust );
6028b0ad3d4STrond Myklebust 
6038b0ad3d4STrond Myklebust TRACE_EVENT(nfs_create_exit,
6048b0ad3d4STrond Myklebust 		TP_PROTO(
6058b0ad3d4STrond Myklebust 			const struct inode *dir,
6068b0ad3d4STrond Myklebust 			const struct dentry *dentry,
6078b0ad3d4STrond Myklebust 			unsigned int flags,
6088b0ad3d4STrond Myklebust 			int error
6098b0ad3d4STrond Myklebust 		),
6108b0ad3d4STrond Myklebust 
6118b0ad3d4STrond Myklebust 		TP_ARGS(dir, dentry, flags, error),
6128b0ad3d4STrond Myklebust 
6138b0ad3d4STrond Myklebust 		TP_STRUCT__entry(
61438a638a7SChuck Lever 			__field(unsigned long, error)
6157d4006c1SChuck Lever 			__field(unsigned long, flags)
6168b0ad3d4STrond Myklebust 			__field(dev_t, dev)
6178b0ad3d4STrond Myklebust 			__field(u64, dir)
6188b0ad3d4STrond Myklebust 			__string(name, dentry->d_name.name)
6198b0ad3d4STrond Myklebust 		),
6208b0ad3d4STrond Myklebust 
6218b0ad3d4STrond Myklebust 		TP_fast_assign(
62238a638a7SChuck Lever 			__entry->error = -error;
6238b0ad3d4STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
6248b0ad3d4STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
6258b0ad3d4STrond Myklebust 			__entry->flags = flags;
6262c92ca84SSteven Rostedt (Google) 			__assign_str(name);
6278b0ad3d4STrond Myklebust 		),
6288b0ad3d4STrond Myklebust 
6298b0ad3d4STrond Myklebust 		TP_printk(
6307d4006c1SChuck Lever 			"error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
6318791545eSChuck Lever 			-__entry->error, show_nfs_status(__entry->error),
6328b0ad3d4STrond Myklebust 			__entry->flags,
6339d2d48bbSChuck Lever 			show_fs_fcntl_open_flags(__entry->flags),
6348b0ad3d4STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
6358b0ad3d4STrond Myklebust 			(unsigned long long)__entry->dir,
6368b0ad3d4STrond Myklebust 			__get_str(name)
6378b0ad3d4STrond Myklebust 		)
6388b0ad3d4STrond Myklebust );
6398b0ad3d4STrond Myklebust 
6401ca42382STrond Myklebust DECLARE_EVENT_CLASS(nfs_directory_event,
6411ca42382STrond Myklebust 		TP_PROTO(
6421ca42382STrond Myklebust 			const struct inode *dir,
6431ca42382STrond Myklebust 			const struct dentry *dentry
6441ca42382STrond Myklebust 		),
6451ca42382STrond Myklebust 
6461ca42382STrond Myklebust 		TP_ARGS(dir, dentry),
6471ca42382STrond Myklebust 
6481ca42382STrond Myklebust 		TP_STRUCT__entry(
6491ca42382STrond Myklebust 			__field(dev_t, dev)
6501ca42382STrond Myklebust 			__field(u64, dir)
6511ca42382STrond Myklebust 			__string(name, dentry->d_name.name)
6521ca42382STrond Myklebust 		),
6531ca42382STrond Myklebust 
6541ca42382STrond Myklebust 		TP_fast_assign(
6551ca42382STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
6561ca42382STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
6572c92ca84SSteven Rostedt (Google) 			__assign_str(name);
6581ca42382STrond Myklebust 		),
6591ca42382STrond Myklebust 
6601ca42382STrond Myklebust 		TP_printk(
6611ca42382STrond Myklebust 			"name=%02x:%02x:%llu/%s",
6621ca42382STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
6631ca42382STrond Myklebust 			(unsigned long long)__entry->dir,
6641ca42382STrond Myklebust 			__get_str(name)
6651ca42382STrond Myklebust 		)
6661ca42382STrond Myklebust );
6671ca42382STrond Myklebust 
6681ca42382STrond Myklebust #define DEFINE_NFS_DIRECTORY_EVENT(name) \
6691ca42382STrond Myklebust 	DEFINE_EVENT(nfs_directory_event, name, \
6701ca42382STrond Myklebust 			TP_PROTO( \
6711ca42382STrond Myklebust 				const struct inode *dir, \
6721ca42382STrond Myklebust 				const struct dentry *dentry \
6731ca42382STrond Myklebust 			), \
6741ca42382STrond Myklebust 			TP_ARGS(dir, dentry))
6751ca42382STrond Myklebust 
6761ca42382STrond Myklebust DECLARE_EVENT_CLASS(nfs_directory_event_done,
6771ca42382STrond Myklebust 		TP_PROTO(
6781ca42382STrond Myklebust 			const struct inode *dir,
6791ca42382STrond Myklebust 			const struct dentry *dentry,
6801ca42382STrond Myklebust 			int error
6811ca42382STrond Myklebust 		),
6821ca42382STrond Myklebust 
6831ca42382STrond Myklebust 		TP_ARGS(dir, dentry, error),
6841ca42382STrond Myklebust 
6851ca42382STrond Myklebust 		TP_STRUCT__entry(
68638a638a7SChuck Lever 			__field(unsigned long, error)
6871ca42382STrond Myklebust 			__field(dev_t, dev)
6881ca42382STrond Myklebust 			__field(u64, dir)
6891ca42382STrond Myklebust 			__string(name, dentry->d_name.name)
6901ca42382STrond Myklebust 		),
6911ca42382STrond Myklebust 
6921ca42382STrond Myklebust 		TP_fast_assign(
6931ca42382STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
6941ca42382STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
69538a638a7SChuck Lever 			__entry->error = error < 0 ? -error : 0;
6962c92ca84SSteven Rostedt (Google) 			__assign_str(name);
6971ca42382STrond Myklebust 		),
6981ca42382STrond Myklebust 
6991ca42382STrond Myklebust 		TP_printk(
70038a638a7SChuck Lever 			"error=%ld (%s) name=%02x:%02x:%llu/%s",
7018791545eSChuck Lever 			-__entry->error, show_nfs_status(__entry->error),
7021ca42382STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
7031ca42382STrond Myklebust 			(unsigned long long)__entry->dir,
7041ca42382STrond Myklebust 			__get_str(name)
7051ca42382STrond Myklebust 		)
7061ca42382STrond Myklebust );
7071ca42382STrond Myklebust 
7081ca42382STrond Myklebust #define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \
7091ca42382STrond Myklebust 	DEFINE_EVENT(nfs_directory_event_done, name, \
7101ca42382STrond Myklebust 			TP_PROTO( \
7111ca42382STrond Myklebust 				const struct inode *dir, \
7121ca42382STrond Myklebust 				const struct dentry *dentry, \
7131ca42382STrond Myklebust 				int error \
7141ca42382STrond Myklebust 			), \
7151ca42382STrond Myklebust 			TP_ARGS(dir, dentry, error))
7161ca42382STrond Myklebust 
7171ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter);
7181ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit);
7191ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter);
7201ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit);
7211ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter);
7221ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit);
7231ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter);
7241ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit);
7251ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter);
7261ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit);
7271ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter);
7281ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit);
7291ca42382STrond Myklebust 
7301fd1085bSTrond Myklebust TRACE_EVENT(nfs_link_enter,
7311fd1085bSTrond Myklebust 		TP_PROTO(
7321fd1085bSTrond Myklebust 			const struct inode *inode,
7331fd1085bSTrond Myklebust 			const struct inode *dir,
7341fd1085bSTrond Myklebust 			const struct dentry *dentry
7351fd1085bSTrond Myklebust 		),
7361fd1085bSTrond Myklebust 
7371fd1085bSTrond Myklebust 		TP_ARGS(inode, dir, dentry),
7381fd1085bSTrond Myklebust 
7391fd1085bSTrond Myklebust 		TP_STRUCT__entry(
7401fd1085bSTrond Myklebust 			__field(dev_t, dev)
7411fd1085bSTrond Myklebust 			__field(u64, fileid)
7421fd1085bSTrond Myklebust 			__field(u64, dir)
7431fd1085bSTrond Myklebust 			__string(name, dentry->d_name.name)
7441fd1085bSTrond Myklebust 		),
7451fd1085bSTrond Myklebust 
7461fd1085bSTrond Myklebust 		TP_fast_assign(
7471fd1085bSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
7481fd1085bSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
7491fd1085bSTrond Myklebust 			__entry->dir = NFS_FILEID(dir);
7502c92ca84SSteven Rostedt (Google) 			__assign_str(name);
7511fd1085bSTrond Myklebust 		),
7521fd1085bSTrond Myklebust 
7531fd1085bSTrond Myklebust 		TP_printk(
7541fd1085bSTrond Myklebust 			"fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
7551fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
7561fd1085bSTrond Myklebust 			__entry->fileid,
7571fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
7581fd1085bSTrond Myklebust 			(unsigned long long)__entry->dir,
7591fd1085bSTrond Myklebust 			__get_str(name)
7601fd1085bSTrond Myklebust 		)
7611fd1085bSTrond Myklebust );
7621fd1085bSTrond Myklebust 
7631fd1085bSTrond Myklebust TRACE_EVENT(nfs_link_exit,
7641fd1085bSTrond Myklebust 		TP_PROTO(
7651fd1085bSTrond Myklebust 			const struct inode *inode,
7661fd1085bSTrond Myklebust 			const struct inode *dir,
7671fd1085bSTrond Myklebust 			const struct dentry *dentry,
7681fd1085bSTrond Myklebust 			int error
7691fd1085bSTrond Myklebust 		),
7701fd1085bSTrond Myklebust 
7711fd1085bSTrond Myklebust 		TP_ARGS(inode, dir, dentry, error),
7721fd1085bSTrond Myklebust 
7731fd1085bSTrond Myklebust 		TP_STRUCT__entry(
77438a638a7SChuck Lever 			__field(unsigned long, error)
7751fd1085bSTrond Myklebust 			__field(dev_t, dev)
7761fd1085bSTrond Myklebust 			__field(u64, fileid)
7771fd1085bSTrond Myklebust 			__field(u64, dir)
7781fd1085bSTrond Myklebust 			__string(name, dentry->d_name.name)
7791fd1085bSTrond Myklebust 		),
7801fd1085bSTrond Myklebust 
7811fd1085bSTrond Myklebust 		TP_fast_assign(
7821fd1085bSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
7831fd1085bSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
7841fd1085bSTrond Myklebust 			__entry->dir = NFS_FILEID(dir);
78538a638a7SChuck Lever 			__entry->error = error < 0 ? -error : 0;
7862c92ca84SSteven Rostedt (Google) 			__assign_str(name);
7871fd1085bSTrond Myklebust 		),
7881fd1085bSTrond Myklebust 
7891fd1085bSTrond Myklebust 		TP_printk(
79038a638a7SChuck Lever 			"error=%ld (%s) fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
7918791545eSChuck Lever 			-__entry->error, show_nfs_status(__entry->error),
7921fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
7931fd1085bSTrond Myklebust 			__entry->fileid,
7941fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
7951fd1085bSTrond Myklebust 			(unsigned long long)__entry->dir,
7961fd1085bSTrond Myklebust 			__get_str(name)
7971fd1085bSTrond Myklebust 		)
7981fd1085bSTrond Myklebust );
7991fd1085bSTrond Myklebust 
80070ded201STrond Myklebust DECLARE_EVENT_CLASS(nfs_rename_event,
80170ded201STrond Myklebust 		TP_PROTO(
80270ded201STrond Myklebust 			const struct inode *old_dir,
80370ded201STrond Myklebust 			const struct dentry *old_dentry,
80470ded201STrond Myklebust 			const struct inode *new_dir,
80570ded201STrond Myklebust 			const struct dentry *new_dentry
80670ded201STrond Myklebust 		),
80770ded201STrond Myklebust 
80870ded201STrond Myklebust 		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry),
80970ded201STrond Myklebust 
81070ded201STrond Myklebust 		TP_STRUCT__entry(
81170ded201STrond Myklebust 			__field(dev_t, dev)
81270ded201STrond Myklebust 			__field(u64, old_dir)
81370ded201STrond Myklebust 			__field(u64, new_dir)
81470ded201STrond Myklebust 			__string(old_name, old_dentry->d_name.name)
81570ded201STrond Myklebust 			__string(new_name, new_dentry->d_name.name)
81670ded201STrond Myklebust 		),
81770ded201STrond Myklebust 
81870ded201STrond Myklebust 		TP_fast_assign(
81970ded201STrond Myklebust 			__entry->dev = old_dir->i_sb->s_dev;
82070ded201STrond Myklebust 			__entry->old_dir = NFS_FILEID(old_dir);
82170ded201STrond Myklebust 			__entry->new_dir = NFS_FILEID(new_dir);
8222c92ca84SSteven Rostedt (Google) 			__assign_str(old_name);
8232c92ca84SSteven Rostedt (Google) 			__assign_str(new_name);
82470ded201STrond Myklebust 		),
82570ded201STrond Myklebust 
82670ded201STrond Myklebust 		TP_printk(
82770ded201STrond Myklebust 			"old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s",
82870ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
82970ded201STrond Myklebust 			(unsigned long long)__entry->old_dir,
83070ded201STrond Myklebust 			__get_str(old_name),
83170ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
83270ded201STrond Myklebust 			(unsigned long long)__entry->new_dir,
83370ded201STrond Myklebust 			__get_str(new_name)
83470ded201STrond Myklebust 		)
83570ded201STrond Myklebust );
83670ded201STrond Myklebust #define DEFINE_NFS_RENAME_EVENT(name) \
83770ded201STrond Myklebust 	DEFINE_EVENT(nfs_rename_event, name, \
83870ded201STrond Myklebust 			TP_PROTO( \
83970ded201STrond Myklebust 				const struct inode *old_dir, \
84070ded201STrond Myklebust 				const struct dentry *old_dentry, \
84170ded201STrond Myklebust 				const struct inode *new_dir, \
84270ded201STrond Myklebust 				const struct dentry *new_dentry \
84370ded201STrond Myklebust 			), \
84470ded201STrond Myklebust 			TP_ARGS(old_dir, old_dentry, new_dir, new_dentry))
84570ded201STrond Myklebust 
84670ded201STrond Myklebust DECLARE_EVENT_CLASS(nfs_rename_event_done,
84770ded201STrond Myklebust 		TP_PROTO(
84870ded201STrond Myklebust 			const struct inode *old_dir,
84970ded201STrond Myklebust 			const struct dentry *old_dentry,
85070ded201STrond Myklebust 			const struct inode *new_dir,
85170ded201STrond Myklebust 			const struct dentry *new_dentry,
85270ded201STrond Myklebust 			int error
85370ded201STrond Myklebust 		),
85470ded201STrond Myklebust 
85570ded201STrond Myklebust 		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, error),
85670ded201STrond Myklebust 
85770ded201STrond Myklebust 		TP_STRUCT__entry(
85870ded201STrond Myklebust 			__field(dev_t, dev)
85938a638a7SChuck Lever 			__field(unsigned long, error)
86070ded201STrond Myklebust 			__field(u64, old_dir)
86170ded201STrond Myklebust 			__string(old_name, old_dentry->d_name.name)
86270ded201STrond Myklebust 			__field(u64, new_dir)
86370ded201STrond Myklebust 			__string(new_name, new_dentry->d_name.name)
86470ded201STrond Myklebust 		),
86570ded201STrond Myklebust 
86670ded201STrond Myklebust 		TP_fast_assign(
86770ded201STrond Myklebust 			__entry->dev = old_dir->i_sb->s_dev;
86838a638a7SChuck Lever 			__entry->error = -error;
86970ded201STrond Myklebust 			__entry->old_dir = NFS_FILEID(old_dir);
87070ded201STrond Myklebust 			__entry->new_dir = NFS_FILEID(new_dir);
8712c92ca84SSteven Rostedt (Google) 			__assign_str(old_name);
8722c92ca84SSteven Rostedt (Google) 			__assign_str(new_name);
87370ded201STrond Myklebust 		),
87470ded201STrond Myklebust 
87570ded201STrond Myklebust 		TP_printk(
87638a638a7SChuck Lever 			"error=%ld (%s) old_name=%02x:%02x:%llu/%s "
87770ded201STrond Myklebust 			"new_name=%02x:%02x:%llu/%s",
8788791545eSChuck Lever 			-__entry->error, show_nfs_status(__entry->error),
87970ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
88070ded201STrond Myklebust 			(unsigned long long)__entry->old_dir,
88170ded201STrond Myklebust 			__get_str(old_name),
88270ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
88370ded201STrond Myklebust 			(unsigned long long)__entry->new_dir,
88470ded201STrond Myklebust 			__get_str(new_name)
88570ded201STrond Myklebust 		)
88670ded201STrond Myklebust );
88770ded201STrond Myklebust #define DEFINE_NFS_RENAME_EVENT_DONE(name) \
88870ded201STrond Myklebust 	DEFINE_EVENT(nfs_rename_event_done, name, \
88970ded201STrond Myklebust 			TP_PROTO( \
89070ded201STrond Myklebust 				const struct inode *old_dir, \
89170ded201STrond Myklebust 				const struct dentry *old_dentry, \
89270ded201STrond Myklebust 				const struct inode *new_dir, \
89370ded201STrond Myklebust 				const struct dentry *new_dentry, \
89470ded201STrond Myklebust 				int error \
89570ded201STrond Myklebust 			), \
89670ded201STrond Myklebust 			TP_ARGS(old_dir, old_dentry, new_dir, \
89770ded201STrond Myklebust 				new_dentry, error))
89870ded201STrond Myklebust 
89970ded201STrond Myklebust DEFINE_NFS_RENAME_EVENT(nfs_rename_enter);
90070ded201STrond Myklebust DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit);
90170ded201STrond Myklebust 
902310b1f89SJeff Layton DEFINE_NFS_RENAME_EVENT_DONE(nfs_async_rename_done);
90370ded201STrond Myklebust 
90470ded201STrond Myklebust TRACE_EVENT(nfs_sillyrename_unlink,
90570ded201STrond Myklebust 		TP_PROTO(
90670ded201STrond Myklebust 			const struct nfs_unlinkdata *data,
90770ded201STrond Myklebust 			int error
90870ded201STrond Myklebust 		),
90970ded201STrond Myklebust 
91070ded201STrond Myklebust 		TP_ARGS(data, error),
91170ded201STrond Myklebust 
91270ded201STrond Myklebust 		TP_STRUCT__entry(
91370ded201STrond Myklebust 			__field(dev_t, dev)
91438a638a7SChuck Lever 			__field(unsigned long, error)
91570ded201STrond Myklebust 			__field(u64, dir)
91670ded201STrond Myklebust 			__dynamic_array(char, name, data->args.name.len + 1)
91770ded201STrond Myklebust 		),
91870ded201STrond Myklebust 
91970ded201STrond Myklebust 		TP_fast_assign(
920884be175SAl Viro 			struct inode *dir = d_inode(data->dentry->d_parent);
92170ded201STrond Myklebust 			size_t len = data->args.name.len;
92270ded201STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
92370ded201STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
92438a638a7SChuck Lever 			__entry->error = -error;
925752d596bSDaniel Bristot de Oliveira 			memcpy(__get_str(name),
92670ded201STrond Myklebust 				data->args.name.name, len);
927752d596bSDaniel Bristot de Oliveira 			__get_str(name)[len] = 0;
92870ded201STrond Myklebust 		),
92970ded201STrond Myklebust 
93070ded201STrond Myklebust 		TP_printk(
93138a638a7SChuck Lever 			"error=%ld (%s) name=%02x:%02x:%llu/%s",
9328791545eSChuck Lever 			-__entry->error, show_nfs_status(__entry->error),
93370ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
93470ded201STrond Myklebust 			(unsigned long long)__entry->dir,
93570ded201STrond Myklebust 			__get_str(name)
93670ded201STrond Myklebust 		)
93770ded201STrond Myklebust );
9388224b273SChuck Lever 
939eb5654b3STrond Myklebust DECLARE_EVENT_CLASS(nfs_folio_event,
940d9f87743SChuck Lever 		TP_PROTO(
941d9f87743SChuck Lever 			const struct inode *inode,
942fada32edSChristoph Hellwig 			loff_t offset,
943fada32edSChristoph Hellwig 			size_t count
944d9f87743SChuck Lever 		),
945d9f87743SChuck Lever 
946fada32edSChristoph Hellwig 		TP_ARGS(inode, offset, count),
947d9f87743SChuck Lever 
948d9f87743SChuck Lever 		TP_STRUCT__entry(
949d9f87743SChuck Lever 			__field(dev_t, dev)
950d9f87743SChuck Lever 			__field(u32, fhandle)
951d9f87743SChuck Lever 			__field(u64, fileid)
952d9f87743SChuck Lever 			__field(u64, version)
953d9f87743SChuck Lever 			__field(loff_t, offset)
954fada32edSChristoph Hellwig 			__field(size_t, count)
955d9f87743SChuck Lever 		),
956d9f87743SChuck Lever 
957d9f87743SChuck Lever 		TP_fast_assign(
958d9f87743SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
959d9f87743SChuck Lever 
960d9f87743SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
961d9f87743SChuck Lever 			__entry->fileid = nfsi->fileid;
962d9f87743SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
963d9f87743SChuck Lever 			__entry->version = inode_peek_iversion_raw(inode);
964fada32edSChristoph Hellwig 			__entry->offset = offset,
965fada32edSChristoph Hellwig 			__entry->count = count;
966d9f87743SChuck Lever 		),
967d9f87743SChuck Lever 
968d9f87743SChuck Lever 		TP_printk(
969eb5654b3STrond Myklebust 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu "
970fada32edSChristoph Hellwig 			"offset=%lld count=%zu",
971d9f87743SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
972d9f87743SChuck Lever 			(unsigned long long)__entry->fileid,
973d9f87743SChuck Lever 			__entry->fhandle, __entry->version,
974eb5654b3STrond Myklebust 			__entry->offset, __entry->count
975d9f87743SChuck Lever 		)
976d9f87743SChuck Lever );
977d9f87743SChuck Lever 
978eb5654b3STrond Myklebust #define DEFINE_NFS_FOLIO_EVENT(name) \
979eb5654b3STrond Myklebust 	DEFINE_EVENT(nfs_folio_event, name, \
980eb5654b3STrond Myklebust 			TP_PROTO( \
981eb5654b3STrond Myklebust 				const struct inode *inode, \
982fada32edSChristoph Hellwig 				loff_t offset, \
983fada32edSChristoph Hellwig 				size_t count \
984eb5654b3STrond Myklebust 			), \
985fada32edSChristoph Hellwig 			TP_ARGS(inode, offset, count))
986eb5654b3STrond Myklebust 
987eb5654b3STrond Myklebust DECLARE_EVENT_CLASS(nfs_folio_event_done,
988d9f87743SChuck Lever 		TP_PROTO(
989d9f87743SChuck Lever 			const struct inode *inode,
990fada32edSChristoph Hellwig 			loff_t offset,
991fada32edSChristoph Hellwig 			size_t count,
992d9f87743SChuck Lever 			int ret
993d9f87743SChuck Lever 		),
994d9f87743SChuck Lever 
995fada32edSChristoph Hellwig 		TP_ARGS(inode, offset, count, ret),
996d9f87743SChuck Lever 
997d9f87743SChuck Lever 		TP_STRUCT__entry(
998d9f87743SChuck Lever 			__field(dev_t, dev)
999d9f87743SChuck Lever 			__field(u32, fhandle)
1000d9f87743SChuck Lever 			__field(int, ret)
1001d9f87743SChuck Lever 			__field(u64, fileid)
1002d9f87743SChuck Lever 			__field(u64, version)
1003d9f87743SChuck Lever 			__field(loff_t, offset)
1004fada32edSChristoph Hellwig 			__field(size_t, count)
1005d9f87743SChuck Lever 		),
1006d9f87743SChuck Lever 
1007d9f87743SChuck Lever 		TP_fast_assign(
1008d9f87743SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
1009d9f87743SChuck Lever 
1010d9f87743SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
1011d9f87743SChuck Lever 			__entry->fileid = nfsi->fileid;
1012d9f87743SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1013d9f87743SChuck Lever 			__entry->version = inode_peek_iversion_raw(inode);
1014fada32edSChristoph Hellwig 			__entry->offset = offset,
1015fada32edSChristoph Hellwig 			__entry->count = count,
1016d9f87743SChuck Lever 			__entry->ret = ret;
1017d9f87743SChuck Lever 		),
1018d9f87743SChuck Lever 
1019d9f87743SChuck Lever 		TP_printk(
1020eb5654b3STrond Myklebust 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu "
1021fada32edSChristoph Hellwig 			"offset=%lld count=%zu ret=%d",
1022d9f87743SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
1023d9f87743SChuck Lever 			(unsigned long long)__entry->fileid,
1024d9f87743SChuck Lever 			__entry->fhandle, __entry->version,
1025eb5654b3STrond Myklebust 			__entry->offset, __entry->count, __entry->ret
1026d9f87743SChuck Lever 		)
1027d9f87743SChuck Lever );
1028d9f87743SChuck Lever 
1029eb5654b3STrond Myklebust #define DEFINE_NFS_FOLIO_EVENT_DONE(name) \
1030eb5654b3STrond Myklebust 	DEFINE_EVENT(nfs_folio_event_done, name, \
1031eb5654b3STrond Myklebust 			TP_PROTO( \
1032eb5654b3STrond Myklebust 				const struct inode *inode, \
1033fada32edSChristoph Hellwig 				loff_t offset, \
1034fada32edSChristoph Hellwig 				size_t count, \
1035eb5654b3STrond Myklebust 				int ret \
1036eb5654b3STrond Myklebust 			), \
1037fada32edSChristoph Hellwig 			TP_ARGS(inode, offset, count, ret))
1038eb5654b3STrond Myklebust 
1039eb5654b3STrond Myklebust DEFINE_NFS_FOLIO_EVENT(nfs_aop_readpage);
1040eb5654b3STrond Myklebust DEFINE_NFS_FOLIO_EVENT_DONE(nfs_aop_readpage_done);
1041eb5654b3STrond Myklebust 
1042256093feSTrond Myklebust DEFINE_NFS_FOLIO_EVENT(nfs_writeback_folio);
1043256093feSTrond Myklebust DEFINE_NFS_FOLIO_EVENT_DONE(nfs_writeback_folio_done);
1044256093feSTrond Myklebust 
1045eb5654b3STrond Myklebust DEFINE_NFS_FOLIO_EVENT(nfs_invalidate_folio);
1046eb5654b3STrond Myklebust DEFINE_NFS_FOLIO_EVENT_DONE(nfs_launder_folio_done);
1047eb5654b3STrond Myklebust 
1048d9f87743SChuck Lever TRACE_EVENT(nfs_aop_readahead,
1049d9f87743SChuck Lever 		TP_PROTO(
1050d9f87743SChuck Lever 			const struct inode *inode,
10518786fde8SMatthew Wilcox (Oracle) 			loff_t pos,
1052d9f87743SChuck Lever 			unsigned int nr_pages
1053d9f87743SChuck Lever 		),
1054d9f87743SChuck Lever 
10558786fde8SMatthew Wilcox (Oracle) 		TP_ARGS(inode, pos, nr_pages),
1056d9f87743SChuck Lever 
1057d9f87743SChuck Lever 		TP_STRUCT__entry(
1058d9f87743SChuck Lever 			__field(dev_t, dev)
1059d9f87743SChuck Lever 			__field(u32, fhandle)
1060d9f87743SChuck Lever 			__field(u64, fileid)
1061d9f87743SChuck Lever 			__field(u64, version)
1062edfa0b16SDave Wysochanski 			__field(loff_t, offset)
1063d9f87743SChuck Lever 			__field(unsigned int, nr_pages)
1064d9f87743SChuck Lever 		),
1065d9f87743SChuck Lever 
1066d9f87743SChuck Lever 		TP_fast_assign(
1067d9f87743SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
1068d9f87743SChuck Lever 
1069d9f87743SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
1070d9f87743SChuck Lever 			__entry->fileid = nfsi->fileid;
1071d9f87743SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1072d9f87743SChuck Lever 			__entry->version = inode_peek_iversion_raw(inode);
10738786fde8SMatthew Wilcox (Oracle) 			__entry->offset = pos;
1074d9f87743SChuck Lever 			__entry->nr_pages = nr_pages;
1075d9f87743SChuck Lever 		),
1076d9f87743SChuck Lever 
1077d9f87743SChuck Lever 		TP_printk(
1078edfa0b16SDave Wysochanski 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu offset=%lld nr_pages=%u",
1079d9f87743SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
1080d9f87743SChuck Lever 			(unsigned long long)__entry->fileid,
1081d9f87743SChuck Lever 			__entry->fhandle, __entry->version,
1082edfa0b16SDave Wysochanski 			__entry->offset, __entry->nr_pages
1083d9f87743SChuck Lever 		)
1084d9f87743SChuck Lever );
1085d9f87743SChuck Lever 
1086d9f87743SChuck Lever TRACE_EVENT(nfs_aop_readahead_done,
1087d9f87743SChuck Lever 		TP_PROTO(
1088d9f87743SChuck Lever 			const struct inode *inode,
1089d9f87743SChuck Lever 			unsigned int nr_pages,
1090d9f87743SChuck Lever 			int ret
1091d9f87743SChuck Lever 		),
1092d9f87743SChuck Lever 
1093d9f87743SChuck Lever 		TP_ARGS(inode, nr_pages, ret),
1094d9f87743SChuck Lever 
1095d9f87743SChuck Lever 		TP_STRUCT__entry(
1096d9f87743SChuck Lever 			__field(dev_t, dev)
1097d9f87743SChuck Lever 			__field(u32, fhandle)
1098d9f87743SChuck Lever 			__field(int, ret)
1099d9f87743SChuck Lever 			__field(u64, fileid)
1100d9f87743SChuck Lever 			__field(u64, version)
1101edfa0b16SDave Wysochanski 			__field(loff_t, offset)
1102d9f87743SChuck Lever 			__field(unsigned int, nr_pages)
1103d9f87743SChuck Lever 		),
1104d9f87743SChuck Lever 
1105d9f87743SChuck Lever 		TP_fast_assign(
1106d9f87743SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
1107d9f87743SChuck Lever 
1108d9f87743SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
1109d9f87743SChuck Lever 			__entry->fileid = nfsi->fileid;
1110d9f87743SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1111d9f87743SChuck Lever 			__entry->version = inode_peek_iversion_raw(inode);
1112d9f87743SChuck Lever 			__entry->nr_pages = nr_pages;
1113d9f87743SChuck Lever 			__entry->ret = ret;
1114d9f87743SChuck Lever 		),
1115d9f87743SChuck Lever 
1116d9f87743SChuck Lever 		TP_printk(
1117d9f87743SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu nr_pages=%u ret=%d",
1118d9f87743SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
1119d9f87743SChuck Lever 			(unsigned long long)__entry->fileid,
1120d9f87743SChuck Lever 			__entry->fhandle, __entry->version,
1121d9f87743SChuck Lever 			__entry->nr_pages, __entry->ret
1122d9f87743SChuck Lever 		)
1123d9f87743SChuck Lever );
1124d9f87743SChuck Lever 
11258224b273SChuck Lever TRACE_EVENT(nfs_initiate_read,
11268224b273SChuck Lever 		TP_PROTO(
11272343172dSTrond Myklebust 			const struct nfs_pgio_header *hdr
11288224b273SChuck Lever 		),
11298224b273SChuck Lever 
11302343172dSTrond Myklebust 		TP_ARGS(hdr),
11318224b273SChuck Lever 
11328224b273SChuck Lever 		TP_STRUCT__entry(
11338224b273SChuck Lever 			__field(dev_t, dev)
11348224b273SChuck Lever 			__field(u32, fhandle)
11358224b273SChuck Lever 			__field(u64, fileid)
11362343172dSTrond Myklebust 			__field(loff_t, offset)
11372343172dSTrond Myklebust 			__field(u32, count)
11388224b273SChuck Lever 		),
11398224b273SChuck Lever 
11408224b273SChuck Lever 		TP_fast_assign(
11412343172dSTrond Myklebust 			const struct inode *inode = hdr->inode;
11428224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
11432343172dSTrond Myklebust 			const struct nfs_fh *fh = hdr->args.fh ?
11442343172dSTrond Myklebust 						  hdr->args.fh : &nfsi->fh;
11458224b273SChuck Lever 
11462343172dSTrond Myklebust 			__entry->offset = hdr->args.offset;
11472343172dSTrond Myklebust 			__entry->count = hdr->args.count;
11488224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
11498224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
11502343172dSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
11518224b273SChuck Lever 		),
11528224b273SChuck Lever 
11538224b273SChuck Lever 		TP_printk(
11548224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
11552343172dSTrond Myklebust 			"offset=%lld count=%u",
11568224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
11578224b273SChuck Lever 			(unsigned long long)__entry->fileid,
11588224b273SChuck Lever 			__entry->fhandle,
11592343172dSTrond Myklebust 			(long long)__entry->offset, __entry->count
11608224b273SChuck Lever 		)
11618224b273SChuck Lever );
11628224b273SChuck Lever 
11638224b273SChuck Lever TRACE_EVENT(nfs_readpage_done,
11648224b273SChuck Lever 		TP_PROTO(
11652343172dSTrond Myklebust 			const struct rpc_task *task,
11662343172dSTrond Myklebust 			const struct nfs_pgio_header *hdr
11678224b273SChuck Lever 		),
11688224b273SChuck Lever 
11692343172dSTrond Myklebust 		TP_ARGS(task, hdr),
11708224b273SChuck Lever 
11718224b273SChuck Lever 		TP_STRUCT__entry(
11728224b273SChuck Lever 			__field(dev_t, dev)
11738224b273SChuck Lever 			__field(u32, fhandle)
11748224b273SChuck Lever 			__field(u64, fileid)
11752343172dSTrond Myklebust 			__field(loff_t, offset)
11762343172dSTrond Myklebust 			__field(u32, arg_count)
11772343172dSTrond Myklebust 			__field(u32, res_count)
11782343172dSTrond Myklebust 			__field(bool, eof)
11793fa5cbdcSTrond Myklebust 			__field(int, error)
11808224b273SChuck Lever 		),
11818224b273SChuck Lever 
11828224b273SChuck Lever 		TP_fast_assign(
11832343172dSTrond Myklebust 			const struct inode *inode = hdr->inode;
11848224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
11852343172dSTrond Myklebust 			const struct nfs_fh *fh = hdr->args.fh ?
11862343172dSTrond Myklebust 						  hdr->args.fh : &nfsi->fh;
11878224b273SChuck Lever 
11883fa5cbdcSTrond Myklebust 			__entry->error = task->tk_status;
11892343172dSTrond Myklebust 			__entry->offset = hdr->args.offset;
11902343172dSTrond Myklebust 			__entry->arg_count = hdr->args.count;
11912343172dSTrond Myklebust 			__entry->res_count = hdr->res.count;
11922343172dSTrond Myklebust 			__entry->eof = hdr->res.eof;
11938224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
11948224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
11952343172dSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
11968224b273SChuck Lever 		),
11978224b273SChuck Lever 
11988224b273SChuck Lever 		TP_printk(
11993fa5cbdcSTrond Myklebust 			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
12003fa5cbdcSTrond Myklebust 			"offset=%lld count=%u res=%u%s", __entry->error,
12018224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
12028224b273SChuck Lever 			(unsigned long long)__entry->fileid,
12038224b273SChuck Lever 			__entry->fhandle,
12042343172dSTrond Myklebust 			(long long)__entry->offset, __entry->arg_count,
12053fa5cbdcSTrond Myklebust 			__entry->res_count, __entry->eof ? " eof" : ""
12068224b273SChuck Lever 		)
12078224b273SChuck Lever );
12088224b273SChuck Lever 
1209fd2b6121SChuck Lever TRACE_EVENT(nfs_readpage_short,
1210fd2b6121SChuck Lever 		TP_PROTO(
1211fd2b6121SChuck Lever 			const struct rpc_task *task,
1212fd2b6121SChuck Lever 			const struct nfs_pgio_header *hdr
1213fd2b6121SChuck Lever 		),
1214fd2b6121SChuck Lever 
1215fd2b6121SChuck Lever 		TP_ARGS(task, hdr),
1216fd2b6121SChuck Lever 
1217fd2b6121SChuck Lever 		TP_STRUCT__entry(
1218fd2b6121SChuck Lever 			__field(dev_t, dev)
1219fd2b6121SChuck Lever 			__field(u32, fhandle)
1220fd2b6121SChuck Lever 			__field(u64, fileid)
1221fd2b6121SChuck Lever 			__field(loff_t, offset)
1222fd2b6121SChuck Lever 			__field(u32, arg_count)
1223fd2b6121SChuck Lever 			__field(u32, res_count)
1224fd2b6121SChuck Lever 			__field(bool, eof)
12253fa5cbdcSTrond Myklebust 			__field(int, error)
1226fd2b6121SChuck Lever 		),
1227fd2b6121SChuck Lever 
1228fd2b6121SChuck Lever 		TP_fast_assign(
1229fd2b6121SChuck Lever 			const struct inode *inode = hdr->inode;
1230fd2b6121SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
1231fd2b6121SChuck Lever 			const struct nfs_fh *fh = hdr->args.fh ?
1232fd2b6121SChuck Lever 						  hdr->args.fh : &nfsi->fh;
1233fd2b6121SChuck Lever 
12343fa5cbdcSTrond Myklebust 			__entry->error = task->tk_status;
1235fd2b6121SChuck Lever 			__entry->offset = hdr->args.offset;
1236fd2b6121SChuck Lever 			__entry->arg_count = hdr->args.count;
1237fd2b6121SChuck Lever 			__entry->res_count = hdr->res.count;
1238fd2b6121SChuck Lever 			__entry->eof = hdr->res.eof;
1239fd2b6121SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
1240fd2b6121SChuck Lever 			__entry->fileid = nfsi->fileid;
1241fd2b6121SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(fh);
1242fd2b6121SChuck Lever 		),
1243fd2b6121SChuck Lever 
1244fd2b6121SChuck Lever 		TP_printk(
12453fa5cbdcSTrond Myklebust 			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
12463fa5cbdcSTrond Myklebust 			"offset=%lld count=%u res=%u%s", __entry->error,
1247fd2b6121SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
1248fd2b6121SChuck Lever 			(unsigned long long)__entry->fileid,
1249fd2b6121SChuck Lever 			__entry->fhandle,
1250fd2b6121SChuck Lever 			(long long)__entry->offset, __entry->arg_count,
12513fa5cbdcSTrond Myklebust 			__entry->res_count, __entry->eof ? " eof" : ""
1252fd2b6121SChuck Lever 		)
1253fd2b6121SChuck Lever );
1254fd2b6121SChuck Lever 
1255e3f0a7feSDave Wysochanski 
1256cd2ed9bdSChuck Lever TRACE_EVENT(nfs_pgio_error,
1257cd2ed9bdSChuck Lever 	TP_PROTO(
1258cd2ed9bdSChuck Lever 		const struct nfs_pgio_header *hdr,
1259cd2ed9bdSChuck Lever 		int error,
1260cd2ed9bdSChuck Lever 		loff_t pos
1261cd2ed9bdSChuck Lever 	),
1262cd2ed9bdSChuck Lever 
1263cd2ed9bdSChuck Lever 	TP_ARGS(hdr, error, pos),
1264cd2ed9bdSChuck Lever 
1265cd2ed9bdSChuck Lever 	TP_STRUCT__entry(
1266cd2ed9bdSChuck Lever 		__field(dev_t, dev)
1267cd2ed9bdSChuck Lever 		__field(u32, fhandle)
1268cd2ed9bdSChuck Lever 		__field(u64, fileid)
1269cd2ed9bdSChuck Lever 		__field(loff_t, offset)
1270cd2ed9bdSChuck Lever 		__field(u32, arg_count)
1271cd2ed9bdSChuck Lever 		__field(u32, res_count)
1272cd2ed9bdSChuck Lever 		__field(loff_t, pos)
12733fa5cbdcSTrond Myklebust 		__field(int, error)
1274cd2ed9bdSChuck Lever 	),
1275cd2ed9bdSChuck Lever 
1276cd2ed9bdSChuck Lever 	TP_fast_assign(
1277cd2ed9bdSChuck Lever 		const struct inode *inode = hdr->inode;
1278cd2ed9bdSChuck Lever 		const struct nfs_inode *nfsi = NFS_I(inode);
1279cd2ed9bdSChuck Lever 		const struct nfs_fh *fh = hdr->args.fh ?
1280cd2ed9bdSChuck Lever 					  hdr->args.fh : &nfsi->fh;
1281cd2ed9bdSChuck Lever 
12823fa5cbdcSTrond Myklebust 		__entry->error = error;
1283cd2ed9bdSChuck Lever 		__entry->offset = hdr->args.offset;
1284cd2ed9bdSChuck Lever 		__entry->arg_count = hdr->args.count;
1285cd2ed9bdSChuck Lever 		__entry->res_count = hdr->res.count;
1286cd2ed9bdSChuck Lever 		__entry->dev = inode->i_sb->s_dev;
1287cd2ed9bdSChuck Lever 		__entry->fileid = nfsi->fileid;
1288cd2ed9bdSChuck Lever 		__entry->fhandle = nfs_fhandle_hash(fh);
1289cd2ed9bdSChuck Lever 	),
1290cd2ed9bdSChuck Lever 
12913fa5cbdcSTrond Myklebust 	TP_printk("error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
12923fa5cbdcSTrond Myklebust 		  "offset=%lld count=%u res=%u pos=%llu", __entry->error,
1293cd2ed9bdSChuck Lever 		MAJOR(__entry->dev), MINOR(__entry->dev),
1294cd2ed9bdSChuck Lever 		(unsigned long long)__entry->fileid, __entry->fhandle,
1295cd2ed9bdSChuck Lever 		(long long)__entry->offset, __entry->arg_count, __entry->res_count,
12963fa5cbdcSTrond Myklebust 		__entry->pos
1297cd2ed9bdSChuck Lever 	)
1298cd2ed9bdSChuck Lever );
1299cd2ed9bdSChuck Lever 
13008224b273SChuck Lever TRACE_EVENT(nfs_initiate_write,
13018224b273SChuck Lever 		TP_PROTO(
13025bb2a7cbSTrond Myklebust 			const struct nfs_pgio_header *hdr
13038224b273SChuck Lever 		),
13048224b273SChuck Lever 
13055bb2a7cbSTrond Myklebust 		TP_ARGS(hdr),
13068224b273SChuck Lever 
13078224b273SChuck Lever 		TP_STRUCT__entry(
13088224b273SChuck Lever 			__field(dev_t, dev)
13098224b273SChuck Lever 			__field(u32, fhandle)
13108224b273SChuck Lever 			__field(u64, fileid)
13115bb2a7cbSTrond Myklebust 			__field(loff_t, offset)
13125bb2a7cbSTrond Myklebust 			__field(u32, count)
13138791545eSChuck Lever 			__field(unsigned long, stable)
13148224b273SChuck Lever 		),
13158224b273SChuck Lever 
13168224b273SChuck Lever 		TP_fast_assign(
13175bb2a7cbSTrond Myklebust 			const struct inode *inode = hdr->inode;
13188224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
13195bb2a7cbSTrond Myklebust 			const struct nfs_fh *fh = hdr->args.fh ?
13205bb2a7cbSTrond Myklebust 						  hdr->args.fh : &nfsi->fh;
13218224b273SChuck Lever 
13225bb2a7cbSTrond Myklebust 			__entry->offset = hdr->args.offset;
13235bb2a7cbSTrond Myklebust 			__entry->count = hdr->args.count;
13245bb2a7cbSTrond Myklebust 			__entry->stable = hdr->args.stable;
13258224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
13268224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
13275bb2a7cbSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
13288224b273SChuck Lever 		),
13298224b273SChuck Lever 
13308224b273SChuck Lever 		TP_printk(
13318224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
13325bb2a7cbSTrond Myklebust 			"offset=%lld count=%u stable=%s",
13338224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
13348224b273SChuck Lever 			(unsigned long long)__entry->fileid,
13358224b273SChuck Lever 			__entry->fhandle,
13365bb2a7cbSTrond Myklebust 			(long long)__entry->offset, __entry->count,
13378791545eSChuck Lever 			show_nfs_stable_how(__entry->stable)
13388224b273SChuck Lever 		)
13398224b273SChuck Lever );
13408224b273SChuck Lever 
13418224b273SChuck Lever TRACE_EVENT(nfs_writeback_done,
13428224b273SChuck Lever 		TP_PROTO(
13435bb2a7cbSTrond Myklebust 			const struct rpc_task *task,
13445bb2a7cbSTrond Myklebust 			const struct nfs_pgio_header *hdr
13458224b273SChuck Lever 		),
13468224b273SChuck Lever 
13475bb2a7cbSTrond Myklebust 		TP_ARGS(task, hdr),
13488224b273SChuck Lever 
13498224b273SChuck Lever 		TP_STRUCT__entry(
13508224b273SChuck Lever 			__field(dev_t, dev)
13518224b273SChuck Lever 			__field(u32, fhandle)
13528224b273SChuck Lever 			__field(u64, fileid)
13535bb2a7cbSTrond Myklebust 			__field(loff_t, offset)
13545bb2a7cbSTrond Myklebust 			__field(u32, arg_count)
13555bb2a7cbSTrond Myklebust 			__field(u32, res_count)
13563fa5cbdcSTrond Myklebust 			__field(int, error)
13578791545eSChuck Lever 			__field(unsigned long, stable)
13585bb2a7cbSTrond Myklebust 			__array(char, verifier, NFS4_VERIFIER_SIZE)
13598224b273SChuck Lever 		),
13608224b273SChuck Lever 
13618224b273SChuck Lever 		TP_fast_assign(
13625bb2a7cbSTrond Myklebust 			const struct inode *inode = hdr->inode;
13638224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
13645bb2a7cbSTrond Myklebust 			const struct nfs_fh *fh = hdr->args.fh ?
13655bb2a7cbSTrond Myklebust 						  hdr->args.fh : &nfsi->fh;
13665bb2a7cbSTrond Myklebust 			const struct nfs_writeverf *verf = hdr->res.verf;
13678224b273SChuck Lever 
13683fa5cbdcSTrond Myklebust 			__entry->error = task->tk_status;
13695bb2a7cbSTrond Myklebust 			__entry->offset = hdr->args.offset;
13705bb2a7cbSTrond Myklebust 			__entry->arg_count = hdr->args.count;
13715bb2a7cbSTrond Myklebust 			__entry->res_count = hdr->res.count;
13725bb2a7cbSTrond Myklebust 			__entry->stable = verf->committed;
13735bb2a7cbSTrond Myklebust 			memcpy(__entry->verifier,
13745bb2a7cbSTrond Myklebust 				&verf->verifier,
13755bb2a7cbSTrond Myklebust 				NFS4_VERIFIER_SIZE);
13768224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
13778224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
13785bb2a7cbSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
13798224b273SChuck Lever 		),
13808224b273SChuck Lever 
13818224b273SChuck Lever 		TP_printk(
13823fa5cbdcSTrond Myklebust 			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
13833fa5cbdcSTrond Myklebust 			"offset=%lld count=%u res=%u stable=%s "
13843fa5cbdcSTrond Myklebust 			"verifier=%s", __entry->error,
13858224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
13868224b273SChuck Lever 			(unsigned long long)__entry->fileid,
13878224b273SChuck Lever 			__entry->fhandle,
13885bb2a7cbSTrond Myklebust 			(long long)__entry->offset, __entry->arg_count,
13893fa5cbdcSTrond Myklebust 			__entry->res_count,
13908791545eSChuck Lever 			show_nfs_stable_how(__entry->stable),
13918791545eSChuck Lever 			show_nfs4_verifier(__entry->verifier)
13928224b273SChuck Lever 		)
13938224b273SChuck Lever );
13948224b273SChuck Lever 
1395861e1671SChuck Lever DECLARE_EVENT_CLASS(nfs_page_error_class,
1396861e1671SChuck Lever 		TP_PROTO(
1397af887e43STrond Myklebust 			const struct inode *inode,
1398861e1671SChuck Lever 			const struct nfs_page *req,
1399861e1671SChuck Lever 			int error
1400861e1671SChuck Lever 		),
1401861e1671SChuck Lever 
1402af887e43STrond Myklebust 		TP_ARGS(inode, req, error),
1403861e1671SChuck Lever 
1404861e1671SChuck Lever 		TP_STRUCT__entry(
1405af887e43STrond Myklebust 			__field(dev_t, dev)
1406af887e43STrond Myklebust 			__field(u32, fhandle)
1407af887e43STrond Myklebust 			__field(u64, fileid)
1408af887e43STrond Myklebust 			__field(loff_t, offset)
1409af887e43STrond Myklebust 			__field(unsigned int, count)
1410861e1671SChuck Lever 			__field(int, error)
1411861e1671SChuck Lever 		),
1412861e1671SChuck Lever 
1413861e1671SChuck Lever 		TP_fast_assign(
1414af887e43STrond Myklebust 			const struct nfs_inode *nfsi = NFS_I(inode);
1415af887e43STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
1416af887e43STrond Myklebust 			__entry->fileid = nfsi->fileid;
1417af887e43STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1418af887e43STrond Myklebust 			__entry->offset = req_offset(req);
1419af887e43STrond Myklebust 			__entry->count = req->wb_bytes;
1420861e1671SChuck Lever 			__entry->error = error;
1421861e1671SChuck Lever 		),
1422861e1671SChuck Lever 
1423861e1671SChuck Lever 		TP_printk(
1424af887e43STrond Myklebust 			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
1425af887e43STrond Myklebust 			"offset=%lld count=%u", __entry->error,
1426af887e43STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
1427af887e43STrond Myklebust 			(unsigned long long)__entry->fileid,
1428af887e43STrond Myklebust 			__entry->fhandle, __entry->offset,
1429af887e43STrond Myklebust 			__entry->count
1430861e1671SChuck Lever 		)
1431861e1671SChuck Lever );
1432861e1671SChuck Lever 
1433861e1671SChuck Lever #define DEFINE_NFS_PAGEERR_EVENT(name) \
1434861e1671SChuck Lever 	DEFINE_EVENT(nfs_page_error_class, name, \
1435861e1671SChuck Lever 			TP_PROTO( \
1436af887e43STrond Myklebust 				const struct inode *inode, \
1437861e1671SChuck Lever 				const struct nfs_page *req, \
1438861e1671SChuck Lever 				int error \
1439861e1671SChuck Lever 			), \
1440af887e43STrond Myklebust 			TP_ARGS(inode, req, error))
1441861e1671SChuck Lever 
1442861e1671SChuck Lever DEFINE_NFS_PAGEERR_EVENT(nfs_write_error);
1443861e1671SChuck Lever DEFINE_NFS_PAGEERR_EVENT(nfs_comp_error);
1444861e1671SChuck Lever DEFINE_NFS_PAGEERR_EVENT(nfs_commit_error);
1445861e1671SChuck Lever 
14468224b273SChuck Lever TRACE_EVENT(nfs_initiate_commit,
14478224b273SChuck Lever 		TP_PROTO(
14488224b273SChuck Lever 			const struct nfs_commit_data *data
14498224b273SChuck Lever 		),
14508224b273SChuck Lever 
14518224b273SChuck Lever 		TP_ARGS(data),
14528224b273SChuck Lever 
14538224b273SChuck Lever 		TP_STRUCT__entry(
14548224b273SChuck Lever 			__field(dev_t, dev)
14558224b273SChuck Lever 			__field(u32, fhandle)
14568224b273SChuck Lever 			__field(u64, fileid)
14577bdd297eSTrond Myklebust 			__field(loff_t, offset)
14587bdd297eSTrond Myklebust 			__field(u32, count)
14598224b273SChuck Lever 		),
14608224b273SChuck Lever 
14618224b273SChuck Lever 		TP_fast_assign(
14628224b273SChuck Lever 			const struct inode *inode = data->inode;
14638224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
14647bdd297eSTrond Myklebust 			const struct nfs_fh *fh = data->args.fh ?
14657bdd297eSTrond Myklebust 						  data->args.fh : &nfsi->fh;
14668224b273SChuck Lever 
14678224b273SChuck Lever 			__entry->offset = data->args.offset;
14688224b273SChuck Lever 			__entry->count = data->args.count;
14698224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
14708224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
14717bdd297eSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
14728224b273SChuck Lever 		),
14738224b273SChuck Lever 
14748224b273SChuck Lever 		TP_printk(
14758224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
14767bdd297eSTrond Myklebust 			"offset=%lld count=%u",
14778224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
14788224b273SChuck Lever 			(unsigned long long)__entry->fileid,
14798224b273SChuck Lever 			__entry->fhandle,
14807bdd297eSTrond Myklebust 			(long long)__entry->offset, __entry->count
14818224b273SChuck Lever 		)
14828224b273SChuck Lever );
14838224b273SChuck Lever 
14848224b273SChuck Lever TRACE_EVENT(nfs_commit_done,
14858224b273SChuck Lever 		TP_PROTO(
14867bdd297eSTrond Myklebust 			const struct rpc_task *task,
14878224b273SChuck Lever 			const struct nfs_commit_data *data
14888224b273SChuck Lever 		),
14898224b273SChuck Lever 
14907bdd297eSTrond Myklebust 		TP_ARGS(task, data),
14918224b273SChuck Lever 
14928224b273SChuck Lever 		TP_STRUCT__entry(
14938224b273SChuck Lever 			__field(dev_t, dev)
14948224b273SChuck Lever 			__field(u32, fhandle)
14958224b273SChuck Lever 			__field(u64, fileid)
14967bdd297eSTrond Myklebust 			__field(loff_t, offset)
14973fa5cbdcSTrond Myklebust 			__field(int, error)
14988791545eSChuck Lever 			__field(unsigned long, stable)
14997bdd297eSTrond Myklebust 			__array(char, verifier, NFS4_VERIFIER_SIZE)
15008224b273SChuck Lever 		),
15018224b273SChuck Lever 
15028224b273SChuck Lever 		TP_fast_assign(
15038224b273SChuck Lever 			const struct inode *inode = data->inode;
15048224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
15057bdd297eSTrond Myklebust 			const struct nfs_fh *fh = data->args.fh ?
15067bdd297eSTrond Myklebust 						  data->args.fh : &nfsi->fh;
15077bdd297eSTrond Myklebust 			const struct nfs_writeverf *verf = data->res.verf;
15088224b273SChuck Lever 
15093fa5cbdcSTrond Myklebust 			__entry->error = task->tk_status;
15108224b273SChuck Lever 			__entry->offset = data->args.offset;
15117bdd297eSTrond Myklebust 			__entry->stable = verf->committed;
15127bdd297eSTrond Myklebust 			memcpy(__entry->verifier,
15137bdd297eSTrond Myklebust 				&verf->verifier,
15147bdd297eSTrond Myklebust 				NFS4_VERIFIER_SIZE);
15158224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
15168224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
15177bdd297eSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
15188224b273SChuck Lever 		),
15198224b273SChuck Lever 
15208224b273SChuck Lever 		TP_printk(
15213fa5cbdcSTrond Myklebust 			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
15223fa5cbdcSTrond Myklebust 			"offset=%lld stable=%s verifier=%s", __entry->error,
15238224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
15248224b273SChuck Lever 			(unsigned long long)__entry->fileid,
15258224b273SChuck Lever 			__entry->fhandle,
15263fa5cbdcSTrond Myklebust 			(long long)__entry->offset,
15278791545eSChuck Lever 			show_nfs_stable_how(__entry->stable),
15288791545eSChuck Lever 			show_nfs4_verifier(__entry->verifier)
15298224b273SChuck Lever 		)
15308224b273SChuck Lever );
15318224b273SChuck Lever 
15328efc4bbeSJeff Layton #define nfs_show_direct_req_flags(v) \
15338efc4bbeSJeff Layton 	__print_flags(v, "|", \
15348efc4bbeSJeff Layton 			{ NFS_ODIRECT_DO_COMMIT, "DO_COMMIT" }, \
15358efc4bbeSJeff Layton 			{ NFS_ODIRECT_RESCHED_WRITES, "RESCHED_WRITES" }, \
15368efc4bbeSJeff Layton 			{ NFS_ODIRECT_SHOULD_DIRTY, "SHOULD DIRTY" }, \
15378efc4bbeSJeff Layton 			{ NFS_ODIRECT_DONE, "DONE" } )
15388efc4bbeSJeff Layton 
15398efc4bbeSJeff Layton DECLARE_EVENT_CLASS(nfs_direct_req_class,
15408efc4bbeSJeff Layton 		TP_PROTO(
15418efc4bbeSJeff Layton 			const struct nfs_direct_req *dreq
15428efc4bbeSJeff Layton 		),
15438efc4bbeSJeff Layton 
15448efc4bbeSJeff Layton 		TP_ARGS(dreq),
15458efc4bbeSJeff Layton 
15468efc4bbeSJeff Layton 		TP_STRUCT__entry(
15478efc4bbeSJeff Layton 			__field(dev_t, dev)
15488efc4bbeSJeff Layton 			__field(u64, fileid)
15498efc4bbeSJeff Layton 			__field(u32, fhandle)
1550b313eb91STrond Myklebust 			__field(loff_t, offset)
15518efc4bbeSJeff Layton 			__field(ssize_t, count)
15528efc4bbeSJeff Layton 			__field(ssize_t, error)
15538efc4bbeSJeff Layton 			__field(int, flags)
15548efc4bbeSJeff Layton 		),
15558efc4bbeSJeff Layton 
15568efc4bbeSJeff Layton 		TP_fast_assign(
15578efc4bbeSJeff Layton 			const struct inode *inode = dreq->inode;
15588efc4bbeSJeff Layton 			const struct nfs_inode *nfsi = NFS_I(inode);
15598efc4bbeSJeff Layton 			const struct nfs_fh *fh = &nfsi->fh;
15608efc4bbeSJeff Layton 
15618efc4bbeSJeff Layton 			__entry->dev = inode->i_sb->s_dev;
15628efc4bbeSJeff Layton 			__entry->fileid = nfsi->fileid;
15638efc4bbeSJeff Layton 			__entry->fhandle = nfs_fhandle_hash(fh);
1564b313eb91STrond Myklebust 			__entry->offset = dreq->io_start;
15658efc4bbeSJeff Layton 			__entry->count = dreq->count;
15668efc4bbeSJeff Layton 			__entry->error = dreq->error;
15678efc4bbeSJeff Layton 			__entry->flags = dreq->flags;
15688efc4bbeSJeff Layton 		),
15698efc4bbeSJeff Layton 
15708efc4bbeSJeff Layton 		TP_printk(
1571b313eb91STrond Myklebust 			"error=%zd fileid=%02x:%02x:%llu fhandle=0x%08x "
15721fd5394eSBenjamin Coddington 			"offset=%lld count=%zd flags=%s",
1573b313eb91STrond Myklebust 			__entry->error, MAJOR(__entry->dev),
1574b313eb91STrond Myklebust 			MINOR(__entry->dev),
15758efc4bbeSJeff Layton 			(unsigned long long)__entry->fileid,
1576b313eb91STrond Myklebust 			__entry->fhandle, __entry->offset,
15771fd5394eSBenjamin Coddington 			__entry->count,
1578b313eb91STrond Myklebust 			nfs_show_direct_req_flags(__entry->flags)
15798efc4bbeSJeff Layton 		)
15808efc4bbeSJeff Layton );
15818efc4bbeSJeff Layton 
15828efc4bbeSJeff Layton #define DEFINE_NFS_DIRECT_REQ_EVENT(name) \
15838efc4bbeSJeff Layton 	DEFINE_EVENT(nfs_direct_req_class, name, \
15848efc4bbeSJeff Layton 			TP_PROTO( \
15858efc4bbeSJeff Layton 				const struct nfs_direct_req *dreq \
15868efc4bbeSJeff Layton 			), \
15878efc4bbeSJeff Layton 			TP_ARGS(dreq))
15888efc4bbeSJeff Layton 
15898efc4bbeSJeff Layton DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_commit_complete);
15908efc4bbeSJeff Layton DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_resched_write);
15918efc4bbeSJeff Layton DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_complete);
15928efc4bbeSJeff Layton DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_completion);
15938efc4bbeSJeff Layton DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_schedule_iovec);
15948efc4bbeSJeff Layton DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_reschedule_io);
15958efc4bbeSJeff Layton 
159643622eabSTrond Myklebust TRACE_EVENT(nfs_fh_to_dentry,
159743622eabSTrond Myklebust 		TP_PROTO(
159843622eabSTrond Myklebust 			const struct super_block *sb,
159943622eabSTrond Myklebust 			const struct nfs_fh *fh,
160043622eabSTrond Myklebust 			u64 fileid,
160143622eabSTrond Myklebust 			int error
160243622eabSTrond Myklebust 		),
160343622eabSTrond Myklebust 
160443622eabSTrond Myklebust 		TP_ARGS(sb, fh, fileid, error),
160543622eabSTrond Myklebust 
160643622eabSTrond Myklebust 		TP_STRUCT__entry(
160743622eabSTrond Myklebust 			__field(int, error)
160843622eabSTrond Myklebust 			__field(dev_t, dev)
160943622eabSTrond Myklebust 			__field(u32, fhandle)
161043622eabSTrond Myklebust 			__field(u64, fileid)
161143622eabSTrond Myklebust 		),
161243622eabSTrond Myklebust 
161343622eabSTrond Myklebust 		TP_fast_assign(
161443622eabSTrond Myklebust 			__entry->error = error;
161543622eabSTrond Myklebust 			__entry->dev = sb->s_dev;
161643622eabSTrond Myklebust 			__entry->fileid = fileid;
161743622eabSTrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(fh);
161843622eabSTrond Myklebust 		),
161943622eabSTrond Myklebust 
162043622eabSTrond Myklebust 		TP_printk(
162143622eabSTrond Myklebust 			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x ",
162243622eabSTrond Myklebust 			__entry->error,
162343622eabSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
162443622eabSTrond Myklebust 			(unsigned long long)__entry->fileid,
162543622eabSTrond Myklebust 			__entry->fhandle
162643622eabSTrond Myklebust 		)
162743622eabSTrond Myklebust );
162843622eabSTrond Myklebust 
162933ce83efSChuck Lever TRACE_EVENT(nfs_mount_assign,
163033ce83efSChuck Lever 	TP_PROTO(
163133ce83efSChuck Lever 		const char *option,
163233ce83efSChuck Lever 		const char *value
163333ce83efSChuck Lever 	),
163433ce83efSChuck Lever 
163533ce83efSChuck Lever 	TP_ARGS(option, value),
163633ce83efSChuck Lever 
163733ce83efSChuck Lever 	TP_STRUCT__entry(
163833ce83efSChuck Lever 		__string(option, option)
163933ce83efSChuck Lever 		__string(value, value)
164033ce83efSChuck Lever 	),
164133ce83efSChuck Lever 
164233ce83efSChuck Lever 	TP_fast_assign(
16432c92ca84SSteven Rostedt (Google) 		__assign_str(option);
16442c92ca84SSteven Rostedt (Google) 		__assign_str(value);
164533ce83efSChuck Lever 	),
164633ce83efSChuck Lever 
164733ce83efSChuck Lever 	TP_printk("option %s=%s",
164833ce83efSChuck Lever 		__get_str(option), __get_str(value)
164933ce83efSChuck Lever 	)
165033ce83efSChuck Lever );
165133ce83efSChuck Lever 
165233ce83efSChuck Lever TRACE_EVENT(nfs_mount_option,
165333ce83efSChuck Lever 	TP_PROTO(
165433ce83efSChuck Lever 		const struct fs_parameter *param
165533ce83efSChuck Lever 	),
165633ce83efSChuck Lever 
165733ce83efSChuck Lever 	TP_ARGS(param),
165833ce83efSChuck Lever 
165933ce83efSChuck Lever 	TP_STRUCT__entry(
166033ce83efSChuck Lever 		__string(option, param->key)
166133ce83efSChuck Lever 	),
166233ce83efSChuck Lever 
166333ce83efSChuck Lever 	TP_fast_assign(
16642c92ca84SSteven Rostedt (Google) 		__assign_str(option);
166533ce83efSChuck Lever 	),
166633ce83efSChuck Lever 
166733ce83efSChuck Lever 	TP_printk("option %s", __get_str(option))
166833ce83efSChuck Lever );
166933ce83efSChuck Lever 
167033ce83efSChuck Lever TRACE_EVENT(nfs_mount_path,
167133ce83efSChuck Lever 	TP_PROTO(
167233ce83efSChuck Lever 		const char *path
167333ce83efSChuck Lever 	),
167433ce83efSChuck Lever 
167533ce83efSChuck Lever 	TP_ARGS(path),
167633ce83efSChuck Lever 
167733ce83efSChuck Lever 	TP_STRUCT__entry(
167833ce83efSChuck Lever 		__string(path, path)
167933ce83efSChuck Lever 	),
168033ce83efSChuck Lever 
168133ce83efSChuck Lever 	TP_fast_assign(
16822c92ca84SSteven Rostedt (Google) 		__assign_str(path);
168333ce83efSChuck Lever 	),
168433ce83efSChuck Lever 
168533ce83efSChuck Lever 	TP_printk("path='%s'", __get_str(path))
168633ce83efSChuck Lever );
168733ce83efSChuck Lever 
1688*70ba381eSWeston Andros Adamson TRACE_EVENT(nfs_local_open_fh,
1689*70ba381eSWeston Andros Adamson 		TP_PROTO(
1690*70ba381eSWeston Andros Adamson 			const struct nfs_fh *fh,
1691*70ba381eSWeston Andros Adamson 			fmode_t fmode,
1692*70ba381eSWeston Andros Adamson 			int error
1693*70ba381eSWeston Andros Adamson 		),
1694*70ba381eSWeston Andros Adamson 
1695*70ba381eSWeston Andros Adamson 		TP_ARGS(fh, fmode, error),
1696*70ba381eSWeston Andros Adamson 
1697*70ba381eSWeston Andros Adamson 		TP_STRUCT__entry(
1698*70ba381eSWeston Andros Adamson 			__field(int, error)
1699*70ba381eSWeston Andros Adamson 			__field(u32, fhandle)
1700*70ba381eSWeston Andros Adamson 			__field(unsigned int, fmode)
1701*70ba381eSWeston Andros Adamson 		),
1702*70ba381eSWeston Andros Adamson 
1703*70ba381eSWeston Andros Adamson 		TP_fast_assign(
1704*70ba381eSWeston Andros Adamson 			__entry->error = error;
1705*70ba381eSWeston Andros Adamson 			__entry->fhandle = nfs_fhandle_hash(fh);
1706*70ba381eSWeston Andros Adamson 			__entry->fmode = (__force unsigned int)fmode;
1707*70ba381eSWeston Andros Adamson 		),
1708*70ba381eSWeston Andros Adamson 
1709*70ba381eSWeston Andros Adamson 		TP_printk(
1710*70ba381eSWeston Andros Adamson 			"error=%d fhandle=0x%08x mode=%s",
1711*70ba381eSWeston Andros Adamson 			__entry->error,
1712*70ba381eSWeston Andros Adamson 			__entry->fhandle,
1713*70ba381eSWeston Andros Adamson 			show_fs_fmode_flags(__entry->fmode)
1714*70ba381eSWeston Andros Adamson 		)
1715*70ba381eSWeston Andros Adamson );
1716*70ba381eSWeston Andros Adamson 
1717*70ba381eSWeston Andros Adamson DECLARE_EVENT_CLASS(nfs_local_client_event,
1718*70ba381eSWeston Andros Adamson 		TP_PROTO(
1719*70ba381eSWeston Andros Adamson 			const struct nfs_client *clp
1720*70ba381eSWeston Andros Adamson 		),
1721*70ba381eSWeston Andros Adamson 
1722*70ba381eSWeston Andros Adamson 		TP_ARGS(clp),
1723*70ba381eSWeston Andros Adamson 
1724*70ba381eSWeston Andros Adamson 		TP_STRUCT__entry(
1725*70ba381eSWeston Andros Adamson 			__field(unsigned int, protocol)
1726*70ba381eSWeston Andros Adamson 			__string(server, clp->cl_hostname)
1727*70ba381eSWeston Andros Adamson 		),
1728*70ba381eSWeston Andros Adamson 
1729*70ba381eSWeston Andros Adamson 		TP_fast_assign(
1730*70ba381eSWeston Andros Adamson 			__entry->protocol = clp->rpc_ops->version;
1731*70ba381eSWeston Andros Adamson 			__assign_str(server);
1732*70ba381eSWeston Andros Adamson 		),
1733*70ba381eSWeston Andros Adamson 
1734*70ba381eSWeston Andros Adamson 		TP_printk(
1735*70ba381eSWeston Andros Adamson 			"server=%s NFSv%u", __get_str(server), __entry->protocol
1736*70ba381eSWeston Andros Adamson 		)
1737*70ba381eSWeston Andros Adamson );
1738*70ba381eSWeston Andros Adamson 
1739*70ba381eSWeston Andros Adamson #define DEFINE_NFS_LOCAL_CLIENT_EVENT(name) \
1740*70ba381eSWeston Andros Adamson 	DEFINE_EVENT(nfs_local_client_event, name, \
1741*70ba381eSWeston Andros Adamson 			TP_PROTO( \
1742*70ba381eSWeston Andros Adamson 				const struct nfs_client *clp \
1743*70ba381eSWeston Andros Adamson 			), \
1744*70ba381eSWeston Andros Adamson 			TP_ARGS(clp))
1745*70ba381eSWeston Andros Adamson 
1746*70ba381eSWeston Andros Adamson DEFINE_NFS_LOCAL_CLIENT_EVENT(nfs_local_enable);
1747*70ba381eSWeston Andros Adamson DEFINE_NFS_LOCAL_CLIENT_EVENT(nfs_local_disable);
1748*70ba381eSWeston Andros Adamson 
17493d66bae1STrond Myklebust DECLARE_EVENT_CLASS(nfs_xdr_event,
1750f23f6584SChuck Lever 		TP_PROTO(
175162a92ba9SChuck Lever 			const struct xdr_stream *xdr,
1752f23f6584SChuck Lever 			int error
1753f23f6584SChuck Lever 		),
1754f23f6584SChuck Lever 
175562a92ba9SChuck Lever 		TP_ARGS(xdr, error),
1756f23f6584SChuck Lever 
1757f23f6584SChuck Lever 		TP_STRUCT__entry(
175862a92ba9SChuck Lever 			__field(unsigned int, task_id)
175962a92ba9SChuck Lever 			__field(unsigned int, client_id)
176062a92ba9SChuck Lever 			__field(u32, xid)
17615be59458SChuck Lever 			__field(int, version)
176238a638a7SChuck Lever 			__field(unsigned long, error)
17635be59458SChuck Lever 			__string(program,
17645be59458SChuck Lever 				 xdr->rqst->rq_task->tk_client->cl_program->name)
17655be59458SChuck Lever 			__string(procedure,
17665be59458SChuck Lever 				 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
1767f23f6584SChuck Lever 		),
1768f23f6584SChuck Lever 
1769f23f6584SChuck Lever 		TP_fast_assign(
177062a92ba9SChuck Lever 			const struct rpc_rqst *rqstp = xdr->rqst;
177162a92ba9SChuck Lever 			const struct rpc_task *task = rqstp->rq_task;
177262a92ba9SChuck Lever 
177362a92ba9SChuck Lever 			__entry->task_id = task->tk_pid;
177462a92ba9SChuck Lever 			__entry->client_id = task->tk_client->cl_clid;
177562a92ba9SChuck Lever 			__entry->xid = be32_to_cpu(rqstp->rq_xid);
17765be59458SChuck Lever 			__entry->version = task->tk_client->cl_vers;
1777f23f6584SChuck Lever 			__entry->error = error;
17782c92ca84SSteven Rostedt (Google) 			__assign_str(program);
17792c92ca84SSteven Rostedt (Google) 			__assign_str(procedure);
1780f23f6584SChuck Lever 		),
1781f23f6584SChuck Lever 
1782b4776a34SChuck Lever 		TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
1783b4776a34SChuck Lever 			  " xid=0x%08x %sv%d %s error=%ld (%s)",
178462a92ba9SChuck Lever 			__entry->task_id, __entry->client_id, __entry->xid,
17855be59458SChuck Lever 			__get_str(program), __entry->version,
17865be59458SChuck Lever 			__get_str(procedure), -__entry->error,
17878791545eSChuck Lever 			show_nfs_status(__entry->error)
1788f23f6584SChuck Lever 		)
1789f23f6584SChuck Lever );
17903d66bae1STrond Myklebust #define DEFINE_NFS_XDR_EVENT(name) \
17913d66bae1STrond Myklebust 	DEFINE_EVENT(nfs_xdr_event, name, \
17923d66bae1STrond Myklebust 			TP_PROTO( \
17933d66bae1STrond Myklebust 				const struct xdr_stream *xdr, \
17943d66bae1STrond Myklebust 				int error \
17953d66bae1STrond Myklebust 			), \
17963d66bae1STrond Myklebust 			TP_ARGS(xdr, error))
17973d66bae1STrond Myklebust DEFINE_NFS_XDR_EVENT(nfs_xdr_status);
1798eb3d58c6STrond Myklebust DEFINE_NFS_XDR_EVENT(nfs_xdr_bad_filehandle);
1799f23f6584SChuck Lever 
1800f4ce1299STrond Myklebust #endif /* _TRACE_NFS_H */
1801f4ce1299STrond Myklebust 
1802f4ce1299STrond Myklebust #undef TRACE_INCLUDE_PATH
1803f4ce1299STrond Myklebust #define TRACE_INCLUDE_PATH .
1804f4ce1299STrond Myklebust #define TRACE_INCLUDE_FILE nfstrace
1805f4ce1299STrond Myklebust /* This part must be outside protection */
1806f4ce1299STrond Myklebust #include <trace/define_trace.h>
1807