simplify the deletion for bucket node
authorLai Jiangshan <laijs@cn.fujitsu.com>
Tue, 20 Dec 2011 15:32:48 +0000 (10:32 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 20 Dec 2011 15:32:48 +0000 (10:32 -0500)
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
rculfhash.c

index 91958dd108b38f8177fc49432ffa1a139ddf1505..e565aec0f4c6d5dc96f6901403445056490e7490 100644 (file)
@@ -1124,12 +1124,15 @@ void remove_table_partition(struct cds_lfht *ht, unsigned long i,
        assert(i > MIN_TABLE_ORDER);
        ht->flavor->read_lock();
        for (j = size + start; j < size + start + len; j++) {
-               struct cds_lfht_node *fini_node = bucket_at(ht, j);
+               struct cds_lfht_node *fini_bucket = bucket_at(ht, j);
+               struct cds_lfht_node *parent_bucket = bucket_at(ht, j - size);
 
                assert(j >= size && j < (size << 1));
                dbg_printf("remove entry: order %lu index %lu hash %lu\n",
                           i, j, j);
-               (void) _cds_lfht_del(ht, size, fini_node, 1);
+               /* Set the REMOVED_FLAG to freeze the ->next for gc */
+               uatomic_or(&fini_bucket->next, REMOVED_FLAG);
+               _cds_lfht_gc_bucket(parent_bucket, fini_bucket);
        }
        ht->flavor->read_unlock();
 }
This page took 0.025663 seconds and 4 git commands to generate.