From: Mathieu Desnoyers Date: Wed, 6 Jul 2011 04:52:07 +0000 (-0400) Subject: Fix reverse hash comparison X-Git-Tag: v0.7.0~43^2~227 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=dd4505e03a99bb149c71ebabfa5d5e372a61d737;p=urcu.git Fix reverse hash comparison Signed-off-by: Mathieu Desnoyers --- diff --git a/rculfhash.c b/rculfhash.c index 450b286..f1e6674 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -220,7 +220,7 @@ void _ht_add(struct rcu_ht *ht, struct rcu_table *t, struct rcu_ht_node *node) iter = clear_flag(rcu_dereference(iter_prev->next)); if (unlikely(!iter)) break; - if (iter->reverse_hash < node->reverse_hash) + if (iter->reverse_hash > node->reverse_hash) break; iter_prev = iter; check_resize(ht, t, ++chain_len); @@ -255,7 +255,7 @@ retry: iter = clear_flag(rcu_dereference(iter_prev->next)); if (unlikely(!iter)) break; - if (iter->reverse_hash < node->reverse_hash) + if (unlikely(iter->reverse_hash > node->reverse_hash)) break; if (iter == node) { found = 1; @@ -355,12 +355,12 @@ struct rcu_ht_node *ht_lookup(struct rcu_ht *ht, void *key, size_t key_len) for (;;) { if (unlikely(!node)) break; - if (node->reverse_hash > reverse_hash) { + if (unlikely(node->reverse_hash > reverse_hash)) { node = NULL; break; } if (!ht->compare_fct(node->key, node->key_len, key, key_len)) { - if (is_removed(rcu_dereference(node->next))) + if (unlikely(is_removed(rcu_dereference(node->next)))) node = NULL; break; }