[PATCH] avoid calling casefold_internal if the dn is already casefolded

Matthieu Patou mat at samba.org
Wed Dec 12 15:02:44 MST 2012


On 12/12/2012 03:26 AM, Andrew Bartlett wrote:
> On Tue, 2012-12-11 at 22:23 -0800, Matthieu Patou wrote:
>> Hello,
>>
>> Can someone review this patch ?
>>
>> It comes from analysis of indexed ldb_search with scope = one or subtree.
>> For each entries in the index we will compare the dn in the index to dn
>> specified as base for the search. And we keep casefolding the later one
>> which is useless and costly.
>>
>> With a hundreds of entries in the index the cost of cost folding is
>> starting to be one of the most important one. With this patch we can
>> avoid useless calls.
> Did this really help?  I can't see how this is any different to the
> dn->valid_case check we already do in ldb_dn_casefold_internal().
>
> Additionally, the reason that dn->valid_case needs to be checked is that
> if the DN is changed, the casefolded version may not be valid, and may
> need to be regenerated.  (ie, there is a correctness issue here as
Looking at the code it seems that if the dn is changed not only 
valid_case is changed but also casefold too or at least casefolded is 
freed and nulled.
So it seems to be correct still.

Matthieu

-- 
Matthieu Patou
Samba Team
http://samba.org



More information about the samba-technical mailing list