From nobody Thu Nov 14 07:05:27 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=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1621521453; cv=pass; d=zohomail.com; s=zohoarc; b=XDe/H9mAo5My+oC6PIMWqK/ELzHLMej2vKp/FlWvvqDcHQ3colCrGSAReJa++tEZSbeJPzXQY5y/NXDNvoLddl5gi/MS/wx39EnKFMFOzMzHh9tzyqXQhsCvakBEpGe1Qog6o9jS8mcVtEOZRQhcq3MC61MbLFgL9gnZxe2+UBg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621521453; 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=RhWlz9yilLiDMYDqzAyAN8F6GaiOvA3qOvlK9zLe/Bw=; b=JYlWWdmb5ht8qMGMuXr56/ABD9dVqIgO9lgXqnox2Gp5BtihJM6AB5U4WGtImSESNWzFwQRnCwHvNL3KZTj7U6wNJS+w5aY6P++c1Sq9NqbC4HZtI/ep7TGyDbTxOqgW5Rj9iAw8Jv/xEFbTTF0gDJ99D1A02ZPuYGh21t4CFuE= 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=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine 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 1621521453285517.7869408192689; Thu, 20 May 2021 07:37:33 -0700 (PDT) Received: from localhost ([::1]:57224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljjno-0003DB-1e for importer@patchew.org; Thu, 20 May 2021 10:37:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljjZz-0006WI-2Z; Thu, 20 May 2021 10:23:15 -0400 Received: from mail-eopbgr00114.outbound.protection.outlook.com ([40.107.0.114]:2638 helo=EUR02-AM5-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 1ljjZw-0005ik-CW; Thu, 20 May 2021 10:23:14 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AM6PR08MB3544.eurprd08.prod.outlook.com (2603:10a6:20b:4e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4129.25; Thu, 20 May 2021 14:22:49 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::b403:c1a9:6bb7:133%7]) with mapi id 15.20.4129.033; Thu, 20 May 2021 14:22:49 +0000 Received: from localhost.localdomain (185.215.60.197) by HE1P190CA0034.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:52::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4150.23 via Frontend Transport; Thu, 20 May 2021 14:22:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NkUM/kORkqyV3mnziivybqephtBYGjVELRqC1EkK9M3qk7dyjI23CfgzoaTY1hWOaXtBMiFmSaSuvLlw1WaWknOdI6dvkUcScqc0hNFnuHoV4kmxxDLQ8tU1y2EnQxu+pFAP67+oGmPXfNzWorDIFCPMIG5BZmAfSnprmn1HK1pOxZPVFt+MggYN+F/4XrqMMYiweuxxlgSdrPkGbxZOsqq83211hsxHyAmoBMIwT5KNu5KK6h7CJalanSw2SczIoaJpmp88DFsz3LsJyzAYxKOmvlxcrO0pZDwWK/Nay27TwButIBTyMuUd+cvFnUwlDZgJSANI6B3tvvTiVXMiiQ== 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=RhWlz9yilLiDMYDqzAyAN8F6GaiOvA3qOvlK9zLe/Bw=; b=BO1bIylnYfJHsB4wjaeZiANenTQVRMzRnK0x0ZglFWTXpZxtordLDbW/ZNM+e2UaHU/PaseXMCnMh2NpY+1JD4l7rL+KEdKT/QlCaU1zRn6KUt4OCxtJZSB4zqKTU8mXuW9wPQH4+Pyk+lFA2JxMMz2vnYCcXdCmAyTe86wA5fRsVL7k/aZHvYVFPsydeLq1SSYVYE8YQ5AA/Nakh9NWUlHqiEZ9PduhPi5SyuDeeRMPfmwJQ5I7o09u6WjlJcoOUpDcI75NKYJEqsviaUv5qLI6ZDsUheqF0gY5vXKfe5AJxg3FFa3qJ4AvHMt4bZNISxhDBVx1wsd15FCFZStsBw== 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=RhWlz9yilLiDMYDqzAyAN8F6GaiOvA3qOvlK9zLe/Bw=; b=eddNyjT1jt+mtc3n3M5nwGV+FzL66EsAVIuEakDvcQISa2Ch0UKOKqWL8PjORKpZrcw/EQrDWfCAx0PqbQ5zqWojH9jpSQleWFbLoaRMQoYcckTKecK29uz6ec7MQNawTWn3MWKkHf7A4E4q7nWQ6E/ckkM2X89I9PFhE+Nx+RQ= 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, mreitz@redhat.com, kwolf@redhat.com, den@openvz.org Subject: [PATCH v2 19/33] block/copy-before-write: initialize block-copy bitmap Date: Thu, 20 May 2021 17:21:51 +0300 Message-Id: <20210520142205.607501-20-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210520142205.607501-1-vsementsov@virtuozzo.com> References: <20210520142205.607501-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.197] X-ClientProxiedBy: HE1P190CA0034.EURP190.PROD.OUTLOOK.COM (2603:10a6:7:52::23) 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: 35eae6b5-8b03-490a-5a65-08d91b9abf38 X-MS-TrafficTypeDiagnostic: AM6PR08MB3544: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:194; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3VSeTEn6Uida/ePTq7Fb4XSWj/EyP8c/DwvpIcxLsnM0gIyaDXuMPI+Nf/8IDmsYIpJS76NOwuprg6c5mweIZ92yQVclKSZSFecpN/pGzRCWaIBuzyeSnrZOKlMwU4Akuc9JmsVEwGkv7rjPW3nPUHkhAD8lzRo9gzrgSx0/vbcn7/YXoYMymJ4kUlsOYqXSdzI2U1tGoIck57LTzPG1pYf7oNmXWnAGb78xkXlePodoe5oeBfxj/mN8S4ruRwbhiUEXUi+TvSp/GS00TV27FmhFVzzg6fvoy95Iu2fnN87VBxwS5H1GAqnMSSm2tCZ+14L16shfh3tXKBs2rKUTaRYWcZabW8b10K4g3wJ8VsDG4QaGxRx+9CgdbGwy6XmKOJk59kU5HSUoLX/l34iAOMHQkTKw2yaD7ac8ccXEmtsdwVA5MdK2LHc5yX8lQK5WAT+b5Q41DlQnEVLflBLsf8ubyIaZDfwKKuMWvfYp2ahDKuZla4gBUfFw+pnT9U7Zau9gHy2B7P0siaj4MEVsi0zeyxwXcWzlkj09S/wBEZWRPEA3Z3b+ZccwwBjF59liKRdI0MQ3vN8M+BPfSQ0TEKwgER/4w0d0ugk+m72cYQuQ6qCKMRBeQkUSGwt/lIX54VlzSw+Do2LWuMxNevMSKXhw201qfT8Z/CbBDavnltRf081YKiKA7HkGpFgCYV1f 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)(366004)(346002)(376002)(39840400004)(396003)(136003)(478600001)(1076003)(52116002)(86362001)(66946007)(66476007)(4326008)(6486002)(2616005)(66556008)(956004)(26005)(5660300002)(6506007)(107886003)(7416002)(38100700002)(2906002)(8936002)(36756003)(186003)(316002)(6916009)(6512007)(8676002)(16526019)(6666004)(38350700002)(83380400001)(69590400013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?s9XbLtyhnr4hkPwlwWmiwgpvF4dhfYubQSN/LK5YHIO+LlRTbvn6QDYcGMAC?= =?us-ascii?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95+q9QpPeAkI19g?= =?us-ascii?Q?Nm4Rhyf4sKc9jokiAgZpNHQH4CD/Q+FZCTG/Fw4ffqVUQrxcPEFaTB0/B0D0?= =?us-ascii?Q?VPOKelI75HhvBAO8ciuSCV6cBxSYj5YYqUzoG8NchCDCpgQUlMRxiXLuPju6?= =?us-ascii?Q?7lX2xFpqXUpyVnd2Ah430oWsMU3YRzIWZo+aoBtDyn0DN2zTZMif1KU/ksAE?= =?us-ascii?Q?9pMn7ZpoBSUKLwb8CSD00agN3xS7wm/I2BAcwh5C2HA1icZygPSTy7XNowBu?= =?us-ascii?Q?PhYzRY8v6nspDHWeHgaVN9nV0+0Ux4nycuoQCWshiEbc8nV1Ctx5u+qezLCI?= =?us-ascii?Q?F6HcHsJ2avMmd7SXY3TIgGZ9uZX3a1r66uHg+O82T+JJPPCzbXD1PW2esDld?= =?us-ascii?Q?F5yg9YfvxxXmxPyXfIiVcjca?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35eae6b5-8b03-490a-5a65-08d91b9abf38 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2021 14:22:49.8164 (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: K/fuSlGhqUza/Dd60NC0yoGoryE0TPGcVTqpIyXI9pzO6eMBsmzmNq7UCWjQut+8oyLK45OyjPwudm43rUdnu5UMgIYkl/yq9SH3z+jOD2Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3544 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.0.114; envelope-from=vsementsov@virtuozzo.com; helo=EUR02-AM5-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) 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 af17149f22..14652ac98a 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 e889af7b80..ba2466a328 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; bool compress; =20 bs->file =3D bdrv_open_child(NULL, options, "file", bs, &child_of_bds, @@ -184,6 +185,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