{"id":815105,"url":"http://patchwork.ozlabs.org/api/1.2/patches/815105/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170918185819.5984-13-eblake@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.2/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":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170918185819.5984-13-eblake@redhat.com>","list_archive_url":null,"date":"2017-09-18T18:58:11","name":"[v8,12/20] dirty-bitmap: Change bdrv_get_dirty_count() to report bytes","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"c9a792a8684760f28f02cfd79a7bcfc7fb739706","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/1.2/people/6591/?format=json","name":"Eric Blake","email":"eblake@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170918185819.5984-13-eblake@redhat.com/mbox/","series":[{"id":3711,"url":"http://patchwork.ozlabs.org/api/1.2/series/3711/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3711","date":"2017-09-18T18:58:00","name":"make dirty-bitmap byte-based","version":8,"mbox":"http://patchwork.ozlabs.org/series/3711/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/815105/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/815105/checks/","tags":{},"related":[],"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 3xwwXd5nSPz9s3T\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 19 Sep 2017 05:09:05 +1000 (AEST)","from localhost ([::1]:38412 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 1du1Pj-0003ev-2A\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 15:09:03 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:44410)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1du1G4-0002Q6-Nl\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 14:59:05 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1du1G3-0006as-Aj\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 14:59:04 -0400","from mx1.redhat.com ([209.132.183.28]:51016)\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 1du1G0-0006YG-20; Mon, 18 Sep 2017 14:59:00 -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 077922CE92A;\n\tMon, 18 Sep 2017 18:58:59 +0000 (UTC)","from red.redhat.com (ovpn-124-97.rdu2.redhat.com [10.10.124.97])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 89B365C541;\n\tMon, 18 Sep 2017 18:58:54 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 077922CE92A","From":"Eric Blake <eblake@redhat.com>","To":"qemu-devel@nongnu.org","Date":"Mon, 18 Sep 2017 13:58:11 -0500","Message-Id":"<20170918185819.5984-13-eblake@redhat.com>","In-Reply-To":"<20170918185819.5984-1-eblake@redhat.com>","References":"<20170918185819.5984-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\tMon, 18 Sep 2017 18:58:59 +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 v8 12/20] dirty-bitmap: Change\n\tbdrv_get_dirty_count() to report bytes","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, Juan Quintela <quintela@redhat.com>,\n\tJeff Cody <jcody@redhat.com>,\n\t\"Dr. David Alan Gilbert\" <dgilbert@redhat.com>,\n\tMax Reitz <mreitz@redhat.com>,\n\tStefan Hajnoczi <stefanha@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, all callers were scaling a return value\nof sectors into bytes; do the scaling internally instead.\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\nReviewed-by: John Snow <jsnow@redhat.com>\n\n---\nv8: no change, add R-b\nv7: fix one more trace caller [Kevin]\nv4-v6: no change\nv3: no change, add R-b\nv2: no change\n---\n block/dirty-bitmap.c |  4 ++--\n block/mirror.c       | 16 ++++++----------\n migration/block.c    |  2 +-\n 3 files changed, 9 insertions(+), 13 deletions(-)","diff":"diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c\nindex e451916187..8322e23f0d 100644\n--- a/block/dirty-bitmap.c\n+++ b/block/dirty-bitmap.c\n@@ -423,7 +423,7 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDriverState *bs)\n     QLIST_FOREACH(bm, &bs->dirty_bitmaps, list) {\n         BlockDirtyInfo *info = g_new0(BlockDirtyInfo, 1);\n         BlockDirtyInfoList *entry = g_new0(BlockDirtyInfoList, 1);\n-        info->count = bdrv_get_dirty_count(bm) << BDRV_SECTOR_BITS;\n+        info->count = bdrv_get_dirty_count(bm);\n         info->granularity = bdrv_dirty_bitmap_granularity(bm);\n         info->has_name = !!bm->name;\n         info->name = g_strdup(bm->name);\n@@ -652,7 +652,7 @@ void bdrv_set_dirty_iter(BdrvDirtyBitmapIter *iter, int64_t offset)\n\n int64_t bdrv_get_dirty_count(BdrvDirtyBitmap *bitmap)\n {\n-    return hbitmap_count(bitmap->bitmap);\n+    return hbitmap_count(bitmap->bitmap) << BDRV_SECTOR_BITS;\n }\n\n int64_t bdrv_get_meta_dirty_count(BdrvDirtyBitmap *bitmap)\ndiff --git a/block/mirror.c b/block/mirror.c\nindex 77bf5aa3a4..7113d47db4 100644\n--- a/block/mirror.c\n+++ b/block/mirror.c\n@@ -340,8 +340,7 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)\n     if (offset < 0) {\n         bdrv_set_dirty_iter(s->dbi, 0);\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+        trace_mirror_restart_iter(s, bdrv_get_dirty_count(s->dirty_bitmap));\n         assert(offset >= 0);\n     }\n     bdrv_dirty_bitmap_unlock(s->dirty_bitmap);\n@@ -811,11 +810,10 @@ static void coroutine_fn mirror_run(void *opaque)\n\n         cnt = bdrv_get_dirty_count(s->dirty_bitmap);\n         /* s->common.offset contains the number of bytes already processed so\n-         * far, cnt is the number of dirty sectors remaining and\n+         * far, cnt is the number of dirty bytes remaining and\n          * s->bytes_in_flight is the number of bytes currently being\n          * processed; together those are the current total operation length */\n-        s->common.len = s->common.offset + s->bytes_in_flight +\n-            cnt * BDRV_SECTOR_SIZE;\n+        s->common.len = s->common.offset + s->bytes_in_flight + cnt;\n\n         /* Note that even when no rate limit is applied we need to yield\n          * periodically with no pending I/O so that bdrv_drain_all() returns.\n@@ -827,8 +825,7 @@ static void coroutine_fn mirror_run(void *opaque)\n             s->common.iostatus == BLOCK_DEVICE_IO_STATUS_OK) {\n             if (s->in_flight >= MAX_IN_FLIGHT || s->buf_free_count == 0 ||\n                 (cnt == 0 && s->in_flight > 0)) {\n-                trace_mirror_yield(s, cnt * BDRV_SECTOR_SIZE,\n-                                   s->buf_free_count, s->in_flight);\n+                trace_mirror_yield(s, cnt, s->buf_free_count, s->in_flight);\n                 mirror_wait_for_io(s);\n                 continue;\n             } else if (cnt != 0) {\n@@ -869,7 +866,7 @@ static void coroutine_fn mirror_run(void *opaque)\n              * whether to switch to target check one last time if I/O has\n              * come in the meanwhile, and if not flush the data to disk.\n              */\n-            trace_mirror_before_drain(s, cnt * BDRV_SECTOR_SIZE);\n+            trace_mirror_before_drain(s, cnt);\n\n             bdrv_drained_begin(bs);\n             cnt = bdrv_get_dirty_count(s->dirty_bitmap);\n@@ -888,8 +885,7 @@ static void coroutine_fn mirror_run(void *opaque)\n         }\n\n         ret = 0;\n-        trace_mirror_before_sleep(s, cnt * BDRV_SECTOR_SIZE,\n-                                  s->synced, delay_ns);\n+        trace_mirror_before_sleep(s, cnt, s->synced, delay_ns);\n         if (!s->synced) {\n             block_job_sleep_ns(&s->common, QEMU_CLOCK_REALTIME, delay_ns);\n             if (block_job_is_cancelled(&s->common)) {\ndiff --git a/migration/block.c b/migration/block.c\nindex 9171f60028..a3512945da 100644\n--- a/migration/block.c\n+++ b/migration/block.c\n@@ -667,7 +667,7 @@ static int64_t get_remaining_dirty(void)\n         aio_context_release(blk_get_aio_context(bmds->blk));\n     }\n\n-    return dirty << BDRV_SECTOR_BITS;\n+    return dirty;\n }\n\n\n","prefixes":["v8","12/20"]}