blob: 05b96a6dac5cf8cc26034bf63229b6c8eb4f0b01 [file] [log] [blame]
Trond Myklebustc6d01c62013-08-09 11:51:26 -04001/*
2 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com>
3 */
4#undef TRACE_SYSTEM
5#define TRACE_SYSTEM nfs4
6
7#if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ)
8#define _TRACE_NFS4_H
9
10#include <linux/tracepoint.h>
11
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" })
163
Trond Myklebust42113a72013-08-12 16:19:27 -0400164#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" })
170
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" })
176
Trond Myklebustb5f875a2013-08-13 13:01:39 -0400177#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" })
194
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400195DECLARE_EVENT_CLASS(nfs4_clientid_event,
196 TP_PROTO(
197 const struct nfs_client *clp,
198 int error
199 ),
200
201 TP_ARGS(clp, error),
202
203 TP_STRUCT__entry(
204 __string(dstaddr,
205 rpc_peeraddr2str(clp->cl_rpcclient,
206 RPC_DISPLAY_ADDR))
207 __field(int, error)
208 ),
209
210 TP_fast_assign(
211 __entry->error = error;
212 __assign_str(dstaddr,
213 rpc_peeraddr2str(clp->cl_rpcclient,
214 RPC_DISPLAY_ADDR));
215 ),
216
217 TP_printk(
218 "error=%d (%s) dstaddr=%s",
219 __entry->error,
220 show_nfsv4_errors(__entry->error),
221 __get_str(dstaddr)
222 )
223);
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))
231DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
232DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
233DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
234DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
235#ifdef CONFIG_NFS_V4_1
236DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
237DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
238DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
239DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
240DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
241DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
242DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400243
244TRACE_EVENT(nfs4_setup_sequence,
245 TP_PROTO(
246 const struct nfs4_session *session,
247 const struct nfs4_sequence_args *args
248 ),
249 TP_ARGS(session, args),
250
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)
256 ),
257
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;
265 ),
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
273 )
274);
275
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" })
298
299TRACE_EVENT(nfs4_sequence_done,
300 TP_PROTO(
301 const struct nfs4_session *session,
302 const struct nfs4_sequence_res *res
303 ),
304 TP_ARGS(session, res),
305
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)
314 ),
315
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;
325 ),
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)
339 )
340);
341
342struct cb_sequenceargs;
343struct cb_sequenceres;
344
345TRACE_EVENT(nfs4_cb_sequence,
346 TP_PROTO(
347 const struct cb_sequenceargs *args,
348 const struct cb_sequenceres *res,
349 __be32 status
350 ),
351 TP_ARGS(args, res, status),
352
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)
360 ),
361
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);
369 ),
370
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
380 )
381);
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400382#endif /* CONFIG_NFS_V4_1 */
383
Trond Myklebust42113a72013-08-12 16:19:27 -0400384DECLARE_EVENT_CLASS(nfs4_open_event,
385 TP_PROTO(
386 const struct nfs_open_context *ctx,
387 int flags,
388 int error
389 ),
390
391 TP_ARGS(ctx, flags, error),
392
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)
402 ),
403
404 TP_fast_assign(
405 const struct nfs4_state *state = ctx->state;
406 const struct inode *inode = NULL;
407
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;
420 }
421 __entry->dir = NFS_FILEID(ctx->dentry->d_parent->d_inode);
422 __assign_str(name, ctx->dentry->d_name.name);
423 ),
424
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)
440 )
441);
442
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))
451DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
452DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
453DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
454
455TRACE_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
461 ),
462
463 TP_ARGS(state, args, res, error),
464
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)
471 ),
472
473 TP_fast_assign(
474 const struct inode *inode = state->inode;
475
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;
481 ),
482
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
493 )
494);
495
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400496#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" })
506
507DECLARE_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
513 ),
514
515 TP_ARGS(request, state, cmd, error),
516
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)
526 ),
527
528 TP_fast_assign(
529 const struct inode *inode = state->inode;
530
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));
539 ),
540
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
553 )
554);
555
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))
565DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
566DEFINE_NFS4_LOCK_EVENT(nfs4_set_lock);
567DEFINE_NFS4_LOCK_EVENT(nfs4_lock_reclaim);
568DEFINE_NFS4_LOCK_EVENT(nfs4_lock_expired);
569DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
570
Trond Myklebustca8acf82013-08-13 10:36:56 -0400571DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
572 TP_PROTO(
573 const struct inode *inode,
574 fmode_t fmode
575 ),
576
577 TP_ARGS(inode, fmode),
578
579 TP_STRUCT__entry(
580 __field(dev_t, dev)
581 __field(u32, fhandle)
582 __field(u64, fileid)
583 __field(unsigned int, fmode)
584 ),
585
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;
591 ),
592
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
599 )
600);
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))
608DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
609DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
610
611TRACE_EVENT(nfs4_delegreturn_exit,
612 TP_PROTO(
613 const struct nfs4_delegreturnargs *args,
614 const struct nfs4_delegreturnres *res,
615 int error
616 ),
617
618 TP_ARGS(args, res, error),
619
620 TP_STRUCT__entry(
621 __field(dev_t, dev)
622 __field(u32, fhandle)
623 __field(int, error)
624 ),
625
626 TP_fast_assign(
627 __entry->dev = res->server->s_dev;
628 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
629 __entry->error = error;
630 ),
631
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
638 )
639);
640
Trond Myklebust078ea3d2013-08-12 16:45:55 -0400641DECLARE_EVENT_CLASS(nfs4_lookup_event,
642 TP_PROTO(
643 const struct inode *dir,
644 const struct qstr *name,
645 int error
646 ),
647
648 TP_ARGS(dir, name, error),
649
650 TP_STRUCT__entry(
651 __field(dev_t, dev)
652 __field(int, error)
653 __field(u64, dir)
654 __string(name, name->name)
655 ),
656
657 TP_fast_assign(
658 __entry->dev = dir->i_sb->s_dev;
659 __entry->dir = NFS_FILEID(dir);
660 __entry->error = error;
661 __assign_str(name, name->name);
662 ),
663
664 TP_printk(
665 "error=%d (%s) name=%02x:%02x:%llu/%s",
666 __entry->error,
667 show_nfsv4_errors(__entry->error),
668 MAJOR(__entry->dev), MINOR(__entry->dev),
669 (unsigned long long)__entry->dir,
670 __get_str(name)
671 )
672);
673
674#define DEFINE_NFS4_LOOKUP_EVENT(name) \
675 DEFINE_EVENT(nfs4_lookup_event, name, \
676 TP_PROTO( \
677 const struct inode *dir, \
678 const struct qstr *name, \
679 int error \
680 ), \
681 TP_ARGS(dir, name, error))
682
683DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
684DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
685DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
686DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
687DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
688DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
689DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
690
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -0400691TRACE_EVENT(nfs4_rename,
692 TP_PROTO(
693 const struct inode *olddir,
694 const struct qstr *oldname,
695 const struct inode *newdir,
696 const struct qstr *newname,
697 int error
698 ),
699
700 TP_ARGS(olddir, oldname, newdir, newname, error),
701
702 TP_STRUCT__entry(
703 __field(dev_t, dev)
704 __field(int, error)
705 __field(u64, olddir)
706 __string(oldname, oldname->name)
707 __field(u64, newdir)
708 __string(newname, newname->name)
709 ),
710
711 TP_fast_assign(
712 __entry->dev = olddir->i_sb->s_dev;
713 __entry->olddir = NFS_FILEID(olddir);
714 __entry->newdir = NFS_FILEID(newdir);
715 __entry->error = error;
716 __assign_str(oldname, oldname->name);
717 __assign_str(newname, newname->name);
718 ),
719
720 TP_printk(
721 "error=%d (%s) oldname=%02x:%02x:%llu/%s "
722 "newname=%02x:%02x:%llu/%s",
723 __entry->error,
724 show_nfsv4_errors(__entry->error),
725 MAJOR(__entry->dev), MINOR(__entry->dev),
726 (unsigned long long)__entry->olddir,
727 __get_str(oldname),
728 MAJOR(__entry->dev), MINOR(__entry->dev),
729 (unsigned long long)__entry->newdir,
730 __get_str(newname)
731 )
732);
733
Trond Myklebustc1578b72013-08-12 16:58:42 -0400734DECLARE_EVENT_CLASS(nfs4_inode_event,
735 TP_PROTO(
736 const struct inode *inode,
737 int error
738 ),
739
740 TP_ARGS(inode, error),
741
742 TP_STRUCT__entry(
743 __field(dev_t, dev)
744 __field(u32, fhandle)
745 __field(u64, fileid)
746 __field(int, error)
747 ),
748
749 TP_fast_assign(
750 __entry->dev = inode->i_sb->s_dev;
751 __entry->fileid = NFS_FILEID(inode);
752 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
753 __entry->error = error;
754 ),
755
756 TP_printk(
757 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
758 __entry->error,
759 show_nfsv4_errors(__entry->error),
760 MAJOR(__entry->dev), MINOR(__entry->dev),
761 (unsigned long long)__entry->fileid,
762 __entry->fhandle
763 )
764);
765
766#define DEFINE_NFS4_INODE_EVENT(name) \
767 DEFINE_EVENT(nfs4_inode_event, name, \
768 TP_PROTO( \
769 const struct inode *inode, \
770 int error \
771 ), \
772 TP_ARGS(inode, error))
773
774DEFINE_NFS4_INODE_EVENT(nfs4_setattr);
775DEFINE_NFS4_INODE_EVENT(nfs4_access);
776DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
777DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
778DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
779DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
780#ifdef CONFIG_NFS_V4_SECURITY_LABEL
781DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
782DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
783#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
Trond Myklebustca8acf82013-08-13 10:36:56 -0400784DEFINE_NFS4_INODE_EVENT(nfs4_recall_delegation);
785DEFINE_NFS4_INODE_EVENT(nfs4_delegreturn);
Trond Myklebustc1578b72013-08-12 16:58:42 -0400786
Trond Myklebustb5f875a2013-08-13 13:01:39 -0400787DECLARE_EVENT_CLASS(nfs4_getattr_event,
788 TP_PROTO(
789 const struct nfs_server *server,
790 const struct nfs_fh *fhandle,
791 const struct nfs_fattr *fattr,
792 int error
793 ),
794
795 TP_ARGS(server, fhandle, fattr, error),
796
797 TP_STRUCT__entry(
798 __field(dev_t, dev)
799 __field(u32, fhandle)
800 __field(u64, fileid)
801 __field(unsigned int, valid)
802 __field(int, error)
803 ),
804
805 TP_fast_assign(
806 __entry->dev = server->s_dev;
807 __entry->valid = fattr->valid;
808 __entry->fhandle = nfs_fhandle_hash(fhandle);
809 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
810 __entry->error = error;
811 ),
812
813 TP_printk(
814 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
815 "valid=%s",
816 __entry->error,
817 show_nfsv4_errors(__entry->error),
818 MAJOR(__entry->dev), MINOR(__entry->dev),
819 (unsigned long long)__entry->fileid,
820 __entry->fhandle,
821 show_nfs_fattr_flags(__entry->valid)
822 )
823);
824
825#define DEFINE_NFS4_GETATTR_EVENT(name) \
826 DEFINE_EVENT(nfs4_getattr_event, name, \
827 TP_PROTO( \
828 const struct nfs_server *server, \
829 const struct nfs_fh *fhandle, \
830 const struct nfs_fattr *fattr, \
831 int error \
832 ), \
833 TP_ARGS(server, fhandle, fattr, error))
834DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
835DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
836DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
837
Trond Myklebust1f2d30b2013-08-13 11:34:01 -0400838DECLARE_EVENT_CLASS(nfs4_idmap_event,
839 TP_PROTO(
840 const char *name,
841 int len,
842 u32 id,
843 int error
844 ),
845
846 TP_ARGS(name, len, id, error),
847
848 TP_STRUCT__entry(
849 __field(int, error)
850 __field(u32, id)
851 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
852 ),
853
854 TP_fast_assign(
855 if (len < 0)
856 len = 0;
857 __entry->error = error < 0 ? error : 0;
858 __entry->id = id;
859 memcpy(__get_dynamic_array(name), name, len);
860 ((char *)__get_dynamic_array(name))[len] = 0;
861 ),
862
863 TP_printk(
864 "error=%d id=%u name=%s",
865 __entry->error,
866 __entry->id,
867 __get_str(name)
868 )
869);
870#define DEFINE_NFS4_IDMAP_EVENT(name) \
871 DEFINE_EVENT(nfs4_idmap_event, name, \
872 TP_PROTO( \
873 const char *name, \
874 int len, \
875 u32 id, \
876 int error \
877 ), \
878 TP_ARGS(name, len, id, error))
879DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
880DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
881DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
882DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
883
Trond Myklebustcc668ab2013-08-14 15:31:28 -0400884DECLARE_EVENT_CLASS(nfs4_read_event,
885 TP_PROTO(
886 const struct nfs_read_data *data,
887 int error
888 ),
889
890 TP_ARGS(data, error),
891
892 TP_STRUCT__entry(
893 __field(dev_t, dev)
894 __field(u32, fhandle)
895 __field(u64, fileid)
896 __field(loff_t, offset)
897 __field(size_t, count)
898 __field(int, error)
899 ),
900
901 TP_fast_assign(
902 const struct inode *inode = data->header->inode;
903 __entry->dev = inode->i_sb->s_dev;
904 __entry->fileid = NFS_FILEID(inode);
905 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
906 __entry->offset = data->args.offset;
907 __entry->count = data->args.count;
908 __entry->error = error;
909 ),
910
911 TP_printk(
912 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
913 "offset=%lld count=%zu",
914 __entry->error,
915 show_nfsv4_errors(__entry->error),
916 MAJOR(__entry->dev), MINOR(__entry->dev),
917 (unsigned long long)__entry->fileid,
918 __entry->fhandle,
919 (long long)__entry->offset,
920 __entry->count
921 )
922);
923#define DEFINE_NFS4_READ_EVENT(name) \
924 DEFINE_EVENT(nfs4_read_event, name, \
925 TP_PROTO( \
926 const struct nfs_read_data *data, \
927 int error \
928 ), \
929 TP_ARGS(data, error))
930DEFINE_NFS4_READ_EVENT(nfs4_read);
931#ifdef CONFIG_NFS_V4_1
932DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
933#endif /* CONFIG_NFS_V4_1 */
934
935DECLARE_EVENT_CLASS(nfs4_write_event,
936 TP_PROTO(
937 const struct nfs_write_data *data,
938 int error
939 ),
940
941 TP_ARGS(data, error),
942
943 TP_STRUCT__entry(
944 __field(dev_t, dev)
945 __field(u32, fhandle)
946 __field(u64, fileid)
947 __field(loff_t, offset)
948 __field(size_t, count)
949 __field(int, error)
950 ),
951
952 TP_fast_assign(
953 const struct inode *inode = data->header->inode;
954 __entry->dev = inode->i_sb->s_dev;
955 __entry->fileid = NFS_FILEID(inode);
956 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
957 __entry->offset = data->args.offset;
958 __entry->count = data->args.count;
959 __entry->error = error;
960 ),
961
962 TP_printk(
963 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
964 "offset=%lld count=%zu",
965 __entry->error,
966 show_nfsv4_errors(__entry->error),
967 MAJOR(__entry->dev), MINOR(__entry->dev),
968 (unsigned long long)__entry->fileid,
969 __entry->fhandle,
970 (long long)__entry->offset,
971 __entry->count
972 )
973);
974
975#define DEFINE_NFS4_WRITE_EVENT(name) \
976 DEFINE_EVENT(nfs4_write_event, name, \
977 TP_PROTO( \
978 const struct nfs_write_data *data, \
979 int error \
980 ), \
981 TP_ARGS(data, error))
982DEFINE_NFS4_WRITE_EVENT(nfs4_write);
983#ifdef CONFIG_NFS_V4_1
984DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
985#endif /* CONFIG_NFS_V4_1 */
986
987DECLARE_EVENT_CLASS(nfs4_commit_event,
988 TP_PROTO(
989 const struct nfs_commit_data *data,
990 int error
991 ),
992
993 TP_ARGS(data, error),
994
995 TP_STRUCT__entry(
996 __field(dev_t, dev)
997 __field(u32, fhandle)
998 __field(u64, fileid)
999 __field(loff_t, offset)
1000 __field(size_t, count)
1001 __field(int, error)
1002 ),
1003
1004 TP_fast_assign(
1005 const struct inode *inode = data->inode;
1006 __entry->dev = inode->i_sb->s_dev;
1007 __entry->fileid = NFS_FILEID(inode);
1008 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1009 __entry->offset = data->args.offset;
1010 __entry->count = data->args.count;
1011 __entry->error = error;
1012 ),
1013
1014 TP_printk(
1015 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1016 "offset=%lld count=%zu",
1017 __entry->error,
1018 show_nfsv4_errors(__entry->error),
1019 MAJOR(__entry->dev), MINOR(__entry->dev),
1020 (unsigned long long)__entry->fileid,
1021 __entry->fhandle,
1022 (long long)__entry->offset,
1023 __entry->count
1024 )
1025);
1026#define DEFINE_NFS4_COMMIT_EVENT(name) \
1027 DEFINE_EVENT(nfs4_commit_event, name, \
1028 TP_PROTO( \
1029 const struct nfs_commit_data *data, \
1030 int error \
1031 ), \
1032 TP_ARGS(data, error))
1033DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1034#ifdef CONFIG_NFS_V4_1
1035DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001036
1037#define show_pnfs_iomode(iomode) \
1038 __print_symbolic(iomode, \
1039 { IOMODE_READ, "READ" }, \
1040 { IOMODE_RW, "RW" }, \
1041 { IOMODE_ANY, "ANY" })
1042
1043TRACE_EVENT(nfs4_layoutget,
1044 TP_PROTO(
1045 const struct nfs_open_context *ctx,
1046 const struct pnfs_layout_range *args,
1047 const struct pnfs_layout_range *res,
1048 int error
1049 ),
1050
1051 TP_ARGS(ctx, args, res, error),
1052
1053 TP_STRUCT__entry(
1054 __field(dev_t, dev)
1055 __field(u32, fhandle)
1056 __field(u64, fileid)
1057 __field(u32, iomode)
1058 __field(u64, offset)
1059 __field(u64, count)
1060 __field(int, error)
1061 ),
1062
1063 TP_fast_assign(
1064 const struct inode *inode = ctx->dentry->d_inode;
1065 __entry->dev = inode->i_sb->s_dev;
1066 __entry->fileid = NFS_FILEID(inode);
1067 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1068 __entry->iomode = args->iomode;
1069 __entry->offset = args->offset;
1070 __entry->count = args->length;
1071 __entry->error = error;
1072 ),
1073
1074 TP_printk(
1075 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1076 "iomode=%s offset=%llu count=%llu",
1077 __entry->error,
1078 show_nfsv4_errors(__entry->error),
1079 MAJOR(__entry->dev), MINOR(__entry->dev),
1080 (unsigned long long)__entry->fileid,
1081 __entry->fhandle,
1082 show_pnfs_iomode(__entry->iomode),
1083 (unsigned long long)__entry->offset,
1084 (unsigned long long)__entry->count
1085 )
1086);
1087
1088DEFINE_NFS4_INODE_EVENT(nfs4_layoutcommit);
1089DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn);
1090
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001091#endif /* CONFIG_NFS_V4_1 */
1092
Trond Myklebustc6d01c62013-08-09 11:51:26 -04001093#endif /* _TRACE_NFS4_H */
1094
1095#undef TRACE_INCLUDE_PATH
1096#define TRACE_INCLUDE_PATH .
1097#define TRACE_INCLUDE_FILE nfs4trace
1098/* This part must be outside protection */
1099#include <trace/define_trace.h>