All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	vsementsov@virtuozzo.com, Markus Armbruster <armbru@redhat.com>,
	Max Reitz <mreitz@redhat.com>, John Snow <jsnow@redhat.com>
Subject: [Qemu-devel] [PATCH v2 07/11] block/backup: centralize copy_bitmap initialization
Date: Mon, 15 Jul 2019 20:01:13 -0400	[thread overview]
Message-ID: <20190716000117.25219-8-jsnow@redhat.com> (raw)
In-Reply-To: <20190716000117.25219-1-jsnow@redhat.com>

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 <jsnow@redhat.com>
---
 block/backup.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/block/backup.c b/block/backup.c
index 22fafbb80f..c88a70fe10 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -441,16 +441,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)
@@ -462,12 +468,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



  parent reply	other threads:[~2019-07-16  0:03 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16  0:01 [Qemu-devel] [PATCH v2 00/11] bitmaps: allow bitmaps to be used with full and top John Snow
2019-07-16  0:01 ` [Qemu-devel] [PATCH v2 01/11] iotests/257: add Pattern class John Snow
2019-07-16 10:08   ` Max Reitz
2019-07-16  0:01 ` [Qemu-devel] [PATCH v2 02/11] iotests/257: add EmulatedBitmap class John Snow
2019-07-16 10:11   ` Max Reitz
2019-07-16  0:01 ` [Qemu-devel] [PATCH v2 03/11] iotests/257: Refactor backup helpers John Snow
2019-07-16 10:33   ` Max Reitz
2019-07-16  0:01 ` [Qemu-devel] [PATCH v2 04/11] block/backup: hoist bitmap check into QMP interface John Snow
2019-07-16  0:01 ` [Qemu-devel] [PATCH v2 05/11] iotests/257: test API failures John Snow
2019-07-16 10:35   ` Max Reitz
2019-07-16  0:01 ` [Qemu-devel] [PATCH v2 06/11] block/backup: improve sync=bitmap work estimates John Snow
2019-07-16 10:53   ` Max Reitz
2019-07-16  0:01 ` John Snow [this message]
2019-07-16 10:58   ` [Qemu-devel] [PATCH v2 07/11] block/backup: centralize copy_bitmap initialization Max Reitz
2019-07-16  0:01 ` [Qemu-devel] [PATCH v2 08/11] block/backup: add backup_is_cluster_allocated John Snow
2019-07-16 11:07   ` Max Reitz
2019-07-16  0:01 ` [Qemu-devel] [PATCH v2 09/11] block/backup: teach TOP to never copy unallocated regions John Snow
2019-07-16 11:43   ` Max Reitz
2019-07-16 16:02     ` John Snow
2019-07-16 16:11       ` Max Reitz
2019-07-17 18:10         ` John Snow
2019-07-16  0:01 ` [Qemu-devel] [PATCH v2 10/11] block/backup: support bitmap sync modes for non-bitmap backups John Snow
2019-07-16  5:18   ` Markus Armbruster
2019-07-16 14:49     ` John Snow
2019-07-16 11:45   ` Max Reitz
2019-07-16  0:01 ` [Qemu-devel] [PATCH v2 11/11] iotests/257: test traditional sync modes John Snow
2019-07-16 12:04   ` Max Reitz
2019-07-16 16:58     ` John Snow
2019-07-17  9:50       ` Max Reitz
2019-07-17 17:53         ` John Snow
2019-07-17 19:35 ` [Qemu-devel] [PATCH v2 00/11] bitmaps: allow bitmaps to be used with full and top John Snow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190716000117.25219-8-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.