From 615fbb1d8b28619f0a6a00cdaaa57d223670bf92 Mon Sep 17 00:00:00 2001 From: John Snow Date: Wed, 3 Apr 2019 18:18:50 +0200 Subject: [PATCH 145/163] block/dirty-bitmap: add inconsistent status RH-Author: John Snow Message-id: <20190403181857.9693-15-jsnow@redhat.com> Patchwork-id: 85411 O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 14/21] block/dirty-bitmap: add inconsistent status Bugzilla: 1677073 RH-Acked-by: Max Reitz RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Sergio Lopez Pascual 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 Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20190301191545.8728-3-jsnow@redhat.com Signed-off-by: John Snow (cherry picked from commit 0064cfefa4e90c11e394befb7abe47602f2f30d7) Signed-off-by: John Snow Signed-off-by: Miroslav Rezanina --- block/dirty-bitmap.c | 7 ++++++- qapi/block-core.json | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 096c1b7..4a2349d 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -210,10 +210,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; diff --git a/qapi/block-core.json b/qapi/block-core.json index 92a42ef..c84144d 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -443,10 +443,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: -- 1.8.3.1