diff options
-rw-r--r-- | fs/nfs/internal.h | 1 | ||||
-rw-r--r-- | fs/nfs/pagelist.c | 20 | ||||
-rw-r--r-- | fs/nfs/read.c | 25 | ||||
-rw-r--r-- | fs/nfs/write.c | 25 |
4 files changed, 29 insertions, 42 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 519864b3296a..a4b9e754756b 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -242,6 +242,7 @@ struct nfs_rw_header *nfs_rw_header_alloc(const struct nfs_rw_ops *); | |||
242 | void nfs_rw_header_free(struct nfs_pgio_header *); | 242 | void nfs_rw_header_free(struct nfs_pgio_header *); |
243 | struct nfs_pgio_data *nfs_pgio_data_alloc(struct nfs_pgio_header *, unsigned int); | 243 | struct nfs_pgio_data *nfs_pgio_data_alloc(struct nfs_pgio_header *, unsigned int); |
244 | void nfs_pgio_data_release(struct nfs_pgio_data *); | 244 | void nfs_pgio_data_release(struct nfs_pgio_data *); |
245 | int nfs_pgio_error(struct nfs_pageio_descriptor *, struct nfs_pgio_header *); | ||
245 | void nfs_pgio_rpcsetup(struct nfs_pgio_data *, unsigned int, unsigned int, int, | 246 | void nfs_pgio_rpcsetup(struct nfs_pgio_data *, unsigned int, unsigned int, int, |
246 | struct nfs_commit_info *); | 247 | struct nfs_commit_info *); |
247 | 248 | ||
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 | |||
@@ -447,6 +447,26 @@ static void nfs_pgio_prepare(struct rpc_task *task, void *calldata) | |||
447 | } | 447 | } |
448 | 448 | ||
449 | /** | 449 | /** |
450 | * nfs_pgio_error - Clean up from a pageio error | ||
451 | * @desc: IO descriptor | ||
452 | * @hdr: pageio header | ||
453 | */ | ||
454 | int nfs_pgio_error(struct nfs_pageio_descriptor *desc, | ||
455 | struct nfs_pgio_header *hdr) | ||
456 | { | ||
457 | struct nfs_pgio_data *data; | ||
458 | |||
459 | set_bit(NFS_IOHDR_REDO, &hdr->flags); | ||
460 | while (!list_empty(&hdr->rpc_list)) { | ||
461 | data = list_first_entry(&hdr->rpc_list, struct nfs_pgio_data, list); | ||
462 | list_del(&data->list); | ||
463 | nfs_pgio_data_release(data); | ||
464 | } | ||
465 | desc->pg_completion_ops->error_cleanup(&desc->pg_list); | ||
466 | return -ENOMEM; | ||
467 | } | ||
468 | |||
469 | /** | ||
450 | * nfs_pgio_release - Release pageio data | 470 | * nfs_pgio_release - Release pageio data |
451 | * @calldata: The pageio data to release | 471 | * @calldata: The pageio data to release |
452 | */ | 472 | */ |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 0c88c60fbee9..64f8eefec76a 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -237,19 +237,6 @@ static const struct nfs_pgio_completion_ops nfs_async_read_completion_ops = { | |||
237 | .completion = nfs_read_completion, | 237 | .completion = nfs_read_completion, |
238 | }; | 238 | }; |
239 | 239 | ||
240 | static void nfs_pagein_error(struct nfs_pageio_descriptor *desc, | ||
241 | struct nfs_pgio_header *hdr) | ||
242 | { | ||
243 | set_bit(NFS_IOHDR_REDO, &hdr->flags); | ||
244 | while (!list_empty(&hdr->rpc_list)) { | ||
245 | struct nfs_pgio_data *data = list_first_entry(&hdr->rpc_list, | ||
246 | struct nfs_pgio_data, list); | ||
247 | list_del(&data->list); | ||
248 | nfs_pgio_data_release(data); | ||
249 | } | ||
250 | desc->pg_completion_ops->error_cleanup(&desc->pg_list); | ||
251 | } | ||
252 | |||
253 | /* | 240 | /* |
254 | * Generate multiple requests to fill a single page. | 241 | * Generate multiple requests to fill a single page. |
255 | * | 242 | * |
@@ -278,10 +265,8 @@ static int nfs_pagein_multi(struct nfs_pageio_descriptor *desc, | |||
278 | size_t len = min(nbytes,rsize); | 265 | size_t len = min(nbytes,rsize); |
279 | 266 | ||
280 | data = nfs_pgio_data_alloc(hdr, 1); | 267 | data = nfs_pgio_data_alloc(hdr, 1); |
281 | if (!data) { | 268 | if (!data) |
282 | nfs_pagein_error(desc, hdr); | 269 | return nfs_pgio_error(desc, hdr); |
283 | return -ENOMEM; | ||
284 | } | ||
285 | data->pages.pagevec[0] = page; | 270 | data->pages.pagevec[0] = page; |
286 | nfs_pgio_rpcsetup(data, len, offset, 0, NULL); | 271 | nfs_pgio_rpcsetup(data, len, offset, 0, NULL); |
287 | list_add(&data->list, &hdr->rpc_list); | 272 | list_add(&data->list, &hdr->rpc_list); |
@@ -305,10 +290,8 @@ static int nfs_pagein_one(struct nfs_pageio_descriptor *desc, | |||
305 | 290 | ||
306 | data = nfs_pgio_data_alloc(hdr, nfs_page_array_len(desc->pg_base, | 291 | data = nfs_pgio_data_alloc(hdr, nfs_page_array_len(desc->pg_base, |
307 | desc->pg_count)); | 292 | desc->pg_count)); |
308 | if (!data) { | 293 | if (!data) |
309 | nfs_pagein_error(desc, hdr); | 294 | return nfs_pgio_error(desc, hdr); |
310 | return -ENOMEM; | ||
311 | } | ||
312 | 295 | ||
313 | pages = data->pages.pagevec; | 296 | pages = data->pages.pagevec; |
314 | while (!list_empty(head)) { | 297 | while (!list_empty(head)) { |
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 | ||
1047 | static 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; |