blob: 845d0eadefc94f48dc6410b3bbb3a0df89caca18 [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
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400244#define show_nfs4_sequence_status_flags(status) \
245 __print_flags((unsigned long)status, "|", \
246 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
247 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
248 "CB_GSS_CONTEXTS_EXPIRING" }, \
249 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
250 "CB_GSS_CONTEXTS_EXPIRED" }, \
251 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
252 "EXPIRED_ALL_STATE_REVOKED" }, \
253 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
254 "EXPIRED_SOME_STATE_REVOKED" }, \
255 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
256 "ADMIN_STATE_REVOKED" }, \
257 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
258 "RECALLABLE_STATE_REVOKED" }, \
259 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
260 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
261 "RESTART_RECLAIM_NEEDED" }, \
262 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
263 "CB_PATH_DOWN_SESSION" }, \
264 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
265 "BACKCHANNEL_FAULT" })
266
267TRACE_EVENT(nfs4_sequence_done,
268 TP_PROTO(
269 const struct nfs4_session *session,
270 const struct nfs4_sequence_res *res
271 ),
272 TP_ARGS(session, res),
273
274 TP_STRUCT__entry(
275 __field(unsigned int, session)
276 __field(unsigned int, slot_nr)
277 __field(unsigned int, seq_nr)
278 __field(unsigned int, highest_slotid)
279 __field(unsigned int, target_highest_slotid)
280 __field(unsigned int, status_flags)
281 __field(int, error)
282 ),
283
284 TP_fast_assign(
285 const struct nfs4_slot *sr_slot = res->sr_slot;
286 __entry->session = nfs_session_id_hash(&session->sess_id);
287 __entry->slot_nr = sr_slot->slot_nr;
288 __entry->seq_nr = sr_slot->seq_nr;
289 __entry->highest_slotid = res->sr_highest_slotid;
290 __entry->target_highest_slotid =
291 res->sr_target_highest_slotid;
Andrew Elble52618df2015-12-02 09:19:43 -0500292 __entry->status_flags = res->sr_status_flags;
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400293 __entry->error = res->sr_status;
294 ),
295 TP_printk(
296 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
297 "highest_slotid=%u target_highest_slotid=%u "
298 "status_flags=%u (%s)",
299 __entry->error,
300 show_nfsv4_errors(__entry->error),
301 __entry->session,
302 __entry->slot_nr,
303 __entry->seq_nr,
304 __entry->highest_slotid,
305 __entry->target_highest_slotid,
306 __entry->status_flags,
307 show_nfs4_sequence_status_flags(__entry->status_flags)
308 )
309);
310
311struct cb_sequenceargs;
312struct cb_sequenceres;
313
314TRACE_EVENT(nfs4_cb_sequence,
315 TP_PROTO(
316 const struct cb_sequenceargs *args,
317 const struct cb_sequenceres *res,
318 __be32 status
319 ),
320 TP_ARGS(args, res, status),
321
322 TP_STRUCT__entry(
323 __field(unsigned int, session)
324 __field(unsigned int, slot_nr)
325 __field(unsigned int, seq_nr)
326 __field(unsigned int, highest_slotid)
327 __field(unsigned int, cachethis)
328 __field(int, error)
329 ),
330
331 TP_fast_assign(
332 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
333 __entry->slot_nr = args->csa_slotid;
334 __entry->seq_nr = args->csa_sequenceid;
335 __entry->highest_slotid = args->csa_highestslotid;
336 __entry->cachethis = args->csa_cachethis;
337 __entry->error = -be32_to_cpu(status);
338 ),
339
340 TP_printk(
341 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
342 "highest_slotid=%u",
343 __entry->error,
344 show_nfsv4_errors(__entry->error),
345 __entry->session,
346 __entry->slot_nr,
347 __entry->seq_nr,
348 __entry->highest_slotid
349 )
350);
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400351#endif /* CONFIG_NFS_V4_1 */
352
Anna Schumakerad05cc02017-01-11 13:37:06 -0500353TRACE_EVENT(nfs4_setup_sequence,
354 TP_PROTO(
355 const struct nfs4_session *session,
356 const struct nfs4_sequence_args *args
357 ),
358 TP_ARGS(session, args),
359
360 TP_STRUCT__entry(
361 __field(unsigned int, session)
362 __field(unsigned int, slot_nr)
363 __field(unsigned int, seq_nr)
364 __field(unsigned int, highest_used_slotid)
365 ),
366
367 TP_fast_assign(
368 const struct nfs4_slot *sa_slot = args->sa_slot;
369 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
370 __entry->slot_nr = sa_slot->slot_nr;
371 __entry->seq_nr = sa_slot->seq_nr;
372 __entry->highest_used_slotid =
373 sa_slot->table->highest_used_slotid;
374 ),
375 TP_printk(
376 "session=0x%08x slot_nr=%u seq_nr=%u "
377 "highest_used_slotid=%u",
378 __entry->session,
379 __entry->slot_nr,
380 __entry->seq_nr,
381 __entry->highest_used_slotid
382 )
383);
384
Trond Myklebust42113a72013-08-12 16:19:27 -0400385DECLARE_EVENT_CLASS(nfs4_open_event,
386 TP_PROTO(
387 const struct nfs_open_context *ctx,
388 int flags,
389 int error
390 ),
391
392 TP_ARGS(ctx, flags, error),
393
394 TP_STRUCT__entry(
395 __field(int, error)
396 __field(unsigned int, flags)
397 __field(unsigned int, fmode)
398 __field(dev_t, dev)
399 __field(u32, fhandle)
400 __field(u64, fileid)
401 __field(u64, dir)
402 __string(name, ctx->dentry->d_name.name)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500403 __field(int, stateid_seq)
404 __field(u32, stateid_hash)
405 __field(int, openstateid_seq)
406 __field(u32, openstateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400407 ),
408
409 TP_fast_assign(
410 const struct nfs4_state *state = ctx->state;
411 const struct inode *inode = NULL;
412
413 __entry->error = error;
414 __entry->flags = flags;
415 __entry->fmode = (__force unsigned int)ctx->mode;
416 __entry->dev = ctx->dentry->d_sb->s_dev;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500417 if (!IS_ERR_OR_NULL(state)) {
Trond Myklebust42113a72013-08-12 16:19:27 -0400418 inode = state->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500419 __entry->stateid_seq =
420 be32_to_cpu(state->stateid.seqid);
421 __entry->stateid_hash =
422 nfs_stateid_hash(&state->stateid);
423 __entry->openstateid_seq =
424 be32_to_cpu(state->open_stateid.seqid);
425 __entry->openstateid_hash =
426 nfs_stateid_hash(&state->open_stateid);
427 } else {
428 __entry->stateid_seq = 0;
429 __entry->stateid_hash = 0;
430 __entry->openstateid_seq = 0;
431 __entry->openstateid_hash = 0;
432 }
Trond Myklebust42113a72013-08-12 16:19:27 -0400433 if (inode != NULL) {
434 __entry->fileid = NFS_FILEID(inode);
435 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
436 } else {
437 __entry->fileid = 0;
438 __entry->fhandle = 0;
439 }
David Howells2b0143b2015-03-17 22:25:59 +0000440 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
Trond Myklebust42113a72013-08-12 16:19:27 -0400441 __assign_str(name, ctx->dentry->d_name.name);
442 ),
443
444 TP_printk(
445 "error=%d (%s) flags=%d (%s) fmode=%s "
446 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500447 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
448 "openstateid=%d:0x%08x",
Trond Myklebust42113a72013-08-12 16:19:27 -0400449 __entry->error,
450 show_nfsv4_errors(__entry->error),
451 __entry->flags,
452 show_open_flags(__entry->flags),
453 show_fmode_flags(__entry->fmode),
454 MAJOR(__entry->dev), MINOR(__entry->dev),
455 (unsigned long long)__entry->fileid,
456 __entry->fhandle,
457 MAJOR(__entry->dev), MINOR(__entry->dev),
458 (unsigned long long)__entry->dir,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500459 __get_str(name),
460 __entry->stateid_seq, __entry->stateid_hash,
461 __entry->openstateid_seq, __entry->openstateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400462 )
463);
464
465#define DEFINE_NFS4_OPEN_EVENT(name) \
466 DEFINE_EVENT(nfs4_open_event, name, \
467 TP_PROTO( \
468 const struct nfs_open_context *ctx, \
469 int flags, \
470 int error \
471 ), \
472 TP_ARGS(ctx, flags, error))
473DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
474DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
475DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
476
Olga Kornievskaia9759b0f2015-11-24 13:29:42 -0500477TRACE_EVENT(nfs4_cached_open,
478 TP_PROTO(
479 const struct nfs4_state *state
480 ),
481 TP_ARGS(state),
482 TP_STRUCT__entry(
483 __field(dev_t, dev)
484 __field(u32, fhandle)
485 __field(u64, fileid)
486 __field(unsigned int, fmode)
487 __field(int, stateid_seq)
488 __field(u32, stateid_hash)
489 ),
490
491 TP_fast_assign(
492 const struct inode *inode = state->inode;
493
494 __entry->dev = inode->i_sb->s_dev;
495 __entry->fileid = NFS_FILEID(inode);
496 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
497 __entry->fmode = (__force unsigned int)state->state;
498 __entry->stateid_seq =
499 be32_to_cpu(state->stateid.seqid);
500 __entry->stateid_hash =
501 nfs_stateid_hash(&state->stateid);
502 ),
503
504 TP_printk(
505 "fmode=%s fileid=%02x:%02x:%llu "
506 "fhandle=0x%08x stateid=%d:0x%08x",
507 __entry->fmode ? show_fmode_flags(__entry->fmode) :
508 "closed",
509 MAJOR(__entry->dev), MINOR(__entry->dev),
510 (unsigned long long)__entry->fileid,
511 __entry->fhandle,
512 __entry->stateid_seq, __entry->stateid_hash
513 )
514);
515
Trond Myklebust42113a72013-08-12 16:19:27 -0400516TRACE_EVENT(nfs4_close,
517 TP_PROTO(
518 const struct nfs4_state *state,
519 const struct nfs_closeargs *args,
520 const struct nfs_closeres *res,
521 int error
522 ),
523
524 TP_ARGS(state, args, res, error),
525
526 TP_STRUCT__entry(
527 __field(dev_t, dev)
528 __field(u32, fhandle)
529 __field(u64, fileid)
530 __field(unsigned int, fmode)
531 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500532 __field(int, stateid_seq)
533 __field(u32, stateid_hash)
Trond Myklebust42113a72013-08-12 16:19:27 -0400534 ),
535
536 TP_fast_assign(
537 const struct inode *inode = state->inode;
538
539 __entry->dev = inode->i_sb->s_dev;
540 __entry->fileid = NFS_FILEID(inode);
541 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
542 __entry->fmode = (__force unsigned int)state->state;
543 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500544 __entry->stateid_seq =
545 be32_to_cpu(args->stateid.seqid);
546 __entry->stateid_hash =
547 nfs_stateid_hash(&args->stateid);
Trond Myklebust42113a72013-08-12 16:19:27 -0400548 ),
549
550 TP_printk(
551 "error=%d (%s) fmode=%s fileid=%02x:%02x:%llu "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500552 "fhandle=0x%08x openstateid=%d:0x%08x",
Trond Myklebust42113a72013-08-12 16:19:27 -0400553 __entry->error,
554 show_nfsv4_errors(__entry->error),
555 __entry->fmode ? show_fmode_flags(__entry->fmode) :
556 "closed",
557 MAJOR(__entry->dev), MINOR(__entry->dev),
558 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500559 __entry->fhandle,
560 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust42113a72013-08-12 16:19:27 -0400561 )
562);
563
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400564#define show_lock_cmd(type) \
565 __print_symbolic((int)type, \
566 { F_GETLK, "GETLK" }, \
567 { F_SETLK, "SETLK" }, \
568 { F_SETLKW, "SETLKW" })
569#define show_lock_type(type) \
570 __print_symbolic((int)type, \
571 { F_RDLCK, "RDLCK" }, \
572 { F_WRLCK, "WRLCK" }, \
573 { F_UNLCK, "UNLCK" })
574
575DECLARE_EVENT_CLASS(nfs4_lock_event,
576 TP_PROTO(
577 const struct file_lock *request,
578 const struct nfs4_state *state,
579 int cmd,
580 int error
581 ),
582
583 TP_ARGS(request, state, cmd, error),
584
585 TP_STRUCT__entry(
586 __field(int, error)
587 __field(int, cmd)
588 __field(char, type)
589 __field(loff_t, start)
590 __field(loff_t, end)
591 __field(dev_t, dev)
592 __field(u32, fhandle)
593 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500594 __field(int, stateid_seq)
595 __field(u32, stateid_hash)
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400596 ),
597
598 TP_fast_assign(
599 const struct inode *inode = state->inode;
600
601 __entry->error = error;
602 __entry->cmd = cmd;
603 __entry->type = request->fl_type;
604 __entry->start = request->fl_start;
605 __entry->end = request->fl_end;
606 __entry->dev = inode->i_sb->s_dev;
607 __entry->fileid = NFS_FILEID(inode);
608 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500609 __entry->stateid_seq =
610 be32_to_cpu(state->stateid.seqid);
611 __entry->stateid_hash =
612 nfs_stateid_hash(&state->stateid);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400613 ),
614
615 TP_printk(
616 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500617 "fileid=%02x:%02x:%llu fhandle=0x%08x "
618 "stateid=%d:0x%08x",
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400619 __entry->error,
620 show_nfsv4_errors(__entry->error),
621 show_lock_cmd(__entry->cmd),
622 show_lock_type(__entry->type),
623 (long long)__entry->start,
624 (long long)__entry->end,
625 MAJOR(__entry->dev), MINOR(__entry->dev),
626 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500627 __entry->fhandle,
628 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400629 )
630);
631
632#define DEFINE_NFS4_LOCK_EVENT(name) \
633 DEFINE_EVENT(nfs4_lock_event, name, \
634 TP_PROTO( \
635 const struct file_lock *request, \
636 const struct nfs4_state *state, \
637 int cmd, \
638 int error \
639 ), \
640 TP_ARGS(request, state, cmd, error))
641DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
Trond Myklebustd1b748a2013-08-12 16:35:20 -0400642DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
643
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500644TRACE_EVENT(nfs4_set_lock,
645 TP_PROTO(
646 const struct file_lock *request,
647 const struct nfs4_state *state,
648 const nfs4_stateid *lockstateid,
649 int cmd,
650 int error
651 ),
652
653 TP_ARGS(request, state, lockstateid, cmd, error),
654
655 TP_STRUCT__entry(
656 __field(int, error)
657 __field(int, cmd)
658 __field(char, type)
659 __field(loff_t, start)
660 __field(loff_t, end)
661 __field(dev_t, dev)
662 __field(u32, fhandle)
663 __field(u64, fileid)
664 __field(int, stateid_seq)
665 __field(u32, stateid_hash)
666 __field(int, lockstateid_seq)
667 __field(u32, lockstateid_hash)
668 ),
669
670 TP_fast_assign(
671 const struct inode *inode = state->inode;
672
673 __entry->error = error;
674 __entry->cmd = cmd;
675 __entry->type = request->fl_type;
676 __entry->start = request->fl_start;
677 __entry->end = request->fl_end;
678 __entry->dev = inode->i_sb->s_dev;
679 __entry->fileid = NFS_FILEID(inode);
680 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
681 __entry->stateid_seq =
682 be32_to_cpu(state->stateid.seqid);
683 __entry->stateid_hash =
684 nfs_stateid_hash(&state->stateid);
685 __entry->lockstateid_seq =
686 be32_to_cpu(lockstateid->seqid);
687 __entry->lockstateid_hash =
688 nfs_stateid_hash(lockstateid);
689 ),
690
691 TP_printk(
692 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
693 "fileid=%02x:%02x:%llu fhandle=0x%08x "
694 "stateid=%d:0x%08x lockstateid=%d:0x%08x",
695 __entry->error,
696 show_nfsv4_errors(__entry->error),
697 show_lock_cmd(__entry->cmd),
698 show_lock_type(__entry->type),
699 (long long)__entry->start,
700 (long long)__entry->end,
701 MAJOR(__entry->dev), MINOR(__entry->dev),
702 (unsigned long long)__entry->fileid,
703 __entry->fhandle,
704 __entry->stateid_seq, __entry->stateid_hash,
705 __entry->lockstateid_seq, __entry->lockstateid_hash
706 )
707);
708
Trond Myklebustca8acf82013-08-13 10:36:56 -0400709DECLARE_EVENT_CLASS(nfs4_set_delegation_event,
710 TP_PROTO(
711 const struct inode *inode,
712 fmode_t fmode
713 ),
714
715 TP_ARGS(inode, fmode),
716
717 TP_STRUCT__entry(
718 __field(dev_t, dev)
719 __field(u32, fhandle)
720 __field(u64, fileid)
721 __field(unsigned int, fmode)
722 ),
723
724 TP_fast_assign(
725 __entry->dev = inode->i_sb->s_dev;
726 __entry->fileid = NFS_FILEID(inode);
727 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
728 __entry->fmode = (__force unsigned int)fmode;
729 ),
730
731 TP_printk(
732 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x",
733 show_fmode_flags(__entry->fmode),
734 MAJOR(__entry->dev), MINOR(__entry->dev),
735 (unsigned long long)__entry->fileid,
736 __entry->fhandle
737 )
738);
739#define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \
740 DEFINE_EVENT(nfs4_set_delegation_event, name, \
741 TP_PROTO( \
742 const struct inode *inode, \
743 fmode_t fmode \
744 ), \
745 TP_ARGS(inode, fmode))
746DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
747DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
748
749TRACE_EVENT(nfs4_delegreturn_exit,
750 TP_PROTO(
751 const struct nfs4_delegreturnargs *args,
752 const struct nfs4_delegreturnres *res,
753 int error
754 ),
755
756 TP_ARGS(args, res, error),
757
758 TP_STRUCT__entry(
759 __field(dev_t, dev)
760 __field(u32, fhandle)
761 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500762 __field(int, stateid_seq)
763 __field(u32, stateid_hash)
Trond Myklebustca8acf82013-08-13 10:36:56 -0400764 ),
765
766 TP_fast_assign(
767 __entry->dev = res->server->s_dev;
768 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
769 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500770 __entry->stateid_seq =
771 be32_to_cpu(args->stateid->seqid);
772 __entry->stateid_hash =
773 nfs_stateid_hash(args->stateid);
Trond Myklebustca8acf82013-08-13 10:36:56 -0400774 ),
775
776 TP_printk(
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500777 "error=%d (%s) dev=%02x:%02x fhandle=0x%08x "
778 "stateid=%d:0x%08x",
Trond Myklebustca8acf82013-08-13 10:36:56 -0400779 __entry->error,
780 show_nfsv4_errors(__entry->error),
781 MAJOR(__entry->dev), MINOR(__entry->dev),
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500782 __entry->fhandle,
783 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustca8acf82013-08-13 10:36:56 -0400784 )
785);
786
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400787#ifdef CONFIG_NFS_V4_1
788DECLARE_EVENT_CLASS(nfs4_test_stateid_event,
789 TP_PROTO(
790 const struct nfs4_state *state,
791 const struct nfs4_lock_state *lsp,
792 int error
793 ),
794
795 TP_ARGS(state, lsp, error),
796
797 TP_STRUCT__entry(
798 __field(int, error)
799 __field(dev_t, dev)
800 __field(u32, fhandle)
801 __field(u64, fileid)
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500802 __field(int, stateid_seq)
803 __field(u32, stateid_hash)
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400804 ),
805
806 TP_fast_assign(
807 const struct inode *inode = state->inode;
808
809 __entry->error = error;
810 __entry->dev = inode->i_sb->s_dev;
811 __entry->fileid = NFS_FILEID(inode);
812 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500813 __entry->stateid_seq =
814 be32_to_cpu(state->stateid.seqid);
815 __entry->stateid_hash =
816 nfs_stateid_hash(&state->stateid);
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400817 ),
818
819 TP_printk(
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500820 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
821 "stateid=%d:0x%08x",
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400822 __entry->error,
823 show_nfsv4_errors(__entry->error),
824 MAJOR(__entry->dev), MINOR(__entry->dev),
825 (unsigned long long)__entry->fileid,
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500826 __entry->fhandle,
827 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebust08cb47f2013-08-20 21:59:40 -0400828 )
829);
830
831#define DEFINE_NFS4_TEST_STATEID_EVENT(name) \
832 DEFINE_EVENT(nfs4_test_stateid_event, name, \
833 TP_PROTO( \
834 const struct nfs4_state *state, \
835 const struct nfs4_lock_state *lsp, \
836 int error \
837 ), \
838 TP_ARGS(state, lsp, error))
839DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
840DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
841DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
842#endif /* CONFIG_NFS_V4_1 */
843
Trond Myklebust078ea3d2013-08-12 16:45:55 -0400844DECLARE_EVENT_CLASS(nfs4_lookup_event,
845 TP_PROTO(
846 const struct inode *dir,
847 const struct qstr *name,
848 int error
849 ),
850
851 TP_ARGS(dir, name, error),
852
853 TP_STRUCT__entry(
854 __field(dev_t, dev)
855 __field(int, error)
856 __field(u64, dir)
857 __string(name, name->name)
858 ),
859
860 TP_fast_assign(
861 __entry->dev = dir->i_sb->s_dev;
862 __entry->dir = NFS_FILEID(dir);
863 __entry->error = error;
864 __assign_str(name, name->name);
865 ),
866
867 TP_printk(
868 "error=%d (%s) name=%02x:%02x:%llu/%s",
869 __entry->error,
870 show_nfsv4_errors(__entry->error),
871 MAJOR(__entry->dev), MINOR(__entry->dev),
872 (unsigned long long)__entry->dir,
873 __get_str(name)
874 )
875);
876
877#define DEFINE_NFS4_LOOKUP_EVENT(name) \
878 DEFINE_EVENT(nfs4_lookup_event, name, \
879 TP_PROTO( \
880 const struct inode *dir, \
881 const struct qstr *name, \
882 int error \
883 ), \
884 TP_ARGS(dir, name, error))
885
886DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
887DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
888DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
889DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
890DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
891DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
892DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
893
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -0400894TRACE_EVENT(nfs4_rename,
895 TP_PROTO(
896 const struct inode *olddir,
897 const struct qstr *oldname,
898 const struct inode *newdir,
899 const struct qstr *newname,
900 int error
901 ),
902
903 TP_ARGS(olddir, oldname, newdir, newname, error),
904
905 TP_STRUCT__entry(
906 __field(dev_t, dev)
907 __field(int, error)
908 __field(u64, olddir)
909 __string(oldname, oldname->name)
910 __field(u64, newdir)
911 __string(newname, newname->name)
912 ),
913
914 TP_fast_assign(
915 __entry->dev = olddir->i_sb->s_dev;
916 __entry->olddir = NFS_FILEID(olddir);
917 __entry->newdir = NFS_FILEID(newdir);
918 __entry->error = error;
919 __assign_str(oldname, oldname->name);
920 __assign_str(newname, newname->name);
921 ),
922
923 TP_printk(
924 "error=%d (%s) oldname=%02x:%02x:%llu/%s "
925 "newname=%02x:%02x:%llu/%s",
926 __entry->error,
927 show_nfsv4_errors(__entry->error),
928 MAJOR(__entry->dev), MINOR(__entry->dev),
929 (unsigned long long)__entry->olddir,
930 __get_str(oldname),
931 MAJOR(__entry->dev), MINOR(__entry->dev),
932 (unsigned long long)__entry->newdir,
933 __get_str(newname)
934 )
935);
936
Trond Myklebustc1578b72013-08-12 16:58:42 -0400937DECLARE_EVENT_CLASS(nfs4_inode_event,
938 TP_PROTO(
939 const struct inode *inode,
940 int error
941 ),
942
943 TP_ARGS(inode, error),
944
945 TP_STRUCT__entry(
946 __field(dev_t, dev)
947 __field(u32, fhandle)
948 __field(u64, fileid)
949 __field(int, error)
950 ),
951
952 TP_fast_assign(
953 __entry->dev = inode->i_sb->s_dev;
954 __entry->fileid = NFS_FILEID(inode);
955 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
956 __entry->error = error;
957 ),
958
959 TP_printk(
960 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
961 __entry->error,
962 show_nfsv4_errors(__entry->error),
963 MAJOR(__entry->dev), MINOR(__entry->dev),
964 (unsigned long long)__entry->fileid,
965 __entry->fhandle
966 )
967);
968
969#define DEFINE_NFS4_INODE_EVENT(name) \
970 DEFINE_EVENT(nfs4_inode_event, name, \
971 TP_PROTO( \
972 const struct inode *inode, \
973 int error \
974 ), \
975 TP_ARGS(inode, error))
976
Trond Myklebustc1578b72013-08-12 16:58:42 -0400977DEFINE_NFS4_INODE_EVENT(nfs4_access);
978DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
979DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
980DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
981DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
982#ifdef CONFIG_NFS_V4_SECURITY_LABEL
983DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
984DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
985#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
Olga Kornievskaia48c95792015-11-24 13:29:41 -0500986
987DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
988 TP_PROTO(
989 const struct inode *inode,
990 const nfs4_stateid *stateid,
991 int error
992 ),
993
994 TP_ARGS(inode, stateid, error),
995
996 TP_STRUCT__entry(
997 __field(dev_t, dev)
998 __field(u32, fhandle)
999 __field(u64, fileid)
1000 __field(int, error)
1001 __field(int, stateid_seq)
1002 __field(u32, stateid_hash)
1003 ),
1004
1005 TP_fast_assign(
1006 __entry->dev = inode->i_sb->s_dev;
1007 __entry->fileid = NFS_FILEID(inode);
1008 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1009 __entry->error = error;
1010 __entry->stateid_seq =
1011 be32_to_cpu(stateid->seqid);
1012 __entry->stateid_hash =
1013 nfs_stateid_hash(stateid);
1014 ),
1015
1016 TP_printk(
1017 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1018 "stateid=%d:0x%08x",
1019 __entry->error,
1020 show_nfsv4_errors(__entry->error),
1021 MAJOR(__entry->dev), MINOR(__entry->dev),
1022 (unsigned long long)__entry->fileid,
1023 __entry->fhandle,
1024 __entry->stateid_seq, __entry->stateid_hash
1025 )
1026);
1027
1028#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1029 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1030 TP_PROTO( \
1031 const struct inode *inode, \
1032 const nfs4_stateid *stateid, \
1033 int error \
1034 ), \
1035 TP_ARGS(inode, stateid, error))
1036
1037DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1038DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
Trond Myklebustc1578b72013-08-12 16:58:42 -04001039
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001040DECLARE_EVENT_CLASS(nfs4_getattr_event,
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
1048 TP_ARGS(server, fhandle, fattr, error),
1049
1050 TP_STRUCT__entry(
1051 __field(dev_t, dev)
1052 __field(u32, fhandle)
1053 __field(u64, fileid)
1054 __field(unsigned int, valid)
1055 __field(int, error)
1056 ),
1057
1058 TP_fast_assign(
1059 __entry->dev = server->s_dev;
1060 __entry->valid = fattr->valid;
1061 __entry->fhandle = nfs_fhandle_hash(fhandle);
1062 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
1063 __entry->error = error;
1064 ),
1065
1066 TP_printk(
1067 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1068 "valid=%s",
1069 __entry->error,
1070 show_nfsv4_errors(__entry->error),
1071 MAJOR(__entry->dev), MINOR(__entry->dev),
1072 (unsigned long long)__entry->fileid,
1073 __entry->fhandle,
1074 show_nfs_fattr_flags(__entry->valid)
1075 )
1076);
1077
1078#define DEFINE_NFS4_GETATTR_EVENT(name) \
1079 DEFINE_EVENT(nfs4_getattr_event, name, \
1080 TP_PROTO( \
1081 const struct nfs_server *server, \
1082 const struct nfs_fh *fhandle, \
1083 const struct nfs_fattr *fattr, \
1084 int error \
1085 ), \
1086 TP_ARGS(server, fhandle, fattr, error))
1087DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1088DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1089DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1090
Trond Myklebust7cd14862015-08-20 20:07:54 -05001091DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1092 TP_PROTO(
1093 const struct nfs_client *clp,
1094 const struct nfs_fh *fhandle,
1095 const struct inode *inode,
1096 int error
1097 ),
1098
1099 TP_ARGS(clp, fhandle, inode, error),
1100
1101 TP_STRUCT__entry(
1102 __field(int, error)
1103 __field(dev_t, dev)
1104 __field(u32, fhandle)
1105 __field(u64, fileid)
1106 __string(dstaddr, clp ?
1107 rpc_peeraddr2str(clp->cl_rpcclient,
1108 RPC_DISPLAY_ADDR) : "unknown")
1109 ),
1110
1111 TP_fast_assign(
1112 __entry->error = error;
1113 __entry->fhandle = nfs_fhandle_hash(fhandle);
1114 if (inode != NULL) {
1115 __entry->fileid = NFS_FILEID(inode);
1116 __entry->dev = inode->i_sb->s_dev;
1117 } else {
1118 __entry->fileid = 0;
1119 __entry->dev = 0;
1120 }
1121 __assign_str(dstaddr, clp ?
1122 rpc_peeraddr2str(clp->cl_rpcclient,
1123 RPC_DISPLAY_ADDR) : "unknown")
1124 ),
1125
1126 TP_printk(
1127 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1128 "dstaddr=%s",
1129 __entry->error,
1130 show_nfsv4_errors(__entry->error),
1131 MAJOR(__entry->dev), MINOR(__entry->dev),
1132 (unsigned long long)__entry->fileid,
1133 __entry->fhandle,
1134 __get_str(dstaddr)
1135 )
1136);
1137
1138#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1139 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1140 TP_PROTO( \
1141 const struct nfs_client *clp, \
1142 const struct nfs_fh *fhandle, \
1143 const struct inode *inode, \
1144 int error \
1145 ), \
1146 TP_ARGS(clp, fhandle, inode, error))
1147DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1148
Trond Myklebuste07db902015-12-28 14:07:23 -05001149DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1150 TP_PROTO(
1151 const struct nfs_client *clp,
1152 const struct nfs_fh *fhandle,
1153 const struct inode *inode,
1154 const nfs4_stateid *stateid,
1155 int error
1156 ),
1157
1158 TP_ARGS(clp, fhandle, inode, stateid, error),
1159
1160 TP_STRUCT__entry(
1161 __field(int, error)
1162 __field(dev_t, dev)
1163 __field(u32, fhandle)
1164 __field(u64, fileid)
1165 __string(dstaddr, clp ?
1166 rpc_peeraddr2str(clp->cl_rpcclient,
1167 RPC_DISPLAY_ADDR) : "unknown")
1168 __field(int, stateid_seq)
1169 __field(u32, stateid_hash)
1170 ),
1171
1172 TP_fast_assign(
1173 __entry->error = error;
1174 __entry->fhandle = nfs_fhandle_hash(fhandle);
1175 if (inode != NULL) {
1176 __entry->fileid = NFS_FILEID(inode);
1177 __entry->dev = inode->i_sb->s_dev;
1178 } else {
1179 __entry->fileid = 0;
1180 __entry->dev = 0;
1181 }
1182 __assign_str(dstaddr, clp ?
1183 rpc_peeraddr2str(clp->cl_rpcclient,
1184 RPC_DISPLAY_ADDR) : "unknown")
1185 __entry->stateid_seq =
1186 be32_to_cpu(stateid->seqid);
1187 __entry->stateid_hash =
1188 nfs_stateid_hash(stateid);
1189 ),
1190
1191 TP_printk(
1192 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1193 "stateid=%d:0x%08x dstaddr=%s",
1194 __entry->error,
1195 show_nfsv4_errors(__entry->error),
1196 MAJOR(__entry->dev), MINOR(__entry->dev),
1197 (unsigned long long)__entry->fileid,
1198 __entry->fhandle,
1199 __entry->stateid_seq, __entry->stateid_hash,
1200 __get_str(dstaddr)
1201 )
1202);
1203
1204#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1205 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1206 TP_PROTO( \
1207 const struct nfs_client *clp, \
1208 const struct nfs_fh *fhandle, \
1209 const struct inode *inode, \
1210 const nfs4_stateid *stateid, \
1211 int error \
1212 ), \
1213 TP_ARGS(clp, fhandle, inode, stateid, error))
1214DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1215DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
Trond Myklebust7cd14862015-08-20 20:07:54 -05001216
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001217DECLARE_EVENT_CLASS(nfs4_idmap_event,
1218 TP_PROTO(
1219 const char *name,
1220 int len,
1221 u32 id,
1222 int error
1223 ),
1224
1225 TP_ARGS(name, len, id, error),
1226
1227 TP_STRUCT__entry(
1228 __field(int, error)
1229 __field(u32, id)
1230 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1231 ),
1232
1233 TP_fast_assign(
1234 if (len < 0)
1235 len = 0;
1236 __entry->error = error < 0 ? error : 0;
1237 __entry->id = id;
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -03001238 memcpy(__get_str(name), name, len);
1239 __get_str(name)[len] = 0;
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001240 ),
1241
1242 TP_printk(
1243 "error=%d id=%u name=%s",
1244 __entry->error,
1245 __entry->id,
1246 __get_str(name)
1247 )
1248);
1249#define DEFINE_NFS4_IDMAP_EVENT(name) \
1250 DEFINE_EVENT(nfs4_idmap_event, name, \
1251 TP_PROTO( \
1252 const char *name, \
1253 int len, \
1254 u32 id, \
1255 int error \
1256 ), \
1257 TP_ARGS(name, len, id, error))
1258DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1259DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1260DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1261DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1262
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001263DECLARE_EVENT_CLASS(nfs4_read_event,
1264 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001265 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001266 int error
1267 ),
1268
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001269 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001270
1271 TP_STRUCT__entry(
1272 __field(dev_t, dev)
1273 __field(u32, fhandle)
1274 __field(u64, fileid)
1275 __field(loff_t, offset)
1276 __field(size_t, count)
1277 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001278 __field(int, stateid_seq)
1279 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001280 ),
1281
1282 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001283 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001284 const struct nfs4_state *state =
1285 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001286 __entry->dev = inode->i_sb->s_dev;
1287 __entry->fileid = NFS_FILEID(inode);
1288 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001289 __entry->offset = hdr->args.offset;
1290 __entry->count = hdr->args.count;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001291 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001292 __entry->stateid_seq =
1293 be32_to_cpu(state->stateid.seqid);
1294 __entry->stateid_hash =
1295 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001296 ),
1297
1298 TP_printk(
1299 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001300 "offset=%lld count=%zu stateid=%d:0x%08x",
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001301 __entry->error,
1302 show_nfsv4_errors(__entry->error),
1303 MAJOR(__entry->dev), MINOR(__entry->dev),
1304 (unsigned long long)__entry->fileid,
1305 __entry->fhandle,
1306 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001307 __entry->count,
1308 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001309 )
1310);
1311#define DEFINE_NFS4_READ_EVENT(name) \
1312 DEFINE_EVENT(nfs4_read_event, name, \
1313 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001314 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001315 int error \
1316 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001317 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001318DEFINE_NFS4_READ_EVENT(nfs4_read);
1319#ifdef CONFIG_NFS_V4_1
1320DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1321#endif /* CONFIG_NFS_V4_1 */
1322
1323DECLARE_EVENT_CLASS(nfs4_write_event,
1324 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001325 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001326 int error
1327 ),
1328
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001329 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001330
1331 TP_STRUCT__entry(
1332 __field(dev_t, dev)
1333 __field(u32, fhandle)
1334 __field(u64, fileid)
1335 __field(loff_t, offset)
1336 __field(size_t, count)
1337 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001338 __field(int, stateid_seq)
1339 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001340 ),
1341
1342 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001343 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001344 const struct nfs4_state *state =
1345 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001346 __entry->dev = inode->i_sb->s_dev;
1347 __entry->fileid = NFS_FILEID(inode);
1348 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001349 __entry->offset = hdr->args.offset;
1350 __entry->count = hdr->args.count;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001351 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001352 __entry->stateid_seq =
1353 be32_to_cpu(state->stateid.seqid);
1354 __entry->stateid_hash =
1355 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001356 ),
1357
1358 TP_printk(
1359 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001360 "offset=%lld count=%zu stateid=%d:0x%08x",
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001361 __entry->error,
1362 show_nfsv4_errors(__entry->error),
1363 MAJOR(__entry->dev), MINOR(__entry->dev),
1364 (unsigned long long)__entry->fileid,
1365 __entry->fhandle,
1366 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001367 __entry->count,
1368 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001369 )
1370);
1371
1372#define DEFINE_NFS4_WRITE_EVENT(name) \
1373 DEFINE_EVENT(nfs4_write_event, name, \
1374 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001375 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001376 int error \
1377 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001378 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001379DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1380#ifdef CONFIG_NFS_V4_1
1381DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1382#endif /* CONFIG_NFS_V4_1 */
1383
1384DECLARE_EVENT_CLASS(nfs4_commit_event,
1385 TP_PROTO(
1386 const struct nfs_commit_data *data,
1387 int error
1388 ),
1389
1390 TP_ARGS(data, error),
1391
1392 TP_STRUCT__entry(
1393 __field(dev_t, dev)
1394 __field(u32, fhandle)
1395 __field(u64, fileid)
1396 __field(loff_t, offset)
1397 __field(size_t, count)
1398 __field(int, error)
1399 ),
1400
1401 TP_fast_assign(
1402 const struct inode *inode = data->inode;
1403 __entry->dev = inode->i_sb->s_dev;
1404 __entry->fileid = NFS_FILEID(inode);
1405 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1406 __entry->offset = data->args.offset;
1407 __entry->count = data->args.count;
1408 __entry->error = error;
1409 ),
1410
1411 TP_printk(
1412 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1413 "offset=%lld count=%zu",
1414 __entry->error,
1415 show_nfsv4_errors(__entry->error),
1416 MAJOR(__entry->dev), MINOR(__entry->dev),
1417 (unsigned long long)__entry->fileid,
1418 __entry->fhandle,
1419 (long long)__entry->offset,
1420 __entry->count
1421 )
1422);
1423#define DEFINE_NFS4_COMMIT_EVENT(name) \
1424 DEFINE_EVENT(nfs4_commit_event, name, \
1425 TP_PROTO( \
1426 const struct nfs_commit_data *data, \
1427 int error \
1428 ), \
1429 TP_ARGS(data, error))
1430DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1431#ifdef CONFIG_NFS_V4_1
1432DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001433
1434#define show_pnfs_iomode(iomode) \
1435 __print_symbolic(iomode, \
1436 { IOMODE_READ, "READ" }, \
1437 { IOMODE_RW, "RW" }, \
1438 { IOMODE_ANY, "ANY" })
1439
1440TRACE_EVENT(nfs4_layoutget,
1441 TP_PROTO(
1442 const struct nfs_open_context *ctx,
1443 const struct pnfs_layout_range *args,
1444 const struct pnfs_layout_range *res,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001445 const nfs4_stateid *layout_stateid,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001446 int error
1447 ),
1448
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001449 TP_ARGS(ctx, args, res, layout_stateid, error),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001450
1451 TP_STRUCT__entry(
1452 __field(dev_t, dev)
1453 __field(u32, fhandle)
1454 __field(u64, fileid)
1455 __field(u32, iomode)
1456 __field(u64, offset)
1457 __field(u64, count)
1458 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001459 __field(int, stateid_seq)
1460 __field(u32, stateid_hash)
1461 __field(int, layoutstateid_seq)
1462 __field(u32, layoutstateid_hash)
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001463 ),
1464
1465 TP_fast_assign(
David Howells2b0143b2015-03-17 22:25:59 +00001466 const struct inode *inode = d_inode(ctx->dentry);
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001467 const struct nfs4_state *state = ctx->state;
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001468 __entry->dev = inode->i_sb->s_dev;
1469 __entry->fileid = NFS_FILEID(inode);
1470 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1471 __entry->iomode = args->iomode;
1472 __entry->offset = args->offset;
1473 __entry->count = args->length;
1474 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001475 __entry->stateid_seq =
1476 be32_to_cpu(state->stateid.seqid);
1477 __entry->stateid_hash =
1478 nfs_stateid_hash(&state->stateid);
1479 if (!error) {
1480 __entry->layoutstateid_seq =
1481 be32_to_cpu(layout_stateid->seqid);
1482 __entry->layoutstateid_hash =
1483 nfs_stateid_hash(layout_stateid);
1484 } else {
1485 __entry->layoutstateid_seq = 0;
1486 __entry->layoutstateid_hash = 0;
1487 }
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001488 ),
1489
1490 TP_printk(
1491 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001492 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1493 "layoutstateid=%d:0x%08x",
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001494 __entry->error,
1495 show_nfsv4_errors(__entry->error),
1496 MAJOR(__entry->dev), MINOR(__entry->dev),
1497 (unsigned long long)__entry->fileid,
1498 __entry->fhandle,
1499 show_pnfs_iomode(__entry->iomode),
1500 (unsigned long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001501 (unsigned long long)__entry->count,
1502 __entry->stateid_seq, __entry->stateid_hash,
1503 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001504 )
1505);
1506
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001507DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1508DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
Trond Myklebust6a463beb2015-08-20 15:40:47 -05001509DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001510
Jeff Layton9a4bf312015-12-10 10:41:58 -05001511#define show_pnfs_update_layout_reason(reason) \
1512 __print_symbolic(reason, \
1513 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
1514 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
1515 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
1516 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
1517 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
1518 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
1519 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
1520 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
1521 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
1522 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
Jeff Layton183d9e72016-05-17 12:28:47 -04001523 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
1524 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
Jeff Layton9a4bf312015-12-10 10:41:58 -05001525 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" })
1526
1527TRACE_EVENT(pnfs_update_layout,
1528 TP_PROTO(struct inode *inode,
1529 loff_t pos,
1530 u64 count,
1531 enum pnfs_iomode iomode,
Trond Myklebustf4848302015-12-26 18:03:07 -05001532 struct pnfs_layout_hdr *lo,
Jeff Layton183d9e72016-05-17 12:28:47 -04001533 struct pnfs_layout_segment *lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05001534 enum pnfs_update_layout_reason reason
1535 ),
Jeff Layton183d9e72016-05-17 12:28:47 -04001536 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
Jeff Layton9a4bf312015-12-10 10:41:58 -05001537 TP_STRUCT__entry(
1538 __field(dev_t, dev)
1539 __field(u64, fileid)
1540 __field(u32, fhandle)
1541 __field(loff_t, pos)
1542 __field(u64, count)
1543 __field(enum pnfs_iomode, iomode)
Trond Myklebustf4848302015-12-26 18:03:07 -05001544 __field(int, layoutstateid_seq)
1545 __field(u32, layoutstateid_hash)
Jeff Layton183d9e72016-05-17 12:28:47 -04001546 __field(long, lseg)
Jeff Layton9a4bf312015-12-10 10:41:58 -05001547 __field(enum pnfs_update_layout_reason, reason)
1548 ),
1549 TP_fast_assign(
1550 __entry->dev = inode->i_sb->s_dev;
1551 __entry->fileid = NFS_FILEID(inode);
1552 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1553 __entry->pos = pos;
1554 __entry->count = count;
1555 __entry->iomode = iomode;
Jeff Layton9a4bf312015-12-10 10:41:58 -05001556 __entry->reason = reason;
Trond Myklebustf4848302015-12-26 18:03:07 -05001557 if (lo != NULL) {
1558 __entry->layoutstateid_seq =
1559 be32_to_cpu(lo->plh_stateid.seqid);
1560 __entry->layoutstateid_hash =
1561 nfs_stateid_hash(&lo->plh_stateid);
1562 } else {
1563 __entry->layoutstateid_seq = 0;
1564 __entry->layoutstateid_hash = 0;
1565 }
Jeff Layton183d9e72016-05-17 12:28:47 -04001566 __entry->lseg = (long)lseg;
Jeff Layton9a4bf312015-12-10 10:41:58 -05001567 ),
1568 TP_printk(
1569 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustf4848302015-12-26 18:03:07 -05001570 "iomode=%s pos=%llu count=%llu "
Jeff Layton183d9e72016-05-17 12:28:47 -04001571 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
Jeff Layton9a4bf312015-12-10 10:41:58 -05001572 MAJOR(__entry->dev), MINOR(__entry->dev),
1573 (unsigned long long)__entry->fileid,
1574 __entry->fhandle,
1575 show_pnfs_iomode(__entry->iomode),
1576 (unsigned long long)__entry->pos,
Trond Myklebustf4848302015-12-26 18:03:07 -05001577 (unsigned long long)__entry->count,
1578 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
Jeff Layton183d9e72016-05-17 12:28:47 -04001579 __entry->lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05001580 show_pnfs_update_layout_reason(__entry->reason)
1581 )
1582);
1583
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001584#endif /* CONFIG_NFS_V4_1 */
1585
Trond Myklebustc6d01c62013-08-09 11:51:26 -04001586#endif /* _TRACE_NFS4_H */
1587
1588#undef TRACE_INCLUDE_PATH
1589#define TRACE_INCLUDE_PATH .
1590#define TRACE_INCLUDE_FILE nfs4trace
1591/* This part must be outside protection */
1592#include <trace/define_trace.h>