blob: 5a59dcdce0b2b2a1c150acdb9a9c7f4281d101b9 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Trond Myklebustf4ce1292013-08-19 18:59:33 -04002/*
3 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
4 */
5#undef TRACE_SYSTEM
6#define TRACE_SYSTEM nfs
7
8#if !defined(_TRACE_NFS_H) || defined(TRACE_HEADER_MULTI_READ)
9#define _TRACE_NFS_H
10
11#include <linux/tracepoint.h>
Jeff Layton1eb5d982018-01-09 08:21:17 -050012#include <linux/iversion.h>
Trond Myklebustf4ce1292013-08-19 18:59:33 -040013
Chuck Lever7d4006c2019-06-19 10:34:03 -040014TRACE_DEFINE_ENUM(DT_UNKNOWN);
15TRACE_DEFINE_ENUM(DT_FIFO);
16TRACE_DEFINE_ENUM(DT_CHR);
17TRACE_DEFINE_ENUM(DT_DIR);
18TRACE_DEFINE_ENUM(DT_BLK);
19TRACE_DEFINE_ENUM(DT_REG);
20TRACE_DEFINE_ENUM(DT_LNK);
21TRACE_DEFINE_ENUM(DT_SOCK);
22TRACE_DEFINE_ENUM(DT_WHT);
23
Trond Myklebustf4ce1292013-08-19 18:59:33 -040024#define nfs_show_file_type(ftype) \
25 __print_symbolic(ftype, \
26 { DT_UNKNOWN, "UNKNOWN" }, \
27 { DT_FIFO, "FIFO" }, \
28 { DT_CHR, "CHR" }, \
29 { DT_DIR, "DIR" }, \
30 { DT_BLK, "BLK" }, \
31 { DT_REG, "REG" }, \
32 { DT_LNK, "LNK" }, \
33 { DT_SOCK, "SOCK" }, \
34 { DT_WHT, "WHT" })
35
Chuck Lever7d4006c2019-06-19 10:34:03 -040036TRACE_DEFINE_ENUM(NFS_INO_INVALID_DATA);
37TRACE_DEFINE_ENUM(NFS_INO_INVALID_ATIME);
38TRACE_DEFINE_ENUM(NFS_INO_INVALID_ACCESS);
39TRACE_DEFINE_ENUM(NFS_INO_INVALID_ACL);
40TRACE_DEFINE_ENUM(NFS_INO_REVAL_PAGECACHE);
41TRACE_DEFINE_ENUM(NFS_INO_REVAL_FORCED);
42TRACE_DEFINE_ENUM(NFS_INO_INVALID_LABEL);
43TRACE_DEFINE_ENUM(NFS_INO_INVALID_CHANGE);
44TRACE_DEFINE_ENUM(NFS_INO_INVALID_CTIME);
45TRACE_DEFINE_ENUM(NFS_INO_INVALID_MTIME);
46TRACE_DEFINE_ENUM(NFS_INO_INVALID_SIZE);
47TRACE_DEFINE_ENUM(NFS_INO_INVALID_OTHER);
48
Trond Myklebustf4ce1292013-08-19 18:59:33 -040049#define nfs_show_cache_validity(v) \
50 __print_flags(v, "|", \
Trond Myklebustf4ce1292013-08-19 18:59:33 -040051 { NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
52 { NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
53 { NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
54 { NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
55 { NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \
56 { NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
Chuck Lever7d4006c2019-06-19 10:34:03 -040057 { NFS_INO_INVALID_LABEL, "INVALID_LABEL" }, \
58 { NFS_INO_INVALID_CHANGE, "INVALID_CHANGE" }, \
59 { NFS_INO_INVALID_CTIME, "INVALID_CTIME" }, \
60 { NFS_INO_INVALID_MTIME, "INVALID_MTIME" }, \
61 { NFS_INO_INVALID_SIZE, "INVALID_SIZE" }, \
Frank van der Linden0f44da52020-06-23 22:39:00 +000062 { NFS_INO_INVALID_OTHER, "INVALID_OTHER" }, \
63 { NFS_INO_INVALID_XATTR, "INVALID_XATTR" })
Chuck Lever7d4006c2019-06-19 10:34:03 -040064
65TRACE_DEFINE_ENUM(NFS_INO_ADVISE_RDPLUS);
66TRACE_DEFINE_ENUM(NFS_INO_STALE);
67TRACE_DEFINE_ENUM(NFS_INO_ACL_LRU_SET);
68TRACE_DEFINE_ENUM(NFS_INO_INVALIDATING);
69TRACE_DEFINE_ENUM(NFS_INO_FSCACHE);
70TRACE_DEFINE_ENUM(NFS_INO_FSCACHE_LOCK);
71TRACE_DEFINE_ENUM(NFS_INO_LAYOUTCOMMIT);
72TRACE_DEFINE_ENUM(NFS_INO_LAYOUTCOMMITTING);
73TRACE_DEFINE_ENUM(NFS_INO_LAYOUTSTATS);
74TRACE_DEFINE_ENUM(NFS_INO_ODIRECT);
Trond Myklebustf4ce1292013-08-19 18:59:33 -040075
76#define nfs_show_nfsi_flags(v) \
77 __print_flags(v, "|", \
Chuck Lever7d4006c2019-06-19 10:34:03 -040078 { BIT(NFS_INO_ADVISE_RDPLUS), "ADVISE_RDPLUS" }, \
79 { BIT(NFS_INO_STALE), "STALE" }, \
80 { BIT(NFS_INO_ACL_LRU_SET), "ACL_LRU_SET" }, \
81 { BIT(NFS_INO_INVALIDATING), "INVALIDATING" }, \
82 { BIT(NFS_INO_FSCACHE), "FSCACHE" }, \
83 { BIT(NFS_INO_FSCACHE_LOCK), "FSCACHE_LOCK" }, \
84 { BIT(NFS_INO_LAYOUTCOMMIT), "NEED_LAYOUTCOMMIT" }, \
85 { BIT(NFS_INO_LAYOUTCOMMITTING), "LAYOUTCOMMIT" }, \
86 { BIT(NFS_INO_LAYOUTSTATS), "LAYOUTSTATS" }, \
87 { BIT(NFS_INO_ODIRECT), "ODIRECT" })
Trond Myklebustf4ce1292013-08-19 18:59:33 -040088
89DECLARE_EVENT_CLASS(nfs_inode_event,
90 TP_PROTO(
91 const struct inode *inode
92 ),
93
94 TP_ARGS(inode),
95
96 TP_STRUCT__entry(
97 __field(dev_t, dev)
98 __field(u32, fhandle)
99 __field(u64, fileid)
100 __field(u64, version)
101 ),
102
103 TP_fast_assign(
104 const struct nfs_inode *nfsi = NFS_I(inode);
105 __entry->dev = inode->i_sb->s_dev;
106 __entry->fileid = nfsi->fileid;
107 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
Jeff Layton1eb5d982018-01-09 08:21:17 -0500108 __entry->version = inode_peek_iversion_raw(inode);
Trond Myklebustf4ce1292013-08-19 18:59:33 -0400109 ),
110
111 TP_printk(
112 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
113 MAJOR(__entry->dev), MINOR(__entry->dev),
114 (unsigned long long)__entry->fileid,
115 __entry->fhandle,
116 (unsigned long long)__entry->version
117 )
118);
119
120DECLARE_EVENT_CLASS(nfs_inode_event_done,
121 TP_PROTO(
122 const struct inode *inode,
123 int error
124 ),
125
126 TP_ARGS(inode, error),
127
128 TP_STRUCT__entry(
Chuck Lever38a638a2019-06-19 10:33:58 -0400129 __field(unsigned long, error)
Trond Myklebustf4ce1292013-08-19 18:59:33 -0400130 __field(dev_t, dev)
131 __field(u32, fhandle)
132 __field(unsigned char, type)
133 __field(u64, fileid)
134 __field(u64, version)
135 __field(loff_t, size)
136 __field(unsigned long, nfsi_flags)
137 __field(unsigned long, cache_validity)
138 ),
139
140 TP_fast_assign(
141 const struct nfs_inode *nfsi = NFS_I(inode);
Chuck Lever38a638a2019-06-19 10:33:58 -0400142 __entry->error = error < 0 ? -error : 0;
Trond Myklebustf4ce1292013-08-19 18:59:33 -0400143 __entry->dev = inode->i_sb->s_dev;
144 __entry->fileid = nfsi->fileid;
145 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
146 __entry->type = nfs_umode_to_dtype(inode->i_mode);
Jeff Layton1eb5d982018-01-09 08:21:17 -0500147 __entry->version = inode_peek_iversion_raw(inode);
Trond Myklebustf4ce1292013-08-19 18:59:33 -0400148 __entry->size = i_size_read(inode);
149 __entry->nfsi_flags = nfsi->flags;
150 __entry->cache_validity = nfsi->cache_validity;
151 ),
152
153 TP_printk(
Chuck Lever38a638a2019-06-19 10:33:58 -0400154 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustf4ce1292013-08-19 18:59:33 -0400155 "type=%u (%s) version=%llu size=%lld "
Chuck Lever7d4006c2019-06-19 10:34:03 -0400156 "cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s)",
Chuck Lever38a638a2019-06-19 10:33:58 -0400157 -__entry->error, nfs_show_status(__entry->error),
Trond Myklebustf4ce1292013-08-19 18:59:33 -0400158 MAJOR(__entry->dev), MINOR(__entry->dev),
159 (unsigned long long)__entry->fileid,
160 __entry->fhandle,
161 __entry->type,
162 nfs_show_file_type(__entry->type),
163 (unsigned long long)__entry->version,
164 (long long)__entry->size,
165 __entry->cache_validity,
166 nfs_show_cache_validity(__entry->cache_validity),
167 __entry->nfsi_flags,
168 nfs_show_nfsi_flags(__entry->nfsi_flags)
169 )
170);
171
172#define DEFINE_NFS_INODE_EVENT(name) \
173 DEFINE_EVENT(nfs_inode_event, name, \
174 TP_PROTO( \
175 const struct inode *inode \
176 ), \
177 TP_ARGS(inode))
178#define DEFINE_NFS_INODE_EVENT_DONE(name) \
179 DEFINE_EVENT(nfs_inode_event_done, name, \
180 TP_PROTO( \
181 const struct inode *inode, \
182 int error \
183 ), \
184 TP_ARGS(inode, error))
Trond Myklebust93ce4af2020-04-06 13:39:29 -0400185DEFINE_NFS_INODE_EVENT(nfs_set_inode_stale);
Trond Myklebustf4ce1292013-08-19 18:59:33 -0400186DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter);
187DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit);
188DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter);
189DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit);
190DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter);
191DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit);
192DEFINE_NFS_INODE_EVENT(nfs_getattr_enter);
193DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit);
194DEFINE_NFS_INODE_EVENT(nfs_setattr_enter);
195DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit);
196DEFINE_NFS_INODE_EVENT(nfs_writeback_page_enter);
197DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_page_exit);
198DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter);
199DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit);
200DEFINE_NFS_INODE_EVENT(nfs_fsync_enter);
201DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
202DEFINE_NFS_INODE_EVENT(nfs_access_enter);
Trond Myklebuste8194b72020-01-06 15:25:12 -0500203
204TRACE_EVENT(nfs_access_exit,
205 TP_PROTO(
206 const struct inode *inode,
207 unsigned int mask,
208 unsigned int permitted,
209 int error
210 ),
211
212 TP_ARGS(inode, mask, permitted, error),
213
214 TP_STRUCT__entry(
215 __field(unsigned long, error)
216 __field(dev_t, dev)
217 __field(u32, fhandle)
218 __field(unsigned char, type)
219 __field(u64, fileid)
220 __field(u64, version)
221 __field(loff_t, size)
222 __field(unsigned long, nfsi_flags)
223 __field(unsigned long, cache_validity)
224 __field(unsigned int, mask)
225 __field(unsigned int, permitted)
226 ),
227
228 TP_fast_assign(
229 const struct nfs_inode *nfsi = NFS_I(inode);
230 __entry->error = error < 0 ? -error : 0;
231 __entry->dev = inode->i_sb->s_dev;
232 __entry->fileid = nfsi->fileid;
233 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
234 __entry->type = nfs_umode_to_dtype(inode->i_mode);
235 __entry->version = inode_peek_iversion_raw(inode);
236 __entry->size = i_size_read(inode);
237 __entry->nfsi_flags = nfsi->flags;
238 __entry->cache_validity = nfsi->cache_validity;
239 __entry->mask = mask;
240 __entry->permitted = permitted;
241 ),
242
243 TP_printk(
244 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
245 "type=%u (%s) version=%llu size=%lld "
246 "cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s) "
247 "mask=0x%x permitted=0x%x",
248 -__entry->error, nfs_show_status(__entry->error),
249 MAJOR(__entry->dev), MINOR(__entry->dev),
250 (unsigned long long)__entry->fileid,
251 __entry->fhandle,
252 __entry->type,
253 nfs_show_file_type(__entry->type),
254 (unsigned long long)__entry->version,
255 (long long)__entry->size,
256 __entry->cache_validity,
257 nfs_show_cache_validity(__entry->cache_validity),
258 __entry->nfsi_flags,
259 nfs_show_nfsi_flags(__entry->nfsi_flags),
260 __entry->mask, __entry->permitted
261 )
262);
Trond Myklebustf4ce1292013-08-19 18:59:33 -0400263
Chuck Lever7d4006c2019-06-19 10:34:03 -0400264TRACE_DEFINE_ENUM(LOOKUP_FOLLOW);
265TRACE_DEFINE_ENUM(LOOKUP_DIRECTORY);
266TRACE_DEFINE_ENUM(LOOKUP_AUTOMOUNT);
267TRACE_DEFINE_ENUM(LOOKUP_PARENT);
268TRACE_DEFINE_ENUM(LOOKUP_REVAL);
269TRACE_DEFINE_ENUM(LOOKUP_RCU);
Chuck Lever7d4006c2019-06-19 10:34:03 -0400270TRACE_DEFINE_ENUM(LOOKUP_OPEN);
271TRACE_DEFINE_ENUM(LOOKUP_CREATE);
272TRACE_DEFINE_ENUM(LOOKUP_EXCL);
273TRACE_DEFINE_ENUM(LOOKUP_RENAME_TARGET);
274TRACE_DEFINE_ENUM(LOOKUP_JUMPED);
275TRACE_DEFINE_ENUM(LOOKUP_ROOT);
276TRACE_DEFINE_ENUM(LOOKUP_EMPTY);
277TRACE_DEFINE_ENUM(LOOKUP_DOWN);
278
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400279#define show_lookup_flags(flags) \
Chuck Lever7d4006c2019-06-19 10:34:03 -0400280 __print_flags(flags, "|", \
281 { LOOKUP_FOLLOW, "FOLLOW" }, \
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400282 { LOOKUP_DIRECTORY, "DIRECTORY" }, \
Chuck Lever7d4006c2019-06-19 10:34:03 -0400283 { LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \
284 { LOOKUP_PARENT, "PARENT" }, \
285 { LOOKUP_REVAL, "REVAL" }, \
286 { LOOKUP_RCU, "RCU" }, \
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400287 { LOOKUP_OPEN, "OPEN" }, \
288 { LOOKUP_CREATE, "CREATE" }, \
Chuck Lever7d4006c2019-06-19 10:34:03 -0400289 { LOOKUP_EXCL, "EXCL" }, \
290 { LOOKUP_RENAME_TARGET, "RENAME_TARGET" }, \
291 { LOOKUP_JUMPED, "JUMPED" }, \
292 { LOOKUP_ROOT, "ROOT" }, \
293 { LOOKUP_EMPTY, "EMPTY" }, \
294 { LOOKUP_DOWN, "DOWN" })
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400295
296DECLARE_EVENT_CLASS(nfs_lookup_event,
297 TP_PROTO(
298 const struct inode *dir,
299 const struct dentry *dentry,
300 unsigned int flags
301 ),
302
303 TP_ARGS(dir, dentry, flags),
304
305 TP_STRUCT__entry(
Chuck Lever7d4006c2019-06-19 10:34:03 -0400306 __field(unsigned long, flags)
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400307 __field(dev_t, dev)
308 __field(u64, dir)
309 __string(name, dentry->d_name.name)
310 ),
311
312 TP_fast_assign(
313 __entry->dev = dir->i_sb->s_dev;
314 __entry->dir = NFS_FILEID(dir);
315 __entry->flags = flags;
316 __assign_str(name, dentry->d_name.name);
317 ),
318
319 TP_printk(
Chuck Lever7d4006c2019-06-19 10:34:03 -0400320 "flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400321 __entry->flags,
322 show_lookup_flags(__entry->flags),
323 MAJOR(__entry->dev), MINOR(__entry->dev),
324 (unsigned long long)__entry->dir,
325 __get_str(name)
326 )
327);
328
329#define DEFINE_NFS_LOOKUP_EVENT(name) \
330 DEFINE_EVENT(nfs_lookup_event, name, \
331 TP_PROTO( \
332 const struct inode *dir, \
333 const struct dentry *dentry, \
334 unsigned int flags \
335 ), \
336 TP_ARGS(dir, dentry, flags))
337
338DECLARE_EVENT_CLASS(nfs_lookup_event_done,
339 TP_PROTO(
340 const struct inode *dir,
341 const struct dentry *dentry,
342 unsigned int flags,
343 int error
344 ),
345
346 TP_ARGS(dir, dentry, flags, error),
347
348 TP_STRUCT__entry(
Chuck Lever38a638a2019-06-19 10:33:58 -0400349 __field(unsigned long, error)
Chuck Lever7d4006c2019-06-19 10:34:03 -0400350 __field(unsigned long, flags)
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400351 __field(dev_t, dev)
352 __field(u64, dir)
353 __string(name, dentry->d_name.name)
354 ),
355
356 TP_fast_assign(
357 __entry->dev = dir->i_sb->s_dev;
358 __entry->dir = NFS_FILEID(dir);
Chuck Lever38a638a2019-06-19 10:33:58 -0400359 __entry->error = error < 0 ? -error : 0;
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400360 __entry->flags = flags;
361 __assign_str(name, dentry->d_name.name);
362 ),
363
364 TP_printk(
Chuck Lever7d4006c2019-06-19 10:34:03 -0400365 "error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
Chuck Lever38a638a2019-06-19 10:33:58 -0400366 -__entry->error, nfs_show_status(__entry->error),
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400367 __entry->flags,
368 show_lookup_flags(__entry->flags),
369 MAJOR(__entry->dev), MINOR(__entry->dev),
370 (unsigned long long)__entry->dir,
371 __get_str(name)
372 )
373);
374
375#define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \
376 DEFINE_EVENT(nfs_lookup_event_done, name, \
377 TP_PROTO( \
378 const struct inode *dir, \
379 const struct dentry *dentry, \
380 unsigned int flags, \
381 int error \
382 ), \
383 TP_ARGS(dir, dentry, flags, error))
384
385DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter);
386DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
387DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
388DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
389
Chuck Lever7d4006c2019-06-19 10:34:03 -0400390TRACE_DEFINE_ENUM(O_WRONLY);
391TRACE_DEFINE_ENUM(O_RDWR);
392TRACE_DEFINE_ENUM(O_CREAT);
393TRACE_DEFINE_ENUM(O_EXCL);
394TRACE_DEFINE_ENUM(O_NOCTTY);
395TRACE_DEFINE_ENUM(O_TRUNC);
396TRACE_DEFINE_ENUM(O_APPEND);
397TRACE_DEFINE_ENUM(O_NONBLOCK);
398TRACE_DEFINE_ENUM(O_DSYNC);
399TRACE_DEFINE_ENUM(O_DIRECT);
400TRACE_DEFINE_ENUM(O_LARGEFILE);
401TRACE_DEFINE_ENUM(O_DIRECTORY);
402TRACE_DEFINE_ENUM(O_NOFOLLOW);
403TRACE_DEFINE_ENUM(O_NOATIME);
404TRACE_DEFINE_ENUM(O_CLOEXEC);
405
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400406#define show_open_flags(flags) \
Chuck Lever7d4006c2019-06-19 10:34:03 -0400407 __print_flags(flags, "|", \
408 { O_WRONLY, "O_WRONLY" }, \
409 { O_RDWR, "O_RDWR" }, \
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400410 { O_CREAT, "O_CREAT" }, \
411 { O_EXCL, "O_EXCL" }, \
Chuck Lever7d4006c2019-06-19 10:34:03 -0400412 { O_NOCTTY, "O_NOCTTY" }, \
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400413 { O_TRUNC, "O_TRUNC" }, \
414 { O_APPEND, "O_APPEND" }, \
Chuck Lever7d4006c2019-06-19 10:34:03 -0400415 { O_NONBLOCK, "O_NONBLOCK" }, \
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400416 { O_DSYNC, "O_DSYNC" }, \
417 { O_DIRECT, "O_DIRECT" }, \
Chuck Lever7d4006c2019-06-19 10:34:03 -0400418 { O_LARGEFILE, "O_LARGEFILE" }, \
419 { O_DIRECTORY, "O_DIRECTORY" }, \
420 { O_NOFOLLOW, "O_NOFOLLOW" }, \
421 { O_NOATIME, "O_NOATIME" }, \
422 { O_CLOEXEC, "O_CLOEXEC" })
423
424TRACE_DEFINE_ENUM(FMODE_READ);
425TRACE_DEFINE_ENUM(FMODE_WRITE);
426TRACE_DEFINE_ENUM(FMODE_EXEC);
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400427
428#define show_fmode_flags(mode) \
429 __print_flags(mode, "|", \
430 { ((__force unsigned long)FMODE_READ), "READ" }, \
431 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
432 { ((__force unsigned long)FMODE_EXEC), "EXEC" })
433
434TRACE_EVENT(nfs_atomic_open_enter,
435 TP_PROTO(
436 const struct inode *dir,
437 const struct nfs_open_context *ctx,
438 unsigned int flags
439 ),
440
441 TP_ARGS(dir, ctx, flags),
442
443 TP_STRUCT__entry(
Chuck Lever7d4006c2019-06-19 10:34:03 -0400444 __field(unsigned long, flags)
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400445 __field(unsigned int, fmode)
446 __field(dev_t, dev)
447 __field(u64, dir)
448 __string(name, ctx->dentry->d_name.name)
449 ),
450
451 TP_fast_assign(
452 __entry->dev = dir->i_sb->s_dev;
453 __entry->dir = NFS_FILEID(dir);
454 __entry->flags = flags;
455 __entry->fmode = (__force unsigned int)ctx->mode;
456 __assign_str(name, ctx->dentry->d_name.name);
457 ),
458
459 TP_printk(
Chuck Lever7d4006c2019-06-19 10:34:03 -0400460 "flags=0x%lx (%s) fmode=%s name=%02x:%02x:%llu/%s",
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400461 __entry->flags,
462 show_open_flags(__entry->flags),
463 show_fmode_flags(__entry->fmode),
464 MAJOR(__entry->dev), MINOR(__entry->dev),
465 (unsigned long long)__entry->dir,
466 __get_str(name)
467 )
468);
469
470TRACE_EVENT(nfs_atomic_open_exit,
471 TP_PROTO(
472 const struct inode *dir,
473 const struct nfs_open_context *ctx,
474 unsigned int flags,
475 int error
476 ),
477
478 TP_ARGS(dir, ctx, flags, error),
479
480 TP_STRUCT__entry(
Chuck Lever38a638a2019-06-19 10:33:58 -0400481 __field(unsigned long, error)
Chuck Lever7d4006c2019-06-19 10:34:03 -0400482 __field(unsigned long, flags)
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400483 __field(unsigned int, fmode)
484 __field(dev_t, dev)
485 __field(u64, dir)
486 __string(name, ctx->dentry->d_name.name)
487 ),
488
489 TP_fast_assign(
Chuck Lever38a638a2019-06-19 10:33:58 -0400490 __entry->error = -error;
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400491 __entry->dev = dir->i_sb->s_dev;
492 __entry->dir = NFS_FILEID(dir);
493 __entry->flags = flags;
494 __entry->fmode = (__force unsigned int)ctx->mode;
495 __assign_str(name, ctx->dentry->d_name.name);
496 ),
497
498 TP_printk(
Chuck Lever7d4006c2019-06-19 10:34:03 -0400499 "error=%ld (%s) flags=0x%lx (%s) fmode=%s "
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400500 "name=%02x:%02x:%llu/%s",
Chuck Lever38a638a2019-06-19 10:33:58 -0400501 -__entry->error, nfs_show_status(__entry->error),
Trond Myklebust6e0d0be2013-08-20 11:26:17 -0400502 __entry->flags,
503 show_open_flags(__entry->flags),
504 show_fmode_flags(__entry->fmode),
505 MAJOR(__entry->dev), MINOR(__entry->dev),
506 (unsigned long long)__entry->dir,
507 __get_str(name)
508 )
509);
510
Trond Myklebust8b0ad3d2013-08-21 10:53:09 -0400511TRACE_EVENT(nfs_create_enter,
512 TP_PROTO(
513 const struct inode *dir,
514 const struct dentry *dentry,
515 unsigned int flags
516 ),
517
518 TP_ARGS(dir, dentry, flags),
519
520 TP_STRUCT__entry(
Chuck Lever7d4006c2019-06-19 10:34:03 -0400521 __field(unsigned long, flags)
Trond Myklebust8b0ad3d2013-08-21 10:53:09 -0400522 __field(dev_t, dev)
523 __field(u64, dir)
524 __string(name, dentry->d_name.name)
525 ),
526
527 TP_fast_assign(
528 __entry->dev = dir->i_sb->s_dev;
529 __entry->dir = NFS_FILEID(dir);
530 __entry->flags = flags;
531 __assign_str(name, dentry->d_name.name);
532 ),
533
534 TP_printk(
Chuck Lever7d4006c2019-06-19 10:34:03 -0400535 "flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
Trond Myklebust8b0ad3d2013-08-21 10:53:09 -0400536 __entry->flags,
537 show_open_flags(__entry->flags),
538 MAJOR(__entry->dev), MINOR(__entry->dev),
539 (unsigned long long)__entry->dir,
540 __get_str(name)
541 )
542);
543
544TRACE_EVENT(nfs_create_exit,
545 TP_PROTO(
546 const struct inode *dir,
547 const struct dentry *dentry,
548 unsigned int flags,
549 int error
550 ),
551
552 TP_ARGS(dir, dentry, flags, error),
553
554 TP_STRUCT__entry(
Chuck Lever38a638a2019-06-19 10:33:58 -0400555 __field(unsigned long, error)
Chuck Lever7d4006c2019-06-19 10:34:03 -0400556 __field(unsigned long, flags)
Trond Myklebust8b0ad3d2013-08-21 10:53:09 -0400557 __field(dev_t, dev)
558 __field(u64, dir)
559 __string(name, dentry->d_name.name)
560 ),
561
562 TP_fast_assign(
Chuck Lever38a638a2019-06-19 10:33:58 -0400563 __entry->error = -error;
Trond Myklebust8b0ad3d2013-08-21 10:53:09 -0400564 __entry->dev = dir->i_sb->s_dev;
565 __entry->dir = NFS_FILEID(dir);
566 __entry->flags = flags;
567 __assign_str(name, dentry->d_name.name);
568 ),
569
570 TP_printk(
Chuck Lever7d4006c2019-06-19 10:34:03 -0400571 "error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
Chuck Lever38a638a2019-06-19 10:33:58 -0400572 -__entry->error, nfs_show_status(__entry->error),
Trond Myklebust8b0ad3d2013-08-21 10:53:09 -0400573 __entry->flags,
574 show_open_flags(__entry->flags),
575 MAJOR(__entry->dev), MINOR(__entry->dev),
576 (unsigned long long)__entry->dir,
577 __get_str(name)
578 )
579);
580
Trond Myklebust1ca42382013-08-21 12:36:04 -0400581DECLARE_EVENT_CLASS(nfs_directory_event,
582 TP_PROTO(
583 const struct inode *dir,
584 const struct dentry *dentry
585 ),
586
587 TP_ARGS(dir, dentry),
588
589 TP_STRUCT__entry(
590 __field(dev_t, dev)
591 __field(u64, dir)
592 __string(name, dentry->d_name.name)
593 ),
594
595 TP_fast_assign(
596 __entry->dev = dir->i_sb->s_dev;
597 __entry->dir = NFS_FILEID(dir);
598 __assign_str(name, dentry->d_name.name);
599 ),
600
601 TP_printk(
602 "name=%02x:%02x:%llu/%s",
603 MAJOR(__entry->dev), MINOR(__entry->dev),
604 (unsigned long long)__entry->dir,
605 __get_str(name)
606 )
607);
608
609#define DEFINE_NFS_DIRECTORY_EVENT(name) \
610 DEFINE_EVENT(nfs_directory_event, name, \
611 TP_PROTO( \
612 const struct inode *dir, \
613 const struct dentry *dentry \
614 ), \
615 TP_ARGS(dir, dentry))
616
617DECLARE_EVENT_CLASS(nfs_directory_event_done,
618 TP_PROTO(
619 const struct inode *dir,
620 const struct dentry *dentry,
621 int error
622 ),
623
624 TP_ARGS(dir, dentry, error),
625
626 TP_STRUCT__entry(
Chuck Lever38a638a2019-06-19 10:33:58 -0400627 __field(unsigned long, error)
Trond Myklebust1ca42382013-08-21 12:36:04 -0400628 __field(dev_t, dev)
629 __field(u64, dir)
630 __string(name, dentry->d_name.name)
631 ),
632
633 TP_fast_assign(
634 __entry->dev = dir->i_sb->s_dev;
635 __entry->dir = NFS_FILEID(dir);
Chuck Lever38a638a2019-06-19 10:33:58 -0400636 __entry->error = error < 0 ? -error : 0;
Trond Myklebust1ca42382013-08-21 12:36:04 -0400637 __assign_str(name, dentry->d_name.name);
638 ),
639
640 TP_printk(
Chuck Lever38a638a2019-06-19 10:33:58 -0400641 "error=%ld (%s) name=%02x:%02x:%llu/%s",
642 -__entry->error, nfs_show_status(__entry->error),
Trond Myklebust1ca42382013-08-21 12:36:04 -0400643 MAJOR(__entry->dev), MINOR(__entry->dev),
644 (unsigned long long)__entry->dir,
645 __get_str(name)
646 )
647);
648
649#define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \
650 DEFINE_EVENT(nfs_directory_event_done, name, \
651 TP_PROTO( \
652 const struct inode *dir, \
653 const struct dentry *dentry, \
654 int error \
655 ), \
656 TP_ARGS(dir, dentry, error))
657
658DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter);
659DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit);
660DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter);
661DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit);
662DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter);
663DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit);
664DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter);
665DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit);
666DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter);
667DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit);
668DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter);
669DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit);
670
Trond Myklebust1fd10852013-08-21 13:54:44 -0400671TRACE_EVENT(nfs_link_enter,
672 TP_PROTO(
673 const struct inode *inode,
674 const struct inode *dir,
675 const struct dentry *dentry
676 ),
677
678 TP_ARGS(inode, dir, dentry),
679
680 TP_STRUCT__entry(
681 __field(dev_t, dev)
682 __field(u64, fileid)
683 __field(u64, dir)
684 __string(name, dentry->d_name.name)
685 ),
686
687 TP_fast_assign(
688 __entry->dev = inode->i_sb->s_dev;
689 __entry->fileid = NFS_FILEID(inode);
690 __entry->dir = NFS_FILEID(dir);
691 __assign_str(name, dentry->d_name.name);
692 ),
693
694 TP_printk(
695 "fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
696 MAJOR(__entry->dev), MINOR(__entry->dev),
697 __entry->fileid,
698 MAJOR(__entry->dev), MINOR(__entry->dev),
699 (unsigned long long)__entry->dir,
700 __get_str(name)
701 )
702);
703
704TRACE_EVENT(nfs_link_exit,
705 TP_PROTO(
706 const struct inode *inode,
707 const struct inode *dir,
708 const struct dentry *dentry,
709 int error
710 ),
711
712 TP_ARGS(inode, dir, dentry, error),
713
714 TP_STRUCT__entry(
Chuck Lever38a638a2019-06-19 10:33:58 -0400715 __field(unsigned long, error)
Trond Myklebust1fd10852013-08-21 13:54:44 -0400716 __field(dev_t, dev)
717 __field(u64, fileid)
718 __field(u64, dir)
719 __string(name, dentry->d_name.name)
720 ),
721
722 TP_fast_assign(
723 __entry->dev = inode->i_sb->s_dev;
724 __entry->fileid = NFS_FILEID(inode);
725 __entry->dir = NFS_FILEID(dir);
Chuck Lever38a638a2019-06-19 10:33:58 -0400726 __entry->error = error < 0 ? -error : 0;
Trond Myklebust1fd10852013-08-21 13:54:44 -0400727 __assign_str(name, dentry->d_name.name);
728 ),
729
730 TP_printk(
Chuck Lever38a638a2019-06-19 10:33:58 -0400731 "error=%ld (%s) fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
732 -__entry->error, nfs_show_status(__entry->error),
Trond Myklebust1fd10852013-08-21 13:54:44 -0400733 MAJOR(__entry->dev), MINOR(__entry->dev),
734 __entry->fileid,
735 MAJOR(__entry->dev), MINOR(__entry->dev),
736 (unsigned long long)__entry->dir,
737 __get_str(name)
738 )
739);
740
Trond Myklebust70ded202013-08-21 12:08:45 -0400741DECLARE_EVENT_CLASS(nfs_rename_event,
742 TP_PROTO(
743 const struct inode *old_dir,
744 const struct dentry *old_dentry,
745 const struct inode *new_dir,
746 const struct dentry *new_dentry
747 ),
748
749 TP_ARGS(old_dir, old_dentry, new_dir, new_dentry),
750
751 TP_STRUCT__entry(
752 __field(dev_t, dev)
753 __field(u64, old_dir)
754 __field(u64, new_dir)
755 __string(old_name, old_dentry->d_name.name)
756 __string(new_name, new_dentry->d_name.name)
757 ),
758
759 TP_fast_assign(
760 __entry->dev = old_dir->i_sb->s_dev;
761 __entry->old_dir = NFS_FILEID(old_dir);
762 __entry->new_dir = NFS_FILEID(new_dir);
763 __assign_str(old_name, old_dentry->d_name.name);
764 __assign_str(new_name, new_dentry->d_name.name);
765 ),
766
767 TP_printk(
768 "old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s",
769 MAJOR(__entry->dev), MINOR(__entry->dev),
770 (unsigned long long)__entry->old_dir,
771 __get_str(old_name),
772 MAJOR(__entry->dev), MINOR(__entry->dev),
773 (unsigned long long)__entry->new_dir,
774 __get_str(new_name)
775 )
776);
777#define DEFINE_NFS_RENAME_EVENT(name) \
778 DEFINE_EVENT(nfs_rename_event, name, \
779 TP_PROTO( \
780 const struct inode *old_dir, \
781 const struct dentry *old_dentry, \
782 const struct inode *new_dir, \
783 const struct dentry *new_dentry \
784 ), \
785 TP_ARGS(old_dir, old_dentry, new_dir, new_dentry))
786
787DECLARE_EVENT_CLASS(nfs_rename_event_done,
788 TP_PROTO(
789 const struct inode *old_dir,
790 const struct dentry *old_dentry,
791 const struct inode *new_dir,
792 const struct dentry *new_dentry,
793 int error
794 ),
795
796 TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, error),
797
798 TP_STRUCT__entry(
799 __field(dev_t, dev)
Chuck Lever38a638a2019-06-19 10:33:58 -0400800 __field(unsigned long, error)
Trond Myklebust70ded202013-08-21 12:08:45 -0400801 __field(u64, old_dir)
802 __string(old_name, old_dentry->d_name.name)
803 __field(u64, new_dir)
804 __string(new_name, new_dentry->d_name.name)
805 ),
806
807 TP_fast_assign(
808 __entry->dev = old_dir->i_sb->s_dev;
Chuck Lever38a638a2019-06-19 10:33:58 -0400809 __entry->error = -error;
Trond Myklebust70ded202013-08-21 12:08:45 -0400810 __entry->old_dir = NFS_FILEID(old_dir);
811 __entry->new_dir = NFS_FILEID(new_dir);
Trond Myklebust70ded202013-08-21 12:08:45 -0400812 __assign_str(old_name, old_dentry->d_name.name);
813 __assign_str(new_name, new_dentry->d_name.name);
814 ),
815
816 TP_printk(
Chuck Lever38a638a2019-06-19 10:33:58 -0400817 "error=%ld (%s) old_name=%02x:%02x:%llu/%s "
Trond Myklebust70ded202013-08-21 12:08:45 -0400818 "new_name=%02x:%02x:%llu/%s",
Chuck Lever38a638a2019-06-19 10:33:58 -0400819 -__entry->error, nfs_show_status(__entry->error),
Trond Myklebust70ded202013-08-21 12:08:45 -0400820 MAJOR(__entry->dev), MINOR(__entry->dev),
821 (unsigned long long)__entry->old_dir,
822 __get_str(old_name),
823 MAJOR(__entry->dev), MINOR(__entry->dev),
824 (unsigned long long)__entry->new_dir,
825 __get_str(new_name)
826 )
827);
828#define DEFINE_NFS_RENAME_EVENT_DONE(name) \
829 DEFINE_EVENT(nfs_rename_event_done, name, \
830 TP_PROTO( \
831 const struct inode *old_dir, \
832 const struct dentry *old_dentry, \
833 const struct inode *new_dir, \
834 const struct dentry *new_dentry, \
835 int error \
836 ), \
837 TP_ARGS(old_dir, old_dentry, new_dir, \
838 new_dentry, error))
839
840DEFINE_NFS_RENAME_EVENT(nfs_rename_enter);
841DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit);
842
843DEFINE_NFS_RENAME_EVENT_DONE(nfs_sillyrename_rename);
844
845TRACE_EVENT(nfs_sillyrename_unlink,
846 TP_PROTO(
847 const struct nfs_unlinkdata *data,
848 int error
849 ),
850
851 TP_ARGS(data, error),
852
853 TP_STRUCT__entry(
854 __field(dev_t, dev)
Chuck Lever38a638a2019-06-19 10:33:58 -0400855 __field(unsigned long, error)
Trond Myklebust70ded202013-08-21 12:08:45 -0400856 __field(u64, dir)
857 __dynamic_array(char, name, data->args.name.len + 1)
858 ),
859
860 TP_fast_assign(
Al Viro884be172016-04-28 23:56:31 -0400861 struct inode *dir = d_inode(data->dentry->d_parent);
Trond Myklebust70ded202013-08-21 12:08:45 -0400862 size_t len = data->args.name.len;
863 __entry->dev = dir->i_sb->s_dev;
864 __entry->dir = NFS_FILEID(dir);
Chuck Lever38a638a2019-06-19 10:33:58 -0400865 __entry->error = -error;
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -0300866 memcpy(__get_str(name),
Trond Myklebust70ded202013-08-21 12:08:45 -0400867 data->args.name.name, len);
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -0300868 __get_str(name)[len] = 0;
Trond Myklebust70ded202013-08-21 12:08:45 -0400869 ),
870
871 TP_printk(
Chuck Lever38a638a2019-06-19 10:33:58 -0400872 "error=%ld (%s) name=%02x:%02x:%llu/%s",
873 -__entry->error, nfs_show_status(__entry->error),
Trond Myklebust70ded202013-08-21 12:08:45 -0400874 MAJOR(__entry->dev), MINOR(__entry->dev),
875 (unsigned long long)__entry->dir,
876 __get_str(name)
877 )
878);
Chuck Lever8224b272017-08-21 15:00:49 -0400879
880TRACE_EVENT(nfs_initiate_read,
881 TP_PROTO(
Trond Myklebust23431722020-01-06 15:25:08 -0500882 const struct nfs_pgio_header *hdr
Chuck Lever8224b272017-08-21 15:00:49 -0400883 ),
884
Trond Myklebust23431722020-01-06 15:25:08 -0500885 TP_ARGS(hdr),
Chuck Lever8224b272017-08-21 15:00:49 -0400886
887 TP_STRUCT__entry(
Chuck Lever8224b272017-08-21 15:00:49 -0400888 __field(dev_t, dev)
889 __field(u32, fhandle)
890 __field(u64, fileid)
Trond Myklebust23431722020-01-06 15:25:08 -0500891 __field(loff_t, offset)
892 __field(u32, count)
Chuck Lever8224b272017-08-21 15:00:49 -0400893 ),
894
895 TP_fast_assign(
Trond Myklebust23431722020-01-06 15:25:08 -0500896 const struct inode *inode = hdr->inode;
Chuck Lever8224b272017-08-21 15:00:49 -0400897 const struct nfs_inode *nfsi = NFS_I(inode);
Trond Myklebust23431722020-01-06 15:25:08 -0500898 const struct nfs_fh *fh = hdr->args.fh ?
899 hdr->args.fh : &nfsi->fh;
Chuck Lever8224b272017-08-21 15:00:49 -0400900
Trond Myklebust23431722020-01-06 15:25:08 -0500901 __entry->offset = hdr->args.offset;
902 __entry->count = hdr->args.count;
Chuck Lever8224b272017-08-21 15:00:49 -0400903 __entry->dev = inode->i_sb->s_dev;
904 __entry->fileid = nfsi->fileid;
Trond Myklebust23431722020-01-06 15:25:08 -0500905 __entry->fhandle = nfs_fhandle_hash(fh);
Chuck Lever8224b272017-08-21 15:00:49 -0400906 ),
907
908 TP_printk(
909 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust23431722020-01-06 15:25:08 -0500910 "offset=%lld count=%u",
Chuck Lever8224b272017-08-21 15:00:49 -0400911 MAJOR(__entry->dev), MINOR(__entry->dev),
912 (unsigned long long)__entry->fileid,
913 __entry->fhandle,
Trond Myklebust23431722020-01-06 15:25:08 -0500914 (long long)__entry->offset, __entry->count
Chuck Lever8224b272017-08-21 15:00:49 -0400915 )
916);
917
918TRACE_EVENT(nfs_readpage_done,
919 TP_PROTO(
Trond Myklebust23431722020-01-06 15:25:08 -0500920 const struct rpc_task *task,
921 const struct nfs_pgio_header *hdr
Chuck Lever8224b272017-08-21 15:00:49 -0400922 ),
923
Trond Myklebust23431722020-01-06 15:25:08 -0500924 TP_ARGS(task, hdr),
Chuck Lever8224b272017-08-21 15:00:49 -0400925
926 TP_STRUCT__entry(
Chuck Lever8224b272017-08-21 15:00:49 -0400927 __field(dev_t, dev)
928 __field(u32, fhandle)
929 __field(u64, fileid)
Trond Myklebust23431722020-01-06 15:25:08 -0500930 __field(loff_t, offset)
931 __field(u32, arg_count)
932 __field(u32, res_count)
933 __field(bool, eof)
934 __field(int, status)
Chuck Lever8224b272017-08-21 15:00:49 -0400935 ),
936
937 TP_fast_assign(
Trond Myklebust23431722020-01-06 15:25:08 -0500938 const struct inode *inode = hdr->inode;
Chuck Lever8224b272017-08-21 15:00:49 -0400939 const struct nfs_inode *nfsi = NFS_I(inode);
Trond Myklebust23431722020-01-06 15:25:08 -0500940 const struct nfs_fh *fh = hdr->args.fh ?
941 hdr->args.fh : &nfsi->fh;
Chuck Lever8224b272017-08-21 15:00:49 -0400942
Trond Myklebust23431722020-01-06 15:25:08 -0500943 __entry->status = task->tk_status;
944 __entry->offset = hdr->args.offset;
945 __entry->arg_count = hdr->args.count;
946 __entry->res_count = hdr->res.count;
947 __entry->eof = hdr->res.eof;
Chuck Lever8224b272017-08-21 15:00:49 -0400948 __entry->dev = inode->i_sb->s_dev;
949 __entry->fileid = nfsi->fileid;
Trond Myklebust23431722020-01-06 15:25:08 -0500950 __entry->fhandle = nfs_fhandle_hash(fh);
Chuck Lever8224b272017-08-21 15:00:49 -0400951 ),
952
953 TP_printk(
954 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust23431722020-01-06 15:25:08 -0500955 "offset=%lld count=%u res=%u status=%d%s",
Chuck Lever8224b272017-08-21 15:00:49 -0400956 MAJOR(__entry->dev), MINOR(__entry->dev),
957 (unsigned long long)__entry->fileid,
958 __entry->fhandle,
Trond Myklebust23431722020-01-06 15:25:08 -0500959 (long long)__entry->offset, __entry->arg_count,
960 __entry->res_count, __entry->status,
Chuck Lever8224b272017-08-21 15:00:49 -0400961 __entry->eof ? " eof" : ""
962 )
963);
964
Chuck Leverfd2b6122020-05-12 17:14:05 -0400965TRACE_EVENT(nfs_readpage_short,
966 TP_PROTO(
967 const struct rpc_task *task,
968 const struct nfs_pgio_header *hdr
969 ),
970
971 TP_ARGS(task, hdr),
972
973 TP_STRUCT__entry(
974 __field(dev_t, dev)
975 __field(u32, fhandle)
976 __field(u64, fileid)
977 __field(loff_t, offset)
978 __field(u32, arg_count)
979 __field(u32, res_count)
980 __field(bool, eof)
981 __field(int, status)
982 ),
983
984 TP_fast_assign(
985 const struct inode *inode = hdr->inode;
986 const struct nfs_inode *nfsi = NFS_I(inode);
987 const struct nfs_fh *fh = hdr->args.fh ?
988 hdr->args.fh : &nfsi->fh;
989
990 __entry->status = task->tk_status;
991 __entry->offset = hdr->args.offset;
992 __entry->arg_count = hdr->args.count;
993 __entry->res_count = hdr->res.count;
994 __entry->eof = hdr->res.eof;
995 __entry->dev = inode->i_sb->s_dev;
996 __entry->fileid = nfsi->fileid;
997 __entry->fhandle = nfs_fhandle_hash(fh);
998 ),
999
1000 TP_printk(
1001 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1002 "offset=%lld count=%u res=%u status=%d%s",
1003 MAJOR(__entry->dev), MINOR(__entry->dev),
1004 (unsigned long long)__entry->fileid,
1005 __entry->fhandle,
1006 (long long)__entry->offset, __entry->arg_count,
1007 __entry->res_count, __entry->status,
1008 __entry->eof ? " eof" : ""
1009 )
1010);
1011
Chuck Levercd2ed9b2020-05-12 17:14:11 -04001012TRACE_EVENT(nfs_pgio_error,
1013 TP_PROTO(
1014 const struct nfs_pgio_header *hdr,
1015 int error,
1016 loff_t pos
1017 ),
1018
1019 TP_ARGS(hdr, error, pos),
1020
1021 TP_STRUCT__entry(
1022 __field(dev_t, dev)
1023 __field(u32, fhandle)
1024 __field(u64, fileid)
1025 __field(loff_t, offset)
1026 __field(u32, arg_count)
1027 __field(u32, res_count)
1028 __field(loff_t, pos)
1029 __field(int, status)
1030 ),
1031
1032 TP_fast_assign(
1033 const struct inode *inode = hdr->inode;
1034 const struct nfs_inode *nfsi = NFS_I(inode);
1035 const struct nfs_fh *fh = hdr->args.fh ?
1036 hdr->args.fh : &nfsi->fh;
1037
1038 __entry->status = error;
1039 __entry->offset = hdr->args.offset;
1040 __entry->arg_count = hdr->args.count;
1041 __entry->res_count = hdr->res.count;
1042 __entry->dev = inode->i_sb->s_dev;
1043 __entry->fileid = nfsi->fileid;
1044 __entry->fhandle = nfs_fhandle_hash(fh);
1045 ),
1046
1047 TP_printk("fileid=%02x:%02x:%llu fhandle=0x%08x "
1048 "offset=%lld count=%u res=%u pos=%llu status=%d",
1049 MAJOR(__entry->dev), MINOR(__entry->dev),
1050 (unsigned long long)__entry->fileid, __entry->fhandle,
1051 (long long)__entry->offset, __entry->arg_count, __entry->res_count,
1052 __entry->pos, __entry->status
1053 )
1054);
1055
Chuck Lever06e19022018-01-18 14:55:01 -05001056TRACE_DEFINE_ENUM(NFS_UNSTABLE);
1057TRACE_DEFINE_ENUM(NFS_DATA_SYNC);
1058TRACE_DEFINE_ENUM(NFS_FILE_SYNC);
1059
Chuck Lever8224b272017-08-21 15:00:49 -04001060#define nfs_show_stable(stable) \
1061 __print_symbolic(stable, \
Chuck Lever06e19022018-01-18 14:55:01 -05001062 { NFS_UNSTABLE, "UNSTABLE" }, \
1063 { NFS_DATA_SYNC, "DATA_SYNC" }, \
1064 { NFS_FILE_SYNC, "FILE_SYNC" })
Chuck Lever8224b272017-08-21 15:00:49 -04001065
1066TRACE_EVENT(nfs_initiate_write,
1067 TP_PROTO(
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001068 const struct nfs_pgio_header *hdr
Chuck Lever8224b272017-08-21 15:00:49 -04001069 ),
1070
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001071 TP_ARGS(hdr),
Chuck Lever8224b272017-08-21 15:00:49 -04001072
1073 TP_STRUCT__entry(
Chuck Lever8224b272017-08-21 15:00:49 -04001074 __field(dev_t, dev)
1075 __field(u32, fhandle)
1076 __field(u64, fileid)
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001077 __field(loff_t, offset)
1078 __field(u32, count)
1079 __field(enum nfs3_stable_how, stable)
Chuck Lever8224b272017-08-21 15:00:49 -04001080 ),
1081
1082 TP_fast_assign(
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001083 const struct inode *inode = hdr->inode;
Chuck Lever8224b272017-08-21 15:00:49 -04001084 const struct nfs_inode *nfsi = NFS_I(inode);
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001085 const struct nfs_fh *fh = hdr->args.fh ?
1086 hdr->args.fh : &nfsi->fh;
Chuck Lever8224b272017-08-21 15:00:49 -04001087
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001088 __entry->offset = hdr->args.offset;
1089 __entry->count = hdr->args.count;
1090 __entry->stable = hdr->args.stable;
Chuck Lever8224b272017-08-21 15:00:49 -04001091 __entry->dev = inode->i_sb->s_dev;
1092 __entry->fileid = nfsi->fileid;
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001093 __entry->fhandle = nfs_fhandle_hash(fh);
Chuck Lever8224b272017-08-21 15:00:49 -04001094 ),
1095
1096 TP_printk(
1097 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001098 "offset=%lld count=%u stable=%s",
Chuck Lever8224b272017-08-21 15:00:49 -04001099 MAJOR(__entry->dev), MINOR(__entry->dev),
1100 (unsigned long long)__entry->fileid,
1101 __entry->fhandle,
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001102 (long long)__entry->offset, __entry->count,
Chuck Lever06e19022018-01-18 14:55:01 -05001103 nfs_show_stable(__entry->stable)
Chuck Lever8224b272017-08-21 15:00:49 -04001104 )
1105);
1106
1107TRACE_EVENT(nfs_writeback_done,
1108 TP_PROTO(
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001109 const struct rpc_task *task,
1110 const struct nfs_pgio_header *hdr
Chuck Lever8224b272017-08-21 15:00:49 -04001111 ),
1112
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001113 TP_ARGS(task, hdr),
Chuck Lever8224b272017-08-21 15:00:49 -04001114
1115 TP_STRUCT__entry(
Chuck Lever8224b272017-08-21 15:00:49 -04001116 __field(dev_t, dev)
1117 __field(u32, fhandle)
1118 __field(u64, fileid)
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001119 __field(loff_t, offset)
1120 __field(u32, arg_count)
1121 __field(u32, res_count)
1122 __field(int, status)
1123 __field(enum nfs3_stable_how, stable)
1124 __array(char, verifier, NFS4_VERIFIER_SIZE)
Chuck Lever8224b272017-08-21 15:00:49 -04001125 ),
1126
1127 TP_fast_assign(
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001128 const struct inode *inode = hdr->inode;
Chuck Lever8224b272017-08-21 15:00:49 -04001129 const struct nfs_inode *nfsi = NFS_I(inode);
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001130 const struct nfs_fh *fh = hdr->args.fh ?
1131 hdr->args.fh : &nfsi->fh;
1132 const struct nfs_writeverf *verf = hdr->res.verf;
Chuck Lever8224b272017-08-21 15:00:49 -04001133
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001134 __entry->status = task->tk_status;
1135 __entry->offset = hdr->args.offset;
1136 __entry->arg_count = hdr->args.count;
1137 __entry->res_count = hdr->res.count;
1138 __entry->stable = verf->committed;
1139 memcpy(__entry->verifier,
1140 &verf->verifier,
1141 NFS4_VERIFIER_SIZE);
Chuck Lever8224b272017-08-21 15:00:49 -04001142 __entry->dev = inode->i_sb->s_dev;
1143 __entry->fileid = nfsi->fileid;
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001144 __entry->fhandle = nfs_fhandle_hash(fh);
Chuck Lever8224b272017-08-21 15:00:49 -04001145 ),
1146
1147 TP_printk(
1148 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001149 "offset=%lld count=%u res=%u status=%d stable=%s "
1150 "verifier=%s",
Chuck Lever8224b272017-08-21 15:00:49 -04001151 MAJOR(__entry->dev), MINOR(__entry->dev),
1152 (unsigned long long)__entry->fileid,
1153 __entry->fhandle,
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001154 (long long)__entry->offset, __entry->arg_count,
1155 __entry->res_count, __entry->status,
Chuck Lever06e19022018-01-18 14:55:01 -05001156 nfs_show_stable(__entry->stable),
Trond Myklebust5bb2a7c2020-01-06 15:25:09 -05001157 __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE)
Chuck Lever8224b272017-08-21 15:00:49 -04001158 )
1159);
1160
Chuck Lever861e1672019-12-23 10:28:33 -05001161DECLARE_EVENT_CLASS(nfs_page_error_class,
1162 TP_PROTO(
1163 const struct nfs_page *req,
1164 int error
1165 ),
1166
1167 TP_ARGS(req, error),
1168
1169 TP_STRUCT__entry(
1170 __field(const void *, req)
1171 __field(pgoff_t, index)
1172 __field(unsigned int, offset)
1173 __field(unsigned int, pgbase)
1174 __field(unsigned int, bytes)
1175 __field(int, error)
1176 ),
1177
1178 TP_fast_assign(
1179 __entry->req = req;
1180 __entry->index = req->wb_index;
1181 __entry->offset = req->wb_offset;
1182 __entry->pgbase = req->wb_pgbase;
1183 __entry->bytes = req->wb_bytes;
1184 __entry->error = error;
1185 ),
1186
1187 TP_printk(
1188 "req=%p index=%lu offset=%u pgbase=%u bytes=%u error=%d",
1189 __entry->req, __entry->index, __entry->offset,
1190 __entry->pgbase, __entry->bytes, __entry->error
1191 )
1192);
1193
1194#define DEFINE_NFS_PAGEERR_EVENT(name) \
1195 DEFINE_EVENT(nfs_page_error_class, name, \
1196 TP_PROTO( \
1197 const struct nfs_page *req, \
1198 int error \
1199 ), \
1200 TP_ARGS(req, error))
1201
1202DEFINE_NFS_PAGEERR_EVENT(nfs_write_error);
1203DEFINE_NFS_PAGEERR_EVENT(nfs_comp_error);
1204DEFINE_NFS_PAGEERR_EVENT(nfs_commit_error);
1205
Chuck Lever8224b272017-08-21 15:00:49 -04001206TRACE_EVENT(nfs_initiate_commit,
1207 TP_PROTO(
1208 const struct nfs_commit_data *data
1209 ),
1210
1211 TP_ARGS(data),
1212
1213 TP_STRUCT__entry(
Chuck Lever8224b272017-08-21 15:00:49 -04001214 __field(dev_t, dev)
1215 __field(u32, fhandle)
1216 __field(u64, fileid)
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001217 __field(loff_t, offset)
1218 __field(u32, count)
Chuck Lever8224b272017-08-21 15:00:49 -04001219 ),
1220
1221 TP_fast_assign(
1222 const struct inode *inode = data->inode;
1223 const struct nfs_inode *nfsi = NFS_I(inode);
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001224 const struct nfs_fh *fh = data->args.fh ?
1225 data->args.fh : &nfsi->fh;
Chuck Lever8224b272017-08-21 15:00:49 -04001226
1227 __entry->offset = data->args.offset;
1228 __entry->count = data->args.count;
1229 __entry->dev = inode->i_sb->s_dev;
1230 __entry->fileid = nfsi->fileid;
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001231 __entry->fhandle = nfs_fhandle_hash(fh);
Chuck Lever8224b272017-08-21 15:00:49 -04001232 ),
1233
1234 TP_printk(
1235 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001236 "offset=%lld count=%u",
Chuck Lever8224b272017-08-21 15:00:49 -04001237 MAJOR(__entry->dev), MINOR(__entry->dev),
1238 (unsigned long long)__entry->fileid,
1239 __entry->fhandle,
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001240 (long long)__entry->offset, __entry->count
Chuck Lever8224b272017-08-21 15:00:49 -04001241 )
1242);
1243
1244TRACE_EVENT(nfs_commit_done,
1245 TP_PROTO(
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001246 const struct rpc_task *task,
Chuck Lever8224b272017-08-21 15:00:49 -04001247 const struct nfs_commit_data *data
1248 ),
1249
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001250 TP_ARGS(task, data),
Chuck Lever8224b272017-08-21 15:00:49 -04001251
1252 TP_STRUCT__entry(
Chuck Lever8224b272017-08-21 15:00:49 -04001253 __field(dev_t, dev)
1254 __field(u32, fhandle)
1255 __field(u64, fileid)
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001256 __field(loff_t, offset)
1257 __field(int, status)
1258 __field(enum nfs3_stable_how, stable)
1259 __array(char, verifier, NFS4_VERIFIER_SIZE)
Chuck Lever8224b272017-08-21 15:00:49 -04001260 ),
1261
1262 TP_fast_assign(
1263 const struct inode *inode = data->inode;
1264 const struct nfs_inode *nfsi = NFS_I(inode);
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001265 const struct nfs_fh *fh = data->args.fh ?
1266 data->args.fh : &nfsi->fh;
1267 const struct nfs_writeverf *verf = data->res.verf;
Chuck Lever8224b272017-08-21 15:00:49 -04001268
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001269 __entry->status = task->tk_status;
Chuck Lever8224b272017-08-21 15:00:49 -04001270 __entry->offset = data->args.offset;
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001271 __entry->stable = verf->committed;
1272 memcpy(__entry->verifier,
1273 &verf->verifier,
1274 NFS4_VERIFIER_SIZE);
Chuck Lever8224b272017-08-21 15:00:49 -04001275 __entry->dev = inode->i_sb->s_dev;
1276 __entry->fileid = nfsi->fileid;
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001277 __entry->fhandle = nfs_fhandle_hash(fh);
Chuck Lever8224b272017-08-21 15:00:49 -04001278 ),
1279
1280 TP_printk(
1281 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001282 "offset=%lld status=%d stable=%s verifier=%s",
Chuck Lever8224b272017-08-21 15:00:49 -04001283 MAJOR(__entry->dev), MINOR(__entry->dev),
1284 (unsigned long long)__entry->fileid,
1285 __entry->fhandle,
Trond Myklebust7bdd2972020-01-06 15:25:10 -05001286 (long long)__entry->offset, __entry->status,
1287 nfs_show_stable(__entry->stable),
1288 __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE)
Chuck Lever8224b272017-08-21 15:00:49 -04001289 )
1290);
1291
Trond Myklebust43622ea2019-11-01 15:33:55 -04001292TRACE_EVENT(nfs_fh_to_dentry,
1293 TP_PROTO(
1294 const struct super_block *sb,
1295 const struct nfs_fh *fh,
1296 u64 fileid,
1297 int error
1298 ),
1299
1300 TP_ARGS(sb, fh, fileid, error),
1301
1302 TP_STRUCT__entry(
1303 __field(int, error)
1304 __field(dev_t, dev)
1305 __field(u32, fhandle)
1306 __field(u64, fileid)
1307 ),
1308
1309 TP_fast_assign(
1310 __entry->error = error;
1311 __entry->dev = sb->s_dev;
1312 __entry->fileid = fileid;
1313 __entry->fhandle = nfs_fhandle_hash(fh);
1314 ),
1315
1316 TP_printk(
1317 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x ",
1318 __entry->error,
1319 MAJOR(__entry->dev), MINOR(__entry->dev),
1320 (unsigned long long)__entry->fileid,
1321 __entry->fhandle
1322 )
1323);
1324
Chuck Leverf23f6582019-02-11 11:24:26 -05001325TRACE_DEFINE_ENUM(NFS_OK);
1326TRACE_DEFINE_ENUM(NFSERR_PERM);
1327TRACE_DEFINE_ENUM(NFSERR_NOENT);
1328TRACE_DEFINE_ENUM(NFSERR_IO);
1329TRACE_DEFINE_ENUM(NFSERR_NXIO);
Chuck Lever38a638a2019-06-19 10:33:58 -04001330TRACE_DEFINE_ENUM(ECHILD);
1331TRACE_DEFINE_ENUM(NFSERR_EAGAIN);
Chuck Leverf23f6582019-02-11 11:24:26 -05001332TRACE_DEFINE_ENUM(NFSERR_ACCES);
1333TRACE_DEFINE_ENUM(NFSERR_EXIST);
1334TRACE_DEFINE_ENUM(NFSERR_XDEV);
1335TRACE_DEFINE_ENUM(NFSERR_NODEV);
1336TRACE_DEFINE_ENUM(NFSERR_NOTDIR);
1337TRACE_DEFINE_ENUM(NFSERR_ISDIR);
1338TRACE_DEFINE_ENUM(NFSERR_INVAL);
1339TRACE_DEFINE_ENUM(NFSERR_FBIG);
1340TRACE_DEFINE_ENUM(NFSERR_NOSPC);
1341TRACE_DEFINE_ENUM(NFSERR_ROFS);
1342TRACE_DEFINE_ENUM(NFSERR_MLINK);
Chuck Lever38a638a2019-06-19 10:33:58 -04001343TRACE_DEFINE_ENUM(NFSERR_OPNOTSUPP);
Chuck Leverf23f6582019-02-11 11:24:26 -05001344TRACE_DEFINE_ENUM(NFSERR_NAMETOOLONG);
1345TRACE_DEFINE_ENUM(NFSERR_NOTEMPTY);
1346TRACE_DEFINE_ENUM(NFSERR_DQUOT);
1347TRACE_DEFINE_ENUM(NFSERR_STALE);
1348TRACE_DEFINE_ENUM(NFSERR_REMOTE);
1349TRACE_DEFINE_ENUM(NFSERR_WFLUSH);
1350TRACE_DEFINE_ENUM(NFSERR_BADHANDLE);
1351TRACE_DEFINE_ENUM(NFSERR_NOT_SYNC);
1352TRACE_DEFINE_ENUM(NFSERR_BAD_COOKIE);
1353TRACE_DEFINE_ENUM(NFSERR_NOTSUPP);
1354TRACE_DEFINE_ENUM(NFSERR_TOOSMALL);
1355TRACE_DEFINE_ENUM(NFSERR_SERVERFAULT);
1356TRACE_DEFINE_ENUM(NFSERR_BADTYPE);
1357TRACE_DEFINE_ENUM(NFSERR_JUKEBOX);
1358
1359#define nfs_show_status(x) \
1360 __print_symbolic(x, \
1361 { NFS_OK, "OK" }, \
1362 { NFSERR_PERM, "PERM" }, \
1363 { NFSERR_NOENT, "NOENT" }, \
1364 { NFSERR_IO, "IO" }, \
1365 { NFSERR_NXIO, "NXIO" }, \
Chuck Lever38a638a2019-06-19 10:33:58 -04001366 { ECHILD, "CHILD" }, \
1367 { NFSERR_EAGAIN, "AGAIN" }, \
Chuck Leverf23f6582019-02-11 11:24:26 -05001368 { NFSERR_ACCES, "ACCES" }, \
1369 { NFSERR_EXIST, "EXIST" }, \
1370 { NFSERR_XDEV, "XDEV" }, \
1371 { NFSERR_NODEV, "NODEV" }, \
1372 { NFSERR_NOTDIR, "NOTDIR" }, \
1373 { NFSERR_ISDIR, "ISDIR" }, \
1374 { NFSERR_INVAL, "INVAL" }, \
1375 { NFSERR_FBIG, "FBIG" }, \
1376 { NFSERR_NOSPC, "NOSPC" }, \
1377 { NFSERR_ROFS, "ROFS" }, \
1378 { NFSERR_MLINK, "MLINK" }, \
Chuck Lever38a638a2019-06-19 10:33:58 -04001379 { NFSERR_OPNOTSUPP, "OPNOTSUPP" }, \
Chuck Leverf23f6582019-02-11 11:24:26 -05001380 { NFSERR_NAMETOOLONG, "NAMETOOLONG" }, \
1381 { NFSERR_NOTEMPTY, "NOTEMPTY" }, \
1382 { NFSERR_DQUOT, "DQUOT" }, \
1383 { NFSERR_STALE, "STALE" }, \
1384 { NFSERR_REMOTE, "REMOTE" }, \
1385 { NFSERR_WFLUSH, "WFLUSH" }, \
1386 { NFSERR_BADHANDLE, "BADHANDLE" }, \
1387 { NFSERR_NOT_SYNC, "NOTSYNC" }, \
1388 { NFSERR_BAD_COOKIE, "BADCOOKIE" }, \
1389 { NFSERR_NOTSUPP, "NOTSUPP" }, \
1390 { NFSERR_TOOSMALL, "TOOSMALL" }, \
1391 { NFSERR_SERVERFAULT, "REMOTEIO" }, \
1392 { NFSERR_BADTYPE, "BADTYPE" }, \
1393 { NFSERR_JUKEBOX, "JUKEBOX" })
1394
1395TRACE_EVENT(nfs_xdr_status,
1396 TP_PROTO(
Chuck Lever62a92ba2019-06-19 10:34:09 -04001397 const struct xdr_stream *xdr,
Chuck Leverf23f6582019-02-11 11:24:26 -05001398 int error
1399 ),
1400
Chuck Lever62a92ba2019-06-19 10:34:09 -04001401 TP_ARGS(xdr, error),
Chuck Leverf23f6582019-02-11 11:24:26 -05001402
1403 TP_STRUCT__entry(
Chuck Lever62a92ba2019-06-19 10:34:09 -04001404 __field(unsigned int, task_id)
1405 __field(unsigned int, client_id)
1406 __field(u32, xid)
Chuck Lever5be59452020-05-12 17:14:00 -04001407 __field(int, version)
Chuck Lever38a638a2019-06-19 10:33:58 -04001408 __field(unsigned long, error)
Chuck Lever5be59452020-05-12 17:14:00 -04001409 __string(program,
1410 xdr->rqst->rq_task->tk_client->cl_program->name)
1411 __string(procedure,
1412 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
Chuck Leverf23f6582019-02-11 11:24:26 -05001413 ),
1414
1415 TP_fast_assign(
Chuck Lever62a92ba2019-06-19 10:34:09 -04001416 const struct rpc_rqst *rqstp = xdr->rqst;
1417 const struct rpc_task *task = rqstp->rq_task;
1418
1419 __entry->task_id = task->tk_pid;
1420 __entry->client_id = task->tk_client->cl_clid;
1421 __entry->xid = be32_to_cpu(rqstp->rq_xid);
Chuck Lever5be59452020-05-12 17:14:00 -04001422 __entry->version = task->tk_client->cl_vers;
Chuck Leverf23f6582019-02-11 11:24:26 -05001423 __entry->error = error;
Chuck Lever5be59452020-05-12 17:14:00 -04001424 __assign_str(program,
1425 task->tk_client->cl_program->name)
1426 __assign_str(procedure, task->tk_msg.rpc_proc->p_name)
Chuck Leverf23f6582019-02-11 11:24:26 -05001427 ),
1428
1429 TP_printk(
Chuck Lever5be59452020-05-12 17:14:00 -04001430 "task:%u@%d xid=0x%08x %sv%d %s error=%ld (%s)",
Chuck Lever62a92ba2019-06-19 10:34:09 -04001431 __entry->task_id, __entry->client_id, __entry->xid,
Chuck Lever5be59452020-05-12 17:14:00 -04001432 __get_str(program), __entry->version,
1433 __get_str(procedure), -__entry->error,
1434 nfs_show_status(__entry->error)
Chuck Leverf23f6582019-02-11 11:24:26 -05001435 )
1436);
1437
Trond Myklebustf4ce1292013-08-19 18:59:33 -04001438#endif /* _TRACE_NFS_H */
1439
1440#undef TRACE_INCLUDE_PATH
1441#define TRACE_INCLUDE_PATH .
1442#define TRACE_INCLUDE_FILE nfstrace
1443/* This part must be outside protection */
1444#include <trace/define_trace.h>