From 63b48ed2b0fbc5f9c7f60fd424dba84369f57dfe Mon Sep 17 00:00:00 2001 From: Joern Engel Date: Sat, 28 Nov 2009 13:14:08 +0100 Subject: [PATCH] --- yaml --- r: 186440 b: refs/heads/master c: 30835cd074381048b0ea5d53e27725bbd0bdf5b7 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/logfs/dir.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 2488eab56a13..2af9c81eb5aa 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ddfd1f04b7bc557c1fe9b110e99cebb2e19d4993 +refs/heads/master: 30835cd074381048b0ea5d53e27725bbd0bdf5b7 diff --git a/trunk/fs/logfs/dir.c b/trunk/fs/logfs/dir.c index e7659b15a907..56a8bfbb0120 100644 --- a/trunk/fs/logfs/dir.c +++ b/trunk/fs/logfs/dir.c @@ -133,17 +133,22 @@ static u32 hash_32(const char *s, int len, u32 seed) */ static pgoff_t hash_index(u32 hash, int round) { + u32 i0_blocks = I0_BLOCKS; + u32 i1_blocks = I1_BLOCKS; + u32 i2_blocks = I2_BLOCKS; + u32 i3_blocks = I3_BLOCKS; + switch (round) { case 0: - return hash % I0_BLOCKS; + return hash % i0_blocks; case 1: - return I0_BLOCKS + hash % (I1_BLOCKS - I0_BLOCKS); + return i0_blocks + hash % (i1_blocks - i0_blocks); case 2: - return I1_BLOCKS + hash % (I2_BLOCKS - I1_BLOCKS); + return i1_blocks + hash % (i2_blocks - i1_blocks); case 3: - return I2_BLOCKS + hash % (I3_BLOCKS - I2_BLOCKS); + return i2_blocks + hash % (i3_blocks - i2_blocks); case 4 ... 19: - return I3_BLOCKS + 16 * (hash % (((1<<31) - I3_BLOCKS) / 16)) + return i3_blocks + 16 * (hash % (((1<<31) - i3_blocks) / 16)) + round - 4; } BUG();