This is the mail archive of the
cygwin@sources.redhat.com
mailing list for the Cygwin project.
Re: Cygwin fstat and NT caching
- To: Dan Morris <dmorris at tiqit dot com>
- Subject: Re: Cygwin fstat and NT caching
- From: Egor Duda <deo at logos-m dot ru>
- Date: Wed, 3 Jan 2001 17:35:15 +0300
- CC: cygwin at sources dot redhat dot com
- Organization: DEO
- References: <Pine.GSO.4.21.0101030036510.14474-100000@fable6.Stanford.EDU>
- Reply-To: Egor Duda <cygwin at sources dot redhat dot com>
Hi!
Wednesday, 03 January, 2001 Dan Morris dmorris@tiqit.com wrote:
DM> Anyone know why this might be? I looked through the du code; the only
DM> repeated filesystem access seems to be through stat() and lstat(). So I
DM> looked through stat() and lstat(), and I can't see any place where disk
DM> flushes are explicitly forced, or any place where Win32 calls are made with
DM> specific flags for ignoring the inode cache ... these seem to be the Win32
DM> filesystem calls that get made :
DM> GetVolumeInformation
DM> GetDriveType
DM> GetFileInformationByHandle
DM> GetFileSize
DM> GetFileType
DM> FindFirstFile
DM> I don't know why any of them would ignore the cache... any ideas? I'm
DM> running Win2000, if that helps anyone...
They don't ignore cache, and there's no disk flushes.
GetFileInformationByHandle, however, requires opening file, which is
far more expensive than just obtaining it via
FindFirstFile/FindNextFile. moreover, cygwin tries to deduce if the
file is executable by file's header and this involves ReadFile. If
your filesystem contains a lot of symlinks, this makes things even
worse, because each symlink is resolved via ReadFile() too.
those performance tradeoffs were made to achieve semantical
correctness of *stat calls.
If you want to improve performance of du, you should patch its
sources. change all calls to stat to bunch of native win32 api calls
needed to get statbuf fields used later. something like this:
...
#if defined (__CYGWIN__)
...
statbuf.st_size = GetFileSize (file, &hwSize);
...
#else
rc = stat (file, &statbuf)
#endif
...
Egor. mailto:deo@logos-m.ru ICQ 5165414 FidoNet 2:5020/496.19
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple