[sheepdog] [PATCH v2 2/6] write inode at one time in vdi_create() and vdi_clone()

MORITA Kazutaka morita.kazutaka at gmail.com
Tue Oct 15 20:21:47 CEST 2013


At Tue, 15 Oct 2013 14:45:36 +0800,
Robin Dong wrote:
> 
> It will improve performance for writing whole inode once after changing all vids
> instead of writing each vid every time.
> 
> Signed-off-by: Robin Dong <sanbai at taobao.com>
> ---
>  dog/vdi.c |   50 ++++++++++++++++++++++++++++++++------------------
>  1 files changed, 32 insertions(+), 18 deletions(-)
> 
> diff --git a/dog/vdi.c b/dog/vdi.c
> index 28509e2..02267ab 100644
> --- a/dog/vdi.c
> +++ b/dog/vdi.c
> @@ -536,15 +536,18 @@ static int vdi_create(int argc, char **argv)
>  		}
>  
>  		sd_inode_set_vdi(inode, 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);
> -		if (ret) {
> -			ret = EXIT_FAILURE;
> -			goto out;
> -		}
>  	}
> +
> +	ret = sd_write_object(vid_to_vdi_oid(vid), 0, inode,
> +			      sizeof(uint32_t) * MAX_DATA_OBJS,
> +			      SD_INODE_HEADER_SIZE, 0,
> +			      inode->nr_copies, inode->copy_policy,
> +			      false, true);
> +	if (ret) {
> +		ret = EXIT_FAILURE;
> +		goto out;
> +	}
> +

This improves performance, but generates lots of orphan data objects
if we interrupt vdi creation.  Do you have any performance number?

Thanks,

Kazutaka



More information about the sheepdog mailing list