From af4c6e1d844b0f4ccd0e7b704e07570e017ce154 Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Thu, 31 Jan 2013 00:38:41 +0530 Subject: [PATCH] Reduce dedupe hash table collisions by half. --- rabin/rabin_dedup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rabin/rabin_dedup.c b/rabin/rabin_dedup.c index 6492dbf..7612269 100755 --- a/rabin/rabin_dedup.c +++ b/rabin/rabin_dedup.c @@ -560,7 +560,7 @@ process_blocks: DEBUG_STAT_EN(delta_fails = 0); DEBUG_STAT_EN(hash_collisions = 0); - ary_sz = blknum * sizeof (rabin_blockentry_t *); + ary_sz = (blknum << 1) * sizeof (rabin_blockentry_t *); htab = (rabin_blockentry_t **)(ctx->cbuf + ctx->real_chunksize - ary_sz); memset(htab, 0, ary_sz); @@ -598,8 +598,8 @@ process_blocks: * not enabled then value of similarity_hash == hash. */ ck = ctx->blocks[i]->similarity_hash; - ck += (ck / ctx->blocks[i]->length); - j = ck % blknum; + ck ^= (ck / ctx->blocks[i]->length); + j = ck % (blknum << 1); if (htab[j] == 0) { /*