From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Fam Zheng <famz@redhat.com>,
qemu-devel@nongnu.org, dietmar@proxmox.com, imain@redhat.com,
Stefan Hajnoczi <stefanha@redhat.com>,
pbonzini@redhat.com, Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v2 1/3] block: add basic backup support to block driver
Date: Tue, 14 May 2013 15:43:00 +0200 [thread overview]
Message-ID: <20130514134300.GC2556@dhcp-200-207.str.redhat.com> (raw)
In-Reply-To: <20130514132459.GA21771@stefanha-thinkpad.redhat.com>
Am 14.05.2013 um 15:24 hat Stefan Hajnoczi geschrieben:
> On Wed, May 08, 2013 at 02:39:25PM +0200, Kevin Wolf wrote:
> > Am 29.04.2013 um 09:42 hat Stefan Hajnoczi geschrieben:
> > > diff --git a/include/block/blockjob.h b/include/block/blockjob.h
> > > index c290d07..6f42495 100644
> > > --- a/include/block/blockjob.h
> > > +++ b/include/block/blockjob.h
> > > @@ -50,6 +50,13 @@ typedef struct BlockJobType {
> > > * manually.
> > > */
> > > void (*complete)(BlockJob *job, Error **errp);
> > > +
> > > + /** tracked requests */
> > > + int coroutine_fn (*before_read)(BlockDriverState *bs, int64_t sector_num,
> > > + int nb_sectors, QEMUIOVector *qiov);
> > > + int coroutine_fn (*before_write)(BlockDriverState *bs, int64_t sector_num,
> > > + int nb_sectors, QEMUIOVector *qiov);
> > > +
> > > } BlockJobType;
> >
> > This is actually a sign that a block job isn't the right tool. Jobs are
> > something that runs in the background and doesn't have callbacks. You
> > really want to have a filter here (that happens to be coupled to a job).
> > Need the BlockBackend split before we can do this right.
> >
> > The second thing that this conflicts with is generalising block jobs to
> > generic background jobs.
> >
> > Each hack like this that we accumulate makes it harder to get the real
> > thing eventually.
>
> In v3 I added a slightly cleaner interface:
>
> bdrv_set_before_write_cb(bs, backup_before_write);
>
> This way the "before write" callback is not tied to block jobs and
> could be reused in the future.
>
> The alternative is to create a BlockDriver that mostly delegates plus
> uses bdrv_swap(). The boilerplate involved in that is ugly though, so
> I'm using bdrv_set_before_write_cb() instead.
The clean implementation of filters is putting a BlockDriver on top, it
gives you flexibility to intercept anything and you can stack multiple
of them instead of having just one callback per BDS.
But I'm not sure if simply bdrv_swap is good enough. You would definitely
have to disable snapshots while the filter is active and there may be
more cases. This is the part that I think getting right is a bit more
complex and might need the BlockBackend split.
So you would vote to introduce bdrv_set_before_write_cb() now and later
change how everything works?
Kevin
next prev parent reply other threads:[~2013-05-14 13:43 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-29 7:42 [Qemu-devel] [PATCH v2 0/3] block: block-backup live backup command Stefan Hajnoczi
2013-04-29 7:42 ` [Qemu-devel] [PATCH v2 1/3] block: add basic backup support to block driver Stefan Hajnoczi
2013-05-08 12:39 ` Kevin Wolf
2013-05-08 15:43 ` Paolo Bonzini
2013-05-14 8:51 ` Stefan Hajnoczi
2013-05-14 13:24 ` Stefan Hajnoczi
2013-05-14 13:43 ` Kevin Wolf [this message]
2013-05-14 15:12 ` Stefan Hajnoczi
2013-05-30 3:37 ` Fam Zheng
2013-05-30 12:27 ` Stefan Hajnoczi
2013-04-29 7:42 ` [Qemu-devel] [PATCH v2 2/3] block: add block-backup QMP command Stefan Hajnoczi
2013-05-08 12:49 ` Kevin Wolf
2013-05-11 3:34 ` Eric Blake
2013-05-11 8:02 ` Paolo Bonzini
2013-05-13 8:23 ` Kevin Wolf
2013-05-14 8:44 ` Stefan Hajnoczi
2013-05-11 4:02 ` Eric Blake
2013-05-13 8:28 ` Kevin Wolf
2013-05-13 12:56 ` Eric Blake
2013-05-13 13:09 ` Kevin Wolf
2013-05-13 13:18 ` Luiz Capitulino
2013-05-13 14:14 ` Eric Blake
2013-05-13 14:27 ` Kevin Wolf
2013-05-13 14:50 ` Eric Blake
2013-05-14 2:18 ` Wenchao Xia
2013-05-14 8:48 ` Stefan Hajnoczi
2013-04-29 7:42 ` [Qemu-devel] [PATCH v2 3/3] qemu-iotests: add 054 block-backup test case Stefan Hajnoczi
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=20130514134300.GC2556@dhcp-200-207.str.redhat.com \
--to=kwolf@redhat.com \
--cc=dietmar@proxmox.com \
--cc=famz@redhat.com \
--cc=imain@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=stefanha@redhat.com \
--cc=xiawenc@linux.vnet.ibm.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).