diff options
Diffstat (limited to 'lib/rhashtable.c')
-rw-r--r-- | lib/rhashtable.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 09a7ada89ade..097400362467 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
@@ -162,7 +162,6 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht, | |||
162 | return NULL; | 162 | return NULL; |
163 | 163 | ||
164 | tbl->size = nbuckets; | 164 | tbl->size = nbuckets; |
165 | tbl->shift = ilog2(nbuckets); | ||
166 | 165 | ||
167 | if (alloc_bucket_locks(ht, tbl) < 0) { | 166 | if (alloc_bucket_locks(ht, tbl) < 0) { |
168 | bucket_table_free(tbl); | 167 | bucket_table_free(tbl); |
@@ -189,7 +188,7 @@ static bool rht_grow_above_75(const struct rhashtable *ht, | |||
189 | { | 188 | { |
190 | /* Expand table when exceeding 75% load */ | 189 | /* Expand table when exceeding 75% load */ |
191 | return atomic_read(&ht->nelems) > (tbl->size / 4 * 3) && | 190 | return atomic_read(&ht->nelems) > (tbl->size / 4 * 3) && |
192 | (!ht->p.max_shift || tbl->shift < ht->p.max_shift); | 191 | (!ht->p.max_shift || tbl->size < (1 << ht->p.max_shift)); |
193 | } | 192 | } |
194 | 193 | ||
195 | /** | 194 | /** |
@@ -202,7 +201,7 @@ static bool rht_shrink_below_30(const struct rhashtable *ht, | |||
202 | { | 201 | { |
203 | /* Shrink table beneath 30% load */ | 202 | /* Shrink table beneath 30% load */ |
204 | return atomic_read(&ht->nelems) < (tbl->size * 3 / 10) && | 203 | return atomic_read(&ht->nelems) < (tbl->size * 3 / 10) && |
205 | tbl->shift > ht->p.min_shift; | 204 | tbl->size > (1 << ht->p.min_shift); |
206 | } | 205 | } |
207 | 206 | ||
208 | static int rhashtable_rehash_one(struct rhashtable *ht, unsigned old_hash) | 207 | static int rhashtable_rehash_one(struct rhashtable *ht, unsigned old_hash) |