aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-10-02 11:01:18 +0100
committerPeter Maydell <peter.maydell@linaro.org>2015-10-02 11:01:18 +0100
commitff770b07f34d28b79013a83989bd6c85f8f16b2f (patch)
treec241650c28d45d92bc59f26252de8f1786cb28b3
parent5250ced83173c9534b4a2723b7a50b67b7c7a6ee (diff)
parent5279efebcf8f8fbf2ed2feed63cdb9d375c7cd07 (diff)
Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging
# gpg: Signature made Thu 01 Oct 2015 20:02:33 BST using RSA key ID C0DE3057 # gpg: Good signature from "Jeffrey Cody <jcody@redhat.com>" # gpg: aka "Jeffrey Cody <jeff@codyprime.org>" # gpg: aka "Jeffrey Cody <codyprime@gmail.com>" * remotes/cody/tags/block-pull-request: block: mirror - fix full sync mode when target does not support zero init Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--block/mirror.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block/mirror.c b/block/mirror.c
index a2589261f5..87928aba84 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -455,6 +455,8 @@ static void coroutine_fn mirror_run(void *opaque)
if (!s->is_none_mode) {
/* First part, loop on the sectors and initialize the dirty bitmap. */
BlockDriverState *base = s->base;
+ bool mark_all_dirty = s->base == NULL && !bdrv_has_zero_init(s->target);
+
for (sector_num = 0; sector_num < end; ) {
/* Just to make sure we are not exceeding int limit. */
int nb_sectors = MIN(INT_MAX >> BDRV_SECTOR_BITS,
@@ -477,7 +479,7 @@ static void coroutine_fn mirror_run(void *opaque)
}
assert(n > 0);
- if (ret == 1) {
+ if (ret == 1 || mark_all_dirty) {
bdrv_set_dirty_bitmap(s->dirty_bitmap, sector_num, n);
}
sector_num += n;