From: Stefan Hajnoczi <stefanha@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kwolf@redhat.com, stefanha@linux.vnet.ibm.com, jcody@redhat.com,
Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel@nongnu.org, fsimonce@redhat.com, eblake@redhat.com
Subject: Re: [Qemu-devel] [PATCH 5/6] Add blkmirror block driver
Date: Wed, 29 Feb 2012 14:37:26 +0000 [thread overview]
Message-ID: <CAJSP0QX-2vthL-t=K2fck32EO=Tjtec3vjHHxBtnf870pToCTA@mail.gmail.com> (raw)
In-Reply-To: <1330522650-15357-6-git-send-email-pbonzini@redhat.com>
On Wed, Feb 29, 2012 at 1:37 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> From: Marcelo Tosatti <mtosatti@redhat.com>
>
> Mirrored writes are used by live block copy.
>
> The blkmirror driver is for internal use only, because it requires
> bdrv_append to set up a backing_hd for it. It relies on a quirk
> of bdrv_append, which leaves the old image open for writes.
>
> The source is hardcoded as the backing_hd for the destination, so that
> copy-on-write functions properly. Since the source is not yet available
> at the time blkmirror_open is called, the backing_hd is set later.
>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> This version of the driver is almost entirely rewritten to
> use bs->backing_hd and bs->file. This is necessary in order
> to share as much code as possible with group snapshots.
>
> Makefile.objs | 2 +-
> block/blkmirror.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> docs/blkmirror.txt | 16 ++++++
> 3 files changed, 170 insertions(+), 1 deletions(-)
> create mode 100644 block/blkmirror.c
> create mode 100644 docs/blkmirror.txt
Mostly happy here, I just recommend tweaking the name of this block
driver and documenting clearly that this is not a general-purpose
mirroring driver, given that it points image B's backing file at image
A's backing file. I see this driver as internal functionality and
it's fairly easy for users to misuse it and be surprised by the
results.
> +static int blkmirror_co_writev(BlockDriverState *bs,
> + int64_t sector_num, int nb_sectors,
> + QEMUIOVector *qiov)
> +{
> + int ret;
> +
> + /* bs->backing_hd is set after initialization. */
> + bs->file->backing_hd = bs->backing_hd;
> +
> + ret = bdrv_co_writev(bs->backing_hd, sector_num, nb_sectors, qiov);
> + if (ret >= 0) {
> + ret = bdrv_co_writev(bs->file, sector_num, nb_sectors, qiov);
> + }
> +
> + return ret;
> +}
Have you done performance tests? It seems suboptimal to use
.bdrv_co_writev() and perform writes sequentially, even with
cache=unsafe.
next prev parent reply other threads:[~2012-02-29 14:37 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-29 13:37 [Qemu-devel] [PATCH 0/6] Mirrored writes using blockdev-transaction Paolo Bonzini
2012-02-29 13:37 ` [Qemu-devel] [PATCH 1/6] fix format name for backing file Paolo Bonzini
2012-02-29 13:37 ` [Qemu-devel] [PATCH 2/6] qapi: complete implementation of unions Paolo Bonzini
2012-02-29 13:37 ` [Qemu-devel] [PATCH 3/6] rename blockdev-group-snapshot-sync Paolo Bonzini
2012-02-29 14:25 ` Paolo Bonzini
2012-02-29 15:08 ` Luiz Capitulino
2012-02-29 15:23 ` Paolo Bonzini
2012-03-01 13:30 ` Luiz Capitulino
2012-03-01 13:33 ` Paolo Bonzini
2012-02-29 18:41 ` Eric Blake
2012-03-01 10:18 ` Paolo Bonzini
2012-02-29 13:37 ` [Qemu-devel] [PATCH 4/6] add reuse field Paolo Bonzini
2012-02-29 18:50 ` Eric Blake
2012-03-01 10:22 ` Kevin Wolf
2012-02-29 13:37 ` [Qemu-devel] [PATCH 5/6] Add blkmirror block driver Paolo Bonzini
2012-02-29 14:37 ` Stefan Hajnoczi [this message]
2012-02-29 14:56 ` Paolo Bonzini
2012-02-29 19:36 ` Eric Blake
2012-02-29 13:37 ` [Qemu-devel] [PATCH 6/6] add mirroring to blockdev-transaction Paolo Bonzini
2012-02-29 19:47 ` Eric Blake
2012-03-01 6:46 ` Paolo Bonzini
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='CAJSP0QX-2vthL-t=K2fck32EO=Tjtec3vjHHxBtnf870pToCTA@mail.gmail.com' \
--to=stefanha@gmail.com \
--cc=eblake@redhat.com \
--cc=fsimonce@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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).