Commit e2e21c1c authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

rhashtable: Remove max_shift and min_shift

Now that nobody uses max_shift and min_shift, we can safely remove
them.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4f509df4
...@@ -83,8 +83,6 @@ struct rhashtable; ...@@ -83,8 +83,6 @@ struct rhashtable;
* @key_len: Length of key * @key_len: Length of key
* @key_offset: Offset of key in struct to be hashed * @key_offset: Offset of key in struct to be hashed
* @head_offset: Offset of rhash_head in struct to be hashed * @head_offset: Offset of rhash_head in struct to be hashed
* @max_shift: Maximum number of shifts while expanding
* @min_shift: Minimum number of shifts while shrinking
* @max_size: Maximum size while expanding * @max_size: Maximum size while expanding
* @min_size: Minimum size while shrinking * @min_size: Minimum size while shrinking
* @nulls_base: Base value to generate nulls marker * @nulls_base: Base value to generate nulls marker
...@@ -97,8 +95,6 @@ struct rhashtable_params { ...@@ -97,8 +95,6 @@ struct rhashtable_params {
size_t key_len; size_t key_len;
size_t key_offset; size_t key_offset;
size_t head_offset; size_t head_offset;
size_t max_shift;
size_t min_shift;
unsigned int max_size; unsigned int max_size;
unsigned int min_size; unsigned int min_size;
u32 nulls_base; u32 nulls_base;
......
...@@ -188,7 +188,6 @@ static bool rht_grow_above_75(const struct rhashtable *ht, ...@@ -188,7 +188,6 @@ static bool rht_grow_above_75(const struct rhashtable *ht,
{ {
/* Expand table when exceeding 75% load */ /* Expand table when exceeding 75% load */
return atomic_read(&ht->nelems) > (tbl->size / 4 * 3) && return atomic_read(&ht->nelems) > (tbl->size / 4 * 3) &&
(!ht->p.max_shift || tbl->size < (1 << ht->p.max_shift)) &&
(!ht->p.max_size || tbl->size < ht->p.max_size); (!ht->p.max_size || tbl->size < ht->p.max_size);
} }
...@@ -202,7 +201,6 @@ static bool rht_shrink_below_30(const struct rhashtable *ht, ...@@ -202,7 +201,6 @@ static bool rht_shrink_below_30(const struct rhashtable *ht,
{ {
/* Shrink table beneath 30% load */ /* Shrink table beneath 30% load */
return atomic_read(&ht->nelems) < (tbl->size * 3 / 10) && return atomic_read(&ht->nelems) < (tbl->size * 3 / 10) &&
tbl->size > (1 << ht->p.min_shift) &&
tbl->size > ht->p.min_size; tbl->size > ht->p.min_size;
} }
...@@ -875,8 +873,7 @@ EXPORT_SYMBOL_GPL(rhashtable_walk_stop); ...@@ -875,8 +873,7 @@ EXPORT_SYMBOL_GPL(rhashtable_walk_stop);
static size_t rounded_hashtable_size(struct rhashtable_params *params) static size_t rounded_hashtable_size(struct rhashtable_params *params)
{ {
return max(roundup_pow_of_two(params->nelem_hint * 4 / 3), return max(roundup_pow_of_two(params->nelem_hint * 4 / 3),
max(1UL << params->min_shift, (unsigned long)params->min_size);
(unsigned long)params->min_size));
} }
/** /**
...@@ -936,8 +933,6 @@ int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params) ...@@ -936,8 +933,6 @@ int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params)
if (params->nulls_base && params->nulls_base < (1U << RHT_BASE_SHIFT)) if (params->nulls_base && params->nulls_base < (1U << RHT_BASE_SHIFT))
return -EINVAL; return -EINVAL;
params->min_shift = max_t(size_t, params->min_shift,
ilog2(HASH_MIN_SIZE));
params->min_size = max(params->min_size, HASH_MIN_SIZE); params->min_size = max(params->min_size, HASH_MIN_SIZE);
if (params->nelem_hint) if (params->nelem_hint)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment