gro: Allow tunnel stacking in the case of FOU/GUE
[linux/fpc-iii.git] / fs / nfs / nfs4trace.h
blob470af1a78becf206c6e2de9aae89b61b35eb8452
1 /*
2 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
3 */
4 #undef TRACE_SYSTEM
5 #define TRACE_SYSTEM nfs4
7 #if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
8 #define _TRACE_NFS4_H
10 #include <linux/tracepoint.h>
12 #define show_nfsv4_errors(error) \
13 __print_symbolic(error, \
14 { NFS4_OK, "OK" }, \
15 /* Mapped by nfs4_stat_to_errno() */ \
16 { -EPERM, "EPERM" }, \
17 { -ENOENT, "ENOENT" }, \
18 { -EIO, "EIO" }, \
19 { -ENXIO, "ENXIO" }, \
20 { -EACCES, "EACCES" }, \
21 { -EEXIST, "EEXIST" }, \
22 { -EXDEV, "EXDEV" }, \
23 { -ENOTDIR, "ENOTDIR" }, \
24 { -EISDIR, "EISDIR" }, \
25 { -EFBIG, "EFBIG" }, \
26 { -ENOSPC, "ENOSPC" }, \
27 { -EROFS, "EROFS" }, \
28 { -EMLINK, "EMLINK" }, \
29 { -ENAMETOOLONG, "ENAMETOOLONG" }, \
30 { -ENOTEMPTY, "ENOTEMPTY" }, \
31 { -EDQUOT, "EDQUOT" }, \
32 { -ESTALE, "ESTALE" }, \
33 { -EBADHANDLE, "EBADHANDLE" }, \
34 { -EBADCOOKIE, "EBADCOOKIE" }, \
35 { -ENOTSUPP, "ENOTSUPP" }, \
36 { -ETOOSMALL, "ETOOSMALL" }, \
37 { -EREMOTEIO, "EREMOTEIO" }, \
38 { -EBADTYPE, "EBADTYPE" }, \
39 { -EAGAIN, "EAGAIN" }, \
40 { -ELOOP, "ELOOP" }, \
41 { -EOPNOTSUPP, "EOPNOTSUPP" }, \
42 { -EDEADLK, "EDEADLK" }, \
43 /* RPC errors */ \
44 { -ENOMEM, "ENOMEM" }, \
45 { -EKEYEXPIRED, "EKEYEXPIRED" }, \
46 { -ETIMEDOUT, "ETIMEDOUT" }, \
47 { -ERESTARTSYS, "ERESTARTSYS" }, \
48 { -ECONNREFUSED, "ECONNREFUSED" }, \
49 { -ECONNRESET, "ECONNRESET" }, \
50 { -ENETUNREACH, "ENETUNREACH" }, \
51 { -EHOSTUNREACH, "EHOSTUNREACH" }, \
52 { -EHOSTDOWN, "EHOSTDOWN" }, \
53 { -EPIPE, "EPIPE" }, \
54 { -EPFNOSUPPORT, "EPFNOSUPPORT" }, \
55 { -EPROTONOSUPPORT, "EPROTONOSUPPORT" }, \
56 /* NFSv4 native errors */ \
57 { -NFS4ERR_ACCESS, "ACCESS" }, \
58 { -NFS4ERR_ATTRNOTSUPP, "ATTRNOTSUPP" }, \
59 { -NFS4ERR_ADMIN_REVOKED, "ADMIN_REVOKED" }, \
60 { -NFS4ERR_BACK_CHAN_BUSY, "BACK_CHAN_BUSY" }, \
61 { -NFS4ERR_BADCHAR, "BADCHAR" }, \
62 { -NFS4ERR_BADHANDLE, "BADHANDLE" }, \
63 { -NFS4ERR_BADIOMODE, "BADIOMODE" }, \
64 { -NFS4ERR_BADLAYOUT, "BADLAYOUT" }, \
65 { -NFS4ERR_BADLABEL, "BADLABEL" }, \
66 { -NFS4ERR_BADNAME, "BADNAME" }, \
67 { -NFS4ERR_BADOWNER, "BADOWNER" }, \
68 { -NFS4ERR_BADSESSION, "BADSESSION" }, \
69 { -NFS4ERR_BADSLOT, "BADSLOT" }, \
70 { -NFS4ERR_BADTYPE, "BADTYPE" }, \
71 { -NFS4ERR_BADXDR, "BADXDR" }, \
72 { -NFS4ERR_BAD_COOKIE, "BAD_COOKIE" }, \
73 { -NFS4ERR_BAD_HIGH_SLOT, "BAD_HIGH_SLOT" }, \
74 { -NFS4ERR_BAD_RANGE, "BAD_RANGE" }, \
75 { -NFS4ERR_BAD_SEQID, "BAD_SEQID" }, \
76 { -NFS4ERR_BAD_SESSION_DIGEST, "BAD_SESSION_DIGEST" }, \
77 { -NFS4ERR_BAD_STATEID, "BAD_STATEID" }, \
78 { -NFS4ERR_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
79 { -NFS4ERR_CLID_INUSE, "CLID_INUSE" }, \
80 { -NFS4ERR_CLIENTID_BUSY, "CLIENTID_BUSY" }, \
81 { -NFS4ERR_COMPLETE_ALREADY, "COMPLETE_ALREADY" }, \
82 { -NFS4ERR_CONN_NOT_BOUND_TO_SESSION, \
83 "CONN_NOT_BOUND_TO_SESSION" }, \
84 { -NFS4ERR_DEADLOCK, "DEADLOCK" }, \
85 { -NFS4ERR_DEADSESSION, "DEAD_SESSION" }, \
86 { -NFS4ERR_DELAY, "DELAY" }, \
87 { -NFS4ERR_DELEG_ALREADY_WANTED, \
88 "DELEG_ALREADY_WANTED" }, \
89 { -NFS4ERR_DELEG_REVOKED, "DELEG_REVOKED" }, \
90 { -NFS4ERR_DENIED, "DENIED" }, \
91 { -NFS4ERR_DIRDELEG_UNAVAIL, "DIRDELEG_UNAVAIL" }, \
92 { -NFS4ERR_DQUOT, "DQUOT" }, \
93 { -NFS4ERR_ENCR_ALG_UNSUPP, "ENCR_ALG_UNSUPP" }, \
94 { -NFS4ERR_EXIST, "EXIST" }, \
95 { -NFS4ERR_EXPIRED, "EXPIRED" }, \
96 { -NFS4ERR_FBIG, "FBIG" }, \
97 { -NFS4ERR_FHEXPIRED, "FHEXPIRED" }, \
98 { -NFS4ERR_FILE_OPEN, "FILE_OPEN" }, \
99 { -NFS4ERR_GRACE, "GRACE" }, \
100 { -NFS4ERR_HASH_ALG_UNSUPP, "HASH_ALG_UNSUPP" }, \
101 { -NFS4ERR_INVAL, "INVAL" }, \
102 { -NFS4ERR_IO, "IO" }, \
103 { -NFS4ERR_ISDIR, "ISDIR" }, \
104 { -NFS4ERR_LAYOUTTRYLATER, "LAYOUTTRYLATER" }, \
105 { -NFS4ERR_LAYOUTUNAVAILABLE, "LAYOUTUNAVAILABLE" }, \
106 { -NFS4ERR_LEASE_MOVED, "LEASE_MOVED" }, \
107 { -NFS4ERR_LOCKED, "LOCKED" }, \
108 { -NFS4ERR_LOCKS_HELD, "LOCKS_HELD" }, \
109 { -NFS4ERR_LOCK_RANGE, "LOCK_RANGE" }, \
110 { -NFS4ERR_MINOR_VERS_MISMATCH, "MINOR_VERS_MISMATCH" }, \
111 { -NFS4ERR_MLINK, "MLINK" }, \
112 { -NFS4ERR_MOVED, "MOVED" }, \
113 { -NFS4ERR_NAMETOOLONG, "NAMETOOLONG" }, \
114 { -NFS4ERR_NOENT, "NOENT" }, \
115 { -NFS4ERR_NOFILEHANDLE, "NOFILEHANDLE" }, \
116 { -NFS4ERR_NOMATCHING_LAYOUT, "NOMATCHING_LAYOUT" }, \
117 { -NFS4ERR_NOSPC, "NOSPC" }, \
118 { -NFS4ERR_NOTDIR, "NOTDIR" }, \
119 { -NFS4ERR_NOTEMPTY, "NOTEMPTY" }, \
120 { -NFS4ERR_NOTSUPP, "NOTSUPP" }, \
121 { -NFS4ERR_NOT_ONLY_OP, "NOT_ONLY_OP" }, \
122 { -NFS4ERR_NOT_SAME, "NOT_SAME" }, \
123 { -NFS4ERR_NO_GRACE, "NO_GRACE" }, \
124 { -NFS4ERR_NXIO, "NXIO" }, \
125 { -NFS4ERR_OLD_STATEID, "OLD_STATEID" }, \
126 { -NFS4ERR_OPENMODE, "OPENMODE" }, \
127 { -NFS4ERR_OP_ILLEGAL, "OP_ILLEGAL" }, \
128 { -NFS4ERR_OP_NOT_IN_SESSION, "OP_NOT_IN_SESSION" }, \
129 { -NFS4ERR_PERM, "PERM" }, \
130 { -NFS4ERR_PNFS_IO_HOLE, "PNFS_IO_HOLE" }, \
131 { -NFS4ERR_PNFS_NO_LAYOUT, "PNFS_NO_LAYOUT" }, \
132 { -NFS4ERR_RECALLCONFLICT, "RECALLCONFLICT" }, \
133 { -NFS4ERR_RECLAIM_BAD, "RECLAIM_BAD" }, \
134 { -NFS4ERR_RECLAIM_CONFLICT, "RECLAIM_CONFLICT" }, \
135 { -NFS4ERR_REJECT_DELEG, "REJECT_DELEG" }, \
136 { -NFS4ERR_REP_TOO_BIG, "REP_TOO_BIG" }, \
137 { -NFS4ERR_REP_TOO_BIG_TO_CACHE, \
138 "REP_TOO_BIG_TO_CACHE" }, \
139 { -NFS4ERR_REQ_TOO_BIG, "REQ_TOO_BIG" }, \
140 { -NFS4ERR_RESOURCE, "RESOURCE" }, \
141 { -NFS4ERR_RESTOREFH, "RESTOREFH" }, \
142 { -NFS4ERR_RETRY_UNCACHED_REP, "RETRY_UNCACHED_REP" }, \
143 { -NFS4ERR_RETURNCONFLICT, "RETURNCONFLICT" }, \
144 { -NFS4ERR_ROFS, "ROFS" }, \
145 { -NFS4ERR_SAME, "SAME" }, \
146 { -NFS4ERR_SHARE_DENIED, "SHARE_DENIED" }, \
147 { -NFS4ERR_SEQUENCE_POS, "SEQUENCE_POS" }, \
148 { -NFS4ERR_SEQ_FALSE_RETRY, "SEQ_FALSE_RETRY" }, \
149 { -NFS4ERR_SEQ_MISORDERED, "SEQ_MISORDERED" }, \
150 { -NFS4ERR_SERVERFAULT, "SERVERFAULT" }, \
151 { -NFS4ERR_STALE, "STALE" }, \
152 { -NFS4ERR_STALE_CLIENTID, "STALE_CLIENTID" }, \
153 { -NFS4ERR_STALE_STATEID, "STALE_STATEID" }, \
154 { -NFS4ERR_SYMLINK, "SYMLINK" }, \
155 { -NFS4ERR_TOOSMALL, "TOOSMALL" }, \
156 { -NFS4ERR_TOO_MANY_OPS, "TOO_MANY_OPS" }, \
157 { -NFS4ERR_UNKNOWN_LAYOUTTYPE, "UNKNOWN_LAYOUTTYPE" }, \
158 { -NFS4ERR_UNSAFE_COMPOUND, "UNSAFE_COMPOUND" }, \
159 { -NFS4ERR_WRONGSEC, "WRONGSEC" }, \
160 { -NFS4ERR_WRONG_CRED, "WRONG_CRED" }, \
161 { -NFS4ERR_WRONG_TYPE, "WRONG_TYPE" }, \
162 { -NFS4ERR_XDEV, "XDEV" })
164 #define show_open_flags(flags) \
165 __print_flags(flags, "|", \
166 { O_CREAT, "O_CREAT" }, \
167 { O_EXCL, "O_EXCL" }, \
168 { O_TRUNC, "O_TRUNC" }, \
169 { O_DIRECT, "O_DIRECT" })
171 #define show_fmode_flags(mode) \
172 __print_flags(mode, "|", \
173 { ((__force unsigned long)FMODE_READ), "READ" }, \
174 { ((__force unsigned long)FMODE_WRITE), "WRITE" }, \
175 { ((__force unsigned long)FMODE_EXEC), "EXEC" })
177 #define show_nfs_fattr_flags(valid) \
178 __print_flags((unsigned long)valid, "|", \
179 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \
180 { NFS_ATTR_FATTR_MODE, "MODE" }, \
181 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \
182 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \
183 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \
184 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \
185 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \
186 { NFS_ATTR_FATTR_FSID, "FSID" }, \
187 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \
188 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \
189 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \
190 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \
191 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \
192 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \
193 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" })
195 DECLARE_EVENT_CLASS(nfs4_clientid_event,
196 TP_PROTO(
197 const struct nfs_client *clp,
198 int error
201 TP_ARGS(clp, error),
203 TP_STRUCT__entry(
204 __string(dstaddr,
205 rpc_peeraddr2str(clp->cl_rpcclient,
206 RPC_DISPLAY_ADDR))
207 __field(int, error)
210 TP_fast_assign(
211 __entry->error = error;
212 __assign_str(dstaddr,
213 rpc_peeraddr2str(clp->cl_rpcclient,
214 RPC_DISPLAY_ADDR));
217 TP_printk(
218 "error=%d (%s) dstaddr=%s",
219 __entry->error,
220 show_nfsv4_errors(__entry->error),
221 __get_str(dstaddr)
224 #define DEFINE_NFS4_CLIENTID_EVENT(name) \
225 DEFINE_EVENT(nfs4_clientid_event, name, \
226 TP_PROTO( \
227 const struct nfs_client *clp, \
228 int error \
229 ), \
230 TP_ARGS(clp, error))
231 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
232 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
233 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
234 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
235 #ifdef CONFIG_NFS_V4_1
236 DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
237 DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
238 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
239 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
240 DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
241 DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
242 DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
244 TRACE_EVENT(nfs4_setup_sequence,
245 TP_PROTO(
246 const struct nfs4_session *session,
247 const struct nfs4_sequence_args *args
249 TP_ARGS(session, args),
251 TP_STRUCT__entry(
252 __field(unsigned int, session)
253 __field(unsigned int, slot_nr)
254 __field(unsigned int, seq_nr)
255 __field(unsigned int, highest_used_slotid)
258 TP_fast_assign(
259 const struct nfs4_slot *sa_slot = args->sa_slot;
260 __entry->session = nfs_session_id_hash(&session->sess_id);
261 __entry->slot_nr = sa_slot->slot_nr;
262 __entry->seq_nr = sa_slot->seq_nr;
263 __entry->highest_used_slotid =
264 sa_slot->table->highest_used_slotid;
266 TP_printk(
267 "session=0x%08x slot_nr=%u seq_nr=%u "
268 "highest_used_slotid=%u",
269 __entry->session,
270 __entry->slot_nr,
271 __entry->seq_nr,
272 __entry->highest_used_slotid
276 #define show_nfs4_sequence_status_flags(status) \
277 __print_flags((unsigned long)status, "|", \
278 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
279 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
280 "CB_GSS_CONTEXTS_EXPIRING" }, \
281 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
282 "CB_GSS_CONTEXTS_EXPIRED" }, \
283 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
284 "EXPIRED_ALL_STATE_REVOKED" }, \
285 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
286 "EXPIRED_SOME_STATE_REVOKED" }, \
287 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
288 "ADMIN_STATE_REVOKED" }, \
289 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
290 "RECALLABLE_STATE_REVOKED" }, \
291 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
292 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
293 "RESTART_RECLAIM_NEEDED" }, \
294 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
295 "CB_PATH_DOWN_SESSION" }, \
296 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
297 "BACKCHANNEL_FAULT" })
299 TRACE_EVENT(nfs4_sequence_done,
300 TP_PROTO(
301 const struct nfs4_session *session,
302 const struct nfs4_sequence_res *res
304 TP_ARGS(session, res),
306 TP_STRUCT__entry(
307 __field(unsigned int, session)
308 __field(unsigned int, slot_nr)
309 __field(unsigned int, seq_nr)
310 __field(unsigned int, highest_slotid)
311 __field(unsigned int, target_highest_slotid)
312 __field(unsigned int, status_flags)
313 __field(int, error)
316 TP_fast_assign(
317 const struct nfs4_slot *sr_slot = res->sr_slot;
318 __entry->session = nfs_session_id_hash(&session->sess_id);
319 __entry->slot_nr = sr_slot->slot_nr;
320 __entry->seq_nr = sr_slot->seq_nr;
321 __entry->highest_slotid = res->sr_highest_slotid;
322 __entry->target_highest_slotid =
323 res->sr_target_highest_slotid;
324 __entry->error = res->sr_status;
326 TP_printk(
327 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
328 "highest_slotid=%u target_highest_slotid=%u "
329 "status_flags=%u (%s)",
330 __entry->error,
331 show_nfsv4_errors(__entry->error),
332 __entry->session,
333 __entry->slot_nr,
334 __entry->seq_nr,
335 __entry->highest_slotid,
336 __entry->target_highest_slotid,
337 __entry->status_flags,
338 show_nfs4_sequence_status_flags(__entry->status_flags)
342 struct cb_sequenceargs;
343 struct cb_sequenceres;
345 TRACE_EVENT(nfs4_cb_sequence,
346 TP_PROTO(
347 const struct cb_sequenceargs *args,
348 const struct cb_sequenceres *res,
349 __be32 status
351 TP_ARGS(args, res, status),
353 TP_STRUCT__entry(
354 __field(unsigned int, session)
355 __field(unsigned int, slot_nr)
356 __field(unsigned int, seq_nr)
357 __field(unsigned int, highest_slotid)
358 __field(unsigned int, cachethis)
359 __field(int, error)
362 TP_fast_assign(
363 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
364 __entry->slot_nr = args->csa_slotid;
365 __entry->seq_nr = args->csa_sequenceid;
366 __entry->highest_slotid = args->csa_highestslotid;
367 __entry->cachethis = args->csa_cachethis;
368 __entry->error = -be32_to_cpu(status);
371 TP_printk(
372 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
373 "highest_slotid=%u",
374 __entry->error,
375 show_nfsv4_errors(__entry->error),
376 __entry->session,
377 __entry->slot_nr,
378 __entry->seq_nr,
379 __entry->highest_slotid
382 #endif /* CONFIG_NFS_V4_1 */
384 DECLARE_EVENT_CLASS(nfs4_open_event,
385 TP_PROTO(
386 const struct nfs_open_context *ctx,
387 int flags,
388 int error
391 TP_ARGS(ctx, flags, error),
393 TP_STRUCT__entry(
394 __field(int, error)
395 __field(unsigned int, flags)
396 __field(unsigned int, fmode)
397 __field(dev_t, dev)
398 __field(u32, fhandle)
399 __field(u64, fileid)
400 __field(u64, dir)
401 __string(name, ctx->dentry->d_name.name)
404 TP_fast_assign(
405 const struct nfs4_state *state = ctx->state;
406 const struct inode *inode = NULL;
408 __entry->error = error;
409 __entry->flags = flags;
410 __entry->fmode = (__force unsigned int)ctx->mode;
411 __entry->dev = ctx->dentry->d_sb->s_dev;
412 if (!IS_ERR(state))
413 inode = state->inode;
414 if (inode != NULL) {
415 __entry->fileid = NFS_FILEID(inode);
416 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
417 } else {
418 __entry->fileid = 0;
419 __entry->fhandle = 0;
421 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
422 __assign_str(name, ctx->dentry->d_name.name);
425 TP_printk(
426 "error=%d (%s) flags=%d (%s) fmode=%s "
427 "fileid=%02x:%02x:%llu fhandle=0x%08x "
428 "name=%02x:%02x:%llu/%s",
429 __entry->error,
430 show_nfsv4_errors(__entry->error),
431 __entry->flags,
432 show_open_flags(__entry->flags),
433 show_fmode_flags(__entry->fmode),
434 MAJOR(__entry->dev), MINOR(__entry->dev),
435 (unsigned long long)__entry->fileid,
436 __entry->fhandle,
437 MAJOR(__entry->dev), MINOR(__entry->dev),
438 (unsigned long long)__entry->dir,
439 __get_str(name)
443 #define DEFINE_NFS4_OPEN_EVENT(name) \
444 DEFINE_EVENT(nfs4_open_event, name, \
445 TP_PROTO( \
446 const struct nfs_open_context *ctx, \
447 int flags, \
448 int error \
449 ), \
450 TP_ARGS(ctx, flags, error))
451 DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
452 DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
453 DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
455 TRACE_EVENT(nfs4_close,
456 TP_PROTO(
457 const struct nfs4_state *state,
458 const struct nfs_closeargs *args,
459 const struct nfs_closeres *res,
460 int error
463 TP_ARGS(state, args, res, error),
465 TP_STRUCT__entry(
466 __field(dev_t, dev)
467 __field(u32, fhandle)
468 __field(u64, fileid)
469 __field(unsigned int, fmode)
470 __field(int, error)
473 TP_fast_assign(
474 const struct inode *inode = state->inode;
476 __entry->dev = inode->i_sb->s_dev;
477 __entry->fileid = NFS_FILEID(inode);
478 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
479 __entry->fmode = (__force unsigned int)state->state;
480 __entry->error = error;
483 TP_printk(
484 "error=%d (%s) fmode=%s fileid=%02x:%02x:%llu "
485 "fhandle=0x%08x",
486 __entry->error,
487 show_nfsv4_errors(__entry->error),
488 __entry->fmode ? show_fmode_flags(__entry->fmode) :
489 "closed",
490 MAJOR(__entry->dev), MINOR(__entry->dev),
491 (unsigned long long)__entry->fileid,
492 __entry->fhandle
496 #define show_lock_cmd(type) \
497 __print_symbolic((int)type, \
498 { F_GETLK, "GETLK" }, \
499 { F_SETLK, "SETLK" }, \
500 { F_SETLKW, "SETLKW" })
501 #define show_lock_type(type) \
502 __print_symbolic((int)type, \
503 { F_RDLCK, "RDLCK" }, \
504 { F_WRLCK, "WRLCK" }, \
505 { F_UNLCK, "UNLCK" })
507 DECLARE_EVENT_CLASS(nfs4_lock_event,
508 TP_PROTO(
509 const struct file_lock *request,
510 const struct nfs4_state *state,
511 int cmd,
512 int error
515 TP_ARGS(request, state, cmd, error),
517 TP_STRUCT__entry(
518 __field(int, error)
519 __field(int, cmd)
520 __field(char, type)
521 __field(loff_t, start)
522 __field(loff_t, end)
523 __field(dev_t, dev)
524 __field(u32, fhandle)
525 __field(u64, fileid)
528 TP_fast_assign(
529 const struct inode *inode = state->inode;
531 __entry->error = error;
532 __entry->cmd = cmd;
533 __entry->type = request->fl_type;
534 __entry->start = request->fl_start;
535 __entry->end = request->fl_end;
536 __entry->dev = inode->i_sb->s_dev;
537 __entry->fileid = NFS_FILEID(inode);
538 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
541 TP_printk(
542 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
543 "fileid=%02x:%02x:%llu fhandle=0x%08x",
544 __entry->error,
545 show_nfsv4_errors(__entry->error),
546 show_lock_cmd(__entry->cmd),
547 show_lock_type(__entry->type),
548 (long long)__entry->start,
549 (long long)__entry->end,
550 MAJOR(__entry->dev), MINOR(__entry->dev),
551 (unsigned long long)__entry->fileid,
552 __entry->fhandle
556 #define DEFINE_NFS4_LOCK_EVENT(name) \
557 DEFINE_EVENT(nfs4_lock_event, name, \
558 TP_PROTO( \
559 const struct file_lock *request, \
560 const struct nfs4_state *state, \
561 int cmd, \
562 int error \
563 ), \
564 TP_ARGS(request, state, cmd, error))
565 DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
566 DEFINE_NFS4_LOCK_EVENT(nfs4_set_lock);
567 DEFINE_NFS4_LOCK_EVENT(nfs4_lock_reclaim);
568 DEFINE_NFS4_LOCK_EVENT(nfs4_lock_expired);
569 DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
571 DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
572 TP_PROTO(
573 const struct inode *inode,
574 fmode_t fmode
577 TP_ARGS(inode, fmode),
579 TP_STRUCT__entry(
580 __field(dev_t, dev)
581 __field(u32, fhandle)
582 __field(u64, fileid)
583 __field(unsigned int, fmode)
586 TP_fast_assign(
587 __entry->dev = inode->i_sb->s_dev;
588 __entry->fileid = NFS_FILEID(inode);
589 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
590 __entry->fmode = (__force unsigned int)fmode;
593 TP_printk(
594 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
595 show_fmode_flags(__entry->fmode),
596 MAJOR(__entry->dev), MINOR(__entry->dev),
597 (unsigned long long)__entry->fileid,
598 __entry->fhandle
601 #define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
602 DEFINE_EVENT(nfs4_set_delegation_event, name, \
603 TP_PROTO( \
604 const struct inode *inode, \
605 fmode_t fmode \
606 ), \
607 TP_ARGS(inode, fmode))
608 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
609 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
611 TRACE_EVENT(nfs4_delegreturn_exit,
612 TP_PROTO(
613 const struct nfs4_delegreturnargs *args,
614 const struct nfs4_delegreturnres *res,
615 int error
618 TP_ARGS(args, res, error),
620 TP_STRUCT__entry(
621 __field(dev_t, dev)
622 __field(u32, fhandle)
623 __field(int, error)
626 TP_fast_assign(
627 __entry->dev = res->server->s_dev;
628 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
629 __entry->error = error;
632 TP_printk(
633 "error=%d (%s) dev=%02x:%02x fhandle=0x%08x",
634 __entry->error,
635 show_nfsv4_errors(__entry->error),
636 MAJOR(__entry->dev), MINOR(__entry->dev),
637 __entry->fhandle
641 #ifdef CONFIG_NFS_V4_1
642 DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
643 TP_PROTO(
644 const struct nfs4_state *state,
645 const struct nfs4_lock_state *lsp,
646 int error
649 TP_ARGS(state, lsp, error),
651 TP_STRUCT__entry(
652 __field(int, error)
653 __field(dev_t, dev)
654 __field(u32, fhandle)
655 __field(u64, fileid)
658 TP_fast_assign(
659 const struct inode *inode = state->inode;
661 __entry->error = error;
662 __entry->dev = inode->i_sb->s_dev;
663 __entry->fileid = NFS_FILEID(inode);
664 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
667 TP_printk(
668 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
669 __entry->error,
670 show_nfsv4_errors(__entry->error),
671 MAJOR(__entry->dev), MINOR(__entry->dev),
672 (unsigned long long)__entry->fileid,
673 __entry->fhandle
677 #define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
678 DEFINE_EVENT(nfs4_test_stateid_event, name, \
679 TP_PROTO( \
680 const struct nfs4_state *state, \
681 const struct nfs4_lock_state *lsp, \
682 int error \
683 ), \
684 TP_ARGS(state, lsp, error))
685 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
686 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
687 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
688 #endif /* CONFIG_NFS_V4_1 */
690 DECLARE_EVENT_CLASS(nfs4_lookup_event,
691 TP_PROTO(
692 const struct inode *dir,
693 const struct qstr *name,
694 int error
697 TP_ARGS(dir, name, error),
699 TP_STRUCT__entry(
700 __field(dev_t, dev)
701 __field(int, error)
702 __field(u64, dir)
703 __string(name, name->name)
706 TP_fast_assign(
707 __entry->dev = dir->i_sb->s_dev;
708 __entry->dir = NFS_FILEID(dir);
709 __entry->error = error;
710 __assign_str(name, name->name);
713 TP_printk(
714 "error=%d (%s) name=%02x:%02x:%llu/%s",
715 __entry->error,
716 show_nfsv4_errors(__entry->error),
717 MAJOR(__entry->dev), MINOR(__entry->dev),
718 (unsigned long long)__entry->dir,
719 __get_str(name)
723 #define DEFINE_NFS4_LOOKUP_EVENT(name) \
724 DEFINE_EVENT(nfs4_lookup_event, name, \
725 TP_PROTO( \
726 const struct inode *dir, \
727 const struct qstr *name, \
728 int error \
729 ), \
730 TP_ARGS(dir, name, error))
732 DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
733 DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
734 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
735 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
736 DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
737 DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
738 DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
740 TRACE_EVENT(nfs4_rename,
741 TP_PROTO(
742 const struct inode *olddir,
743 const struct qstr *oldname,
744 const struct inode *newdir,
745 const struct qstr *newname,
746 int error
749 TP_ARGS(olddir, oldname, newdir, newname, error),
751 TP_STRUCT__entry(
752 __field(dev_t, dev)
753 __field(int, error)
754 __field(u64, olddir)
755 __string(oldname, oldname->name)
756 __field(u64, newdir)
757 __string(newname, newname->name)
760 TP_fast_assign(
761 __entry->dev = olddir->i_sb->s_dev;
762 __entry->olddir = NFS_FILEID(olddir);
763 __entry->newdir = NFS_FILEID(newdir);
764 __entry->error = error;
765 __assign_str(oldname, oldname->name);
766 __assign_str(newname, newname->name);
769 TP_printk(
770 "error=%d (%s) oldname=%02x:%02x:%llu/%s "
771 "newname=%02x:%02x:%llu/%s",
772 __entry->error,
773 show_nfsv4_errors(__entry->error),
774 MAJOR(__entry->dev), MINOR(__entry->dev),
775 (unsigned long long)__entry->olddir,
776 __get_str(oldname),
777 MAJOR(__entry->dev), MINOR(__entry->dev),
778 (unsigned long long)__entry->newdir,
779 __get_str(newname)
783 DECLARE_EVENT_CLASS(nfs4_inode_event,
784 TP_PROTO(
785 const struct inode *inode,
786 int error
789 TP_ARGS(inode, error),
791 TP_STRUCT__entry(
792 __field(dev_t, dev)
793 __field(u32, fhandle)
794 __field(u64, fileid)
795 __field(int, error)
798 TP_fast_assign(
799 __entry->dev = inode->i_sb->s_dev;
800 __entry->fileid = NFS_FILEID(inode);
801 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
802 __entry->error = error;
805 TP_printk(
806 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
807 __entry->error,
808 show_nfsv4_errors(__entry->error),
809 MAJOR(__entry->dev), MINOR(__entry->dev),
810 (unsigned long long)__entry->fileid,
811 __entry->fhandle
815 #define DEFINE_NFS4_INODE_EVENT(name) \
816 DEFINE_EVENT(nfs4_inode_event, name, \
817 TP_PROTO( \
818 const struct inode *inode, \
819 int error \
820 ), \
821 TP_ARGS(inode, error))
823 DEFINE_NFS4_INODE_EVENT(nfs4_setattr);
824 DEFINE_NFS4_INODE_EVENT(nfs4_access);
825 DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
826 DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
827 DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
828 DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
829 #ifdef CONFIG_NFS_V4_SECURITY_LABEL
830 DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
831 DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
832 #endif /* CONFIG_NFS_V4_SECURITY_LABEL */
833 DEFINE_NFS4_INODE_EVENT(nfs4_recall_delegation);
834 DEFINE_NFS4_INODE_EVENT(nfs4_delegreturn);
836 DECLARE_EVENT_CLASS(nfs4_getattr_event,
837 TP_PROTO(
838 const struct nfs_server *server,
839 const struct nfs_fh *fhandle,
840 const struct nfs_fattr *fattr,
841 int error
844 TP_ARGS(server, fhandle, fattr, error),
846 TP_STRUCT__entry(
847 __field(dev_t, dev)
848 __field(u32, fhandle)
849 __field(u64, fileid)
850 __field(unsigned int, valid)
851 __field(int, error)
854 TP_fast_assign(
855 __entry->dev = server->s_dev;
856 __entry->valid = fattr->valid;
857 __entry->fhandle = nfs_fhandle_hash(fhandle);
858 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
859 __entry->error = error;
862 TP_printk(
863 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
864 "valid=%s",
865 __entry->error,
866 show_nfsv4_errors(__entry->error),
867 MAJOR(__entry->dev), MINOR(__entry->dev),
868 (unsigned long long)__entry->fileid,
869 __entry->fhandle,
870 show_nfs_fattr_flags(__entry->valid)
874 #define DEFINE_NFS4_GETATTR_EVENT(name) \
875 DEFINE_EVENT(nfs4_getattr_event, name, \
876 TP_PROTO( \
877 const struct nfs_server *server, \
878 const struct nfs_fh *fhandle, \
879 const struct nfs_fattr *fattr, \
880 int error \
881 ), \
882 TP_ARGS(server, fhandle, fattr, error))
883 DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
884 DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
885 DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
887 DECLARE_EVENT_CLASS(nfs4_idmap_event,
888 TP_PROTO(
889 const char *name,
890 int len,
891 u32 id,
892 int error
895 TP_ARGS(name, len, id, error),
897 TP_STRUCT__entry(
898 __field(int, error)
899 __field(u32, id)
900 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
903 TP_fast_assign(
904 if (len < 0)
905 len = 0;
906 __entry->error = error < 0 ? error : 0;
907 __entry->id = id;
908 memcpy(__get_dynamic_array(name), name, len);
909 ((char *)__get_dynamic_array(name))[len] = 0;
912 TP_printk(
913 "error=%d id=%u name=%s",
914 __entry->error,
915 __entry->id,
916 __get_str(name)
919 #define DEFINE_NFS4_IDMAP_EVENT(name) \
920 DEFINE_EVENT(nfs4_idmap_event, name, \
921 TP_PROTO( \
922 const char *name, \
923 int len, \
924 u32 id, \
925 int error \
926 ), \
927 TP_ARGS(name, len, id, error))
928 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
929 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
930 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
931 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
933 DECLARE_EVENT_CLASS(nfs4_read_event,
934 TP_PROTO(
935 const struct nfs_pgio_header *hdr,
936 int error
939 TP_ARGS(hdr, error),
941 TP_STRUCT__entry(
942 __field(dev_t, dev)
943 __field(u32, fhandle)
944 __field(u64, fileid)
945 __field(loff_t, offset)
946 __field(size_t, count)
947 __field(int, error)
950 TP_fast_assign(
951 const struct inode *inode = hdr->inode;
952 __entry->dev = inode->i_sb->s_dev;
953 __entry->fileid = NFS_FILEID(inode);
954 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
955 __entry->offset = hdr->args.offset;
956 __entry->count = hdr->args.count;
957 __entry->error = error;
960 TP_printk(
961 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
962 "offset=%lld count=%zu",
963 __entry->error,
964 show_nfsv4_errors(__entry->error),
965 MAJOR(__entry->dev), MINOR(__entry->dev),
966 (unsigned long long)__entry->fileid,
967 __entry->fhandle,
968 (long long)__entry->offset,
969 __entry->count
972 #define DEFINE_NFS4_READ_EVENT(name) \
973 DEFINE_EVENT(nfs4_read_event, name, \
974 TP_PROTO( \
975 const struct nfs_pgio_header *hdr, \
976 int error \
977 ), \
978 TP_ARGS(hdr, error))
979 DEFINE_NFS4_READ_EVENT(nfs4_read);
980 #ifdef CONFIG_NFS_V4_1
981 DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
982 #endif /* CONFIG_NFS_V4_1 */
984 DECLARE_EVENT_CLASS(nfs4_write_event,
985 TP_PROTO(
986 const struct nfs_pgio_header *hdr,
987 int error
990 TP_ARGS(hdr, error),
992 TP_STRUCT__entry(
993 __field(dev_t, dev)
994 __field(u32, fhandle)
995 __field(u64, fileid)
996 __field(loff_t, offset)
997 __field(size_t, count)
998 __field(int, error)
1001 TP_fast_assign(
1002 const struct inode *inode = hdr->inode;
1003 __entry->dev = inode->i_sb->s_dev;
1004 __entry->fileid = NFS_FILEID(inode);
1005 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1006 __entry->offset = hdr->args.offset;
1007 __entry->count = hdr->args.count;
1008 __entry->error = error;
1011 TP_printk(
1012 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1013 "offset=%lld count=%zu",
1014 __entry->error,
1015 show_nfsv4_errors(__entry->error),
1016 MAJOR(__entry->dev), MINOR(__entry->dev),
1017 (unsigned long long)__entry->fileid,
1018 __entry->fhandle,
1019 (long long)__entry->offset,
1020 __entry->count
1024 #define DEFINE_NFS4_WRITE_EVENT(name) \
1025 DEFINE_EVENT(nfs4_write_event, name, \
1026 TP_PROTO( \
1027 const struct nfs_pgio_header *hdr, \
1028 int error \
1029 ), \
1030 TP_ARGS(hdr, error))
1031 DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1032 #ifdef CONFIG_NFS_V4_1
1033 DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1034 #endif /* CONFIG_NFS_V4_1 */
1036 DECLARE_EVENT_CLASS(nfs4_commit_event,
1037 TP_PROTO(
1038 const struct nfs_commit_data *data,
1039 int error
1042 TP_ARGS(data, error),
1044 TP_STRUCT__entry(
1045 __field(dev_t, dev)
1046 __field(u32, fhandle)
1047 __field(u64, fileid)
1048 __field(loff_t, offset)
1049 __field(size_t, count)
1050 __field(int, error)
1053 TP_fast_assign(
1054 const struct inode *inode = data->inode;
1055 __entry->dev = inode->i_sb->s_dev;
1056 __entry->fileid = NFS_FILEID(inode);
1057 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1058 __entry->offset = data->args.offset;
1059 __entry->count = data->args.count;
1060 __entry->error = error;
1063 TP_printk(
1064 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1065 "offset=%lld count=%zu",
1066 __entry->error,
1067 show_nfsv4_errors(__entry->error),
1068 MAJOR(__entry->dev), MINOR(__entry->dev),
1069 (unsigned long long)__entry->fileid,
1070 __entry->fhandle,
1071 (long long)__entry->offset,
1072 __entry->count
1075 #define DEFINE_NFS4_COMMIT_EVENT(name) \
1076 DEFINE_EVENT(nfs4_commit_event, name, \
1077 TP_PROTO( \
1078 const struct nfs_commit_data *data, \
1079 int error \
1080 ), \
1081 TP_ARGS(data, error))
1082 DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1083 #ifdef CONFIG_NFS_V4_1
1084 DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
1086 #define show_pnfs_iomode(iomode) \
1087 __print_symbolic(iomode, \
1088 { IOMODE_READ, "READ" }, \
1089 { IOMODE_RW, "RW" }, \
1090 { IOMODE_ANY, "ANY" })
1092 TRACE_EVENT(nfs4_layoutget,
1093 TP_PROTO(
1094 const struct nfs_open_context *ctx,
1095 const struct pnfs_layout_range *args,
1096 const struct pnfs_layout_range *res,
1097 int error
1100 TP_ARGS(ctx, args, res, error),
1102 TP_STRUCT__entry(
1103 __field(dev_t, dev)
1104 __field(u32, fhandle)
1105 __field(u64, fileid)
1106 __field(u32, iomode)
1107 __field(u64, offset)
1108 __field(u64, count)
1109 __field(int, error)
1112 TP_fast_assign(
1113 const struct inode *inode = d_inode(ctx->dentry);
1114 __entry->dev = inode->i_sb->s_dev;
1115 __entry->fileid = NFS_FILEID(inode);
1116 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1117 __entry->iomode = args->iomode;
1118 __entry->offset = args->offset;
1119 __entry->count = args->length;
1120 __entry->error = error;
1123 TP_printk(
1124 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1125 "iomode=%s offset=%llu count=%llu",
1126 __entry->error,
1127 show_nfsv4_errors(__entry->error),
1128 MAJOR(__entry->dev), MINOR(__entry->dev),
1129 (unsigned long long)__entry->fileid,
1130 __entry->fhandle,
1131 show_pnfs_iomode(__entry->iomode),
1132 (unsigned long long)__entry->offset,
1133 (unsigned long long)__entry->count
1137 DEFINE_NFS4_INODE_EVENT(nfs4_layoutcommit);
1138 DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn);
1140 #endif /* CONFIG_NFS_V4_1 */
1142 #endif /* _TRACE_NFS4_H */
1144 #undef TRACE_INCLUDE_PATH
1145 #define TRACE_INCLUDE_PATH .
1146 #define TRACE_INCLUDE_FILE nfs4trace
1147 /* This part must be outside protection */
1148 #include <trace/define_trace.h>