next up previous
Next: Parallel directory operations Up: Improving ext3 without changing Previous: Asynchronous file unlink/truncate


Increased nlinks support

The use of a 16-bit value for an inode's link count (i_nlink) limits the number of hard links on an inode to 65535. For directories, it starts with a link count of 2 (one for "." and one for "..") and each subdirectory has a hard link to its parent, so the number of subdirectories is similarly limited.

The ext3 implementation further reduced this limit to 32000 to avoid signed-int problems. Before indexed directories were implemented, the practical limit for files/subdirectories was about 10000 in a single directory.

A patch was implemented to overcome this subdirectory limit by not counting the subdirectory links after the counter overflowed (at 65000 links actually); instead, a link count of one is stored in the inode. The ext3 code already ignores the link count when determining if a directory is full or empty, and a link count of one is otherwise not possible for a directory.

Using a link count of one is also required because userspace tools like ``find'' optimize their directory walking by only checking a number of subdirectories equal to the link count minus two. Having a directory link count of one disables that heuristic.


next up previous
Next: Parallel directory operations Up: Improving ext3 without changing Previous: Asynchronous file unlink/truncate
Mingming Cao 2005-07-26