From: Benny Halevy <bhalevy@tonian.com>
To: Peng Tao <bergwolf@gmail.com>
Cc: Trond.Myklebust@netapp.com, linux-nfs@vger.kernel.org,
Peng Tao <peng_tao@emc.com>
Subject: Re: [PATCH 3/4] nfsv41: get lseg before issue LD IO if pgio doesn't carry lseg
Date: Wed, 30 Nov 2011 15:01:03 +0200 [thread overview]
Message-ID: <4ED6290F.4020407@tonian.com> (raw)
In-Reply-To: <1322887965-2938-4-git-send-email-bergwolf@gmail.com>
On 2011-12-03 06:52, Peng Tao wrote:
> This gives LD option not to ask for layout in pg_init.
>
> Signed-off-by: Peng Tao <peng_tao@emc.com>
> ---
> fs/nfs/pnfs.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 46 insertions(+), 0 deletions(-)
>
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index 734e670..c8dc0b1 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -1254,6 +1254,7 @@ pnfs_do_multiple_writes(struct nfs_pageio_descriptor *desc, struct list_head *he
> struct nfs_write_data *data;
> const struct rpc_call_ops *call_ops = desc->pg_rpc_callops;
> struct pnfs_layout_segment *lseg = desc->pg_lseg;
> + const bool has_lseg = !!lseg;
nit: "has_lseg = (lseg != NULL)" would be more straight forward IMO
>
> desc->pg_lseg = NULL;
> while (!list_empty(head)) {
> @@ -1262,7 +1263,29 @@ pnfs_do_multiple_writes(struct nfs_pageio_descriptor *desc, struct list_head *he
> data = list_entry(head->next, struct nfs_write_data, list);
> list_del_init(&data->list);
>
> + if (!has_lseg) {
> + struct nfs_page *req = nfs_list_entry(data->pages.next);
> + __u64 length = data->npages << PAGE_CACHE_SHIFT;
> +
> + lseg = pnfs_update_layout(desc->pg_inode,
> + req->wb_context,
> + req_offset(req),
> + length,
> + IOMODE_RW,
> + GFP_NOFS);
> + if (!lseg || length > (lseg->pls_range.length)) {
I'm concerned about the 'length' part of this condition.
pnfs_try_to_write_data should handle short writes/reads and
we should be able to iterate through the I/O using different
layout segments.
> + put_lseg(lseg);
> + lseg = NULL;
> + pnfs_write_through_mds(desc,data);
> + continue;
> + }
> + }
> +
> trypnfs = pnfs_try_to_write_data(data, call_ops, lseg, how);
> + if (!has_lseg) {
> + put_lseg(lseg);
> + lseg = NULL;
> + }
We had an implementation in the past that saved the most recent lseg in 'desc'
so it could be used for the remaining requests. Once exhausted, you can
look for a new one.
> if (trypnfs == PNFS_NOT_ATTEMPTED)
> pnfs_write_through_mds(desc, data);
> }
> @@ -1350,6 +1373,7 @@ pnfs_do_multiple_reads(struct nfs_pageio_descriptor *desc, struct list_head *hea
> struct nfs_read_data *data;
> const struct rpc_call_ops *call_ops = desc->pg_rpc_callops;
> struct pnfs_layout_segment *lseg = desc->pg_lseg;
> + const bool has_lseg = !!lseg;
ditto
>
> desc->pg_lseg = NULL;
> while (!list_empty(head)) {
> @@ -1358,7 +1382,29 @@ pnfs_do_multiple_reads(struct nfs_pageio_descriptor *desc, struct list_head *hea
> data = list_entry(head->next, struct nfs_read_data, list);
> list_del_init(&data->list);
>
> + if (!has_lseg) {
> + struct nfs_page *req = nfs_list_entry(data->pages.next);
> + __u64 length = data->npages << PAGE_CACHE_SHIFT;
> +
> + lseg = pnfs_update_layout(desc->pg_inode,
> + req->wb_context,
> + req_offset(req),
> + length,
> + IOMODE_READ,
> + GFP_KERNEL);
> + if (!lseg || length > lseg->pls_range.length) {
> + put_lseg(lseg);
> + lseg = NULL;
> + pnfs_read_through_mds(desc, data);
> + continue;
> + }
> + }
> +
> trypnfs = pnfs_try_to_read_data(data, call_ops, lseg);
> + if (!has_lseg) {
> + put_lseg(lseg);
> + lseg = NULL;
> + }
ditto
Benny
> if (trypnfs == PNFS_NOT_ATTEMPTED)
> pnfs_read_through_mds(desc, data);
> }
next prev parent reply other threads:[~2011-11-30 13:01 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-03 4:52 [PATCH 0/4] nfs41: allow layoutget at pnfs_do_multiple_writes Peng Tao
2011-11-29 21:34 ` Boaz Harrosh
2011-11-29 21:50 ` Boaz Harrosh
2011-11-29 21:57 ` Trond Myklebust
2011-11-29 22:40 ` Boaz Harrosh
2011-11-29 22:47 ` Trond Myklebust
2011-11-29 22:58 ` Boaz Harrosh
2011-11-29 23:30 ` Trond Myklebust
2011-11-29 23:49 ` Marc Eshel
2011-11-30 0:08 ` Trond Myklebust
2011-11-30 0:20 ` Marc Eshel
2011-11-30 0:37 ` Trond Myklebust
2011-11-30 0:50 ` Boaz Harrosh
2011-11-30 19:39 ` J. Bruce Fields
2011-11-30 0:52 ` Marc Eshel
2011-11-30 19:44 ` J. Bruce Fields
2011-12-01 9:47 ` Benny Halevy
2011-12-01 11:14 ` J. Bruce Fields
2011-12-01 11:48 ` J. Bruce Fields
2011-11-30 0:42 ` Boaz Harrosh
2011-11-30 0:24 ` Boaz Harrosh
2011-11-30 0:58 ` Trond Myklebust
2011-11-30 1:46 ` Boaz Harrosh
2011-11-30 2:07 ` Trond Myklebust
2011-11-30 3:08 ` Boaz Harrosh
2011-11-30 12:33 ` Benny Halevy
2011-11-30 0:37 ` Matt W. Benjamin
2011-11-30 0:48 ` Matt W. Benjamin
2011-11-30 1:01 ` Trond Myklebust
2011-11-30 1:03 ` Matt W. Benjamin
2011-11-29 23:01 ` Trond Myklebust
2011-11-29 23:47 ` Boaz Harrosh
2011-11-30 3:16 ` tao.peng
2011-11-30 3:50 ` Boaz Harrosh
2011-11-30 5:05 ` tao.peng
2011-11-30 12:42 ` Benny Halevy
2011-12-03 4:52 ` [PATCH 1/4] nfsv41: export pnfs_find_alloc_layout Peng Tao
2011-12-03 4:52 ` [PATCH 2/4] nfsv41: add and export pnfs_find_get_layout_locked Peng Tao
2011-12-03 4:52 ` [PATCH 3/4] nfsv41: get lseg before issue LD IO if pgio doesn't carry lseg Peng Tao
2011-11-30 13:01 ` Benny Halevy [this message]
2011-11-30 13:20 ` Peng Tao
2011-12-03 4:52 ` [PATCH 4/4] pnfsblock: do ask for layout in pg_init Peng Tao
2011-11-29 16:40 ` Trond Myklebust
2011-11-29 17:25 ` Peng Tao
2011-11-29 17:43 ` Trond Myklebust
2011-11-30 2:55 ` tao.peng
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=4ED6290F.4020407@tonian.com \
--to=bhalevy@tonian.com \
--cc=Trond.Myklebust@netapp.com \
--cc=bergwolf@gmail.com \
--cc=linux-nfs@vger.kernel.org \
--cc=peng_tao@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).