[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/21] backup: skip unallocated clusters for full mo
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-devel] [PATCH 08/21] backup: skip unallocated clusters for full mode |
Date: |
Fri, 23 Dec 2016 17:28:51 +0300 |
In case of full backup we can skip unallocated clusters if the target
disk is already zero-initialized.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
block/backup.c | 8 ++++++--
tests/qemu-iotests/055 | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/block/backup.c b/block/backup.c
index 2afd1b6..4ef8daf 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -562,9 +562,13 @@ static void coroutine_fn backup_run(void *opaque)
if (job->sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
backup_incremental_init_copy_bitmap(job);
} else {
+ /* top or full mode */
+ bool is_top = job->sync_mode == MIRROR_SYNC_MODE_TOP;
+ BlockDriverState *base =
+ is_top ? backing_bs(blk_bs(job->common.blk)) : NULL;
hbitmap_set(job->copy_bitmap, 0, end);
- if (job->sync_mode == MIRROR_SYNC_MODE_TOP) {
- backup_skip_loop(job, backing_bs(blk_bs(job->common.blk)));
+ if (is_top || bdrv_has_zero_init(blk_bs(job->target))) {
+ backup_skip_loop(job, base);
}
}
ret = backup_loop(job);
diff --git a/tests/qemu-iotests/055 b/tests/qemu-iotests/055
index 1d3fd04..388b7b2 100755
--- a/tests/qemu-iotests/055
+++ b/tests/qemu-iotests/055
@@ -30,6 +30,7 @@ target_img = os.path.join(iotests.test_dir, 'target.img')
blockdev_target_img = os.path.join(iotests.test_dir, 'blockdev-target.img')
image_len = 64 * 1024 * 1024 # MB
+pause_write = '3M'
def setUpModule():
qemu_img('create', '-f', iotests.imgfmt, test_img, str(image_len))
@@ -39,6 +40,7 @@ def setUpModule():
qemu_io('-f', iotests.imgfmt, '-c', 'write -P0xd5 1M 32k', test_img)
qemu_io('-f', iotests.imgfmt, '-c', 'write -P0xdc 32M 124k', test_img)
qemu_io('-f', iotests.imgfmt, '-c', 'write -P0x33 67043328 64k', test_img)
+ qemu_io('-f', iotests.imgfmt, '-c', 'write -P0xdc 40M ' + pause_write,
test_img)
def tearDownModule():
os.remove(test_img)
--
1.8.3.1
- [Qemu-devel] [PATCH 17/21] backup: make all reads not serializing, (continued)
- [Qemu-devel] [PATCH 17/21] backup: make all reads not serializing, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-devel] [PATCH 04/21] backup: use copy_bitmap in incremental backup, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-devel] [PATCH 03/21] backup: improve non-dirty bits progress processing, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-devel] [PATCH 06/21] backup: rewrite top mode cluster skipping, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-devel] [PATCH 02/21] backup: init copy_bitmap from sync_bitmap for incremental, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-devel] [PATCH 07/21] backup: refactor: merge top/full/incremental backup code, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-devel] [PATCH 14/21] block: add trace point on bdrv_close_all, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-devel] [PATCH 12/21] iotests: add supported_cache_modes to main function, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-devel] [PATCH 10/21] backup: refactor backup_copy_cluster(), Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-devel] [PATCH 09/21] backup: separate copy function, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-devel] [PATCH 08/21] backup: skip unallocated clusters for full mode,
Vladimir Sementsov-Ogievskiy <=
- [Qemu-devel] [PATCH 13/21] coroutine: add qemu_coroutine_add_next, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-devel] [PATCH 11/21] backup: move r/w error handling code to r/w functions, Vladimir Sementsov-Ogievskiy, 2016/12/23