From 393ced991aec0bf8e404daad7d62e23092d04f55 Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Sun, 18 Nov 2012 20:20:16 +0530 Subject: [PATCH] A couple of minor cleanups. --- crypto/crypto_utils.c | 2 +- rabin/rabin_dedup.c | 2 +- rabin/rabin_dedup.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/crypto/crypto_utils.c b/crypto/crypto_utils.c index f154424..b159ed2 100644 --- a/crypto/crypto_utils.c +++ b/crypto/crypto_utils.c @@ -138,7 +138,7 @@ init_sha256(void) } /* - * Check is either the given checksum name or id is valid and + * Check if either the given checksum name or id is valid and * return it's properties. */ int diff --git a/rabin/rabin_dedup.c b/rabin/rabin_dedup.c index ad32df8..fd0790a 100755 --- a/rabin/rabin_dedup.c +++ b/rabin/rabin_dedup.c @@ -179,7 +179,7 @@ create_dedupe_context(uint64_t chunksize, uint64_t real_chunksize, int rab_blk_s ctx->fixed_flag = fixed_flag; ctx->rabin_break_patt = 0; - ctx->rabin_poly_avg_block_size = 1 << (rab_blk_sz + RAB_BLK_MIN_BITS); + ctx->rabin_poly_avg_block_size = RAB_BLK_AVG_SZ(rab_blk_sz); ctx->rabin_avg_block_mask = RAB_BLK_MASK; ctx->rabin_poly_min_block_size = dedupe_min_blksz(rab_blk_sz); ctx->delta_flag = 0; diff --git a/rabin/rabin_dedup.h b/rabin/rabin_dedup.h index 7aab87f..d98aeb6 100644 --- a/rabin/rabin_dedup.h +++ b/rabin/rabin_dedup.h @@ -74,6 +74,7 @@ #define RAB_POLYNOMIAL_MAX_WIN_SIZE 64 #define RAB_POLYNOMIAL_MAX_BLOCK_SIZE (128 * 1024) #define RAB_BLK_MASK (((1 << RAB_BLK_MIN_BITS) - 1) >> 1) +#define RAB_BLK_AVG_SZ(x) (1 << ((x) + RAB_BLK_MIN_BITS)) // Minimum practical chunk size when doing dedup #define RAB_MIN_CHUNK_SIZE (1048576L)