Re: large directory handling speed

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Mon, 31 May 1999 17:30:36 +0200


Alexander Viro wrote:
> Hmm... It is quadratic on ext2 too. I'm very sceptical about populating
> dcache on readdir() for any filesystem, mostly because it will be useless
> on small directories and will trigger cache reaping on the large ones. The
> same applies to icache.

It would be a *bad* idea to populate inode cache on readdir() -- the
inodes are often in a very bad order on the disk. Especially
directories containing other directories (on ext2).

To populate the dentry cache, we should add "dentry without inode" -- a
dentry for which we have the inode number, but haven't fetched the inode
itself yet. The mechanism isn't there, but wouldn't be hard to add IMO.
Thus your issue about icache reaping goes away completely.

The biggest space hog due to positive dentries is currently the inodes
themselves. If we added "dentry without inode", populating the dcache
on readdir() shouldn't be a big hit.

Dcache flushing, if it is a problem, is alleviated by giving the new
dentries a lower priority, so they're discarded in preference to
dentries that actually have their inodes pulled in.

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/