From 860d07e812c3001e9d6ce261c8b861dabd3203b3 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 20 Sep 2011 19:34:49 -0400 Subject: [PATCH] rculfhash: API rename: remove -> del Signed-off-by: Mathieu Desnoyers --- rculfhash.c | 22 +++++++++++----------- tests/test_urcu_hash.c | 2 +- urcu/rculfhash.h | 17 +++++++++-------- 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/rculfhash.c b/rculfhash.c index b11bbf4..074a6f4 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -204,7 +204,7 @@ #define END_VALUE NULL struct ht_items_count { - unsigned long add, remove; + unsigned long add, del; } __attribute__((aligned(CAA_CACHE_LINE_SIZE))); struct rcu_level { @@ -565,7 +565,7 @@ void ht_count_add(struct cds_lfht *ht, unsigned long size) } static -void ht_count_remove(struct cds_lfht *ht, unsigned long size) +void ht_count_del(struct cds_lfht *ht, unsigned long size) { unsigned long percpu_count; int cpu; @@ -575,18 +575,18 @@ void ht_count_remove(struct cds_lfht *ht, unsigned long size) cpu = ht_get_cpu(); if (unlikely(cpu < 0)) return; - percpu_count = uatomic_add_return(&ht->percpu_count[cpu].remove, -1); + percpu_count = uatomic_add_return(&ht->percpu_count[cpu].del, -1); if (unlikely(!(percpu_count & ((1UL << COUNT_COMMIT_ORDER) - 1)))) { unsigned long count; - dbg_printf("remove percpu %lu\n", percpu_count); + dbg_printf("del percpu %lu\n", percpu_count); count = uatomic_add_return(&ht->count, -(1UL << COUNT_COMMIT_ORDER)); /* If power of 2 */ if (!(count & (count - 1))) { if ((count >> CHAIN_LEN_RESIZE_THRESHOLD) >= size) return; - dbg_printf("remove set global %lu\n", count); + dbg_printf("del set global %lu\n", count); cds_lfht_resize_lazy_count(ht, size, count >> (CHAIN_LEN_TARGET - 1)); } @@ -614,7 +614,7 @@ void ht_count_add(struct cds_lfht *ht, unsigned long size) } static -void ht_count_remove(struct cds_lfht *ht, unsigned long size) +void ht_count_del(struct cds_lfht *ht, unsigned long size) { } @@ -844,7 +844,7 @@ gc_end: } static -int _cds_lfht_remove(struct cds_lfht *ht, unsigned long size, +int _cds_lfht_del(struct cds_lfht *ht, unsigned long size, struct cds_lfht_node *node, int dummy_removal) { @@ -1077,7 +1077,7 @@ void remove_table_partition(struct cds_lfht *ht, unsigned long i, 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)), + (void) _cds_lfht_del(ht, !i ? 0 : (1UL << (i - 1)), fini_node, 1); if (CMM_LOAD_SHARED(ht->in_progress_destroy)) break; @@ -1299,15 +1299,15 @@ struct cds_lfht_node *cds_lfht_add_unique(struct cds_lfht *ht, return ret; } -int cds_lfht_remove(struct cds_lfht *ht, struct cds_lfht_node *node) +int cds_lfht_del(struct cds_lfht *ht, struct cds_lfht_node *node) { unsigned long size; int ret; size = rcu_dereference(ht->t.size); - ret = _cds_lfht_remove(ht, size, node, 0); + ret = _cds_lfht_del(ht, size, node, 0); if (!ret) - ht_count_remove(ht, size); + ht_count_del(ht, size); return ret; } diff --git a/tests/test_urcu_hash.c b/tests/test_urcu_hash.c index 238b8e5..c19a487 100644 --- a/tests/test_urcu_hash.c +++ b/tests/test_urcu_hash.c @@ -484,7 +484,7 @@ void *thr_writer(void *_count) (void *)(((unsigned long) rand_r(&rand_lookup) % write_pool_size) + write_pool_offset), sizeof(void *)); if (node) - ret = cds_lfht_remove(test_ht, node); + ret = cds_lfht_del(test_ht, node); else ret = -ENOENT; rcu_read_unlock(); diff --git a/urcu/rculfhash.h b/urcu/rculfhash.h index 4f7cc52..c1c9ddc 100644 --- a/urcu/rculfhash.h +++ b/urcu/rculfhash.h @@ -171,8 +171,8 @@ struct cds_lfht_node *cds_lfht_lookup(struct cds_lfht *ht, void *key, size_t key * * Return NULL if no following node exists with same key. * RCU read-side lock must be held across cds_lfht_lookup and cds_lfht_next calls, and also - * between cds_lfht_next calls using the node returned by a previous cds_lfht_next. - * Call with rcu_read_lock held. + * between cds_lfht_next calls using the node returned by a previous + * cds_lfht_next. Call with rcu_read_lock held. */ struct cds_lfht_node *cds_lfht_next(struct cds_lfht *ht, struct cds_lfht_node *node); @@ -187,20 +187,21 @@ void cds_lfht_add(struct cds_lfht *ht, struct cds_lfht_node *node); * cds_lfht_add_unique - add a node to hash table, if key is not present. * * Return the node added upon success. - * Return the unique node already present upon failure. If cds_lfht_add_unique fails, - * the node passed as parameter should be freed by the caller. + * Return the unique node already present upon failure. If + * cds_lfht_add_unique fails, the node passed as parameter should be + * freed by the caller. * Call with rcu_read_lock held. */ struct cds_lfht_node *cds_lfht_add_unique(struct cds_lfht *ht, struct cds_lfht_node *node); /* - * cds_lfht_remove - remove node from hash table. + * cds_lfht_del - remove node from hash table. * - * Node can be looked up with cds_lfht_lookup. RCU read-side lock must be held between - * lookup and removal. + * Node can be looked up with cds_lfht_lookup. RCU read-side lock must + * be held between lookup and removal. * Call with rcu_read_lock held. */ -int cds_lfht_remove(struct cds_lfht *ht, struct cds_lfht_node *node); +int cds_lfht_del(struct cds_lfht *ht, struct cds_lfht_node *node); /* * cds_lfht_resize - Force a hash table resize -- 2.34.1