diff mbox

[RFC,3/3] NFS41: send real read size in layoutget for DIO

Message ID 1344391392-1948-4-git-send-email-bergwolf@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peng Tao Aug. 8, 2012, 2:03 a.m. UTC
From: Peng Tao <tao.peng@emc.com>

We don't have the real IO size information in buffer read, but for direct
read, we can get it from dreq->bytes_left. Let's make use of it.

Signed-off-by: Peng Tao <tao.peng@emc.com>
---
 fs/nfs/pnfs.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

Comments

Trond Myklebust Aug. 8, 2012, 6:57 p.m. UTC | #1
On Wed, 2012-08-08 at 10:03 +0800, Peng Tao wrote:
> From: Peng Tao <tao.peng@emc.com>

> 

> We don't have the real IO size information in buffer read, but for direct

> read, we can get it from dreq->bytes_left. Let's make use of it.


What's wrong with using the nfs_readpages arguments? The readahead code
will tell you exactly how many pages it is trying to read.

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com
diff mbox

Patch

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index e61a373..e4cfd1e 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1154,16 +1154,22 @@  out_forget_reply:
 void
 pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
 {
+	u64 rd_size = req->wb_bytes;
+
 	BUG_ON(pgio->pg_lseg != NULL);
 
 	if (req->wb_offset != req->wb_pgbase) {
 		nfs_pageio_reset_read_mds(pgio);
 		return;
 	}
+
+	if (pgio->pg_dreq != NULL)
+		rd_size = nfs_dreq_bytes_left(pgio->pg_dreq);
+
 	pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
 					   req->wb_context,
 					   req_offset(req),
-					   req->wb_bytes,
+					   rd_size,
 					   IOMODE_READ,
 					   GFP_KERNEL);
 	/* If no lseg, fall back to read through mds */