Merge tag 'regmap-v3.14-rc4' into regmap-linus
[firefly-linux-kernel-4.4.55.git] / fs / nfs / nfstrace.h
1 /*
2  * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
3  */
4 #undef TRACE_SYSTEM
5 #define TRACE_SYSTEM nfs
6
7 #if !defined(_TRACE_NFS_H) || defined(TRACE_HEADER_MULTI_READ)
8 #define _TRACE_NFS_H
9
10 #include <linux/tracepoint.h>
11
12 #define nfs_show_file_type(ftype) \
13         __print_symbolic(ftype, \
14                         { DT_UNKNOWN, "UNKNOWN" }, \
15                         { DT_FIFO, "FIFO" }, \
16                         { DT_CHR, "CHR" }, \
17                         { DT_DIR, "DIR" }, \
18                         { DT_BLK, "BLK" }, \
19                         { DT_REG, "REG" }, \
20                         { DT_LNK, "LNK" }, \
21                         { DT_SOCK, "SOCK" }, \
22                         { DT_WHT, "WHT" })
23
24 #define nfs_show_cache_validity(v) \
25         __print_flags(v, "|", \
26                         { NFS_INO_INVALID_ATTR, "INVALID_ATTR" }, \
27                         { NFS_INO_INVALID_DATA, "INVALID_DATA" }, \
28                         { NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \
29                         { NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \
30                         { NFS_INO_INVALID_ACL, "INVALID_ACL" }, \
31                         { NFS_INO_REVAL_PAGECACHE, "REVAL_PAGECACHE" }, \
32                         { NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \
33                         { NFS_INO_INVALID_LABEL, "INVALID_LABEL" })
34
35 #define nfs_show_nfsi_flags(v) \
36         __print_flags(v, "|", \
37                         { 1 << NFS_INO_ADVISE_RDPLUS, "ADVISE_RDPLUS" }, \
38                         { 1 << NFS_INO_STALE, "STALE" }, \
39                         { 1 << NFS_INO_INVALIDATING, "INVALIDATING" }, \
40                         { 1 << NFS_INO_FLUSHING, "FLUSHING" }, \
41                         { 1 << NFS_INO_FSCACHE, "FSCACHE" }, \
42                         { 1 << NFS_INO_COMMIT, "COMMIT" }, \
43                         { 1 << NFS_INO_LAYOUTCOMMIT, "NEED_LAYOUTCOMMIT" }, \
44                         { 1 << NFS_INO_LAYOUTCOMMITTING, "LAYOUTCOMMIT" })
45
46 DECLARE_EVENT_CLASS(nfs_inode_event,
47                 TP_PROTO(
48                         const struct inode *inode
49                 ),
50
51                 TP_ARGS(inode),
52
53                 TP_STRUCT__entry(
54                         __field(dev_t, dev)
55                         __field(u32, fhandle)
56                         __field(u64, fileid)
57                         __field(u64, version)
58                 ),
59
60                 TP_fast_assign(
61                         const struct nfs_inode *nfsi = NFS_I(inode);
62                         __entry->dev = inode->i_sb->s_dev;
63                         __entry->fileid = nfsi->fileid;
64                         __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
65                         __entry->version = inode->i_version;
66                 ),
67
68                 TP_printk(
69                         "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ",
70                         MAJOR(__entry->dev), MINOR(__entry->dev),
71                         (unsigned long long)__entry->fileid,
72                         __entry->fhandle,
73                         (unsigned long long)__entry->version
74                 )
75 );
76
77 DECLARE_EVENT_CLASS(nfs_inode_event_done,
78                 TP_PROTO(
79                         const struct inode *inode,
80                         int error
81                 ),
82
83                 TP_ARGS(inode, error),
84
85                 TP_STRUCT__entry(
86                         __field(int, error)
87                         __field(dev_t, dev)
88                         __field(u32, fhandle)
89                         __field(unsigned char, type)
90                         __field(u64, fileid)
91                         __field(u64, version)
92                         __field(loff_t, size)
93                         __field(unsigned long, nfsi_flags)
94                         __field(unsigned long, cache_validity)
95                 ),
96
97                 TP_fast_assign(
98                         const struct nfs_inode *nfsi = NFS_I(inode);
99                         __entry->error = error;
100                         __entry->dev = inode->i_sb->s_dev;
101                         __entry->fileid = nfsi->fileid;
102                         __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
103                         __entry->type = nfs_umode_to_dtype(inode->i_mode);
104                         __entry->version = inode->i_version;
105                         __entry->size = i_size_read(inode);
106                         __entry->nfsi_flags = nfsi->flags;
107                         __entry->cache_validity = nfsi->cache_validity;
108                 ),
109
110                 TP_printk(
111                         "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x "
112                         "type=%u (%s) version=%llu size=%lld "
113                         "cache_validity=%lu (%s) nfs_flags=%ld (%s)",
114                         __entry->error,
115                         MAJOR(__entry->dev), MINOR(__entry->dev),
116                         (unsigned long long)__entry->fileid,
117                         __entry->fhandle,
118                         __entry->type,
119                         nfs_show_file_type(__entry->type),
120                         (unsigned long long)__entry->version,
121                         (long long)__entry->size,
122                         __entry->cache_validity,
123                         nfs_show_cache_validity(__entry->cache_validity),
124                         __entry->nfsi_flags,
125                         nfs_show_nfsi_flags(__entry->nfsi_flags)
126                 )
127 );
128
129 #define DEFINE_NFS_INODE_EVENT(name) \
130         DEFINE_EVENT(nfs_inode_event, name, \
131                         TP_PROTO( \
132                                 const struct inode *inode \
133                         ), \
134                         TP_ARGS(inode))
135 #define DEFINE_NFS_INODE_EVENT_DONE(name) \
136         DEFINE_EVENT(nfs_inode_event_done, name, \
137                         TP_PROTO( \
138                                 const struct inode *inode, \
139                                 int error \
140                         ), \
141                         TP_ARGS(inode, error))
142 DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter);
143 DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit);
144 DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter);
145 DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit);
146 DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter);
147 DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit);
148 DEFINE_NFS_INODE_EVENT(nfs_getattr_enter);
149 DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit);
150 DEFINE_NFS_INODE_EVENT(nfs_setattr_enter);
151 DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit);
152 DEFINE_NFS_INODE_EVENT(nfs_writeback_page_enter);
153 DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_page_exit);
154 DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter);
155 DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit);
156 DEFINE_NFS_INODE_EVENT(nfs_fsync_enter);
157 DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit);
158 DEFINE_NFS_INODE_EVENT(nfs_access_enter);
159 DEFINE_NFS_INODE_EVENT_DONE(nfs_access_exit);
160
161 #define show_lookup_flags(flags) \
162         __print_flags((unsigned long)flags, "|", \
163                         { LOOKUP_AUTOMOUNT, "AUTOMOUNT" }, \
164                         { LOOKUP_DIRECTORY, "DIRECTORY" }, \
165                         { LOOKUP_OPEN, "OPEN" }, \
166                         { LOOKUP_CREATE, "CREATE" }, \
167                         { LOOKUP_EXCL, "EXCL" })
168
169 DECLARE_EVENT_CLASS(nfs_lookup_event,
170                 TP_PROTO(
171                         const struct inode *dir,
172                         const struct dentry *dentry,
173                         unsigned int flags
174                 ),
175
176                 TP_ARGS(dir, dentry, flags),
177
178                 TP_STRUCT__entry(
179                         __field(unsigned int, flags)
180                         __field(dev_t, dev)
181                         __field(u64, dir)
182                         __string(name, dentry->d_name.name)
183                 ),
184
185                 TP_fast_assign(
186                         __entry->dev = dir->i_sb->s_dev;
187                         __entry->dir = NFS_FILEID(dir);
188                         __entry->flags = flags;
189                         __assign_str(name, dentry->d_name.name);
190                 ),
191
192                 TP_printk(
193                         "flags=%u (%s) name=%02x:%02x:%llu/%s",
194                         __entry->flags,
195                         show_lookup_flags(__entry->flags),
196                         MAJOR(__entry->dev), MINOR(__entry->dev),
197                         (unsigned long long)__entry->dir,
198                         __get_str(name)
199                 )
200 );
201
202 #define DEFINE_NFS_LOOKUP_EVENT(name) \
203         DEFINE_EVENT(nfs_lookup_event, name, \
204                         TP_PROTO( \
205                                 const struct inode *dir, \
206                                 const struct dentry *dentry, \
207                                 unsigned int flags \
208                         ), \
209                         TP_ARGS(dir, dentry, flags))
210
211 DECLARE_EVENT_CLASS(nfs_lookup_event_done,
212                 TP_PROTO(
213                         const struct inode *dir,
214                         const struct dentry *dentry,
215                         unsigned int flags,
216                         int error
217                 ),
218
219                 TP_ARGS(dir, dentry, flags, error),
220
221                 TP_STRUCT__entry(
222                         __field(int, error)
223                         __field(unsigned int, flags)
224                         __field(dev_t, dev)
225                         __field(u64, dir)
226                         __string(name, dentry->d_name.name)
227                 ),
228
229                 TP_fast_assign(
230                         __entry->dev = dir->i_sb->s_dev;
231                         __entry->dir = NFS_FILEID(dir);
232                         __entry->error = error;
233                         __entry->flags = flags;
234                         __assign_str(name, dentry->d_name.name);
235                 ),
236
237                 TP_printk(
238                         "error=%d flags=%u (%s) name=%02x:%02x:%llu/%s",
239                         __entry->error,
240                         __entry->flags,
241                         show_lookup_flags(__entry->flags),
242                         MAJOR(__entry->dev), MINOR(__entry->dev),
243                         (unsigned long long)__entry->dir,
244                         __get_str(name)
245                 )
246 );
247
248 #define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \
249         DEFINE_EVENT(nfs_lookup_event_done, name, \
250                         TP_PROTO( \
251                                 const struct inode *dir, \
252                                 const struct dentry *dentry, \
253                                 unsigned int flags, \
254                                 int error \
255                         ), \
256                         TP_ARGS(dir, dentry, flags, error))
257
258 DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter);
259 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit);
260 DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter);
261 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit);
262
263 #define show_open_flags(flags) \
264         __print_flags((unsigned long)flags, "|", \
265                 { O_CREAT, "O_CREAT" }, \
266                 { O_EXCL, "O_EXCL" }, \
267                 { O_TRUNC, "O_TRUNC" }, \
268                 { O_APPEND, "O_APPEND" }, \
269                 { O_DSYNC, "O_DSYNC" }, \
270                 { O_DIRECT, "O_DIRECT" }, \
271                 { O_DIRECTORY, "O_DIRECTORY" })
272
273 #define show_fmode_flags(mode) \
274         __print_flags(mode, "|", \
275                 { ((__force unsigned long)FMODE_READ), "READ" }, \
276                 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
277                 { ((__force unsigned long)FMODE_EXEC), "EXEC" })
278
279 TRACE_EVENT(nfs_atomic_open_enter,
280                 TP_PROTO(
281                         const struct inode *dir,
282                         const struct nfs_open_context *ctx,
283                         unsigned int flags
284                 ),
285
286                 TP_ARGS(dir, ctx, flags),
287
288                 TP_STRUCT__entry(
289                         __field(unsigned int, flags)
290                         __field(unsigned int, fmode)
291                         __field(dev_t, dev)
292                         __field(u64, dir)
293                         __string(name, ctx->dentry->d_name.name)
294                 ),
295
296                 TP_fast_assign(
297                         __entry->dev = dir->i_sb->s_dev;
298                         __entry->dir = NFS_FILEID(dir);
299                         __entry->flags = flags;
300                         __entry->fmode = (__force unsigned int)ctx->mode;
301                         __assign_str(name, ctx->dentry->d_name.name);
302                 ),
303
304                 TP_printk(
305                         "flags=%u (%s) fmode=%s name=%02x:%02x:%llu/%s",
306                         __entry->flags,
307                         show_open_flags(__entry->flags),
308                         show_fmode_flags(__entry->fmode),
309                         MAJOR(__entry->dev), MINOR(__entry->dev),
310                         (unsigned long long)__entry->dir,
311                         __get_str(name)
312                 )
313 );
314
315 TRACE_EVENT(nfs_atomic_open_exit,
316                 TP_PROTO(
317                         const struct inode *dir,
318                         const struct nfs_open_context *ctx,
319                         unsigned int flags,
320                         int error
321                 ),
322
323                 TP_ARGS(dir, ctx, flags, error),
324
325                 TP_STRUCT__entry(
326                         __field(int, error)
327                         __field(unsigned int, flags)
328                         __field(unsigned int, fmode)
329                         __field(dev_t, dev)
330                         __field(u64, dir)
331                         __string(name, ctx->dentry->d_name.name)
332                 ),
333
334                 TP_fast_assign(
335                         __entry->error = error;
336                         __entry->dev = dir->i_sb->s_dev;
337                         __entry->dir = NFS_FILEID(dir);
338                         __entry->flags = flags;
339                         __entry->fmode = (__force unsigned int)ctx->mode;
340                         __assign_str(name, ctx->dentry->d_name.name);
341                 ),
342
343                 TP_printk(
344                         "error=%d flags=%u (%s) fmode=%s "
345                         "name=%02x:%02x:%llu/%s",
346                         __entry->error,
347                         __entry->flags,
348                         show_open_flags(__entry->flags),
349                         show_fmode_flags(__entry->fmode),
350                         MAJOR(__entry->dev), MINOR(__entry->dev),
351                         (unsigned long long)__entry->dir,
352                         __get_str(name)
353                 )
354 );
355
356 TRACE_EVENT(nfs_create_enter,
357                 TP_PROTO(
358                         const struct inode *dir,
359                         const struct dentry *dentry,
360                         unsigned int flags
361                 ),
362
363                 TP_ARGS(dir, dentry, flags),
364
365                 TP_STRUCT__entry(
366                         __field(unsigned int, flags)
367                         __field(dev_t, dev)
368                         __field(u64, dir)
369                         __string(name, dentry->d_name.name)
370                 ),
371
372                 TP_fast_assign(
373                         __entry->dev = dir->i_sb->s_dev;
374                         __entry->dir = NFS_FILEID(dir);
375                         __entry->flags = flags;
376                         __assign_str(name, dentry->d_name.name);
377                 ),
378
379                 TP_printk(
380                         "flags=%u (%s) name=%02x:%02x:%llu/%s",
381                         __entry->flags,
382                         show_open_flags(__entry->flags),
383                         MAJOR(__entry->dev), MINOR(__entry->dev),
384                         (unsigned long long)__entry->dir,
385                         __get_str(name)
386                 )
387 );
388
389 TRACE_EVENT(nfs_create_exit,
390                 TP_PROTO(
391                         const struct inode *dir,
392                         const struct dentry *dentry,
393                         unsigned int flags,
394                         int error
395                 ),
396
397                 TP_ARGS(dir, dentry, flags, error),
398
399                 TP_STRUCT__entry(
400                         __field(int, error)
401                         __field(unsigned int, flags)
402                         __field(dev_t, dev)
403                         __field(u64, dir)
404                         __string(name, dentry->d_name.name)
405                 ),
406
407                 TP_fast_assign(
408                         __entry->error = error;
409                         __entry->dev = dir->i_sb->s_dev;
410                         __entry->dir = NFS_FILEID(dir);
411                         __entry->flags = flags;
412                         __assign_str(name, dentry->d_name.name);
413                 ),
414
415                 TP_printk(
416                         "error=%d flags=%u (%s) name=%02x:%02x:%llu/%s",
417                         __entry->error,
418                         __entry->flags,
419                         show_open_flags(__entry->flags),
420                         MAJOR(__entry->dev), MINOR(__entry->dev),
421                         (unsigned long long)__entry->dir,
422                         __get_str(name)
423                 )
424 );
425
426 DECLARE_EVENT_CLASS(nfs_directory_event,
427                 TP_PROTO(
428                         const struct inode *dir,
429                         const struct dentry *dentry
430                 ),
431
432                 TP_ARGS(dir, dentry),
433
434                 TP_STRUCT__entry(
435                         __field(dev_t, dev)
436                         __field(u64, dir)
437                         __string(name, dentry->d_name.name)
438                 ),
439
440                 TP_fast_assign(
441                         __entry->dev = dir->i_sb->s_dev;
442                         __entry->dir = NFS_FILEID(dir);
443                         __assign_str(name, dentry->d_name.name);
444                 ),
445
446                 TP_printk(
447                         "name=%02x:%02x:%llu/%s",
448                         MAJOR(__entry->dev), MINOR(__entry->dev),
449                         (unsigned long long)__entry->dir,
450                         __get_str(name)
451                 )
452 );
453
454 #define DEFINE_NFS_DIRECTORY_EVENT(name) \
455         DEFINE_EVENT(nfs_directory_event, name, \
456                         TP_PROTO( \
457                                 const struct inode *dir, \
458                                 const struct dentry *dentry \
459                         ), \
460                         TP_ARGS(dir, dentry))
461
462 DECLARE_EVENT_CLASS(nfs_directory_event_done,
463                 TP_PROTO(
464                         const struct inode *dir,
465                         const struct dentry *dentry,
466                         int error
467                 ),
468
469                 TP_ARGS(dir, dentry, error),
470
471                 TP_STRUCT__entry(
472                         __field(int, error)
473                         __field(dev_t, dev)
474                         __field(u64, dir)
475                         __string(name, dentry->d_name.name)
476                 ),
477
478                 TP_fast_assign(
479                         __entry->dev = dir->i_sb->s_dev;
480                         __entry->dir = NFS_FILEID(dir);
481                         __entry->error = error;
482                         __assign_str(name, dentry->d_name.name);
483                 ),
484
485                 TP_printk(
486                         "error=%d name=%02x:%02x:%llu/%s",
487                         __entry->error,
488                         MAJOR(__entry->dev), MINOR(__entry->dev),
489                         (unsigned long long)__entry->dir,
490                         __get_str(name)
491                 )
492 );
493
494 #define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \
495         DEFINE_EVENT(nfs_directory_event_done, name, \
496                         TP_PROTO( \
497                                 const struct inode *dir, \
498                                 const struct dentry *dentry, \
499                                 int error \
500                         ), \
501                         TP_ARGS(dir, dentry, error))
502
503 DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter);
504 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit);
505 DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter);
506 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit);
507 DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter);
508 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit);
509 DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter);
510 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit);
511 DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter);
512 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit);
513 DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter);
514 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit);
515
516 TRACE_EVENT(nfs_link_enter,
517                 TP_PROTO(
518                         const struct inode *inode,
519                         const struct inode *dir,
520                         const struct dentry *dentry
521                 ),
522
523                 TP_ARGS(inode, dir, dentry),
524
525                 TP_STRUCT__entry(
526                         __field(dev_t, dev)
527                         __field(u64, fileid)
528                         __field(u64, dir)
529                         __string(name, dentry->d_name.name)
530                 ),
531
532                 TP_fast_assign(
533                         __entry->dev = inode->i_sb->s_dev;
534                         __entry->fileid = NFS_FILEID(inode);
535                         __entry->dir = NFS_FILEID(dir);
536                         __assign_str(name, dentry->d_name.name);
537                 ),
538
539                 TP_printk(
540                         "fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
541                         MAJOR(__entry->dev), MINOR(__entry->dev),
542                         __entry->fileid,
543                         MAJOR(__entry->dev), MINOR(__entry->dev),
544                         (unsigned long long)__entry->dir,
545                         __get_str(name)
546                 )
547 );
548
549 TRACE_EVENT(nfs_link_exit,
550                 TP_PROTO(
551                         const struct inode *inode,
552                         const struct inode *dir,
553                         const struct dentry *dentry,
554                         int error
555                 ),
556
557                 TP_ARGS(inode, dir, dentry, error),
558
559                 TP_STRUCT__entry(
560                         __field(int, error)
561                         __field(dev_t, dev)
562                         __field(u64, fileid)
563                         __field(u64, dir)
564                         __string(name, dentry->d_name.name)
565                 ),
566
567                 TP_fast_assign(
568                         __entry->dev = inode->i_sb->s_dev;
569                         __entry->fileid = NFS_FILEID(inode);
570                         __entry->dir = NFS_FILEID(dir);
571                         __entry->error = error;
572                         __assign_str(name, dentry->d_name.name);
573                 ),
574
575                 TP_printk(
576                         "error=%d fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s",
577                         __entry->error,
578                         MAJOR(__entry->dev), MINOR(__entry->dev),
579                         __entry->fileid,
580                         MAJOR(__entry->dev), MINOR(__entry->dev),
581                         (unsigned long long)__entry->dir,
582                         __get_str(name)
583                 )
584 );
585
586 DECLARE_EVENT_CLASS(nfs_rename_event,
587                 TP_PROTO(
588                         const struct inode *old_dir,
589                         const struct dentry *old_dentry,
590                         const struct inode *new_dir,
591                         const struct dentry *new_dentry
592                 ),
593
594                 TP_ARGS(old_dir, old_dentry, new_dir, new_dentry),
595
596                 TP_STRUCT__entry(
597                         __field(dev_t, dev)
598                         __field(u64, old_dir)
599                         __field(u64, new_dir)
600                         __string(old_name, old_dentry->d_name.name)
601                         __string(new_name, new_dentry->d_name.name)
602                 ),
603
604                 TP_fast_assign(
605                         __entry->dev = old_dir->i_sb->s_dev;
606                         __entry->old_dir = NFS_FILEID(old_dir);
607                         __entry->new_dir = NFS_FILEID(new_dir);
608                         __assign_str(old_name, old_dentry->d_name.name);
609                         __assign_str(new_name, new_dentry->d_name.name);
610                 ),
611
612                 TP_printk(
613                         "old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s",
614                         MAJOR(__entry->dev), MINOR(__entry->dev),
615                         (unsigned long long)__entry->old_dir,
616                         __get_str(old_name),
617                         MAJOR(__entry->dev), MINOR(__entry->dev),
618                         (unsigned long long)__entry->new_dir,
619                         __get_str(new_name)
620                 )
621 );
622 #define DEFINE_NFS_RENAME_EVENT(name) \
623         DEFINE_EVENT(nfs_rename_event, name, \
624                         TP_PROTO( \
625                                 const struct inode *old_dir, \
626                                 const struct dentry *old_dentry, \
627                                 const struct inode *new_dir, \
628                                 const struct dentry *new_dentry \
629                         ), \
630                         TP_ARGS(old_dir, old_dentry, new_dir, new_dentry))
631
632 DECLARE_EVENT_CLASS(nfs_rename_event_done,
633                 TP_PROTO(
634                         const struct inode *old_dir,
635                         const struct dentry *old_dentry,
636                         const struct inode *new_dir,
637                         const struct dentry *new_dentry,
638                         int error
639                 ),
640
641                 TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, error),
642
643                 TP_STRUCT__entry(
644                         __field(dev_t, dev)
645                         __field(int, error)
646                         __field(u64, old_dir)
647                         __string(old_name, old_dentry->d_name.name)
648                         __field(u64, new_dir)
649                         __string(new_name, new_dentry->d_name.name)
650                 ),
651
652                 TP_fast_assign(
653                         __entry->dev = old_dir->i_sb->s_dev;
654                         __entry->old_dir = NFS_FILEID(old_dir);
655                         __entry->new_dir = NFS_FILEID(new_dir);
656                         __entry->error = error;
657                         __assign_str(old_name, old_dentry->d_name.name);
658                         __assign_str(new_name, new_dentry->d_name.name);
659                 ),
660
661                 TP_printk(
662                         "error=%d old_name=%02x:%02x:%llu/%s "
663                         "new_name=%02x:%02x:%llu/%s",
664                         __entry->error,
665                         MAJOR(__entry->dev), MINOR(__entry->dev),
666                         (unsigned long long)__entry->old_dir,
667                         __get_str(old_name),
668                         MAJOR(__entry->dev), MINOR(__entry->dev),
669                         (unsigned long long)__entry->new_dir,
670                         __get_str(new_name)
671                 )
672 );
673 #define DEFINE_NFS_RENAME_EVENT_DONE(name) \
674         DEFINE_EVENT(nfs_rename_event_done, name, \
675                         TP_PROTO( \
676                                 const struct inode *old_dir, \
677                                 const struct dentry *old_dentry, \
678                                 const struct inode *new_dir, \
679                                 const struct dentry *new_dentry, \
680                                 int error \
681                         ), \
682                         TP_ARGS(old_dir, old_dentry, new_dir, \
683                                 new_dentry, error))
684
685 DEFINE_NFS_RENAME_EVENT(nfs_rename_enter);
686 DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit);
687
688 DEFINE_NFS_RENAME_EVENT_DONE(nfs_sillyrename_rename);
689
690 TRACE_EVENT(nfs_sillyrename_unlink,
691                 TP_PROTO(
692                         const struct nfs_unlinkdata *data,
693                         int error
694                 ),
695
696                 TP_ARGS(data, error),
697
698                 TP_STRUCT__entry(
699                         __field(dev_t, dev)
700                         __field(int, error)
701                         __field(u64, dir)
702                         __dynamic_array(char, name, data->args.name.len + 1)
703                 ),
704
705                 TP_fast_assign(
706                         struct inode *dir = data->dir;
707                         size_t len = data->args.name.len;
708                         __entry->dev = dir->i_sb->s_dev;
709                         __entry->dir = NFS_FILEID(dir);
710                         __entry->error = error;
711                         memcpy(__get_dynamic_array(name),
712                                 data->args.name.name, len);
713                         ((char *)__get_dynamic_array(name))[len] = 0;
714                 ),
715
716                 TP_printk(
717                         "error=%d name=%02x:%02x:%llu/%s",
718                         __entry->error,
719                         MAJOR(__entry->dev), MINOR(__entry->dev),
720                         (unsigned long long)__entry->dir,
721                         __get_str(name)
722                 )
723 );
724 #endif /* _TRACE_NFS_H */
725
726 #undef TRACE_INCLUDE_PATH
727 #define TRACE_INCLUDE_PATH .
728 #define TRACE_INCLUDE_FILE nfstrace
729 /* This part must be outside protection */
730 #include <trace/define_trace.h>