Skip to content

Commit e2e21c1

Browse files
herbertxdavem330
authored andcommitted
rhashtable: Remove max_shift and min_shift
Now that nobody uses max_shift and min_shift, we can safely remove them. Signed-off-by: Herbert Xu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4f509df commit e2e21c1

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

include/linux/rhashtable.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ struct rhashtable;
8383
* @key_len: Length of key
8484
* @key_offset: Offset of key in struct to be hashed
8585
* @head_offset: Offset of rhash_head in struct to be hashed
86-
* @max_shift: Maximum number of shifts while expanding
87-
* @min_shift: Minimum number of shifts while shrinking
8886
* @max_size: Maximum size while expanding
8987
* @min_size: Minimum size while shrinking
9088
* @nulls_base: Base value to generate nulls marker
@@ -97,8 +95,6 @@ struct rhashtable_params {
9795
size_t key_len;
9896
size_t key_offset;
9997
size_t head_offset;
100-
size_t max_shift;
101-
size_t min_shift;
10298
unsigned int max_size;
10399
unsigned int min_size;
104100
u32 nulls_base;

lib/rhashtable.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ static bool rht_grow_above_75(const struct rhashtable *ht,
188188
{
189189
/* Expand table when exceeding 75% load */
190190
return atomic_read(&ht->nelems) > (tbl->size / 4 * 3) &&
191-
(!ht->p.max_shift || tbl->size < (1 << ht->p.max_shift)) &&
192191
(!ht->p.max_size || tbl->size < ht->p.max_size);
193192
}
194193

@@ -202,7 +201,6 @@ static bool rht_shrink_below_30(const struct rhashtable *ht,
202201
{
203202
/* Shrink table beneath 30% load */
204203
return atomic_read(&ht->nelems) < (tbl->size * 3 / 10) &&
205-
tbl->size > (1 << ht->p.min_shift) &&
206204
tbl->size > ht->p.min_size;
207205
}
208206

@@ -875,8 +873,7 @@ EXPORT_SYMBOL_GPL(rhashtable_walk_stop);
875873
static size_t rounded_hashtable_size(struct rhashtable_params *params)
876874
{
877875
return max(roundup_pow_of_two(params->nelem_hint * 4 / 3),
878-
max(1UL << params->min_shift,
879-
(unsigned long)params->min_size));
876+
(unsigned long)params->min_size);
880877
}
881878

882879
/**
@@ -936,8 +933,6 @@ int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params)
936933
if (params->nulls_base && params->nulls_base < (1U << RHT_BASE_SHIFT))
937934
return -EINVAL;
938935

939-
params->min_shift = max_t(size_t, params->min_shift,
940-
ilog2(HASH_MIN_SIZE));
941936
params->min_size = max(params->min_size, HASH_MIN_SIZE);
942937

943938
if (params->nelem_hint)

0 commit comments

Comments
 (0)