linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fred Isaman <iisaman@netapp.com>
To: Benny Halevy <bhalevy@panasas.com>
Cc: andros@netapp.com, trond.myklebust@netapp.com,
	linux-nfs@vger.kernel.org, Andy Adamon <andros@citi.umich.edu>,
	Dean Hildebrand <dhildeb@us.ibm.com>,
	Boaz Harrosh <bharrosh@panasas.com>,
	Oleg Drokin <green@linuxhacker.ru>
Subject: Re: [PATCH pNFS wave 3 Version 2 10/18] NFSv4.1: shift pnfs_update_layout locations
Date: Wed, 16 Feb 2011 16:09:54 -0500	[thread overview]
Message-ID: <AANLkTim04-f5ittgAQf9Q1fp7NsXXLk9MC4-NAS9mdd5@mail.gmail.com> (raw)
In-Reply-To: <4D5C2ED8.1030200@panasas.com>

On Wed, Feb 16, 2011 at 3:08 PM, Benny Halevy <bhalevy@panasas.com> wrote:
> On 2011-02-16 14:55, Fred Isaman wrote:
>>
>> On Feb 16, 2011, at 2:42 PM, Benny Halevy wrote:
>>
>>> On 2011-02-15 03:38, andros@netapp.com wrote:
>>>> From: Fred Isaman <iisaman@netapp.com>
>>>>
>>>> Move the pnfs_update_layout call location to nfs_pageio_do_add_request().
>>>> Grab the lseg sent in the doio function to nfs_read_rpcsetup and attach
>>>> it to each nfs_read_data so it can be sent to the layout driver.
>>>>
>>>> @@ -131,10 +132,12 @@ int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode,
>>>>             zero_user_segment(page, len, PAGE_CACHE_SIZE);
>>>>
>>>>     nfs_list_add_request(new, &one_request);
>>>> +   lseg = pnfs_update_layout(inode, ctx, IOMODE_READ);
>>>>     if (NFS_SERVER(inode)->rsize < PAGE_CACHE_SIZE)
>>>> -           nfs_pagein_multi(inode, &one_request, 1, len, 0);
>>>> +           nfs_pagein_multi(inode, &one_request, 1, len, 0, lseg);
>>>>     else
>>>> -           nfs_pagein_one(inode, &one_request, 1, len, 0);
>>>> +           nfs_pagein_one(inode, &one_request, 1, len, 0, lseg);
>>>> +   put_lseg(lseg);
>>>>     return 0;
>>>> }
>>>>
>>>> @@ -160,7 +163,8 @@ static void nfs_readpage_release(struct nfs_page *req)
>>>>  */
>>>> static int nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
>>>>             const struct rpc_call_ops *call_ops,
>>>> -           unsigned int count, unsigned int offset)
>>>> +           unsigned int count, unsigned int offset,
>>>> +           struct pnfs_layout_segment *lseg)
>>>> {
>>>>     struct inode *inode = req->wb_context->path.dentry->d_inode;
>>>>     int swap_flags = IS_SWAPFILE(inode) ? NFS_RPC_SWAPFLAGS : 0;
>>>> @@ -183,6 +187,7 @@ static int nfs_read_rpcsetup(struct nfs_page *req, struct nfs_read_data *data,
>>>>     data->req         = req;
>>>>     data->inode       = inode;
>>>>     data->cred        = msg.rpc_cred;
>>>> +   data->lseg        = get_lseg(lseg);
>>>>
>>>>     data->args.fh     = NFS_FH(inode);
>>>>     data->args.offset = req_offset(req) + offset;
>>>> @@ -240,7 +245,7 @@ nfs_async_read_error(struct list_head *head)
>>>>  * won't see the new data until our attribute cache is updated.  This is more
>>>>  * or less conventional NFS client behavior.
>>>>  */
>>>> -static int nfs_pagein_multi(struct inode *inode, struct list_head *head, unsigned int npages, size_t count, int flags)
>>>> +static int nfs_pagein_multi(struct inode *inode, struct list_head *head, unsigned int npages, size_t count, int flags, struct pnfs_layout_segment *lseg)
>>>> {
>>>>     struct nfs_page *req = nfs_list_entry(head->next);
>>>>     struct page *page = req->wb_page;
>>>> @@ -266,6 +271,8 @@ static int nfs_pagein_multi(struct inode *inode, struct list_head *head, unsigne
>>>>     } while(nbytes != 0);
>>>>     atomic_set(&req->wb_complete, requests);
>>>>
>>>> +   /* We know lseg==NULL */
>
> Can you provide more details?
> If it's always NULL why bother to pass it in?
>
>>>> +   lseg = pnfs_update_layout(inode, req->wb_context, IOMODE_READ);
>>>>     ClearPageError(page);
>>>>     offset = 0;
>>>>     nbytes = count;
>>>> @@ -280,12 +287,13 @@ static int nfs_pagein_multi(struct inode *inode, struct list_head *head, unsigne
>>>>             if (nbytes < rsize)
>>>>                     rsize = nbytes;
>>>>             ret2 = nfs_read_rpcsetup(req, data, &nfs_read_partial_ops,
>>>> -                             rsize, offset);
>>>> +                                    rsize, offset, lseg);
>>>>             if (ret == 0)
>>>>                     ret = ret2;
>>>>             offset += rsize;
>>>>             nbytes -= rsize;
>>>>     } while (nbytes != 0);
>>>> +   put_lseg(lseg);
>>>>
>>>>     return ret;
>>>>
>>>> @@ -300,7 +308,7 @@ out_bad:
>>>>     return -ENOMEM;
>>>> }
>>>>
>>>> -static int nfs_pagein_one(struct inode *inode, struct list_head *head, unsigned int npages, size_t count, int flags)
>>>> +static int nfs_pagein_one(struct inode *inode, struct list_head *head, unsigned int npages, size_t count, int flags, struct pnfs_layout_segment *lseg)
>>>> {
>>>>     struct nfs_page         *req;
>>>>     struct page             **pages;
>>>> @@ -320,9 +328,14 @@ static int nfs_pagein_one(struct inode *inode, struct list_head *head, unsigned
>>>>             *pages++ = req->wb_page;
>>>>     }
>>>>     req = nfs_list_entry(data->pages.next);
>>>> +   if ((!lseg) && list_is_singular(&data->pages))
>>>> +           lseg = pnfs_update_layout(inode, req->wb_context, IOMODE_READ);
>
> When is lseg NULL and why getting it here works better than in nfs_readpage_async?
>
>>>>
>>>> -   return nfs_read_rpcsetup(req, data, &nfs_read_full_ops, count, 0);
>>>> +   ret = nfs_read_rpcsetup(req, data, &nfs_read_full_ops, count, 0, lseg);
>>>> +   put_lseg(lseg);
>>>
>>> Shouldn't that be done only if pnfs_update_layout was called here?
>>> Otherwise, the caller, nfs_readpage_async puts the lseg it passes down.
>>>
>>
>> You are right there is a problem.  But it needs to be fixed by removing the put_lseg from nfs_readpage_async.
>>
>>
>
> If we can avoid getting the lseg in one place and putting it in another that would be better.
>
> Benny
>

I agree, but I don't see how It is possible with the current code,
where the pnfs_update_layout occurs in pg_test.

Fred

>>>> +   return ret;
>>>> out_bad:
>>>> +   put_lseg(lseg);
>>>
>>> I'd unify the common exit path by doing nfs_async_read_error on the error path
>>> and then goto out for the common code.
>>>
>>
>> OK.
>>
>> Fred
>>
>

  reply	other threads:[~2011-02-16 21:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-15  8:38 [PATCH 0/18] pNFS wave 3 submission Version 2 andros
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 01/18] NFSv4: remove CONFIG_NFS_V4 from nfs_read_data andros
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 02/18] NFSv4.1: put_layout_hdr can remove nfsi->layout andros
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 03/18] NFS move nfs_client initialization into nfs_get_client andros
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 04/18] NFSv4.1: send zero stateid seqid on v4.1 i/o andros
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 05/18] NFSv4.1: new flag for state renewal check andros
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 06/18] NFSv4.1: new flag for lease time check andros
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 07/18] NFSv4.1: add MDS mount DS only check andros
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 08/18] NFSv4.1: lseg refcounting andros
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 09/18] NFSv4.1: coelesce across layout stripes andros
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 10/18] NFSv4.1: shift pnfs_update_layout locations andros
2011-02-16 19:42   ` Benny Halevy
2011-02-16 19:55     ` Fred Isaman
2011-02-16 20:08       ` Benny Halevy
2011-02-16 21:09         ` Fred Isaman [this message]
2011-02-16 22:56           ` Fred Isaman
2011-02-17  8:15             ` Christoph Hellwig
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 11/18] NFSv4.1: generic read andros
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 12/18] NFSv4.1: data server connection andros
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 13/18] NFSv4.1: filelayout i/o helpers andros
2011-02-15  8:38 ` [PATCH pNFS wave 3 Version 2 14/18] NFSv4.1: filelayout read andros
2011-02-15  8:39 ` [PATCH pNFS wave 3 Version 2 15/18] NFSv4.1: filelayout async error handler andros
2011-02-16 19:57   ` Benny Halevy
2011-02-15  8:39 ` [PATCH pNFS wave 3 Version 2 16/18] NFSv4.1 move deviceid cache to filelayout driver andros
2011-02-16 18:48   ` Andy Adamson
2011-02-15  8:39 ` [PATCH pNFS wave 3 Version 2 17/18] NFSv4.1: turn off pNFS on ds connection failure andros
2011-02-15  8:39 ` [PATCH pNFS wave 3 Version 2 18/18] NFSv4.1: lseg documentation andros
2011-02-16 18:49   ` Andy Adamson

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=AANLkTim04-f5ittgAQf9Q1fp7NsXXLk9MC4-NAS9mdd5@mail.gmail.com \
    --to=iisaman@netapp.com \
    --cc=andros@citi.umich.edu \
    --cc=andros@netapp.com \
    --cc=bhalevy@panasas.com \
    --cc=bharrosh@panasas.com \
    --cc=dhildeb@us.ibm.com \
    --cc=green@linuxhacker.ru \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@netapp.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).