This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Why does readdir() open files ?


On Mar 28 18:35, Ben RUBSON wrote:
> 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 !

You should make sure that the hasgood_inode() check works for your FUSE
FS.  Check at the end of fs_info::update():

  has_acls (flags () & FS_PERSISTENT_ACLS);
  /* Netapp inode numbers are fly-by-night. */
  hasgood_inode ((has_acls () && !is_netapp ()) || is_nfs ());

So your filesystem should return the FS_PERSISTENT_ACLS flags in a call
to NtQueryVolumeInformationFile(..., FileFsAttributeInformation)


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]