From: Peng Tao <bergwolf@gmail.com>
To: Trond.Myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, bharrosh@panasas.com,
Peng Tao <tao.peng@emc.com>
Subject: [PATCH-v2 3/3] NFS41: send real read size in layoutget
Date: Mon, 13 Aug 2012 22:39:36 +0800 [thread overview]
Message-ID: <1344868776-1739-3-git-send-email-bergwolf@gmail.com> (raw)
In-Reply-To: <1344868776-1739-1-git-send-email-bergwolf@gmail.com>
For buffer read, use offst-to-isize.
For direct read, use dreq->bytes_left.
Signed-off-by: Peng Tao <tao.peng@emc.com>
---
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 d1da23a..49d2f2d 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1154,16 +1154,24 @@ 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 = i_size_read(pgio->pg_inode) - req_offset(req);
+ else
+ 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 */
--
1.7.1.262.g5ef3d
prev parent reply other threads:[~2012-08-13 14:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-13 14:39 [PATCH-v2 1/3] NFS: track direct IO left bytes Peng Tao
2012-08-13 14:39 ` [PATCH-v2 2/3] NFS41: send real write size in layoutget Peng Tao
2012-08-13 23:53 ` Boaz Harrosh
2012-08-14 10:05 ` Peng, Tao
2012-08-14 0:42 ` Myklebust, Trond
2012-08-14 10:08 ` Peng, Tao
2012-08-14 10:57 ` Boaz Harrosh
2012-08-14 11:21 ` Peng, Tao
2012-08-13 14:39 ` Peng Tao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1344868776-1739-3-git-send-email-bergwolf@gmail.com \
--to=bergwolf@gmail.com \
--cc=Trond.Myklebust@netapp.com \
--cc=bharrosh@panasas.com \
--cc=linux-nfs@vger.kernel.org \
--cc=tao.peng@emc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).