diff options
author | Peng Tao <bergwolf@gmail.com> | 2012-09-25 02:55:57 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-08 19:32:34 -0400 |
commit | 1fd937bd7583e618df0528f0268b210f265d6910 (patch) | |
tree | 6cc162c459c5acbe7f3126cb8159e500f9dd6e38 /fs/nfs/pnfs.c | |
parent | 6296556f0b31eaff29f2a3aee2c17b7eae895b98 (diff) |
NFS41: send real read size in layoutget
For buffer read, use offst-to-isize.
For direct read, use dreq->bytes_left.
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r-- | fs/nfs/pnfs.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 9a2bcce45282..fe624c91bd00 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -1220,16 +1220,24 @@ out_forget_reply: | |||
1220 | void | 1220 | void |
1221 | pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) | 1221 | pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) |
1222 | { | 1222 | { |
1223 | u64 rd_size = req->wb_bytes; | ||
1224 | |||
1223 | BUG_ON(pgio->pg_lseg != NULL); | 1225 | BUG_ON(pgio->pg_lseg != NULL); |
1224 | 1226 | ||
1225 | if (req->wb_offset != req->wb_pgbase) { | 1227 | if (req->wb_offset != req->wb_pgbase) { |
1226 | nfs_pageio_reset_read_mds(pgio); | 1228 | nfs_pageio_reset_read_mds(pgio); |
1227 | return; | 1229 | return; |
1228 | } | 1230 | } |
1231 | |||
1232 | if (pgio->pg_dreq == NULL) | ||
1233 | rd_size = i_size_read(pgio->pg_inode) - req_offset(req); | ||
1234 | else | ||
1235 | rd_size = nfs_dreq_bytes_left(pgio->pg_dreq); | ||
1236 | |||
1229 | pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, | 1237 | pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode, |
1230 | req->wb_context, | 1238 | req->wb_context, |
1231 | req_offset(req), | 1239 | req_offset(req), |
1232 | req->wb_bytes, | 1240 | rd_size, |
1233 | IOMODE_READ, | 1241 | IOMODE_READ, |
1234 | GFP_KERNEL); | 1242 | GFP_KERNEL); |
1235 | /* If no lseg, fall back to read through mds */ | 1243 | /* If no lseg, fall back to read through mds */ |