aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/pagelist.c
diff options
context:
space:
mode:
authorWeston Andros Adamson <dros@primarydata.com>2014-06-09 11:48:38 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-06-24 18:47:01 -0400
commit53113ad35e4b9ce82d949c7c67c7b666fad5d907 (patch)
treed648b4ca1de29c1dcb87e545f58aa25a3dce2da8 /fs/nfs/pagelist.c
parent4714fb51fd03a14d8c73001438283e7f7b752f1e (diff)
pnfs: clean up *_resend_to_mds
Clean up pnfs_read_done_resend_to_mds and pnfs_write_done_resend_to_mds: - instead of passing all arguments from a nfs_pgio_header, just pass the header - share the common code Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Weston Andros Adamson <dros@primarydata.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pagelist.c')
-rw-r--r--fs/nfs/pagelist.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 580fc0c982e6..9c6c55359394 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -949,6 +949,38 @@ int nfs_pageio_add_request(struct nfs_pageio_descriptor *desc,
949} 949}
950EXPORT_SYMBOL_GPL(nfs_pageio_add_request); 950EXPORT_SYMBOL_GPL(nfs_pageio_add_request);
951 951
952/*
953 * nfs_pageio_resend - Transfer requests to new descriptor and resend
954 * @hdr - the pgio header to move request from
955 * @desc - the pageio descriptor to add requests to
956 *
957 * Try to move each request (nfs_page) from @hdr to @desc then attempt
958 * to send them.
959 *
960 * Returns 0 on success and < 0 on error.
961 */
962int nfs_pageio_resend(struct nfs_pageio_descriptor *desc,
963 struct nfs_pgio_header *hdr)
964{
965 LIST_HEAD(failed);
966
967 desc->pg_dreq = hdr->dreq;
968 while (!list_empty(&hdr->pages)) {
969 struct nfs_page *req = nfs_list_entry(hdr->pages.next);
970
971 nfs_list_remove_request(req);
972 if (!nfs_pageio_add_request(desc, req))
973 nfs_list_add_request(req, &failed);
974 }
975 nfs_pageio_complete(desc);
976 if (!list_empty(&failed)) {
977 list_move(&failed, &hdr->pages);
978 return -EIO;
979 }
980 return 0;
981}
982EXPORT_SYMBOL_GPL(nfs_pageio_resend);
983
952/** 984/**
953 * nfs_pageio_complete - Complete I/O on an nfs_pageio_descriptor 985 * nfs_pageio_complete - Complete I/O on an nfs_pageio_descriptor
954 * @desc: pointer to io descriptor 986 * @desc: pointer to io descriptor