From 844c9e691d8723853ca8f2de0207683538645824 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Tue, 6 May 2014 09:12:35 -0400 Subject: NFS: Create a common pgio_error function At this point, the read and write versions of this function look identical so both should use the same function. Signed-off-by: Anna Schumaker Signed-off-by: Trond Myklebust --- fs/nfs/pagelist.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'fs/nfs/pagelist.c') diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 0ccd95116968..b0a98daae14c 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -446,6 +446,26 @@ static void nfs_pgio_prepare(struct rpc_task *task, void *calldata) rpc_exit(task, err); } +/** + * nfs_pgio_error - Clean up from a pageio error + * @desc: IO descriptor + * @hdr: pageio header + */ +int nfs_pgio_error(struct nfs_pageio_descriptor *desc, + struct nfs_pgio_header *hdr) +{ + struct nfs_pgio_data *data; + + set_bit(NFS_IOHDR_REDO, &hdr->flags); + while (!list_empty(&hdr->rpc_list)) { + data = list_first_entry(&hdr->rpc_list, struct nfs_pgio_data, list); + list_del(&data->list); + nfs_pgio_data_release(data); + } + desc->pg_completion_ops->error_cleanup(&desc->pg_list); + return -ENOMEM; +} + /** * nfs_pgio_release - Release pageio data * @calldata: The pageio data to release -- cgit v1.2.3