1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (c) 2013 Trond Myklebust <Trond.Myklebust@netapp.com> 4 */ 5 #undef TRACE_SYSTEM 6 #define TRACE_SYSTEM nfs4 7 8 #if !defined(_TRACE_NFS4_H) || defined(TRACE_HEADER_MULTI_READ) 9 #define _TRACE_NFS4_H 10 11 #include <linux/tracepoint.h> 12 #include <trace/misc/sunrpc.h> 13 14 #include <trace/misc/fs.h> 15 #include <trace/misc/nfs.h> 16 17 #define show_nfs_fattr_flags(valid) \ 18 __print_flags((unsigned long)valid, "|", \ 19 { NFS_ATTR_FATTR_TYPE, "TYPE" }, \ 20 { NFS_ATTR_FATTR_MODE, "MODE" }, \ 21 { NFS_ATTR_FATTR_NLINK, "NLINK" }, \ 22 { NFS_ATTR_FATTR_OWNER, "OWNER" }, \ 23 { NFS_ATTR_FATTR_GROUP, "GROUP" }, \ 24 { NFS_ATTR_FATTR_RDEV, "RDEV" }, \ 25 { NFS_ATTR_FATTR_SIZE, "SIZE" }, \ 26 { NFS_ATTR_FATTR_FSID, "FSID" }, \ 27 { NFS_ATTR_FATTR_FILEID, "FILEID" }, \ 28 { NFS_ATTR_FATTR_ATIME, "ATIME" }, \ 29 { NFS_ATTR_FATTR_MTIME, "MTIME" }, \ 30 { NFS_ATTR_FATTR_CTIME, "CTIME" }, \ 31 { NFS_ATTR_FATTR_CHANGE, "CHANGE" }, \ 32 { NFS_ATTR_FATTR_OWNER_NAME, "OWNER_NAME" }, \ 33 { NFS_ATTR_FATTR_GROUP_NAME, "GROUP_NAME" }) 34 35 DECLARE_EVENT_CLASS(nfs4_clientid_event, 36 TP_PROTO( 37 const struct nfs_client *clp, 38 int error 39 ), 40 41 TP_ARGS(clp, error), 42 43 TP_STRUCT__entry( 44 __string(dstaddr, clp->cl_hostname) 45 __field(unsigned long, error) 46 ), 47 48 TP_fast_assign( 49 __entry->error = error < 0 ? -error : 0; 50 __assign_str(dstaddr); 51 ), 52 53 TP_printk( 54 "error=%ld (%s) dstaddr=%s", 55 -__entry->error, 56 show_nfs4_status(__entry->error), 57 __get_str(dstaddr) 58 ) 59 ); 60 #define DEFINE_NFS4_CLIENTID_EVENT(name) \ 61 DEFINE_EVENT(nfs4_clientid_event, name, \ 62 TP_PROTO( \ 63 const struct nfs_client *clp, \ 64 int error \ 65 ), \ 66 TP_ARGS(clp, error)) 67 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid); 68 DEFINE_NFS4_CLIENTID_EVENT(nfs4_setclientid_confirm); 69 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew); 70 DEFINE_NFS4_CLIENTID_EVENT(nfs4_renew_async); 71 #ifdef CONFIG_NFS_V4_1 72 DEFINE_NFS4_CLIENTID_EVENT(nfs4_exchange_id); 73 DEFINE_NFS4_CLIENTID_EVENT(nfs4_create_session); 74 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_session); 75 DEFINE_NFS4_CLIENTID_EVENT(nfs4_destroy_clientid); 76 DEFINE_NFS4_CLIENTID_EVENT(nfs4_bind_conn_to_session); 77 DEFINE_NFS4_CLIENTID_EVENT(nfs4_sequence); 78 DEFINE_NFS4_CLIENTID_EVENT(nfs4_reclaim_complete); 79 80 TRACE_EVENT(nfs4_trunked_exchange_id, 81 TP_PROTO( 82 const struct nfs_client *clp, 83 const char *addr, 84 int error 85 ), 86 87 TP_ARGS(clp, addr, error), 88 89 TP_STRUCT__entry( 90 __string(main_addr, clp->cl_hostname) 91 __string(trunk_addr, addr) 92 __field(unsigned long, error) 93 ), 94 95 TP_fast_assign( 96 __entry->error = error < 0 ? -error : 0; 97 __assign_str(main_addr); 98 __assign_str(trunk_addr); 99 ), 100 101 TP_printk( 102 "error=%ld (%s) main_addr=%s trunk_addr=%s", 103 -__entry->error, 104 show_nfs4_status(__entry->error), 105 __get_str(main_addr), 106 __get_str(trunk_addr) 107 ) 108 ); 109 110 TRACE_EVENT(nfs4_sequence_done, 111 TP_PROTO( 112 const struct nfs4_session *session, 113 const struct nfs4_sequence_res *res 114 ), 115 TP_ARGS(session, res), 116 117 TP_STRUCT__entry( 118 __field(unsigned int, session) 119 __field(unsigned int, slot_nr) 120 __field(unsigned int, seq_nr) 121 __field(unsigned int, highest_slotid) 122 __field(unsigned int, target_highest_slotid) 123 __field(unsigned long, status_flags) 124 __field(unsigned long, error) 125 ), 126 127 TP_fast_assign( 128 const struct nfs4_slot *sr_slot = res->sr_slot; 129 __entry->session = nfs_session_id_hash(&session->sess_id); 130 __entry->slot_nr = sr_slot->slot_nr; 131 __entry->seq_nr = sr_slot->seq_nr; 132 __entry->highest_slotid = res->sr_highest_slotid; 133 __entry->target_highest_slotid = 134 res->sr_target_highest_slotid; 135 __entry->status_flags = res->sr_status_flags; 136 __entry->error = res->sr_status < 0 ? 137 -res->sr_status : 0; 138 ), 139 TP_printk( 140 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u " 141 "highest_slotid=%u target_highest_slotid=%u " 142 "status_flags=0x%lx (%s)", 143 -__entry->error, 144 show_nfs4_status(__entry->error), 145 __entry->session, 146 __entry->slot_nr, 147 __entry->seq_nr, 148 __entry->highest_slotid, 149 __entry->target_highest_slotid, 150 __entry->status_flags, 151 show_nfs4_seq4_status(__entry->status_flags) 152 ) 153 ); 154 155 struct cb_sequenceargs; 156 struct cb_sequenceres; 157 158 TRACE_EVENT(nfs4_cb_sequence, 159 TP_PROTO( 160 const struct cb_sequenceargs *args, 161 const struct cb_sequenceres *res, 162 __be32 status 163 ), 164 TP_ARGS(args, res, status), 165 166 TP_STRUCT__entry( 167 __field(unsigned int, session) 168 __field(unsigned int, slot_nr) 169 __field(unsigned int, seq_nr) 170 __field(unsigned int, highest_slotid) 171 __field(unsigned int, cachethis) 172 __field(unsigned long, error) 173 ), 174 175 TP_fast_assign( 176 __entry->session = nfs_session_id_hash(&args->csa_sessionid); 177 __entry->slot_nr = args->csa_slotid; 178 __entry->seq_nr = args->csa_sequenceid; 179 __entry->highest_slotid = args->csa_highestslotid; 180 __entry->cachethis = args->csa_cachethis; 181 __entry->error = be32_to_cpu(status); 182 ), 183 184 TP_printk( 185 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u " 186 "highest_slotid=%u", 187 -__entry->error, 188 show_nfs4_status(__entry->error), 189 __entry->session, 190 __entry->slot_nr, 191 __entry->seq_nr, 192 __entry->highest_slotid 193 ) 194 ); 195 196 TRACE_EVENT(nfs4_cb_seqid_err, 197 TP_PROTO( 198 const struct cb_sequenceargs *args, 199 __be32 status 200 ), 201 TP_ARGS(args, status), 202 203 TP_STRUCT__entry( 204 __field(unsigned int, session) 205 __field(unsigned int, slot_nr) 206 __field(unsigned int, seq_nr) 207 __field(unsigned int, highest_slotid) 208 __field(unsigned int, cachethis) 209 __field(unsigned long, error) 210 ), 211 212 TP_fast_assign( 213 __entry->session = nfs_session_id_hash(&args->csa_sessionid); 214 __entry->slot_nr = args->csa_slotid; 215 __entry->seq_nr = args->csa_sequenceid; 216 __entry->highest_slotid = args->csa_highestslotid; 217 __entry->cachethis = args->csa_cachethis; 218 __entry->error = be32_to_cpu(status); 219 ), 220 221 TP_printk( 222 "error=%ld (%s) session=0x%08x slot_nr=%u seq_nr=%u " 223 "highest_slotid=%u", 224 -__entry->error, 225 show_nfs4_status(__entry->error), 226 __entry->session, 227 __entry->slot_nr, 228 __entry->seq_nr, 229 __entry->highest_slotid 230 ) 231 ); 232 233 TRACE_EVENT(nfs4_cb_offload, 234 TP_PROTO( 235 const struct nfs_fh *cb_fh, 236 const nfs4_stateid *cb_stateid, 237 uint64_t cb_count, 238 int cb_error, 239 int cb_how_stable 240 ), 241 242 TP_ARGS(cb_fh, cb_stateid, cb_count, cb_error, 243 cb_how_stable), 244 245 TP_STRUCT__entry( 246 __field(unsigned long, error) 247 __field(u32, fhandle) 248 __field(loff_t, cb_count) 249 __field(int, cb_how) 250 __field(int, cb_stateid_seq) 251 __field(u32, cb_stateid_hash) 252 ), 253 254 TP_fast_assign( 255 __entry->error = cb_error < 0 ? -cb_error : 0; 256 __entry->fhandle = nfs_fhandle_hash(cb_fh); 257 __entry->cb_stateid_seq = 258 be32_to_cpu(cb_stateid->seqid); 259 __entry->cb_stateid_hash = 260 nfs_stateid_hash(cb_stateid); 261 __entry->cb_count = cb_count; 262 __entry->cb_how = cb_how_stable; 263 ), 264 265 TP_printk( 266 "error=%ld (%s) fhandle=0x%08x cb_stateid=%d:0x%08x " 267 "cb_count=%llu cb_how=%s", 268 -__entry->error, 269 show_nfs4_status(__entry->error), 270 __entry->fhandle, 271 __entry->cb_stateid_seq, __entry->cb_stateid_hash, 272 __entry->cb_count, 273 show_nfs_stable_how(__entry->cb_how) 274 ) 275 ); 276 #endif /* CONFIG_NFS_V4_1 */ 277 278 TRACE_EVENT(nfs4_setup_sequence, 279 TP_PROTO( 280 const struct nfs4_session *session, 281 const struct nfs4_sequence_args *args 282 ), 283 TP_ARGS(session, args), 284 285 TP_STRUCT__entry( 286 __field(unsigned int, session) 287 __field(unsigned int, slot_nr) 288 __field(unsigned int, seq_nr) 289 __field(unsigned int, highest_used_slotid) 290 ), 291 292 TP_fast_assign( 293 const struct nfs4_slot *sa_slot = args->sa_slot; 294 __entry->session = session ? nfs_session_id_hash(&session->sess_id) : 0; 295 __entry->slot_nr = sa_slot->slot_nr; 296 __entry->seq_nr = sa_slot->seq_nr; 297 __entry->highest_used_slotid = 298 sa_slot->table->highest_used_slotid; 299 ), 300 TP_printk( 301 "session=0x%08x slot_nr=%u seq_nr=%u " 302 "highest_used_slotid=%u", 303 __entry->session, 304 __entry->slot_nr, 305 __entry->seq_nr, 306 __entry->highest_used_slotid 307 ) 308 ); 309 310 TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_RUNNING); 311 TRACE_DEFINE_ENUM(NFS4CLNT_CHECK_LEASE); 312 TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_EXPIRED); 313 TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_REBOOT); 314 TRACE_DEFINE_ENUM(NFS4CLNT_RECLAIM_NOGRACE); 315 TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN); 316 TRACE_DEFINE_ENUM(NFS4CLNT_SESSION_RESET); 317 TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_CONFIRM); 318 TRACE_DEFINE_ENUM(NFS4CLNT_SERVER_SCOPE_MISMATCH); 319 TRACE_DEFINE_ENUM(NFS4CLNT_PURGE_STATE); 320 TRACE_DEFINE_ENUM(NFS4CLNT_BIND_CONN_TO_SESSION); 321 TRACE_DEFINE_ENUM(NFS4CLNT_MOVED); 322 TRACE_DEFINE_ENUM(NFS4CLNT_LEASE_MOVED); 323 TRACE_DEFINE_ENUM(NFS4CLNT_DELEGATION_EXPIRED); 324 TRACE_DEFINE_ENUM(NFS4CLNT_RUN_MANAGER); 325 TRACE_DEFINE_ENUM(NFS4CLNT_MANAGER_AVAILABLE); 326 TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_RUNNING); 327 TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_READ); 328 TRACE_DEFINE_ENUM(NFS4CLNT_RECALL_ANY_LAYOUT_RW); 329 TRACE_DEFINE_ENUM(NFS4CLNT_DELEGRETURN_DELAYED); 330 331 #define show_nfs4_clp_state(state) \ 332 __print_flags(state, "|", \ 333 { BIT(NFS4CLNT_MANAGER_RUNNING), "MANAGER_RUNNING" }, \ 334 { BIT(NFS4CLNT_CHECK_LEASE), "CHECK_LEASE" }, \ 335 { BIT(NFS4CLNT_LEASE_EXPIRED), "LEASE_EXPIRED" }, \ 336 { BIT(NFS4CLNT_RECLAIM_REBOOT), "RECLAIM_REBOOT" }, \ 337 { BIT(NFS4CLNT_RECLAIM_NOGRACE), "RECLAIM_NOGRACE" }, \ 338 { BIT(NFS4CLNT_DELEGRETURN), "DELEGRETURN" }, \ 339 { BIT(NFS4CLNT_SESSION_RESET), "SESSION_RESET" }, \ 340 { BIT(NFS4CLNT_LEASE_CONFIRM), "LEASE_CONFIRM" }, \ 341 { BIT(NFS4CLNT_SERVER_SCOPE_MISMATCH), "SERVER_SCOPE_MISMATCH" }, \ 342 { BIT(NFS4CLNT_PURGE_STATE), "PURGE_STATE" }, \ 343 { BIT(NFS4CLNT_BIND_CONN_TO_SESSION), "BIND_CONN_TO_SESSION" }, \ 344 { BIT(NFS4CLNT_MOVED), "MOVED" }, \ 345 { BIT(NFS4CLNT_LEASE_MOVED), "LEASE_MOVED" }, \ 346 { BIT(NFS4CLNT_DELEGATION_EXPIRED), "DELEGATION_EXPIRED" }, \ 347 { BIT(NFS4CLNT_RUN_MANAGER), "RUN_MANAGER" }, \ 348 { BIT(NFS4CLNT_MANAGER_AVAILABLE), "MANAGER_AVAILABLE" }, \ 349 { BIT(NFS4CLNT_RECALL_RUNNING), "RECALL_RUNNING" }, \ 350 { BIT(NFS4CLNT_RECALL_ANY_LAYOUT_READ), "RECALL_ANY_LAYOUT_READ" }, \ 351 { BIT(NFS4CLNT_RECALL_ANY_LAYOUT_RW), "RECALL_ANY_LAYOUT_RW" }, \ 352 { BIT(NFS4CLNT_DELEGRETURN_DELAYED), "DELERETURN_DELAYED" }) 353 354 TRACE_EVENT(nfs4_state_mgr, 355 TP_PROTO( 356 const struct nfs_client *clp 357 ), 358 359 TP_ARGS(clp), 360 361 TP_STRUCT__entry( 362 __field(unsigned long, state) 363 __string(hostname, clp->cl_hostname) 364 ), 365 366 TP_fast_assign( 367 __entry->state = clp->cl_state; 368 __assign_str(hostname); 369 ), 370 371 TP_printk( 372 "hostname=%s clp state=%s", __get_str(hostname), 373 show_nfs4_clp_state(__entry->state) 374 ) 375 ) 376 377 TRACE_EVENT(nfs4_state_mgr_failed, 378 TP_PROTO( 379 const struct nfs_client *clp, 380 const char *section, 381 int status 382 ), 383 384 TP_ARGS(clp, section, status), 385 386 TP_STRUCT__entry( 387 __field(unsigned long, error) 388 __field(unsigned long, state) 389 __string(hostname, clp->cl_hostname) 390 __string(section, section) 391 ), 392 393 TP_fast_assign( 394 __entry->error = status < 0 ? -status : 0; 395 __entry->state = clp->cl_state; 396 __assign_str(hostname); 397 __assign_str(section); 398 ), 399 400 TP_printk( 401 "hostname=%s clp state=%s error=%ld (%s) section=%s", 402 __get_str(hostname), 403 show_nfs4_clp_state(__entry->state), -__entry->error, 404 show_nfs4_status(__entry->error), __get_str(section) 405 406 ) 407 ) 408 409 TRACE_EVENT(nfs4_xdr_bad_operation, 410 TP_PROTO( 411 const struct xdr_stream *xdr, 412 u32 op, 413 u32 expected 414 ), 415 416 TP_ARGS(xdr, op, expected), 417 418 TP_STRUCT__entry( 419 __field(unsigned int, task_id) 420 __field(unsigned int, client_id) 421 __field(u32, xid) 422 __field(u32, op) 423 __field(u32, expected) 424 ), 425 426 TP_fast_assign( 427 const struct rpc_rqst *rqstp = xdr->rqst; 428 const struct rpc_task *task = rqstp->rq_task; 429 430 __entry->task_id = task->tk_pid; 431 __entry->client_id = task->tk_client->cl_clid; 432 __entry->xid = be32_to_cpu(rqstp->rq_xid); 433 __entry->op = op; 434 __entry->expected = expected; 435 ), 436 437 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 438 " xid=0x%08x operation=%u, expected=%u", 439 __entry->task_id, __entry->client_id, __entry->xid, 440 __entry->op, __entry->expected 441 ) 442 ); 443 444 DECLARE_EVENT_CLASS(nfs4_xdr_event, 445 TP_PROTO( 446 const struct xdr_stream *xdr, 447 u32 op, 448 u32 error 449 ), 450 451 TP_ARGS(xdr, op, error), 452 453 TP_STRUCT__entry( 454 __field(unsigned int, task_id) 455 __field(unsigned int, client_id) 456 __field(u32, xid) 457 __field(u32, op) 458 __field(unsigned long, error) 459 ), 460 461 TP_fast_assign( 462 const struct rpc_rqst *rqstp = xdr->rqst; 463 const struct rpc_task *task = rqstp->rq_task; 464 465 __entry->task_id = task->tk_pid; 466 __entry->client_id = task->tk_client->cl_clid; 467 __entry->xid = be32_to_cpu(rqstp->rq_xid); 468 __entry->op = op; 469 __entry->error = error; 470 ), 471 472 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 473 " xid=0x%08x error=%ld (%s) operation=%u", 474 __entry->task_id, __entry->client_id, __entry->xid, 475 -__entry->error, show_nfs4_status(__entry->error), 476 __entry->op 477 ) 478 ); 479 #define DEFINE_NFS4_XDR_EVENT(name) \ 480 DEFINE_EVENT(nfs4_xdr_event, name, \ 481 TP_PROTO( \ 482 const struct xdr_stream *xdr, \ 483 u32 op, \ 484 u32 error \ 485 ), \ 486 TP_ARGS(xdr, op, error)) 487 DEFINE_NFS4_XDR_EVENT(nfs4_xdr_status); 488 DEFINE_NFS4_XDR_EVENT(nfs4_xdr_bad_filehandle); 489 490 DECLARE_EVENT_CLASS(nfs4_cb_error_class, 491 TP_PROTO( 492 __be32 xid, 493 u32 cb_ident 494 ), 495 496 TP_ARGS(xid, cb_ident), 497 498 TP_STRUCT__entry( 499 __field(u32, xid) 500 __field(u32, cbident) 501 ), 502 503 TP_fast_assign( 504 __entry->xid = be32_to_cpu(xid); 505 __entry->cbident = cb_ident; 506 ), 507 508 TP_printk( 509 "xid=0x%08x cb_ident=0x%08x", 510 __entry->xid, __entry->cbident 511 ) 512 ); 513 514 #define DEFINE_CB_ERROR_EVENT(name) \ 515 DEFINE_EVENT(nfs4_cb_error_class, nfs_cb_##name, \ 516 TP_PROTO( \ 517 __be32 xid, \ 518 u32 cb_ident \ 519 ), \ 520 TP_ARGS(xid, cb_ident)) 521 522 DEFINE_CB_ERROR_EVENT(no_clp); 523 DEFINE_CB_ERROR_EVENT(badprinc); 524 525 DECLARE_EVENT_CLASS(nfs4_open_event, 526 TP_PROTO( 527 const struct nfs_open_context *ctx, 528 int flags, 529 int error 530 ), 531 532 TP_ARGS(ctx, flags, error), 533 534 TP_STRUCT__entry( 535 __field(unsigned long, error) 536 __field(unsigned long, flags) 537 __field(unsigned long, fmode) 538 __field(dev_t, dev) 539 __field(u32, fhandle) 540 __field(u64, fileid) 541 __field(u64, dir) 542 __string(name, ctx->dentry->d_name.name) 543 __field(int, stateid_seq) 544 __field(u32, stateid_hash) 545 __field(int, openstateid_seq) 546 __field(u32, openstateid_hash) 547 ), 548 549 TP_fast_assign( 550 const struct nfs4_state *state = ctx->state; 551 const struct inode *inode = NULL; 552 553 __entry->error = -error; 554 __entry->flags = flags; 555 __entry->fmode = (__force unsigned long)ctx->mode; 556 __entry->dev = ctx->dentry->d_sb->s_dev; 557 if (!IS_ERR_OR_NULL(state)) { 558 inode = state->inode; 559 __entry->stateid_seq = 560 be32_to_cpu(state->stateid.seqid); 561 __entry->stateid_hash = 562 nfs_stateid_hash(&state->stateid); 563 __entry->openstateid_seq = 564 be32_to_cpu(state->open_stateid.seqid); 565 __entry->openstateid_hash = 566 nfs_stateid_hash(&state->open_stateid); 567 } else { 568 __entry->stateid_seq = 0; 569 __entry->stateid_hash = 0; 570 __entry->openstateid_seq = 0; 571 __entry->openstateid_hash = 0; 572 } 573 if (inode != NULL) { 574 __entry->fileid = NFS_FILEID(inode); 575 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 576 } else { 577 __entry->fileid = 0; 578 __entry->fhandle = 0; 579 } 580 __entry->dir = NFS_FILEID(d_inode(ctx->dentry->d_parent)); 581 __assign_str(name); 582 ), 583 584 TP_printk( 585 "error=%ld (%s) flags=%lu (%s) fmode=%s " 586 "fileid=%02x:%02x:%llu fhandle=0x%08x " 587 "name=%02x:%02x:%llu/%s stateid=%d:0x%08x " 588 "openstateid=%d:0x%08x", 589 -__entry->error, 590 show_nfs4_status(__entry->error), 591 __entry->flags, 592 show_fs_fcntl_open_flags(__entry->flags), 593 show_fs_fmode_flags(__entry->fmode), 594 MAJOR(__entry->dev), MINOR(__entry->dev), 595 (unsigned long long)__entry->fileid, 596 __entry->fhandle, 597 MAJOR(__entry->dev), MINOR(__entry->dev), 598 (unsigned long long)__entry->dir, 599 __get_str(name), 600 __entry->stateid_seq, __entry->stateid_hash, 601 __entry->openstateid_seq, __entry->openstateid_hash 602 ) 603 ); 604 605 #define DEFINE_NFS4_OPEN_EVENT(name) \ 606 DEFINE_EVENT(nfs4_open_event, name, \ 607 TP_PROTO( \ 608 const struct nfs_open_context *ctx, \ 609 int flags, \ 610 int error \ 611 ), \ 612 TP_ARGS(ctx, flags, error)) 613 DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim); 614 DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired); 615 DEFINE_NFS4_OPEN_EVENT(nfs4_open_file); 616 617 TRACE_EVENT(nfs4_cached_open, 618 TP_PROTO( 619 const struct nfs4_state *state 620 ), 621 TP_ARGS(state), 622 TP_STRUCT__entry( 623 __field(dev_t, dev) 624 __field(u32, fhandle) 625 __field(u64, fileid) 626 __field(unsigned int, fmode) 627 __field(int, stateid_seq) 628 __field(u32, stateid_hash) 629 ), 630 631 TP_fast_assign( 632 const struct inode *inode = state->inode; 633 634 __entry->dev = inode->i_sb->s_dev; 635 __entry->fileid = NFS_FILEID(inode); 636 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 637 __entry->fmode = (__force unsigned int)state->state; 638 __entry->stateid_seq = 639 be32_to_cpu(state->stateid.seqid); 640 __entry->stateid_hash = 641 nfs_stateid_hash(&state->stateid); 642 ), 643 644 TP_printk( 645 "fmode=%s fileid=%02x:%02x:%llu " 646 "fhandle=0x%08x stateid=%d:0x%08x", 647 __entry->fmode ? show_fs_fmode_flags(__entry->fmode) : 648 "closed", 649 MAJOR(__entry->dev), MINOR(__entry->dev), 650 (unsigned long long)__entry->fileid, 651 __entry->fhandle, 652 __entry->stateid_seq, __entry->stateid_hash 653 ) 654 ); 655 656 TRACE_EVENT(nfs4_close, 657 TP_PROTO( 658 const struct nfs4_state *state, 659 const struct nfs_closeargs *args, 660 const struct nfs_closeres *res, 661 int error 662 ), 663 664 TP_ARGS(state, args, res, error), 665 666 TP_STRUCT__entry( 667 __field(dev_t, dev) 668 __field(u32, fhandle) 669 __field(u64, fileid) 670 __field(unsigned int, fmode) 671 __field(unsigned long, error) 672 __field(int, stateid_seq) 673 __field(u32, stateid_hash) 674 ), 675 676 TP_fast_assign( 677 const struct inode *inode = state->inode; 678 679 __entry->dev = inode->i_sb->s_dev; 680 __entry->fileid = NFS_FILEID(inode); 681 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 682 __entry->fmode = (__force unsigned int)state->state; 683 __entry->error = error < 0 ? -error : 0; 684 __entry->stateid_seq = 685 be32_to_cpu(args->stateid.seqid); 686 __entry->stateid_hash = 687 nfs_stateid_hash(&args->stateid); 688 ), 689 690 TP_printk( 691 "error=%ld (%s) fmode=%s fileid=%02x:%02x:%llu " 692 "fhandle=0x%08x openstateid=%d:0x%08x", 693 -__entry->error, 694 show_nfs4_status(__entry->error), 695 __entry->fmode ? show_fs_fmode_flags(__entry->fmode) : 696 "closed", 697 MAJOR(__entry->dev), MINOR(__entry->dev), 698 (unsigned long long)__entry->fileid, 699 __entry->fhandle, 700 __entry->stateid_seq, __entry->stateid_hash 701 ) 702 ); 703 704 DECLARE_EVENT_CLASS(nfs4_lock_event, 705 TP_PROTO( 706 const struct file_lock *request, 707 const struct nfs4_state *state, 708 int cmd, 709 int error 710 ), 711 712 TP_ARGS(request, state, cmd, error), 713 714 TP_STRUCT__entry( 715 __field(unsigned long, error) 716 __field(unsigned long, cmd) 717 __field(unsigned long, type) 718 __field(loff_t, start) 719 __field(loff_t, end) 720 __field(dev_t, dev) 721 __field(u32, fhandle) 722 __field(u64, fileid) 723 __field(int, stateid_seq) 724 __field(u32, stateid_hash) 725 ), 726 727 TP_fast_assign( 728 const struct inode *inode = state->inode; 729 730 __entry->error = error < 0 ? -error : 0; 731 __entry->cmd = cmd; 732 __entry->type = request->c.flc_type; 733 __entry->start = request->fl_start; 734 __entry->end = request->fl_end; 735 __entry->dev = inode->i_sb->s_dev; 736 __entry->fileid = NFS_FILEID(inode); 737 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 738 __entry->stateid_seq = 739 be32_to_cpu(state->stateid.seqid); 740 __entry->stateid_hash = 741 nfs_stateid_hash(&state->stateid); 742 ), 743 744 TP_printk( 745 "error=%ld (%s) cmd=%s:%s range=%lld:%lld " 746 "fileid=%02x:%02x:%llu fhandle=0x%08x " 747 "stateid=%d:0x%08x", 748 -__entry->error, 749 show_nfs4_status(__entry->error), 750 show_fs_fcntl_cmd(__entry->cmd), 751 show_fs_fcntl_lock_type(__entry->type), 752 (long long)__entry->start, 753 (long long)__entry->end, 754 MAJOR(__entry->dev), MINOR(__entry->dev), 755 (unsigned long long)__entry->fileid, 756 __entry->fhandle, 757 __entry->stateid_seq, __entry->stateid_hash 758 ) 759 ); 760 761 #define DEFINE_NFS4_LOCK_EVENT(name) \ 762 DEFINE_EVENT(nfs4_lock_event, name, \ 763 TP_PROTO( \ 764 const struct file_lock *request, \ 765 const struct nfs4_state *state, \ 766 int cmd, \ 767 int error \ 768 ), \ 769 TP_ARGS(request, state, cmd, error)) 770 DEFINE_NFS4_LOCK_EVENT(nfs4_get_lock); 771 DEFINE_NFS4_LOCK_EVENT(nfs4_unlock); 772 773 TRACE_EVENT(nfs4_set_lock, 774 TP_PROTO( 775 const struct file_lock *request, 776 const struct nfs4_state *state, 777 const nfs4_stateid *lockstateid, 778 int cmd, 779 int error 780 ), 781 782 TP_ARGS(request, state, lockstateid, cmd, error), 783 784 TP_STRUCT__entry( 785 __field(unsigned long, error) 786 __field(unsigned long, cmd) 787 __field(unsigned long, type) 788 __field(loff_t, start) 789 __field(loff_t, end) 790 __field(dev_t, dev) 791 __field(u32, fhandle) 792 __field(u64, fileid) 793 __field(int, stateid_seq) 794 __field(u32, stateid_hash) 795 __field(int, lockstateid_seq) 796 __field(u32, lockstateid_hash) 797 ), 798 799 TP_fast_assign( 800 const struct inode *inode = state->inode; 801 802 __entry->error = error < 0 ? -error : 0; 803 __entry->cmd = cmd; 804 __entry->type = request->c.flc_type; 805 __entry->start = request->fl_start; 806 __entry->end = request->fl_end; 807 __entry->dev = inode->i_sb->s_dev; 808 __entry->fileid = NFS_FILEID(inode); 809 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 810 __entry->stateid_seq = 811 be32_to_cpu(state->stateid.seqid); 812 __entry->stateid_hash = 813 nfs_stateid_hash(&state->stateid); 814 __entry->lockstateid_seq = 815 be32_to_cpu(lockstateid->seqid); 816 __entry->lockstateid_hash = 817 nfs_stateid_hash(lockstateid); 818 ), 819 820 TP_printk( 821 "error=%ld (%s) cmd=%s:%s range=%lld:%lld " 822 "fileid=%02x:%02x:%llu fhandle=0x%08x " 823 "stateid=%d:0x%08x lockstateid=%d:0x%08x", 824 -__entry->error, 825 show_nfs4_status(__entry->error), 826 show_fs_fcntl_cmd(__entry->cmd), 827 show_fs_fcntl_lock_type(__entry->type), 828 (long long)__entry->start, 829 (long long)__entry->end, 830 MAJOR(__entry->dev), MINOR(__entry->dev), 831 (unsigned long long)__entry->fileid, 832 __entry->fhandle, 833 __entry->stateid_seq, __entry->stateid_hash, 834 __entry->lockstateid_seq, __entry->lockstateid_hash 835 ) 836 ); 837 838 TRACE_DEFINE_ENUM(LK_STATE_IN_USE); 839 TRACE_DEFINE_ENUM(NFS_DELEGATED_STATE); 840 TRACE_DEFINE_ENUM(NFS_OPEN_STATE); 841 TRACE_DEFINE_ENUM(NFS_O_RDONLY_STATE); 842 TRACE_DEFINE_ENUM(NFS_O_WRONLY_STATE); 843 TRACE_DEFINE_ENUM(NFS_O_RDWR_STATE); 844 TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_REBOOT); 845 TRACE_DEFINE_ENUM(NFS_STATE_RECLAIM_NOGRACE); 846 TRACE_DEFINE_ENUM(NFS_STATE_POSIX_LOCKS); 847 TRACE_DEFINE_ENUM(NFS_STATE_RECOVERY_FAILED); 848 TRACE_DEFINE_ENUM(NFS_STATE_MAY_NOTIFY_LOCK); 849 TRACE_DEFINE_ENUM(NFS_STATE_CHANGE_WAIT); 850 TRACE_DEFINE_ENUM(NFS_CLNT_DST_SSC_COPY_STATE); 851 TRACE_DEFINE_ENUM(NFS_CLNT_SRC_SSC_COPY_STATE); 852 TRACE_DEFINE_ENUM(NFS_SRV_SSC_COPY_STATE); 853 854 #define show_nfs4_state_flags(flags) \ 855 __print_flags(flags, "|", \ 856 { LK_STATE_IN_USE, "IN_USE" }, \ 857 { NFS_DELEGATED_STATE, "DELEGATED" }, \ 858 { NFS_OPEN_STATE, "OPEN" }, \ 859 { NFS_O_RDONLY_STATE, "O_RDONLY" }, \ 860 { NFS_O_WRONLY_STATE, "O_WRONLY" }, \ 861 { NFS_O_RDWR_STATE, "O_RDWR" }, \ 862 { NFS_STATE_RECLAIM_REBOOT, "RECLAIM_REBOOT" }, \ 863 { NFS_STATE_RECLAIM_NOGRACE, "RECLAIM_NOGRACE" }, \ 864 { NFS_STATE_POSIX_LOCKS, "POSIX_LOCKS" }, \ 865 { NFS_STATE_RECOVERY_FAILED, "RECOVERY_FAILED" }, \ 866 { NFS_STATE_MAY_NOTIFY_LOCK, "MAY_NOTIFY_LOCK" }, \ 867 { NFS_STATE_CHANGE_WAIT, "CHANGE_WAIT" }, \ 868 { NFS_CLNT_DST_SSC_COPY_STATE, "CLNT_DST_SSC_COPY" }, \ 869 { NFS_CLNT_SRC_SSC_COPY_STATE, "CLNT_SRC_SSC_COPY" }, \ 870 { NFS_SRV_SSC_COPY_STATE, "SRV_SSC_COPY" }) 871 872 #define show_nfs4_lock_flags(flags) \ 873 __print_flags(flags, "|", \ 874 { BIT(NFS_LOCK_INITIALIZED), "INITIALIZED" }, \ 875 { BIT(NFS_LOCK_LOST), "LOST" }) 876 877 TRACE_EVENT(nfs4_state_lock_reclaim, 878 TP_PROTO( 879 const struct nfs4_state *state, 880 const struct nfs4_lock_state *lock 881 ), 882 883 TP_ARGS(state, lock), 884 885 TP_STRUCT__entry( 886 __field(dev_t, dev) 887 __field(u32, fhandle) 888 __field(u64, fileid) 889 __field(unsigned long, state_flags) 890 __field(unsigned long, lock_flags) 891 __field(int, stateid_seq) 892 __field(u32, stateid_hash) 893 ), 894 895 TP_fast_assign( 896 const struct inode *inode = state->inode; 897 898 __entry->dev = inode->i_sb->s_dev; 899 __entry->fileid = NFS_FILEID(inode); 900 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 901 __entry->state_flags = state->flags; 902 __entry->lock_flags = lock->ls_flags; 903 __entry->stateid_seq = 904 be32_to_cpu(state->stateid.seqid); 905 __entry->stateid_hash = 906 nfs_stateid_hash(&state->stateid); 907 ), 908 909 TP_printk( 910 "fileid=%02x:%02x:%llu fhandle=0x%08x " 911 "stateid=%d:0x%08x state_flags=%s lock_flags=%s", 912 MAJOR(__entry->dev), MINOR(__entry->dev), 913 (unsigned long long)__entry->fileid, __entry->fhandle, 914 __entry->stateid_seq, __entry->stateid_hash, 915 show_nfs4_state_flags(__entry->state_flags), 916 show_nfs4_lock_flags(__entry->lock_flags) 917 ) 918 ) 919 920 DECLARE_EVENT_CLASS(nfs4_set_delegation_event, 921 TP_PROTO( 922 const struct inode *inode, 923 fmode_t fmode 924 ), 925 926 TP_ARGS(inode, fmode), 927 928 TP_STRUCT__entry( 929 __field(dev_t, dev) 930 __field(u32, fhandle) 931 __field(u64, fileid) 932 __field(unsigned int, fmode) 933 ), 934 935 TP_fast_assign( 936 __entry->dev = inode->i_sb->s_dev; 937 __entry->fileid = NFS_FILEID(inode); 938 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 939 __entry->fmode = (__force unsigned int)fmode; 940 ), 941 942 TP_printk( 943 "fmode=%s fileid=%02x:%02x:%llu fhandle=0x%08x", 944 show_fs_fmode_flags(__entry->fmode), 945 MAJOR(__entry->dev), MINOR(__entry->dev), 946 (unsigned long long)__entry->fileid, 947 __entry->fhandle 948 ) 949 ); 950 #define DEFINE_NFS4_SET_DELEGATION_EVENT(name) \ 951 DEFINE_EVENT(nfs4_set_delegation_event, name, \ 952 TP_PROTO( \ 953 const struct inode *inode, \ 954 fmode_t fmode \ 955 ), \ 956 TP_ARGS(inode, fmode)) 957 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_set_delegation); 958 DEFINE_NFS4_SET_DELEGATION_EVENT(nfs4_reclaim_delegation); 959 960 TRACE_EVENT(nfs4_delegreturn_exit, 961 TP_PROTO( 962 const struct nfs4_delegreturnargs *args, 963 const struct nfs4_delegreturnres *res, 964 int error 965 ), 966 967 TP_ARGS(args, res, error), 968 969 TP_STRUCT__entry( 970 __field(dev_t, dev) 971 __field(u32, fhandle) 972 __field(unsigned long, error) 973 __field(int, stateid_seq) 974 __field(u32, stateid_hash) 975 ), 976 977 TP_fast_assign( 978 __entry->dev = res->server->s_dev; 979 __entry->fhandle = nfs_fhandle_hash(args->fhandle); 980 __entry->error = error < 0 ? -error : 0; 981 __entry->stateid_seq = 982 be32_to_cpu(args->stateid->seqid); 983 __entry->stateid_hash = 984 nfs_stateid_hash(args->stateid); 985 ), 986 987 TP_printk( 988 "error=%ld (%s) dev=%02x:%02x fhandle=0x%08x " 989 "stateid=%d:0x%08x", 990 -__entry->error, 991 show_nfs4_status(__entry->error), 992 MAJOR(__entry->dev), MINOR(__entry->dev), 993 __entry->fhandle, 994 __entry->stateid_seq, __entry->stateid_hash 995 ) 996 ); 997 998 #ifdef CONFIG_NFS_V4_1 999 DECLARE_EVENT_CLASS(nfs4_test_stateid_event, 1000 TP_PROTO( 1001 const struct nfs4_state *state, 1002 const struct nfs4_lock_state *lsp, 1003 int error 1004 ), 1005 1006 TP_ARGS(state, lsp, error), 1007 1008 TP_STRUCT__entry( 1009 __field(unsigned long, error) 1010 __field(dev_t, dev) 1011 __field(u32, fhandle) 1012 __field(u64, fileid) 1013 __field(int, stateid_seq) 1014 __field(u32, stateid_hash) 1015 ), 1016 1017 TP_fast_assign( 1018 const struct inode *inode = state->inode; 1019 1020 __entry->error = error < 0 ? -error : 0; 1021 __entry->dev = inode->i_sb->s_dev; 1022 __entry->fileid = NFS_FILEID(inode); 1023 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1024 __entry->stateid_seq = 1025 be32_to_cpu(state->stateid.seqid); 1026 __entry->stateid_hash = 1027 nfs_stateid_hash(&state->stateid); 1028 ), 1029 1030 TP_printk( 1031 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1032 "stateid=%d:0x%08x", 1033 -__entry->error, 1034 show_nfs4_status(__entry->error), 1035 MAJOR(__entry->dev), MINOR(__entry->dev), 1036 (unsigned long long)__entry->fileid, 1037 __entry->fhandle, 1038 __entry->stateid_seq, __entry->stateid_hash 1039 ) 1040 ); 1041 1042 #define DEFINE_NFS4_TEST_STATEID_EVENT(name) \ 1043 DEFINE_EVENT(nfs4_test_stateid_event, name, \ 1044 TP_PROTO( \ 1045 const struct nfs4_state *state, \ 1046 const struct nfs4_lock_state *lsp, \ 1047 int error \ 1048 ), \ 1049 TP_ARGS(state, lsp, error)) 1050 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_delegation_stateid); 1051 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_open_stateid); 1052 DEFINE_NFS4_TEST_STATEID_EVENT(nfs4_test_lock_stateid); 1053 #endif /* CONFIG_NFS_V4_1 */ 1054 1055 DECLARE_EVENT_CLASS(nfs4_lookup_event, 1056 TP_PROTO( 1057 const struct inode *dir, 1058 const struct qstr *name, 1059 int error 1060 ), 1061 1062 TP_ARGS(dir, name, error), 1063 1064 TP_STRUCT__entry( 1065 __field(dev_t, dev) 1066 __field(unsigned long, error) 1067 __field(u64, dir) 1068 __string(name, name->name) 1069 ), 1070 1071 TP_fast_assign( 1072 __entry->dev = dir->i_sb->s_dev; 1073 __entry->dir = NFS_FILEID(dir); 1074 __entry->error = -error; 1075 __assign_str(name); 1076 ), 1077 1078 TP_printk( 1079 "error=%ld (%s) name=%02x:%02x:%llu/%s", 1080 -__entry->error, 1081 show_nfs4_status(__entry->error), 1082 MAJOR(__entry->dev), MINOR(__entry->dev), 1083 (unsigned long long)__entry->dir, 1084 __get_str(name) 1085 ) 1086 ); 1087 1088 #define DEFINE_NFS4_LOOKUP_EVENT(name) \ 1089 DEFINE_EVENT(nfs4_lookup_event, name, \ 1090 TP_PROTO( \ 1091 const struct inode *dir, \ 1092 const struct qstr *name, \ 1093 int error \ 1094 ), \ 1095 TP_ARGS(dir, name, error)) 1096 1097 DEFINE_NFS4_LOOKUP_EVENT(nfs4_lookup); 1098 DEFINE_NFS4_LOOKUP_EVENT(nfs4_symlink); 1099 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mkdir); 1100 DEFINE_NFS4_LOOKUP_EVENT(nfs4_mknod); 1101 DEFINE_NFS4_LOOKUP_EVENT(nfs4_remove); 1102 DEFINE_NFS4_LOOKUP_EVENT(nfs4_get_fs_locations); 1103 DEFINE_NFS4_LOOKUP_EVENT(nfs4_secinfo); 1104 1105 TRACE_EVENT(nfs4_lookupp, 1106 TP_PROTO( 1107 const struct inode *inode, 1108 int error 1109 ), 1110 1111 TP_ARGS(inode, error), 1112 1113 TP_STRUCT__entry( 1114 __field(dev_t, dev) 1115 __field(u64, ino) 1116 __field(unsigned long, error) 1117 ), 1118 1119 TP_fast_assign( 1120 __entry->dev = inode->i_sb->s_dev; 1121 __entry->ino = NFS_FILEID(inode); 1122 __entry->error = error < 0 ? -error : 0; 1123 ), 1124 1125 TP_printk( 1126 "error=%ld (%s) inode=%02x:%02x:%llu", 1127 -__entry->error, 1128 show_nfs4_status(__entry->error), 1129 MAJOR(__entry->dev), MINOR(__entry->dev), 1130 (unsigned long long)__entry->ino 1131 ) 1132 ); 1133 1134 TRACE_EVENT(nfs4_rename, 1135 TP_PROTO( 1136 const struct inode *olddir, 1137 const struct qstr *oldname, 1138 const struct inode *newdir, 1139 const struct qstr *newname, 1140 int error 1141 ), 1142 1143 TP_ARGS(olddir, oldname, newdir, newname, error), 1144 1145 TP_STRUCT__entry( 1146 __field(dev_t, dev) 1147 __field(unsigned long, error) 1148 __field(u64, olddir) 1149 __string(oldname, oldname->name) 1150 __field(u64, newdir) 1151 __string(newname, newname->name) 1152 ), 1153 1154 TP_fast_assign( 1155 __entry->dev = olddir->i_sb->s_dev; 1156 __entry->olddir = NFS_FILEID(olddir); 1157 __entry->newdir = NFS_FILEID(newdir); 1158 __entry->error = error < 0 ? -error : 0; 1159 __assign_str(oldname); 1160 __assign_str(newname); 1161 ), 1162 1163 TP_printk( 1164 "error=%ld (%s) oldname=%02x:%02x:%llu/%s " 1165 "newname=%02x:%02x:%llu/%s", 1166 -__entry->error, 1167 show_nfs4_status(__entry->error), 1168 MAJOR(__entry->dev), MINOR(__entry->dev), 1169 (unsigned long long)__entry->olddir, 1170 __get_str(oldname), 1171 MAJOR(__entry->dev), MINOR(__entry->dev), 1172 (unsigned long long)__entry->newdir, 1173 __get_str(newname) 1174 ) 1175 ); 1176 1177 DECLARE_EVENT_CLASS(nfs4_inode_event, 1178 TP_PROTO( 1179 const struct inode *inode, 1180 int error 1181 ), 1182 1183 TP_ARGS(inode, error), 1184 1185 TP_STRUCT__entry( 1186 __field(dev_t, dev) 1187 __field(u32, fhandle) 1188 __field(u64, fileid) 1189 __field(unsigned long, error) 1190 ), 1191 1192 TP_fast_assign( 1193 __entry->dev = inode->i_sb->s_dev; 1194 __entry->fileid = NFS_FILEID(inode); 1195 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1196 __entry->error = error < 0 ? -error : 0; 1197 ), 1198 1199 TP_printk( 1200 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x", 1201 -__entry->error, 1202 show_nfs4_status(__entry->error), 1203 MAJOR(__entry->dev), MINOR(__entry->dev), 1204 (unsigned long long)__entry->fileid, 1205 __entry->fhandle 1206 ) 1207 ); 1208 1209 #define DEFINE_NFS4_INODE_EVENT(name) \ 1210 DEFINE_EVENT(nfs4_inode_event, name, \ 1211 TP_PROTO( \ 1212 const struct inode *inode, \ 1213 int error \ 1214 ), \ 1215 TP_ARGS(inode, error)) 1216 1217 DEFINE_NFS4_INODE_EVENT(nfs4_access); 1218 DEFINE_NFS4_INODE_EVENT(nfs4_readlink); 1219 DEFINE_NFS4_INODE_EVENT(nfs4_readdir); 1220 DEFINE_NFS4_INODE_EVENT(nfs4_get_acl); 1221 DEFINE_NFS4_INODE_EVENT(nfs4_set_acl); 1222 #ifdef CONFIG_NFS_V4_SECURITY_LABEL 1223 DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label); 1224 DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label); 1225 #endif /* CONFIG_NFS_V4_SECURITY_LABEL */ 1226 1227 DECLARE_EVENT_CLASS(nfs4_inode_stateid_event, 1228 TP_PROTO( 1229 const struct inode *inode, 1230 const nfs4_stateid *stateid, 1231 int error 1232 ), 1233 1234 TP_ARGS(inode, stateid, error), 1235 1236 TP_STRUCT__entry( 1237 __field(dev_t, dev) 1238 __field(u32, fhandle) 1239 __field(u64, fileid) 1240 __field(unsigned long, error) 1241 __field(int, stateid_seq) 1242 __field(u32, stateid_hash) 1243 ), 1244 1245 TP_fast_assign( 1246 __entry->dev = inode->i_sb->s_dev; 1247 __entry->fileid = NFS_FILEID(inode); 1248 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1249 __entry->error = error < 0 ? -error : 0; 1250 __entry->stateid_seq = 1251 be32_to_cpu(stateid->seqid); 1252 __entry->stateid_hash = 1253 nfs_stateid_hash(stateid); 1254 ), 1255 1256 TP_printk( 1257 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1258 "stateid=%d:0x%08x", 1259 -__entry->error, 1260 show_nfs4_status(__entry->error), 1261 MAJOR(__entry->dev), MINOR(__entry->dev), 1262 (unsigned long long)__entry->fileid, 1263 __entry->fhandle, 1264 __entry->stateid_seq, __entry->stateid_hash 1265 ) 1266 ); 1267 1268 #define DEFINE_NFS4_INODE_STATEID_EVENT(name) \ 1269 DEFINE_EVENT(nfs4_inode_stateid_event, name, \ 1270 TP_PROTO( \ 1271 const struct inode *inode, \ 1272 const nfs4_stateid *stateid, \ 1273 int error \ 1274 ), \ 1275 TP_ARGS(inode, stateid, error)) 1276 1277 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_setattr); 1278 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_delegreturn); 1279 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update); 1280 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_open_stateid_update_wait); 1281 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_close_stateid_update_wait); 1282 1283 DECLARE_EVENT_CLASS(nfs4_getattr_event, 1284 TP_PROTO( 1285 const struct nfs_server *server, 1286 const struct nfs_fh *fhandle, 1287 const struct nfs_fattr *fattr, 1288 int error 1289 ), 1290 1291 TP_ARGS(server, fhandle, fattr, error), 1292 1293 TP_STRUCT__entry( 1294 __field(dev_t, dev) 1295 __field(u32, fhandle) 1296 __field(u64, fileid) 1297 __field(unsigned int, valid) 1298 __field(unsigned long, error) 1299 ), 1300 1301 TP_fast_assign( 1302 __entry->dev = server->s_dev; 1303 __entry->valid = fattr->valid; 1304 __entry->fhandle = nfs_fhandle_hash(fhandle); 1305 __entry->fileid = (fattr->valid & NFS_ATTR_FATTR_FILEID) ? fattr->fileid : 0; 1306 __entry->error = error < 0 ? -error : 0; 1307 ), 1308 1309 TP_printk( 1310 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1311 "valid=%s", 1312 -__entry->error, 1313 show_nfs4_status(__entry->error), 1314 MAJOR(__entry->dev), MINOR(__entry->dev), 1315 (unsigned long long)__entry->fileid, 1316 __entry->fhandle, 1317 show_nfs_fattr_flags(__entry->valid) 1318 ) 1319 ); 1320 1321 #define DEFINE_NFS4_GETATTR_EVENT(name) \ 1322 DEFINE_EVENT(nfs4_getattr_event, name, \ 1323 TP_PROTO( \ 1324 const struct nfs_server *server, \ 1325 const struct nfs_fh *fhandle, \ 1326 const struct nfs_fattr *fattr, \ 1327 int error \ 1328 ), \ 1329 TP_ARGS(server, fhandle, fattr, error)) 1330 DEFINE_NFS4_GETATTR_EVENT(nfs4_getattr); 1331 DEFINE_NFS4_GETATTR_EVENT(nfs4_lookup_root); 1332 DEFINE_NFS4_GETATTR_EVENT(nfs4_fsinfo); 1333 1334 DECLARE_EVENT_CLASS(nfs4_inode_callback_event, 1335 TP_PROTO( 1336 const struct nfs_client *clp, 1337 const struct nfs_fh *fhandle, 1338 const struct inode *inode, 1339 int error 1340 ), 1341 1342 TP_ARGS(clp, fhandle, inode, error), 1343 1344 TP_STRUCT__entry( 1345 __field(unsigned long, error) 1346 __field(dev_t, dev) 1347 __field(u32, fhandle) 1348 __field(u64, fileid) 1349 __string(dstaddr, clp ? clp->cl_hostname : "unknown") 1350 ), 1351 1352 TP_fast_assign( 1353 __entry->error = error < 0 ? -error : 0; 1354 __entry->fhandle = nfs_fhandle_hash(fhandle); 1355 if (!IS_ERR_OR_NULL(inode)) { 1356 __entry->fileid = NFS_FILEID(inode); 1357 __entry->dev = inode->i_sb->s_dev; 1358 } else { 1359 __entry->fileid = 0; 1360 __entry->dev = 0; 1361 } 1362 __assign_str(dstaddr); 1363 ), 1364 1365 TP_printk( 1366 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1367 "dstaddr=%s", 1368 -__entry->error, 1369 show_nfs4_status(__entry->error), 1370 MAJOR(__entry->dev), MINOR(__entry->dev), 1371 (unsigned long long)__entry->fileid, 1372 __entry->fhandle, 1373 __get_str(dstaddr) 1374 ) 1375 ); 1376 1377 #define DEFINE_NFS4_INODE_CALLBACK_EVENT(name) \ 1378 DEFINE_EVENT(nfs4_inode_callback_event, name, \ 1379 TP_PROTO( \ 1380 const struct nfs_client *clp, \ 1381 const struct nfs_fh *fhandle, \ 1382 const struct inode *inode, \ 1383 int error \ 1384 ), \ 1385 TP_ARGS(clp, fhandle, inode, error)) 1386 DEFINE_NFS4_INODE_CALLBACK_EVENT(nfs4_cb_getattr); 1387 1388 DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event, 1389 TP_PROTO( 1390 const struct nfs_client *clp, 1391 const struct nfs_fh *fhandle, 1392 const struct inode *inode, 1393 const nfs4_stateid *stateid, 1394 int error 1395 ), 1396 1397 TP_ARGS(clp, fhandle, inode, stateid, error), 1398 1399 TP_STRUCT__entry( 1400 __field(unsigned long, error) 1401 __field(dev_t, dev) 1402 __field(u32, fhandle) 1403 __field(u64, fileid) 1404 __string(dstaddr, clp ? clp->cl_hostname : "unknown") 1405 __field(int, stateid_seq) 1406 __field(u32, stateid_hash) 1407 ), 1408 1409 TP_fast_assign( 1410 __entry->error = error < 0 ? -error : 0; 1411 __entry->fhandle = nfs_fhandle_hash(fhandle); 1412 if (!IS_ERR_OR_NULL(inode)) { 1413 __entry->fileid = NFS_FILEID(inode); 1414 __entry->dev = inode->i_sb->s_dev; 1415 } else { 1416 __entry->fileid = 0; 1417 __entry->dev = 0; 1418 } 1419 __assign_str(dstaddr); 1420 __entry->stateid_seq = 1421 be32_to_cpu(stateid->seqid); 1422 __entry->stateid_hash = 1423 nfs_stateid_hash(stateid); 1424 ), 1425 1426 TP_printk( 1427 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1428 "stateid=%d:0x%08x dstaddr=%s", 1429 -__entry->error, 1430 show_nfs4_status(__entry->error), 1431 MAJOR(__entry->dev), MINOR(__entry->dev), 1432 (unsigned long long)__entry->fileid, 1433 __entry->fhandle, 1434 __entry->stateid_seq, __entry->stateid_hash, 1435 __get_str(dstaddr) 1436 ) 1437 ); 1438 1439 #define DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(name) \ 1440 DEFINE_EVENT(nfs4_inode_stateid_callback_event, name, \ 1441 TP_PROTO( \ 1442 const struct nfs_client *clp, \ 1443 const struct nfs_fh *fhandle, \ 1444 const struct inode *inode, \ 1445 const nfs4_stateid *stateid, \ 1446 int error \ 1447 ), \ 1448 TP_ARGS(clp, fhandle, inode, stateid, error)) 1449 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_recall); 1450 DEFINE_NFS4_INODE_STATEID_CALLBACK_EVENT(nfs4_cb_layoutrecall_file); 1451 1452 DECLARE_EVENT_CLASS(nfs4_idmap_event, 1453 TP_PROTO( 1454 const char *name, 1455 int len, 1456 u32 id, 1457 int error 1458 ), 1459 1460 TP_ARGS(name, len, id, error), 1461 1462 TP_STRUCT__entry( 1463 __field(unsigned long, error) 1464 __field(u32, id) 1465 __dynamic_array(char, name, len > 0 ? len + 1 : 1) 1466 ), 1467 1468 TP_fast_assign( 1469 if (len < 0) 1470 len = 0; 1471 __entry->error = error < 0 ? error : 0; 1472 __entry->id = id; 1473 memcpy(__get_str(name), name, len); 1474 __get_str(name)[len] = 0; 1475 ), 1476 1477 TP_printk( 1478 "error=%ld (%s) id=%u name=%s", 1479 -__entry->error, show_nfs4_status(__entry->error), 1480 __entry->id, 1481 __get_str(name) 1482 ) 1483 ); 1484 #define DEFINE_NFS4_IDMAP_EVENT(name) \ 1485 DEFINE_EVENT(nfs4_idmap_event, name, \ 1486 TP_PROTO( \ 1487 const char *name, \ 1488 int len, \ 1489 u32 id, \ 1490 int error \ 1491 ), \ 1492 TP_ARGS(name, len, id, error)) 1493 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_name_to_uid); 1494 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_group_to_gid); 1495 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_uid_to_name); 1496 DEFINE_NFS4_IDMAP_EVENT(nfs4_map_gid_to_group); 1497 1498 #ifdef CONFIG_NFS_V4_1 1499 #define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) \ 1500 (lseg ? nfs_stateid_hash(&lseg->pls_layout->plh_stateid) : 0) 1501 #else 1502 #define NFS4_LSEG_LAYOUT_STATEID_HASH(lseg) (0) 1503 #endif 1504 1505 DECLARE_EVENT_CLASS(nfs4_read_event, 1506 TP_PROTO( 1507 const struct nfs_pgio_header *hdr, 1508 int error 1509 ), 1510 1511 TP_ARGS(hdr, error), 1512 1513 TP_STRUCT__entry( 1514 __field(dev_t, dev) 1515 __field(u32, fhandle) 1516 __field(u64, fileid) 1517 __field(loff_t, offset) 1518 __field(u32, arg_count) 1519 __field(u32, res_count) 1520 __field(unsigned long, error) 1521 __field(int, stateid_seq) 1522 __field(u32, stateid_hash) 1523 __field(int, layoutstateid_seq) 1524 __field(u32, layoutstateid_hash) 1525 ), 1526 1527 TP_fast_assign( 1528 const struct inode *inode = hdr->inode; 1529 const struct nfs_inode *nfsi = NFS_I(inode); 1530 const struct nfs_fh *fh = hdr->args.fh ? 1531 hdr->args.fh : &nfsi->fh; 1532 const struct nfs4_state *state = 1533 hdr->args.context->state; 1534 const struct pnfs_layout_segment *lseg = hdr->lseg; 1535 1536 __entry->dev = inode->i_sb->s_dev; 1537 __entry->fileid = nfsi->fileid; 1538 __entry->fhandle = nfs_fhandle_hash(fh); 1539 __entry->offset = hdr->args.offset; 1540 __entry->arg_count = hdr->args.count; 1541 __entry->res_count = hdr->res.count; 1542 __entry->error = error < 0 ? -error : 0; 1543 __entry->stateid_seq = 1544 be32_to_cpu(state->stateid.seqid); 1545 __entry->stateid_hash = 1546 nfs_stateid_hash(&state->stateid); 1547 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0; 1548 __entry->layoutstateid_hash = 1549 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg); 1550 ), 1551 1552 TP_printk( 1553 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1554 "offset=%lld count=%u res=%u stateid=%d:0x%08x " 1555 "layoutstateid=%d:0x%08x", 1556 -__entry->error, 1557 show_nfs4_status(__entry->error), 1558 MAJOR(__entry->dev), MINOR(__entry->dev), 1559 (unsigned long long)__entry->fileid, 1560 __entry->fhandle, 1561 (long long)__entry->offset, 1562 __entry->arg_count, __entry->res_count, 1563 __entry->stateid_seq, __entry->stateid_hash, 1564 __entry->layoutstateid_seq, __entry->layoutstateid_hash 1565 ) 1566 ); 1567 #define DEFINE_NFS4_READ_EVENT(name) \ 1568 DEFINE_EVENT(nfs4_read_event, name, \ 1569 TP_PROTO( \ 1570 const struct nfs_pgio_header *hdr, \ 1571 int error \ 1572 ), \ 1573 TP_ARGS(hdr, error)) 1574 DEFINE_NFS4_READ_EVENT(nfs4_read); 1575 #ifdef CONFIG_NFS_V4_1 1576 DEFINE_NFS4_READ_EVENT(nfs4_pnfs_read); 1577 #endif /* CONFIG_NFS_V4_1 */ 1578 1579 DECLARE_EVENT_CLASS(nfs4_write_event, 1580 TP_PROTO( 1581 const struct nfs_pgio_header *hdr, 1582 int error 1583 ), 1584 1585 TP_ARGS(hdr, error), 1586 1587 TP_STRUCT__entry( 1588 __field(dev_t, dev) 1589 __field(u32, fhandle) 1590 __field(u64, fileid) 1591 __field(loff_t, offset) 1592 __field(u32, arg_count) 1593 __field(u32, res_count) 1594 __field(unsigned long, error) 1595 __field(int, stateid_seq) 1596 __field(u32, stateid_hash) 1597 __field(int, layoutstateid_seq) 1598 __field(u32, layoutstateid_hash) 1599 ), 1600 1601 TP_fast_assign( 1602 const struct inode *inode = hdr->inode; 1603 const struct nfs_inode *nfsi = NFS_I(inode); 1604 const struct nfs_fh *fh = hdr->args.fh ? 1605 hdr->args.fh : &nfsi->fh; 1606 const struct nfs4_state *state = 1607 hdr->args.context->state; 1608 const struct pnfs_layout_segment *lseg = hdr->lseg; 1609 1610 __entry->dev = inode->i_sb->s_dev; 1611 __entry->fileid = nfsi->fileid; 1612 __entry->fhandle = nfs_fhandle_hash(fh); 1613 __entry->offset = hdr->args.offset; 1614 __entry->arg_count = hdr->args.count; 1615 __entry->res_count = hdr->res.count; 1616 __entry->error = error < 0 ? -error : 0; 1617 __entry->stateid_seq = 1618 be32_to_cpu(state->stateid.seqid); 1619 __entry->stateid_hash = 1620 nfs_stateid_hash(&state->stateid); 1621 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0; 1622 __entry->layoutstateid_hash = 1623 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg); 1624 ), 1625 1626 TP_printk( 1627 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1628 "offset=%lld count=%u res=%u stateid=%d:0x%08x " 1629 "layoutstateid=%d:0x%08x", 1630 -__entry->error, 1631 show_nfs4_status(__entry->error), 1632 MAJOR(__entry->dev), MINOR(__entry->dev), 1633 (unsigned long long)__entry->fileid, 1634 __entry->fhandle, 1635 (long long)__entry->offset, 1636 __entry->arg_count, __entry->res_count, 1637 __entry->stateid_seq, __entry->stateid_hash, 1638 __entry->layoutstateid_seq, __entry->layoutstateid_hash 1639 ) 1640 ); 1641 1642 #define DEFINE_NFS4_WRITE_EVENT(name) \ 1643 DEFINE_EVENT(nfs4_write_event, name, \ 1644 TP_PROTO( \ 1645 const struct nfs_pgio_header *hdr, \ 1646 int error \ 1647 ), \ 1648 TP_ARGS(hdr, error)) 1649 DEFINE_NFS4_WRITE_EVENT(nfs4_write); 1650 #ifdef CONFIG_NFS_V4_1 1651 DEFINE_NFS4_WRITE_EVENT(nfs4_pnfs_write); 1652 #endif /* CONFIG_NFS_V4_1 */ 1653 1654 DECLARE_EVENT_CLASS(nfs4_commit_event, 1655 TP_PROTO( 1656 const struct nfs_commit_data *data, 1657 int error 1658 ), 1659 1660 TP_ARGS(data, error), 1661 1662 TP_STRUCT__entry( 1663 __field(dev_t, dev) 1664 __field(u32, fhandle) 1665 __field(u64, fileid) 1666 __field(unsigned long, error) 1667 __field(loff_t, offset) 1668 __field(u32, count) 1669 __field(int, layoutstateid_seq) 1670 __field(u32, layoutstateid_hash) 1671 ), 1672 1673 TP_fast_assign( 1674 const struct inode *inode = data->inode; 1675 const struct nfs_inode *nfsi = NFS_I(inode); 1676 const struct nfs_fh *fh = data->args.fh ? 1677 data->args.fh : &nfsi->fh; 1678 const struct pnfs_layout_segment *lseg = data->lseg; 1679 1680 __entry->dev = inode->i_sb->s_dev; 1681 __entry->fileid = nfsi->fileid; 1682 __entry->fhandle = nfs_fhandle_hash(fh); 1683 __entry->offset = data->args.offset; 1684 __entry->count = data->args.count; 1685 __entry->error = error < 0 ? -error : 0; 1686 __entry->layoutstateid_seq = lseg ? lseg->pls_seq : 0; 1687 __entry->layoutstateid_hash = 1688 NFS4_LSEG_LAYOUT_STATEID_HASH(lseg); 1689 ), 1690 1691 TP_printk( 1692 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1693 "offset=%lld count=%u layoutstateid=%d:0x%08x", 1694 -__entry->error, 1695 show_nfs4_status(__entry->error), 1696 MAJOR(__entry->dev), MINOR(__entry->dev), 1697 (unsigned long long)__entry->fileid, 1698 __entry->fhandle, 1699 (long long)__entry->offset, 1700 __entry->count, 1701 __entry->layoutstateid_seq, __entry->layoutstateid_hash 1702 ) 1703 ); 1704 #define DEFINE_NFS4_COMMIT_EVENT(name) \ 1705 DEFINE_EVENT(nfs4_commit_event, name, \ 1706 TP_PROTO( \ 1707 const struct nfs_commit_data *data, \ 1708 int error \ 1709 ), \ 1710 TP_ARGS(data, error)) 1711 DEFINE_NFS4_COMMIT_EVENT(nfs4_commit); 1712 #ifdef CONFIG_NFS_V4_1 1713 DEFINE_NFS4_COMMIT_EVENT(nfs4_pnfs_commit_ds); 1714 1715 TRACE_EVENT(nfs4_layoutget, 1716 TP_PROTO( 1717 const struct nfs_open_context *ctx, 1718 const struct pnfs_layout_range *args, 1719 const struct pnfs_layout_range *res, 1720 const nfs4_stateid *layout_stateid, 1721 int error 1722 ), 1723 1724 TP_ARGS(ctx, args, res, layout_stateid, error), 1725 1726 TP_STRUCT__entry( 1727 __field(dev_t, dev) 1728 __field(u32, fhandle) 1729 __field(u64, fileid) 1730 __field(u32, iomode) 1731 __field(u64, offset) 1732 __field(u64, count) 1733 __field(unsigned long, error) 1734 __field(int, stateid_seq) 1735 __field(u32, stateid_hash) 1736 __field(int, layoutstateid_seq) 1737 __field(u32, layoutstateid_hash) 1738 ), 1739 1740 TP_fast_assign( 1741 const struct inode *inode = d_inode(ctx->dentry); 1742 const struct nfs4_state *state = ctx->state; 1743 __entry->dev = inode->i_sb->s_dev; 1744 __entry->fileid = NFS_FILEID(inode); 1745 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1746 __entry->iomode = args->iomode; 1747 __entry->offset = args->offset; 1748 __entry->count = args->length; 1749 __entry->error = error < 0 ? -error : 0; 1750 __entry->stateid_seq = 1751 be32_to_cpu(state->stateid.seqid); 1752 __entry->stateid_hash = 1753 nfs_stateid_hash(&state->stateid); 1754 if (!error) { 1755 __entry->layoutstateid_seq = 1756 be32_to_cpu(layout_stateid->seqid); 1757 __entry->layoutstateid_hash = 1758 nfs_stateid_hash(layout_stateid); 1759 } else { 1760 __entry->layoutstateid_seq = 0; 1761 __entry->layoutstateid_hash = 0; 1762 } 1763 ), 1764 1765 TP_printk( 1766 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 1767 "iomode=%s offset=%llu count=%llu stateid=%d:0x%08x " 1768 "layoutstateid=%d:0x%08x", 1769 -__entry->error, 1770 show_nfs4_status(__entry->error), 1771 MAJOR(__entry->dev), MINOR(__entry->dev), 1772 (unsigned long long)__entry->fileid, 1773 __entry->fhandle, 1774 show_pnfs_layout_iomode(__entry->iomode), 1775 (unsigned long long)__entry->offset, 1776 (unsigned long long)__entry->count, 1777 __entry->stateid_seq, __entry->stateid_hash, 1778 __entry->layoutstateid_seq, __entry->layoutstateid_hash 1779 ) 1780 ); 1781 1782 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutcommit); 1783 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn); 1784 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutreturn_on_close); 1785 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layouterror); 1786 DEFINE_NFS4_INODE_STATEID_EVENT(nfs4_layoutstats); 1787 1788 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_UNKNOWN); 1789 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NO_PNFS); 1790 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RD_ZEROLEN); 1791 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_MDSTHRESH); 1792 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_NOMEM); 1793 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BULK_RECALL); 1794 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_IO_TEST_FAIL); 1795 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_FOUND_CACHED); 1796 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETURN); 1797 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_BLOCKED); 1798 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_INVALID_OPEN); 1799 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_RETRY); 1800 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET); 1801 TRACE_DEFINE_ENUM(PNFS_UPDATE_LAYOUT_EXIT); 1802 1803 #define show_pnfs_update_layout_reason(reason) \ 1804 __print_symbolic(reason, \ 1805 { PNFS_UPDATE_LAYOUT_UNKNOWN, "unknown" }, \ 1806 { PNFS_UPDATE_LAYOUT_NO_PNFS, "no pnfs" }, \ 1807 { PNFS_UPDATE_LAYOUT_RD_ZEROLEN, "read+zerolen" }, \ 1808 { PNFS_UPDATE_LAYOUT_MDSTHRESH, "mdsthresh" }, \ 1809 { PNFS_UPDATE_LAYOUT_NOMEM, "nomem" }, \ 1810 { PNFS_UPDATE_LAYOUT_BULK_RECALL, "bulk recall" }, \ 1811 { PNFS_UPDATE_LAYOUT_IO_TEST_FAIL, "io test fail" }, \ 1812 { PNFS_UPDATE_LAYOUT_FOUND_CACHED, "found cached" }, \ 1813 { PNFS_UPDATE_LAYOUT_RETURN, "layoutreturn" }, \ 1814 { PNFS_UPDATE_LAYOUT_BLOCKED, "layouts blocked" }, \ 1815 { PNFS_UPDATE_LAYOUT_INVALID_OPEN, "invalid open" }, \ 1816 { PNFS_UPDATE_LAYOUT_RETRY, "retrying" }, \ 1817 { PNFS_UPDATE_LAYOUT_SEND_LAYOUTGET, "sent layoutget" }, \ 1818 { PNFS_UPDATE_LAYOUT_EXIT, "exit" }) 1819 1820 TRACE_EVENT(pnfs_update_layout, 1821 TP_PROTO(struct inode *inode, 1822 loff_t pos, 1823 u64 count, 1824 enum pnfs_iomode iomode, 1825 struct pnfs_layout_hdr *lo, 1826 struct pnfs_layout_segment *lseg, 1827 enum pnfs_update_layout_reason reason 1828 ), 1829 TP_ARGS(inode, pos, count, iomode, lo, lseg, reason), 1830 TP_STRUCT__entry( 1831 __field(dev_t, dev) 1832 __field(u64, fileid) 1833 __field(u32, fhandle) 1834 __field(loff_t, pos) 1835 __field(u64, count) 1836 __field(enum pnfs_iomode, iomode) 1837 __field(int, layoutstateid_seq) 1838 __field(u32, layoutstateid_hash) 1839 __field(long, lseg) 1840 __field(enum pnfs_update_layout_reason, reason) 1841 ), 1842 TP_fast_assign( 1843 __entry->dev = inode->i_sb->s_dev; 1844 __entry->fileid = NFS_FILEID(inode); 1845 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1846 __entry->pos = pos; 1847 __entry->count = count; 1848 __entry->iomode = iomode; 1849 __entry->reason = reason; 1850 if (lo != NULL && pnfs_layout_is_valid(lo)) { 1851 __entry->layoutstateid_seq = 1852 be32_to_cpu(lo->plh_stateid.seqid); 1853 __entry->layoutstateid_hash = 1854 nfs_stateid_hash(&lo->plh_stateid); 1855 } else { 1856 __entry->layoutstateid_seq = 0; 1857 __entry->layoutstateid_hash = 0; 1858 } 1859 __entry->lseg = (long)lseg; 1860 ), 1861 TP_printk( 1862 "fileid=%02x:%02x:%llu fhandle=0x%08x " 1863 "iomode=%s pos=%llu count=%llu " 1864 "layoutstateid=%d:0x%08x lseg=0x%lx (%s)", 1865 MAJOR(__entry->dev), MINOR(__entry->dev), 1866 (unsigned long long)__entry->fileid, 1867 __entry->fhandle, 1868 show_pnfs_layout_iomode(__entry->iomode), 1869 (unsigned long long)__entry->pos, 1870 (unsigned long long)__entry->count, 1871 __entry->layoutstateid_seq, __entry->layoutstateid_hash, 1872 __entry->lseg, 1873 show_pnfs_update_layout_reason(__entry->reason) 1874 ) 1875 ); 1876 1877 DECLARE_EVENT_CLASS(pnfs_layout_event, 1878 TP_PROTO(struct inode *inode, 1879 loff_t pos, 1880 u64 count, 1881 enum pnfs_iomode iomode, 1882 struct pnfs_layout_hdr *lo, 1883 struct pnfs_layout_segment *lseg 1884 ), 1885 TP_ARGS(inode, pos, count, iomode, lo, lseg), 1886 TP_STRUCT__entry( 1887 __field(dev_t, dev) 1888 __field(u64, fileid) 1889 __field(u32, fhandle) 1890 __field(loff_t, pos) 1891 __field(u64, count) 1892 __field(enum pnfs_iomode, iomode) 1893 __field(int, layoutstateid_seq) 1894 __field(u32, layoutstateid_hash) 1895 __field(long, lseg) 1896 ), 1897 TP_fast_assign( 1898 __entry->dev = inode->i_sb->s_dev; 1899 __entry->fileid = NFS_FILEID(inode); 1900 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 1901 __entry->pos = pos; 1902 __entry->count = count; 1903 __entry->iomode = iomode; 1904 if (lo != NULL && pnfs_layout_is_valid(lo)) { 1905 __entry->layoutstateid_seq = 1906 be32_to_cpu(lo->plh_stateid.seqid); 1907 __entry->layoutstateid_hash = 1908 nfs_stateid_hash(&lo->plh_stateid); 1909 } else { 1910 __entry->layoutstateid_seq = 0; 1911 __entry->layoutstateid_hash = 0; 1912 } 1913 __entry->lseg = (long)lseg; 1914 ), 1915 TP_printk( 1916 "fileid=%02x:%02x:%llu fhandle=0x%08x " 1917 "iomode=%s pos=%llu count=%llu " 1918 "layoutstateid=%d:0x%08x lseg=0x%lx", 1919 MAJOR(__entry->dev), MINOR(__entry->dev), 1920 (unsigned long long)__entry->fileid, 1921 __entry->fhandle, 1922 show_pnfs_layout_iomode(__entry->iomode), 1923 (unsigned long long)__entry->pos, 1924 (unsigned long long)__entry->count, 1925 __entry->layoutstateid_seq, __entry->layoutstateid_hash, 1926 __entry->lseg 1927 ) 1928 ); 1929 1930 #define DEFINE_PNFS_LAYOUT_EVENT(name) \ 1931 DEFINE_EVENT(pnfs_layout_event, name, \ 1932 TP_PROTO(struct inode *inode, \ 1933 loff_t pos, \ 1934 u64 count, \ 1935 enum pnfs_iomode iomode, \ 1936 struct pnfs_layout_hdr *lo, \ 1937 struct pnfs_layout_segment *lseg \ 1938 ), \ 1939 TP_ARGS(inode, pos, count, iomode, lo, lseg)) 1940 1941 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_read); 1942 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_init_write); 1943 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_pg_get_mirror_count); 1944 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_done); 1945 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_done); 1946 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_read_pagelist); 1947 DEFINE_PNFS_LAYOUT_EVENT(pnfs_mds_fallback_write_pagelist); 1948 1949 DECLARE_EVENT_CLASS(nfs4_deviceid_event, 1950 TP_PROTO( 1951 const struct nfs_client *clp, 1952 const struct nfs4_deviceid *deviceid 1953 ), 1954 1955 TP_ARGS(clp, deviceid), 1956 1957 TP_STRUCT__entry( 1958 __string(dstaddr, clp->cl_hostname) 1959 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE) 1960 ), 1961 1962 TP_fast_assign( 1963 __assign_str(dstaddr); 1964 memcpy(__entry->deviceid, deviceid->data, 1965 NFS4_DEVICEID4_SIZE); 1966 ), 1967 1968 TP_printk( 1969 "deviceid=%s, dstaddr=%s", 1970 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE), 1971 __get_str(dstaddr) 1972 ) 1973 ); 1974 #define DEFINE_PNFS_DEVICEID_EVENT(name) \ 1975 DEFINE_EVENT(nfs4_deviceid_event, name, \ 1976 TP_PROTO(const struct nfs_client *clp, \ 1977 const struct nfs4_deviceid *deviceid \ 1978 ), \ 1979 TP_ARGS(clp, deviceid)) 1980 DEFINE_PNFS_DEVICEID_EVENT(nfs4_deviceid_free); 1981 1982 DECLARE_EVENT_CLASS(nfs4_deviceid_status, 1983 TP_PROTO( 1984 const struct nfs_server *server, 1985 const struct nfs4_deviceid *deviceid, 1986 int status 1987 ), 1988 1989 TP_ARGS(server, deviceid, status), 1990 1991 TP_STRUCT__entry( 1992 __field(dev_t, dev) 1993 __field(int, status) 1994 __string(dstaddr, server->nfs_client->cl_hostname) 1995 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE) 1996 ), 1997 1998 TP_fast_assign( 1999 __entry->dev = server->s_dev; 2000 __entry->status = status; 2001 __assign_str(dstaddr); 2002 memcpy(__entry->deviceid, deviceid->data, 2003 NFS4_DEVICEID4_SIZE); 2004 ), 2005 2006 TP_printk( 2007 "dev=%02x:%02x: deviceid=%s, dstaddr=%s, status=%d", 2008 MAJOR(__entry->dev), MINOR(__entry->dev), 2009 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE), 2010 __get_str(dstaddr), 2011 __entry->status 2012 ) 2013 ); 2014 #define DEFINE_PNFS_DEVICEID_STATUS(name) \ 2015 DEFINE_EVENT(nfs4_deviceid_status, name, \ 2016 TP_PROTO(const struct nfs_server *server, \ 2017 const struct nfs4_deviceid *deviceid, \ 2018 int status \ 2019 ), \ 2020 TP_ARGS(server, deviceid, status)) 2021 DEFINE_PNFS_DEVICEID_STATUS(nfs4_getdeviceinfo); 2022 DEFINE_PNFS_DEVICEID_STATUS(nfs4_find_deviceid); 2023 2024 TRACE_EVENT(fl_getdevinfo, 2025 TP_PROTO( 2026 const struct nfs_server *server, 2027 const struct nfs4_deviceid *deviceid, 2028 char *ds_remotestr 2029 ), 2030 TP_ARGS(server, deviceid, ds_remotestr), 2031 2032 TP_STRUCT__entry( 2033 __string(mds_addr, server->nfs_client->cl_hostname) 2034 __array(unsigned char, deviceid, NFS4_DEVICEID4_SIZE) 2035 __string(ds_ips, ds_remotestr) 2036 ), 2037 2038 TP_fast_assign( 2039 __assign_str(mds_addr); 2040 __assign_str(ds_ips); 2041 memcpy(__entry->deviceid, deviceid->data, 2042 NFS4_DEVICEID4_SIZE); 2043 ), 2044 TP_printk( 2045 "deviceid=%s, mds_addr=%s, ds_ips=%s", 2046 __print_hex(__entry->deviceid, NFS4_DEVICEID4_SIZE), 2047 __get_str(mds_addr), 2048 __get_str(ds_ips) 2049 ) 2050 ); 2051 2052 DECLARE_EVENT_CLASS(nfs4_flexfiles_io_event, 2053 TP_PROTO( 2054 const struct nfs_pgio_header *hdr 2055 ), 2056 2057 TP_ARGS(hdr), 2058 2059 TP_STRUCT__entry( 2060 __field(unsigned long, error) 2061 __field(dev_t, dev) 2062 __field(u32, fhandle) 2063 __field(u64, fileid) 2064 __field(loff_t, offset) 2065 __field(u32, count) 2066 __field(int, stateid_seq) 2067 __field(u32, stateid_hash) 2068 __string(dstaddr, hdr->ds_clp ? 2069 rpc_peeraddr2str(hdr->ds_clp->cl_rpcclient, 2070 RPC_DISPLAY_ADDR) : "unknown") 2071 ), 2072 2073 TP_fast_assign( 2074 const struct inode *inode = hdr->inode; 2075 2076 __entry->error = hdr->res.op_status; 2077 __entry->fhandle = nfs_fhandle_hash(hdr->args.fh); 2078 __entry->fileid = NFS_FILEID(inode); 2079 __entry->dev = inode->i_sb->s_dev; 2080 __entry->offset = hdr->args.offset; 2081 __entry->count = hdr->args.count; 2082 __entry->stateid_seq = 2083 be32_to_cpu(hdr->args.stateid.seqid); 2084 __entry->stateid_hash = 2085 nfs_stateid_hash(&hdr->args.stateid); 2086 __assign_str(dstaddr); 2087 ), 2088 2089 TP_printk( 2090 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2091 "offset=%llu count=%u stateid=%d:0x%08x dstaddr=%s", 2092 -__entry->error, 2093 show_nfs4_status(__entry->error), 2094 MAJOR(__entry->dev), MINOR(__entry->dev), 2095 (unsigned long long)__entry->fileid, 2096 __entry->fhandle, 2097 __entry->offset, __entry->count, 2098 __entry->stateid_seq, __entry->stateid_hash, 2099 __get_str(dstaddr) 2100 ) 2101 ); 2102 2103 #define DEFINE_NFS4_FLEXFILES_IO_EVENT(name) \ 2104 DEFINE_EVENT(nfs4_flexfiles_io_event, name, \ 2105 TP_PROTO( \ 2106 const struct nfs_pgio_header *hdr \ 2107 ), \ 2108 TP_ARGS(hdr)) 2109 DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_read_error); 2110 DEFINE_NFS4_FLEXFILES_IO_EVENT(ff_layout_write_error); 2111 2112 TRACE_EVENT(ff_layout_commit_error, 2113 TP_PROTO( 2114 const struct nfs_commit_data *data 2115 ), 2116 2117 TP_ARGS(data), 2118 2119 TP_STRUCT__entry( 2120 __field(unsigned long, error) 2121 __field(dev_t, dev) 2122 __field(u32, fhandle) 2123 __field(u64, fileid) 2124 __field(loff_t, offset) 2125 __field(u32, count) 2126 __string(dstaddr, data->ds_clp ? 2127 rpc_peeraddr2str(data->ds_clp->cl_rpcclient, 2128 RPC_DISPLAY_ADDR) : "unknown") 2129 ), 2130 2131 TP_fast_assign( 2132 const struct inode *inode = data->inode; 2133 2134 __entry->error = data->res.op_status; 2135 __entry->fhandle = nfs_fhandle_hash(data->args.fh); 2136 __entry->fileid = NFS_FILEID(inode); 2137 __entry->dev = inode->i_sb->s_dev; 2138 __entry->offset = data->args.offset; 2139 __entry->count = data->args.count; 2140 __assign_str(dstaddr); 2141 ), 2142 2143 TP_printk( 2144 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2145 "offset=%llu count=%u dstaddr=%s", 2146 -__entry->error, 2147 show_nfs4_status(__entry->error), 2148 MAJOR(__entry->dev), MINOR(__entry->dev), 2149 (unsigned long long)__entry->fileid, 2150 __entry->fhandle, 2151 __entry->offset, __entry->count, 2152 __get_str(dstaddr) 2153 ) 2154 ); 2155 2156 DECLARE_EVENT_CLASS(pnfs_bl_pr_key_class, 2157 TP_PROTO( 2158 const struct block_device *bdev, 2159 u64 key 2160 ), 2161 TP_ARGS(bdev, key), 2162 TP_STRUCT__entry( 2163 __field(u64, key) 2164 __field(dev_t, dev) 2165 __string(device, bdev->bd_disk->disk_name) 2166 ), 2167 TP_fast_assign( 2168 __entry->key = key; 2169 __entry->dev = bdev->bd_dev; 2170 __assign_str(device); 2171 ), 2172 TP_printk("dev=%d,%d (%s) key=0x%016llx", 2173 MAJOR(__entry->dev), MINOR(__entry->dev), 2174 __get_str(device), __entry->key 2175 ) 2176 ); 2177 2178 #define DEFINE_NFS4_BLOCK_PRKEY_EVENT(name) \ 2179 DEFINE_EVENT(pnfs_bl_pr_key_class, name, \ 2180 TP_PROTO( \ 2181 const struct block_device *bdev, \ 2182 u64 key \ 2183 ), \ 2184 TP_ARGS(bdev, key)) 2185 DEFINE_NFS4_BLOCK_PRKEY_EVENT(bl_pr_key_reg); 2186 DEFINE_NFS4_BLOCK_PRKEY_EVENT(bl_pr_key_unreg); 2187 2188 /* 2189 * From uapi/linux/pr.h 2190 */ 2191 TRACE_DEFINE_ENUM(PR_STS_SUCCESS); 2192 TRACE_DEFINE_ENUM(PR_STS_IOERR); 2193 TRACE_DEFINE_ENUM(PR_STS_RESERVATION_CONFLICT); 2194 TRACE_DEFINE_ENUM(PR_STS_RETRY_PATH_FAILURE); 2195 TRACE_DEFINE_ENUM(PR_STS_PATH_FAST_FAILED); 2196 TRACE_DEFINE_ENUM(PR_STS_PATH_FAILED); 2197 2198 #define show_pr_status(x) \ 2199 __print_symbolic(x, \ 2200 { PR_STS_SUCCESS, "SUCCESS" }, \ 2201 { PR_STS_IOERR, "IOERR" }, \ 2202 { PR_STS_RESERVATION_CONFLICT, "RESERVATION_CONFLICT" }, \ 2203 { PR_STS_RETRY_PATH_FAILURE, "RETRY_PATH_FAILURE" }, \ 2204 { PR_STS_PATH_FAST_FAILED, "PATH_FAST_FAILED" }, \ 2205 { PR_STS_PATH_FAILED, "PATH_FAILED" }) 2206 2207 DECLARE_EVENT_CLASS(pnfs_bl_pr_key_err_class, 2208 TP_PROTO( 2209 const struct block_device *bdev, 2210 u64 key, 2211 int status 2212 ), 2213 TP_ARGS(bdev, key, status), 2214 TP_STRUCT__entry( 2215 __field(u64, key) 2216 __field(dev_t, dev) 2217 __field(unsigned long, status) 2218 __string(device, bdev->bd_disk->disk_name) 2219 ), 2220 TP_fast_assign( 2221 __entry->key = key; 2222 __entry->dev = bdev->bd_dev; 2223 __entry->status = status; 2224 __assign_str(device); 2225 ), 2226 TP_printk("dev=%d,%d (%s) key=0x%016llx status=%s", 2227 MAJOR(__entry->dev), MINOR(__entry->dev), 2228 __get_str(device), __entry->key, 2229 show_pr_status(__entry->status) 2230 ) 2231 ); 2232 2233 #define DEFINE_NFS4_BLOCK_PRKEY_ERR_EVENT(name) \ 2234 DEFINE_EVENT(pnfs_bl_pr_key_err_class, name, \ 2235 TP_PROTO( \ 2236 const struct block_device *bdev, \ 2237 u64 key, \ 2238 int status \ 2239 ), \ 2240 TP_ARGS(bdev, key, status)) 2241 DEFINE_NFS4_BLOCK_PRKEY_ERR_EVENT(bl_pr_key_reg_err); 2242 DEFINE_NFS4_BLOCK_PRKEY_ERR_EVENT(bl_pr_key_unreg_err); 2243 2244 #ifdef CONFIG_NFS_V4_2 2245 TRACE_DEFINE_ENUM(NFS4_CONTENT_DATA); 2246 TRACE_DEFINE_ENUM(NFS4_CONTENT_HOLE); 2247 2248 #define show_llseek_mode(what) \ 2249 __print_symbolic(what, \ 2250 { NFS4_CONTENT_DATA, "DATA" }, \ 2251 { NFS4_CONTENT_HOLE, "HOLE" }) 2252 2253 TRACE_EVENT(nfs4_llseek, 2254 TP_PROTO( 2255 const struct inode *inode, 2256 const struct nfs42_seek_args *args, 2257 const struct nfs42_seek_res *res, 2258 int error 2259 ), 2260 2261 TP_ARGS(inode, args, res, error), 2262 2263 TP_STRUCT__entry( 2264 __field(unsigned long, error) 2265 __field(u32, fhandle) 2266 __field(u32, fileid) 2267 __field(dev_t, dev) 2268 __field(int, stateid_seq) 2269 __field(u32, stateid_hash) 2270 __field(loff_t, offset_s) 2271 __field(u32, what) 2272 __field(loff_t, offset_r) 2273 __field(u32, eof) 2274 ), 2275 2276 TP_fast_assign( 2277 const struct nfs_inode *nfsi = NFS_I(inode); 2278 const struct nfs_fh *fh = args->sa_fh; 2279 2280 __entry->fileid = nfsi->fileid; 2281 __entry->dev = inode->i_sb->s_dev; 2282 __entry->fhandle = nfs_fhandle_hash(fh); 2283 __entry->offset_s = args->sa_offset; 2284 __entry->stateid_seq = 2285 be32_to_cpu(args->sa_stateid.seqid); 2286 __entry->stateid_hash = 2287 nfs_stateid_hash(&args->sa_stateid); 2288 __entry->what = args->sa_what; 2289 if (error) { 2290 __entry->error = -error; 2291 __entry->offset_r = 0; 2292 __entry->eof = 0; 2293 } else { 2294 __entry->error = 0; 2295 __entry->offset_r = res->sr_offset; 2296 __entry->eof = res->sr_eof; 2297 } 2298 ), 2299 2300 TP_printk( 2301 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2302 "stateid=%d:0x%08x offset_s=%llu what=%s " 2303 "offset_r=%llu eof=%u", 2304 -__entry->error, 2305 show_nfs4_status(__entry->error), 2306 MAJOR(__entry->dev), MINOR(__entry->dev), 2307 (unsigned long long)__entry->fileid, 2308 __entry->fhandle, 2309 __entry->stateid_seq, __entry->stateid_hash, 2310 __entry->offset_s, 2311 show_llseek_mode(__entry->what), 2312 __entry->offset_r, 2313 __entry->eof 2314 ) 2315 ); 2316 2317 DECLARE_EVENT_CLASS(nfs4_sparse_event, 2318 TP_PROTO( 2319 const struct inode *inode, 2320 const struct nfs42_falloc_args *args, 2321 int error 2322 ), 2323 2324 TP_ARGS(inode, args, error), 2325 2326 TP_STRUCT__entry( 2327 __field(unsigned long, error) 2328 __field(loff_t, offset) 2329 __field(loff_t, len) 2330 __field(dev_t, dev) 2331 __field(u32, fhandle) 2332 __field(u64, fileid) 2333 __field(int, stateid_seq) 2334 __field(u32, stateid_hash) 2335 ), 2336 2337 TP_fast_assign( 2338 __entry->error = error < 0 ? -error : 0; 2339 __entry->offset = args->falloc_offset; 2340 __entry->len = args->falloc_length; 2341 __entry->dev = inode->i_sb->s_dev; 2342 __entry->fileid = NFS_FILEID(inode); 2343 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 2344 __entry->stateid_seq = 2345 be32_to_cpu(args->falloc_stateid.seqid); 2346 __entry->stateid_hash = 2347 nfs_stateid_hash(&args->falloc_stateid); 2348 ), 2349 2350 TP_printk( 2351 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2352 "stateid=%d:0x%08x offset=%llu len=%llu", 2353 -__entry->error, 2354 show_nfs4_status(__entry->error), 2355 MAJOR(__entry->dev), MINOR(__entry->dev), 2356 (unsigned long long)__entry->fileid, 2357 __entry->fhandle, 2358 __entry->stateid_seq, __entry->stateid_hash, 2359 (long long)__entry->offset, 2360 (long long)__entry->len 2361 ) 2362 ); 2363 #define DEFINE_NFS4_SPARSE_EVENT(name) \ 2364 DEFINE_EVENT(nfs4_sparse_event, name, \ 2365 TP_PROTO( \ 2366 const struct inode *inode, \ 2367 const struct nfs42_falloc_args *args, \ 2368 int error \ 2369 ), \ 2370 TP_ARGS(inode, args, error)) 2371 DEFINE_NFS4_SPARSE_EVENT(nfs4_fallocate); 2372 DEFINE_NFS4_SPARSE_EVENT(nfs4_deallocate); 2373 2374 TRACE_EVENT(nfs4_copy, 2375 TP_PROTO( 2376 const struct inode *src_inode, 2377 const struct inode *dst_inode, 2378 const struct nfs42_copy_args *args, 2379 const struct nfs42_copy_res *res, 2380 const struct nl4_server *nss, 2381 int error 2382 ), 2383 2384 TP_ARGS(src_inode, dst_inode, args, res, nss, error), 2385 2386 TP_STRUCT__entry( 2387 __field(unsigned long, error) 2388 __field(u32, src_fhandle) 2389 __field(u32, src_fileid) 2390 __field(u32, dst_fhandle) 2391 __field(u32, dst_fileid) 2392 __field(dev_t, src_dev) 2393 __field(dev_t, dst_dev) 2394 __field(int, src_stateid_seq) 2395 __field(u32, src_stateid_hash) 2396 __field(int, dst_stateid_seq) 2397 __field(u32, dst_stateid_hash) 2398 __field(loff_t, src_offset) 2399 __field(loff_t, dst_offset) 2400 __field(bool, sync) 2401 __field(loff_t, len) 2402 __field(int, res_stateid_seq) 2403 __field(u32, res_stateid_hash) 2404 __field(loff_t, res_count) 2405 __field(bool, res_sync) 2406 __field(bool, res_cons) 2407 __field(bool, intra) 2408 ), 2409 2410 TP_fast_assign( 2411 const struct nfs_inode *src_nfsi = NFS_I(src_inode); 2412 const struct nfs_inode *dst_nfsi = NFS_I(dst_inode); 2413 2414 __entry->src_fileid = src_nfsi->fileid; 2415 __entry->src_dev = src_inode->i_sb->s_dev; 2416 __entry->src_fhandle = nfs_fhandle_hash(args->src_fh); 2417 __entry->src_offset = args->src_pos; 2418 __entry->dst_fileid = dst_nfsi->fileid; 2419 __entry->dst_dev = dst_inode->i_sb->s_dev; 2420 __entry->dst_fhandle = nfs_fhandle_hash(args->dst_fh); 2421 __entry->dst_offset = args->dst_pos; 2422 __entry->len = args->count; 2423 __entry->sync = args->sync; 2424 __entry->src_stateid_seq = 2425 be32_to_cpu(args->src_stateid.seqid); 2426 __entry->src_stateid_hash = 2427 nfs_stateid_hash(&args->src_stateid); 2428 __entry->dst_stateid_seq = 2429 be32_to_cpu(args->dst_stateid.seqid); 2430 __entry->dst_stateid_hash = 2431 nfs_stateid_hash(&args->dst_stateid); 2432 __entry->intra = nss ? 0 : 1; 2433 if (error) { 2434 __entry->error = -error; 2435 __entry->res_stateid_seq = 0; 2436 __entry->res_stateid_hash = 0; 2437 __entry->res_count = 0; 2438 __entry->res_sync = 0; 2439 __entry->res_cons = 0; 2440 } else { 2441 __entry->error = 0; 2442 __entry->res_stateid_seq = 2443 be32_to_cpu(res->write_res.stateid.seqid); 2444 __entry->res_stateid_hash = 2445 nfs_stateid_hash(&res->write_res.stateid); 2446 __entry->res_count = res->write_res.count; 2447 __entry->res_sync = res->synchronous; 2448 __entry->res_cons = res->consecutive; 2449 } 2450 ), 2451 2452 TP_printk( 2453 "error=%ld (%s) intra=%d src_fileid=%02x:%02x:%llu " 2454 "src_fhandle=0x%08x dst_fileid=%02x:%02x:%llu " 2455 "dst_fhandle=0x%08x src_stateid=%d:0x%08x " 2456 "dst_stateid=%d:0x%08x src_offset=%llu dst_offset=%llu " 2457 "len=%llu sync=%d cb_stateid=%d:0x%08x res_sync=%d " 2458 "res_cons=%d res_count=%llu", 2459 -__entry->error, 2460 show_nfs4_status(__entry->error), 2461 __entry->intra, 2462 MAJOR(__entry->src_dev), MINOR(__entry->src_dev), 2463 (unsigned long long)__entry->src_fileid, 2464 __entry->src_fhandle, 2465 MAJOR(__entry->dst_dev), MINOR(__entry->dst_dev), 2466 (unsigned long long)__entry->dst_fileid, 2467 __entry->dst_fhandle, 2468 __entry->src_stateid_seq, __entry->src_stateid_hash, 2469 __entry->dst_stateid_seq, __entry->dst_stateid_hash, 2470 __entry->src_offset, 2471 __entry->dst_offset, 2472 __entry->len, 2473 __entry->sync, 2474 __entry->res_stateid_seq, __entry->res_stateid_hash, 2475 __entry->res_sync, 2476 __entry->res_cons, 2477 __entry->res_count 2478 ) 2479 ); 2480 2481 TRACE_EVENT(nfs4_clone, 2482 TP_PROTO( 2483 const struct inode *src_inode, 2484 const struct inode *dst_inode, 2485 const struct nfs42_clone_args *args, 2486 int error 2487 ), 2488 2489 TP_ARGS(src_inode, dst_inode, args, error), 2490 2491 TP_STRUCT__entry( 2492 __field(unsigned long, error) 2493 __field(u32, src_fhandle) 2494 __field(u32, src_fileid) 2495 __field(u32, dst_fhandle) 2496 __field(u32, dst_fileid) 2497 __field(dev_t, src_dev) 2498 __field(dev_t, dst_dev) 2499 __field(loff_t, src_offset) 2500 __field(loff_t, dst_offset) 2501 __field(int, src_stateid_seq) 2502 __field(u32, src_stateid_hash) 2503 __field(int, dst_stateid_seq) 2504 __field(u32, dst_stateid_hash) 2505 __field(loff_t, len) 2506 ), 2507 2508 TP_fast_assign( 2509 const struct nfs_inode *src_nfsi = NFS_I(src_inode); 2510 const struct nfs_inode *dst_nfsi = NFS_I(dst_inode); 2511 2512 __entry->src_fileid = src_nfsi->fileid; 2513 __entry->src_dev = src_inode->i_sb->s_dev; 2514 __entry->src_fhandle = nfs_fhandle_hash(args->src_fh); 2515 __entry->src_offset = args->src_offset; 2516 __entry->dst_fileid = dst_nfsi->fileid; 2517 __entry->dst_dev = dst_inode->i_sb->s_dev; 2518 __entry->dst_fhandle = nfs_fhandle_hash(args->dst_fh); 2519 __entry->dst_offset = args->dst_offset; 2520 __entry->len = args->count; 2521 __entry->error = error < 0 ? -error : 0; 2522 __entry->src_stateid_seq = 2523 be32_to_cpu(args->src_stateid.seqid); 2524 __entry->src_stateid_hash = 2525 nfs_stateid_hash(&args->src_stateid); 2526 __entry->dst_stateid_seq = 2527 be32_to_cpu(args->dst_stateid.seqid); 2528 __entry->dst_stateid_hash = 2529 nfs_stateid_hash(&args->dst_stateid); 2530 ), 2531 2532 TP_printk( 2533 "error=%ld (%s) src_fileid=%02x:%02x:%llu " 2534 "src_fhandle=0x%08x dst_fileid=%02x:%02x:%llu " 2535 "dst_fhandle=0x%08x src_stateid=%d:0x%08x " 2536 "dst_stateid=%d:0x%08x src_offset=%llu " 2537 "dst_offset=%llu len=%llu", 2538 -__entry->error, 2539 show_nfs4_status(__entry->error), 2540 MAJOR(__entry->src_dev), MINOR(__entry->src_dev), 2541 (unsigned long long)__entry->src_fileid, 2542 __entry->src_fhandle, 2543 MAJOR(__entry->dst_dev), MINOR(__entry->dst_dev), 2544 (unsigned long long)__entry->dst_fileid, 2545 __entry->dst_fhandle, 2546 __entry->src_stateid_seq, __entry->src_stateid_hash, 2547 __entry->dst_stateid_seq, __entry->dst_stateid_hash, 2548 __entry->src_offset, 2549 __entry->dst_offset, 2550 __entry->len 2551 ) 2552 ); 2553 2554 TRACE_EVENT(nfs4_copy_notify, 2555 TP_PROTO( 2556 const struct inode *inode, 2557 const struct nfs42_copy_notify_args *args, 2558 const struct nfs42_copy_notify_res *res, 2559 int error 2560 ), 2561 2562 TP_ARGS(inode, args, res, error), 2563 2564 TP_STRUCT__entry( 2565 __field(unsigned long, error) 2566 __field(u32, fhandle) 2567 __field(u32, fileid) 2568 __field(dev_t, dev) 2569 __field(int, stateid_seq) 2570 __field(u32, stateid_hash) 2571 __field(int, res_stateid_seq) 2572 __field(u32, res_stateid_hash) 2573 ), 2574 2575 TP_fast_assign( 2576 const struct nfs_inode *nfsi = NFS_I(inode); 2577 2578 __entry->fileid = nfsi->fileid; 2579 __entry->dev = inode->i_sb->s_dev; 2580 __entry->fhandle = nfs_fhandle_hash(args->cna_src_fh); 2581 __entry->stateid_seq = 2582 be32_to_cpu(args->cna_src_stateid.seqid); 2583 __entry->stateid_hash = 2584 nfs_stateid_hash(&args->cna_src_stateid); 2585 if (error) { 2586 __entry->error = -error; 2587 __entry->res_stateid_seq = 0; 2588 __entry->res_stateid_hash = 0; 2589 } else { 2590 __entry->error = 0; 2591 __entry->res_stateid_seq = 2592 be32_to_cpu(res->cnr_stateid.seqid); 2593 __entry->res_stateid_hash = 2594 nfs_stateid_hash(&res->cnr_stateid); 2595 } 2596 ), 2597 2598 TP_printk( 2599 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2600 "stateid=%d:0x%08x res_stateid=%d:0x%08x", 2601 -__entry->error, 2602 show_nfs4_status(__entry->error), 2603 MAJOR(__entry->dev), MINOR(__entry->dev), 2604 (unsigned long long)__entry->fileid, 2605 __entry->fhandle, 2606 __entry->stateid_seq, __entry->stateid_hash, 2607 __entry->res_stateid_seq, __entry->res_stateid_hash 2608 ) 2609 ); 2610 2611 TRACE_EVENT(nfs4_offload_cancel, 2612 TP_PROTO( 2613 const struct nfs42_offload_status_args *args, 2614 int error 2615 ), 2616 2617 TP_ARGS(args, error), 2618 2619 TP_STRUCT__entry( 2620 __field(unsigned long, error) 2621 __field(u32, fhandle) 2622 __field(int, stateid_seq) 2623 __field(u32, stateid_hash) 2624 ), 2625 2626 TP_fast_assign( 2627 __entry->fhandle = nfs_fhandle_hash(args->osa_src_fh); 2628 __entry->error = error < 0 ? -error : 0; 2629 __entry->stateid_seq = 2630 be32_to_cpu(args->osa_stateid.seqid); 2631 __entry->stateid_hash = 2632 nfs_stateid_hash(&args->osa_stateid); 2633 ), 2634 2635 TP_printk( 2636 "error=%ld (%s) fhandle=0x%08x stateid=%d:0x%08x", 2637 -__entry->error, 2638 show_nfs4_status(__entry->error), 2639 __entry->fhandle, 2640 __entry->stateid_seq, __entry->stateid_hash 2641 ) 2642 ); 2643 2644 DECLARE_EVENT_CLASS(nfs4_xattr_event, 2645 TP_PROTO( 2646 const struct inode *inode, 2647 const char *name, 2648 int error 2649 ), 2650 2651 TP_ARGS(inode, name, error), 2652 2653 TP_STRUCT__entry( 2654 __field(unsigned long, error) 2655 __field(dev_t, dev) 2656 __field(u32, fhandle) 2657 __field(u64, fileid) 2658 __string(name, name) 2659 ), 2660 2661 TP_fast_assign( 2662 __entry->error = error < 0 ? -error : 0; 2663 __entry->dev = inode->i_sb->s_dev; 2664 __entry->fileid = NFS_FILEID(inode); 2665 __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); 2666 __assign_str(name); 2667 ), 2668 2669 TP_printk( 2670 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 2671 "name=%s", 2672 -__entry->error, show_nfs4_status(__entry->error), 2673 MAJOR(__entry->dev), MINOR(__entry->dev), 2674 (unsigned long long)__entry->fileid, 2675 __entry->fhandle, __get_str(name) 2676 ) 2677 ); 2678 #define DEFINE_NFS4_XATTR_EVENT(name) \ 2679 DEFINE_EVENT(nfs4_xattr_event, name, \ 2680 TP_PROTO( \ 2681 const struct inode *inode, \ 2682 const char *name, \ 2683 int error \ 2684 ), \ 2685 TP_ARGS(inode, name, error)) 2686 DEFINE_NFS4_XATTR_EVENT(nfs4_getxattr); 2687 DEFINE_NFS4_XATTR_EVENT(nfs4_setxattr); 2688 DEFINE_NFS4_XATTR_EVENT(nfs4_removexattr); 2689 2690 DEFINE_NFS4_INODE_EVENT(nfs4_listxattr); 2691 #endif /* CONFIG_NFS_V4_2 */ 2692 2693 #endif /* CONFIG_NFS_V4_1 */ 2694 2695 #endif /* _TRACE_NFS4_H */ 2696 2697 #undef TRACE_INCLUDE_PATH 2698 #define TRACE_INCLUDE_PATH . 2699 #define TRACE_INCLUDE_FILE nfs4trace 2700 /* This part must be outside protection */ 2701 #include <trace/define_trace.h> 2702