qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: Max Reitz <mreitz@redhat.com>, Fam Zheng <fam@euphon.net>,
	John Snow <jsnow@redhat.com>, Kevin Wolf <kwolf@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	eblake@redhat.com, vsementsov@virtuozzo.com,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Juan Quintela <quintela@redhat.com>
Subject: [Qemu-devel] [PATCH v3 2/7] block/dirty-bitmap: add inconsistent status
Date: Fri,  1 Mar 2019 14:15:40 -0500	[thread overview]
Message-ID: <20190301191545.8728-3-jsnow@redhat.com> (raw)
In-Reply-To: <20190301191545.8728-1-jsnow@redhat.com>

Even though the status field is deprecated, we still have to support
it for a few more releases. Since this is a very new kind of bitmap
state, it makes sense for it to have its own status field.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
---
 qapi/block-core.json | 7 ++++++-
 block/dirty-bitmap.c | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/qapi/block-core.json b/qapi/block-core.json
index e639ef6d1c..ae55cd0704 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -442,10 +442,15 @@
 #          recording new writes. If the bitmap was @disabled, it is not
 #          recording new writes. (Since 2.12)
 #
+# @inconsistent: This is a persistent dirty bitmap that was marked in-use on
+#                disk, and is unusable by QEMU. It can only be deleted.
+#                Please rely on the inconsistent field in @BlockDirtyInfo
+#                instead, as the status field is deprecated. (Since 4.0)
+#
 # Since: 2.4
 ##
 { 'enum': 'DirtyBitmapStatus',
-  'data': ['active', 'disabled', 'frozen', 'locked'] }
+  'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] }
 
 ##
 # @BlockDirtyInfo:
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
index 9e8630e1ac..71e0098396 100644
--- a/block/dirty-bitmap.c
+++ b/block/dirty-bitmap.c
@@ -209,10 +209,15 @@ bool bdrv_dirty_bitmap_enabled(BdrvDirtyBitmap *bitmap)
  *               or it can be Disabled and not recording writes.
  * (4) Locked:   Whether Active or Disabled, the user cannot modify this bitmap
  *               in any way from the monitor.
+ * (5) Inconsistent: This is a persistent bitmap whose "in use" bit is set, and
+ *                   is unusable by QEMU. It can be deleted to remove it from
+ *                   the qcow2.
  */
 DirtyBitmapStatus bdrv_dirty_bitmap_status(BdrvDirtyBitmap *bitmap)
 {
-    if (bdrv_dirty_bitmap_has_successor(bitmap)) {
+    if (bdrv_dirty_bitmap_inconsistent(bitmap)) {
+        return DIRTY_BITMAP_STATUS_INCONSISTENT;
+    } else if (bdrv_dirty_bitmap_has_successor(bitmap)) {
         return DIRTY_BITMAP_STATUS_FROZEN;
     } else if (bdrv_dirty_bitmap_busy(bitmap)) {
         return DIRTY_BITMAP_STATUS_LOCKED;
-- 
2.17.2

  parent reply	other threads:[~2019-03-01 19:16 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 19:15 [Qemu-devel] [PATCH v3 0/7] bitmaps: add inconsistent bit John Snow
2019-03-01 19:15 ` [Qemu-devel] [PATCH v3 1/7] block/dirty-bitmaps: " John Snow
2019-03-01 19:32   ` Eric Blake
2019-03-01 19:44     ` John Snow
2019-03-06 12:25   ` Vladimir Sementsov-Ogievskiy
2019-03-06 13:06     ` Vladimir Sementsov-Ogievskiy
2019-03-06 13:08       ` Vladimir Sementsov-Ogievskiy
2019-03-06 15:15     ` John Snow
2019-03-01 19:15 ` John Snow [this message]
2019-03-06 13:05   ` [Qemu-devel] [PATCH v3 2/7] block/dirty-bitmap: add inconsistent status Vladimir Sementsov-Ogievskiy
2019-03-06 15:14     ` John Snow
2019-03-01 19:15 ` [Qemu-devel] [PATCH v3 3/7] block/dirty-bitmaps: add block_dirty_bitmap_check function John Snow
2019-03-01 19:36   ` Eric Blake
2019-03-01 19:57     ` John Snow
2019-03-01 20:03       ` Eric Blake
2019-03-01 20:06         ` Eric Blake
2019-03-06 13:44   ` Vladimir Sementsov-Ogievskiy
2019-03-06 15:17     ` John Snow
2019-03-01 19:15 ` [Qemu-devel] [PATCH v3 4/7] block/dirty-bitmaps: prohibit readonly bitmaps for backups John Snow
2019-03-01 19:38   ` Eric Blake
2019-03-06 13:47   ` Vladimir Sementsov-Ogievskiy
2019-03-01 19:15 ` [Qemu-devel] [PATCH v3 5/7] block/dirty-bitmaps: prohibit removing readonly bitmaps John Snow
2019-03-01 19:39   ` Eric Blake
2019-03-06 13:49   ` Vladimir Sementsov-Ogievskiy
2019-03-01 19:15 ` [Qemu-devel] [PATCH v3 6/7] block/dirty-bitmaps: disallow busy bitmaps as merge source John Snow
2019-03-01 19:44   ` Eric Blake
2019-03-01 19:48     ` John Snow
2019-03-01 19:57       ` Eric Blake
2019-03-01 20:04         ` John Snow
2019-03-06 13:57           ` Vladimir Sementsov-Ogievskiy
2019-03-06 15:24             ` John Snow
2019-03-06 15:29               ` Eric Blake
2019-03-06 13:57   ` Vladimir Sementsov-Ogievskiy
2019-03-01 19:15 ` [Qemu-devel] [PATCH v3 7/7] block/dirty-bitmaps: implement inconsistent bit John Snow
2019-03-01 19:53   ` Eric Blake
2019-03-06 14:26   ` Vladimir Sementsov-Ogievskiy
2019-03-06 21:46     ` John Snow
2019-03-07 16:37       ` Eric Blake
2019-03-08 18:46         ` John Snow
2019-03-05 23:59 ` [Qemu-devel] [PATCH v3 0/7] bitmaps: add " John Snow

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=20190301191545.8728-3-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=eblake@redhat.com \
    --cc=fam@euphon.net \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --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).