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 nfs 7 8 #if !defined(_TRACE_NFS_H) || defined(TRACE_HEADER_MULTI_READ) 9 #define _TRACE_NFS_H 10 11 #include <linux/tracepoint.h> 12 #include <linux/iversion.h> 13 14 #include <trace/misc/fs.h> 15 #include <trace/misc/nfs.h> 16 #include <trace/misc/sunrpc.h> 17 18 #define nfs_show_cache_validity(v) \ 19 __print_flags(v, "|", \ 20 { NFS_INO_INVALID_DATA, "INVALID_DATA" }, \ 21 { NFS_INO_INVALID_ATIME, "INVALID_ATIME" }, \ 22 { NFS_INO_INVALID_ACCESS, "INVALID_ACCESS" }, \ 23 { NFS_INO_INVALID_ACL, "INVALID_ACL" }, \ 24 { NFS_INO_REVAL_FORCED, "REVAL_FORCED" }, \ 25 { NFS_INO_INVALID_LABEL, "INVALID_LABEL" }, \ 26 { NFS_INO_INVALID_CHANGE, "INVALID_CHANGE" }, \ 27 { NFS_INO_INVALID_CTIME, "INVALID_CTIME" }, \ 28 { NFS_INO_INVALID_MTIME, "INVALID_MTIME" }, \ 29 { NFS_INO_INVALID_SIZE, "INVALID_SIZE" }, \ 30 { NFS_INO_INVALID_OTHER, "INVALID_OTHER" }, \ 31 { NFS_INO_DATA_INVAL_DEFER, "DATA_INVAL_DEFER" }, \ 32 { NFS_INO_INVALID_BLOCKS, "INVALID_BLOCKS" }, \ 33 { NFS_INO_INVALID_XATTR, "INVALID_XATTR" }, \ 34 { NFS_INO_INVALID_NLINK, "INVALID_NLINK" }, \ 35 { NFS_INO_INVALID_MODE, "INVALID_MODE" }) 36 37 #define nfs_show_nfsi_flags(v) \ 38 __print_flags(v, "|", \ 39 { BIT(NFS_INO_STALE), "STALE" }, \ 40 { BIT(NFS_INO_ACL_LRU_SET), "ACL_LRU_SET" }, \ 41 { BIT(NFS_INO_INVALIDATING), "INVALIDATING" }, \ 42 { BIT(NFS_INO_LAYOUTCOMMIT), "NEED_LAYOUTCOMMIT" }, \ 43 { BIT(NFS_INO_LAYOUTCOMMITTING), "LAYOUTCOMMIT" }, \ 44 { BIT(NFS_INO_LAYOUTSTATS), "LAYOUTSTATS" }, \ 45 { BIT(NFS_INO_ODIRECT), "ODIRECT" }) 46 47 DECLARE_EVENT_CLASS(nfs_inode_event, 48 TP_PROTO( 49 const struct inode *inode 50 ), 51 52 TP_ARGS(inode), 53 54 TP_STRUCT__entry( 55 __field(dev_t, dev) 56 __field(u32, fhandle) 57 __field(u64, fileid) 58 __field(u64, version) 59 ), 60 61 TP_fast_assign( 62 const struct nfs_inode *nfsi = NFS_I(inode); 63 __entry->dev = inode->i_sb->s_dev; 64 __entry->fileid = nfsi->fileid; 65 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 66 __entry->version = inode_peek_iversion_raw(inode); 67 ), 68 69 TP_printk( 70 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu ", 71 MAJOR(__entry->dev), MINOR(__entry->dev), 72 (unsigned long long)__entry->fileid, 73 __entry->fhandle, 74 (unsigned long long)__entry->version 75 ) 76 ); 77 78 DECLARE_EVENT_CLASS(nfs_inode_event_done, 79 TP_PROTO( 80 const struct inode *inode, 81 int error 82 ), 83 84 TP_ARGS(inode, error), 85 86 TP_STRUCT__entry( 87 __field(unsigned long, error) 88 __field(dev_t, dev) 89 __field(u32, fhandle) 90 __field(unsigned char, type) 91 __field(u64, fileid) 92 __field(u64, version) 93 __field(loff_t, size) 94 __field(unsigned long, nfsi_flags) 95 __field(unsigned long, cache_validity) 96 ), 97 98 TP_fast_assign( 99 const struct nfs_inode *nfsi = NFS_I(inode); 100 __entry->error = error < 0 ? -error : 0; 101 __entry->dev = inode->i_sb->s_dev; 102 __entry->fileid = nfsi->fileid; 103 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 104 __entry->type = nfs_umode_to_dtype(inode->i_mode); 105 __entry->version = inode_peek_iversion_raw(inode); 106 __entry->size = i_size_read(inode); 107 __entry->nfsi_flags = nfsi->flags; 108 __entry->cache_validity = nfsi->cache_validity; 109 ), 110 111 TP_printk( 112 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 113 "type=%u (%s) version=%llu size=%lld " 114 "cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s)", 115 -__entry->error, show_nfs_status(__entry->error), 116 MAJOR(__entry->dev), MINOR(__entry->dev), 117 (unsigned long long)__entry->fileid, 118 __entry->fhandle, 119 __entry->type, 120 show_fs_dirent_type(__entry->type), 121 (unsigned long long)__entry->version, 122 (long long)__entry->size, 123 __entry->cache_validity, 124 nfs_show_cache_validity(__entry->cache_validity), 125 __entry->nfsi_flags, 126 nfs_show_nfsi_flags(__entry->nfsi_flags) 127 ) 128 ); 129 130 #define DEFINE_NFS_INODE_EVENT(name) \ 131 DEFINE_EVENT(nfs_inode_event, name, \ 132 TP_PROTO( \ 133 const struct inode *inode \ 134 ), \ 135 TP_ARGS(inode)) 136 #define DEFINE_NFS_INODE_EVENT_DONE(name) \ 137 DEFINE_EVENT(nfs_inode_event_done, name, \ 138 TP_PROTO( \ 139 const struct inode *inode, \ 140 int error \ 141 ), \ 142 TP_ARGS(inode, error)) 143 DEFINE_NFS_INODE_EVENT(nfs_set_inode_stale); 144 DEFINE_NFS_INODE_EVENT(nfs_refresh_inode_enter); 145 DEFINE_NFS_INODE_EVENT_DONE(nfs_refresh_inode_exit); 146 DEFINE_NFS_INODE_EVENT(nfs_revalidate_inode_enter); 147 DEFINE_NFS_INODE_EVENT_DONE(nfs_revalidate_inode_exit); 148 DEFINE_NFS_INODE_EVENT(nfs_invalidate_mapping_enter); 149 DEFINE_NFS_INODE_EVENT_DONE(nfs_invalidate_mapping_exit); 150 DEFINE_NFS_INODE_EVENT(nfs_getattr_enter); 151 DEFINE_NFS_INODE_EVENT_DONE(nfs_getattr_exit); 152 DEFINE_NFS_INODE_EVENT(nfs_setattr_enter); 153 DEFINE_NFS_INODE_EVENT_DONE(nfs_setattr_exit); 154 DEFINE_NFS_INODE_EVENT(nfs_writeback_inode_enter); 155 DEFINE_NFS_INODE_EVENT_DONE(nfs_writeback_inode_exit); 156 DEFINE_NFS_INODE_EVENT(nfs_fsync_enter); 157 DEFINE_NFS_INODE_EVENT_DONE(nfs_fsync_exit); 158 DEFINE_NFS_INODE_EVENT(nfs_access_enter); 159 DEFINE_NFS_INODE_EVENT_DONE(nfs_set_cache_invalid); 160 DEFINE_NFS_INODE_EVENT(nfs_readdir_force_readdirplus); 161 DEFINE_NFS_INODE_EVENT_DONE(nfs_readdir_cache_fill_done); 162 DEFINE_NFS_INODE_EVENT_DONE(nfs_readdir_uncached_done); 163 164 TRACE_EVENT(nfs_access_exit, 165 TP_PROTO( 166 const struct inode *inode, 167 unsigned int mask, 168 unsigned int permitted, 169 int error 170 ), 171 172 TP_ARGS(inode, mask, permitted, error), 173 174 TP_STRUCT__entry( 175 __field(unsigned long, error) 176 __field(dev_t, dev) 177 __field(u32, fhandle) 178 __field(unsigned char, type) 179 __field(u64, fileid) 180 __field(u64, version) 181 __field(loff_t, size) 182 __field(unsigned long, nfsi_flags) 183 __field(unsigned long, cache_validity) 184 __field(unsigned int, mask) 185 __field(unsigned int, permitted) 186 ), 187 188 TP_fast_assign( 189 const struct nfs_inode *nfsi = NFS_I(inode); 190 __entry->error = error < 0 ? -error : 0; 191 __entry->dev = inode->i_sb->s_dev; 192 __entry->fileid = nfsi->fileid; 193 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 194 __entry->type = nfs_umode_to_dtype(inode->i_mode); 195 __entry->version = inode_peek_iversion_raw(inode); 196 __entry->size = i_size_read(inode); 197 __entry->nfsi_flags = nfsi->flags; 198 __entry->cache_validity = nfsi->cache_validity; 199 __entry->mask = mask; 200 __entry->permitted = permitted; 201 ), 202 203 TP_printk( 204 "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " 205 "type=%u (%s) version=%llu size=%lld " 206 "cache_validity=0x%lx (%s) nfs_flags=0x%lx (%s) " 207 "mask=0x%x permitted=0x%x", 208 -__entry->error, show_nfs_status(__entry->error), 209 MAJOR(__entry->dev), MINOR(__entry->dev), 210 (unsigned long long)__entry->fileid, 211 __entry->fhandle, 212 __entry->type, 213 show_fs_dirent_type(__entry->type), 214 (unsigned long long)__entry->version, 215 (long long)__entry->size, 216 __entry->cache_validity, 217 nfs_show_cache_validity(__entry->cache_validity), 218 __entry->nfsi_flags, 219 nfs_show_nfsi_flags(__entry->nfsi_flags), 220 __entry->mask, __entry->permitted 221 ) 222 ); 223 224 DECLARE_EVENT_CLASS(nfs_update_size_class, 225 TP_PROTO( 226 const struct inode *inode, 227 loff_t new_size 228 ), 229 230 TP_ARGS(inode, new_size), 231 232 TP_STRUCT__entry( 233 __field(dev_t, dev) 234 __field(u32, fhandle) 235 __field(u64, fileid) 236 __field(u64, version) 237 __field(loff_t, cur_size) 238 __field(loff_t, new_size) 239 ), 240 241 TP_fast_assign( 242 const struct nfs_inode *nfsi = NFS_I(inode); 243 244 __entry->dev = inode->i_sb->s_dev; 245 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 246 __entry->fileid = nfsi->fileid; 247 __entry->version = inode_peek_iversion_raw(inode); 248 __entry->cur_size = i_size_read(inode); 249 __entry->new_size = new_size; 250 ), 251 252 TP_printk( 253 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu cursize=%lld newsize=%lld", 254 MAJOR(__entry->dev), MINOR(__entry->dev), 255 (unsigned long long)__entry->fileid, 256 __entry->fhandle, __entry->version, 257 __entry->cur_size, __entry->new_size 258 ) 259 ); 260 261 #define DEFINE_NFS_UPDATE_SIZE_EVENT(name) \ 262 DEFINE_EVENT(nfs_update_size_class, nfs_size_##name, \ 263 TP_PROTO( \ 264 const struct inode *inode, \ 265 loff_t new_size \ 266 ), \ 267 TP_ARGS(inode, new_size)) 268 269 DEFINE_NFS_UPDATE_SIZE_EVENT(truncate); 270 DEFINE_NFS_UPDATE_SIZE_EVENT(wcc); 271 DEFINE_NFS_UPDATE_SIZE_EVENT(update); 272 DEFINE_NFS_UPDATE_SIZE_EVENT(grow); 273 274 DECLARE_EVENT_CLASS(nfs_inode_range_event, 275 TP_PROTO( 276 const struct inode *inode, 277 loff_t range_start, 278 loff_t range_end 279 ), 280 281 TP_ARGS(inode, range_start, range_end), 282 283 TP_STRUCT__entry( 284 __field(dev_t, dev) 285 __field(u32, fhandle) 286 __field(u64, fileid) 287 __field(u64, version) 288 __field(loff_t, range_start) 289 __field(loff_t, range_end) 290 ), 291 292 TP_fast_assign( 293 const struct nfs_inode *nfsi = NFS_I(inode); 294 295 __entry->dev = inode->i_sb->s_dev; 296 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 297 __entry->fileid = nfsi->fileid; 298 __entry->version = inode_peek_iversion_raw(inode); 299 __entry->range_start = range_start; 300 __entry->range_end = range_end; 301 ), 302 303 TP_printk( 304 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu " 305 "range=[%lld, %lld]", 306 MAJOR(__entry->dev), MINOR(__entry->dev), 307 (unsigned long long)__entry->fileid, 308 __entry->fhandle, __entry->version, 309 __entry->range_start, __entry->range_end 310 ) 311 ); 312 313 #define DEFINE_NFS_INODE_RANGE_EVENT(name) \ 314 DEFINE_EVENT(nfs_inode_range_event, name, \ 315 TP_PROTO( \ 316 const struct inode *inode, \ 317 loff_t range_start, \ 318 loff_t range_end \ 319 ), \ 320 TP_ARGS(inode, range_start, range_end)) 321 322 DEFINE_NFS_INODE_RANGE_EVENT(nfs_readdir_invalidate_cache_range); 323 324 DECLARE_EVENT_CLASS(nfs_readdir_event, 325 TP_PROTO( 326 const struct file *file, 327 const __be32 *verifier, 328 u64 cookie, 329 pgoff_t page_index, 330 unsigned int dtsize 331 ), 332 333 TP_ARGS(file, verifier, cookie, page_index, dtsize), 334 335 TP_STRUCT__entry( 336 __field(dev_t, dev) 337 __field(u32, fhandle) 338 __field(u64, fileid) 339 __field(u64, version) 340 __array(char, verifier, NFS4_VERIFIER_SIZE) 341 __field(u64, cookie) 342 __field(pgoff_t, index) 343 __field(unsigned int, dtsize) 344 ), 345 346 TP_fast_assign( 347 const struct inode *dir = file_inode(file); 348 const struct nfs_inode *nfsi = NFS_I(dir); 349 350 __entry->dev = dir->i_sb->s_dev; 351 __entry->fileid = nfsi->fileid; 352 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 353 __entry->version = inode_peek_iversion_raw(dir); 354 if (cookie != 0) 355 memcpy(__entry->verifier, verifier, 356 NFS4_VERIFIER_SIZE); 357 else 358 memset(__entry->verifier, 0, 359 NFS4_VERIFIER_SIZE); 360 __entry->cookie = cookie; 361 __entry->index = page_index; 362 __entry->dtsize = dtsize; 363 ), 364 365 TP_printk( 366 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu " 367 "cookie=%s:0x%llx cache_index=%lu dtsize=%u", 368 MAJOR(__entry->dev), MINOR(__entry->dev), 369 (unsigned long long)__entry->fileid, __entry->fhandle, 370 __entry->version, show_nfs4_verifier(__entry->verifier), 371 (unsigned long long)__entry->cookie, __entry->index, 372 __entry->dtsize 373 ) 374 ); 375 376 #define DEFINE_NFS_READDIR_EVENT(name) \ 377 DEFINE_EVENT(nfs_readdir_event, name, \ 378 TP_PROTO( \ 379 const struct file *file, \ 380 const __be32 *verifier, \ 381 u64 cookie, \ 382 pgoff_t page_index, \ 383 unsigned int dtsize \ 384 ), \ 385 TP_ARGS(file, verifier, cookie, page_index, dtsize)) 386 387 DEFINE_NFS_READDIR_EVENT(nfs_readdir_cache_fill); 388 DEFINE_NFS_READDIR_EVENT(nfs_readdir_uncached); 389 390 DECLARE_EVENT_CLASS(nfs_lookup_event, 391 TP_PROTO( 392 const struct inode *dir, 393 const struct dentry *dentry, 394 unsigned int flags 395 ), 396 397 TP_ARGS(dir, dentry, flags), 398 399 TP_STRUCT__entry( 400 __field(unsigned long, flags) 401 __field(dev_t, dev) 402 __field(u64, dir) 403 __field(u64, fileid) 404 __string(name, dentry->d_name.name) 405 ), 406 407 TP_fast_assign( 408 __entry->dev = dir->i_sb->s_dev; 409 __entry->dir = NFS_FILEID(dir); 410 __entry->flags = flags; 411 __entry->fileid = d_is_negative(dentry) ? 0 : NFS_FILEID(d_inode(dentry)); 412 __assign_str(name, dentry->d_name.name); 413 ), 414 415 TP_printk( 416 "flags=0x%lx (%s) name=%02x:%02x:%llu/%s fileid=%llu", 417 __entry->flags, 418 show_fs_lookup_flags(__entry->flags), 419 MAJOR(__entry->dev), MINOR(__entry->dev), 420 (unsigned long long)__entry->dir, 421 __get_str(name), 422 __entry->fileid 423 ) 424 ); 425 426 #define DEFINE_NFS_LOOKUP_EVENT(name) \ 427 DEFINE_EVENT(nfs_lookup_event, name, \ 428 TP_PROTO( \ 429 const struct inode *dir, \ 430 const struct dentry *dentry, \ 431 unsigned int flags \ 432 ), \ 433 TP_ARGS(dir, dentry, flags)) 434 435 DECLARE_EVENT_CLASS(nfs_lookup_event_done, 436 TP_PROTO( 437 const struct inode *dir, 438 const struct dentry *dentry, 439 unsigned int flags, 440 int error 441 ), 442 443 TP_ARGS(dir, dentry, flags, error), 444 445 TP_STRUCT__entry( 446 __field(unsigned long, error) 447 __field(unsigned long, flags) 448 __field(dev_t, dev) 449 __field(u64, dir) 450 __field(u64, fileid) 451 __string(name, dentry->d_name.name) 452 ), 453 454 TP_fast_assign( 455 __entry->dev = dir->i_sb->s_dev; 456 __entry->dir = NFS_FILEID(dir); 457 __entry->error = error < 0 ? -error : 0; 458 __entry->flags = flags; 459 __entry->fileid = d_is_negative(dentry) ? 0 : NFS_FILEID(d_inode(dentry)); 460 __assign_str(name, dentry->d_name.name); 461 ), 462 463 TP_printk( 464 "error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s fileid=%llu", 465 -__entry->error, show_nfs_status(__entry->error), 466 __entry->flags, 467 show_fs_lookup_flags(__entry->flags), 468 MAJOR(__entry->dev), MINOR(__entry->dev), 469 (unsigned long long)__entry->dir, 470 __get_str(name), 471 __entry->fileid 472 ) 473 ); 474 475 #define DEFINE_NFS_LOOKUP_EVENT_DONE(name) \ 476 DEFINE_EVENT(nfs_lookup_event_done, name, \ 477 TP_PROTO( \ 478 const struct inode *dir, \ 479 const struct dentry *dentry, \ 480 unsigned int flags, \ 481 int error \ 482 ), \ 483 TP_ARGS(dir, dentry, flags, error)) 484 485 DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_enter); 486 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_exit); 487 DEFINE_NFS_LOOKUP_EVENT(nfs_lookup_revalidate_enter); 488 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_lookup_revalidate_exit); 489 DEFINE_NFS_LOOKUP_EVENT(nfs_readdir_lookup); 490 DEFINE_NFS_LOOKUP_EVENT(nfs_readdir_lookup_revalidate_failed); 491 DEFINE_NFS_LOOKUP_EVENT_DONE(nfs_readdir_lookup_revalidate); 492 493 TRACE_EVENT(nfs_atomic_open_enter, 494 TP_PROTO( 495 const struct inode *dir, 496 const struct nfs_open_context *ctx, 497 unsigned int flags 498 ), 499 500 TP_ARGS(dir, ctx, flags), 501 502 TP_STRUCT__entry( 503 __field(unsigned long, flags) 504 __field(unsigned long, fmode) 505 __field(dev_t, dev) 506 __field(u64, dir) 507 __string(name, ctx->dentry->d_name.name) 508 ), 509 510 TP_fast_assign( 511 __entry->dev = dir->i_sb->s_dev; 512 __entry->dir = NFS_FILEID(dir); 513 __entry->flags = flags; 514 __entry->fmode = (__force unsigned long)ctx->mode; 515 __assign_str(name, ctx->dentry->d_name.name); 516 ), 517 518 TP_printk( 519 "flags=0x%lx (%s) fmode=%s name=%02x:%02x:%llu/%s", 520 __entry->flags, 521 show_fs_fcntl_open_flags(__entry->flags), 522 show_fs_fmode_flags(__entry->fmode), 523 MAJOR(__entry->dev), MINOR(__entry->dev), 524 (unsigned long long)__entry->dir, 525 __get_str(name) 526 ) 527 ); 528 529 TRACE_EVENT(nfs_atomic_open_exit, 530 TP_PROTO( 531 const struct inode *dir, 532 const struct nfs_open_context *ctx, 533 unsigned int flags, 534 int error 535 ), 536 537 TP_ARGS(dir, ctx, flags, error), 538 539 TP_STRUCT__entry( 540 __field(unsigned long, error) 541 __field(unsigned long, flags) 542 __field(unsigned long, fmode) 543 __field(dev_t, dev) 544 __field(u64, dir) 545 __string(name, ctx->dentry->d_name.name) 546 ), 547 548 TP_fast_assign( 549 __entry->error = -error; 550 __entry->dev = dir->i_sb->s_dev; 551 __entry->dir = NFS_FILEID(dir); 552 __entry->flags = flags; 553 __entry->fmode = (__force unsigned long)ctx->mode; 554 __assign_str(name, ctx->dentry->d_name.name); 555 ), 556 557 TP_printk( 558 "error=%ld (%s) flags=0x%lx (%s) fmode=%s " 559 "name=%02x:%02x:%llu/%s", 560 -__entry->error, show_nfs_status(__entry->error), 561 __entry->flags, 562 show_fs_fcntl_open_flags(__entry->flags), 563 show_fs_fmode_flags(__entry->fmode), 564 MAJOR(__entry->dev), MINOR(__entry->dev), 565 (unsigned long long)__entry->dir, 566 __get_str(name) 567 ) 568 ); 569 570 TRACE_EVENT(nfs_create_enter, 571 TP_PROTO( 572 const struct inode *dir, 573 const struct dentry *dentry, 574 unsigned int flags 575 ), 576 577 TP_ARGS(dir, dentry, flags), 578 579 TP_STRUCT__entry( 580 __field(unsigned long, flags) 581 __field(dev_t, dev) 582 __field(u64, dir) 583 __string(name, dentry->d_name.name) 584 ), 585 586 TP_fast_assign( 587 __entry->dev = dir->i_sb->s_dev; 588 __entry->dir = NFS_FILEID(dir); 589 __entry->flags = flags; 590 __assign_str(name, dentry->d_name.name); 591 ), 592 593 TP_printk( 594 "flags=0x%lx (%s) name=%02x:%02x:%llu/%s", 595 __entry->flags, 596 show_fs_fcntl_open_flags(__entry->flags), 597 MAJOR(__entry->dev), MINOR(__entry->dev), 598 (unsigned long long)__entry->dir, 599 __get_str(name) 600 ) 601 ); 602 603 TRACE_EVENT(nfs_create_exit, 604 TP_PROTO( 605 const struct inode *dir, 606 const struct dentry *dentry, 607 unsigned int flags, 608 int error 609 ), 610 611 TP_ARGS(dir, dentry, flags, error), 612 613 TP_STRUCT__entry( 614 __field(unsigned long, error) 615 __field(unsigned long, flags) 616 __field(dev_t, dev) 617 __field(u64, dir) 618 __string(name, dentry->d_name.name) 619 ), 620 621 TP_fast_assign( 622 __entry->error = -error; 623 __entry->dev = dir->i_sb->s_dev; 624 __entry->dir = NFS_FILEID(dir); 625 __entry->flags = flags; 626 __assign_str(name, dentry->d_name.name); 627 ), 628 629 TP_printk( 630 "error=%ld (%s) flags=0x%lx (%s) name=%02x:%02x:%llu/%s", 631 -__entry->error, show_nfs_status(__entry->error), 632 __entry->flags, 633 show_fs_fcntl_open_flags(__entry->flags), 634 MAJOR(__entry->dev), MINOR(__entry->dev), 635 (unsigned long long)__entry->dir, 636 __get_str(name) 637 ) 638 ); 639 640 DECLARE_EVENT_CLASS(nfs_directory_event, 641 TP_PROTO( 642 const struct inode *dir, 643 const struct dentry *dentry 644 ), 645 646 TP_ARGS(dir, dentry), 647 648 TP_STRUCT__entry( 649 __field(dev_t, dev) 650 __field(u64, dir) 651 __string(name, dentry->d_name.name) 652 ), 653 654 TP_fast_assign( 655 __entry->dev = dir->i_sb->s_dev; 656 __entry->dir = NFS_FILEID(dir); 657 __assign_str(name, dentry->d_name.name); 658 ), 659 660 TP_printk( 661 "name=%02x:%02x:%llu/%s", 662 MAJOR(__entry->dev), MINOR(__entry->dev), 663 (unsigned long long)__entry->dir, 664 __get_str(name) 665 ) 666 ); 667 668 #define DEFINE_NFS_DIRECTORY_EVENT(name) \ 669 DEFINE_EVENT(nfs_directory_event, name, \ 670 TP_PROTO( \ 671 const struct inode *dir, \ 672 const struct dentry *dentry \ 673 ), \ 674 TP_ARGS(dir, dentry)) 675 676 DECLARE_EVENT_CLASS(nfs_directory_event_done, 677 TP_PROTO( 678 const struct inode *dir, 679 const struct dentry *dentry, 680 int error 681 ), 682 683 TP_ARGS(dir, dentry, error), 684 685 TP_STRUCT__entry( 686 __field(unsigned long, error) 687 __field(dev_t, dev) 688 __field(u64, dir) 689 __string(name, dentry->d_name.name) 690 ), 691 692 TP_fast_assign( 693 __entry->dev = dir->i_sb->s_dev; 694 __entry->dir = NFS_FILEID(dir); 695 __entry->error = error < 0 ? -error : 0; 696 __assign_str(name, dentry->d_name.name); 697 ), 698 699 TP_printk( 700 "error=%ld (%s) name=%02x:%02x:%llu/%s", 701 -__entry->error, show_nfs_status(__entry->error), 702 MAJOR(__entry->dev), MINOR(__entry->dev), 703 (unsigned long long)__entry->dir, 704 __get_str(name) 705 ) 706 ); 707 708 #define DEFINE_NFS_DIRECTORY_EVENT_DONE(name) \ 709 DEFINE_EVENT(nfs_directory_event_done, name, \ 710 TP_PROTO( \ 711 const struct inode *dir, \ 712 const struct dentry *dentry, \ 713 int error \ 714 ), \ 715 TP_ARGS(dir, dentry, error)) 716 717 DEFINE_NFS_DIRECTORY_EVENT(nfs_mknod_enter); 718 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mknod_exit); 719 DEFINE_NFS_DIRECTORY_EVENT(nfs_mkdir_enter); 720 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_mkdir_exit); 721 DEFINE_NFS_DIRECTORY_EVENT(nfs_rmdir_enter); 722 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_rmdir_exit); 723 DEFINE_NFS_DIRECTORY_EVENT(nfs_remove_enter); 724 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_remove_exit); 725 DEFINE_NFS_DIRECTORY_EVENT(nfs_unlink_enter); 726 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_unlink_exit); 727 DEFINE_NFS_DIRECTORY_EVENT(nfs_symlink_enter); 728 DEFINE_NFS_DIRECTORY_EVENT_DONE(nfs_symlink_exit); 729 730 TRACE_EVENT(nfs_link_enter, 731 TP_PROTO( 732 const struct inode *inode, 733 const struct inode *dir, 734 const struct dentry *dentry 735 ), 736 737 TP_ARGS(inode, dir, dentry), 738 739 TP_STRUCT__entry( 740 __field(dev_t, dev) 741 __field(u64, fileid) 742 __field(u64, dir) 743 __string(name, dentry->d_name.name) 744 ), 745 746 TP_fast_assign( 747 __entry->dev = inode->i_sb->s_dev; 748 __entry->fileid = NFS_FILEID(inode); 749 __entry->dir = NFS_FILEID(dir); 750 __assign_str(name, dentry->d_name.name); 751 ), 752 753 TP_printk( 754 "fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s", 755 MAJOR(__entry->dev), MINOR(__entry->dev), 756 __entry->fileid, 757 MAJOR(__entry->dev), MINOR(__entry->dev), 758 (unsigned long long)__entry->dir, 759 __get_str(name) 760 ) 761 ); 762 763 TRACE_EVENT(nfs_link_exit, 764 TP_PROTO( 765 const struct inode *inode, 766 const struct inode *dir, 767 const struct dentry *dentry, 768 int error 769 ), 770 771 TP_ARGS(inode, dir, dentry, error), 772 773 TP_STRUCT__entry( 774 __field(unsigned long, error) 775 __field(dev_t, dev) 776 __field(u64, fileid) 777 __field(u64, dir) 778 __string(name, dentry->d_name.name) 779 ), 780 781 TP_fast_assign( 782 __entry->dev = inode->i_sb->s_dev; 783 __entry->fileid = NFS_FILEID(inode); 784 __entry->dir = NFS_FILEID(dir); 785 __entry->error = error < 0 ? -error : 0; 786 __assign_str(name, dentry->d_name.name); 787 ), 788 789 TP_printk( 790 "error=%ld (%s) fileid=%02x:%02x:%llu name=%02x:%02x:%llu/%s", 791 -__entry->error, show_nfs_status(__entry->error), 792 MAJOR(__entry->dev), MINOR(__entry->dev), 793 __entry->fileid, 794 MAJOR(__entry->dev), MINOR(__entry->dev), 795 (unsigned long long)__entry->dir, 796 __get_str(name) 797 ) 798 ); 799 800 DECLARE_EVENT_CLASS(nfs_rename_event, 801 TP_PROTO( 802 const struct inode *old_dir, 803 const struct dentry *old_dentry, 804 const struct inode *new_dir, 805 const struct dentry *new_dentry 806 ), 807 808 TP_ARGS(old_dir, old_dentry, new_dir, new_dentry), 809 810 TP_STRUCT__entry( 811 __field(dev_t, dev) 812 __field(u64, old_dir) 813 __field(u64, new_dir) 814 __string(old_name, old_dentry->d_name.name) 815 __string(new_name, new_dentry->d_name.name) 816 ), 817 818 TP_fast_assign( 819 __entry->dev = old_dir->i_sb->s_dev; 820 __entry->old_dir = NFS_FILEID(old_dir); 821 __entry->new_dir = NFS_FILEID(new_dir); 822 __assign_str(old_name, old_dentry->d_name.name); 823 __assign_str(new_name, new_dentry->d_name.name); 824 ), 825 826 TP_printk( 827 "old_name=%02x:%02x:%llu/%s new_name=%02x:%02x:%llu/%s", 828 MAJOR(__entry->dev), MINOR(__entry->dev), 829 (unsigned long long)__entry->old_dir, 830 __get_str(old_name), 831 MAJOR(__entry->dev), MINOR(__entry->dev), 832 (unsigned long long)__entry->new_dir, 833 __get_str(new_name) 834 ) 835 ); 836 #define DEFINE_NFS_RENAME_EVENT(name) \ 837 DEFINE_EVENT(nfs_rename_event, name, \ 838 TP_PROTO( \ 839 const struct inode *old_dir, \ 840 const struct dentry *old_dentry, \ 841 const struct inode *new_dir, \ 842 const struct dentry *new_dentry \ 843 ), \ 844 TP_ARGS(old_dir, old_dentry, new_dir, new_dentry)) 845 846 DECLARE_EVENT_CLASS(nfs_rename_event_done, 847 TP_PROTO( 848 const struct inode *old_dir, 849 const struct dentry *old_dentry, 850 const struct inode *new_dir, 851 const struct dentry *new_dentry, 852 int error 853 ), 854 855 TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, error), 856 857 TP_STRUCT__entry( 858 __field(dev_t, dev) 859 __field(unsigned long, error) 860 __field(u64, old_dir) 861 __string(old_name, old_dentry->d_name.name) 862 __field(u64, new_dir) 863 __string(new_name, new_dentry->d_name.name) 864 ), 865 866 TP_fast_assign( 867 __entry->dev = old_dir->i_sb->s_dev; 868 __entry->error = -error; 869 __entry->old_dir = NFS_FILEID(old_dir); 870 __entry->new_dir = NFS_FILEID(new_dir); 871 __assign_str(old_name, old_dentry->d_name.name); 872 __assign_str(new_name, new_dentry->d_name.name); 873 ), 874 875 TP_printk( 876 "error=%ld (%s) old_name=%02x:%02x:%llu/%s " 877 "new_name=%02x:%02x:%llu/%s", 878 -__entry->error, show_nfs_status(__entry->error), 879 MAJOR(__entry->dev), MINOR(__entry->dev), 880 (unsigned long long)__entry->old_dir, 881 __get_str(old_name), 882 MAJOR(__entry->dev), MINOR(__entry->dev), 883 (unsigned long long)__entry->new_dir, 884 __get_str(new_name) 885 ) 886 ); 887 #define DEFINE_NFS_RENAME_EVENT_DONE(name) \ 888 DEFINE_EVENT(nfs_rename_event_done, name, \ 889 TP_PROTO( \ 890 const struct inode *old_dir, \ 891 const struct dentry *old_dentry, \ 892 const struct inode *new_dir, \ 893 const struct dentry *new_dentry, \ 894 int error \ 895 ), \ 896 TP_ARGS(old_dir, old_dentry, new_dir, \ 897 new_dentry, error)) 898 899 DEFINE_NFS_RENAME_EVENT(nfs_rename_enter); 900 DEFINE_NFS_RENAME_EVENT_DONE(nfs_rename_exit); 901 902 DEFINE_NFS_RENAME_EVENT_DONE(nfs_async_rename_done); 903 904 TRACE_EVENT(nfs_sillyrename_unlink, 905 TP_PROTO( 906 const struct nfs_unlinkdata *data, 907 int error 908 ), 909 910 TP_ARGS(data, error), 911 912 TP_STRUCT__entry( 913 __field(dev_t, dev) 914 __field(unsigned long, error) 915 __field(u64, dir) 916 __dynamic_array(char, name, data->args.name.len + 1) 917 ), 918 919 TP_fast_assign( 920 struct inode *dir = d_inode(data->dentry->d_parent); 921 size_t len = data->args.name.len; 922 __entry->dev = dir->i_sb->s_dev; 923 __entry->dir = NFS_FILEID(dir); 924 __entry->error = -error; 925 memcpy(__get_str(name), 926 data->args.name.name, len); 927 __get_str(name)[len] = 0; 928 ), 929 930 TP_printk( 931 "error=%ld (%s) name=%02x:%02x:%llu/%s", 932 -__entry->error, show_nfs_status(__entry->error), 933 MAJOR(__entry->dev), MINOR(__entry->dev), 934 (unsigned long long)__entry->dir, 935 __get_str(name) 936 ) 937 ); 938 939 DECLARE_EVENT_CLASS(nfs_folio_event, 940 TP_PROTO( 941 const struct inode *inode, 942 struct folio *folio 943 ), 944 945 TP_ARGS(inode, folio), 946 947 TP_STRUCT__entry( 948 __field(dev_t, dev) 949 __field(u32, fhandle) 950 __field(u64, fileid) 951 __field(u64, version) 952 __field(loff_t, offset) 953 __field(u32, count) 954 ), 955 956 TP_fast_assign( 957 const struct nfs_inode *nfsi = NFS_I(inode); 958 959 __entry->dev = inode->i_sb->s_dev; 960 __entry->fileid = nfsi->fileid; 961 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 962 __entry->version = inode_peek_iversion_raw(inode); 963 __entry->offset = folio_file_pos(folio); 964 __entry->count = nfs_folio_length(folio); 965 ), 966 967 TP_printk( 968 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu " 969 "offset=%lld count=%u", 970 MAJOR(__entry->dev), MINOR(__entry->dev), 971 (unsigned long long)__entry->fileid, 972 __entry->fhandle, __entry->version, 973 __entry->offset, __entry->count 974 ) 975 ); 976 977 #define DEFINE_NFS_FOLIO_EVENT(name) \ 978 DEFINE_EVENT(nfs_folio_event, name, \ 979 TP_PROTO( \ 980 const struct inode *inode, \ 981 struct folio *folio \ 982 ), \ 983 TP_ARGS(inode, folio)) 984 985 DECLARE_EVENT_CLASS(nfs_folio_event_done, 986 TP_PROTO( 987 const struct inode *inode, 988 struct folio *folio, 989 int ret 990 ), 991 992 TP_ARGS(inode, folio, ret), 993 994 TP_STRUCT__entry( 995 __field(dev_t, dev) 996 __field(u32, fhandle) 997 __field(int, ret) 998 __field(u64, fileid) 999 __field(u64, version) 1000 __field(loff_t, offset) 1001 __field(u32, count) 1002 ), 1003 1004 TP_fast_assign( 1005 const struct nfs_inode *nfsi = NFS_I(inode); 1006 1007 __entry->dev = inode->i_sb->s_dev; 1008 __entry->fileid = nfsi->fileid; 1009 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 1010 __entry->version = inode_peek_iversion_raw(inode); 1011 __entry->offset = folio_file_pos(folio); 1012 __entry->count = nfs_folio_length(folio); 1013 __entry->ret = ret; 1014 ), 1015 1016 TP_printk( 1017 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu " 1018 "offset=%lld count=%u ret=%d", 1019 MAJOR(__entry->dev), MINOR(__entry->dev), 1020 (unsigned long long)__entry->fileid, 1021 __entry->fhandle, __entry->version, 1022 __entry->offset, __entry->count, __entry->ret 1023 ) 1024 ); 1025 1026 #define DEFINE_NFS_FOLIO_EVENT_DONE(name) \ 1027 DEFINE_EVENT(nfs_folio_event_done, name, \ 1028 TP_PROTO( \ 1029 const struct inode *inode, \ 1030 struct folio *folio, \ 1031 int ret \ 1032 ), \ 1033 TP_ARGS(inode, folio, ret)) 1034 1035 DEFINE_NFS_FOLIO_EVENT(nfs_aop_readpage); 1036 DEFINE_NFS_FOLIO_EVENT_DONE(nfs_aop_readpage_done); 1037 1038 DEFINE_NFS_FOLIO_EVENT(nfs_writeback_folio); 1039 DEFINE_NFS_FOLIO_EVENT_DONE(nfs_writeback_folio_done); 1040 1041 DEFINE_NFS_FOLIO_EVENT(nfs_invalidate_folio); 1042 DEFINE_NFS_FOLIO_EVENT_DONE(nfs_launder_folio_done); 1043 1044 TRACE_EVENT(nfs_aop_readahead, 1045 TP_PROTO( 1046 const struct inode *inode, 1047 loff_t pos, 1048 unsigned int nr_pages 1049 ), 1050 1051 TP_ARGS(inode, pos, nr_pages), 1052 1053 TP_STRUCT__entry( 1054 __field(dev_t, dev) 1055 __field(u32, fhandle) 1056 __field(u64, fileid) 1057 __field(u64, version) 1058 __field(loff_t, offset) 1059 __field(unsigned int, nr_pages) 1060 ), 1061 1062 TP_fast_assign( 1063 const struct nfs_inode *nfsi = NFS_I(inode); 1064 1065 __entry->dev = inode->i_sb->s_dev; 1066 __entry->fileid = nfsi->fileid; 1067 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 1068 __entry->version = inode_peek_iversion_raw(inode); 1069 __entry->offset = pos; 1070 __entry->nr_pages = nr_pages; 1071 ), 1072 1073 TP_printk( 1074 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu offset=%lld nr_pages=%u", 1075 MAJOR(__entry->dev), MINOR(__entry->dev), 1076 (unsigned long long)__entry->fileid, 1077 __entry->fhandle, __entry->version, 1078 __entry->offset, __entry->nr_pages 1079 ) 1080 ); 1081 1082 TRACE_EVENT(nfs_aop_readahead_done, 1083 TP_PROTO( 1084 const struct inode *inode, 1085 unsigned int nr_pages, 1086 int ret 1087 ), 1088 1089 TP_ARGS(inode, nr_pages, ret), 1090 1091 TP_STRUCT__entry( 1092 __field(dev_t, dev) 1093 __field(u32, fhandle) 1094 __field(int, ret) 1095 __field(u64, fileid) 1096 __field(u64, version) 1097 __field(loff_t, offset) 1098 __field(unsigned int, nr_pages) 1099 ), 1100 1101 TP_fast_assign( 1102 const struct nfs_inode *nfsi = NFS_I(inode); 1103 1104 __entry->dev = inode->i_sb->s_dev; 1105 __entry->fileid = nfsi->fileid; 1106 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 1107 __entry->version = inode_peek_iversion_raw(inode); 1108 __entry->nr_pages = nr_pages; 1109 __entry->ret = ret; 1110 ), 1111 1112 TP_printk( 1113 "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu nr_pages=%u ret=%d", 1114 MAJOR(__entry->dev), MINOR(__entry->dev), 1115 (unsigned long long)__entry->fileid, 1116 __entry->fhandle, __entry->version, 1117 __entry->nr_pages, __entry->ret 1118 ) 1119 ); 1120 1121 TRACE_EVENT(nfs_initiate_read, 1122 TP_PROTO( 1123 const struct nfs_pgio_header *hdr 1124 ), 1125 1126 TP_ARGS(hdr), 1127 1128 TP_STRUCT__entry( 1129 __field(dev_t, dev) 1130 __field(u32, fhandle) 1131 __field(u64, fileid) 1132 __field(loff_t, offset) 1133 __field(u32, count) 1134 ), 1135 1136 TP_fast_assign( 1137 const struct inode *inode = hdr->inode; 1138 const struct nfs_inode *nfsi = NFS_I(inode); 1139 const struct nfs_fh *fh = hdr->args.fh ? 1140 hdr->args.fh : &nfsi->fh; 1141 1142 __entry->offset = hdr->args.offset; 1143 __entry->count = hdr->args.count; 1144 __entry->dev = inode->i_sb->s_dev; 1145 __entry->fileid = nfsi->fileid; 1146 __entry->fhandle = nfs_fhandle_hash(fh); 1147 ), 1148 1149 TP_printk( 1150 "fileid=%02x:%02x:%llu fhandle=0x%08x " 1151 "offset=%lld count=%u", 1152 MAJOR(__entry->dev), MINOR(__entry->dev), 1153 (unsigned long long)__entry->fileid, 1154 __entry->fhandle, 1155 (long long)__entry->offset, __entry->count 1156 ) 1157 ); 1158 1159 TRACE_EVENT(nfs_readpage_done, 1160 TP_PROTO( 1161 const struct rpc_task *task, 1162 const struct nfs_pgio_header *hdr 1163 ), 1164 1165 TP_ARGS(task, hdr), 1166 1167 TP_STRUCT__entry( 1168 __field(dev_t, dev) 1169 __field(u32, fhandle) 1170 __field(u64, fileid) 1171 __field(loff_t, offset) 1172 __field(u32, arg_count) 1173 __field(u32, res_count) 1174 __field(bool, eof) 1175 __field(int, error) 1176 ), 1177 1178 TP_fast_assign( 1179 const struct inode *inode = hdr->inode; 1180 const struct nfs_inode *nfsi = NFS_I(inode); 1181 const struct nfs_fh *fh = hdr->args.fh ? 1182 hdr->args.fh : &nfsi->fh; 1183 1184 __entry->error = task->tk_status; 1185 __entry->offset = hdr->args.offset; 1186 __entry->arg_count = hdr->args.count; 1187 __entry->res_count = hdr->res.count; 1188 __entry->eof = hdr->res.eof; 1189 __entry->dev = inode->i_sb->s_dev; 1190 __entry->fileid = nfsi->fileid; 1191 __entry->fhandle = nfs_fhandle_hash(fh); 1192 ), 1193 1194 TP_printk( 1195 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x " 1196 "offset=%lld count=%u res=%u%s", __entry->error, 1197 MAJOR(__entry->dev), MINOR(__entry->dev), 1198 (unsigned long long)__entry->fileid, 1199 __entry->fhandle, 1200 (long long)__entry->offset, __entry->arg_count, 1201 __entry->res_count, __entry->eof ? " eof" : "" 1202 ) 1203 ); 1204 1205 TRACE_EVENT(nfs_readpage_short, 1206 TP_PROTO( 1207 const struct rpc_task *task, 1208 const struct nfs_pgio_header *hdr 1209 ), 1210 1211 TP_ARGS(task, hdr), 1212 1213 TP_STRUCT__entry( 1214 __field(dev_t, dev) 1215 __field(u32, fhandle) 1216 __field(u64, fileid) 1217 __field(loff_t, offset) 1218 __field(u32, arg_count) 1219 __field(u32, res_count) 1220 __field(bool, eof) 1221 __field(int, error) 1222 ), 1223 1224 TP_fast_assign( 1225 const struct inode *inode = hdr->inode; 1226 const struct nfs_inode *nfsi = NFS_I(inode); 1227 const struct nfs_fh *fh = hdr->args.fh ? 1228 hdr->args.fh : &nfsi->fh; 1229 1230 __entry->error = task->tk_status; 1231 __entry->offset = hdr->args.offset; 1232 __entry->arg_count = hdr->args.count; 1233 __entry->res_count = hdr->res.count; 1234 __entry->eof = hdr->res.eof; 1235 __entry->dev = inode->i_sb->s_dev; 1236 __entry->fileid = nfsi->fileid; 1237 __entry->fhandle = nfs_fhandle_hash(fh); 1238 ), 1239 1240 TP_printk( 1241 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x " 1242 "offset=%lld count=%u res=%u%s", __entry->error, 1243 MAJOR(__entry->dev), MINOR(__entry->dev), 1244 (unsigned long long)__entry->fileid, 1245 __entry->fhandle, 1246 (long long)__entry->offset, __entry->arg_count, 1247 __entry->res_count, __entry->eof ? " eof" : "" 1248 ) 1249 ); 1250 1251 1252 TRACE_EVENT(nfs_pgio_error, 1253 TP_PROTO( 1254 const struct nfs_pgio_header *hdr, 1255 int error, 1256 loff_t pos 1257 ), 1258 1259 TP_ARGS(hdr, error, pos), 1260 1261 TP_STRUCT__entry( 1262 __field(dev_t, dev) 1263 __field(u32, fhandle) 1264 __field(u64, fileid) 1265 __field(loff_t, offset) 1266 __field(u32, arg_count) 1267 __field(u32, res_count) 1268 __field(loff_t, pos) 1269 __field(int, error) 1270 ), 1271 1272 TP_fast_assign( 1273 const struct inode *inode = hdr->inode; 1274 const struct nfs_inode *nfsi = NFS_I(inode); 1275 const struct nfs_fh *fh = hdr->args.fh ? 1276 hdr->args.fh : &nfsi->fh; 1277 1278 __entry->error = error; 1279 __entry->offset = hdr->args.offset; 1280 __entry->arg_count = hdr->args.count; 1281 __entry->res_count = hdr->res.count; 1282 __entry->dev = inode->i_sb->s_dev; 1283 __entry->fileid = nfsi->fileid; 1284 __entry->fhandle = nfs_fhandle_hash(fh); 1285 ), 1286 1287 TP_printk("error=%d fileid=%02x:%02x:%llu fhandle=0x%08x " 1288 "offset=%lld count=%u res=%u pos=%llu", __entry->error, 1289 MAJOR(__entry->dev), MINOR(__entry->dev), 1290 (unsigned long long)__entry->fileid, __entry->fhandle, 1291 (long long)__entry->offset, __entry->arg_count, __entry->res_count, 1292 __entry->pos 1293 ) 1294 ); 1295 1296 TRACE_EVENT(nfs_initiate_write, 1297 TP_PROTO( 1298 const struct nfs_pgio_header *hdr 1299 ), 1300 1301 TP_ARGS(hdr), 1302 1303 TP_STRUCT__entry( 1304 __field(dev_t, dev) 1305 __field(u32, fhandle) 1306 __field(u64, fileid) 1307 __field(loff_t, offset) 1308 __field(u32, count) 1309 __field(unsigned long, stable) 1310 ), 1311 1312 TP_fast_assign( 1313 const struct inode *inode = hdr->inode; 1314 const struct nfs_inode *nfsi = NFS_I(inode); 1315 const struct nfs_fh *fh = hdr->args.fh ? 1316 hdr->args.fh : &nfsi->fh; 1317 1318 __entry->offset = hdr->args.offset; 1319 __entry->count = hdr->args.count; 1320 __entry->stable = hdr->args.stable; 1321 __entry->dev = inode->i_sb->s_dev; 1322 __entry->fileid = nfsi->fileid; 1323 __entry->fhandle = nfs_fhandle_hash(fh); 1324 ), 1325 1326 TP_printk( 1327 "fileid=%02x:%02x:%llu fhandle=0x%08x " 1328 "offset=%lld count=%u stable=%s", 1329 MAJOR(__entry->dev), MINOR(__entry->dev), 1330 (unsigned long long)__entry->fileid, 1331 __entry->fhandle, 1332 (long long)__entry->offset, __entry->count, 1333 show_nfs_stable_how(__entry->stable) 1334 ) 1335 ); 1336 1337 TRACE_EVENT(nfs_writeback_done, 1338 TP_PROTO( 1339 const struct rpc_task *task, 1340 const struct nfs_pgio_header *hdr 1341 ), 1342 1343 TP_ARGS(task, hdr), 1344 1345 TP_STRUCT__entry( 1346 __field(dev_t, dev) 1347 __field(u32, fhandle) 1348 __field(u64, fileid) 1349 __field(loff_t, offset) 1350 __field(u32, arg_count) 1351 __field(u32, res_count) 1352 __field(int, error) 1353 __field(unsigned long, stable) 1354 __array(char, verifier, NFS4_VERIFIER_SIZE) 1355 ), 1356 1357 TP_fast_assign( 1358 const struct inode *inode = hdr->inode; 1359 const struct nfs_inode *nfsi = NFS_I(inode); 1360 const struct nfs_fh *fh = hdr->args.fh ? 1361 hdr->args.fh : &nfsi->fh; 1362 const struct nfs_writeverf *verf = hdr->res.verf; 1363 1364 __entry->error = task->tk_status; 1365 __entry->offset = hdr->args.offset; 1366 __entry->arg_count = hdr->args.count; 1367 __entry->res_count = hdr->res.count; 1368 __entry->stable = verf->committed; 1369 memcpy(__entry->verifier, 1370 &verf->verifier, 1371 NFS4_VERIFIER_SIZE); 1372 __entry->dev = inode->i_sb->s_dev; 1373 __entry->fileid = nfsi->fileid; 1374 __entry->fhandle = nfs_fhandle_hash(fh); 1375 ), 1376 1377 TP_printk( 1378 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x " 1379 "offset=%lld count=%u res=%u stable=%s " 1380 "verifier=%s", __entry->error, 1381 MAJOR(__entry->dev), MINOR(__entry->dev), 1382 (unsigned long long)__entry->fileid, 1383 __entry->fhandle, 1384 (long long)__entry->offset, __entry->arg_count, 1385 __entry->res_count, 1386 show_nfs_stable_how(__entry->stable), 1387 show_nfs4_verifier(__entry->verifier) 1388 ) 1389 ); 1390 1391 DECLARE_EVENT_CLASS(nfs_page_error_class, 1392 TP_PROTO( 1393 const struct inode *inode, 1394 const struct nfs_page *req, 1395 int error 1396 ), 1397 1398 TP_ARGS(inode, req, error), 1399 1400 TP_STRUCT__entry( 1401 __field(dev_t, dev) 1402 __field(u32, fhandle) 1403 __field(u64, fileid) 1404 __field(loff_t, offset) 1405 __field(unsigned int, count) 1406 __field(int, error) 1407 ), 1408 1409 TP_fast_assign( 1410 const struct nfs_inode *nfsi = NFS_I(inode); 1411 __entry->dev = inode->i_sb->s_dev; 1412 __entry->fileid = nfsi->fileid; 1413 __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); 1414 __entry->offset = req_offset(req); 1415 __entry->count = req->wb_bytes; 1416 __entry->error = error; 1417 ), 1418 1419 TP_printk( 1420 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x " 1421 "offset=%lld count=%u", __entry->error, 1422 MAJOR(__entry->dev), MINOR(__entry->dev), 1423 (unsigned long long)__entry->fileid, 1424 __entry->fhandle, __entry->offset, 1425 __entry->count 1426 ) 1427 ); 1428 1429 #define DEFINE_NFS_PAGEERR_EVENT(name) \ 1430 DEFINE_EVENT(nfs_page_error_class, name, \ 1431 TP_PROTO( \ 1432 const struct inode *inode, \ 1433 const struct nfs_page *req, \ 1434 int error \ 1435 ), \ 1436 TP_ARGS(inode, req, error)) 1437 1438 DEFINE_NFS_PAGEERR_EVENT(nfs_write_error); 1439 DEFINE_NFS_PAGEERR_EVENT(nfs_comp_error); 1440 DEFINE_NFS_PAGEERR_EVENT(nfs_commit_error); 1441 1442 TRACE_EVENT(nfs_initiate_commit, 1443 TP_PROTO( 1444 const struct nfs_commit_data *data 1445 ), 1446 1447 TP_ARGS(data), 1448 1449 TP_STRUCT__entry( 1450 __field(dev_t, dev) 1451 __field(u32, fhandle) 1452 __field(u64, fileid) 1453 __field(loff_t, offset) 1454 __field(u32, count) 1455 ), 1456 1457 TP_fast_assign( 1458 const struct inode *inode = data->inode; 1459 const struct nfs_inode *nfsi = NFS_I(inode); 1460 const struct nfs_fh *fh = data->args.fh ? 1461 data->args.fh : &nfsi->fh; 1462 1463 __entry->offset = data->args.offset; 1464 __entry->count = data->args.count; 1465 __entry->dev = inode->i_sb->s_dev; 1466 __entry->fileid = nfsi->fileid; 1467 __entry->fhandle = nfs_fhandle_hash(fh); 1468 ), 1469 1470 TP_printk( 1471 "fileid=%02x:%02x:%llu fhandle=0x%08x " 1472 "offset=%lld count=%u", 1473 MAJOR(__entry->dev), MINOR(__entry->dev), 1474 (unsigned long long)__entry->fileid, 1475 __entry->fhandle, 1476 (long long)__entry->offset, __entry->count 1477 ) 1478 ); 1479 1480 TRACE_EVENT(nfs_commit_done, 1481 TP_PROTO( 1482 const struct rpc_task *task, 1483 const struct nfs_commit_data *data 1484 ), 1485 1486 TP_ARGS(task, data), 1487 1488 TP_STRUCT__entry( 1489 __field(dev_t, dev) 1490 __field(u32, fhandle) 1491 __field(u64, fileid) 1492 __field(loff_t, offset) 1493 __field(int, error) 1494 __field(unsigned long, stable) 1495 __array(char, verifier, NFS4_VERIFIER_SIZE) 1496 ), 1497 1498 TP_fast_assign( 1499 const struct inode *inode = data->inode; 1500 const struct nfs_inode *nfsi = NFS_I(inode); 1501 const struct nfs_fh *fh = data->args.fh ? 1502 data->args.fh : &nfsi->fh; 1503 const struct nfs_writeverf *verf = data->res.verf; 1504 1505 __entry->error = task->tk_status; 1506 __entry->offset = data->args.offset; 1507 __entry->stable = verf->committed; 1508 memcpy(__entry->verifier, 1509 &verf->verifier, 1510 NFS4_VERIFIER_SIZE); 1511 __entry->dev = inode->i_sb->s_dev; 1512 __entry->fileid = nfsi->fileid; 1513 __entry->fhandle = nfs_fhandle_hash(fh); 1514 ), 1515 1516 TP_printk( 1517 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x " 1518 "offset=%lld stable=%s verifier=%s", __entry->error, 1519 MAJOR(__entry->dev), MINOR(__entry->dev), 1520 (unsigned long long)__entry->fileid, 1521 __entry->fhandle, 1522 (long long)__entry->offset, 1523 show_nfs_stable_how(__entry->stable), 1524 show_nfs4_verifier(__entry->verifier) 1525 ) 1526 ); 1527 1528 #define nfs_show_direct_req_flags(v) \ 1529 __print_flags(v, "|", \ 1530 { NFS_ODIRECT_DO_COMMIT, "DO_COMMIT" }, \ 1531 { NFS_ODIRECT_RESCHED_WRITES, "RESCHED_WRITES" }, \ 1532 { NFS_ODIRECT_SHOULD_DIRTY, "SHOULD DIRTY" }, \ 1533 { NFS_ODIRECT_DONE, "DONE" } ) 1534 1535 DECLARE_EVENT_CLASS(nfs_direct_req_class, 1536 TP_PROTO( 1537 const struct nfs_direct_req *dreq 1538 ), 1539 1540 TP_ARGS(dreq), 1541 1542 TP_STRUCT__entry( 1543 __field(dev_t, dev) 1544 __field(u64, fileid) 1545 __field(u32, fhandle) 1546 __field(loff_t, offset) 1547 __field(ssize_t, count) 1548 __field(ssize_t, error) 1549 __field(int, flags) 1550 ), 1551 1552 TP_fast_assign( 1553 const struct inode *inode = dreq->inode; 1554 const struct nfs_inode *nfsi = NFS_I(inode); 1555 const struct nfs_fh *fh = &nfsi->fh; 1556 1557 __entry->dev = inode->i_sb->s_dev; 1558 __entry->fileid = nfsi->fileid; 1559 __entry->fhandle = nfs_fhandle_hash(fh); 1560 __entry->offset = dreq->io_start; 1561 __entry->count = dreq->count; 1562 __entry->error = dreq->error; 1563 __entry->flags = dreq->flags; 1564 ), 1565 1566 TP_printk( 1567 "error=%zd fileid=%02x:%02x:%llu fhandle=0x%08x " 1568 "offset=%lld count=%zd flags=%s", 1569 __entry->error, MAJOR(__entry->dev), 1570 MINOR(__entry->dev), 1571 (unsigned long long)__entry->fileid, 1572 __entry->fhandle, __entry->offset, 1573 __entry->count, 1574 nfs_show_direct_req_flags(__entry->flags) 1575 ) 1576 ); 1577 1578 #define DEFINE_NFS_DIRECT_REQ_EVENT(name) \ 1579 DEFINE_EVENT(nfs_direct_req_class, name, \ 1580 TP_PROTO( \ 1581 const struct nfs_direct_req *dreq \ 1582 ), \ 1583 TP_ARGS(dreq)) 1584 1585 DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_commit_complete); 1586 DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_resched_write); 1587 DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_complete); 1588 DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_completion); 1589 DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_schedule_iovec); 1590 DEFINE_NFS_DIRECT_REQ_EVENT(nfs_direct_write_reschedule_io); 1591 1592 TRACE_EVENT(nfs_fh_to_dentry, 1593 TP_PROTO( 1594 const struct super_block *sb, 1595 const struct nfs_fh *fh, 1596 u64 fileid, 1597 int error 1598 ), 1599 1600 TP_ARGS(sb, fh, fileid, error), 1601 1602 TP_STRUCT__entry( 1603 __field(int, error) 1604 __field(dev_t, dev) 1605 __field(u32, fhandle) 1606 __field(u64, fileid) 1607 ), 1608 1609 TP_fast_assign( 1610 __entry->error = error; 1611 __entry->dev = sb->s_dev; 1612 __entry->fileid = fileid; 1613 __entry->fhandle = nfs_fhandle_hash(fh); 1614 ), 1615 1616 TP_printk( 1617 "error=%d fileid=%02x:%02x:%llu fhandle=0x%08x ", 1618 __entry->error, 1619 MAJOR(__entry->dev), MINOR(__entry->dev), 1620 (unsigned long long)__entry->fileid, 1621 __entry->fhandle 1622 ) 1623 ); 1624 1625 TRACE_EVENT(nfs_mount_assign, 1626 TP_PROTO( 1627 const char *option, 1628 const char *value 1629 ), 1630 1631 TP_ARGS(option, value), 1632 1633 TP_STRUCT__entry( 1634 __string(option, option) 1635 __string(value, value) 1636 ), 1637 1638 TP_fast_assign( 1639 __assign_str(option, option); 1640 __assign_str(value, value); 1641 ), 1642 1643 TP_printk("option %s=%s", 1644 __get_str(option), __get_str(value) 1645 ) 1646 ); 1647 1648 TRACE_EVENT(nfs_mount_option, 1649 TP_PROTO( 1650 const struct fs_parameter *param 1651 ), 1652 1653 TP_ARGS(param), 1654 1655 TP_STRUCT__entry( 1656 __string(option, param->key) 1657 ), 1658 1659 TP_fast_assign( 1660 __assign_str(option, param->key); 1661 ), 1662 1663 TP_printk("option %s", __get_str(option)) 1664 ); 1665 1666 TRACE_EVENT(nfs_mount_path, 1667 TP_PROTO( 1668 const char *path 1669 ), 1670 1671 TP_ARGS(path), 1672 1673 TP_STRUCT__entry( 1674 __string(path, path) 1675 ), 1676 1677 TP_fast_assign( 1678 __assign_str(path, path); 1679 ), 1680 1681 TP_printk("path='%s'", __get_str(path)) 1682 ); 1683 1684 DECLARE_EVENT_CLASS(nfs_xdr_event, 1685 TP_PROTO( 1686 const struct xdr_stream *xdr, 1687 int error 1688 ), 1689 1690 TP_ARGS(xdr, error), 1691 1692 TP_STRUCT__entry( 1693 __field(unsigned int, task_id) 1694 __field(unsigned int, client_id) 1695 __field(u32, xid) 1696 __field(int, version) 1697 __field(unsigned long, error) 1698 __string(program, 1699 xdr->rqst->rq_task->tk_client->cl_program->name) 1700 __string(procedure, 1701 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name) 1702 ), 1703 1704 TP_fast_assign( 1705 const struct rpc_rqst *rqstp = xdr->rqst; 1706 const struct rpc_task *task = rqstp->rq_task; 1707 1708 __entry->task_id = task->tk_pid; 1709 __entry->client_id = task->tk_client->cl_clid; 1710 __entry->xid = be32_to_cpu(rqstp->rq_xid); 1711 __entry->version = task->tk_client->cl_vers; 1712 __entry->error = error; 1713 __assign_str(program, 1714 task->tk_client->cl_program->name); 1715 __assign_str(procedure, task->tk_msg.rpc_proc->p_name); 1716 ), 1717 1718 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1719 " xid=0x%08x %sv%d %s error=%ld (%s)", 1720 __entry->task_id, __entry->client_id, __entry->xid, 1721 __get_str(program), __entry->version, 1722 __get_str(procedure), -__entry->error, 1723 show_nfs_status(__entry->error) 1724 ) 1725 ); 1726 #define DEFINE_NFS_XDR_EVENT(name) \ 1727 DEFINE_EVENT(nfs_xdr_event, name, \ 1728 TP_PROTO( \ 1729 const struct xdr_stream *xdr, \ 1730 int error \ 1731 ), \ 1732 TP_ARGS(xdr, error)) 1733 DEFINE_NFS_XDR_EVENT(nfs_xdr_status); 1734 DEFINE_NFS_XDR_EVENT(nfs_xdr_bad_filehandle); 1735 1736 #endif /* _TRACE_NFS_H */ 1737 1738 #undef TRACE_INCLUDE_PATH 1739 #define TRACE_INCLUDE_PATH . 1740 #define TRACE_INCLUDE_FILE nfstrace 1741 /* This part must be outside protection */ 1742 #include <trace/define_trace.h> 1743