|
@@ -87,31 +87,6 @@ struct nfs_rw_header *nfs_writehdr_alloc(void)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(nfs_writehdr_alloc);
|
|
EXPORT_SYMBOL_GPL(nfs_writehdr_alloc);
|
|
|
|
|
|
-static struct nfs_pgio_data *nfs_writedata_alloc(struct nfs_pgio_header *hdr,
|
|
|
|
- unsigned int pagecount)
|
|
|
|
-{
|
|
|
|
- struct nfs_pgio_data *data, *prealloc;
|
|
|
|
-
|
|
|
|
- prealloc = &container_of(hdr, struct nfs_rw_header, header)->rpc_data;
|
|
|
|
- if (prealloc->header == NULL)
|
|
|
|
- data = prealloc;
|
|
|
|
- else
|
|
|
|
- data = kzalloc(sizeof(*data), GFP_KERNEL);
|
|
|
|
- if (!data)
|
|
|
|
- goto out;
|
|
|
|
-
|
|
|
|
- if (nfs_pgarray_set(&data->pages, pagecount)) {
|
|
|
|
- data->header = hdr;
|
|
|
|
- atomic_inc(&hdr->refcnt);
|
|
|
|
- } else {
|
|
|
|
- if (data != prealloc)
|
|
|
|
- kfree(data);
|
|
|
|
- data = NULL;
|
|
|
|
- }
|
|
|
|
-out:
|
|
|
|
- return data;
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
void nfs_writehdr_free(struct nfs_pgio_header *hdr)
|
|
void nfs_writehdr_free(struct nfs_pgio_header *hdr)
|
|
{
|
|
{
|
|
struct nfs_rw_header *whdr = container_of(hdr, struct nfs_rw_header, header);
|
|
struct nfs_rw_header *whdr = container_of(hdr, struct nfs_rw_header, header);
|
|
@@ -119,27 +94,6 @@ void nfs_writehdr_free(struct nfs_pgio_header *hdr)
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(nfs_writehdr_free);
|
|
EXPORT_SYMBOL_GPL(nfs_writehdr_free);
|
|
|
|
|
|
-void nfs_writedata_release(struct nfs_pgio_data *wdata)
|
|
|
|
-{
|
|
|
|
- struct nfs_pgio_header *hdr = wdata->header;
|
|
|
|
- struct nfs_rw_header *write_header = container_of(hdr, struct nfs_rw_header, header);
|
|
|
|
-
|
|
|
|
- put_nfs_open_context(wdata->args.context);
|
|
|
|
- if (wdata->pages.pagevec != wdata->pages.page_array)
|
|
|
|
- kfree(wdata->pages.pagevec);
|
|
|
|
- if (wdata == &write_header->rpc_data) {
|
|
|
|
- wdata->header = NULL;
|
|
|
|
- wdata = NULL;
|
|
|
|
- }
|
|
|
|
- if (atomic_dec_and_test(&hdr->refcnt))
|
|
|
|
- hdr->completion_ops->completion(hdr);
|
|
|
|
- /* Note: we only free the rpc_task after callbacks are done.
|
|
|
|
- * See the comment in rpc_free_task() for why
|
|
|
|
- */
|
|
|
|
- kfree(wdata);
|
|
|
|
-}
|
|
|
|
-EXPORT_SYMBOL_GPL(nfs_writedata_release);
|
|
|
|
-
|
|
|
|
static void nfs_context_set_write_error(struct nfs_open_context *ctx, int error)
|
|
static void nfs_context_set_write_error(struct nfs_open_context *ctx, int error)
|
|
{
|
|
{
|
|
ctx->error = error;
|
|
ctx->error = error;
|
|
@@ -1146,7 +1100,7 @@ static void nfs_flush_error(struct nfs_pageio_descriptor *desc,
|
|
struct nfs_pgio_data *data = list_first_entry(&hdr->rpc_list,
|
|
struct nfs_pgio_data *data = list_first_entry(&hdr->rpc_list,
|
|
struct nfs_pgio_data, list);
|
|
struct nfs_pgio_data, list);
|
|
list_del(&data->list);
|
|
list_del(&data->list);
|
|
- nfs_writedata_release(data);
|
|
|
|
|
|
+ nfs_pgio_data_release(data);
|
|
}
|
|
}
|
|
desc->pg_completion_ops->error_cleanup(&desc->pg_list);
|
|
desc->pg_completion_ops->error_cleanup(&desc->pg_list);
|
|
}
|
|
}
|
|
@@ -1179,7 +1133,7 @@ static int nfs_flush_multi(struct nfs_pageio_descriptor *desc,
|
|
do {
|
|
do {
|
|
size_t len = min(nbytes, wsize);
|
|
size_t len = min(nbytes, wsize);
|
|
|
|
|
|
- data = nfs_writedata_alloc(hdr, 1);
|
|
|
|
|
|
+ data = nfs_pgio_data_alloc(hdr, 1);
|
|
if (!data) {
|
|
if (!data) {
|
|
nfs_flush_error(desc, hdr);
|
|
nfs_flush_error(desc, hdr);
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
@@ -1214,7 +1168,7 @@ static int nfs_flush_one(struct nfs_pageio_descriptor *desc,
|
|
struct list_head *head = &desc->pg_list;
|
|
struct list_head *head = &desc->pg_list;
|
|
struct nfs_commit_info cinfo;
|
|
struct nfs_commit_info cinfo;
|
|
|
|
|
|
- data = nfs_writedata_alloc(hdr, nfs_page_array_len(desc->pg_base,
|
|
|
|
|
|
+ data = nfs_pgio_data_alloc(hdr, nfs_page_array_len(desc->pg_base,
|
|
desc->pg_count));
|
|
desc->pg_count));
|
|
if (!data) {
|
|
if (!data) {
|
|
nfs_flush_error(desc, hdr);
|
|
nfs_flush_error(desc, hdr);
|
|
@@ -1348,7 +1302,7 @@ static void nfs_writeback_release_common(void *calldata)
|
|
set_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags);
|
|
set_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags);
|
|
spin_unlock(&hdr->lock);
|
|
spin_unlock(&hdr->lock);
|
|
}
|
|
}
|
|
- nfs_writedata_release(data);
|
|
|
|
|
|
+ nfs_pgio_data_release(data);
|
|
}
|
|
}
|
|
|
|
|
|
static const struct rpc_call_ops nfs_write_common_ops = {
|
|
static const struct rpc_call_ops nfs_write_common_ops = {
|