From nobody Wed Nov 5 16:33:05 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 1535663900361317.88269786218734; Thu, 30 Aug 2018 14:18:20 -0700 (PDT) Received: from localhost ([::1]:50913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvUKV-00075C-4T for importer@patchew.org; Thu, 30 Aug 2018 17:18:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fvUIc-0004tt-8Z for qemu-devel@nongnu.org; Thu, 30 Aug 2018 17:16:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fvUIa-0003Kj-2K for qemu-devel@nongnu.org; Thu, 30 Aug 2018 17:16:18 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:58688 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fvUIS-00036E-2P; Thu, 30 Aug 2018 17:16:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA06787A70; Thu, 30 Aug 2018 21:16:07 +0000 (UTC) Received: from probe.bos.redhat.com (dhcp-17-156.bos.redhat.com [10.18.17.156]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69CFD10EE79F; Thu, 30 Aug 2018 21:16:07 +0000 (UTC) From: John Snow To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Thu, 30 Aug 2018 17:16:04 -0400 Message-Id: <20180830211605.13683-2-jsnow@redhat.com> In-Reply-To: <20180830211605.13683-1-jsnow@redhat.com> References: <20180830211605.13683-1-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 30 Aug 2018 21:16:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Thu, 30 Aug 2018 21:16:07 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jsnow@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 1/2] 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: Kevin Wolf , John Snow , Markus Armbruster , Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 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 --- blockdev.c | 16 +++++++++++++++- qapi/block-core.json | 7 ++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index 72f5347df5..b9f19afacc 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3491,6 +3491,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; @@ -3541,6 +3542,19 @@ 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; } @@ -3548,7 +3562,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 4c7a37afdc..d3ea281039 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1315,6 +1315,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) # @@ -1346,7 +1350,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.4