void nfs_rw_header_free(struct nfs_pgio_header *);
struct nfs_pgio_data *nfs_pgio_data_alloc(struct nfs_pgio_header *, unsigned int);
void nfs_pgio_data_release(struct nfs_pgio_data *);
+int nfs_pgio_error(struct nfs_pageio_descriptor *, struct nfs_pgio_header *);
void nfs_pgio_rpcsetup(struct nfs_pgio_data *, unsigned int, unsigned int, int,
struct nfs_commit_info *);
}
/**
+ * 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
*/
.completion = nfs_read_completion,
};
-static void nfs_pagein_error(struct nfs_pageio_descriptor *desc,
- struct nfs_pgio_header *hdr)
-{
- set_bit(NFS_IOHDR_REDO, &hdr->flags);
- while (!list_empty(&hdr->rpc_list)) {
- struct nfs_pgio_data *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);
-}
-
/*
* Generate multiple requests to fill a single page.
*
size_t len = min(nbytes,rsize);
data = nfs_pgio_data_alloc(hdr, 1);
- if (!data) {
- nfs_pagein_error(desc, hdr);
- return -ENOMEM;
- }
+ if (!data)
+ return nfs_pgio_error(desc, hdr);
data->pages.pagevec[0] = page;
nfs_pgio_rpcsetup(data, len, offset, 0, NULL);
list_add(&data->list, &hdr->rpc_list);
data = nfs_pgio_data_alloc(hdr, nfs_page_array_len(desc->pg_base,
desc->pg_count));
- if (!data) {
- nfs_pagein_error(desc, hdr);
- return -ENOMEM;
- }
+ if (!data)
+ return nfs_pgio_error(desc, hdr);
pages = data->pages.pagevec;
while (!list_empty(head)) {
.completion = nfs_write_completion,
};
-static void nfs_flush_error(struct nfs_pageio_descriptor *desc,
- struct nfs_pgio_header *hdr)
-{
- set_bit(NFS_IOHDR_REDO, &hdr->flags);
- while (!list_empty(&hdr->rpc_list)) {
- struct nfs_pgio_data *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);
-}
-
/*
* Generate multiple small requests to write out a single
* contiguous dirty area on one page.
size_t len = min(nbytes, wsize);
data = nfs_pgio_data_alloc(hdr, 1);
- if (!data) {
- nfs_flush_error(desc, hdr);
- return -ENOMEM;
- }
+ if (!data)
+ return nfs_pgio_error(desc, hdr);
data->pages.pagevec[0] = page;
nfs_pgio_rpcsetup(data, len, offset, desc->pg_ioflags, &cinfo);
list_add(&data->list, &hdr->rpc_list);
data = nfs_pgio_data_alloc(hdr, nfs_page_array_len(desc->pg_base,
desc->pg_count));
- if (!data) {
- nfs_flush_error(desc, hdr);
- return -ENOMEM;
- }
+ if (!data)
+ return nfs_pgio_error(desc, hdr);
nfs_init_cinfo(&cinfo, desc->pg_inode, desc->pg_dreq);
pages = data->pages.pagevec;