aboutsummaryrefslogtreecommitdiffstats
path: root/fs/logfs
diff options
context:
space:
mode:
authorJoern Engel <joern@logfs.org>2009-11-28 07:14:08 -0500
committerJoern Engel <joern@logfs.org>2009-11-28 07:14:08 -0500
commit30835cd074381048b0ea5d53e27725bbd0bdf5b7 (patch)
tree4dca9f2ef0660542e544066ce60ee5bed63bb98e /fs/logfs
parentddfd1f04b7bc557c1fe9b110e99cebb2e19d4993 (diff)
[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'
Diffstat (limited to 'fs/logfs')
-rw-r--r--fs/logfs/dir.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c
index e7659b15a907..56a8bfbb0120 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)
133 */ 133 */
134static pgoff_t hash_index(u32 hash, int round) 134static pgoff_t hash_index(u32 hash, int round)
135{ 135{
136 u32 i0_blocks = I0_BLOCKS;
137 u32 i1_blocks = I1_BLOCKS;
138 u32 i2_blocks = I2_BLOCKS;
139 u32 i3_blocks = I3_BLOCKS;
140
136 switch (round) { 141 switch (round) {
137 case 0: 142 case 0:
138 return hash % I0_BLOCKS; 143 return hash % i0_blocks;
139 case 1: 144 case 1:
140 return I0_BLOCKS + hash % (I1_BLOCKS - I0_BLOCKS); 145 return i0_blocks + hash % (i1_blocks - i0_blocks);
141 case 2: 146 case 2:
142 return I1_BLOCKS + hash % (I2_BLOCKS - I1_BLOCKS); 147 return i1_blocks + hash % (i2_blocks - i1_blocks);
143 case 3: 148 case 3:
144 return I2_BLOCKS + hash % (I3_BLOCKS - I2_BLOCKS); 149 return i2_blocks + hash % (i3_blocks - i2_blocks);
145 case 4 ... 19: 150 case 4 ... 19:
146 return I3_BLOCKS + 16 * (hash % (((1<<31) - I3_BLOCKS) / 16)) 151 return i3_blocks + 16 * (hash % (((1<<31) - i3_blocks) / 16))
147 + round - 4; 152 + round - 4;
148 } 153 }
149 BUG(); 154 BUG();