From nobody Thu Nov 6 12:11:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540849163721589.490503540707; Mon, 29 Oct 2018 14:39:23 -0700 (PDT) Received: from localhost ([::1]:49137 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHFFq-0000Wh-Lm for importer@patchew.org; Mon, 29 Oct 2018 17:39:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHF2V-0004RA-PT for qemu-devel@nongnu.org; Mon, 29 Oct 2018 17:25:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHF2Q-0002Qo-0s for qemu-devel@nongnu.org; Mon, 29 Oct 2018 17:25:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52670) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gHF2B-0002J4-Bt for qemu-devel@nongnu.org; Mon, 29 Oct 2018 17:25:19 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AFB4E308421B; Mon, 29 Oct 2018 21:25:13 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-171.bos.redhat.com [10.18.17.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38A78194AB; Mon, 29 Oct 2018 21:25:13 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Mon, 29 Oct 2018 17:24:54 -0400 Message-Id: <20181029212501.5897-13-jsnow@redhat.com> In-Reply-To: <20181029212501.5897-1-jsnow@redhat.com> References: <20181029212501.5897-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 29 Oct 2018 21:25:13 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 12/19] block/dirty-bitmaps: allow clear on disabled bitmaps X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- 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 bfccb0ea15..9b9ebd7142 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -625,7 +625,6 @@ void bdrv_reset_dirty_bitmap(BdrvDirtyBitmap *bitmap, =20 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 9da0cf1a72..8970f699b9 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2013,9 +2013,6 @@ static void block_dirty_bitmap_clear_prepare(BlkActio= nState *common, if (bdrv_dirty_bitmap_user_locked(state->bitmap)) { error_setg(errp, "Cannot modify a bitmap in use by another operati= on"); 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; @@ -2918,11 +2915,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 cleare= d", - name); - return; } else if (bdrv_dirty_bitmap_readonly(bitmap)) { error_setg(errp, "Bitmap '%s' is readonly and cannot be cleared", = name); return; --=20 2.14.5