NFS: create common nfs_pgio_header for both read and write
In order to avoid duplicating all the data in nfs_read_data whenever we split it up into multiple RPC calls (either due to a short read result or due to rsize < PAGE_SIZE), we split out the bits that are the same per RPC call into a separate "header" structure. The goal this patch moves towards is to have a single header refcounted by several rpc_data structures. Thus, want to always refer from rpc_data to the header, and not the other way. This patch comes close to that ideal, but the directio code currently needs some special casing, isolated in the nfs_direct_[read_write]hdr_release() functions. This will be dealt with in a future patch. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:

committed by
Trond Myklebust

parent
b554284976
commit
cd841605f7
@@ -440,11 +440,12 @@ static void _read_done(struct ore_io_state *ios, void *private)
|
||||
|
||||
int objio_read_pagelist(struct nfs_read_data *rdata)
|
||||
{
|
||||
struct nfs_pgio_header *hdr = rdata->header;
|
||||
struct objio_state *objios;
|
||||
int ret;
|
||||
|
||||
ret = objio_alloc_io_state(NFS_I(rdata->inode)->layout, true,
|
||||
rdata->lseg, rdata->args.pages, rdata->args.pgbase,
|
||||
ret = objio_alloc_io_state(NFS_I(hdr->inode)->layout, true,
|
||||
hdr->lseg, rdata->args.pages, rdata->args.pgbase,
|
||||
rdata->args.offset, rdata->args.count, rdata,
|
||||
GFP_KERNEL, &objios);
|
||||
if (unlikely(ret))
|
||||
@@ -483,12 +484,12 @@ static struct page *__r4w_get_page(void *priv, u64 offset, bool *uptodate)
|
||||
{
|
||||
struct objio_state *objios = priv;
|
||||
struct nfs_write_data *wdata = objios->oir.rpcdata;
|
||||
struct address_space *mapping = wdata->header->inode->i_mapping;
|
||||
pgoff_t index = offset / PAGE_SIZE;
|
||||
struct page *page = find_get_page(wdata->inode->i_mapping, index);
|
||||
struct page *page = find_get_page(mapping, index);
|
||||
|
||||
if (!page) {
|
||||
page = find_or_create_page(wdata->inode->i_mapping,
|
||||
index, GFP_NOFS);
|
||||
page = find_or_create_page(mapping, index, GFP_NOFS);
|
||||
if (unlikely(!page)) {
|
||||
dprintk("%s: grab_cache_page Failed index=0x%lx\n",
|
||||
__func__, index);
|
||||
@@ -518,11 +519,12 @@ static const struct _ore_r4w_op _r4w_op = {
|
||||
|
||||
int objio_write_pagelist(struct nfs_write_data *wdata, int how)
|
||||
{
|
||||
struct nfs_pgio_header *hdr = wdata->header;
|
||||
struct objio_state *objios;
|
||||
int ret;
|
||||
|
||||
ret = objio_alloc_io_state(NFS_I(wdata->inode)->layout, false,
|
||||
wdata->lseg, wdata->args.pages, wdata->args.pgbase,
|
||||
ret = objio_alloc_io_state(NFS_I(hdr->inode)->layout, false,
|
||||
hdr->lseg, wdata->args.pages, wdata->args.pgbase,
|
||||
wdata->args.offset, wdata->args.count, wdata, GFP_NOFS,
|
||||
&objios);
|
||||
if (unlikely(ret))
|
||||
|
Reference in New Issue
Block a user