From nobody Thu Nov 14 17:46:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1629795515; cv=pass; d=zohomail.com; s=zohoarc; b=LkvbagmxF1sR46MkAoUZegBs1SVwdUpU4C4Fgr/jkoIQAa2ITEBdjq5fg6ak2QuCreLaxy728rUHZsRPfX8JrIGRCsm3n21WtcQcdY9yedKjEZ0n9X1sTF0AB0CEXN+3lesFMaWfPYQyetqQ6GlV5DDFy/w6P4nCirPfNvBv7Kk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629795515; 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; bh=Vfqnsp7hFTsT4dqLeM7DgaoDGD1UcygGkQvv816ee3Q=; b=B9AwmfkOBF/E5bhSX4Qk9Xg5Yl4CjipBqXnScJhlFxEZqNswlEb1cM3w0hxqk+/6aj11ayfWq+DU1uAPPf9lXL28XM2Qo8f8Deuz1RUrO+AMrv80AhUpQLEBPLMRhdo6RmdJshJ3T+xk1yMrPuUPejIbVVtxfTBwKs8zs+u9dFk= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162979551593523.704062787016937; Tue, 24 Aug 2021 01:58:35 -0700 (PDT) Received: from localhost ([::1]:34712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mISGQ-0008Aj-RT for importer@patchew.org; Tue, 24 Aug 2021 04:58:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIRyQ-00037k-Q9; Tue, 24 Aug 2021 04:39:58 -0400 Received: from mail-eopbgr50092.outbound.protection.outlook.com ([40.107.5.92]:39447 helo=EUR03-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIRyO-0007cr-Vp; Tue, 24 Aug 2021 04:39:58 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM7PR08MB5333.eurprd08.prod.outlook.com (2603:10a6:20b:104::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Tue, 24 Aug 2021 08:39:44 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::3c5e:7829:362d:1423]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::3c5e:7829:362d:1423%2]) with mapi id 15.20.4436.025; Tue, 24 Aug 2021 08:39:44 +0000 Received: from localhost.localdomain (185.215.60.249) by HE1PR05CA0178.eurprd05.prod.outlook.com (2603:10a6:3:f8::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 08:39:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KL45JxMMyPceO9BOQUrVv0ju/g1UQSHbwQfC4QWKij5SMSyPtbnXlz4Vv56D/2eNf3x3T14Ws6o8jCdpEtzXhnEtKQl1K9RPE+tdy4ElrA7ndLzIp8siNgjFG1Gis43DUd+ZRT+GlWeGJFeUInN+GmrOGYRm8MLltoISXf9aHAoHQ9vi5dBOepdRox6B+576WQ2rumo+JieGISb1Zmg+laXOG6YN412WSfucNhN7o1rwwufYv4PyMkfiFOaGb9tefqcu1I2zkD9xR1yrSJ6VAgbqTfTBA7kuCLBSutagqQLsueyq+tDl8W68KaNjK0CU6n8UtuO9W4dNI10K4Fjjag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Vfqnsp7hFTsT4dqLeM7DgaoDGD1UcygGkQvv816ee3Q=; b=DSm1nOCdIfWvMF3LL+D5zTfmv0Xn36HjRjnLw+EQEBCyBpgdwkogT8pxKQHe4mjF4Bt1q0+TxIWX4FdgSpOIQOxiNCehsLrLyx/JRVptjUl5Pe9lpcADq2bUwBZ3AecKqsjdIM49Q1iblJxOdNotEX5oT3x0rW1KLFxHoCyzTK1eGw5jXA2IpvH13uZtH5uNzoOl1RE4qlp+I1EQXnc5L2cOf5/GCjdA1n2BNmzkFm9Zys703VO475Ka1fXIaN7I0oHyjiO1qwT4Av2mUgtdBv60tc7Jov74yBsKpbfg+v3JFnVbF3NDgJxlxf17VjJajjUPNbrWPFnwT5PjtUVQ1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Vfqnsp7hFTsT4dqLeM7DgaoDGD1UcygGkQvv816ee3Q=; b=eoshUdlInOgXhzzT2v76PWYa02zaM7KaUSu4mm7mlWPGHz1jlFgOCBorKSa5x8JX0wPYADIWkTDWYoaJwLy6g5SP34WLRx13cXEzkrw8/iMgPhuFBHKSvkRJTYyj/HkzOll/HUizTKBHjXnrio29OhFEP1bshbisszTgROfry5g= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, eblake@redhat.com, armbru@redhat.com, crosa@redhat.com, ehabkost@redhat.com, berrange@redhat.com, pbonzini@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, hreitz@redhat.com, kwolf@redhat.com, Max Reitz Subject: [PATCH v8 19/34] block/copy-before-write: initialize block-copy bitmap Date: Tue, 24 Aug 2021 11:38:41 +0300 Message-Id: <20210824083856.17408-20-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210824083856.17408-1-vsementsov@virtuozzo.com> References: <20210824083856.17408-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: HE1PR05CA0178.eurprd05.prod.outlook.com (2603:10a6:3:f8::26) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c8fb34c0-d425-4ba0-1761-08d966dab8d1 X-MS-TrafficTypeDiagnostic: AM7PR08MB5333: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:194; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zfHUi2liljEAPfb0wBUWkGIjq+hA/FVvV0mx9T3NZRkmsSRNj41iBD4fZDxlGXLhgWLbfjP3pDf6Zi9SiZlFXDMsn6aFScD+1+rD+qRvcxAZIftdlVHbXM2UfKXaPhPMVdYwvzmWkGjbNtKloEx9APVt8Mb5ZmMlxEQdgBlP+igHMKYcT5s/86i/EJJJTFexmA9uZy7QWSHRjtgAezGoYAU0rKUG9g6tYrP+ih/9NAITTQ9rUzm1l4Gcq5oJjrPXWBansx3ciDIPts7XtVNuXE79tqfgiCYlzzotH6gmtLHfpSzgkgEQG/vUY2hxH2Xlwi/Eqfehyq9+Knz+W0zd4P/OGRCGnGJLAf5L27m5WjfCbR5SxbVMPxxZcmuBYOHBCmIsZQlQNcZEqZUL6OeXaVwtYRD1B7YEXOTxcAl1BRCGickZOHXvUQBNHCcYtawxg1TUTrSEwEKnigUXL6XXVLq1Dn/Md9/onwGRSzIAXBuTlXhKaIAKuS2bFCTMiX/jagRGeUOp4otgE2HXeJ2vtenclBBRc/PbTsdhHn6pZmg5N4eUTXwrDAtJTgFDZP/NQhNnVFKMKaapDx0drwJz0QBg7WFj3WJYNxHomQAskvI4wQiRzAIAXMa8S6qgqxBX2+fMjTufwbgclFLVaoUzqNIwodLe5UfpaCw4/s1udTm5+AGjinSd5Dctn/AaZtzbZwJsIQBmrf3DNZzXCDY7Zw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39840400004)(346002)(396003)(366004)(376002)(38100700002)(8676002)(4326008)(86362001)(52116002)(38350700002)(83380400001)(7416002)(8936002)(6916009)(5660300002)(478600001)(26005)(1076003)(6506007)(6512007)(186003)(2616005)(66556008)(36756003)(66476007)(66946007)(956004)(316002)(6486002)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?oBOc/k5SEh+1zl6ZOSngnRj0IH0wg2gS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-ascii?Q?tKCEKLjfeCyc/z9ftKt7FSZFk49ZpdueSvgft/LbZhdTvq0JYXQ4eIlo9Eb3?= =?us-ascii?Q?UcgAgDOV50as+W4gQxW3qXxHEIZfv4zZuhRGMEuzQmZQuu55XgbqoqIIa33C?= =?us-ascii?Q?/OqYyfQwyL9uBa8VxMF0QOsd2W9JdLwab8dCikZUDSj+qFOa/Q+PWnd14JwJ?= =?us-ascii?Q?n9zNO5EprHZ3sU33bOq9mEiZ215VQuQhG23fDoa+8XAfnXDDt2qF3xnlzrl5?= =?us-ascii?Q?jb9AvOrTdXraQQTbYcmYYZkX9met5oBefHGEShfFEESGvuVmXWByyzz1gW1Q?= =?us-ascii?Q?E0zaPXs82X48zqmcT42nZWexsihV42iWuJ69kGvUDPOgPgVqZGcyTJ6OvwLk?= =?us-ascii?Q?v2CrtpS1uv/6UMayE3l6fOSTCMHAriBW0D1cGQYf9RjKO2ysgUr/o4m0Au5D?= =?us-ascii?Q?k+cCEieMjDgeadGqkqPL9jwQ?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8fb34c0-d425-4ba0-1761-08d966dab8d1 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2021 08:39:44.0464 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BvsWXTq6d/3DdqtMDL9Mcf9IBCDRmzpnrj2syFa8EmQDaW43DEEOx/xQ9Q1F8t2zzAiwlHn5uJ3V2hBuZMaPD1LRPse/HONqYWBvrHPW/sY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5333 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=40.107.5.92; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-VE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1629795516269100001 Content-Type: text/plain; charset="utf-8" We are going to publish copy-before-write filter to be used in separate of backup. Future step would support bitmap for the filter. But let's start from full set bitmap. We have to modify backup, as bitmap is first initialized by copy-before-write filter, and then backup modifies it. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- block/backup.c | 16 +++++++--------- block/copy-before-write.c | 4 ++++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/block/backup.c b/block/backup.c index 4869f1e5da..687d2882bc 100644 --- a/block/backup.c +++ b/block/backup.c @@ -233,18 +233,16 @@ static void backup_init_bcs_bitmap(BackupBlockJob *jo= b) BdrvDirtyBitmap *bcs_bitmap =3D block_copy_dirty_bitmap(job->bcs); =20 if (job->sync_mode =3D=3D MIRROR_SYNC_MODE_BITMAP) { + bdrv_clear_dirty_bitmap(bcs_bitmap, NULL); ret =3D bdrv_dirty_bitmap_merge_internal(bcs_bitmap, job->sync_bit= map, NULL, true); assert(ret); - } else { - if (job->sync_mode =3D=3D MIRROR_SYNC_MODE_TOP) { - /* - * We can't hog the coroutine to initialize this thoroughly. - * Set a flag and resume work when we are able to yield safely. - */ - block_copy_set_skip_unallocated(job->bcs, true); - } - bdrv_set_dirty_bitmap(bcs_bitmap, 0, job->len); + } else if (job->sync_mode =3D=3D MIRROR_SYNC_MODE_TOP) { + /* + * We can't hog the coroutine to initialize this thoroughly. + * Set a flag and resume work when we are able to yield safely. + */ + block_copy_set_skip_unallocated(job->bcs, true); } =20 estimate =3D bdrv_get_dirty_count(bcs_bitmap); diff --git a/block/copy-before-write.c b/block/copy-before-write.c index 1cefcade78..2efe098aae 100644 --- a/block/copy-before-write.c +++ b/block/copy-before-write.c @@ -147,6 +147,7 @@ static void cbw_child_perm(BlockDriverState *bs, BdrvCh= ild *c, static int cbw_init(BlockDriverState *bs, QDict *options, Error **errp) { BDRVCopyBeforeWriteState *s =3D bs->opaque; + BdrvDirtyBitmap *copy_bitmap; =20 bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY, @@ -174,6 +175,9 @@ static int cbw_init(BlockDriverState *bs, QDict *option= s, Error **errp) return -EINVAL; } =20 + copy_bitmap =3D block_copy_dirty_bitmap(s->bcs); + bdrv_set_dirty_bitmap(copy_bitmap, 0, bdrv_dirty_bitmap_size(copy_bitm= ap)); + return 0; } =20 --=20 2.29.2