The guts of stat cache.

Christopher R. Hertel crh at ubiqx.mn.org
Tue Mar 19 16:22:37 MDT 2013


On 03/19/2013 05:05 PM, Jeremy Allison wrote:
> On Tue, Mar 19, 2013 at 04:20:51PM -0500, Christopher R. Hertel wrote:
>> Folks,
>>
>> I'm looking into a corner case problem, and I need to know more about the
>> workings of the stat cache.
>>
>> The problem has to do with small file creates.  Seems that whenever a file
>> is created (particularly if the create needs to fail if the file exists), we
>> have to do some work going through the possible case permutations of the
>> given filename.
>>
>> Stat cache is supposed to help with that, but I am seeing lots of calls to
>> the Samba VFS stat function, asking for info on the same name.
>>
>> Is the stat cache above or below the VFS layer?
> 
> Above.

So it's not replaceable from within a VFS module (augmentable, perhaps, but
not replaceable).

>> What does the stat cache do to speed up case-insensitive name matching?
> 
> It maps whatever case the client sends us into the actual
> case found on disk.

...which means that it has to look at what's on disk.  I assume that it
caches that disk-based info so that the look-up is done internally so that
we can reduce the number of times we go to disk.

In which case, I'm confused as to why I see stat calls repeated.  I've
written a very simple VFS module that logs calls to the vfs .stat function,
and I see repeated calls on the same name (and variations of the name).

Chris -)-----

-- 
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org


More information about the samba-technical mailing list