linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] NFS: Adapt readdirplus to application usage patterns
Date: Wed, 2 May 2012 08:39:26 +1000	[thread overview]
Message-ID: <20120502083926.1583f5f7@notabene.brown> (raw)
In-Reply-To: <1335909983-26413-1-git-send-email-Trond.Myklebust@netapp.com>

[-- Attachment #1: Type: text/plain, Size: 2172 bytes --]

On Tue,  1 May 2012 18:06:23 -0400 Trond Myklebust
<Trond.Myklebust@netapp.com> wrote:

> While the use of READDIRPLUS is significantly more efficient than
> READDIR followed by many LOOKUP calls, it is still less efficient
> than just READDIR if the attributes are not required.
> 
> This patch tracks when lookups are attempted on the directory,
> and uses that information to selectively disable READDIRPLUS
> on that directory.
> The first 'readdir' call is always served using READDIRPLUS.
> Subsequent calls only use READDIRPLUS if there was a successful
> lookup or revalidation on a child in the mean time.
> 
> Credit for the original idea should go to Neil Brown. See:
>       http://www.spinics.net/lists/linux-nfs/msg19996.html
> However, the implementation in this patch differs from Neil's
> in that it focuses on tracking lookups rather than calls to
> stat().
> 
> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> Cc: Neil Brown <neilb@suse.de>

Thanks!  Looks good.
Tracking lookups rather than getattr does make sense - more general.

> @@ -874,7 +897,9 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
>  	desc->file = filp;
>  	desc->dir_cookie = &dir_ctx->dir_cookie;
>  	desc->decode = NFS_PROTO(inode)->decode_dirent;
> -	desc->plus = NFS_USE_READDIRPLUS(inode);
> +	desc->plus = 0;
> +	if (nfs_use_readdirplus(inode, filp))
> +		desc->plus = 1;
>  

This looks a bit odd to me.

        desc->plus = nfs_use_readdirplus(inode, filp):
??
Or if you think there is a type conflict:
        desc->plus = nfs_use_readdirplus(inode, file) ? 1 : 0;

But maybe you prefer the original - your choice of course.

Also, the current code will clear NFS_INO_ADVISE_RDPLUS if it gets -ETOOSMALL,
and it will stay cleared until the inode falls out of cache and is reloaded.
The new code will set it again a lot sooner.  Is that likely to be a problem
(I don't remember what conditions lead to ETOOSMALL)?
In fact I think it will ignore  the ETOOSMALL and always retry with
readdirplus for the first read in a directory.  That doesn't seem good ?

Thanks,
NeilBrown


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2012-05-01 22:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-01 22:06 [PATCH] NFS: Adapt readdirplus to application usage patterns Trond Myklebust
2012-05-01 22:39 ` NeilBrown [this message]
2012-05-01 23:04   ` Myklebust, Trond
2012-05-01 23:22     ` NeilBrown

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=20120502083926.1583f5f7@notabene.brown \
    --to=neilb@suse.de \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    /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).