diff options
| -rw-r--r-- | fs/logfs/dir.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/logfs/dir.c b/fs/logfs/dir.c index e7659b15a90..56a8bfbb012 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 | */ |
| 134 | static pgoff_t hash_index(u32 hash, int round) | 134 | static 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(); |
