blob: 9058aecc248efef030ca37ccf9ae85943a8ffb7e [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)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500402 __field(int, stateid_seq)
403 __field(u32, stateid_hash)
404 __field(int, openstateid_seq)
405 __field(u32, openstateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400406 ),
407
408 TP_fast_assign(
409 const struct nfs4_state *state = ctx->state;
410 const struct inode *inode = NULL;
411
412 __entry->error = error;
413 __entry->flags = flags;
414 __entry->fmode = (__force unsigned int)ctx->mode;
415 __entry->dev = ctx->dentry->d_sb->s_dev;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500416 if (!IS_ERR_OR_NULL(state)) {
Trond Myklebust42113a72013-08-12 16:19:27 -0400417 inode = state->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500418 __entry->stateid_seq =
419 be32_to_cpu(state->stateid.seqid);
420 __entry->stateid_hash =
421 nfs_stateid_hash(&state->stateid);
422 __entry->openstateid_seq =
423 be32_to_cpu(state->open_stateid.seqid);
424 __entry->openstateid_hash =
425 nfs_stateid_hash(&state->open_stateid);
426 } else {
427 __entry->stateid_seq = 0;
428 __entry->stateid_hash = 0;
429 __entry->openstateid_seq = 0;
430 __entry->openstateid_hash = 0;
431 }
Trond Myklebust42113a72013-08-12 16:19:27 -0400432 if (inode != NULL) {
433 __entry->fileid = NFS_FILEID(inode);
434 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
435 } else {
436 __entry->fileid = 0;
437 __entry->fhandle = 0;
438 }
David Howells2b0143b2015-03-17 22:25:59 +0000439 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
Trond Myklebust42113a72013-08-12 16:19:27 -0400440 __assign_str(name, ctx->dentry->d_name.name);
441 ),
442
443 TP_printk(
444 "error=%d (%s) flags=%d (%s) fmode=%s "
445 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500446 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
447 "openstateid=%d:0x%08x",
Trond Myklebust42113a72013-08-12 16:19:27 -0400448 __entry->error,
449 show_nfsv4_errors(__entry->error),
450 __entry->flags,
451 show_open_flags(__entry->flags),
452 show_fmode_flags(__entry->fmode),
453 MAJOR(__entry->dev), MINOR(__entry->dev),
454 (unsigned long long)__entry->fileid,
455 __entry->fhandle,
456 MAJOR(__entry->dev), MINOR(__entry->dev),
457 (unsigned long long)__entry->dir,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500458 __get_str(name),
459 __entry->stateid_seq, __entry->stateid_hash,
460 __entry->openstateid_seq, __entry->openstateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400461 )
462);
463
464#define DEFINE_NFS4_OPEN_EVENT(name) \
465 DEFINE_EVENT(nfs4_open_event, name, \
466 TP_PROTO( \
467 const struct nfs_open_context *ctx, \
468 int flags, \
469 int error \
470 ), \
471 TP_ARGS(ctx, flags, error))
472DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
473DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
474DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
475
476TRACE_EVENT(nfs4_close,
477 TP_PROTO(
478 const struct nfs4_state *state,
479 const struct nfs_closeargs *args,
480 const struct nfs_closeres *res,
481 int error
482 ),
483
484 TP_ARGS(state, args, res, error),
485
486 TP_STRUCT__entry(
487 __field(dev_t, dev)
488 __field(u32, fhandle)
489 __field(u64, fileid)
490 __field(unsigned int, fmode)
491 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500492 __field(int, stateid_seq)
493 __field(u32, stateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400494 ),
495
496 TP_fast_assign(
497 const struct inode *inode = state->inode;
498
499 __entry->dev = inode->i_sb->s_dev;
500 __entry->fileid = NFS_FILEID(inode);
501 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
502 __entry->fmode = (__force unsigned int)state->state;
503 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500504 __entry->stateid_seq =
505 be32_to_cpu(args->stateid.seqid);
506 __entry->stateid_hash =
507 nfs_stateid_hash(&args->stateid);
Trond Myklebust42113a72013-08-12 16:19:27 -0400508 ),
509
510 TP_printk(
511 "error=%d (%s) fmode=%s fileid=%02x:%02x:%llu "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500512 "fhandle=0x%08x openstateid=%d:0x%08x",
Trond Myklebust42113a72013-08-12 16:19:27 -0400513 __entry->error,
514 show_nfsv4_errors(__entry->error),
515 __entry->fmode ? show_fmode_flags(__entry->fmode) :
516 "closed",
517 MAJOR(__entry->dev), MINOR(__entry->dev),
518 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500519 __entry->fhandle,
520 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400521 )
522);
523
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400524#define show_lock_cmd(type) \
525 __print_symbolic((int)type, \
526 { F_GETLK, "GETLK" }, \
527 { F_SETLK, "SETLK" }, \
528 { F_SETLKW, "SETLKW" })
529#define show_lock_type(type) \
530 __print_symbolic((int)type, \
531 { F_RDLCK, "RDLCK" }, \
532 { F_WRLCK, "WRLCK" }, \
533 { F_UNLCK, "UNLCK" })
534
535DECLARE_EVENT_CLASS(nfs4_lock_event,
536 TP_PROTO(
537 const struct file_lock *request,
538 const struct nfs4_state *state,
539 int cmd,
540 int error
541 ),
542
543 TP_ARGS(request, state, cmd, error),
544
545 TP_STRUCT__entry(
546 __field(int, error)
547 __field(int, cmd)
548 __field(char, type)
549 __field(loff_t, start)
550 __field(loff_t, end)
551 __field(dev_t, dev)
552 __field(u32, fhandle)
553 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500554 __field(int, stateid_seq)
555 __field(u32, stateid_hash)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400556 ),
557
558 TP_fast_assign(
559 const struct inode *inode = state->inode;
560
561 __entry->error = error;
562 __entry->cmd = cmd;
563 __entry->type = request->fl_type;
564 __entry->start = request->fl_start;
565 __entry->end = request->fl_end;
566 __entry->dev = inode->i_sb->s_dev;
567 __entry->fileid = NFS_FILEID(inode);
568 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500569 __entry->stateid_seq =
570 be32_to_cpu(state->stateid.seqid);
571 __entry->stateid_hash =
572 nfs_stateid_hash(&state->stateid);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400573 ),
574
575 TP_printk(
576 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500577 "fileid=%02x:%02x:%llu fhandle=0x%08x "
578 "stateid=%d:0x%08x",
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400579 __entry->error,
580 show_nfsv4_errors(__entry->error),
581 show_lock_cmd(__entry->cmd),
582 show_lock_type(__entry->type),
583 (long long)__entry->start,
584 (long long)__entry->end,
585 MAJOR(__entry->dev), MINOR(__entry->dev),
586 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500587 __entry->fhandle,
588 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400589 )
590);
591
592#define DEFINE_NFS4_LOCK_EVENT(name) \
593 DEFINE_EVENT(nfs4_lock_event, name, \
594 TP_PROTO( \
595 const struct file_lock *request, \
596 const struct nfs4_state *state, \
597 int cmd, \
598 int error \
599 ), \
600 TP_ARGS(request, state, cmd, error))
601DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400602DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
603
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500604TRACE_EVENT(nfs4_set_lock,
605 TP_PROTO(
606 const struct file_lock *request,
607 const struct nfs4_state *state,
608 const nfs4_stateid *lockstateid,
609 int cmd,
610 int error
611 ),
612
613 TP_ARGS(request, state, lockstateid, cmd, error),
614
615 TP_STRUCT__entry(
616 __field(int, error)
617 __field(int, cmd)
618 __field(char, type)
619 __field(loff_t, start)
620 __field(loff_t, end)
621 __field(dev_t, dev)
622 __field(u32, fhandle)
623 __field(u64, fileid)
624 __field(int, stateid_seq)
625 __field(u32, stateid_hash)
626 __field(int, lockstateid_seq)
627 __field(u32, lockstateid_hash)
628 ),
629
630 TP_fast_assign(
631 const struct inode *inode = state->inode;
632
633 __entry->error = error;
634 __entry->cmd = cmd;
635 __entry->type = request->fl_type;
636 __entry->start = request->fl_start;
637 __entry->end = request->fl_end;
638 __entry->dev = inode->i_sb->s_dev;
639 __entry->fileid = NFS_FILEID(inode);
640 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
641 __entry->stateid_seq =
642 be32_to_cpu(state->stateid.seqid);
643 __entry->stateid_hash =
644 nfs_stateid_hash(&state->stateid);
645 __entry->lockstateid_seq =
646 be32_to_cpu(lockstateid->seqid);
647 __entry->lockstateid_hash =
648 nfs_stateid_hash(lockstateid);
649 ),
650
651 TP_printk(
652 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
653 "fileid=%02x:%02x:%llu fhandle=0x%08x "
654 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
655 __entry->error,
656 show_nfsv4_errors(__entry->error),
657 show_lock_cmd(__entry->cmd),
658 show_lock_type(__entry->type),
659 (long long)__entry->start,
660 (long long)__entry->end,
661 MAJOR(__entry->dev), MINOR(__entry->dev),
662 (unsigned long long)__entry->fileid,
663 __entry->fhandle,
664 __entry->stateid_seq, __entry->stateid_hash,
665 __entry->lockstateid_seq, __entry->lockstateid_hash
666 )
667);
668
Trond Myklebustca8acf82013-08-13 10:36:56 -0400669DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
670 TP_PROTO(
671 const struct inode *inode,
672 fmode_t fmode
673 ),
674
675 TP_ARGS(inode, fmode),
676
677 TP_STRUCT__entry(
678 __field(dev_t, dev)
679 __field(u32, fhandle)
680 __field(u64, fileid)
681 __field(unsigned int, fmode)
682 ),
683
684 TP_fast_assign(
685 __entry->dev = inode->i_sb->s_dev;
686 __entry->fileid = NFS_FILEID(inode);
687 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
688 __entry->fmode = (__force unsigned int)fmode;
689 ),
690
691 TP_printk(
692 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
693 show_fmode_flags(__entry->fmode),
694 MAJOR(__entry->dev), MINOR(__entry->dev),
695 (unsigned long long)__entry->fileid,
696 __entry->fhandle
697 )
698);
699#define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
700 DEFINE_EVENT(nfs4_set_delegation_event, name, \
701 TP_PROTO( \
702 const struct inode *inode, \
703 fmode_t fmode \
704 ), \
705 TP_ARGS(inode, fmode))
706DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
707DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
708
709TRACE_EVENT(nfs4_delegreturn_exit,
710 TP_PROTO(
711 const struct nfs4_delegreturnargs *args,
712 const struct nfs4_delegreturnres *res,
713 int error
714 ),
715
716 TP_ARGS(args, res, error),
717
718 TP_STRUCT__entry(
719 __field(dev_t, dev)
720 __field(u32, fhandle)
721 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500722 __field(int, stateid_seq)
723 __field(u32, stateid_hash)
Trond Myklebustca8acf82013-08-13 10:36:56 -0400724 ),
725
726 TP_fast_assign(
727 __entry->dev = res->server->s_dev;
728 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
729 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500730 __entry->stateid_seq =
731 be32_to_cpu(args->stateid->seqid);
732 __entry->stateid_hash =
733 nfs_stateid_hash(args->stateid);
Trond Myklebustca8acf82013-08-13 10:36:56 -0400734 ),
735
736 TP_printk(
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500737 "error=%d (%s) dev=%02x:%02x fhandle=0x%08x "
738 "stateid=%d:0x%08x",
Trond Myklebustca8acf82013-08-13 10:36:56 -0400739 __entry->error,
740 show_nfsv4_errors(__entry->error),
741 MAJOR(__entry->dev), MINOR(__entry->dev),
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500742 __entry->fhandle,
743 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustca8acf82013-08-13 10:36:56 -0400744 )
745);
746
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400747#ifdef CONFIG_NFS_V4_1
748DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
749 TP_PROTO(
750 const struct nfs4_state *state,
751 const struct nfs4_lock_state *lsp,
752 int error
753 ),
754
755 TP_ARGS(state, lsp, error),
756
757 TP_STRUCT__entry(
758 __field(int, error)
759 __field(dev_t, dev)
760 __field(u32, fhandle)
761 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500762 __field(int, stateid_seq)
763 __field(u32, stateid_hash)
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400764 ),
765
766 TP_fast_assign(
767 const struct inode *inode = state->inode;
768
769 __entry->error = error;
770 __entry->dev = inode->i_sb->s_dev;
771 __entry->fileid = NFS_FILEID(inode);
772 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500773 __entry->stateid_seq =
774 be32_to_cpu(state->stateid.seqid);
775 __entry->stateid_hash =
776 nfs_stateid_hash(&state->stateid);
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400777 ),
778
779 TP_printk(
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500780 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
781 "stateid=%d:0x%08x",
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400782 __entry->error,
783 show_nfsv4_errors(__entry->error),
784 MAJOR(__entry->dev), MINOR(__entry->dev),
785 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500786 __entry->fhandle,
787 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400788 )
789);
790
791#define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
792 DEFINE_EVENT(nfs4_test_stateid_event, name, \
793 TP_PROTO( \
794 const struct nfs4_state *state, \
795 const struct nfs4_lock_state *lsp, \
796 int error \
797 ), \
798 TP_ARGS(state, lsp, error))
799DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
800DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
801DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
802#endif /* CONFIG_NFS_V4_1 */
803
Trond Myklebust078ea3d2013-08-12 16:45:55 -0400804DECLARE_EVENT_CLASS(nfs4_lookup_event,
805 TP_PROTO(
806 const struct inode *dir,
807 const struct qstr *name,
808 int error
809 ),
810
811 TP_ARGS(dir, name, error),
812
813 TP_STRUCT__entry(
814 __field(dev_t, dev)
815 __field(int, error)
816 __field(u64, dir)
817 __string(name, name->name)
818 ),
819
820 TP_fast_assign(
821 __entry->dev = dir->i_sb->s_dev;
822 __entry->dir = NFS_FILEID(dir);
823 __entry->error = error;
824 __assign_str(name, name->name);
825 ),
826
827 TP_printk(
828 "error=%d (%s) name=%02x:%02x:%llu/%s",
829 __entry->error,
830 show_nfsv4_errors(__entry->error),
831 MAJOR(__entry->dev), MINOR(__entry->dev),
832 (unsigned long long)__entry->dir,
833 __get_str(name)
834 )
835);
836
837#define DEFINE_NFS4_LOOKUP_EVENT(name) \
838 DEFINE_EVENT(nfs4_lookup_event, name, \
839 TP_PROTO( \
840 const struct inode *dir, \
841 const struct qstr *name, \
842 int error \
843 ), \
844 TP_ARGS(dir, name, error))
845
846DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
847DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
848DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
849DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
850DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
851DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
852DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
853
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -0400854TRACE_EVENT(nfs4_rename,
855 TP_PROTO(
856 const struct inode *olddir,
857 const struct qstr *oldname,
858 const struct inode *newdir,
859 const struct qstr *newname,
860 int error
861 ),
862
863 TP_ARGS(olddir, oldname, newdir, newname, error),
864
865 TP_STRUCT__entry(
866 __field(dev_t, dev)
867 __field(int, error)
868 __field(u64, olddir)
869 __string(oldname, oldname->name)
870 __field(u64, newdir)
871 __string(newname, newname->name)
872 ),
873
874 TP_fast_assign(
875 __entry->dev = olddir->i_sb->s_dev;
876 __entry->olddir = NFS_FILEID(olddir);
877 __entry->newdir = NFS_FILEID(newdir);
878 __entry->error = error;
879 __assign_str(oldname, oldname->name);
880 __assign_str(newname, newname->name);
881 ),
882
883 TP_printk(
884 "error=%d (%s) oldname=%02x:%02x:%llu/%s "
885 "newname=%02x:%02x:%llu/%s",
886 __entry->error,
887 show_nfsv4_errors(__entry->error),
888 MAJOR(__entry->dev), MINOR(__entry->dev),
889 (unsigned long long)__entry->olddir,
890 __get_str(oldname),
891 MAJOR(__entry->dev), MINOR(__entry->dev),
892 (unsigned long long)__entry->newdir,
893 __get_str(newname)
894 )
895);
896
Trond Myklebustc1578b72013-08-12 16:58:42 -0400897DECLARE_EVENT_CLASS(nfs4_inode_event,
898 TP_PROTO(
899 const struct inode *inode,
900 int error
901 ),
902
903 TP_ARGS(inode, error),
904
905 TP_STRUCT__entry(
906 __field(dev_t, dev)
907 __field(u32, fhandle)
908 __field(u64, fileid)
909 __field(int, error)
910 ),
911
912 TP_fast_assign(
913 __entry->dev = inode->i_sb->s_dev;
914 __entry->fileid = NFS_FILEID(inode);
915 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
916 __entry->error = error;
917 ),
918
919 TP_printk(
920 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
921 __entry->error,
922 show_nfsv4_errors(__entry->error),
923 MAJOR(__entry->dev), MINOR(__entry->dev),
924 (unsigned long long)__entry->fileid,
925 __entry->fhandle
926 )
927);
928
929#define DEFINE_NFS4_INODE_EVENT(name) \
930 DEFINE_EVENT(nfs4_inode_event, name, \
931 TP_PROTO( \
932 const struct inode *inode, \
933 int error \
934 ), \
935 TP_ARGS(inode, error))
936
Trond Myklebustc1578b72013-08-12 16:58:42 -0400937DEFINE_NFS4_INODE_EVENT(nfs4_access);
938DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
939DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
940DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
941DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
942#ifdef CONFIG_NFS_V4_SECURITY_LABEL
943DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
944DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
945#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
Trond Myklebustca8acf82013-08-13 10:36:56 -0400946DEFINE_NFS4_INODE_EVENT(nfs4_recall_delegation);
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500947
948DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
949 TP_PROTO(
950 const struct inode *inode,
951 const nfs4_stateid *stateid,
952 int error
953 ),
954
955 TP_ARGS(inode, stateid, error),
956
957 TP_STRUCT__entry(
958 __field(dev_t, dev)
959 __field(u32, fhandle)
960 __field(u64, fileid)
961 __field(int, error)
962 __field(int, stateid_seq)
963 __field(u32, stateid_hash)
964 ),
965
966 TP_fast_assign(
967 __entry->dev = inode->i_sb->s_dev;
968 __entry->fileid = NFS_FILEID(inode);
969 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
970 __entry->error = error;
971 __entry->stateid_seq =
972 be32_to_cpu(stateid->seqid);
973 __entry->stateid_hash =
974 nfs_stateid_hash(stateid);
975 ),
976
977 TP_printk(
978 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
979 "stateid=%d:0x%08x",
980 __entry->error,
981 show_nfsv4_errors(__entry->error),
982 MAJOR(__entry->dev), MINOR(__entry->dev),
983 (unsigned long long)__entry->fileid,
984 __entry->fhandle,
985 __entry->stateid_seq, __entry->stateid_hash
986 )
987);
988
989#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
990 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
991 TP_PROTO( \
992 const struct inode *inode, \
993 const nfs4_stateid *stateid, \
994 int error \
995 ), \
996 TP_ARGS(inode, stateid, error))
997
998DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
999DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
Trond Myklebustc1578b72013-08-12 16:58:42 -04001000
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001001DECLARE_EVENT_CLASS(nfs4_getattr_event,
1002 TP_PROTO(
1003 const struct nfs_server *server,
1004 const struct nfs_fh *fhandle,
1005 const struct nfs_fattr *fattr,
1006 int error
1007 ),
1008
1009 TP_ARGS(server, fhandle, fattr, error),
1010
1011 TP_STRUCT__entry(
1012 __field(dev_t, dev)
1013 __field(u32, fhandle)
1014 __field(u64, fileid)
1015 __field(unsigned int, valid)
1016 __field(int, error)
1017 ),
1018
1019 TP_fast_assign(
1020 __entry->dev = server->s_dev;
1021 __entry->valid = fattr->valid;
1022 __entry->fhandle = nfs_fhandle_hash(fhandle);
1023 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
1024 __entry->error = error;
1025 ),
1026
1027 TP_printk(
1028 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1029 "valid=%s",
1030 __entry->error,
1031 show_nfsv4_errors(__entry->error),
1032 MAJOR(__entry->dev), MINOR(__entry->dev),
1033 (unsigned long long)__entry->fileid,
1034 __entry->fhandle,
1035 show_nfs_fattr_flags(__entry->valid)
1036 )
1037);
1038
1039#define DEFINE_NFS4_GETATTR_EVENT(name) \
1040 DEFINE_EVENT(nfs4_getattr_event, name, \
1041 TP_PROTO( \
1042 const struct nfs_server *server, \
1043 const struct nfs_fh *fhandle, \
1044 const struct nfs_fattr *fattr, \
1045 int error \
1046 ), \
1047 TP_ARGS(server, fhandle, fattr, error))
1048DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1049DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1050DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1051
Trond Myklebust7cd14862015-08-20 20:07:54 -05001052DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1053 TP_PROTO(
1054 const struct nfs_client *clp,
1055 const struct nfs_fh *fhandle,
1056 const struct inode *inode,
1057 int error
1058 ),
1059
1060 TP_ARGS(clp, fhandle, inode, error),
1061
1062 TP_STRUCT__entry(
1063 __field(int, error)
1064 __field(dev_t, dev)
1065 __field(u32, fhandle)
1066 __field(u64, fileid)
1067 __string(dstaddr, clp ?
1068 rpc_peeraddr2str(clp->cl_rpcclient,
1069 RPC_DISPLAY_ADDR) : "unknown")
1070 ),
1071
1072 TP_fast_assign(
1073 __entry->error = error;
1074 __entry->fhandle = nfs_fhandle_hash(fhandle);
1075 if (inode != NULL) {
1076 __entry->fileid = NFS_FILEID(inode);
1077 __entry->dev = inode->i_sb->s_dev;
1078 } else {
1079 __entry->fileid = 0;
1080 __entry->dev = 0;
1081 }
1082 __assign_str(dstaddr, clp ?
1083 rpc_peeraddr2str(clp->cl_rpcclient,
1084 RPC_DISPLAY_ADDR) : "unknown")
1085 ),
1086
1087 TP_printk(
1088 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1089 "dstaddr=%s",
1090 __entry->error,
1091 show_nfsv4_errors(__entry->error),
1092 MAJOR(__entry->dev), MINOR(__entry->dev),
1093 (unsigned long long)__entry->fileid,
1094 __entry->fhandle,
1095 __get_str(dstaddr)
1096 )
1097);
1098
1099#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1100 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1101 TP_PROTO( \
1102 const struct nfs_client *clp, \
1103 const struct nfs_fh *fhandle, \
1104 const struct inode *inode, \
1105 int error \
1106 ), \
1107 TP_ARGS(clp, fhandle, inode, error))
1108DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
Trond Myklebust249b2ee2015-08-20 20:43:14 -05001109DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_layoutrecall_inode);
Trond Myklebust7cd14862015-08-20 20:07:54 -05001110
1111
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001112DECLARE_EVENT_CLASS(nfs4_idmap_event,
1113 TP_PROTO(
1114 const char *name,
1115 int len,
1116 u32 id,
1117 int error
1118 ),
1119
1120 TP_ARGS(name, len, id, error),
1121
1122 TP_STRUCT__entry(
1123 __field(int, error)
1124 __field(u32, id)
1125 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1126 ),
1127
1128 TP_fast_assign(
1129 if (len < 0)
1130 len = 0;
1131 __entry->error = error < 0 ? error : 0;
1132 __entry->id = id;
1133 memcpy(__get_dynamic_array(name), name, len);
1134 ((char *)__get_dynamic_array(name))[len] = 0;
1135 ),
1136
1137 TP_printk(
1138 "error=%d id=%u name=%s",
1139 __entry->error,
1140 __entry->id,
1141 __get_str(name)
1142 )
1143);
1144#define DEFINE_NFS4_IDMAP_EVENT(name) \
1145 DEFINE_EVENT(nfs4_idmap_event, name, \
1146 TP_PROTO( \
1147 const char *name, \
1148 int len, \
1149 u32 id, \
1150 int error \
1151 ), \
1152 TP_ARGS(name, len, id, error))
1153DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1154DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1155DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1156DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1157
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001158DECLARE_EVENT_CLASS(nfs4_read_event,
1159 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001160 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001161 int error
1162 ),
1163
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001164 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001165
1166 TP_STRUCT__entry(
1167 __field(dev_t, dev)
1168 __field(u32, fhandle)
1169 __field(u64, fileid)
1170 __field(loff_t, offset)
1171 __field(size_t, count)
1172 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001173 __field(int, stateid_seq)
1174 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001175 ),
1176
1177 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001178 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001179 const struct nfs4_state *state =
1180 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001181 __entry->dev = inode->i_sb->s_dev;
1182 __entry->fileid = NFS_FILEID(inode);
1183 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001184 __entry->offset = hdr->args.offset;
1185 __entry->count = hdr->args.count;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001186 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001187 __entry->stateid_seq =
1188 be32_to_cpu(state->stateid.seqid);
1189 __entry->stateid_hash =
1190 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001191 ),
1192
1193 TP_printk(
1194 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001195 "offset=%lld count=%zu stateid=%d:0x%08x",
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001196 __entry->error,
1197 show_nfsv4_errors(__entry->error),
1198 MAJOR(__entry->dev), MINOR(__entry->dev),
1199 (unsigned long long)__entry->fileid,
1200 __entry->fhandle,
1201 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001202 __entry->count,
1203 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001204 )
1205);
1206#define DEFINE_NFS4_READ_EVENT(name) \
1207 DEFINE_EVENT(nfs4_read_event, name, \
1208 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001209 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001210 int error \
1211 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001212 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001213DEFINE_NFS4_READ_EVENT(nfs4_read);
1214#ifdef CONFIG_NFS_V4_1
1215DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1216#endif /* CONFIG_NFS_V4_1 */
1217
1218DECLARE_EVENT_CLASS(nfs4_write_event,
1219 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001220 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001221 int error
1222 ),
1223
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001224 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001225
1226 TP_STRUCT__entry(
1227 __field(dev_t, dev)
1228 __field(u32, fhandle)
1229 __field(u64, fileid)
1230 __field(loff_t, offset)
1231 __field(size_t, count)
1232 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001233 __field(int, stateid_seq)
1234 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001235 ),
1236
1237 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001238 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001239 const struct nfs4_state *state =
1240 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001241 __entry->dev = inode->i_sb->s_dev;
1242 __entry->fileid = NFS_FILEID(inode);
1243 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001244 __entry->offset = hdr->args.offset;
1245 __entry->count = hdr->args.count;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001246 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001247 __entry->stateid_seq =
1248 be32_to_cpu(state->stateid.seqid);
1249 __entry->stateid_hash =
1250 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001251 ),
1252
1253 TP_printk(
1254 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001255 "offset=%lld count=%zu stateid=%d:0x%08x",
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001256 __entry->error,
1257 show_nfsv4_errors(__entry->error),
1258 MAJOR(__entry->dev), MINOR(__entry->dev),
1259 (unsigned long long)__entry->fileid,
1260 __entry->fhandle,
1261 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001262 __entry->count,
1263 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001264 )
1265);
1266
1267#define DEFINE_NFS4_WRITE_EVENT(name) \
1268 DEFINE_EVENT(nfs4_write_event, name, \
1269 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001270 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001271 int error \
1272 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001273 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001274DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1275#ifdef CONFIG_NFS_V4_1
1276DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1277#endif /* CONFIG_NFS_V4_1 */
1278
1279DECLARE_EVENT_CLASS(nfs4_commit_event,
1280 TP_PROTO(
1281 const struct nfs_commit_data *data,
1282 int error
1283 ),
1284
1285 TP_ARGS(data, error),
1286
1287 TP_STRUCT__entry(
1288 __field(dev_t, dev)
1289 __field(u32, fhandle)
1290 __field(u64, fileid)
1291 __field(loff_t, offset)
1292 __field(size_t, count)
1293 __field(int, error)
1294 ),
1295
1296 TP_fast_assign(
1297 const struct inode *inode = data->inode;
1298 __entry->dev = inode->i_sb->s_dev;
1299 __entry->fileid = NFS_FILEID(inode);
1300 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1301 __entry->offset = data->args.offset;
1302 __entry->count = data->args.count;
1303 __entry->error = error;
1304 ),
1305
1306 TP_printk(
1307 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1308 "offset=%lld count=%zu",
1309 __entry->error,
1310 show_nfsv4_errors(__entry->error),
1311 MAJOR(__entry->dev), MINOR(__entry->dev),
1312 (unsigned long long)__entry->fileid,
1313 __entry->fhandle,
1314 (long long)__entry->offset,
1315 __entry->count
1316 )
1317);
1318#define DEFINE_NFS4_COMMIT_EVENT(name) \
1319 DEFINE_EVENT(nfs4_commit_event, name, \
1320 TP_PROTO( \
1321 const struct nfs_commit_data *data, \
1322 int error \
1323 ), \
1324 TP_ARGS(data, error))
1325DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1326#ifdef CONFIG_NFS_V4_1
1327DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001328
1329#define show_pnfs_iomode(iomode) \
1330 __print_symbolic(iomode, \
1331 { IOMODE_READ, "READ" }, \
1332 { IOMODE_RW, "RW" }, \
1333 { IOMODE_ANY, "ANY" })
1334
1335TRACE_EVENT(nfs4_layoutget,
1336 TP_PROTO(
1337 const struct nfs_open_context *ctx,
1338 const struct pnfs_layout_range *args,
1339 const struct pnfs_layout_range *res,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001340 const nfs4_stateid *layout_stateid,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001341 int error
1342 ),
1343
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001344 TP_ARGS(ctx, args, res, layout_stateid, error),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001345
1346 TP_STRUCT__entry(
1347 __field(dev_t, dev)
1348 __field(u32, fhandle)
1349 __field(u64, fileid)
1350 __field(u32, iomode)
1351 __field(u64, offset)
1352 __field(u64, count)
1353 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001354 __field(int, stateid_seq)
1355 __field(u32, stateid_hash)
1356 __field(int, layoutstateid_seq)
1357 __field(u32, layoutstateid_hash)
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001358 ),
1359
1360 TP_fast_assign(
David Howells2b0143b2015-03-17 22:25:59 +00001361 const struct inode *inode = d_inode(ctx->dentry);
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001362 const struct nfs4_state *state = ctx->state;
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001363 __entry->dev = inode->i_sb->s_dev;
1364 __entry->fileid = NFS_FILEID(inode);
1365 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1366 __entry->iomode = args->iomode;
1367 __entry->offset = args->offset;
1368 __entry->count = args->length;
1369 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001370 __entry->stateid_seq =
1371 be32_to_cpu(state->stateid.seqid);
1372 __entry->stateid_hash =
1373 nfs_stateid_hash(&state->stateid);
1374 if (!error) {
1375 __entry->layoutstateid_seq =
1376 be32_to_cpu(layout_stateid->seqid);
1377 __entry->layoutstateid_hash =
1378 nfs_stateid_hash(layout_stateid);
1379 } else {
1380 __entry->layoutstateid_seq = 0;
1381 __entry->layoutstateid_hash = 0;
1382 }
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001383 ),
1384
1385 TP_printk(
1386 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001387 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1388 "layoutstateid=%d:0x%08x",
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001389 __entry->error,
1390 show_nfsv4_errors(__entry->error),
1391 MAJOR(__entry->dev), MINOR(__entry->dev),
1392 (unsigned long long)__entry->fileid,
1393 __entry->fhandle,
1394 show_pnfs_iomode(__entry->iomode),
1395 (unsigned long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001396 (unsigned long long)__entry->count,
1397 __entry->stateid_seq, __entry->stateid_hash,
1398 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001399 )
1400);
1401
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001402DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1403DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
Trond Myklebust6a463beb2015-08-20 15:40:47 -05001404DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001405
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001406#endif /* CONFIG_NFS_V4_1 */
1407
Trond Myklebustc6d01c62013-08-09 11:51:26 -04001408#endif /* _TRACE_NFS4_H */
1409
1410#undef TRACE_INCLUDE_PATH
1411#define TRACE_INCLUDE_PATH .
1412#define TRACE_INCLUDE_FILE nfs4trace
1413/* This part must be outside protection */
1414#include <trace/define_trace.h>