Skip to content

Commit

Permalink
rhashtable: Move masking back into key_hashfn
Browse files Browse the repository at this point in the history
This patch reverts commit c88455c
("rhashtable: key_hashfn() must return full hash value") because
the only user of it always masks the hash value.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Herbert Xu authored and David S. Miller committed Mar 12, 2015
1 parent 6b9f53b commit 8d2b187
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/rhashtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ static u32 obj_raw_hashfn(struct rhashtable *ht,
static u32 key_hashfn(struct rhashtable *ht, const struct bucket_table *tbl,
const void *key, u32 len)
{
return ht->p.hashfn(key, len, tbl->hash_rnd) >> HASH_RESERVED_SPACE;
return rht_bucket_index(tbl, ht->p.hashfn(key, len, tbl->hash_rnd) >>
HASH_RESERVED_SPACE);
}

static u32 head_hashfn(struct rhashtable *ht,
Expand Down Expand Up @@ -622,7 +623,7 @@ void *rhashtable_lookup_compare(struct rhashtable *ht, const void *key,
tbl = rht_dereference_rcu(ht->tbl, ht);
hash = key_hashfn(ht, tbl, key, ht->p.key_len);
restart:
rht_for_each_rcu(he, tbl, rht_bucket_index(tbl, hash)) {
rht_for_each_rcu(he, tbl, hash) {
if (!compare(rht_obj(ht, he), arg))
continue;
rcu_read_unlock();
Expand Down

0 comments on commit 8d2b187

Please sign in to comment.