Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nfs: new tracepoints around write handling

New start and done tracepoints for:

nfs_update_folio()
nfs_write_begin()
nfs_write_end()
nfs_try_to_update_request()

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>

authored by

Jeff Layton and committed by
Anna Schumaker
4a2d8171 4b62f0e4

+35 -4
+13 -3
fs/nfs/file.c
··· 388 388 int once_thru = 0; 389 389 int ret; 390 390 391 + trace_nfs_write_begin(file_inode(file), pos, len); 392 + 391 393 dfprintk(PAGECACHE, "NFS: write_begin(%pD2(%lu), %u@%lld)\n", 392 394 file, mapping->host->i_ino, len, (long long) pos); 393 395 nfs_truncate_last_folio(mapping, i_size_read(mapping->host), pos); ··· 398 396 start: 399 397 folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, fgp, 400 398 mapping_gfp_mask(mapping)); 401 - if (IS_ERR(folio)) 402 - return PTR_ERR(folio); 399 + if (IS_ERR(folio)) { 400 + ret = PTR_ERR(folio); 401 + goto out; 402 + } 403 403 *foliop = folio; 404 404 405 405 ret = nfs_flush_incompatible(file, folio); ··· 416 412 if (!ret) 417 413 goto start; 418 414 } 415 + out: 416 + trace_nfs_write_begin_done(file_inode(file), pos, len, ret); 419 417 return ret; 420 418 } 421 419 ··· 431 425 unsigned offset = offset_in_folio(folio, pos); 432 426 int status; 433 427 428 + trace_nfs_write_end(file_inode(file), pos, len); 434 429 dfprintk(PAGECACHE, "NFS: write_end(%pD2(%lu), %u@%lld)\n", 435 430 file, mapping->host->i_ino, len, (long long) pos); 436 431 ··· 460 453 folio_unlock(folio); 461 454 folio_put(folio); 462 455 463 - if (status < 0) 456 + if (status < 0) { 457 + trace_nfs_write_end_done(file_inode(file), pos, len, status); 464 458 return status; 459 + } 465 460 NFS_I(mapping->host)->write_io += copied; 466 461 467 462 if (nfs_ctx_key_to_expire(ctx, mapping->host)) 468 463 nfs_wb_all(mapping->host); 469 464 465 + trace_nfs_write_end_done(file_inode(file), pos, len, copied); 470 466 return copied; 471 467 } 472 468
+13
fs/nfs/nfstrace.h
··· 1051 1051 DEFINE_NFS_FOLIO_EVENT(nfs_invalidate_folio); 1052 1052 DEFINE_NFS_FOLIO_EVENT_DONE(nfs_launder_folio_done); 1053 1053 1054 + DEFINE_NFS_FOLIO_EVENT(nfs_try_to_update_request); 1055 + DEFINE_NFS_FOLIO_EVENT_DONE(nfs_try_to_update_request_done); 1056 + 1057 + DEFINE_NFS_FOLIO_EVENT(nfs_update_folio); 1058 + DEFINE_NFS_FOLIO_EVENT_DONE(nfs_update_folio_done); 1059 + 1060 + DEFINE_NFS_FOLIO_EVENT(nfs_write_begin); 1061 + DEFINE_NFS_FOLIO_EVENT_DONE(nfs_write_begin_done); 1062 + 1063 + DEFINE_NFS_FOLIO_EVENT(nfs_write_end); 1064 + DEFINE_NFS_FOLIO_EVENT_DONE(nfs_write_end_done); 1065 + 1066 + 1054 1067 DECLARE_EVENT_CLASS(nfs_kiocb_event, 1055 1068 TP_PROTO( 1056 1069 const struct kiocb *iocb,
+9 -1
fs/nfs/write.c
··· 1017 1017 unsigned int end; 1018 1018 int error; 1019 1019 1020 + trace_nfs_try_to_update_request(folio_inode(folio), offset, bytes); 1020 1021 end = offset + bytes; 1021 1022 1022 1023 req = nfs_lock_and_join_requests(folio); 1023 1024 if (IS_ERR_OR_NULL(req)) 1024 - return req; 1025 + goto out; 1025 1026 1026 1027 rqend = req->wb_offset + req->wb_bytes; 1027 1028 /* ··· 1044 1043 else 1045 1044 req->wb_bytes = rqend - req->wb_offset; 1046 1045 req->wb_nio = 0; 1046 + out: 1047 + trace_nfs_try_to_update_request_done(folio_inode(folio), offset, bytes, 1048 + PTR_ERR_OR_ZERO(req)); 1047 1049 return req; 1048 1050 out_flushme: 1049 1051 /* ··· 1057 1053 nfs_mark_request_dirty(req); 1058 1054 nfs_unlock_and_release_request(req); 1059 1055 error = nfs_wb_folio(folio->mapping->host, folio); 1056 + trace_nfs_try_to_update_request_done(folio_inode(folio), offset, bytes, error); 1060 1057 return (error < 0) ? ERR_PTR(error) : NULL; 1061 1058 } 1062 1059 ··· 1295 1290 1296 1291 nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE); 1297 1292 1293 + trace_nfs_update_folio(inode, offset, count); 1294 + 1298 1295 dprintk("NFS: nfs_update_folio(%pD2 %d@%lld)\n", file, count, 1299 1296 (long long)(folio_pos(folio) + offset)); 1300 1297 ··· 1316 1309 if (status < 0) 1317 1310 nfs_set_pageerror(mapping); 1318 1311 out: 1312 + trace_nfs_update_folio_done(inode, offset, count, status); 1319 1313 dprintk("NFS: nfs_update_folio returns %d (isize %lld)\n", 1320 1314 status, (long long)i_size_read(inode)); 1321 1315 return status;