unix_convert() and amount of stat() calls
Jeremy Allison
jra at samba.org
Thu Sep 9 09:43:15 MDT 2010
On Thu, Sep 09, 2010 at 05:29:32PM +0200, Stefan (metze) Metzmacher wrote:
> Am 09.09.2010 17:20, schrieb Jeremy Allison:
> > On Thu, Sep 09, 2010 at 11:43:54AM +0200, Stefan (metze) Metzmacher wrote:
> >>
> >> You mean we only do this, correct?
> >> path\to\some\dir\with\files = OK
> >
> > Err. Yes :-).
> >
> >> + if (posix_pathnames) {
> >> + ret = SMB_VFS_LSTAT(conn, &parent_fname);
> >> + } else {
> >> + ret = SMB_VFS_STAT(conn, &parent_fname);
> >> + }
> >> + if (ret == 0) {
> >> + status = check_for_dot_component(&parent_fname);
> >> + if (!NT_STATUS_IS_OK(status)) {
> >> + goto fail;
> >> + }
> >> +
> >> + start = smb_fname->base_name +
> >> + strlen(parent_fname.base_name);
> >> +
> >> + DEBUG(5,("unix_convert optimize2: name "
> >> + "= %s, dirpath = %s, "
> >> + "start = %s\n",
> >> + smb_fname->base_name,
> >> + dirpath,
> >> + start));
> >>
> >> Don't we need a 'goto done;' here?
> >
> > *Probably*. I thought about adding that but didn't do so
> > explicitly as I need to think more about what the loop
> > below will do, and wasn't 100% sure there were no side
> > effects, so I thought it was less harmful to just go
> > through the code in the same way as before.
>
> But that means no optimization and doing one additional stat call.
No it doesn't - I also added your fix:
/* Skip the stat call if it's a wildcard end. */
if (name_has_wildcard) {
DEBUG(5,("Wildcard %s\n",start));
goto done;
}
as well :-). Look at the code checked into master and 3.6.0.
Jeremy.
More information about the samba-technical
mailing list