[PATCH] improve performance of stat() operations (e.g. ls -lR )

Christopher Faylor cgf@redhat.com
Mon May 27 10:43:00 GMT 2002


On Mon, May 27, 2002 at 02:24:37PM +0200, Corinna Vinschen wrote:
>On Sun, May 26, 2002 at 10:23:39PM -0400, Chris Faylor wrote:
>> You can get nearly all of the information that you need from
>> FindFirstFile.  Unfortunately, GetFileInformationByHandle() seems to be
>> the only available function which returns the hard link count of a file.
>
>What about taking the FS into account here?  We could perhaps speedup
>stat() for FAT/FAT32 since the hard link count is always 1 for files
>then.  We could completely skip the open() call if the file isn't
>already open (as in fstat(2)).  The FS info is already available from
>path_conv::check().

Yes, I have a patch that I'm working on which does this.  I really do
hate having two different code paths for different filesystems, though.
Too bad there isn't an os-specific way of finding out if a filesystem
handles hard links or not.

I've revamped some of fstat to remove some of the excess OS calls, too.
In the process of researching this, I discovered that NT has a mechanism
for determining a filename from an open handle so I'm trying to work
that into dtable.cc.  I've seen hints that something similar is possible
in Windows 9x but I haven't tracked down any code yet.

cgf



More information about the Cygwin-patches mailing list