Skip to content

Commit 1fd937b

Browse files
bergwolfTrond Myklebust
authored andcommitted
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>
1 parent 6296556 commit 1fd937b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

fs/nfs/pnfs.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,16 +1220,24 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
12201220
void
12211221
pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
12221222
{
1223+
u64 rd_size = req->wb_bytes;
1224+
12231225
BUG_ON(pgio->pg_lseg != NULL);
12241226

12251227
if (req->wb_offset != req->wb_pgbase) {
12261228
nfs_pageio_reset_read_mds(pgio);
12271229
return;
12281230
}
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+
12291237
pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
12301238
req->wb_context,
12311239
req_offset(req),
1232-
req->wb_bytes,
1240+
rd_size,
12331241
IOMODE_READ,
12341242
GFP_KERNEL);
12351243
/* If no lseg, fall back to read through mds */

0 commit comments

Comments
 (0)