qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V2] block: Add BlockDriver.bdrv_check_ext_snapsh


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH V2] block: Add BlockDriver.bdrv_check_ext_snapshot.
Date: Fri, 27 Sep 2013 11:52:20 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 26.09.2013 um 18:48 hat Jeff Cody geschrieben:
> On Thu, Sep 26, 2013 at 04:33:49PM +0200, Benoît Canet wrote:
> > This field is used by blkverify to disable external snapshots creation.
> > I will also be used by block filters like quorum to disable external 
> > snapshots
> > creation.
> > 
> > Signed-off-by: Benoit Canet <address@hidden>
> > ---
> >  block.c                   | 14 ++++++++++++++
> >  block/blkverify.c         |  2 ++
> >  blockdev.c                |  5 +++++
> >  include/block/block.h     |  7 +++++++
> >  include/block/block_int.h |  8 ++++++++
> >  5 files changed, 36 insertions(+)
> > 
> > diff --git a/block.c b/block.c
> > index 4833b37..4da6fd9 100644
> > --- a/block.c
> > +++ b/block.c
> > @@ -4632,3 +4632,17 @@ int bdrv_amend_options(BlockDriverState *bs, 
> > QEMUOptionParameter *options)
> >      }
> >      return bs->drv->bdrv_amend_options(bs, options);
> >  }
> > +
> > +bool bdrv_check_ext_snapshot(BlockDriverState *bs)
> > +{
> > +    /* external snashots are enabled by defaults */
> > +    if (!bs->drv->bdrv_check_ext_snapshot) {
> > +        return true;
> > +    }
> > +    return bs->drv->bdrv_check_ext_snapshot(bs);
> > +}
> > +
> > +bool bdrv_forbid_ext_snapshot(BlockDriverState *bs)
> > +{
> > +    return false;
> > +}
> 
> The only problem I have with this now, is that
> "bdrv_forbid_ext_snapshot()" returns false, to indicate that "forbid
> ext snapshot" is true.  Looking at the function above, I would come to
> the opposite conclusion as to what it does.
> 
> I understand why - you want the function name assigned to
> .bdrv_check_ext_snapshot to reflect the action, but then that causes
> the boolean return to be misleading.  Maybe returning an enum would be
> more natural?
> 
> I apologize if this seems too pedantic.  :)

Perhaps rename the function to bdrv_check_ext_snapshot_forbidden() or
something like that?

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]