Question about T2FindFirst

James Peach jpeach at
Thu Aug 5 05:51:10 GMT 2004

On Fri, May 07, 2004 at 02:46:41PM -0700, Jeremy Allison wrote:
> On Fri, May 07, 2004 at 10:36:55PM +0100, MVM RAJU wrote:
> > I have a question about T2FindFirst implementation,
> > when Samba receives a T2FindFirst request
> > WITHOUT wildcard pattern, it retrieves all the
> > directory entries using opendir()/readdir() 
> > before it replies to the request, any specific reason
> > for this?
> If we're acting in a case-insensitve way, we ave to
> do this as we can't know what case the incoming value
> matches. If case-sensitive we don't have to do this and
> can just do a stat() instead. This is an optimisation
> I'll be adding into 3.0.5 and above.

I have a patch to do lazy directory creation (ie. keep a DIR * open and
use readdir API on the fly, rather than slurping all the directory
entries in at once). I did it this way because I didn't want to tamper
with the get_lanman2_dir_entry logic.

Obviously the direct stat approach is going to be faster because you
don't incur the ngetdents cost for large directories. I was curious
about why OpenDir behaves as it does, however .. do you know the history
of that?

James Peach | jpeach at | SGI Australian Software Group
I don't speak for SGI.

More information about the samba-technical mailing list