David Dabbs writes:
 > 
 > If you downloaded the code at http://dabbs.net/reiser4 I have uploaded a new
 > zip file. I posted an incorrect version when I uploaded it in the wee hours
 > this morning. 

----------------------------------------------------------------------
static inline cmp_t_new
keycmp_new( const reiser4_key * k1 /* first key to compare */ ,
const reiser4_key * k2 /* second key to compare */ )
{
   __u64 v1, v2;
  
   if ((v1=get_key_el(k1,0)) != (v2=get_key_el(k2,0)))
      return (v1 > v2);
   if ((v1=get_key_el(k1,1)) != (v2=get_key_el(k2,1))) 
      return (v1 > v2);
   if ((v1=get_key_el(k1,2)) != (v2=get_key_el(k2,2)))
      return (v1 > v2); 
   if ((v1=get_key_el(k1,3)) != (v2=get_key_el(k2,3)))
      return (v1 > v2);
  
   return EQUAL_TO_NEW;
}
----------------------------------------------------------------------

Note that comparisons in C (like (v1 > v2)) are not guaranteed to return 0
or _1_ as a result, but simply zero, or _non-zero_.

Standard trick to "normalize" comparison result is to do

    return !!(v1 > v2));

etc. In the same vein, "isunique" argument of
znode_contains_key_strict_new() is not guaranteed to be 0 or 1, which
renders this function wrong.

That said, I think that proper way to test your functions is to plug
them into kernel reiser4 version and run some CPU intensive tests.

 > ══
 > David
 > 
 > 

Good luck,
Nikita.

 > 

Reply via email to