unix_convert() and amount of stat() calls

Stefan (metze) Metzmacher metze at samba.org
Thu Sep 9 09:29:32 MDT 2010


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.

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20100909/da5ea310/attachment.pgp>


More information about the samba-technical mailing list