mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@lazybastard.org>
To: Neil Brown <neilb@suse.de>
Cc: Theodore Tso <tytso@mit.edu>, "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 11:33:11 +0200	[thread overview]
Message-ID: <20070412093310.GC8175@lazybastard.org> (raw)
In-Reply-To: <17949.51797.386833.917451@notabene.brown>

On Thu, 12 April 2007 15:57:41 +1000, Neil Brown wrote:
> 
> > However, the collision chain gives me quite a bit of headache.  One
> > would have to store each entry's position on the chain, deal with older
> > entries getting deleted, newer entries getting removed, etc.  All this
> > requires a lot of complicated code that basically never gets tested in
> > the wild.
> 
> This is a simple consequence of the design decision to use hashes as
> the search key.  They aren't dense and they will collide.  So the
> solution will be a bit fuzzy around the edges.  And maybe that is an
> acceptable tradeoff.  But the filesystem should take full
> responsibility for it, whether in performance or correctness :-)

Sure.  And seeing that not using hashes would kill performance long
before 4 billion dentries are reached, there don't seem to be many
downsides to hashing in principle.

> > Just settling for a 64bit hash and returning -EEXIST when someone causes
> > a collision an creat() sounds more appealing.  Directories with 4
> > billion entries will cause problems, but that is hardly news to anyone.
> 
> I think you want -EFBIG or -ENOSPC.  -EEXIST sounds just wrong.

None of them are 100% correct.  But you are right, -ENOSPC seems to do
less harm.

> But there are alternatives.  e.g. internal chaining.
> Insist on a unique 64bit hash for every file.  If the hash is in use,
> increment and try again.  On lookup, if the hash leads you to a file
> with the wrong name, increment and try again until you find a hole
> (hash value that is not stored).  When you delete an entry, leave a
> place holder if the next hash is in use.  Conversely if the next hash
> is not in use, delete the entry and delete the previous one if it is a
> place holder.

That would work and is limited to reasonable complexity.  It still
suffers from getting virtually no testing in the wild and therefore
being one of the dark corners little critters thrive in.  But one can at
least add a config option to fold the hash to 16bit or so.  And cross
fingers that at least one person will occasionally test with that
option.

> You have to require 64bit cookies/fpos, but I think that today, that
> is a reasonable thing to require (5 years ago it might not have been).

Which brings us back to the start of this thread.

Jörn

-- 
Why do musicians compose symphonies and poets write poems?
They do it because life wouldn't have any meaning for them if they didn't.
That's why I draw cartoons.  It's my life.
-- Charles Shultz

  reply	other threads:[~2007-04-12  9:37 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
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 [this message]
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=20070412093310.GC8175@lazybastard.org \
    --to=joern@lazybastard.org \
    --cc=drepper@gmail.com \
    --cc=hch@infradead.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    --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

Powered by JetHome