Use fixed rolling-hash mask for better block size approximation.

This commit is contained in:
Moinak Ghosh 2012-11-11 14:58:39 +05:30
parent 4d2e8ba644
commit b2cbf0699e
2 changed files with 2 additions and 1 deletions

View file

@ -180,7 +180,7 @@ create_dedupe_context(uint64_t chunksize, uint64_t real_chunksize, int rab_blk_s
ctx->fixed_flag = fixed_flag; ctx->fixed_flag = fixed_flag;
ctx->rabin_break_patt = 0; 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 = 1 << (rab_blk_sz + RAB_BLK_MIN_BITS);
ctx->rabin_avg_block_mask = ((ctx->rabin_poly_avg_block_size - 1) >> 2); ctx->rabin_avg_block_mask = RAB_BLK_MASK;
ctx->rabin_poly_min_block_size = dedupe_min_blksz(rab_blk_sz); ctx->rabin_poly_min_block_size = dedupe_min_blksz(rab_blk_sz);
ctx->delta_flag = 0; ctx->delta_flag = 0;

View file

@ -73,6 +73,7 @@
#define RAB_POLYNOMIAL_MIN_WIN_SIZE 8 #define RAB_POLYNOMIAL_MIN_WIN_SIZE 8
#define RAB_POLYNOMIAL_MAX_WIN_SIZE 64 #define RAB_POLYNOMIAL_MAX_WIN_SIZE 64
#define RAB_POLYNOMIAL_MAX_BLOCK_SIZE (128 * 1024) #define RAB_POLYNOMIAL_MAX_BLOCK_SIZE (128 * 1024)
#define RAB_BLK_MASK (((1 << RAB_BLK_MIN_BITS) - 1) >> 1)
// Minimum practical chunk size when doing dedup // Minimum practical chunk size when doing dedup
#define RAB_MIN_CHUNK_SIZE (1048576L) #define RAB_MIN_CHUNK_SIZE (1048576L)