From: Neil Brown <neilb@suse.de>
To: Theodore Tso <tytso@mit.edu>
Cc: "Jörn Engel" <joern@lazybastard.org>,
"H. Peter Anvin" <hpa@zytor.com>,
"Christoph Hellwig" <hch@infradead.org>,
"Ulrich Drepper" <drepper@gmail.com>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: If not readdir() then what?
Date: Thu, 12 Apr 2007 08:32:05 +1000 [thread overview]
Message-ID: <17949.25061.739035.688232@notabene.brown> (raw)
In-Reply-To: message from Theodore Tso on Wednesday April 11
On Wednesday April 11, tytso@mit.edu wrote:
> On Wed, Apr 11, 2007 at 07:15:57AM +1000, Neil Brown wrote:
> > > Neil, is this correct?
> >
> > It's just NFS. nfsd does open/getdents/close on every readdir
> > request.
>
> That's... unfortunate.
I like to think of it as "challenging" :-)
>
>
> So the problem with nfsd doing an open/getdents/close on every readdir
> request is two-fold. First of all, it means that you are incurring
> extra overhead by forcing ext3 to allocate, create, and free the
> red-black tree on every single NFS readdir request. Secondly, it
> increases the chances of problems with the hash collision logic.
I guess we need a two-fold solution then :-)
For the first:
You are storing an internal tree representation of part of the
directory attached to the 'struct file'.
Would it be possible to store this attached to the page via the
->private pointer? What would avoid the allocate/create/free
overhead on every request.
You suggest caching the open files in nfsd. While that is probably
possible (I've thought of it a number of times) is would also be
quite complex, e.g. requiring some sort of call-back to close all
those files when the filesystem is unexported. And it is very easy
to get caching heuristics wrong. Leveraging the page-cache which is
a very mature cache seems to make a lot of sense.
The cursor would still be in the 'struct file', but if the second
second fold works, that should be much less critical.
For the second.
You say that you " would need at least 96 bits in order to make that
guarantee; 64 bits of hash, plus a 32-bit count value in the hash
collision chain". I think 96 is a bit greedy. Surely 48 bits of
hash and 16 bits of collision-chain-position would plenty. You would
need 65537 entries before a collision was even possible, and
billions before it was at all likely. (How big does a set of 48bit
numbers have to get before the probability that "No subset of 65536
numbers are all the same" drops below 0.95?)
This would really require that the collision-chain-index was stable
across create/delete. Doing that while you have the tree in the
page cache is probably easy enough. Doing it across reboots is
probably not possible without on-disk changes.
So while my two-fold solution is not perfect(*), I think it is
substantially better than what we have now, and is extremely unlike to
ever show an observable problem.
(*)And perfection can only be achieved we two independent indexes.
This requires 64bit cookies which NFSv2 cannot handle. I think it is
OK to say "tough". We should probably make sure that READDIRv2 *always*
fails on a directory which is indexed, and possibly on a filesystem
which allows index directories. People can always disable indexing if
they want a v2 export.
NeilBrown
next prev parent reply other threads:[~2007-04-11 22:32 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-07 16:57 Ulrich Drepper
2007-04-07 20:36 ` Theodore Tso
2007-04-07 23:30 ` Christoph Hellwig
2007-04-08 18:11 ` H. Peter Anvin
2007-04-08 18:41 ` Jörn Engel
2007-04-08 19:19 ` Theodore Tso
2007-04-08 19:26 ` Ulrich Drepper
2007-04-08 19:28 ` H. Peter Anvin
2007-04-08 19:40 ` Ulrich Drepper
2007-04-09 1:44 ` Theodore Tso
2007-04-09 11:09 ` Jörn Engel
2007-04-09 12:29 ` Trond Myklebust
2007-04-09 12:31 ` Trond Myklebust
2007-04-09 13:19 ` Theodore Tso
2007-04-09 14:03 ` Trond Myklebust
2007-04-09 16:34 ` Jan Engelhardt
2007-04-09 17:00 ` Trond Myklebust
2007-04-10 13:56 ` Theodore Tso
2007-04-10 14:10 ` Ulrich Drepper
2007-04-10 15:48 ` H. Peter Anvin
2007-04-10 16:42 ` Ulrich Drepper
2007-04-10 14:37 ` Trond Myklebust
2007-04-10 15:54 ` Jan Engelhardt
2007-04-10 16:18 ` H. Peter Anvin
2007-04-10 16:25 ` Valdis.Kletnieks
2007-04-10 21:12 ` Neil Brown
2007-04-10 21:16 ` H. Peter Anvin
2007-04-10 21:43 ` Neil Brown
2007-04-10 21:18 ` Trond Myklebust
2007-04-10 21:37 ` Neil Brown
2007-04-10 21:57 ` Bob Copeland
2007-04-10 21:59 ` Trond Myklebust
2007-04-10 22:33 ` Neil Brown
2007-04-11 0:22 ` Trond Myklebust
2007-04-11 1:45 ` Bernd Eckenfels
2007-04-10 21:46 ` Alan Cox
2007-04-10 21:26 ` Neil Brown
2007-04-09 12:46 ` Andreas Schwab
2007-04-10 21:15 ` Neil Brown
2007-04-11 13:57 ` Jan Engelhardt
2007-04-11 14:42 ` Theodore Tso
2007-04-11 22:32 ` Neil Brown [this message]
2007-04-11 22:06 ` David Lang
2007-04-11 23:23 ` H. Peter Anvin
2007-04-11 23:33 ` Jörn Engel
2007-04-12 0:00 ` Neil Brown
2007-04-11 23:22 ` Theodore Tso
2007-04-12 1:46 ` Neil Brown
2007-04-12 2:37 ` Jörn Engel
2007-04-12 5:57 ` Neil Brown
2007-04-12 9:33 ` Jörn Engel
2007-04-12 12:21 ` Theodore Tso
2007-04-12 17:18 ` J. Bruce Fields
2007-04-12 17:35 ` H. Peter Anvin
2007-04-16 3:05 ` Theodore Tso
2007-04-16 5:47 ` Neil Brown
2007-04-16 10:39 ` Theodore Tso
2007-04-16 6:18 ` Neil Brown
2007-04-16 11:07 ` Theodore Tso
2007-04-16 23:24 ` Neil Brown
2007-04-08 18:47 ` Theodore Tso
2007-04-08 19:13 ` H. Peter Anvin
2007-04-08 18:50 ` Ulrich Drepper
2007-04-07 23:44 ` Jan Engelhardt
2007-04-08 20:36 ` J. Bruce Fields
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=17949.25061.739035.688232@notabene.brown \
--to=neilb@suse.de \
--cc=drepper@gmail.com \
--cc=hch@infradead.org \
--cc=hpa@zytor.com \
--cc=joern@lazybastard.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/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
all inboxes | Powered by JetHome®