Slow performance on large dirs.

Jeremy Allison jallison at
Tue Nov 2 00:04:51 GMT 1999

Michel Stoop wrote:
> > > I have put some code in trans2.c after line 773 and 1030
> > > to set finished to true if the found filename is an exact
> > > match to the given mask. This speeds things up but it is
> > > not a good fix. Altough I try to understand why NT first
> > > tries to determine if the file exists before opening it,
> The code is:
>       finished = !get_lanman2_dir_entry(conn,mask,dirtype,info_level,
>                    requires_resume_key,dont_descend,
>                    &p,pdata,space_remaining, &out_of_space,
>                    &last_name_off);
>     }
>     if ((!strcmp(mask, wcard)) && (!strchr(mask, '*'))) [added this one!]
>       finished = True;
>     if (finished && out_of_space)
>       finished = False;
> This extra code aborts the dirseek if mask contains an exact
> filename. This is because I think that there is no sense to
> continue searching if we were looking for a single filename.

Yep - this is definately a good idea.

> Now the delay is almost gone when I open the first file in
> the directory, but it gets slower when the file wich I open
> is further in the directory list. It has to parse more filenames...

I just added a change into the 2.0.6 codebase to implement
this. It should be in the pre3 snapshot Andrew will release
shortly, so I'd appreciate it if you'd test it.


	Jeremy Allison,
	Samba Team.

Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.

More information about the samba-technical mailing list