From nobody Sun May 19 23:20:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1549314737823527.5256902877466; Mon, 4 Feb 2019 13:12:17 -0800 (PST) Received: from localhost ([127.0.0.1]:49393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqlXK-0003vO-AI for importer@patchew.org; Mon, 04 Feb 2019 16:12:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gqlVQ-0002c0-Tk for qemu-devel@nongnu.org; Mon, 04 Feb 2019 16:10:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gqlQp-0004k0-H3 for qemu-devel@nongnu.org; Mon, 04 Feb 2019 16:05:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55396) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gqlQn-0004fn-Jc; Mon, 04 Feb 2019 16:05:29 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 316ED5F79B; Mon, 4 Feb 2019 21:05:27 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-162.phx2.redhat.com [10.3.116.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id D36DF6EA09; Mon, 4 Feb 2019 21:05:22 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Mon, 4 Feb 2019 15:05:12 -0600 Message-Id: <20190204210512.27458-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 04 Feb 2019 21:05:27 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2] dirty-bitmap: Expose persistent flag to 'query-block' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , vsementsov@virtuozzo.com, qemu-block@nongnu.org, Markus Armbruster , Max Reitz , andrey.shinkevich@virtuozzo.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Since qemu currently doesn't flush persistent bitmaps to disk until shutdown (which might be MUCH later), it's useful if 'query-block' at least shows WHICH bitmaps will (eventually) make it to persistent storage. Update affected iotests. Signed-off-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow --- v2: also update iotest output [John]; R-b added since changes only to tests --- qapi/block-core.json | 5 ++++- block/dirty-bitmap.c | 1 + tests/qemu-iotests/124 | 1 + tests/qemu-iotests/236.out | 14 ++++++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 5f17d67d714..f2bfe566d8d 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -447,11 +447,14 @@ # # @status: current status of the dirty bitmap (since 2.4) # +# @persistent: true if the bitmap will eventually be flushed to persistent +# storage (since 4.0) +# # Since: 1.3 ## { 'struct': 'BlockDirtyInfo', 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32', - 'status': 'DirtyBitmapStatus'} } + 'status': 'DirtyBitmapStatus', 'persistent': 'bool' } } ## # @BlockLatencyHistogramInfo: diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 00ea36f5545..e46f72b346c 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -440,6 +440,7 @@ BlockDirtyInfoList *bdrv_query_dirty_bitmaps(BlockDrive= rState *bs) info->has_name =3D !!bm->name; info->name =3D g_strdup(bm->name); info->status =3D bdrv_dirty_bitmap_status(bm); + info->persistent =3D bm->persistent; entry->value =3D info; *plist =3D entry; plist =3D &entry->next; diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 index 9f189e3b540..5aa1bf1bd64 100755 --- a/tests/qemu-iotests/124 +++ b/tests/qemu-iotests/124 @@ -350,6 +350,7 @@ class TestIncrementalBackup(TestIncrementalBackupBase): self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/count', 458752) self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/granularity', = 65536) self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/status', 'acti= ve') + self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/persistent', F= alse) # Prepare a cluster_size=3D128k backup target without a backing fi= le. (target, _) =3D bitmap0.new_target() diff --git a/tests/qemu-iotests/236.out b/tests/qemu-iotests/236.out index bb2d71ea5ec..5006f7bca16 100644 --- a/tests/qemu-iotests/236.out +++ b/tests/qemu-iotests/236.out @@ -25,12 +25,14 @@ write -P0xcd 0x3ff0000 64k "count": 262144, "granularity": 65536, "name": "bitmapB", + "persistent": false, "status": "active" }, { "count": 262144, "granularity": 65536, "name": "bitmapA", + "persistent": false, "status": "active" } ] @@ -85,12 +87,14 @@ write -P0xcd 0x3ff0000 64k "count": 262144, "granularity": 65536, "name": "bitmapB", + "persistent": false, "status": "active" }, { "count": 262144, "granularity": 65536, "name": "bitmapA", + "persistent": false, "status": "active" } ] @@ -183,18 +187,21 @@ write -P0xea 0x3fe0000 64k "count": 393216, "granularity": 65536, "name": "bitmapC", + "persistent": false, "status": "disabled" }, { "count": 262144, "granularity": 65536, "name": "bitmapB", + "persistent": false, "status": "disabled" }, { "count": 458752, "granularity": 65536, "name": "bitmapA", + "persistent": false, "status": "disabled" } ] @@ -247,18 +254,21 @@ write -P0xea 0x3fe0000 64k "count": 393216, "granularity": 65536, "name": "bitmapC", + "persistent": false, "status": "disabled" }, { "count": 262144, "granularity": 65536, "name": "bitmapB", + "persistent": false, "status": "disabled" }, { "count": 458752, "granularity": 65536, "name": "bitmapA", + "persistent": false, "status": "disabled" } ] @@ -304,24 +314,28 @@ write -P0xea 0x3fe0000 64k "count": 458752, "granularity": 65536, "name": "bitmapD", + "persistent": false, "status": "disabled" }, { "count": 393216, "granularity": 65536, "name": "bitmapC", + "persistent": false, "status": "disabled" }, { "count": 262144, "granularity": 65536, "name": "bitmapB", + "persistent": false, "status": "disabled" }, { "count": 458752, "granularity": 65536, "name": "bitmapA", + "persistent": false, "status": "disabled" } ] --=20 2.20.1