[sheepdog] [PATCH v2 2/6] write inode at one time in vdi_create() and vdi_clone()
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Fri Oct 18 04:33:32 CEST 2013
At Wed, 16 Oct 2013 15:55:35 +0800,
Liu Yuan wrote:
>
> 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.
Who fixes the corrupted inode object after vdi creation is
interrupted?
Thanks,
Kazutaka
More information about the sheepdog
mailing list