[ltt-dev] [PATCH 9/9] rculfhash: compare hash value before call compare_fct()
Lai Jiangshan
laijs at cn.fujitsu.com
Mon Oct 10 21:23:59 EDT 2011
Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
---
rculfhash.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/rculfhash.c b/rculfhash.c
index eca3a4e..71ef411 100644
--- a/rculfhash.c
+++ b/rculfhash.c
@@ -880,6 +880,7 @@ struct cds_lfht_node *_cds_lfht_add(struct cds_lfht *ht,
goto gc_node;
if ((mode == ADD_UNIQUE || mode == ADD_REPLACE)
&& !is_dummy(next)
+ && clear_flag(iter)->p.reverse_hash == node->p.reverse_hash
&& !ht->compare_fct(node->key, node->key_len,
clear_flag(iter)->key,
clear_flag(iter)->key_len)) {
@@ -1329,6 +1330,7 @@ void cds_lfht_lookup(struct cds_lfht *ht, void *key, size_t key_len,
next = rcu_dereference(node->p.next);
if (likely(!is_removed(next))
&& !is_dummy(next)
+ && clear_flag(next)->p.reverse_hash == reverse_hash
&& likely(!ht->compare_fct(node->key, node->key_len, key, key_len))) {
break;
}
--
1.7.4.4
More information about the lttng-dev
mailing list