[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 08/14] mirror: improve performance of mirroring of em
From: |
Jeff Cody |
Subject: |
[Qemu-block] [PULL 08/14] mirror: improve performance of mirroring of empty disk |
Date: |
Tue, 19 Jul 2016 20:20:56 -0400 |
From: "Denis V. Lunev" <address@hidden>
We should not take into account zero blocks for delay calculations.
They are not read and thus IO throttling is not required. In the
other case VM migration with 16 Tb QCOW2 disk with 4 Gb of data takes
days.
Signed-off-by: Denis V. Lunev <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Message-id: address@hidden
CC: Stefan Hajnoczi <address@hidden>
CC: Kevin Wolf <address@hidden>
CC: Max Reitz <address@hidden>
CC: Jeff Cody <address@hidden>
CC: Eric Blake <address@hidden>
Signed-off-by: Jeff Cody <address@hidden>
---
block/mirror.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c
index 0262b03..f78186d 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -323,6 +323,7 @@ static uint64_t coroutine_fn
mirror_iteration(MirrorBlockJob *s)
int nb_chunks = 1;
int64_t end = s->bdev_length / BDRV_SECTOR_SIZE;
int sectors_per_chunk = s->granularity >> BDRV_SECTOR_BITS;
+ bool write_zeroes_ok = bdrv_can_write_zeroes_with_unmap(blk_bs(s->target));
sector_num = hbitmap_iter_next(&s->hbi);
if (sector_num < 0) {
@@ -373,7 +374,7 @@ static uint64_t coroutine_fn
mirror_iteration(MirrorBlockJob *s)
bitmap_set(s->in_flight_bitmap, sector_num / sectors_per_chunk, nb_chunks);
while (nb_chunks > 0 && sector_num < end) {
int ret;
- int io_sectors;
+ int io_sectors, io_sectors_acct;
BlockDriverState *file;
enum MirrorMethod {
MIRROR_METHOD_COPY,
@@ -410,12 +411,17 @@ static uint64_t coroutine_fn
mirror_iteration(MirrorBlockJob *s)
switch (mirror_method) {
case MIRROR_METHOD_COPY:
io_sectors = mirror_do_read(s, sector_num, io_sectors);
+ io_sectors_acct = io_sectors;
break;
case MIRROR_METHOD_ZERO:
- mirror_do_zero_or_discard(s, sector_num, io_sectors, false);
- break;
case MIRROR_METHOD_DISCARD:
- mirror_do_zero_or_discard(s, sector_num, io_sectors, true);
+ mirror_do_zero_or_discard(s, sector_num, io_sectors,
+ mirror_method == MIRROR_METHOD_DISCARD);
+ if (write_zeroes_ok) {
+ io_sectors_acct = 0;
+ } else {
+ io_sectors_acct = io_sectors;
+ }
break;
default:
abort();
@@ -424,7 +430,7 @@ static uint64_t coroutine_fn
mirror_iteration(MirrorBlockJob *s)
sector_num += io_sectors;
nb_chunks -= DIV_ROUND_UP(io_sectors, sectors_per_chunk);
if (s->common.speed) {
- delay_ns = ratelimit_calculate_delay(&s->limit, io_sectors);
+ delay_ns = ratelimit_calculate_delay(&s->limit, io_sectors_acct);
}
}
return delay_ns;
--
1.9.3
- [Qemu-block] [PULL 00/14] Block patches, Jeff Cody, 2016/07/19
- [Qemu-block] [PULL 03/14] mirror: create mirror_throttle helper, Jeff Cody, 2016/07/19
- [Qemu-block] [PULL 02/14] mirror: make sectors_in_flight int64_t, Jeff Cody, 2016/07/19
- [Qemu-block] [PULL 01/14] dirty-bitmap: operate with int64_t amount, Jeff Cody, 2016/07/19
- [Qemu-block] [PULL 04/14] mirror: create mirror_dirty_init helper for mirror_run, Jeff Cody, 2016/07/19
- [Qemu-block] [PULL 05/14] block: remove extra condition in bdrv_can_write_zeroes_with_unmap, Jeff Cody, 2016/07/19
- [Qemu-block] [PULL 06/14] mirror: optimize dirty bitmap filling in mirror_run a bit, Jeff Cody, 2016/07/19
- [Qemu-block] [PULL 07/14] mirror: efficiently zero out target, Jeff Cody, 2016/07/19
- [Qemu-block] [PULL 08/14] mirror: improve performance of mirroring of empty disk,
Jeff Cody <=
- [Qemu-block] [PULL 09/14] mirror: fix request throttling in drive-mirror, Jeff Cody, 2016/07/19
- [Qemu-block] [PULL 10/14] block/gluster: rename [server, volname, image] -> [host, volume, path], Jeff Cody, 2016/07/19
- [Qemu-block] [PULL 11/14] block/gluster: code cleanup, Jeff Cody, 2016/07/19
- [Qemu-block] [PULL 12/14] block/gluster: deprecate rdma support, Jeff Cody, 2016/07/19
- [Qemu-block] [PULL 14/14] block/gluster: add support for multiple gluster servers, Jeff Cody, 2016/07/19
- [Qemu-block] [PULL 13/14] block/gluster: using new qapi schema, Jeff Cody, 2016/07/19
- Re: [Qemu-block] [PULL 00/14] Block patches, Peter Maydell, 2016/07/20