summaryrefslogtreecommitdiff
path: root/fs/nfs/read.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-13 15:58:28 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-15 09:12:21 -0400
commit493292ddc78d18ee2ad2d5c24c2b7dd6a24641d2 (patch)
treecad42b32b7baa303189ddd6d791229c619f24f37 /fs/nfs/read.c
parentd9156f9f364897e93bdd98b4ad22138de18f7c24 (diff)
NFS: Move the pnfs read code into pnfs.c
...and ensure that we recoalese to take into account differences in block sizes when falling back to read through the MDS. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/read.c')
-rw-r--r--fs/nfs/read.c46
1 files changed, 20 insertions, 26 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 75088f58183..d2f53ddd826 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -67,7 +67,7 @@ void nfs_readdata_free(struct nfs_read_data *p)
mempool_free(p, nfs_rdata_mempool);
}
-static void nfs_readdata_release(struct nfs_read_data *rdata)
+void nfs_readdata_release(struct nfs_read_data *rdata)
{
put_lseg(rdata->lseg);
put_nfs_open_context(rdata->args.context);
@@ -120,6 +120,12 @@ void nfs_pageio_init_read_mds(struct nfs_pageio_descriptor *pgio,
}
EXPORT_SYMBOL_GPL(nfs_pageio_init_read_mds);
+void nfs_pageio_reset_read_mds(struct nfs_pageio_descriptor *pgio)
+{
+ pgio->pg_ops = &nfs_pageio_read_ops;
+ pgio->pg_bsize = NFS_SERVER(pgio->pg_inode)->rsize;
+}
+
static void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio,
struct inode *inode)
{
@@ -235,26 +241,16 @@ static void nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
}
static int nfs_do_read(struct nfs_read_data *data,
- const struct rpc_call_ops *call_ops,
- struct pnfs_layout_segment *lseg)
+ const struct rpc_call_ops *call_ops)
{
struct inode *inode = data->args.context->path.dentry->d_inode;
- if (lseg) {
- data->lseg = get_lseg(lseg);
- if (pnfs_try_to_read_data(data, call_ops) == PNFS_ATTEMPTED)
- return 0;
- put_lseg(data->lseg);
- data->lseg = NULL;
- }
-
return nfs_initiate_read(data, NFS_CLIENT(inode), call_ops);
}
static int
nfs_do_multiple_reads(struct list_head *head,
- const struct rpc_call_ops *call_ops,
- struct pnfs_layout_segment *lseg)
+ const struct rpc_call_ops *call_ops)
{
struct nfs_read_data *data;
int ret = 0;
@@ -265,7 +261,7 @@ nfs_do_multiple_reads(struct list_head *head,
data = list_entry(head->next, struct nfs_read_data, list);
list_del_init(&data->list);
- ret2 = nfs_do_read(data, call_ops, lseg);
+ ret2 = nfs_do_read(data, call_ops);
if (ret == 0)
ret = ret2;
}
@@ -373,25 +369,23 @@ out:
return ret;
}
-int nfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc)
+int nfs_generic_pagein(struct nfs_pageio_descriptor *desc, struct list_head *head)
+{
+ if (desc->pg_bsize < PAGE_CACHE_SIZE)
+ return nfs_pagein_multi(desc, head);
+ return nfs_pagein_one(desc, head);
+}
+
+static int nfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc)
{
LIST_HEAD(head);
int ret;
- if (desc->pg_bsize < PAGE_CACHE_SIZE)
- ret = nfs_pagein_multi(desc, &head);
- else
- ret = nfs_pagein_one(desc, &head);
-
+ ret = nfs_generic_pagein(desc, &head);
if (ret == 0)
- ret = nfs_do_multiple_reads(&head, desc->pg_rpc_callops,
- desc->pg_lseg);
- put_lseg(desc->pg_lseg);
- desc->pg_lseg = NULL;
+ ret = nfs_do_multiple_reads(&head, desc->pg_rpc_callops);
return ret;
}
-EXPORT_SYMBOL_GPL(nfs_generic_pg_readpages);
-
static const struct nfs_pageio_ops nfs_pageio_read_ops = {
.pg_test = nfs_generic_pg_test,