From patchwork Thu Jan 31 01:01:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 10789527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1096F91E for ; Thu, 31 Jan 2019 01:11:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D55B2F7C3 for ; Thu, 31 Jan 2019 01:11:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11CB12F6B2; Thu, 31 Jan 2019 01:11:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B72792F7F4 for ; Thu, 31 Jan 2019 01:11:40 +0000 (UTC) Received: from localhost ([127.0.0.1]:47014 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gp0tI-0000ce-04 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 30 Jan 2019 20:11:40 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gp0jn-00012J-Rn for qemu-devel@nongnu.org; Wed, 30 Jan 2019 20:01:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gp0jm-00018F-MQ for qemu-devel@nongnu.org; Wed, 30 Jan 2019 20:01:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34152) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gp0jg-00012q-Jn; Wed, 30 Jan 2019 20:01:45 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E5D7A12F8E5; Thu, 31 Jan 2019 01:01:39 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-68.bos.redhat.com [10.18.17.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF4CE9067; Thu, 31 Jan 2019 01:01:36 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Wed, 30 Jan 2019 20:01:36 -0500 Message-Id: <20190131010136.12007-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 31 Jan 2019 01:01:40 +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] [PATCH] block/dirty-bitmap: Documentation and Comment fixups 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: Kevin Wolf , Fam Zheng , vsementsov@virtuozzo.com, Markus Armbruster , Max Reitz , John Snow Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The meaning of the states has changed subtly over time, this should bring the understanding more in-line with the current, actual usages. Reported-by: Eric Blake Signed-off-by: John Snow Reviewed-by: Eric Blake --- block/dirty-bitmap.c | 19 +++++++++++++------ qapi/block-core.json | 17 ++++++++++++----- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 00ea36f554..e2adf54dd3 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -29,12 +29,19 @@ #include "block/blockjob.h" /** - * A BdrvDirtyBitmap can be in three possible states: - * (1) successor is NULL and disabled is false: full r/w mode - * (2) successor is NULL and disabled is true: read only mode ("disabled") - * (3) successor is set: frozen mode. - * A frozen bitmap cannot be renamed, deleted, anonymized, cleared, set, - * or enabled. A frozen bitmap can only abdicate() or reclaim(). + * A BdrvDirtyBitmap can be in four possible user-visible states: + * (1) Active: successor is NULL, and disabled is false: full r/w mode + * (2) Disabled: successor is NULL, and disabled is true: qualified r/w mode, + * guest writes are dropped, but monitor writes are possible, + * through commands like merge and clear. + * (3) Frozen: successor is not null. + * A frozen bitmap cannot be renamed, deleted, cleared, set, + * enabled, merged to, etc. A frozen bitmap can only abdicate() + * or reclaim(). + * In this state, the successor bitmap is Active and will + * generally be recording writes from the guest for us. + * (4) Locked: Whether Active or Disabled, the user cannot modify this bitmap + * in any way from the monitor. */ struct BdrvDirtyBitmap { QemuMutex *mutex; diff --git a/qapi/block-core.json b/qapi/block-core.json index 91685be6c2..eba126c76e 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -418,10 +418,12 @@ # An enumeration of possible states that a dirty bitmap can report to the user. # # @frozen: The bitmap is currently in-use by a backup operation or block job, -# and is immutable. +# and is immutable. New writes by the guest are being recorded in a +# cache, and are not lost. # -# @disabled: The bitmap is currently in-use by an internal operation and is -# read-only. It can still be deleted. +# @disabled: The bitmap is not currently recording new writes by the guest. +# This is requested explicitly via @block-dirty-bitmap-disable. +# It can still be cleared, deleted, or used for backup operations. # # @active: The bitmap is actively monitoring for new writes, and can be cleared, # deleted, or used for backup operations. @@ -1944,9 +1946,14 @@ # @block-dirty-bitmap-merge: # # Merge dirty bitmaps listed in @bitmaps to the @target dirty bitmap. -# The @bitmaps dirty bitmaps are unchanged. +# Dirty bitmaps in @bitmaps will be unchanged. +# Any bits already set in @target will still be set after the merge. # On error, @target is unchanged. # +# The resulting bitmap will count as dirty any clusters that were dirty in any +# of the source bitmaps. This can be used to achieve backup checkpoints, or in +# simpler usages, to copy bitmaps. +# # Returns: nothing on success # If @node is not a valid block device, DeviceNotFound # If any bitmap in @bitmaps or @target is not found, GenericError @@ -1981,7 +1988,7 @@ ## # @x-debug-block-dirty-bitmap-sha256: # -# Get bitmap SHA256 +# Get bitmap SHA256. # # Returns: BlockDirtyBitmapSha256 on success # If @node is not a valid block device, DeviceNotFound