PATCH: revamped catia

Tim Prouty tprouty at samba.org
Thu Aug 27 10:43:19 MDT 2009


On Aug 27, 2009, at 12:56 AM, Volker Lendecke wrote:

>> Additonally, since a catia mapping can map from a single byte
>> character to a multi-byte character, the directory enumeration code
>> needs to be able to handle allocated strings rather than the
>> statically sized ones in the dirent struct.  This was the motivation
>> for introducing the SMB_VFS_TRANSLATE_NAME call.
>
> I'm a bit worried about performance in the default case
> here. In a recent little profiling I've done, the
> for example smb_filename code showed up quite high in the
> callgrind statistics. This is nothing I can back with hard
> data yet, but is there a way this can be done without
> penalty in the case where this is not used?

I'm open to suggestions, but one possible way to optimize for the  
common case would be to introduce a struct that contains pointers to  
both the const char* from the dirent and the possibly talloc'd  
dirname.  This struct could be passed around instead of char *s in the  
directory enumeration code, and accessor functions could be written to  
use the dirent if the allocated dirname is NULL.

This would add some definite complexity to this code path, so I'm a  
little hesitant to prematurely optimize unless we know that the  
complexity/maintainability/performance tradeoffs would be worth it.   
Additionally, the common case is using talloc_tos(), so while not  
completely free, the allocation should be relatively cheap.

-Tim


More information about the samba-technical mailing list