blob: 20cd8500452a922cf9bc88d548a30baef64bc51c [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(
Anna Schumaker8fb42f72017-11-01 15:48:43 -0400204 __string(dstaddr, clp->cl_hostname)
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400205 __field(int, error)
206 ),
207
208 TP_fast_assign(
209 __entry->error = error;
Anna Schumaker8fb42f72017-11-01 15:48:43 -0400210 __assign_str(dstaddr, clp->cl_hostname);
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400211 ),
212
213 TP_printk(
214 "error=%d (%s) dstaddr=%s",
215 __entry->error,
216 show_nfsv4_errors(__entry->error),
217 __get_str(dstaddr)
218 )
219);
220#define DEFINE_NFS4_CLIENTID_EVENT(name) \
221 DEFINE_EVENT(nfs4_clientid_event, name, \
222 TP_PROTO( \
223 const struct nfs_client *clp, \
224 int error \
225 ), \
226 TP_ARGS(clp, error))
227DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
228DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
229DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
230DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
231#ifdef CONFIG_NFS_V4_1
232DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
233DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
234DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
235DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
236DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
237DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
238DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400239
240TRACE_EVENT(nfs4_setup_sequence,
241 TP_PROTO(
242 const struct nfs4_session *session,
243 const struct nfs4_sequence_args *args
244 ),
245 TP_ARGS(session, args),
246
247 TP_STRUCT__entry(
248 __field(unsigned int, session)
249 __field(unsigned int, slot_nr)
250 __field(unsigned int, seq_nr)
251 __field(unsigned int, highest_used_slotid)
252 ),
253
254 TP_fast_assign(
255 const struct nfs4_slot *sa_slot = args->sa_slot;
256 __entry->session = nfs_session_id_hash(&session->sess_id);
257 __entry->slot_nr = sa_slot->slot_nr;
258 __entry->seq_nr = sa_slot->seq_nr;
259 __entry->highest_used_slotid =
260 sa_slot->table->highest_used_slotid;
261 ),
262 TP_printk(
263 "session=0x%08x slot_nr=%u seq_nr=%u "
264 "highest_used_slotid=%u",
265 __entry->session,
266 __entry->slot_nr,
267 __entry->seq_nr,
268 __entry->highest_used_slotid
269 )
270);
271
272#define show_nfs4_sequence_status_flags(status) \
273 __print_flags((unsigned long)status, "|", \
274 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
275 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
276 "CB_GSS_CONTEXTS_EXPIRING" }, \
277 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
278 "CB_GSS_CONTEXTS_EXPIRED" }, \
279 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
280 "EXPIRED_ALL_STATE_REVOKED" }, \
281 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
282 "EXPIRED_SOME_STATE_REVOKED" }, \
283 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
284 "ADMIN_STATE_REVOKED" }, \
285 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
286 "RECALLABLE_STATE_REVOKED" }, \
287 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
288 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
289 "RESTART_RECLAIM_NEEDED" }, \
290 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
291 "CB_PATH_DOWN_SESSION" }, \
292 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
293 "BACKCHANNEL_FAULT" })
294
295TRACE_EVENT(nfs4_sequence_done,
296 TP_PROTO(
297 const struct nfs4_session *session,
298 const struct nfs4_sequence_res *res
299 ),
300 TP_ARGS(session, res),
301
302 TP_STRUCT__entry(
303 __field(unsigned int, session)
304 __field(unsigned int, slot_nr)
305 __field(unsigned int, seq_nr)
306 __field(unsigned int, highest_slotid)
307 __field(unsigned int, target_highest_slotid)
308 __field(unsigned int, status_flags)
309 __field(int, error)
310 ),
311
312 TP_fast_assign(
313 const struct nfs4_slot *sr_slot = res->sr_slot;
314 __entry->session = nfs_session_id_hash(&session->sess_id);
315 __entry->slot_nr = sr_slot->slot_nr;
316 __entry->seq_nr = sr_slot->seq_nr;
317 __entry->highest_slotid = res->sr_highest_slotid;
318 __entry->target_highest_slotid =
319 res->sr_target_highest_slotid;
Andrew Elble52618df2015-12-02 09:19:43 -0500320 __entry->status_flags = res->sr_status_flags;
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400321 __entry->error = res->sr_status;
322 ),
323 TP_printk(
324 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
325 "highest_slotid=%u target_highest_slotid=%u "
326 "status_flags=%u (%s)",
327 __entry->error,
328 show_nfsv4_errors(__entry->error),
329 __entry->session,
330 __entry->slot_nr,
331 __entry->seq_nr,
332 __entry->highest_slotid,
333 __entry->target_highest_slotid,
334 __entry->status_flags,
335 show_nfs4_sequence_status_flags(__entry->status_flags)
336 )
337);
338
339struct cb_sequenceargs;
340struct cb_sequenceres;
341
342TRACE_EVENT(nfs4_cb_sequence,
343 TP_PROTO(
344 const struct cb_sequenceargs *args,
345 const struct cb_sequenceres *res,
346 __be32 status
347 ),
348 TP_ARGS(args, res, status),
349
350 TP_STRUCT__entry(
351 __field(unsigned int, session)
352 __field(unsigned int, slot_nr)
353 __field(unsigned int, seq_nr)
354 __field(unsigned int, highest_slotid)
355 __field(unsigned int, cachethis)
356 __field(int, error)
357 ),
358
359 TP_fast_assign(
360 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
361 __entry->slot_nr = args->csa_slotid;
362 __entry->seq_nr = args->csa_sequenceid;
363 __entry->highest_slotid = args->csa_highestslotid;
364 __entry->cachethis = args->csa_cachethis;
365 __entry->error = -be32_to_cpu(status);
366 ),
367
368 TP_printk(
369 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
370 "highest_slotid=%u",
371 __entry->error,
372 show_nfsv4_errors(__entry->error),
373 __entry->session,
374 __entry->slot_nr,
375 __entry->seq_nr,
376 __entry->highest_slotid
377 )
378);
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400379#endif /* CONFIG_NFS_V4_1 */
380
Trond Myklebust42113a72013-08-12 16:19:27 -0400381DECLARE_EVENT_CLASS(nfs4_open_event,
382 TP_PROTO(
383 const struct nfs_open_context *ctx,
384 int flags,
385 int error
386 ),
387
388 TP_ARGS(ctx, flags, error),
389
390 TP_STRUCT__entry(
391 __field(int, error)
392 __field(unsigned int, flags)
393 __field(unsigned int, fmode)
394 __field(dev_t, dev)
395 __field(u32, fhandle)
396 __field(u64, fileid)
397 __field(u64, dir)
398 __string(name, ctx->dentry->d_name.name)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500399 __field(int, stateid_seq)
400 __field(u32, stateid_hash)
401 __field(int, openstateid_seq)
402 __field(u32, openstateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400403 ),
404
405 TP_fast_assign(
406 const struct nfs4_state *state = ctx->state;
407 const struct inode *inode = NULL;
408
409 __entry->error = error;
410 __entry->flags = flags;
411 __entry->fmode = (__force unsigned int)ctx->mode;
412 __entry->dev = ctx->dentry->d_sb->s_dev;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500413 if (!IS_ERR_OR_NULL(state)) {
Trond Myklebust42113a72013-08-12 16:19:27 -0400414 inode = state->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500415 __entry->stateid_seq =
416 be32_to_cpu(state->stateid.seqid);
417 __entry->stateid_hash =
418 nfs_stateid_hash(&state->stateid);
419 __entry->openstateid_seq =
420 be32_to_cpu(state->open_stateid.seqid);
421 __entry->openstateid_hash =
422 nfs_stateid_hash(&state->open_stateid);
423 } else {
424 __entry->stateid_seq = 0;
425 __entry->stateid_hash = 0;
426 __entry->openstateid_seq = 0;
427 __entry->openstateid_hash = 0;
428 }
Trond Myklebust42113a72013-08-12 16:19:27 -0400429 if (inode != NULL) {
430 __entry->fileid = NFS_FILEID(inode);
431 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
432 } else {
433 __entry->fileid = 0;
434 __entry->fhandle = 0;
435 }
David Howells2b0143b2015-03-17 22:25:59 +0000436 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
Trond Myklebust42113a72013-08-12 16:19:27 -0400437 __assign_str(name, ctx->dentry->d_name.name);
438 ),
439
440 TP_printk(
441 "error=%d (%s) flags=%d (%s) fmode=%s "
442 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500443 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
444 "openstateid=%d:0x%08x",
Trond Myklebust42113a72013-08-12 16:19:27 -0400445 __entry->error,
446 show_nfsv4_errors(__entry->error),
447 __entry->flags,
448 show_open_flags(__entry->flags),
449 show_fmode_flags(__entry->fmode),
450 MAJOR(__entry->dev), MINOR(__entry->dev),
451 (unsigned long long)__entry->fileid,
452 __entry->fhandle,
453 MAJOR(__entry->dev), MINOR(__entry->dev),
454 (unsigned long long)__entry->dir,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500455 __get_str(name),
456 __entry->stateid_seq, __entry->stateid_hash,
457 __entry->openstateid_seq, __entry->openstateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400458 )
459);
460
461#define DEFINE_NFS4_OPEN_EVENT(name) \
462 DEFINE_EVENT(nfs4_open_event, name, \
463 TP_PROTO( \
464 const struct nfs_open_context *ctx, \
465 int flags, \
466 int error \
467 ), \
468 TP_ARGS(ctx, flags, error))
469DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
470DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
471DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
472
Olga Kornievskaia9759b0f2015-11-24 13:29:42 -0500473TRACE_EVENT(nfs4_cached_open,
474 TP_PROTO(
475 const struct nfs4_state *state
476 ),
477 TP_ARGS(state),
478 TP_STRUCT__entry(
479 __field(dev_t, dev)
480 __field(u32, fhandle)
481 __field(u64, fileid)
482 __field(unsigned int, fmode)
483 __field(int, stateid_seq)
484 __field(u32, stateid_hash)
485 ),
486
487 TP_fast_assign(
488 const struct inode *inode = state->inode;
489
490 __entry->dev = inode->i_sb->s_dev;
491 __entry->fileid = NFS_FILEID(inode);
492 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
493 __entry->fmode = (__force unsigned int)state->state;
494 __entry->stateid_seq =
495 be32_to_cpu(state->stateid.seqid);
496 __entry->stateid_hash =
497 nfs_stateid_hash(&state->stateid);
498 ),
499
500 TP_printk(
501 "fmode=%s fileid=%02x:%02x:%llu "
502 "fhandle=0x%08x stateid=%d:0x%08x",
503 __entry->fmode ? show_fmode_flags(__entry->fmode) :
504 "closed",
505 MAJOR(__entry->dev), MINOR(__entry->dev),
506 (unsigned long long)__entry->fileid,
507 __entry->fhandle,
508 __entry->stateid_seq, __entry->stateid_hash
509 )
510);
511
Trond Myklebust42113a72013-08-12 16:19:27 -0400512TRACE_EVENT(nfs4_close,
513 TP_PROTO(
514 const struct nfs4_state *state,
515 const struct nfs_closeargs *args,
516 const struct nfs_closeres *res,
517 int error
518 ),
519
520 TP_ARGS(state, args, res, error),
521
522 TP_STRUCT__entry(
523 __field(dev_t, dev)
524 __field(u32, fhandle)
525 __field(u64, fileid)
526 __field(unsigned int, fmode)
527 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500528 __field(int, stateid_seq)
529 __field(u32, stateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400530 ),
531
532 TP_fast_assign(
533 const struct inode *inode = state->inode;
534
535 __entry->dev = inode->i_sb->s_dev;
536 __entry->fileid = NFS_FILEID(inode);
537 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
538 __entry->fmode = (__force unsigned int)state->state;
539 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500540 __entry->stateid_seq =
541 be32_to_cpu(args->stateid.seqid);
542 __entry->stateid_hash =
543 nfs_stateid_hash(&args->stateid);
Trond Myklebust42113a72013-08-12 16:19:27 -0400544 ),
545
546 TP_printk(
547 "error=%d (%s) fmode=%s fileid=%02x:%02x:%llu "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500548 "fhandle=0x%08x openstateid=%d:0x%08x",
Trond Myklebust42113a72013-08-12 16:19:27 -0400549 __entry->error,
550 show_nfsv4_errors(__entry->error),
551 __entry->fmode ? show_fmode_flags(__entry->fmode) :
552 "closed",
553 MAJOR(__entry->dev), MINOR(__entry->dev),
554 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500555 __entry->fhandle,
556 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400557 )
558);
559
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400560#define show_lock_cmd(type) \
561 __print_symbolic((int)type, \
562 { F_GETLK, "GETLK" }, \
563 { F_SETLK, "SETLK" }, \
564 { F_SETLKW, "SETLKW" })
565#define show_lock_type(type) \
566 __print_symbolic((int)type, \
567 { F_RDLCK, "RDLCK" }, \
568 { F_WRLCK, "WRLCK" }, \
569 { F_UNLCK, "UNLCK" })
570
571DECLARE_EVENT_CLASS(nfs4_lock_event,
572 TP_PROTO(
573 const struct file_lock *request,
574 const struct nfs4_state *state,
575 int cmd,
576 int error
577 ),
578
579 TP_ARGS(request, state, cmd, error),
580
581 TP_STRUCT__entry(
582 __field(int, error)
583 __field(int, cmd)
584 __field(char, type)
585 __field(loff_t, start)
586 __field(loff_t, end)
587 __field(dev_t, dev)
588 __field(u32, fhandle)
589 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500590 __field(int, stateid_seq)
591 __field(u32, stateid_hash)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400592 ),
593
594 TP_fast_assign(
595 const struct inode *inode = state->inode;
596
597 __entry->error = error;
598 __entry->cmd = cmd;
599 __entry->type = request->fl_type;
600 __entry->start = request->fl_start;
601 __entry->end = request->fl_end;
602 __entry->dev = inode->i_sb->s_dev;
603 __entry->fileid = NFS_FILEID(inode);
604 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500605 __entry->stateid_seq =
606 be32_to_cpu(state->stateid.seqid);
607 __entry->stateid_hash =
608 nfs_stateid_hash(&state->stateid);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400609 ),
610
611 TP_printk(
612 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500613 "fileid=%02x:%02x:%llu fhandle=0x%08x "
614 "stateid=%d:0x%08x",
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400615 __entry->error,
616 show_nfsv4_errors(__entry->error),
617 show_lock_cmd(__entry->cmd),
618 show_lock_type(__entry->type),
619 (long long)__entry->start,
620 (long long)__entry->end,
621 MAJOR(__entry->dev), MINOR(__entry->dev),
622 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500623 __entry->fhandle,
624 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400625 )
626);
627
628#define DEFINE_NFS4_LOCK_EVENT(name) \
629 DEFINE_EVENT(nfs4_lock_event, name, \
630 TP_PROTO( \
631 const struct file_lock *request, \
632 const struct nfs4_state *state, \
633 int cmd, \
634 int error \
635 ), \
636 TP_ARGS(request, state, cmd, error))
637DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400638DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
639
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500640TRACE_EVENT(nfs4_set_lock,
641 TP_PROTO(
642 const struct file_lock *request,
643 const struct nfs4_state *state,
644 const nfs4_stateid *lockstateid,
645 int cmd,
646 int error
647 ),
648
649 TP_ARGS(request, state, lockstateid, cmd, error),
650
651 TP_STRUCT__entry(
652 __field(int, error)
653 __field(int, cmd)
654 __field(char, type)
655 __field(loff_t, start)
656 __field(loff_t, end)
657 __field(dev_t, dev)
658 __field(u32, fhandle)
659 __field(u64, fileid)
660 __field(int, stateid_seq)
661 __field(u32, stateid_hash)
662 __field(int, lockstateid_seq)
663 __field(u32, lockstateid_hash)
664 ),
665
666 TP_fast_assign(
667 const struct inode *inode = state->inode;
668
669 __entry->error = error;
670 __entry->cmd = cmd;
671 __entry->type = request->fl_type;
672 __entry->start = request->fl_start;
673 __entry->end = request->fl_end;
674 __entry->dev = inode->i_sb->s_dev;
675 __entry->fileid = NFS_FILEID(inode);
676 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
677 __entry->stateid_seq =
678 be32_to_cpu(state->stateid.seqid);
679 __entry->stateid_hash =
680 nfs_stateid_hash(&state->stateid);
681 __entry->lockstateid_seq =
682 be32_to_cpu(lockstateid->seqid);
683 __entry->lockstateid_hash =
684 nfs_stateid_hash(lockstateid);
685 ),
686
687 TP_printk(
688 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
689 "fileid=%02x:%02x:%llu fhandle=0x%08x "
690 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
691 __entry->error,
692 show_nfsv4_errors(__entry->error),
693 show_lock_cmd(__entry->cmd),
694 show_lock_type(__entry->type),
695 (long long)__entry->start,
696 (long long)__entry->end,
697 MAJOR(__entry->dev), MINOR(__entry->dev),
698 (unsigned long long)__entry->fileid,
699 __entry->fhandle,
700 __entry->stateid_seq, __entry->stateid_hash,
701 __entry->lockstateid_seq, __entry->lockstateid_hash
702 )
703);
704
Trond Myklebustca8acf82013-08-13 10:36:56 -0400705DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
706 TP_PROTO(
707 const struct inode *inode,
708 fmode_t fmode
709 ),
710
711 TP_ARGS(inode, fmode),
712
713 TP_STRUCT__entry(
714 __field(dev_t, dev)
715 __field(u32, fhandle)
716 __field(u64, fileid)
717 __field(unsigned int, fmode)
718 ),
719
720 TP_fast_assign(
721 __entry->dev = inode->i_sb->s_dev;
722 __entry->fileid = NFS_FILEID(inode);
723 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
724 __entry->fmode = (__force unsigned int)fmode;
725 ),
726
727 TP_printk(
728 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
729 show_fmode_flags(__entry->fmode),
730 MAJOR(__entry->dev), MINOR(__entry->dev),
731 (unsigned long long)__entry->fileid,
732 __entry->fhandle
733 )
734);
735#define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
736 DEFINE_EVENT(nfs4_set_delegation_event, name, \
737 TP_PROTO( \
738 const struct inode *inode, \
739 fmode_t fmode \
740 ), \
741 TP_ARGS(inode, fmode))
742DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
743DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
744
745TRACE_EVENT(nfs4_delegreturn_exit,
746 TP_PROTO(
747 const struct nfs4_delegreturnargs *args,
748 const struct nfs4_delegreturnres *res,
749 int error
750 ),
751
752 TP_ARGS(args, res, error),
753
754 TP_STRUCT__entry(
755 __field(dev_t, dev)
756 __field(u32, fhandle)
757 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500758 __field(int, stateid_seq)
759 __field(u32, stateid_hash)
Trond Myklebustca8acf82013-08-13 10:36:56 -0400760 ),
761
762 TP_fast_assign(
763 __entry->dev = res->server->s_dev;
764 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
765 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500766 __entry->stateid_seq =
767 be32_to_cpu(args->stateid->seqid);
768 __entry->stateid_hash =
769 nfs_stateid_hash(args->stateid);
Trond Myklebustca8acf82013-08-13 10:36:56 -0400770 ),
771
772 TP_printk(
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500773 "error=%d (%s) dev=%02x:%02x fhandle=0x%08x "
774 "stateid=%d:0x%08x",
Trond Myklebustca8acf82013-08-13 10:36:56 -0400775 __entry->error,
776 show_nfsv4_errors(__entry->error),
777 MAJOR(__entry->dev), MINOR(__entry->dev),
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500778 __entry->fhandle,
779 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustca8acf82013-08-13 10:36:56 -0400780 )
781);
782
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400783#ifdef CONFIG_NFS_V4_1
784DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
785 TP_PROTO(
786 const struct nfs4_state *state,
787 const struct nfs4_lock_state *lsp,
788 int error
789 ),
790
791 TP_ARGS(state, lsp, error),
792
793 TP_STRUCT__entry(
794 __field(int, error)
795 __field(dev_t, dev)
796 __field(u32, fhandle)
797 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500798 __field(int, stateid_seq)
799 __field(u32, stateid_hash)
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400800 ),
801
802 TP_fast_assign(
803 const struct inode *inode = state->inode;
804
805 __entry->error = error;
806 __entry->dev = inode->i_sb->s_dev;
807 __entry->fileid = NFS_FILEID(inode);
808 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500809 __entry->stateid_seq =
810 be32_to_cpu(state->stateid.seqid);
811 __entry->stateid_hash =
812 nfs_stateid_hash(&state->stateid);
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400813 ),
814
815 TP_printk(
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500816 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
817 "stateid=%d:0x%08x",
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400818 __entry->error,
819 show_nfsv4_errors(__entry->error),
820 MAJOR(__entry->dev), MINOR(__entry->dev),
821 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500822 __entry->fhandle,
823 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400824 )
825);
826
827#define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
828 DEFINE_EVENT(nfs4_test_stateid_event, name, \
829 TP_PROTO( \
830 const struct nfs4_state *state, \
831 const struct nfs4_lock_state *lsp, \
832 int error \
833 ), \
834 TP_ARGS(state, lsp, error))
835DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
836DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
837DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
838#endif /* CONFIG_NFS_V4_1 */
839
Trond Myklebust078ea3d2013-08-12 16:45:55 -0400840DECLARE_EVENT_CLASS(nfs4_lookup_event,
841 TP_PROTO(
842 const struct inode *dir,
843 const struct qstr *name,
844 int error
845 ),
846
847 TP_ARGS(dir, name, error),
848
849 TP_STRUCT__entry(
850 __field(dev_t, dev)
851 __field(int, error)
852 __field(u64, dir)
853 __string(name, name->name)
854 ),
855
856 TP_fast_assign(
857 __entry->dev = dir->i_sb->s_dev;
858 __entry->dir = NFS_FILEID(dir);
859 __entry->error = error;
860 __assign_str(name, name->name);
861 ),
862
863 TP_printk(
864 "error=%d (%s) name=%02x:%02x:%llu/%s",
865 __entry->error,
866 show_nfsv4_errors(__entry->error),
867 MAJOR(__entry->dev), MINOR(__entry->dev),
868 (unsigned long long)__entry->dir,
869 __get_str(name)
870 )
871);
872
873#define DEFINE_NFS4_LOOKUP_EVENT(name) \
874 DEFINE_EVENT(nfs4_lookup_event, name, \
875 TP_PROTO( \
876 const struct inode *dir, \
877 const struct qstr *name, \
878 int error \
879 ), \
880 TP_ARGS(dir, name, error))
881
882DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
883DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
884DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
885DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
886DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
887DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
888DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
889
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -0400890TRACE_EVENT(nfs4_rename,
891 TP_PROTO(
892 const struct inode *olddir,
893 const struct qstr *oldname,
894 const struct inode *newdir,
895 const struct qstr *newname,
896 int error
897 ),
898
899 TP_ARGS(olddir, oldname, newdir, newname, error),
900
901 TP_STRUCT__entry(
902 __field(dev_t, dev)
903 __field(int, error)
904 __field(u64, olddir)
905 __string(oldname, oldname->name)
906 __field(u64, newdir)
907 __string(newname, newname->name)
908 ),
909
910 TP_fast_assign(
911 __entry->dev = olddir->i_sb->s_dev;
912 __entry->olddir = NFS_FILEID(olddir);
913 __entry->newdir = NFS_FILEID(newdir);
914 __entry->error = error;
915 __assign_str(oldname, oldname->name);
916 __assign_str(newname, newname->name);
917 ),
918
919 TP_printk(
920 "error=%d (%s) oldname=%02x:%02x:%llu/%s "
921 "newname=%02x:%02x:%llu/%s",
922 __entry->error,
923 show_nfsv4_errors(__entry->error),
924 MAJOR(__entry->dev), MINOR(__entry->dev),
925 (unsigned long long)__entry->olddir,
926 __get_str(oldname),
927 MAJOR(__entry->dev), MINOR(__entry->dev),
928 (unsigned long long)__entry->newdir,
929 __get_str(newname)
930 )
931);
932
Trond Myklebustc1578b72013-08-12 16:58:42 -0400933DECLARE_EVENT_CLASS(nfs4_inode_event,
934 TP_PROTO(
935 const struct inode *inode,
936 int error
937 ),
938
939 TP_ARGS(inode, error),
940
941 TP_STRUCT__entry(
942 __field(dev_t, dev)
943 __field(u32, fhandle)
944 __field(u64, fileid)
945 __field(int, error)
946 ),
947
948 TP_fast_assign(
949 __entry->dev = inode->i_sb->s_dev;
950 __entry->fileid = NFS_FILEID(inode);
951 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
952 __entry->error = error;
953 ),
954
955 TP_printk(
956 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
957 __entry->error,
958 show_nfsv4_errors(__entry->error),
959 MAJOR(__entry->dev), MINOR(__entry->dev),
960 (unsigned long long)__entry->fileid,
961 __entry->fhandle
962 )
963);
964
965#define DEFINE_NFS4_INODE_EVENT(name) \
966 DEFINE_EVENT(nfs4_inode_event, name, \
967 TP_PROTO( \
968 const struct inode *inode, \
969 int error \
970 ), \
971 TP_ARGS(inode, error))
972
Trond Myklebustc1578b72013-08-12 16:58:42 -0400973DEFINE_NFS4_INODE_EVENT(nfs4_access);
974DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
975DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
976DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
977DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
978#ifdef CONFIG_NFS_V4_SECURITY_LABEL
979DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
980DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
981#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500982
983DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
984 TP_PROTO(
985 const struct inode *inode,
986 const nfs4_stateid *stateid,
987 int error
988 ),
989
990 TP_ARGS(inode, stateid, error),
991
992 TP_STRUCT__entry(
993 __field(dev_t, dev)
994 __field(u32, fhandle)
995 __field(u64, fileid)
996 __field(int, error)
997 __field(int, stateid_seq)
998 __field(u32, stateid_hash)
999 ),
1000
1001 TP_fast_assign(
1002 __entry->dev = inode->i_sb->s_dev;
1003 __entry->fileid = NFS_FILEID(inode);
1004 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1005 __entry->error = error;
1006 __entry->stateid_seq =
1007 be32_to_cpu(stateid->seqid);
1008 __entry->stateid_hash =
1009 nfs_stateid_hash(stateid);
1010 ),
1011
1012 TP_printk(
1013 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1014 "stateid=%d:0x%08x",
1015 __entry->error,
1016 show_nfsv4_errors(__entry->error),
1017 MAJOR(__entry->dev), MINOR(__entry->dev),
1018 (unsigned long long)__entry->fileid,
1019 __entry->fhandle,
1020 __entry->stateid_seq, __entry->stateid_hash
1021 )
1022);
1023
1024#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1025 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1026 TP_PROTO( \
1027 const struct inode *inode, \
1028 const nfs4_stateid *stateid, \
1029 int error \
1030 ), \
1031 TP_ARGS(inode, stateid, error))
1032
1033DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1034DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
Trond Myklebustc1578b72013-08-12 16:58:42 -04001035
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001036DECLARE_EVENT_CLASS(nfs4_getattr_event,
1037 TP_PROTO(
1038 const struct nfs_server *server,
1039 const struct nfs_fh *fhandle,
1040 const struct nfs_fattr *fattr,
1041 int error
1042 ),
1043
1044 TP_ARGS(server, fhandle, fattr, error),
1045
1046 TP_STRUCT__entry(
1047 __field(dev_t, dev)
1048 __field(u32, fhandle)
1049 __field(u64, fileid)
1050 __field(unsigned int, valid)
1051 __field(int, error)
1052 ),
1053
1054 TP_fast_assign(
1055 __entry->dev = server->s_dev;
1056 __entry->valid = fattr->valid;
1057 __entry->fhandle = nfs_fhandle_hash(fhandle);
1058 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
1059 __entry->error = error;
1060 ),
1061
1062 TP_printk(
1063 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1064 "valid=%s",
1065 __entry->error,
1066 show_nfsv4_errors(__entry->error),
1067 MAJOR(__entry->dev), MINOR(__entry->dev),
1068 (unsigned long long)__entry->fileid,
1069 __entry->fhandle,
1070 show_nfs_fattr_flags(__entry->valid)
1071 )
1072);
1073
1074#define DEFINE_NFS4_GETATTR_EVENT(name) \
1075 DEFINE_EVENT(nfs4_getattr_event, name, \
1076 TP_PROTO( \
1077 const struct nfs_server *server, \
1078 const struct nfs_fh *fhandle, \
1079 const struct nfs_fattr *fattr, \
1080 int error \
1081 ), \
1082 TP_ARGS(server, fhandle, fattr, error))
1083DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1084DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1085DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1086
Trond Myklebust7cd14862015-08-20 20:07:54 -05001087DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1088 TP_PROTO(
1089 const struct nfs_client *clp,
1090 const struct nfs_fh *fhandle,
1091 const struct inode *inode,
1092 int error
1093 ),
1094
1095 TP_ARGS(clp, fhandle, inode, error),
1096
1097 TP_STRUCT__entry(
1098 __field(int, error)
1099 __field(dev_t, dev)
1100 __field(u32, fhandle)
1101 __field(u64, fileid)
Anna Schumaker8fb42f72017-11-01 15:48:43 -04001102 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001103 ),
1104
1105 TP_fast_assign(
1106 __entry->error = error;
1107 __entry->fhandle = nfs_fhandle_hash(fhandle);
1108 if (inode != NULL) {
1109 __entry->fileid = NFS_FILEID(inode);
1110 __entry->dev = inode->i_sb->s_dev;
1111 } else {
1112 __entry->fileid = 0;
1113 __entry->dev = 0;
1114 }
Anna Schumaker8fb42f72017-11-01 15:48:43 -04001115 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001116 ),
1117
1118 TP_printk(
1119 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1120 "dstaddr=%s",
1121 __entry->error,
1122 show_nfsv4_errors(__entry->error),
1123 MAJOR(__entry->dev), MINOR(__entry->dev),
1124 (unsigned long long)__entry->fileid,
1125 __entry->fhandle,
1126 __get_str(dstaddr)
1127 )
1128);
1129
1130#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1131 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1132 TP_PROTO( \
1133 const struct nfs_client *clp, \
1134 const struct nfs_fh *fhandle, \
1135 const struct inode *inode, \
1136 int error \
1137 ), \
1138 TP_ARGS(clp, fhandle, inode, error))
1139DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1140
Trond Myklebuste07db902015-12-28 14:07:23 -05001141DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1142 TP_PROTO(
1143 const struct nfs_client *clp,
1144 const struct nfs_fh *fhandle,
1145 const struct inode *inode,
1146 const nfs4_stateid *stateid,
1147 int error
1148 ),
1149
1150 TP_ARGS(clp, fhandle, inode, stateid, error),
1151
1152 TP_STRUCT__entry(
1153 __field(int, error)
1154 __field(dev_t, dev)
1155 __field(u32, fhandle)
1156 __field(u64, fileid)
Anna Schumaker8fb42f72017-11-01 15:48:43 -04001157 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001158 __field(int, stateid_seq)
1159 __field(u32, stateid_hash)
1160 ),
1161
1162 TP_fast_assign(
1163 __entry->error = error;
1164 __entry->fhandle = nfs_fhandle_hash(fhandle);
1165 if (inode != NULL) {
1166 __entry->fileid = NFS_FILEID(inode);
1167 __entry->dev = inode->i_sb->s_dev;
1168 } else {
1169 __entry->fileid = 0;
1170 __entry->dev = 0;
1171 }
Anna Schumaker8fb42f72017-11-01 15:48:43 -04001172 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001173 __entry->stateid_seq =
1174 be32_to_cpu(stateid->seqid);
1175 __entry->stateid_hash =
1176 nfs_stateid_hash(stateid);
1177 ),
1178
1179 TP_printk(
1180 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1181 "stateid=%d:0x%08x dstaddr=%s",
1182 __entry->error,
1183 show_nfsv4_errors(__entry->error),
1184 MAJOR(__entry->dev), MINOR(__entry->dev),
1185 (unsigned long long)__entry->fileid,
1186 __entry->fhandle,
1187 __entry->stateid_seq, __entry->stateid_hash,
1188 __get_str(dstaddr)
1189 )
1190);
1191
1192#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1193 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1194 TP_PROTO( \
1195 const struct nfs_client *clp, \
1196 const struct nfs_fh *fhandle, \
1197 const struct inode *inode, \
1198 const nfs4_stateid *stateid, \
1199 int error \
1200 ), \
1201 TP_ARGS(clp, fhandle, inode, stateid, error))
1202DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1203DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
Trond Myklebust7cd14862015-08-20 20:07:54 -05001204
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001205DECLARE_EVENT_CLASS(nfs4_idmap_event,
1206 TP_PROTO(
1207 const char *name,
1208 int len,
1209 u32 id,
1210 int error
1211 ),
1212
1213 TP_ARGS(name, len, id, error),
1214
1215 TP_STRUCT__entry(
1216 __field(int, error)
1217 __field(u32, id)
1218 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1219 ),
1220
1221 TP_fast_assign(
1222 if (len < 0)
1223 len = 0;
1224 __entry->error = error < 0 ? error : 0;
1225 __entry->id = id;
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -03001226 memcpy(__get_str(name), name, len);
1227 __get_str(name)[len] = 0;
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001228 ),
1229
1230 TP_printk(
1231 "error=%d id=%u name=%s",
1232 __entry->error,
1233 __entry->id,
1234 __get_str(name)
1235 )
1236);
1237#define DEFINE_NFS4_IDMAP_EVENT(name) \
1238 DEFINE_EVENT(nfs4_idmap_event, name, \
1239 TP_PROTO( \
1240 const char *name, \
1241 int len, \
1242 u32 id, \
1243 int error \
1244 ), \
1245 TP_ARGS(name, len, id, error))
1246DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1247DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1248DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1249DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1250
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001251DECLARE_EVENT_CLASS(nfs4_read_event,
1252 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001253 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001254 int error
1255 ),
1256
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001257 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001258
1259 TP_STRUCT__entry(
1260 __field(dev_t, dev)
1261 __field(u32, fhandle)
1262 __field(u64, fileid)
1263 __field(loff_t, offset)
1264 __field(size_t, count)
1265 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001266 __field(int, stateid_seq)
1267 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001268 ),
1269
1270 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001271 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001272 const struct nfs4_state *state =
1273 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001274 __entry->dev = inode->i_sb->s_dev;
1275 __entry->fileid = NFS_FILEID(inode);
1276 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001277 __entry->offset = hdr->args.offset;
1278 __entry->count = hdr->args.count;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001279 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001280 __entry->stateid_seq =
1281 be32_to_cpu(state->stateid.seqid);
1282 __entry->stateid_hash =
1283 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001284 ),
1285
1286 TP_printk(
1287 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001288 "offset=%lld count=%zu stateid=%d:0x%08x",
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001289 __entry->error,
1290 show_nfsv4_errors(__entry->error),
1291 MAJOR(__entry->dev), MINOR(__entry->dev),
1292 (unsigned long long)__entry->fileid,
1293 __entry->fhandle,
1294 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001295 __entry->count,
1296 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001297 )
1298);
1299#define DEFINE_NFS4_READ_EVENT(name) \
1300 DEFINE_EVENT(nfs4_read_event, name, \
1301 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001302 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001303 int error \
1304 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001305 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001306DEFINE_NFS4_READ_EVENT(nfs4_read);
1307#ifdef CONFIG_NFS_V4_1
1308DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1309#endif /* CONFIG_NFS_V4_1 */
1310
1311DECLARE_EVENT_CLASS(nfs4_write_event,
1312 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001313 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001314 int error
1315 ),
1316
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001317 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001318
1319 TP_STRUCT__entry(
1320 __field(dev_t, dev)
1321 __field(u32, fhandle)
1322 __field(u64, fileid)
1323 __field(loff_t, offset)
1324 __field(size_t, count)
1325 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001326 __field(int, stateid_seq)
1327 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001328 ),
1329
1330 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001331 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001332 const struct nfs4_state *state =
1333 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001334 __entry->dev = inode->i_sb->s_dev;
1335 __entry->fileid = NFS_FILEID(inode);
1336 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001337 __entry->offset = hdr->args.offset;
1338 __entry->count = hdr->args.count;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001339 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001340 __entry->stateid_seq =
1341 be32_to_cpu(state->stateid.seqid);
1342 __entry->stateid_hash =
1343 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001344 ),
1345
1346 TP_printk(
1347 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001348 "offset=%lld count=%zu stateid=%d:0x%08x",
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001349 __entry->error,
1350 show_nfsv4_errors(__entry->error),
1351 MAJOR(__entry->dev), MINOR(__entry->dev),
1352 (unsigned long long)__entry->fileid,
1353 __entry->fhandle,
1354 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001355 __entry->count,
1356 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001357 )
1358);
1359
1360#define DEFINE_NFS4_WRITE_EVENT(name) \
1361 DEFINE_EVENT(nfs4_write_event, name, \
1362 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001363 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001364 int error \
1365 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001366 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001367DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1368#ifdef CONFIG_NFS_V4_1
1369DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1370#endif /* CONFIG_NFS_V4_1 */
1371
1372DECLARE_EVENT_CLASS(nfs4_commit_event,
1373 TP_PROTO(
1374 const struct nfs_commit_data *data,
1375 int error
1376 ),
1377
1378 TP_ARGS(data, error),
1379
1380 TP_STRUCT__entry(
1381 __field(dev_t, dev)
1382 __field(u32, fhandle)
1383 __field(u64, fileid)
1384 __field(loff_t, offset)
1385 __field(size_t, count)
1386 __field(int, error)
1387 ),
1388
1389 TP_fast_assign(
1390 const struct inode *inode = data->inode;
1391 __entry->dev = inode->i_sb->s_dev;
1392 __entry->fileid = NFS_FILEID(inode);
1393 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1394 __entry->offset = data->args.offset;
1395 __entry->count = data->args.count;
1396 __entry->error = error;
1397 ),
1398
1399 TP_printk(
1400 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1401 "offset=%lld count=%zu",
1402 __entry->error,
1403 show_nfsv4_errors(__entry->error),
1404 MAJOR(__entry->dev), MINOR(__entry->dev),
1405 (unsigned long long)__entry->fileid,
1406 __entry->fhandle,
1407 (long long)__entry->offset,
1408 __entry->count
1409 )
1410);
1411#define DEFINE_NFS4_COMMIT_EVENT(name) \
1412 DEFINE_EVENT(nfs4_commit_event, name, \
1413 TP_PROTO( \
1414 const struct nfs_commit_data *data, \
1415 int error \
1416 ), \
1417 TP_ARGS(data, error))
1418DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1419#ifdef CONFIG_NFS_V4_1
1420DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001421
1422#define show_pnfs_iomode(iomode) \
1423 __print_symbolic(iomode, \
1424 { IOMODE_READ, "READ" }, \
1425 { IOMODE_RW, "RW" }, \
1426 { IOMODE_ANY, "ANY" })
1427
1428TRACE_EVENT(nfs4_layoutget,
1429 TP_PROTO(
1430 const struct nfs_open_context *ctx,
1431 const struct pnfs_layout_range *args,
1432 const struct pnfs_layout_range *res,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001433 const nfs4_stateid *layout_stateid,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001434 int error
1435 ),
1436
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001437 TP_ARGS(ctx, args, res, layout_stateid, error),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001438
1439 TP_STRUCT__entry(
1440 __field(dev_t, dev)
1441 __field(u32, fhandle)
1442 __field(u64, fileid)
1443 __field(u32, iomode)
1444 __field(u64, offset)
1445 __field(u64, count)
1446 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001447 __field(int, stateid_seq)
1448 __field(u32, stateid_hash)
1449 __field(int, layoutstateid_seq)
1450 __field(u32, layoutstateid_hash)
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001451 ),
1452
1453 TP_fast_assign(
David Howells2b0143b2015-03-17 22:25:59 +00001454 const struct inode *inode = d_inode(ctx->dentry);
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001455 const struct nfs4_state *state = ctx->state;
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001456 __entry->dev = inode->i_sb->s_dev;
1457 __entry->fileid = NFS_FILEID(inode);
1458 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1459 __entry->iomode = args->iomode;
1460 __entry->offset = args->offset;
1461 __entry->count = args->length;
1462 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001463 __entry->stateid_seq =
1464 be32_to_cpu(state->stateid.seqid);
1465 __entry->stateid_hash =
1466 nfs_stateid_hash(&state->stateid);
1467 if (!error) {
1468 __entry->layoutstateid_seq =
1469 be32_to_cpu(layout_stateid->seqid);
1470 __entry->layoutstateid_hash =
1471 nfs_stateid_hash(layout_stateid);
1472 } else {
1473 __entry->layoutstateid_seq = 0;
1474 __entry->layoutstateid_hash = 0;
1475 }
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001476 ),
1477
1478 TP_printk(
1479 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001480 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1481 "layoutstateid=%d:0x%08x",
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001482 __entry->error,
1483 show_nfsv4_errors(__entry->error),
1484 MAJOR(__entry->dev), MINOR(__entry->dev),
1485 (unsigned long long)__entry->fileid,
1486 __entry->fhandle,
1487 show_pnfs_iomode(__entry->iomode),
1488 (unsigned long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001489 (unsigned long long)__entry->count,
1490 __entry->stateid_seq, __entry->stateid_hash,
1491 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001492 )
1493);
1494
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001495DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1496DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
Trond Myklebust6a463beb2015-08-20 15:40:47 -05001497DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001498
Jeff Layton9a4bf312015-12-10 10:41:58 -05001499#define show_pnfs_update_layout_reason(reason) \
1500 __print_symbolic(reason, \
1501 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
1502 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
1503 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
1504 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
1505 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
1506 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
1507 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
1508 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
1509 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
1510 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
Jeff Layton183d9e72016-05-17 12:28:47 -04001511 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
1512 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
Jeff Layton9a4bf312015-12-10 10:41:58 -05001513 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" })
1514
1515TRACE_EVENT(pnfs_update_layout,
1516 TP_PROTO(struct inode *inode,
1517 loff_t pos,
1518 u64 count,
1519 enum pnfs_iomode iomode,
Trond Myklebustf4848302015-12-26 18:03:07 -05001520 struct pnfs_layout_hdr *lo,
Jeff Layton183d9e72016-05-17 12:28:47 -04001521 struct pnfs_layout_segment *lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05001522 enum pnfs_update_layout_reason reason
1523 ),
Jeff Layton183d9e72016-05-17 12:28:47 -04001524 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
Jeff Layton9a4bf312015-12-10 10:41:58 -05001525 TP_STRUCT__entry(
1526 __field(dev_t, dev)
1527 __field(u64, fileid)
1528 __field(u32, fhandle)
1529 __field(loff_t, pos)
1530 __field(u64, count)
1531 __field(enum pnfs_iomode, iomode)
Trond Myklebustf4848302015-12-26 18:03:07 -05001532 __field(int, layoutstateid_seq)
1533 __field(u32, layoutstateid_hash)
Jeff Layton183d9e72016-05-17 12:28:47 -04001534 __field(long, lseg)
Jeff Layton9a4bf312015-12-10 10:41:58 -05001535 __field(enum pnfs_update_layout_reason, reason)
1536 ),
1537 TP_fast_assign(
1538 __entry->dev = inode->i_sb->s_dev;
1539 __entry->fileid = NFS_FILEID(inode);
1540 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1541 __entry->pos = pos;
1542 __entry->count = count;
1543 __entry->iomode = iomode;
Jeff Layton9a4bf312015-12-10 10:41:58 -05001544 __entry->reason = reason;
Trond Myklebustf4848302015-12-26 18:03:07 -05001545 if (lo != NULL) {
1546 __entry->layoutstateid_seq =
1547 be32_to_cpu(lo->plh_stateid.seqid);
1548 __entry->layoutstateid_hash =
1549 nfs_stateid_hash(&lo->plh_stateid);
1550 } else {
1551 __entry->layoutstateid_seq = 0;
1552 __entry->layoutstateid_hash = 0;
1553 }
Jeff Layton183d9e72016-05-17 12:28:47 -04001554 __entry->lseg = (long)lseg;
Jeff Layton9a4bf312015-12-10 10:41:58 -05001555 ),
1556 TP_printk(
1557 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustf4848302015-12-26 18:03:07 -05001558 "iomode=%s pos=%llu count=%llu "
Jeff Layton183d9e72016-05-17 12:28:47 -04001559 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
Jeff Layton9a4bf312015-12-10 10:41:58 -05001560 MAJOR(__entry->dev), MINOR(__entry->dev),
1561 (unsigned long long)__entry->fileid,
1562 __entry->fhandle,
1563 show_pnfs_iomode(__entry->iomode),
1564 (unsigned long long)__entry->pos,
Trond Myklebustf4848302015-12-26 18:03:07 -05001565 (unsigned long long)__entry->count,
1566 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
Jeff Layton183d9e72016-05-17 12:28:47 -04001567 __entry->lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05001568 show_pnfs_update_layout_reason(__entry->reason)
1569 )
1570);
1571
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001572#endif /* CONFIG_NFS_V4_1 */
1573
Trond Myklebustc6d01c62013-08-09 11:51:26 -04001574#endif /* _TRACE_NFS4_H */
1575
1576#undef TRACE_INCLUDE_PATH
1577#define TRACE_INCLUDE_PATH .
1578#define TRACE_INCLUDE_FILE nfs4trace
1579/* This part must be outside protection */
1580#include <trace/define_trace.h>