From nobody Wed Nov 27 15:42:49 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=1697725667; cv=pass; d=zohomail.com; s=zohoarc; b=AMSAuiGkKwoMxn7T8WdO2gZlo8Yy6YOo8Z7UB32p4dJtxFCziCldm+qkWajCrRxvGkxVa5E4B31CB3Xo9WqU5wrSBgHZoUzP3GDfQWb7sNQc0w6AzZ2pNULQ6O2gVL5IHdzRFCulKpZtwOxlfTaKEvQ6od1Z1LvIvMaJ+mLipA0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697725667; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OdxpCNCExdXIlG04uu3xZW928uMbN8sgV7wRopaQH2w=; b=IXDPBuPySM+qdJj3mJz3IuWHLc+CjCAeHW+SrodweWeA6NQJXA22j4Yg3diGL1HAGBqtzMlMgLsv8jKLJzYnyuZAglS0Nl7EOGhelj1qBvw/GENt64bcyBZAq2qWVDzFmhMq0AM0+lz+3koxIMW88jdgBhRv/Ay6Z5HIf/pYjl4= 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 1697725667218281.52481819607874; Thu, 19 Oct 2023 07:27:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScP-0005i4-9g; Thu, 19 Oct 2023 08:59:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScM-0005gT-AP; Thu, 19 Oct 2023 08:59:14 -0400 Received: from mail-vi1eur05on20717.outbound.protection.outlook.com ([2a01:111:f400:7d00::717] helo=EUR05-VI1-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 1qtScK-0002ew-Pj; Thu, 19 Oct 2023 08:59:14 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS4PR08MB7997.eurprd08.prod.outlook.com (2603:10a6:20b:580::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21; Thu, 19 Oct 2023 12:59:04 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AJI2jEnoYoWiuG79dZ7/gCU6wQbEytF8OAP3XKRkqQzf/NIdmN5ZbVt3yw75fZCLEFDJdwOL6bf7oWx4/n1ehBRCzXY5tz3d62xAnIVpiPaKt4vKNAjy/fklOVowTR6J2AnPp/8LrcvRBc/n5w5j8ONAzrMCjehfslQc1Foee8hWzX5gK/fptBUR5bE3tu3XZ9IHUGXRwI6rL4sMc4wo7fDz2FdNfvwWxOCG2tWCnNiDz/QhQmpLwhI9aF1ZUN8v09HjEFKnIt45ZbmCkY5UTJJojJreeGX9IorZnjmGNy2ij8eZYMnM6SKQUPKeBFTX1MleVcShvBNmpSBpQyRbwQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OdxpCNCExdXIlG04uu3xZW928uMbN8sgV7wRopaQH2w=; b=kgs89uJ4RfmA3xLoPkHnmtf55w//ya1BEFiDCvPVj7Httbu+RiDJsTpkUqNgYdcey3XTcfE0GmJqGfcImiiWvsHMgoBbAtZmcqkiUkCn5GxdqRTgVgAO7vFKJejgl3xVfA8PwgV38ZrpGWnQQqNeLmge/I1HTjqAwin0gF1QhSjitdWTAAG2u6wCAO3H3d0dvF15ibMxZ7OLliY7U7dw0jW1Vjhj55vjzB/kgXdOxjqWMpxDZawheS+ahXo5TXCKtyYXV5+dEJOTQ3Y8p/GdnJJu2S5vxrqYPYUS1CgzF19r7PJZmDhoRWmYf8TCSYot18NbVQ/ik8ztCObZH4JIlA== 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=OdxpCNCExdXIlG04uu3xZW928uMbN8sgV7wRopaQH2w=; b=qpFts582Vt9cYvlqSSCXCkgqkG3VodJ4i5oJGhrtiuT3yfvslG8i+ZS/aR1nJitqM6e62gDfN9nJOPGSe1zKcq8sRFRlr2meVp8DC7W7btX0BPQfeRmw0eofWnCY7n2E4fUskh3qUlJ5haC4mIioJd0u5W3kHyalIj3POL1YEIvjB+FbPVca1OvzHO+NJU0oyEQ8dqRJ7RsQzu3c2XRS2ARq0hVefD5s9KGOBZGTKm9onmCNKmQnONXWhFTIIAMAshgYkjuOFncmy1t09wyD65ZzLbdPPKWmXx293OExNsv1BunHpU+RiylRf6wUjxITJOZV5JDV0Lu0EjBPcTAAUg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 01/20] parallels: Set s->used_bmap to NULL in parallels_free_used_bitmap() Date: Thu, 19 Oct 2023 14:58:35 +0200 Message-Id: <20231019125854.390385-2-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS4PR08MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: 13a3a482-e9d6-4110-d6b6-08dbd0a32bf7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TH+PBP9Sx8D7oqF5qjkrhSNvv0KnSJbiup88IUcgfY+a10FAcDxxPYMte6falMiw/UYCVZH7T/yD9YMpK/FYUI8IBti7TnoP1UAJR4CLM/nW++cUataWH5HdZta+BBXBJUdRcmAY1JFWonCtlmx8HtLW3r70FS1Totiz1FpMcUJR4ekZkGl9Xa7gOq9NOboqzPCSwnflscCmTYWsm/w35ginpBVqHHWlwOZ2USdRS2pyF09AfO+t+/0CB0jg55iZmOKmoEy54PaMC26w/PZQHw1ZTjnE5q3xmVBrEjskyc+9ObqmubA1BW0B8I34NBDZtFgY/jxtsM0GCHtaOYWPDftEtxqau840RLb+csEqleBGghRPA3rids71rsig9F5vNp3+/sD3/+JvSqnp0bSEaX6KI1S1OruMmtKjWriKJRQdjlU6Cj8Emaug0mykQJsmjWvPMoOUiuSnSF+QLN26UaKRBx9nC9dHZ8I07Y62N+hVEUEOTzPGSi6KDjRWxBYALiQO/Fv9Ii/KM0bhYhuSI42lX95P5IJIoAXLgdbFS4ACPHlH5/atJiXTIfgnGY7FFUJu1oiWtLaoMJhiASm9i7DFd/jlHDDPbQiynbf9Cfrkykc6LriVUXvGOy5kHgXx X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39850400004)(346002)(366004)(396003)(376002)(136003)(230922051799003)(451199024)(186009)(64100799003)(1800799009)(2906002)(4744005)(8936002)(52116002)(66476007)(6916009)(66946007)(41300700001)(316002)(86362001)(6512007)(66556008)(478600001)(6666004)(6486002)(6506007)(44832011)(8676002)(36756003)(4326008)(2616005)(1076003)(38100700002)(5660300002)(26005)(83380400001)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?lbDx6O6nECOvOH2EFYLhUiU62V42YFtcotFfU5I0nxArIoE3n/5A0DwMoNNA?= =?us-ascii?Q?t3z2ghV8MdkaJHF15v3xuOUG9kgQSPnT7DdOhviYJGporaq8AGrl8POtFpUn?= =?us-ascii?Q?s1wmljo7f/pfi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ascii?Q?6sX+BADzDc73s9DYYWuPye/msiA+JhxlpQ6FFiJblZdcfvjt9j2rDtFPRfW/?= =?us-ascii?Q?50E30JZtpJiJfeqz9HcUxu35sjcWEr+qZxv0CxgXHMZ5rUVIOK4Zq9rH1y+P?= =?us-ascii?Q?xBOC8QismysFIOaeraUKvaeApvlhVsoSZQ+FuR85iQuxgiRtxBxP+GsFbiez?= =?us-ascii?Q?a7iCGmv3qyHuCv/TIo20hskmAb0un7UPbtrcTzcWaTP8qsf4dZMis8ZrkIvC?= =?us-ascii?Q?8Ii++tWISwPj5+y/U+851bII/dpgfaQyjiG1EJZPYGe39IumxecQ/u+iCXYo?= =?us-ascii?Q?H2mS7VMMniqgblsSrqPZpzIZ36vI/UCSzfk4AEgnqoOdBBVh1p8N3zx/5Bwf?= =?us-ascii?Q?MkXx4B9NDzrnjRnLuaNS4Y5duy1iaks+WHqFEq4+Ms5FSUASVGAR3LoaIyIB?= =?us-ascii?Q?Ol+kFVT/V83SsTktXov7Gta+uZcb9fhoAiie4wMqVgn3Bp7BhRMdWSHjFgbF?= =?us-ascii?Q?U2h6z+GpU5ZwJQWIP0cu8DRthFbPkGo5VgoC6nqYlNYT695T+z2+PRFfIrbG?= =?us-ascii?Q?kGn1EyOKPPAaixug4E64JqPBewT1G6mAEeJO6FizLy5HgN3o6ja5ZWdxrqdc?= =?us-ascii?Q?R90675vXSXqES8lY0rw4mZE=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 13a3a482-e9d6-4110-d6b6-08dbd0a32bf7 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:04.1335 (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: Ka3KxhXNX761ucsDi8j/hh5OO/2rHUr6UG2/N8OAgd+zcP0eepDt8JMn29pXehwqPU0ZI8oX5eo92BR+t/OgVAxNlvmwD3MiUXDuCGdagQo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB7997 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=2a01:111:f400:7d00::717; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-VI1-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, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697725667636100001 Content-Type: text/plain; charset="utf-8" After used bitmap freeng s->used_bmap points to the freed memory. If we try to free used bitmap one more time it leads to double free error. Set s->used_bmap to NULL to exclude double free error. Signed-off-by: Alexander Ivanov --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallels.c index 6b46623241..ba1fdde259 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -244,6 +244,7 @@ static void parallels_free_used_bitmap(BlockDriverState= *bs) { BDRVParallelsState *s =3D bs->opaque; s->used_bmap_size =3D 0; + s->used_bmap =3D NULL; g_free(s->used_bmap); } =20 --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697720405; cv=pass; d=zohomail.com; s=zohoarc; b=VVYoaSRNeUXaAEoiOFYQ3AUBK7OtxLkXMJYrPX8kPUoKBJzysRGnKPkYrcqo6r0xsEtjJXib5klFIbtkduh4k3VkQaM1ZUc4ntVPh1/8S8UD5LZw8Tu4heqaxgrCyy8qh0p/DMaWehBVf5Ie0fuGlkq3XHgR0GHtFsjLdAAmBg4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697720405; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FfQacRtA+dxtvKqlu6oakpPJG5E5HyZ5RmdNS2Y8cKU=; b=YdWyfk3drZMnk2YpwbgUKtbE4HsPkvO0m+ujaT4+0yz7kzQIv+Un0Ekq20iahaswYkHJf2XyR94OePSpn+0zOEDfZDsfBRWkb0sbE0+HB/+Yfh9jnYaS1Usmak59arWbia7fJ41NompDtnPVV40y3OMkBGZIcUMA12/+oOq144o= 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 1697720405727895.4466887686556; Thu, 19 Oct 2023 06:00:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScL-0005ft-Po; Thu, 19 Oct 2023 08:59:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScJ-0005fR-VX; Thu, 19 Oct 2023 08:59:11 -0400 Received: from mail-vi1eur04on0703.outbound.protection.outlook.com ([2a01:111:f400:fe0e::703] helo=EUR04-VI1-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 1qtScH-0002f3-TW; Thu, 19 Oct 2023 08:59:11 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:05 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YFs7OFLlDBfbzSImuFVmnCB4k4L5UyePAH8xCZN9RxK0AiPak7Pot6yXRAM9nrsK95ssFvyMey1Vw0wu9W4dDSkIIxSU8TPWNlhp4y/fdvKTfs1FenyDeVttMNBXb8BuXKTfRsqq61ng6TV8ew0iNdIcHRMaqDeuX4Bev7jK7a5FfkEY+oD/sMHuuMo412AQYPCm88Yo0WOvE755hRe5DzbGrA2ex4qH2vHCqQ3khevs873tN/vAIbM0PAiA9Zop+d8A+qU+Wwax9H7CK2ariWuYiBBsHrm/HAxaNmzGc0yKXM7D/df/gH+/++3RE2mIQ84T9kcMFtUChJoWMxAy4A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FfQacRtA+dxtvKqlu6oakpPJG5E5HyZ5RmdNS2Y8cKU=; b=eRmdfATOVX2MvuGgZk5GMZk3mppnaBp2G2YtGzxZwg+Fgf4mc1Tn6OxM6zzcnbCN+qen340GMeWryUNR17fMeSoNYRr84hDFPY2WMSSl6PPJCOCLSG8YBpUk55wAZvRSy9NNUABddNXMO7wJEXTST/M4umvKVNdtJm/Ro8QkqSPzEffv3Itt2DieYjYwW2180H5ay+/Z5Sol/CvtBiypFKgJBpXw56WsZXQeC4x1IuNzM1nSWyDQveqUTryAI6LKCDcvff5Ws4ri+OYAhwBvloZoXfG2nxO8TAv87Ea/EXV4FfRZnWapSkRz6IjKP0aouvD2RpACWiTen1o8oqobLg== 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=FfQacRtA+dxtvKqlu6oakpPJG5E5HyZ5RmdNS2Y8cKU=; b=eDeyafSMqeg6gGjHHOC7haMGpxQNHNG3KGzbl+kfEoEwZpKdd66eCsw7UiObJOYLa6rWMQBO+1u0i4QjDaxKvx3WwATrRJ+93YFY1iYPpYxoWBSyko0HT/gj+SNtfgkJELxOswb4Sws2KQfGIujsu+GA/38vuoOVY9pXwtV69K0MLM+SU/T1RYJincw2fkxINFUFD3v+gUQ3KmRFzmW+KK+JXlnHgY+BvWVzojyf7tLAbaVWSn/BqM8Y47BIv+PDMbL4SduemoBRad4jQbogPouxGtKZ7k3O0BohnEztzm5tvfk0x+kHWGqsgymLWYcRXm5fk184G2OHG3rMLnTHZA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 02/20] parallels: Move inactivation code to a separate function Date: Thu, 19 Oct 2023 14:58:36 +0200 Message-Id: <20231019125854.390385-3-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: dd3eb9a0-963b-45c9-1cb7-08dbd0a32c82 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P4tSevXXGYYSU6e+fW0B/SgtFAiFrqUkj0Eaiou40h3BagBIXg5D/MLnlXNzs0SqDUaZ0QuOEDhpI/ZDmoUvUt39WqMwgSlNsJssWZ87ZrotGopfgOi3L479OQQe8s0m1mrVitcBBUE/np6re7KVrC39uc1Mm6xmobDXQNRQu2QaqlRDHYHs0X8rjAVz/eDjVplWKdcISpkSrMw9b0SEcf93FG5XBQahXwIaH9ufWYz0vL91t6yPL6Di+4kloWIwgu8dqJHRbD6ApDx5RHp3Tak0hwvTMCn3Q5kD7HrTSCxXAPZ0nLi52THQfpdf1DDlHS+/E8rSdopLG9BvqE181WpmCwA3ZTwKSrDVtQCWpjX+n+MHm5fKkRnd1BVqD8YQkO2lhoE/gL3hnz+JlCc4zpX/RMGDOfXKsm2ygQvKJY2L+w6gf8qXi18uwycTKNDfnDjjQlVzkOli5nq52eqRVJklkBxI99R4M1WisQYVxyM4e/tVwfhGopC8wBskmqVQ235quGw3UZRLLEI3W8VzkC9Gdnk8+tgBH/+o+64VWwYup/tZyAuYaw2gC89bk7d+bVThT+jCzcfArEXET/qNdWZP9u1J6drWXPStaExAEX70CBabepQx6FEon/xO4Nuu X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Y6Dx1QuVH6K1qplxe7RpPudxKBRsbLTQsdERx/2/0bx6Z77ROwDd8Vw+XOKI?= =?us-ascii?Q?Qo6Qgy6qXKqudiHyE2zediatHlFo9X3lQMUt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M5KvKJNR0njXp6I3irvTmAJ9lpRmCWGV9A5UScK?= =?us-ascii?Q?6MDWAf/tgk1RjHP3kOxTs/Fk+4C2VStRxdqHL2ExnPOnzuvyK7wGLxAf+PvD?= =?us-ascii?Q?HEDgSyjaCE+Mx+7lhN4ozZsq92ekPySoCd+iVq0MZigM9gHxaDZnzcWt5D84?= =?us-ascii?Q?vwqnQw2yNLfvuH0J/GZp4qRqBOu28ZHecXdRw+SHG8m6xn3Cjgc1vm0bXeMf?= =?us-ascii?Q?EceI1D1uhaqFcUgxp/isiBX4F2PnU25guGEKDvTjJvWblPpWUFF5/ULVsiJA?= =?us-ascii?Q?Dy2tIdWxv8tYWFllRYnUKIJPWKLEDbaZbRYy/eEUFTdEDOEh5eDBh/4R7Bcr?= =?us-ascii?Q?gDAo0MEZdkPaZ6Ec3gwbBtCB0n261njOUQFdw0gRHO6Xw6eOi7FijwB1zfmT?= =?us-ascii?Q?5QhFGJSumU/gktzWnuhzlHvE38+P9my7An8VVoonk6N3zuROnlVJgVWywEXU?= =?us-ascii?Q?B5dINiaEJk55UvnFkcdFWlOVEvebPNVbnz2MkpQOFw7Lem9nICd3jkDFe84Q?= =?us-ascii?Q?CF6hc/mKqHyD+IO6+l7uo+ib+VtNZyT84IkLunSJqH8zrltZPrMST+1EsWVU?= =?us-ascii?Q?ZN7/qK61kjZVTYoFMb21T9o4v8aFYJUIF+qPeZ10nWezsW8zW1v/4JTt9xjy?= =?us-ascii?Q?IEu9ppBdAPJ0MS8i65QxFPE=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: dd3eb9a0-963b-45c9-1cb7-08dbd0a32c82 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:04.9714 (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: VytNPPTsY3mnNFIKvwLpsrodxJrJuI6AuUYlFErOypbLz4CDHI4aOB84nYuLum1xxU5Mduk4KR7gNyF4oZ3iN43fP8Qb/RhpntRRdrY/sKw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:fe0e::703; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697720407370100006 Content-Type: text/plain; charset="utf-8" We are going to add parallels image extensions storage and need a separate function for inactivation code. Signed-off-by: Alexander Ivanov --- block/parallels.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index ba1fdde259..7eb92f87ab 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1430,18 +1430,27 @@ fail: return ret; } =20 +static int parallels_inactivate(BlockDriverState *bs) +{ + BDRVParallelsState *s =3D bs->opaque; + int ret; + + s->header->inuse =3D 0; + parallels_update_header(bs); + + /* errors are ignored, so we might as well pass exact=3Dtrue */ + ret =3D bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, true, + PREALLOC_MODE_OFF, 0, NULL); + + return ret; +} =20 static void parallels_close(BlockDriverState *bs) { BDRVParallelsState *s =3D bs->opaque; =20 if ((bs->open_flags & BDRV_O_RDWR) && !(bs->open_flags & BDRV_O_INACTI= VE)) { - s->header->inuse =3D 0; - parallels_update_header(bs); - - /* errors are ignored, so we might as well pass exact=3Dtrue */ - bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, true, - PREALLOC_MODE_OFF, 0, NULL); + parallels_inactivate(bs); } =20 parallels_free_used_bitmap(bs); @@ -1481,6 +1490,7 @@ static BlockDriver bdrv_parallels =3D { .bdrv_co_check =3D parallels_co_check, .bdrv_co_pdiscard =3D parallels_co_pdiscard, .bdrv_co_pwrite_zeroes =3D parallels_co_pwrite_zeroes, + .bdrv_inactivate =3D parallels_inactivate, }; =20 static void bdrv_parallels_init(void) --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697725669; cv=pass; d=zohomail.com; s=zohoarc; b=g7b3Dn7CMi+OyIXqyXKPtq3uabErZuEZC9L6AEHW6iwrRLhujYE9xB0GEgkdKwGgDEszVcQbs39AaNzKQw4LiPa9kNuinRpvzbffrWylitAQcABB//YtWDgDdKGRSCN4m4+zcsLB5PgtNYq476crQVYXarvev283ELaX+NPKix4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697725669; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2wmguTHr8AiAOvO1Cv4xcdIkU50krH8TmKkx+Ks4lSo=; b=HtYdbyCc1+EnVIGwPEPw5rOPjDWu5gFs2haTwrzDhAIU97KvWur8KzocSXl5OVqsQraG7Tik2TKRSjwdRNzU34UO8d1isPY6PiFHERS2I4i5ICZyvIErZdZB5A3VF0qmRDwmRYWk9smMwGxFX2/z5oi5s/KuqZhViHOVcF0i2OE= 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 1697725669826791.3847099639039; Thu, 19 Oct 2023 07:27:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScP-0005iC-FC; Thu, 19 Oct 2023 08:59:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScN-0005hd-Iv; Thu, 19 Oct 2023 08:59:15 -0400 Received: from mail-db8eur05on20725.outbound.protection.outlook.com ([2a01:111:f400:7e1a::725] helo=EUR05-DB8-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 1qtScL-0002g2-OT; Thu, 19 Oct 2023 08:59:15 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:05 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GhTMvcbxHAsjDdNXLDeam9p5Qy8vd1rFd8ua2ZtAxgPL0TAcFh2DNzHpXbhSkCVrA4kjcoMZOwXi3SKypc0VchrfpVaAACgrok05Ijxtf/xJ1ZjL3rZA5NJTACMD2uBume9KGkRXVNDzKfYEeV7NhON84wZoqF2iwIfu/fDGTwV4jvMnPUgFjutRX9HGJYhEEHuyHAylJggRpG5ckgDLeuk7p3j36iuuv+mR9eyaqdC6GOJRXPzKpoLsPxP4ojY/iK4I4jIjlrQBBs1A4ClZOO/E6WBuQCzMiophBVNP1wtiBkQKKjv2g1mCijryTJJePZKIv8CkJZRzRdv+xogbbQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2wmguTHr8AiAOvO1Cv4xcdIkU50krH8TmKkx+Ks4lSo=; b=kE1G3zZZAWnaffA1wJgFGmR11v1Y5+o+qErrAOrB/WDuE9KANbXOPlHBDtxrhpYkxMa2boTgTwlKBvql0dUnwgKhPviuLmRFHEaXR/+9RDpHzWy44r4xeiamaXT59gh95lYdSPsdZyLkjDz88Ta2Tzn8/DhaNu627InwmAXrU187mk33k24dvaJZfBXaBqMvGN1BRyB/5wrm3OJBiOaNXFReufsMDvmbcytuG4GqPBJAkt4IAlVQcnPp2S4zAbE3KLdPXlrA+k6h8E6RvYzpBjYP9O+toMaROfwEbebKW9IzhxuJ69G7L89Fo5AYjFUgO6wJ57iseH/aSzpIl28q+Q== 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=2wmguTHr8AiAOvO1Cv4xcdIkU50krH8TmKkx+Ks4lSo=; b=En9YMHYEywQ3/KF4JLFaO0si0Y1qrwPVyIvCouapczvhxcEnoE57xs+IB/KhzEYQjYCXUXT1gfjLhCJ3Y78kwmTAC2zdz3mBLIVqTGhs4+BNGDW9dNiYscQXAf5tUfUBhZNAWp3Kv3AIN5lEiIO9O4APwtcXMAzfcPpv4XsBr77gMvnODzuzoYrpEtgJ+TV3Q0zljwdk0Mr03+l1yQ2jbjK5MuKq8mi6Tu94Vyns+A3nvG61wL6CP1EeinyM9eXCNy/YhKVswmXcKIm/Yu0B7ks7Rimpv8/1CWNTshMl1xMli422eBwDNdpiUNEp6c5DrXZfifWWp4b9GDau33tEuA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 03/20] parallels: Add mark_unused() helper Date: Thu, 19 Oct 2023 14:58:37 +0200 Message-Id: <20231019125854.390385-4-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: 32f1e8ff-5254-424c-14c9-08dbd0a32cfe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M1KnUp0HEkA3Ys7kVoi2zwEdkLrg2yR7e8+5MX1FBvqWQ+QIjkVaVzb5xhQqQxLQotJDKEhT4gy+XTEK7+KTmFhpFIL6PMcYG+WIqblFQRR6RlEvgk4qFv48Jmy+5XbnYeAO+Y+EMecO9/7SQ/UU7N5rjpLF5jBhmcJtxE9fmWu+e+zYFy9vrj4qr2kNvkGKn/7EUSuWE/MhBKeYXuGsdrwOiwZgQTANCO4fUZBRAsD9g4nv9ddTC/5GCPhdvWU1niPJmvw+YwYgkmGbIGV0MWSCGkFwCOQGalSdGmdd7lxcgrli5ba++A6KmBY72owfU/OB000lQS1mQeh8Zzg7aaPhqCt8KGT7dvUIaXIyZ93LG+GaOjPP1tcw+5hB4B/wfM1XY6fJWyOEzWzEI1lixADJP3lo1+rebDTuD1T0RT4ICRr4b2L3B7mSs6JIutVT7GI5xepZUeaMIaU4ZFyLxk2zF/cBbKf9VyyAqiKuNl4iZXfc880FKpbc6oNpOd9HmFjz+4leG6uIAUpbekxrgRPIZsPdcE+0Hg7FTnhO+S5CXKgRR4FGTlJsh8/eSpWSxFd43gJiGYQZ3hxR0V0gDtep0DOMhgVtnYZcVQL26HwbbNeiZsKIc/wKndHe1sRT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?7ANDOA7wsLYSDBZgWTS6RO7Z8vb+Fd7ok+Wq/EZgloZIq9b13x0DyXchR6Vf?= =?us-ascii?Q?hogmlRxxmgdsc2BbsjnsbtfmVOAxLla10y0JC8iubw1D83cLBLTBCTAaMO9j?= =?us-ascii?Q?XssuSvb6o2Swbyqoi6jPyMFWsHBgSRAhn2j1Gnu8jmnzWINTrZZMDCwzbNiu?= =?us-ascii?Q?f2G7Kua/9gLWq13PSaz42ENp3xYOEp18va3rkjuBQbt7R3VSpCRt6L95mwHQ?= =?us-ascii?Q?AgnaWtL1tEz/kINiplGIjWX2IfAfac4OZK4QnU2Fv9qi9ZvbZG2zgLm08NCm?= =?us-ascii?Q?GwWVu7vY3ly0Lpbs5ZDwzkFiK0EQrW1teZ6XJom8vLBhundaP0ZCpjfA96Bz?= =?us-ascii?Q?M1rHTqCdK26XooW/D5fWbYv0aEcuTYh6C8pLVISZCs/jj9b+SS8JeY7dXw3y?= =?us-ascii?Q?incYSM/QIyQPJ0Du4qGESuDwh0bN7aYrDaMQCfYnHrpl7F5mdWqfHRDurYR5?= =?us-ascii?Q?ex4ZLc0MnEX5xcVyhFYLk1bgfyD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BYH2DGQ8sbclO5zLG8937S/lJNXvtNhWo9u1qGonLjYk6/9MLA60Ja?= =?us-ascii?Q?yNgYs1F7yU2ymBHXGdJtP3oUVb203xe91eOMg+r3gOMFtd1q+7qUhta4WUbB?= =?us-ascii?Q?SQfiyKMGw2nUEbOzdrker4uyHH4bjOl1zdnvwrYh3xl//NpaN7lq3r4zKNge?= =?us-ascii?Q?AYcAQpdQRghRXmH+b0lgVKai1B1/e8/jOFpA4GVcuqWka9FM/+UsWSfcZ6eg?= =?us-ascii?Q?fqjDBJVDMwonnqXFiLMxic4=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32f1e8ff-5254-424c-14c9-08dbd0a32cfe X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:05.8213 (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: MhlOlilHHSkWYdaMzprBLWR32yex8qXETeVEt/yjFLUGZrHIISwamPlvj57bX1SdL6lCO4Fe04cWPLxI6p5fyadcvcr6JRa4a8/sS1rYZz0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:7e1a::725; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697725671561100007 Content-Type: text/plain; charset="utf-8" Add a helper to set unused areas in used bitmap. Signed-off-by: Alexander Ivanov --- block/parallels.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index 7eb92f87ab..6a4e3945c6 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -195,6 +195,23 @@ static int mark_used(BlockDriverState *bs, unsigned lo= ng *bitmap, return 0; } =20 +static int mark_unused(BlockDriverState *bs, unsigned long *bitmap, + uint32_t bitmap_size, int64_t off, uint32_t count) +{ + BDRVParallelsState *s =3D bs->opaque; + uint32_t cluster_index =3D host_cluster_index(s, off); + unsigned long next_unused; + if (cluster_index + count > bitmap_size) { + return -E2BIG; + } + next_unused =3D find_next_zero_bit(bitmap, bitmap_size, cluster_index); + if (next_unused < cluster_index + count) { + return -EINVAL; + } + bitmap_clear(bitmap, cluster_index, count); + return 0; +} + /* * Collect used bitmap. The image can contain errors, we should fill the * bitmap anyway, as much as we can. This information will be used for --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697722436; cv=pass; d=zohomail.com; s=zohoarc; b=WK8sRalKknmQXkkn4lC31alXgHWk0TgzS9lW/KgDnnhbR45aCgs67qjc2umzAug9h3dGaej/dxziqBIupuzNaocJvEmtkW3lZp7IMKelgnKdHAM/bqqkWmSelzGlGY7L5v5afeJ4TwwsK0bQrswDWhmLMF8S+9p/KUl3QHp0o2g= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697722436; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tJTjXlH9d+c1eWZwqQZdk1+aL299rT+DTPDqF+pBQzk=; b=irZZ6+jmOSyPabaRZTVpRdgFjm9vwcqEYdeSHGynqoHpifLLt4fM7YUuivwNPV2lJ5f2EFbs1L6RH57+R6DiKOLBROIWmW4WWLs5oSDQO/yHxtG+NWqcz9xonzWX+K/CEZs/nglFcuhO3+cCr3BnzwDHdGOmf85gt8Ek3smsL7A= 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 169772243612264.47596577480499; Thu, 19 Oct 2023 06:33:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScS-0005kL-P5; Thu, 19 Oct 2023 08:59:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScM-0005h8-Se; Thu, 19 Oct 2023 08:59:15 -0400 Received: from mail-vi1eur04on0703.outbound.protection.outlook.com ([2a01:111:f400:fe0e::703] helo=EUR04-VI1-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 1qtScK-0002f3-Nl; Thu, 19 Oct 2023 08:59:14 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:06 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HSRsccyEK+bLAnz9T7dpzxx+scjl0qkJgxwrMJbYH+0M4NszZwLlsQX+Z2ED4aP7uB40wBZM/xdgM/pTwLHhSAiWroKYMqS7PNsViZ9NOSqCrigimHq3cJLKUStrc4dUBmQjq6Z9F0F+5VP+m7XN8i5fCP/CDZHw6IOJQT9rCW3eiR5+M5aPld0BEHy4tN/gN+JDaOLvkOl3HyWBpkQ2X5VCMp2/FLrEUpV/6aK7cT67xKOdbNXVqiQruKCFMFaqvv05CwUCr3DlZW3OqXHZQuK6gCRWSdiU90gJRa/iHHICE7q8A+63yiEFkcHDOxBMr1aHQpgRTTmFOBD44iBBIA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tJTjXlH9d+c1eWZwqQZdk1+aL299rT+DTPDqF+pBQzk=; b=FdSDk2waPSyu/49iIa+3TEvV4dE9myVyQXWdV7YwxUMsCNoW9Wtcb31l9nZO6mtjyMA9cGBx3MQBUqM95bWkMTcnlvkpoOH/Xxv4xxpUsOiRpiYvqlhoBLnZ+AEpMzhd96xzJWWY0e4Oc2DC7aiPATHJNgG6yv8jm7OJ0kika3hybvyrSfWVkB1O0tSWIFQ4M0M+oFc82kG528SUyyHoT8Ay7Q79LBIJcIsYQ8eBEiK9M6fox2UC5lvfK/iVRzn8CKH+SeGGz95idbz2GYhkGuGmFPnjZA2VHMW2yTQfvD4c/lRjo5QvfOCCpVde8NkzFxB9a9goxwOseTtt79kfUg== 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=tJTjXlH9d+c1eWZwqQZdk1+aL299rT+DTPDqF+pBQzk=; b=vv5x6ZQ0oUqns8IXEIM4/hJcQLu5IKgXkhS7SckOwtvli7erhHHsRy/FMhQP2LLdNT6Rx+01mmGbEdJui4vGOJdtqCTeiCa9R/JzamNkIU0UFyDoyCPBSsjn0nbD4253MFW+ToKifpxtGo46TdriCdCOvq0NtODwubaLOe+svqJhPwmNuhTilY1ikzZs3ZahngHABcghpNrn3OkvhNmqDG00AkShPCcJgnsgtAsQL6CLEPgyyoESAmO+ly5HlilFMshcwLBRxNqr1oOhhI1iflVtOPkF+E/5nsPdH5Wq2tzcoiKkpwhZr/kQH+D3HveHrgIL2z5nioXwM9wdviAg4A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 04/20] parallels: Move host clusters allocation to a separate function Date: Thu, 19 Oct 2023 14:58:38 +0200 Message-Id: <20231019125854.390385-5-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: a9243103-d002-4835-d176-08dbd0a32d7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ryNJ5rBRqkd6NxQc6JEdYfDeizFUB+zVtOXPQU1qiGJ6OzdZ4TfKSLBVcvzOUN5WZBiQ+S+zGqz4Ujmmr/VM5saVURzSiym3e9+jl65tvUGYK/DXe1Wm+e04G5+hOL5vsRvZ9jEJMb8WXh4SMY5q4rlcXUD78P2ZV9QUJwYHWT5+YaHrRy23U/+Pt7hk4SOAsjTHwX+cRYVDRDBTZg9xD6uUMQNhaM2lPXcKXHszN3RaKvnq9CMdrilD3WRfqOgc1SDn+RBRCdgtiAeZh2BkaHyn4QnGQnUE06Xv6az4ALh1F1T9wm/62wGUogBbirLdTmKEbRWJ9U/0F2FjE9fREi/wSkknYVHCJ7FKfR0oxuhpA3j2EnIXfwzqzRDY2a/WNm6HIrCWSWb5VETUN9M1U1xFnMOCYoQdTVKkRu8gjYQEXN2suVCicKDFzh5IcuZ1bx/FRzssOZpqmT8Sebku/bwkb/Az7M5arXPC3oIFmLC17eGwXyxKxfF9cbgZ2Gp+KwxaUrLk7hb5eBw2h6V82NwaIKyMmbnUE4qVhYD7x5kn8+Y7Sz/4KJ/XutgYTT39Ioj2wVlxCrPzyrBCKrIa7jNSMepPjjvgRnHpl0UnOgqvTwTydQWFwpqyZt5L53Nb X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?J8ihcfnZKM8+sAy+Xnfz/wk/pgW0Z2aF4+arql5mW7+61l2+FMdXszSH+9UG?= =?us-ascii?Q?v5cGbOAeLzKZ75t4pr2M8FGhFKjz/iBjGTwvbUgbrtLRgApjftCn1Tr+hnWl?= =?us-ascii?Q?98rn+U1E1jZc/PHAdK2LNKVrS4eJJQugp80uQAWiITdTE8QqVc53blNuhuUW?= =?us-ascii?Q?H1C3/C0W6Z/ApXfOmTFnXKUHymRpxekRHeVNqA5yCF8GER5vVDJEEWBuarnV?= =?us-ascii?Q?Q4O+6B8iiyVgBt+vPzE7H6ktoor6QKnzOci0mwy4YgLsykWe36ExH2Z1KMb8?= =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McDw2SAjbfPg/JwboQ/blQYqSjgb/M?= =?us-ascii?Q?K4w+JFDglmwbT8g23GcnBF2O1XMEkIafB6Ca8RszBoAr0T+JugyepGAxbCCn?= =?us-ascii?Q?o/r1WT8oCfF+yJQ13XxfFWwgGsJw5s/BsgiDVv3FL79sLF53WjS9WfmOdOGy?= =?us-ascii?Q?VdY/uLc56Kmg1Wrue2hjUvo8HZGDMXJ+FmFcIkb87JgsGoOJu7/uUif+h5C9?= =?us-ascii?Q?dn8pnBXPLb1B8DhuoS65Kg6RiNWQUGWgBpVX4Br0wzOALe0QGwkgdEzpv9ze?= =?us-ascii?Q?YJS1hLiD+zsVsuG6FRPn+D/7JoM2EoxaM9pteUiHgpFG3AtoEALlON+Y+kkY?= =?us-ascii?Q?z4mncemSYnWD/7coCEmWNrDMzSvRO3Qzi/VxyibxPusDVIPOrD5c4bKFnkbe?= =?us-ascii?Q?PcGCc/n/70T4DA5fHCJH/QZ+RCBEWUIxUVPyjdLubMRou2cJBxSCuCd58bSJ?= =?us-ascii?Q?JByUelSltvHhEgLITbBmLhk=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9243103-d002-4835-d176-08dbd0a32d7e X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:06.6182 (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: fbqfURzAQmEpTU5YpsFIbjXkyj6EGumWCFhIWNjzacshzmiTc7IHjJCaXgW18KRCJxY1xMUOCO/TNjGySQNLNDuJXFW9H9r+1UYOvGg9ZIc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:fe0e::703; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697722437592100003 Content-Type: text/plain; charset="utf-8" For parallels images extensions we need to allocate host clusters without any connection to BAT. Move host clusters allocation code to allocate_host_clusters(). Signed-off-by: Alexander Ivanov --- block/parallels.c | 126 ++++++++++++++++++++++++---------------------- block/parallels.h | 4 ++ 2 files changed, 71 insertions(+), 59 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 6a4e3945c6..ce97387e3e 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -265,58 +265,31 @@ static void parallels_free_used_bitmap(BlockDriverSta= te *bs) g_free(s->used_bmap); } =20 -static int64_t coroutine_fn GRAPH_RDLOCK -allocate_clusters(BlockDriverState *bs, int64_t sector_num, - int nb_sectors, int *pnum) +int64_t parallels_allocate_host_clusters(BlockDriverState *bs, + int64_t *clusters) { - int ret =3D 0; BDRVParallelsState *s =3D bs->opaque; - int64_t i, pos, idx, to_allocate, first_free, host_off; - - pos =3D block_status(s, sector_num, nb_sectors, pnum); - if (pos > 0) { - return pos; - } - - idx =3D sector_num / s->tracks; - to_allocate =3D DIV_ROUND_UP(sector_num + *pnum, s->tracks) - idx; - - /* - * This function is called only by parallels_co_writev(), which will n= ever - * pass a sector_num at or beyond the end of the image (because the bl= ock - * layer never passes such a sector_num to that function). Therefore, = idx - * is always below s->bat_size. - * block_status() will limit *pnum so that sector_num + *pnum will not - * exceed the image end. Therefore, idx + to_allocate cannot exceed - * s->bat_size. - * Note that s->bat_size is an unsigned int, therefore idx + to_alloca= te - * will always fit into a uint32_t. - */ - assert(idx < s->bat_size && idx + to_allocate <=3D s->bat_size); + int64_t first_free, next_used, host_off, prealloc_clusters; + int64_t bytes, prealloc_bytes; + uint32_t new_usedsize; + int ret =3D 0; =20 first_free =3D find_first_zero_bit(s->used_bmap, s->used_bmap_size); if (first_free =3D=3D s->used_bmap_size) { - uint32_t new_usedsize; - int64_t bytes =3D to_allocate * s->cluster_size; - bytes +=3D s->prealloc_size * BDRV_SECTOR_SIZE; - host_off =3D s->data_end * BDRV_SECTOR_SIZE; + prealloc_clusters =3D *clusters + s->prealloc_size / s->tracks; + bytes =3D *clusters * s->cluster_size; + prealloc_bytes =3D prealloc_clusters * s->cluster_size; =20 - /* - * We require the expanded size to read back as zero. If the - * user permitted truncation, we try that; but if it fails, we - * force the safer-but-slower fallocate. - */ if (s->prealloc_mode =3D=3D PRL_PREALLOC_MODE_TRUNCATE) { - ret =3D bdrv_co_truncate(bs->file, host_off + bytes, - false, PREALLOC_MODE_OFF, - BDRV_REQ_ZERO_WRITE, NULL); + ret =3D bdrv_truncate(bs->file, host_off + prealloc_bytes, fal= se, + PREALLOC_MODE_OFF, BDRV_REQ_ZERO_WRITE, NU= LL); if (ret =3D=3D -ENOTSUP) { s->prealloc_mode =3D PRL_PREALLOC_MODE_FALLOCATE; } } if (s->prealloc_mode =3D=3D PRL_PREALLOC_MODE_FALLOCATE) { - ret =3D bdrv_co_pwrite_zeroes(bs->file, host_off, bytes, 0); + ret =3D bdrv_pwrite_zeroes(bs->file, host_off, prealloc_bytes,= 0); } if (ret < 0) { return ret; @@ -326,15 +299,15 @@ allocate_clusters(BlockDriverState *bs, int64_t secto= r_num, s->used_bmap =3D bitmap_zero_extend(s->used_bmap, s->used_bmap_siz= e, new_usedsize); s->used_bmap_size =3D new_usedsize; + if (host_off + bytes > s->data_end * BDRV_SECTOR_SIZE) { + s->data_end =3D (host_off + bytes) / BDRV_SECTOR_SIZE; + } } else { - int64_t next_used; next_used =3D find_next_bit(s->used_bmap, s->used_bmap_size, first= _free); =20 /* Not enough continuous clusters in the middle, adjust the size */ - if (next_used - first_free < to_allocate) { - to_allocate =3D next_used - first_free; - *pnum =3D (idx + to_allocate) * s->tracks - sector_num; - } + *clusters =3D MIN(*clusters, next_used - first_free); + bytes =3D *clusters * s->cluster_size; =20 host_off =3D s->data_start * BDRV_SECTOR_SIZE; host_off +=3D first_free * s->cluster_size; @@ -346,14 +319,58 @@ allocate_clusters(BlockDriverState *bs, int64_t secto= r_num, */ if (s->prealloc_mode =3D=3D PRL_PREALLOC_MODE_FALLOCATE && host_off < s->data_end * BDRV_SECTOR_SIZE) { - ret =3D bdrv_co_pwrite_zeroes(bs->file, host_off, - s->cluster_size * to_allocate, 0); + ret =3D bdrv_pwrite_zeroes(bs->file, host_off, bytes, 0); if (ret < 0) { return ret; } } } =20 + ret =3D mark_used(bs, s->used_bmap, s->used_bmap_size, host_off, *clus= ters); + if (ret < 0) { + /* Image consistency is broken. Alarm! */ + return ret; + } + + return host_off; +} + +static int64_t coroutine_fn GRAPH_RDLOCK +allocate_clusters(BlockDriverState *bs, int64_t sector_num, + int nb_sectors, int *pnum) +{ + int ret =3D 0; + BDRVParallelsState *s =3D bs->opaque; + int64_t i, pos, idx, to_allocate, host_off; + + pos =3D block_status(s, sector_num, nb_sectors, pnum); + if (pos > 0) { + return pos; + } + + idx =3D sector_num / s->tracks; + to_allocate =3D DIV_ROUND_UP(sector_num + *pnum, s->tracks) - idx; + + /* + * This function is called only by parallels_co_writev(), which will n= ever + * pass a sector_num at or beyond the end of the image (because the bl= ock + * layer never passes such a sector_num to that function). Therefore, = idx + * is always below s->bat_size. + * block_status() will limit *pnum so that sector_num + *pnum will not + * exceed the image end. Therefore, idx + to_allocate cannot exceed + * s->bat_size. + * Note that s->bat_size is an unsigned int, therefore idx + to_alloca= te + * will always fit into a uint32_t. + */ + assert(idx < s->bat_size && idx + to_allocate <=3D s->bat_size); + + host_off =3D parallels_allocate_host_clusters(bs, &to_allocate); + if (host_off < 0) { + return host_off; + } + + *pnum =3D MIN(*pnum, (idx + to_allocate) * s->tracks - sector_num); + /* * Try to read from backing to fill empty clusters * FIXME: 1. previous write_zeroes may be redundant @@ -370,32 +387,23 @@ allocate_clusters(BlockDriverState *bs, int64_t secto= r_num, =20 ret =3D bdrv_co_pread(bs->backing, idx * s->tracks * BDRV_SECTOR_S= IZE, nb_cow_bytes, buf, 0); - if (ret < 0) { - qemu_vfree(buf); - return ret; + if (ret =3D=3D 0) { + ret =3D bdrv_co_pwrite(bs->file, host_off, nb_cow_bytes, buf, = 0); } =20 - ret =3D bdrv_co_pwrite(bs->file, s->data_end * BDRV_SECTOR_SIZE, - nb_cow_bytes, buf, 0); qemu_vfree(buf); if (ret < 0) { + mark_unused(bs, s->used_bmap, s->used_bmap_size, + host_off, to_allocate); return ret; } } =20 - ret =3D mark_used(bs, s->used_bmap, s->used_bmap_size, host_off, to_al= locate); - if (ret < 0) { - /* Image consistency is broken. Alarm! */ - return ret; - } for (i =3D 0; i < to_allocate; i++) { parallels_set_bat_entry(s, idx + i, host_off / BDRV_SECTOR_SIZE / s->off_multiplier); host_off +=3D s->cluster_size; } - if (host_off > s->data_end * BDRV_SECTOR_SIZE) { - s->data_end =3D host_off / BDRV_SECTOR_SIZE; - } =20 return bat2sect(s, idx) + sector_num % s->tracks; } diff --git a/block/parallels.h b/block/parallels.h index 6b199443cf..3e4f397502 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -90,7 +90,11 @@ typedef struct BDRVParallelsState { Error *migration_blocker; } BDRVParallelsState; =20 +int64_t parallels_allocate_host_clusters(BlockDriverState *bs, + int64_t *clusters); + int parallels_read_format_extension(BlockDriverState *bs, int64_t ext_off, Error **errp); =20 + #endif --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697725302; cv=pass; d=zohomail.com; s=zohoarc; b=Z/jl7E40a0pd6NYCnZa6kki4y7n0omR1DAKiSN/Y34I9A6txOC5QMJPEoX0436O5lHpaVq3hyeqGFnKg2/0DmPY3zmvEc08/3QYvlIA1GA93qsPYaZvLY5EoDkvv16ZNEe3ElQRNyVv9XFyYEBMgOnOk/VPeun+USlLeexoXenQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697725302; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LDffaETnr5fYHpQ2nnTQuJeK/UGFcL01sqPorLAFZHs=; b=gL29LyHKERQLMds4gEdWuTJuZ4CnRQD48Zbcww8VDKx7RzMRabGvbNPKPqcrKBRzHlgbhhrVKjtZLKEMT3KRRVtVsHS+LgJW0LWMMvZRvUke1rv8bNUOYFY5tmsZB9TMgN+w0C/kUtQtPYXXtiLTNqa1Un24jeijwzdD1auyEjw= 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 1697725302191393.2082637177821; Thu, 19 Oct 2023 07:21:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScT-0005ks-C8; Thu, 19 Oct 2023 08:59:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScP-0005iB-An; Thu, 19 Oct 2023 08:59:17 -0400 Received: from mail-vi1eur04on0703.outbound.protection.outlook.com ([2a01:111:f400:fe0e::703] helo=EUR04-VI1-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 1qtScN-0002f3-Nz; Thu, 19 Oct 2023 08:59:17 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:07 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H86ut6qqa1QU1KppDTRV6WjntR85r/009Pp1mff0Z+fgMsJEUGD7RAgQtQFJ1NIjzipmWDbSNePoWK+ng6Mx34XiXc8BUkcWtVh1zhh6QT3y7NJ8xO+x8wSoxwrwuVLcvVNZ90mJ3r1VXl25vQpTHUO5Yieh2OnW+Ey0+M/F7pZpxi80JogUAEFN23D9e1NULjFbLGtVKbrS7XFji0rjQP2FWuQo1nK70mMBNG0j+0CnKgIElij/l7NYZlf77ew+2RetTp2C67LW/6dMblMI9DC9N2+P/kipfBpOAJgzMPXQRO6H85gP/cX/9XnBExh2PTaXhNpjohpE4DRG8DDLLA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LDffaETnr5fYHpQ2nnTQuJeK/UGFcL01sqPorLAFZHs=; b=V5ooYvWJ4jVVoZWIwXvKH7uxDIBIZ59xDQHzRf++NM++e0mRX/zJ6GO3S62LVVt0YY6zCi9wbFbuFRaWWGKDCmMYnz5bLPRBbwihSRbonH7KT8VgZtpDRHuJKFsZzAWSjgefookAMdumOu3N+Ox5428yRFPvcdtPhKjQu829OWzrKjbchKS0R6Q76r0q392ufO1kI6hbC+RLqt9lNZkgBq7vQ84Gtm+OU2PkOnQAF+SAhThtsbtvMFTzLK5WVCERVj9b22xK8iYO/MHOeZkekYh8wKvGTWUJV/fM6HxWNcAttGjUY4bWLl3jfl7hy+Df6ve9oEcqg2bYhMIYliMP1g== 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=LDffaETnr5fYHpQ2nnTQuJeK/UGFcL01sqPorLAFZHs=; b=r5x7VznOlPo1f0sloiHwRaOHsau0R3aieTwyGE210yodqHdBINN7hv+/Mk8RdHDuc+M37zwAcenp6Bk7AiFM4yBP1FZWbyA4hQBDNU90Xj6h8gXZ2efYAcFFYcyvwHCmK0FhUyBrFf0UlqAEWqQtt50s4FIFi+cub2d/p+pvftWz4swRGqB4ldVx6CSRdR0zGQC8cI5txeVUAJsjO2EA9X2ublIAdeWxcP6l6ny1tSzWbF77aEDLJBA8bIvzehIxg7yqWpkwU8S92Ej/ct+MbFBcMyldOxJp6hUg91CJ7UGzXkj8fdiov982VEErSn2pYs4R7Nm5XufyBFpwDCoyJw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 05/20] parallels: Set data_end value in parallels_check_leak() Date: Thu, 19 Oct 2023 14:58:39 +0200 Message-Id: <20231019125854.390385-6-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: 427b2bf4-71b0-48e3-7bb8-08dbd0a32dec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zPfSD25N/FDL/x6JzSG/VniJ0Ab/neEIP0gDnbsjBtXNHIMtyy51h7moOOWYrxSuBvodTfxA08HQUmSkdtSlTgzAMDe19+bF2Qray+FwCncCd6REdS6u0kth4ubLyLD8u74it/ynjEU5RkIYlF+K9awNQwcO/bctUBAGRwWS34MdKLvETI4mom5z62a7irMNw9pmKw/uuUB7VhnbU7t1DRcjnQNUl1diBX3oHr+lfTZGZqN492RcfrCekr/ZXP3Wf3viFkJhszTTA27MD3EVKwTrB1M14K/zN1JIDOx+cSy+V2gu1lAoKbTMEd1U9StNVaF+ZQX4B9i9x2xx5qRtn67cuaxP6V7FVRVX1Xvn+8EUbs39ybZsM/tPijeYn0/FwaBoDm0Ex4aS1MryKgnEudQmHLYb+/3EjyIS1k730Xyu5ivxB3CC/5u1irS2yN8OCx+8lUidBXxARf5FH2ey1JYYPFKee1aRovJC4AzNA2dlJuGURxDycpcRzZT/2dotF10ld/qhFr1DMs342Pk/nlbS5SSjwLsyG5flnqwa4FuFBZk+s0UdK2Hq4Gh5s1JkeXB2OnQgI1pC500KBefajaXZzz3AGZ34jczuhrc2vh2bcV5jOI0f0oruvquU3tJX X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(4744005)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?7Oc2aEKMpcpW/ANq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q?hXrCPxDWgVorBbXsXX0/fgv+wlxeXrY14wL/xYzf2TV7OQLsGX67CeXjY2fK?= =?us-ascii?Q?4Km2XOnEqrGCELTOGaYyHfJBmn6d8fw7EzqZqXwAU7EJtsDSRajX3b7i+bWC?= =?us-ascii?Q?Z98Sj/vXFe+Bb5c0mY3atoYCgKD0F9w/FmRAHZqg+u5Byt4JFuKE6fWLuFGz?= =?us-ascii?Q?oytHLxL0DRHxC0HJE+lxGOGKaaBaPrxm0phaBJjjGPxuEU6+2hYHgHAQKVm7?= =?us-ascii?Q?QRouifV8EvW0XAsW55Ecu8w4SKCRFHxp7dv+xEbtA6Ba9jRfx9I6OHzU7hY0?= =?us-ascii?Q?gn5SaFjTgJ14vcQZGyq0CYtdlbuVrcuN40YD4UUIfjJi7TaHLpw+kv3hTmxh?= =?us-ascii?Q?aLAegxQ3R8xU7gq++P4n0gU6VzpYAZnUlB1YeVNr8PQxhGZeAa/7DLyvo79P?= =?us-ascii?Q?vZG4SpILPdISKjD9VCmgPy7ju+R2mvB7dTWK0L4eM5rvsZjkOsFiIOu8KBjR?= =?us-ascii?Q?q2GVm3K0BjP5InzG1S9OC58i9LM/4sxGLDE17ci3lpEd2/RZqVsGt79ONBNn?= =?us-ascii?Q?e02j3m6SQS01CXwxpdJJwliA9CpKSZOQsuIX5VfOGC7U16nEODSZ+eZI5+wd?= =?us-ascii?Q?qJ3MZnWyywj0DvZ2VXCikO7SOT1JwjrodB0ik5Hs3nXASH4hRJ4jZYte5rX0?= =?us-ascii?Q?K+fuV2uPQPv6X6zEAawKdY3PqnMfggmkcTyzWsNglHpiLiYjRh8Y0myak00p?= =?us-ascii?Q?WyEZoQoedAWe/6tFapkJCyc=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 427b2bf4-71b0-48e3-7bb8-08dbd0a32dec X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:07.4598 (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: kDrbH8RRVLqX50d0di0S4tNGRJXuRDtwz/smFU77yEYofeQiwaB+Xu1ZNtvZzIwVupDSgakItt1Xt/Q93uVktmTT3f7NP2MhHLkXVa1vwaQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:fe0e::703; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697725304011100001 Content-Type: text/plain; charset="utf-8" In parallels_check_leak() we change file size but don't correct data_end field of BDRVParallelsState structure. Fix it. Signed-off-by: Alexander Ivanov --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallels.c index ce97387e3e..ba9fc46279 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -806,6 +806,7 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckRes= ult *res, res->check_errors++; return ret; } + s->data_end =3D res->image_end_offset >> BDRV_SECTOR_BITS; if (explicit) { res->leaks_fixed +=3D count; } --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697725095; cv=pass; d=zohomail.com; s=zohoarc; b=cQSGLtQ3GbkHf+gJ+EpklNkIcUR9FWOkTfHiUpsw+Iyi1YiWQDYJY50U0WYsGaD5v8q1tyLupA+Y8WkzntxSr23he0p70n4XvlRzE3NJAW3uhZltJar3BaQ0DlXyus4vOnI/Q77s0j1DNiDVDDstpusEX+KAS/y8RU7/3lQAFvw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697725095; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FYGC276nRVTIguNvwpRfI3oZX12GIxnO8UajaNte3mY=; b=AtVXMCpke9wG+U3uGI8bq1Q/3aVdQSzCZCGAcS0lLp5h5RVqHsKrfbSLx/W9BazxHq+ZDXG9vFqvJH1sNrUSphnK+9OJVVaHH1oZSrzU7X/88JBaG1pNtNot6jGkoOuTTv2+Xg8LhH7E5c+eVBRu8eS5Ars+rOu4hs/73Hpt9iE= 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 1697725095754359.07942692335735; Thu, 19 Oct 2023 07:18:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScU-0005lX-G6; Thu, 19 Oct 2023 08:59:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScQ-0005jK-FD; Thu, 19 Oct 2023 08:59:18 -0400 Received: from mail-db8eur05on20725.outbound.protection.outlook.com ([2a01:111:f400:7e1a::725] helo=EUR05-DB8-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 1qtScO-0002g2-8i; Thu, 19 Oct 2023 08:59:18 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:08 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J1uABb1k+P4xg/zNPaE1OkxiYEn+utBnzrNzZq+dtj/PRn/Qs/VIMjNhU985WibasPBWZ0ar+uxCgGoa51G2HaQttBOkywDaHVPAv5Rd3sz0HgptZf1hV4/sgPjL+KiAAIj7SHgnTXIcqpME6SrZhChhgK2xbk4yLVBFFL60/n/GvBaisBX15y9z8lqPttPPc3D0J+7X799wJjFqw0WEkRrunwNuShMxubf9Yl2xnNLymNS+g20iOzxq+t/kjd/22bqNzF2QbrsJZeLhHgEv8UT485LQklYeCWNNKwXv/II0a5WTo/3APRh/Wd39ha7iAmRjkeBrcsjrY7czm4OQOw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FYGC276nRVTIguNvwpRfI3oZX12GIxnO8UajaNte3mY=; b=Y+msWJqK0ynmwksqecVPF6n1SEOQco9/lAjgKzHv5660Xk+i3pFZ7HVGZvQsW3PGQo4CWAn6eg/2ekCuSfJCDdsdYnL5+7zBT5auupNfCEyS8mSrkvKENOtXRTgsIYhRvgPZpi1Dr3tjvTj2R8h++hajJOKUjhXyD2jA2QdOnwNON88kWrn/bkvauaJrg/eXOWPyBsLUuCAGjQSesCmSBvLF1Dp681LoSFIhsRx6ZYWAs9o2aDhm4tr7SiF9NdbyEvNfF6DFvVLw9Ud05lvF0BDsiVSH/pcZj1EzfVQRknDsVayvboFA4IsTe5x+spnK0GX5NkO6m6XGwqoJwO4bRg== 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=FYGC276nRVTIguNvwpRfI3oZX12GIxnO8UajaNte3mY=; b=vNY/kWZfqkMx1Vag3aDncBT79qLI889rztxitdNFS4EcG9qaTt6/NpNeFGPuYwR1yXWe1dqR2No+P7/zr08LkcsTJQJJLsWoqe/np8MpKt/eJWBYBdg5uckZJXqp4ecc//3t+n6IBac4WWg/6fLexrWgbdqUoU5c2vm9hnLmI6/KCdoC+q1YY5uSAU7gOHJ8GkSuwxkpND3410JD+f9qEw6/hBSD0fcTvhuHqQML45I/V/bbhKjGVkbPOXJZrM2U6OtZTrK/rLaugN7seNdTDweJ0NgIgFoeB3OVaigHyt7HmHf6NEhdW/4vA66h+rJ6oFlR6gGNdhhVUFw7C6q3UQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 06/20] parallels: Recreate used bitmap in parallels_check_leak() Date: Thu, 19 Oct 2023 14:58:40 +0200 Message-Id: <20231019125854.390385-7-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: 8372816e-332f-4790-8642-08dbd0a32e7b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Yx5JM2jsiL+ckDIEU8Fzlz8dnM72Ospd4evm3RMYrtBtzU75LXx22t0NQbven4DbSR6PxSxR/YwpyS/hrVGIaj7W0UoY7J8AtnJO3Kwclwe/dg7loVrRuL4u8VNDo9bwxvK2fAMcLbF01KQXVJtLa3Eyk+Ht5ms5sC453Pusy1bf6/Gz6uuNfs5itP1SD98ry0SKBt+Q2p3Z2qrAkDug1UdkdH9RW1ewt/d9pobBo7Y1MWMVLO/+Agc8HGKBGdWlu915yqOtSbLEGpZCZIieqxHzTzXHLqskVxO43r4+Fj79SH0SVwwnD6qLChxwaA1FUP/YkZuYXp0GX0vviyGosPUOHCucc0FLDwxqjvNnlFtJG6Vey82BXBBE2tCZYFggbY0ZhEYVkCpJOl59w8NefCQRxHWv2P2xmehv9cFZycDvDFZacqN5v55RstfLhABy+O9XWTpuIez0XfQWJxT5IrCR88+O+qI/N/1Wye11VgmH6u8NbexSTfqlDrF8Qu/r3vWXw84EqExlNSuXJBL5F5IEnpbBsf2n3picMLVcBHFERC6o2FhBA/ZOz9N9xQGh7EV3oDb4HrB/Pi9rj9GN+0NZS/VpmJj54k2TP4ZlIzMSJLU3E1vSz03A4MydIBFz X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(4744005)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?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kWqeVCTNO2V79zqW?= =?us-ascii?Q?MNL8WQaY3uvt7eGr1bs0MNvMo//E943I1pLfgGQQzmsfZapgsWXWT/F5N6oO?= =?us-ascii?Q?HJzXLdnMrG2nU2jw1shPnBmzg2s1SU1Lq9bEwAEe2BK/txE13uQ2C4VaYozR?= =?us-ascii?Q?YhsYGbxcCi+cv40m8loZJQEw6s3VAkcs7F+cY5gL8DHcqKDXsSmN/JIRFaMY?= =?us-ascii?Q?xap/auZb1z9kgFFzmexQJz8v30pHpDe3H1bIO8Szq5wzarAA+nLHH0phN3CO?= =?us-ascii?Q?h3afpWxYOEZgyN/SSyPIADKUgQEXHcg4Y1oqWnWIQ6et1nSLeZ1V/1R6NxaR?= =?us-ascii?Q?XX/lfnaRp/9lEpN+d2tVu5l/ntqcBuYZCtmOz1TIyCcJkR7E8lhS0Wqou46T?= =?us-ascii?Q?NiczCkWGw06YB0QDX8Kt4JEPP5FlyrHjXGlxBUU+tdB3X5KVXFcKtb5TYL0D?= =?us-ascii?Q?5P1H/v4ftSjbD7GCj3VNIAh8m5u+vIcTHDFCwYXs/K2ZreNpLGHesE3kfrc8?= =?us-ascii?Q?DuQ6j8EzbeJTDPBqF+56XXIpZ+ac2rP8oVK8acbiPl33ejvKvNt9NnUxShsd?= =?us-ascii?Q?GoEI1X3mkA5+Npib7E+fhtRpvDCZOXxMBSjEMXITNZuyaNNQMrHFYVcZpAZr?= =?us-ascii?Q?fE9B5rvGxePpJc/L5NU/KA0u5hhVrG/D0ZZ61y/JXUoIDevLJAcckZqMskLe?= =?us-ascii?Q?sWuAQxQtHOvvyGY/TzPNrYVdZXPmEgaMeMS5T7LCajiVJsT4Sqzx/enfVOJ7?= =?us-ascii?Q?tNznf1+9pMDC1dmGEeebzf4=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8372816e-332f-4790-8642-08dbd0a32e7b X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:08.4158 (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: J8X7+OG5oXSt95hzezoxPFZiMdQU/aFT4OvCmIHy82ovk8lMvsycjh2wfYN0FkqKoHCYSESTqJqzrS/m1t1sov991+Y1Rb5H8wI/Aqq9PAo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:7e1a::725; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697725097041100003 Content-Type: text/plain; charset="utf-8" In parallels_check_leak() file can be truncated. In this case the used bitmap would not comply to the file. Recreate the bitmap after file truncation. Signed-off-by: Alexander Ivanov --- block/parallels.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index ba9fc46279..dad2bf67cf 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -807,6 +807,14 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckRe= sult *res, return ret; } s->data_end =3D res->image_end_offset >> BDRV_SECTOR_BITS; + + parallels_free_used_bitmap(bs); + ret =3D parallels_fill_used_bitmap(bs); + if (ret =3D=3D -ENOMEM) { + res->check_errors++; + return ret; + } + if (explicit) { res->leaks_fixed +=3D count; } --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697722020; cv=pass; d=zohomail.com; s=zohoarc; b=nH3rjzHthmtFaKPLZ2jhP4STxvK0+B9NNDaoWpXoYhPMVr7jo4W58Is9jLlfIlbHBzZIo8S1BVaUYYQlHyKiz3+HWrj0vPmhz2ovVmv5l9DJS7LLj8KfisTQVRqQhD8ybC7/l2ZU/FfyoOx5uw7ItHuI3Tu3Q6aUceKme4Zh4FU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697722020; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QcgepgWnCdHnhMgOTwm0Ko6SgRB62LnSc/g+1ZQ7t1Y=; b=BpGffS2LvjyeGdvhfnAVoi2rcB87wqVY3/pFANiG2YBLOtVNruOixQbGkfW0nOOIgJHpMyM2/pXhKIk1NoZsXpuoNsnuasHp6m9aRMjFznrOtJqewmg1cMkY6AB+sXLPSXARdP0Zt9AUB5mmdruJeYtn6bpmn9Qj0bhB5Pk+8Yc= 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 1697722020637904.7824561181612; Thu, 19 Oct 2023 06:27:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScV-0005ll-6H; Thu, 19 Oct 2023 08:59:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScR-0005k8-OA; Thu, 19 Oct 2023 08:59:19 -0400 Received: from mail-vi1eur04on0703.outbound.protection.outlook.com ([2a01:111:f400:fe0e::703] helo=EUR04-VI1-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 1qtScQ-0002f3-2F; Thu, 19 Oct 2023 08:59:19 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:09 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UlpRPM2vpwnI1v5jvKkC+uhgRZjt/BenYlbAy9SZX47H8pnblmnXVLEDqVKT3xnh5lfkPpUL6M8OGdENHetgoJwEc2m1oyQyXcd2KXBo8t9khPYdpAva9HK2pIqD6F8VNEpxbcuwAxqfppXLXL5cZxWB8WDWk/xr4UdmJLnT/U6XexfbjkLmw9j+d19DDx/PJq4ls/9OhvmZivh7l3NCmBNOfiVrZCr3nhWECQTujaQopNEZwDxFw4XWG+BSCj258vMK6hasinwCkV2Ta5JA5VQeq4YWm8mrztNvJAYoUAhe9+S5vxjzS+6mDTewisetL8+ljaY0UkTAU/iCe7qhIw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QcgepgWnCdHnhMgOTwm0Ko6SgRB62LnSc/g+1ZQ7t1Y=; b=FIXkGq170FUJ/D4CF3BnbeN1ihp7RiRHRUJx/WlmsmrFFC8EzWv8Pd4BtTiXM9SIL4N5KZxDGycojDMFX9GhOLyuM7D5dXhdKdhXGD/HRDpbaqSb8KC024i3/zDguPe8qL2yZ9711yBCg0ebLRHbi0fyAxsLqU98kRIdrs4DOpZhzNNIErRdNCdhDi8Tzt1WZP/dqTOvGC1B7uFIaHXIlpOJqlbT5vB+T5V5lI/z05N6kQHM7Tm09MZ0kfg6pAAU7A6ZxuVI+5+VWuKF/E7d8BJerIHE7rzMobZ60sCUziRTnV6S3bjqRfEMTxAjZk17vRRnjaZNbk1ExaGR/cHZeQ== 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=QcgepgWnCdHnhMgOTwm0Ko6SgRB62LnSc/g+1ZQ7t1Y=; b=VjE4qoVksIdQGEzkwFtVXmvgvfnXab7nlgFx2TBwoNBNEwEJKuaRINy2xHZw+/4B6orcr44zA350NVlDR4y9YRmLiah+AZlH16NjDZuwLwAEm5nPc+exeFe4/dkzkGe/MQNyfomwXcqWJqVx1oW56pqT0CAoFrnmfOPwkMi6h7FKgFPys2kRVyQ0QCqNS85tHNKyBwx/7Nlw/GJ/iiadSrzfPhUODjut1hgZcz65MqAoc4tFYL2VSqBJcpdJ5mrV+BVg8sG+I4Sac2kgyq8gxZronc1ALB77bxbcbaLtaoGCD4i6kWSnm500OF4rPggWq6b+uq/gE02avoK7dosPLw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 07/20] parallels: Add a note about used bitmap in parallels_check_duplicate() Date: Thu, 19 Oct 2023 14:58:41 +0200 Message-Id: <20231019125854.390385-8-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d1199d8-c45c-4d0d-03a5-08dbd0a32f3f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WbXPB/xx1ZPi5FxxKYZuPTwXOVJMxivTXE8bNEe0LQQALir+zIUIWikkE36h2NF1NWo44ILM6nLV96Ht3QUL5uj5ApUuZ3ojmesCDGLiqdH9WkchnrVXX9P0KsmSzVgEdF3sx9Yj6O3AxXs+5pAGB4TXcu0zxBteUwx/R/2MpG/2HS6YD8eTTZ6J1MtbeaySyJuEqy0kcrzdB/Gs9hqOLowS+H2tcusucIWFFKgsnfGQrPj/P6CJBQnizE8lAYC751rdPGLMMCGpajSouKJRarKdbj/zL3aBebLBHCj1jbPnEi7G8MHXcAT+42dhZTytIge7O5LJUtLrSPvED7VYLAGS5NpktQuD9iNfNzdq7GuG61ZED9+ZSd590pYWhWgC8lH6TwaxBvjdR+yKxEzcAp1BHfHUXSuO8kLGbickslhcns92pDmLeUmzxFaXpzLSJI5L9Bw9xzp12i2VG5Wx3Sv0tCNfrSpO/70ZUav9LJkj0eFog0+Fwy+Nhmbwo3RfozrAB9RxaD5Hd1+gYz1DEuwzhCS63UrE7OfGLUAlB/QvOkUaWeGiUjXcW9UCLkxhH/tov49QyRU7KrK0zy5xGDcPqX/gasJDn4ktDdnpwpkgc1kZsir/ION0VedTjYeW X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?VYUVo4s8GJYEorLj1cpRqksBdBwz3NaQYUcAAqLklznj5VXuXdSR+ybKJPzH?= =?us-ascii?Q?JEN98U4zfaJzrC4RnZWMiYiPuJGPS98d55XUpFIaO4DoNk94KYCSyKdALvbW?= =?us-ascii?Q?MTNohxKp7kWYS221XvsBi7AlECh5mKZSH9W2QEYvbIz2H8ssc9FWxGQ9NuoM?= =?us-ascii?Q?202Buw9GLB5Afx63FqhXZ+p4Do4CSdfV9zQZKyFw69qheIq68f65z7wVZ9/O?= =?us-ascii?Q?5P5JUvAyWYIDre1ZmjEbr2pt85Ip89QegeQHRJVS4CVcRSLgZIupn6RAuT8S?= =?us-ascii?Q?rUiFyGJ9f+Y+wVHwK97EJE6NlZqrMpLJVZ0vgGaX8IfGAHSJuhfLZXaScF8c?= =?us-ascii?Q?3F9HLR1EFZMaP84MCDQP/N8nc2Ci11bhhlO8L1c7IbczuwAiVx6bLoVcR639?= =?us-ascii?Q?uYqcvHJj+/JGXkfGhTWZlBOJtdzWxL67BxWfAVWAhxgvOVMZzmkL56S4aIE9?= =?us-ascii?Q?4CfaySxeZkEXy3QgWQYflT6SXmEU5I2uX8HRAePJSuzKgQWbdt6esJVFdzQG?= =?us-ascii?Q?yoxYcZfH3W1aBRpxeoTXCkIAptiR/li2SGmyt6aP3wIwgIB/8MgzoJbuG1D+?= =?us-ascii?Q?ziIzZKmIPoPca82Seu7Uyd7tMsS/jQeS/g/shMMHhOrEC2GbjSXsOVXM+Wnw?= =?us-ascii?Q?Vg/Hz0FGx61sS+OB2+eAKtm4CI/Rv1aEeVLiCGnSYiUpP1kGFxfM2pOvGcSm?= =?us-ascii?Q?6XJCETaLtG4k06kgX2ASkX2RDRq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WKafd9JLEPdRkRfQ0mA=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d1199d8-c45c-4d0d-03a5-08dbd0a32f3f X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:09.6101 (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: TmgUC89kX1/vKDxlcM50I9bQjKzmkp1dEAghSoVIKYaC/5C0MI/Amy2SkXcojq2BmCZTQm//U/7/pGSfeXsuSFAWWAB4AoMUSAOTWUCQgAE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:fe0e::703; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697722021903100001 Content-Type: text/plain; charset="utf-8" In parallels_check_duplicate() We use a bitmap for duplication detection. This bitmap is not related to used_bmap field in BDRVParallelsState. Add a comment about it to avoid confusion. Signed-off-by: Alexander Ivanov --- block/parallels.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/parallels.c b/block/parallels.c index dad2bf67cf..dd8ec925f3 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -837,7 +837,10 @@ parallels_check_duplicate(BlockDriverState *bs, BdrvCh= eckResult *res, bool fixed =3D false; =20 /* - * Create a bitmap of used clusters. + * Create a bitmap of used clusters. Please note that this bitmap is n= ot + * related to used_bmap field in BDRVParallelsState and is created onl= y for + * local usage. + * * If a bit is set, there is a BAT entry pointing to this cluster. * Loop through the BAT entries, check bits relevant to an entry offse= t. * If bit is set, this entry is duplicated. Otherwise set the bit. --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697725109; cv=pass; d=zohomail.com; s=zohoarc; b=M1luvsITAyA7cAITBk3lBAjnF9GAOFyejx3HAtJ3GL4wFq533Qnu43HBp+zGVnYfdDY87Xnx/8ZZDvD/QWGntESNxR7zlyaAYya2zMWhygXn6wm3Mq7+Cm61k6znVeayN/mJAbUgLtvazIYmqSeLqWv2YOLdWjKy/VrwvvYL2SQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697725109; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=n+dkAU8jB3VPCRKq0mCBLdFkw9LSev8c99bgqrLPiBE=; b=CAmaBoYkKrUn/XvQrfZoyzt0IlAUsrjcl76Qrd5xEtL5e2jzTzZoku4Xn1QK5AqR8wdIgOnd+cPV2eBlmBxId0PWXXkyeUCiqJMOxt+StC21dV5WsCt2Z5IxtRHB+u9whxZyZUrHNajmsw+yFmc5pXNi9xJH3J+2V4GQBwG7rwE= 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 169772510979282.97559692381628; Thu, 19 Oct 2023 07:18:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScU-0005lg-Om; Thu, 19 Oct 2023 08:59:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScS-0005kM-Ex; Thu, 19 Oct 2023 08:59:20 -0400 Received: from mail-db8eur05on20725.outbound.protection.outlook.com ([2a01:111:f400:7e1a::725] helo=EUR05-DB8-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 1qtScR-0002g2-0j; Thu, 19 Oct 2023 08:59:20 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:10 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IhOHKpZcUvTR0rYe1zMACvj7svrzAQQUQM5LT7NM9M+UnmJTZRCYS8PEY/SESx6OZVhfT7xjqY90I4WSMfl+KXlJ35tqIko1TNNimI79xJV5fPqCFe3K4Is3UtAB4nZ1gF9fRk8haBJxI36k2ONmLeIjlIwGIdzMCEGNk7V7wOhLx5c/yCe/Esi3rf3DGePanpLCTjhjQFpVd4XRWfDkNm2saNTp4oOqkSbAmluVl8fU85kWuT/fG/2keekkTbyP3FUtZb+ET3dd/cNM9PToNF232aTiEXLqVRXVU/75BFepwkKX9p7vYfHw56CThIC+SLRzOTTYwu3WMdIEhsvc/Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=n+dkAU8jB3VPCRKq0mCBLdFkw9LSev8c99bgqrLPiBE=; b=aV0zvsMJgAZg+spmXTE/kZ7swWKlBDDjnx9sihkoHvLpk+5EF5TVX5djsHFRXqcvgjSgPxy8J0VlfJSpJM93M14kWvT8bULbiB4nVun8prhN+LzWm7uX0JZYb/4q4sCbjnViYcGpOE6JT2bT7xOZikMCagSoqfv0iN9rA2x78HHBDca0pNC9GoQwjt/sYm7x4BFx87OIxKOFY9va46LAz8tZ5MfRMBiQXT6AFUwPPEfPvucYEwInHkW624oopXIv9IhlyTTN6owvA9NkWNVA4zXxE1ufghla1WYb/bQoQvMojzKdmusMA71aNNSJopmRXd6Gk1v3yUmSDBczDfBO/Q== 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=n+dkAU8jB3VPCRKq0mCBLdFkw9LSev8c99bgqrLPiBE=; b=S+Kt8yWSQIrDdUlM+l69vJgWLfMj55CCM7O4nT0JE88hwa6yGlOYm6J1PZI2bpCl0ndlvUoHprt7AAOX7XuBGnwsiQsDTVXAuUHFehxn930xzJJYcjRsp5OTEzcQuMaXWqo/2nRL6NQo2KH02GUMiqzs/DRbSd75/ZV10i3aE7yDRT2MG5lUGISmtplU/iXhXi2MUHbrEvt45ph0JRpD7qxp75WKoawAe93cgZmnLfD3j4i1BiMcJ9AIj0lR47q/Gtw0m8Z6rFQWz0TT2f5UCEQqZaOJ40G+HSKG4RPFInm+cvgJ/VDk7KmE6QvVOUVyt8yVpUnbvzvvvcH9MAB0qw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 08/20] parallels: Create used bitmap even if checks needed Date: Thu, 19 Oct 2023 14:58:42 +0200 Message-Id: <20231019125854.390385-9-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: ddf71d27-3c45-475c-996a-08dbd0a32fb8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u+jeOXWp+pfLqpRhvrXhe0TuHgl+EeeC5piXUC67oHZ102queWjnfW11sY0n6k/Cu++75lH7zjFMNoz9OiKD0tAVyJuHyPSwO3NDLSffNXvPm/SGOmaj6OEkLoTcS2BRb8AojCH1mh2dcJZ+TB8q19G4kX0R5Lri5P1/7fAS23+LjK4wn+y7uaWsM4X42s8TdVZKvAcdD/XPNNHyyBezQjCFsiJIehtTbRQH9FznL4r+y2KgpLZTAIROwGsw5HxnBLOgkOq9sRFzFjqB7CbhGojysjSc/Afpwjd0rQBoND1ypnsxBPGE5qqLIjsR6vB2xxehIN4Y5GCniICZ8aR5sqdy5alJnQyFDkJBFDa5P47DXIBl+X9TnjVaQy3jQ+7PdyXKnm7ZH5nLlGQZAGvQO0AP1PVKJ+onle9SR1SS8dD4a8ZHtKcFbg/WmFqhf55UxPXfC9iQF4ZlXMcTk2Qsdsh4/3TQAaCz1iLgZB89UD/RUiDHlWzIm9K4yuB7TYhRe/3Y2C7fSqK6xzQZwl1xOUHmxCKuR9Lcyz//J1Ag4JALnxkK01S15UBucsGBkgt74qeGTl6yawedS6di4bAIC2UvEcWOCYJj4UTm8U29MyyTE4tM9UzX831wRBhv0gXH X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(4744005)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?far0YfP2Sr8bppqsPUrSl8SVlsqmzaEdnApE/AKsl5+S14GfrARwU50dwbWz?= =?us-ascii?Q?akkqSI0SY2rZ8xQuPNE0h6GQeBaskoxWS4qkGvcipjoEBbZS/1JQWJAtq+sH?= =?us-ascii?Q?PqipMaNrOadfSVPel0yViZ3y4/8cRMSEY0Gj59Z/eC9Un+C4tRW0iXQq0ZIG?= =?us-ascii?Q?5M+YuBGS6LddT2gSZ5jX3HFJxrgRBDD4493xWvD2HI5MH7kw/N4xGdPX1gjg?= =?us-ascii?Q?jimGyi0R7eN9ifkkrF7xQD8dmsh8xxKO1bkH30dip4r4JhhBq0XzFXPDlIRg?= =?us-ascii?Q?XVCnqsc38HLhXWEQfhqHxn/H53/5gQoPV+0virh22DORqa4cQTNoNBkA+WYU?= =?us-ascii?Q?gntZYugTv6mN3kZo/7CSXu0TJcO8mfTbCt+72uivSZhEM6GH3T5vcIXnodQe?= =?us-ascii?Q?Zt2CUVxJ3LeT7vIN0mSR0HUfkY8Q7MKTEWF3IRBgCWdAvJbxsZ2wI6F55PQZ?= =?us-ascii?Q?APuQpMnEdAePJ4XqTre7qg+2kouammWTftj5O7I9Tz2YeN9aetlDRY8y8w63?= =?us-ascii?Q?rIv2gK4c345lhCjZp26aIeOSDIwrqmkKoPlkfYhmUC5lL3D32n6GsOd8M+x4?= =?us-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/BQBfjye3LJcwYxToUt4OTVnkTf5?= =?us-ascii?Q?rkXCc5PeW+Th74rFgcjkL/2cY3sMKZjzxy2ztDmxybQLRjGHdsGSfJtnTKkW?= =?us-ascii?Q?prTjSqI9mPgcPShmkDjSpgNlDbRER5fiBi8/8N+Z2017Yw0ttzNjcphfQKca?= =?us-ascii?Q?TKVcKGKog1P6XTe+zpMI5wU=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ddf71d27-3c45-475c-996a-08dbd0a32fb8 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:10.5668 (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: D2e+jn88fwZpzEQQMcfm7PhorzRNIx+DfkxG4YoMp339j3bOwSJWlYyijv2lGzmjPq1X9fwciZuWsmGZvP5NCZRaPH2xHdD+lE1bIDdWrSY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:7e1a::725; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697725111143100003 Content-Type: text/plain; charset="utf-8" All the checks were fixed to work with used bitmap. Create used bitmap in parallels_open() even if need_check is true. Signed-off-by: Alexander Ivanov --- block/parallels.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index dd8ec925f3..a22ab7f2fc 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1422,13 +1422,11 @@ static int parallels_open(BlockDriverState *bs, QDi= ct *options, int flags, } need_check =3D need_check || s->data_end > file_nb_sectors; =20 - if (!need_check) { - ret =3D parallels_fill_used_bitmap(bs); - if (ret =3D=3D -ENOMEM) { - goto fail; - } - need_check =3D need_check || ret < 0; /* These are correctable err= ors */ + ret =3D parallels_fill_used_bitmap(bs); + if (ret =3D=3D -ENOMEM) { + goto fail; } + need_check =3D need_check || ret < 0; /* These are correctable errors = */ =20 /* * We don't repair the image here if it's opened for checks. Also we d= on't --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697723344; cv=pass; d=zohomail.com; s=zohoarc; b=XrzpuoJ8rXvrhBWsZfExfvLTMvIdi0A+odrt/oFn0OnhQ1Mw2zKnDjPl1XTRTD0msQ/cAkvbQIEma28RnNo7xZhqYqwhGOfmk6vxAPfQbxVc3noR9aQZVyYDLz7UGHsoMhi+g/fvlga+FCft4GXpRmm5bF+td+m9b1i8OPp/aYU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697723344; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DKb2aNDLw+nyj3qBLDs/krwJiCERi42BTes3pdyX/hQ=; b=SzRTHsZQN5uiX90c7mHG4zqEN0e6rqCWV3Eotwcf/VAjrCguFfMAPcEFOfqSJxPsxeJxmgJfcq/5h13F5R3AQZqtKQBvC3ko9KSKBotgLyLtQ8Z4ofk+xR4I0ssUUY7tX1Eld1srIMvZBWpKA24gmucj/Q6wvgPU0YGeIlmbYDU= 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 1697723344624502.7267139937909; Thu, 19 Oct 2023 06:49:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScY-0005o9-69; Thu, 19 Oct 2023 08:59:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScU-0005lR-52; Thu, 19 Oct 2023 08:59:22 -0400 Received: from mail-vi1eur04on0703.outbound.protection.outlook.com ([2a01:111:f400:fe0e::703] helo=EUR04-VI1-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 1qtScS-0002f3-G7; Thu, 19 Oct 2023 08:59:21 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:11 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RJWzBTL/8RjKawIdgF0s5R06JdKrWP9Om8v8xqtVPTWq8IDTxSv72hXmSXhJoSq49JQDf+YfEyHm2viO0YCv6NxjH0AdxTTNCa6aTI4Wyird6wbNSLt4yepDV8Wngwc4evHCP0xk3PQvEZjlhyUoWVhoM2b8oEUCI3vJ2mPFssBWcixxpWgk6RGPIv6kBUbat21xE2E7pG0+YTxgqLJGbGlLlOF23DXtAXToYeaiJPkTQfIxWKk1CTVni7KY/LcGjnLJU9JdKYASo60VQovl2ZRL7wPpqFoE0o7PslQ1tIlxJB2WaZGJILwkMYMnAJtQFZQVBLCpaEopd5b0SROMig== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DKb2aNDLw+nyj3qBLDs/krwJiCERi42BTes3pdyX/hQ=; b=B/tBlNAnSxKIcjQ/pBGG3tugKWUhECWTiww45sqoDNnd6pbdvsEjSzLwkGF1mvX/pscuagZD4J+Kn5nP/F4iYURXVMPXVleaWENGXlKT4Lnlrk1dOrWPTwoxY3S4o/l7wAt0gQ14dM9p2ExuJ319PDeCia1oIUDw8nJpAExtAFchr1XOreSeUjPRGE6GwpvqIO2eFFESAw0VYi9PIBreQYEzHKjHY6xSQNKlhbr9XcisMFdeF9r4k13WWZcAUY+faWL7ZzhC8rSSL3bc0dbtPKZ6XKPWfWV83z2xdQWfQ4ZmbmxSNe3nbP1TtX7W+gRrjh6kCk7DOFVuLle2j/TIug== 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=DKb2aNDLw+nyj3qBLDs/krwJiCERi42BTes3pdyX/hQ=; b=kQDsH917rsTiNngVKYW2THlQ5tw1qfjJJFrnZ64jKpBsKhN0M6IOry8L0ZbH842IuQ0l6r2xxL7cwhRGNP0Wjwne+N9LG3JHyWDNnchldj6eojIFvA1dnDHoaMXVtucvHymL3/oyA2UVBVIcCPGf+kpTpsT16oSNCXLHCQr24m5mdVT1QPnEMbdR9EnG/nGo4k6TnOrCrjTMxXok9rqnvUHiLWPQ6ren1WYtBpBTGCuYBPMfmzT+JBHlnobnzmfeMK62YdFz0GXWg8qMI9302AnzepOtQ1KEZbJm/iMiRzYxwHA/Lv70XTSRXFtPsdq/Ivx3ZvNS7cs4cHmIASlB/A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 09/20] parallels: Make mark_used() and mark_unused() global functions Date: Thu, 19 Oct 2023 14:58:43 +0200 Message-Id: <20231019125854.390385-10-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: c30cd856-055f-4def-541e-08dbd0a33058 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7rwjIYVRzibYwJCFpT4QQ6y/mmKITd3JOdpQdr7TXzPckJodc3TtrBFL4SbkwJzmDjAsKZDz5DDEYmS9aRbsH49LvRpgFzm5gsqiG4ps1hytdypq3sQyf0snEOwAfXwGafZeBByrI37Z5A2awHnqn59jmai4ZxXQ8iWpFzVWDXWdliXWtSA2Q2D+rGa2mU0zGr6G5QGiroSRpOrfhhfLh0ylVvdWEU9Jhwf7latzlSR6Kda48RGmG3flNLIxjBoU6YlFefj/PAlNKmJPtRZv13tB1Asbqo5zdT7ULs20rAxJZ2D+T+S7b6lYFxmXum9pE8178bp+z26lUeTqyJaq8J2Sjq0gPr/j++9/zO7rfBQMlEH2mVk7I0VZoGo6iEns1tHK0GMtfreLZMgZKxdpMq1DiWnZBP0NPeDMKIwigsAC+37eCK4X1rETLa2op5wZqks+dCNwwgQ3jglI4D1fY20IJ8fcIvT31WjktZQMsYFFti0iIi55Sh0pXs+4oQwdU23z8IznajLMABbBLFX5wxAhQ+OIPShT69+zO5cL+1QBCs7XXPSx8M6UipaZpfgtde9R2xay03hAsgPb77rUM0eG6po6jdE0aWdBdmZI5Id4aexfCo66QbPfvwcLombn X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?BaAAvWPxLflZutlGGX357QTsbIh/Ww7/ORF4qo7ThHFJWCAS931QMxcp7uXG?= =?us-ascii?Q?eVpTOkMPwuqbNNZBj65u2C/Pq5HZYwretVlCz6Z3g/efOxXuGDFPnDJJnYK2?= =?us-ascii?Q?eFPZtpu1wdZeuTqKM73PirQv2DipJZ/P/dYWsDYcfjjurImZHeDj2Fm+dR1i?= =?us-ascii?Q?KoNOkLFj5mgYtFmeucR//yFof3Z1Ge3zfQHVX7dT8Qa5SEDJr7OIdcCOJLWB?= =?us-ascii?Q?yAWttJOb8OHBNZCjKfyrd3zTAa/4J+pLnM3L8OCj5Qm+g17QaWHvj0va2eqA?= =?us-ascii?Q?ada7SWkI5YqnEN2wN+Bgm2lLeRuQQw5z31mG5B/QJ26Nc2rv7VZzhDopMnvL?= =?us-ascii?Q?yibUNOPHPUizMxk6AWZtGLnGrSEpBQe2Qihk2z9qXCdI0DYoabjzr+TbCYDf?= =?us-ascii?Q?C+dh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4aBE+ijho8e/RL?= =?us-ascii?Q?XzH1oIOKlGPawbv5X56LJh49LtgofOGdcy6cdld6TVUuXfy9dACRu3izNkMx?= =?us-ascii?Q?MfIr/14PF1hw2KejDBGxceK8k/R5MgULVJ0Jw3Sh0swmrye2773DF87/uuXL?= =?us-ascii?Q?9er5k3XxYK3wI3V3fBxfZqZwRuBWX/rscIH2ghPmU9zzihL3wIf8NjuBd+qx?= =?us-ascii?Q?lw4/cil4y3xTC6RhhU9gTAQZ7QXkEiorvDjs/NE07oTJLg4Z5gwKybvyc2rH?= =?us-ascii?Q?L8zolmTlpfWfPZEYepWXRshtz3lKODTemmHZkP61jyAxQbNIr3v3nHA0DqXH?= =?us-ascii?Q?xvZ/c+RZEyipgDPQTJEqMtc=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c30cd856-055f-4def-541e-08dbd0a33058 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:11.3969 (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: Hax1YSk968A7k3bLq6HtWjKo8MDn80zsfv3EPpM3M9UbIxaN0D69ExPhXRQMgnMXn7XYkD+t4C4A+VI6WyzEpc3llsAc5A2awppfrf9n8uo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:fe0e::703; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697723345358100001 Content-Type: text/plain; charset="utf-8" We will need these functions in parallels-ext.c too. Let them be global functions parallels_mark_used() and parallels_mark_unused(). Signed-off-by: Alexander Ivanov --- block/parallels.c | 22 ++++++++++++---------- block/parallels.h | 5 +++++ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index a22ab7f2fc..2ee2b42038 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -178,8 +178,8 @@ static void parallels_set_bat_entry(BDRVParallelsState = *s, bitmap_set(s->bat_dirty_bmap, bat_entry_off(index) / s->bat_dirty_bloc= k, 1); } =20 -static int mark_used(BlockDriverState *bs, unsigned long *bitmap, - uint32_t bitmap_size, int64_t off, uint32_t count) +int parallels_mark_used(BlockDriverState *bs, unsigned long *bitmap, + uint32_t bitmap_size, int64_t off, uint32_t count) { BDRVParallelsState *s =3D bs->opaque; uint32_t cluster_index =3D host_cluster_index(s, off); @@ -195,8 +195,8 @@ static int mark_used(BlockDriverState *bs, unsigned lon= g *bitmap, return 0; } =20 -static int mark_unused(BlockDriverState *bs, unsigned long *bitmap, - uint32_t bitmap_size, int64_t off, uint32_t count) +int parallels_mark_unused(BlockDriverState *bs, unsigned long *bitmap, + uint32_t bitmap_size, int64_t off, uint32_t coun= t) { BDRVParallelsState *s =3D bs->opaque; uint32_t cluster_index =3D host_cluster_index(s, off); @@ -249,7 +249,8 @@ static int parallels_fill_used_bitmap(BlockDriverState = *bs) continue; } =20 - err2 =3D mark_used(bs, s->used_bmap, s->used_bmap_size, host_off, = 1); + err2 =3D parallels_mark_used(bs, s->used_bmap, s->used_bmap_size, + host_off, 1); if (err2 < 0 && err =3D=3D 0) { err =3D err2; } @@ -326,7 +327,8 @@ int64_t parallels_allocate_host_clusters(BlockDriverSta= te *bs, } } =20 - ret =3D mark_used(bs, s->used_bmap, s->used_bmap_size, host_off, *clus= ters); + ret =3D parallels_mark_used(bs, s->used_bmap, s->used_bmap_size, + host_off, *clusters); if (ret < 0) { /* Image consistency is broken. Alarm! */ return ret; @@ -393,8 +395,8 @@ allocate_clusters(BlockDriverState *bs, int64_t sector_= num, =20 qemu_vfree(buf); if (ret < 0) { - mark_unused(bs, s->used_bmap, s->used_bmap_size, - host_off, to_allocate); + parallels_mark_unused(bs, s->used_bmap, s->used_bmap_size, + host_off, to_allocate); return ret; } } @@ -868,7 +870,7 @@ parallels_check_duplicate(BlockDriverState *bs, BdrvChe= ckResult *res, continue; } =20 - ret =3D mark_used(bs, bitmap, bitmap_size, host_off, 1); + ret =3D parallels_mark_used(bs, bitmap, bitmap_size, host_off, 1); assert(ret !=3D -E2BIG); if (ret =3D=3D 0) { continue; @@ -928,7 +930,7 @@ parallels_check_duplicate(BlockDriverState *bs, BdrvChe= ckResult *res, * considered, and the bitmap size doesn't change. This specifical= ly * means that -E2BIG is OK. */ - ret =3D mark_used(bs, bitmap, bitmap_size, host_off, 1); + ret =3D parallels_mark_used(bs, bitmap, bitmap_size, host_off, 1); if (ret =3D=3D -EBUSY) { res->check_errors++; goto out_repair_bat; diff --git a/block/parallels.h b/block/parallels.h index 3e4f397502..4e7aa6b80f 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -90,6 +90,11 @@ typedef struct BDRVParallelsState { Error *migration_blocker; } BDRVParallelsState; =20 +int parallels_mark_used(BlockDriverState *bs, unsigned long *bitmap, + uint32_t bitmap_size, int64_t off, uint32_t count); +int parallels_mark_unused(BlockDriverState *bs, unsigned long *bitmap, + uint32_t bitmap_size, int64_t off, uint32_t coun= t); + int64_t parallels_allocate_host_clusters(BlockDriverState *bs, int64_t *clusters); =20 --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697725804; cv=pass; d=zohomail.com; s=zohoarc; b=idfz/+CTciWHxM3jS2YpNmVHF3hMoz9RsaN1R7kTuN7vs2B2FfCnzaoGLZR6mNo0rWDQeGkVxlfJEuDt5YZLkwsU/BAQm/4qspNLoTCjc4FUtg24+vam4MakLD4XF82GHW6lxlRh62pq66RrK+IHMftPGv+REKr+HXAKDBtCDcI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697725804; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=P1ROKceqzdFsLtvMFETFdrK7Cy0QaljPXiPODplEFpg=; b=Qka/GFoOzByyfOFuR8MuZdzKbUzuh5OR20CyqyHFZqKNxoTjKmL0/WgPqaQmam7pDShtCJdSxsL4gXlBQdeZXlSuMOCQKnE+r4gS7Z9myI+UdkhDICmmOdAnt6RXkWKOC6Ta/pzIUO1/537t7yGkDFkrsx2w0aQw0waIZ9zAqFo= 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 1697725804120522.951759054813; Thu, 19 Oct 2023 07:30:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScW-0005n4-D0; Thu, 19 Oct 2023 08:59:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScV-0005lj-2G; Thu, 19 Oct 2023 08:59:23 -0400 Received: from mail-db8eur05on20725.outbound.protection.outlook.com ([2a01:111:f400:7e1a::725] helo=EUR05-DB8-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 1qtScT-0002g2-1o; Thu, 19 Oct 2023 08:59:22 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:12 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=goPCdXJyKGiNr5pGwILz3uQQTxEtKfWPH2woGRlsIsdYsHujugLtT7pLO+yHYS/4Pnt5Bc6T38SAmWod0khHvIZMpW6RFFnR3wrg0oEVMUXFmbVCzkDmxBBtH6+dYj9P4ztyrXNoMs2zAssTWVJW/ojZHtc9mvTIrlEIHW7sV8H8hBkqZQAg/6DJpeSXhZ0z56zwhoivwHD/1tjad+z4gI0RCGz109afuVASo1mibPoH7B3RHArWynOU48rU3iqPPQbrN32SeTMnEFOqXvB2JfJNZ1QXhsnR/pMbTQU9BKxsfhlsSv4KEl+cCd3u5PH48PUFA99LShQthc6Lq8J+4g== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=P1ROKceqzdFsLtvMFETFdrK7Cy0QaljPXiPODplEFpg=; b=IO3armO/ywc0/7cDhtCtfhB2OmJsV8D8Egq+SGt2CBmaIsLH008uPMmM7RlWlVU4XW22UTO+leuvSq15er4J8RGRkknjM5gxn6zJjHWDoU/04ds0JOlwcLbJYadUxH1D74P33eEpcQEpm1ZvloLdpjMYOoNRwE3jEsUd4PLEorf9Mhw/LLqwSgf4SeGvJ1W+Fwv4RrAuNvpjCKoDXz6rWd4uMXqAwpRwst5/LWuFO7iNZ56qzEEDQraytaQd9/oMqdZIvxQNUOwkLGybzoJPCPAxDHs94IwYI7FlK/CSfhdH9li7oAAlYJ0waNFJIXmS1kC/1y4gHmYOGg7ZdM+sIA== 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=P1ROKceqzdFsLtvMFETFdrK7Cy0QaljPXiPODplEFpg=; b=uFbbxq9/7/BhQPnzPX++XCy05xxnVR1SBJSEWM1I0VZ4+ab612ozeADhd24gj3zlQ0PicaDq7NIJ1jsQ0sElhWbr2fnCVgZThsPigHChbPMq8ROEL6sLV/btN/g+B13V5L85sfTcIOJgWNzC1x5SnTKr3JdAnKOfOr1r1T+QdIkAKPA7qx1/Hw/yYlqC7YKpa3boz6NW2KMTBra8zupJnBm7Mqag8fWDhWOAib5cnkE6Mp7lMQBM++fwrSfngDNoJqT5vOnGXZICxOMeLRMpF9eDnt8a/BI4O+Hcz0IbiX76VbmwJEZB1PSTR3sfvPN27ZjR52GFNQ81v7yxBz1fNw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 10/20] parallels: Add dirty bitmaps saving Date: Thu, 19 Oct 2023 14:58:44 +0200 Message-Id: <20231019125854.390385-11-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b652caf-392e-418e-8795-08dbd0a330cf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kZifmBI7YHsM4Da4KHQdRkEY3oTqwB/t+9venAp8ioL1Fum+2rbjUiuy/V6k8KQuLiYEWagvtrHa2gL5wAOUEmneNNkIq4MwwRv1tEFXXV6Ps1yn3AGo41vcvO7htvN1gxazn0uCMy4FaHIHkWD6TWrSxZd4Hvgh2eHQ8IdigQf9/Ry4Q9HRIwE7nedtmO+Cwr4UTK8xZXTwD2ooJoUcgXimn3WgZ6LRHcrWMfffu0FcTLR9ofNHJZBssYlC7naei9KMoN10G0OtfcLPc0MrirqLJjXKUvlBCcRVj0o4UIqMO/o1qbfXAVsxJAJXc8K2b91gMJdfSV9fnzb4vuEDMQkFBX3zfBaFSwtOHEy/1GQRepTwYj5o1Vlmdzms3SGgP75HT+84c6WSX+Z8d1o1edDGs+VuhGiBmPPEB0XBnVMv/0NQ0JCl97CNidO603hziAj3Wl7wU+n/mFBOGq+PAO0cCAN75FqLp1jhA9+N8cp8YaG7XBThgBcZOBt43AeJMbLOVMiT2vmnAj4b/dwF7xrkFaq1JyHmZbg/kOqelSDdKyIx1XXYyckCzIB9gG0dVCWrSGqzfZBcmvhw3/nNPXm3zugVkEokdaZbfK1OlKyxBY7I9EGH480tJe/YeyHLrTxdrR/eH58DPQeYBXJojg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?eAr+U1aMATqS4Zb1Y4gLJQHVa6Vco2pHeOIqGstrHPuN5K7PwU7ovuwwQ3mq?= =?us-ascii?Q?qdrY7KcDUfie0Z3RlhAoVlgIdT553uTc0NplG7eOGy0dq9eRd1ASJp4MSZ7b?= =?us-ascii?Q?/uRFaHWn7iYQ+RsXME7B8WAp+/78NwWm5sW3GYj39yVDbien6JBREOFsFWcl?= =?us-ascii?Q?4LvUsln7BEi5Rd3FL409CewrOg+M4Ri1PKWdbBVujjmrvTaXky8kgtNSCb4y?= =?us-ascii?Q?efuUdf7w3ORldoS6CTAsfdFZvfpfRt43QibLI82wGuvzEbLrRd6vJtfWN9oh?= =?us-ascii?Q?DuRED4ExifJAii1USbCptnPJn1XvLgeRu3ddeWoB/9yaQYS8YuR2aFpeTZBz?= =?us-ascii?Q?tEYbyMXEY3yOx8KUpxn/iPznVWDw98ZjYCwMLplF7ygHWdQS4e5I8SZK90xZ?= =?us-ascii?Q?ShedwkdeiZqe16MflpXColsXlXKY9q2VlYB2eRorGXJBA3TaeQQCIVkNoXjE?= =?us-ascii?Q?EKgnFt51TmlU2S60eGeYHuESdfPPRhoL7Od49JoMiUb9JjptEQY5D+lvlIbP?= =?us-ascii?Q?mTdsDEqet0ys0wSPR+t6pTmYGp76WScUOyqIk3071eGmYJhf7yvo/cvLhg2y?= =?us-ascii?Q?KwZYKgGq1OxGgWn4iaLN7Y3HA6VgB6rP7HK5Pbdgcn4N02Dufo2TEoFcQF/X?= =?us-ascii?Q?EASt4qE87EHeC/OkLfcQ+UkgHN358Q6CvEBy4efHuHf7Nq/3PBRX8uGNfpAr?= =?us-ascii?Q?RSQsApyxF50ZkVRRwFzLJ007wCkF/cN4IBU0iJaOQN8PNC5mkgM6mg8QmTui?= =?us-ascii?Q?UhRx1deqACkCwmkIhtsqo3aUcaZBxWNm8h5ozyLv1vW219PykOjQNMq8CYEG?= =?us-ascii?Q?EhFBwQ+WukYs99KEz5LVnciUh3vHIjXfwFsdLbDGafbJzE/uso551dZGKZvy?= =?us-ascii?Q?6frJ6bY2KQGpKSTBSvF1mnu5aBqYOLRcLdeRKw/L5FcTCJPk25FMrBV3QMia?= =?us-ascii?Q?cwoIKnUx/92AtH+yTlMWpEiawwwjXBwTy0+7IQcTJiMdViFdBN7Qcu3qaBQ1?= =?us-ascii?Q?ErCuFPC/bF4/vFAnjgolLp8MQSxmL+2JZSdce3H6324kt7f+I3UHDHng7FKO?= =?us-ascii?Q?IwnRNCEkZO6YAZyCmFOusSn0yGt1jz2n+oH1lrFgUIP8IalNTTAIqZXAtUyD?= =?us-ascii?Q?sw7kQ2l44MsKzuP4X8cGodeEgldiZMOqrOE2DgvLdZhMAClACryuIBEmje8K?= =?us-ascii?Q?Z3k1vg7ur7qbFV1ClOgWz9a6WincTfi6UUQVtZzTB+5V25Q8dq489xTBEHuJ?= =?us-ascii?Q?z8yM6XgkHtPgE8nmVE4Qx4ZueXUdoHj5NKwwY2sLR9jWenrRttWIKyZMHLIw?= =?us-ascii?Q?JbEINnC1DHxIBa8p/rb2SjYijxCoqeW5k0IvBodiwJzNleiiwjaSR+GNJFNM?= =?us-ascii?Q?cz/YGdrAsqM1s3lPD8e66sXT4oAvT9Hd6+htRgnImZf75AeU+AQ5KK3Lkl8S?= =?us-ascii?Q?VwBUYvJQWGqJA/pIiQezeSsrWgUEn+GfhpJvh2+0WmmUcktnWPpL3ICB5H0c?= =?us-ascii?Q?Hak8Q+H7dpnV7PKeJiw+5oPeV2kVBjDjTWevo3Zf1b0VJv4M1nynXTGQVj2d?= =?us-ascii?Q?g1eCjH773zSMdQUtT2zMZjnxkaohFNPyG8lATF47fW0nU5XoUsBy2sXQb0zP?= =?us-ascii?Q?fzkft5MMcw7nz8kT9Y8wsWI=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b652caf-392e-418e-8795-08dbd0a330cf X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:12.1561 (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: Exkt60UQ8BHwgbO3aEA+5mnGs3XlFuYNh/AZ6z98DuJnzmKAnzghvNfFR2bHrBgRph/TgfYGX/OVb/ykJ95EjCj3vp5kkN7OCbkzcTjfh5c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:7e1a::725; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697725806320100003 Content-Type: text/plain; charset="utf-8" Now dirty bitmaps can be loaded but there is no their saving. Add code for dirty bitmap storage. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 167 ++++++++++++++++++++++++++++++++++++++++++ block/parallels.c | 16 +++- block/parallels.h | 5 ++ 3 files changed, 186 insertions(+), 2 deletions(-) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index 8a109f005a..0a632a2331 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -24,6 +24,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "block/block-io.h" #include "block/block_int.h" @@ -301,3 +302,169 @@ out: =20 return ret; } + +static void parallels_save_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *b= itmap, + uint8_t **buf, int *buf_size) +{ + BDRVParallelsState *s =3D bs->opaque; + ParallelsFeatureHeader *fh; + ParallelsDirtyBitmapFeature *bh; + uint64_t *l1_table, l1_size, granularity, limit; + int64_t bm_size, ser_size, offset, buf_used; + int64_t alloc_size =3D 1; + const char *name; + uint8_t *bm_buf; + QemuUUID uuid; + int ret =3D 0; + + if (!bdrv_dirty_bitmap_get_persistence(bitmap) || + bdrv_dirty_bitmap_inconsistent(bitmap)) { + return; + } + + bm_size =3D bdrv_dirty_bitmap_size(bitmap); + granularity =3D bdrv_dirty_bitmap_granularity(bitmap); + limit =3D bdrv_dirty_bitmap_serialization_coverage(s->cluster_size, bi= tmap); + ser_size =3D bdrv_dirty_bitmap_serialization_size(bitmap, 0, bm_size); + l1_size =3D DIV_ROUND_UP(ser_size, s->cluster_size); + + buf_used =3D l1_size * 8 + sizeof(*fh) + sizeof(*bh); + /* Check if there is enough space for the final section */ + if (*buf_size - buf_used < sizeof(*fh)) { + return; + } + + name =3D bdrv_dirty_bitmap_name(bitmap); + ret =3D qemu_uuid_parse(name, &uuid); + if (ret < 0) { + error_report("Can't save dirty bitmap: ID parsing error: '%s'", na= me); + return; + } + + fh =3D (ParallelsFeatureHeader *)*buf; + bh =3D (ParallelsDirtyBitmapFeature *)(*buf + sizeof(*fh)); + l1_table =3D (uint64_t *)((uint8_t *)bh + sizeof(*bh)); + + fh->magic =3D cpu_to_le64(PARALLELS_DIRTY_BITMAP_FEATURE_MAGIC); + fh->data_size =3D cpu_to_le32(l1_size * 8 + sizeof(*bh)); + + bh->l1_size =3D cpu_to_le32(l1_size); + bh->size =3D cpu_to_le64(bm_size >> BDRV_SECTOR_BITS); + bh->granularity =3D cpu_to_le32(granularity >> BDRV_SECTOR_BITS); + memcpy(bh->id, &uuid, sizeof(uuid)); + + bm_buf =3D qemu_blockalign(bs, s->cluster_size); + + offset =3D 0; + while ((offset =3D bdrv_dirty_bitmap_next_dirty(bitmap, offset, bm_siz= e)) >=3D 0) { + uint64_t idx =3D offset / limit; + int64_t cluster_off, end, write_size; + + offset =3D QEMU_ALIGN_DOWN(offset, limit); + end =3D MIN(bm_size, offset + limit); + write_size =3D bdrv_dirty_bitmap_serialization_size(bitmap, offset, + end - offset); + assert(write_size <=3D s->cluster_size); + + bdrv_dirty_bitmap_serialize_part(bitmap, bm_buf, offset, end - off= set); + if (write_size < s->cluster_size) { + memset(bm_buf + write_size, 0, s->cluster_size - write_size); + } + + cluster_off =3D parallels_allocate_host_clusters(bs, &alloc_size); + if (cluster_off <=3D 0) { + goto end; + } + + ret =3D bdrv_pwrite(bs->file, cluster_off, s->cluster_size, bm_buf= , 0); + if (ret < 0) { + memset(&fh->magic, 0, sizeof(fh->magic)); + parallels_mark_unused(bs, s->used_bmap, s->used_bmap_size, + cluster_off, 1); + goto end; + } + + l1_table[idx] =3D cpu_to_le64(cluster_off >> BDRV_SECTOR_BITS); + offset =3D end; + } + + *buf_size -=3D buf_used; + *buf +=3D buf_used; + +end: + qemu_vfree(bm_buf); +} + +void parallels_store_persistent_dirty_bitmaps(BlockDriverState *bs, + Error **errp) +{ + BDRVParallelsState *s =3D bs->opaque; + BdrvDirtyBitmap *bitmap; + ParallelsFormatExtensionHeader *eh; + int remaining =3D s->cluster_size; + uint8_t *buf, *pos; + int64_t header_off, alloc_size =3D 1; + g_autofree uint8_t *hash =3D NULL; + size_t hash_len =3D 0; + int ret; + + s->header->ext_off =3D 0; + + if (!bdrv_has_named_bitmaps(bs)) { + return; + } + + buf =3D qemu_blockalign0(bs, s->cluster_size); + + eh =3D (ParallelsFormatExtensionHeader *)buf; + pos =3D buf + sizeof(*eh); + + eh->magic =3D cpu_to_le64(PARALLELS_FORMAT_EXTENSION_MAGIC); + + FOR_EACH_DIRTY_BITMAP(bs, bitmap) { + parallels_save_bitmap(bs, bitmap, &pos, &remaining); + } + + header_off =3D parallels_allocate_host_clusters(bs, &alloc_size); + if (header_off < 0) { + error_report("Can't save dirty bitmap: cluster allocation error"); + ret =3D header_off; + goto end; + } + + ret =3D qcrypto_hash_bytes(QCRYPTO_HASH_ALG_MD5, + (const char *)(buf + sizeof(*eh)), + s->cluster_size - sizeof(*eh), + &hash, &hash_len, errp); + if (ret < 0 || hash_len !=3D sizeof(eh->check_sum)) { + error_report("Can't save dirty bitmap: hash error"); + ret =3D -EINVAL; + goto end; + } + memcpy(eh->check_sum, hash, hash_len); + + ret =3D bdrv_pwrite(bs->file, header_off, s->cluster_size, buf, 0); + if (ret < 0) { + error_report("Can't save dirty bitmap: IO error"); + parallels_mark_unused(bs, s->used_bmap, s->used_bmap_size, + header_off, 1); + goto end; + } + + s->header->ext_off =3D cpu_to_le64(header_off / BDRV_SECTOR_SIZE); +end: + qemu_vfree(buf); +} + +bool coroutine_fn parallels_co_can_store_new_dirty_bitmap(BlockDriverState= *bs, + const char *name, + uint32_t granula= rity, + Error **errp) +{ + if (bdrv_find_dirty_bitmap(bs, name)) { + error_setg(errp, "Bitmap already exists: %s", name); + return false; + } + + return true; +} diff --git a/block/parallels.c b/block/parallels.c index 2ee2b42038..bb1e765ec8 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1470,14 +1470,25 @@ fail: static int parallels_inactivate(BlockDriverState *bs) { BDRVParallelsState *s =3D bs->opaque; + Error *err =3D NULL; int ret; =20 + parallels_store_persistent_dirty_bitmaps(bs, &err); + if (err !=3D NULL) { + error_reportf_err(err, "Lost persistent bitmaps during " + "inactivation of node '%s': ", + bdrv_get_device_or_node_name(bs)); + } + s->header->inuse =3D 0; parallels_update_header(bs); =20 /* errors are ignored, so we might as well pass exact=3Dtrue */ - ret =3D bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, true, - PREALLOC_MODE_OFF, 0, NULL); + ret =3D bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, + true, PREALLOC_MODE_OFF, 0, NULL); + if (ret < 0) { + error_report("Failed to truncate image: %s", strerror(-ret)); + } =20 return ret; } @@ -1528,6 +1539,7 @@ static BlockDriver bdrv_parallels =3D { .bdrv_co_pdiscard =3D parallels_co_pdiscard, .bdrv_co_pwrite_zeroes =3D parallels_co_pwrite_zeroes, .bdrv_inactivate =3D parallels_inactivate, + .bdrv_co_can_store_new_dirty_bitmap =3D parallels_co_can_store_new_dir= ty_bitmap, }; =20 static void bdrv_parallels_init(void) diff --git a/block/parallels.h b/block/parallels.h index 4e7aa6b80f..18b4f8068e 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -100,6 +100,11 @@ int64_t parallels_allocate_host_clusters(BlockDriverSt= ate *bs, =20 int parallels_read_format_extension(BlockDriverState *bs, int64_t ext_off, Error **errp); +void parallels_store_persistent_dirty_bitmaps(BlockDriverState *bs, + Error **errp); +bool coroutine_fn +parallels_co_can_store_new_dirty_bitmap(BlockDriverState *bs, const char *= name, + uint32_t granularity, Error **errp= ); =20 =20 #endif --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697720405; cv=pass; d=zohomail.com; s=zohoarc; b=bkOsGuh3T2KHKEui+OrnH7f54kZ4HoyRBROuVKhYOkEV5kwkaZKt7D0CAxiVUPYG5g2AubPvP4IrIkri6tD24t+Xkv0yNnojI6Ow5SsIBh+7PI5I/Jo2qFGj6rPj37FVDNLRHJlQd4jLSdVyFzlF9sSnTLEPYJfFTJpYeuwWQPE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697720405; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3UUsUWJac+HNAUU17zSb3q3mAf9jMCl9RlQFBSNn+z0=; b=autHsyzGm+iYhtSKzLmOIAb4BcZAoRCWaWsOpVhEbWprcXtcbbtk3E7Kg4eC+gSid/WJ6ICOfy4LaupHMd4fCUxNmY485UXQIRoBJPI0rj1G05dftYwoilKAQTSeMKSEZdSbFM525FMGSeozfS/+9XgoODrQ1ilME0EQ2DzmAVQ= 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 1697720405563141.79669451329005; Thu, 19 Oct 2023 06:00:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScc-0005sJ-Ur; Thu, 19 Oct 2023 08:59:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScX-0005nr-Ov; Thu, 19 Oct 2023 08:59:25 -0400 Received: from mail-db8eur05on20717.outbound.protection.outlook.com ([2a01:111:f400:7e1a::717] helo=EUR05-DB8-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 1qtScW-0002iq-37; Thu, 19 Oct 2023 08:59:25 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:13 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z9lZ2GiL4hnOsIp1WO+Q9/TiglsbRtCVNj4cygyKGqJcQdaxnE1XnRsiq+xNQc73iEZW2vZbtHir7jPp6030yJgpFFmVKl4egoMG8u0dwUdGV+LPCk7OWx+ilU6bIEwWwx0niPzwwqZo/sEED80Q8g+O8CXfZmICkZEt2Q/N+3hv3jD3srABeTBuUsHPugJQ9l3hdW+TDcWtvzEwQSvRUZ8EoclIhyp3zPi2LBn0jE/8y0GbJL4fvXUAxqtehzuBp3REvH4dGoiS11nNjztNvW/SoJtp23DWR/1fns5x6lDh2sF4ehQ6R6f4BkSv0NEdtVf4IuUaTxpzPCO8Blqq0A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3UUsUWJac+HNAUU17zSb3q3mAf9jMCl9RlQFBSNn+z0=; b=BY+dACuvAj7aIEDyUklBEaUbuQub0Vd9Y3zZbX+gB6ICDCkFs/BgjRXtxu+Juw9CNHQ0ciwvLDLHJ3EJWajW0kC8NhchGgY2FPoB1RcCbFitCzINkBbDvdV/PlenwVWaEMMe21B+T6qgHZqFO0MKBG2Q1rcemr0EKjPaGJ3CXodLlhDf360K2owikEWsEFk83JBRv25Pev1SGlnb4McrQ++hMb5Bhg2BUlCs3fDMLJEf55OraOL29bYjxUpQxFurfjMWdWmcV2vb1JbiZoGt+cosF35zruS432JeNegN/+3dBObQ8c+/GC3ipE/3fEDgNjwbAEE/CUi8LMoznbTEAg== 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=3UUsUWJac+HNAUU17zSb3q3mAf9jMCl9RlQFBSNn+z0=; b=Pif+O8e2HuknLvUnCqqDOcJV8BIfuz2LId2eWaQf7BgzXxVy2vQAzTp0Q2HHw3Y978qCGmglsaaplu8kBM+aMcwQh7co6C7e3n3u1Bb0T8I8H4s0uLGVtV7yP7Zghg5vAHzzJw+IQ6PnX2x/Fl/+4VERN45UecbAb8Q3hIGLyDfk4WQr5MbXinLQFWnQAIeo48Qx5RMxpgUTn59cumsn5JIxjlVGE+SqzSZQAEay80zdhUWMXARTrGTfNiypklOI/ecXb7ZF6k58TMijy3mRvb4QP4on7g7/ohdh/Wpg/5PG8rh0a7gjuakEkAfN3zOgom0BA9+avszsW2XFIgaVeg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 11/20] parallels: Let image extensions work in RW mode Date: Thu, 19 Oct 2023 14:58:45 +0200 Message-Id: <20231019125854.390385-12-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: e5369127-ff5e-40ca-58be-08dbd0a33144 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +oLW+dqlBz3iqWr7JdgDSnjOJhHJmB6eDeFREt+JnZmOzad2TkLKlMb1FWRkXh0ZCrlHy1UdLzwXVPcbH+Afg7GZi/LOxUzKU18lmxpR7eTtvO4lgmpUcFWraCzZMuYaFVBwM79i5VGaFah3grjMudfbr51luteWNstzF5xnLlT6qp+0+PviQHDsrz8R4bhyI0MQKwOs0aICz6WV9wMfNO4clrKWRk/dldGxjZF+nuJbWvtrcDS6RQ+wbBFqaF8bqWKANrjjvBEWpMmvWckixzMn1/eEl+wtwg+7h7lwRTtawWp4erVn2QnehtS+sHC+147sHVa9eKmzWnSDxFWx8TUVp1g5bqOgiyAoT9p424NyeWkWtHmaQJ4PLfPCUiuRMOx6Ky3F1ZBevOP2e7FCTIHgUBobJLK37izDaJ+5nauRUbeB1Kkh7zfoE9nvkQ/Tcu5QBSSowiDlFcPiUqQ5KBbmro5dTQGYNp2GwwG7zwpI1FFAcq97VM0P7/mUpuD/YKiiEMCQVabVm8NPLo3vy/ogJWOW2M/mNNrC4Wj5rmJXqhfcabEzY2dXxxWRDCSjdG/iLrjIbnhuvYpafoYoXX42s7dLHmR/WMoRaXFJMrl09yUVpM+BdAa3duTkJKms X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Pq6F8Xk29nF829q88rvoNfP+Vs0PwWn/8xJAVm84Ai/BP6Ewnvzbjw0CZL54?= =?us-ascii?Q?1McgMEl931hEZA3n84IAES32No7TSr83edeGzZQTMVwUZIsLsHvGONWBXUmU?= =?us-ascii?Q?gSy6vxinJy6YBML7NDQKsyAc2SzNHWWV2rQ7bfZB0pBuq9TXXNKgnrqlWUVZ?= =?us-ascii?Q?K7Tf2sG6TbJbfExNDyp1ZSUkoaKZcM5L02aEcostFje8+KWAgAmDe2HNiddM?= =?us-ascii?Q?HnFKEDrdqzJmeRq9QmjYaKlEuGMBmX6+mjs432Hc0VQUoWdpBF3doZ8km3RI?= =?us-ascii?Q?cFQPFZKkTlCmwEhseDqwlsfIeIDgFvxI0JFropa//TnccNYkd7V15opbR1zp?= =?us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kGObr+CkGcSHE9VKs?= =?us-ascii?Q?0gKj4nm44S2eVcBfiyTjABqc5W9X225VExiTUBKB4osJMUnLtJMZ3sGgIFch?= =?us-ascii?Q?wFxKSRC0uRdAUV2jbi5gHLQ7hGyH64z2aGdxlFfeo7QIPZ3hRmJOD8R+gf8w?= =?us-ascii?Q?di9xXivb+nCnh8euAQjcC1kqhhEZ+n8zIPiSz2gDwgiDNxW4Cxx2cRpbywoM?= =?us-ascii?Q?GRaBFYD18HUfXkC6bgJfhvWQ74x/yBh+3hYmi7hABzJXvEoBqf2kk3JVmZm+?= =?us-ascii?Q?OW8Wi/aWzVoBS2ecmVNR5C1tV3Jw3nvmr2G7pss60GcL6/HgatpGIulCCMkG?= =?us-ascii?Q?U5SBrDUgUsX0FsHFbASijifG/yJyvSKRyNfW94ye2EifoMxNdND07oTGwGmM?= =?us-ascii?Q?aILdHHboueWE5GHk5oOW3k0=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5369127-ff5e-40ca-58be-08dbd0a33144 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:12.9720 (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: CBoP+JIb8zOKMqiobYE6Yu2G9D9BZqgCDfFLix6JxEk2BH2TJdgejMNjiRKDWyw8pP/b8pFRVR4xvb2qIWzs1M0j0eNB+mu2GqFRAc0DtEU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:7e1a::717; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697720407370100005 Content-Type: text/plain; charset="utf-8" Now we support extensions saving and can let to work with them in read-write mode. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 4 ---- block/parallels.c | 17 ++++------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index 0a632a2331..a0de4f1b07 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -177,10 +177,6 @@ static BdrvDirtyBitmap *parallels_load_bitmap(BlockDri= verState *bs, return NULL; } =20 - /* We support format extension only for RO parallels images. */ - assert(!(bs->open_flags & BDRV_O_RDWR)); - bdrv_dirty_bitmap_set_readonly(bitmap, true); - return bitmap; } =20 diff --git a/block/parallels.c b/block/parallels.c index bb1e765ec8..2198eff21e 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1374,19 +1374,10 @@ static int parallels_open(BlockDriverState *bs, QDi= ct *options, int flags, } =20 if (ph.ext_off) { - if (flags & BDRV_O_RDWR) { - /* - * It's unsafe to open image RW if there is an extension (as we - * don't support it). But parallels driver in QEMU historically - * ignores the extension, so print warning and don't care. - */ - warn_report("Format Extension ignored in RW mode"); - } else { - ret =3D parallels_read_format_extension( - bs, le64_to_cpu(ph.ext_off) << BDRV_SECTOR_BITS, errp); - if (ret < 0) { - goto fail; - } + ret =3D parallels_read_format_extension( + bs, le64_to_cpu(ph.ext_off) << BDRV_SECTOR_BITS, errp); + if (ret < 0) { + goto fail; } } =20 --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697723332; cv=pass; d=zohomail.com; s=zohoarc; b=ZGxYGUhHhQBN0kah0gOygPsM6o5i1F42HhwRzSbcRPm0KYu1pjeJCSsjgv7R/Gxtevi91sk8uu3U186Klp6xA3jKMSvwwGyVTvi/83o0dwTxXhCsqDoaLiL4ytt1nEBNB1aurh5SwmimRP2Yzc+JTqhhSnyh65sAcVcvUU0t8HA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697723332; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/k1oANas5MIf55ewby6rPkY5+MPfOFhL+ASOIh1bWOk=; b=ZuirTX/mLORzwVYRPYETQVMCVzBHBCkcMkhwkqD+O+Kt/Y2oERoIRLIx3/O5qr/DOVZ3HzxmTDMqlPWjxWqzWxUpl8IVbJbMCLHOqjJAqb5nBGv3+TZV72/rYU8JeHjRZb6KGRAuaCh3S/3eMA3ZUkNYB1QCokDvHVzcsy3l5Qo= 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 1697723331921246.70620359408076; Thu, 19 Oct 2023 06:48:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScY-0005o6-3R; Thu, 19 Oct 2023 08:59:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScW-0005nF-Cm; Thu, 19 Oct 2023 08:59:24 -0400 Received: from mail-vi1eur04on0703.outbound.protection.outlook.com ([2a01:111:f400:fe0e::703] helo=EUR04-VI1-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 1qtScU-0002f3-S4; Thu, 19 Oct 2023 08:59:24 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:13 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nevb5vtx8DiKfxC4JJOw1CJVey78KVhrhxuehhyK/moK76QXFpCkPgKQvxqmtpxI8599bNClwyvI3qK4UfRsSBGPwlmE3ofXnuY6V8a/NGztJh6uIY5TiQC3OuxW6z6BCvSIfeaorywsfORDh+3bze7DpB+1u4i4x2mmG1trl2A9RGqGHLgBvulKTzYYfDBgDrMLH4t4FubRndbUhv4FlwBHiCXnVtAPa79OViQGdubz33Tj3SESUj2cV8a35Q6RretBmoD6CE5Lgu6E4d/iSA19QXUckp7q47YaLwD4GP9hqdgDs9Fue3+ZjwrsC4N7C5iaOOBatnTLdKFZ+CWokA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/k1oANas5MIf55ewby6rPkY5+MPfOFhL+ASOIh1bWOk=; b=OQ6e7LySIuBKsdoRDiIpTg5hn5WcDBH8JFpEUWxxzQKtrD0O8p54D99edFmpQaH++nuX/nTNR4AmBIguX/nk0woRk2+UqSLu7LCSNYU3LjkAXl8v7VmoaMqkSOLBdtflC2V2DwOvblgJYvQFQZuSptconCL+i2ldojMTwFnBcPrKbvjj19/VVfgGrIBtmYGgO4NVQt2i8I5UBgrl4UFXHgMRrLOYiAXuIhPM4eZWwBE/blWa5obm+Y2p7yqlU4mPeFJ0K3r+d02ExCuEfUJUA0eGgwrzz516LGCmDGu2Nw8ArGn3azBwa7du3AwTJHOE3QA3x0VwOY1f2wDyunkeBQ== 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=/k1oANas5MIf55ewby6rPkY5+MPfOFhL+ASOIh1bWOk=; b=tGWUyaAqnX7+6qMTzGJVWUkEuR41yMoZnwkXC2wsxQWMsZmHUHurxOwfFhnj+snRs4ycxUvUgpXX8z6ip1plF89GJPcokoTLg0vD21A/R9ZZCk1EieBo/Lp7Gbg+a8fLPLCsgZe0jWULm6X5bVfZ6L5Qw30jGSZfK+/pZyjULEsgqNv9E7GmgScxeeynZreRuUt+wcQ0kraTMQvTLB9NtSmnt6IVLYPXuCCkbP7D82A5Ed7mtokoEB2fwJc+Y9CFgNbF50NiBbqhK7DGYH6aVyvLtP5yL/ckLHMCKGwW+WV0nHktbBPOXRkEtNWOk0LTcBWYDIP3fPYvr3saVejowA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 12/20] parallels: Handle L1 entries equal to one Date: Thu, 19 Oct 2023 14:58:46 +0200 Message-Id: <20231019125854.390385-13-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c90fad4-4547-4535-ee88-08dbd0a331bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YUzOByOXB0ezPnKfUmfSWe24LbzJX2LJPS6VcwQ1PlcHrIiy6ks5S2qC+ZASMbtuiaxpGarguTk5jKEXv7jbnPKPBRvx1ZtlnW0+RPVK4jh46bzPeKmkigHxysDcvqkGYYg7hxoo/mfWeBWWSpmEYt1jmjIyIEns5LZI5uLS25VY0KWvtH+K4N8SYvfoMYPFE6V/rmEMpW9Oyp5v8UPle9xA81d/KMxprhH0Qxyyif1RqeVV/1ulhF+fjsb/mOsNOheuuCSmzzXDkI6XbyFR1VqB+sj666sJGqGoR/sCkPYDV2RnXR2i5BgYemlL3MC7IGIidHDIl+6+qoXotiWG3xlNXh02uUisWT2/kH5yiZ3TC4ub3tpnCf/aNgVj5UmyzNSlKPXEbVj4IuhVPMwic+rfIeJuHIn5EaATKHLkk3J6ui7BGCF84qFYnanWzJ8wZ/m3JrbH/B1IoptTUOTu3P0NfL/rAtIYst3Vmfn1SlWM/d8Ow+MhHNTf89HrHyHLxZTKYlD1stexvw8dRPEuYc04Wzq3d9K/rO8IgebvANhJY7o++tr7Oe5brndkKvTm222aN5HjLgxxWeYvHPeUrUzUDX5HO8tWbw2vAJr6/hjnIIrmlH5baTqsRZdWc3/z X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?DG7AIn9+ZWo9EfvyOFdykxzm9eMyPgamcd7XTw0aqh7kuMvQdf1QgHHoqwi2?= =?us-ascii?Q?i7r5w9Or1l4f3R1Jdyv3L1ITRfzCbiwag3I0s2S9XNAoke3Qt4egum0kYUGd?= =?us-ascii?Q?UONVZRFYP9J34KlXN99ss5cWG0jVNytkwoXgbwkrO7dLa8NHEcWn+p+Ubi77?= =?us-ascii?Q?DQchb23dHBe44CiR1IsE5rhzyKU459v1nNoeHZN4ucCFHVx0/rU/FFqJ4Jrz?= =?us-ascii?Q?lGJxc1gdLk3Ep3EioZHRzWTX7+nuhjy1JBWk3IiNiL4lyuNDHwMun9ZZ1CZF?= =?us-ascii?Q?e1LATINKXlfsOaxNFw8KAN/0fYNw0wSzkEQ/uHzsPpvcLHGUj/UDMQop3e/B?= =?us-ascii?Q?u4I029lQpgyyt2nV0/toI8lL2fua/8JJYf78/nnrjU2iy43l8ow12mGjwN3y?= =?us-ascii?Q?IP6xjvJMmrrrH0p4XyexWlp7kYEtcf3QT5YW1vB9SD4C4I8iYeC9tT6b/xC4?= =?us-ascii?Q?849XQn4blOhHlsFV75BqQSFnStskLteNT/KRZFk/kPmGgj/pEXzoiiZkjvWD?= =?us-ascii?Q?6hmghB+tnFL/0l1fig5kAXQR2X7vX9EwvpIRsCRjHoxZuGFwl37yetgXQ2iA?= =?us-ascii?Q?GdrLcVUVAjMQ3nEQTnesRpsmGrvgKcFSXzYJfLai9kt3R6XuEHS534v5jUL9?= =?us-ascii?Q?pf65pbv4aq4AvjoF3ASkH+dh5Bl1Z6u7kaJVwHup1GQDMEZU70NT4p9D0E8A?= =?us-ascii?Q?CyVcBk2cxIVDU3RU34cPu3IuKspcAnUrqChhtGTALNiJzP9R5kFASVss3edf?= =?us-ascii?Q?95xZLIXTWfhaw+tYV6hxGlsJr34lezeleER3XkEEXGvIhoOOTXkGHOf0QF9v?= =?us-ascii?Q?wbFU9bDcFgOQJJ7Wa3+lp/MtLGkxNIxXpLH6yJp/QZFWVxqHuJdeqmXiEgJX?= =?us-ascii?Q?t6NkOYqNd7gacyU273PeUgHiRFZGZJnZK2a2oBELXDZl38zDvsi0nAw3DJck?= =?us-ascii?Q?4vji+FDnUlJ7U9aLAhWRhcRVrNdcnt+vRziR6BRmV0imEOIfNivj9a/EE+en?= =?us-ascii?Q?woC0Dm9oFLAxruiP7mNfRUZpwgg/zCi2uZWRdxF1QLjqxRx6uVaQLXY4QsTR?= =?us-ascii?Q?syf04x8IlKwCZGM2AP8i7ok7t5tQRRsRACkGy3yBB57Z8StAHCjt2CLlaDj2?= =?us-ascii?Q?EPz4ierDin9bp9kVDnZsmWRup/Ce2FO7ra8YK9DvxaOIRZ9OBy8Fwl3JEOj8?= =?us-ascii?Q?dq8oXXPVYva+UOnalvafvo031nbjMdw6llZePjZSMqvHccmDqOCIwKRoRGuJ?= =?us-ascii?Q?dOia1C4wVYyG6Ta8tD0OKmhyj1qcFd59fe+xT9vshfCihN7d4NvPS2P1EICD?= =?us-ascii?Q?YJHXhzSMHLSEnSCo740Y/hLX701hAUwCY0QDmBqJybAsHZYiQYcC3KL49ziZ?= =?us-ascii?Q?XTsXAatRnq9LXZSVUp9e9JjOwipHwSAJwVJ7rY4IGwEzm8628lbUSCB2d0tb?= =?us-ascii?Q?o5eeUiSOQIgKa1gH0y1oiZqJWkUlAO09XhfWAi4cf2Sp4Z3bK0Rf5RXB9cwk?= =?us-ascii?Q?oVjAH4dxEY4pyKHEHQ0bhbm6vX3XFfXsL1fDpEcKvvhb/0ifKuhXYyESKdrd?= =?us-ascii?Q?gzq1mvnL5CelQ4/Ilx8Dj7mYLaaxv5NBK/7ryqiIv/BcZNXn8NurxvMDI87E?= =?us-ascii?Q?tIPRPihdGhEYsrD58yxWtcg=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c90fad4-4547-4535-ee88-08dbd0a331bd X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:13.7327 (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: 6t12xgHP8x3QFQNlAW4r4oAyN8gq5XO7zmOgSwefYFjxHm0SpOK7ya4YMK8koYIMU2q1fDkja24OtmO4keOnfAJEnOOvbzM806coyBYJsjI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:fe0e::703; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697723333291100001 Content-Type: text/plain; charset="utf-8" If all the bits in a dirty bitmap cluster are ones, the cluster shouldn't be written. Instead the corresponding L1 entry should be set to 1. Check if all bits in a memory region are ones and set 1 to L1 entries corresponding clusters filled with ones. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index a0de4f1b07..ebda6b0a01 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -354,7 +354,7 @@ static void parallels_save_bitmap(BlockDriverState *bs,= BdrvDirtyBitmap *bitmap, offset =3D 0; while ((offset =3D bdrv_dirty_bitmap_next_dirty(bitmap, offset, bm_siz= e)) >=3D 0) { uint64_t idx =3D offset / limit; - int64_t cluster_off, end, write_size; + int64_t cluster_off, end, write_size, first_zero; =20 offset =3D QEMU_ALIGN_DOWN(offset, limit); end =3D MIN(bm_size, offset + limit); @@ -367,6 +367,16 @@ static void parallels_save_bitmap(BlockDriverState *bs= , BdrvDirtyBitmap *bitmap, memset(bm_buf + write_size, 0, s->cluster_size - write_size); } =20 + first_zero =3D bdrv_dirty_bitmap_next_zero(bitmap, offset, bm_size= ); + if (first_zero < 0) { + goto end; + } + if (first_zero - offset >=3D s->cluster_size) { + l1_table[idx] =3D 1; + offset =3D end; + continue; + } + cluster_off =3D parallels_allocate_host_clusters(bs, &alloc_size); if (cluster_off <=3D 0) { goto end; --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697722594; cv=pass; d=zohomail.com; s=zohoarc; b=MPhNq1saNOX5t6z1MStkYjGICNP6wfuBM2qeBWLrXRaQW/NQwqwbNcgWKCHSiwGU781r/R0MAbMV0eIjBuBhHZr1Jk5/v3kV6lBhKfM7ZXydhUAQCQ4SxCVweiAbhseHylhg7yFISPuiweTz6R+NQTcHaeaGAArteBPqmCTBM7o= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697722594; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=97ukfm6vS/99N2d/mWr2AxWxYEsWR6QQMKlvpEE00Dg=; b=mq/pjSpF5V9J6CoqDkklBjPbwUxlwQny876D+FJTCL23oZbWOvGc6CHg9je/Ng9J2oCrrdXd94UVdOHphNK6q8qVhRxaK9Ri4yrJOGW6TK9fQNKhK00R93DR69t5Jj5bodWCYQ51tR41nIrZRxEsE0pvDu7YGFHlQeNaDG2KXo8= 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 1697722594026327.4741130837813; Thu, 19 Oct 2023 06:36:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtSca-0005qT-AQ; Thu, 19 Oct 2023 08:59:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScX-0005ng-4r; Thu, 19 Oct 2023 08:59:25 -0400 Received: from mail-db8eur05on20725.outbound.protection.outlook.com ([2a01:111:f400:7e1a::725] helo=EUR05-DB8-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 1qtScV-0002g2-KK; Thu, 19 Oct 2023 08:59:24 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:14 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hPwoa6/ij04YTVnHZKXVMa80ry+6RDniJQH7enZBpdJBtFA2ihQcZ+sp9cWPukCLr7qoKDI94qLnXUCJIkEBqcm73lcwFV5Mc5c3fixy2fiYe2jBm+jPTmHFRJH8ZrOgbEq0/E2yqKpybTmdPwa7/MqisZfwB4KujuvjUgWYvBj/dKXLe6LWuUnk6pKDXPILerWTbR4AlBlWIuJ9xRF/zmSBYsxPpZ/KrO5U47HXxkwrvq7QvSOvkeORDp/OIlr7NjsHkwHYypM97edS5OLCZU+0KOd6dtTFWcYU/2/ja1vhzUPRL5UnNew7er5VaHCMDBqbLATiThDFZV8HI0/kGw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=97ukfm6vS/99N2d/mWr2AxWxYEsWR6QQMKlvpEE00Dg=; b=P1tBOD1wRsxWnxQIEc4/A8cx5hqKoNStDmILxyEViIDYwCIrFI5NuLumGSDFYGeIPs7ZzUaY3sUdWAW5OtSNw+TCMg8icXZfmPKgtVMFw7QZ4nFG16krnG4XK8Ppc0vrnPhvLTm5nNQj7CXhRNvU1vDJRodb2Ofm1Xa6+BeNsTl0pnpLyBPQ/JospJD9cSkjOnSMQ5RNZZXwpeWY7zOGdV/7S7RG4rvJEhsvUAZYg07vOBPb/W+pdjtlcaG3o4Yqb0CvkfHQcKs7fU1gaB0KznxqyWfcivsi5XpSf2tEESS1FG2AzvVXYKn82vFlmOqkY47wZtgS3pgP9NcrcreYow== 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=97ukfm6vS/99N2d/mWr2AxWxYEsWR6QQMKlvpEE00Dg=; b=RVQ3Y1eMqT/MRICQ+rdndslIPvWR8z4/8SBgoVyP75a5XSWa/RbJwqLxGDsSj62pdN/iUge3lixcQSDFiAXaco9Gjm0Nj+ChpZWhgaF9z3Hmhr6rztTX1LbxWwW+pxpLc5dPljuk0BI/mpmPvtEA5q8Nx+MlZWbA1oVz5QC2mfUGbte9Bt4l8jtxhymUYhACrLlk3onVUEm0agRpfND7zRNq1TMogEnc3Z1UuLg77Nk36OdeCXFOEtAwwR1eNej4yPAjz82SSfHDdmK+Gwo3SM7HO7CGuSmaUq4EvZTWqYR20Ro2UofHjBr5jCJNdbz+v0qfwVraNkf4swJyWQdhzQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 13/20] parallels: Make a loaded dirty bitmap persistent Date: Thu, 19 Oct 2023 14:58:47 +0200 Message-Id: <20231019125854.390385-14-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: 67640a00-eb8a-4a29-bfaf-08dbd0a33232 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3KCI3QahdlC3JHSve509W24U8rZue5YfIG+ueZ4l1Pxq9SSChSnxB/liwE4Fv/Nv52bxyQyHLiZyTpGWYF3KvSmnRjYDiZdxsf4sy59/QqX8Jdc7gVtzkc7lXTp4O6Tg0AIA1y4J60SM/Swt5vOngh3rShec1OJhWZYd6NdXa2bq3oQAgj2Cbk8HOFMm/jeH9ZqaQVy32m75QM9QKO8zUl46ZqjtQY/3GK2hnCbER0kHnyL/ZC5mVBmmluA/t6E7GyxApsk65S0porSXJv6Otb7ciSnCVfqafQz5ChZlnMRWHLtQe/ck3uShDcMvRbKKsYaVxvwyUpeSEq9PSOFK9Wo/aWXCLM/9vqSvZtA4sBaf45h+LCOZhsSbN06jnr6sl5yTkt9M4lQQOcuVGHhkZ4NCyUXI54CqL/+bibL/NVVPa01RnstAI+4MHZ86alXxkAn12XV7cbhJGYWbDApyZP8fpLpWpP3wI92/u4kaNlRbpCHRyMUtH/5GBYIYdyAQwO86iXyBFg1xUZCbYAOF02x5/Edo5kycwweBdXMDvn+KhIwu4mPaEWazdd7TEbEcYWV2sen+5zxTs9rJHABNISSxLUnA9vTAFsi8jTLd65UlymFxARtrTarwB+gn3iOGAS6EEfrRLSr6v0yPJSmL1A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(4744005)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?tQMyUTQQ0C2xoX967A7svIdQ/cHGjngpVhyAE3b3WdASBZuSicKYfqt5L5ea?= =?us-ascii?Q?BtPM704tV3waU8Cd+LuU/R2TBa7DaErimcgkmCLCD32V6XNNpLOEbmtvnL4H?= =?us-ascii?Q?WCWE9Dgj75ZnfgVKbtMdalPu1xTjfJg9mjMCIGXB+jcDTxMnEMFxlBuPsY3D?= =?us-ascii?Q?jOjduHZdtTGJ7GHxStOJJFjsrakeCt6yxUp+GC7mLQtzz7G7cBpf/og/IZak?= =?us-ascii?Q?nuKzwKB4dDolt3fbvVq5j7v9t94Qk1Z5IMECu8BGDCY3pZwtQR7aGm3zF6BZ?= =?us-ascii?Q?zLhbH8J895ryT0HgOI/ZMOwu8bXR1DveAbbUoUFaY8c9wmVZAx/togtMjx1G?= =?us-ascii?Q?9NGnqeVsuD3B0/Ajr9+IpOXfsCVDq6iMzM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E/WYWvUpyUDDPX/NEFNoJDJswKFf52QfXmVe08RFCqxtwLsUtoe1Au?= =?us-ascii?Q?3P4E52NHDSHoyFPowQXR1BPyC0I8doHPR40RK7vMdAza/jFumB1/pOXvIFfQ?= =?us-ascii?Q?5vC5rpz9RHNSf74zKjHwrLOY5nALJmnhMNxbXbobQH1Tn6CwD8FegYshmMgX?= =?us-ascii?Q?jK3t0M1ywj4hr2swfabwH1I+QAO4RXGPgzsnyq2r4CIa3jM1x3GIKhWe+4/t?= =?us-ascii?Q?Ko3j5IgbbDxbt/jkoY1RgC/HamK/olL84WUPRtF5GJtKiZcjwiW2ic8nbrDQ?= =?us-ascii?Q?ySXs377Df82QACrq2o98wxXnXrGMC+W00w4XxHuNWPaiWjMg9zTo/lOXYr2u?= =?us-ascii?Q?fjlQVefcb4pqyR5pdsQLeC4=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67640a00-eb8a-4a29-bfaf-08dbd0a33232 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:14.5457 (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: o8fBWuXzqdOuIJOt2t/LTvnUe7yQ74zC8qqba6Sw5PBzKsMOs5+ZDfevIKG6kfbNgDKb4rY2PWDMD+jp3uc6K8OP9Vua7hw6pss89KZKkUg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:7e1a::725; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697722595944100008 Content-Type: text/plain; charset="utf-8" After bitmap loading the bitmap is not persistent and is removed on image saving. Set bitmap persistence to true. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index ebda6b0a01..bb4478c350 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -256,6 +256,7 @@ static int parallels_parse_format_extension(BlockDriver= State *bs, if (!bitmap) { goto fail; } + bdrv_dirty_bitmap_set_persistence(bitmap, true); bitmaps =3D g_slist_append(bitmaps, bitmap); break; =20 --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697722798; cv=pass; d=zohomail.com; s=zohoarc; b=M1rer2AkpClu05e2PrmJovSqapiyXutCYjvG6uIMINrWdBAMRkSylfx27VwqN58TKWUeCuqijGlPLzA9fCt5RI6QqXrdhwktYNdyBVIDfG6QtRr1ji18mEzDsiwOsT6HOUftKJcudaa7yYbJzXex8vNPKIoWgfoHenkddktTwLI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697722798; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GriIL388nddtRLNdfJ0n50/UFtbzcBFqr715o9pZJ9o=; b=cUkS/0tKEa6EROtTamxboQ/2Qzq+YHVAJRjeJ+5SSGV7xfW6uU1LeqB6qQTeuRXpPM/gzUPNykiubrznlD0SfuwgMQbk3buyMvC1NU+aNlLAsmn1DoLzNCKVvFKzQmq3QXt1HQ7L2wIxwG+Iru3dHLwaI4UR/hePYaQSy8hBoMc= 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 1697722798728142.14064171937582; Thu, 19 Oct 2023 06:39:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScb-0005r1-Gr; Thu, 19 Oct 2023 08:59:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScY-0005ok-Ix; Thu, 19 Oct 2023 08:59:26 -0400 Received: from mail-vi1eur04on0703.outbound.protection.outlook.com ([2a01:111:f400:fe0e::703] helo=EUR04-VI1-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 1qtScX-0002f3-1I; Thu, 19 Oct 2023 08:59:26 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:15 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cvrAVHteWwALoZSuoM5eE9/EFC6ITSOnQcFktmERqZaeDi0D8N4iBcyPsCGOrwaZCulSf1gqg4X6EPx5W3Np3T0LJXA4z7oQmYuMSwUTaZsvz5iZT1QIjNpn+/kQOKk67Mag3wLpD/BSs2+rYirWutRKZslx/A0sjDsQhbGqkZBb3SB3kcMoGDLask4wnOSmV/Okrl/DUOH72iBrf9ua/gY+e06VVNKqgyn+R7oNC3kDgd6vHxzKITjBsllhKNThNv8rbVgFdUjgTyvQGfru71A7aLR8MYoCeSwwibZwfCf28gGb9aPmC7T94OelP3Bv+R6KEl6srHJ7eAZReXQIZw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GriIL388nddtRLNdfJ0n50/UFtbzcBFqr715o9pZJ9o=; b=Z1yaUgcVcE8qwTy2vJKEqiegqDigc8EJ/0LvXJlBMjg9qM4tJhjVUEB5uXQXNaVyjtBqQC6Ofig4MewRmY86DD8NA5+W33YnIUrpCvdrnidweXe80J0KJ9Qu05icTubzgmbEMStAytJrI0VCBtYRCdWj3CcyVmhw74NuqbkgfiA8VR8RtPWVxKq+16HCWEwrdiE5Qb6WjrJxVhdHpGGJDvRjfTMhi6lcNYOSDdeQy0qRTpVUBKk0A+ohgIxAZJlizRNik72DIDiaAusNIEZQHEvdTGzgqTZvLO2h7EA4MsMME8jcJXUBzYXT41FcB/tm5vZoZu8JKn8lqoFo4ZHMIw== 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=GriIL388nddtRLNdfJ0n50/UFtbzcBFqr715o9pZJ9o=; b=rnNFPeMPuyT38fOlkqbnZHycKxKw4HaO3/0QhxBqWtTyPnHD1LX/4XJMaqMnTbc4cgRrB/A0kugssbajnsOhJNGw4PEYrJ4fi/kuKFdTH27Dpb64U444CaDj5v6M7jRO70KP2mU+Wfls5a7GidzMacioTTaq1ya2Twf8+9AGdm5y/RR0NUIxd2EJAKGrSH2MqHT+LUqsriAs8+TFzs5kHYXY0xF2mI4g0L2XHG21DKwC3oSxRTLZ6Ono5WkXSurtAS36JOj5ix8Fyk0cx9+s3zwN6m/srxKXL6KjbYYj1AzvK/oA7r2qQcAbvxoE0g0MKLmoK/Q2hYR4s+Ohlv1XeQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 14/20] parallels: Reverse a conditional in parallels_check_leak() to reduce indents Date: Thu, 19 Oct 2023 14:58:48 +0200 Message-Id: <20231019125854.390385-15-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: 7481e3dd-7e1d-40e9-5579-08dbd0a332ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ssMyTVFcUJvJilLva/CtDFYtviAnx55cQjVKHv4F/S/5+XeZxzeqYRqSopvUA6Bnjeb4YMurs/vaCwADMPE7j+RHPlW2qNDREYI1OmFVbgr9RLyNDkA2MD+n/Bgm55/aPktiiTwZfQcdJeYouYrG6wzmEGrOhr2qlIguPfrSv7j+0YiPY6qv54EaUe0EY6YM7zTZ80ta56C3FMU3f21x4lANDwNx07dfairhyzzWEzDsLfEDqZEN9Cqckg0oTXqkiVKIm9Q9qJxQ/HmSbI3JLmmaLX/kg6tYeEEesbPZpEnI1ELHQgU5afn32SvvdhnmiW6kIhDtYtOdkFUNB/uuG2GxlnvhwLOEV1yyxvausblReH0MTVOxVMDGhUaTrQWADzMCpcJo+ByRqptODBleJLxlrUXO1OGvQ0XGAQZ8YRqgexCPDtt4VZUjRSMOp/QYUSXzjQpTJ3lKo8T3NCXCIuOPUmpnYpY8E2NkhfFhq0JsKo9Fh1TyqCyQisNRGQ/CQTeSZDtm9Mlgxqi3Q/LVYNKiYn3iGAOzRXBHrHn+phD1utBKokJKSQAGuZoCLIZMRZ0ocDh2B/QSUfzD1OYxnfg4UkkPKA/TQSC24TO1uMDgNvSsk22RtV4UvHnT68ct X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Siljvwmg1lVAI9defYdo2HA3f+WOvxKdJZkZj6tdmNOmMVcPfGu6CL/EPkP3?= =?us-ascii?Q?9cQ8AxipGRFxXhkP0d35VbBCShDecw2cNOv8EhkzqDtB12jjPkAkjQyJ4uNg?= =?us-ascii?Q?ZgiKq3xRXzwoXZjzYBgwa3DZIUAOF2z2QD51oBFNIuPaJhGpQoPOk4goMziy?= =?us-ascii?Q?Dif4xRRcqCA6UsNa+oiAr95u332DWv1OiaRj9zQd6oQ5irJ0SdSOG2z5G/4d?= =?us-ascii?Q?uBEBGEYMyPeD8v5xVrvK/5Xzfn1wFdrZeu8i/2JWNRh4copxVyZ8pAHzASTp?= =?us-ascii?Q?p7cO5gl4RSNJnumdzQhQ0MxKdrZe/k7ai3rk9hlDs5PW6hEcWFfIhK4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q09hfbI4K/GTwSabCUp9fDp//CGBQKywIQHvL?= =?us-ascii?Q?zstPX82+MwzUtC1rMdiL2ov4wgEqRjxkWzYEwMPBoKEmJREU9ho7N5cdCEWc?= =?us-ascii?Q?a81ZAx14dZ04fUYc3DTmNOwo/aAXHU0lftv9rmgNw8TNT09ZWA7RQ0SyzEIc?= =?us-ascii?Q?Ah3LX/tn5EW/d78WZooqk2DPjpYr+Qi1t+LC1BL4h38D1HOqciaRhOc9hlzT?= =?us-ascii?Q?PxuMSgOv2XcduNBVrKS+cONvYRCk8qxF+6vCxAv7j+IrEy/uOpSQbExyilsQ?= =?us-ascii?Q?1zbGYIiKLcxnoIya8Br0/GfBE3lXSmD+cJXOjQJcB6R3xVI08wnQMik68Lzo?= =?us-ascii?Q?tpzftCknQUMnIjvI0LP2aF0hsrURHcP3B82SzFWIMnjWlYK6lQ7k9NOm4idM?= =?us-ascii?Q?QqC1mIwXHjdV3Ypt254jODc=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7481e3dd-7e1d-40e9-5579-08dbd0a332ac X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:15.2907 (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: D10kw7Z2tSUUE3jFLfbNM/KNwC/Y8ZQU5Zny404sfeb11DtFbd35Ev/lSzmTOM6iIZnuIvKKo9fgO6pMnQa7Wsx6HUj8aXYlq64TE5NhIc0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:fe0e::703; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697722800810100003 Content-Type: text/plain; charset="utf-8" Let the function return a success code if a file size is not bigger than image_end_offset. Thus we can decrease indents in the next code block. Signed-off-by: Alexander Ivanov --- block/parallels.c | 72 +++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 2198eff21e..2d54459087 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -775,7 +775,7 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckRes= ult *res, BdrvCheckMode fix, bool explicit) { BDRVParallelsState *s =3D bs->opaque; - int64_t size; + int64_t size, count; int ret; =20 size =3D bdrv_co_getlength(bs->file->bs); @@ -783,43 +783,43 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckR= esult *res, res->check_errors++; return size; } + if (size <=3D res->image_end_offset) { + return 0; + } + + count =3D DIV_ROUND_UP(size - res->image_end_offset, s->cluster_size); + if (explicit) { + fprintf(stderr, + "%s space leaked at the end of the image %" PRId64 "\n", + fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR", + size - res->image_end_offset); + res->leaks +=3D count; + } + if (fix & BDRV_FIX_LEAKS) { + Error *local_err =3D NULL; + + /* + * In order to really repair the image, we must shrink it. + * That means we have to pass exact=3Dtrue. + */ + ret =3D bdrv_co_truncate(bs->file, res->image_end_offset, true, + PREALLOC_MODE_OFF, 0, &local_err); + if (ret < 0) { + error_report_err(local_err); + res->check_errors++; + return ret; + } + s->data_end =3D res->image_end_offset >> BDRV_SECTOR_BITS; + + parallels_free_used_bitmap(bs); + ret =3D parallels_fill_used_bitmap(bs); + if (ret =3D=3D -ENOMEM) { + res->check_errors++; + return ret; + } =20 - if (size > res->image_end_offset) { - int64_t count; - count =3D DIV_ROUND_UP(size - res->image_end_offset, s->cluster_si= ze); if (explicit) { - fprintf(stderr, - "%s space leaked at the end of the image %" PRId64 "\n= ", - fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR", - size - res->image_end_offset); - res->leaks +=3D count; - } - if (fix & BDRV_FIX_LEAKS) { - Error *local_err =3D NULL; - - /* - * In order to really repair the image, we must shrink it. - * That means we have to pass exact=3Dtrue. - */ - ret =3D bdrv_co_truncate(bs->file, res->image_end_offset, true, - PREALLOC_MODE_OFF, 0, &local_err); - if (ret < 0) { - error_report_err(local_err); - res->check_errors++; - return ret; - } - s->data_end =3D res->image_end_offset >> BDRV_SECTOR_BITS; - - parallels_free_used_bitmap(bs); - ret =3D parallels_fill_used_bitmap(bs); - if (ret =3D=3D -ENOMEM) { - res->check_errors++; - return ret; - } - - if (explicit) { - res->leaks_fixed +=3D count; - } + res->leaks_fixed +=3D count; } } =20 --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697722596; cv=pass; d=zohomail.com; s=zohoarc; b=RpGTh2BXOUxryqoOsylbHnlE1t4REa1Yh+oOp09BwLpjqs8fd8KkLjvsPLtGb4a4Js+vSzGdKAqb/VbWHBak4mG8zn/G3Zwa5KnkhQEF4E4zwRn0e8Tj0eT4xQsJoQpWfVPxTkfR/Z4Fw+WwZ6iYCddil7MIHXWBlhcGrJ9MKek= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697722596; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6Q1znhGGtbgAyMPyI3UZCaCwbYtbnuY38EmVBd6olw4=; b=E0sBHAZss/g+aML5rCy7yUibh/559GPtujeLm8oLa9wJ4+qPIGX9L3oPRzaJx44Q1fH79SCUQjgv7X8GpYzfYG46AOb+wP2NA7UktEgTaavJDe41kx1D4TjOfvIb8l/RGOQTvYbXlqByQG2zWHNSEOnUEC/xLUBnXMjs+Hm2TPU= 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 1697722596349156.49478444961176; Thu, 19 Oct 2023 06:36:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtSca-0005qU-B1; Thu, 19 Oct 2023 08:59:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScZ-0005q6-7i; Thu, 19 Oct 2023 08:59:27 -0400 Received: from mail-db8eur05on20725.outbound.protection.outlook.com ([2a01:111:f400:7e1a::725] helo=EUR05-DB8-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 1qtScX-0002g2-OA; Thu, 19 Oct 2023 08:59:26 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:16 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fXu8PTWkohr5phi+gYID5ornXd9sUMCo1CHFxkQd4a3L6LWiJVFnMB1PVRVFzav0Zh6qviTeMbeNlLryM8xrMCrd9Mt5NDvpZSlc676Ipd8PoUAKkexICqe/BqsM6HanWnWDgFb3F8v1zrPZ66EqbrtlfZRcSKQTCu8Rzbmtd+4rrjEFVJS7cc6rhP1mUnjMc3B0Casq46eN1ZyiZuZ1d5kjuFTR3bv6/1WmeBk4om+rm1q/sKwhoonHuzPN+FC1OQH6itAeS1EfoWSCpOpOuNv83Iu4xVM4wVBk4iTApKOMiMQZdWW8FVMC3mTwDZT7CaX4v97pFwqGbWTyoMQafA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6Q1znhGGtbgAyMPyI3UZCaCwbYtbnuY38EmVBd6olw4=; b=L4QSNnTnZf5J+/jC3ROKXyLc3bbdjwLZ0TpfoEr+op7yQzbBclp9i7F1ShzUi84GsSksjvJSwBoXIHCa4A2nVUYg37FpxAwEOz5WMnxgjcqBe6TC4koJJlHfy2PGPuk8OBXPfUK46qtOX5TY9Oo+CA+DcflhPF9E66HnatyoMcuwq102LXyjhyiIRUFgZxKobB7Xgmf0ovoG0E1rwWCLBGhKld8FPBasOaVMgNUjd7mjpKksGqpXyc0GrYcIDdc4u2gvp6I1RNzpYKT2SLy1Yq+9tpXiPRpwcJzojbj0HJbBTkJf57NmtNyPNkcXPTiScifYrzs5RJwQFqHa8y/gOA== 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=6Q1znhGGtbgAyMPyI3UZCaCwbYtbnuY38EmVBd6olw4=; b=ITJGOOS6dMDvDV5crRDq1zcAIdwTJKOehbrjoKX6HqaLN9TTts7i/eOLSOxF+7yHSGC8TlOlzSoUPpOSGIvaDMBUmPNWzvtcnvW8+G9VSDJuu1UGc6YNwQg5uMrBLZoIvAym4JE5ixtZAGjjxtrkJOjY1AunnVwe/CThxm+RfNjkIYvqucEyJZriUfxTSihRaKE4dAOV/CXGHOJEPbUfpIhNwmTQx1i/pY6pCMrkBVueuUdZojWjKTX+O/8kaoiEyQPZsW0xY8zgBgHLhbdhWg+ldIvM02g8X4CkCMrarg5CUEsP1uZ0FTSZysfSK3/rKUnQWje2aOX21qidpvdaEw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 15/20] parallels: Truncate images on the last used cluster Date: Thu, 19 Oct 2023 14:58:49 +0200 Message-Id: <20231019125854.390385-16-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f0123c1-f8e2-4292-ffb3-08dbd0a33319 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5MLeK8oMbGwNUdd4Oy/dvM0acHaLoEflyc0TnHKx7HJ2MT8g5rcrC+CiwV6LDrIBerJYnP760RR9GH4HYY3+Tb2D3uIhihvq6M/H9n5YByTAMEPCEeVg4P2kORxsqdJgdy8xjyUlh22rkQ+bLZ3chSJQP7kgvl3YeWpP064dYEOYIsoAk1iRITrsYv6YAK7mqVp0WSHJ44TxAkPUSEjYAMoKClsgHp2b9olJRhfbpOlRUw2R4T2Qgjlc/sZBabB0RB5sDi7LIy1UbgwaV2oS9hYdub/rpEYPEko+Fvf2xECpR63FiMiSZk0HlyIVxwa3lDmRlEbFf8fyUik8Fm16A40RFbdZ0RvY9Z0HA8C7NmHle4Ho9Mi9n+qT9OTNXAMEXpKJdDV8CGc0D9DdrDrjOfvuIc98aKw5bZJGO+PGi/HIn2WIsGoZflwI3LPIN+ZFsVqxsGfr3E24uy5uJWEtO+nuItWarE7Mb6yAQdKlakqQ4N4OlvQsnuvgJzaLiyzBy5S0M7Otp05sT+PAsNhyTHg9xupj1oVTgUSzzUoKuxnG0Az33WyRc7whB5vjzPA5r42/RYHUyo4gsOXUOqBuTM3nJPIZngw7CgBf384ZH72N994nEbsR7ZrP4T3Z8Plt X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?KpjTzAeKX8DL4AGtYfyYnrYcNsZZwQlcaIpcvJaAnjXA6mwYCm0yyOj6T+1n?= =?us-ascii?Q?5UCaBv7XkK+zz8x9VsZ9NebV6AfPpoklGC8FA5BMSS16WZlCB/vNn2x62qA2?= =?us-ascii?Q?e9ei0L4DcjysYErFbZAMNo2TfyvCE521in0BC8Rm3Nheu+4J7ArP5VHPonXp?= =?us-ascii?Q?8bskVFmjOpUDcGElsNm1UJxjU9LK6h3/vqsp2tWDliOKPKdCPtMBBVjsaW5o?= =?us-ascii?Q?Ixci5icsqn03TNp0JrTYE2GeuPC9q1/BYer4ORO+3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XmGL1cVS6KdLXCbqHmRgT7c2FCXbL2/206raZW46LG+rvCszp3/bOkz?= =?us-ascii?Q?Vm2bYUhBGaDjeJeWidC4b+0r9iiu1OBp+Ug8jJ5UGrrEcr5A+Tu4uDXgXZhv?= =?us-ascii?Q?JCDoDpwJ66UepAX+BPvmUCgbASsR9wZmbyjr6u0EI5kB3UTHCn+kpztsM/r/?= =?us-ascii?Q?aQ+A0Gg1hRJhbyEDrr1mEEAuDGSzb/u5WE5EmyrbyFlLcjgwdBwnDwklRC+m?= =?us-ascii?Q?aQ3TBKc0RmOL/bS5Q2vRa/rwJxqKNfvbgqjz+qvjmlh6uozPbC1OeXJu1ELc?= =?us-ascii?Q?TN3m9TqIthlQqdDW8cc9MaR9t8JV5PahLF87WiaH9gRGtnfo5b3o2szW9UDw?= =?us-ascii?Q?8Y1nrNDiHd/ecI2h1NT7Hevq9tSjrduPfKg+SmIi+u0uBbcGjQyoeB6TGrGs?= =?us-ascii?Q?t5GSd8dxQt6AAlEmN8mbcUvxeHO33B+SlqA5dJrq7LUDyLLcvdc8sA8pSimk?= =?us-ascii?Q?PHIAKgkvQygd8G0EoRxi4x4=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f0123c1-f8e2-4292-ffb3-08dbd0a33319 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:16.0384 (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: bQoIoIZmlIO8HEUjr1yzrunGi0XzV/GII5QEAXhEDWo3BPRrlhW5R3+15Nt3q3zsja4d9WEzNldcPLo2KW0wrkqhlgOv/cB/bZvZ0jvgG/A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:7e1a::725; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697722597954100019 Content-Type: text/plain; charset="utf-8" On an image closing there can be unused clusters in the end of the image. Truncate these clusters and update data_end field. Signed-off-by: Alexander Ivanov --- block/parallels.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 2d54459087..c7db2a9562 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1458,6 +1458,23 @@ fail: return ret; } =20 +static int parallels_truncate_unused_clusters(BlockDriverState *bs) +{ + BDRVParallelsState *s =3D bs->opaque; + uint64_t end_off =3D 0; + if (s->used_bmap_size > 0) { + end_off =3D find_last_bit(s->used_bmap, s->used_bmap_size); + if (end_off =3D=3D s->used_bmap_size) { + end_off =3D 0; + } else { + end_off =3D (end_off + 1) * s->cluster_size; + } + } + end_off +=3D s->data_start * BDRV_SECTOR_SIZE; + s->data_end =3D end_off / BDRV_SECTOR_SIZE; + return bdrv_truncate(bs->file, end_off, true, PREALLOC_MODE_OFF, 0, NU= LL); +} + static int parallels_inactivate(BlockDriverState *bs) { BDRVParallelsState *s =3D bs->opaque; @@ -1475,8 +1492,7 @@ static int parallels_inactivate(BlockDriverState *bs) parallels_update_header(bs); =20 /* errors are ignored, so we might as well pass exact=3Dtrue */ - ret =3D bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, - true, PREALLOC_MODE_OFF, 0, NULL); + ret =3D parallels_truncate_unused_clusters(bs); if (ret < 0) { error_report("Failed to truncate image: %s", strerror(-ret)); } --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697720529; cv=pass; d=zohomail.com; s=zohoarc; b=dAPDt82Y/Q/Jacv6tGZlSckWBFCWsMXHcBa6zG0gnOz08JSuUTfDXI+VZn9r05nB00RnXx8LwnqNc+7PWWerGiZVG17lFCQAEE+jKW043w5qR7Rt2V5G48806xQQA7Df1m2ihgHjhEGWwgwlCPOswBaIR8rc5UdGJn4ohULHJ+4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697720529; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=F/fIMh0t+n5/eHm7akgQHN0R6WD+Om74Hz3SAl1S1G4=; b=kWY/s7VjZWswvoAnf03ZbURkv9f4/RkPoYsPumqv4Q6z2LhgkyJbGctyf2IVvAaQjv4hfIbd8yh7YDKatMfb3UW1CZkc8luQ7rlP/jJpkedo+RewJFpcmGCPdltTU0Q4c1fuxNFVs8aLXBZtu4RsGyq966Ri+MC+xcfLCyK5oDs= 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 1697720529922356.3088996559874; Thu, 19 Oct 2023 06:02:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtScy-000639-Ap; Thu, 19 Oct 2023 08:59:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtSca-0005qR-69; Thu, 19 Oct 2023 08:59:28 -0400 Received: from mail-db8eur05on20717.outbound.protection.outlook.com ([2a01:111:f400:7e1a::717] helo=EUR05-DB8-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 1qtScY-0002iq-AU; Thu, 19 Oct 2023 08:59:27 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:16 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T5Hskc1JU7Cej6UQx/9+9AHo/H/oaSUQWa7ViEDVfyBFWJjN1Kk/yLvoPsRAzb/K9yUe+/V0ulrkaZV8kS+6v7nzeImvjIm0stbmLb70CSyBAJ4T0GqN13mB/pPH/nQdbv7duwhWyJdvqY4GdsLBzphgMFXgi4Zc5UHr9DnJICHRT1GIeFLfl/Dzl7ZmtZWtcdX2jTqoBMviRDgVNExL97gIkHbY91wsM3qX6IRjbsyqKD2ZjvfGvb49aKSCrgxqHoNJ29JaPjM/uiiwiu6LTNYr5HjKNQtKo2Y+quxbAdRcX8R3+Vn2J1gcCieZKTcwtNhRmQD6wIIXzl61KHWT2Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=F/fIMh0t+n5/eHm7akgQHN0R6WD+Om74Hz3SAl1S1G4=; b=SVahIMeauDuqihxkP2JG1d3hl6wRwWVltWAIkS4D67UMNzLHuOW5PxOLHdWTrEb8nfTiNJeuUH32d56v0ofE32gwpP1LqjQqI3F9oeejZN0/oFbyri4dI/xvfgg5gHJTlb9dlrk2dtgJKtTIseqOnVDD9stb5vrzwXyXXtdrqsL7pSFq3/IzCnjvh5gu7cyG3ZboVxSs2zBQWfBI1vPveMPRIjryVLXd/dHuVP3xh3gLcWeUOc8V+3fPkt3oeYZJsZNBDbqv3wnILofSuuH+4bkEpGCziGfo10bWS+zkXRSwI7tmMJ85VhVozKK7LqyqlCxAhWLpsIkTbbhaVXjMUQ== 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=F/fIMh0t+n5/eHm7akgQHN0R6WD+Om74Hz3SAl1S1G4=; b=0Y+YHNB8xUYiRXaNHWxTCnt2DxGbRd4GbLLkQApBqSATzBbDmK2tHqqopOPkYIHjA2Xqfmm+MzNsM8MlFqKtNYYahmTPREcg1n6DVyeq9a/KiIaAStZgchDG+deJYtuGUA/xThLom9pptNL9RUmCkZ5J7Zu1vfDwugAUcKHOy1SSF1xsrTir8Hee95Po7NcDsyfWRxs6uxnWIZIFV1mVogj1Jdj8IxZfVM37pYV5YUO+pBbs/wMDHXaVxBRYpiAOKiAc4zLMUSEalIXMXISDi/Bpb/mvLWh3w1BorMUZqsUaIVzhRm2wuejmwioY9z/OyQnPxyaMn8sgGdKK4mc6nA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 16/20] parallels: Check unused clusters in parallels_check_leak() Date: Thu, 19 Oct 2023 14:58:50 +0200 Message-Id: <20231019125854.390385-17-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: dad8b8bd-19aa-402a-bc65-08dbd0a3339a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Dt9DiIMmYLPVofM9PI0q8luTF/62VIjzX5w44ImHcTvIezx6tkkOQ2TmnfDivT1L9Ud7vQlfhT1f3XBPoM3fpcENZcwSTO3Ufwytc07LyBxZCgJw0QmQ06jtbubzIYMXwjpWb4qNBtraTpXYLRIN+QavCbhFp2F6HlqAAANGDD02iEgHqDZ3VCd6s5P9WkwoMHhD1lax6ingXBPs5lM6/2df93psJTIbMuDlARh9KlPVS2cRwNWkiTAJZCUt/f6t5/CUx73Timvfj085A0AYzAp3eTkyFHbRUugyVY93K46OzbdBc+n8O+gWqDu1Bx2fFP6fBcNt2VsefdfnfMW7AhaDR8ROpp1/kFxyTi93VC82briRrgoNImNIyQ9A1DRHN1b+KgpPFdtUU6OqhetQK1f1lFCCsoTQVRfrmcLOGlEEB3NuI97TkRyZ9MZFXpOklXRBYgA2GjFugoT2i9A8Ua2YI3heTXcxY95VWs2JImDjlffEwA0YjdC85vliTrOP7YR6MGFeNUxY7uUhPwqOngTOmRx1Lrd2qF9HnWZxd3Cz5bFGYre6h2EcywHWnvMQTWyfLNKn7ReDfJHQbbI1W0ozj6XYYJXBJKsDuxVCfdH+wtUhd2GEVU6oK9aNOR4A X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?+YQYRF0VMET4+Kl9MeSIxiFz9wjl8yGmvh1Y/UEi7M/JZ+r8eZiqPMXkAvQ8?= =?us-ascii?Q?ka02nFNyapBxbUTRP20BnqSnZc119QA47sl3MuW539mfl1vPpTmVh2RVoML1?= =?us-ascii?Q?Ly+O59gviAph15wqSFTiuBhffBMxNDyRpdSEbrh85aGvXSpssr92nTdU3wd4?= =?us-ascii?Q?rpjhf6jrqlryFt0+U7Pw/VFvYVOdyjWcZ/cXrnX5QupLnIRMKHY962irtRNg?= =?us-ascii?Q?cd1FiU8MjZeeehooY9t6yj7MAwIEdFIvaqzSDLJIsa0W9YWEIMh9NK/Q9Pf8?= =?us-ascii?Q?1EFSEepA52oktbPoZwPubGoqWn9PCZFvBDwoGYQ0w8ANRyqhKiRs8VZwP3wX?= =?us-ascii?Q?YjoO/O61GEyIH3vRUsEXQstDi0Ws4JRPC5gJfBQ6RWB0d963clBf4Y4p80Nm?= =?us-ascii?Q?LsNdoa2Vp56DBeMxt3oKqX7C6qyC3X4co6OujWuv5UI3fTlceot9rUbEVzUP?= =?us-ascii?Q?H0o5Qha4Jxo2CbsxL8ForsLWZ6bFYk9NCQLpyDhFQgLosZHSIEi0SVKj0Cw1?= =?us-ascii?Q?ZZ1RRHUnYRUv2nmKj4LZcNNbzNEjAorvKx76AyErW8rynWOk8g58nD3ATUA+?= =?us-ascii?Q?217yiQL2QMmZRd43S8aUw2Rl7Ake+HEAU7cfpCz9FzvPX1rGnvxoPopUfH8W?= =?us-ascii?Q?a4qQFfnOJ7GP6M1WhcDLk692DEf8yHtKw5ZJCe+yV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LeHi76GmZikMupf8tNt8DXsxkbw2lJv3wfmC6MEtOpekoR8gGIsgGgk?= =?us-ascii?Q?aehTWhaJ+GIJSWvn24HFuAM=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: dad8b8bd-19aa-402a-bc65-08dbd0a3339a X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:16.8422 (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: i0WfzL4hHYIMnQH2kipcg5K6MX0dlCpTpCN5xjZhEmRZIvD9hqyJwYfW1a/00NeAwMyexX6QdmBvwJOQilILtvf8XiS3uaXb9CP3D9JEq88= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:7e1a::717; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697720530455100001 Content-Type: text/plain; charset="utf-8" Since we have used bitmap, leak check is useless. Transform parallels_truncate_unused_clusters() to parallels_check_unused_clusters() helper and use it in leak check. Signed-off-by: Alexander Ivanov --- block/parallels.c | 121 +++++++++++++++++++++++++--------------------- 1 file changed, 67 insertions(+), 54 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index c7db2a9562..b1100dc65c 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -770,57 +770,87 @@ parallels_check_outside_image(BlockDriverState *bs, B= drvCheckResult *res, return 0; } =20 +static int64_t parallels_check_unused_clusters(BlockDriverState *bs, + bool truncate) +{ + BDRVParallelsState *s =3D bs->opaque; + int64_t leak, file_size, end_off =3D 0; + int ret; + + file_size =3D bdrv_getlength(bs->file->bs); + if (file_size < 0) { + return file_size; + } + + if (s->used_bmap_size > 0) { + end_off =3D find_last_bit(s->used_bmap, s->used_bmap_size); + if (end_off =3D=3D s->used_bmap_size) { + end_off =3D 0; + } else { + end_off =3D (end_off + 1) * s->cluster_size; + } + } + + end_off +=3D s->data_start * BDRV_SECTOR_SIZE; + leak =3D file_size - end_off; + if (leak < 0) { + return -EINVAL; + } + if (!truncate || leak =3D=3D 0) { + return leak; + } + + ret =3D bdrv_truncate(bs->file, end_off, true, PREALLOC_MODE_OFF, 0, N= ULL); + if (ret) { + return ret; + } + + s->data_end =3D end_off / BDRV_SECTOR_SIZE; + + parallels_free_used_bitmap(bs); + ret =3D parallels_fill_used_bitmap(bs); + if (ret < 0) { + return ret; + } + + return leak; +} + static int coroutine_fn GRAPH_RDLOCK parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix, bool explicit) { BDRVParallelsState *s =3D bs->opaque; - int64_t size, count; - int ret; + int64_t leak, count, size; + + leak =3D parallels_check_unused_clusters(bs, fix & BDRV_FIX_LEAKS); + if (leak < 0) { + res->check_errors++; + return leak; + } + if (leak =3D=3D 0) { + return 0; + } =20 size =3D bdrv_co_getlength(bs->file->bs); if (size < 0) { res->check_errors++; return size; } - if (size <=3D res->image_end_offset) { + res->image_end_offset =3D size; + + if (!explicit) { return 0; } =20 - count =3D DIV_ROUND_UP(size - res->image_end_offset, s->cluster_size); - if (explicit) { - fprintf(stderr, - "%s space leaked at the end of the image %" PRId64 "\n", - fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR", - size - res->image_end_offset); - res->leaks +=3D count; - } + count =3D DIV_ROUND_UP(leak, s->cluster_size); + fprintf(stderr, + "%s space leaked at the end of the image %" PRId64 "\n", + fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR", leak); + res->leaks +=3D count; + if (fix & BDRV_FIX_LEAKS) { - Error *local_err =3D NULL; - - /* - * In order to really repair the image, we must shrink it. - * That means we have to pass exact=3Dtrue. - */ - ret =3D bdrv_co_truncate(bs->file, res->image_end_offset, true, - PREALLOC_MODE_OFF, 0, &local_err); - if (ret < 0) { - error_report_err(local_err); - res->check_errors++; - return ret; - } - s->data_end =3D res->image_end_offset >> BDRV_SECTOR_BITS; - - parallels_free_used_bitmap(bs); - ret =3D parallels_fill_used_bitmap(bs); - if (ret =3D=3D -ENOMEM) { - res->check_errors++; - return ret; - } - - if (explicit) { - res->leaks_fixed +=3D count; - } + res->leaks_fixed +=3D count; } =20 return 0; @@ -1458,23 +1488,6 @@ fail: return ret; } =20 -static int parallels_truncate_unused_clusters(BlockDriverState *bs) -{ - BDRVParallelsState *s =3D bs->opaque; - uint64_t end_off =3D 0; - if (s->used_bmap_size > 0) { - end_off =3D find_last_bit(s->used_bmap, s->used_bmap_size); - if (end_off =3D=3D s->used_bmap_size) { - end_off =3D 0; - } else { - end_off =3D (end_off + 1) * s->cluster_size; - } - } - end_off +=3D s->data_start * BDRV_SECTOR_SIZE; - s->data_end =3D end_off / BDRV_SECTOR_SIZE; - return bdrv_truncate(bs->file, end_off, true, PREALLOC_MODE_OFF, 0, NU= LL); -} - static int parallels_inactivate(BlockDriverState *bs) { BDRVParallelsState *s =3D bs->opaque; @@ -1492,7 +1505,7 @@ static int parallels_inactivate(BlockDriverState *bs) parallels_update_header(bs); =20 /* errors are ignored, so we might as well pass exact=3Dtrue */ - ret =3D parallels_truncate_unused_clusters(bs); + ret =3D parallels_check_unused_clusters(bs, true); if (ret < 0) { error_report("Failed to truncate image: %s", strerror(-ret)); } --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697720474; cv=pass; d=zohomail.com; s=zohoarc; b=gkGmfVC/1yPi86bIVW6sJzruBOiKtZoNfLkbZP6agLiyKjQ9t2E7mQFQEtsCy06hwKUh/jylKpIkbrQOX3mdzGEivMtdG54GTf46zQrdp8NTv3+U8P6ab43gmgHXVQn30SWTWJjrqlRafMt4VBAyVJBSs4cyCBVr7uvTwudFzJQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697720474; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=neC7FT5ECeFNIwS8hQFOvVmkATsBRQuXlwfArRxGcro=; b=a0QGoxbMnT7+BczMHKn944nWAkbDVR8vn1EbFM82Wgd5NCbOy58oXYWWuaNwRTZ8pZ8ee7y484C8bX6KJvuKKMYmW9rYKMysiU6JKiD6aHfZnGjBXpVdplDEFQRHU1GcKCm5SS2YCIQ07mZfs8fyQSiHj5q8kaQB5e0d/2CMFR8= 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 1697720474481250.68672291807297; Thu, 19 Oct 2023 06:01:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtSd4-000695-H9; Thu, 19 Oct 2023 09:00:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScb-0005qx-0J; Thu, 19 Oct 2023 08:59:29 -0400 Received: from mail-vi1eur04on0703.outbound.protection.outlook.com ([2a01:111:f400:fe0e::703] helo=EUR04-VI1-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 1qtScZ-0002f3-9h; Thu, 19 Oct 2023 08:59:28 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:17 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ivgt68UaUmqIOsqSNvwhqtKv2HwgL1RkMqaWa0zZb8qgGm2LWUz5lESjwM5vc/tECThfx7KrKq9X2HrqHuZuC0OhW4QOtpjZ9O83rYsN+4GXXpxQKb9tnVh/Ujj5GQuzGoJUQ+PmZfFgjpEYVTzy5dUWhEHAywA7hXJSLuo8SmNHsUUbAb1HW0tWtm4miWf2btg+sbZn+tKbyBhGI4Hgc4yoqsKNSD1OdYUJpGvgaed7L3PVBGaWQ2R0sdkaSGP0lnHTRH0qQZdRBKF7QMcIcTBehEpwJw+9NcrzKnKeL6erVMLxTQ3sEreaQnJ2nndiQFn9wM85x2WT933camS9rg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=neC7FT5ECeFNIwS8hQFOvVmkATsBRQuXlwfArRxGcro=; b=TuJiFFQowvjdfAci1FUnS37DAZS23sCSV3UgenS9CU2VEK8ChCaQ1Wln+x76EbjQAMme+tcqaIU8TlV+vu1O6yjJeSkHs4VsgPDF2avVN8Lr3ilhM34ZxgOK28LuMoA/Y2IJCZkG2/mHG19x5mVxYRMr+ORlBSG85CJjc8MdJJu9Oc8dwDrEQH/DacYjO9mZ/WsHzK9VZ59UajCdKunjAQwdCkodKAredyyfmXiDjrH6uJPWYEt3ulfs8dT/VyjSUsXfh02cTdUwQki+ZBZAZP3IEM8UmSS3XA35uQUrzy1+Y87/MW9X5NUosd7wsdChNIRyO/nnhap+ZI4IwJ0mhQ== 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=neC7FT5ECeFNIwS8hQFOvVmkATsBRQuXlwfArRxGcro=; b=AbqvT1KaEvxhe2ETg5tfDkhrWanNkGyHDXfeNxTi9KmkHd0kV3E250YPHz6AJGnCfeQNNp2bY7ipMYEsTieYUn1N1UesvfuTsNKknP32GQVtNHEVOMxTPPEl8PnoW5ejkFqXdESLj4wAfPqNxbl8rlTRLAQ3ZpXebB/JVEYzVLIwepZETucJP/U8rcNOkpSKrQVnYzNecRtcYtrje29WG7h0s9z8HYdk9YlDe+fNLAjZL00Dy0Nupu3NoZ6Z29/oAOtMWJXhfvyDDgqFCi32eOd55XvYmS1m5rCWsIp346HBt8GULCiRC8YKbIu6uaDFIVVNG9+d/Zpkd5YUbDvObg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 17/20] parallels: Remove unnecessary data_end field Date: Thu, 19 Oct 2023 14:58:51 +0200 Message-Id: <20231019125854.390385-18-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: 18027701-a2b6-412e-0455-08dbd0a33406 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q4kpbmG1ARelq1RtbMC5kLtBJYaXRldlvIRO514ggBG/INkIK/h8gr/uKOpDMIT/cxWsk5LIXvDbV1NghHIS9e3jen+y4ywnLhp2Wvll10q5hMD+9GaEoBOlMoDpWkNHwPyxVEAFGYAeUJgCo2aw1C4ezcmyi+m3bKgqNvYOScJ7itLiqt0MzoC14syO1ZwZHc8LxA6Pk7rEFebpnan9YP0eQ3qeyl5+B+mau0mO0XyG0+vG9xG1zdJWk22aiOvWamoNcaZzsPYVcccH0BDlXicGrx3B/AzevS9vhR7Hwmz2AlmtGwwFq5LmhFcdpnP7Qmk8YFahK+fv6Ovoqjr7HG/wsXDXgMcsl2COrbJyHSI7wJg/USC3pOlZvGxjnVP7SnLHoavBMd9t9efkJTXve26jQM1MVRd6swFFbF2r2t73JzfWkMR7KP0jS7BjnvvhrbaKcAglRTEOCXH+zBSMCx63LGbtgzvvnJwECSkZsU8Jn6sJoMuE/T4hnOL//RYJboeXChS5otRfQ9ADzqU+t8dinCGvRfBaeRYxkZ0fr1q/t++/k/dVIGzTDQ+qh6RY8WgffFiozTMUcNOJHVYIJ5LAhBy0PsrF3sgut9ZtQu0Hc5zySyT1E9ySN4ll/TA2 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?+bqL8LuHD7PRdkTH6eHZF4HlHZSGhLTT6ZwQJPoATyOMgn5Uk6Ewy6BHi1Tm?= =?us-ascii?Q?zNHMhaHVOT24C98uCs0opEH4L3pQzzKRJMrqSC9kvhyCcPimPBTSPeBrMSnr?= =?us-ascii?Q?Lira/wGZedhAtceXkEznd0Q+4ZBcqtGr7yQ5CCBHps2AWVW5MNs8z0kLyr9s?= =?us-ascii?Q?mYh6M/vuIpOJKwnGgQllfWsAgd96au2XVzBiUJ5cdXK3yApsI8MDDnUKXIWf?= =?us-ascii?Q?4P+i9V3eeWhkEj6Bno0mqCPM/0IpwSHnQOq/XvUzpWVGver33mVYua7/Yfk/?= =?us-ascii?Q?wyndUgAG/sVUxhTe7CV9cSFbDsNtEYANmJE7Xp37DzcM0SsDJIDh5GPqHOVS?= =?us-ascii?Q?ziAkiQxMA7nOOZmqaj3Nc5wnR3JJwwD9os8L3X/JqM8WBikVjgdlIlIPBTk8?= =?us-ascii?Q?Nf3Nn3IDqDoaYo3ImjAf9OIelWp31Yhy/9+fWxBCzOxNZ/8oQAmF+iCa83Zn?= =?us-ascii?Q?HfHGpECLAM2nOJEaHZnzi5gvkFqVFmhx7SlAqg03NCLkvf9WKMGoYHEbRmvK?= =?us-ascii?Q?WE1MjnzX/ArNOHlra58oXVXmM/XNtFWeH3YW4TnKSnu0IyoUJo2kq0eEeek0?= =?us-ascii?Q?gHeB4ZlywUta07V7s4bgbrZ0vQH+pIOgHbyGegmuTl5Mmi4YAYYltooluUdK?= =?us-ascii?Q?hf8ppZJnmMo4ITmTa8W3386rzkErSD7x0vQGlOHChaYxwMtqJRVU5vMyEt3K?= =?us-ascii?Q?4IYDFcENR2d8RUVBgKzqwGc0mhH6roQXAWnAsFhnby5R+LjaUmkcU8Xmb2Az?= =?us-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zo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18027701-a2b6-412e-0455-08dbd0a33406 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:17.5634 (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: i20ZJlqRgCQsUPjQdtR233WTfJALEX45RxIr6jhMJ8xRGFN26locZPh8PKUnrGLaWcnhyBUmBOqxGTYglRwX+yMhWZnKL13fg+dpINHal/g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:fe0e::703; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697720476006100001 Content-Type: text/plain; charset="utf-8" Since we have used bitmap, field data_end in BDRVParallelsState is redundant and can be removed. Add parallels_data_end() helper and remove data_end handling. Signed-off-by: Alexander Ivanov --- block/parallels.c | 33 +++++++++++++-------------------- block/parallels.h | 1 - 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index b1100dc65c..fcea44276a 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -266,6 +266,13 @@ static void parallels_free_used_bitmap(BlockDriverStat= e *bs) g_free(s->used_bmap); } =20 +static int64_t parallels_data_end(BDRVParallelsState *s) +{ + int64_t data_end =3D s->data_start * BDRV_SECTOR_SIZE; + data_end +=3D s->used_bmap_size * s->cluster_size; + return data_end; +} + int64_t parallels_allocate_host_clusters(BlockDriverState *bs, int64_t *clusters) { @@ -277,7 +284,7 @@ int64_t parallels_allocate_host_clusters(BlockDriverSta= te *bs, =20 first_free =3D find_first_zero_bit(s->used_bmap, s->used_bmap_size); if (first_free =3D=3D s->used_bmap_size) { - host_off =3D s->data_end * BDRV_SECTOR_SIZE; + host_off =3D parallels_data_end(s); prealloc_clusters =3D *clusters + s->prealloc_size / s->tracks; bytes =3D *clusters * s->cluster_size; prealloc_bytes =3D prealloc_clusters * s->cluster_size; @@ -300,9 +307,6 @@ int64_t parallels_allocate_host_clusters(BlockDriverSta= te *bs, s->used_bmap =3D bitmap_zero_extend(s->used_bmap, s->used_bmap_siz= e, new_usedsize); s->used_bmap_size =3D new_usedsize; - if (host_off + bytes > s->data_end * BDRV_SECTOR_SIZE) { - s->data_end =3D (host_off + bytes) / BDRV_SECTOR_SIZE; - } } else { next_used =3D find_next_bit(s->used_bmap, s->used_bmap_size, first= _free); =20 @@ -318,8 +322,7 @@ int64_t parallels_allocate_host_clusters(BlockDriverSta= te *bs, * branch. In the other case we are likely re-using hole. Prealloc= ate * the space if required by the prealloc_mode. */ - if (s->prealloc_mode =3D=3D PRL_PREALLOC_MODE_FALLOCATE && - host_off < s->data_end * BDRV_SECTOR_SIZE) { + if (s->prealloc_mode =3D=3D PRL_PREALLOC_MODE_FALLOCATE) { ret =3D bdrv_pwrite_zeroes(bs->file, host_off, bytes, 0); if (ret < 0) { return ret; @@ -760,13 +763,7 @@ parallels_check_outside_image(BlockDriverState *bs, Bd= rvCheckResult *res, } } =20 - if (high_off =3D=3D 0) { - res->image_end_offset =3D s->data_end << BDRV_SECTOR_BITS; - } else { - res->image_end_offset =3D high_off + s->cluster_size; - s->data_end =3D res->image_end_offset >> BDRV_SECTOR_BITS; - } - + res->image_end_offset =3D parallels_data_end(s); return 0; } =20 @@ -805,8 +802,6 @@ static int64_t parallels_check_unused_clusters(BlockDri= verState *bs, return ret; } =20 - s->data_end =3D end_off / BDRV_SECTOR_SIZE; - parallels_free_used_bitmap(bs); ret =3D parallels_fill_used_bitmap(bs); if (ret < 0) { @@ -1394,8 +1389,7 @@ static int parallels_open(BlockDriverState *bs, QDict= *options, int flags, } =20 s->data_start =3D data_start; - s->data_end =3D s->data_start; - if (s->data_end < (s->header_size >> BDRV_SECTOR_BITS)) { + if (s->data_start < (s->header_size >> BDRV_SECTOR_BITS)) { /* * There is not enough unused space to fit to block align between = BAT * and actual data. We can't avoid read-modify-write... @@ -1439,11 +1433,10 @@ static int parallels_open(BlockDriverState *bs, QDi= ct *options, int flags, =20 for (i =3D 0; i < s->bat_size; i++) { sector =3D bat2sect(s, i); - if (sector + s->tracks > s->data_end) { - s->data_end =3D sector + s->tracks; + if (sector + s->tracks > file_nb_sectors) { + need_check =3D true; } } - need_check =3D need_check || s->data_end > file_nb_sectors; =20 ret =3D parallels_fill_used_bitmap(bs); if (ret =3D=3D -ENOMEM) { diff --git a/block/parallels.h b/block/parallels.h index 18b4f8068e..a6a048d890 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -79,7 +79,6 @@ typedef struct BDRVParallelsState { unsigned int bat_size; =20 int64_t data_start; - int64_t data_end; uint64_t prealloc_size; ParallelsPreallocMode prealloc_mode; =20 --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697720520; cv=pass; d=zohomail.com; s=zohoarc; b=MQaoak0dB1lsGiKeaCMVw51P8GTXYdLo4COjnXS97JUwPZXkxShRYc75HvhGS8SJzzvKaIBams4KRx9q9sHxZR/JSMZc/HJNnfRH1OQluIXYNhhndtezzb11Rco85ztV9PtFs8ZJclC9Br7oJSEnzBRw6iaDN/1FMOQU2U1PYwo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697720520; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oirhDp1aJ+KaHzsTnY2r8XLS49vYxHQU3xKKAox1B+w=; b=MlJi0z6qzoHYEeKIjJ0lEvU/ApmWSAOyHeXnTNQBXBZB9xZwRRsXsNehWji0NYhg/rb+LsFb/OK8J67Xn8Zs1gHpGhGZoDvBRg0XiDruU/ZSwtXuktxfu/oSviSu9fbpJLPRDbYreNF5SJFi7dBGMtuIdn/qai4BP6SI0y7u8pE= 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 1697720519887431.5258366279305; Thu, 19 Oct 2023 06:01:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtSdo-0006jw-05; Thu, 19 Oct 2023 09:00:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScb-0005rg-N4; Thu, 19 Oct 2023 08:59:29 -0400 Received: from mail-db8eur05on20725.outbound.protection.outlook.com ([2a01:111:f400:7e1a::725] helo=EUR05-DB8-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 1qtScZ-0002g2-Rj; Thu, 19 Oct 2023 08:59:29 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:18 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TUW96YZdDcQ+dQoLjYCsxX71Y6qMmO3jUMFdcGFyPx1zNYOci6htfQ/+6MYMMXG6vR/xcEeFTKKpaUYgwzowctNfjrBB0YVr8OZE9rbNGHYzDGBw9h8XtDViGpVBPJCN93VP8UM1EPIpExOlPlWfh/yshCtjMuIpqukbMfnZ/KYE+BX+jRbM0uKvBxXZkjys68BzUhPTQ1+ao/bAIOgOasxsXlzkQ+42fsjVFynTdTZ7cnuORMNYh9eJ0LyB84gP5hdK+t/uTYqzo/xZpUNJtPLsKVkOwSR5ErvesforpY9GvGgWwXwsGkpylxxCkVu02B88luTrIbk8Xgt0RYXj/w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oirhDp1aJ+KaHzsTnY2r8XLS49vYxHQU3xKKAox1B+w=; b=Lwto9GKK2RWStUzCORQqKEHo91kPK5ThMZSMRltOw5g68D3evfShFau5oMOx1GUDvrvUuynWMZyZFgHa6GufWFMBgs+2k0IpgrSrB/3BME6SCMobMvY1sO9i33CLBgZg+axvO8ybzantcT53Z8HZJ+0Y4EO93m63T/Ld791s97in5nKzRa7Vhv7UR9ZOPqOj02PPGYbM8THzH0HwKL9e9+jiO/8E7wzkKLsTmPpf2Md4R+zmRmBDLnBGVyZLWXHQ49YaCS4dT9MgrdwZjnk66gCRs/MqTREFX9BVQr91yBE92yCGXPzbRC4wHIaCC09JIU1PSj3aL3hsN6mutYWOkA== 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=oirhDp1aJ+KaHzsTnY2r8XLS49vYxHQU3xKKAox1B+w=; b=P4pgRh8ok7kcjZ9PXngNvjYWNAaqdgz918PhZFam75th6+nwlBnAOrTFjOpDuiBcBkrfOayuXyEdSbe2DGGAAUdLX1qbsYGfNyLW9KPGsbxOajztyLxB66d99zRRYoCjIPypQCm3mIors9/UhW/rTnfxyJfuGIqanmkLRsMDPrA9eJe1g/I3eU5bAmSPJY6fDF7nt6/TU5QwB2TcLR/HcyFZRc0e3SshvhWzjAr6cB/qn8E8xm1P9L4IQbB++UEYSZg6jVo8ll1D/CbUHj9K3nDyjVncE3PZwesFxt3hNNE6vT8Pg8MeKDF/prE5QkzRsvKJlXVGYJksfQpS+Eq8wQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 18/20] tests: Add parallels images support to test 165 Date: Thu, 19 Oct 2023 14:58:52 +0200 Message-Id: <20231019125854.390385-19-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ad39deb-846f-49d9-235e-08dbd0a33489 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: etZ4vGwBNeWX7/Lw4T2wnaXn9pHKydFGZvpVTpYCH8ii2tOEQ0dhm0vuQB2ihHEFMdD+NMR8L/xv1mYyL87Zns3+UZayClIeWbHI/MTqJ/o+H7CcLskf9a+zp7JByIottw5bNSqeGg3K8kgpX0xqPVtll0IV2tQldYXy2c/m8zrYixOfl+Ha7rRI1IaVIJ4AYD5JqCI3aHEN9nQ0KW/6/BXWUI0Zt93anQrmyufV3h3bmlkNtp7XSK/lFLgDTorwiSk0BASxU6Pjo9LGrwmshhihfdqalqn9vKUxE7ZOiHiB/HZ5MgV2u+QcjcV7SlL3QiTE5zEpjaITIiXYsSTNHUgnV8c6hOCT9rAvm48npMcEr+LKBVuwWNQbi50OrNM/dFhb5eqiTDZfIq27HwY2b971HsPARGfnUdxMTeGw94kjgOZAQwDoSgmV99bOuXW4fpL6/HD3LwvhQD0N0oYJC+JD2EinYuaOPkqOW9A1vHQme6C8dokCaCXqKJoQAEOYc4ynKLVPb9SppojLN49rN5N+mtZwGOVeMxSOfflMzvatc23iIuSEq0MZj/Y7Dw+Ap9agroqSchAp/ZfpGL2X3yl8UoVrFYCKmhEiCeF9uUDic00oIZoJrG21kcz42/y9 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0S/I59MbO4oomhIUYwt2WxdfVOhA4t51OouFVYyxaYdmn5PWVhHkStYRoKU4?= =?us-ascii?Q?TlJvwXRcHLHwadpI4hNTbvUdM5G4UQ40g/m8ivt33V/CJeRW4M4KxuBBxIp+?= =?us-ascii?Q?rSuMyDkeCp0sXELUKqpJwoeThBlKVGCY7hUGSqxUY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9sEaPVpcRRPLUUIuAUJyCfGdzJQAgPF8HSCUAov+CX1?= =?us-ascii?Q?Ry0lfeyk9JTR38S+cAG3OZpFxCWDm4y2HNLJdMbP6chH6NrOpAP5lmiudkT2?= =?us-ascii?Q?5OA/SreOjQ3cILPXdTzagXC0J7ZqskdefaM6FfEQb5cNLsvyZo+e13QXwNX4?= =?us-ascii?Q?LPUCSUl/00LhZXVnXhl6oHeDfbPbAJ4ejeTr4oTdIAZfu5yEhVxtJZJxs+tQ?= =?us-ascii?Q?adAEuZWzioqC9ifs7+vsCiqd/424PqKupGA3o8P3etQljJkkQQOyOj/TzFpg?= =?us-ascii?Q?Fxy6ilXhgAt4ymKxjY86TqjyEdWRezRmFRYjKn6z3wZygQ08Mfzvd8dPPwzW?= =?us-ascii?Q?+Sba3lLPEq3Q3YP2uPIMxOpBtmfqphu0gNFJBWAfF1J93lJ9vX48XOLADs6y?= =?us-ascii?Q?zhXdnbQiyXYupB4P0TnabMlhnofWXXw7JmhI7k1b4BYMdurg0tsvQOkaCiQ3?= =?us-ascii?Q?x6ePDQK7exoO9W5vmyGwQTfvVMMoFjLb3kvhYGj1CJygrLoyXvscTdSPa/Y5?= =?us-ascii?Q?nRz5S9OMdx1NnoOWXZLJYd99y+2KEWDQ6Q0SDi84fJAMoi72Lt1ERewQ2e0w?= =?us-ascii?Q?4q4sa1i6FVFueYQRegT35do=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ad39deb-846f-49d9-235e-08dbd0a33489 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:18.4021 (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: Rj3hg0YJ6+5mvwLulp8v3gyNOnniqzEvhVDuGbNO+jwPG5q4b92oJHXVBBGHwjzfheG0ssHIrYce7CZSxsOXpze7TqvWH5W5mSQM0k7yb6M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:7e1a::725; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697720522207100007 Content-Type: text/plain; charset="utf-8" Use a different bitmap name for parallels images because their has own ID format, and can't contain an arbitrary string. Replace image reopen by shutdown/launch VM because parallels images doesn't support reopen. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/165 | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 index b24907a62f..f732db257c 100755 --- a/tests/qemu-iotests/165 +++ b/tests/qemu-iotests/165 @@ -38,6 +38,10 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): =20 def setUp(self): qemu_img('create', '-f', iotests.imgfmt, disk, str(disk_size)) + if iotests.imgfmt =3D=3D 'parallels': + self.bitmap_name =3D '00000000-0000-0000-0000-000000000000' + else: + self.bitmap_name =3D 'bitmap0' =20 def tearDown(self): os.remove(disk) @@ -50,12 +54,12 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): =20 def getSha256(self): result =3D self.vm.qmp('x-debug-block-dirty-bitmap-sha256', - node=3D'drive0', name=3D'bitmap0') + node=3D'drive0', name=3Dself.bitmap_name) return result['return']['sha256'] =20 def checkBitmap(self, sha256): result =3D self.vm.qmp('x-debug-block-dirty-bitmap-sha256', - node=3D'drive0', name=3D'bitmap0') + node=3D'drive0', name=3Dself.bitmap_name) self.assert_qmp(result, 'return/sha256', sha256); =20 def writeRegions(self, regions): @@ -65,7 +69,7 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): =20 def qmpAddBitmap(self): self.vm.qmp('block-dirty-bitmap-add', node=3D'drive0', - name=3D'bitmap0', persistent=3DTrue) + name=3Dself.bitmap_name, persistent=3DTrue) =20 def test_persistent(self): self.vm =3D self.mkVm() @@ -117,7 +121,7 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): assert sha256_1 !=3D sha256_2 # Otherwise, it's not very interesti= ng. =20 self.vm.cmd('block-dirty-bitmap-clear', node=3D'drive0', - name=3D'bitmap0') + name=3Dself.bitmap_name) =20 # Start with regions1 =20 @@ -135,16 +139,22 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): self.writeRegions(regions2) assert sha256_1 =3D=3D self.getSha256() =20 - # Reopen to RW - self.vm.cmd('blockdev-reopen', options=3D[{ - 'node-name': 'node0', - 'driver': iotests.imgfmt, - 'file': { - 'driver': 'file', - 'filename': disk - }, - 'read-only': False - }]) + if iotests.imgfmt =3D=3D 'parallels': + # parallels doesn't support reopen + self.vm.shutdown() + self.vm =3D self.mkVm() + self.vm.launch() + else: + # Reopen to RW + self.vm.cmd('blockdev-reopen', options=3D[{ + 'node-name': 'node0', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': disk + }, + 'read-only': False + }]) =20 # Check that bitmap is reopened to RW and we can write to it. self.writeRegions(regions2) @@ -154,6 +164,6 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): =20 =20 if __name__ =3D=3D '__main__': - iotests.main(supported_fmts=3D['qcow2'], + iotests.main(supported_fmts=3D['qcow2', 'parallels'], supported_protocols=3D['file'], unsupported_imgopts=3D['compat']) --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697725063; cv=pass; d=zohomail.com; s=zohoarc; b=Dhj1I1+PprYUgzCWzw12YqE4U5MaYHs75PTVQqzM8DfcaRupbjnGijntEj1CTYQAUNZkUbMX7QPXpg8XpkwOcERMecOTLAlsnIIOehCRFUDHXsYQMsKIWxJDYGscSD1yCT0wu280sDjmwTv9CViS+JxTshGwQYP8cRF9C0QvHi8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697725063; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=djhWzR1OD9wSw+5JwkKqbMpl26LmShHjJ4ERxNNSq+8=; b=QS0Ko7ZUFj0v9V6onEl72l59NTkBctfnMTcyRT6vQTiCvSPo/RlqCafgJem1sUQ4KX8F+TGCCadwBY9/LQCysuP4jlP3zSDphvUvYJjsdDSc2O9cBxn2chA/jFiivmGy9hssO7UJeX4casaVt5EZQyRSRjI5GdyjVPwdc6qj4DU= 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 1697725063264468.7968756158841; Thu, 19 Oct 2023 07:17:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtSd0-000689-Ec; Thu, 19 Oct 2023 08:59:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScc-0005sK-MF; Thu, 19 Oct 2023 08:59:30 -0400 Received: from mail-db8eur05on20717.outbound.protection.outlook.com ([2a01:111:f400:7e1a::717] helo=EUR05-DB8-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 1qtSca-0002iq-Rz; Thu, 19 Oct 2023 08:59:30 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:19 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B8awAWzVBXyE5yZwyYxUoMvU8TBnff11h6u9pnLVsQ1EtJWOmpjSmrLJLehWNIwh8nZkyz/426IkMXQX1kktTrdKtNHDcb6d0+keL8aau/Bm5tQiqEtCA/cZ9D+Sqw/LxP+hBLV7gTGhZEr/iyZ+CrMPp6EWaAcKWLO5q2/ix82++YObAZk6oEjwor9B16H6+s8JFbKpp+G6R6ohvMi7jnMh5qfcZ0TnullG3/dGIAjQAHP5fxJHVXPuwfpNZtMdVN71C7LKRb35cUVvpe6znXTJEa5znSC1zUKZSmZkQd7ygEYBBW+1CiLBkkqiQZbl0vIUPQ5cHcQwG+9UQRLlXA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=djhWzR1OD9wSw+5JwkKqbMpl26LmShHjJ4ERxNNSq+8=; b=SYZMcvU9ls2HHyTZbSO/e5Hqtzh0s+1/QjPdAJ61vff4cnoaIVF+mCKITTl+p8kytQX0FfCUBEs9NyOroZtHH+4H/MfF0ObAxsT3V2hq40VWPs+G2cZzQ9gzSgo6GUELQPdnwGCwl+KTU2YJio2R0iVXaJoIZpWzwS4EITV9YKyrIHJvfRLwGw0NdmwFzQLjmq1Frw/8ldAu36k3PoK7iqjaqyzrT9GwF3Ya68VtA7/mA/I/w9AlLxp25SCLwhDRt2v0gc1+IXpEzt9kkHoAteaeg/dNwapvXxHDqN7MfGofPpNJUnm5HHy5eRrIRnoBLwiYr99JLeVuHZf4ILJZgg== 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=djhWzR1OD9wSw+5JwkKqbMpl26LmShHjJ4ERxNNSq+8=; b=Ik2Pgt2H8v0t1JIhUP4qghXXKswtVDO+8ERXC35w+rqYDepF//SoydKa5Qf0LKgqTkQjvJGlXO1mNz2fT6MDhUUj5C3n9KdyPdyVjjdof1UM0/1X5G0zM8zbKf0zcBtkTZxmwgybdD6NjFs/DKQsobVrH52ubH8NnLmTiL8dO6PtQYI3DEqUFkasVUQOcnY+bxj6ZkWmATWae9gu9A2CF+4XLdrSvaClqNs9iWyndJ2VoSe1n2OaOX37ou2ceqwFy/zLEuo0jUvxPje3fwzAd2EJXw4oVYHZ9xT5HbDKgG2nLH4NPv1VjyJ6HF8yMUN6rACODR4gNFmSD88D/Z2E6Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 19/20] tests: Turned on 256, 299, 304 and block-status-cache for parallels format Date: Thu, 19 Oct 2023 14:58:53 +0200 Message-Id: <20231019125854.390385-20-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: d91f73fa-9465-48be-cd94-08dbd0a334f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WZdXcOMYQN3fp8s2QzsVt632KKFvkZkL1CG+MI3Qo/dEWKJab8yI5eu4drzSpsqCD3gPgberOVf0EjiYlZiDZ+aFTk1MmG4Tv3AFqkHYa8McSgvmxaTVOuTdDJd2pOinmutFGYIgXMaPLLQGAWmiu4oIWpB8vU7vroQRO/MiLGTiEgDjLCePLG8V9w3I8SNmo2vGIty1a54hRdAcZHgyXRbb8QcJw/phXxWtHWuzywqCKw5LenxRzmJnWQ6Iu6obnbwcNaToyt/tjyYPEoS6Wv5r5N98nNr1TvxKCg1sgZhb3JVmvAtvaAGIc9R7SUzK3leZpNwkMfxw8CDC+oD0TTvHtxDDEOPLbGEp8rlAMhKG3Zte8ZcJI+yghNELBHQ+TnwShxOf7IkU4I9cMI8HOL3lROcVJC6bUd3pHLSqYO5kMuoFybL0/iraXfNOGcm1yLF1hbpU7EzqqBUikQo/vEl+pySMkbJEEdEB6HH56m8AXTXpU3Zum1ADHb9Dr6PZXNanjJtTg8LIHgZqjx9iYk9QnmsCd35mhvxrHBvlraXJfdZ/BiCXL/Nepskgh+8N5zXLwXU4psdcPDfZY+HrI8tpoxwhzNVwkOSCvAbRpv37wM9n7EN/b9cj3U42ZOqT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?pVVYtiPKosTVgB2CfzBcyQkpNFN7IU+j0FXDa8aDlGWZI9tF1Ojg0BkYmOFz?= =?us-ascii?Q?7wjKEa55BLtxsIEDVUTewHvie7TMh7k20np4WEzbsjVjm/n0XGsBxBZewVrr?= =?us-ascii?Q?q+0D3UsdzqYMW19jiI57LoXfunB1hHJ93/oMO4yKsvN8TQoNE8jbVGseZesr?= =?us-ascii?Q?4F3u2dHNxwDmscJUdCONBvtuKj3SgUd4UDQGCxIChG88j9jQPf3Qgkg6WdtS?= =?us-ascii?Q?RvoFYnXfZGUHa/GKtY+OB6XVGrIExed4aUIQO0rFNvSqUx72pSSyLAI/MiTS?= =?us-ascii?Q?3b6uTSHx3Jh2E6ihsHr5NHwcVmBCB2ySZFX3mpyIWhkAIIYoYPkXhaFMMM8k?= =?us-ascii?Q?0sOtzhCYGJNLiczY8y9JbzsBybXujuAgYccIvVZKslY5hgjzsVMgEZULuM73?= =?us-ascii?Q?MELbvM8M1dK67LCGGmE4lQIRihPAuU0xHyDW0EdMBSeMqYJRXVAQ5huA6v3n?= =?us-ascii?Q?yvzqAbT0aG16m3m9gTyaVXj3936DvQEladnl0puTreLn39cWc5tGfX9FijEC?= =?us-ascii?Q?JOipPiiEAcSzIUKxAKDWmAem8Nc7bZ/gI4XTuPlbJyHoouHiOCTHAF2l73go?= =?us-ascii?Q?FG0A4/zZI300zWIy8FDTJSFqxpUcpsELPEyXGGBvl0F9YG26kh4CpqqQmGzE?= =?us-ascii?Q?VPhgwAdIUhDVyykfH9jGICSh6LFzUrLfTh8te+TYZjDZ4pyLt1z8Uns6a3GI?= =?us-ascii?Q?G2970Pom/hreds31Uf+eCwlu9RQl4VfJpJ7Q2Vz8JpeV8rbjuDemCz6iVXE5?= =?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: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d91f73fa-9465-48be-cd94-08dbd0a334f6 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:19.1523 (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: XyqXhERcCeuESKzhwc8Tz6SIB1CnJ8ZJawhvXvxYGmPnk9x+xURJCAt1AeF9ThvHRhgFkTRZHlNQZwd6AsaXmeNS5yM2DnmV+6dJzvsv52c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:7e1a::717; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697725065095100001 Content-Type: text/plain; charset="utf-8" These tests pass with parallels format. Add parallels to supporting formats for these tests. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/256 | 2 +- tests/qemu-iotests/299 | 2 +- tests/qemu-iotests/304 | 2 +- tests/qemu-iotests/tests/block-status-cache | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/256 b/tests/qemu-iotests/256 index f34af6cef7..1a4c9c6885 100755 --- a/tests/qemu-iotests/256 +++ b/tests/qemu-iotests/256 @@ -26,7 +26,7 @@ from iotests import log =20 iotests.verify_virtio_scsi_pci_or_ccw() =20 -iotests.script_initialize(supported_fmts=3D['qcow2']) +iotests.script_initialize(supported_fmts=3D['qcow2', 'parallels']) size =3D 64 * 1024 * 1024 =20 with iotests.FilePath('img0') as img0_path, \ diff --git a/tests/qemu-iotests/299 b/tests/qemu-iotests/299 index a7122941fd..d8c4399446 100755 --- a/tests/qemu-iotests/299 +++ b/tests/qemu-iotests/299 @@ -23,7 +23,7 @@ import iotests =20 # The test is unrelated to formats, restrict it to qcow2 to avoid extra ru= ns iotests.script_initialize( - supported_fmts=3D['qcow2'], + supported_fmts=3D['qcow2', 'parallels'], ) =20 nbd_sock =3D iotests.file_path('nbd.sock', base_dir=3Diotests.sock_dir) diff --git a/tests/qemu-iotests/304 b/tests/qemu-iotests/304 index 198f282087..1ebf999930 100755 --- a/tests/qemu-iotests/304 +++ b/tests/qemu-iotests/304 @@ -23,7 +23,7 @@ import iotests from iotests import qemu_img_create, qemu_img_log, file_path =20 -iotests.script_initialize(supported_fmts=3D['qcow2'], +iotests.script_initialize(supported_fmts=3D['qcow2', 'parallels'], supported_protocols=3D['file']) =20 test_img =3D file_path('test.qcow2') diff --git a/tests/qemu-iotests/tests/block-status-cache b/tests/qemu-iotes= ts/tests/block-status-cache index 5a7bc2c149..ade3d5b169 100755 --- a/tests/qemu-iotests/tests/block-status-cache +++ b/tests/qemu-iotests/tests/block-status-cache @@ -131,5 +131,5 @@ class TestBscWithNbd(iotests.QMPTestCase): if __name__ =3D=3D '__main__': # The block-status cache only works on the protocol layer, so to test = it, # we can only use the raw format - iotests.main(supported_fmts=3D['raw'], + iotests.main(supported_fmts=3D['raw', 'parallels'], supported_protocols=3D['file']) --=20 2.34.1 From nobody Wed Nov 27 15:42:49 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=1697723781; cv=pass; d=zohomail.com; s=zohoarc; b=CDNBLCm/l+nuqJoMTlKW4nj9se6Si5lqtX/mISaiXEA2hi3xU24tTTW97t75zg0s+M4gUQu1M4BR/CMpw6f1m8Ze1mqynT4koigZ8ljF/NKVFVNW8VTB0jElaeBSFUzpmuMyZgfp8PZlvVeDRk1opnnRbgQW0ryKDLoH/wiItaY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697723781; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OQY3VTqKbLWc1ugDai63v18GJcmUxZY7ZT4nVkMImmo=; b=U38lkWqEFeIKFXAQYA2Cdsx1ukKkvts9dBBAj0Ke8kpsdxJWTVaNAe6tqqbb+wViXRliV9O+BBQwx2Gb1gsP0uh6R6TivIX0HeQOx8XsyUcsa6LH0Oxxs76VBglhJreX5vlZ3aYWtHDI8LDddRv/WiEup8fFU4IWsMpOWiNHFRc= 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 1697723781380299.5088268678626; Thu, 19 Oct 2023 06:56:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtSej-0007aW-Bk; Thu, 19 Oct 2023 09:01:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtScd-0005tH-KV; Thu, 19 Oct 2023 08:59:31 -0400 Received: from mail-vi1eur04on0703.outbound.protection.outlook.com ([2a01:111:f400:fe0e::703] helo=EUR04-VI1-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 1qtScb-0002f3-Tq; Thu, 19 Oct 2023 08:59:31 -0400 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by DBBPR08MB10554.eurprd08.prod.outlook.com (2603:10a6:10:52d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.23; Thu, 19 Oct 2023 12:59:19 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::cefd:987d:e77f:71e0%11]) with mapi id 15.20.6907.022; Thu, 19 Oct 2023 12:59:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kbwDvgQ1VOKS9qdO9+NPQUQFtRb02O+uTnCTznYcmmSex9vuPMTU8OUUIPjGd67vpI5Z21TuKiMDuiThre/LfuFZ/8nV/kPPjte6dMncmYqmZqDaWQngt0qp7a1LFwly8i+9CwW9W0gcoDhtbb57JCRBKb08hVYbZij0utxWDcJVmBLoXBW5s/c3H95ycZAGUDjT9cRh1YR8PJhyF/EPznyKvzhPwG6IsDGoLsMgRpgb1grIlOts28czY9salNwkx5/slg2tFpzbZdqecrhlvjs7ii114ljzlHZr/kdF9pq22VlvBUZ77RB1T/de/xFBqppa3iaXXgTk97agFxC71g== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OQY3VTqKbLWc1ugDai63v18GJcmUxZY7ZT4nVkMImmo=; b=ib+q9VqcYo2NRYossvmbWQ5d2VKj80WfPlunp6F21M4r4oxP6uYOuPBg6CyLjNzObuuellHD/Nf0VMHNjw2fmq/gLhIUdYBTDBL7NESLoPUXzQ0Q38XA0FtiOoezODjsFxEzT00ERgDJOvJIue6WfcFdWTxtw8T/DHRWFK1W/f4yMCiDfy+90fZxN5FikRNVNhj6TEfZ+IrzW+cnvJlLQpcpsj8ikkKEWKcUQB7CW7URLvi5vctpKb6OmP+aPA4hA9SGcRoiP3z0ZPx131jc2EE+fJLQq+qnDGowpokg/nsPwSg6hnTOkBwKZU9+Tsql2DaI08LNv+LXPa4dkH+8qw== 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=OQY3VTqKbLWc1ugDai63v18GJcmUxZY7ZT4nVkMImmo=; b=qYSs+mAC5Rncq88CmPjB1iL1xppllVR0M+Z4ybaWqRdS0f7OpcpI0P1+jcHobhxsjM5JanuLv6hML96Pv9tyVrS45mm+mCqFHTnClRXdmNQ11sLdus6yM/TgXptPpXk62x0KzlaQrAjUuB/9yDuTiUmInHBKlkQyPLyaiFKPO5AyYCmONi3qQJz7z8r4Ct5nuqAekxx3vEg0KAQVzmlG+Cn5tcCQQu1aalTEXN6Yp0bFa1265rpunyuQifuJVDcn8hhytroduVkznLKCbnkLrJbmPHW+eWMKVG8jkERWTQ+BudTCxkBpFCaCziQw/blW+P9ai6B8xwPczT14ffeO8A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v2 20/20] tests: Add parallels format support to image-fleecing Date: Thu, 19 Oct 2023 14:58:54 +0200 Message-Id: <20231019125854.390385-21-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> References: <20231019125854.390385-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: VI1P189CA0026.EURP189.PROD.OUTLOOK.COM (2603:10a6:802:2a::39) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|DBBPR08MB10554:EE_ X-MS-Office365-Filtering-Correlation-Id: 3d576eef-4d3c-4f05-77c7-08dbd0a33564 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EYNHjbns1qYzQd3dSkC8otaFLNXZ6m0NGlen1nMl+cwappkuf1rmvjR/btWhZdWHT0YFUp0i+Q6mNZaZ5FI9cMZalE4JJJDXiH2WnKulymsFkCGwRNemBra4fqrBP1KRHHZDj9s7gqulg0uGYD8NtUiZ+gbNVHFH1aVDsbuRpw95si4cNzcO08zmEoxeScUPeSWty6HivmpbXnjX8UnzuJTA0G6oiCx0WzesrCf6zRtJUKa+dKY48fQKN+GBPXrgFCfVfiwhDlJ8egVUogwFWkIzQusUXhHzjmXzKyVw3EqmF9ho8LquV/zkzXTdBLztGHMS49TLKN5JKr/cF6guufZF9tzGQPRkZ1R2ipcSlKAoMemZ9A0IytMPq2or23ExZjWwUQxAJ9sC/1ypfhxG4X3joKNx5//VQBzCQ3kUZkO1twblZUZNVrHliIh/4BDkmEqW0bUwypsegFnwKSJnlDEH17Iwh7v80BysSKEuLynnJQwJ7ooC2JPugx1Q1FgmYwVLnOr3XrLh/nXdWmCRpKG4YdiO3/Ps2Iq8Sz3ZMRQBuqDs6MDC07lw6thpQFxS43xsAwJdKbrPwUZx6EpW6kAwNw0oMH3YWR25rdog8tkcq+SE9oxn8aOV1I/kW6q5 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(136003)(396003)(376002)(346002)(39850400004)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(26005)(38350700005)(38100700002)(5660300002)(83380400001)(44832011)(41300700001)(86362001)(8676002)(4326008)(66946007)(8936002)(316002)(1076003)(6916009)(66476007)(66556008)(6486002)(6666004)(6506007)(478600001)(52116002)(2906002)(2616005)(6512007)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?SBHQKP4T5be4LpMpajIXxVp006JTCJv/ZLJS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akICqdLZLMLtCP8gcy37AHJLMGEytUmibtrsVeoavgnt65STn?= =?us-ascii?Q?prmgt6QTzzUigh5zqH501oE3+hdfbVZa35VA9h0uthCegtkf+gypR/O7xS4n?= =?us-ascii?Q?CJpFvVTByOia8dRu+dZLaIy37cN+kea9GrCFri23RgRhg36svW/Zavz4K3e4?= =?us-ascii?Q?DJCWasUjn3/ybXydW2w9YJwlD66YzLJhDgeRsDj+XULhQvwmySxH/K3ej21L?= =?us-ascii?Q?q1JbJMdtlOP5XDFGVdDooDkaelGhDu4U46tQj6MFDh4DzI4+CGwJ0KIvPW7o?= =?us-ascii?Q?eUgGkARwkHcQF1VstC2WtFmTwit1awbrNmF21O1Ly7ZEJrhKynOlvMKD4Wis?= =?us-ascii?Q?I1ijv/ahKoQSe+46f3L+yvE5KIALwhpiesRdtv4zKBZa2QbWEyC7298u2gVL?= =?us-ascii?Q?4i9xRakgTXa7B44sL5CC3shzY05NoyiRO4hL3+ov5SZgOI2aS3KwAXclbOUk?= =?us-ascii?Q?fGIAXEhF8ABM8QFO2eoOGRcSSWUyqNty2ZA7x1wU+HxggTqpvjJM9wi2OCqA?= =?us-ascii?Q?dRqGUxJMkF0r/E+FUtovoL8MSBk55eLXMLn5cFusf0SoPLhm8n/AQzrWN2/U?= =?us-ascii?Q?xGdePJjFCzYmEoothg0iy5o36Q/Zkq949+PglJgSc2mPFkl1lRI9VlPIrMM5?= =?us-ascii?Q?POjgeLCnL+n5nZKMr6zbDAhiH+5pwCJN4PNgWNYisvp1cnYdd86wLNFKXpKD?= =?us-ascii?Q?B1CZ8uZGDm9MpS26pk/KiQo=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3d576eef-4d3c-4f05-77c7-08dbd0a33564 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:59:19.8531 (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: jk+oXeVLTUbWXXIUPdRmy/fSqTDGIPx4E04J64owRFXhsPpxGq1oyAeFMpK/mP5XuStjKc4PSlXbmdpuA/K43S4ujUo+spKzgU8BxKzPwjo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10554 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=2a01:111:f400:fe0e::703; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-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, 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.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1697723783411100003 Content-Type: text/plain; charset="utf-8" Use a different bitmap name for parallels images because their has own ID format, and can't contain an arbitrary string. Replace hardcoded 'qcow2' format to iotests.imgfmt. Add 'parallels' to supported formats. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/image-fleecing | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/t= ests/image-fleecing index 5e3b2c7e46..dd940b7203 100755 --- a/tests/qemu-iotests/tests/image-fleecing +++ b/tests/qemu-iotests/tests/image-fleecing @@ -28,7 +28,7 @@ import iotests from iotests import log, qemu_img, qemu_io =20 iotests.script_initialize( - supported_fmts=3D['qcow2'], + supported_fmts=3D['qcow2', 'parallels'], supported_platforms=3D['linux'], required_fmts=3D['copy-before-write'], unsupported_imgopts=3D['compat'] @@ -61,12 +61,17 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, ba= se_img_path, if push_backup: assert use_cbw =20 + if iotests.imgfmt =3D=3D 'parallels': + bitmap_name =3D '00000000-0000-0000-0000-000000000000' + else: + bitmap_name =3D 'bitmap0' + log('--- Setting up images ---') log('') =20 qemu_img('create', '-f', iotests.imgfmt, base_img_path, '64M') if bitmap: - qemu_img('bitmap', '--add', base_img_path, 'bitmap0') + qemu_img('bitmap', '--add', base_img_path, bitmap_name) =20 if use_snapshot_access_filter: assert use_cbw @@ -75,7 +80,7 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, base= _img_path, qemu_img('create', '-f', 'qcow2', fleece_img_path, '64M') =20 if push_backup: - qemu_img('create', '-f', 'qcow2', target_img_path, '64M') + qemu_img('create', '-f', iotests.imgfmt, target_img_path, '64M') =20 for p in patterns: qemu_io('-f', iotests.imgfmt, @@ -130,7 +135,7 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, ba= se_img_path, } =20 if bitmap: - fl_cbw['bitmap'] =3D {'node': src_node, 'name': 'bitmap0'} + fl_cbw['bitmap'] =3D {'node': src_node, 'name': bitmap_name} =20 log(vm.qmp('blockdev-add', fl_cbw)) =20 --=20 2.34.1