[sheepdog] [PATCH] dog: don't set copy_policy for inode update of 'vdi write/create'

MORITA Kazutaka morita.kazutaka at gmail.com
Wed Oct 9 17:28:00 CEST 2013


At Wed,  9 Oct 2013 18:51:27 +0800,
Liu Yuan wrote:
> 
> inode object isn't erasure coded but replicated.

Is this a cleanup patch?  IIUC, is_erasure_oid() in sheep returns
false against vdi objects, so I thought that it's not problem to set
copy_policy for inode update.

> 
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  dog/vdi.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/dog/vdi.c b/dog/vdi.c
> index db32193..b4a2aeb 100644
> --- a/dog/vdi.c
> +++ b/dog/vdi.c
> @@ -559,8 +559,7 @@ static int vdi_create(int argc, char **argv)
>  		inode->data_vdi_id[idx] = vid;
>  		ret = sd_write_object(vid_to_vdi_oid(vid), 0, &vid, sizeof(vid),
>  				      SD_INODE_HEADER_SIZE + sizeof(vid) * idx,
> -				      0, inode->nr_copies, inode->copy_policy,
> -				      false, true);
> +				      0, inode->nr_copies, 0, false, true);
>  		if (ret) {
>  			ret = EXIT_FAILURE;
>  			goto out;
> @@ -1323,11 +1322,12 @@ static int vdi_write(int argc, char **argv)
>  		}
>  
>  		if (create) {
> +			/* For inode update, don't set copy_policy */
>  			ret = sd_write_object(vid_to_vdi_oid(vid), 0, &vid,
>  					      sizeof(vid),
>  				SD_INODE_HEADER_SIZE + sizeof(vid) * idx,
>  					      flags, inode->nr_copies,
> -					      inode->copy_policy, false, false);
> +					      0, false, false);
>  			if (ret) {
>  				ret = EXIT_FAILURE;
>  				goto out;

There are other sd_write_object() calls against vdi objects in
vdi_snapshot(), vdi_clone(), vdi_resize(), and many other places in
dog/vdi.c.

Thanks,

Kazutaka



More information about the sheepdog mailing list