qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Jeff Cody <jcody@redhat.com>
Cc: "Benoît Canet" <benoit@irqsave.net>,
	stefanha@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH V2] block: Add BlockDriver.bdrv_check_ext_snapshot.
Date: Fri, 27 Sep 2013 11:52:20 +0200	[thread overview]
Message-ID: <20130927095220.GG2440@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <20130926164813.GA29688@localhost.localdomain>

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 <benoit@irqsave.net>
> > ---
> >  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	other threads:[~2013-09-27  9:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-26 14:33 [Qemu-devel] [PATCH V2] disable blkverify external snapshot creation Benoît Canet
2013-09-26 14:33 ` [Qemu-devel] [PATCH V2] block: Add BlockDriver.bdrv_check_ext_snapshot Benoît Canet
2013-09-26 16:48   ` Jeff Cody
2013-09-27  9:52     ` Kevin Wolf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130927095220.GG2440@dhcp-200-207.str.redhat.com \
    --to=kwolf@redhat.com \
    --cc=benoit@irqsave.net \
    --cc=jcody@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).