aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
authorAnna Schumaker <Anna.Schumaker@netapp.com>2014-05-06 09:12:35 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-05-28 18:41:04 -0400
commit844c9e691d8723853ca8f2de0207683538645824 (patch)
tree81e74dc24a665888727c0e7b26a59db2feea2ecb /fs/nfs/write.c
parentce59515c1484d3a01bc2f3e7043dc488d25efe34 (diff)
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 <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r--fs/nfs/write.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 0d367aa87814..02d088b1d8e4 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1044,19 +1044,6 @@ static const struct nfs_pgio_completion_ops nfs_async_write_completion_ops = {
1044 .completion = nfs_write_completion, 1044 .completion = nfs_write_completion,
1045}; 1045};
1046 1046
1047static void nfs_flush_error(struct nfs_pageio_descriptor *desc,
1048 struct nfs_pgio_header *hdr)
1049{
1050 set_bit(NFS_IOHDR_REDO, &hdr->flags);
1051 while (!list_empty(&hdr->rpc_list)) {
1052 struct nfs_pgio_data *data = list_first_entry(&hdr->rpc_list,
1053 struct nfs_pgio_data, list);
1054 list_del(&data->list);
1055 nfs_pgio_data_release(data);
1056 }
1057 desc->pg_completion_ops->error_cleanup(&desc->pg_list);
1058}
1059
1060/* 1047/*
1061 * Generate multiple small requests to write out a single 1048 * Generate multiple small requests to write out a single
1062 * contiguous dirty area on one page. 1049 * contiguous dirty area on one page.
@@ -1086,10 +1073,8 @@ static int nfs_flush_multi(struct nfs_pageio_descriptor *desc,
1086 size_t len = min(nbytes, wsize); 1073 size_t len = min(nbytes, wsize);
1087 1074
1088 data = nfs_pgio_data_alloc(hdr, 1); 1075 data = nfs_pgio_data_alloc(hdr, 1);
1089 if (!data) { 1076 if (!data)
1090 nfs_flush_error(desc, hdr); 1077 return nfs_pgio_error(desc, hdr);
1091 return -ENOMEM;
1092 }
1093 data->pages.pagevec[0] = page; 1078 data->pages.pagevec[0] = page;
1094 nfs_pgio_rpcsetup(data, len, offset, desc->pg_ioflags, &cinfo); 1079 nfs_pgio_rpcsetup(data, len, offset, desc->pg_ioflags, &cinfo);
1095 list_add(&data->list, &hdr->rpc_list); 1080 list_add(&data->list, &hdr->rpc_list);
@@ -1122,10 +1107,8 @@ static int nfs_flush_one(struct nfs_pageio_descriptor *desc,
1122 1107
1123 data = nfs_pgio_data_alloc(hdr, nfs_page_array_len(desc->pg_base, 1108 data = nfs_pgio_data_alloc(hdr, nfs_page_array_len(desc->pg_base,
1124 desc->pg_count)); 1109 desc->pg_count));
1125 if (!data) { 1110 if (!data)
1126 nfs_flush_error(desc, hdr); 1111 return nfs_pgio_error(desc, hdr);
1127 return -ENOMEM;
1128 }
1129 1112
1130 nfs_init_cinfo(&cinfo, desc->pg_inode, desc->pg_dreq); 1113 nfs_init_cinfo(&cinfo, desc->pg_inode, desc->pg_dreq);
1131 pages = data->pages.pagevec; 1114 pages = data->pages.pagevec;