From nobody Sat May 4 18:37:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1549069990568743.5998574387881; Fri, 1 Feb 2019 17:13:10 -0800 (PST) Received: from localhost ([127.0.0.1]:35685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpjrn-00077h-Ht for importer@patchew.org; Fri, 01 Feb 2019 20:13:07 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33353) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpjpm-0005sW-2h for qemu-devel@nongnu.org; Fri, 01 Feb 2019 20:11:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gpjpj-0007ic-SQ for qemu-devel@nongnu.org; Fri, 01 Feb 2019 20:11:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49240) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gpjpf-0007ce-LW; Fri, 01 Feb 2019 20:10:56 -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 39216804F7; Sat, 2 Feb 2019 01:10:52 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-187.bos.redhat.com [10.18.17.187]) by smtp.corp.redhat.com (Postfix) with ESMTP id E717F60123; Sat, 2 Feb 2019 01:10:48 +0000 (UTC) From: John Snow To: qemu-block@nongnu.org, qemu-devel@nongnu.org Date: Fri, 1 Feb 2019 20:10:48 -0500 Message-Id: <20190202011048.12343-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.27]); Sat, 02 Feb 2019 01:10:52 +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 v2] 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Vladimir Sementsov-Ogievskiy --- V2: Amended some wordings, though this is a little chatty now. Hopefully it's clearer, though. --- block/dirty-bitmap.c | 20 ++++++++++++++------ qapi/block-core.json | 32 ++++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 00ea36f554..b1b9b03939 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -29,12 +29,20 @@ #include "block/blockjob.h" =20 /** - * 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, se= t, - * 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 mo= de, + * 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 abdicat= e() + * or reclaim(). + * In this state, the anonymous successor bitmap may be eith= er + * Active and recording writes from the guest (e.g. backup j= obs), + * but it can be Disabled and not recording writes. + * (4) Locked: Whether Active or Disabled, the user cannot modify this b= itmap + * in any way from the monitor. */ struct BdrvDirtyBitmap { QemuMutex *mutex; diff --git a/qapi/block-core.json b/qapi/block-core.json index 5f17d67d71..a775af04cf 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -417,17 +417,27 @@ # # 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 j= ob, -# and is immutable. +# @frozen: The bitmap is currently in-use by some operation and is immutab= le. +# If the bitmap was @active prior to the operation, new writes by= the +# guest are being recorded in a temporary buffer, and will not be= lost. +# Generally, bitmaps are cleared on successful use in an operatio= n and +# the temporary buffer is committed into the bitmap. On failure, = the +# temporary buffer is merged back into the bitmap without first +# clearing it. +# Please refer to the documentation for each bitmap-using operati= on, +# See also @blockdev-backup, @drive-backup. # -# @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 operatio= ns. # # @active: The bitmap is actively monitoring for new writes, and can be cl= eared, # deleted, or used for backup operations. # -# @locked: The bitmap is currently in-use by some operation and can not be -# cleared, deleted, or used for backup operations. (Since 2.12) +# @locked: The bitmap is currently in-use by some operation and is immutab= le. +# If the bitmap was @active prior to the operation, it is still +# recording new writes. If the bitmap was @disabled, it is not +# recording new writes. (Since 2.12) # # Since: 2.4 ## @@ -2052,9 +2062,15 @@ # @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, except if it also appears +# as the @target bitmap. Any bits already set in @target will still be +# set after the merge, i.e., this operation does not clear the target. # 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, o= r 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 @@ -2089,7 +2105,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 --=20 2.17.2