[sheepdog] [PATCH] sheep: fix confused comments of vdi_snapshot()

Yu Yang justyuyang at foxmail.com
Thu May 7 15:13:31 CEST 2015


Thanks, and I find the reason.
When I type 'dog vdi list'  I got the following info , 

$dog vdi list
  Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
Block Size Shift
  v1           0   10 MB  4.0 MB  0.0 MB 2015-05-07 16:45   709128      3
22
s v2           1   20 MB  4.0 MB  0.0 MB 2015-05-07 19:11   709641      3
22
  v2           0   20 MB  0.0 MB  4.0 MB 2015-05-07 19:14   709642      3
22

the second column Id of   the v1 and v2 (line3) is 0,  
in fact the Id of v1 is 1, and the 3rd line Id is 2(I got it from your
suggestion cmd  'dog vdi object dump-inode <inode object path>' ), 
the reason is the statement  in function int parse_vdi() of  common.c  (Line
223):
	snapid = vdi_is_snapshot(i) ? i->snap_id : 0;
so I can see  the Id is 0 for the working VDI.
Still confused thing.


> -----Original Message-----
> From: Hitoshi Mitake [mailto:mitake.hitoshi at gmail.com] On Behalf Of Hitoshi
> Mitake
> Sent: Monday, April 27, 2015 10:07 AM
> To: Yu Yang
> Cc: 'Hitoshi Mitake'; sheepdog at lists.wpkg.org
> Subject: Re: [sheepdog] [PATCH] sheep: fix confused comments of
> vdi_snapshot()
> 
> At Thu, 23 Apr 2015 19:15:00 +0800,
> Yu Yang wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Hitoshi Mitake [mailto:mitake.hitoshi at gmail.com] On Behalf Of
Hitoshi
> > > Mitake
> > > Sent: Thursday, April 23, 2015 5:28 PM
> > > To: Yu Yang
> > > Cc: sheepdog at lists.wpkg.org
> > > Subject: Re: [sheepdog] [PATCH] sheep: fix confused comments of
> > > vdi_snapshot()
> > >
> > > At Thu, 23 Apr 2015 16:03:49 +0800,
> > > Yu Yang wrote:
> > > >
> > > > From: Yu Yang <yuyang at cmss.chinamobile.com>
> > > >
> > > > fix the confused comments between snapid and vid for vdi_snapshot().
> > > >
> > > > Signed-off-by: Yu Yang <yuyang at cmss.chinamobile.com>
> > > > ---
> > > >  sheep/vdi.c |    4 ++--
> > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/sheep/vdi.c b/sheep/vdi.c
> > > > index 63e578d..b35a763 100644
> > > > --- a/sheep/vdi.c
> > > > +++ b/sheep/vdi.c
> > > > @@ -1572,8 +1572,8 @@ int vdi_create(const struct vdi_iocb *iocb,
uint32_t
> > > *new_vid)
> > > >   * 2. rollback create (base_vid != current_vid)
> > > >   *
> > > >   * This function expects SUCCESS returned from vdi_lookup().  Both
> rollback
> > > and
> > > > - * snap create started with current working VDI's snap_id + 1. Working
VDI
> > > > - * always has the highest snapid.
> > > > + * snap creation starts with current working VDI's vid + 1. Working VDI
> > > > + * always has the highest vid and its snapid is 0.
> > >
> > > Sorry, I missed to point a possibility of vid overflow. Working VDI
doesn't
> > > have the highest VID always.
> > >
> > > And the snapid of working VDI is always highest. It is simply incremented.
> > >
> > > Could you fix them?
> > >
> > > Thanks,
> > > Hitoshi
> > >
> >
> > I know when vid is overflow it's not the highest,
> > but you said the snapid of working VDI is always the highest ?
> > I find it is always ZERO, or I misunderstand of working VDI which can be
> > read/write ?
> 
> You can check the snapid field with
> $ dog vdi object dump-inode <inode object path>
> 
> It will show that working VDIs have largest snapid (working VDIs have
> higher VIDs).
> 
> # anyway, the field doesn't seem to be used currently
> 
> Thanks,
> Hitoshi
> 
> >
> > Thanks
> > Yang
> >
> > > >   */
> > > >  int vdi_snapshot(const struct vdi_iocb *iocb, uint32_t *new_vid)
> > > >  {
> > > > --
> > > > 1.7.9.5
> > > >
> > > >
> > > > --
> > > > sheepdog mailing list
> > > > sheepdog at lists.wpkg.org
> > > > https://lists.wpkg.org/mailman/listinfo/sheepdog
> >
> >
> >
> > --
> > sheepdog mailing list
> > sheepdog at lists.wpkg.org
> > https://lists.wpkg.org/mailman/listinfo/sheepdog






More information about the sheepdog mailing list