Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
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>
12#include <linux/iversion.h>
13
14#include <trace/misc/fs.h>
15#include <trace/misc/nfs.h>
16#include <trace/misc/sunrpc.h>
17
18#define nfs_show_cache_validity(v) \
19 __print_flags(v, "|", \
20 { NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
21 { NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
22 { NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
23 { NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
24 { NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
25 { NFS_INO_INVALID_LABEL, "INVALID_LABEL" }, \
26 { NFS_INO_INVALID_CHANGE, "INVALID_CHANGE" }, \
27 { NFS_INO_INVALID_CTIME, "INVALID_CTIME" }, \
28 { NFS_INO_INVALID_MTIME, "INVALID_MTIME" }, \
29 { NFS_INO_INVALID_SIZE, "INVALID_SIZE" }, \
30 { NFS_INO_INVALID_OTHER, "INVALID_OTHER" }, \
31 { NFS_INO_DATA_INVAL_DEFER, "DATA_INVAL_DEFER" }, \
32 { NFS_INO_INVALID_BLOCKS, "INVALID_BLOCKS" }, \
33 { NFS_INO_INVALID_XATTR, "INVALID_XATTR" }, \
34 { NFS_INO_INVALID_NLINK, "INVALID_NLINK" }, \
35 { NFS_INO_INVALID_MODE, "INVALID_MODE" })
36
37#define nfs_show_nfsi_flags(v) \
38 __print_flags(v, "|", \
39 { BIT(NFS_INO_STALE), "STALE" }, \
40 { BIT(NFS_INO_ACL_LRU_SET), "ACL_LRU_SET" }, \
41 { BIT(NFS_INO_INVALIDATING), "INVALIDATING" }, \
42 { BIT(NFS_INO_LAYOUTCOMMIT), "NEED_LAYOUTCOMMIT" }, \
43 { BIT(NFS_INO_LAYOUTCOMMITTING), "LAYOUTCOMMIT" }, \
44 { BIT(NFS_INO_LAYOUTSTATS), "LAYOUTSTATS" }, \
45 { BIT(NFS_INO_ODIRECT), "ODIRECT" })
46
47DECLARE_EVENT_CLASS(nfs_inode_event,
48 TP_PROTO(
49 const struct inode *inode
50 ),
51
52 TP_ARGS(inode),
53
54 TP_STRUCT__entry(
55 __field(dev_t, dev)
56 __field(u32, fhandle)
57 __field(u64, fileid)
58 __field(u64, version)
59 ),
60
61 TP_fast_assign(
62 const struct nfs_inode *nfsi = NFS_I(inode);
63 __entry->dev = inode->i_sb->s_dev;
64 __entry->fileid = nfsi->fileid;
65 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
66 __entry->version = inode_peek_iversion_raw(inode);
67 ),
68
69 TP_printk(
70 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
71 MAJOR(__entry->dev), MINOR(__entry->dev),
72 (unsigned long long)__entry->fileid,
73 __entry->fhandle,
74 (unsigned long long)__entry->version
75 )
76);
77
78DECLARE_EVENT_CLASS(nfs_inode_event_done,
79 TP_PROTO(
80 const struct inode *inode,
81 int error
82 ),
83
84 TP_ARGS(inode, error),
85
86 TP_STRUCT__entry(
87 __field(unsigned long, error)
88 __field(dev_t, dev)
89 __field(u32, fhandle)
90 __field(unsigned char, type)
91 __field(u64, fileid)
92 __field(u64, version)
93 __field(loff_t, size)
94 __field(unsigned long, nfsi_flags)
95 __field(unsigned long, cache_validity)
96 ),
97
98 TP_fast_assign(
99 const struct nfs_inode *nfsi = NFS_I(inode);
100 __entry->error = error < 0 ? -error : 0;
101 __entry->dev = inode->i_sb->s_dev;
102 __entry->fileid = nfsi->fileid;
103 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
104 __entry->type = nfs_umode_to_dtype(inode->i_mode);
105 __entry->version = inode_peek_iversion_raw(inode);
106 __entry->size = i_size_read(inode);
107 __entry->nfsi_flags = nfsi->flags;
108 __entry->cache_validity = nfsi->cache_validity;
109 ),
110
111 TP_printk(
112 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
113 "type=%u (%s) version=%llu size=%lld "
114 "cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s)",
115 -__entry->error, show_nfs_status(__entry->error),
116 MAJOR(__entry->dev), MINOR(__entry->dev),
117 (unsigned long long)__entry->fileid,
118 __entry->fhandle,
119 __entry->type,
120 show_fs_dirent_type(__entry->type),
121 (unsigned long long)__entry->version,
122 (long long)__entry->size,
123 __entry->cache_validity,
124 nfs_show_cache_validity(__entry->cache_validity),
125 __entry->nfsi_flags,
126 nfs_show_nfsi_flags(__entry->nfsi_flags)
127 )
128);
129
130#define DEFINE_NFS_INODE_EVENT(name) \
131 DEFINE_EVENT(nfs_inode_event, name, \
132 TP_PROTO( \
133 const struct inode *inode \
134 ), \
135 TP_ARGS(inode))
136#define DEFINE_NFS_INODE_EVENT_DONE(name) \
137 DEFINE_EVENT(nfs_inode_event_done, name, \
138 TP_PROTO( \
139 const struct inode *inode, \
140 int error \
141 ), \
142 TP_ARGS(inode, error))
143DEFINE_NFS_INODE_EVENT(nfs_set_inode_stale);
144DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter);
145DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit);
146DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter);
147DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit);
148DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter);
149DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit);
150DEFINE_NFS_INODE_EVENT(nfs_getattr_enter);
151DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit);
152DEFINE_NFS_INODE_EVENT(nfs_setattr_enter);
153DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit);
154DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter);
155DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit);
156DEFINE_NFS_INODE_EVENT(nfs_fsync_enter);
157DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
158DEFINE_NFS_INODE_EVENT(nfs_access_enter);
159DEFINE_NFS_INODE_EVENT_DONE(nfs_set_cache_invalid);
160DEFINE_NFS_INODE_EVENT(nfs_readdir_force_readdirplus);
161DEFINE_NFS_INODE_EVENT_DONE(nfs_readdir_cache_fill_done);
162DEFINE_NFS_INODE_EVENT_DONE(nfs_readdir_uncached_done);
163
164TRACE_EVENT(nfs_access_exit,
165 TP_PROTO(
166 const struct inode *inode,
167 unsigned int mask,
168 unsigned int permitted,
169 int error
170 ),
171
172 TP_ARGS(inode, mask, permitted, error),
173
174 TP_STRUCT__entry(
175 __field(unsigned long, error)
176 __field(dev_t, dev)
177 __field(u32, fhandle)
178 __field(unsigned char, type)
179 __field(u64, fileid)
180 __field(u64, version)
181 __field(loff_t, size)
182 __field(unsigned long, nfsi_flags)
183 __field(unsigned long, cache_validity)
184 __field(unsigned int, mask)
185 __field(unsigned int, permitted)
186 ),
187
188 TP_fast_assign(
189 const struct nfs_inode *nfsi = NFS_I(inode);
190 __entry->error = error < 0 ? -error : 0;
191 __entry->dev = inode->i_sb->s_dev;
192 __entry->fileid = nfsi->fileid;
193 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
194 __entry->type = nfs_umode_to_dtype(inode->i_mode);
195 __entry->version = inode_peek_iversion_raw(inode);
196 __entry->size = i_size_read(inode);
197 __entry->nfsi_flags = nfsi->flags;
198 __entry->cache_validity = nfsi->cache_validity;
199 __entry->mask = mask;
200 __entry->permitted = permitted;
201 ),
202
203 TP_printk(
204 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
205 "type=%u (%s) version=%llu size=%lld "
206 "cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s) "
207 "mask=0x%x permitted=0x%x",
208 -__entry->error, show_nfs_status(__entry->error),
209 MAJOR(__entry->dev), MINOR(__entry->dev),
210 (unsigned long long)__entry->fileid,
211 __entry->fhandle,
212 __entry->type,
213 show_fs_dirent_type(__entry->type),
214 (unsigned long long)__entry->version,
215 (long long)__entry->size,
216 __entry->cache_validity,
217 nfs_show_cache_validity(__entry->cache_validity),
218 __entry->nfsi_flags,
219 nfs_show_nfsi_flags(__entry->nfsi_flags),
220 __entry->mask, __entry->permitted
221 )
222);
223
224DECLARE_EVENT_CLASS(nfs_update_size_class,
225 TP_PROTO(
226 const struct inode *inode,
227 loff_t new_size
228 ),
229
230 TP_ARGS(inode, new_size),
231
232 TP_STRUCT__entry(
233 __field(dev_t, dev)
234 __field(u32, fhandle)
235 __field(u64, fileid)
236 __field(u64, version)
237 __field(loff_t, cur_size)
238 __field(loff_t, new_size)
239 ),
240
241 TP_fast_assign(
242 const struct nfs_inode *nfsi = NFS_I(inode);
243
244 __entry->dev = inode->i_sb->s_dev;
245 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
246 __entry->fileid = nfsi->fileid;
247 __entry->version = inode_peek_iversion_raw(inode);
248 __entry->cur_size = i_size_read(inode);
249 __entry->new_size = new_size;
250 ),
251
252 TP_printk(
253 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu cursize=%lld newsize=%lld",
254 MAJOR(__entry->dev), MINOR(__entry->dev),
255 (unsigned long long)__entry->fileid,
256 __entry->fhandle, __entry->version,
257 __entry->cur_size, __entry->new_size
258 )
259);
260
261#define DEFINE_NFS_UPDATE_SIZE_EVENT(name) \
262 DEFINE_EVENT(nfs_update_size_class, nfs_size_##name, \
263 TP_PROTO( \
264 const struct inode *inode, \
265 loff_t new_size \
266 ), \
267 TP_ARGS(inode, new_size))
268
269DEFINE_NFS_UPDATE_SIZE_EVENT(truncate);
270DEFINE_NFS_UPDATE_SIZE_EVENT(wcc);
271DEFINE_NFS_UPDATE_SIZE_EVENT(update);
272DEFINE_NFS_UPDATE_SIZE_EVENT(grow);
273
274DECLARE_EVENT_CLASS(nfs_inode_range_event,
275 TP_PROTO(
276 const struct inode *inode,
277 loff_t range_start,
278 loff_t range_end
279 ),
280
281 TP_ARGS(inode, range_start, range_end),
282
283 TP_STRUCT__entry(
284 __field(dev_t, dev)
285 __field(u32, fhandle)
286 __field(u64, fileid)
287 __field(u64, version)
288 __field(loff_t, range_start)
289 __field(loff_t, range_end)
290 ),
291
292 TP_fast_assign(
293 const struct nfs_inode *nfsi = NFS_I(inode);
294
295 __entry->dev = inode->i_sb->s_dev;
296 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
297 __entry->fileid = nfsi->fileid;
298 __entry->version = inode_peek_iversion_raw(inode);
299 __entry->range_start = range_start;
300 __entry->range_end = range_end;
301 ),
302
303 TP_printk(
304 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu "
305 "range=[%lld, %lld]",
306 MAJOR(__entry->dev), MINOR(__entry->dev),
307 (unsigned long long)__entry->fileid,
308 __entry->fhandle, __entry->version,
309 __entry->range_start, __entry->range_end
310 )
311);
312
313#define DEFINE_NFS_INODE_RANGE_EVENT(name) \
314 DEFINE_EVENT(nfs_inode_range_event, name, \
315 TP_PROTO( \
316 const struct inode *inode, \
317 loff_t range_start, \
318 loff_t range_end \
319 ), \
320 TP_ARGS(inode, range_start, range_end))
321
322DEFINE_NFS_INODE_RANGE_EVENT(nfs_readdir_invalidate_cache_range);
323
324DECLARE_EVENT_CLASS(nfs_readdir_event,
325 TP_PROTO(
326 const struct file *file,
327 const __be32 *verifier,
328 u64 cookie,
329 pgoff_t page_index,
330 unsigned int dtsize
331 ),
332
333 TP_ARGS(file, verifier, cookie, page_index, dtsize),
334
335 TP_STRUCT__entry(
336 __field(dev_t, dev)
337 __field(u32, fhandle)
338 __field(u64, fileid)
339 __field(u64, version)
340 __array(char, verifier, NFS4_VERIFIER_SIZE)
341 __field(u64, cookie)
342 __field(pgoff_t, index)
343 __field(unsigned int, dtsize)
344 ),
345
346 TP_fast_assign(
347 const struct inode *dir = file_inode(file);
348 const struct nfs_inode *nfsi = NFS_I(dir);
349
350 __entry->dev = dir->i_sb->s_dev;
351 __entry->fileid = nfsi->fileid;
352 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
353 __entry->version = inode_peek_iversion_raw(dir);
354 if (cookie != 0)
355 memcpy(__entry->verifier, verifier,
356 NFS4_VERIFIER_SIZE);
357 else
358 memset(__entry->verifier, 0,
359 NFS4_VERIFIER_SIZE);
360 __entry->cookie = cookie;
361 __entry->index = page_index;
362 __entry->dtsize = dtsize;
363 ),
364
365 TP_printk(
366 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu "
367 "cookie=%s:0x%llx cache_index=%lu dtsize=%u",
368 MAJOR(__entry->dev), MINOR(__entry->dev),
369 (unsigned long long)__entry->fileid, __entry->fhandle,
370 __entry->version, show_nfs4_verifier(__entry->verifier),
371 (unsigned long long)__entry->cookie, __entry->index,
372 __entry->dtsize
373 )
374);
375
376#define DEFINE_NFS_READDIR_EVENT(name) \
377 DEFINE_EVENT(nfs_readdir_event, name, \
378 TP_PROTO( \
379 const struct file *file, \
380 const __be32 *verifier, \
381 u64 cookie, \
382 pgoff_t page_index, \
383 unsigned int dtsize \
384 ), \
385 TP_ARGS(file, verifier, cookie, page_index, dtsize))
386
387DEFINE_NFS_READDIR_EVENT(nfs_readdir_cache_fill);
388DEFINE_NFS_READDIR_EVENT(nfs_readdir_uncached);
389
390DECLARE_EVENT_CLASS(nfs_lookup_event,
391 TP_PROTO(
392 const struct inode *dir,
393 const struct dentry *dentry,
394 unsigned int flags
395 ),
396
397 TP_ARGS(dir, dentry, flags),
398
399 TP_STRUCT__entry(
400 __field(unsigned long, flags)
401 __field(dev_t, dev)
402 __field(u64, dir)
403 __field(u64, fileid)
404 __string(name, dentry->d_name.name)
405 ),
406
407 TP_fast_assign(
408 __entry->dev = dir->i_sb->s_dev;
409 __entry->dir = NFS_FILEID(dir);
410 __entry->flags = flags;
411 __entry->fileid = d_is_negative(dentry) ? 0 : NFS_FILEID(d_inode(dentry));
412 __assign_str(name, dentry->d_name.name);
413 ),
414
415 TP_printk(
416 "flags=0x%lx (%s) name=%02x:%02x:%llu/%s fileid=%llu",
417 __entry->flags,
418 show_fs_lookup_flags(__entry->flags),
419 MAJOR(__entry->dev), MINOR(__entry->dev),
420 (unsigned long long)__entry->dir,
421 __get_str(name),
422 __entry->fileid
423 )
424);
425
426#define DEFINE_NFS_LOOKUP_EVENT(name) \
427 DEFINE_EVENT(nfs_lookup_event, name, \
428 TP_PROTO( \
429 const struct inode *dir, \
430 const struct dentry *dentry, \
431 unsigned int flags \
432 ), \
433 TP_ARGS(dir, dentry, flags))
434
435DECLARE_EVENT_CLASS(nfs_lookup_event_done,
436 TP_PROTO(
437 const struct inode *dir,
438 const struct dentry *dentry,
439 unsigned int flags,
440 int error
441 ),
442
443 TP_ARGS(dir, dentry, flags, error),
444
445 TP_STRUCT__entry(
446 __field(unsigned long, error)
447 __field(unsigned long, flags)
448 __field(dev_t, dev)
449 __field(u64, dir)
450 __field(u64, fileid)
451 __string(name, dentry->d_name.name)
452 ),
453
454 TP_fast_assign(
455 __entry->dev = dir->i_sb->s_dev;
456 __entry->dir = NFS_FILEID(dir);
457 __entry->error = error < 0 ? -error : 0;
458 __entry->flags = flags;
459 __entry->fileid = d_is_negative(dentry) ? 0 : NFS_FILEID(d_inode(dentry));
460 __assign_str(name, dentry->d_name.name);
461 ),
462
463 TP_printk(
464 "error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s fileid=%llu",
465 -__entry->error, show_nfs_status(__entry->error),
466 __entry->flags,
467 show_fs_lookup_flags(__entry->flags),
468 MAJOR(__entry->dev), MINOR(__entry->dev),
469 (unsigned long long)__entry->dir,
470 __get_str(name),
471 __entry->fileid
472 )
473);
474
475#define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \
476 DEFINE_EVENT(nfs_lookup_event_done, name, \
477 TP_PROTO( \
478 const struct inode *dir, \
479 const struct dentry *dentry, \
480 unsigned int flags, \
481 int error \
482 ), \
483 TP_ARGS(dir, dentry, flags, error))
484
485DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter);
486DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
487DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
488DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
489DEFINE_NFS_LOOKUP_EVENT(nfs_readdir_lookup);
490DEFINE_NFS_LOOKUP_EVENT(nfs_readdir_lookup_revalidate_failed);
491DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_readdir_lookup_revalidate);
492
493TRACE_EVENT(nfs_atomic_open_enter,
494 TP_PROTO(
495 const struct inode *dir,
496 const struct nfs_open_context *ctx,
497 unsigned int flags
498 ),
499
500 TP_ARGS(dir, ctx, flags),
501
502 TP_STRUCT__entry(
503 __field(unsigned long, flags)
504 __field(unsigned long, fmode)
505 __field(dev_t, dev)
506 __field(u64, dir)
507 __string(name, ctx->dentry->d_name.name)
508 ),
509
510 TP_fast_assign(
511 __entry->dev = dir->i_sb->s_dev;
512 __entry->dir = NFS_FILEID(dir);
513 __entry->flags = flags;
514 __entry->fmode = (__force unsigned long)ctx->mode;
515 __assign_str(name, ctx->dentry->d_name.name);
516 ),
517
518 TP_printk(
519 "flags=0x%lx (%s) fmode=%s name=%02x:%02x:%llu/%s",
520 __entry->flags,
521 show_fs_fcntl_open_flags(__entry->flags),
522 show_fs_fmode_flags(__entry->fmode),
523 MAJOR(__entry->dev), MINOR(__entry->dev),
524 (unsigned long long)__entry->dir,
525 __get_str(name)
526 )
527);
528
529TRACE_EVENT(nfs_atomic_open_exit,
530 TP_PROTO(
531 const struct inode *dir,
532 const struct nfs_open_context *ctx,
533 unsigned int flags,
534 int error
535 ),
536
537 TP_ARGS(dir, ctx, flags, error),
538
539 TP_STRUCT__entry(
540 __field(unsigned long, error)
541 __field(unsigned long, flags)
542 __field(unsigned long, fmode)
543 __field(dev_t, dev)
544 __field(u64, dir)
545 __string(name, ctx->dentry->d_name.name)
546 ),
547
548 TP_fast_assign(
549 __entry->error = -error;
550 __entry->dev = dir->i_sb->s_dev;
551 __entry->dir = NFS_FILEID(dir);
552 __entry->flags = flags;
553 __entry->fmode = (__force unsigned long)ctx->mode;
554 __assign_str(name, ctx->dentry->d_name.name);
555 ),
556
557 TP_printk(
558 "error=%ld (%s) flags=0x%lx (%s) fmode=%s "
559 "name=%02x:%02x:%llu/%s",
560 -__entry->error, show_nfs_status(__entry->error),
561 __entry->flags,
562 show_fs_fcntl_open_flags(__entry->flags),
563 show_fs_fmode_flags(__entry->fmode),
564 MAJOR(__entry->dev), MINOR(__entry->dev),
565 (unsigned long long)__entry->dir,
566 __get_str(name)
567 )
568);
569
570TRACE_EVENT(nfs_create_enter,
571 TP_PROTO(
572 const struct inode *dir,
573 const struct dentry *dentry,
574 unsigned int flags
575 ),
576
577 TP_ARGS(dir, dentry, flags),
578
579 TP_STRUCT__entry(
580 __field(unsigned long, flags)
581 __field(dev_t, dev)
582 __field(u64, dir)
583 __string(name, dentry->d_name.name)
584 ),
585
586 TP_fast_assign(
587 __entry->dev = dir->i_sb->s_dev;
588 __entry->dir = NFS_FILEID(dir);
589 __entry->flags = flags;
590 __assign_str(name, dentry->d_name.name);
591 ),
592
593 TP_printk(
594 "flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
595 __entry->flags,
596 show_fs_fcntl_open_flags(__entry->flags),
597 MAJOR(__entry->dev), MINOR(__entry->dev),
598 (unsigned long long)__entry->dir,
599 __get_str(name)
600 )
601);
602
603TRACE_EVENT(nfs_create_exit,
604 TP_PROTO(
605 const struct inode *dir,
606 const struct dentry *dentry,
607 unsigned int flags,
608 int error
609 ),
610
611 TP_ARGS(dir, dentry, flags, error),
612
613 TP_STRUCT__entry(
614 __field(unsigned long, error)
615 __field(unsigned long, flags)
616 __field(dev_t, dev)
617 __field(u64, dir)
618 __string(name, dentry->d_name.name)
619 ),
620
621 TP_fast_assign(
622 __entry->error = -error;
623 __entry->dev = dir->i_sb->s_dev;
624 __entry->dir = NFS_FILEID(dir);
625 __entry->flags = flags;
626 __assign_str(name, dentry->d_name.name);
627 ),
628
629 TP_printk(
630 "error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
631 -__entry->error, show_nfs_status(__entry->error),
632 __entry->flags,
633 show_fs_fcntl_open_flags(__entry->flags),
634 MAJOR(__entry->dev), MINOR(__entry->dev),
635 (unsigned long long)__entry->dir,
636 __get_str(name)
637 )
638);
639
640DECLARE_EVENT_CLASS(nfs_directory_event,
641 TP_PROTO(
642 const struct inode *dir,
643 const struct dentry *dentry
644 ),
645
646 TP_ARGS(dir, dentry),
647
648 TP_STRUCT__entry(
649 __field(dev_t, dev)
650 __field(u64, dir)
651 __string(name, dentry->d_name.name)
652 ),
653
654 TP_fast_assign(
655 __entry->dev = dir->i_sb->s_dev;
656 __entry->dir = NFS_FILEID(dir);
657 __assign_str(name, dentry->d_name.name);
658 ),
659
660 TP_printk(
661 "name=%02x:%02x:%llu/%s",
662 MAJOR(__entry->dev), MINOR(__entry->dev),
663 (unsigned long long)__entry->dir,
664 __get_str(name)
665 )
666);
667
668#define DEFINE_NFS_DIRECTORY_EVENT(name) \
669 DEFINE_EVENT(nfs_directory_event, name, \
670 TP_PROTO( \
671 const struct inode *dir, \
672 const struct dentry *dentry \
673 ), \
674 TP_ARGS(dir, dentry))
675
676DECLARE_EVENT_CLASS(nfs_directory_event_done,
677 TP_PROTO(
678 const struct inode *dir,
679 const struct dentry *dentry,
680 int error
681 ),
682
683 TP_ARGS(dir, dentry, error),
684
685 TP_STRUCT__entry(
686 __field(unsigned long, error)
687 __field(dev_t, dev)
688 __field(u64, dir)
689 __string(name, dentry->d_name.name)
690 ),
691
692 TP_fast_assign(
693 __entry->dev = dir->i_sb->s_dev;
694 __entry->dir = NFS_FILEID(dir);
695 __entry->error = error < 0 ? -error : 0;
696 __assign_str(name, dentry->d_name.name);
697 ),
698
699 TP_printk(
700 "error=%ld (%s) name=%02x:%02x:%llu/%s",
701 -__entry->error, show_nfs_status(__entry->error),
702 MAJOR(__entry->dev), MINOR(__entry->dev),
703 (unsigned long long)__entry->dir,
704 __get_str(name)
705 )
706);
707
708#define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \
709 DEFINE_EVENT(nfs_directory_event_done, name, \
710 TP_PROTO( \
711 const struct inode *dir, \
712 const struct dentry *dentry, \
713 int error \
714 ), \
715 TP_ARGS(dir, dentry, error))
716
717DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter);
718DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit);
719DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter);
720DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit);
721DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter);
722DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit);
723DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter);
724DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit);
725DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter);
726DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit);
727DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter);
728DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit);
729
730TRACE_EVENT(nfs_link_enter,
731 TP_PROTO(
732 const struct inode *inode,
733 const struct inode *dir,
734 const struct dentry *dentry
735 ),
736
737 TP_ARGS(inode, dir, dentry),
738
739 TP_STRUCT__entry(
740 __field(dev_t, dev)
741 __field(u64, fileid)
742 __field(u64, dir)
743 __string(name, dentry->d_name.name)
744 ),
745
746 TP_fast_assign(
747 __entry->dev = inode->i_sb->s_dev;
748 __entry->fileid = NFS_FILEID(inode);
749 __entry->dir = NFS_FILEID(dir);
750 __assign_str(name, dentry->d_name.name);
751 ),
752
753 TP_printk(
754 "fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
755 MAJOR(__entry->dev), MINOR(__entry->dev),
756 __entry->fileid,
757 MAJOR(__entry->dev), MINOR(__entry->dev),
758 (unsigned long long)__entry->dir,
759 __get_str(name)
760 )
761);
762
763TRACE_EVENT(nfs_link_exit,
764 TP_PROTO(
765 const struct inode *inode,
766 const struct inode *dir,
767 const struct dentry *dentry,
768 int error
769 ),
770
771 TP_ARGS(inode, dir, dentry, error),
772
773 TP_STRUCT__entry(
774 __field(unsigned long, error)
775 __field(dev_t, dev)
776 __field(u64, fileid)
777 __field(u64, dir)
778 __string(name, dentry->d_name.name)
779 ),
780
781 TP_fast_assign(
782 __entry->dev = inode->i_sb->s_dev;
783 __entry->fileid = NFS_FILEID(inode);
784 __entry->dir = NFS_FILEID(dir);
785 __entry->error = error < 0 ? -error : 0;
786 __assign_str(name, dentry->d_name.name);
787 ),
788
789 TP_printk(
790 "error=%ld (%s) fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
791 -__entry->error, show_nfs_status(__entry->error),
792 MAJOR(__entry->dev), MINOR(__entry->dev),
793 __entry->fileid,
794 MAJOR(__entry->dev), MINOR(__entry->dev),
795 (unsigned long long)__entry->dir,
796 __get_str(name)
797 )
798);
799
800DECLARE_EVENT_CLASS(nfs_rename_event,
801 TP_PROTO(
802 const struct inode *old_dir,
803 const struct dentry *old_dentry,
804 const struct inode *new_dir,
805 const struct dentry *new_dentry
806 ),
807
808 TP_ARGS(old_dir, old_dentry, new_dir, new_dentry),
809
810 TP_STRUCT__entry(
811 __field(dev_t, dev)
812 __field(u64, old_dir)
813 __field(u64, new_dir)
814 __string(old_name, old_dentry->d_name.name)
815 __string(new_name, new_dentry->d_name.name)
816 ),
817
818 TP_fast_assign(
819 __entry->dev = old_dir->i_sb->s_dev;
820 __entry->old_dir = NFS_FILEID(old_dir);
821 __entry->new_dir = NFS_FILEID(new_dir);
822 __assign_str(old_name, old_dentry->d_name.name);
823 __assign_str(new_name, new_dentry->d_name.name);
824 ),
825
826 TP_printk(
827 "old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s",
828 MAJOR(__entry->dev), MINOR(__entry->dev),
829 (unsigned long long)__entry->old_dir,
830 __get_str(old_name),
831 MAJOR(__entry->dev), MINOR(__entry->dev),
832 (unsigned long long)__entry->new_dir,
833 __get_str(new_name)
834 )
835);
836#define DEFINE_NFS_RENAME_EVENT(name) \
837 DEFINE_EVENT(nfs_rename_event, name, \
838 TP_PROTO( \
839 const struct inode *old_dir, \
840 const struct dentry *old_dentry, \
841 const struct inode *new_dir, \
842 const struct dentry *new_dentry \
843 ), \
844 TP_ARGS(old_dir, old_dentry, new_dir, new_dentry))
845
846DECLARE_EVENT_CLASS(nfs_rename_event_done,
847 TP_PROTO(
848 const struct inode *old_dir,
849 const struct dentry *old_dentry,
850 const struct inode *new_dir,
851 const struct dentry *new_dentry,
852 int error
853 ),
854
855 TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, error),
856
857 TP_STRUCT__entry(
858 __field(dev_t, dev)
859 __field(unsigned long, error)
860 __field(u64, old_dir)
861 __string(old_name, old_dentry->d_name.name)
862 __field(u64, new_dir)
863 __string(new_name, new_dentry->d_name.name)
864 ),
865
866 TP_fast_assign(
867 __entry->dev = old_dir->i_sb->s_dev;
868 __entry->error = -error;
869 __entry->old_dir = NFS_FILEID(old_dir);
870 __entry->new_dir = NFS_FILEID(new_dir);
871 __assign_str(old_name, old_dentry->d_name.name);
872 __assign_str(new_name, new_dentry->d_name.name);
873 ),
874
875 TP_printk(
876 "error=%ld (%s) old_name=%02x:%02x:%llu/%s "
877 "new_name=%02x:%02x:%llu/%s",
878 -__entry->error, show_nfs_status(__entry->error),
879 MAJOR(__entry->dev), MINOR(__entry->dev),
880 (unsigned long long)__entry->old_dir,
881 __get_str(old_name),
882 MAJOR(__entry->dev), MINOR(__entry->dev),
883 (unsigned long long)__entry->new_dir,
884 __get_str(new_name)
885 )
886);
887#define DEFINE_NFS_RENAME_EVENT_DONE(name) \
888 DEFINE_EVENT(nfs_rename_event_done, name, \
889 TP_PROTO( \
890 const struct inode *old_dir, \
891 const struct dentry *old_dentry, \
892 const struct inode *new_dir, \
893 const struct dentry *new_dentry, \
894 int error \
895 ), \
896 TP_ARGS(old_dir, old_dentry, new_dir, \
897 new_dentry, error))
898
899DEFINE_NFS_RENAME_EVENT(nfs_rename_enter);
900DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit);
901
902DEFINE_NFS_RENAME_EVENT_DONE(nfs_async_rename_done);
903
904TRACE_EVENT(nfs_sillyrename_unlink,
905 TP_PROTO(
906 const struct nfs_unlinkdata *data,
907 int error
908 ),
909
910 TP_ARGS(data, error),
911
912 TP_STRUCT__entry(
913 __field(dev_t, dev)
914 __field(unsigned long, error)
915 __field(u64, dir)
916 __dynamic_array(char, name, data->args.name.len + 1)
917 ),
918
919 TP_fast_assign(
920 struct inode *dir = d_inode(data->dentry->d_parent);
921 size_t len = data->args.name.len;
922 __entry->dev = dir->i_sb->s_dev;
923 __entry->dir = NFS_FILEID(dir);
924 __entry->error = -error;
925 memcpy(__get_str(name),
926 data->args.name.name, len);
927 __get_str(name)[len] = 0;
928 ),
929
930 TP_printk(
931 "error=%ld (%s) name=%02x:%02x:%llu/%s",
932 -__entry->error, show_nfs_status(__entry->error),
933 MAJOR(__entry->dev), MINOR(__entry->dev),
934 (unsigned long long)__entry->dir,
935 __get_str(name)
936 )
937);
938
939DECLARE_EVENT_CLASS(nfs_folio_event,
940 TP_PROTO(
941 const struct inode *inode,
942 struct folio *folio
943 ),
944
945 TP_ARGS(inode, folio),
946
947 TP_STRUCT__entry(
948 __field(dev_t, dev)
949 __field(u32, fhandle)
950 __field(u64, fileid)
951 __field(u64, version)
952 __field(loff_t, offset)
953 __field(u32, count)
954 ),
955
956 TP_fast_assign(
957 const struct nfs_inode *nfsi = NFS_I(inode);
958
959 __entry->dev = inode->i_sb->s_dev;
960 __entry->fileid = nfsi->fileid;
961 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
962 __entry->version = inode_peek_iversion_raw(inode);
963 __entry->offset = folio_file_pos(folio);
964 __entry->count = nfs_folio_length(folio);
965 ),
966
967 TP_printk(
968 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu "
969 "offset=%lld count=%u",
970 MAJOR(__entry->dev), MINOR(__entry->dev),
971 (unsigned long long)__entry->fileid,
972 __entry->fhandle, __entry->version,
973 __entry->offset, __entry->count
974 )
975);
976
977#define DEFINE_NFS_FOLIO_EVENT(name) \
978 DEFINE_EVENT(nfs_folio_event, name, \
979 TP_PROTO( \
980 const struct inode *inode, \
981 struct folio *folio \
982 ), \
983 TP_ARGS(inode, folio))
984
985DECLARE_EVENT_CLASS(nfs_folio_event_done,
986 TP_PROTO(
987 const struct inode *inode,
988 struct folio *folio,
989 int ret
990 ),
991
992 TP_ARGS(inode, folio, ret),
993
994 TP_STRUCT__entry(
995 __field(dev_t, dev)
996 __field(u32, fhandle)
997 __field(int, ret)
998 __field(u64, fileid)
999 __field(u64, version)
1000 __field(loff_t, offset)
1001 __field(u32, count)
1002 ),
1003
1004 TP_fast_assign(
1005 const struct nfs_inode *nfsi = NFS_I(inode);
1006
1007 __entry->dev = inode->i_sb->s_dev;
1008 __entry->fileid = nfsi->fileid;
1009 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1010 __entry->version = inode_peek_iversion_raw(inode);
1011 __entry->offset = folio_file_pos(folio);
1012 __entry->count = nfs_folio_length(folio);
1013 __entry->ret = ret;
1014 ),
1015
1016 TP_printk(
1017 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu "
1018 "offset=%lld count=%u ret=%d",
1019 MAJOR(__entry->dev), MINOR(__entry->dev),
1020 (unsigned long long)__entry->fileid,
1021 __entry->fhandle, __entry->version,
1022 __entry->offset, __entry->count, __entry->ret
1023 )
1024);
1025
1026#define DEFINE_NFS_FOLIO_EVENT_DONE(name) \
1027 DEFINE_EVENT(nfs_folio_event_done, name, \
1028 TP_PROTO( \
1029 const struct inode *inode, \
1030 struct folio *folio, \
1031 int ret \
1032 ), \
1033 TP_ARGS(inode, folio, ret))
1034
1035DEFINE_NFS_FOLIO_EVENT(nfs_aop_readpage);
1036DEFINE_NFS_FOLIO_EVENT_DONE(nfs_aop_readpage_done);
1037
1038DEFINE_NFS_FOLIO_EVENT(nfs_writeback_folio);
1039DEFINE_NFS_FOLIO_EVENT_DONE(nfs_writeback_folio_done);
1040
1041DEFINE_NFS_FOLIO_EVENT(nfs_invalidate_folio);
1042DEFINE_NFS_FOLIO_EVENT_DONE(nfs_launder_folio_done);
1043
1044TRACE_EVENT(nfs_aop_readahead,
1045 TP_PROTO(
1046 const struct inode *inode,
1047 loff_t pos,
1048 unsigned int nr_pages
1049 ),
1050
1051 TP_ARGS(inode, pos, nr_pages),
1052
1053 TP_STRUCT__entry(
1054 __field(dev_t, dev)
1055 __field(u32, fhandle)
1056 __field(u64, fileid)
1057 __field(u64, version)
1058 __field(loff_t, offset)
1059 __field(unsigned int, nr_pages)
1060 ),
1061
1062 TP_fast_assign(
1063 const struct nfs_inode *nfsi = NFS_I(inode);
1064
1065 __entry->dev = inode->i_sb->s_dev;
1066 __entry->fileid = nfsi->fileid;
1067 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1068 __entry->version = inode_peek_iversion_raw(inode);
1069 __entry->offset = pos;
1070 __entry->nr_pages = nr_pages;
1071 ),
1072
1073 TP_printk(
1074 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu offset=%lld nr_pages=%u",
1075 MAJOR(__entry->dev), MINOR(__entry->dev),
1076 (unsigned long long)__entry->fileid,
1077 __entry->fhandle, __entry->version,
1078 __entry->offset, __entry->nr_pages
1079 )
1080);
1081
1082TRACE_EVENT(nfs_aop_readahead_done,
1083 TP_PROTO(
1084 const struct inode *inode,
1085 unsigned int nr_pages,
1086 int ret
1087 ),
1088
1089 TP_ARGS(inode, nr_pages, ret),
1090
1091 TP_STRUCT__entry(
1092 __field(dev_t, dev)
1093 __field(u32, fhandle)
1094 __field(int, ret)
1095 __field(u64, fileid)
1096 __field(u64, version)
1097 __field(loff_t, offset)
1098 __field(unsigned int, nr_pages)
1099 ),
1100
1101 TP_fast_assign(
1102 const struct nfs_inode *nfsi = NFS_I(inode);
1103
1104 __entry->dev = inode->i_sb->s_dev;
1105 __entry->fileid = nfsi->fileid;
1106 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1107 __entry->version = inode_peek_iversion_raw(inode);
1108 __entry->nr_pages = nr_pages;
1109 __entry->ret = ret;
1110 ),
1111
1112 TP_printk(
1113 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu nr_pages=%u ret=%d",
1114 MAJOR(__entry->dev), MINOR(__entry->dev),
1115 (unsigned long long)__entry->fileid,
1116 __entry->fhandle, __entry->version,
1117 __entry->nr_pages, __entry->ret
1118 )
1119);
1120
1121TRACE_EVENT(nfs_initiate_read,
1122 TP_PROTO(
1123 const struct nfs_pgio_header *hdr
1124 ),
1125
1126 TP_ARGS(hdr),
1127
1128 TP_STRUCT__entry(
1129 __field(dev_t, dev)
1130 __field(u32, fhandle)
1131 __field(u64, fileid)
1132 __field(loff_t, offset)
1133 __field(u32, count)
1134 ),
1135
1136 TP_fast_assign(
1137 const struct inode *inode = hdr->inode;
1138 const struct nfs_inode *nfsi = NFS_I(inode);
1139 const struct nfs_fh *fh = hdr->args.fh ?
1140 hdr->args.fh : &nfsi->fh;
1141
1142 __entry->offset = hdr->args.offset;
1143 __entry->count = hdr->args.count;
1144 __entry->dev = inode->i_sb->s_dev;
1145 __entry->fileid = nfsi->fileid;
1146 __entry->fhandle = nfs_fhandle_hash(fh);
1147 ),
1148
1149 TP_printk(
1150 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1151 "offset=%lld count=%u",
1152 MAJOR(__entry->dev), MINOR(__entry->dev),
1153 (unsigned long long)__entry->fileid,
1154 __entry->fhandle,
1155 (long long)__entry->offset, __entry->count
1156 )
1157);
1158
1159TRACE_EVENT(nfs_readpage_done,
1160 TP_PROTO(
1161 const struct rpc_task *task,
1162 const struct nfs_pgio_header *hdr
1163 ),
1164
1165 TP_ARGS(task, hdr),
1166
1167 TP_STRUCT__entry(
1168 __field(dev_t, dev)
1169 __field(u32, fhandle)
1170 __field(u64, fileid)
1171 __field(loff_t, offset)
1172 __field(u32, arg_count)
1173 __field(u32, res_count)
1174 __field(bool, eof)
1175 __field(int, error)
1176 ),
1177
1178 TP_fast_assign(
1179 const struct inode *inode = hdr->inode;
1180 const struct nfs_inode *nfsi = NFS_I(inode);
1181 const struct nfs_fh *fh = hdr->args.fh ?
1182 hdr->args.fh : &nfsi->fh;
1183
1184 __entry->error = task->tk_status;
1185 __entry->offset = hdr->args.offset;
1186 __entry->arg_count = hdr->args.count;
1187 __entry->res_count = hdr->res.count;
1188 __entry->eof = hdr->res.eof;
1189 __entry->dev = inode->i_sb->s_dev;
1190 __entry->fileid = nfsi->fileid;
1191 __entry->fhandle = nfs_fhandle_hash(fh);
1192 ),
1193
1194 TP_printk(
1195 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
1196 "offset=%lld count=%u res=%u%s", __entry->error,
1197 MAJOR(__entry->dev), MINOR(__entry->dev),
1198 (unsigned long long)__entry->fileid,
1199 __entry->fhandle,
1200 (long long)__entry->offset, __entry->arg_count,
1201 __entry->res_count, __entry->eof ? " eof" : ""
1202 )
1203);
1204
1205TRACE_EVENT(nfs_readpage_short,
1206 TP_PROTO(
1207 const struct rpc_task *task,
1208 const struct nfs_pgio_header *hdr
1209 ),
1210
1211 TP_ARGS(task, hdr),
1212
1213 TP_STRUCT__entry(
1214 __field(dev_t, dev)
1215 __field(u32, fhandle)
1216 __field(u64, fileid)
1217 __field(loff_t, offset)
1218 __field(u32, arg_count)
1219 __field(u32, res_count)
1220 __field(bool, eof)
1221 __field(int, error)
1222 ),
1223
1224 TP_fast_assign(
1225 const struct inode *inode = hdr->inode;
1226 const struct nfs_inode *nfsi = NFS_I(inode);
1227 const struct nfs_fh *fh = hdr->args.fh ?
1228 hdr->args.fh : &nfsi->fh;
1229
1230 __entry->error = task->tk_status;
1231 __entry->offset = hdr->args.offset;
1232 __entry->arg_count = hdr->args.count;
1233 __entry->res_count = hdr->res.count;
1234 __entry->eof = hdr->res.eof;
1235 __entry->dev = inode->i_sb->s_dev;
1236 __entry->fileid = nfsi->fileid;
1237 __entry->fhandle = nfs_fhandle_hash(fh);
1238 ),
1239
1240 TP_printk(
1241 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
1242 "offset=%lld count=%u res=%u%s", __entry->error,
1243 MAJOR(__entry->dev), MINOR(__entry->dev),
1244 (unsigned long long)__entry->fileid,
1245 __entry->fhandle,
1246 (long long)__entry->offset, __entry->arg_count,
1247 __entry->res_count, __entry->eof ? " eof" : ""
1248 )
1249);
1250
1251
1252TRACE_EVENT(nfs_pgio_error,
1253 TP_PROTO(
1254 const struct nfs_pgio_header *hdr,
1255 int error,
1256 loff_t pos
1257 ),
1258
1259 TP_ARGS(hdr, error, pos),
1260
1261 TP_STRUCT__entry(
1262 __field(dev_t, dev)
1263 __field(u32, fhandle)
1264 __field(u64, fileid)
1265 __field(loff_t, offset)
1266 __field(u32, arg_count)
1267 __field(u32, res_count)
1268 __field(loff_t, pos)
1269 __field(int, error)
1270 ),
1271
1272 TP_fast_assign(
1273 const struct inode *inode = hdr->inode;
1274 const struct nfs_inode *nfsi = NFS_I(inode);
1275 const struct nfs_fh *fh = hdr->args.fh ?
1276 hdr->args.fh : &nfsi->fh;
1277
1278 __entry->error = error;
1279 __entry->offset = hdr->args.offset;
1280 __entry->arg_count = hdr->args.count;
1281 __entry->res_count = hdr->res.count;
1282 __entry->dev = inode->i_sb->s_dev;
1283 __entry->fileid = nfsi->fileid;
1284 __entry->fhandle = nfs_fhandle_hash(fh);
1285 ),
1286
1287 TP_printk("error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
1288 "offset=%lld count=%u res=%u pos=%llu", __entry->error,
1289 MAJOR(__entry->dev), MINOR(__entry->dev),
1290 (unsigned long long)__entry->fileid, __entry->fhandle,
1291 (long long)__entry->offset, __entry->arg_count, __entry->res_count,
1292 __entry->pos
1293 )
1294);
1295
1296TRACE_EVENT(nfs_initiate_write,
1297 TP_PROTO(
1298 const struct nfs_pgio_header *hdr
1299 ),
1300
1301 TP_ARGS(hdr),
1302
1303 TP_STRUCT__entry(
1304 __field(dev_t, dev)
1305 __field(u32, fhandle)
1306 __field(u64, fileid)
1307 __field(loff_t, offset)
1308 __field(u32, count)
1309 __field(unsigned long, stable)
1310 ),
1311
1312 TP_fast_assign(
1313 const struct inode *inode = hdr->inode;
1314 const struct nfs_inode *nfsi = NFS_I(inode);
1315 const struct nfs_fh *fh = hdr->args.fh ?
1316 hdr->args.fh : &nfsi->fh;
1317
1318 __entry->offset = hdr->args.offset;
1319 __entry->count = hdr->args.count;
1320 __entry->stable = hdr->args.stable;
1321 __entry->dev = inode->i_sb->s_dev;
1322 __entry->fileid = nfsi->fileid;
1323 __entry->fhandle = nfs_fhandle_hash(fh);
1324 ),
1325
1326 TP_printk(
1327 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1328 "offset=%lld count=%u stable=%s",
1329 MAJOR(__entry->dev), MINOR(__entry->dev),
1330 (unsigned long long)__entry->fileid,
1331 __entry->fhandle,
1332 (long long)__entry->offset, __entry->count,
1333 show_nfs_stable_how(__entry->stable)
1334 )
1335);
1336
1337TRACE_EVENT(nfs_writeback_done,
1338 TP_PROTO(
1339 const struct rpc_task *task,
1340 const struct nfs_pgio_header *hdr
1341 ),
1342
1343 TP_ARGS(task, hdr),
1344
1345 TP_STRUCT__entry(
1346 __field(dev_t, dev)
1347 __field(u32, fhandle)
1348 __field(u64, fileid)
1349 __field(loff_t, offset)
1350 __field(u32, arg_count)
1351 __field(u32, res_count)
1352 __field(int, error)
1353 __field(unsigned long, stable)
1354 __array(char, verifier, NFS4_VERIFIER_SIZE)
1355 ),
1356
1357 TP_fast_assign(
1358 const struct inode *inode = hdr->inode;
1359 const struct nfs_inode *nfsi = NFS_I(inode);
1360 const struct nfs_fh *fh = hdr->args.fh ?
1361 hdr->args.fh : &nfsi->fh;
1362 const struct nfs_writeverf *verf = hdr->res.verf;
1363
1364 __entry->error = task->tk_status;
1365 __entry->offset = hdr->args.offset;
1366 __entry->arg_count = hdr->args.count;
1367 __entry->res_count = hdr->res.count;
1368 __entry->stable = verf->committed;
1369 memcpy(__entry->verifier,
1370 &verf->verifier,
1371 NFS4_VERIFIER_SIZE);
1372 __entry->dev = inode->i_sb->s_dev;
1373 __entry->fileid = nfsi->fileid;
1374 __entry->fhandle = nfs_fhandle_hash(fh);
1375 ),
1376
1377 TP_printk(
1378 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
1379 "offset=%lld count=%u res=%u stable=%s "
1380 "verifier=%s", __entry->error,
1381 MAJOR(__entry->dev), MINOR(__entry->dev),
1382 (unsigned long long)__entry->fileid,
1383 __entry->fhandle,
1384 (long long)__entry->offset, __entry->arg_count,
1385 __entry->res_count,
1386 show_nfs_stable_how(__entry->stable),
1387 show_nfs4_verifier(__entry->verifier)
1388 )
1389);
1390
1391DECLARE_EVENT_CLASS(nfs_page_error_class,
1392 TP_PROTO(
1393 const struct inode *inode,
1394 const struct nfs_page *req,
1395 int error
1396 ),
1397
1398 TP_ARGS(inode, req, error),
1399
1400 TP_STRUCT__entry(
1401 __field(dev_t, dev)
1402 __field(u32, fhandle)
1403 __field(u64, fileid)
1404 __field(loff_t, offset)
1405 __field(unsigned int, count)
1406 __field(int, error)
1407 ),
1408
1409 TP_fast_assign(
1410 const struct nfs_inode *nfsi = NFS_I(inode);
1411 __entry->dev = inode->i_sb->s_dev;
1412 __entry->fileid = nfsi->fileid;
1413 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
1414 __entry->offset = req_offset(req);
1415 __entry->count = req->wb_bytes;
1416 __entry->error = error;
1417 ),
1418
1419 TP_printk(
1420 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
1421 "offset=%lld count=%u", __entry->error,
1422 MAJOR(__entry->dev), MINOR(__entry->dev),
1423 (unsigned long long)__entry->fileid,
1424 __entry->fhandle, __entry->offset,
1425 __entry->count
1426 )
1427);
1428
1429#define DEFINE_NFS_PAGEERR_EVENT(name) \
1430 DEFINE_EVENT(nfs_page_error_class, name, \
1431 TP_PROTO( \
1432 const struct inode *inode, \
1433 const struct nfs_page *req, \
1434 int error \
1435 ), \
1436 TP_ARGS(inode, req, error))
1437
1438DEFINE_NFS_PAGEERR_EVENT(nfs_write_error);
1439DEFINE_NFS_PAGEERR_EVENT(nfs_comp_error);
1440DEFINE_NFS_PAGEERR_EVENT(nfs_commit_error);
1441
1442TRACE_EVENT(nfs_initiate_commit,
1443 TP_PROTO(
1444 const struct nfs_commit_data *data
1445 ),
1446
1447 TP_ARGS(data),
1448
1449 TP_STRUCT__entry(
1450 __field(dev_t, dev)
1451 __field(u32, fhandle)
1452 __field(u64, fileid)
1453 __field(loff_t, offset)
1454 __field(u32, count)
1455 ),
1456
1457 TP_fast_assign(
1458 const struct inode *inode = data->inode;
1459 const struct nfs_inode *nfsi = NFS_I(inode);
1460 const struct nfs_fh *fh = data->args.fh ?
1461 data->args.fh : &nfsi->fh;
1462
1463 __entry->offset = data->args.offset;
1464 __entry->count = data->args.count;
1465 __entry->dev = inode->i_sb->s_dev;
1466 __entry->fileid = nfsi->fileid;
1467 __entry->fhandle = nfs_fhandle_hash(fh);
1468 ),
1469
1470 TP_printk(
1471 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1472 "offset=%lld count=%u",
1473 MAJOR(__entry->dev), MINOR(__entry->dev),
1474 (unsigned long long)__entry->fileid,
1475 __entry->fhandle,
1476 (long long)__entry->offset, __entry->count
1477 )
1478);
1479
1480TRACE_EVENT(nfs_commit_done,
1481 TP_PROTO(
1482 const struct rpc_task *task,
1483 const struct nfs_commit_data *data
1484 ),
1485
1486 TP_ARGS(task, data),
1487
1488 TP_STRUCT__entry(
1489 __field(dev_t, dev)
1490 __field(u32, fhandle)
1491 __field(u64, fileid)
1492 __field(loff_t, offset)
1493 __field(int, error)
1494 __field(unsigned long, stable)
1495 __array(char, verifier, NFS4_VERIFIER_SIZE)
1496 ),
1497
1498 TP_fast_assign(
1499 const struct inode *inode = data->inode;
1500 const struct nfs_inode *nfsi = NFS_I(inode);
1501 const struct nfs_fh *fh = data->args.fh ?
1502 data->args.fh : &nfsi->fh;
1503 const struct nfs_writeverf *verf = data->res.verf;
1504
1505 __entry->error = task->tk_status;
1506 __entry->offset = data->args.offset;
1507 __entry->stable = verf->committed;
1508 memcpy(__entry->verifier,
1509 &verf->verifier,
1510 NFS4_VERIFIER_SIZE);
1511 __entry->dev = inode->i_sb->s_dev;
1512 __entry->fileid = nfsi->fileid;
1513 __entry->fhandle = nfs_fhandle_hash(fh);
1514 ),
1515
1516 TP_printk(
1517 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
1518 "offset=%lld stable=%s verifier=%s", __entry->error,
1519 MAJOR(__entry->dev), MINOR(__entry->dev),
1520 (unsigned long long)__entry->fileid,
1521 __entry->fhandle,
1522 (long long)__entry->offset,
1523 show_nfs_stable_how(__entry->stable),
1524 show_nfs4_verifier(__entry->verifier)
1525 )
1526);
1527
1528#define nfs_show_direct_req_flags(v) \
1529 __print_flags(v, "|", \
1530 { NFS_ODIRECT_DO_COMMIT, "DO_COMMIT" }, \
1531 { NFS_ODIRECT_RESCHED_WRITES, "RESCHED_WRITES" }, \
1532 { NFS_ODIRECT_SHOULD_DIRTY, "SHOULD DIRTY" }, \
1533 { NFS_ODIRECT_DONE, "DONE" } )
1534
1535DECLARE_EVENT_CLASS(nfs_direct_req_class,
1536 TP_PROTO(
1537 const struct nfs_direct_req *dreq
1538 ),
1539
1540 TP_ARGS(dreq),
1541
1542 TP_STRUCT__entry(
1543 __field(dev_t, dev)
1544 __field(u64, fileid)
1545 __field(u32, fhandle)
1546 __field(loff_t, offset)
1547 __field(ssize_t, count)
1548 __field(ssize_t, error)
1549 __field(int, flags)
1550 ),
1551
1552 TP_fast_assign(
1553 const struct inode *inode = dreq->inode;
1554 const struct nfs_inode *nfsi = NFS_I(inode);
1555 const struct nfs_fh *fh = &nfsi->fh;
1556
1557 __entry->dev = inode->i_sb->s_dev;
1558 __entry->fileid = nfsi->fileid;
1559 __entry->fhandle = nfs_fhandle_hash(fh);
1560 __entry->offset = dreq->io_start;
1561 __entry->count = dreq->count;
1562 __entry->error = dreq->error;
1563 __entry->flags = dreq->flags;
1564 ),
1565
1566 TP_printk(
1567 "error=%zd fileid=%02x:%02x:%llu fhandle=0x%08x "
1568 "offset=%lld count=%zd flags=%s",
1569 __entry->error, MAJOR(__entry->dev),
1570 MINOR(__entry->dev),
1571 (unsigned long long)__entry->fileid,
1572 __entry->fhandle, __entry->offset,
1573 __entry->count,
1574 nfs_show_direct_req_flags(__entry->flags)
1575 )
1576);
1577
1578#define DEFINE_NFS_DIRECT_REQ_EVENT(name) \
1579 DEFINE_EVENT(nfs_direct_req_class, name, \
1580 TP_PROTO( \
1581 const struct nfs_direct_req *dreq \
1582 ), \
1583 TP_ARGS(dreq))
1584
1585DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_commit_complete);
1586DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_resched_write);
1587DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_complete);
1588DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_completion);
1589DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_schedule_iovec);
1590DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_reschedule_io);
1591
1592TRACE_EVENT(nfs_fh_to_dentry,
1593 TP_PROTO(
1594 const struct super_block *sb,
1595 const struct nfs_fh *fh,
1596 u64 fileid,
1597 int error
1598 ),
1599
1600 TP_ARGS(sb, fh, fileid, error),
1601
1602 TP_STRUCT__entry(
1603 __field(int, error)
1604 __field(dev_t, dev)
1605 __field(u32, fhandle)
1606 __field(u64, fileid)
1607 ),
1608
1609 TP_fast_assign(
1610 __entry->error = error;
1611 __entry->dev = sb->s_dev;
1612 __entry->fileid = fileid;
1613 __entry->fhandle = nfs_fhandle_hash(fh);
1614 ),
1615
1616 TP_printk(
1617 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x ",
1618 __entry->error,
1619 MAJOR(__entry->dev), MINOR(__entry->dev),
1620 (unsigned long long)__entry->fileid,
1621 __entry->fhandle
1622 )
1623);
1624
1625TRACE_EVENT(nfs_mount_assign,
1626 TP_PROTO(
1627 const char *option,
1628 const char *value
1629 ),
1630
1631 TP_ARGS(option, value),
1632
1633 TP_STRUCT__entry(
1634 __string(option, option)
1635 __string(value, value)
1636 ),
1637
1638 TP_fast_assign(
1639 __assign_str(option, option);
1640 __assign_str(value, value);
1641 ),
1642
1643 TP_printk("option %s=%s",
1644 __get_str(option), __get_str(value)
1645 )
1646);
1647
1648TRACE_EVENT(nfs_mount_option,
1649 TP_PROTO(
1650 const struct fs_parameter *param
1651 ),
1652
1653 TP_ARGS(param),
1654
1655 TP_STRUCT__entry(
1656 __string(option, param->key)
1657 ),
1658
1659 TP_fast_assign(
1660 __assign_str(option, param->key);
1661 ),
1662
1663 TP_printk("option %s", __get_str(option))
1664);
1665
1666TRACE_EVENT(nfs_mount_path,
1667 TP_PROTO(
1668 const char *path
1669 ),
1670
1671 TP_ARGS(path),
1672
1673 TP_STRUCT__entry(
1674 __string(path, path)
1675 ),
1676
1677 TP_fast_assign(
1678 __assign_str(path, path);
1679 ),
1680
1681 TP_printk("path='%s'", __get_str(path))
1682);
1683
1684DECLARE_EVENT_CLASS(nfs_xdr_event,
1685 TP_PROTO(
1686 const struct xdr_stream *xdr,
1687 int error
1688 ),
1689
1690 TP_ARGS(xdr, error),
1691
1692 TP_STRUCT__entry(
1693 __field(unsigned int, task_id)
1694 __field(unsigned int, client_id)
1695 __field(u32, xid)
1696 __field(int, version)
1697 __field(unsigned long, error)
1698 __string(program,
1699 xdr->rqst->rq_task->tk_client->cl_program->name)
1700 __string(procedure,
1701 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
1702 ),
1703
1704 TP_fast_assign(
1705 const struct rpc_rqst *rqstp = xdr->rqst;
1706 const struct rpc_task *task = rqstp->rq_task;
1707
1708 __entry->task_id = task->tk_pid;
1709 __entry->client_id = task->tk_client->cl_clid;
1710 __entry->xid = be32_to_cpu(rqstp->rq_xid);
1711 __entry->version = task->tk_client->cl_vers;
1712 __entry->error = error;
1713 __assign_str(program,
1714 task->tk_client->cl_program->name);
1715 __assign_str(procedure, task->tk_msg.rpc_proc->p_name);
1716 ),
1717
1718 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
1719 " xid=0x%08x %sv%d %s error=%ld (%s)",
1720 __entry->task_id, __entry->client_id, __entry->xid,
1721 __get_str(program), __entry->version,
1722 __get_str(procedure), -__entry->error,
1723 show_nfs_status(__entry->error)
1724 )
1725);
1726#define DEFINE_NFS_XDR_EVENT(name) \
1727 DEFINE_EVENT(nfs_xdr_event, name, \
1728 TP_PROTO( \
1729 const struct xdr_stream *xdr, \
1730 int error \
1731 ), \
1732 TP_ARGS(xdr, error))
1733DEFINE_NFS_XDR_EVENT(nfs_xdr_status);
1734DEFINE_NFS_XDR_EVENT(nfs_xdr_bad_filehandle);
1735
1736#endif /* _TRACE_NFS_H */
1737
1738#undef TRACE_INCLUDE_PATH
1739#define TRACE_INCLUDE_PATH .
1740#define TRACE_INCLUDE_FILE nfstrace
1741/* This part must be outside protection */
1742#include <trace/define_trace.h>
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
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>
12#include <linux/iversion.h>
13
14TRACE_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
24#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
36TRACE_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
49#define nfs_show_cache_validity(v) \
50 __print_flags(v, "|", \
51 { 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" }, \
57 { 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" }, \
62 { NFS_INO_INVALID_OTHER, "INVALID_OTHER" }, \
63 { NFS_INO_INVALID_XATTR, "INVALID_XATTR" })
64
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);
75
76#define nfs_show_nfsi_flags(v) \
77 __print_flags(v, "|", \
78 { 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" })
88
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);
108 __entry->version = inode_peek_iversion_raw(inode);
109 ),
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(
129 __field(unsigned long, error)
130 __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);
142 __entry->error = error < 0 ? -error : 0;
143 __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);
147 __entry->version = inode_peek_iversion_raw(inode);
148 __entry->size = i_size_read(inode);
149 __entry->nfsi_flags = nfsi->flags;
150 __entry->cache_validity = nfsi->cache_validity;
151 ),
152
153 TP_printk(
154 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
155 "type=%u (%s) version=%llu size=%lld "
156 "cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s)",
157 -__entry->error, nfs_show_status(__entry->error),
158 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))
185DEFINE_NFS_INODE_EVENT(nfs_set_inode_stale);
186DEFINE_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);
203
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);
263
264TRACE_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);
270TRACE_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
279#define show_lookup_flags(flags) \
280 __print_flags(flags, "|", \
281 { LOOKUP_FOLLOW, "FOLLOW" }, \
282 { LOOKUP_DIRECTORY, "DIRECTORY" }, \
283 { LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \
284 { LOOKUP_PARENT, "PARENT" }, \
285 { LOOKUP_REVAL, "REVAL" }, \
286 { LOOKUP_RCU, "RCU" }, \
287 { LOOKUP_OPEN, "OPEN" }, \
288 { LOOKUP_CREATE, "CREATE" }, \
289 { 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" })
295
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(
306 __field(unsigned long, flags)
307 __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(
320 "flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
321 __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(
349 __field(unsigned long, error)
350 __field(unsigned long, flags)
351 __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);
359 __entry->error = error < 0 ? -error : 0;
360 __entry->flags = flags;
361 __assign_str(name, dentry->d_name.name);
362 ),
363
364 TP_printk(
365 "error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
366 -__entry->error, nfs_show_status(__entry->error),
367 __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
390TRACE_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
406#define show_open_flags(flags) \
407 __print_flags(flags, "|", \
408 { O_WRONLY, "O_WRONLY" }, \
409 { O_RDWR, "O_RDWR" }, \
410 { O_CREAT, "O_CREAT" }, \
411 { O_EXCL, "O_EXCL" }, \
412 { O_NOCTTY, "O_NOCTTY" }, \
413 { O_TRUNC, "O_TRUNC" }, \
414 { O_APPEND, "O_APPEND" }, \
415 { O_NONBLOCK, "O_NONBLOCK" }, \
416 { O_DSYNC, "O_DSYNC" }, \
417 { O_DIRECT, "O_DIRECT" }, \
418 { 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);
427
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(
444 __field(unsigned long, flags)
445 __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(
460 "flags=0x%lx (%s) fmode=%s name=%02x:%02x:%llu/%s",
461 __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(
481 __field(unsigned long, error)
482 __field(unsigned long, flags)
483 __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(
490 __entry->error = -error;
491 __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(
499 "error=%ld (%s) flags=0x%lx (%s) fmode=%s "
500 "name=%02x:%02x:%llu/%s",
501 -__entry->error, nfs_show_status(__entry->error),
502 __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
511TRACE_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(
521 __field(unsigned long, flags)
522 __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(
535 "flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
536 __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(
555 __field(unsigned long, error)
556 __field(unsigned long, flags)
557 __field(dev_t, dev)
558 __field(u64, dir)
559 __string(name, dentry->d_name.name)
560 ),
561
562 TP_fast_assign(
563 __entry->error = -error;
564 __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(
571 "error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s",
572 -__entry->error, nfs_show_status(__entry->error),
573 __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
581DECLARE_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(
627 __field(unsigned long, error)
628 __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);
636 __entry->error = error < 0 ? -error : 0;
637 __assign_str(name, dentry->d_name.name);
638 ),
639
640 TP_printk(
641 "error=%ld (%s) name=%02x:%02x:%llu/%s",
642 -__entry->error, nfs_show_status(__entry->error),
643 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
671TRACE_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(
715 __field(unsigned long, error)
716 __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);
726 __entry->error = error < 0 ? -error : 0;
727 __assign_str(name, dentry->d_name.name);
728 ),
729
730 TP_printk(
731 "error=%ld (%s) fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
732 -__entry->error, nfs_show_status(__entry->error),
733 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
741DECLARE_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)
800 __field(unsigned long, error)
801 __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;
809 __entry->error = -error;
810 __entry->old_dir = NFS_FILEID(old_dir);
811 __entry->new_dir = NFS_FILEID(new_dir);
812 __assign_str(old_name, old_dentry->d_name.name);
813 __assign_str(new_name, new_dentry->d_name.name);
814 ),
815
816 TP_printk(
817 "error=%ld (%s) old_name=%02x:%02x:%llu/%s "
818 "new_name=%02x:%02x:%llu/%s",
819 -__entry->error, nfs_show_status(__entry->error),
820 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)
855 __field(unsigned long, error)
856 __field(u64, dir)
857 __dynamic_array(char, name, data->args.name.len + 1)
858 ),
859
860 TP_fast_assign(
861 struct inode *dir = d_inode(data->dentry->d_parent);
862 size_t len = data->args.name.len;
863 __entry->dev = dir->i_sb->s_dev;
864 __entry->dir = NFS_FILEID(dir);
865 __entry->error = -error;
866 memcpy(__get_str(name),
867 data->args.name.name, len);
868 __get_str(name)[len] = 0;
869 ),
870
871 TP_printk(
872 "error=%ld (%s) name=%02x:%02x:%llu/%s",
873 -__entry->error, nfs_show_status(__entry->error),
874 MAJOR(__entry->dev), MINOR(__entry->dev),
875 (unsigned long long)__entry->dir,
876 __get_str(name)
877 )
878);
879
880TRACE_EVENT(nfs_initiate_read,
881 TP_PROTO(
882 const struct nfs_pgio_header *hdr
883 ),
884
885 TP_ARGS(hdr),
886
887 TP_STRUCT__entry(
888 __field(dev_t, dev)
889 __field(u32, fhandle)
890 __field(u64, fileid)
891 __field(loff_t, offset)
892 __field(u32, count)
893 ),
894
895 TP_fast_assign(
896 const struct inode *inode = hdr->inode;
897 const struct nfs_inode *nfsi = NFS_I(inode);
898 const struct nfs_fh *fh = hdr->args.fh ?
899 hdr->args.fh : &nfsi->fh;
900
901 __entry->offset = hdr->args.offset;
902 __entry->count = hdr->args.count;
903 __entry->dev = inode->i_sb->s_dev;
904 __entry->fileid = nfsi->fileid;
905 __entry->fhandle = nfs_fhandle_hash(fh);
906 ),
907
908 TP_printk(
909 "fileid=%02x:%02x:%llu fhandle=0x%08x "
910 "offset=%lld count=%u",
911 MAJOR(__entry->dev), MINOR(__entry->dev),
912 (unsigned long long)__entry->fileid,
913 __entry->fhandle,
914 (long long)__entry->offset, __entry->count
915 )
916);
917
918TRACE_EVENT(nfs_readpage_done,
919 TP_PROTO(
920 const struct rpc_task *task,
921 const struct nfs_pgio_header *hdr
922 ),
923
924 TP_ARGS(task, hdr),
925
926 TP_STRUCT__entry(
927 __field(dev_t, dev)
928 __field(u32, fhandle)
929 __field(u64, fileid)
930 __field(loff_t, offset)
931 __field(u32, arg_count)
932 __field(u32, res_count)
933 __field(bool, eof)
934 __field(int, status)
935 ),
936
937 TP_fast_assign(
938 const struct inode *inode = hdr->inode;
939 const struct nfs_inode *nfsi = NFS_I(inode);
940 const struct nfs_fh *fh = hdr->args.fh ?
941 hdr->args.fh : &nfsi->fh;
942
943 __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;
948 __entry->dev = inode->i_sb->s_dev;
949 __entry->fileid = nfsi->fileid;
950 __entry->fhandle = nfs_fhandle_hash(fh);
951 ),
952
953 TP_printk(
954 "fileid=%02x:%02x:%llu fhandle=0x%08x "
955 "offset=%lld count=%u res=%u status=%d%s",
956 MAJOR(__entry->dev), MINOR(__entry->dev),
957 (unsigned long long)__entry->fileid,
958 __entry->fhandle,
959 (long long)__entry->offset, __entry->arg_count,
960 __entry->res_count, __entry->status,
961 __entry->eof ? " eof" : ""
962 )
963);
964
965TRACE_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
1012TRACE_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
1056TRACE_DEFINE_ENUM(NFS_UNSTABLE);
1057TRACE_DEFINE_ENUM(NFS_DATA_SYNC);
1058TRACE_DEFINE_ENUM(NFS_FILE_SYNC);
1059
1060#define nfs_show_stable(stable) \
1061 __print_symbolic(stable, \
1062 { NFS_UNSTABLE, "UNSTABLE" }, \
1063 { NFS_DATA_SYNC, "DATA_SYNC" }, \
1064 { NFS_FILE_SYNC, "FILE_SYNC" })
1065
1066TRACE_EVENT(nfs_initiate_write,
1067 TP_PROTO(
1068 const struct nfs_pgio_header *hdr
1069 ),
1070
1071 TP_ARGS(hdr),
1072
1073 TP_STRUCT__entry(
1074 __field(dev_t, dev)
1075 __field(u32, fhandle)
1076 __field(u64, fileid)
1077 __field(loff_t, offset)
1078 __field(u32, count)
1079 __field(enum nfs3_stable_how, stable)
1080 ),
1081
1082 TP_fast_assign(
1083 const struct inode *inode = hdr->inode;
1084 const struct nfs_inode *nfsi = NFS_I(inode);
1085 const struct nfs_fh *fh = hdr->args.fh ?
1086 hdr->args.fh : &nfsi->fh;
1087
1088 __entry->offset = hdr->args.offset;
1089 __entry->count = hdr->args.count;
1090 __entry->stable = hdr->args.stable;
1091 __entry->dev = inode->i_sb->s_dev;
1092 __entry->fileid = nfsi->fileid;
1093 __entry->fhandle = nfs_fhandle_hash(fh);
1094 ),
1095
1096 TP_printk(
1097 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1098 "offset=%lld count=%u stable=%s",
1099 MAJOR(__entry->dev), MINOR(__entry->dev),
1100 (unsigned long long)__entry->fileid,
1101 __entry->fhandle,
1102 (long long)__entry->offset, __entry->count,
1103 nfs_show_stable(__entry->stable)
1104 )
1105);
1106
1107TRACE_EVENT(nfs_writeback_done,
1108 TP_PROTO(
1109 const struct rpc_task *task,
1110 const struct nfs_pgio_header *hdr
1111 ),
1112
1113 TP_ARGS(task, hdr),
1114
1115 TP_STRUCT__entry(
1116 __field(dev_t, dev)
1117 __field(u32, fhandle)
1118 __field(u64, fileid)
1119 __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)
1125 ),
1126
1127 TP_fast_assign(
1128 const struct inode *inode = hdr->inode;
1129 const struct nfs_inode *nfsi = NFS_I(inode);
1130 const struct nfs_fh *fh = hdr->args.fh ?
1131 hdr->args.fh : &nfsi->fh;
1132 const struct nfs_writeverf *verf = hdr->res.verf;
1133
1134 __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);
1142 __entry->dev = inode->i_sb->s_dev;
1143 __entry->fileid = nfsi->fileid;
1144 __entry->fhandle = nfs_fhandle_hash(fh);
1145 ),
1146
1147 TP_printk(
1148 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1149 "offset=%lld count=%u res=%u status=%d stable=%s "
1150 "verifier=%s",
1151 MAJOR(__entry->dev), MINOR(__entry->dev),
1152 (unsigned long long)__entry->fileid,
1153 __entry->fhandle,
1154 (long long)__entry->offset, __entry->arg_count,
1155 __entry->res_count, __entry->status,
1156 nfs_show_stable(__entry->stable),
1157 __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE)
1158 )
1159);
1160
1161DECLARE_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
1206TRACE_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(
1214 __field(dev_t, dev)
1215 __field(u32, fhandle)
1216 __field(u64, fileid)
1217 __field(loff_t, offset)
1218 __field(u32, count)
1219 ),
1220
1221 TP_fast_assign(
1222 const struct inode *inode = data->inode;
1223 const struct nfs_inode *nfsi = NFS_I(inode);
1224 const struct nfs_fh *fh = data->args.fh ?
1225 data->args.fh : &nfsi->fh;
1226
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;
1231 __entry->fhandle = nfs_fhandle_hash(fh);
1232 ),
1233
1234 TP_printk(
1235 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1236 "offset=%lld count=%u",
1237 MAJOR(__entry->dev), MINOR(__entry->dev),
1238 (unsigned long long)__entry->fileid,
1239 __entry->fhandle,
1240 (long long)__entry->offset, __entry->count
1241 )
1242);
1243
1244TRACE_EVENT(nfs_commit_done,
1245 TP_PROTO(
1246 const struct rpc_task *task,
1247 const struct nfs_commit_data *data
1248 ),
1249
1250 TP_ARGS(task, data),
1251
1252 TP_STRUCT__entry(
1253 __field(dev_t, dev)
1254 __field(u32, fhandle)
1255 __field(u64, fileid)
1256 __field(loff_t, offset)
1257 __field(int, status)
1258 __field(enum nfs3_stable_how, stable)
1259 __array(char, verifier, NFS4_VERIFIER_SIZE)
1260 ),
1261
1262 TP_fast_assign(
1263 const struct inode *inode = data->inode;
1264 const struct nfs_inode *nfsi = NFS_I(inode);
1265 const struct nfs_fh *fh = data->args.fh ?
1266 data->args.fh : &nfsi->fh;
1267 const struct nfs_writeverf *verf = data->res.verf;
1268
1269 __entry->status = task->tk_status;
1270 __entry->offset = data->args.offset;
1271 __entry->stable = verf->committed;
1272 memcpy(__entry->verifier,
1273 &verf->verifier,
1274 NFS4_VERIFIER_SIZE);
1275 __entry->dev = inode->i_sb->s_dev;
1276 __entry->fileid = nfsi->fileid;
1277 __entry->fhandle = nfs_fhandle_hash(fh);
1278 ),
1279
1280 TP_printk(
1281 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1282 "offset=%lld status=%d stable=%s verifier=%s",
1283 MAJOR(__entry->dev), MINOR(__entry->dev),
1284 (unsigned long long)__entry->fileid,
1285 __entry->fhandle,
1286 (long long)__entry->offset, __entry->status,
1287 nfs_show_stable(__entry->stable),
1288 __print_hex_str(__entry->verifier, NFS4_VERIFIER_SIZE)
1289 )
1290);
1291
1292TRACE_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
1325TRACE_DEFINE_ENUM(NFS_OK);
1326TRACE_DEFINE_ENUM(NFSERR_PERM);
1327TRACE_DEFINE_ENUM(NFSERR_NOENT);
1328TRACE_DEFINE_ENUM(NFSERR_IO);
1329TRACE_DEFINE_ENUM(NFSERR_NXIO);
1330TRACE_DEFINE_ENUM(ECHILD);
1331TRACE_DEFINE_ENUM(NFSERR_EAGAIN);
1332TRACE_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);
1343TRACE_DEFINE_ENUM(NFSERR_OPNOTSUPP);
1344TRACE_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" }, \
1366 { ECHILD, "CHILD" }, \
1367 { NFSERR_EAGAIN, "AGAIN" }, \
1368 { 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" }, \
1379 { NFSERR_OPNOTSUPP, "OPNOTSUPP" }, \
1380 { 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(
1397 const struct xdr_stream *xdr,
1398 int error
1399 ),
1400
1401 TP_ARGS(xdr, error),
1402
1403 TP_STRUCT__entry(
1404 __field(unsigned int, task_id)
1405 __field(unsigned int, client_id)
1406 __field(u32, xid)
1407 __field(int, version)
1408 __field(unsigned long, error)
1409 __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)
1413 ),
1414
1415 TP_fast_assign(
1416 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);
1422 __entry->version = task->tk_client->cl_vers;
1423 __entry->error = error;
1424 __assign_str(program,
1425 task->tk_client->cl_program->name)
1426 __assign_str(procedure, task->tk_msg.rpc_proc->p_name)
1427 ),
1428
1429 TP_printk(
1430 "task:%u@%d xid=0x%08x %sv%d %s error=%ld (%s)",
1431 __entry->task_id, __entry->client_id, __entry->xid,
1432 __get_str(program), __entry->version,
1433 __get_str(procedure), -__entry->error,
1434 nfs_show_status(__entry->error)
1435 )
1436);
1437
1438#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>