From 2f1acc04e2744651329f4c9bf2de480923f63a41 Mon Sep 17 00:00:00 2001 From: John Snow Date: Wed, 6 Feb 2019 22:12:33 +0100 Subject: [PATCH 23/33] block/dirty-bitmaps: allow clear on disabled bitmaps RH-Author: John Snow Message-id: <20190206221243.7407-14-jsnow@redhat.com> Patchwork-id: 84266 O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH v2 13/23] block/dirty-bitmaps: allow clear on disabled bitmaps Bugzilla: 1658343 RH-Acked-by: Thomas Huth RH-Acked-by: Laurent Vivier RH-Acked-by: Stefan Hajnoczi Similarly to merge, it's OK to allow clear operations on disabled bitmaps, as this condition only means that they are not recording new writes. We are free to clear it if the user requests it. Signed-off-by: John Snow Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20181002230218.13949-4-jsnow@redhat.com Signed-off-by: John Snow (cherry picked from commit 0be37c9e19f541643ef407bdafe0282b667ec23c) Signed-off-by: John Snow Signed-off-by: Miroslav Rezanina --- block/dirty-bitmap.c | 1 - blockdev.c | 8 -------- 2 files changed, 9 deletions(-) diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 8c7dc60..db8021a 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -625,7 +625,6 @@ void bdrv_reset_dirty_bitmap(BdrvDirtyBitmap *bitmap, void bdrv_clear_dirty_bitmap(BdrvDirtyBitmap *bitmap, HBitmap **out) { - assert(bdrv_dirty_bitmap_enabled(bitmap)); assert(!bdrv_dirty_bitmap_readonly(bitmap)); bdrv_dirty_bitmap_lock(bitmap); if (!out) { diff --git a/blockdev.c b/blockdev.c index 6cf7654..7300f01 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2164,9 +2164,6 @@ static void block_dirty_bitmap_clear_prepare(BlkActionState *common, if (bdrv_dirty_bitmap_user_locked(state->bitmap)) { error_setg(errp, "Cannot modify a bitmap in use by another operation"); return; - } else if (!bdrv_dirty_bitmap_enabled(state->bitmap)) { - error_setg(errp, "Cannot clear a disabled bitmap"); - return; } else if (bdrv_dirty_bitmap_readonly(state->bitmap)) { error_setg(errp, "Cannot clear a readonly bitmap"); return; @@ -3069,11 +3066,6 @@ void qmp_block_dirty_bitmap_clear(const char *node, const char *name, "Bitmap '%s' is currently in use by another operation" " and cannot be cleared", name); return; - } else if (!bdrv_dirty_bitmap_enabled(bitmap)) { - error_setg(errp, - "Bitmap '%s' is currently disabled and cannot be cleared", - name); - return; } else if (bdrv_dirty_bitmap_readonly(bitmap)) { error_setg(errp, "Bitmap '%s' is readonly and cannot be cleared", name); return; -- 1.8.3.1