From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568989492; cv=none; d=zoho.com; s=zohoarc; b=lOCSm1wMIZ5SwgcdBuSIZSQmrIM0RUh+pxeaBeuR6r5btzfdG4qGi0oDt3z9yggpTT7oAmkXDTDubh+CDYKLeRUgochc1NsGK7hQq4ZcDHiyluYDYK1ontHIR1QYKw8CcTa8/V4WOIuzCKokg7jfyQwgQ9dhrpr9Fq9uGlOIbxA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568989492; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=mvwvhfbXTbdaiGdVffqrLsh1Wj5O8ubiquSRgm3KDco=; b=mJIO9l7/IjT91mZdq1eJJu9pTwROk4fcxfmNm7da6n0202TFgOCsghZQcEg+xeLEoYMUUUQHsftf2m0XrF/J6qoiEQGx9wxj0J/bfKMe59fm3+wKmJOWcV51rBAtDpXkPoVOMVvwT3lxE/CkuoMdj/bW/Wv2gslGNyzwJJGKCSI= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568989492028368.3667852675336; Fri, 20 Sep 2019 07:24:52 -0700 (PDT) Received: from localhost ([::1]:60184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJq3-0007Wx-8C for importer@patchew.org; Fri, 20 Sep 2019 10:24:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32809) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJmW-0004Z6-9G for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJmU-0000t0-Jt for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:08 -0400 Received: from relay.sw.ru ([185.231.240.75]:43800) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmQ-0000g7-7d; Fri, 20 Sep 2019 10:21:02 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmM-0006b5-7T; Fri, 20 Sep 2019 17:20:58 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 01/15] block/backup: fix max_transfer handling for copy_range Date: Fri, 20 Sep 2019 17:20:42 +0300 Message-Id: <20190920142056.12778-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Of course, QEMU_ALIGN_UP is a typo, it should be QEMU_ALIGN_DOWN, as we are trying to find aligned size which satisfy both source and target. Also, don't ignore too small max_transfer. In this case seems safer to disable copy_range. Fixes: 9ded4a0114968e Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/backup.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/block/backup.c b/block/backup.c index 763f0d7ff6..db20249063 100644 --- a/block/backup.c +++ b/block/backup.c @@ -741,12 +741,19 @@ BlockJob *backup_job_create(const char *job_id, Block= DriverState *bs, job->cluster_size =3D cluster_size; job->copy_bitmap =3D copy_bitmap; copy_bitmap =3D NULL; - job->use_copy_range =3D !compress; /* compression isn't supported for = it */ job->copy_range_size =3D MIN_NON_ZERO(blk_get_max_transfer(job->common= .blk), blk_get_max_transfer(job->target)); - job->copy_range_size =3D MAX(job->cluster_size, - QEMU_ALIGN_UP(job->copy_range_size, - job->cluster_size)); + job->copy_range_size =3D QEMU_ALIGN_DOWN(job->copy_range_size, + job->cluster_size); + /* + * Set use_copy_range, consider the following: + * 1. Compression is not supported for copy_range. + * 2. copy_range does not respect max_transfer (it's a TODO), so we fa= ctor + * that in here. If max_transfer is smaller than the job->cluster_s= ize, + * we do not use copy_range (in that case it's zero after aligning = down + * above). + */ + job->use_copy_range =3D !compress && job->copy_range_size > 0; =20 /* Required permissions are already taken with target's blk_new() */ block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL, --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568989561; cv=none; d=zoho.com; s=zohoarc; b=S28JWa2RtMgPnNR3cKIPNsTmtCNFFQ1ObOWoT93crENN4RlzX7Ep4ZwICTNaFxVHNdh6hMjBMYfcZNLKwGqHIxAGTYX27UCD7nC7CouFaHwLUPFXupCZZyRsZdKN1jp9ummN3KzX0hkY7/szVjkM6rTBM/qXbpmEF/cse063MPQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568989561; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=SAlBzAmXD3RBf5IXajUeqxRU4k1DusbWqIMJIwCl6Ps=; b=L85q8BM4XmmJCT0esAvYwVUTAd4iJWfi5TQLO2ESl7ac/vhsWfbofSJ8TZFYL4BAmRjY3S4rizwOyPDRs12f1f39Z96GNPCURsokTF0bgVioWdwcAARpW2tLN3IKJ3CSKOGxwhviIbVbTvuIm2Zyv1E9PEKVVr2jVUeMOK98g3A= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568989561267709.214944760918; Fri, 20 Sep 2019 07:26:01 -0700 (PDT) Received: from localhost ([::1]:60194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJrD-0000VB-6F for importer@patchew.org; Fri, 20 Sep 2019 10:25:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32779) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJmV-0004Yb-OM for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJmU-0000st-Fd for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:07 -0400 Received: from relay.sw.ru ([185.231.240.75]:43804) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmQ-0000gE-7W; Fri, 20 Sep 2019 10:21:02 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmM-0006b5-DU; Fri, 20 Sep 2019 17:20:58 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 02/15] block/backup: fix backup_cow_with_offload for last cluster Date: Fri, 20 Sep 2019 17:20:43 +0300 Message-Id: <20190920142056.12778-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We shouldn't try to copy bytes beyond EOF. Fix it. Fixes: 9ded4a0114968e Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz Reviewed-by: John Snow --- block/backup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/backup.c b/block/backup.c index db20249063..99177f03f8 100644 --- a/block/backup.c +++ b/block/backup.c @@ -161,7 +161,7 @@ static int coroutine_fn backup_cow_with_offload(BackupB= lockJob *job, =20 assert(QEMU_IS_ALIGNED(job->copy_range_size, job->cluster_size)); assert(QEMU_IS_ALIGNED(start, job->cluster_size)); - nbytes =3D MIN(job->copy_range_size, end - start); + nbytes =3D MIN(job->copy_range_size, MIN(end, job->len) - start); nr_clusters =3D DIV_ROUND_UP(nbytes, job->cluster_size); bdrv_reset_dirty_bitmap(job->copy_bitmap, start, job->cluster_size * nr_clusters); --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568989740; cv=none; d=zoho.com; s=zohoarc; b=oPytkLgriktwFdcCgS7OAt7uvsQ6kTS+IHecSEPDaCefzjcPkon47qfsT3BTVnhw0M0aG1Uax3uSyKbXtx872zyWPEjkSwlxrdz1SR7aOC8actE3quEYuROva2Fs6iatD0MZSNO+P0qoN+wmSGrF0xZNypVlz7mJ6hFcaWkswYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568989740; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=v3vhH6TNWDSUjFHafEWNMazB+Tb8gVdxHLtD/MzvO0M=; b=VkYSgLB6dc7PK1yFoDxMyYtwxZz3xkoEqKMAjcWf9yUymWdAeYDx2dfa+hEj2AgUoh0AyvGhP2EgiPShIHTlm85mYFx274lxIcBhmMMPSNV5N4Shd6ZynvRSUYwae8dNy4HgpKQKar6Iof8AIHB7TWvozPKW1qFFzg1mulqxyaY= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568989740335500.74013611420753; Fri, 20 Sep 2019 07:29:00 -0700 (PDT) Received: from localhost ([::1]:60226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJu6-0003ZN-KG for importer@patchew.org; Fri, 20 Sep 2019 10:28:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32832) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJmW-0004Zf-PX for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJmU-0000tU-RH for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:08 -0400 Received: from relay.sw.ru ([185.231.240.75]:43796) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmQ-0000g8-DM; Fri, 20 Sep 2019 10:21:02 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmM-0006b5-KE; Fri, 20 Sep 2019 17:20:58 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 03/15] block/backup: split shareable copying part from backup_do_cow Date: Fri, 20 Sep 2019 17:20:44 +0300 Message-Id: <20190920142056.12778-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Split copying logic which will be shared with backup-top filter. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/backup.c | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/block/backup.c b/block/backup.c index 99177f03f8..98d7f7a905 100644 --- a/block/backup.c +++ b/block/backup.c @@ -248,26 +248,18 @@ static int64_t backup_bitmap_reset_unallocated(Backup= BlockJob *s, return ret; } =20 -static int coroutine_fn backup_do_cow(BackupBlockJob *job, - int64_t offset, uint64_t bytes, - bool *error_is_read, - bool is_write_notifier) +static int coroutine_fn backup_do_copy(BackupBlockJob *job, + int64_t start, uint64_t bytes, + bool *error_is_read, + bool is_write_notifier) { - CowRequest cow_request; int ret =3D 0; - int64_t start, end; /* bytes */ + int64_t end =3D bytes + start; /* bytes */ void *bounce_buffer =3D NULL; int64_t status_bytes; =20 - qemu_co_rwlock_rdlock(&job->flush_rwlock); - - start =3D QEMU_ALIGN_DOWN(offset, job->cluster_size); - end =3D QEMU_ALIGN_UP(bytes + offset, job->cluster_size); - - trace_backup_do_cow_enter(job, start, offset, bytes); - - wait_for_overlapping_requests(job, start, end); - cow_request_begin(&cow_request, job, start, end); + assert(QEMU_IS_ALIGNED(start, job->cluster_size)); + assert(QEMU_IS_ALIGNED(end, job->cluster_size)); =20 while (start < end) { int64_t dirty_end; @@ -326,6 +318,31 @@ static int coroutine_fn backup_do_cow(BackupBlockJob *= job, qemu_vfree(bounce_buffer); } =20 + return ret; +} + +static int coroutine_fn backup_do_cow(BackupBlockJob *job, + int64_t offset, uint64_t bytes, + bool *error_is_read, + bool is_write_notifier) +{ + CowRequest cow_request; + int ret =3D 0; + int64_t start, end; /* bytes */ + + qemu_co_rwlock_rdlock(&job->flush_rwlock); + + start =3D QEMU_ALIGN_DOWN(offset, job->cluster_size); + end =3D QEMU_ALIGN_UP(bytes + offset, job->cluster_size); + + trace_backup_do_cow_enter(job, start, offset, bytes); + + wait_for_overlapping_requests(job, start, end); + cow_request_begin(&cow_request, job, start, end); + + ret =3D backup_do_copy(job, start, end - start, error_is_read, + is_write_notifier); + cow_request_end(&cow_request); =20 trace_backup_do_cow_return(job, offset, bytes, ret); --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568989454; cv=none; d=zoho.com; s=zohoarc; b=RIjynKmzeVspA/81yxB8dZyKc9iWQ6vNehUyjdx3DOVDXDxoP51PP6WxqC7JWYcTPmk4xTySWEd6uI7stU/POBfkgKvLC41CQSLsStgxMieqf4enOKoRUWARkjNmEdGY8Mvb8hkQ6pITQrO4rA1zGZ6pNaXyNvKL07mV3xzq63w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568989454; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=DRtp8lnstZgkNqLagavVPY7NtAinuuNkz0jzF7B6++Y=; b=gcsHuK5bkCnQbK3xtgP8z6GSNo/59D/7dJV6numk0/MsxBEkhJJj/NVSOSTz4WwJO0GGPPdGdJwUwwvO91S2/4AM7A/ErxEZTgOqxhplkjDyoIEqgmXBiXVDS2Lq0XxFWoRD72MpOSVi/N4/+qugOgk5Kc5EnD7wnAnwecVU5T8= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568989454408996.3742667010929; Fri, 20 Sep 2019 07:24:14 -0700 (PDT) Received: from localhost ([::1]:60178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJpS-0006ms-KD for importer@patchew.org; Fri, 20 Sep 2019 10:24:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32808) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJmW-0004Z5-8a for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJmU-0000tC-MZ for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:08 -0400 Received: from relay.sw.ru ([185.231.240.75]:43818) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmQ-0000gH-EY; Fri, 20 Sep 2019 10:21:02 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmM-0006b5-PW; Fri, 20 Sep 2019 17:20:58 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 04/15] block/backup: improve comment about image fleecing Date: Fri, 20 Sep 2019 17:20:45 +0300 Message-Id: <20190920142056.12778-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/backup.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/block/backup.c b/block/backup.c index 98d7f7a905..ae28849660 100644 --- a/block/backup.c +++ b/block/backup.c @@ -747,9 +747,18 @@ BlockJob *backup_job_create(const char *job_id, BlockD= riverState *bs, job->bitmap_mode =3D bitmap_mode; =20 /* - * Set write flags: - * 1. Detect image-fleecing (and similar) schemes - * 2. Handle compression + * If source is in backing chain of target assume that target is going= to be + * used for "image fleecing", i.e. it should represent a kind of snaps= hot of + * source at backup-start point in time. And target is going to be rea= d by + * somebody (for example, used as NBD export) during backup job. + * + * In this case, we need to add BDRV_REQ_SERIALISING write flag to avo= id + * intersection of backup writes and third party reads from target, + * otherwise reading from target we may occasionally read already upda= ted by + * guest data. + * + * For more information see commit f8d59dfb40bb and test + * tests/qemu-iotests/222 */ job->write_flags =3D (bdrv_chain_contains(target, bs) ? BDRV_REQ_SERIALISING : 0) | --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568990381; cv=none; d=zoho.com; s=zohoarc; b=HwbjhB775Mz8pOLeV9DIb6iZ6DL1oDL3aCu70m2P3Mc9hhDPok2aOB0xNadl5w7xRl+IBXT7sCgaLF9OrsFP8ZHSGRLhYW4N+jZjRjEY6sQskj9ck/hrQjKpZSBT5ZgWHM1YpTDF4CGgfUPytTSDLlwCqK9X9RAyKW2clqXqBPI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568990381; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=SU+/DPWpbCt/bFgN8Lefvgp9WmUoIlttpTv/0mrzyNc=; b=gUJ/uPIR4mIlNkJi8aMDKsJ1lL88Zc1s5uUHoc3fL1jd4LhUDt4bsVx3GHfJy0yoTd4mH4NaOzCZNYyoacOCoDCjHngTw8vpKy8/cJIygTgI+MZFQ7GTBOhHL5QEkIGhWi6CpuayoWMpxY1LNmhJuvJVb3GMfVHU/7QA7Z45WTw= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568990381390507.4086921497194; Fri, 20 Sep 2019 07:39:41 -0700 (PDT) Received: from localhost ([::1]:60322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBK4R-0003qc-9k for importer@patchew.org; Fri, 20 Sep 2019 10:39:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32919) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJme-0004hZ-0J for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJma-0000xR-IR for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:15 -0400 Received: from relay.sw.ru ([185.231.240.75]:43794) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmQ-0000gD-Ah; Fri, 20 Sep 2019 10:21:02 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmM-0006b5-Tj; Fri, 20 Sep 2019 17:20:58 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 05/15] block/backup: introduce BlockCopyState Date: Fri, 20 Sep 2019 17:20:46 +0300 Message-Id: <20190920142056.12778-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Split copying code part from backup to "block-copy", including separate state structure and function renaming. This is needed to share it with backup-top filter driver in further commits. Notes: 1. As BlockCopyState keeps own BlockBackend objects, remaining job->common.blk users only use it to get bs by blk_bs() call, so clear job->commen.blk permissions set in block_job_create and add job->source_bs to be used instead of blk_bs(job->common.blk), to keep it more clear which bs we use when introduce backup-top filter in further commit. 2. Rename s/initializing_bitmap/skip_unallocated/ to sound a bit better as interface to BlockCopyState 3. Split is not very clean: there left some duplicated fields, backup code uses some BlockCopyState fields directly, let's postpone it for further improvements and keep this comment simpler for review. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/backup.c | 370 ++++++++++++++++++++++++++++----------------- block/trace-events | 12 +- 2 files changed, 239 insertions(+), 143 deletions(-) diff --git a/block/backup.c b/block/backup.c index ae28849660..5dda1673ca 100644 --- a/block/backup.c +++ b/block/backup.c @@ -35,12 +35,52 @@ typedef struct CowRequest { CoQueue wait_queue; /* coroutines blocked on this request */ } CowRequest; =20 +typedef void (*ProgressBytesCallbackFunc)(int64_t bytes, void *opaque); +typedef void (*ProgressResetCallbackFunc)(void *opaque); +typedef struct BlockCopyState { + BlockBackend *source; + BlockBackend *target; + BdrvDirtyBitmap *copy_bitmap; + int64_t cluster_size; + bool use_copy_range; + int64_t copy_range_size; + uint64_t len; + + BdrvRequestFlags write_flags; + + /* + * skip_unallocated: + * + * Used by sync=3Dtop jobs, which first scan the source node for unall= ocated + * areas and clear them in the copy_bitmap. During this process, the = bitmap + * is thus not fully initialized: It may still have bits set for areas= that + * are unallocated and should actually not be copied. + * + * This is indicated by skip_unallocated. + * + * In this case, block_copy() will query the source=E2=80=99s allocati= on status, + * skip unallocated regions, clear them in the copy_bitmap, and invoke + * block_copy_reset_unallocated() every time it does. + */ + bool skip_unallocated; + + /* progress_bytes_callback: called when some copying progress is done.= */ + ProgressBytesCallbackFunc progress_bytes_callback; + + /* + * progress_reset_callback: called when some bytes reset from copy_bit= map + * (see @skip_unallocated above). The callee is assumed to recalculate= how + * many bytes remain based on the dirty bit count of copy_bitmap. + */ + ProgressResetCallbackFunc progress_reset_callback; + void *progress_opaque; +} BlockCopyState; + typedef struct BackupBlockJob { BlockJob common; - BlockBackend *target; + BlockDriverState *source_bs; =20 BdrvDirtyBitmap *sync_bitmap; - BdrvDirtyBitmap *copy_bitmap; =20 MirrorSyncMode sync_mode; BitmapSyncMode bitmap_mode; @@ -53,11 +93,7 @@ typedef struct BackupBlockJob { NotifierWithReturn before_write; QLIST_HEAD(, CowRequest) inflight_reqs; =20 - bool use_copy_range; - int64_t copy_range_size; - - BdrvRequestFlags write_flags; - bool initializing_bitmap; + BlockCopyState *bcs; } BackupBlockJob; =20 static const BlockJobDriver backup_job_driver; @@ -99,9 +135,97 @@ static void cow_request_end(CowRequest *req) qemu_co_queue_restart_all(&req->wait_queue); } =20 +static void block_copy_state_free(BlockCopyState *s) +{ + if (!s) { + return; + } + + bdrv_release_dirty_bitmap(blk_bs(s->source), s->copy_bitmap); + blk_unref(s->source); + blk_unref(s->target); + g_free(s); +} + +static BlockCopyState *block_copy_state_new( + BlockDriverState *source, BlockDriverState *target, + int64_t cluster_size, BdrvRequestFlags write_flags, + ProgressBytesCallbackFunc progress_bytes_callback, + ProgressResetCallbackFunc progress_reset_callback, + void *progress_opaque, Error **errp) +{ + BlockCopyState *s; + int ret; + uint64_t no_resize =3D BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE | + BLK_PERM_WRITE_UNCHANGED | BLK_PERM_GRAPH_MOD; + BdrvDirtyBitmap *copy_bitmap; + + copy_bitmap =3D bdrv_create_dirty_bitmap(source, cluster_size, NULL, e= rrp); + if (!copy_bitmap) { + return NULL; + } + bdrv_disable_dirty_bitmap(copy_bitmap); + + s =3D g_new(BlockCopyState, 1); + *s =3D (BlockCopyState) { + .source =3D blk_new(bdrv_get_aio_context(source), + BLK_PERM_CONSISTENT_READ, no_resize), + .target =3D blk_new(bdrv_get_aio_context(target), + BLK_PERM_WRITE, no_resize), + .copy_bitmap =3D copy_bitmap, + .cluster_size =3D cluster_size, + .len =3D bdrv_dirty_bitmap_size(copy_bitmap), + .write_flags =3D write_flags, + .progress_bytes_callback =3D progress_bytes_callback, + .progress_reset_callback =3D progress_reset_callback, + .progress_opaque =3D progress_opaque, + }; + + s->copy_range_size =3D QEMU_ALIGN_DOWN(MIN(blk_get_max_transfer(s->sou= rce), + blk_get_max_transfer(s->targe= t)), + s->cluster_size); + /* + * Set use_copy_range, consider the following: + * 1. Compression is not supported for copy_range. + * 2. copy_range does not respect max_transfer (it's a TODO), so we fa= ctor + * that in here. If max_transfer is smaller than the job->cluster_s= ize, + * we do not use copy_range (in that case it's zero after aligning = down + * above). + */ + s->use_copy_range =3D + !(write_flags & BDRV_REQ_WRITE_COMPRESSED) && s->copy_range_size >= 0; + + /* + * We just allow aio context change on our block backends. block_copy(= ) user + * (now it's only backup) is responsible for source and target being i= n same + * aio context. + */ + blk_set_disable_request_queuing(s->source, true); + blk_set_allow_aio_context_change(s->source, true); + blk_set_disable_request_queuing(s->target, true); + blk_set_allow_aio_context_change(s->target, true); + + ret =3D blk_insert_bs(s->source, source, errp); + if (ret < 0) { + goto fail; + } + + ret =3D blk_insert_bs(s->target, target, errp); + if (ret < 0) { + goto fail; + } + + return s; + +fail: + block_copy_state_free(s); + + return NULL; +} + /* Copy range to target with a bounce buffer and return the bytes copied. = If * error occurred, return a negative error number */ -static int coroutine_fn backup_cow_with_bounce_buffer(BackupBlockJob *job, +static int coroutine_fn block_copy_with_bounce_buffer(BlockCopyState *s, int64_t start, int64_t end, bool is_write_notifi= er, @@ -109,30 +233,29 @@ static int coroutine_fn backup_cow_with_bounce_buffer= (BackupBlockJob *job, void **bounce_buffer) { int ret; - BlockBackend *blk =3D job->common.blk; int nbytes; int read_flags =3D is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; =20 - assert(QEMU_IS_ALIGNED(start, job->cluster_size)); - bdrv_reset_dirty_bitmap(job->copy_bitmap, start, job->cluster_size); - nbytes =3D MIN(job->cluster_size, job->len - start); + assert(QEMU_IS_ALIGNED(start, s->cluster_size)); + bdrv_reset_dirty_bitmap(s->copy_bitmap, start, s->cluster_size); + nbytes =3D MIN(s->cluster_size, s->len - start); if (!*bounce_buffer) { - *bounce_buffer =3D blk_blockalign(blk, job->cluster_size); + *bounce_buffer =3D blk_blockalign(s->source, s->cluster_size); } =20 - ret =3D blk_co_pread(blk, start, nbytes, *bounce_buffer, read_flags); + ret =3D blk_co_pread(s->source, start, nbytes, *bounce_buffer, read_fl= ags); if (ret < 0) { - trace_backup_do_cow_read_fail(job, start, ret); + trace_block_copy_with_bounce_buffer_read_fail(s, start, ret); if (error_is_read) { *error_is_read =3D true; } goto fail; } =20 - ret =3D blk_co_pwrite(job->target, start, nbytes, *bounce_buffer, - job->write_flags); + ret =3D blk_co_pwrite(s->target, start, nbytes, *bounce_buffer, + s->write_flags); if (ret < 0) { - trace_backup_do_cow_write_fail(job, start, ret); + trace_block_copy_with_bounce_buffer_write_fail(s, start, ret); if (error_is_read) { *error_is_read =3D false; } @@ -141,36 +264,35 @@ static int coroutine_fn backup_cow_with_bounce_buffer= (BackupBlockJob *job, =20 return nbytes; fail: - bdrv_set_dirty_bitmap(job->copy_bitmap, start, job->cluster_size); + bdrv_set_dirty_bitmap(s->copy_bitmap, start, s->cluster_size); return ret; =20 } =20 /* Copy range to target and return the bytes copied. If error occurred, re= turn a * negative error number. */ -static int coroutine_fn backup_cow_with_offload(BackupBlockJob *job, +static int coroutine_fn block_copy_with_offload(BlockCopyState *s, int64_t start, int64_t end, bool is_write_notifier) { int ret; int nr_clusters; - BlockBackend *blk =3D job->common.blk; int nbytes; int read_flags =3D is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; =20 - assert(QEMU_IS_ALIGNED(job->copy_range_size, job->cluster_size)); - assert(QEMU_IS_ALIGNED(start, job->cluster_size)); - nbytes =3D MIN(job->copy_range_size, MIN(end, job->len) - start); - nr_clusters =3D DIV_ROUND_UP(nbytes, job->cluster_size); - bdrv_reset_dirty_bitmap(job->copy_bitmap, start, - job->cluster_size * nr_clusters); - ret =3D blk_co_copy_range(blk, start, job->target, start, nbytes, - read_flags, job->write_flags); + assert(QEMU_IS_ALIGNED(s->copy_range_size, s->cluster_size)); + assert(QEMU_IS_ALIGNED(start, s->cluster_size)); + nbytes =3D MIN(s->copy_range_size, MIN(end, s->len) - start); + nr_clusters =3D DIV_ROUND_UP(nbytes, s->cluster_size); + bdrv_reset_dirty_bitmap(s->copy_bitmap, start, + s->cluster_size * nr_clusters); + ret =3D blk_co_copy_range(s->source, start, s->target, start, nbytes, + read_flags, s->write_flags); if (ret < 0) { - trace_backup_do_cow_copy_range_fail(job, start, ret); - bdrv_set_dirty_bitmap(job->copy_bitmap, start, - job->cluster_size * nr_clusters); + trace_block_copy_with_offload_fail(s, start, ret); + bdrv_set_dirty_bitmap(s->copy_bitmap, start, + s->cluster_size * nr_clusters); return ret; } =20 @@ -181,10 +303,10 @@ static int coroutine_fn backup_cow_with_offload(Backu= pBlockJob *job, * Check if the cluster starting at offset is allocated or not. * return via pnum the number of contiguous clusters sharing this allocati= on. */ -static int backup_is_cluster_allocated(BackupBlockJob *s, int64_t offset, - int64_t *pnum) +static int block_copy_is_cluster_allocated(BlockCopyState *s, int64_t offs= et, + int64_t *pnum) { - BlockDriverState *bs =3D blk_bs(s->common.blk); + BlockDriverState *bs =3D blk_bs(s->source); int64_t count, total_count =3D 0; int64_t bytes =3D s->len - offset; int ret; @@ -225,13 +347,13 @@ static int backup_is_cluster_allocated(BackupBlockJob= *s, int64_t offset, * @return 0 when the cluster at @offset was unallocated, * 1 otherwise, and -ret on error. */ -static int64_t backup_bitmap_reset_unallocated(BackupBlockJob *s, - int64_t offset, int64_t *co= unt) +static int64_t block_copy_reset_unallocated(BlockCopyState *s, + int64_t offset, int64_t *count) { int ret; - int64_t clusters, bytes, estimate; + int64_t clusters, bytes; =20 - ret =3D backup_is_cluster_allocated(s, offset, &clusters); + ret =3D block_copy_is_cluster_allocated(s, offset, &clusters); if (ret < 0) { return ret; } @@ -240,46 +362,51 @@ static int64_t backup_bitmap_reset_unallocated(Backup= BlockJob *s, =20 if (!ret) { bdrv_reset_dirty_bitmap(s->copy_bitmap, offset, bytes); - estimate =3D bdrv_get_dirty_count(s->copy_bitmap); - job_progress_set_remaining(&s->common.job, estimate); + s->progress_reset_callback(s->progress_opaque); } =20 *count =3D bytes; return ret; } =20 -static int coroutine_fn backup_do_copy(BackupBlockJob *job, - int64_t start, uint64_t bytes, - bool *error_is_read, - bool is_write_notifier) +static int coroutine_fn block_copy(BlockCopyState *s, + int64_t start, uint64_t bytes, + bool *error_is_read, + bool is_write_notifier) { int ret =3D 0; int64_t end =3D bytes + start; /* bytes */ void *bounce_buffer =3D NULL; int64_t status_bytes; =20 - assert(QEMU_IS_ALIGNED(start, job->cluster_size)); - assert(QEMU_IS_ALIGNED(end, job->cluster_size)); + /* + * block_copy() user is responsible for keeping source and target in s= ame + * aio context + */ + assert(blk_get_aio_context(s->source) =3D=3D blk_get_aio_context(s->ta= rget)); + + assert(QEMU_IS_ALIGNED(start, s->cluster_size)); + assert(QEMU_IS_ALIGNED(end, s->cluster_size)); =20 while (start < end) { int64_t dirty_end; =20 - if (!bdrv_dirty_bitmap_get(job->copy_bitmap, start)) { - trace_backup_do_cow_skip(job, start); - start +=3D job->cluster_size; + if (!bdrv_dirty_bitmap_get(s->copy_bitmap, start)) { + trace_block_copy_skip(s, start); + start +=3D s->cluster_size; continue; /* already copied */ } =20 - dirty_end =3D bdrv_dirty_bitmap_next_zero(job->copy_bitmap, start, + dirty_end =3D bdrv_dirty_bitmap_next_zero(s->copy_bitmap, start, (end - start)); if (dirty_end < 0) { dirty_end =3D end; } =20 - if (job->initializing_bitmap) { - ret =3D backup_bitmap_reset_unallocated(job, start, &status_by= tes); + if (s->skip_unallocated) { + ret =3D block_copy_reset_unallocated(s, start, &status_bytes); if (ret =3D=3D 0) { - trace_backup_do_cow_skip_range(job, start, status_bytes); + trace_block_copy_skip_range(s, start, status_bytes); start +=3D status_bytes; continue; } @@ -287,17 +414,17 @@ static int coroutine_fn backup_do_copy(BackupBlockJob= *job, dirty_end =3D MIN(dirty_end, start + status_bytes); } =20 - trace_backup_do_cow_process(job, start); + trace_block_copy_process(s, start); =20 - if (job->use_copy_range) { - ret =3D backup_cow_with_offload(job, start, dirty_end, + if (s->use_copy_range) { + ret =3D block_copy_with_offload(s, start, dirty_end, is_write_notifier); if (ret < 0) { - job->use_copy_range =3D false; + s->use_copy_range =3D false; } } - if (!job->use_copy_range) { - ret =3D backup_cow_with_bounce_buffer(job, start, dirty_end, + if (!s->use_copy_range) { + ret =3D block_copy_with_bounce_buffer(s, start, dirty_end, is_write_notifier, error_is_read, &bounce_buf= fer); } @@ -305,12 +432,8 @@ static int coroutine_fn backup_do_copy(BackupBlockJob = *job, break; } =20 - /* Publish progress, guest I/O counts as progress too. Note that = the - * offset field is an opaque progress value, it is not a disk offs= et. - */ start +=3D ret; - job->bytes_read +=3D ret; - job_progress_update(&job->common.job, ret); + s->progress_bytes_callback(ret, s->progress_opaque); ret =3D 0; } =20 @@ -321,6 +444,22 @@ static int coroutine_fn backup_do_copy(BackupBlockJob = *job, return ret; } =20 +static void backup_progress_bytes_callback(int64_t bytes, void *opaque) +{ + BackupBlockJob *s =3D opaque; + + s->bytes_read +=3D bytes; + job_progress_update(&s->common.job, bytes); +} + +static void backup_progress_reset_callback(void *opaque) +{ + BackupBlockJob *s =3D opaque; + uint64_t estimate =3D bdrv_get_dirty_count(s->bcs->copy_bitmap); + + job_progress_set_remaining(&s->common.job, estimate); +} + static int coroutine_fn backup_do_cow(BackupBlockJob *job, int64_t offset, uint64_t bytes, bool *error_is_read, @@ -340,8 +479,8 @@ static int coroutine_fn backup_do_cow(BackupBlockJob *j= ob, wait_for_overlapping_requests(job, start, end); cow_request_begin(&cow_request, job, start, end); =20 - ret =3D backup_do_copy(job, start, end - start, error_is_read, - is_write_notifier); + ret =3D block_copy(job->bcs, start, end - start, error_is_read, + is_write_notifier); =20 cow_request_end(&cow_request); =20 @@ -359,7 +498,7 @@ static int coroutine_fn backup_before_write_notify( BackupBlockJob *job =3D container_of(notifier, BackupBlockJob, before_= write); BdrvTrackedRequest *req =3D opaque; =20 - assert(req->bs =3D=3D blk_bs(job->common.blk)); + assert(req->bs =3D=3D job->source_bs); assert(QEMU_IS_ALIGNED(req->offset, BDRV_SECTOR_SIZE)); assert(QEMU_IS_ALIGNED(req->bytes, BDRV_SECTOR_SIZE)); =20 @@ -369,7 +508,6 @@ static int coroutine_fn backup_before_write_notify( static void backup_cleanup_sync_bitmap(BackupBlockJob *job, int ret) { BdrvDirtyBitmap *bm; - BlockDriverState *bs =3D blk_bs(job->common.blk); bool sync =3D (((ret =3D=3D 0) || (job->bitmap_mode =3D=3D BITMAP_SYNC= _MODE_ALWAYS)) \ && (job->bitmap_mode !=3D BITMAP_SYNC_MODE_NEVER)); =20 @@ -378,20 +516,20 @@ static void backup_cleanup_sync_bitmap(BackupBlockJob= *job, int ret) * We succeeded, or we always intended to sync the bitmap. * Delete this bitmap and install the child. */ - bm =3D bdrv_dirty_bitmap_abdicate(bs, job->sync_bitmap, NULL); + bm =3D bdrv_dirty_bitmap_abdicate(job->source_bs, job->sync_bitmap= , NULL); } else { /* * We failed, or we never intended to sync the bitmap anyway. * Merge the successor back into the parent, keeping all data. */ - bm =3D bdrv_reclaim_dirty_bitmap(bs, job->sync_bitmap, NULL); + bm =3D bdrv_reclaim_dirty_bitmap(job->source_bs, job->sync_bitmap,= NULL); } =20 assert(bm); =20 if (ret < 0 && job->bitmap_mode =3D=3D BITMAP_SYNC_MODE_ALWAYS) { /* If we failed and synced, merge in the bits we didn't copy: */ - bdrv_dirty_bitmap_merge_internal(bm, job->copy_bitmap, + bdrv_dirty_bitmap_merge_internal(bm, job->bcs->copy_bitmap, NULL, true); } } @@ -415,16 +553,8 @@ static void backup_abort(Job *job) static void backup_clean(Job *job) { BackupBlockJob *s =3D container_of(job, BackupBlockJob, common.job); - BlockDriverState *bs =3D blk_bs(s->common.blk); =20 - if (s->copy_bitmap) { - bdrv_release_dirty_bitmap(bs, s->copy_bitmap); - s->copy_bitmap =3D NULL; - } - - assert(s->target); - blk_unref(s->target); - s->target =3D NULL; + block_copy_state_free(s->bcs); } =20 void backup_do_checkpoint(BlockJob *job, Error **errp) @@ -439,7 +569,7 @@ void backup_do_checkpoint(BlockJob *job, Error **errp) return; } =20 - bdrv_set_dirty_bitmap(backup_job->copy_bitmap, 0, backup_job->len); + bdrv_set_dirty_bitmap(backup_job->bcs->copy_bitmap, 0, backup_job->len= ); } =20 static BlockErrorAction backup_error_action(BackupBlockJob *job, @@ -482,7 +612,7 @@ static int coroutine_fn backup_loop(BackupBlockJob *job) BdrvDirtyBitmapIter *bdbi; int ret =3D 0; =20 - bdbi =3D bdrv_dirty_iter_new(job->copy_bitmap); + bdbi =3D bdrv_dirty_iter_new(job->bcs->copy_bitmap); while ((offset =3D bdrv_dirty_iter_next(bdbi)) !=3D -1) { do { if (yield_and_check(job)) { @@ -509,7 +639,7 @@ static void backup_init_copy_bitmap(BackupBlockJob *job) uint64_t estimate; =20 if (job->sync_mode =3D=3D MIRROR_SYNC_MODE_BITMAP) { - ret =3D bdrv_dirty_bitmap_merge_internal(job->copy_bitmap, + ret =3D bdrv_dirty_bitmap_merge_internal(job->bcs->copy_bitmap, job->sync_bitmap, NULL, true); assert(ret); @@ -519,19 +649,18 @@ static void backup_init_copy_bitmap(BackupBlockJob *j= ob) * We can't hog the coroutine to initialize this thoroughly. * Set a flag and resume work when we are able to yield safely. */ - job->initializing_bitmap =3D true; + job->bcs->skip_unallocated =3D true; } - bdrv_set_dirty_bitmap(job->copy_bitmap, 0, job->len); + bdrv_set_dirty_bitmap(job->bcs->copy_bitmap, 0, job->len); } =20 - estimate =3D bdrv_get_dirty_count(job->copy_bitmap); + estimate =3D bdrv_get_dirty_count(job->bcs->copy_bitmap); job_progress_set_remaining(&job->common.job, estimate); } =20 static int coroutine_fn backup_run(Job *job, Error **errp) { BackupBlockJob *s =3D container_of(job, BackupBlockJob, common.job); - BlockDriverState *bs =3D blk_bs(s->common.blk); int ret =3D 0; =20 QLIST_INIT(&s->inflight_reqs); @@ -540,7 +669,7 @@ static int coroutine_fn backup_run(Job *job, Error **er= rp) backup_init_copy_bitmap(s); =20 s->before_write.notify =3D backup_before_write_notify; - bdrv_add_before_write_notifier(bs, &s->before_write); + bdrv_add_before_write_notifier(s->source_bs, &s->before_write); =20 if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_TOP) { int64_t offset =3D 0; @@ -552,14 +681,14 @@ static int coroutine_fn backup_run(Job *job, Error **= errp) goto out; } =20 - ret =3D backup_bitmap_reset_unallocated(s, offset, &count); + ret =3D block_copy_reset_unallocated(s->bcs, offset, &count); if (ret < 0) { goto out; } =20 offset +=3D count; } - s->initializing_bitmap =3D false; + s->bcs->skip_unallocated =3D false; } =20 if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_NONE) { @@ -646,9 +775,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDr= iverState *bs, { int64_t len; BackupBlockJob *job =3D NULL; - int ret; int64_t cluster_size; - BdrvDirtyBitmap *copy_bitmap =3D NULL; + BdrvRequestFlags write_flags; =20 assert(bs); assert(target); @@ -713,33 +841,14 @@ BlockJob *backup_job_create(const char *job_id, Block= DriverState *bs, goto error; } =20 - copy_bitmap =3D bdrv_create_dirty_bitmap(bs, cluster_size, NULL, errp); - if (!copy_bitmap) { - goto error; - } - bdrv_disable_dirty_bitmap(copy_bitmap); - /* job->len is fixed, so we can't allow resize */ - job =3D block_job_create(job_id, &backup_job_driver, txn, bs, - BLK_PERM_CONSISTENT_READ, - BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE | - BLK_PERM_WRITE_UNCHANGED | BLK_PERM_GRAPH_MOD, + job =3D block_job_create(job_id, &backup_job_driver, txn, bs, 0, BLK_P= ERM_ALL, speed, creation_flags, cb, opaque, errp); if (!job) { goto error; } =20 - /* The target must match the source in size, so no resize here either = */ - job->target =3D blk_new(job->common.job.aio_context, - BLK_PERM_WRITE, - BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE | - BLK_PERM_WRITE_UNCHANGED | BLK_PERM_GRAPH_MOD); - ret =3D blk_insert_bs(job->target, target, errp); - if (ret < 0) { - goto error; - } - blk_set_disable_request_queuing(job->target, true); - + job->source_bs =3D bs; job->on_source_error =3D on_source_error; job->on_target_error =3D on_target_error; job->sync_mode =3D sync_mode; @@ -760,28 +869,19 @@ BlockJob *backup_job_create(const char *job_id, Block= DriverState *bs, * For more information see commit f8d59dfb40bb and test * tests/qemu-iotests/222 */ - job->write_flags =3D - (bdrv_chain_contains(target, bs) ? BDRV_REQ_SERIALISING : 0) | - (compress ? BDRV_REQ_WRITE_COMPRESSED : 0); + write_flags =3D (bdrv_chain_contains(target, bs) ? BDRV_REQ_SERIALISIN= G : 0) | + (compress ? BDRV_REQ_WRITE_COMPRESSED : 0), + + job->bcs =3D block_copy_state_new(bs, target, cluster_size, write_flag= s, + backup_progress_bytes_callback, + backup_progress_reset_callback, job, e= rrp); + if (!job->bcs) { + goto error; + } =20 job->cluster_size =3D cluster_size; - job->copy_bitmap =3D copy_bitmap; - copy_bitmap =3D NULL; - job->copy_range_size =3D MIN_NON_ZERO(blk_get_max_transfer(job->common= .blk), - blk_get_max_transfer(job->target)); - job->copy_range_size =3D QEMU_ALIGN_DOWN(job->copy_range_size, - job->cluster_size); - /* - * Set use_copy_range, consider the following: - * 1. Compression is not supported for copy_range. - * 2. copy_range does not respect max_transfer (it's a TODO), so we fa= ctor - * that in here. If max_transfer is smaller than the job->cluster_s= ize, - * we do not use copy_range (in that case it's zero after aligning = down - * above). - */ - job->use_copy_range =3D !compress && job->copy_range_size > 0; =20 - /* Required permissions are already taken with target's blk_new() */ + /* Required permissions are already taken by block-copy-state target */ block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL, &error_abort); job->len =3D len; @@ -789,10 +889,6 @@ BlockJob *backup_job_create(const char *job_id, BlockD= riverState *bs, return &job->common; =20 error: - if (copy_bitmap) { - assert(!job || !job->copy_bitmap); - bdrv_release_dirty_bitmap(bs, copy_bitmap); - } if (sync_bitmap) { bdrv_reclaim_dirty_bitmap(bs, sync_bitmap, NULL); } diff --git a/block/trace-events b/block/trace-events index 04209f058d..6e7532f48b 100644 --- a/block/trace-events +++ b/block/trace-events @@ -40,12 +40,12 @@ mirror_yield_in_flight(void *s, int64_t offset, int in_= flight) "s %p offset %" P # backup.c backup_do_cow_enter(void *job, int64_t start, int64_t offset, uint64_t byt= es) "job %p start %" PRId64 " offset %" PRId64 " bytes %" PRIu64 backup_do_cow_return(void *job, int64_t offset, uint64_t bytes, int ret) "= job %p offset %" PRId64 " bytes %" PRIu64 " ret %d" -backup_do_cow_skip(void *job, int64_t start) "job %p start %"PRId64 -backup_do_cow_skip_range(void *job, int64_t start, uint64_t bytes) "job %p= start %"PRId64" bytes %"PRId64 -backup_do_cow_process(void *job, int64_t start) "job %p start %"PRId64 -backup_do_cow_read_fail(void *job, int64_t start, int ret) "job %p start %= "PRId64" ret %d" -backup_do_cow_write_fail(void *job, int64_t start, int ret) "job %p start = %"PRId64" ret %d" -backup_do_cow_copy_range_fail(void *job, int64_t start, int ret) "job %p s= tart %"PRId64" ret %d" +block_copy_skip(void *bcs, int64_t start) "bcs %p start %"PRId64 +block_copy_skip_range(void *bcs, int64_t start, uint64_t bytes) "bcs %p st= art %"PRId64" bytes %"PRId64 +block_copy_process(void *bcs, int64_t start) "bcs %p start %"PRId64 +block_copy_with_bounce_buffer_read_fail(void *bcs, int64_t start, int ret)= "bcs %p start %"PRId64" ret %d" +block_copy_with_bounce_buffer_write_fail(void *bcs, int64_t start, int ret= ) "bcs %p start %"PRId64" ret %d" +block_copy_with_offload_fail(void *bcs, int64_t start, int ret) "bcs %p st= art %"PRId64" ret %d" =20 # ../blockdev.c qmp_block_job_cancel(void *job) "job %p" --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568990137; cv=none; d=zoho.com; s=zohoarc; b=aqf9+nJl0m0t1mawQNB6pWtZYb5+p7p5iCj51+xZRHgIfvR0bR+ax4l3MVWgSMtoDxGRA0X3L/+Fd9FbTGT0BWGJrwJ1N5T0uD5mIzREGgBq/9C7sVrsmNVQsoano6yUfiPh/q/nuyRC2BZ07uYrAhHhilp0phJFpbYFA9MSCic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568990137; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=DSV8ytD5S1Dtq0VpjEHmw0nidtW9+zYsGqZVwT72/kk=; b=cEsxG64FVRXbm2BPOu3gox5rr2Vr9TOcAYsZyLySSWpvEF0RapQ0Tgaa6f1sDVOD4B8TTKkw+TVwMB3kAiw3Wf9r2c80qYVq0JyfLM44rMbSIb4g4CGQPhG6kk/oalhUKqO+oxRvYACf61XTfR38yH+z1feIWWyfRR88T8rJpSc= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568990137499879.756687666269; Fri, 20 Sep 2019 07:35:37 -0700 (PDT) Received: from localhost ([::1]:60274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBK0V-0008MW-DP for importer@patchew.org; Fri, 20 Sep 2019 10:35:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32830) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJmW-0004Za-Mv for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJmV-0000tj-0B for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:08 -0400 Received: from relay.sw.ru ([185.231.240.75]:43802) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmQ-0000g9-8P; Fri, 20 Sep 2019 10:21:02 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmN-0006b5-16; Fri, 20 Sep 2019 17:20:59 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 06/15] block/backup: fix block-comment style Date: Fri, 20 Sep 2019 17:20:47 +0300 Message-Id: <20190920142056.12778-7-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We need to fix comment style around block-copy functions before further moving them to separate file to satisfy checkpatch. But do more: fix all comments style. Also, seems like doubled first asterisk is not forbidden, but drop it too for consistency. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/backup.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/block/backup.c b/block/backup.c index 5dda1673ca..f5125984db 100644 --- a/block/backup.c +++ b/block/backup.c @@ -223,8 +223,10 @@ fail: return NULL; } =20 -/* Copy range to target with a bounce buffer and return the bytes copied. = If - * error occurred, return a negative error number */ +/* + * Copy range to target with a bounce buffer and return the bytes copied. = If + * error occurred, return a negative error number + */ static int coroutine_fn block_copy_with_bounce_buffer(BlockCopyState *s, int64_t start, int64_t end, @@ -269,8 +271,10 @@ fail: =20 } =20 -/* Copy range to target and return the bytes copied. If error occurred, re= turn a - * negative error number. */ +/* + * Copy range to target and return the bytes copied. If error occurred, re= turn a + * negative error number. + */ static int coroutine_fn block_copy_with_offload(BlockCopyState *s, int64_t start, int64_t end, @@ -341,7 +345,7 @@ static int block_copy_is_cluster_allocated(BlockCopySta= te *s, int64_t offset, } } =20 -/** +/* * Reset bits in copy_bitmap starting at offset if they represent unalloca= ted * data in the image. May reset subsequent contiguous bits. * @return 0 when the cluster at @offset was unallocated, @@ -592,8 +596,10 @@ static bool coroutine_fn yield_and_check(BackupBlockJo= b *job) return true; } =20 - /* We need to yield even for delay_ns =3D 0 so that bdrv_drain_all() c= an - * return. Without a yield, the VM would not reboot. */ + /* + * We need to yield even for delay_ns =3D 0 so that bdrv_drain_all() c= an + * return. Without a yield, the VM would not reboot. + */ delay_ns =3D block_job_ratelimit_get_delay(&job->common, job->bytes_re= ad); job->bytes_read =3D 0; job_sleep_ns(&job->common.job, delay_ns); @@ -692,11 +698,15 @@ static int coroutine_fn backup_run(Job *job, Error **= errp) } =20 if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_NONE) { - /* All bits are set in copy_bitmap to allow any cluster to be copi= ed. - * This does not actually require them to be copied. */ + /* + * All bits are set in copy_bitmap to allow any cluster to be copi= ed. + * This does not actually require them to be copied. + */ while (!job_is_cancelled(job)) { - /* Yield until the job is cancelled. We just let our before_w= rite - * notify callback service CoW requests. */ + /* + * Yield until the job is cancelled. We just let our before_w= rite + * notify callback service CoW requests. + */ job_yield(job); } } else { --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568990187; cv=none; d=zoho.com; s=zohoarc; b=lbT5YquR4/KvvPXcm/f8cYcp3bnquIuE6mQ9NXxdFYI5JRbH6jbpbKptyRpskWBObgK7Sy61or+/OcsiIyWcTNk7cXU2GpqyTJCiRRwj5UfWDO8qr9yu7zmgt7QmzBznebyCaHWIbicMt1zhSToB0pxZANPmkuFz30O0bZ3e56o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568990187; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=SBgXZeKnkukRaBGmi+AGv6NVZpDSYOu8m8eu1/5FmQA=; b=bmeCrSuyxG2l/7NWA2y7C8TZvsHfuPo9HA9jPSLgcfRVNF3y/oh8UwLOFhvLdazPWNbdZsoBUBVx66KAcOw8BK4NnOfWc1TckhsKdvVl2jTzQskRvcxPBs8GibXUK6y2FOE4mwHCo4s9H7Y4OG1jbGJiqSmSkPLMlajzGv2NTmI= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568990187045730.4553227522119; Fri, 20 Sep 2019 07:36:27 -0700 (PDT) Received: from localhost ([::1]:60282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBK1E-0000d1-5D for importer@patchew.org; Fri, 20 Sep 2019 10:36:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32920) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJme-0004hk-Aj for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJma-0000xc-PP for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:15 -0400 Received: from relay.sw.ru ([185.231.240.75]:43798) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmQ-0000gA-9t; Fri, 20 Sep 2019 10:21:02 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmN-0006b5-5W; Fri, 20 Sep 2019 17:20:59 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 07/15] block: move block_copy from block/backup.c to separate file Date: Fri, 20 Sep 2019 17:20:48 +0300 Message-Id: <20190920142056.12778-8-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Split block_copy to separate file, to be cleanly shared with backup-top filter driver in further commits. It's a clean movement, the only change is drop "static" from interface functions. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- include/block/block-copy.h | 76 ++++++++ block/backup.c | 355 +------------------------------------ block/block-copy.c | 333 ++++++++++++++++++++++++++++++++++ block/Makefile.objs | 1 + block/trace-events | 2 + 5 files changed, 413 insertions(+), 354 deletions(-) create mode 100644 include/block/block-copy.h create mode 100644 block/block-copy.c diff --git a/include/block/block-copy.h b/include/block/block-copy.h new file mode 100644 index 0000000000..54f90d0c9a --- /dev/null +++ b/include/block/block-copy.h @@ -0,0 +1,76 @@ +/* + * block_copy API + * + * Copyright (C) 2013 Proxmox Server Solutions + * Copyright (c) 2019 Virtuozzo International GmbH. + * + * Authors: + * Dietmar Maurer (dietmar@proxmox.com) + * Vladimir Sementsov-Ogievskiy + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#ifndef BLOCK_COPY_H +#define BLOCK_COPY_H + +#include "block/block.h" + +typedef void (*ProgressBytesCallbackFunc)(int64_t bytes, void *opaque); +typedef void (*ProgressResetCallbackFunc)(void *opaque); +typedef struct BlockCopyState { + BlockBackend *source; + BlockBackend *target; + BdrvDirtyBitmap *copy_bitmap; + int64_t cluster_size; + bool use_copy_range; + int64_t copy_range_size; + uint64_t len; + + BdrvRequestFlags write_flags; + + /* + * skip_unallocated: + * + * Used by sync=3Dtop jobs, which first scan the source node for unall= ocated + * areas and clear them in the copy_bitmap. During this process, the = bitmap + * is thus not fully initialized: It may still have bits set for areas= that + * are unallocated and should actually not be copied. + * + * This is indicated by skip_unallocated. + * + * In this case, block_copy() will query the source=E2=80=99s allocati= on status, + * skip unallocated regions, clear them in the copy_bitmap, and invoke + * block_copy_reset_unallocated() every time it does. + */ + bool skip_unallocated; + + /* progress_bytes_callback: called when some copying progress is done.= */ + ProgressBytesCallbackFunc progress_bytes_callback; + + /* + * progress_reset_callback: called when some bytes reset from copy_bit= map + * (see @skip_unallocated above). The callee is assumed to recalculate= how + * many bytes remain based on the dirty bit count of copy_bitmap. + */ + ProgressResetCallbackFunc progress_reset_callback; + void *progress_opaque; +} BlockCopyState; + +BlockCopyState *block_copy_state_new( + BlockDriverState *source, BlockDriverState *target, + int64_t cluster_size, BdrvRequestFlags write_flags, + ProgressBytesCallbackFunc progress_bytes_callback, + ProgressResetCallbackFunc progress_reset_callback, + void *progress_opaque, Error **errp); + +void block_copy_state_free(BlockCopyState *s); + +int64_t block_copy_reset_unallocated(BlockCopyState *s, + int64_t offset, int64_t *count); + +int coroutine_fn block_copy(BlockCopyState *s, int64_t start, uint64_t byt= es, + bool *error_is_read, bool is_write_notifier); + +#endif /* BLOCK_COPY_H */ diff --git a/block/backup.c b/block/backup.c index f5125984db..4613b8c88d 100644 --- a/block/backup.c +++ b/block/backup.c @@ -18,6 +18,7 @@ #include "block/block_int.h" #include "block/blockjob_int.h" #include "block/block_backup.h" +#include "block/block-copy.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qemu/ratelimit.h" @@ -35,47 +36,6 @@ typedef struct CowRequest { CoQueue wait_queue; /* coroutines blocked on this request */ } CowRequest; =20 -typedef void (*ProgressBytesCallbackFunc)(int64_t bytes, void *opaque); -typedef void (*ProgressResetCallbackFunc)(void *opaque); -typedef struct BlockCopyState { - BlockBackend *source; - BlockBackend *target; - BdrvDirtyBitmap *copy_bitmap; - int64_t cluster_size; - bool use_copy_range; - int64_t copy_range_size; - uint64_t len; - - BdrvRequestFlags write_flags; - - /* - * skip_unallocated: - * - * Used by sync=3Dtop jobs, which first scan the source node for unall= ocated - * areas and clear them in the copy_bitmap. During this process, the = bitmap - * is thus not fully initialized: It may still have bits set for areas= that - * are unallocated and should actually not be copied. - * - * This is indicated by skip_unallocated. - * - * In this case, block_copy() will query the source=E2=80=99s allocati= on status, - * skip unallocated regions, clear them in the copy_bitmap, and invoke - * block_copy_reset_unallocated() every time it does. - */ - bool skip_unallocated; - - /* progress_bytes_callback: called when some copying progress is done.= */ - ProgressBytesCallbackFunc progress_bytes_callback; - - /* - * progress_reset_callback: called when some bytes reset from copy_bit= map - * (see @skip_unallocated above). The callee is assumed to recalculate= how - * many bytes remain based on the dirty bit count of copy_bitmap. - */ - ProgressResetCallbackFunc progress_reset_callback; - void *progress_opaque; -} BlockCopyState; - typedef struct BackupBlockJob { BlockJob common; BlockDriverState *source_bs; @@ -135,319 +95,6 @@ static void cow_request_end(CowRequest *req) qemu_co_queue_restart_all(&req->wait_queue); } =20 -static void block_copy_state_free(BlockCopyState *s) -{ - if (!s) { - return; - } - - bdrv_release_dirty_bitmap(blk_bs(s->source), s->copy_bitmap); - blk_unref(s->source); - blk_unref(s->target); - g_free(s); -} - -static BlockCopyState *block_copy_state_new( - BlockDriverState *source, BlockDriverState *target, - int64_t cluster_size, BdrvRequestFlags write_flags, - ProgressBytesCallbackFunc progress_bytes_callback, - ProgressResetCallbackFunc progress_reset_callback, - void *progress_opaque, Error **errp) -{ - BlockCopyState *s; - int ret; - uint64_t no_resize =3D BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE | - BLK_PERM_WRITE_UNCHANGED | BLK_PERM_GRAPH_MOD; - BdrvDirtyBitmap *copy_bitmap; - - copy_bitmap =3D bdrv_create_dirty_bitmap(source, cluster_size, NULL, e= rrp); - if (!copy_bitmap) { - return NULL; - } - bdrv_disable_dirty_bitmap(copy_bitmap); - - s =3D g_new(BlockCopyState, 1); - *s =3D (BlockCopyState) { - .source =3D blk_new(bdrv_get_aio_context(source), - BLK_PERM_CONSISTENT_READ, no_resize), - .target =3D blk_new(bdrv_get_aio_context(target), - BLK_PERM_WRITE, no_resize), - .copy_bitmap =3D copy_bitmap, - .cluster_size =3D cluster_size, - .len =3D bdrv_dirty_bitmap_size(copy_bitmap), - .write_flags =3D write_flags, - .progress_bytes_callback =3D progress_bytes_callback, - .progress_reset_callback =3D progress_reset_callback, - .progress_opaque =3D progress_opaque, - }; - - s->copy_range_size =3D QEMU_ALIGN_DOWN(MIN(blk_get_max_transfer(s->sou= rce), - blk_get_max_transfer(s->targe= t)), - s->cluster_size); - /* - * Set use_copy_range, consider the following: - * 1. Compression is not supported for copy_range. - * 2. copy_range does not respect max_transfer (it's a TODO), so we fa= ctor - * that in here. If max_transfer is smaller than the job->cluster_s= ize, - * we do not use copy_range (in that case it's zero after aligning = down - * above). - */ - s->use_copy_range =3D - !(write_flags & BDRV_REQ_WRITE_COMPRESSED) && s->copy_range_size >= 0; - - /* - * We just allow aio context change on our block backends. block_copy(= ) user - * (now it's only backup) is responsible for source and target being i= n same - * aio context. - */ - blk_set_disable_request_queuing(s->source, true); - blk_set_allow_aio_context_change(s->source, true); - blk_set_disable_request_queuing(s->target, true); - blk_set_allow_aio_context_change(s->target, true); - - ret =3D blk_insert_bs(s->source, source, errp); - if (ret < 0) { - goto fail; - } - - ret =3D blk_insert_bs(s->target, target, errp); - if (ret < 0) { - goto fail; - } - - return s; - -fail: - block_copy_state_free(s); - - return NULL; -} - -/* - * Copy range to target with a bounce buffer and return the bytes copied. = If - * error occurred, return a negative error number - */ -static int coroutine_fn block_copy_with_bounce_buffer(BlockCopyState *s, - int64_t start, - int64_t end, - bool is_write_notifi= er, - bool *error_is_read, - void **bounce_buffer) -{ - int ret; - int nbytes; - int read_flags =3D is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; - - assert(QEMU_IS_ALIGNED(start, s->cluster_size)); - bdrv_reset_dirty_bitmap(s->copy_bitmap, start, s->cluster_size); - nbytes =3D MIN(s->cluster_size, s->len - start); - if (!*bounce_buffer) { - *bounce_buffer =3D blk_blockalign(s->source, s->cluster_size); - } - - ret =3D blk_co_pread(s->source, start, nbytes, *bounce_buffer, read_fl= ags); - if (ret < 0) { - trace_block_copy_with_bounce_buffer_read_fail(s, start, ret); - if (error_is_read) { - *error_is_read =3D true; - } - goto fail; - } - - ret =3D blk_co_pwrite(s->target, start, nbytes, *bounce_buffer, - s->write_flags); - if (ret < 0) { - trace_block_copy_with_bounce_buffer_write_fail(s, start, ret); - if (error_is_read) { - *error_is_read =3D false; - } - goto fail; - } - - return nbytes; -fail: - bdrv_set_dirty_bitmap(s->copy_bitmap, start, s->cluster_size); - return ret; - -} - -/* - * Copy range to target and return the bytes copied. If error occurred, re= turn a - * negative error number. - */ -static int coroutine_fn block_copy_with_offload(BlockCopyState *s, - int64_t start, - int64_t end, - bool is_write_notifier) -{ - int ret; - int nr_clusters; - int nbytes; - int read_flags =3D is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; - - assert(QEMU_IS_ALIGNED(s->copy_range_size, s->cluster_size)); - assert(QEMU_IS_ALIGNED(start, s->cluster_size)); - nbytes =3D MIN(s->copy_range_size, MIN(end, s->len) - start); - nr_clusters =3D DIV_ROUND_UP(nbytes, s->cluster_size); - bdrv_reset_dirty_bitmap(s->copy_bitmap, start, - s->cluster_size * nr_clusters); - ret =3D blk_co_copy_range(s->source, start, s->target, start, nbytes, - read_flags, s->write_flags); - if (ret < 0) { - trace_block_copy_with_offload_fail(s, start, ret); - bdrv_set_dirty_bitmap(s->copy_bitmap, start, - s->cluster_size * nr_clusters); - return ret; - } - - return nbytes; -} - -/* - * Check if the cluster starting at offset is allocated or not. - * return via pnum the number of contiguous clusters sharing this allocati= on. - */ -static int block_copy_is_cluster_allocated(BlockCopyState *s, int64_t offs= et, - int64_t *pnum) -{ - BlockDriverState *bs =3D blk_bs(s->source); - int64_t count, total_count =3D 0; - int64_t bytes =3D s->len - offset; - int ret; - - assert(QEMU_IS_ALIGNED(offset, s->cluster_size)); - - while (true) { - ret =3D bdrv_is_allocated(bs, offset, bytes, &count); - if (ret < 0) { - return ret; - } - - total_count +=3D count; - - if (ret || count =3D=3D 0) { - /* - * ret: partial segment(s) are considered allocated. - * otherwise: unallocated tail is treated as an entire segment. - */ - *pnum =3D DIV_ROUND_UP(total_count, s->cluster_size); - return ret; - } - - /* Unallocated segment(s) with uncertain following segment(s) */ - if (total_count >=3D s->cluster_size) { - *pnum =3D total_count / s->cluster_size; - return 0; - } - - offset +=3D count; - bytes -=3D count; - } -} - -/* - * Reset bits in copy_bitmap starting at offset if they represent unalloca= ted - * data in the image. May reset subsequent contiguous bits. - * @return 0 when the cluster at @offset was unallocated, - * 1 otherwise, and -ret on error. - */ -static int64_t block_copy_reset_unallocated(BlockCopyState *s, - int64_t offset, int64_t *count) -{ - int ret; - int64_t clusters, bytes; - - ret =3D block_copy_is_cluster_allocated(s, offset, &clusters); - if (ret < 0) { - return ret; - } - - bytes =3D clusters * s->cluster_size; - - if (!ret) { - bdrv_reset_dirty_bitmap(s->copy_bitmap, offset, bytes); - s->progress_reset_callback(s->progress_opaque); - } - - *count =3D bytes; - return ret; -} - -static int coroutine_fn block_copy(BlockCopyState *s, - int64_t start, uint64_t bytes, - bool *error_is_read, - bool is_write_notifier) -{ - int ret =3D 0; - int64_t end =3D bytes + start; /* bytes */ - void *bounce_buffer =3D NULL; - int64_t status_bytes; - - /* - * block_copy() user is responsible for keeping source and target in s= ame - * aio context - */ - assert(blk_get_aio_context(s->source) =3D=3D blk_get_aio_context(s->ta= rget)); - - assert(QEMU_IS_ALIGNED(start, s->cluster_size)); - assert(QEMU_IS_ALIGNED(end, s->cluster_size)); - - while (start < end) { - int64_t dirty_end; - - if (!bdrv_dirty_bitmap_get(s->copy_bitmap, start)) { - trace_block_copy_skip(s, start); - start +=3D s->cluster_size; - continue; /* already copied */ - } - - dirty_end =3D bdrv_dirty_bitmap_next_zero(s->copy_bitmap, start, - (end - start)); - if (dirty_end < 0) { - dirty_end =3D end; - } - - if (s->skip_unallocated) { - ret =3D block_copy_reset_unallocated(s, start, &status_bytes); - if (ret =3D=3D 0) { - trace_block_copy_skip_range(s, start, status_bytes); - start +=3D status_bytes; - continue; - } - /* Clamp to known allocated region */ - dirty_end =3D MIN(dirty_end, start + status_bytes); - } - - trace_block_copy_process(s, start); - - if (s->use_copy_range) { - ret =3D block_copy_with_offload(s, start, dirty_end, - is_write_notifier); - if (ret < 0) { - s->use_copy_range =3D false; - } - } - if (!s->use_copy_range) { - ret =3D block_copy_with_bounce_buffer(s, start, dirty_end, - is_write_notifier, - error_is_read, &bounce_buf= fer); - } - if (ret < 0) { - break; - } - - start +=3D ret; - s->progress_bytes_callback(ret, s->progress_opaque); - ret =3D 0; - } - - if (bounce_buffer) { - qemu_vfree(bounce_buffer); - } - - return ret; -} - static void backup_progress_bytes_callback(int64_t bytes, void *opaque) { BackupBlockJob *s =3D opaque; diff --git a/block/block-copy.c b/block/block-copy.c new file mode 100644 index 0000000000..3fc9152853 --- /dev/null +++ b/block/block-copy.c @@ -0,0 +1,333 @@ +/* + * block_copy API + * + * Copyright (C) 2013 Proxmox Server Solutions + * Copyright (c) 2019 Virtuozzo International GmbH. + * + * Authors: + * Dietmar Maurer (dietmar@proxmox.com) + * Vladimir Sementsov-Ogievskiy + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" + +#include "trace.h" +#include "qapi/error.h" +#include "block/block-copy.h" +#include "sysemu/block-backend.h" + +void block_copy_state_free(BlockCopyState *s) +{ + if (!s) { + return; + } + + bdrv_release_dirty_bitmap(blk_bs(s->source), s->copy_bitmap); + blk_unref(s->source); + blk_unref(s->target); + g_free(s); +} + +BlockCopyState *block_copy_state_new( + BlockDriverState *source, BlockDriverState *target, + int64_t cluster_size, BdrvRequestFlags write_flags, + ProgressBytesCallbackFunc progress_bytes_callback, + ProgressResetCallbackFunc progress_reset_callback, + void *progress_opaque, Error **errp) +{ + BlockCopyState *s; + int ret; + uint64_t no_resize =3D BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE | + BLK_PERM_WRITE_UNCHANGED | BLK_PERM_GRAPH_MOD; + BdrvDirtyBitmap *copy_bitmap; + + copy_bitmap =3D bdrv_create_dirty_bitmap(source, cluster_size, NULL, e= rrp); + if (!copy_bitmap) { + return NULL; + } + bdrv_disable_dirty_bitmap(copy_bitmap); + + s =3D g_new(BlockCopyState, 1); + *s =3D (BlockCopyState) { + .source =3D blk_new(bdrv_get_aio_context(source), + BLK_PERM_CONSISTENT_READ, no_resize), + .target =3D blk_new(bdrv_get_aio_context(target), + BLK_PERM_WRITE, no_resize), + .copy_bitmap =3D copy_bitmap, + .cluster_size =3D cluster_size, + .len =3D bdrv_dirty_bitmap_size(copy_bitmap), + .write_flags =3D write_flags, + .progress_bytes_callback =3D progress_bytes_callback, + .progress_reset_callback =3D progress_reset_callback, + .progress_opaque =3D progress_opaque, + }; + + s->copy_range_size =3D QEMU_ALIGN_DOWN(MIN(blk_get_max_transfer(s->sou= rce), + blk_get_max_transfer(s->targe= t)), + s->cluster_size); + /* + * Set use_copy_range, consider the following: + * 1. Compression is not supported for copy_range. + * 2. copy_range does not respect max_transfer (it's a TODO), so we fa= ctor + * that in here. If max_transfer is smaller than the job->cluster_s= ize, + * we do not use copy_range (in that case it's zero after aligning = down + * above). + */ + s->use_copy_range =3D + !(write_flags & BDRV_REQ_WRITE_COMPRESSED) && s->copy_range_size >= 0; + + /* + * We just allow aio context change on our block backends. block_copy(= ) user + * (now it's only backup) is responsible for source and target being i= n same + * aio context. + */ + blk_set_disable_request_queuing(s->source, true); + blk_set_allow_aio_context_change(s->source, true); + blk_set_disable_request_queuing(s->target, true); + blk_set_allow_aio_context_change(s->target, true); + + ret =3D blk_insert_bs(s->source, source, errp); + if (ret < 0) { + goto fail; + } + + ret =3D blk_insert_bs(s->target, target, errp); + if (ret < 0) { + goto fail; + } + + return s; + +fail: + block_copy_state_free(s); + + return NULL; +} + +/* + * Copy range to target with a bounce buffer and return the bytes copied. = If + * error occurred, return a negative error number + */ +static int coroutine_fn block_copy_with_bounce_buffer(BlockCopyState *s, + int64_t start, + int64_t end, + bool is_write_notifi= er, + bool *error_is_read, + void **bounce_buffer) +{ + int ret; + int nbytes; + int read_flags =3D is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; + + assert(QEMU_IS_ALIGNED(start, s->cluster_size)); + bdrv_reset_dirty_bitmap(s->copy_bitmap, start, s->cluster_size); + nbytes =3D MIN(s->cluster_size, s->len - start); + if (!*bounce_buffer) { + *bounce_buffer =3D blk_blockalign(s->source, s->cluster_size); + } + + ret =3D blk_co_pread(s->source, start, nbytes, *bounce_buffer, read_fl= ags); + if (ret < 0) { + trace_block_copy_with_bounce_buffer_read_fail(s, start, ret); + if (error_is_read) { + *error_is_read =3D true; + } + goto fail; + } + + ret =3D blk_co_pwrite(s->target, start, nbytes, *bounce_buffer, + s->write_flags); + if (ret < 0) { + trace_block_copy_with_bounce_buffer_write_fail(s, start, ret); + if (error_is_read) { + *error_is_read =3D false; + } + goto fail; + } + + return nbytes; +fail: + bdrv_set_dirty_bitmap(s->copy_bitmap, start, s->cluster_size); + return ret; + +} + +/* + * Copy range to target and return the bytes copied. If error occurred, re= turn a + * negative error number. + */ +static int coroutine_fn block_copy_with_offload(BlockCopyState *s, + int64_t start, + int64_t end, + bool is_write_notifier) +{ + int ret; + int nr_clusters; + int nbytes; + int read_flags =3D is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; + + assert(QEMU_IS_ALIGNED(s->copy_range_size, s->cluster_size)); + assert(QEMU_IS_ALIGNED(start, s->cluster_size)); + nbytes =3D MIN(s->copy_range_size, MIN(end, s->len) - start); + nr_clusters =3D DIV_ROUND_UP(nbytes, s->cluster_size); + bdrv_reset_dirty_bitmap(s->copy_bitmap, start, + s->cluster_size * nr_clusters); + ret =3D blk_co_copy_range(s->source, start, s->target, start, nbytes, + read_flags, s->write_flags); + if (ret < 0) { + trace_block_copy_with_offload_fail(s, start, ret); + bdrv_set_dirty_bitmap(s->copy_bitmap, start, + s->cluster_size * nr_clusters); + return ret; + } + + return nbytes; +} + +/* + * Check if the cluster starting at offset is allocated or not. + * return via pnum the number of contiguous clusters sharing this allocati= on. + */ +static int block_copy_is_cluster_allocated(BlockCopyState *s, int64_t offs= et, + int64_t *pnum) +{ + BlockDriverState *bs =3D blk_bs(s->source); + int64_t count, total_count =3D 0; + int64_t bytes =3D s->len - offset; + int ret; + + assert(QEMU_IS_ALIGNED(offset, s->cluster_size)); + + while (true) { + ret =3D bdrv_is_allocated(bs, offset, bytes, &count); + if (ret < 0) { + return ret; + } + + total_count +=3D count; + + if (ret || count =3D=3D 0) { + /* + * ret: partial segment(s) are considered allocated. + * otherwise: unallocated tail is treated as an entire segment. + */ + *pnum =3D DIV_ROUND_UP(total_count, s->cluster_size); + return ret; + } + + /* Unallocated segment(s) with uncertain following segment(s) */ + if (total_count >=3D s->cluster_size) { + *pnum =3D total_count / s->cluster_size; + return 0; + } + + offset +=3D count; + bytes -=3D count; + } +} + +/* + * Reset bits in copy_bitmap starting at offset if they represent unalloca= ted + * data in the image. May reset subsequent contiguous bits. + * @return 0 when the cluster at @offset was unallocated, + * 1 otherwise, and -ret on error. + */ +int64_t block_copy_reset_unallocated(BlockCopyState *s, + int64_t offset, int64_t *count) +{ + int ret; + int64_t clusters, bytes; + + ret =3D block_copy_is_cluster_allocated(s, offset, &clusters); + if (ret < 0) { + return ret; + } + + bytes =3D clusters * s->cluster_size; + + if (!ret) { + bdrv_reset_dirty_bitmap(s->copy_bitmap, offset, bytes); + s->progress_reset_callback(s->progress_opaque); + } + + *count =3D bytes; + return ret; +} + +int coroutine_fn block_copy(BlockCopyState *s, + int64_t start, uint64_t bytes, + bool *error_is_read, + bool is_write_notifier) +{ + int ret =3D 0; + int64_t end =3D bytes + start; /* bytes */ + void *bounce_buffer =3D NULL; + int64_t status_bytes; + + /* + * block_copy() user is responsible for keeping source and target in s= ame + * aio context + */ + assert(blk_get_aio_context(s->source) =3D=3D blk_get_aio_context(s->ta= rget)); + + assert(QEMU_IS_ALIGNED(start, s->cluster_size)); + assert(QEMU_IS_ALIGNED(end, s->cluster_size)); + + while (start < end) { + int64_t dirty_end; + + if (!bdrv_dirty_bitmap_get(s->copy_bitmap, start)) { + trace_block_copy_skip(s, start); + start +=3D s->cluster_size; + continue; /* already copied */ + } + + dirty_end =3D bdrv_dirty_bitmap_next_zero(s->copy_bitmap, start, + (end - start)); + if (dirty_end < 0) { + dirty_end =3D end; + } + + if (s->skip_unallocated) { + ret =3D block_copy_reset_unallocated(s, start, &status_bytes); + if (ret =3D=3D 0) { + trace_block_copy_skip_range(s, start, status_bytes); + start +=3D status_bytes; + continue; + } + /* Clamp to known allocated region */ + dirty_end =3D MIN(dirty_end, start + status_bytes); + } + + trace_block_copy_process(s, start); + + if (s->use_copy_range) { + ret =3D block_copy_with_offload(s, start, dirty_end, + is_write_notifier); + if (ret < 0) { + s->use_copy_range =3D false; + } + } + if (!s->use_copy_range) { + ret =3D block_copy_with_bounce_buffer(s, start, dirty_end, + is_write_notifier, + error_is_read, &bounce_buf= fer); + } + if (ret < 0) { + break; + } + + start +=3D ret; + s->progress_bytes_callback(ret, s->progress_opaque); + ret =3D 0; + } + + if (bounce_buffer) { + qemu_vfree(bounce_buffer); + } + + return ret; +} diff --git a/block/Makefile.objs b/block/Makefile.objs index 35f3bca4d9..0b5c635fb2 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs @@ -37,6 +37,7 @@ block-obj-y +=3D write-threshold.o block-obj-y +=3D backup.o block-obj-$(CONFIG_REPLICATION) +=3D replication.o block-obj-y +=3D throttle.o copy-on-read.o +block-obj-y +=3D block-copy.o =20 block-obj-y +=3D crypto.o =20 diff --git a/block/trace-events b/block/trace-events index 6e7532f48b..bbf82f069e 100644 --- a/block/trace-events +++ b/block/trace-events @@ -40,6 +40,8 @@ mirror_yield_in_flight(void *s, int64_t offset, int in_fl= ight) "s %p offset %" P # backup.c backup_do_cow_enter(void *job, int64_t start, int64_t offset, uint64_t byt= es) "job %p start %" PRId64 " offset %" PRId64 " bytes %" PRIu64 backup_do_cow_return(void *job, int64_t offset, uint64_t bytes, int ret) "= job %p offset %" PRId64 " bytes %" PRIu64 " ret %d" + +# block-copy.c block_copy_skip(void *bcs, int64_t start) "bcs %p start %"PRId64 block_copy_skip_range(void *bcs, int64_t start, uint64_t bytes) "bcs %p st= art %"PRId64" bytes %"PRId64 block_copy_process(void *bcs, int64_t start) "bcs %p start %"PRId64 --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568989836; cv=none; d=zoho.com; s=zohoarc; b=W9syZ8eh7bxEUckGf18jkzbajITxWOD8KfkYZ/mCE1S7ecIn8L8Z7KYfBjXwkxFX0mUJTyLsYYdV2hzoY5CpUBZc75Hg8sFcXcou/AOd0UsOz+4D48/iqVLTwxMduYkg+StspWB6oMEGDMSytF1fTJrviQiBkfHHRPnHiqK6lDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568989836; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=2/itGr55EXquE+ggjpGKsCTKjUx3LfCnzblS/hO7cN8=; b=DOPm7iH4SnlAwduDJkDmjapraXlOP8Qga8psySgH/s+UWKvv7P2sHv3/El/nxb217jaL/GNNyMZFLtMc8i9v8J9PF5Ia+8aU/sxaUs4sE26Ze9fwU4vPHLyxbfhbH3gN50Qh43ZK1FFJ7Kel44vtoVy/5xcDSr53tO/qA76gLag= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 156898983630511.084338781393853; Fri, 20 Sep 2019 07:30:36 -0700 (PDT) Received: from localhost ([::1]:60238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJvT-0004LD-OZ for importer@patchew.org; Fri, 20 Sep 2019 10:30:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32804) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJmW-0004Z1-8D for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJmU-0000t6-Kr for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:08 -0400 Received: from relay.sw.ru ([185.231.240.75]:43782) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmQ-0000g6-Aa; Fri, 20 Sep 2019 10:21:02 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmN-0006b5-DN; Fri, 20 Sep 2019 17:20:59 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 08/15] block: teach bdrv_debug_breakpoint skip filters with backing Date: Fri, 20 Sep 2019 17:20:49 +0300 Message-Id: <20190920142056.12778-9-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Teach bdrv_debug_breakpoint and bdrv_debug_remove_breakpoint skip filters with backing. This is needed to implement and use in backup job it's own backup_top filter driver (like mirror already has one), and without this improvement, breakpoint removal will fail at least in 55 iotest. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/block.c b/block.c index 5944124845..1c7c199849 100644 --- a/block.c +++ b/block.c @@ -5164,14 +5164,35 @@ void bdrv_debug_event(BlockDriverState *bs, Blkdebu= gEvent event) bs->drv->bdrv_debug_event(bs, event); } =20 -int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event, - const char *tag) +static BlockDriverState *bdrv_find_debug_node(BlockDriverState *bs) { while (bs && bs->drv && !bs->drv->bdrv_debug_breakpoint) { - bs =3D bs->file ? bs->file->bs : NULL; + if (bs->file) { + bs =3D bs->file->bs; + continue; + } + + if (bs->drv->is_filter && bs->backing) { + bs =3D bs->backing->bs; + continue; + } + + break; } =20 if (bs && bs->drv && bs->drv->bdrv_debug_breakpoint) { + assert(bs->drv->bdrv_debug_remove_breakpoint); + return bs; + } + + return NULL; +} + +int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event, + const char *tag) +{ + bs =3D bdrv_find_debug_node(bs); + if (bs) { return bs->drv->bdrv_debug_breakpoint(bs, event, tag); } =20 @@ -5180,11 +5201,8 @@ int bdrv_debug_breakpoint(BlockDriverState *bs, cons= t char *event, =20 int bdrv_debug_remove_breakpoint(BlockDriverState *bs, const char *tag) { - while (bs && bs->drv && !bs->drv->bdrv_debug_remove_breakpoint) { - bs =3D bs->file ? bs->file->bs : NULL; - } - - if (bs && bs->drv && bs->drv->bdrv_debug_remove_breakpoint) { + bs =3D bdrv_find_debug_node(bs); + if (bs) { return bs->drv->bdrv_debug_remove_breakpoint(bs, tag); } =20 --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568991047; cv=none; d=zoho.com; s=zohoarc; b=hu3sVGe/oYllapLDGGoBwbriQw3MabO6TUY33P4o7xba/QsKumHy6rvVKY+78xeTo6eNvZMGzkzQtOm/7i//AYregW9Q9/VIMZh+ysY/tyR23IC2rEY80pXOkN8vbY3IKcd7X1fvurTXMgdu6yV9JXyt6b+a7mZmwaQPP7YeFQg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568991047; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=9iG3zqG2dmHVcl+ocPO/EYKSfXNV/E6cqB5F6zyqlqU=; b=cgOkruEvttDoI/xaltAovWRufJ3wz9II2E4J+5u5dzIHA36+KZEX1IyVWFv2GfWaWczEXjN48u9GeoQHIIAg7JKMzu2Mc7M6ZRpvyKHbNhwIr25mbJ0eZn4/4dxQQsPeHHsvOjXYB+Wcp9NE/gRQ1INdcCzCzyjthoD8h40ARns= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568991047081249.4183470783537; Fri, 20 Sep 2019 07:50:47 -0700 (PDT) Received: from localhost ([::1]:60404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBKF8-0004Zl-4U for importer@patchew.org; Fri, 20 Sep 2019 10:50:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33051) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJn0-00056q-E8 for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJmv-00014o-CK for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:38 -0400 Received: from relay.sw.ru ([185.231.240.75]:43778) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmk-0000g5-FL; Fri, 20 Sep 2019 10:21:22 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmN-0006b5-LM; Fri, 20 Sep 2019 17:20:59 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 09/15] iotests: prepare 124 and 257 bitmap querying for backup-top filter Date: Fri, 20 Sep 2019 17:20:50 +0300 Message-Id: <20190920142056.12778-10-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" After backup-top filter appearing it's not possible to see dirty bitmaps in top node, so use node-name instead. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- tests/qemu-iotests/124 | 83 ++++---- tests/qemu-iotests/257 | 49 ++--- tests/qemu-iotests/257.out | 364 +++++++++++++--------------------- tests/qemu-iotests/iotests.py | 27 +++ 4 files changed, 219 insertions(+), 304 deletions(-) diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 index ca40ba3be2..d3e851e1ae 100755 --- a/tests/qemu-iotests/124 +++ b/tests/qemu-iotests/124 @@ -105,7 +105,7 @@ class TestIncrementalBackupBase(iotests.QMPTestCase): # Create a base image with a distinctive patterning drive0 =3D self.add_node('drive0') self.img_create(drive0['file'], drive0['fmt']) - self.vm.add_drive(drive0['file']) + self.vm.add_drive(drive0['file'], opts=3D'node-name=3Dnode0') self.write_default_pattern(drive0['file']) self.vm.launch() =20 @@ -348,12 +348,14 @@ class TestIncrementalBackup(TestIncrementalBackupBase= ): ('0xfe', '16M', '256k'), ('0x64', '32736k', '64k'))) # Check the dirty bitmap stats - result =3D self.vm.qmp('query-block') - self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/name', 'bitmap= 0') - self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/count', 458752) - self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/granularity', = 65536) - self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/status', 'acti= ve') - self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/persistent', F= alse) + self.assertTrue(self.vm.check_bitmap_status( + 'node0', bitmap0.name, { + 'name': 'bitmap0', + 'count': 458752, + 'granularity': 65536, + 'status': 'active', + 'persistent': False + })) =20 # Prepare a cluster_size=3D128k backup target without a backing fi= le. (target, _) =3D bitmap0.new_target() @@ -670,9 +672,8 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBack= upBase): """ =20 drive0 =3D self.drives[0] - # NB: The blkdebug script here looks for a "flush, read, read" pat= tern. - # The flush occurs in hmp_io_writes, the first read in device_add,= and - # the last read during the block job. + # NB: The blkdebug script here looks for a "flush, read" pattern. + # The flush occurs in hmp_io_writes, and the read during the block= job. result =3D self.vm.qmp('blockdev-add', node_name=3Ddrive0['id'], driver=3Ddrive0['fmt'], @@ -686,15 +687,11 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBa= ckupBase): 'event': 'flush_to_disk', 'state': 1, 'new_state': 2 - },{ - 'event': 'read_aio', - 'state': 2, - 'new_state': 3 }], 'inject-error': [{ 'event': 'read_aio', 'errno': 5, - 'state': 3, + 'state': 2, 'immediately': False, 'once': True }], @@ -708,23 +705,15 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBa= ckupBase): ('0xfe', '16M', '256k'), ('0x64', '32736k', '64k'))) =20 - # For the purposes of query-block visibility of bitmaps, add a dri= ve - # frontend after we've written data; otherwise we can't use hmp-io - result =3D self.vm.qmp("device_add", - id=3D"device0", - drive=3Ddrive0['id'], - driver=3D"virtio-blk") - self.assert_qmp(result, 'return', {}) - # Bitmap Status Check - query =3D self.vm.qmp('query-block') - ret =3D [bmap for bmap in query['return'][0]['dirty-bitmaps'] - if bmap.get('name') =3D=3D bitmap.name][0] - self.assert_qmp(ret, 'count', 458752) - self.assert_qmp(ret, 'granularity', 65536) - self.assert_qmp(ret, 'status', 'active') - self.assert_qmp(ret, 'busy', False) - self.assert_qmp(ret, 'recording', True) + self.assertTrue(self.vm.check_bitmap_status( + drive0['id'], bitmap.name, { + 'count': 458752, + 'granularity': 65536, + 'status': 'active', + 'busy': False, + 'recording': True + })) =20 # Start backup parent, _ =3D bitmap.last_target() @@ -748,14 +737,14 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBa= ckupBase): 'operation': 'read'}) =20 # Bitmap Status Check - query =3D self.vm.qmp('query-block') - ret =3D [bmap for bmap in query['return'][0]['dirty-bitmaps'] - if bmap.get('name') =3D=3D bitmap.name][0] - self.assert_qmp(ret, 'count', 458752) - self.assert_qmp(ret, 'granularity', 65536) - self.assert_qmp(ret, 'status', 'frozen') - self.assert_qmp(ret, 'busy', True) - self.assert_qmp(ret, 'recording', True) + self.assertTrue(self.vm.check_bitmap_status( + drive0['id'], bitmap.name, { + 'count': 458752, + 'granularity': 65536, + 'status': 'frozen', + 'busy': True, + 'recording': True + })) =20 # Resume and check incremental backup for consistency res =3D self.vm.qmp('block-job-resume', device=3Dbitmap.drive['id'= ]) @@ -763,14 +752,14 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBa= ckupBase): self.wait_qmp_backup(bitmap.drive['id']) =20 # Bitmap Status Check - query =3D self.vm.qmp('query-block') - ret =3D [bmap for bmap in query['return'][0]['dirty-bitmaps'] - if bmap.get('name') =3D=3D bitmap.name][0] - self.assert_qmp(ret, 'count', 0) - self.assert_qmp(ret, 'granularity', 65536) - self.assert_qmp(ret, 'status', 'active') - self.assert_qmp(ret, 'busy', False) - self.assert_qmp(ret, 'recording', True) + self.assertTrue(self.vm.check_bitmap_status( + drive0['id'], bitmap.name, { + 'count': 0, + 'granularity': 65536, + 'status': 'active', + 'busy': False, + 'recording': True + })) =20 # Finalize / Cleanup self.make_reference_backup(bitmap) diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index 4a636d8ab2..6b368e1e70 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -188,25 +188,6 @@ class Drive: self.size =3D size self.node =3D name =20 -def query_bitmaps(vm): - res =3D vm.qmp("query-block") - return {"bitmaps": {device['device'] or device['qdev']: - device.get('dirty-bitmaps', []) for - device in res['return']}} - -def get_bitmap(bitmaps, drivename, name, recording=3DNone): - """ - get a specific bitmap from the object returned by query_bitmaps. - :param recording: If specified, filter results by the specified value. - """ - for bitmap in bitmaps['bitmaps'][drivename]: - if bitmap.get('name', '') =3D=3D name: - if recording is None: - return bitmap - elif bitmap.get('recording') =3D=3D recording: - return bitmap - return None - def blockdev_backup(vm, device, target, sync, **kwargs): # Strip any arguments explicitly nulled by the caller: kwargs =3D {key: val for key, val in kwargs.items() if val is not None} @@ -249,8 +230,8 @@ def perform_writes(drive, n): pattern.size) log(cmd) log(drive.vm.hmp_qemu_io(drive.name, cmd)) - bitmaps =3D query_bitmaps(drive.vm) - log(bitmaps, indent=3D2) + bitmaps =3D drive.vm.query_bitmaps() + log({'bitmaps': bitmaps}, indent=3D2) log('') return bitmaps =20 @@ -370,7 +351,7 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap',= failure=3DNone): # 1 - Writes and Reference Backup bitmaps =3D perform_writes(drive0, 1) ebitmap.dirty_group(1) - bitmap =3D get_bitmap(bitmaps, drive0.device, 'bitmap0') + bitmap =3D vm.get_bitmap(drive0.node, 'bitmap0', bitmaps=3Dbitmaps) ebitmap.compare(bitmap) reference_backup(drive0, 1, fbackup1) =20 @@ -388,12 +369,13 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap= ', failure=3DNone): log('') bitmaps =3D perform_writes(drive0, 2) # Named bitmap (static, should be unchanged) - ebitmap.compare(get_bitmap(bitmaps, drive0.device, 'bitmap0')) + ebitmap.compare(vm.get_bitmap(drive0.node, 'bitmap0', + bitmaps=3Dbitmaps)) # Anonymous bitmap (dynamic, shows new writes) anonymous =3D EmulatedBitmap() anonymous.dirty_group(2) - anonymous.compare(get_bitmap(bitmaps, drive0.device, '', - recording=3DTrue)) + anonymous.compare(vm.get_bitmap(drive0.node, '', recording=3DT= rue, + bitmaps=3Dbitmaps)) =20 # Simulate the order in which this will happen: # group 1 gets cleared first, then group two gets written. @@ -405,8 +387,8 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap',= failure=3DNone): vm.run_job(job, auto_dismiss=3DTrue, auto_finalize=3DFalse, pre_finalize=3D_callback, cancel=3D(failure =3D=3D 'simulated')) - bitmaps =3D query_bitmaps(vm) - log(bitmaps, indent=3D2) + bitmaps =3D vm.query_bitmaps() + log({'bitmaps': bitmaps}, indent=3D2) log('') =20 if bsync_mode =3D=3D 'always' and failure =3D=3D 'intermediate': @@ -423,29 +405,30 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap= ', failure=3DNone): ebitmap.clear() ebitmap.dirty_bits(range(fail_bit, SIZE // GRANULARITY)) =20 - ebitmap.compare(get_bitmap(bitmaps, drive0.device, 'bitmap0')) + ebitmap.compare(vm.get_bitmap(drive0.node, 'bitmap0', bitmaps=3Dbi= tmaps)) =20 # 2 - Writes and Reference Backup bitmaps =3D perform_writes(drive0, 3) ebitmap.dirty_group(3) - ebitmap.compare(get_bitmap(bitmaps, drive0.device, 'bitmap0')) + ebitmap.compare(vm.get_bitmap(drive0.node, 'bitmap0', bitmaps=3Dbi= tmaps)) reference_backup(drive0, 2, fbackup2) =20 # 2 - Bitmap Backup (In failure modes, this is a recovery.) job =3D backup(drive0, 2, bsync2, "bitmap", bitmap=3D"bitmap0", bitmap_mode=3Dbsync_mode) vm.run_job(job, auto_dismiss=3DTrue, auto_finalize=3DFalse) - bitmaps =3D query_bitmaps(vm) - log(bitmaps, indent=3D2) + bitmaps =3D vm.query_bitmaps() + log({'bitmaps': bitmaps}, indent=3D2) log('') if bsync_mode !=3D 'never': ebitmap.clear() - ebitmap.compare(get_bitmap(bitmaps, drive0.device, 'bitmap0')) + ebitmap.compare(vm.get_bitmap(drive0.node, 'bitmap0', bitmaps=3Dbi= tmaps)) =20 log('--- Cleanup ---\n') vm.qmp_log("block-dirty-bitmap-remove", node=3Ddrive0.name, name=3D"bitmap0") - log(query_bitmaps(vm), indent=3D2) + bitmaps =3D vm.query_bitmaps() + log({'bitmaps': bitmaps}, indent=3D2) vm.shutdown() log('') =20 diff --git a/tests/qemu-iotests/257.out b/tests/qemu-iotests/257.out index 84b79d7bfe..c9b4b68232 100644 --- a/tests/qemu-iotests/257.out +++ b/tests/qemu-iotests/257.out @@ -19,9 +19,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -55,7 +53,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -111,7 +109,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -153,7 +151,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 655360, @@ -182,7 +180,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 983040, @@ -231,7 +229,7 @@ expecting 15 dirty sectors; have 15. OK! {"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 983040, @@ -253,9 +251,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -285,9 +281,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -321,7 +315,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -370,7 +364,7 @@ expecting 6 dirty sectors; have 6. OK! {"data": {"device": "backup_1", "error": "Input/output error", "len": 3932= 16, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -399,7 +393,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 917504, @@ -448,7 +442,7 @@ expecting 14 dirty sectors; have 14. OK! {"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 917504, @@ -470,9 +464,7 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -502,9 +494,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -538,7 +528,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -594,7 +584,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -636,7 +626,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 655360, @@ -665,7 +655,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 983040, @@ -714,7 +704,7 @@ expecting 15 dirty sectors; have 15. OK! {"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 983040, @@ -736,9 +726,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -768,9 +756,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -804,7 +790,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -860,7 +846,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -902,7 +888,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 655360, @@ -931,7 +917,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 983040, @@ -980,7 +966,7 @@ expecting 15 dirty sectors; have 15. OK! {"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -1002,9 +988,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -1034,9 +1018,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -1070,7 +1052,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -1119,7 +1101,7 @@ expecting 6 dirty sectors; have 6. OK! {"data": {"device": "backup_1", "error": "Input/output error", "len": 3932= 16, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -1148,7 +1130,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 917504, @@ -1197,7 +1179,7 @@ expecting 14 dirty sectors; have 14. OK! {"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -1219,9 +1201,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -1251,9 +1231,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -1287,7 +1265,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -1343,7 +1321,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -1385,7 +1363,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 458752, @@ -1414,7 +1392,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 786432, @@ -1463,7 +1441,7 @@ expecting 12 dirty sectors; have 12. OK! {"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -1485,9 +1463,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -1517,9 +1493,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -1553,7 +1527,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -1609,7 +1583,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -1651,7 +1625,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 458752, @@ -1680,7 +1654,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 786432, @@ -1729,7 +1703,7 @@ expecting 12 dirty sectors; have 12. OK! {"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -1751,9 +1725,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -1783,9 +1755,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -1819,7 +1789,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -1868,7 +1838,7 @@ expecting 6 dirty sectors; have 6. OK! {"data": {"device": "backup_1", "error": "Input/output error", "len": 3932= 16, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 327680, @@ -1897,7 +1867,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 851968, @@ -1946,7 +1916,7 @@ expecting 13 dirty sectors; have 13. OK! {"data": {"device": "backup_2", "len": 851968, "offset": 851968, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -1968,9 +1938,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -2000,9 +1968,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -2036,7 +2002,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -2092,7 +2058,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -2134,7 +2100,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 393216, "offset": 393216, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 458752, @@ -2163,7 +2129,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 786432, @@ -2212,7 +2178,7 @@ expecting 12 dirty sectors; have 12. OK! {"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -2234,9 +2200,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -2266,9 +2230,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -2302,7 +2264,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -2358,7 +2320,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -2400,7 +2362,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 655360, @@ -2429,7 +2391,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 983040, @@ -2478,7 +2440,7 @@ expecting 15 dirty sectors; have 15. OK! {"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -2500,9 +2462,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -2532,9 +2492,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -2568,7 +2526,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -2617,7 +2575,7 @@ expecting 6 dirty sectors; have 6. OK! {"data": {"device": "backup_1", "error": "Input/output error", "len": 6710= 8864, "offset": 983040, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_= COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -2646,7 +2604,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 917504, @@ -2695,7 +2653,7 @@ expecting 14 dirty sectors; have 14. OK! {"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -2717,9 +2675,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -2749,9 +2705,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -2785,7 +2739,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -2841,7 +2795,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -2883,7 +2837,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 458752, @@ -2912,7 +2866,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 786432, @@ -2961,7 +2915,7 @@ expecting 12 dirty sectors; have 12. OK! {"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -2983,9 +2937,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -3015,9 +2967,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -3051,7 +3001,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -3107,7 +3057,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -3149,7 +3099,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 458752, @@ -3178,7 +3128,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 786432, @@ -3227,7 +3177,7 @@ expecting 12 dirty sectors; have 12. OK! {"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -3249,9 +3199,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -3281,9 +3229,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -3317,7 +3263,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -3366,7 +3312,7 @@ expecting 6 dirty sectors; have 6. OK! {"data": {"device": "backup_1", "error": "Input/output error", "len": 6710= 8864, "offset": 983040, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_= COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 66125824, @@ -3395,7 +3341,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 66453504, @@ -3444,7 +3390,7 @@ expecting 1014 dirty sectors; have 1014. OK! {"data": {"device": "backup_2", "len": 66453504, "offset": 66453504, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -3466,9 +3412,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -3498,9 +3442,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -3534,7 +3476,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -3590,7 +3532,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -3632,7 +3574,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 67108864, "offset": 67108864, "spee= d": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"mi= croseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 458752, @@ -3661,7 +3603,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 786432, @@ -3710,7 +3652,7 @@ expecting 12 dirty sectors; have 12. OK! {"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -3732,9 +3674,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -3764,9 +3704,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -3800,7 +3738,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -3856,7 +3794,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -3898,7 +3836,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 458752, "offset": 458752, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 655360, @@ -3927,7 +3865,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 983040, @@ -3976,7 +3914,7 @@ expecting 15 dirty sectors; have 15. OK! {"data": {"device": "backup_2", "len": 983040, "offset": 983040, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -3998,9 +3936,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -4030,9 +3966,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -4066,7 +4000,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -4115,7 +4049,7 @@ expecting 6 dirty sectors; have 6. OK! {"data": {"device": "backup_1", "error": "Input/output error", "len": 4587= 52, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -4144,7 +4078,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 917504, @@ -4193,7 +4127,7 @@ expecting 14 dirty sectors; have 14. OK! {"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -4215,9 +4149,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -4247,9 +4179,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -4283,7 +4213,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -4339,7 +4269,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -4381,7 +4311,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 458752, "offset": 458752, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 458752, @@ -4410,7 +4340,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 786432, @@ -4459,7 +4389,7 @@ expecting 12 dirty sectors; have 12. OK! {"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -4481,9 +4411,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -4513,9 +4441,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -4549,7 +4475,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -4605,7 +4531,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -4647,7 +4573,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 458752, "offset": 458752, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_CANCELLED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 458752, @@ -4676,7 +4602,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 786432, @@ -4725,7 +4651,7 @@ expecting 12 dirty sectors; have 12. OK! {"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -4747,9 +4673,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -4779,9 +4703,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -4815,7 +4737,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -4864,7 +4786,7 @@ expecting 6 dirty sectors; have 6. OK! {"data": {"device": "backup_1", "error": "Input/output error", "len": 4587= 52, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -4893,7 +4815,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 917504, @@ -4942,7 +4864,7 @@ expecting 14 dirty sectors; have 14. OK! {"data": {"device": "backup_2", "len": 917504, "offset": 917504, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -4964,9 +4886,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- @@ -4996,9 +4916,7 @@ write -P0x6f 0x2000000 0x10000 write -P0x76 0x3ff0000 0x10000 {"return": ""} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Reference Backup #0 --- @@ -5032,7 +4950,7 @@ write -P0x69 0x3fe0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 393216, @@ -5088,7 +5006,7 @@ write -P0x67 0x3fe0000 0x20000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -5130,7 +5048,7 @@ expecting 7 dirty sectors; have 7. OK! {"data": {"device": "backup_1", "len": 458752, "offset": 458752, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 458752, @@ -5159,7 +5077,7 @@ write -P0xdd 0x3fc0000 0x10000 {"return": ""} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 786432, @@ -5208,7 +5126,7 @@ expecting 12 dirty sectors; have 12. OK! {"data": {"device": "backup_2", "len": 786432, "offset": 786432, "speed": = 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"micros= econds": "USECS", "seconds": "SECS"}} { "bitmaps": { - "device0": [ + "drive0": [ { "busy": false, "count": 0, @@ -5230,9 +5148,7 @@ expecting 0 dirty sectors; have 0. OK! {"execute": "block-dirty-bitmap-remove", "arguments": {"name": "bitmap0", = "node": "drive0"}} {"return": {}} { - "bitmaps": { - "device0": [] - } + "bitmaps": {} } =20 --- Verification --- diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index b26271187c..cf92716847 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -643,6 +643,33 @@ class VM(qtest.QEMUQtestMachine): return x return None =20 + def query_bitmaps(self): + res =3D self.qmp("query-named-block-nodes") + return {device['node-name']: device['dirty-bitmaps'] + for device in res['return'] if 'dirty-bitmaps' in device} + + def get_bitmap(self, node_name, bitmap_name, recording=3DNone, bitmaps= =3DNone): + """ + get a specific bitmap from the object returned by query_bitmaps. + :param recording: If specified, filter results by the specified va= lue. + :param bitmaps: If specified, use it instead of call query_bitmaps= () + """ + if bitmaps is None: + bitmaps =3D self.query_bitmaps() + + for bitmap in bitmaps[node_name]: + if bitmap.get('name', '') =3D=3D bitmap_name: + if recording is None: + return bitmap + elif bitmap.get('recording') =3D=3D recording: + return bitmap + return None + + def check_bitmap_status(self, node_name, bitmap_name, fields): + ret =3D self.get_bitmap(node_name, bitmap_name) + + return fields.items() <=3D ret.items() + =20 index_re =3D re.compile(r'([^\[]+)\[([^\]]+)\]') =20 --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568990646; cv=none; d=zoho.com; s=zohoarc; b=a6p5X5r4/UI+PsHpAE4ZOc8I1F1B/eC1AQzb/2PHJhH8kNTsA2BXrEl2UGIp5ZR2uBpuw78/Qztz43vMerVREGtcFcTENuDCCYMjZdW/9CxZBl+mG2dR7eg9DcciRdDG3A7E/nsAkuix5QlAXQ7qub5dgLmNa2CjiNVb63nOa74= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568990646; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=W0v8GuYKuuTpk/r2IYDuXMSAx33ZJYb7gIlmos7nRkw=; b=QiB8dMqIkqRXpts7ctcdK/LUW0cJufm2qSJo/SYV2pIAzUN5eYxxvyCADn0I0TbYF2ejjeArLxjzkrVyjWtTBdkI98FMt6VZDDynTAgi1ub9AUoBMPILwtdEuMez5WwDMFsHxceliBuxgoY6oOf5i9Spe7YxebhHQLp/9dxOUq8= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568990646939103.88683583409522; Fri, 20 Sep 2019 07:44:06 -0700 (PDT) Received: from localhost ([::1]:60358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBK8i-0008D8-Nd for importer@patchew.org; Fri, 20 Sep 2019 10:44:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33013) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJms-0004yG-LI for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJmr-00013S-44 for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:30 -0400 Received: from relay.sw.ru ([185.231.240.75]:43996) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmo-0000sH-4w; Fri, 20 Sep 2019 10:21:26 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmN-0006b5-R1; Fri, 20 Sep 2019 17:20:59 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 10/15] iotests: 257: drop unused Drive.device field Date: Fri, 20 Sep 2019 17:20:51 +0300 Message-Id: <20190920142056.12778-11-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" After previous commit Drive.device is actually unused. Drop it together with .name property. While being here reuse .node in qmp commands instead of writing 'drive0' twice. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- tests/qemu-iotests/257 | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index 6b368e1e70..5d77202157 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -148,11 +148,6 @@ class Drive: self.fmt =3D None self.size =3D None self.node =3D None - self.device =3D None - - @property - def name(self): - return self.node or self.device =20 def img_create(self, fmt, size): self.fmt =3D fmt @@ -201,7 +196,7 @@ def blockdev_backup(vm, device, target, sync, **kwargs): def blockdev_backup_mktarget(drive, target_id, filepath, sync, **kwargs): target_drive =3D Drive(filepath, vm=3Ddrive.vm) target_drive.create_target(target_id, drive.fmt, drive.size) - blockdev_backup(drive.vm, drive.name, target_id, sync, **kwargs) + blockdev_backup(drive.vm, drive.node, target_id, sync, **kwargs) =20 def reference_backup(drive, n, filepath): log("--- Reference Backup #{:d} ---\n".format(n)) @@ -229,7 +224,7 @@ def perform_writes(drive, n): pattern.offset, pattern.size) log(cmd) - log(drive.vm.hmp_qemu_io(drive.name, cmd)) + log(drive.vm.hmp_qemu_io(drive.node, cmd)) bitmaps =3D drive.vm.query_bitmaps() log({'bitmaps': bitmaps}, indent=3D2) log('') @@ -324,18 +319,17 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap= ', failure=3DNone): }] } =20 + drive0.node =3D 'drive0' vm.qmp_log('blockdev-add', filters=3D[iotests.filter_qmp_testfiles], - node_name=3D"drive0", + node_name=3Ddrive0.node, driver=3Ddrive0.fmt, file=3Dfile_config) - drive0.node =3D 'drive0' - drive0.device =3D 'device0' # Use share-rw to allow writes directly to the node; # The anonymous block-backend for this configuration prevents us # from using HMP's qemu-io commands to address the device. - vm.qmp_log("device_add", id=3Ddrive0.device, - drive=3Ddrive0.name, driver=3D"scsi-hd", + vm.qmp_log("device_add", id=3D'device0', + drive=3Ddrive0.node, driver=3D"scsi-hd", share_rw=3DTrue) log('') =20 @@ -343,7 +337,7 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap',= failure=3DNone): perform_writes(drive0, 0) reference_backup(drive0, 0, fbackup0) log('--- Add Bitmap ---\n') - vm.qmp_log("block-dirty-bitmap-add", node=3Ddrive0.name, + vm.qmp_log("block-dirty-bitmap-add", node=3Ddrive0.node, name=3D"bitmap0", granularity=3DGRANULARITY) log('') ebitmap =3D EmulatedBitmap() @@ -358,7 +352,7 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap',= failure=3DNone): # 1 - Test Backup (w/ Optional induced failure) if failure =3D=3D 'intermediate': # Activate blkdebug induced failure for second-to-next read - log(vm.hmp_qemu_io(drive0.name, 'flush')) + log(vm.hmp_qemu_io(drive0.node, 'flush')) log('') job =3D backup(drive0, 1, bsync1, msync_mode, bitmap=3D"bitmap0", bitmap_mode=3Dbsync_mode) @@ -426,7 +420,7 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap',= failure=3DNone): =20 log('--- Cleanup ---\n') vm.qmp_log("block-dirty-bitmap-remove", - node=3Ddrive0.name, name=3D"bitmap0") + node=3Ddrive0.node, name=3D"bitmap0") bitmaps =3D vm.query_bitmaps() log({'bitmaps': bitmaps}, indent=3D2) vm.shutdown() @@ -467,22 +461,21 @@ def test_backup_api(): 'filename': drive0.path } =20 + drive0.node =3D 'drive0' vm.qmp_log('blockdev-add', filters=3D[iotests.filter_qmp_testfiles], - node_name=3D"drive0", + node_name=3Ddrive0.node, driver=3Ddrive0.fmt, file=3Dfile_config) - drive0.node =3D 'drive0' - drive0.device =3D 'device0' - vm.qmp_log("device_add", id=3Ddrive0.device, - drive=3Ddrive0.name, driver=3D"scsi-hd") + vm.qmp_log("device_add", id=3D'device0', + drive=3Ddrive0.node, driver=3D"scsi-hd") log('') =20 target0 =3D Drive(backup_path, vm=3Dvm) target0.create_target("backup_target", drive0.fmt, drive0.size) log('') =20 - vm.qmp_log("block-dirty-bitmap-add", node=3Ddrive0.name, + vm.qmp_log("block-dirty-bitmap-add", node=3Ddrive0.node, name=3D"bitmap0", granularity=3DGRANULARITY) log('') =20 @@ -521,7 +514,7 @@ def test_backup_api(): log("-- Sync mode {:s} tests --\n".format(sync_mode)) for bitmap in (None, 'bitmap404', 'bitmap0'): for policy in error_cases[sync_mode][bitmap]: - blockdev_backup(drive0.vm, drive0.name, "backup_target= ", + blockdev_backup(drive0.vm, drive0.node, "backup_target= ", sync_mode, job_id=3D'api_job', bitmap=3Dbitmap, bitmap_mode=3Dpolicy) log('') --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568990609; cv=none; d=zoho.com; s=zohoarc; b=C8QB/aEnkVL5oj+mkSip/IPVXX3LM+lc+zfAZZOQTw/wlYY1bwGJJTbqJuv+W1Ty3ATcN7jB4xb/t/mrrjWPFZm5PLH/4BNCRBgPBdFZ/VtOEHa9QwtSnf620OGHWEaqaHanLseCdnM2b3Ipt+lHVwKT/S6bOhD+WeXphkwEayE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568990609; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6BneTunYPmxfhR1SdMURbYVRJY6V4Bwwnt/YXswnmiE=; b=ItN8VEKWmBIUK05QZBrlx+tfDws7Fco0eTmso2vQ03QXobYhIX/C4woYRICJTUrBqZMYlVUSkpjTsMjljDMKxMXZqXW//JqeMMuE9Ze0Zklk5ay1VX4r36PFgYU4OKeluO/W1Io7ORiEvoa9Bq/ZR8tGMb6Rs9Bm7gCkd5vgtCE= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568990609444238.39223546771768; Fri, 20 Sep 2019 07:43:29 -0700 (PDT) Received: from localhost ([::1]:60356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBK85-0007V4-JC for importer@patchew.org; Fri, 20 Sep 2019 10:43:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33007) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJmr-0004x1-KO for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJmp-00012m-BI for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:29 -0400 Received: from relay.sw.ru ([185.231.240.75]:43812) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmk-0000gF-Ed; Fri, 20 Sep 2019 10:21:22 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmN-0006b5-U2; Fri, 20 Sep 2019 17:21:00 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 11/15] iotests: 257: drop device_add Date: Fri, 20 Sep 2019 17:20:52 +0300 Message-Id: <20190920142056.12778-12-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" SCSI devices are unused in test, drop them. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- tests/qemu-iotests/257 | 8 ------- tests/qemu-iotests/257.out | 44 -------------------------------------- 2 files changed, 52 deletions(-) diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index 5d77202157..de8b45f094 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -325,12 +325,6 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap'= , failure=3DNone): node_name=3Ddrive0.node, driver=3Ddrive0.fmt, file=3Dfile_config) - # Use share-rw to allow writes directly to the node; - # The anonymous block-backend for this configuration prevents us - # from using HMP's qemu-io commands to address the device. - vm.qmp_log("device_add", id=3D'device0', - drive=3Ddrive0.node, driver=3D"scsi-hd", - share_rw=3DTrue) log('') =20 # 0 - Writes and Reference Backup @@ -467,8 +461,6 @@ def test_backup_api(): node_name=3Ddrive0.node, driver=3Ddrive0.fmt, file=3Dfile_config) - vm.qmp_log("device_add", id=3D'device0', - drive=3Ddrive0.node, driver=3D"scsi-hd") log('') =20 target0 =3D Drive(backup_path, vm=3Dvm) diff --git a/tests/qemu-iotests/257.out b/tests/qemu-iotests/257.out index c9b4b68232..ec7e25877b 100644 --- a/tests/qemu-iotests/257.out +++ b/tests/qemu-iotests/257.out @@ -5,8 +5,6 @@ =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -267,8 +265,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fback= up2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -480,8 +476,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fback= up2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -742,8 +736,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fback= up2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -1004,8 +996,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fbac= kup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -1217,8 +1207,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -1479,8 +1467,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -1741,8 +1727,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -1954,8 +1938,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -2216,8 +2198,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -2478,8 +2458,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -2691,8 +2669,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -2953,8 +2929,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -3215,8 +3189,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -3428,8 +3400,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -3690,8 +3660,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -3952,8 +3920,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -4165,8 +4131,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -4427,8 +4391,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -4689,8 +4651,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "blkdebug", "image": {"driver": "file", "filename": "TEST_DIR/PID-img= "}, "inject-error": [{"errno": 5, "event": "read_aio", "immediately": false= , "once": true, "state": 3}], "set-state": [{"event": "flush_to_disk", "new= -state": 2, "state": 1}, {"event": "read_aio", "new-state": 3, "state": 2}]= }, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -4902,8 +4862,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0", "share-rw": true}} -{"return": {}} =20 --- Write #0 --- =20 @@ -5164,8 +5122,6 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID-fba= ckup2" =3D=3D> Identical, OK! =20 {"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": {"dri= ver": "file", "filename": "TEST_DIR/PID-img"}, "node-name": "drive0"}} {"return": {}} -{"execute": "device_add", "arguments": {"drive": "drive0", "driver": "scsi= -hd", "id": "device0"}} -{"return": {}} =20 {} {"execute": "job-dismiss", "arguments": {"id": "bdc-file-job"}} --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568990340; cv=none; d=zoho.com; s=zohoarc; b=HeiNbJgUrvN3I8aM0WLyQajZcAUPXM87ulqykmGNaQsDl7jnuDmD33ggrNzpRRpnI4ysiEEsAAbNYKZWM7R+R1/nP0dBCRcUg0q5Y0+X2DdxJCbrZrYiw95s1ue28sKp3VEaI9vOXmm9/5ZW3YdlPa4UFlrtWf38UGkIKiAc6Rs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568990340; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=EPwalWq6+z4ZzGuh9IAhn7nBX+8JDZ3955nWacubDX4=; b=Gpl2l0KHHRMcldViGgSYLjhk2/8fJY2YH24boS8HMRJKLQEid9AXXh7HT//pHGDJSKHFMrBRje0Dtb/GclQKSP7cU6DncfJ3ogQPi0gbUde6yZGl9GtTLvUgK44P9iYMownzMy9602SBIlldf5FgcM5xLM8aDIwxTmf+WQVecLA= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156899034060268.84012779073635; Fri, 20 Sep 2019 07:39:00 -0700 (PDT) Received: from localhost ([::1]:60318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBK3k-0003Ek-0F for importer@patchew.org; Fri, 20 Sep 2019 10:38:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32974) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJmo-0004tQ-8i for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJmn-000125-2r for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:26 -0400 Received: from relay.sw.ru ([185.231.240.75]:43814) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmk-0000gG-FN; Fri, 20 Sep 2019 10:21:22 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmO-0006b5-7C; Fri, 20 Sep 2019 17:21:00 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 12/15] block/io: refactor wait_serialising_requests Date: Fri, 20 Sep 2019 17:20:53 +0300 Message-Id: <20190920142056.12778-13-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Split out do_wait_serialising_requests with additional possibility to not actually wait but just check, that there is something to wait for. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/io.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/block/io.c b/block/io.c index f8c3596131..f5f7b7357c 100644 --- a/block/io.c +++ b/block/io.c @@ -786,12 +786,13 @@ void bdrv_dec_in_flight(BlockDriverState *bs) bdrv_wakeup(bs); } =20 -static bool coroutine_fn wait_serialising_requests(BdrvTrackedRequest *sel= f) +static bool coroutine_fn do_wait_serialising_requests(BdrvTrackedRequest *= self, + bool wait) { BlockDriverState *bs =3D self->bs; BdrvTrackedRequest *req; bool retry; - bool waited =3D false; + bool found =3D false; =20 if (!atomic_read(&bs->serialising_in_flight)) { return false; @@ -817,11 +818,13 @@ static bool coroutine_fn wait_serialising_requests(Bd= rvTrackedRequest *self) * will wait for us as soon as it wakes up, then just go on * (instead of producing a deadlock in the former case). */ if (!req->waiting_for) { - self->waiting_for =3D req; - qemu_co_queue_wait(&req->wait_queue, &bs->reqs_lock); - self->waiting_for =3D NULL; - retry =3D true; - waited =3D true; + found =3D true; + if (wait) { + self->waiting_for =3D req; + qemu_co_queue_wait(&req->wait_queue, &bs->reqs_loc= k); + self->waiting_for =3D NULL; + retry =3D true; + } break; } } @@ -829,7 +832,12 @@ static bool coroutine_fn wait_serialising_requests(Bdr= vTrackedRequest *self) qemu_co_mutex_unlock(&bs->reqs_lock); } while (retry); =20 - return waited; + return found; +} + +static bool coroutine_fn wait_serialising_requests(BdrvTrackedRequest *sel= f) +{ + return do_wait_serialising_requests(self, true); } =20 static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568989645; cv=none; d=zoho.com; s=zohoarc; b=gYNLirlsyD3y15r/oOi17+3F3fWzJoHS5Cp+w2DMhaLYTgmcodLG2MDMTiPAoN5KO28JEKnz+jVFnBCa5di9mxI+1QraUU4VC5SmweyP2vWKl1U0mHRnsEZnG7hbY5/3xJGHMG38nysiZzYkbeUNgTylbgLZCOYbMsR2kbAs8E4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568989645; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=FCXxQlrBPRzYq+2Viw4cPweBXixiV0z7RpERgVpFGd0=; b=bHlCWcHHjbxI79xkqEoGU8cAKU1LSBOPgsRyeNWeWtMwjkZBjW/8pAPZORJM347ZUnSHiz5RAXFKBdRWClQ+x4Y7JVLnjn/SxSo0d3MirFmYUWrmYlhXN6uuLR2GOPzu9/EkBYOG65ZSxs+1qaF3E3vyCyf8SffVshqbIeLlgn4= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568989645354791.1088020410887; Fri, 20 Sep 2019 07:27:25 -0700 (PDT) Received: from localhost ([::1]:60212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJsZ-00023d-IC for importer@patchew.org; Fri, 20 Sep 2019 10:27:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32829) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJmW-0004ZZ-Mh for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJmU-0000tZ-Rv for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:08 -0400 Received: from relay.sw.ru ([185.231.240.75]:43826) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmQ-0000h0-6S; Fri, 20 Sep 2019 10:21:02 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmO-0006b5-F8; Fri, 20 Sep 2019 17:21:00 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 13/15] block: add lock/unlock range functions Date: Fri, 20 Sep 2019 17:20:54 +0300 Message-Id: <20190920142056.12778-14-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Introduce lock/unlock range functionality, based on serialized requests. This is needed to refactor backup, dropping local tracked-request-like synchronization. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- include/block/block_int.h | 4 ++++ block/io.c | 44 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 0422acdf1c..b59011ca97 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -65,6 +65,7 @@ enum BdrvTrackedRequestType { BDRV_TRACKED_WRITE, BDRV_TRACKED_DISCARD, BDRV_TRACKED_TRUNCATE, + BDRV_TRACKED_LOCK, }; =20 typedef struct BdrvTrackedRequest { @@ -968,6 +969,9 @@ int coroutine_fn bdrv_co_pwritev(BdrvChild *child, int coroutine_fn bdrv_co_pwritev_part(BdrvChild *child, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, size_t qiov_offset, BdrvRequestFlags flags); +void *coroutine_fn bdrv_co_try_lock(BlockDriverState *bs, + int64_t offset, unsigned int bytes); +void coroutine_fn bdrv_co_unlock(void *opaque); =20 static inline int coroutine_fn bdrv_co_pread(BdrvChild *child, int64_t offset, unsigned int bytes, void *buf, BdrvRequestFlags flags) diff --git a/block/io.c b/block/io.c index f5f7b7357c..a749583453 100644 --- a/block/io.c +++ b/block/io.c @@ -786,6 +786,15 @@ void bdrv_dec_in_flight(BlockDriverState *bs) bdrv_wakeup(bs); } =20 +static bool ignore_intersection(BdrvTrackedRequest *a, BdrvTrackedRequest = *b) +{ + return a =3D=3D b || (!a->serialising && !b->serialising) || + (a->type =3D=3D BDRV_TRACKED_LOCK && b->type =3D=3D BDRV_TRACKED_R= EAD && + !b->serialising) || + (b->type =3D=3D BDRV_TRACKED_LOCK && a->type =3D=3D BDRV_TRACKED_R= EAD && + !a->serialising); +} + static bool coroutine_fn do_wait_serialising_requests(BdrvTrackedRequest *= self, bool wait) { @@ -802,7 +811,7 @@ static bool coroutine_fn do_wait_serialising_requests(B= drvTrackedRequest *self, retry =3D false; qemu_co_mutex_lock(&bs->reqs_lock); QLIST_FOREACH(req, &bs->tracked_requests, list) { - if (req =3D=3D self || (!req->serialising && !self->serialisin= g)) { + if (ignore_intersection(self, req)) { continue; } if (tracked_request_overlaps(req, self->overlap_offset, @@ -840,6 +849,12 @@ static bool coroutine_fn wait_serialising_requests(Bdr= vTrackedRequest *self) return do_wait_serialising_requests(self, true); } =20 +static bool coroutine_fn should_wait_serialising_requests( + BdrvTrackedRequest *self) +{ + return do_wait_serialising_requests(self, false); +} + static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset, size_t size) { @@ -3378,3 +3393,30 @@ int bdrv_truncate(BdrvChild *child, int64_t offset, = PreallocMode prealloc, =20 return tco.ret; } + +void *coroutine_fn bdrv_co_try_lock(BlockDriverState *bs, + int64_t offset, unsigned int bytes) +{ + BdrvTrackedRequest *req =3D g_new(BdrvTrackedRequest, 1); + + tracked_request_begin(req, bs, offset, bytes, BDRV_TRACKED_LOCK); + mark_request_serialising(req, bdrv_get_cluster_size(bs)); + + if (should_wait_serialising_requests(req)) { + tracked_request_end(req); + g_free(req); + return NULL; + } + + return req; +} + +void coroutine_fn bdrv_co_unlock(void *opaque) +{ + BdrvTrackedRequest *req =3D opaque; + + assert(req->type =3D=3D BDRV_TRACKED_LOCK); + + tracked_request_end(req); + g_free(req); +} --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568990088; cv=none; d=zoho.com; s=zohoarc; b=DfbUp6XXfgb6XQE3LSKqipncl5d8Hcn5jO0mQfQUyOfcOhvaeZ/wfw/pBCN4QtrbGU94yQ77eemTxlhdFJ/5LtlkoWn6r3fmdoCfhjzWjgb9eBcCzlMD68D9SzuskkCnEJg57pZEkodDpB1XpKWkZiMgvvhjM4OTyrBvwAgKgqc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568990088; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lSjy/YCZHaQJGyYLzhmcDr9h8BzFLj5ZRlYbKMGYNOc=; b=NuOKWG5/7nYlF59ca3Lu8KVAtMiqKznTGzztYhTPlfkHxNads9y0vAO/lclv7gRL0UC91A63pvQyZ8wacc17sIq19o3vj8hyNluz2L24oi80V7mfM+v2THKzDmVDDXizvOy9QqCOlFGbD1NIjqE96mCGvSlpTKuDvhEYx9NbSyU= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568990088163102.04947509103522; Fri, 20 Sep 2019 07:34:48 -0700 (PDT) Received: from localhost ([::1]:60272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJzi-0007W5-AV for importer@patchew.org; Fri, 20 Sep 2019 10:34:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32879) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJmZ-0004cv-CB for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJmX-0000vT-3S for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:11 -0400 Received: from relay.sw.ru ([185.231.240.75]:43828) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmQ-0000ht-Bw; Fri, 20 Sep 2019 10:21:02 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmO-0006b5-ME; Fri, 20 Sep 2019 17:21:00 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 14/15] block: introduce backup-top filter driver Date: Fri, 20 Sep 2019 17:20:55 +0300 Message-Id: <20190920142056.12778-15-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Backup-top filter caches write operations and does copy-before-write operations. The driver will be used in backup instead of write-notifiers. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/backup-top.h | 37 +++++++ block/backup-top.c | 244 ++++++++++++++++++++++++++++++++++++++++++++ block/Makefile.objs | 2 + 3 files changed, 283 insertions(+) create mode 100644 block/backup-top.h create mode 100644 block/backup-top.c diff --git a/block/backup-top.h b/block/backup-top.h new file mode 100644 index 0000000000..67de7a9133 --- /dev/null +++ b/block/backup-top.h @@ -0,0 +1,37 @@ +/* + * backup-top filter driver + * + * The driver performs Copy-Before-Write (CBW) operation: it is injected a= bove + * some node, and before each write it copies _old_ data to the target nod= e. + * + * Copyright (c) 2018-2019 Virtuozzo International GmbH. + * + * Author: + * Sementsov-Ogievskiy Vladimir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef BACKUP_TOP_H +#define BACKUP_TOP_H + +#include "block/block_int.h" + +BlockDriverState *bdrv_backup_top_append(BlockDriverState *source, + const char *filter_node_name, + Error **errp); +void bdrv_backup_top_set_bcs(BlockDriverState *bs, BlockCopyState *copy_st= ate); +void bdrv_backup_top_drop(BlockDriverState *bs); + +#endif /* BACKUP_TOP_H */ diff --git a/block/backup-top.c b/block/backup-top.c new file mode 100644 index 0000000000..0991b64759 --- /dev/null +++ b/block/backup-top.c @@ -0,0 +1,244 @@ +/* + * backup-top filter driver + * + * The driver performs Copy-Before-Write (CBW) operation: it is injected a= bove + * some node, and before each write it copies _old_ data to the target nod= e. + * + * Copyright (c) 2018-2019 Virtuozzo International GmbH. + * + * Author: + * Sementsov-Ogievskiy Vladimir + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "qemu/osdep.h" + +#include "sysemu/block-backend.h" +#include "qemu/cutils.h" +#include "qapi/error.h" +#include "block/block_int.h" +#include "block/qdict.h" +#include "block/block-copy.h" + +#include "block/backup-top.h" + +typedef struct BDRVBackupTopState { + BlockCopyState *bcs; + bool active; +} BDRVBackupTopState; + +static coroutine_fn int backup_top_co_preadv( + BlockDriverState *bs, uint64_t offset, uint64_t bytes, + QEMUIOVector *qiov, int flags) +{ + return bdrv_co_preadv(bs->backing, offset, bytes, qiov, flags); +} + +static coroutine_fn int backup_top_cbw(BlockDriverState *bs, uint64_t offs= et, + uint64_t bytes) +{ + /* + * Here we'd like to use block_copy(), but it needs some additional + * synchronization mechanism to prevent intersecting guest writes duri= ng + * copy operation. The will appear in further commit (it should be done + * together with moving backup to using of backup-top and to the same + * synchronization mechanism), and for now it is a TODO. + */ + + abort(); +} + +static int coroutine_fn backup_top_co_pdiscard(BlockDriverState *bs, + int64_t offset, int bytes) +{ + int ret =3D backup_top_cbw(bs, offset, bytes); + if (ret < 0) { + return ret; + } + + return bdrv_co_pdiscard(bs->backing, offset, bytes); +} + +static int coroutine_fn backup_top_co_pwrite_zeroes(BlockDriverState *bs, + int64_t offset, int bytes, BdrvRequestFlags flags) +{ + int ret =3D backup_top_cbw(bs, offset, bytes); + if (ret < 0) { + return ret; + } + + return bdrv_co_pwrite_zeroes(bs->backing, offset, bytes, flags); +} + +static coroutine_fn int backup_top_co_pwritev(BlockDriverState *bs, + uint64_t offset, + uint64_t bytes, + QEMUIOVector *qiov, int flag= s) +{ + if (!(flags & BDRV_REQ_WRITE_UNCHANGED)) { + int ret =3D backup_top_cbw(bs, offset, bytes); + if (ret < 0) { + return ret; + } + } + + return bdrv_co_pwritev(bs->backing, offset, bytes, qiov, flags); +} + +static int coroutine_fn backup_top_co_flush(BlockDriverState *bs) +{ + if (!bs->backing) { + return 0; + } + + return bdrv_co_flush(bs->backing->bs); +} + +static void backup_top_refresh_filename(BlockDriverState *bs) +{ + if (bs->backing =3D=3D NULL) { + /* + * we can be here after failed bdrv_attach_child in + * bdrv_set_backing_hd + */ + return; + } + pstrcpy(bs->exact_filename, sizeof(bs->exact_filename), + bs->backing->bs->filename); +} + +static void backup_top_child_perm(BlockDriverState *bs, BdrvChild *c, + const BdrvChildRole *role, + BlockReopenQueue *reopen_queue, + uint64_t perm, uint64_t shared, + uint64_t *nperm, uint64_t *nshared) +{ + BDRVBackupTopState *s =3D bs->opaque; + + if (!s->active) { + /* + * The filter node may be in process of bdrv_append(), which first= ly do + * bdrv_set_backing_hd() and then bdrv_replace_node(). This means = that + * we can't unshare BLK_PERM_WRITE during bdrv_append() operation.= So, + * let's require nothing during bdrv_append() and refresh permissi= ons + * after it (see bdrv_backup_top_append()). + */ + *nperm =3D 0; + *nshared =3D BLK_PERM_ALL; + return; + } + + bdrv_filter_default_perms(bs, c, role, reopen_queue, perm, shared, + nperm, nshared); + + *nshared &=3D ~BLK_PERM_WRITE; +} + +BlockDriver bdrv_backup_top_filter =3D { + .format_name =3D "backup-top", + .instance_size =3D sizeof(BDRVBackupTopState), + + .bdrv_co_preadv =3D backup_top_co_preadv, + .bdrv_co_pwritev =3D backup_top_co_pwritev, + .bdrv_co_pwrite_zeroes =3D backup_top_co_pwrite_zeroes, + .bdrv_co_pdiscard =3D backup_top_co_pdiscard, + .bdrv_co_flush =3D backup_top_co_flush, + + .bdrv_co_block_status =3D bdrv_co_block_status_from_backing, + + .bdrv_refresh_filename =3D backup_top_refresh_filename, + + .bdrv_child_perm =3D backup_top_child_perm, + + .is_filter =3D true, +}; + +BlockDriverState *bdrv_backup_top_append(BlockDriverState *source, + const char *filter_node_name, + Error **errp) +{ + Error *local_err =3D NULL; + BDRVBackupTopState *state; + BlockDriverState *top =3D bdrv_new_open_driver(&bdrv_backup_top_filter, + filter_node_name, + BDRV_O_RDWR, errp); + + if (!top) { + return NULL; + } + + top->total_sectors =3D source->total_sectors; + top->opaque =3D state =3D g_new0(BDRVBackupTopState, 1); + + bdrv_drained_begin(source); + + bdrv_ref(top); + bdrv_append(top, source, &local_err); + if (local_err) { + error_prepend(&local_err, "Cannot append backup-top filter: "); + } else { + /* + * bdrv_append() finished successfully, now we can require permiss= ions + * we want. + */ + state->active =3D true; + bdrv_child_refresh_perms(top, top->backing, &local_err); + if (local_err) { + state->active =3D false; + bdrv_backup_top_drop(top); + error_prepend(&local_err, + "Cannot set permissions for backup-top filter: "= ); + } + } + + bdrv_drained_end(source); + + if (local_err) { + bdrv_unref(top); + error_propagate(errp, local_err); + return NULL; + } + + return top; +} + +void bdrv_backup_top_set_bcs(BlockDriverState *bs, BlockCopyState *copy_st= ate) +{ + BDRVBackupTopState *s =3D bs->opaque; + + assert(blk_bs(copy_state->source) =3D=3D bs->backing->bs); + s->bcs =3D copy_state; +} + +void bdrv_backup_top_drop(BlockDriverState *bs) +{ + BDRVBackupTopState *s =3D bs->opaque; + AioContext *aio_context =3D bdrv_get_aio_context(bs); + + aio_context_acquire(aio_context); + + bdrv_drained_begin(bs); + + s->active =3D false; + bdrv_child_refresh_perms(bs, bs->backing, &error_abort); + bdrv_replace_node(bs, backing_bs(bs), &error_abort); + bdrv_set_backing_hd(bs, NULL, &error_abort); + + bdrv_drained_end(bs); + + bdrv_unref(bs); + + aio_context_release(aio_context); +} diff --git a/block/Makefile.objs b/block/Makefile.objs index 0b5c635fb2..6f348c56c9 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs @@ -41,6 +41,8 @@ block-obj-y +=3D block-copy.o =20 block-obj-y +=3D crypto.o =20 +block-obj-y +=3D backup-top.o + common-obj-y +=3D stream.o =20 nfs.o-libs :=3D $(LIBNFS_LIBS) --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1568990029; cv=none; d=zoho.com; s=zohoarc; b=dueF6B1BfQd4dM05P5UlrU8SlcwsrhvM7sLM4Q/jl4J23bsxof+MaBvTF61xTp5GE284V4x+ZsZ7ax+dnGLP2TMuHfcLLdCfNEZSDjDymQJf4PT0wNATO9KJW39mwki3lOxQtUdmJwh0jaKC3DzEPbBdNJH6i5BRHa0CWnQZKnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568990029; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=XFVYb9JM4Fnq1+TiP5q0F/QGzNVP7taV+ZzORFSaUL8=; b=h6yfK7GZhfNy0cTRskFcUqaSFjD3LE6WSjPwuy20BslG/m3qG7KKxHnG7HVcrcDpIKoU9RwMOJNEyKcNQHN+PSeMWvMl59W9s+D9DUUlhHIO/0KTWeuaWz/wkwbPx9f0DK9z7mhNizSvpF8HD9H2+I6hz3vnxiZZi8Nr0LtVcb4= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1568990029000780.4452086853997; Fri, 20 Sep 2019 07:33:49 -0700 (PDT) Received: from localhost ([::1]:60266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJyk-0006Su-RM for importer@patchew.org; Fri, 20 Sep 2019 10:33:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33100) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iBJnH-0005SV-Fc for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:22:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iBJn7-0001AQ-10 for qemu-devel@nongnu.org; Fri, 20 Sep 2019 10:21:55 -0400 Received: from relay.sw.ru ([185.231.240.75]:43832) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iBJmk-0000jQ-FL; Fri, 20 Sep 2019 10:21:23 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iBJmO-0006b5-To; Fri, 20 Sep 2019 17:21:01 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH v13 15/15] block/backup: use backup-top instead of write notifiers Date: Fri, 20 Sep 2019 17:20:56 +0300 Message-Id: <20190920142056.12778-16-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, wencongyang2@huawei.com, xiechanglong.d@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, jsnow@redhat.com, stefanha@redhat.com, den@openvz.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Drop write notifiers and use filter node instead. =3D Changes =3D 1. Add filter-node-name argument for backup qmp api. We have to do it in this commit, as 257 needs to be fixed. 2. There are no more write notifiers here, so is_write_notifier parameter is dropped from block-copy paths. 3. Intersecting requests handling changed, now synchronization between backup-top, backup and guest writes are all done in block/block-copy.c and works as follows: On copy operation, we work only with dirty areas. If bits are dirty it means that there are no requests intersecting with this area. We clear dirty bits and take bdrv range lock (bdrv_co_try_lock) on this area to prevent further operations from interaction with guest (only with guest, as neither backup nor backup-top will touch non-dirty area). If copy-operation failed we set dirty bits back together with releasing the lock. The actual difference with old scheme is that on guest writes we don't lock the whole region but only dirty-parts, and to be more precise: only dirty-part we are currently operate on. In old scheme guest write to non-dirty area (which may be safely ignored by backup) may wait for intersecting request, touching some other area which is dirty. 4. To sync with in-flight requests at job finish we now have drained removing of the filter, we don't need rw-lock. =3D Notes =3D Note the consequence of three objects appearing: backup-top, backup job and block-copy-state: 1. We want to insert backup-top before job creation, to behave similar with mirror and commit, where job is started upon filter. 2. We also have to create block-copy-state after filter injection, as we don't want its source child be replaced by filter. Instead we want to keep BCS.source to be real source node, as we want to use bdrv_co_try_lock in CBW operations and it can't be used on filter, as on filter we already have in-flight (write) request from upper layer. So, we firstly create inject backup-top, then create job and BCS. BCS is the latest just to not create extra variable for it. Finally we set bcs for backup-top filter. =3D Iotest changes =3D 56: op-blocker doesn't shoot now, as we set it on source, but then check on filter, when trying to start second backup. To keep the test we instead can catch another collision: both jobs will get 'drive0' job-id, as job-id parameter is unspecified. To prevent interleaving with file-posix locks (as they are dependent on config) let's use another target for second backup. Also, it's obvious now that we'd like to drop this op-blocker at all and add a test-case for two backups from one node (to different destinations) actually works. But not in these series. 257: The test wants to emulate guest write during backup. They should go to filter node, not to original source node, of course. Therefore we need to specify filter node name and use it. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- qapi/block-core.json | 8 +- include/block/block-copy.h | 10 +- include/block/block_int.h | 1 + block/backup-top.c | 14 +- block/backup.c | 112 +++----------- block/block-copy.c | 45 ++++-- block/replication.c | 2 +- blockdev.c | 1 + tests/qemu-iotests/056 | 8 +- tests/qemu-iotests/257 | 7 +- tests/qemu-iotests/257.out | 306 ++++++++++++++++++------------------- 11 files changed, 237 insertions(+), 277 deletions(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index e6edd641f1..b5cd00c361 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -1391,6 +1391,11 @@ # list without user intervention. # Defaults to true. (Since 2.12) # +# @filter-node-name: the node name that should be assigned to the +# filter driver that the backup job inserts into the gr= aph +# above node specified by @drive. If this option is not= given, +# a node name is autogenerated. (Since: 4.2) +# # Note: @on-source-error and @on-target-error only affect background # I/O. If an error occurs during a guest write request, the device's # rerror/werror actions will be used. @@ -1404,7 +1409,8 @@ '*compress': 'bool', '*on-source-error': 'BlockdevOnError', '*on-target-error': 'BlockdevOnError', - '*auto-finalize': 'bool', '*auto-dismiss': 'bool' } } + '*auto-finalize': 'bool', '*auto-dismiss': 'bool', + '*filter-node-name': 'str' } } =20 ## # @DriveBackup: diff --git a/include/block/block-copy.h b/include/block/block-copy.h index 54f90d0c9a..bd813280f0 100644 --- a/include/block/block-copy.h +++ b/include/block/block-copy.h @@ -20,6 +20,14 @@ typedef void (*ProgressBytesCallbackFunc)(int64_t bytes, void *opaque); typedef void (*ProgressResetCallbackFunc)(void *opaque); typedef struct BlockCopyState { + /* + * block-copy shares WRITE permission on source, but it relies on user= to + * guarantee that nobody is touching dirty areas. + * + * For backup job this is guaranteed by backup-top filter, which don't= share + * WRITE permission and calls block_copy on any write, so it will hand= le + * dirty areas by itself. + */ BlockBackend *source; BlockBackend *target; BdrvDirtyBitmap *copy_bitmap; @@ -71,6 +79,6 @@ int64_t block_copy_reset_unallocated(BlockCopyState *s, int64_t offset, int64_t *count); =20 int coroutine_fn block_copy(BlockCopyState *s, int64_t start, uint64_t byt= es, - bool *error_is_read, bool is_write_notifier); + bool *error_is_read); =20 #endif /* BLOCK_COPY_H */ diff --git a/include/block/block_int.h b/include/block/block_int.h index b59011ca97..5fd4f17d93 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1200,6 +1200,7 @@ BlockJob *backup_job_create(const char *job_id, Block= DriverState *bs, BdrvDirtyBitmap *sync_bitmap, BitmapSyncMode bitmap_mode, bool compress, + const char *filter_node_name, BlockdevOnError on_source_error, BlockdevOnError on_target_error, int creation_flags, diff --git a/block/backup-top.c b/block/backup-top.c index 0991b64759..7534d1f3dc 100644 --- a/block/backup-top.c +++ b/block/backup-top.c @@ -49,15 +49,11 @@ static coroutine_fn int backup_top_co_preadv( static coroutine_fn int backup_top_cbw(BlockDriverState *bs, uint64_t offs= et, uint64_t bytes) { - /* - * Here we'd like to use block_copy(), but it needs some additional - * synchronization mechanism to prevent intersecting guest writes duri= ng - * copy operation. The will appear in further commit (it should be done - * together with moving backup to using of backup-top and to the same - * synchronization mechanism), and for now it is a TODO. - */ - - abort(); + BDRVBackupTopState *s =3D bs->opaque; + uint64_t end =3D QEMU_ALIGN_UP(offset + bytes, s->bcs->cluster_size); + uint64_t off =3D QEMU_ALIGN_DOWN(offset, s->bcs->cluster_size); + + return block_copy(s->bcs, off, end - off, NULL); } =20 static int coroutine_fn backup_top_co_pdiscard(BlockDriverState *bs, diff --git a/block/backup.c b/block/backup.c index 4613b8c88d..7a669605e4 100644 --- a/block/backup.c +++ b/block/backup.c @@ -2,6 +2,7 @@ * QEMU backup * * Copyright (C) 2013 Proxmox Server Solutions + * Copyright (c) 2019 Virtuozzo International GmbH. * * Authors: * Dietmar Maurer (dietmar@proxmox.com) @@ -27,17 +28,13 @@ #include "qemu/bitmap.h" #include "qemu/error-report.h" =20 -#define BACKUP_CLUSTER_SIZE_DEFAULT (1 << 16) +#include "block/backup-top.h" =20 -typedef struct CowRequest { - int64_t start_byte; - int64_t end_byte; - QLIST_ENTRY(CowRequest) list; - CoQueue wait_queue; /* coroutines blocked on this request */ -} CowRequest; +#define BACKUP_CLUSTER_SIZE_DEFAULT (1 << 16) =20 typedef struct BackupBlockJob { BlockJob common; + BlockDriverState *backup_top; BlockDriverState *source_bs; =20 BdrvDirtyBitmap *sync_bitmap; @@ -46,55 +43,15 @@ typedef struct BackupBlockJob { BitmapSyncMode bitmap_mode; BlockdevOnError on_source_error; BlockdevOnError on_target_error; - CoRwlock flush_rwlock; uint64_t len; uint64_t bytes_read; int64_t cluster_size; - NotifierWithReturn before_write; - QLIST_HEAD(, CowRequest) inflight_reqs; =20 BlockCopyState *bcs; } BackupBlockJob; =20 static const BlockJobDriver backup_job_driver; =20 -/* See if in-flight requests overlap and wait for them to complete */ -static void coroutine_fn wait_for_overlapping_requests(BackupBlockJob *job, - int64_t start, - int64_t end) -{ - CowRequest *req; - bool retry; - - do { - retry =3D false; - QLIST_FOREACH(req, &job->inflight_reqs, list) { - if (end > req->start_byte && start < req->end_byte) { - qemu_co_queue_wait(&req->wait_queue, NULL); - retry =3D true; - break; - } - } - } while (retry); -} - -/* Keep track of an in-flight request */ -static void cow_request_begin(CowRequest *req, BackupBlockJob *job, - int64_t start, int64_t end) -{ - req->start_byte =3D start; - req->end_byte =3D end; - qemu_co_queue_init(&req->wait_queue); - QLIST_INSERT_HEAD(&job->inflight_reqs, req, list); -} - -/* Forget about a completed request */ -static void cow_request_end(CowRequest *req) -{ - QLIST_REMOVE(req, list); - qemu_co_queue_restart_all(&req->wait_queue); -} - static void backup_progress_bytes_callback(int64_t bytes, void *opaque) { BackupBlockJob *s =3D opaque; @@ -113,49 +70,23 @@ static void backup_progress_reset_callback(void *opaqu= e) =20 static int coroutine_fn backup_do_cow(BackupBlockJob *job, int64_t offset, uint64_t bytes, - bool *error_is_read, - bool is_write_notifier) + bool *error_is_read) { - CowRequest cow_request; int ret =3D 0; int64_t start, end; /* bytes */ =20 - qemu_co_rwlock_rdlock(&job->flush_rwlock); - start =3D QEMU_ALIGN_DOWN(offset, job->cluster_size); end =3D QEMU_ALIGN_UP(bytes + offset, job->cluster_size); =20 trace_backup_do_cow_enter(job, start, offset, bytes); =20 - wait_for_overlapping_requests(job, start, end); - cow_request_begin(&cow_request, job, start, end); - - ret =3D block_copy(job->bcs, start, end - start, error_is_read, - is_write_notifier); - - cow_request_end(&cow_request); + ret =3D block_copy(job->bcs, start, end - start, error_is_read); =20 trace_backup_do_cow_return(job, offset, bytes, ret); =20 - qemu_co_rwlock_unlock(&job->flush_rwlock); - return ret; } =20 -static int coroutine_fn backup_before_write_notify( - NotifierWithReturn *notifier, - void *opaque) -{ - BackupBlockJob *job =3D container_of(notifier, BackupBlockJob, before_= write); - BdrvTrackedRequest *req =3D opaque; - - assert(req->bs =3D=3D job->source_bs); - assert(QEMU_IS_ALIGNED(req->offset, BDRV_SECTOR_SIZE)); - assert(QEMU_IS_ALIGNED(req->bytes, BDRV_SECTOR_SIZE)); - - return backup_do_cow(job, req->offset, req->bytes, NULL, true); -} - static void backup_cleanup_sync_bitmap(BackupBlockJob *job, int ret) { BdrvDirtyBitmap *bm; @@ -205,6 +136,7 @@ static void backup_clean(Job *job) { BackupBlockJob *s =3D container_of(job, BackupBlockJob, common.job); =20 + bdrv_backup_top_drop(s->backup_top); block_copy_state_free(s->bcs); } =20 @@ -271,8 +203,7 @@ static int coroutine_fn backup_loop(BackupBlockJob *job) if (yield_and_check(job)) { goto out; } - ret =3D backup_do_cow(job, offset, - job->cluster_size, &error_is_read, false); + ret =3D backup_do_cow(job, offset, job->cluster_size, &error_i= s_read); if (ret < 0 && backup_error_action(job, error_is_read, -ret) = =3D=3D BLOCK_ERROR_ACTION_REPORT) { @@ -316,14 +247,8 @@ static int coroutine_fn backup_run(Job *job, Error **e= rrp) BackupBlockJob *s =3D container_of(job, BackupBlockJob, common.job); int ret =3D 0; =20 - QLIST_INIT(&s->inflight_reqs); - qemu_co_rwlock_init(&s->flush_rwlock); - backup_init_copy_bitmap(s); =20 - s->before_write.notify =3D backup_before_write_notify; - bdrv_add_before_write_notifier(s->source_bs, &s->before_write); - if (s->sync_mode =3D=3D MIRROR_SYNC_MODE_TOP) { int64_t offset =3D 0; int64_t count; @@ -361,12 +286,6 @@ static int coroutine_fn backup_run(Job *job, Error **e= rrp) } =20 out: - notifier_with_return_remove(&s->before_write); - - /* wait until pending backup_do_cow() calls have completed */ - qemu_co_rwlock_wrlock(&s->flush_rwlock); - qemu_co_rwlock_unlock(&s->flush_rwlock); - return ret; } =20 @@ -424,6 +343,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDr= iverState *bs, MirrorSyncMode sync_mode, BdrvDirtyBitmap *sync_bitmap, BitmapSyncMode bitmap_mode, bool compress, + const char *filter_node_name, BlockdevOnError on_source_error, BlockdevOnError on_target_error, int creation_flags, @@ -434,6 +354,7 @@ BlockJob *backup_job_create(const char *job_id, BlockDr= iverState *bs, BackupBlockJob *job =3D NULL; int64_t cluster_size; BdrvRequestFlags write_flags; + BlockDriverState *backup_top =3D NULL; =20 assert(bs); assert(target); @@ -498,13 +419,20 @@ BlockJob *backup_job_create(const char *job_id, Block= DriverState *bs, goto error; } =20 + backup_top =3D bdrv_backup_top_append(bs, filter_node_name, errp); + if (!backup_top) { + goto error; + } + /* job->len is fixed, so we can't allow resize */ - job =3D block_job_create(job_id, &backup_job_driver, txn, bs, 0, BLK_P= ERM_ALL, + job =3D block_job_create(job_id, &backup_job_driver, txn, backup_top, + 0, BLK_PERM_ALL, speed, creation_flags, cb, opaque, errp); if (!job) { goto error; } =20 + job->backup_top =3D backup_top; job->source_bs =3D bs; job->on_source_error =3D on_source_error; job->on_target_error =3D on_target_error; @@ -538,6 +466,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDr= iverState *bs, =20 job->cluster_size =3D cluster_size; =20 + bdrv_backup_top_set_bcs(backup_top, job->bcs); + /* Required permissions are already taken by block-copy-state target */ block_job_add_bdrv(&job->common, "target", target, 0, BLK_PERM_ALL, &error_abort); @@ -552,6 +482,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDr= iverState *bs, if (job) { backup_clean(&job->common.job); job_early_fail(&job->common.job); + } else if (backup_top) { + bdrv_backup_top_drop(backup_top); } =20 return NULL; diff --git a/block/block-copy.c b/block/block-copy.c index 3fc9152853..55bc360d22 100644 --- a/block/block-copy.c +++ b/block/block-copy.c @@ -114,22 +114,26 @@ fail: static int coroutine_fn block_copy_with_bounce_buffer(BlockCopyState *s, int64_t start, int64_t end, - bool is_write_notifi= er, bool *error_is_read, void **bounce_buffer) { int ret; - int nbytes; - int read_flags =3D is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; + int nbytes =3D MIN(s->cluster_size, s->len - start); + void *lock =3D bdrv_co_try_lock(blk_bs(s->source), start, nbytes); + + /* + * Function must be called only on full-dirty region, so nobody touchi= ng or + * touched these bytes. Therefore, we must successfully get lock. + */ + assert(lock); =20 assert(QEMU_IS_ALIGNED(start, s->cluster_size)); bdrv_reset_dirty_bitmap(s->copy_bitmap, start, s->cluster_size); - nbytes =3D MIN(s->cluster_size, s->len - start); if (!*bounce_buffer) { *bounce_buffer =3D blk_blockalign(s->source, s->cluster_size); } =20 - ret =3D blk_co_pread(s->source, start, nbytes, *bounce_buffer, read_fl= ags); + ret =3D blk_co_pread(s->source, start, nbytes, *bounce_buffer, 0); if (ret < 0) { trace_block_copy_with_bounce_buffer_read_fail(s, start, ret); if (error_is_read) { @@ -148,9 +152,14 @@ static int coroutine_fn block_copy_with_bounce_buffer(= BlockCopyState *s, goto fail; } =20 + bdrv_co_unlock(lock); + return nbytes; + fail: bdrv_set_dirty_bitmap(s->copy_bitmap, start, s->cluster_size); + bdrv_co_unlock(lock); + return ret; =20 } @@ -161,30 +170,37 @@ fail: */ static int coroutine_fn block_copy_with_offload(BlockCopyState *s, int64_t start, - int64_t end, - bool is_write_notifier) + int64_t end) { int ret; int nr_clusters; int nbytes; - int read_flags =3D is_write_notifier ? BDRV_REQ_NO_SERIALISING : 0; + void *lock; =20 assert(QEMU_IS_ALIGNED(s->copy_range_size, s->cluster_size)); assert(QEMU_IS_ALIGNED(start, s->cluster_size)); nbytes =3D MIN(s->copy_range_size, MIN(end, s->len) - start); + lock =3D bdrv_co_try_lock(blk_bs(s->source), start, nbytes); + /* + * Function must be called only on full-dirty region, so nobody touchi= ng or + * touched these bytes. Therefore, we must successfully get lock. + */ + assert(lock); + nr_clusters =3D DIV_ROUND_UP(nbytes, s->cluster_size); bdrv_reset_dirty_bitmap(s->copy_bitmap, start, s->cluster_size * nr_clusters); ret =3D blk_co_copy_range(s->source, start, s->target, start, nbytes, - read_flags, s->write_flags); + 0, s->write_flags); if (ret < 0) { trace_block_copy_with_offload_fail(s, start, ret); bdrv_set_dirty_bitmap(s->copy_bitmap, start, s->cluster_size * nr_clusters); - return ret; } =20 - return nbytes; + bdrv_co_unlock(lock); + + return ret < 0 ? ret : nbytes; } =20 /* @@ -259,8 +275,7 @@ int64_t block_copy_reset_unallocated(BlockCopyState *s, =20 int coroutine_fn block_copy(BlockCopyState *s, int64_t start, uint64_t bytes, - bool *error_is_read, - bool is_write_notifier) + bool *error_is_read) { int ret =3D 0; int64_t end =3D bytes + start; /* bytes */ @@ -305,15 +320,13 @@ int coroutine_fn block_copy(BlockCopyState *s, trace_block_copy_process(s, start); =20 if (s->use_copy_range) { - ret =3D block_copy_with_offload(s, start, dirty_end, - is_write_notifier); + ret =3D block_copy_with_offload(s, start, dirty_end); if (ret < 0) { s->use_copy_range =3D false; } } if (!s->use_copy_range) { ret =3D block_copy_with_bounce_buffer(s, start, dirty_end, - is_write_notifier, error_is_read, &bounce_buf= fer); } if (ret < 0) { diff --git a/block/replication.c b/block/replication.c index 936b2f8b5a..99532ce521 100644 --- a/block/replication.c +++ b/block/replication.c @@ -543,7 +543,7 @@ static void replication_start(ReplicationState *rs, Rep= licationMode mode, =20 s->backup_job =3D backup_job_create( NULL, s->secondary_disk->bs, s->hidden_dis= k->bs, - 0, MIRROR_SYNC_MODE_NONE, NULL, 0, false, + 0, MIRROR_SYNC_MODE_NONE, NULL, 0, false, = NULL, BLOCKDEV_ON_ERROR_REPORT, BLOCKDEV_ON_ERROR_REPORT, JOB_INTERNAL, backup_job_completed, bs, NULL, &local_err= ); diff --git a/blockdev.c b/blockdev.c index fbef6845c8..f89e48fc79 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3601,6 +3601,7 @@ static BlockJob *do_backup_common(BackupCommon *backu= p, job =3D backup_job_create(backup->job_id, bs, target_bs, backup->speed, backup->sync, bmap, backup->bitmap_mode, backup->compress, + backup->filter_node_name, backup->on_source_error, backup->on_target_error, job_flags, NULL, NULL, txn, errp); diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056 index 98c55d8e5a..f39287c162 100755 --- a/tests/qemu-iotests/056 +++ b/tests/qemu-iotests/056 @@ -133,6 +133,7 @@ class BackupTest(iotests.QMPTestCase): self.vm =3D iotests.VM() self.test_img =3D img_create('test') self.dest_img =3D img_create('dest') + self.dest_img2 =3D img_create('dest2') self.ref_img =3D img_create('ref') self.vm.add_drive(self.test_img) self.vm.launch() @@ -141,6 +142,7 @@ class BackupTest(iotests.QMPTestCase): self.vm.shutdown() try_remove(self.test_img) try_remove(self.dest_img) + try_remove(self.dest_img2) try_remove(self.ref_img) =20 def hmp_io_writes(self, drive, patterns): @@ -253,9 +255,9 @@ class BackupTest(iotests.QMPTestCase): res =3D self.vm.qmp('query-block-jobs') self.assert_qmp(res, 'return[0]/status', 'concluded') # Leave zombie job un-dismissed, observe a failure: - res =3D self.qmp_backup_and_wait(serror=3D"Node 'drive0' is busy: = block device is in use by block job: backup", + res =3D self.qmp_backup_and_wait(serror=3D"Job ID 'drive0' already= in use", device=3D'drive0', format=3Diotests= .imgfmt, - sync=3D'full', target=3Dself.dest_i= mg, + sync=3D'full', target=3Dself.dest_i= mg2, auto_dismiss=3DFalse) self.assertEqual(res, False) # OK, dismiss the zombie. @@ -265,7 +267,7 @@ class BackupTest(iotests.QMPTestCase): self.assert_qmp(res, 'return', []) # Ensure it's really gone. self.qmp_backup_and_wait(device=3D'drive0', format=3Diotests.imgfm= t, - sync=3D'full', target=3Dself.dest_img, + sync=3D'full', target=3Dself.dest_img2, auto_dismiss=3DFalse) =20 def dismissal_failure(self, dismissal_opt): diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index de8b45f094..a9828251cf 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -190,6 +190,7 @@ def blockdev_backup(vm, device, target, sync, **kwargs): device=3Ddevice, target=3Dtarget, sync=3Dsync, + filter_node_name=3D'backup-top', **kwargs) return result =20 @@ -216,7 +217,7 @@ def backup(drive, n, filepath, sync, **kwargs): job_id=3Djob_id, **kwargs) return job_id =20 -def perform_writes(drive, n): +def perform_writes(drive, n, filter_node_name=3DNone): log("--- Write #{:d} ---\n".format(n)) for pattern in GROUPS[n].patterns: cmd =3D "write -P{:s} 0x{:07x} 0x{:x}".format( @@ -224,7 +225,7 @@ def perform_writes(drive, n): pattern.offset, pattern.size) log(cmd) - log(drive.vm.hmp_qemu_io(drive.node, cmd)) + log(drive.vm.hmp_qemu_io(filter_node_name or drive.node, cmd)) bitmaps =3D drive.vm.query_bitmaps() log({'bitmaps': bitmaps}, indent=3D2) log('') @@ -355,7 +356,7 @@ def test_bitmap_sync(bsync_mode, msync_mode=3D'bitmap',= failure=3DNone): """Issue writes while the job is open to test bitmap divergenc= e.""" # Note: when `failure` is 'intermediate', this isn't called. log('') - bitmaps =3D perform_writes(drive0, 2) + bitmaps =3D perform_writes(drive0, 2, filter_node_name=3D'back= up-top') # Named bitmap (static, should be unchanged) ebitmap.compare(vm.get_bitmap(drive0.node, 'bitmap0', bitmaps=3Dbitmaps)) diff --git a/tests/qemu-iotests/257.out b/tests/qemu-iotests/257.out index ec7e25877b..64dd460055 100644 --- a/tests/qemu-iotests/257.out +++ b/tests/qemu-iotests/257.out @@ -30,7 +30,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -78,7 +78,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -92,7 +92,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "back= up_1", "sync": "bitmap", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "filter-node-na= me": "backup-top", "job-id": "backup_1", "sync": "bitmap", "target": "backu= p_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -205,7 +205,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -219,7 +219,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "back= up_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "filter-node-na= me": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "backu= p_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -290,7 +290,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -338,7 +338,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -354,7 +354,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "back= up_1", "sync": "bitmap", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "filter-node-na= me": "backup-top", "job-id": "backup_1", "sync": "bitmap", "target": "backu= p_target_1"}} {"return": {}} {"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} {"data": {"device": "backup_1", "error": "Input/output error", "len": 3932= 16, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} @@ -416,7 +416,7 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -430,7 +430,7 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "back= up_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "filter-node-na= me": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "backu= p_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -501,7 +501,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -549,7 +549,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -563,7 +563,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "back= up_1", "sync": "bitmap", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "filter-node-na= me": "backup-top", "job-id": "backup_1", "sync": "bitmap", "target": "backu= p_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -676,7 +676,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -690,7 +690,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "job-id": "back= up_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "never", "device": "drive0", "filter-node-na= me": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "backu= p_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -761,7 +761,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -809,7 +809,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -823,7 +823,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "bitmap", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_1", "sync": "bitmap", "target": "= backup_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -936,7 +936,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -950,7 +950,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "= backup_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -1021,7 +1021,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -1069,7 +1069,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -1085,7 +1085,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "bitmap", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_1", "sync": "bitmap", "target": "= backup_target_1"}} {"return": {}} {"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} {"data": {"device": "backup_1", "error": "Input/output error", "len": 3932= 16, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} @@ -1147,7 +1147,7 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -1161,7 +1161,7 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "= backup_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -1232,7 +1232,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -1280,7 +1280,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -1294,7 +1294,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "bitmap", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_1", "sync": "bitmap", "target": "= backup_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -1407,7 +1407,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -1421,7 +1421,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "= backup_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -1492,7 +1492,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -1540,7 +1540,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -1554,7 +1554,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "bitmap", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_1", "sync": "bitmap", "target": "back= up_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -1667,7 +1667,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -1681,7 +1681,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "back= up_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -1752,7 +1752,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -1800,7 +1800,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -1816,7 +1816,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "bitmap", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_1", "sync": "bitmap", "target": "back= up_target_1"}} {"return": {}} {"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} {"data": {"device": "backup_1", "error": "Input/output error", "len": 3932= 16, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} @@ -1878,7 +1878,7 @@ expecting 13 dirty sectors; have 13. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -1892,7 +1892,7 @@ expecting 13 dirty sectors; have 13. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "back= up_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -1963,7 +1963,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -2011,7 +2011,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -2025,7 +2025,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "bitmap", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_1", "sync": "bitmap", "target": "back= up_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -2138,7 +2138,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -2152,7 +2152,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "back= up_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -2223,7 +2223,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -2271,7 +2271,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -2285,7 +2285,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "full", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_1", "sync": "full", "target": "ba= ckup_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -2398,7 +2398,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -2412,7 +2412,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "= backup_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -2483,7 +2483,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -2531,7 +2531,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -2547,7 +2547,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "full", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_1", "sync": "full", "target": "ba= ckup_target_1"}} {"return": {}} {"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} {"data": {"device": "backup_1", "error": "Input/output error", "len": 6710= 8864, "offset": 983040, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_= COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} @@ -2609,7 +2609,7 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -2623,7 +2623,7 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "= backup_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -2694,7 +2694,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -2742,7 +2742,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -2756,7 +2756,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "full", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_1", "sync": "full", "target": "ba= ckup_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -2869,7 +2869,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -2883,7 +2883,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "= backup_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -2954,7 +2954,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -3002,7 +3002,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -3016,7 +3016,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "full", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_1", "sync": "full", "target": "backup= _target_1"}} {"return": {}} =20 --- Write #2 --- @@ -3129,7 +3129,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -3143,7 +3143,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "back= up_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -3214,7 +3214,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -3262,7 +3262,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -3278,7 +3278,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "full", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_1", "sync": "full", "target": "backup= _target_1"}} {"return": {}} {"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} {"data": {"device": "backup_1", "error": "Input/output error", "len": 6710= 8864, "offset": 983040, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_= COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} @@ -3340,7 +3340,7 @@ expecting 1014 dirty sectors; have 1014. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -3354,7 +3354,7 @@ expecting 1014 dirty sectors; have 1014. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "back= up_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -3425,7 +3425,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -3473,7 +3473,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -3487,7 +3487,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "full", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_1", "sync": "full", "target": "backup= _target_1"}} {"return": {}} =20 --- Write #2 --- @@ -3600,7 +3600,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -3614,7 +3614,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "back= up_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -3685,7 +3685,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -3733,7 +3733,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -3747,7 +3747,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "top", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_1", "sync": "top", "target": "bac= kup_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -3860,7 +3860,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -3874,7 +3874,7 @@ expecting 15 dirty sectors; have 15. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "= backup_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -3945,7 +3945,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -3993,7 +3993,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -4009,7 +4009,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "top", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_1", "sync": "top", "target": "bac= kup_target_1"}} {"return": {}} {"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} {"data": {"device": "backup_1", "error": "Input/output error", "len": 4587= 52, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} @@ -4071,7 +4071,7 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -4085,7 +4085,7 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "= backup_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -4156,7 +4156,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -4204,7 +4204,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -4218,7 +4218,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_1", "sync": "top", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_1", "sync": "top", "target": "bac= kup_target_1"}} {"return": {}} =20 --- Write #2 --- @@ -4331,7 +4331,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -4345,7 +4345,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "job-id": = "backup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "on-success", "device": "drive0", "filter-no= de-name": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "= backup_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -4416,7 +4416,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -4464,7 +4464,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -4478,7 +4478,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "top", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_1", "sync": "top", "target": "backup_= target_1"}} {"return": {}} =20 --- Write #2 --- @@ -4591,7 +4591,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -4605,7 +4605,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "back= up_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -4676,7 +4676,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -4724,7 +4724,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -4740,7 +4740,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "top", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_1", "sync": "top", "target": "backup_= target_1"}} {"return": {}} {"data": {"action": "report", "device": "backup_1", "operation": "read"}, = "event": "BLOCK_JOB_ERROR", "timestamp": {"microseconds": "USECS", "seconds= ": "SECS"}} {"data": {"device": "backup_1", "error": "Input/output error", "len": 4587= 52, "offset": 65536, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COM= PLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} @@ -4802,7 +4802,7 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -4816,7 +4816,7 @@ expecting 14 dirty sectors; have 14. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "back= up_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -4887,7 +4887,7 @@ write -P0x76 0x3ff0000 0x10000 {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_0", "sync": "full", "target": "ref_target_0"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_0", "sync": "full", "target"= : "ref_target_0"}} {"return": {}} {"data": {"device": "ref_backup_0", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -4935,7 +4935,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_1", "sync": "full", "target": "ref_target_1"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_1", "sync": "full", "target"= : "ref_target_1"}} {"return": {}} {"data": {"device": "ref_backup_1", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -4949,7 +4949,7 @@ expecting 6 dirty sectors; have 6. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_1", "sync": "top", "target": "backup_target_1"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_1", "sync": "top", "target": "backup_= target_1"}} {"return": {}} =20 --- Write #2 --- @@ -5062,7 +5062,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "ref_backup_2", "sync": "full", "target": "ref_target_2"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "ref_backup_2", "sync": "full", "target"= : "ref_target_2"}} {"return": {}} {"data": {"device": "ref_backup_2", "len": 67108864, "offset": 67108864, "= speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": = {"microseconds": "USECS", "seconds": "SECS"}} =20 @@ -5076,7 +5076,7 @@ expecting 12 dirty sectors; have 12. OK! {"execute": "job-dismiss", "arguments": {"id": "bdc-fmt-job"}} {"return": {}} {} -{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "job-id": "bac= kup_2", "sync": "bitmap", "target": "backup_target_2"}} +{"execute": "blockdev-backup", "arguments": {"auto-finalize": false, "bitm= ap": "bitmap0", "bitmap-mode": "always", "device": "drive0", "filter-node-n= ame": "backup-top", "job-id": "backup_2", "sync": "bitmap", "target": "back= up_target_2"}} {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup_2"}} {"return": {}} @@ -5139,155 +5139,155 @@ qemu_img compare "TEST_DIR/PID-img" "TEST_DIR/PID= -fbackup2" =3D=3D> Identical, OK! =20 -- Sync mode incremental tests -- =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "job-id": "api_job", "sync": "incremental", "target": "= backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", = "sync": "incremental", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'incremental' sync mode"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "job-id": "api_job", "sync": "incremental", "target": "back= up_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "syn= c": "incremental", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'incremental' sync mode"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backu= p_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync= ": "incremental", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'incremental' sync mode"}} =20 -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "api_job", "sync": "incremental", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "api_job", "sync": "incremental", "targe= t": "backup_target"}} {"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'incremental' sync mode"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "in= cremental", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "filter-node-name": "backup-top"= , "job-id": "api_job", "sync": "incremental", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "increm= ental", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "filter-node-name": "backup-top", "j= ob-id": "api_job", "sync": "incremental", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap sync mode must be 'on-= success' when using sync mode 'incremental'"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "increme= ntal", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "filter-node-name": "backup-top", "jo= b-id": "api_job", "sync": "incremental", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap sync mode must be 'on-= success' when using sync mode 'incremental'"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "job-id": "api_job", "sync": "incremental", "target": "backup= _target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync"= : "incremental", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "always", "device": "drive0", "job-id": "api_job", "sync": "incremen= tal", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "always", "device": "drive0", "filter-node-name": "backup-top", "job= -id": "api_job", "sync": "incremental", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap sync mode must be 'on-= success' when using sync mode 'incremental'"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "never", "device": "drive0", "job-id": "api_job", "sync": "increment= al", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "never", "device": "drive0", "filter-node-name": "backup-top", "job-= id": "api_job", "sync": "incremental", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap sync mode must be 'on-= success' when using sync mode 'incremental'"}} =20 -- Sync mode bitmap tests -- =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backu= p_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", = "sync": "bitmap", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'bitmap' sync mode"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_ta= rget"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "syn= c": "bitmap", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'bitmap' sync mode"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_tar= get"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync= ": "bitmap", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'bitmap' sync mode"}} =20 -{"execute": "blockdev-backup", "arguments": {"device": "drive0", "job-id":= "api_job", "sync": "bitmap", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"device": "drive0", "filter-n= ode-name": "backup-top", "job-id": "api_job", "sync": "bitmap", "target": "= backup_target"}} {"error": {"class": "GenericError", "desc": "must provide a valid bitmap n= ame for 'bitmap' sync mode"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "bi= tmap", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "filter-node-name": "backup-top"= , "job-id": "api_job", "sync": "bitmap", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "bitmap= ", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "filter-node-name": "backup-top", "j= ob-id": "api_job", "sync": "bitmap", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "bitmap"= , "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "filter-node-name": "backup-top", "jo= b-id": "api_job", "sync": "bitmap", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_targ= et"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync"= : "bitmap", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device"= : "drive0", "job-id": "api_job", "sync": "bitmap", "target": "backup_target= "}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device"= : "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync": = "bitmap", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap sync mode must be give= n when providing a bitmap"}} =20 -- Sync mode full tests -- =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_= target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", = "sync": "full", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_targ= et"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "syn= c": "full", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_targe= t"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync= ": "full", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "fu= ll", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "filter-node-name": "backup-top"= , "job-id": "api_job", "sync": "full", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "full",= "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "filter-node-name": "backup-top", "j= ob-id": "api_job", "sync": "full", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "full", = "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "filter-node-name": "backup-top", "jo= b-id": "api_job", "sync": "full", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "job-id": "api_job", "sync": "full", "target": "backup_target= "}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync"= : "full", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "never", "device": "drive0", "job-id": "api_job", "sync": "full", "t= arget": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "never", "device": "drive0", "filter-node-name": "backup-top", "job-= id": "api_job", "sync": "full", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap sync mode 'never' has = no meaningful effect when combined with sync mode 'full'"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device"= : "drive0", "job-id": "api_job", "sync": "full", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device"= : "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync": = "full", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap sync mode must be give= n when providing a bitmap"}} =20 -- Sync mode top tests -- =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_t= arget"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", = "sync": "top", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_targe= t"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "syn= c": "top", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target= "}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync= ": "top", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "to= p", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "filter-node-name": "backup-top"= , "job-id": "api_job", "sync": "top", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "top", = "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "filter-node-name": "backup-top", "j= ob-id": "api_job", "sync": "top", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "top", "= target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "filter-node-name": "backup-top", "jo= b-id": "api_job", "sync": "top", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target"= }} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync"= : "top", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "never", "device": "drive0", "job-id": "api_job", "sync": "top", "ta= rget": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "never", "device": "drive0", "filter-node-name": "backup-top", "job-= id": "api_job", "sync": "top", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap sync mode 'never' has = no meaningful effect when combined with sync mode 'top'"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device"= : "drive0", "job-id": "api_job", "sync": "top", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device"= : "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync": = "top", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap sync mode must be give= n when providing a bitmap"}} =20 -- Sync mode none tests -- =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_= target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "on-success", = "device": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", = "sync": "none", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_targ= et"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "always", "dev= ice": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "syn= c": "none", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_targe= t"}} +{"execute": "blockdev-backup", "arguments": {"bitmap-mode": "never", "devi= ce": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync= ": "none", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Cannot specify bitmap sync mo= de without a bitmap"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "no= ne", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "on-success", "device": "drive0", "filter-node-name": "backup-top"= , "job-id": "api_job", "sync": "none", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "job-id": "api_job", "sync": "none",= "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "always", "device": "drive0", "filter-node-name": "backup-top", "j= ob-id": "api_job", "sync": "none", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "job-id": "api_job", "sync": "none", = "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "bitma= p-mode": "never", "device": "drive0", "filter-node-name": "backup-top", "jo= b-id": "api_job", "sync": "none", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target= "}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap404", "devic= e": "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync"= : "none", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap 'bitmap404' could not = be found"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "on-success", "device": "drive0", "job-id": "api_job", "sync": "none= ", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "on-success", "device": "drive0", "filter-node-name": "backup-top", = "job-id": "api_job", "sync": "none", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "sync mode 'none' does not pro= duce meaningful bitmap outputs"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "always", "device": "drive0", "job-id": "api_job", "sync": "none", "= target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "always", "device": "drive0", "filter-node-name": "backup-top", "job= -id": "api_job", "sync": "none", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "sync mode 'none' does not pro= duce meaningful bitmap outputs"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "never", "device": "drive0", "job-id": "api_job", "sync": "none", "t= arget": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "bitmap-= mode": "never", "device": "drive0", "filter-node-name": "backup-top", "job-= id": "api_job", "sync": "none", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "sync mode 'none' does not pro= duce meaningful bitmap outputs"}} =20 -{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device"= : "drive0", "job-id": "api_job", "sync": "none", "target": "backup_target"}} +{"execute": "blockdev-backup", "arguments": {"bitmap": "bitmap0", "device"= : "drive0", "filter-node-name": "backup-top", "job-id": "api_job", "sync": = "none", "target": "backup_target"}} {"error": {"class": "GenericError", "desc": "Bitmap sync mode must be give= n when providing a bitmap"}} =20 --=20 2.21.0 From nobody Sun Apr 28 21:47:54 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=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1569430820; cv=none; d=zoho.com; s=zohoarc; b=TKoeEJnMgEgB5pgr0Bi5MEAV051x3SH+JNRQkIVntApMbTXnxsF+cdfmWA9IAEvPJK1z999vAZmj351mIw04YTtJ4yqcRHO66d4ELJGmqZlgAoN+DVFFd7NlZJ+a0qFwzpNqeuYgkBqa4MJ8dNJeAhiio+9HDs+vmmuhV17bjQg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569430820; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=eo+yRvnsTYaHwKKdLAUdo0LeJMv26lu0VmgDGzFpTvo=; b=Gw4rP7u0X+y75sLtkvWblWHSelVH9IVBxjYQuGskrfk37JsL1G9tt+pEMBrdpb7lmqt8QkrEge6b89inwgvpRZF/XDcaA/Bt0bbJtJKdy8TcvJsfI3DxcRq3GM41KB9Wfnz4g72UOm/3NPv07MUJesN0yoRJTfP4WXIbW7INw10= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569430820274697.9908833727234; Wed, 25 Sep 2019 10:00:20 -0700 (PDT) Received: from localhost ([::1]:55082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDAe9-0002GT-VX for importer@patchew.org; Wed, 25 Sep 2019 13:00:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47252) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDAcs-0001Yr-Ta for qemu-devel@nongnu.org; Wed, 25 Sep 2019 12:58:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDAcr-0007Uk-Ou for qemu-devel@nongnu.org; Wed, 25 Sep 2019 12:58:50 -0400 Received: from relay.sw.ru ([185.231.240.75]:49928) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iDAcp-0007Tv-2N; Wed, 25 Sep 2019 12:58:47 -0400 Received: from [10.94.3.0] (helo=kvm.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iDAcm-0007W3-3e; Wed, 25 Sep 2019 19:58:44 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Subject: [PATCH 16/15 v13] block/block-copy: fix block_copy Date: Wed, 25 Sep 2019 19:58:08 +0300 Message-Id: <20190925165808.20950-1-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190920142056.12778-1-vsementsov@virtuozzo.com> References: <20190920142056.12778-1-vsementsov@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" block_copy_reset_unallocated may yield, and during this yield someone may handle dirty bits which we are handling. Calling block_copy_with_* functions on non-dirty region will lead to copying updated data, which is wrong. To be sure, that we call block_copy_with_* functions on dirty region, check dirty bitmap _after_ block_copy_reset_unallocated. Signed-off-by: Vladimir Sementsov-Ogievskiy --- Hi! Suddenly I understand that there is a bug in [PATCH v13 15/15] block/backup: use backup-top instead of write notifiers (queued at Max's https://git.xanclic.moe/XanClic/qemu/commits/branch/block) And here is a fix, which may be squashed to "block/backup: use backup-top instead of write notifiers" commit. block/block-copy.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/block/block-copy.c b/block/block-copy.c index 55bc360d22..430b88124f 100644 --- a/block/block-copy.c +++ b/block/block-copy.c @@ -292,7 +292,7 @@ int coroutine_fn block_copy(BlockCopyState *s, assert(QEMU_IS_ALIGNED(end, s->cluster_size)); =20 while (start < end) { - int64_t dirty_end; + int64_t chunk_end =3D end, dirty_end; =20 if (!bdrv_dirty_bitmap_get(s->copy_bitmap, start)) { trace_block_copy_skip(s, start); @@ -300,12 +300,6 @@ int coroutine_fn block_copy(BlockCopyState *s, continue; /* already copied */ } =20 - dirty_end =3D bdrv_dirty_bitmap_next_zero(s->copy_bitmap, start, - (end - start)); - if (dirty_end < 0) { - dirty_end =3D end; - } - if (s->skip_unallocated) { ret =3D block_copy_reset_unallocated(s, start, &status_bytes); if (ret =3D=3D 0) { @@ -313,20 +307,37 @@ int coroutine_fn block_copy(BlockCopyState *s, start +=3D status_bytes; continue; } + + if (!bdrv_dirty_bitmap_get(s->copy_bitmap, start)) { + /* + * Someone already handled this bit during yield in + * block_copy_reset_unallocated. + */ + trace_block_copy_skip(s, start); + start +=3D s->cluster_size; + continue; + } + /* Clamp to known allocated region */ - dirty_end =3D MIN(dirty_end, start + status_bytes); + chunk_end =3D MIN(chunk_end, start + status_bytes); + } + + dirty_end =3D bdrv_dirty_bitmap_next_zero(s->copy_bitmap, start, + chunk_end - start); + if (dirty_end >=3D 0) { + chunk_end =3D MIN(chunk_end, dirty_end); } =20 trace_block_copy_process(s, start); =20 if (s->use_copy_range) { - ret =3D block_copy_with_offload(s, start, dirty_end); + ret =3D block_copy_with_offload(s, start, chunk_end); if (ret < 0) { s->use_copy_range =3D false; } } if (!s->use_copy_range) { - ret =3D block_copy_with_bounce_buffer(s, start, dirty_end, + ret =3D block_copy_with_bounce_buffer(s, start, chunk_end, error_is_read, &bounce_buf= fer); } if (ret < 0) { --=20 2.21.0