aboutsummaryrefslogtreecommitdiff
path: root/fs/nfs/read.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2011-06-10 13:30:23 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-12 13:40:28 -0400
commitd8007d4dd6ff8749cc8a4063c3ec87442db76d82 (patch)
treef778176d24666f2e2c7cd7ef4dc5917aa11cc207 /fs/nfs/read.c
parent1751c3638f2a07a8c66a803a31791bab9bd3fced (diff)
NFSv4.1: Add an initialisation callback for pNFS
Ensure that we always get a layout before setting up the i/o request. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/read.c')
-rw-r--r--fs/nfs/read.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index b6d9ec9a208..2cf728b832c 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -147,9 +147,7 @@ int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode,
zero_user_segment(page, len, PAGE_CACHE_SIZE);
nfs_pageio_init_read(&pgio, inode);
- nfs_list_add_request(new, &pgio.pg_list);
- pgio.pg_count = len;
-
+ nfs_pageio_add_request(&pgio, new);
nfs_pageio_complete(&pgio);
return 0;
}
@@ -281,7 +279,7 @@ static int nfs_pagein_multi(struct nfs_pageio_descriptor *desc)
unsigned int offset;
int requests = 0;
int ret = 0;
- struct pnfs_layout_segment *lseg;
+ struct pnfs_layout_segment *lseg = desc->pg_lseg;
LIST_HEAD(list);
nfs_list_remove_request(req);
@@ -299,10 +297,6 @@ static int nfs_pagein_multi(struct nfs_pageio_descriptor *desc)
} while(nbytes != 0);
atomic_set(&req->wb_complete, requests);
- BUG_ON(desc->pg_lseg != NULL);
- lseg = pnfs_update_layout(desc->pg_inode, req->wb_context,
- req_offset(req), desc->pg_count,
- IOMODE_READ, GFP_KERNEL);
ClearPageError(page);
offset = 0;
nbytes = desc->pg_count;
@@ -336,6 +330,8 @@ out_bad:
}
SetPageError(page);
nfs_readpage_release(req);
+ put_lseg(lseg);
+ desc->pg_lseg = NULL;
return -ENOMEM;
}
@@ -364,10 +360,6 @@ static int nfs_pagein_one(struct nfs_pageio_descriptor *desc)
*pages++ = req->wb_page;
}
req = nfs_list_entry(data->pages.next);
- if ((!lseg) && list_is_singular(&data->pages))
- lseg = pnfs_update_layout(desc->pg_inode, req->wb_context,
- req_offset(req), desc->pg_count,
- IOMODE_READ, GFP_KERNEL);
ret = nfs_read_rpcsetup(req, data, &nfs_read_full_ops, desc->pg_count,
0, lseg);