From: Mathieu Desnoyers Date: Sun, 12 Aug 2012 20:13:27 +0000 (-0400) Subject: rcuja: shadow clear also frees the rcu ja node associated X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=25fde237be5027b94803d514f92d65a0263b65e9;p=urcu.git rcuja: shadow clear also frees the rcu ja node associated Signed-off-by: Mathieu Desnoyers --- diff --git a/rcuja/rcuja-internal.h b/rcuja/rcuja-internal.h index a8402cc..b892a87 100644 --- a/rcuja/rcuja-internal.h +++ b/rcuja/rcuja-internal.h @@ -49,4 +49,20 @@ struct rcu_ja { struct cds_lfht *ht; }; +__attribute__((visibility("protected"))) +struct rcu_ja_shadow_node *rcuja_shadow_lookup_lock(struct cds_lfht *ht, + struct rcu_ja_node *node); +__attribute__((visibility("protected"))) +void rcuja_shadow_unlock(struct rcu_ja_shadow_node *shadow_node); +__attribute__((visibility("protected"))) +int rcuja_shadow_set(struct cds_lfht *ht, + struct rcu_ja_node *node); +__attribute__((visibility("protected"))) +int rcuja_shadow_clear_and_free_node(struct cds_lfht *ht, + struct rcu_ja_node *node); +__attribute__((visibility("protected"))) +struct cds_lfht *rcuja_create_ht(void); +__attribute__((visibility("protected"))) +void rcuja_delete_ht(struct cds_lfht *ht); + #endif /* _URCU_RCUJA_INTERNAL_H */ diff --git a/rcuja/rcuja-shadow-nodes.c b/rcuja/rcuja-shadow-nodes.c index 6264a3a..b737e26 100644 --- a/rcuja/rcuja-shadow-nodes.c +++ b/rcuja/rcuja-shadow-nodes.c @@ -215,6 +215,7 @@ rcu_unlock: return shadow_node; } +__attribute__((visibility("protected"))) void rcuja_shadow_unlock(struct rcu_ja_shadow_node *shadow_node) { int ret; @@ -253,15 +254,16 @@ int rcuja_shadow_set(struct cds_lfht *ht, } static -void free_shadow_node(struct rcu_head *head) +void free_shadow_node_and_node(struct rcu_head *head) { struct rcu_ja_shadow_node *shadow_node = caa_container_of(head, struct rcu_ja_shadow_node, head); + free(shadow_node->node); free(shadow_node); } __attribute__((visibility("protected"))) -int rcuja_shadow_clear(struct cds_lfht *ht, +int rcuja_shadow_clear_and_free_node(struct cds_lfht *ht, struct rcu_ja_node *node) { struct cds_lfht_iter iter; @@ -289,7 +291,7 @@ int rcuja_shadow_clear(struct cds_lfht *ht, */ ret = cds_lfht_del(ht, lookup_node); if (!ret) { - call_rcu(&shadow_node->head, free_shadow_node); + call_rcu(&shadow_node->head, free_shadow_node_and_node); } lockret = pthread_mutex_unlock(&shadow_node->lock); assert(!lockret);