Commit 9b4f64a2 authored by NeilBrown's avatar NeilBrown Committed by David S. Miller

rhashtable: simplify INIT_RHT_NULLS_HEAD()

The 'ht' and 'hash' arguments to INIT_RHT_NULLS_HEAD() are
no longer used - so drop them.  This allows us to also
remove the nhash argument from nested_table_alloc().
Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9f9a7077
...@@ -75,7 +75,7 @@ struct bucket_table { ...@@ -75,7 +75,7 @@ struct bucket_table {
struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp; struct rhash_head __rcu *buckets[] ____cacheline_aligned_in_smp;
}; };
#define INIT_RHT_NULLS_HEAD(ptr, ht, hash) \ #define INIT_RHT_NULLS_HEAD(ptr) \
((ptr) = (typeof(ptr)) NULLS_MARKER(0)) ((ptr) = (typeof(ptr)) NULLS_MARKER(0))
static inline bool rht_is_a_nulls(const struct rhash_head *ptr) static inline bool rht_is_a_nulls(const struct rhash_head *ptr)
......
...@@ -116,8 +116,7 @@ static void bucket_table_free_rcu(struct rcu_head *head) ...@@ -116,8 +116,7 @@ static void bucket_table_free_rcu(struct rcu_head *head)
static union nested_table *nested_table_alloc(struct rhashtable *ht, static union nested_table *nested_table_alloc(struct rhashtable *ht,
union nested_table __rcu **prev, union nested_table __rcu **prev,
unsigned int shifted, unsigned int shifted)
unsigned int nhash)
{ {
union nested_table *ntbl; union nested_table *ntbl;
int i; int i;
...@@ -130,8 +129,7 @@ static union nested_table *nested_table_alloc(struct rhashtable *ht, ...@@ -130,8 +129,7 @@ static union nested_table *nested_table_alloc(struct rhashtable *ht,
if (ntbl && shifted) { if (ntbl && shifted) {
for (i = 0; i < PAGE_SIZE / sizeof(ntbl[0].bucket); i++) for (i = 0; i < PAGE_SIZE / sizeof(ntbl[0].bucket); i++)
INIT_RHT_NULLS_HEAD(ntbl[i].bucket, ht, INIT_RHT_NULLS_HEAD(ntbl[i].bucket);
(i << shifted) | nhash);
} }
rcu_assign_pointer(*prev, ntbl); rcu_assign_pointer(*prev, ntbl);
...@@ -157,7 +155,7 @@ static struct bucket_table *nested_bucket_table_alloc(struct rhashtable *ht, ...@@ -157,7 +155,7 @@ static struct bucket_table *nested_bucket_table_alloc(struct rhashtable *ht,
return NULL; return NULL;
if (!nested_table_alloc(ht, (union nested_table __rcu **)tbl->buckets, if (!nested_table_alloc(ht, (union nested_table __rcu **)tbl->buckets,
0, 0)) { 0)) {
kfree(tbl); kfree(tbl);
return NULL; return NULL;
} }
...@@ -207,7 +205,7 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht, ...@@ -207,7 +205,7 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht,
tbl->hash_rnd = get_random_u32(); tbl->hash_rnd = get_random_u32();
for (i = 0; i < nbuckets; i++) for (i = 0; i < nbuckets; i++)
INIT_RHT_NULLS_HEAD(tbl->buckets[i], ht, i); INIT_RHT_NULLS_HEAD(tbl->buckets[i]);
return tbl; return tbl;
} }
...@@ -1217,7 +1215,7 @@ struct rhash_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht, ...@@ -1217,7 +1215,7 @@ struct rhash_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht,
nhash = index; nhash = index;
shifted = tbl->nest; shifted = tbl->nest;
ntbl = nested_table_alloc(ht, &ntbl[index].table, ntbl = nested_table_alloc(ht, &ntbl[index].table,
size <= (1 << shift) ? shifted : 0, nhash); size <= (1 << shift) ? shifted : 0);
while (ntbl && size > (1 << shift)) { while (ntbl && size > (1 << shift)) {
index = hash & ((1 << shift) - 1); index = hash & ((1 << shift) - 1);
...@@ -1226,8 +1224,7 @@ struct rhash_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht, ...@@ -1226,8 +1224,7 @@ struct rhash_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht,
nhash |= index << shifted; nhash |= index << shifted;
shifted += shift; shifted += shift;
ntbl = nested_table_alloc(ht, &ntbl[index].table, ntbl = nested_table_alloc(ht, &ntbl[index].table,
size <= (1 << shift) ? shifted : 0, size <= (1 << shift) ? shifted : 0);
nhash);
} }
if (!ntbl) if (!ntbl)
......
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