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

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