yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-dirty-bitmaps-allow-clear-on-disabled-bitmaps.patch

ae23c9
From 461fe4b2f01c316ce2ca63fa81624fd09273dc02 Mon Sep 17 00:00:00 2001
ae23c9
From: John Snow <jsnow@redhat.com>
ae23c9
Date: Tue, 20 Nov 2018 18:18:18 +0000
ae23c9
Subject: [PATCH 24/35] block/dirty-bitmaps: allow clear on disabled bitmaps
ae23c9
ae23c9
RH-Author: John Snow <jsnow@redhat.com>
ae23c9
Message-id: <20181120181828.15132-15-jsnow@redhat.com>
ae23c9
Patchwork-id: 83062
ae23c9
O-Subject: [RHEL8/rhel qemu-kvm PATCH 14/24] block/dirty-bitmaps: allow clear on disabled bitmaps
ae23c9
Bugzilla: 1518989
ae23c9
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
RH-Acked-by: Max Reitz <mreitz@redhat.com>
ae23c9
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
ae23c9
ae23c9
Similarly to merge, it's OK to allow clear operations on disabled
ae23c9
bitmaps, as this condition only means that they are not recording
ae23c9
new writes. We are free to clear it if the user requests it.
ae23c9
ae23c9
Signed-off-by: John Snow <jsnow@redhat.com>
ae23c9
Reviewed-by: Eric Blake <eblake@redhat.com>
ae23c9
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
ae23c9
Message-id: 20181002230218.13949-4-jsnow@redhat.com
ae23c9
Signed-off-by: John Snow <jsnow@redhat.com>
ae23c9
(cherry picked from commit 0be37c9e19f541643ef407bdafe0282b667ec23c)
ae23c9
Signed-off-by: John Snow <jsnow@redhat.com>
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 block/dirty-bitmap.c | 1 -
ae23c9
 blockdev.c           | 8 --------
ae23c9
 2 files changed, 9 deletions(-)
ae23c9
ae23c9
diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c
ae23c9
index bfccb0e..9b9ebd7 100644
ae23c9
--- a/block/dirty-bitmap.c
ae23c9
+++ b/block/dirty-bitmap.c
ae23c9
@@ -625,7 +625,6 @@ void bdrv_reset_dirty_bitmap(BdrvDirtyBitmap *bitmap,
ae23c9
 
ae23c9
 void bdrv_clear_dirty_bitmap(BdrvDirtyBitmap *bitmap, HBitmap **out)
ae23c9
 {
ae23c9
-    assert(bdrv_dirty_bitmap_enabled(bitmap));
ae23c9
     assert(!bdrv_dirty_bitmap_readonly(bitmap));
ae23c9
     bdrv_dirty_bitmap_lock(bitmap);
ae23c9
     if (!out) {
ae23c9
diff --git a/blockdev.c b/blockdev.c
ae23c9
index 5cdb608..220b317 100644
ae23c9
--- a/blockdev.c
ae23c9
+++ b/blockdev.c
ae23c9
@@ -2122,9 +2122,6 @@ static void block_dirty_bitmap_clear_prepare(BlkActionState *common,
ae23c9
     if (bdrv_dirty_bitmap_user_locked(state->bitmap)) {
ae23c9
         error_setg(errp, "Cannot modify a bitmap in use by another operation");
ae23c9
         return;
ae23c9
-    } else if (!bdrv_dirty_bitmap_enabled(state->bitmap)) {
ae23c9
-        error_setg(errp, "Cannot clear a disabled bitmap");
ae23c9
-        return;
ae23c9
     } else if (bdrv_dirty_bitmap_readonly(state->bitmap)) {
ae23c9
         error_setg(errp, "Cannot clear a readonly bitmap");
ae23c9
         return;
ae23c9
@@ -3027,11 +3024,6 @@ void qmp_block_dirty_bitmap_clear(const char *node, const char *name,
ae23c9
                    "Bitmap '%s' is currently in use by another operation"
ae23c9
                    " and cannot be cleared", name);
ae23c9
         return;
ae23c9
-    } else if (!bdrv_dirty_bitmap_enabled(bitmap)) {
ae23c9
-        error_setg(errp,
ae23c9
-                   "Bitmap '%s' is currently disabled and cannot be cleared",
ae23c9
-                   name);
ae23c9
-        return;
ae23c9
     } else if (bdrv_dirty_bitmap_readonly(bitmap)) {
ae23c9
         error_setg(errp, "Bitmap '%s' is readonly and cannot be cleared", name);
ae23c9
         return;
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9