From: Joern Engel Date: Sat, 28 Nov 2009 12:14:08 +0000 (+0100) Subject: [LogFS] Prevent 64bit divisions in hash_index X-Git-Tag: upstream/snapshot3+hdmi~15326^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=30835cd074381048b0ea5d53e27725bbd0bdf5b7;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git [LogFS] Prevent 64bit divisions in hash_index Randy Dunlap caught this built error on i386: fs/built-in.o: In function `hash_index': dir.c:(.text+0x6c1f2): undefined reference to `__umoddi3' --- diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c index e7659b1..56a8bfb 100644 --- a/fs/logfs/dir.c +++ b/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();