[lug] # of subdirectory limits
jafo at tummy.com
Fri Apr 20 00:02:39 MDT 2001
On Tue, Apr 17, 2001 at 01:12:48PM -0600, Andrew Diederich wrote:
>you see that you can't have more than 32766 subdirectories in a directory,
>and this apparently isn't changable. So, what is this in linux, and is it
>a compile-time option in the kernel? Enquiring minds want to know.
This is more of a file-system thing than a kernel thing. In ext2 and other
Berkeley FFS-derrived file-systems, you probably don't want to have much
more than 1k or 2k entries in a directory because of performance issues.
Creating 32k files in a single directroy gets painfully slow, because at
every create it has to scan the entire directory to see if the file name
already exists, and then it appends the name to the end.
In file-systems that have more advanced directory structures, such as ext3,
reiser, or XFS, you can do many more than this. As a test, at one point I
created well over 100k file entries in a single directory using Reiser and
had no problems.
I don't have the exact numbers for the benchmarks, but as I recall ext2
in a new directory could create something like 50 entries per second, but
when you got up to over 1000 it was down to like 10. At 10k it was down to
2 per second. Reiser started off slower, like 35 per second, but remained
roughly this level all the way up to 100k entries.
A computer scientist is someone who, when told to "Go to Hell," sees the
"go to," rather than the destination, as harmful. -- Dr. Roger M. Firestone
Sean Reifschneider, Inimitably Superfluous <jafo at tummy.com>
tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python
More information about the LUG