xref: /linux/fs/nfs/nfstrace.h (revision 06e1902456f3d0e45c3e64b75124339d67c83e5b)
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>
12f4ce1299STrond Myklebust 
13f4ce1299STrond Myklebust #define nfs_show_file_type(ftype) \
14f4ce1299STrond Myklebust 	__print_symbolic(ftype, \
15f4ce1299STrond Myklebust 			{ DT_UNKNOWN, "UNKNOWN" }, \
16f4ce1299STrond Myklebust 			{ DT_FIFO, "FIFO" }, \
17f4ce1299STrond Myklebust 			{ DT_CHR, "CHR" }, \
18f4ce1299STrond Myklebust 			{ DT_DIR, "DIR" }, \
19f4ce1299STrond Myklebust 			{ DT_BLK, "BLK" }, \
20f4ce1299STrond Myklebust 			{ DT_REG, "REG" }, \
21f4ce1299STrond Myklebust 			{ DT_LNK, "LNK" }, \
22f4ce1299STrond Myklebust 			{ DT_SOCK, "SOCK" }, \
23f4ce1299STrond Myklebust 			{ DT_WHT, "WHT" })
24f4ce1299STrond Myklebust 
25f4ce1299STrond Myklebust #define nfs_show_cache_validity(v) \
26f4ce1299STrond Myklebust 	__print_flags(v, "|", \
27f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_ATTR, "INVALID_ATTR" }, \
28f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
29f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
30f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
31f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
32f4ce1299STrond Myklebust 			{ NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \
33f4ce1299STrond Myklebust 			{ NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
34f4ce1299STrond Myklebust 			{ NFS_INO_INVALID_LABEL, "INVALID_LABEL" })
35f4ce1299STrond Myklebust 
36f4ce1299STrond Myklebust #define nfs_show_nfsi_flags(v) \
37f4ce1299STrond Myklebust 	__print_flags(v, "|", \
38f4ce1299STrond Myklebust 			{ 1 << NFS_INO_ADVISE_RDPLUS, "ADVISE_RDPLUS" }, \
39f4ce1299STrond Myklebust 			{ 1 << NFS_INO_STALE, "STALE" }, \
40d529ef83SJeff Layton 			{ 1 << NFS_INO_INVALIDATING, "INVALIDATING" }, \
41f4ce1299STrond Myklebust 			{ 1 << NFS_INO_FSCACHE, "FSCACHE" }, \
42f4ce1299STrond Myklebust 			{ 1 << NFS_INO_LAYOUTCOMMIT, "NEED_LAYOUTCOMMIT" }, \
43f4ce1299STrond Myklebust 			{ 1 << NFS_INO_LAYOUTCOMMITTING, "LAYOUTCOMMIT" })
44f4ce1299STrond Myklebust 
45f4ce1299STrond Myklebust DECLARE_EVENT_CLASS(nfs_inode_event,
46f4ce1299STrond Myklebust 		TP_PROTO(
47f4ce1299STrond Myklebust 			const struct inode *inode
48f4ce1299STrond Myklebust 		),
49f4ce1299STrond Myklebust 
50f4ce1299STrond Myklebust 		TP_ARGS(inode),
51f4ce1299STrond Myklebust 
52f4ce1299STrond Myklebust 		TP_STRUCT__entry(
53f4ce1299STrond Myklebust 			__field(dev_t, dev)
54f4ce1299STrond Myklebust 			__field(u32, fhandle)
55f4ce1299STrond Myklebust 			__field(u64, fileid)
56f4ce1299STrond Myklebust 			__field(u64, version)
57f4ce1299STrond Myklebust 		),
58f4ce1299STrond Myklebust 
59f4ce1299STrond Myklebust 		TP_fast_assign(
60f4ce1299STrond Myklebust 			const struct nfs_inode *nfsi = NFS_I(inode);
61f4ce1299STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
62f4ce1299STrond Myklebust 			__entry->fileid = nfsi->fileid;
63f4ce1299STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
64f4ce1299STrond Myklebust 			__entry->version = inode->i_version;
65f4ce1299STrond Myklebust 		),
66f4ce1299STrond Myklebust 
67f4ce1299STrond Myklebust 		TP_printk(
68f4ce1299STrond Myklebust 			"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
69f4ce1299STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
70f4ce1299STrond Myklebust 			(unsigned long long)__entry->fileid,
71f4ce1299STrond Myklebust 			__entry->fhandle,
72f4ce1299STrond Myklebust 			(unsigned long long)__entry->version
73f4ce1299STrond Myklebust 		)
74f4ce1299STrond Myklebust );
75f4ce1299STrond Myklebust 
76f4ce1299STrond Myklebust DECLARE_EVENT_CLASS(nfs_inode_event_done,
77f4ce1299STrond Myklebust 		TP_PROTO(
78f4ce1299STrond Myklebust 			const struct inode *inode,
79f4ce1299STrond Myklebust 			int error
80f4ce1299STrond Myklebust 		),
81f4ce1299STrond Myklebust 
82f4ce1299STrond Myklebust 		TP_ARGS(inode, error),
83f4ce1299STrond Myklebust 
84f4ce1299STrond Myklebust 		TP_STRUCT__entry(
85f4ce1299STrond Myklebust 			__field(int, error)
86f4ce1299STrond Myklebust 			__field(dev_t, dev)
87f4ce1299STrond Myklebust 			__field(u32, fhandle)
88f4ce1299STrond Myklebust 			__field(unsigned char, type)
89f4ce1299STrond Myklebust 			__field(u64, fileid)
90f4ce1299STrond Myklebust 			__field(u64, version)
91f4ce1299STrond Myklebust 			__field(loff_t, size)
92f4ce1299STrond Myklebust 			__field(unsigned long, nfsi_flags)
93f4ce1299STrond Myklebust 			__field(unsigned long, cache_validity)
94f4ce1299STrond Myklebust 		),
95f4ce1299STrond Myklebust 
96f4ce1299STrond Myklebust 		TP_fast_assign(
97f4ce1299STrond Myklebust 			const struct nfs_inode *nfsi = NFS_I(inode);
98f4ce1299STrond Myklebust 			__entry->error = error;
99f4ce1299STrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
100f4ce1299STrond Myklebust 			__entry->fileid = nfsi->fileid;
101f4ce1299STrond Myklebust 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
102f4ce1299STrond Myklebust 			__entry->type = nfs_umode_to_dtype(inode->i_mode);
103f4ce1299STrond Myklebust 			__entry->version = inode->i_version;
104f4ce1299STrond Myklebust 			__entry->size = i_size_read(inode);
105f4ce1299STrond Myklebust 			__entry->nfsi_flags = nfsi->flags;
106f4ce1299STrond Myklebust 			__entry->cache_validity = nfsi->cache_validity;
107f4ce1299STrond Myklebust 		),
108f4ce1299STrond Myklebust 
109f4ce1299STrond Myklebust 		TP_printk(
110f4ce1299STrond Myklebust 			"error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
111f4ce1299STrond Myklebust 			"type=%u (%s) version=%llu size=%lld "
112f4ce1299STrond Myklebust 			"cache_validity=%lu (%s) nfs_flags=%ld (%s)",
113f4ce1299STrond Myklebust 			__entry->error,
114f4ce1299STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
115f4ce1299STrond Myklebust 			(unsigned long long)__entry->fileid,
116f4ce1299STrond Myklebust 			__entry->fhandle,
117f4ce1299STrond Myklebust 			__entry->type,
118f4ce1299STrond Myklebust 			nfs_show_file_type(__entry->type),
119f4ce1299STrond Myklebust 			(unsigned long long)__entry->version,
120f4ce1299STrond Myklebust 			(long long)__entry->size,
121f4ce1299STrond Myklebust 			__entry->cache_validity,
122f4ce1299STrond Myklebust 			nfs_show_cache_validity(__entry->cache_validity),
123f4ce1299STrond Myklebust 			__entry->nfsi_flags,
124f4ce1299STrond Myklebust 			nfs_show_nfsi_flags(__entry->nfsi_flags)
125f4ce1299STrond Myklebust 		)
126f4ce1299STrond Myklebust );
127f4ce1299STrond Myklebust 
128f4ce1299STrond Myklebust #define DEFINE_NFS_INODE_EVENT(name) \
129f4ce1299STrond Myklebust 	DEFINE_EVENT(nfs_inode_event, name, \
130f4ce1299STrond Myklebust 			TP_PROTO( \
131f4ce1299STrond Myklebust 				const struct inode *inode \
132f4ce1299STrond Myklebust 			), \
133f4ce1299STrond Myklebust 			TP_ARGS(inode))
134f4ce1299STrond Myklebust #define DEFINE_NFS_INODE_EVENT_DONE(name) \
135f4ce1299STrond Myklebust 	DEFINE_EVENT(nfs_inode_event_done, name, \
136f4ce1299STrond Myklebust 			TP_PROTO( \
137f4ce1299STrond Myklebust 				const struct inode *inode, \
138f4ce1299STrond Myklebust 				int error \
139f4ce1299STrond Myklebust 			), \
140f4ce1299STrond Myklebust 			TP_ARGS(inode, error))
141f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter);
142f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit);
143f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter);
144f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit);
145f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter);
146f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit);
147f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_getattr_enter);
148f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit);
149f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_setattr_enter);
150f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit);
151f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_writeback_page_enter);
152f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_page_exit);
153f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter);
154f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit);
155f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_fsync_enter);
156f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
157f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT(nfs_access_enter);
158f4ce1299STrond Myklebust DEFINE_NFS_INODE_EVENT_DONE(nfs_access_exit);
159f4ce1299STrond Myklebust 
1606e0d0be7STrond Myklebust #define show_lookup_flags(flags) \
1616e0d0be7STrond Myklebust 	__print_flags((unsigned long)flags, "|", \
1626e0d0be7STrond Myklebust 			{ LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \
1636e0d0be7STrond Myklebust 			{ LOOKUP_DIRECTORY, "DIRECTORY" }, \
1646e0d0be7STrond Myklebust 			{ LOOKUP_OPEN, "OPEN" }, \
1656e0d0be7STrond Myklebust 			{ LOOKUP_CREATE, "CREATE" }, \
1666e0d0be7STrond Myklebust 			{ LOOKUP_EXCL, "EXCL" })
1676e0d0be7STrond Myklebust 
1686e0d0be7STrond Myklebust DECLARE_EVENT_CLASS(nfs_lookup_event,
1696e0d0be7STrond Myklebust 		TP_PROTO(
1706e0d0be7STrond Myklebust 			const struct inode *dir,
1716e0d0be7STrond Myklebust 			const struct dentry *dentry,
1726e0d0be7STrond Myklebust 			unsigned int flags
1736e0d0be7STrond Myklebust 		),
1746e0d0be7STrond Myklebust 
1756e0d0be7STrond Myklebust 		TP_ARGS(dir, dentry, flags),
1766e0d0be7STrond Myklebust 
1776e0d0be7STrond Myklebust 		TP_STRUCT__entry(
1786e0d0be7STrond Myklebust 			__field(unsigned int, flags)
1796e0d0be7STrond Myklebust 			__field(dev_t, dev)
1806e0d0be7STrond Myklebust 			__field(u64, dir)
1816e0d0be7STrond Myklebust 			__string(name, dentry->d_name.name)
1826e0d0be7STrond Myklebust 		),
1836e0d0be7STrond Myklebust 
1846e0d0be7STrond Myklebust 		TP_fast_assign(
1856e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
1866e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
1876e0d0be7STrond Myklebust 			__entry->flags = flags;
1886e0d0be7STrond Myklebust 			__assign_str(name, dentry->d_name.name);
1896e0d0be7STrond Myklebust 		),
1906e0d0be7STrond Myklebust 
1916e0d0be7STrond Myklebust 		TP_printk(
1926e0d0be7STrond Myklebust 			"flags=%u (%s) name=%02x:%02x:%llu/%s",
1936e0d0be7STrond Myklebust 			__entry->flags,
1946e0d0be7STrond Myklebust 			show_lookup_flags(__entry->flags),
1956e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
1966e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
1976e0d0be7STrond Myklebust 			__get_str(name)
1986e0d0be7STrond Myklebust 		)
1996e0d0be7STrond Myklebust );
2006e0d0be7STrond Myklebust 
2016e0d0be7STrond Myklebust #define DEFINE_NFS_LOOKUP_EVENT(name) \
2026e0d0be7STrond Myklebust 	DEFINE_EVENT(nfs_lookup_event, name, \
2036e0d0be7STrond Myklebust 			TP_PROTO( \
2046e0d0be7STrond Myklebust 				const struct inode *dir, \
2056e0d0be7STrond Myklebust 				const struct dentry *dentry, \
2066e0d0be7STrond Myklebust 				unsigned int flags \
2076e0d0be7STrond Myklebust 			), \
2086e0d0be7STrond Myklebust 			TP_ARGS(dir, dentry, flags))
2096e0d0be7STrond Myklebust 
2106e0d0be7STrond Myklebust DECLARE_EVENT_CLASS(nfs_lookup_event_done,
2116e0d0be7STrond Myklebust 		TP_PROTO(
2126e0d0be7STrond Myklebust 			const struct inode *dir,
2136e0d0be7STrond Myklebust 			const struct dentry *dentry,
2146e0d0be7STrond Myklebust 			unsigned int flags,
2156e0d0be7STrond Myklebust 			int error
2166e0d0be7STrond Myklebust 		),
2176e0d0be7STrond Myklebust 
2186e0d0be7STrond Myklebust 		TP_ARGS(dir, dentry, flags, error),
2196e0d0be7STrond Myklebust 
2206e0d0be7STrond Myklebust 		TP_STRUCT__entry(
2216e0d0be7STrond Myklebust 			__field(int, error)
2226e0d0be7STrond Myklebust 			__field(unsigned int, flags)
2236e0d0be7STrond Myklebust 			__field(dev_t, dev)
2246e0d0be7STrond Myklebust 			__field(u64, dir)
2256e0d0be7STrond Myklebust 			__string(name, dentry->d_name.name)
2266e0d0be7STrond Myklebust 		),
2276e0d0be7STrond Myklebust 
2286e0d0be7STrond Myklebust 		TP_fast_assign(
2296e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
2306e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
2316e0d0be7STrond Myklebust 			__entry->error = error;
2326e0d0be7STrond Myklebust 			__entry->flags = flags;
2336e0d0be7STrond Myklebust 			__assign_str(name, dentry->d_name.name);
2346e0d0be7STrond Myklebust 		),
2356e0d0be7STrond Myklebust 
2366e0d0be7STrond Myklebust 		TP_printk(
2376e0d0be7STrond Myklebust 			"error=%d flags=%u (%s) name=%02x:%02x:%llu/%s",
2386e0d0be7STrond Myklebust 			__entry->error,
2396e0d0be7STrond Myklebust 			__entry->flags,
2406e0d0be7STrond Myklebust 			show_lookup_flags(__entry->flags),
2416e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
2426e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
2436e0d0be7STrond Myklebust 			__get_str(name)
2446e0d0be7STrond Myklebust 		)
2456e0d0be7STrond Myklebust );
2466e0d0be7STrond Myklebust 
2476e0d0be7STrond Myklebust #define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \
2486e0d0be7STrond Myklebust 	DEFINE_EVENT(nfs_lookup_event_done, name, \
2496e0d0be7STrond Myklebust 			TP_PROTO( \
2506e0d0be7STrond Myklebust 				const struct inode *dir, \
2516e0d0be7STrond Myklebust 				const struct dentry *dentry, \
2526e0d0be7STrond Myklebust 				unsigned int flags, \
2536e0d0be7STrond Myklebust 				int error \
2546e0d0be7STrond Myklebust 			), \
2556e0d0be7STrond Myklebust 			TP_ARGS(dir, dentry, flags, error))
2566e0d0be7STrond Myklebust 
2576e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter);
2586e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
2596e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
2606e0d0be7STrond Myklebust DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
2616e0d0be7STrond Myklebust 
2626e0d0be7STrond Myklebust #define show_open_flags(flags) \
2636e0d0be7STrond Myklebust 	__print_flags((unsigned long)flags, "|", \
2646e0d0be7STrond Myklebust 		{ O_CREAT, "O_CREAT" }, \
2656e0d0be7STrond Myklebust 		{ O_EXCL, "O_EXCL" }, \
2666e0d0be7STrond Myklebust 		{ O_TRUNC, "O_TRUNC" }, \
2676e0d0be7STrond Myklebust 		{ O_APPEND, "O_APPEND" }, \
2686e0d0be7STrond Myklebust 		{ O_DSYNC, "O_DSYNC" }, \
2696e0d0be7STrond Myklebust 		{ O_DIRECT, "O_DIRECT" }, \
2706e0d0be7STrond Myklebust 		{ O_DIRECTORY, "O_DIRECTORY" })
2716e0d0be7STrond Myklebust 
2726e0d0be7STrond Myklebust #define show_fmode_flags(mode) \
2736e0d0be7STrond Myklebust 	__print_flags(mode, "|", \
2746e0d0be7STrond Myklebust 		{ ((__force unsigned long)FMODE_READ), "READ" }, \
2756e0d0be7STrond Myklebust 		{ ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
2766e0d0be7STrond Myklebust 		{ ((__force unsigned long)FMODE_EXEC), "EXEC" })
2776e0d0be7STrond Myklebust 
2786e0d0be7STrond Myklebust TRACE_EVENT(nfs_atomic_open_enter,
2796e0d0be7STrond Myklebust 		TP_PROTO(
2806e0d0be7STrond Myklebust 			const struct inode *dir,
2816e0d0be7STrond Myklebust 			const struct nfs_open_context *ctx,
2826e0d0be7STrond Myklebust 			unsigned int flags
2836e0d0be7STrond Myklebust 		),
2846e0d0be7STrond Myklebust 
2856e0d0be7STrond Myklebust 		TP_ARGS(dir, ctx, flags),
2866e0d0be7STrond Myklebust 
2876e0d0be7STrond Myklebust 		TP_STRUCT__entry(
2886e0d0be7STrond Myklebust 			__field(unsigned int, flags)
2896e0d0be7STrond Myklebust 			__field(unsigned int, fmode)
2906e0d0be7STrond Myklebust 			__field(dev_t, dev)
2916e0d0be7STrond Myklebust 			__field(u64, dir)
2926e0d0be7STrond Myklebust 			__string(name, ctx->dentry->d_name.name)
2936e0d0be7STrond Myklebust 		),
2946e0d0be7STrond Myklebust 
2956e0d0be7STrond Myklebust 		TP_fast_assign(
2966e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
2976e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
2986e0d0be7STrond Myklebust 			__entry->flags = flags;
2996e0d0be7STrond Myklebust 			__entry->fmode = (__force unsigned int)ctx->mode;
3006e0d0be7STrond Myklebust 			__assign_str(name, ctx->dentry->d_name.name);
3016e0d0be7STrond Myklebust 		),
3026e0d0be7STrond Myklebust 
3036e0d0be7STrond Myklebust 		TP_printk(
3046e0d0be7STrond Myklebust 			"flags=%u (%s) fmode=%s name=%02x:%02x:%llu/%s",
3056e0d0be7STrond Myklebust 			__entry->flags,
3066e0d0be7STrond Myklebust 			show_open_flags(__entry->flags),
3076e0d0be7STrond Myklebust 			show_fmode_flags(__entry->fmode),
3086e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
3096e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
3106e0d0be7STrond Myklebust 			__get_str(name)
3116e0d0be7STrond Myklebust 		)
3126e0d0be7STrond Myklebust );
3136e0d0be7STrond Myklebust 
3146e0d0be7STrond Myklebust TRACE_EVENT(nfs_atomic_open_exit,
3156e0d0be7STrond Myklebust 		TP_PROTO(
3166e0d0be7STrond Myklebust 			const struct inode *dir,
3176e0d0be7STrond Myklebust 			const struct nfs_open_context *ctx,
3186e0d0be7STrond Myklebust 			unsigned int flags,
3196e0d0be7STrond Myklebust 			int error
3206e0d0be7STrond Myklebust 		),
3216e0d0be7STrond Myklebust 
3226e0d0be7STrond Myklebust 		TP_ARGS(dir, ctx, flags, error),
3236e0d0be7STrond Myklebust 
3246e0d0be7STrond Myklebust 		TP_STRUCT__entry(
3256e0d0be7STrond Myklebust 			__field(int, error)
3266e0d0be7STrond Myklebust 			__field(unsigned int, flags)
3276e0d0be7STrond Myklebust 			__field(unsigned int, fmode)
3286e0d0be7STrond Myklebust 			__field(dev_t, dev)
3296e0d0be7STrond Myklebust 			__field(u64, dir)
3306e0d0be7STrond Myklebust 			__string(name, ctx->dentry->d_name.name)
3316e0d0be7STrond Myklebust 		),
3326e0d0be7STrond Myklebust 
3336e0d0be7STrond Myklebust 		TP_fast_assign(
3346e0d0be7STrond Myklebust 			__entry->error = error;
3356e0d0be7STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
3366e0d0be7STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
3376e0d0be7STrond Myklebust 			__entry->flags = flags;
3386e0d0be7STrond Myklebust 			__entry->fmode = (__force unsigned int)ctx->mode;
3396e0d0be7STrond Myklebust 			__assign_str(name, ctx->dentry->d_name.name);
3406e0d0be7STrond Myklebust 		),
3416e0d0be7STrond Myklebust 
3426e0d0be7STrond Myklebust 		TP_printk(
3436e0d0be7STrond Myklebust 			"error=%d flags=%u (%s) fmode=%s "
3446e0d0be7STrond Myklebust 			"name=%02x:%02x:%llu/%s",
3456e0d0be7STrond Myklebust 			__entry->error,
3466e0d0be7STrond Myklebust 			__entry->flags,
3476e0d0be7STrond Myklebust 			show_open_flags(__entry->flags),
3486e0d0be7STrond Myklebust 			show_fmode_flags(__entry->fmode),
3496e0d0be7STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
3506e0d0be7STrond Myklebust 			(unsigned long long)__entry->dir,
3516e0d0be7STrond Myklebust 			__get_str(name)
3526e0d0be7STrond Myklebust 		)
3536e0d0be7STrond Myklebust );
3546e0d0be7STrond Myklebust 
3558b0ad3d4STrond Myklebust TRACE_EVENT(nfs_create_enter,
3568b0ad3d4STrond Myklebust 		TP_PROTO(
3578b0ad3d4STrond Myklebust 			const struct inode *dir,
3588b0ad3d4STrond Myklebust 			const struct dentry *dentry,
3598b0ad3d4STrond Myklebust 			unsigned int flags
3608b0ad3d4STrond Myklebust 		),
3618b0ad3d4STrond Myklebust 
3628b0ad3d4STrond Myklebust 		TP_ARGS(dir, dentry, flags),
3638b0ad3d4STrond Myklebust 
3648b0ad3d4STrond Myklebust 		TP_STRUCT__entry(
3658b0ad3d4STrond Myklebust 			__field(unsigned int, flags)
3668b0ad3d4STrond Myklebust 			__field(dev_t, dev)
3678b0ad3d4STrond Myklebust 			__field(u64, dir)
3688b0ad3d4STrond Myklebust 			__string(name, dentry->d_name.name)
3698b0ad3d4STrond Myklebust 		),
3708b0ad3d4STrond Myklebust 
3718b0ad3d4STrond Myklebust 		TP_fast_assign(
3728b0ad3d4STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
3738b0ad3d4STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
3748b0ad3d4STrond Myklebust 			__entry->flags = flags;
3758b0ad3d4STrond Myklebust 			__assign_str(name, dentry->d_name.name);
3768b0ad3d4STrond Myklebust 		),
3778b0ad3d4STrond Myklebust 
3788b0ad3d4STrond Myklebust 		TP_printk(
3798b0ad3d4STrond Myklebust 			"flags=%u (%s) name=%02x:%02x:%llu/%s",
3808b0ad3d4STrond Myklebust 			__entry->flags,
3818b0ad3d4STrond Myklebust 			show_open_flags(__entry->flags),
3828b0ad3d4STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
3838b0ad3d4STrond Myklebust 			(unsigned long long)__entry->dir,
3848b0ad3d4STrond Myklebust 			__get_str(name)
3858b0ad3d4STrond Myklebust 		)
3868b0ad3d4STrond Myklebust );
3878b0ad3d4STrond Myklebust 
3888b0ad3d4STrond Myklebust TRACE_EVENT(nfs_create_exit,
3898b0ad3d4STrond Myklebust 		TP_PROTO(
3908b0ad3d4STrond Myklebust 			const struct inode *dir,
3918b0ad3d4STrond Myklebust 			const struct dentry *dentry,
3928b0ad3d4STrond Myklebust 			unsigned int flags,
3938b0ad3d4STrond Myklebust 			int error
3948b0ad3d4STrond Myklebust 		),
3958b0ad3d4STrond Myklebust 
3968b0ad3d4STrond Myklebust 		TP_ARGS(dir, dentry, flags, error),
3978b0ad3d4STrond Myklebust 
3988b0ad3d4STrond Myklebust 		TP_STRUCT__entry(
3998b0ad3d4STrond Myklebust 			__field(int, error)
4008b0ad3d4STrond Myklebust 			__field(unsigned int, flags)
4018b0ad3d4STrond Myklebust 			__field(dev_t, dev)
4028b0ad3d4STrond Myklebust 			__field(u64, dir)
4038b0ad3d4STrond Myklebust 			__string(name, dentry->d_name.name)
4048b0ad3d4STrond Myklebust 		),
4058b0ad3d4STrond Myklebust 
4068b0ad3d4STrond Myklebust 		TP_fast_assign(
4078b0ad3d4STrond Myklebust 			__entry->error = error;
4088b0ad3d4STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
4098b0ad3d4STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
4108b0ad3d4STrond Myklebust 			__entry->flags = flags;
4118b0ad3d4STrond Myklebust 			__assign_str(name, dentry->d_name.name);
4128b0ad3d4STrond Myklebust 		),
4138b0ad3d4STrond Myklebust 
4148b0ad3d4STrond Myklebust 		TP_printk(
4158b0ad3d4STrond Myklebust 			"error=%d flags=%u (%s) name=%02x:%02x:%llu/%s",
4168b0ad3d4STrond Myklebust 			__entry->error,
4178b0ad3d4STrond Myklebust 			__entry->flags,
4188b0ad3d4STrond Myklebust 			show_open_flags(__entry->flags),
4198b0ad3d4STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
4208b0ad3d4STrond Myklebust 			(unsigned long long)__entry->dir,
4218b0ad3d4STrond Myklebust 			__get_str(name)
4228b0ad3d4STrond Myklebust 		)
4238b0ad3d4STrond Myklebust );
4248b0ad3d4STrond Myklebust 
4251ca42382STrond Myklebust DECLARE_EVENT_CLASS(nfs_directory_event,
4261ca42382STrond Myklebust 		TP_PROTO(
4271ca42382STrond Myklebust 			const struct inode *dir,
4281ca42382STrond Myklebust 			const struct dentry *dentry
4291ca42382STrond Myklebust 		),
4301ca42382STrond Myklebust 
4311ca42382STrond Myklebust 		TP_ARGS(dir, dentry),
4321ca42382STrond Myklebust 
4331ca42382STrond Myklebust 		TP_STRUCT__entry(
4341ca42382STrond Myklebust 			__field(dev_t, dev)
4351ca42382STrond Myklebust 			__field(u64, dir)
4361ca42382STrond Myklebust 			__string(name, dentry->d_name.name)
4371ca42382STrond Myklebust 		),
4381ca42382STrond Myklebust 
4391ca42382STrond Myklebust 		TP_fast_assign(
4401ca42382STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
4411ca42382STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
4421ca42382STrond Myklebust 			__assign_str(name, dentry->d_name.name);
4431ca42382STrond Myklebust 		),
4441ca42382STrond Myklebust 
4451ca42382STrond Myklebust 		TP_printk(
4461ca42382STrond Myklebust 			"name=%02x:%02x:%llu/%s",
4471ca42382STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
4481ca42382STrond Myklebust 			(unsigned long long)__entry->dir,
4491ca42382STrond Myklebust 			__get_str(name)
4501ca42382STrond Myklebust 		)
4511ca42382STrond Myklebust );
4521ca42382STrond Myklebust 
4531ca42382STrond Myklebust #define DEFINE_NFS_DIRECTORY_EVENT(name) \
4541ca42382STrond Myklebust 	DEFINE_EVENT(nfs_directory_event, name, \
4551ca42382STrond Myklebust 			TP_PROTO( \
4561ca42382STrond Myklebust 				const struct inode *dir, \
4571ca42382STrond Myklebust 				const struct dentry *dentry \
4581ca42382STrond Myklebust 			), \
4591ca42382STrond Myklebust 			TP_ARGS(dir, dentry))
4601ca42382STrond Myklebust 
4611ca42382STrond Myklebust DECLARE_EVENT_CLASS(nfs_directory_event_done,
4621ca42382STrond Myklebust 		TP_PROTO(
4631ca42382STrond Myklebust 			const struct inode *dir,
4641ca42382STrond Myklebust 			const struct dentry *dentry,
4651ca42382STrond Myklebust 			int error
4661ca42382STrond Myklebust 		),
4671ca42382STrond Myklebust 
4681ca42382STrond Myklebust 		TP_ARGS(dir, dentry, error),
4691ca42382STrond Myklebust 
4701ca42382STrond Myklebust 		TP_STRUCT__entry(
4711ca42382STrond Myklebust 			__field(int, error)
4721ca42382STrond Myklebust 			__field(dev_t, dev)
4731ca42382STrond Myklebust 			__field(u64, dir)
4741ca42382STrond Myklebust 			__string(name, dentry->d_name.name)
4751ca42382STrond Myklebust 		),
4761ca42382STrond Myklebust 
4771ca42382STrond Myklebust 		TP_fast_assign(
4781ca42382STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
4791ca42382STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
4801ca42382STrond Myklebust 			__entry->error = error;
4811ca42382STrond Myklebust 			__assign_str(name, dentry->d_name.name);
4821ca42382STrond Myklebust 		),
4831ca42382STrond Myklebust 
4841ca42382STrond Myklebust 		TP_printk(
4851ca42382STrond Myklebust 			"error=%d name=%02x:%02x:%llu/%s",
4861ca42382STrond Myklebust 			__entry->error,
4871ca42382STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
4881ca42382STrond Myklebust 			(unsigned long long)__entry->dir,
4891ca42382STrond Myklebust 			__get_str(name)
4901ca42382STrond Myklebust 		)
4911ca42382STrond Myklebust );
4921ca42382STrond Myklebust 
4931ca42382STrond Myklebust #define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \
4941ca42382STrond Myklebust 	DEFINE_EVENT(nfs_directory_event_done, name, \
4951ca42382STrond Myklebust 			TP_PROTO( \
4961ca42382STrond Myklebust 				const struct inode *dir, \
4971ca42382STrond Myklebust 				const struct dentry *dentry, \
4981ca42382STrond Myklebust 				int error \
4991ca42382STrond Myklebust 			), \
5001ca42382STrond Myklebust 			TP_ARGS(dir, dentry, error))
5011ca42382STrond Myklebust 
5021ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter);
5031ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit);
5041ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter);
5051ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit);
5061ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter);
5071ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit);
5081ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter);
5091ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit);
5101ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter);
5111ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit);
5121ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter);
5131ca42382STrond Myklebust DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit);
5141ca42382STrond Myklebust 
5151fd1085bSTrond Myklebust TRACE_EVENT(nfs_link_enter,
5161fd1085bSTrond Myklebust 		TP_PROTO(
5171fd1085bSTrond Myklebust 			const struct inode *inode,
5181fd1085bSTrond Myklebust 			const struct inode *dir,
5191fd1085bSTrond Myklebust 			const struct dentry *dentry
5201fd1085bSTrond Myklebust 		),
5211fd1085bSTrond Myklebust 
5221fd1085bSTrond Myklebust 		TP_ARGS(inode, dir, dentry),
5231fd1085bSTrond Myklebust 
5241fd1085bSTrond Myklebust 		TP_STRUCT__entry(
5251fd1085bSTrond Myklebust 			__field(dev_t, dev)
5261fd1085bSTrond Myklebust 			__field(u64, fileid)
5271fd1085bSTrond Myklebust 			__field(u64, dir)
5281fd1085bSTrond Myklebust 			__string(name, dentry->d_name.name)
5291fd1085bSTrond Myklebust 		),
5301fd1085bSTrond Myklebust 
5311fd1085bSTrond Myklebust 		TP_fast_assign(
5321fd1085bSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
5331fd1085bSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
5341fd1085bSTrond Myklebust 			__entry->dir = NFS_FILEID(dir);
5351fd1085bSTrond Myklebust 			__assign_str(name, dentry->d_name.name);
5361fd1085bSTrond Myklebust 		),
5371fd1085bSTrond Myklebust 
5381fd1085bSTrond Myklebust 		TP_printk(
5391fd1085bSTrond Myklebust 			"fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
5401fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
5411fd1085bSTrond Myklebust 			__entry->fileid,
5421fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
5431fd1085bSTrond Myklebust 			(unsigned long long)__entry->dir,
5441fd1085bSTrond Myklebust 			__get_str(name)
5451fd1085bSTrond Myklebust 		)
5461fd1085bSTrond Myklebust );
5471fd1085bSTrond Myklebust 
5481fd1085bSTrond Myklebust TRACE_EVENT(nfs_link_exit,
5491fd1085bSTrond Myklebust 		TP_PROTO(
5501fd1085bSTrond Myklebust 			const struct inode *inode,
5511fd1085bSTrond Myklebust 			const struct inode *dir,
5521fd1085bSTrond Myklebust 			const struct dentry *dentry,
5531fd1085bSTrond Myklebust 			int error
5541fd1085bSTrond Myklebust 		),
5551fd1085bSTrond Myklebust 
5561fd1085bSTrond Myklebust 		TP_ARGS(inode, dir, dentry, error),
5571fd1085bSTrond Myklebust 
5581fd1085bSTrond Myklebust 		TP_STRUCT__entry(
5591fd1085bSTrond Myklebust 			__field(int, error)
5601fd1085bSTrond Myklebust 			__field(dev_t, dev)
5611fd1085bSTrond Myklebust 			__field(u64, fileid)
5621fd1085bSTrond Myklebust 			__field(u64, dir)
5631fd1085bSTrond Myklebust 			__string(name, dentry->d_name.name)
5641fd1085bSTrond Myklebust 		),
5651fd1085bSTrond Myklebust 
5661fd1085bSTrond Myklebust 		TP_fast_assign(
5671fd1085bSTrond Myklebust 			__entry->dev = inode->i_sb->s_dev;
5681fd1085bSTrond Myklebust 			__entry->fileid = NFS_FILEID(inode);
5691fd1085bSTrond Myklebust 			__entry->dir = NFS_FILEID(dir);
5701fd1085bSTrond Myklebust 			__entry->error = error;
5711fd1085bSTrond Myklebust 			__assign_str(name, dentry->d_name.name);
5721fd1085bSTrond Myklebust 		),
5731fd1085bSTrond Myklebust 
5741fd1085bSTrond Myklebust 		TP_printk(
5751fd1085bSTrond Myklebust 			"error=%d fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
5761fd1085bSTrond Myklebust 			__entry->error,
5771fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
5781fd1085bSTrond Myklebust 			__entry->fileid,
5791fd1085bSTrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
5801fd1085bSTrond Myklebust 			(unsigned long long)__entry->dir,
5811fd1085bSTrond Myklebust 			__get_str(name)
5821fd1085bSTrond Myklebust 		)
5831fd1085bSTrond Myklebust );
5841fd1085bSTrond Myklebust 
58570ded201STrond Myklebust DECLARE_EVENT_CLASS(nfs_rename_event,
58670ded201STrond Myklebust 		TP_PROTO(
58770ded201STrond Myklebust 			const struct inode *old_dir,
58870ded201STrond Myklebust 			const struct dentry *old_dentry,
58970ded201STrond Myklebust 			const struct inode *new_dir,
59070ded201STrond Myklebust 			const struct dentry *new_dentry
59170ded201STrond Myklebust 		),
59270ded201STrond Myklebust 
59370ded201STrond Myklebust 		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry),
59470ded201STrond Myklebust 
59570ded201STrond Myklebust 		TP_STRUCT__entry(
59670ded201STrond Myklebust 			__field(dev_t, dev)
59770ded201STrond Myklebust 			__field(u64, old_dir)
59870ded201STrond Myklebust 			__field(u64, new_dir)
59970ded201STrond Myklebust 			__string(old_name, old_dentry->d_name.name)
60070ded201STrond Myklebust 			__string(new_name, new_dentry->d_name.name)
60170ded201STrond Myklebust 		),
60270ded201STrond Myklebust 
60370ded201STrond Myklebust 		TP_fast_assign(
60470ded201STrond Myklebust 			__entry->dev = old_dir->i_sb->s_dev;
60570ded201STrond Myklebust 			__entry->old_dir = NFS_FILEID(old_dir);
60670ded201STrond Myklebust 			__entry->new_dir = NFS_FILEID(new_dir);
60770ded201STrond Myklebust 			__assign_str(old_name, old_dentry->d_name.name);
60870ded201STrond Myklebust 			__assign_str(new_name, new_dentry->d_name.name);
60970ded201STrond Myklebust 		),
61070ded201STrond Myklebust 
61170ded201STrond Myklebust 		TP_printk(
61270ded201STrond Myklebust 			"old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s",
61370ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
61470ded201STrond Myklebust 			(unsigned long long)__entry->old_dir,
61570ded201STrond Myklebust 			__get_str(old_name),
61670ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
61770ded201STrond Myklebust 			(unsigned long long)__entry->new_dir,
61870ded201STrond Myklebust 			__get_str(new_name)
61970ded201STrond Myklebust 		)
62070ded201STrond Myklebust );
62170ded201STrond Myklebust #define DEFINE_NFS_RENAME_EVENT(name) \
62270ded201STrond Myklebust 	DEFINE_EVENT(nfs_rename_event, name, \
62370ded201STrond Myklebust 			TP_PROTO( \
62470ded201STrond Myklebust 				const struct inode *old_dir, \
62570ded201STrond Myklebust 				const struct dentry *old_dentry, \
62670ded201STrond Myklebust 				const struct inode *new_dir, \
62770ded201STrond Myklebust 				const struct dentry *new_dentry \
62870ded201STrond Myklebust 			), \
62970ded201STrond Myklebust 			TP_ARGS(old_dir, old_dentry, new_dir, new_dentry))
63070ded201STrond Myklebust 
63170ded201STrond Myklebust DECLARE_EVENT_CLASS(nfs_rename_event_done,
63270ded201STrond Myklebust 		TP_PROTO(
63370ded201STrond Myklebust 			const struct inode *old_dir,
63470ded201STrond Myklebust 			const struct dentry *old_dentry,
63570ded201STrond Myklebust 			const struct inode *new_dir,
63670ded201STrond Myklebust 			const struct dentry *new_dentry,
63770ded201STrond Myklebust 			int error
63870ded201STrond Myklebust 		),
63970ded201STrond Myklebust 
64070ded201STrond Myklebust 		TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, error),
64170ded201STrond Myklebust 
64270ded201STrond Myklebust 		TP_STRUCT__entry(
64370ded201STrond Myklebust 			__field(dev_t, dev)
64470ded201STrond Myklebust 			__field(int, error)
64570ded201STrond Myklebust 			__field(u64, old_dir)
64670ded201STrond Myklebust 			__string(old_name, old_dentry->d_name.name)
64770ded201STrond Myklebust 			__field(u64, new_dir)
64870ded201STrond Myklebust 			__string(new_name, new_dentry->d_name.name)
64970ded201STrond Myklebust 		),
65070ded201STrond Myklebust 
65170ded201STrond Myklebust 		TP_fast_assign(
65270ded201STrond Myklebust 			__entry->dev = old_dir->i_sb->s_dev;
65370ded201STrond Myklebust 			__entry->old_dir = NFS_FILEID(old_dir);
65470ded201STrond Myklebust 			__entry->new_dir = NFS_FILEID(new_dir);
65570ded201STrond Myklebust 			__entry->error = error;
65670ded201STrond Myklebust 			__assign_str(old_name, old_dentry->d_name.name);
65770ded201STrond Myklebust 			__assign_str(new_name, new_dentry->d_name.name);
65870ded201STrond Myklebust 		),
65970ded201STrond Myklebust 
66070ded201STrond Myklebust 		TP_printk(
66170ded201STrond Myklebust 			"error=%d old_name=%02x:%02x:%llu/%s "
66270ded201STrond Myklebust 			"new_name=%02x:%02x:%llu/%s",
66370ded201STrond Myklebust 			__entry->error,
66470ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
66570ded201STrond Myklebust 			(unsigned long long)__entry->old_dir,
66670ded201STrond Myklebust 			__get_str(old_name),
66770ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
66870ded201STrond Myklebust 			(unsigned long long)__entry->new_dir,
66970ded201STrond Myklebust 			__get_str(new_name)
67070ded201STrond Myklebust 		)
67170ded201STrond Myklebust );
67270ded201STrond Myklebust #define DEFINE_NFS_RENAME_EVENT_DONE(name) \
67370ded201STrond Myklebust 	DEFINE_EVENT(nfs_rename_event_done, name, \
67470ded201STrond Myklebust 			TP_PROTO( \
67570ded201STrond Myklebust 				const struct inode *old_dir, \
67670ded201STrond Myklebust 				const struct dentry *old_dentry, \
67770ded201STrond Myklebust 				const struct inode *new_dir, \
67870ded201STrond Myklebust 				const struct dentry *new_dentry, \
67970ded201STrond Myklebust 				int error \
68070ded201STrond Myklebust 			), \
68170ded201STrond Myklebust 			TP_ARGS(old_dir, old_dentry, new_dir, \
68270ded201STrond Myklebust 				new_dentry, error))
68370ded201STrond Myklebust 
68470ded201STrond Myklebust DEFINE_NFS_RENAME_EVENT(nfs_rename_enter);
68570ded201STrond Myklebust DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit);
68670ded201STrond Myklebust 
68770ded201STrond Myklebust DEFINE_NFS_RENAME_EVENT_DONE(nfs_sillyrename_rename);
68870ded201STrond Myklebust 
68970ded201STrond Myklebust TRACE_EVENT(nfs_sillyrename_unlink,
69070ded201STrond Myklebust 		TP_PROTO(
69170ded201STrond Myklebust 			const struct nfs_unlinkdata *data,
69270ded201STrond Myklebust 			int error
69370ded201STrond Myklebust 		),
69470ded201STrond Myklebust 
69570ded201STrond Myklebust 		TP_ARGS(data, error),
69670ded201STrond Myklebust 
69770ded201STrond Myklebust 		TP_STRUCT__entry(
69870ded201STrond Myklebust 			__field(dev_t, dev)
69970ded201STrond Myklebust 			__field(int, error)
70070ded201STrond Myklebust 			__field(u64, dir)
70170ded201STrond Myklebust 			__dynamic_array(char, name, data->args.name.len + 1)
70270ded201STrond Myklebust 		),
70370ded201STrond Myklebust 
70470ded201STrond Myklebust 		TP_fast_assign(
705884be175SAl Viro 			struct inode *dir = d_inode(data->dentry->d_parent);
70670ded201STrond Myklebust 			size_t len = data->args.name.len;
70770ded201STrond Myklebust 			__entry->dev = dir->i_sb->s_dev;
70870ded201STrond Myklebust 			__entry->dir = NFS_FILEID(dir);
70970ded201STrond Myklebust 			__entry->error = error;
710752d596bSDaniel Bristot de Oliveira 			memcpy(__get_str(name),
71170ded201STrond Myklebust 				data->args.name.name, len);
712752d596bSDaniel Bristot de Oliveira 			__get_str(name)[len] = 0;
71370ded201STrond Myklebust 		),
71470ded201STrond Myklebust 
71570ded201STrond Myklebust 		TP_printk(
71670ded201STrond Myklebust 			"error=%d name=%02x:%02x:%llu/%s",
71770ded201STrond Myklebust 			__entry->error,
71870ded201STrond Myklebust 			MAJOR(__entry->dev), MINOR(__entry->dev),
71970ded201STrond Myklebust 			(unsigned long long)__entry->dir,
72070ded201STrond Myklebust 			__get_str(name)
72170ded201STrond Myklebust 		)
72270ded201STrond Myklebust );
7238224b273SChuck Lever 
7248224b273SChuck Lever TRACE_EVENT(nfs_initiate_read,
7258224b273SChuck Lever 		TP_PROTO(
7268224b273SChuck Lever 			const struct inode *inode,
7278224b273SChuck Lever 			loff_t offset, unsigned long count
7288224b273SChuck Lever 		),
7298224b273SChuck Lever 
7308224b273SChuck Lever 		TP_ARGS(inode, offset, count),
7318224b273SChuck Lever 
7328224b273SChuck Lever 		TP_STRUCT__entry(
7338224b273SChuck Lever 			__field(loff_t, offset)
7348224b273SChuck Lever 			__field(unsigned long, count)
7358224b273SChuck Lever 			__field(dev_t, dev)
7368224b273SChuck Lever 			__field(u32, fhandle)
7378224b273SChuck Lever 			__field(u64, fileid)
7388224b273SChuck Lever 		),
7398224b273SChuck Lever 
7408224b273SChuck Lever 		TP_fast_assign(
7418224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
7428224b273SChuck Lever 
7438224b273SChuck Lever 			__entry->offset = offset;
7448224b273SChuck Lever 			__entry->count = count;
7458224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
7468224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
7478224b273SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
7488224b273SChuck Lever 		),
7498224b273SChuck Lever 
7508224b273SChuck Lever 		TP_printk(
7518224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
7528224b273SChuck Lever 			"offset=%lld count=%lu",
7538224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
7548224b273SChuck Lever 			(unsigned long long)__entry->fileid,
7558224b273SChuck Lever 			__entry->fhandle,
7568224b273SChuck Lever 			__entry->offset, __entry->count
7578224b273SChuck Lever 		)
7588224b273SChuck Lever );
7598224b273SChuck Lever 
7608224b273SChuck Lever TRACE_EVENT(nfs_readpage_done,
7618224b273SChuck Lever 		TP_PROTO(
7628224b273SChuck Lever 			const struct inode *inode,
7638224b273SChuck Lever 			int status, loff_t offset, bool eof
7648224b273SChuck Lever 		),
7658224b273SChuck Lever 
7668224b273SChuck Lever 		TP_ARGS(inode, status, offset, eof),
7678224b273SChuck Lever 
7688224b273SChuck Lever 		TP_STRUCT__entry(
7698224b273SChuck Lever 			__field(int, status)
7708224b273SChuck Lever 			__field(loff_t, offset)
7718224b273SChuck Lever 			__field(bool, eof)
7728224b273SChuck Lever 			__field(dev_t, dev)
7738224b273SChuck Lever 			__field(u32, fhandle)
7748224b273SChuck Lever 			__field(u64, fileid)
7758224b273SChuck Lever 		),
7768224b273SChuck Lever 
7778224b273SChuck Lever 		TP_fast_assign(
7788224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
7798224b273SChuck Lever 
7808224b273SChuck Lever 			__entry->status = status;
7818224b273SChuck Lever 			__entry->offset = offset;
7828224b273SChuck Lever 			__entry->eof = eof;
7838224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
7848224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
7858224b273SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
7868224b273SChuck Lever 		),
7878224b273SChuck Lever 
7888224b273SChuck Lever 		TP_printk(
7898224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
7908224b273SChuck Lever 			"offset=%lld status=%d%s",
7918224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
7928224b273SChuck Lever 			(unsigned long long)__entry->fileid,
7938224b273SChuck Lever 			__entry->fhandle,
7948224b273SChuck Lever 			__entry->offset, __entry->status,
7958224b273SChuck Lever 			__entry->eof ? " eof" : ""
7968224b273SChuck Lever 		)
7978224b273SChuck Lever );
7988224b273SChuck Lever 
799*06e19024SChuck Lever TRACE_DEFINE_ENUM(NFS_UNSTABLE);
800*06e19024SChuck Lever TRACE_DEFINE_ENUM(NFS_DATA_SYNC);
801*06e19024SChuck Lever TRACE_DEFINE_ENUM(NFS_FILE_SYNC);
802*06e19024SChuck Lever 
8038224b273SChuck Lever #define nfs_show_stable(stable) \
8048224b273SChuck Lever 	__print_symbolic(stable, \
805*06e19024SChuck Lever 			{ NFS_UNSTABLE, "UNSTABLE" }, \
806*06e19024SChuck Lever 			{ NFS_DATA_SYNC, "DATA_SYNC" }, \
807*06e19024SChuck Lever 			{ NFS_FILE_SYNC, "FILE_SYNC" })
8088224b273SChuck Lever 
8098224b273SChuck Lever TRACE_EVENT(nfs_initiate_write,
8108224b273SChuck Lever 		TP_PROTO(
8118224b273SChuck Lever 			const struct inode *inode,
8128224b273SChuck Lever 			loff_t offset, unsigned long count,
8138224b273SChuck Lever 			enum nfs3_stable_how stable
8148224b273SChuck Lever 		),
8158224b273SChuck Lever 
8168224b273SChuck Lever 		TP_ARGS(inode, offset, count, stable),
8178224b273SChuck Lever 
8188224b273SChuck Lever 		TP_STRUCT__entry(
8198224b273SChuck Lever 			__field(loff_t, offset)
8208224b273SChuck Lever 			__field(unsigned long, count)
8218224b273SChuck Lever 			__field(enum nfs3_stable_how, stable)
8228224b273SChuck Lever 			__field(dev_t, dev)
8238224b273SChuck Lever 			__field(u32, fhandle)
8248224b273SChuck Lever 			__field(u64, fileid)
8258224b273SChuck Lever 		),
8268224b273SChuck Lever 
8278224b273SChuck Lever 		TP_fast_assign(
8288224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
8298224b273SChuck Lever 
8308224b273SChuck Lever 			__entry->offset = offset;
8318224b273SChuck Lever 			__entry->count = count;
8328224b273SChuck Lever 			__entry->stable = stable;
8338224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
8348224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
8358224b273SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
8368224b273SChuck Lever 		),
8378224b273SChuck Lever 
8388224b273SChuck Lever 		TP_printk(
8398224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
840*06e19024SChuck Lever 			"offset=%lld count=%lu stable=%s",
8418224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
8428224b273SChuck Lever 			(unsigned long long)__entry->fileid,
8438224b273SChuck Lever 			__entry->fhandle,
8448224b273SChuck Lever 			__entry->offset, __entry->count,
845*06e19024SChuck Lever 			nfs_show_stable(__entry->stable)
8468224b273SChuck Lever 		)
8478224b273SChuck Lever );
8488224b273SChuck Lever 
8498224b273SChuck Lever TRACE_EVENT(nfs_writeback_done,
8508224b273SChuck Lever 		TP_PROTO(
8518224b273SChuck Lever 			const struct inode *inode,
8528224b273SChuck Lever 			int status,
8538224b273SChuck Lever 			loff_t offset,
8548224b273SChuck Lever 			struct nfs_writeverf *writeverf
8558224b273SChuck Lever 		),
8568224b273SChuck Lever 
8578224b273SChuck Lever 		TP_ARGS(inode, status, offset, writeverf),
8588224b273SChuck Lever 
8598224b273SChuck Lever 		TP_STRUCT__entry(
8608224b273SChuck Lever 			__field(int, status)
8618224b273SChuck Lever 			__field(loff_t, offset)
8628224b273SChuck Lever 			__field(enum nfs3_stable_how, stable)
8638224b273SChuck Lever 			__field(unsigned long long, verifier)
8648224b273SChuck Lever 			__field(dev_t, dev)
8658224b273SChuck Lever 			__field(u32, fhandle)
8668224b273SChuck Lever 			__field(u64, fileid)
8678224b273SChuck Lever 		),
8688224b273SChuck Lever 
8698224b273SChuck Lever 		TP_fast_assign(
8708224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
8718224b273SChuck Lever 
8728224b273SChuck Lever 			__entry->status = status;
8738224b273SChuck Lever 			__entry->offset = offset;
8748224b273SChuck Lever 			__entry->stable = writeverf->committed;
8758224b273SChuck Lever 			memcpy(&__entry->verifier, &writeverf->verifier,
8768224b273SChuck Lever 			       sizeof(__entry->verifier));
8778224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
8788224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
8798224b273SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
8808224b273SChuck Lever 		),
8818224b273SChuck Lever 
8828224b273SChuck Lever 		TP_printk(
8838224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
884*06e19024SChuck Lever 			"offset=%lld status=%d stable=%s "
8858224b273SChuck Lever 			"verifier 0x%016llx",
8868224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
8878224b273SChuck Lever 			(unsigned long long)__entry->fileid,
8888224b273SChuck Lever 			__entry->fhandle,
8898224b273SChuck Lever 			__entry->offset, __entry->status,
890*06e19024SChuck Lever 			nfs_show_stable(__entry->stable),
8918224b273SChuck Lever 			__entry->verifier
8928224b273SChuck Lever 		)
8938224b273SChuck Lever );
8948224b273SChuck Lever 
8958224b273SChuck Lever TRACE_EVENT(nfs_initiate_commit,
8968224b273SChuck Lever 		TP_PROTO(
8978224b273SChuck Lever 			const struct nfs_commit_data *data
8988224b273SChuck Lever 		),
8998224b273SChuck Lever 
9008224b273SChuck Lever 		TP_ARGS(data),
9018224b273SChuck Lever 
9028224b273SChuck Lever 		TP_STRUCT__entry(
9038224b273SChuck Lever 			__field(loff_t, offset)
9048224b273SChuck Lever 			__field(unsigned long, count)
9058224b273SChuck Lever 			__field(dev_t, dev)
9068224b273SChuck Lever 			__field(u32, fhandle)
9078224b273SChuck Lever 			__field(u64, fileid)
9088224b273SChuck Lever 		),
9098224b273SChuck Lever 
9108224b273SChuck Lever 		TP_fast_assign(
9118224b273SChuck Lever 			const struct inode *inode = data->inode;
9128224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
9138224b273SChuck Lever 
9148224b273SChuck Lever 			__entry->offset = data->args.offset;
9158224b273SChuck Lever 			__entry->count = data->args.count;
9168224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
9178224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
9188224b273SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
9198224b273SChuck Lever 		),
9208224b273SChuck Lever 
9218224b273SChuck Lever 		TP_printk(
9228224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
9238224b273SChuck Lever 			"offset=%lld count=%lu",
9248224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
9258224b273SChuck Lever 			(unsigned long long)__entry->fileid,
9268224b273SChuck Lever 			__entry->fhandle,
9278224b273SChuck Lever 			__entry->offset, __entry->count
9288224b273SChuck Lever 		)
9298224b273SChuck Lever );
9308224b273SChuck Lever 
9318224b273SChuck Lever TRACE_EVENT(nfs_commit_done,
9328224b273SChuck Lever 		TP_PROTO(
9338224b273SChuck Lever 			const struct nfs_commit_data *data
9348224b273SChuck Lever 		),
9358224b273SChuck Lever 
9368224b273SChuck Lever 		TP_ARGS(data),
9378224b273SChuck Lever 
9388224b273SChuck Lever 		TP_STRUCT__entry(
9398224b273SChuck Lever 			__field(int, status)
9408224b273SChuck Lever 			__field(loff_t, offset)
9418224b273SChuck Lever 			__field(unsigned long long, verifier)
9428224b273SChuck Lever 			__field(dev_t, dev)
9438224b273SChuck Lever 			__field(u32, fhandle)
9448224b273SChuck Lever 			__field(u64, fileid)
9458224b273SChuck Lever 		),
9468224b273SChuck Lever 
9478224b273SChuck Lever 		TP_fast_assign(
9488224b273SChuck Lever 			const struct inode *inode = data->inode;
9498224b273SChuck Lever 			const struct nfs_inode *nfsi = NFS_I(inode);
9508224b273SChuck Lever 
9518224b273SChuck Lever 			__entry->status = data->res.op_status;
9528224b273SChuck Lever 			__entry->offset = data->args.offset;
9538224b273SChuck Lever 			memcpy(&__entry->verifier, &data->verf.verifier,
9548224b273SChuck Lever 			       sizeof(__entry->verifier));
9558224b273SChuck Lever 			__entry->dev = inode->i_sb->s_dev;
9568224b273SChuck Lever 			__entry->fileid = nfsi->fileid;
9578224b273SChuck Lever 			__entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
9588224b273SChuck Lever 		),
9598224b273SChuck Lever 
9608224b273SChuck Lever 		TP_printk(
9618224b273SChuck Lever 			"fileid=%02x:%02x:%llu fhandle=0x%08x "
9628224b273SChuck Lever 			"offset=%lld status=%d verifier 0x%016llx",
9638224b273SChuck Lever 			MAJOR(__entry->dev), MINOR(__entry->dev),
9648224b273SChuck Lever 			(unsigned long long)__entry->fileid,
9658224b273SChuck Lever 			__entry->fhandle,
9668224b273SChuck Lever 			__entry->offset, __entry->status,
9678224b273SChuck Lever 			__entry->verifier
9688224b273SChuck Lever 		)
9698224b273SChuck Lever );
9708224b273SChuck Lever 
971f4ce1299STrond Myklebust #endif /* _TRACE_NFS_H */
972f4ce1299STrond Myklebust 
973f4ce1299STrond Myklebust #undef TRACE_INCLUDE_PATH
974f4ce1299STrond Myklebust #define TRACE_INCLUDE_PATH .
975f4ce1299STrond Myklebust #define TRACE_INCLUDE_FILE nfstrace
976f4ce1299STrond Myklebust /* This part must be outside protection */
977f4ce1299STrond Myklebust #include <trace/define_trace.h>
978