- ht->cds_lfht_rcu_read_lock();
- for (j = 0; j < len; j++) {
- struct cds_lfht_node *new_node =
- (struct cds_lfht_node *) &t->tbl[i]->nodes[j];
-
- dbg_printf("init entry: i %lu j %lu hash %lu\n",
- i, j, !i ? 0 : (1UL << (i - 1)) + j);
- new_node->p.reverse_hash =
- bit_reverse_ulong(!i ? 0 : (1UL << (i - 1)) + j);
- (void) _cds_lfht_add(ht, t, new_node, 0, 1);
- if (CMM_LOAD_SHARED(ht->in_progress_destroy))
- break;
- }
- ht->cds_lfht_rcu_read_unlock();
- /* Update table size */
- t->size = !i ? 1 : (1UL << i);
- dbg_printf("init new size: %lu\n", t->size);
+
+ /* Set all dummy nodes reverse hash values for a level */
+ init_table_hash(ht, i, len);
+
+ /*
+ * Link all dummy nodes into the table. Concurrent
+ * add/remove are helping us.
+ */
+ init_table_link(ht, i, len);
+
+ /*
+ * Update table size (after init for now, because no
+ * concurrent updater help (TODO)).
+ */
+ cmm_smp_wmb(); /* populate data before RCU size */
+ CMM_STORE_SHARED(ht->t.size, !i ? 1 : (1UL << i));
+ dbg_printf("init new size: %lu\n", !i ? 1 : (1UL << i));
+ if (CMM_LOAD_SHARED(ht->in_progress_destroy))
+ break;
+ }
+}
+
+static
+void remove_table(struct cds_lfht *ht, unsigned long i, unsigned long len)
+{
+ unsigned long j;
+
+ ht->cds_lfht_rcu_read_lock();
+ for (j = 0; j < len; j++) {
+ struct cds_lfht_node *fini_node =
+ (struct cds_lfht_node *) &ht->t.tbl[i]->nodes[j];
+
+ dbg_printf("remove entry: i %lu j %lu hash %lu\n",
+ i, j, !i ? 0 : (1UL << (i - 1)) + j);
+ fini_node->p.reverse_hash =
+ bit_reverse_ulong(!i ? 0 : (1UL << (i - 1)) + j);
+ (void) _cds_lfht_remove(ht, !i ? 0 : (1UL << (i - 1)),
+ fini_node, 1);