mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
rhashtable: remove nulls_base and related code.
This "feature" is unused, undocumented, and untested and so doesn't really belong. A patch is under development to properly implement support for detecting when a search gets diverted down a different chain, which the common purpose of nulls markers. This patch actually fixes a bug too. The table resizing allows a table to grow to 2^31 buckets, but the hash is truncated to 27 bits - any growth beyond 2^27 is wasteful an ineffective. This patch results in NULLS_MARKER(0) being used for all chains, and leaves the use of rht_is_a_null() to test for it. Acked-by: Herbert Xu <[email protected]> Signed-off-by: NeilBrown <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
0eb71a9da5
commit
9f9a707738
5 changed files with 6 additions and 46 deletions
|
|
@ -995,7 +995,6 @@ static u32 rhashtable_jhash2(const void *key, u32 length, u32 seed)
|
|||
* .key_offset = offsetof(struct test_obj, key),
|
||||
* .key_len = sizeof(int),
|
||||
* .hashfn = jhash,
|
||||
* .nulls_base = (1U << RHT_BASE_SHIFT),
|
||||
* };
|
||||
*
|
||||
* Configuration Example 2: Variable length keys
|
||||
|
|
@ -1029,9 +1028,6 @@ int rhashtable_init(struct rhashtable *ht,
|
|||
(params->obj_hashfn && !params->obj_cmpfn))
|
||||
return -EINVAL;
|
||||
|
||||
if (params->nulls_base && params->nulls_base < (1U << RHT_BASE_SHIFT))
|
||||
return -EINVAL;
|
||||
|
||||
memset(ht, 0, sizeof(*ht));
|
||||
mutex_init(&ht->mutex);
|
||||
spin_lock_init(&ht->lock);
|
||||
|
|
@ -1096,10 +1092,6 @@ int rhltable_init(struct rhltable *hlt, const struct rhashtable_params *params)
|
|||
{
|
||||
int err;
|
||||
|
||||
/* No rhlist NULLs marking for now. */
|
||||
if (params->nulls_base)
|
||||
return -EINVAL;
|
||||
|
||||
err = rhashtable_init(&hlt->ht, params);
|
||||
hlt->ht.rhlist = true;
|
||||
return err;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ static u32 my_hashfn(const void *data, u32 len, u32 seed)
|
|||
{
|
||||
const struct test_obj_rhl *obj = data;
|
||||
|
||||
return (obj->value.id % 10) << RHT_HASH_RESERVED_SPACE;
|
||||
return (obj->value.id % 10);
|
||||
}
|
||||
|
||||
static int my_cmpfn(struct rhashtable_compare_arg *arg, const void *obj)
|
||||
|
|
@ -99,7 +99,6 @@ static struct rhashtable_params test_rht_params = {
|
|||
.key_offset = offsetof(struct test_obj, value),
|
||||
.key_len = sizeof(struct test_obj_val),
|
||||
.hashfn = jhash,
|
||||
.nulls_base = (3U << RHT_BASE_SHIFT),
|
||||
};
|
||||
|
||||
static struct rhashtable_params test_rht_params_dup = {
|
||||
|
|
@ -296,8 +295,6 @@ static int __init test_rhltable(unsigned int entries)
|
|||
if (!obj_in_table)
|
||||
goto out_free;
|
||||
|
||||
/* nulls_base not supported in rhlist interface */
|
||||
test_rht_params.nulls_base = 0;
|
||||
err = rhltable_init(&rhlt, &test_rht_params);
|
||||
if (WARN_ON(err))
|
||||
goto out_free;
|
||||
|
|
|
|||
Loading…
Reference in a new issue