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

Liu Yuan namei.unix at gmail.com
Wed Oct 16 09:55:35 CEST 2013


On Wed, Oct 16, 2013 at 03:21:47AM +0900, MORITA Kazutaka wrote:
> 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?
> 

I guess we can firstly update inode and then write data objects. if operation is
interrupted, we can delete the vdi and no orphan.

Thanks
Yuan



More information about the sheepdog mailing list