blob: 7a5588c25f70a5405446d2e787b8658e2b9acad3 [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 Schumaker39443692017-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 Schumaker39443692017-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
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400240#define show_nfs4_sequence_status_flags(status) \
241 __print_flags((unsigned long)status, "|", \
242 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
243 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
244 "CB_GSS_CONTEXTS_EXPIRING" }, \
245 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
246 "CB_GSS_CONTEXTS_EXPIRED" }, \
247 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
248 "EXPIRED_ALL_STATE_REVOKED" }, \
249 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
250 "EXPIRED_SOME_STATE_REVOKED" }, \
251 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
252 "ADMIN_STATE_REVOKED" }, \
253 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
254 "RECALLABLE_STATE_REVOKED" }, \
255 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
256 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
257 "RESTART_RECLAIM_NEEDED" }, \
258 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
259 "CB_PATH_DOWN_SESSION" }, \
260 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
261 "BACKCHANNEL_FAULT" })
262
263TRACE_EVENT(nfs4_sequence_done,
264 TP_PROTO(
265 const struct nfs4_session *session,
266 const struct nfs4_sequence_res *res
267 ),
268 TP_ARGS(session, res),
269
270 TP_STRUCT__entry(
271 __field(unsigned int, session)
272 __field(unsigned int, slot_nr)
273 __field(unsigned int, seq_nr)
274 __field(unsigned int, highest_slotid)
275 __field(unsigned int, target_highest_slotid)
276 __field(unsigned int, status_flags)
277 __field(int, error)
278 ),
279
280 TP_fast_assign(
281 const struct nfs4_slot *sr_slot = res->sr_slot;
282 __entry->session = nfs_session_id_hash(&session->sess_id);
283 __entry->slot_nr = sr_slot->slot_nr;
284 __entry->seq_nr = sr_slot->seq_nr;
285 __entry->highest_slotid = res->sr_highest_slotid;
286 __entry->target_highest_slotid =
287 res->sr_target_highest_slotid;
Andrew Elble52618df2015-12-02 09:19:43 -0500288 __entry->status_flags = res->sr_status_flags;
Trond Myklebust2f92ae32013-08-14 17:58:28 -0400289 __entry->error = res->sr_status;
290 ),
291 TP_printk(
292 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
293 "highest_slotid=%u target_highest_slotid=%u "
294 "status_flags=%u (%s)",
295 __entry->error,
296 show_nfsv4_errors(__entry->error),
297 __entry->session,
298 __entry->slot_nr,
299 __entry->seq_nr,
300 __entry->highest_slotid,
301 __entry->target_highest_slotid,
302 __entry->status_flags,
303 show_nfs4_sequence_status_flags(__entry->status_flags)
304 )
305);
306
307struct cb_sequenceargs;
308struct cb_sequenceres;
309
310TRACE_EVENT(nfs4_cb_sequence,
311 TP_PROTO(
312 const struct cb_sequenceargs *args,
313 const struct cb_sequenceres *res,
314 __be32 status
315 ),
316 TP_ARGS(args, res, status),
317
318 TP_STRUCT__entry(
319 __field(unsigned int, session)
320 __field(unsigned int, slot_nr)
321 __field(unsigned int, seq_nr)
322 __field(unsigned int, highest_slotid)
323 __field(unsigned int, cachethis)
324 __field(int, error)
325 ),
326
327 TP_fast_assign(
328 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
329 __entry->slot_nr = args->csa_slotid;
330 __entry->seq_nr = args->csa_sequenceid;
331 __entry->highest_slotid = args->csa_highestslotid;
332 __entry->cachethis = args->csa_cachethis;
333 __entry->error = -be32_to_cpu(status);
334 ),
335
336 TP_printk(
337 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
338 "highest_slotid=%u",
339 __entry->error,
340 show_nfsv4_errors(__entry->error),
341 __entry->session,
342 __entry->slot_nr,
343 __entry->seq_nr,
344 __entry->highest_slotid
345 )
346);
Trond Myklebustc6d01c62013-08-09 11:51:26 -0400347#endif /* CONFIG_NFS_V4_1 */
348
Anna Schumakerad05cc02017-01-11 13:37:06 -0500349TRACE_EVENT(nfs4_setup_sequence,
350 TP_PROTO(
351 const struct nfs4_session *session,
352 const struct nfs4_sequence_args *args
353 ),
354 TP_ARGS(session, args),
355
356 TP_STRUCT__entry(
357 __field(unsigned int, session)
358 __field(unsigned int, slot_nr)
359 __field(unsigned int, seq_nr)
360 __field(unsigned int, highest_used_slotid)
361 ),
362
363 TP_fast_assign(
364 const struct nfs4_slot *sa_slot = args->sa_slot;
365 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0;
366 __entry->slot_nr = sa_slot->slot_nr;
367 __entry->seq_nr = sa_slot->seq_nr;
368 __entry->highest_used_slotid =
369 sa_slot->table->highest_used_slotid;
370 ),
371 TP_printk(
372 "session=0x%08x slot_nr=%u seq_nr=%u "
373 "highest_used_slotid=%u",
374 __entry->session,
375 __entry->slot_nr,
376 __entry->seq_nr,
377 __entry->highest_used_slotid
378 )
379);
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
Jeff Layton5b5faaf2017-06-29 06:34:52 -0700890TRACE_EVENT(nfs4_lookupp,
891 TP_PROTO(
892 const struct inode *inode,
893 int error
894 ),
895
896 TP_ARGS(inode, error),
897
898 TP_STRUCT__entry(
899 __field(dev_t, dev)
900 __field(u64, ino)
901 __field(int, error)
902 ),
903
904 TP_fast_assign(
905 __entry->dev = inode->i_sb->s_dev;
906 __entry->ino = NFS_FILEID(inode);
907 __entry->error = error;
908 ),
909
910 TP_printk(
911 "error=%d (%s) inode=%02x:%02x:%llu",
912 __entry->error,
913 show_nfsv4_errors(__entry->error),
914 MAJOR(__entry->dev), MINOR(__entry->dev),
915 (unsigned long long)__entry->ino
916 )
917);
918
Trond Myklebustfbc6f7c2013-08-12 17:08:26 -0400919TRACE_EVENT(nfs4_rename,
920 TP_PROTO(
921 const struct inode *olddir,
922 const struct qstr *oldname,
923 const struct inode *newdir,
924 const struct qstr *newname,
925 int error
926 ),
927
928 TP_ARGS(olddir, oldname, newdir, newname, error),
929
930 TP_STRUCT__entry(
931 __field(dev_t, dev)
932 __field(int, error)
933 __field(u64, olddir)
934 __string(oldname, oldname->name)
935 __field(u64, newdir)
936 __string(newname, newname->name)
937 ),
938
939 TP_fast_assign(
940 __entry->dev = olddir->i_sb->s_dev;
941 __entry->olddir = NFS_FILEID(olddir);
942 __entry->newdir = NFS_FILEID(newdir);
943 __entry->error = error;
944 __assign_str(oldname, oldname->name);
945 __assign_str(newname, newname->name);
946 ),
947
948 TP_printk(
949 "error=%d (%s) oldname=%02x:%02x:%llu/%s "
950 "newname=%02x:%02x:%llu/%s",
951 __entry->error,
952 show_nfsv4_errors(__entry->error),
953 MAJOR(__entry->dev), MINOR(__entry->dev),
954 (unsigned long long)__entry->olddir,
955 __get_str(oldname),
956 MAJOR(__entry->dev), MINOR(__entry->dev),
957 (unsigned long long)__entry->newdir,
958 __get_str(newname)
959 )
960);
961
Trond Myklebustc1578b72013-08-12 16:58:42 -0400962DECLARE_EVENT_CLASS(nfs4_inode_event,
963 TP_PROTO(
964 const struct inode *inode,
965 int error
966 ),
967
968 TP_ARGS(inode, error),
969
970 TP_STRUCT__entry(
971 __field(dev_t, dev)
972 __field(u32, fhandle)
973 __field(u64, fileid)
974 __field(int, error)
975 ),
976
977 TP_fast_assign(
978 __entry->dev = inode->i_sb->s_dev;
979 __entry->fileid = NFS_FILEID(inode);
980 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
981 __entry->error = error;
982 ),
983
984 TP_printk(
985 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x",
986 __entry->error,
987 show_nfsv4_errors(__entry->error),
988 MAJOR(__entry->dev), MINOR(__entry->dev),
989 (unsigned long long)__entry->fileid,
990 __entry->fhandle
991 )
992);
993
994#define DEFINE_NFS4_INODE_EVENT(name) \
995 DEFINE_EVENT(nfs4_inode_event, name, \
996 TP_PROTO( \
997 const struct inode *inode, \
998 int error \
999 ), \
1000 TP_ARGS(inode, error))
1001
Trond Myklebustc1578b72013-08-12 16:58:42 -04001002DEFINE_NFS4_INODE_EVENT(nfs4_access);
1003DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
1004DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
1005DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
1006DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
1007#ifdef CONFIG_NFS_V4_SECURITY_LABEL
1008DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
1009DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
1010#endif /* CONFIG_NFS_V4_SECURITY_LABEL */
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001011
1012DECLARE_EVENT_CLASS(nfs4_inode_stateid_event,
1013 TP_PROTO(
1014 const struct inode *inode,
1015 const nfs4_stateid *stateid,
1016 int error
1017 ),
1018
1019 TP_ARGS(inode, stateid, error),
1020
1021 TP_STRUCT__entry(
1022 __field(dev_t, dev)
1023 __field(u32, fhandle)
1024 __field(u64, fileid)
1025 __field(int, error)
1026 __field(int, stateid_seq)
1027 __field(u32, stateid_hash)
1028 ),
1029
1030 TP_fast_assign(
1031 __entry->dev = inode->i_sb->s_dev;
1032 __entry->fileid = NFS_FILEID(inode);
1033 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1034 __entry->error = error;
1035 __entry->stateid_seq =
1036 be32_to_cpu(stateid->seqid);
1037 __entry->stateid_hash =
1038 nfs_stateid_hash(stateid);
1039 ),
1040
1041 TP_printk(
1042 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1043 "stateid=%d:0x%08x",
1044 __entry->error,
1045 show_nfsv4_errors(__entry->error),
1046 MAJOR(__entry->dev), MINOR(__entry->dev),
1047 (unsigned long long)__entry->fileid,
1048 __entry->fhandle,
1049 __entry->stateid_seq, __entry->stateid_hash
1050 )
1051);
1052
1053#define DEFINE_NFS4_INODE_STATEID_EVENT(name) \
1054 DEFINE_EVENT(nfs4_inode_stateid_event, name, \
1055 TP_PROTO( \
1056 const struct inode *inode, \
1057 const nfs4_stateid *stateid, \
1058 int error \
1059 ), \
1060 TP_ARGS(inode, stateid, error))
1061
1062DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1063DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
Trond Myklebustc1578b72013-08-12 16:58:42 -04001064
Trond Myklebustb5f875a2013-08-13 13:01:39 -04001065DECLARE_EVENT_CLASS(nfs4_getattr_event,
1066 TP_PROTO(
1067 const struct nfs_server *server,
1068 const struct nfs_fh *fhandle,
1069 const struct nfs_fattr *fattr,
1070 int error
1071 ),
1072
1073 TP_ARGS(server, fhandle, fattr, error),
1074
1075 TP_STRUCT__entry(
1076 __field(dev_t, dev)
1077 __field(u32, fhandle)
1078 __field(u64, fileid)
1079 __field(unsigned int, valid)
1080 __field(int, error)
1081 ),
1082
1083 TP_fast_assign(
1084 __entry->dev = server->s_dev;
1085 __entry->valid = fattr->valid;
1086 __entry->fhandle = nfs_fhandle_hash(fhandle);
1087 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0;
1088 __entry->error = error;
1089 ),
1090
1091 TP_printk(
1092 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1093 "valid=%s",
1094 __entry->error,
1095 show_nfsv4_errors(__entry->error),
1096 MAJOR(__entry->dev), MINOR(__entry->dev),
1097 (unsigned long long)__entry->fileid,
1098 __entry->fhandle,
1099 show_nfs_fattr_flags(__entry->valid)
1100 )
1101);
1102
1103#define DEFINE_NFS4_GETATTR_EVENT(name) \
1104 DEFINE_EVENT(nfs4_getattr_event, name, \
1105 TP_PROTO( \
1106 const struct nfs_server *server, \
1107 const struct nfs_fh *fhandle, \
1108 const struct nfs_fattr *fattr, \
1109 int error \
1110 ), \
1111 TP_ARGS(server, fhandle, fattr, error))
1112DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1113DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1114DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1115
Trond Myklebust7cd14862015-08-20 20:07:54 -05001116DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
1117 TP_PROTO(
1118 const struct nfs_client *clp,
1119 const struct nfs_fh *fhandle,
1120 const struct inode *inode,
1121 int error
1122 ),
1123
1124 TP_ARGS(clp, fhandle, inode, error),
1125
1126 TP_STRUCT__entry(
1127 __field(int, error)
1128 __field(dev_t, dev)
1129 __field(u32, fhandle)
1130 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001131 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001132 ),
1133
1134 TP_fast_assign(
1135 __entry->error = error;
1136 __entry->fhandle = nfs_fhandle_hash(fhandle);
1137 if (inode != NULL) {
1138 __entry->fileid = NFS_FILEID(inode);
1139 __entry->dev = inode->i_sb->s_dev;
1140 } else {
1141 __entry->fileid = 0;
1142 __entry->dev = 0;
1143 }
Anna Schumaker39443692017-11-01 15:48:43 -04001144 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebust7cd14862015-08-20 20:07:54 -05001145 ),
1146
1147 TP_printk(
1148 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1149 "dstaddr=%s",
1150 __entry->error,
1151 show_nfsv4_errors(__entry->error),
1152 MAJOR(__entry->dev), MINOR(__entry->dev),
1153 (unsigned long long)__entry->fileid,
1154 __entry->fhandle,
1155 __get_str(dstaddr)
1156 )
1157);
1158
1159#define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \
1160 DEFINE_EVENT(nfs4_inode_callback_event, name, \
1161 TP_PROTO( \
1162 const struct nfs_client *clp, \
1163 const struct nfs_fh *fhandle, \
1164 const struct inode *inode, \
1165 int error \
1166 ), \
1167 TP_ARGS(clp, fhandle, inode, error))
1168DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1169
Trond Myklebuste07db902015-12-28 14:07:23 -05001170DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
1171 TP_PROTO(
1172 const struct nfs_client *clp,
1173 const struct nfs_fh *fhandle,
1174 const struct inode *inode,
1175 const nfs4_stateid *stateid,
1176 int error
1177 ),
1178
1179 TP_ARGS(clp, fhandle, inode, stateid, error),
1180
1181 TP_STRUCT__entry(
1182 __field(int, error)
1183 __field(dev_t, dev)
1184 __field(u32, fhandle)
1185 __field(u64, fileid)
Anna Schumaker39443692017-11-01 15:48:43 -04001186 __string(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001187 __field(int, stateid_seq)
1188 __field(u32, stateid_hash)
1189 ),
1190
1191 TP_fast_assign(
1192 __entry->error = error;
1193 __entry->fhandle = nfs_fhandle_hash(fhandle);
1194 if (inode != NULL) {
1195 __entry->fileid = NFS_FILEID(inode);
1196 __entry->dev = inode->i_sb->s_dev;
1197 } else {
1198 __entry->fileid = 0;
1199 __entry->dev = 0;
1200 }
Anna Schumaker39443692017-11-01 15:48:43 -04001201 __assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
Trond Myklebuste07db902015-12-28 14:07:23 -05001202 __entry->stateid_seq =
1203 be32_to_cpu(stateid->seqid);
1204 __entry->stateid_hash =
1205 nfs_stateid_hash(stateid);
1206 ),
1207
1208 TP_printk(
1209 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1210 "stateid=%d:0x%08x dstaddr=%s",
1211 __entry->error,
1212 show_nfsv4_errors(__entry->error),
1213 MAJOR(__entry->dev), MINOR(__entry->dev),
1214 (unsigned long long)__entry->fileid,
1215 __entry->fhandle,
1216 __entry->stateid_seq, __entry->stateid_hash,
1217 __get_str(dstaddr)
1218 )
1219);
1220
1221#define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \
1222 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \
1223 TP_PROTO( \
1224 const struct nfs_client *clp, \
1225 const struct nfs_fh *fhandle, \
1226 const struct inode *inode, \
1227 const nfs4_stateid *stateid, \
1228 int error \
1229 ), \
1230 TP_ARGS(clp, fhandle, inode, stateid, error))
1231DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1232DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
Trond Myklebust7cd14862015-08-20 20:07:54 -05001233
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001234DECLARE_EVENT_CLASS(nfs4_idmap_event,
1235 TP_PROTO(
1236 const char *name,
1237 int len,
1238 u32 id,
1239 int error
1240 ),
1241
1242 TP_ARGS(name, len, id, error),
1243
1244 TP_STRUCT__entry(
1245 __field(int, error)
1246 __field(u32, id)
1247 __dynamic_array(char, name, len > 0 ? len + 1 : 1)
1248 ),
1249
1250 TP_fast_assign(
1251 if (len < 0)
1252 len = 0;
1253 __entry->error = error < 0 ? error : 0;
1254 __entry->id = id;
Daniel Bristot de Oliveira752d5962016-07-01 20:44:36 -03001255 memcpy(__get_str(name), name, len);
1256 __get_str(name)[len] = 0;
Trond Myklebust1f2d30b2013-08-13 11:34:01 -04001257 ),
1258
1259 TP_printk(
1260 "error=%d id=%u name=%s",
1261 __entry->error,
1262 __entry->id,
1263 __get_str(name)
1264 )
1265);
1266#define DEFINE_NFS4_IDMAP_EVENT(name) \
1267 DEFINE_EVENT(nfs4_idmap_event, name, \
1268 TP_PROTO( \
1269 const char *name, \
1270 int len, \
1271 u32 id, \
1272 int error \
1273 ), \
1274 TP_ARGS(name, len, id, error))
1275DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1276DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1277DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1278DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1279
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001280DECLARE_EVENT_CLASS(nfs4_read_event,
1281 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001282 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001283 int error
1284 ),
1285
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001286 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001287
1288 TP_STRUCT__entry(
1289 __field(dev_t, dev)
1290 __field(u32, fhandle)
1291 __field(u64, fileid)
1292 __field(loff_t, offset)
1293 __field(size_t, count)
1294 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001295 __field(int, stateid_seq)
1296 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001297 ),
1298
1299 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001300 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001301 const struct nfs4_state *state =
1302 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001303 __entry->dev = inode->i_sb->s_dev;
1304 __entry->fileid = NFS_FILEID(inode);
1305 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001306 __entry->offset = hdr->args.offset;
1307 __entry->count = hdr->args.count;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001308 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001309 __entry->stateid_seq =
1310 be32_to_cpu(state->stateid.seqid);
1311 __entry->stateid_hash =
1312 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001313 ),
1314
1315 TP_printk(
1316 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001317 "offset=%lld count=%zu stateid=%d:0x%08x",
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001318 __entry->error,
1319 show_nfsv4_errors(__entry->error),
1320 MAJOR(__entry->dev), MINOR(__entry->dev),
1321 (unsigned long long)__entry->fileid,
1322 __entry->fhandle,
1323 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001324 __entry->count,
1325 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001326 )
1327);
1328#define DEFINE_NFS4_READ_EVENT(name) \
1329 DEFINE_EVENT(nfs4_read_event, name, \
1330 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001331 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001332 int error \
1333 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001334 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001335DEFINE_NFS4_READ_EVENT(nfs4_read);
1336#ifdef CONFIG_NFS_V4_1
1337DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1338#endif /* CONFIG_NFS_V4_1 */
1339
1340DECLARE_EVENT_CLASS(nfs4_write_event,
1341 TP_PROTO(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001342 const struct nfs_pgio_header *hdr,
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001343 int error
1344 ),
1345
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001346 TP_ARGS(hdr, error),
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001347
1348 TP_STRUCT__entry(
1349 __field(dev_t, dev)
1350 __field(u32, fhandle)
1351 __field(u64, fileid)
1352 __field(loff_t, offset)
1353 __field(size_t, count)
1354 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001355 __field(int, stateid_seq)
1356 __field(u32, stateid_hash)
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001357 ),
1358
1359 TP_fast_assign(
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001360 const struct inode *inode = hdr->inode;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001361 const struct nfs4_state *state =
1362 hdr->args.context->state;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001363 __entry->dev = inode->i_sb->s_dev;
1364 __entry->fileid = NFS_FILEID(inode);
1365 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001366 __entry->offset = hdr->args.offset;
1367 __entry->count = hdr->args.count;
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001368 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001369 __entry->stateid_seq =
1370 be32_to_cpu(state->stateid.seqid);
1371 __entry->stateid_hash =
1372 nfs_stateid_hash(&state->stateid);
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001373 ),
1374
1375 TP_printk(
1376 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001377 "offset=%lld count=%zu stateid=%d:0x%08x",
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001378 __entry->error,
1379 show_nfsv4_errors(__entry->error),
1380 MAJOR(__entry->dev), MINOR(__entry->dev),
1381 (unsigned long long)__entry->fileid,
1382 __entry->fhandle,
1383 (long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001384 __entry->count,
1385 __entry->stateid_seq, __entry->stateid_hash
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001386 )
1387);
1388
1389#define DEFINE_NFS4_WRITE_EVENT(name) \
1390 DEFINE_EVENT(nfs4_write_event, name, \
1391 TP_PROTO( \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001392 const struct nfs_pgio_header *hdr, \
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001393 int error \
1394 ), \
Weston Andros Adamsond45f60c2014-06-09 11:48:35 -04001395 TP_ARGS(hdr, error))
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001396DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1397#ifdef CONFIG_NFS_V4_1
1398DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1399#endif /* CONFIG_NFS_V4_1 */
1400
1401DECLARE_EVENT_CLASS(nfs4_commit_event,
1402 TP_PROTO(
1403 const struct nfs_commit_data *data,
1404 int error
1405 ),
1406
1407 TP_ARGS(data, error),
1408
1409 TP_STRUCT__entry(
1410 __field(dev_t, dev)
1411 __field(u32, fhandle)
1412 __field(u64, fileid)
1413 __field(loff_t, offset)
1414 __field(size_t, count)
1415 __field(int, error)
1416 ),
1417
1418 TP_fast_assign(
1419 const struct inode *inode = data->inode;
1420 __entry->dev = inode->i_sb->s_dev;
1421 __entry->fileid = NFS_FILEID(inode);
1422 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1423 __entry->offset = data->args.offset;
1424 __entry->count = data->args.count;
1425 __entry->error = error;
1426 ),
1427
1428 TP_printk(
1429 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1430 "offset=%lld count=%zu",
1431 __entry->error,
1432 show_nfsv4_errors(__entry->error),
1433 MAJOR(__entry->dev), MINOR(__entry->dev),
1434 (unsigned long long)__entry->fileid,
1435 __entry->fhandle,
1436 (long long)__entry->offset,
1437 __entry->count
1438 )
1439);
1440#define DEFINE_NFS4_COMMIT_EVENT(name) \
1441 DEFINE_EVENT(nfs4_commit_event, name, \
1442 TP_PROTO( \
1443 const struct nfs_commit_data *data, \
1444 int error \
1445 ), \
1446 TP_ARGS(data, error))
1447DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1448#ifdef CONFIG_NFS_V4_1
1449DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001450
1451#define show_pnfs_iomode(iomode) \
1452 __print_symbolic(iomode, \
1453 { IOMODE_READ, "READ" }, \
1454 { IOMODE_RW, "RW" }, \
1455 { IOMODE_ANY, "ANY" })
1456
1457TRACE_EVENT(nfs4_layoutget,
1458 TP_PROTO(
1459 const struct nfs_open_context *ctx,
1460 const struct pnfs_layout_range *args,
1461 const struct pnfs_layout_range *res,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001462 const nfs4_stateid *layout_stateid,
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001463 int error
1464 ),
1465
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001466 TP_ARGS(ctx, args, res, layout_stateid, error),
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001467
1468 TP_STRUCT__entry(
1469 __field(dev_t, dev)
1470 __field(u32, fhandle)
1471 __field(u64, fileid)
1472 __field(u32, iomode)
1473 __field(u64, offset)
1474 __field(u64, count)
1475 __field(int, error)
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001476 __field(int, stateid_seq)
1477 __field(u32, stateid_hash)
1478 __field(int, layoutstateid_seq)
1479 __field(u32, layoutstateid_hash)
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001480 ),
1481
1482 TP_fast_assign(
David Howells2b0143b2015-03-17 22:25:59 +00001483 const struct inode *inode = d_inode(ctx->dentry);
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001484 const struct nfs4_state *state = ctx->state;
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001485 __entry->dev = inode->i_sb->s_dev;
1486 __entry->fileid = NFS_FILEID(inode);
1487 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1488 __entry->iomode = args->iomode;
1489 __entry->offset = args->offset;
1490 __entry->count = args->length;
1491 __entry->error = error;
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001492 __entry->stateid_seq =
1493 be32_to_cpu(state->stateid.seqid);
1494 __entry->stateid_hash =
1495 nfs_stateid_hash(&state->stateid);
1496 if (!error) {
1497 __entry->layoutstateid_seq =
1498 be32_to_cpu(layout_stateid->seqid);
1499 __entry->layoutstateid_hash =
1500 nfs_stateid_hash(layout_stateid);
1501 } else {
1502 __entry->layoutstateid_seq = 0;
1503 __entry->layoutstateid_hash = 0;
1504 }
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001505 ),
1506
1507 TP_printk(
1508 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001509 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1510 "layoutstateid=%d:0x%08x",
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001511 __entry->error,
1512 show_nfsv4_errors(__entry->error),
1513 MAJOR(__entry->dev), MINOR(__entry->dev),
1514 (unsigned long long)__entry->fileid,
1515 __entry->fhandle,
1516 show_pnfs_iomode(__entry->iomode),
1517 (unsigned long long)__entry->offset,
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001518 (unsigned long long)__entry->count,
1519 __entry->stateid_seq, __entry->stateid_hash,
1520 __entry->layoutstateid_seq, __entry->layoutstateid_hash
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001521 )
1522);
1523
Olga Kornievskaia48c95792015-11-24 13:29:41 -05001524DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1525DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
Trond Myklebust6a463beb2015-08-20 15:40:47 -05001526DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
Trond Myklebust1037e6e2013-08-14 16:36:51 -04001527
Jeff Layton9a4bf312015-12-10 10:41:58 -05001528#define show_pnfs_update_layout_reason(reason) \
1529 __print_symbolic(reason, \
1530 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \
1531 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \
1532 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \
1533 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \
1534 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \
1535 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \
1536 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \
1537 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \
1538 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \
1539 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \
Jeff Layton183d9e72016-05-17 12:28:47 -04001540 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \
1541 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \
Jeff Layton9a4bf312015-12-10 10:41:58 -05001542 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" })
1543
1544TRACE_EVENT(pnfs_update_layout,
1545 TP_PROTO(struct inode *inode,
1546 loff_t pos,
1547 u64 count,
1548 enum pnfs_iomode iomode,
Trond Myklebustf4848302015-12-26 18:03:07 -05001549 struct pnfs_layout_hdr *lo,
Jeff Layton183d9e72016-05-17 12:28:47 -04001550 struct pnfs_layout_segment *lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05001551 enum pnfs_update_layout_reason reason
1552 ),
Jeff Layton183d9e72016-05-17 12:28:47 -04001553 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason),
Jeff Layton9a4bf312015-12-10 10:41:58 -05001554 TP_STRUCT__entry(
1555 __field(dev_t, dev)
1556 __field(u64, fileid)
1557 __field(u32, fhandle)
1558 __field(loff_t, pos)
1559 __field(u64, count)
1560 __field(enum pnfs_iomode, iomode)
Trond Myklebustf4848302015-12-26 18:03:07 -05001561 __field(int, layoutstateid_seq)
1562 __field(u32, layoutstateid_hash)
Jeff Layton183d9e72016-05-17 12:28:47 -04001563 __field(long, lseg)
Jeff Layton9a4bf312015-12-10 10:41:58 -05001564 __field(enum pnfs_update_layout_reason, reason)
1565 ),
1566 TP_fast_assign(
1567 __entry->dev = inode->i_sb->s_dev;
1568 __entry->fileid = NFS_FILEID(inode);
1569 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1570 __entry->pos = pos;
1571 __entry->count = count;
1572 __entry->iomode = iomode;
Jeff Layton9a4bf312015-12-10 10:41:58 -05001573 __entry->reason = reason;
Trond Myklebustf4848302015-12-26 18:03:07 -05001574 if (lo != NULL) {
1575 __entry->layoutstateid_seq =
1576 be32_to_cpu(lo->plh_stateid.seqid);
1577 __entry->layoutstateid_hash =
1578 nfs_stateid_hash(&lo->plh_stateid);
1579 } else {
1580 __entry->layoutstateid_seq = 0;
1581 __entry->layoutstateid_hash = 0;
1582 }
Jeff Layton183d9e72016-05-17 12:28:47 -04001583 __entry->lseg = (long)lseg;
Jeff Layton9a4bf312015-12-10 10:41:58 -05001584 ),
1585 TP_printk(
1586 "fileid=%02x:%02x:%llu fhandle=0x%08x "
Trond Myklebustf4848302015-12-26 18:03:07 -05001587 "iomode=%s pos=%llu count=%llu "
Jeff Layton183d9e72016-05-17 12:28:47 -04001588 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)",
Jeff Layton9a4bf312015-12-10 10:41:58 -05001589 MAJOR(__entry->dev), MINOR(__entry->dev),
1590 (unsigned long long)__entry->fileid,
1591 __entry->fhandle,
1592 show_pnfs_iomode(__entry->iomode),
1593 (unsigned long long)__entry->pos,
Trond Myklebustf4848302015-12-26 18:03:07 -05001594 (unsigned long long)__entry->count,
1595 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
Jeff Layton183d9e72016-05-17 12:28:47 -04001596 __entry->lseg,
Jeff Layton9a4bf312015-12-10 10:41:58 -05001597 show_pnfs_update_layout_reason(__entry->reason)
1598 )
1599);
1600
Trond Myklebustcc668ab2013-08-14 15:31:28 -04001601#endif /* CONFIG_NFS_V4_1 */
1602
Trond Myklebustc6d01c62013-08-09 11:51:26 -04001603#endif /* _TRACE_NFS4_H */
1604
1605#undef TRACE_INCLUDE_PATH
1606#define TRACE_INCLUDE_PATH .
1607#define TRACE_INCLUDE_FILE nfs4trace
1608/* This part must be outside protection */
1609#include <trace/define_trace.h>