{"id":807900,"url":"http://patchwork.ozlabs.org/api/1.0/patches/807900/?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-11-eblake@redhat.com>","date":"2017-08-30T21:05:34","name":"[v6,10/18] dirty-bitmap: Change bdrv_get_dirty_count() to report bytes","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"31bf123a2c047601f3c8481ce5a773d7654f5360","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-11-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/807900/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-mx09.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx09.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 3xjJC52BWsz9s8P\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 31 Aug 2017 07:13:37 +1000 (AEST)","from localhost ([::1]:52723 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 1dnAIp-0001gA-94\n\tfor incoming@patchwork.ozlabs.org; Wed, 30 Aug 2017 17:13:35 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:37028)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnABj-0003tl-OK\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 17:06:16 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnABi-0007aX-GB\n\tfor qemu-devel@nongnu.org; Wed, 30 Aug 2017 17:06:15 -0400","from mx1.redhat.com ([209.132.183.28]:35264)\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 1dnABc-0007Vq-K0; Wed, 30 Aug 2017 17:06:08 -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 AA5674E334;\n\tWed, 30 Aug 2017 21:06:07 +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 9621677557;\n\tWed, 30 Aug 2017 21:06:03 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com AA5674E334","From":"Eric Blake <eblake@redhat.com>","To":"qemu-devel@nongnu.org","Date":"Wed, 30 Aug 2017 16:05:34 -0500","Message-Id":"<20170830210542.2153-11-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.38]);\n\tWed, 30 Aug 2017 21:06:07 +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 10/18] 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>\nReviewed-by: Juan Quintela <quintela@redhat.com>\n\n---\nv4: no change\nv3: no change, add R-b\nv2: no change\n---\n block/dirty-bitmap.c |  4 ++--\n block/mirror.c       | 13 +++++--------\n migration/block.c    |  2 +-\n 3 files changed, 8 insertions(+), 11 deletions(-)","diff":"diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c\nindex 20f230867d..f983d99def 100644\n--- a/block/dirty-bitmap.c\n+++ b/block/dirty-bitmap.c\n@@ -425,7 +425,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@@ -653,7 +653,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 af13f5d658..cc47e21814 100644\n--- a/block/mirror.c\n+++ b/block/mirror.c\n@@ -811,11 +811,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 +826,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 +867,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 +886,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":["v6","10/18"]}