aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rhashtable.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rhashtable.c')
-rw-r--r--lib/rhashtable.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 6529fe1b45c1..935ec80f213f 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -34,7 +34,7 @@
34 34
35union nested_table { 35union nested_table {
36 union nested_table __rcu *table; 36 union nested_table __rcu *table;
37 struct rhash_lock_head __rcu *bucket; 37 struct rhash_lock_head *bucket;
38}; 38};
39 39
40static u32 head_hashfn(struct rhashtable *ht, 40static u32 head_hashfn(struct rhashtable *ht,
@@ -131,7 +131,7 @@ static union nested_table *nested_table_alloc(struct rhashtable *ht,
131 INIT_RHT_NULLS_HEAD(ntbl[i].bucket); 131 INIT_RHT_NULLS_HEAD(ntbl[i].bucket);
132 } 132 }
133 133
134 if (cmpxchg(prev, NULL, ntbl) == NULL) 134 if (cmpxchg((union nested_table **)prev, NULL, ntbl) == NULL)
135 return ntbl; 135 return ntbl;
136 /* Raced with another thread. */ 136 /* Raced with another thread. */
137 kfree(ntbl); 137 kfree(ntbl);
@@ -216,7 +216,7 @@ static struct bucket_table *rhashtable_last_table(struct rhashtable *ht,
216} 216}
217 217
218static int rhashtable_rehash_one(struct rhashtable *ht, 218static int rhashtable_rehash_one(struct rhashtable *ht,
219 struct rhash_lock_head __rcu **bkt, 219 struct rhash_lock_head **bkt,
220 unsigned int old_hash) 220 unsigned int old_hash)
221{ 221{
222 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht); 222 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht);
@@ -269,7 +269,7 @@ static int rhashtable_rehash_chain(struct rhashtable *ht,
269 unsigned int old_hash) 269 unsigned int old_hash)
270{ 270{
271 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht); 271 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht);
272 struct rhash_lock_head __rcu **bkt = rht_bucket_var(old_tbl, old_hash); 272 struct rhash_lock_head **bkt = rht_bucket_var(old_tbl, old_hash);
273 int err; 273 int err;
274 274
275 if (!bkt) 275 if (!bkt)
@@ -296,7 +296,8 @@ static int rhashtable_rehash_attach(struct rhashtable *ht,
296 * rcu_assign_pointer(). 296 * rcu_assign_pointer().
297 */ 297 */
298 298
299 if (cmpxchg(&old_tbl->future_tbl, NULL, new_tbl) != NULL) 299 if (cmpxchg((struct bucket_table **)&old_tbl->future_tbl, NULL,
300 new_tbl) != NULL)
300 return -EEXIST; 301 return -EEXIST;
301 302
302 return 0; 303 return 0;
@@ -478,7 +479,7 @@ fail:
478} 479}
479 480
480static void *rhashtable_lookup_one(struct rhashtable *ht, 481static void *rhashtable_lookup_one(struct rhashtable *ht,
481 struct rhash_lock_head __rcu **bkt, 482 struct rhash_lock_head **bkt,
482 struct bucket_table *tbl, unsigned int hash, 483 struct bucket_table *tbl, unsigned int hash,
483 const void *key, struct rhash_head *obj) 484 const void *key, struct rhash_head *obj)
484{ 485{
@@ -529,7 +530,7 @@ static void *rhashtable_lookup_one(struct rhashtable *ht,
529} 530}
530 531
531static struct bucket_table *rhashtable_insert_one(struct rhashtable *ht, 532static struct bucket_table *rhashtable_insert_one(struct rhashtable *ht,
532 struct rhash_lock_head __rcu **bkt, 533 struct rhash_lock_head **bkt,
533 struct bucket_table *tbl, 534 struct bucket_table *tbl,
534 unsigned int hash, 535 unsigned int hash,
535 struct rhash_head *obj, 536 struct rhash_head *obj,
@@ -584,7 +585,7 @@ static void *rhashtable_try_insert(struct rhashtable *ht, const void *key,
584{ 585{
585 struct bucket_table *new_tbl; 586 struct bucket_table *new_tbl;
586 struct bucket_table *tbl; 587 struct bucket_table *tbl;
587 struct rhash_lock_head __rcu **bkt; 588 struct rhash_lock_head **bkt;
588 unsigned int hash; 589 unsigned int hash;
589 void *data; 590 void *data;
590 591
@@ -1166,8 +1167,8 @@ void rhashtable_destroy(struct rhashtable *ht)
1166} 1167}
1167EXPORT_SYMBOL_GPL(rhashtable_destroy); 1168EXPORT_SYMBOL_GPL(rhashtable_destroy);
1168 1169
1169struct rhash_lock_head __rcu **__rht_bucket_nested(const struct bucket_table *tbl, 1170struct rhash_lock_head **__rht_bucket_nested(const struct bucket_table *tbl,
1170 unsigned int hash) 1171 unsigned int hash)
1171{ 1172{
1172 const unsigned int shift = PAGE_SHIFT - ilog2(sizeof(void *)); 1173 const unsigned int shift = PAGE_SHIFT - ilog2(sizeof(void *));
1173 unsigned int index = hash & ((1 << tbl->nest) - 1); 1174 unsigned int index = hash & ((1 << tbl->nest) - 1);
@@ -1195,10 +1196,10 @@ struct rhash_lock_head __rcu **__rht_bucket_nested(const struct bucket_table *tb
1195} 1196}
1196EXPORT_SYMBOL_GPL(__rht_bucket_nested); 1197EXPORT_SYMBOL_GPL(__rht_bucket_nested);
1197 1198
1198struct rhash_lock_head __rcu **rht_bucket_nested(const struct bucket_table *tbl, 1199struct rhash_lock_head **rht_bucket_nested(const struct bucket_table *tbl,
1199 unsigned int hash) 1200 unsigned int hash)
1200{ 1201{
1201 static struct rhash_lock_head __rcu *rhnull; 1202 static struct rhash_lock_head *rhnull;
1202 1203
1203 if (!rhnull) 1204 if (!rhnull)
1204 INIT_RHT_NULLS_HEAD(rhnull); 1205 INIT_RHT_NULLS_HEAD(rhnull);
@@ -1206,9 +1207,9 @@ struct rhash_lock_head __rcu **rht_bucket_nested(const struct bucket_table *tbl,
1206} 1207}
1207EXPORT_SYMBOL_GPL(rht_bucket_nested); 1208EXPORT_SYMBOL_GPL(rht_bucket_nested);
1208 1209
1209struct rhash_lock_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht, 1210struct rhash_lock_head **rht_bucket_nested_insert(struct rhashtable *ht,
1210 struct bucket_table *tbl, 1211 struct bucket_table *tbl,
1211 unsigned int hash) 1212 unsigned int hash)
1212{ 1213{
1213 const unsigned int shift = PAGE_SHIFT - ilog2(sizeof(void *)); 1214 const unsigned int shift = PAGE_SHIFT - ilog2(sizeof(void *));
1214 unsigned int index = hash & ((1 << tbl->nest) - 1); 1215 unsigned int index = hash & ((1 << tbl->nest) - 1);