[sheepdog] [PATCH v3 1/2] sheep/http: don't call oalloc_free() when onode is inlined

Liu Yuan namei.unix at gmail.com
Fri Feb 21 06:46:58 CET 2014


On Fri, Feb 21, 2014 at 01:26:31PM +0800, Robin Dong wrote:
> From: Robin Dong <sanbai at taobao.com>
> 
> The inlined-onode does not contain any extent, so we don't need to free any space.
> And, if we call oalloc_free(), it will pass wrong arguments ( onode->o_extent[0].start
> and onode->o_extent[0].count) to oalloc_free().
> 
> Signed-off-by: Robin Dong <sanbai at taobao.com>
> ---
>  sheep/http/kv.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/sheep/http/kv.c b/sheep/http/kv.c
> index 0c54340..f7dd40f 100644
> --- a/sheep/http/kv.c
> +++ b/sheep/http/kv.c
> @@ -829,14 +829,17 @@ out:
>  static int onode_free_data(struct kv_onode *onode)
>  {
>  	uint32_t data_vid = onode->data_vid;
> -	int ret;
> +	int ret = SD_RES_SUCCESS;
>  
> -	sys->cdrv->lock(data_vid);
> -	ret = oalloc_free(data_vid, onode->o_extent[0].start,
> -			  onode->o_extent[0].count);
> -	sys->cdrv->unlock(data_vid);
> -	if (ret != SD_RES_SUCCESS)
> -		sd_err("failed to free %s", onode->name);
> +	/* it don't need to free data for inlined onode */
> +	if (onode->inlined != 1) {
> +		sys->cdrv->lock(data_vid);
> +		ret = oalloc_free(data_vid, onode->o_extent[0].start,
> +				  onode->o_extent[0].count);
> +		sys->cdrv->unlock(data_vid);
> +		if (ret != SD_RES_SUCCESS)
> +			sd_err("failed to free %s", onode->name);
> +	}
>  	return ret;
>  }
>  
> -- 
> 1.7.12.4
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog

Applied this two thanks

Yuan



More information about the sheepdog mailing list