mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
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>
This commit is contained in:
parent
4b62f0e448
commit
4a2d81714d
|
|
@ -388,6 +388,8 @@ static int nfs_write_begin(const struct kiocb *iocb,
|
|||
int once_thru = 0;
|
||||
int ret;
|
||||
|
||||
trace_nfs_write_begin(file_inode(file), pos, len);
|
||||
|
||||
dfprintk(PAGECACHE, "NFS: write_begin(%pD2(%lu), %u@%lld)\n",
|
||||
file, mapping->host->i_ino, len, (long long) pos);
|
||||
nfs_truncate_last_folio(mapping, i_size_read(mapping->host), pos);
|
||||
|
|
@ -396,8 +398,10 @@ static int nfs_write_begin(const struct kiocb *iocb,
|
|||
start:
|
||||
folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, fgp,
|
||||
mapping_gfp_mask(mapping));
|
||||
if (IS_ERR(folio))
|
||||
return PTR_ERR(folio);
|
||||
if (IS_ERR(folio)) {
|
||||
ret = PTR_ERR(folio);
|
||||
goto out;
|
||||
}
|
||||
*foliop = folio;
|
||||
|
||||
ret = nfs_flush_incompatible(file, folio);
|
||||
|
|
@ -412,6 +416,8 @@ static int nfs_write_begin(const struct kiocb *iocb,
|
|||
if (!ret)
|
||||
goto start;
|
||||
}
|
||||
out:
|
||||
trace_nfs_write_begin_done(file_inode(file), pos, len, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -425,6 +431,7 @@ static int nfs_write_end(const struct kiocb *iocb,
|
|||
unsigned offset = offset_in_folio(folio, pos);
|
||||
int status;
|
||||
|
||||
trace_nfs_write_end(file_inode(file), pos, len);
|
||||
dfprintk(PAGECACHE, "NFS: write_end(%pD2(%lu), %u@%lld)\n",
|
||||
file, mapping->host->i_ino, len, (long long) pos);
|
||||
|
||||
|
|
@ -453,13 +460,16 @@ static int nfs_write_end(const struct kiocb *iocb,
|
|||
folio_unlock(folio);
|
||||
folio_put(folio);
|
||||
|
||||
if (status < 0)
|
||||
if (status < 0) {
|
||||
trace_nfs_write_end_done(file_inode(file), pos, len, status);
|
||||
return status;
|
||||
}
|
||||
NFS_I(mapping->host)->write_io += copied;
|
||||
|
||||
if (nfs_ctx_key_to_expire(ctx, mapping->host))
|
||||
nfs_wb_all(mapping->host);
|
||||
|
||||
trace_nfs_write_end_done(file_inode(file), pos, len, copied);
|
||||
return copied;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1051,6 +1051,19 @@ DEFINE_NFS_FOLIO_EVENT_DONE(nfs_writeback_folio_done);
|
|||
DEFINE_NFS_FOLIO_EVENT(nfs_invalidate_folio);
|
||||
DEFINE_NFS_FOLIO_EVENT_DONE(nfs_launder_folio_done);
|
||||
|
||||
DEFINE_NFS_FOLIO_EVENT(nfs_try_to_update_request);
|
||||
DEFINE_NFS_FOLIO_EVENT_DONE(nfs_try_to_update_request_done);
|
||||
|
||||
DEFINE_NFS_FOLIO_EVENT(nfs_update_folio);
|
||||
DEFINE_NFS_FOLIO_EVENT_DONE(nfs_update_folio_done);
|
||||
|
||||
DEFINE_NFS_FOLIO_EVENT(nfs_write_begin);
|
||||
DEFINE_NFS_FOLIO_EVENT_DONE(nfs_write_begin_done);
|
||||
|
||||
DEFINE_NFS_FOLIO_EVENT(nfs_write_end);
|
||||
DEFINE_NFS_FOLIO_EVENT_DONE(nfs_write_end_done);
|
||||
|
||||
|
||||
DECLARE_EVENT_CLASS(nfs_kiocb_event,
|
||||
TP_PROTO(
|
||||
const struct kiocb *iocb,
|
||||
|
|
|
|||
|
|
@ -1017,11 +1017,12 @@ static struct nfs_page *nfs_try_to_update_request(struct folio *folio,
|
|||
unsigned int end;
|
||||
int error;
|
||||
|
||||
trace_nfs_try_to_update_request(folio_inode(folio), offset, bytes);
|
||||
end = offset + bytes;
|
||||
|
||||
req = nfs_lock_and_join_requests(folio);
|
||||
if (IS_ERR_OR_NULL(req))
|
||||
return req;
|
||||
goto out;
|
||||
|
||||
rqend = req->wb_offset + req->wb_bytes;
|
||||
/*
|
||||
|
|
@ -1043,6 +1044,9 @@ static struct nfs_page *nfs_try_to_update_request(struct folio *folio,
|
|||
else
|
||||
req->wb_bytes = rqend - req->wb_offset;
|
||||
req->wb_nio = 0;
|
||||
out:
|
||||
trace_nfs_try_to_update_request_done(folio_inode(folio), offset, bytes,
|
||||
PTR_ERR_OR_ZERO(req));
|
||||
return req;
|
||||
out_flushme:
|
||||
/*
|
||||
|
|
@ -1053,6 +1057,7 @@ static struct nfs_page *nfs_try_to_update_request(struct folio *folio,
|
|||
nfs_mark_request_dirty(req);
|
||||
nfs_unlock_and_release_request(req);
|
||||
error = nfs_wb_folio(folio->mapping->host, folio);
|
||||
trace_nfs_try_to_update_request_done(folio_inode(folio), offset, bytes, error);
|
||||
return (error < 0) ? ERR_PTR(error) : NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1290,6 +1295,8 @@ int nfs_update_folio(struct file *file, struct folio *folio,
|
|||
|
||||
nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE);
|
||||
|
||||
trace_nfs_update_folio(inode, offset, count);
|
||||
|
||||
dprintk("NFS: nfs_update_folio(%pD2 %d@%lld)\n", file, count,
|
||||
(long long)(folio_pos(folio) + offset));
|
||||
|
||||
|
|
@ -1309,6 +1316,7 @@ int nfs_update_folio(struct file *file, struct folio *folio,
|
|||
if (status < 0)
|
||||
nfs_set_pageerror(mapping);
|
||||
out:
|
||||
trace_nfs_update_folio_done(inode, offset, count, status);
|
||||
dprintk("NFS: nfs_update_folio returns %d (isize %lld)\n",
|
||||
status, (long long)i_size_read(inode));
|
||||
return status;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user