[sheepdog] [PATCH] sheep: remove delete_error from vdi deletion_work

Liu Yuan namei.unix at gmail.com
Wed Jun 27 04:51:21 CEST 2012


On 06/27/2012 10:05 AM, levin li wrote:
> From: levin li <xingke.lwp at taobao.com>
> 
> Since we've made gateway to retry when removing an object fail
> during recovery, the most possible case that make remove_object
> fail is that we meet an EIO, in which case even if we try to
> delete again the error still exist, so delete_error is no longer
> needed.
> 
> Signed-off-by: levin li <xingke.lwp at taobao.com>
> ---
>  sheep/vdi.c |   20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/sheep/vdi.c b/sheep/vdi.c
> index 76a7128..cc35ca7 100644
> --- a/sheep/vdi.c
> +++ b/sheep/vdi.c
> @@ -387,7 +387,6 @@ struct deletion_work {
>  	uint32_t *buf;
>  
>  	struct vnode_info *vnodes;
> -	int delete_error;
>  };
>  
>  static LIST_HEAD(deletion_work_list);
> @@ -460,31 +459,30 @@ static void delete_one(struct work *work)
>  		goto out;
>  
>  	for (i = 0; i < MAX_DATA_OBJS; i++) {
> +		uint64_t oid;
> +
>  		if (!inode->data_vdi_id[i])
>  			continue;
>  
> +		oid = vid_to_data_oid(inode->data_vdi_id[i], i);
> +
>  		if (inode->data_vdi_id[i] != inode->vdi_id) {
>  			dprintf("object %" PRIx64 " is base's data, would not be deleted.\n",
> -					vid_to_data_oid(inode->data_vdi_id[i], i));
> +				oid);
>  			continue;
>  		}
>  
> -		ret = remove_object(dw->vnodes, dw->epoch,
> -			      vid_to_data_oid(inode->data_vdi_id[i], i),
> -			      nr_copies);
> +		ret = remove_object(dw->vnodes, dw->epoch, oid, nr_copies);
>  
>  		if (ret != SD_RES_SUCCESS)
> -			dw->delete_error = 1;
> -		else
> -			inode->data_vdi_id[i] = 0;
> +			eprintf("remove object %" PRIx64 " fail, %d\n", oid, ret);
>  	}
>  
> -	if (!dw->delete_error && *(inode->name) == '\0')
> +	if (*(inode->name) == '\0')
>  		goto out;
>  
>  	inode->vdi_size = 0;
> -	if (!dw->delete_error)
> -		memset(inode->name, 0, sizeof(inode->name));
> +	memset(inode->name, 0, sizeof(inode->name));
>  
>  	write_object(dw->vnodes, dw->epoch, vid_to_vdi_oid(vdi_id),
>  		     (void *)inode, sizeof(*inode), 0, 0, nr_copies, 0);
> 

Applied, thanks.

Yuan




More information about the sheepdog mailing list