From: Max Reitz <mreitz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH for-1.7 1/2] block/drive-mirror: Reuse backing HD for sync=none
Date: Mon, 25 Nov 2013 20:28:55 +0100 [thread overview]
Message-ID: <1385407736-13941-2-git-send-email-mreitz@redhat.com> (raw)
In-Reply-To: <1385407736-13941-1-git-send-email-mreitz@redhat.com>
For "none" sync mode in "absolute-paths" mode, the current image should
be used as the backing file for the newly created image.
The current behavior is:
a) If the image to be mirrored has a backing file, use that (which is
wrong, since the operations recorded by "none" are applied to the
image itself, not to its backing file).
b) If the image to be mirrored lacks a backing file, the target doesn't
have one either (which is not really wrong, but not really right,
either; "none" records a set of operations executed on the image
file, therefore having no backing file to apply these operations on
seems rather pointless).
For a, this is clearly a bugfix. For b, it is still a bugfix, although
it might break existing API - but since that case crashed qemu just
three weeks ago (before 1452686495922b81d6cf43edf025c1aef15965c0), we
can safely assume there is no such API relying on that case yet.
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
blockdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/blockdev.c b/blockdev.c
index 330aa4a..44755e1 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2021,6 +2021,9 @@ void qmp_drive_mirror(const char *device, const char *target,
if (!source && sync == MIRROR_SYNC_MODE_TOP) {
sync = MIRROR_SYNC_MODE_FULL;
}
+ if (sync == MIRROR_SYNC_MODE_NONE) {
+ source = bs;
+ }
size = bdrv_getlength(bs);
if (size < 0) {
--
1.8.4.2
next prev parent reply other threads:[~2013-11-25 19:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-25 19:28 [Qemu-devel] [PATCH for-1.7 0/2] block/drive-mirror: Reuse backing HD for sync=none Max Reitz
2013-11-25 19:28 ` Max Reitz [this message]
2013-11-25 19:37 ` [Qemu-devel] [PATCH for-1.7 1/2] " Eric Blake
2013-11-25 19:28 ` [Qemu-devel] [PATCH for-1.7 2/2] qemu-iotests: Fix test 041 Max Reitz
2013-11-25 19:38 ` Eric Blake
2013-11-26 9:02 ` [Qemu-devel] [PATCH for-1.7 0/2] block/drive-mirror: Reuse backing HD for sync=none Paolo Bonzini
2013-11-26 18:02 ` Anthony Liguori
2013-11-27 9:42 ` Kevin Wolf
2013-11-27 19:33 ` Anthony Liguori
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=1385407736-13941-2-git-send-email-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@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).