From nobody Thu Nov 6 12:10:26 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 1540848448513705.9015958403113; Mon, 29 Oct 2018 14:27:28 -0700 (PDT) Received: from localhost ([::1]:49072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHF48-0005JA-Hi for importer@patchew.org; Mon, 29 Oct 2018 17:27:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45187) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHF27-00040z-7i for qemu-devel@nongnu.org; Mon, 29 Oct 2018 17:25:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHF23-0002Fc-CW for qemu-devel@nongnu.org; Mon, 29 Oct 2018 17:25:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55206) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gHF23-0002FA-2v for qemu-devel@nongnu.org; Mon, 29 Oct 2018 17:25:07 -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 572EE81DE3; Mon, 29 Oct 2018 21:25:06 +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 D45BA194AB; Mon, 29 Oct 2018 21:25:05 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org Date: Mon, 29 Oct 2018 17:24:43 -0400 Message-Id: <20181029212501.5897-2-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.25]); Mon, 29 Oct 2018 21:25:06 +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 01/19] blockdev-backup: add bitmap argument 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" It is only an oversight that we don't allow incremental backup with blockdev-backup. Add the bitmap argument which enables this. Signed-off-by: John Snow Message-id: 20180830211605.13683-2-jsnow@redhat.com Signed-off-by: John Snow --- blockdev.c | 18 +++++++++++++++++- qapi/block-core.json | 7 ++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index 574adbcb7f..1869f9aaf3 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3545,6 +3545,7 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, = JobTxn *txn, BlockDriverState *bs; BlockDriverState *target_bs; Error *local_err =3D NULL; + BdrvDirtyBitmap *bmap =3D NULL; AioContext *aio_context; BlockJob *job =3D NULL; int job_flags =3D JOB_DEFAULT; @@ -3595,6 +3596,21 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup,= JobTxn *txn, goto out; } } + + if (backup->has_bitmap) { + bmap =3D bdrv_find_dirty_bitmap(bs, backup->bitmap); + if (!bmap) { + error_setg(errp, "Bitmap '%s' could not be found", backup->bit= map); + goto out; + } + if (bdrv_dirty_bitmap_qmp_locked(bmap)) { + error_setg(errp, + "Bitmap '%s' is currently locked and cannot be used= for " + "backup", backup->bitmap); + goto out; + } + } + if (!backup->auto_finalize) { job_flags |=3D JOB_MANUAL_FINALIZE; } @@ -3602,7 +3618,7 @@ BlockJob *do_blockdev_backup(BlockdevBackup *backup, = JobTxn *txn, job_flags |=3D JOB_MANUAL_DISMISS; } job =3D backup_job_create(backup->job_id, bs, target_bs, backup->speed, - backup->sync, NULL, backup->compress, + backup->sync, bmap, backup->compress, backup->on_source_error, backup->on_target_err= or, job_flags, NULL, NULL, txn, &local_err); if (local_err !=3D NULL) { diff --git a/qapi/block-core.json b/qapi/block-core.json index cfb37f8c1d..0fc1590c1b 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1316,6 +1316,10 @@ # @speed: the maximum speed, in bytes per second. The default is 0, # for unlimited. # +# @bitmap: the name of dirty bitmap if sync is "incremental". +# Must be present if sync is "incremental", must NOT be present +# otherwise. (Since 3.1) +# # @compress: true to compress data, if the target format supports it. # (default: false) (since 2.8) # @@ -1348,7 +1352,8 @@ ## { 'struct': 'BlockdevBackup', 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str', - 'sync': 'MirrorSyncMode', '*speed': 'int', '*compress': 'bool', + 'sync': 'MirrorSyncMode', '*speed': 'int', + '*bitmap': 'str', '*compress': 'bool', '*on-source-error': 'BlockdevOnError', '*on-target-error': 'BlockdevOnError', '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } } --=20 2.14.5