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