[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 04/10] backup: simplify non-dirty bits progress proce
From: |
Jeff Cody |
Subject: |
[Qemu-block] [PULL 04/10] backup: simplify non-dirty bits progress processing |
Date: |
Mon, 18 Dec 2017 16:08:13 -0500 |
From: Vladimir Sementsov-Ogievskiy <address@hidden>
Set fake progress for non-dirty clusters in copy_bitmap initialization,
to. It simplifies code and allows further refactoring.
This patch changes user's view of backup progress, but formally it
doesn't changed: progress hops are just moved to the beginning.
Actually it's just a point of view: when do we actually skip clusters?
We can say in the very beginning, that we skip these clusters and do
not think about them later.
Of course, if go through disk sequentially, it's logical to say, that
we skip clusters between copied portions to the left and to the right
of them. But even now copying progress is not sequential because of
write notifiers. Future patches will introduce new backup architecture
which will do copying in several coroutines in parallel, so it will
make no sense to publish fake progress by parts in parallel with
other copying requests.
Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Message-id: address@hidden
Signed-off-by: Jeff Cody <address@hidden>
---
block/backup.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/block/backup.c b/block/backup.c
index b8901ea..8ee2200 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -369,7 +369,6 @@ static int coroutine_fn
backup_run_incremental(BackupBlockJob *job)
int64_t offset;
int64_t cluster;
int64_t end;
- int64_t last_cluster = -1;
BdrvDirtyBitmapIter *dbi;
granularity = bdrv_dirty_bitmap_granularity(job->sync_bitmap);
@@ -380,12 +379,6 @@ static int coroutine_fn
backup_run_incremental(BackupBlockJob *job)
while ((offset = bdrv_dirty_iter_next(dbi)) >= 0) {
cluster = offset / job->cluster_size;
- /* Fake progress updates for any clusters we skipped */
- if (cluster != last_cluster + 1) {
- job->common.offset += ((cluster - last_cluster - 1) *
- job->cluster_size);
- }
-
for (end = cluster + clusters_per_iter; cluster < end; cluster++) {
do {
if (yield_and_check(job)) {
@@ -407,14 +400,6 @@ static int coroutine_fn
backup_run_incremental(BackupBlockJob *job)
if (granularity < job->cluster_size) {
bdrv_set_dirty_iter(dbi, cluster * job->cluster_size);
}
-
- last_cluster = cluster - 1;
- }
-
- /* Play some final catchup with the progress meter */
- end = DIV_ROUND_UP(job->common.len, job->cluster_size);
- if (last_cluster + 1 < end) {
- job->common.offset += ((end - last_cluster - 1) * job->cluster_size);
}
out:
@@ -456,6 +441,9 @@ static void
backup_incremental_init_copy_bitmap(BackupBlockJob *job)
bdrv_set_dirty_iter(dbi, next_cluster * job->cluster_size);
}
+ job->common.offset = job->common.len -
+ hbitmap_count(job->copy_bitmap) * job->cluster_size;
+
bdrv_dirty_iter_free(dbi);
}
--
2.9.5
- [Qemu-block] [PULL 00/10] Block patches, Jeff Cody, 2017/12/18
- [Qemu-block] [PULL 01/10] hbitmap: add next_zero function, Jeff Cody, 2017/12/18
- [Qemu-block] [PULL 02/10] backup: move from done_bitmap to copy_bitmap, Jeff Cody, 2017/12/18
- [Qemu-block] [PULL 03/10] backup: init copy_bitmap from sync_bitmap for incremental, Jeff Cody, 2017/12/18
- [Qemu-block] [PULL 04/10] backup: simplify non-dirty bits progress processing,
Jeff Cody <=
- [Qemu-block] [PULL 05/10] backup: use copy_bitmap in incremental backup, Jeff Cody, 2017/12/18
- [Qemu-block] [PULL 06/10] blockjob: kick jobs on set-speed, Jeff Cody, 2017/12/18
- [Qemu-block] [PULL 07/10] block/sheepdog: remove spurious NULL check, Jeff Cody, 2017/12/18
- [Qemu-block] [PULL 08/10] block/sheepdog: code beautification, Jeff Cody, 2017/12/18
- [Qemu-block] [PULL 09/10] block/curl: check error return of curl_global_init(), Jeff Cody, 2017/12/18
- [Qemu-block] [PULL 10/10] block/curl: fix minor memory leaks, Jeff Cody, 2017/12/18
- Re: [Qemu-block] [PULL 00/10] Block patches, Peter Maydell, 2017/12/19