* @size: Number of hash buckets
* @rehash: Current bucket being rehashed
* @hash_rnd: Random seed to fold into hash
- * @shift: Current size (1 << shift)
* @locks_mask: Mask to apply before accessing locks[]
* @locks: Array of spinlocks protecting individual buckets
* @walkers: List of active walkers
unsigned int size;
unsigned int rehash;
u32 hash_rnd;
- u32 shift;
unsigned int locks_mask;
spinlock_t *locks;
struct list_head walkers;
return NULL;
tbl->size = nbuckets;
- tbl->shift = ilog2(nbuckets);
if (alloc_bucket_locks(ht, tbl) < 0) {
bucket_table_free(tbl);
{
/* Expand table when exceeding 75% load */
return atomic_read(&ht->nelems) > (tbl->size / 4 * 3) &&
- (!ht->p.max_shift || tbl->shift < ht->p.max_shift);
+ (!ht->p.max_shift || tbl->size < (1 << ht->p.max_shift));
}
/**
{
/* Shrink table beneath 30% load */
return atomic_read(&ht->nelems) < (tbl->size * 3 / 10) &&
- tbl->shift > ht->p.min_shift;
+ tbl->size > (1 << ht->p.min_shift);
}
static int rhashtable_rehash_one(struct rhashtable *ht, unsigned old_hash)