[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 28/36] block/backup: centralize copy_bitmap initializ
From: |
John Snow |
Subject: |
[Qemu-devel] [PULL 28/36] block/backup: centralize copy_bitmap initialization |
Date: |
Fri, 16 Aug 2019 19:13:10 -0400 |
Just a few housekeeping changes that keeps the following commit easier
to read; perform the initial copy_bitmap initialization in one place.
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Message-id: address@hidden
Signed-off-by: John Snow <address@hidden>
---
block/backup.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/block/backup.c b/block/backup.c
index b04ab2d5f0c..305f9b3468b 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -451,16 +451,22 @@ static int coroutine_fn backup_loop(BackupBlockJob *job)
return ret;
}
-/* init copy_bitmap from sync_bitmap */
-static void backup_incremental_init_copy_bitmap(BackupBlockJob *job)
+static void backup_init_copy_bitmap(BackupBlockJob *job)
{
- bool ret = bdrv_dirty_bitmap_merge_internal(job->copy_bitmap,
- job->sync_bitmap,
- NULL, true);
- assert(ret);
+ bool ret;
+ uint64_t estimate;
- job_progress_set_remaining(&job->common.job,
- bdrv_get_dirty_count(job->copy_bitmap));
+ if (job->sync_mode == MIRROR_SYNC_MODE_BITMAP) {
+ ret = bdrv_dirty_bitmap_merge_internal(job->copy_bitmap,
+ job->sync_bitmap,
+ NULL, true);
+ assert(ret);
+ } else {
+ bdrv_set_dirty_bitmap(job->copy_bitmap, 0, job->len);
+ }
+
+ estimate = bdrv_get_dirty_count(job->copy_bitmap);
+ job_progress_set_remaining(&job->common.job, estimate);
}
static int coroutine_fn backup_run(Job *job, Error **errp)
@@ -472,12 +478,7 @@ static int coroutine_fn backup_run(Job *job, Error **errp)
QLIST_INIT(&s->inflight_reqs);
qemu_co_rwlock_init(&s->flush_rwlock);
- if (s->sync_mode == MIRROR_SYNC_MODE_BITMAP) {
- backup_incremental_init_copy_bitmap(s);
- } else {
- bdrv_set_dirty_bitmap(s->copy_bitmap, 0, s->len);
- job_progress_set_remaining(job, s->len);
- }
+ backup_init_copy_bitmap(s);
s->before_write.notify = backup_before_write_notify;
bdrv_add_before_write_notifier(bs, &s->before_write);
--
2.21.0
- [Qemu-devel] [PULL 16/36] iotests: Add virtio-scsi device helper, (continued)
- [Qemu-devel] [PULL 16/36] iotests: Add virtio-scsi device helper, John Snow, 2019/08/16
- [Qemu-devel] [PULL 12/36] block/backup: add 'always' bitmap sync policy, John Snow, 2019/08/16
- [Qemu-devel] [PULL 11/36] block/backup: upgrade copy_bitmap to BdrvDirtyBitmap, John Snow, 2019/08/16
- [Qemu-devel] [PULL 21/36] iotests: test bitmap moving inside 254, John Snow, 2019/08/16
- [Qemu-devel] [PULL 19/36] blockdev: reduce aio_context locked sections in bitmap add/remove, John Snow, 2019/08/16
- [Qemu-devel] [PULL 20/36] qapi: implement block-dirty-bitmap-remove transaction action, John Snow, 2019/08/16
- [Qemu-devel] [PULL 22/36] iotests/257: add Pattern class, John Snow, 2019/08/16
- [Qemu-devel] [PULL 25/36] block/backup: hoist bitmap check into QMP interface, John Snow, 2019/08/16
- [Qemu-devel] [PULL 23/36] iotests/257: add EmulatedBitmap class, John Snow, 2019/08/16
- [Qemu-devel] [PULL 29/36] block/backup: add backup_is_cluster_allocated, John Snow, 2019/08/16
- [Qemu-devel] [PULL 28/36] block/backup: centralize copy_bitmap initialization,
John Snow <=
- [Qemu-devel] [PULL 30/36] block/backup: teach TOP to never copy unallocated regions, John Snow, 2019/08/16
- [Qemu-devel] [PULL 27/36] block/backup: improve sync=bitmap work estimates, John Snow, 2019/08/16
- [Qemu-devel] [PULL 34/36] block/backup: deal with zero detection, John Snow, 2019/08/16
- [Qemu-devel] [PULL 35/36] block/backup: refactor write_flags, John Snow, 2019/08/16
- [Qemu-devel] [PULL 33/36] qapi: add dirty-bitmaps to query-named-block-nodes result, John Snow, 2019/08/16
- [Qemu-devel] [PULL 26/36] iotests/257: test API failures, John Snow, 2019/08/16
- [Qemu-devel] [PULL 31/36] block/backup: support bitmap sync modes for non-bitmap backups, John Snow, 2019/08/16
- [Qemu-devel] [PULL 36/36] tests/test-hbitmap: test next_zero and _next_dirty_area after truncate, John Snow, 2019/08/16
- [Qemu-devel] [PULL 24/36] iotests/257: Refactor backup helpers, John Snow, 2019/08/16
- [Qemu-devel] [PULL 17/36] iotests: add test 257 for bitmap-mode backups, John Snow, 2019/08/16