|
|
8b1478 |
From 7a2aff323f83e6f98f81a2cbe59005e34a094f93 Mon Sep 17 00:00:00 2001
|
|
|
8b1478 |
From: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
8b1478 |
Date: Wed, 5 Jun 2019 13:57:04 +0200
|
|
|
8b1478 |
Subject: [PATCH 16/23] qemu-img: Use BDRV_REQ_NO_FALLBACK for pre-zeroing
|
|
|
8b1478 |
|
|
|
8b1478 |
RH-Author: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
8b1478 |
Message-id: <20190605135705.24526-9-mlevitsk@redhat.com>
|
|
|
8b1478 |
Patchwork-id: 88558
|
|
|
8b1478 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 8/9] qemu-img: Use BDRV_REQ_NO_FALLBACK for pre-zeroing
|
|
|
8b1478 |
Bugzilla: 1648622
|
|
|
8b1478 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
8b1478 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
8b1478 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
8b1478 |
|
|
|
8b1478 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
8b1478 |
|
|
|
8b1478 |
If qemu-img convert sees that the target image isn't zero-initialised
|
|
|
8b1478 |
yet, it tries to do an efficient zero write for the whole image first
|
|
|
8b1478 |
to save the overhead of repeated explicit zero writes during the
|
|
|
8b1478 |
conversion. Obviously, this provides only an advantage if the
|
|
|
8b1478 |
pre-zeroing is actually efficient. Otherwise, we can end up writing
|
|
|
8b1478 |
zeroes slowly while zeroing out the whole image, and then overwrite the
|
|
|
8b1478 |
same blocks again with real data, potentially doubling the written data.
|
|
|
8b1478 |
|
|
|
8b1478 |
Pass BDRV_REQ_NO_FALLBACK to blk_make_zero() to avoid this case. If we
|
|
|
8b1478 |
can't efficiently zero out, we'll instead write explicit zeroes only if
|
|
|
8b1478 |
there is no data to be written to a block.
|
|
|
8b1478 |
|
|
|
8b1478 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
8b1478 |
Acked-by: Eric Blake <eblake@redhat.com>
|
|
|
8b1478 |
|
|
|
8b1478 |
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1648622
|
|
|
8b1478 |
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
|
|
|
8b1478 |
|
|
|
8b1478 |
(Cherry-picked from c9fdcf202f19fc2acdcb1ee0522ff5d61bf8c906, no conflicts)
|
|
|
8b1478 |
|
|
|
8b1478 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
8b1478 |
---
|
|
|
8b1478 |
qemu-img.c | 2 +-
|
|
|
8b1478 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
8b1478 |
|
|
|
8b1478 |
diff --git a/qemu-img.c b/qemu-img.c
|
|
|
8b1478 |
index 5be2abf..d588183 100644
|
|
|
8b1478 |
--- a/qemu-img.c
|
|
|
8b1478 |
+++ b/qemu-img.c
|
|
|
8b1478 |
@@ -1916,7 +1916,7 @@ static int convert_do_copy(ImgConvertState *s)
|
|
|
8b1478 |
if (!s->has_zero_init && !s->target_has_backing &&
|
|
|
8b1478 |
bdrv_can_write_zeroes_with_unmap(blk_bs(s->target)))
|
|
|
8b1478 |
{
|
|
|
8b1478 |
- ret = blk_make_zero(s->target, BDRV_REQ_MAY_UNMAP);
|
|
|
8b1478 |
+ ret = blk_make_zero(s->target, BDRV_REQ_MAY_UNMAP | BDRV_REQ_NO_FALLBACK);
|
|
|
8b1478 |
if (ret == 0) {
|
|
|
8b1478 |
s->has_zero_init = true;
|
|
|
8b1478 |
}
|
|
|
8b1478 |
--
|
|
|
8b1478 |
1.8.3.1
|
|
|
8b1478 |
|