From: Eric Wong Date: Tue, 24 Jun 2014 01:20:32 +0000 (+0000) Subject: rculfhash: remove duplicated code X-Git-Tag: v0.7.13~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=996311b1befac8bd4dc3ba8103427815aa6d9556;p=urcu.git rculfhash: remove duplicated code Signed-off-by: Eric Wong Signed-off-by: Mathieu Desnoyers --- diff --git a/rculfhash.c b/rculfhash.c index ea65611..8081dc7 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -1175,6 +1175,10 @@ void partition_resize_helper(struct cds_lfht *ht, unsigned long i, int thread, ret; unsigned long nr_threads; + assert(nr_cpus_mask != -1); + if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD) + goto fallback; + /* * Note: nr_cpus_mask + 1 is always power of 2. * We spawn just the number of threads we need to satisfy the minimum @@ -1267,13 +1271,6 @@ static void init_table_populate(struct cds_lfht *ht, unsigned long i, unsigned long len) { - assert(nr_cpus_mask != -1); - if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD) { - ht->flavor->thread_online(); - init_table_populate_partition(ht, i, 0, len); - ht->flavor->thread_offline(); - return; - } partition_resize_helper(ht, i, len, init_table_populate_partition); } @@ -1366,14 +1363,6 @@ void remove_table_partition(struct cds_lfht *ht, unsigned long i, static void remove_table(struct cds_lfht *ht, unsigned long i, unsigned long len) { - - assert(nr_cpus_mask != -1); - if (nr_cpus_mask < 0 || len < 2 * MIN_PARTITION_PER_THREAD) { - ht->flavor->thread_online(); - remove_table_partition(ht, i, 0, len); - ht->flavor->thread_offline(); - return; - } partition_resize_helper(ht, i, len, remove_table_partition); }