[ltt-dev] [PATCH 1/6] rculfhash: Fix ht allocation bug

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Tue Nov 1 12:49:39 EDT 2011


* Lai Jiangshan (laijs at cn.fujitsu.com) wrote:
> Fix a bug introduced by Lai Jiangshan <laijs at cn.fujitsu.com>:
> alloc_split_items_count() use a wrong flags.
> 
> ht->flags should be inited earlier.

Merged, thanks!

Mathieu

> 
> Signed-off-by: Lai Jiangshan <laijs at cn.fujitsu.com>
> ---
>  rculfhash.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/rculfhash.c b/rculfhash.c
> index d786a3d..da37e97 100644
> --- a/rculfhash.c
> +++ b/rculfhash.c
> @@ -1330,6 +1330,7 @@ struct cds_lfht *_cds_lfht_new(cds_lfht_hash_fct hash_fct,
>  	init_size = max(init_size, min_alloc_size);
>  	ht = calloc(1, sizeof(struct cds_lfht));
>  	assert(ht);
> +	ht->flags = flags;
>  	ht->hash_fct = hash_fct;
>  	ht->compare_fct = compare_fct;
>  	ht->hash_seed = hash_seed;
> @@ -1345,7 +1346,6 @@ struct cds_lfht *_cds_lfht_new(cds_lfht_hash_fct hash_fct,
>  	alloc_split_items_count(ht);
>  	/* this mutex should not nest in read-side C.S. */
>  	pthread_mutex_init(&ht->resize_mutex, NULL);
> -	ht->flags = flags;
>  	order = get_count_order_ulong(init_size);
>  	ht->t.resize_target = 1UL << order;
>  	cds_lfht_create_dummy(ht, 1UL << order);
> -- 
> 1.7.4.4
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




More information about the lttng-dev mailing list