linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: <peter.staubach@emc.com>
Cc: <Trond.Myklebust@netapp.com>, <bjschuma@netapp.com>,
	<linux-nfs@vger.kernel.org>
Subject: Re: Use of READDIRPLUS on large directories
Date: Thu, 17 Mar 2011 08:40:38 +1100	[thread overview]
Message-ID: <20110317084038.6d4ea49d@notabene.brown> (raw)
In-Reply-To: <5E6794FC7B8FCA41A704019BE3C70E8B068397B4@MX31A.corp.emc.com>

On Wed, 16 Mar 2011 08:30:20 -0400 <peter.staubach@emc.com> wrote:

> Perhaps the use of a heuristic that enables readdirplus only after the application has shown that it is interested in the attributes for each entry in the directory?  Thus, if the application does readdir()/stat()/stat()/stat()/readdir()/... then the NFS client could use readdirplus to fill the caches.  If the application is just reading the directory and looking at the names, then the client could just use readdir.

I think this could work very well.
"ls -l" certainly calls 'stat' on each file after each 'getdents' call.

So we could arrange that the first readdir call on a directory
always uses the 'plus' version, and clears a "seen any getattr calls"
flag on the directory.

nfs_getattr then sets that flag on the parent

subsequent readdir calls only use 'plus' if the flag was set, and
clear the flag again.


There might be odd issues with multiple processes reading and stating
in the same directory, but they probably aren't very serious.

I'm might give this idea a try ... but I still think the original
switch to always use readdirplus is a regression and should be reverted.

Thanks,
NeilBrown


  parent reply	other threads:[~2011-03-16 21:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-16  4:55 Use of READDIRPLUS on large directories NeilBrown
2011-03-16 12:30 ` peter.staubach
2011-03-16 13:50   ` Trond Myklebust
2011-03-16 21:40   ` NeilBrown [this message]
2011-03-17  0:55     ` NeilBrown
2011-03-17 17:44       ` J. Bruce Fields
2011-03-18  4:27         ` NeilBrown
2011-03-16 13:43 ` Chuck Lever
2011-03-16 14:14   ` Bryan Schumaker
2011-03-16 14:20     ` Trond Myklebust
2011-03-16 21:30       ` NeilBrown
2011-03-16 21:42         ` Trond Myklebust
2011-03-16 22:40           ` NeilBrown
2011-03-17 17:18             ` J. Bruce Fields
2011-04-04 20:14               ` Bryan Schumaker
2011-04-05 12:20                 ` NeilBrown
2011-04-07 14:28                   ` Bryan Schumaker

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=20110317084038.6d4ea49d@notabene.brown \
    --to=neilb@suse.de \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bjschuma@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=peter.staubach@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).