{"id":807901,"url":"http://patchwork.ozlabs.org/api/1.0/patches/807901/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20170830210542.2153-10-eblake@redhat.com>","date":"2017-08-30T21:05:33","name":"[v6,09/18] dirty-bitmap: Change bdrv_dirty_iter_next() to report byte offset","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"8994906d40c610d7f7408e1a754d4780180ffe43","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/1.0/people/6591/?format=json","name":"Eric Blake","email":"eblake@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170830210542.2153-10-eblake@redhat.com/mbox/","series":[{"id":700,"url":"http://patchwork.ozlabs.org/api/1.0/series/700/?format=json","date":"2017-08-30T21:05:25","name":"make dirty-bitmap byte-based","version":6,"mbox":"http://patchwork.ozlabs.org/series/700/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/807901/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx05.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xjJCv5L58z9sNw\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 07:14:19 +1000 (AEST)","from localhost ([::1]:52725 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dnAJV-0002I6-Md\n\tfor incoming@patchwork.ozlabs.org; Wed, 30 Aug 2017 17:14:17 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:36966)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnABc-0003o4-14\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 17:06:11 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnABb-0007VX-2d\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 17:06:08 -0400","from mx1.redhat.com ([209.132.183.28]:43870)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>)\n\tid 1dnABY-0007U4-Bc; Wed, 30 Aug 2017 17:06:04 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 5B89937E85;\n\tWed, 30 Aug 2017 21:06:03 +0000 (UTC)","from red.redhat.com (ovpn-122-186.rdu2.redhat.com [10.10.122.186])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 0461C77557;\n\tWed, 30 Aug 2017 21:06:01 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 5B89937E85","From":"Eric Blake <eblake@redhat.com>","To":"qemu-devel@nongnu.org","Date":"Wed, 30 Aug 2017 16:05:33 -0500","Message-Id":"<20170830210542.2153-10-eblake@redhat.com>","In-Reply-To":"<20170830210542.2153-1-eblake@redhat.com>","References":"<20170830210542.2153-1-eblake@redhat.com>","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.29]);\n\tWed, 30 Aug 2017 21:06:03 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"[Qemu-devel] [PATCH v6 09/18] dirty-bitmap: Change\n\tbdrv_dirty_iter_next() to report byte offset","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"kwolf@redhat.com, vsementsov@virtuozzo.com, Fam Zheng <famz@redhat.com>, \n\tqemu-block@nongnu.org, Jeff Cody <jcody@redhat.com>,\n\tMax Reitz <mreitz@redhat.com>, jsnow@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"Thanks to recent cleanups, most callers were scaling a return value\nof sectors into bytes (the exception, in qcow2-bitmap, will be\nconverted to byte-based iteration later).  Update the interface to\ndo the scaling internally instead.\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\nReviewed-By: John Snow <jsnow@redhat.com>\n\n---\nv5: no change\nv4: rebase to persistent bitmap\nv3: no change\nv2: no change\n---\n block/backup.c       | 2 +-\n block/dirty-bitmap.c | 2 +-\n block/mirror.c       | 8 ++++----\n block/qcow2-bitmap.c | 2 +-\n 4 files changed, 7 insertions(+), 7 deletions(-)","diff":"diff --git a/block/backup.c b/block/backup.c\nindex 1a6ec7d079..f53cde90d6 100644\n--- a/block/backup.c\n+++ b/block/backup.c\n@@ -375,7 +375,7 @@ static int coroutine_fn backup_run_incremental(BackupBlockJob *job)\n     dbi = bdrv_dirty_iter_new(job->sync_bitmap);\n\n     /* Find the next dirty sector(s) */\n-    while ((offset = bdrv_dirty_iter_next(dbi) * BDRV_SECTOR_SIZE) >= 0) {\n+    while ((offset = bdrv_dirty_iter_next(dbi)) >= 0) {\n         cluster = offset / job->cluster_size;\n\n         /* Fake progress updates for any clusters we skipped */\ndiff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c\nindex c091f0c7ba..20f230867d 100644\n--- a/block/dirty-bitmap.c\n+++ b/block/dirty-bitmap.c\n@@ -505,7 +505,7 @@ void bdrv_dirty_iter_free(BdrvDirtyBitmapIter *iter)\n\n int64_t bdrv_dirty_iter_next(BdrvDirtyBitmapIter *iter)\n {\n-    return hbitmap_iter_next(&iter->hbi);\n+    return hbitmap_iter_next(&iter->hbi) * BDRV_SECTOR_SIZE;\n }\n\n /* Called within bdrv_dirty_bitmap_lock..unlock */\ndiff --git a/block/mirror.c b/block/mirror.c\nindex 51824750ac..af13f5d658 100644\n--- a/block/mirror.c\n+++ b/block/mirror.c\n@@ -336,10 +336,10 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)\n     int max_io_bytes = MAX(s->buf_size / MAX_IN_FLIGHT, MAX_IO_BYTES);\n\n     bdrv_dirty_bitmap_lock(s->dirty_bitmap);\n-    offset = bdrv_dirty_iter_next(s->dbi) * BDRV_SECTOR_SIZE;\n+    offset = bdrv_dirty_iter_next(s->dbi);\n     if (offset < 0) {\n         bdrv_set_dirty_iter(s->dbi, 0);\n-        offset = bdrv_dirty_iter_next(s->dbi) * BDRV_SECTOR_SIZE;\n+        offset = bdrv_dirty_iter_next(s->dbi);\n         trace_mirror_restart_iter(s, bdrv_get_dirty_count(s->dirty_bitmap) *\n                                   BDRV_SECTOR_SIZE);\n         assert(offset >= 0);\n@@ -370,11 +370,11 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)\n             break;\n         }\n\n-        next_dirty = bdrv_dirty_iter_next(s->dbi) * BDRV_SECTOR_SIZE;\n+        next_dirty = bdrv_dirty_iter_next(s->dbi);\n         if (next_dirty > next_offset || next_dirty < 0) {\n             /* The bitmap iterator's cache is stale, refresh it */\n             bdrv_set_dirty_iter(s->dbi, next_offset);\n-            next_dirty = bdrv_dirty_iter_next(s->dbi) * BDRV_SECTOR_SIZE;\n+            next_dirty = bdrv_dirty_iter_next(s->dbi);\n         }\n         assert(next_dirty == next_offset);\n         nb_chunks++;\ndiff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c\nindex 44329fc74f..c7c60dfca2 100644\n--- a/block/qcow2-bitmap.c\n+++ b/block/qcow2-bitmap.c\n@@ -1109,7 +1109,7 @@ static uint64_t *store_bitmap_data(BlockDriverState *bs,\n     sbc = limit >> BDRV_SECTOR_BITS;\n     assert(DIV_ROUND_UP(bm_size, limit) == tb_size);\n\n-    while ((sector = bdrv_dirty_iter_next(dbi)) != -1) {\n+    while ((sector = bdrv_dirty_iter_next(dbi) >> BDRV_SECTOR_BITS) != -1) {\n         uint64_t cluster = sector / sbc;\n         uint64_t end, write_size;\n         int64_t off;\n","prefixes":["v6","09/18"]}