[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 20/21] backup: move bitmap handling from backup_do_c
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[Qemu-block] [PATCH 20/21] backup: move bitmap handling from backup_do_cow to get_work |
Date: |
Fri, 23 Dec 2016 17:29:03 +0300 |
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
block/backup.c | 30 ++++++++++++++----------------
1 file changed, 14 insertions(+), 16 deletions(-)
diff --git a/block/backup.c b/block/backup.c
index 900bbd3..b79a481 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -383,19 +383,24 @@ static inline int64_t backup_get_work(BackupBlockJob *job)
}
cluster = next_notif_cluster(job);
- if (cluster != -1) {
- return cluster;
- }
+ if (cluster == -1) {
+ if (block_job_should_pause(&job->common) ||
+ job->sync_mode == MIRROR_SYNC_MODE_NONE || check_delay(job))
+ {
+ return BACKUP_WORKER_PAUSE;
+ }
- if (block_job_should_pause(&job->common) ||
- job->sync_mode == MIRROR_SYNC_MODE_NONE || check_delay(job))
- {
- return BACKUP_WORKER_PAUSE;
+ cluster = hbitmap_iter_next(&job->linear_hbi);
+ if (cluster == -1) {
+ return BACKUP_WORKER_STOP;
+ }
}
- cluster = hbitmap_iter_next(&job->linear_hbi);
+ assert(hbitmap_get(job->copy_bitmap, cluster));
+ hbitmap_reset(job->copy_bitmap, cluster, 1);
+ set_bit(cluster, job->notif_wait_bitmap);
- return cluster == -1 ? BACKUP_WORKER_STOP : cluster;
+ return cluster;
}
static void coroutine_fn backup_worker_co(void *opaque)
@@ -583,13 +588,6 @@ static void coroutine_fn backup_do_cow(BackupBlockJob
*job, int64_t cluster)
trace_backup_do_cow_enter(job, qemu_coroutine_self(), cluster);
- if (!hbitmap_get(job->copy_bitmap, cluster)) {
- trace_backup_do_cow_skip(job, cluster);
- return; /* already copied */
- }
- hbitmap_reset(job->copy_bitmap, cluster, 1);
- set_bit(cluster, job->notif_wait_bitmap);
-
bounce_buffer = blk_blockalign(blk, job->cluster_size);
backup_copy_cluster(job, cluster, bounce_buffer);
qemu_vfree(bounce_buffer);
--
1.8.3.1
- [Qemu-block] [PATCH 00/21] new backup architecture, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 21/21] backup: refactor: remove backup_do_cow(), Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 20/21] backup: move bitmap handling from backup_do_cow to get_work,
Vladimir Sementsov-Ogievskiy <=
- [Qemu-block] [PATCH 01/21] backup: move from done_bitmap to copy_bitmap, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 05/21] hbitmap: improve dirty iter, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 18/21] backup: new async architecture, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 15/21] bitmap: add bitmap_count_between() function, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 17/21] backup: make all reads not serializing, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 16/21] hbitmap: add hbitmap_count_between() function, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 04/21] backup: use copy_bitmap in incremental backup, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 03/21] backup: improve non-dirty bits progress processing, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 06/21] backup: rewrite top mode cluster skipping, Vladimir Sementsov-Ogievskiy, 2016/12/23
- [Qemu-block] [PATCH 02/21] backup: init copy_bitmap from sync_bitmap for incremental, Vladimir Sementsov-Ogievskiy, 2016/12/23