Lines Matching refs:tbl

38 		       const struct bucket_table *tbl,
41 return rht_head_hashfn(ht, tbl, he, ht->p);
53 int lockdep_rht_bucket_is_held(const struct bucket_table *tbl, u32 hash)
57 if (unlikely(tbl->nest))
59 return bit_spin_is_locked(0, (unsigned long *)&tbl->buckets[hash]);
67 const struct bucket_table *tbl)
70 * because it's set at the same time as tbl->nest.
72 return (void *)rcu_dereference_protected(tbl->buckets[0], 1);
94 static void nested_bucket_table_free(const struct bucket_table *tbl)
96 unsigned int size = tbl->size >> tbl->nest;
97 unsigned int len = 1 << tbl->nest;
101 ntbl = nested_table_top(tbl);
109 static void bucket_table_free(const struct bucket_table *tbl)
111 if (tbl->nest)
112 nested_bucket_table_free(tbl);
114 kvfree(tbl);
152 struct bucket_table *tbl;
158 size = sizeof(*tbl) + sizeof(tbl->buckets[0]);
160 tbl = kzalloc(size, gfp);
161 if (!tbl)
164 if (!nested_table_alloc(ht, (union nested_table __rcu **)tbl->buckets,
166 kfree(tbl);
170 tbl->nest = (ilog2(nbuckets) - 1) % shift + 1;
172 return tbl;
179 struct bucket_table *tbl = NULL;
184 tbl = kvzalloc(struct_size(tbl, buckets, nbuckets), gfp);
188 if (tbl == NULL && (gfp & ~__GFP_NOFAIL) != GFP_KERNEL) {
189 tbl = nested_bucket_table_alloc(ht, nbuckets, gfp);
193 if (tbl == NULL)
196 lockdep_init_map(&tbl->dep_map, "rhashtable_bucket", &__key, 0);
198 tbl->size = size;
200 rcu_head_init(&tbl->rcu);
201 INIT_LIST_HEAD(&tbl->walkers);
203 tbl->hash_rnd = get_random_u32();
206 INIT_RHT_NULLS_HEAD(tbl->buckets[i]);
208 return tbl;
212 struct bucket_table *tbl)
217 new_tbl = tbl;
218 tbl = rht_dereference_rcu(tbl->future_tbl, ht);
219 } while (tbl);
228 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht);
279 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht);
317 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht);
335 rcu_assign_pointer(ht->tbl, new_tbl);
339 walker->tbl = NULL;
392 struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht);
413 struct bucket_table *tbl;
419 tbl = rht_dereference(ht->tbl, ht);
420 tbl = rhashtable_last_table(ht, tbl);
422 if (rht_grow_above_75(ht, tbl))
423 err = rhashtable_rehash_alloc(ht, tbl, tbl->size * 2);
424 else if (ht->p.automatic_shrinking && rht_shrink_below_30(ht, tbl))
426 else if (tbl->nest)
427 err = rhashtable_rehash_alloc(ht, tbl, tbl->size);
443 struct bucket_table *tbl)
450 old_tbl = rht_dereference_rcu(ht->tbl, ht);
452 size = tbl->size;
456 if (rht_grow_above_75(ht, tbl))
459 else if (old_tbl != tbl)
468 err = rhashtable_rehash_attach(ht, tbl, new_tbl);
480 if (likely(rcu_access_pointer(tbl->future_tbl)))
492 struct bucket_table *tbl, unsigned int hash,
504 rht_for_each_from(head, rht_ptr(bkt, tbl, hash), tbl, hash) {
524 head = rht_dereference_bucket(head->next, tbl, hash);
543 struct bucket_table *tbl, unsigned int hash, struct rhash_head *obj,
555 new_tbl = rht_dereference_rcu(tbl->future_tbl, ht);
562 if (unlikely(rht_grow_above_max(ht, tbl)))
565 if (unlikely(rht_grow_above_100(ht, tbl)))
568 head = rht_ptr(bkt, tbl, hash);
584 if (rht_grow_above_75(ht, tbl))
594 struct bucket_table *tbl;
600 new_tbl = rcu_dereference(ht->tbl);
603 tbl = new_tbl;
604 hash = rht_head_hashfn(ht, tbl, obj, ht->p);
605 if (rcu_access_pointer(tbl->future_tbl))
607 bkt = rht_bucket_var(tbl, hash);
609 bkt = rht_bucket_insert(ht, tbl, hash);
611 new_tbl = rht_dereference_rcu(tbl->future_tbl, ht);
614 flags = rht_lock(tbl, bkt);
615 data = rhashtable_lookup_one(ht, bkt, tbl,
617 new_tbl = rhashtable_insert_one(ht, bkt, tbl,
622 rht_unlock(tbl, bkt, flags);
627 data = ERR_PTR(rhashtable_insert_rehash(ht, tbl) ?:
678 iter->walker.tbl =
679 rcu_dereference_protected(ht->tbl, lockdep_is_held(&ht->lock));
680 list_add(&iter->walker.list, &iter->walker.tbl->walkers);
694 if (iter->walker.tbl)
727 if (iter->walker.tbl)
733 if (!iter->walker.tbl) {
734 iter->walker.tbl = rht_dereference_rcu(ht->tbl, ht);
747 rht_for_each_rcu(p, iter->walker.tbl, iter->slot) {
762 rht_for_each_rcu(p, iter->walker.tbl, iter->slot) {
793 struct bucket_table *tbl = iter->walker.tbl;
799 if (!tbl)
802 for (; iter->slot < tbl->size; iter->slot++) {
805 rht_for_each_rcu(p, tbl, iter->slot) {
839 iter->walker.tbl = rht_dereference_rcu(tbl->future_tbl, ht);
840 if (iter->walker.tbl) {
938 struct bucket_table *tbl = iter->walker.tbl;
940 if (!tbl)
946 if (rcu_head_after_call_rcu(&tbl->rcu, bucket_table_free_rcu))
948 iter->walker.tbl = NULL;
950 list_add(&iter->walker.list, &tbl->walkers);
1022 struct bucket_table *tbl;
1065 tbl = bucket_table_alloc(ht, size, GFP_KERNEL);
1066 if (unlikely(tbl == NULL)) {
1068 tbl = bucket_table_alloc(ht, size, GFP_KERNEL | __GFP_NOFAIL);
1073 RCU_INIT_POINTER(ht->tbl, tbl);
1138 struct bucket_table *tbl, *next_tbl;
1144 tbl = rht_dereference(ht->tbl, ht);
1147 for (i = 0; i < tbl->size; i++) {
1151 for (pos = rht_ptr_exclusive(rht_bucket(tbl, i)),
1162 next_tbl = rht_dereference(tbl->future_tbl, ht);
1163 bucket_table_free(tbl);
1165 tbl = next_tbl;
1179 const struct bucket_table *tbl, unsigned int hash)
1182 unsigned int index = hash & ((1 << tbl->nest) - 1);
1183 unsigned int size = tbl->size >> tbl->nest;
1187 ntbl = nested_table_top(tbl);
1188 ntbl = rht_dereference_bucket_rcu(ntbl[index].table, tbl, hash);
1189 subhash >>= tbl->nest;
1194 tbl, hash);
1208 const struct bucket_table *tbl, unsigned int hash)
1214 return __rht_bucket_nested(tbl, hash) ?: &rhnull;
1219 struct rhashtable *ht, struct bucket_table *tbl, unsigned int hash)
1222 unsigned int index = hash & ((1 << tbl->nest) - 1);
1223 unsigned int size = tbl->size >> tbl->nest;
1226 ntbl = nested_table_top(tbl);
1227 hash >>= tbl->nest;