OpenDir and large directories
nadavd at exanet.com
Mon Oct 10 01:28:32 GMT 2005
As I already saw in several posts OpenDir with very large directories is
a bit of a problem to say the least.
My main issue is mostly with the stat calls that follows it, and it is
even worse since it is made on NFS mount that is accessed from several
machines and therefore attributes must not be cached.
I can think of several optimizations I can make, but in order to do them
I need to change the way OpenDir, ReadDirName, and CloseDir work.
I assume the main if not the only reason (if there are others I would be
glad to hear about them,) OpenDir reads the whole dir first, is done for
My idea is to move most of OpenDir code to ReadDirName where entries
that are already cached are read from the cache, and those that are not
are processed the same way as in OpenDir. The Dir structure would have
two more fields, the DIR pointer, and eof flag to indicate the last has
been read from the VFS. Of course the DIR pointer has to remain open,
and VFS_CLOSEDIR can only be called after eof is reached, or CloseDir
has been called.
This should reduce the work done in unix_convert for existing non-cached
entries by half, for case-insensitive shares.
I would like to hear any comments you have about this.
More information about the samba-technical