This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: Why does readdir() open files ?
- From: Ben RUBSON <ben dot rubson at gmail dot com>
- To: cygwin-developers at cygwin dot com
- Date: Wed, 28 Mar 2018 18:35:55 +0200
- Subject: Re: Why does readdir() open files ?
- References: <BA623145-AE0F-4805-816E-D9123FCF8BE4@gmail.com>
On 28 Mar 2018, Ben RUBSON wrote:
Hi,
I'm porting a FUSE FS to Cygwin, and I focus especially on readdir()
performance.
What I see is that when readdir() occurs, each file of the directory is
as expected (at least I think) stated (getattr), but also opened (open).
The first block of the file was even red, until I set the notexec mount
option.
My question is, why is every file opened ?
This is quite a performance killer, particularly for a FUSE FS.
I thought this was to calculate the inode number, I then set the ihash
mount option, but it did not help.
I may be totally wrong, but perhaps the culprit is the following code path ?
https://github.com/mirror/newlib-cygwin/blob/master/winsup/cygwin/fhandler_disk_file.cc#L2262
Perhaps we simply don't need to open the file if (!hasgood_inode ()) ?
That would be a nice performance improvement !
Thank you again,
Ben