Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 May 2001 06:26:11 +1000
From:      Greg Black <gjb@gbch.net>
To:        hackers@FreeBSD.ORG
Subject:   Re: technical comparison 
Message-ID:  <nospam-990822371.18423@maxim.gbch.net>
In-Reply-To: <200105251718.VAA06296@aaz.links.ru>  of Fri, 25 May 2001 21:18:05 %2B0400
References:  <200105251718.VAA06296@aaz.links.ru> 

next in thread | previous in thread | raw e-mail | index | archive | help
I would have sent this to the original author if he had used a
proper email address on his post; sorry to those who don't want
to see it.

| > | I have files fooX where X is a number from 00000 to 60000 in that
| > | directory.  I need to find a piece of information, so I run that
| > | information through a hash of some sort and determine that the file I want
| > | is number 23429, so I open that file.
| > 
| > And if this imaginary program is going to do that, it's equally
| > easy to use a multilevel directory structure and that will make
| > the life of all users of the system simpler.  There's no real
| > excuse for directories with millions (or even thousands) of
| > files.
| There is.
| You assume that names are random.
| Assume that they  are not.
| VERY old example:
| a
| aa
| ...
| aaaaaaa...aaa 255 times
| aaaaaaa...aab
| so on.
| Yes, I know: hash.
| 
| Is it practical to this in every application
| (sometimes it is unknown before practical use
| if directories become big) instead in
| one file system?

Any real programmer has tools that make this trivial.  I keep a
pathname hashing function and a couple of standalone programs
that exercise it from shell scripts in my toolbox and can stitch
them into anything that needs fixing in no time.  My code allows
for nearly 1.3 trillion names in a six-level hierarchy if you
can limit yourself to about 500 hundred names per directory, but
can be easily extended for really idiotic uses.

| Sorry for a bad English.

We can live with that, but it's a bit rude to send messages out
without a valid "From" address.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?nospam-990822371.18423>