From: John Snow <jsnow@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, famz@redhat.com, jcody@redhat.com,
mreitz@redhat.com, stefanha@redhat.com, den@openvz.org
Subject: Re: [Qemu-devel] [PATCH 5/5] backup: use copy_bitmap in incremental backup
Date: Mon, 9 Oct 2017 19:51:38 -0400 [thread overview]
Message-ID: <5c764041-da10-7946-86fb-d3be36f76cd9@redhat.com> (raw)
In-Reply-To: <20171002143919.207741-6-vsementsov@virtuozzo.com>
On 10/02/2017 10:39 AM, Vladimir Sementsov-Ogievskiy wrote:
> We can use copy_bitmap instead of sync_bitmap. copy_bitmap is
> initialized from sync_bitmap and it is more informative: we will not try
> to process data, that is already in progress (by write notifier).
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> block/backup.c | 55 +++++++++++++++++--------------------------------------
Lookin' good.
> 1 file changed, 17 insertions(+), 38 deletions(-)
>
> diff --git a/block/backup.c b/block/backup.c
> index 52df7bb19e..c933cfafc3 100644
> --- a/block/backup.c
> +++ b/block/backup.c
> @@ -362,49 +362,28 @@ static bool coroutine_fn yield_and_check(BackupBlockJob *job)
>
> static int coroutine_fn backup_run_incremental(BackupBlockJob *job)
> {
> + int ret;
> bool error_is_read;
> - int ret = 0;
> - int clusters_per_iter;
> - uint32_t granularity;
> - int64_t offset;
> int64_t cluster;
> - int64_t end;
> - BdrvDirtyBitmapIter *dbi;
> -
> - granularity = bdrv_dirty_bitmap_granularity(job->sync_bitmap);
> - clusters_per_iter = MAX((granularity / job->cluster_size), 1);
> - dbi = bdrv_dirty_iter_new(job->sync_bitmap);
> -
> - /* Find the next dirty sector(s) */
> - while ((offset = bdrv_dirty_iter_next(dbi)) >= 0) {
> - cluster = offset / job->cluster_size;
> -
> - for (end = cluster + clusters_per_iter; cluster < end; cluster++) {
> - do {
> - if (yield_and_check(job)) {
> - goto out;
> - }
> - ret = backup_do_cow(job, cluster * job->cluster_size,
> - job->cluster_size, &error_is_read,
> - false);
> - if ((ret < 0) &&
> - backup_error_action(job, error_is_read, -ret) ==
> - BLOCK_ERROR_ACTION_REPORT) {
> - goto out;
> - }
> - } while (ret < 0);
> - }
> + HBitmapIter hbi;
>
> - /* If the bitmap granularity is smaller than the backup granularity,
> - * we need to advance the iterator pointer to the next cluster. */
> - if (granularity < job->cluster_size) {
> - bdrv_set_dirty_iter(dbi, cluster * job->cluster_size);
> - }
> + hbitmap_iter_init(&hbi, job->copy_bitmap, 0);
> + while ((cluster = hbitmap_iter_next(&hbi)) != -1) {
> + do {
> + if (yield_and_check(job)) {
> + return 0;
> + }
> + ret = backup_do_cow(job, cluster * job->cluster_size,
> + job->cluster_size, &error_is_read, false);
> + if (ret < 0 && backup_error_action(job, error_is_read, -ret) ==
> + BLOCK_ERROR_ACTION_REPORT)
> + {
> + return ret;
> + }
> + } while (ret < 0);
> }
>
> -out:
> - bdrv_dirty_iter_free(dbi);
> - return ret;
> + return 0;
> }
>
> /* init copy_bitmap from sync_bitmap */
>
Impressive, you really cleaned this function up considerably.
Reviewed-by: John Snow <jsnow@redhat.com>
next prev parent reply other threads:[~2017-10-09 23:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-02 14:39 [Qemu-devel] [PATCH 0/5] backup improvements part 1 Vladimir Sementsov-Ogievskiy
2017-10-02 14:39 ` [Qemu-devel] [PATCH 1/5] hbitmap: add next_zero function Vladimir Sementsov-Ogievskiy
2017-10-02 15:43 ` Eric Blake
2017-10-02 16:16 ` Vladimir Sementsov-Ogievskiy
2017-10-09 21:51 ` John Snow
2017-10-12 10:05 ` Vladimir Sementsov-Ogievskiy
2017-10-02 14:39 ` [Qemu-devel] [PATCH 2/5] backup: move from done_bitmap to copy_bitmap Vladimir Sementsov-Ogievskiy
2017-10-09 22:16 ` John Snow
2017-10-02 14:39 ` [Qemu-devel] [PATCH 3/5] backup: init copy_bitmap from sync_bitmap for incremental Vladimir Sementsov-Ogievskiy
2017-10-09 22:56 ` John Snow
2017-10-12 11:23 ` Vladimir Sementsov-Ogievskiy
2017-11-07 0:25 ` John Snow
2017-10-02 14:39 ` [Qemu-devel] [PATCH 4/5] backup: simplify non-dirty bits progress processing Vladimir Sementsov-Ogievskiy
2017-10-09 23:44 ` John Snow
2017-10-12 11:42 ` Vladimir Sementsov-Ogievskiy
2017-10-12 13:56 ` Eric Blake
2017-10-02 14:39 ` [Qemu-devel] [PATCH 5/5] backup: use copy_bitmap in incremental backup Vladimir Sementsov-Ogievskiy
2017-10-09 23:51 ` John Snow [this message]
2017-10-02 15:38 ` [Qemu-devel] [PATCH 0/5] backup improvements part 1 Eric Blake
2017-10-02 16:17 ` Vladimir Sementsov-Ogievskiy
-- strict thread matches above, loose matches on Subject: below --
2017-10-12 13:53 [Qemu-devel] [PATCH v2 " Vladimir Sementsov-Ogievskiy
2017-10-12 13:53 ` [Qemu-devel] [PATCH 5/5] backup: use copy_bitmap in incremental backup Vladimir Sementsov-Ogievskiy
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=5c764041-da10-7946-86fb-d3be36f76cd9@redhat.com \
--to=jsnow@redhat.com \
--cc=den@openvz.org \
--cc=famz@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).