autofs4: change log print macros to not insert newline
[deliverable/linux.git] / fs / nfs / nfs4trace.h
1 /*
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
164 #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
177 #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
195 DECLARE_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))
231 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid);
232 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm);
233 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew);
234 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async);
235 #ifdef CONFIG_NFS_V4_1
236 DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id);
237 DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session);
238 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session);
239 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid);
240 DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session);
241 DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence);
242 DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete);
243
244 TRACE_EVENT(nfs4_setup_sequence,
245 TP_PROTO(
246 const struct nfs4_session *session,
247 const struct nfs4_sequence_args *args
248 ),
249 TP_ARGS(session, args),
250
251 TP_STRUCT__entry(
252 __field(unsigned int, session)
253 __field(unsigned int, slot_nr)
254 __field(unsigned int, seq_nr)
255 __field(unsigned int, highest_used_slotid)
256 ),
257
258 TP_fast_assign(
259 const struct nfs4_slot *sa_slot = args->sa_slot;
260 __entry->session = nfs_session_id_hash(&session->sess_id);
261 __entry->slot_nr = sa_slot->slot_nr;
262 __entry->seq_nr = sa_slot->seq_nr;
263 __entry->highest_used_slotid =
264 sa_slot->table->highest_used_slotid;
265 ),
266 TP_printk(
267 "session=0x%08x slot_nr=%u seq_nr=%u "
268 "highest_used_slotid=%u",
269 __entry->session,
270 __entry->slot_nr,
271 __entry->seq_nr,
272 __entry->highest_used_slotid
273 )
274 );
275
276 #define show_nfs4_sequence_status_flags(status) \
277 __print_flags((unsigned long)status, "|", \
278 { SEQ4_STATUS_CB_PATH_DOWN, "CB_PATH_DOWN" }, \
279 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRING, \
280 "CB_GSS_CONTEXTS_EXPIRING" }, \
281 { SEQ4_STATUS_CB_GSS_CONTEXTS_EXPIRED, \
282 "CB_GSS_CONTEXTS_EXPIRED" }, \
283 { SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED, \
284 "EXPIRED_ALL_STATE_REVOKED" }, \
285 { SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED, \
286 "EXPIRED_SOME_STATE_REVOKED" }, \
287 { SEQ4_STATUS_ADMIN_STATE_REVOKED, \
288 "ADMIN_STATE_REVOKED" }, \
289 { SEQ4_STATUS_RECALLABLE_STATE_REVOKED, \
290 "RECALLABLE_STATE_REVOKED" }, \
291 { SEQ4_STATUS_LEASE_MOVED, "LEASE_MOVED" }, \
292 { SEQ4_STATUS_RESTART_RECLAIM_NEEDED, \
293 "RESTART_RECLAIM_NEEDED" }, \
294 { SEQ4_STATUS_CB_PATH_DOWN_SESSION, \
295 "CB_PATH_DOWN_SESSION" }, \
296 { SEQ4_STATUS_BACKCHANNEL_FAULT, \
297 "BACKCHANNEL_FAULT" })
298
299 TRACE_EVENT(nfs4_sequence_done,
300 TP_PROTO(
301 const struct nfs4_session *session,
302 const struct nfs4_sequence_res *res
303 ),
304 TP_ARGS(session, res),
305
306 TP_STRUCT__entry(
307 __field(unsigned int, session)
308 __field(unsigned int, slot_nr)
309 __field(unsigned int, seq_nr)
310 __field(unsigned int, highest_slotid)
311 __field(unsigned int, target_highest_slotid)
312 __field(unsigned int, status_flags)
313 __field(int, error)
314 ),
315
316 TP_fast_assign(
317 const struct nfs4_slot *sr_slot = res->sr_slot;
318 __entry->session = nfs_session_id_hash(&session->sess_id);
319 __entry->slot_nr = sr_slot->slot_nr;
320 __entry->seq_nr = sr_slot->seq_nr;
321 __entry->highest_slotid = res->sr_highest_slotid;
322 __entry->target_highest_slotid =
323 res->sr_target_highest_slotid;
324 __entry->status_flags = res->sr_status_flags;
325 __entry->error = res->sr_status;
326 ),
327 TP_printk(
328 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
329 "highest_slotid=%u target_highest_slotid=%u "
330 "status_flags=%u (%s)",
331 __entry->error,
332 show_nfsv4_errors(__entry->error),
333 __entry->session,
334 __entry->slot_nr,
335 __entry->seq_nr,
336 __entry->highest_slotid,
337 __entry->target_highest_slotid,
338 __entry->status_flags,
339 show_nfs4_sequence_status_flags(__entry->status_flags)
340 )
341 );
342
343 struct cb_sequenceargs;
344 struct cb_sequenceres;
345
346 TRACE_EVENT(nfs4_cb_sequence,
347 TP_PROTO(
348 const struct cb_sequenceargs *args,
349 const struct cb_sequenceres *res,
350 __be32 status
351 ),
352 TP_ARGS(args, res, status),
353
354 TP_STRUCT__entry(
355 __field(unsigned int, session)
356 __field(unsigned int, slot_nr)
357 __field(unsigned int, seq_nr)
358 __field(unsigned int, highest_slotid)
359 __field(unsigned int, cachethis)
360 __field(int, error)
361 ),
362
363 TP_fast_assign(
364 __entry->session = nfs_session_id_hash(&args->csa_sessionid);
365 __entry->slot_nr = args->csa_slotid;
366 __entry->seq_nr = args->csa_sequenceid;
367 __entry->highest_slotid = args->csa_highestslotid;
368 __entry->cachethis = args->csa_cachethis;
369 __entry->error = -be32_to_cpu(status);
370 ),
371
372 TP_printk(
373 "error=%d (%s) session=0x%08x slot_nr=%u seq_nr=%u "
374 "highest_slotid=%u",
375 __entry->error,
376 show_nfsv4_errors(__entry->error),
377 __entry->session,
378 __entry->slot_nr,
379 __entry->seq_nr,
380 __entry->highest_slotid
381 )
382 );
383 #endif /* CONFIG_NFS_V4_1 */
384
385 DECLARE_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)
403 __field(int, stateid_seq)
404 __field(u32, stateid_hash)
405 __field(int, openstateid_seq)
406 __field(u32, openstateid_hash)
407 ),
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;
417 if (!IS_ERR_OR_NULL(state)) {
418 inode = state->inode;
419 __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 }
433 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 }
440 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent));
441 __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 "
447 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x "
448 "openstateid=%d:0x%08x",
449 __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,
459 __get_str(name),
460 __entry->stateid_seq, __entry->stateid_hash,
461 __entry->openstateid_seq, __entry->openstateid_hash
462 )
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))
473 DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
474 DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
475 DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
476
477 TRACE_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
516 TRACE_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)
532 __field(int, stateid_seq)
533 __field(u32, stateid_hash)
534 ),
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;
544 __entry->stateid_seq =
545 be32_to_cpu(args->stateid.seqid);
546 __entry->stateid_hash =
547 nfs_stateid_hash(&args->stateid);
548 ),
549
550 TP_printk(
551 "error=%d (%s) fmode=%s fileid=%02x:%02x:%llu "
552 "fhandle=0x%08x openstateid=%d:0x%08x",
553 __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,
559 __entry->fhandle,
560 __entry->stateid_seq, __entry->stateid_hash
561 )
562 );
563
564 #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
575 DECLARE_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)
594 __field(int, stateid_seq)
595 __field(u32, stateid_hash)
596 ),
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));
609 __entry->stateid_seq =
610 be32_to_cpu(state->stateid.seqid);
611 __entry->stateid_hash =
612 nfs_stateid_hash(&state->stateid);
613 ),
614
615 TP_printk(
616 "error=%d (%s) cmd=%s:%s range=%lld:%lld "
617 "fileid=%02x:%02x:%llu fhandle=0x%08x "
618 "stateid=%d:0x%08x",
619 __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,
627 __entry->fhandle,
628 __entry->stateid_seq, __entry->stateid_hash
629 )
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))
641 DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock);
642 DEFINE_NFS4_LOCK_EVENT(nfs4_unlock);
643
644 TRACE_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
709 DECLARE_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))
746 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation);
747 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation);
748
749 TRACE_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)
762 __field(int, stateid_seq)
763 __field(u32, stateid_hash)
764 ),
765
766 TP_fast_assign(
767 __entry->dev = res->server->s_dev;
768 __entry->fhandle = nfs_fhandle_hash(args->fhandle);
769 __entry->error = error;
770 __entry->stateid_seq =
771 be32_to_cpu(args->stateid->seqid);
772 __entry->stateid_hash =
773 nfs_stateid_hash(args->stateid);
774 ),
775
776 TP_printk(
777 "error=%d (%s) dev=%02x:%02x fhandle=0x%08x "
778 "stateid=%d:0x%08x",
779 __entry->error,
780 show_nfsv4_errors(__entry->error),
781 MAJOR(__entry->dev), MINOR(__entry->dev),
782 __entry->fhandle,
783 __entry->stateid_seq, __entry->stateid_hash
784 )
785 );
786
787 #ifdef CONFIG_NFS_V4_1
788 DECLARE_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)
802 __field(int, stateid_seq)
803 __field(u32, stateid_hash)
804 ),
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));
813 __entry->stateid_seq =
814 be32_to_cpu(state->stateid.seqid);
815 __entry->stateid_hash =
816 nfs_stateid_hash(&state->stateid);
817 ),
818
819 TP_printk(
820 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
821 "stateid=%d:0x%08x",
822 __entry->error,
823 show_nfsv4_errors(__entry->error),
824 MAJOR(__entry->dev), MINOR(__entry->dev),
825 (unsigned long long)__entry->fileid,
826 __entry->fhandle,
827 __entry->stateid_seq, __entry->stateid_hash
828 )
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))
839 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid);
840 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid);
841 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid);
842 #endif /* CONFIG_NFS_V4_1 */
843
844 DECLARE_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
886 DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup);
887 DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink);
888 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir);
889 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod);
890 DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove);
891 DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations);
892 DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo);
893
894 TRACE_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
937 DECLARE_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
977 DEFINE_NFS4_INODE_EVENT(nfs4_access);
978 DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
979 DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
980 DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
981 DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
982 #ifdef CONFIG_NFS_V4_SECURITY_LABEL
983 DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
984 DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
985 #endif /* CONFIG_NFS_V4_SECURITY_LABEL */
986
987 DECLARE_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
1037 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr);
1038 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn);
1039
1040 DECLARE_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))
1087 DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr);
1088 DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root);
1089 DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo);
1090
1091 DECLARE_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))
1147 DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr);
1148
1149 DECLARE_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))
1214 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall);
1215 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file);
1216
1217 DECLARE_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;
1238 memcpy(__get_dynamic_array(name), name, len);
1239 ((char *)__get_dynamic_array(name))[len] = 0;
1240 ),
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))
1258 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid);
1259 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid);
1260 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name);
1261 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group);
1262
1263 DECLARE_EVENT_CLASS(nfs4_read_event,
1264 TP_PROTO(
1265 const struct nfs_pgio_header *hdr,
1266 int error
1267 ),
1268
1269 TP_ARGS(hdr, error),
1270
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)
1278 __field(int, stateid_seq)
1279 __field(u32, stateid_hash)
1280 ),
1281
1282 TP_fast_assign(
1283 const struct inode *inode = hdr->inode;
1284 const struct nfs4_state *state =
1285 hdr->args.context->state;
1286 __entry->dev = inode->i_sb->s_dev;
1287 __entry->fileid = NFS_FILEID(inode);
1288 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1289 __entry->offset = hdr->args.offset;
1290 __entry->count = hdr->args.count;
1291 __entry->error = error;
1292 __entry->stateid_seq =
1293 be32_to_cpu(state->stateid.seqid);
1294 __entry->stateid_hash =
1295 nfs_stateid_hash(&state->stateid);
1296 ),
1297
1298 TP_printk(
1299 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1300 "offset=%lld count=%zu stateid=%d:0x%08x",
1301 __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,
1307 __entry->count,
1308 __entry->stateid_seq, __entry->stateid_hash
1309 )
1310 );
1311 #define DEFINE_NFS4_READ_EVENT(name) \
1312 DEFINE_EVENT(nfs4_read_event, name, \
1313 TP_PROTO( \
1314 const struct nfs_pgio_header *hdr, \
1315 int error \
1316 ), \
1317 TP_ARGS(hdr, error))
1318 DEFINE_NFS4_READ_EVENT(nfs4_read);
1319 #ifdef CONFIG_NFS_V4_1
1320 DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read);
1321 #endif /* CONFIG_NFS_V4_1 */
1322
1323 DECLARE_EVENT_CLASS(nfs4_write_event,
1324 TP_PROTO(
1325 const struct nfs_pgio_header *hdr,
1326 int error
1327 ),
1328
1329 TP_ARGS(hdr, error),
1330
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)
1338 __field(int, stateid_seq)
1339 __field(u32, stateid_hash)
1340 ),
1341
1342 TP_fast_assign(
1343 const struct inode *inode = hdr->inode;
1344 const struct nfs4_state *state =
1345 hdr->args.context->state;
1346 __entry->dev = inode->i_sb->s_dev;
1347 __entry->fileid = NFS_FILEID(inode);
1348 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1349 __entry->offset = hdr->args.offset;
1350 __entry->count = hdr->args.count;
1351 __entry->error = error;
1352 __entry->stateid_seq =
1353 be32_to_cpu(state->stateid.seqid);
1354 __entry->stateid_hash =
1355 nfs_stateid_hash(&state->stateid);
1356 ),
1357
1358 TP_printk(
1359 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1360 "offset=%lld count=%zu stateid=%d:0x%08x",
1361 __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,
1367 __entry->count,
1368 __entry->stateid_seq, __entry->stateid_hash
1369 )
1370 );
1371
1372 #define DEFINE_NFS4_WRITE_EVENT(name) \
1373 DEFINE_EVENT(nfs4_write_event, name, \
1374 TP_PROTO( \
1375 const struct nfs_pgio_header *hdr, \
1376 int error \
1377 ), \
1378 TP_ARGS(hdr, error))
1379 DEFINE_NFS4_WRITE_EVENT(nfs4_write);
1380 #ifdef CONFIG_NFS_V4_1
1381 DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write);
1382 #endif /* CONFIG_NFS_V4_1 */
1383
1384 DECLARE_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))
1430 DEFINE_NFS4_COMMIT_EVENT(nfs4_commit);
1431 #ifdef CONFIG_NFS_V4_1
1432 DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds);
1433
1434 #define show_pnfs_iomode(iomode) \
1435 __print_symbolic(iomode, \
1436 { IOMODE_READ, "READ" }, \
1437 { IOMODE_RW, "RW" }, \
1438 { IOMODE_ANY, "ANY" })
1439
1440 TRACE_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,
1445 const nfs4_stateid *layout_stateid,
1446 int error
1447 ),
1448
1449 TP_ARGS(ctx, args, res, layout_stateid, error),
1450
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)
1459 __field(int, stateid_seq)
1460 __field(u32, stateid_hash)
1461 __field(int, layoutstateid_seq)
1462 __field(u32, layoutstateid_hash)
1463 ),
1464
1465 TP_fast_assign(
1466 const struct inode *inode = d_inode(ctx->dentry);
1467 const struct nfs4_state *state = ctx->state;
1468 __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;
1475 __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 }
1488 ),
1489
1490 TP_printk(
1491 "error=%d (%s) fileid=%02x:%02x:%llu fhandle=0x%08x "
1492 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x "
1493 "layoutstateid=%d:0x%08x",
1494 __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,
1501 (unsigned long long)__entry->count,
1502 __entry->stateid_seq, __entry->stateid_hash,
1503 __entry->layoutstateid_seq, __entry->layoutstateid_hash
1504 )
1505 );
1506
1507 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit);
1508 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn);
1509 DEFINE_NFS4_INODE_EVENT(nfs4_layoutreturn_on_close);
1510
1511 #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" }, \
1523 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" })
1524
1525 TRACE_EVENT(pnfs_update_layout,
1526 TP_PROTO(struct inode *inode,
1527 loff_t pos,
1528 u64 count,
1529 enum pnfs_iomode iomode,
1530 struct pnfs_layout_hdr *lo,
1531 enum pnfs_update_layout_reason reason
1532 ),
1533 TP_ARGS(inode, pos, count, iomode, lo, reason),
1534 TP_STRUCT__entry(
1535 __field(dev_t, dev)
1536 __field(u64, fileid)
1537 __field(u32, fhandle)
1538 __field(loff_t, pos)
1539 __field(u64, count)
1540 __field(enum pnfs_iomode, iomode)
1541 __field(int, layoutstateid_seq)
1542 __field(u32, layoutstateid_hash)
1543 __field(enum pnfs_update_layout_reason, reason)
1544 ),
1545 TP_fast_assign(
1546 __entry->dev = inode->i_sb->s_dev;
1547 __entry->fileid = NFS_FILEID(inode);
1548 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
1549 __entry->pos = pos;
1550 __entry->count = count;
1551 __entry->iomode = iomode;
1552 __entry->reason = reason;
1553 if (lo != NULL) {
1554 __entry->layoutstateid_seq =
1555 be32_to_cpu(lo->plh_stateid.seqid);
1556 __entry->layoutstateid_hash =
1557 nfs_stateid_hash(&lo->plh_stateid);
1558 } else {
1559 __entry->layoutstateid_seq = 0;
1560 __entry->layoutstateid_hash = 0;
1561 }
1562 ),
1563 TP_printk(
1564 "fileid=%02x:%02x:%llu fhandle=0x%08x "
1565 "iomode=%s pos=%llu count=%llu "
1566 "layoutstateid=%d:0x%08x (%s)",
1567 MAJOR(__entry->dev), MINOR(__entry->dev),
1568 (unsigned long long)__entry->fileid,
1569 __entry->fhandle,
1570 show_pnfs_iomode(__entry->iomode),
1571 (unsigned long long)__entry->pos,
1572 (unsigned long long)__entry->count,
1573 __entry->layoutstateid_seq, __entry->layoutstateid_hash,
1574 show_pnfs_update_layout_reason(__entry->reason)
1575 )
1576 );
1577
1578 #endif /* CONFIG_NFS_V4_1 */
1579
1580 #endif /* _TRACE_NFS4_H */
1581
1582 #undef TRACE_INCLUDE_PATH
1583 #define TRACE_INCLUDE_PATH .
1584 #define TRACE_INCLUDE_FILE nfs4trace
1585 /* This part must be outside protection */
1586 #include <trace/define_trace.h>
This page took 0.0646 seconds and 5 git commands to generate.