From patchwork Thu Dec 28 09:41:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505742 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5CD5EC3DA6E for ; Thu, 28 Dec 2023 09:43:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuF-0008E8-VZ; Thu, 28 Dec 2023 04:42:23 -0500 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 1rImu4-0008AI-KH; Thu, 28 Dec 2023 04:42:14 -0500 Received: from mail-am6eur05on20701.outbound.protection.outlook.com ([2a01:111:f403:2612::701] helo=EUR05-AM6-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 1rImu2-0008GX-4q; Thu, 28 Dec 2023 04:42:12 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QNVCm12gGhWFVSzaUmavAF22rq4s0qGRYHM05U+pR3iru4H3AWYNTx+IrvBFKTCq2xIExvTyAIpL/f1aIx0ksRcHlSoczwKDAjcLLzBwTGjJYqEfnNw9vkCXY4tOK7ArT7Fw9XmSmzbimCmRwu9jeooVXV2lx1fDdhPcS55yuH9tyZnV48Qc/oWJwfmeMuhVygHS2lzwzzzjlLE4uYMmkosMFIYBikT0OJPO3/8vJmAb5JyskCPTSlJ3T4liq+pBv3ea8EtGMBHANe4TOUdiQm8d9YIyXA2jX27wC4dfiRgLJkBE2payDkAZQ0xzrrU5x98rMuPnKk2uYQ1mswAaag== 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=GKJH/SnE1VYd6dB1J/HgjlmdPDZivDxE/8D7NJc2Hfw=; b=CcBBXf64RmeKz4LroMxqVyl4YUr23xJ3KwOrOXu06QbI8mK+4pwaxSNxjb2A6seHKrapbv2096en+HnjwhNu4Uh0bBoRXZqNMrkmsuiWI8fDM+AvuWsHNCXPlEpL5BVkhZdYnSG08KP346XY5vHzkAIF8qN/TEHvpSrU0QfI2eP6q77Qgb3vrBJP41mEVeuf0uiQ3feWsNTKRNpfWqdqQFEF47aOdfKi/MiKsWNKVjDaseSGaM0hvaiCKjXcFiO8sEot5Du7vKU1XPEV5beTvpw3WwMuUrjbSSkwYsr8vqc1oyDZJpUjoQac+6jq6dS1nTKQfFrptvwwEysLwVRYGg== 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=GKJH/SnE1VYd6dB1J/HgjlmdPDZivDxE/8D7NJc2Hfw=; b=ESpvbZ4GWk92cxdt7sI7vb9+2TJpPpX7vyvfZLYM9vq1RQBQnz/0u4yZat76A8LWLrxOWpdwnmYnc4vCiMEROZ++quil3qXV7vzRsqGJXCVLPo7/evM6NKndzskYil2fjyQ2ABdQ1dj679FpnBUc2EZ0EFWx58LNZE20mZxaS7ckbiHuwytSGF+jqcMFfzN1Gq/hnNkGzseBjp8wP6cuO0mDuKIWr6FlzNx1084of/NYyCWgtZ24RDwr2qXlNJP6K49aFYe6bus6Y3s6dApbLWnW6lKIzoKBg7ygyJUniRBPAzn9DAEZrqRjExCoXko5uqmM3mwiL6pfdS8vJJrjNA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by AS8PR08MB8969.eurprd08.prod.outlook.com (2603:10a6:20b:5b4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:00 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:00 +0000 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 01/21] parallels: Set s->used_bmap to NULL in parallels_free_used_bitmap() Date: Thu, 28 Dec 2023 10:41:33 +0100 Message-Id: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|AS8PR08MB8969:EE_ X-MS-Office365-Filtering-Correlation-Id: a9c78ac3-3845-43e1-155a-08dc07893d37 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Fp5uywcN20hmmufpfxY6ZI/0egf3oeAtTsyXaMLwF1YywI1A8CYTAI+4nILp0mNbJpbP5G7A+ol64Cx0i5nQG17d4ZVhAim+vZz7qTZo2A+G9J4JOt5432apqqzXDqZPrjb2Ewo7GvYua5lSFCveUqM2x+bNqTTVhDqjnw6qDFe3JuAg8SUSrjmvIhc8chFwtbWd9t+TXxA2wz/h2CdoqnF+ZqqeiHYQndz2Cr1PMtpnWdPN8vTpqeu8O5/OwMM2dmWAXICkvsKm/cq6+22FrInvINXTNbX3gAI/VR02jhflc4xqXMc3lBoDpW4WkdmyuyW7lp5m5OS3sUHmwhwrEUJrS6fAVPph0wvHYzRreDUYAjAvQUKKEyVeISqA2F7UUeaf57t65fCTWjoOAeZbOCkg/0MDI8UkID7gmxioAkSZWC4fHZuxtPpgSaXyNlSG89RmIBRWFuTT91ROrS8ZdYRV7HTYeEijPZohV/orjSUMFqwjtIp/ywQ0V+f41QZtQcGIYWMCxx8KueKFQXhCKNcf5ZDwzmV2qBO0WE24USGCPA3Iaz0Vbgz/DB+Ep6sB/FAyIxRHwomRxO7+0Q6zTg8ArkY+YjIdbwja3TZREmyY7ClVWSYnM4LAkXUfUz8t X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(39840400004)(396003)(366004)(376002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(2616005)(1076003)(26005)(38350700005)(38100700002)(83380400001)(36756003)(44832011)(66476007)(66556008)(6916009)(4326008)(66946007)(86362001)(6486002)(8936002)(8676002)(316002)(6666004)(41300700001)(6506007)(6512007)(2906002)(478600001)(5660300002)(4744005)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 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jM0prpmo4taxaP6O/hchaGRE98iwP6TYHFugZfLwOTC3IhJ1IB5pFqCZZHuFckc34oJvVlwG8Ga+Or97MpMFyNg4NhNCCaB3PjntvxeK5cJ4ExrRclMmpv+2OImqtUdhZTwOk/P8GzKAOdkPWHARHtfn/crj8ayAjKT/xY0I3prBWs9Af79JEHxWYJLcXHOdB4ZC89qczxlPjoJUFr5PwuWkPB7IGyXkobzfmB4UVvZ7smf1PUk1o7lZ2VsXwIySY7ZVil11CLQ+E/FaCPrhPrOpuddFaC+dFIuAuNGXdQHl3zmkyp/5Y/dMr+5oO3M+My6fDUQrj7ilsLSF455Elzx3BXNmiVHmloegqLjqL8Z9crzLb346kdMcPFidJU2HjhWpaLJtJcj90QknlsahTeb4Jk5M0RDpvyPMEb62Xy5gDc32OZ6mTfCdOfBoxMmpkiJ1/ZvHnVIWDiHvA5iAW9pJlzstmZ5NLAiCR7Q+Jh95zxjLrz4XLI8sMFzvy3Y+s8ypeA5pHz6nVO7U4ZzDzNn3FxKkWxAWl27qpk7oUEGUf9CDGU22oEOL41u9/8H3SkJjSJ70b3aGVVPO2qCMDI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9c78ac3-3845-43e1-155a-08dc07893d37 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:00.0596 (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: yfs5DmeKRIk+gXu58Vv5oiy80KrmUXAlzu7Hhn2Spf23IpSW8iR1XQkZ+eD8Czxa5w1ZuHTYYRU6JzWikqp536cQG3+KnjTocLZd5gFcRj4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8969 Received-SPF: pass client-ip=2a01:111:f403:2612::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 Reviewed-by: Denis V. Lunev --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallels.c index 9205a0864f..072b1efd78 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -245,6 +245,7 @@ static void parallels_free_used_bitmap(BlockDriverState *bs) BDRVParallelsState *s = bs->opaque; s->used_bmap_size = 0; g_free(s->used_bmap); + s->used_bmap = NULL; } static int64_t coroutine_fn GRAPH_RDLOCK From patchwork Thu Dec 28 09:41:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505746 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A3264C3DA6E for ; Thu, 28 Dec 2023 09:43:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImu2-00088q-U4; Thu, 28 Dec 2023 04:42:10 -0500 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 1rImu0-00088X-Rf; Thu, 28 Dec 2023 04:42:09 -0500 Received: from mail-am6eur05on20701.outbound.protection.outlook.com ([2a01:111:f403:2612::701] helo=EUR05-AM6-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 1rImty-0008GX-AK; Thu, 28 Dec 2023 04:42:08 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YmS21Gk2w4SF7h93nssxeai8oZMCq0JPRXC5H848HSVNUk+NfzBKXKamX7MJbcO0VBqn3F/i9KAN8mLojxjOuXU61KHRP7W1O4hjxsdFv1xbvpswpfi8FCEulBIRVoTCltaQEzmv2Lr3Jnm1uFjwJqWCjMbGLYA19r9nzDyxjILpwSwtPHgsXG2ymcNzfNpX/guSlVLtmEcjwnJmnuJO8lUHbrswu7bCuT9+3yjntPzqk1uGivd7SQj2oUL+JYYb31Lors4QwMpnkW8n+Y2p/tWFsHUQrRR/+ru6sRwtW5FxCbH/wOGgkTTkEt1qDXNqh7SIzV+P1s4Mv/NJPv5hKw== 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=1XGM8R+1YhTFUzcMeWgYcDxrj2klo3PteoKf3LFzL1k=; b=nAMShe4/u4UVTa0qoJfK0+6bqfO58T29cnBORm/2TAJI1m+0JgRRQNvxbtBQ8VIgSX8rGJuAcMnwAXq5IZBbu04Z53KOhlZJblawPO0ee3sqO6MNT28IWOeZjF8dEFio1BfzdlOSalevyYyU8Ellp7MMG3S3xNUdP/QaqzJmUS8dX1LsFPhd8zGurPsYFUWmDAcHzfftVviofLAnG4ZVaQDSbMkJocMJw5DQbEzHAs8tajAC1NEUSUZE+4UKwji9dIR+Rwx6o+Xu57s5GHyzzQCSNRS2M+ANl+F90dCeBbvEU/mIx0NHx8Ng4RyfLxQpD/N4/7Qd/QgSFSXaJxvVsQ== 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=1XGM8R+1YhTFUzcMeWgYcDxrj2klo3PteoKf3LFzL1k=; b=ntCGvhgTB7X+SmdusQilk/lkckfOqj8XXrz+XQBg6Zuof2XYh7lRh7VsGQUbdH4gc9qqKbNowHvy3gCQEB2VfsIkTF58DY/fDhMQ304NuMfaeUGMXkbHW7cf24xugGzawdvm2nfJvy+f6BBfGg2OQndMK9yoKYEjqO4qBBoNQC82jRp9bWmHGMfSiOdy1flspyjW/4BMGwX5gOczJvgwuZiAx3EObflkrzquU9LDX/Tbj7u2YxISlBeCHR/JBlKjfkKCNhRBNfkbgDaXo0+6NQjKruQJdte77pbdeM3HY2hol9O+5f86arU8OFo5bm/ErkUo+qoGDp4uD53CZ61RfQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by AS8PR08MB8969.eurprd08.prod.outlook.com (2603:10a6:20b:5b4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:00 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:00 +0000 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 02/21] parallels: Move inactivation code to a separate function Date: Thu, 28 Dec 2023 10:41:34 +0100 Message-Id: <20231228094153.370291-2-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|AS8PR08MB8969:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f2013eb-eae3-4f50-3a35-08dc07893d7c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8tC+/GW4kEDKfD/am7b1HERL4aBDYGc0k4aIHKVAqmIWYqoOCXjX59I385nkWUiG0Ivgui+Z0wSPPa52aRkpilgJjXciYk5LHBm3ZAa5yGq2TUhpFKx0oUeHrVg/EkHVaMkxQHsqhDAC699oSYJQ/cVQc71EEOdfWni/OM4E631Uq7SKoBs3YmF0zrAcM1YDwvNddzleYM+Z7zGEBwctrxbdFxKvs6AnE4HmzwkRzh/PlxF+LGWGG7HpH3B91qJuLjKRfZLE8CY9gb3gaNERwR8u5nqMVvL8Z4VhX6IhkLndRqe733D8SR3KjjTR4c1rQTGFUxe+Y6TA/qPt7gKNLTOS8rOymIUlqIP0onFczGEE3RqTwVQAwhJj5whm0sFsSg8eViWOFJDmAC41TNcpiKukZcXiiM+mi42K2j5JQ8BvDZYN/gsRGjS2BCDt8FTScyHMcTH3s+mNntXvJKH9o2Sb4Z1g4LipjrkoreGfPczJCEUnocfR2futAjRfxBNoPx80hlrdeihouZbBQdwY0eaU+16VdYFP9ugdp8MyyYSX7f7s0JFELVVuhoFdwcpcZqlfj1Q1trOQKwksE/rXDnz4OVxws+ZT7Q3xdfk8EClrSfIxWintNDJIw3kjc4WP X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(39840400004)(396003)(366004)(376002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(2616005)(1076003)(26005)(38350700005)(38100700002)(83380400001)(36756003)(44832011)(66476007)(66556008)(6916009)(4326008)(66946007)(86362001)(6486002)(8936002)(8676002)(316002)(6666004)(41300700001)(6506007)(6512007)(2906002)(478600001)(5660300002)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o2OsSii3bssajgNyah+trbtvnj4mnP0h6AeWZPLm+KNJ5LIPIP/PR5aRmzq8B9Awij66ahiufOQAOF1dOTt63gAAiWEhqS+E/XBJ9H9k+Fi/SqbOiwu5ZaK3esp1T2N9JploFBhUYPwHhSO5hl9Biuo6TLb9OnL/xbSgJoRBFsZ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+om1AcOCpoRt8Dz3NbHmIqrmcllBM9cp/pO60zmiyIpMsz5gIewdQuOhZI1pz4f5U6zAWpRHP65AV/wrnSHT1XHki0p3462suWYBUefCte1gpS4qzuD1OkKL3kqhI/JObexd8fIBwm0eFDKx1chMLXkVIu1ZqxKNnteimronXFkQLuIwPxDQAQUgIAg4eHVHm+v8PU/Q0CQewPaPVvwH6W7APNzD4+9PNQDvZUgK6jQgbe7uAZhY3+gbfx1GlUz2FZh6+pDEiM097H3TVbPXswqgAzWSbEKxpUlmeYaZ65orVTZb+G5KZ6z9ZVZZuo3wbbI8RN7utv+TnJBXpv8jeVyDAuF1bmaIXQhcw0q3xek0pNd6pS4FgCgXj0Wpm9iqOoXDIHIpzL1rm4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f2013eb-eae3-4f50-3a35-08dc07893d7c X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:00.4127 (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: WX1AD+LxgUtQ/Pvigp83WENmgeHV7RXRzdqzjLjrxp7LWIVULzBF7uA7pA+WxIbp+tzrk8oS4REnr3+6YEH/wj2myAwm+57zijvfartEwuQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8969 Received-SPF: pass client-ip=2a01:111:f403:2612::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org We are going to add parallels image extensions storage and need a separate function for inactivation code. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 072b1efd78..992362ce29 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1424,6 +1424,20 @@ fail: return ret; } +static int GRAPH_RDLOCK parallels_inactivate(BlockDriverState *bs) +{ + BDRVParallelsState *s = bs->opaque; + int ret; + + s->header->inuse = 0; + parallels_update_header(bs); + + /* errors are ignored, so we might as well pass exact=true */ + ret = bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, true, + PREALLOC_MODE_OFF, 0, NULL); + + return ret; +} static void parallels_close(BlockDriverState *bs) { @@ -1432,12 +1446,7 @@ static void parallels_close(BlockDriverState *bs) GRAPH_RDLOCK_GUARD_MAINLOOP(); if ((bs->open_flags & BDRV_O_RDWR) && !(bs->open_flags & BDRV_O_INACTIVE)) { - s->header->inuse = 0; - parallels_update_header(bs); - - /* errors are ignored, so we might as well pass exact=true */ - bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, true, - PREALLOC_MODE_OFF, 0, NULL); + parallels_inactivate(bs); } parallels_free_used_bitmap(bs); @@ -1476,6 +1485,7 @@ static BlockDriver bdrv_parallels = { .bdrv_co_check = parallels_co_check, .bdrv_co_pdiscard = parallels_co_pdiscard, .bdrv_co_pwrite_zeroes = parallels_co_pwrite_zeroes, + .bdrv_inactivate = parallels_inactivate, }; static void bdrv_parallels_init(void) From patchwork Thu Dec 28 09:41:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33ED4C3DA6E for ; Thu, 28 Dec 2023 09:44:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuM-0008KP-T1; Thu, 28 Dec 2023 04:42:30 -0500 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 1rImuE-0008EV-PF; Thu, 28 Dec 2023 04:42:23 -0500 Received: from mail-am6eur05on20701.outbound.protection.outlook.com ([2a01:111:f403:2612::701] helo=EUR05-AM6-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 1rImu5-0008GX-67; Thu, 28 Dec 2023 04:42:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CBME/44BzIV1ocZTy0pUadIbaHEkjPVtFpMfSG/CL4mes70LqcefKJjrXE8vMoRMjtIF1ni2DV0tu4yNAfHYO3WQFBOE/4r6ruxeJ3YhzuujBHXdU/8q+GbsorLe2Mt0xE/e045nyx6wokeoh5dv3PHQWq1jvvB5hdVMtbCPBPnrvaHKdrdZPAxVBfciheshjAvOfCNntRNq0Vp/xEVqAD7M8kBzN9PGI+6uMixa6yG/tQRun5yCm8P2kuiOfSqvUuK4wqcb0p9qWQL0U3qDrzUuNAWylS97T7kVObyrAdBqOPMylhDFdMiOB6DvB/3Lo6booVeCRwwcs48BHFsb9w== 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=QZAYmTt6a8iWzR3ObMRJXGIqRa8RVqoX0brRg6ZAt0Q=; b=Mw8g6CXgUNmIqNIK6G6D8D1mF+sMiXlquejUJboouRa/SYsiUtZevQzPml1VgbxiQJ0AMz8eGxSZqozKI6NlGjdDvLcqGzmuUuM3sG7jYu6M54eaJ8eNFmnEAJyUcjgfWDT27zq36e9mqDC8rO6gVur7pw6xJjIthwH4r1dw9WmAhTyqvyN2Hn/LXxqb9b9OGzP3wHlUXF/JWJFhdbKWcXmvSlIoWQzeKxHLqDzokf2EcjdZefSL87x/ItocTTeY1nGIsaRRYvpRlO3C2z8ikOqez9AhDLoTpRwZHvqGnPboRmlx1+yw3IaM7d5dgoAx2Gq12CaLnvfMFi99TZZvyw== 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=QZAYmTt6a8iWzR3ObMRJXGIqRa8RVqoX0brRg6ZAt0Q=; b=SGMRwS+NFMwnRZ1n5x0ol7/DFagFIkoEW5nZX5SSPOD4BJropjivt2f6oJWDjbs6GyNcCxFhodNeWg20o6nu6OQA4iqL1l53z73euIg2ta1V5VlTAZdBS1d4+xW5smauCiIPuByHDOestNKmfucwDEOGOFCcodSiyBqc8Mf59p8/mtYaK5hmImb6yG3eh9jeUImzMFpjUYSV4BPyeSkaudphpZH0BLsAGdBqxWOxb9+wE5BtUyDNKW37nSQxEsWlrtnvpe9fAyL+DVRwY/qhoyGNr1IvhVO5cOl141oiweoA07aU3WtkdOTxc8qi3kvnPmLwa4nJKTyFvPDt1HcLKA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by AS8PR08MB8969.eurprd08.prod.outlook.com (2603:10a6:20b:5b4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:01 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:01 +0000 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 03/21] parallels: Make mark_used() a global function Date: Thu, 28 Dec 2023 10:41:35 +0100 Message-Id: <20231228094153.370291-3-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|AS8PR08MB8969:EE_ X-MS-Office365-Filtering-Correlation-Id: 239d117b-1df8-43b8-aeb1-08dc07893db0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s90wtEVWZWycSHRKUzYsqyB04VIw5DVbQEYvqDIQb5N9acPqG4bxBWhuP1vle/vh4Q05mdVzL7dfMpftmPN0tLEdhljCOhP0KHtRgSdzHHlAAnzswER3mFEhKlb1fE4m9mw/IkyAJm65b9+wia68eezfRTZA0dLqx4N072Z0jeIGOq0hg5nrOEj5qlWxoqiwpER5qgGksVlozk4tv2YVDsGz73x4PxPp0lgQLHncqyQP37y9taZX3OJigfzDcVfuWkJYpdtTdYNq/LvNXImKEOJVvG+Sqldqa+8Tx/4NVRQKuQ+D26ypzCRlY1ty7Da+N0ddxpIbiLMO8YzYmT9YAwpv+i56kTXSEvItMkbsbQKQUIK4Ue3gz6jMHf/3+BsPf0fUMCLLn95vl49/WK6WNFQwx+v5xuI3HQP/RSovEhg84LQUj0BjBx/NXXawOlaRlnMESDH2YVweGHy5eNlgzxPPZ9wccDL4IWijdBQ14sEz6EX/bb+xmG408g38giDsjqHsig3VYbMZCfk6rMSMW+URAPiEXIcxoItWwEgNJF68XuN3DOynJMpdH6RLNYVNUghdL145gA3xioZOF/xV+4krcjwBAkZTMtklBggiQSXC3pWclZSV5y2zdJc4S9hZ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(39840400004)(396003)(366004)(376002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(2616005)(1076003)(26005)(38350700005)(38100700002)(83380400001)(36756003)(44832011)(66476007)(66556008)(6916009)(4326008)(66946007)(86362001)(6486002)(8936002)(8676002)(316002)(6666004)(41300700001)(6506007)(6512007)(2906002)(478600001)(5660300002)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cCBo1CnNJrajFqZ0lyrk0oT4sDAcojPW0fAfhaRUak1jaEMR82vLU3l7kLiipkcdg0auqPcmleOxS4TQjwgvs0mFz1TWiDZjltgT6dpWFGkBrEFGHmJGPyVsAS0TFRjOwX2TobWlLl0dcNFBhUnmIf39BLr+oR3hS2CILwKTGwKbNLxPuZXB23RmIn81uaQc7Tv/piE8zVej4diQkO/YleIV3FbipRsah3W1tBWSXe2PiDDU/ixmHxNNHL/N4RneOlP5Zjz7GrF66Zizi5nZ3w2VcmMu3MeAWV99PqRfGJPDwzRqlG4M9UaGE+fzWu31gU3KtIbS8LugCGAcq0dZnEKI1tyHVJyGtnvXiosFHQ6fzYl2MlRkcmDYDZnvkV6+ypl+NSeY6krg3oR34utR8aDKwww1oMkzVMbU7MSMO21meodQQP3VVgkSvHjLhLXdgcWEapj+bJuGon1oiljWp3G3eIRFaBUwrCu5/wJkbUB3ZkSaBp23YEuLiXnnEbycTCqSGR+4SDhrrr7OiBbe2n8IYxcsThzXDW0chLlUBZQcGQpECOunlcC/R20abz6wLDGuggcNHwYnulY6iD9nOuTmZNDvTIIGJ6yr1ijltty/SE7lBfJ6CuVNMlkVmyUh7YGMYs/SqbiNER5KdfDK1KaouvUYMdbjOH/22a3vcJA+RLn22iqX7J69VHeYjuQf9rOHSATkOb8ApFJAnSk+kLqtziTY8DpM7mOwpa2WvLOAZHs0OuoWQhLcBm9nmi7kdw1SuesZ1rpbudBpbitYOnIA3rdlBUurozAB/36VSV6qOJbsEEjKvgEGco/6CISo2QlCFui/Uoy32mpmL8F0Hj0EJYsJ8goVje9Sl1zUvk4sMllYbV46jFmaX1Q1CTZOZVGRuuCK5aJZ3EPpDYcKtN0szdQ/OS69zs7D43WeVk+noOixjrY+yfaArFWxV2InDRokyidK6Rmdv6Em/BIpcUUk6Y7xU3B7S6+AHrGSiS6Zni0qi4jEct+nSBaawx7cpOdGGMo1McLanMunRepfJaOs4fI2TtJzxnonJwe2uZOmsLdF9TyzXzN7+8MkcWwW1hLKMFWtQ43HiA6PJzsS+tZtC+FOOTuTTjzBDoKpg1wIFi/b+cAiUainUGhDX708Oq7p4xO1nO1OZYtsh6CFzmn36oNEMst2PHOrNnRko4RGpAb2+k3eBQ8zIfKtvxMjeL/FrXB3Alicv8tYPOYnM+54jtI8W8nRTuqdgFrJqes/PD8Uu3y3MXcdqT9jitQtLM3+778TS+Xd72ROlkzwVcsvRuXQZDkDOQjuUuXtBl6aIhov6oWtUC09mZODnPiCgj7p8Z7wKC4e9BzrPeX9RKpIutCuQNuQr2BLVTJWSn9cF/Xua7YFBJCVcjOfZBgXyA2XhDiHw8GsWUY1NbiPG7T2DhdM/OU6/0Bav1XU9IXUNdPkf4RDbsGXN3OsI/bMZ45gQLCufSlSqGsyqfQrMq9MZsREC9so2fzwZodleG6jrVCD4G2iD/vdFWa0pstK9IkZXUXcn+97YHhNOBqphjyXHlhQRZQ4bVI7YWMeEFCmXXpfnfq4/SpnXptAbjqWO5YP6+OCS2y5KXIO2stvmWyITSxgWSyY2DKYFdQNckc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 239d117b-1df8-43b8-aeb1-08dc07893db0 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:00.7756 (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: BuNopFLae84hVHisbMjtej+QckgIKbMyT/I5g2xjN/ervaIMzrzUf76ekKM1b0OZfXb2SbchE+KtY8ZkGJsWCNfrJPYAlN/ArXJ45w7uPWE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8969 Received-SPF: pass client-ip=2a01:111:f403:2612::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org We will need this function and a function for marking unused clusters (will be added in the next patch) in parallels-ext.c too. Let it be a global function parallels_mark_used(). Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 14 ++++++++------ block/parallels.h | 3 +++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 992362ce29..ae524f1820 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_block, 1); } -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 = bs->opaque; uint32_t cluster_index = host_cluster_index(s, off); @@ -232,7 +232,8 @@ static int GRAPH_RDLOCK parallels_fill_used_bitmap(BlockDriverState *bs) continue; } - err2 = mark_used(bs, s->used_bmap, s->used_bmap_size, host_off, 1); + err2 = parallels_mark_used(bs, s->used_bmap, s->used_bmap_size, + host_off, 1); if (err2 < 0 && err == 0) { err = err2; } @@ -366,7 +367,8 @@ allocate_clusters(BlockDriverState *bs, int64_t sector_num, } } - ret = mark_used(bs, s->used_bmap, s->used_bmap_size, host_off, to_allocate); + ret = parallels_mark_used(bs, s->used_bmap, s->used_bmap_size, + host_off, to_allocate); if (ret < 0) { /* Image consistency is broken. Alarm! */ return ret; @@ -827,7 +829,7 @@ parallels_check_duplicate(BlockDriverState *bs, BdrvCheckResult *res, continue; } - ret = mark_used(bs, bitmap, bitmap_size, host_off, 1); + ret = parallels_mark_used(bs, bitmap, bitmap_size, host_off, 1); assert(ret != -E2BIG); if (ret == 0) { continue; @@ -887,7 +889,7 @@ parallels_check_duplicate(BlockDriverState *bs, BdrvCheckResult *res, * considered, and the bitmap size doesn't change. This specifically * means that -E2BIG is OK. */ - ret = mark_used(bs, bitmap, bitmap_size, host_off, 1); + ret = parallels_mark_used(bs, bitmap, bitmap_size, host_off, 1); if (ret == -EBUSY) { res->check_errors++; goto out_repair_bat; diff --git a/block/parallels.h b/block/parallels.h index 423b2ad727..68077416b1 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -90,6 +90,9 @@ typedef struct BDRVParallelsState { Error *migration_blocker; } BDRVParallelsState; +int parallels_mark_used(BlockDriverState *bs, unsigned long *bitmap, + uint32_t bitmap_size, int64_t off, uint32_t count); + int GRAPH_RDLOCK parallels_read_format_extension(BlockDriverState *bs, int64_t ext_off, Error **errp); From patchwork Thu Dec 28 09:41:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505744 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77D9DC4706F for ; Thu, 28 Dec 2023 09:43:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImu3-00089g-Sg; Thu, 28 Dec 2023 04:42:11 -0500 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 1rImu1-00088Z-UK; Thu, 28 Dec 2023 04:42:10 -0500 Received: from mail-am6eur05on20701.outbound.protection.outlook.com ([2a01:111:f403:2612::701] helo=EUR05-AM6-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 1rImty-0008Gn-LH; Thu, 28 Dec 2023 04:42:08 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SwPhEB/DmgXXvBGRuCU3nR4qufY9eWablslPk7vrRBIBZ34OVYM/PIE5t3Hic0d3K8u0CLTBLTXu4FqozEc4Arf+Gl91hlRRmlH4N/9Gq/ApWe/5I81jm9DmvCUr/RlCibwxxloNPmU3wp4qwepd63o+ak1B0u3qc3Kwj3SQPnxOZAF4gYziFtFkPQTDAKLrs2rEpJcdHfiSkIKRbDd6y+UjNlScU6d3lc5beu3YjVFH8LH62DR8uiiE0Z4A7naxDsJa5CIFh7QdlzghtQf2jTQanFkKPoJzhI1UEYMgvEH6M5DBjSFgyD8yBv9i0H6bwDAfaLABC91DR/81Qbu4WQ== 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=sXO8ScENoFKWHNVwNMhYTBjNx87409obryISg/lbAE8=; b=frOm7QreJ/hE20yfsUvzKGGisHDRKom3IOZr6qydQy20Yiz/MhiFr3WPj2zo26TlF+UnrUd9NCHmORPtH17T+iKBGFS0d03HR/3gcmjn9PID4DP3QRuMvR1MdThZFSQqLZAs/wwXN8JFMucP2TE64Um9/jeWg14fFUSyGEVJB09kE2Nj3yAPhHH/6oUhhVfgK1Z6C8YfWi1dk4kt9vulSl2ZL1+/wACKWw7jIq9o54LzT8ZM5/pmvH5A3d2rgbXcz/CIhFjckg+xn4wEYmH5/NgMjj4lm63emQzjXgc7HrQwnVQiM1FtBvxRe/+hL9hBABoKRIoIa6lYXd5dmwdoUQ== 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=sXO8ScENoFKWHNVwNMhYTBjNx87409obryISg/lbAE8=; b=Jh8Zb/aJLZFg2dIpZofFJI4vYhA1UH8nVrIVFXksarJvpYlUVuC3JNlCeO64LdiC76XMkFOa9eFOQJT2O/7GjrzsHSfQWrfJxuK1dqg1OqkAN6Dj4z1NxZq0AP9/M68kkuJwBy+vUpbZReFO7VZ0fsVY94CXAXZ71c5e2f51fnIwOQYBSNw2SZeRFB7ao7V8KJ1a38i2eKacFYPEj44qBskcG88vgYMJHICRLtte26z0T7bpk5FeQxETf5M02Ucsevx5UrXtr3Kr8mKLgN0ALs9+8t8FOSHbEctyBvw3YRq0vXrRTvUS4KiEpwPVJImY99UKKMS2CJziLRPlgPtnhA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:01 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:01 +0000 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 04/21] parallels: Limit search in parallels_mark_used to the last marked claster Date: Thu, 28 Dec 2023 10:41:36 +0100 Message-Id: <20231228094153.370291-4-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: 76cb5399-76d9-4aa8-5e36-08dc07893de0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: skmKiNOCrSgrorQObA/Ez9ltc8/WWud//2zmKyP147Ch4x36rIdiFR0MEAhkz32vxAYyO0yFSoNCn7/qPK5VXZ/nVR7rd+RxUdXtIV567m/O49/5pqUZRqfHN8m8BShRQSeCZNuX4wyPtX9DNLz2btILQj5ZwNNhAAQMeOLpSlZEGR1ZXfuMqej6nRFgQLCJWhBe6VKuon1dyEH+r6xbhspYXW1w5SmUX1zKfoicH6ueABMUzLqAOe5sfprH0f28DZ9LOntLcBKyTHccpFtzFzMu5kiEmuTUFHa4y4LkPJNLZuI/3SGgA7C3kzupWROyMoXsExERM8dPHHgCn9kve2v37IeMBfuMYsVT1GATYEaAkf9vSaI75C/Mbd92tu9hS+yhlPWcpYqFKm2qw3eDXpg3Hka7mXMhsjIxDCFevaAvakhu9M6vcNy5Uq/lBAy5EaYxHBRIYDJhau95WueuGaFh6R/ls4GoHDHWMAm//hocCHzwj26mYfsjahSpNg7NzU8voPO0DOTl0YyDU4hzbVJmprmxln2ODO7He4CPWk5JbyUywjsaqfwvu4M84vQAkRHMyh0XlsRf+bfYReLSadutugZZw8/wUfzZ6tpJa3C6HFAffZIaDALb5iofX5ip X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Xj442kW5CENX59xqKc7oaCHTX5ghhK7HTIWxM5FETf76IjiATWcIs9Pt6B7tIYm1Lc5C2jduyZ5d6DQaF+NV73JiCSRMOty0e5dl3fp6va0f8IEbes438A8mnZ9dhIPvJ95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uWeeols50yEJtFKycJ8tDG4iONqqGc1LqTJ/RcWQFi+eyd1GAh0/o8lz9/Dwo/UyhEM2b5JJutqWd+E0ttkta7K2hdzNQlctZOd33hxO5Z8U3Ot9jtmC04kcGt+V3fxJqI+bpqOEBCGUO/ImtogqEp9FR/c1rnfYmdRS2onG1/C586MkB13xwNpYsacgUktfETElwe1zF1Hzs18hzNX+cVkg2cXDM43y7PIdoTM8lODzCyAxPQBjkjMAoJopoYIzew/KjH6T/xe1W8I3m9eVL0tdCAEkP/KN1p3SQxe+HM+Kgtq7EtCn4UJRfax94soxs+R4+MgoLiR3RDqYeOv6Ji8m42iUNQopdXXbF1tnb4+w54Yq0u8qiFCjtVNvle74SEgWMlOZTQyDIObskVOfPZYmqpAHg+J0dcK33CQqdCXEgA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 76cb5399-76d9-4aa8-5e36-08dc07893de0 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:01.0962 (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: qwPsotWPjEupbVhUkhD+E6dwVG4D16EIU67lSr+BBZF/eee5SjalDCGRCgGSpP+yiQ0sS/kuQMx5EMYnI8vi85WvuTCcUVMUUiPBt1lSc8E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org There is no necessity to search to the end of the bitmap. Limit the search area as cluster_index + count. Add cluster_end variable to avoid its calculation in a few places. Signed-off-by: Alexander Ivanov --- block/parallels.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index ae524f1820..4470519656 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -182,13 +182,14 @@ int parallels_mark_used(BlockDriverState *bs, unsigned long *bitmap, uint32_t bitmap_size, int64_t off, uint32_t count) { BDRVParallelsState *s = bs->opaque; - uint32_t cluster_index = host_cluster_index(s, off); + uint32_t cluster_end, cluster_index = host_cluster_index(s, off); unsigned long next_used; - if (cluster_index + count > bitmap_size) { + cluster_end = cluster_index + count; + if (cluster_end > bitmap_size) { return -E2BIG; } - next_used = find_next_bit(bitmap, bitmap_size, cluster_index); - if (next_used < cluster_index + count) { + next_used = find_next_bit(bitmap, cluster_end, cluster_index); + if (next_used < cluster_end) { return -EBUSY; } bitmap_set(bitmap, cluster_index, count); From patchwork Thu Dec 28 09:41:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505760 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 612B4C47073 for ; Thu, 28 Dec 2023 09:46:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImu6-0008Ad-Em; Thu, 28 Dec 2023 04:42:14 -0500 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 1rImu3-00089Y-Bl; Thu, 28 Dec 2023 04:42:11 -0500 Received: from mail-am6eur05on20700.outbound.protection.outlook.com ([2a01:111:f403:2612::700] helo=EUR05-AM6-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 1rImu1-0008HI-Lh; Thu, 28 Dec 2023 04:42:11 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d7PcElLhgEv4tKbFYzvD6O9xIB7t5Ro4HmdQlWoHsih0IUeocH6ry+zHIbRmAe+++hV/Bfvu+lwaSDI6HUGtJbWWZbhewCCUcFRC0f03cORAxC0O7DvB3ZlW4PMGykZ6LeUtkVVORSK32UcA1N04G6dlReZHXF168DlfjLtYnnk8wYrPnOG3vJ0r85UGRv8DcNV6FPBSxEH6XmytWrXoBoY+A4C/mqxyfeFhWGpmEXqJ3sA9HXz5xmykZiflPSpiuWuIG0YliWhAPF59dg8sOfQLqEu4o67nySyHr4IPsAksYbZmtqWLNsfgt03JyEGUggkiAVk+c/A11Tv4FpXZzA== 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=TiK8oZDz+rOtYNkEfWsCX0YcUHkmu5EZp+mPDs9p95Y=; b=fRlqOJmS1FbRBYQYl8M6bfNLefRqlX8DDSMGZOPCGezt5rg8/KmXbVI/cenCck5HoJ9REfFkhqVWF4Xo1/81AXxcPcrOXhaNLj8C33QTtliHRw53vWPRKFgpNfevsar5+w+h7XPQz9skjXQUezKRy1dFRhwYACbwJK+lBsBeApFbey/HmljN5d+9GbId2HHJLEERFJk+Fl00JuqOFEFQhey4ujWxtUSDoU9KaUtZGEHykKQka7HQeoA3pKiJisf+ZT/CFv1chmnDUpUwHcT6DFEBInU2AcQto23SAGMLW2TtIxlXMnb0JNHvHYbqL8nWWKsEFPwh0v5T1xYx1Ms/3w== 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=TiK8oZDz+rOtYNkEfWsCX0YcUHkmu5EZp+mPDs9p95Y=; b=qNBUUbQGUHm/eOsGgSTP/egmxTafBMtKjDgVlIi3gB8VCXSU3pMYweSikN7ch9zEmgNTq72pMRbzQposSEb4iaG1UL1ckRw4cs3/TqfucubG5QvIwMyy0xfZb6xwRa+m2kZYu/qqgtfmbEEcvJP0xSoMPcJd5f+5FDhY/PsTLpmdXxu+KMV/HeK3yPLnNiVNw7lTHmqkdALcfT3dmUd8GSfRrl8p2IvqGoLOwPk3MHa4fHlj8oX0BY7CWo/YgR8zv/YvXGVc2aLPBWKcyYnWU2TE8PuAlW+LEWP0S0jY4VFZIt+V3Qk2u30PS3LW+o/4Q0W4XHIu7vg5QOPNX/GDmQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:02 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:02 +0000 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 05/21] parallels: Add parallels_mark_unused() helper Date: Thu, 28 Dec 2023 10:41:37 +0100 Message-Id: <20231228094153.370291-5-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: 14df02fd-7ac8-4f53-34e4-08dc07893e17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 82LhbH59bWqqQE6s/HeIjliQu4glBsnezrR8UzAb7hm8wnLOsHwE0JmFMRxlVrGJIh530W60y8D7ccnlprjfSijbeubvxftDQWtEmu2ie44aO/yGX6GtXGZ7vHLie8M0yI6ecztRoTTsTrPKn65fKH2e6Ml0BcF6o6kl4LdYVMFf2jglnuN+NxLQOpEepWGopMz3L/5xzznZmirwk6XZgesC14Jbc4uBbUk6aWkLnAss0MVVhByLBYjsM4q8ZA0avf/0esN5uYtIbWkVwclehwxxpsjB+MwvVEpvbP33MJB6F2edCZrwSBHzRzi8/o+Vm0G0OSG5FRoQiDTV2Eejpx5fBUvq121rd8C548wEvY0UZ9BXDACw+viT9kVDEM0hilIJtAQfjH60hBHjsQAY9H7iDq2ZoiQDG0RT7mYgzpn7LX9UeMpxZawnV7e18d3CuWgd2CdtP710AiBB2SoKgZ2nT6h2jh/0SEHjTJD5Bi2LZ4rzcNKYtFV3n4YShUBYM7rdLAiUAjpzpCp1tdABejIhQhvTLHGv1wFKGsaUN7dKTmpFJUp+C+0nIXtldbgQubaj3xSGCBXKIIbNvcAWylm1gH0MCaJegn1bWwlP7/6MUyHWFIhekpPztqTYiFy1 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9jtAKYfPe9udfaDF0/0yw6FD0pxKjnnldBusEJIXBMkfVJGV70p+aZbaQuC5RGUiUV7ueR6U3vckfRPHe4gycMhUeHJUMvsKT/4AqYVkXCr7cOX1cWuCqrHpeL0ByJECWQiN8rJWh8EdA4yhBK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s6XaqZmvgjEl4vRft6SS9fHj18/NMFYcibVQLDPTXhjblksB90sT9ScnRRBsoubjF14yLYuo4sCkV3dDTEjHrQf2RcYD1N6yPB2VyCFyAHiMRPWWCjkwzNOislEiowiiWkZR6Ft3IVjMX0L0pyaJ/FXqrjWFQMGb4gU1O3YpQgf+wtCHWjQlA+N6lNVlFrY2OVDaAIweRHrLr2Ilw/jN/hhr5AJtmBKYRK+cpXZ9xi+9ZWhE5CD+8I6MBt/hunQ/MBFguYR1AH4E8Zr8pE2qooJbpWlTmUZWXEC+NiQq04P9MVnof+05xfn/m3G8bcm4dIULJCliIyY6uDYkIB9nTQfdT9oHky7bTAeAl5v0jSxJEf4uErpOHa0uy2MQeaKwz6kEiCQfaiM/A+S0x+ymwJVkEN7fVM66hmt/2p9k= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14df02fd-7ac8-4f53-34e4-08dc07893e17 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:01.4553 (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: NlMCrmfClnyvKhRjQr9kZ6IEL/hsl0FMna66PYyjyMlPE0MWKP7gtLdeUOSTdvh7QujibLRIQN39UhLvoW6hdG/RSumgKZbZ3zajON/dTYE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add a helper to set unused areas in the used bitmap. Signed-off-by: Alexander Ivanov --- block/parallels.c | 18 ++++++++++++++++++ block/parallels.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index 4470519656..13726fb3d5 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -196,6 +196,24 @@ int parallels_mark_used(BlockDriverState *bs, unsigned long *bitmap, return 0; } +int parallels_mark_unused(BlockDriverState *bs, unsigned long *bitmap, + uint32_t bitmap_size, int64_t off, uint32_t count) +{ + BDRVParallelsState *s = bs->opaque; + uint32_t cluster_end, cluster_index = host_cluster_index(s, off); + unsigned long next_unused; + cluster_end = cluster_index + count; + if (cluster_end > bitmap_size) { + return -E2BIG; + } + next_unused = find_next_zero_bit(bitmap, cluster_end, cluster_index); + if (next_unused < cluster_end) { + 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 diff --git a/block/parallels.h b/block/parallels.h index 68077416b1..02b857b4a4 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -92,6 +92,8 @@ typedef struct BDRVParallelsState { 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 count); int GRAPH_RDLOCK parallels_read_format_extension(BlockDriverState *bs, int64_t ext_off, From patchwork Thu Dec 28 09:41:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5EA47C47073 for ; Thu, 28 Dec 2023 09:43:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImu9-0008Bg-81; Thu, 28 Dec 2023 04:42:17 -0500 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 1rImu5-0008AJ-2H; Thu, 28 Dec 2023 04:42:14 -0500 Received: from mail-am6eur05on20701.outbound.protection.outlook.com ([2a01:111:f403:2612::701] helo=EUR05-AM6-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 1rImu2-0008Gn-DX; Thu, 28 Dec 2023 04:42:12 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UEtS5QGxsb9EyKv1IFkSoTNxTK4qOy50ITojo+DK3cWf7JhfhcSNzx07nrKj2ddz+kdCuy/xJ2jtbYEf+s89QP7x1fUCIMhw0BtvUE0/bG4pRN0c6sUezb/FSa3QsD13YQHEwmF485ozInzlIBY4WzP69I3V4uunxmjPm2ISEqndtB35AerwY2DJMhQdxR5ghpP4qrT7EQyEbKKeFx+bJneQijT9xi6ZnA+Anr8IGtU2DYQqqiZs2q4QA65uBlxUKZHL547EfjUDBZGPpCQWF2XD3tLfxjUrDfQ/5PCFA+p7WPCfkfjk8G4u4NdwzqtUx89GLV0n3dwVWEzxDxTMZg== 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=MLEBTAXP1y3bSSPP0h3JqoKN2wlm3/jxIfexYA7pjcc=; b=NMK0FSfQwQErgXcTZP6CdcerEnU2gOpZs/Lp5jJGQWsk9wF/XPJLPOXT7Y3UadO1x9el8MEZZl3USuNt0z4xo6wT+0unk7KnUPF51CoXtWGdjJPF3LXuUh3ActO5p/38Ou+ETIacBT42CjZUYp4EyToa+vDP+utyNcIgT5ShQ5snGYuCkoKDp7bLCEx3w2lUk/1ySYGcsLRujue+MXUx/c9ZM3zl1x7UFFqVxgapScr5N1wXPjhke5sIbFMEjcFXSLjOpLz4Psl+F4IPqg+9DJP4JnkVxFFKUWNz30DjdcNFtwsFrzaBoEFfqJmYFQRu12Kf+pv90lng1qeW0AahiA== 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=MLEBTAXP1y3bSSPP0h3JqoKN2wlm3/jxIfexYA7pjcc=; b=0SqEaj4M0vejGDYRjq6vpw4zYXqWllN86QwR3PPHThIMB+cOA6ntSqczEW8isRBVSx4w7JD5JFzDkphppBCWFaBRdRQo3G8qe82fWwpg8FfR0QBB6aMm1400ObkYS84TFx3Dd4ahX1EpSP7tfG8msyRSCmK6vB8+MyrhSila+kUqeNQLiYVE67e14giNrC/uQyUA9KKNsVrwEepD5AEQPKPwYdKzbbHuwrQOIq3lfDAAB3WqD/JYYU7IAd13o1iYEZH33v2ZapJHDMPOasT97fUn2LZfCHz57EjBLDlD9aZefK1kDQvl77nkGkbCOWx9fWgugT0/aH4KzLiD6M3ZHg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:02 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:02 +0000 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 06/21] parallels: Move host clusters allocation to a separate function Date: Thu, 28 Dec 2023 10:41:38 +0100 Message-Id: <20231228094153.370291-6-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: c964d0dc-aa16-46d5-6ddf-08dc07893e50 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kpYSYGYPfJ4XG2gR1ECEvZ7JYgVaB5XWfGfnZzz3InU1gENLKTXvoT2PVzdXx+W+SR+AzvwbvxT1S9KpKqy6hOMIP9iAPzteWDRtXJrKcPsgdDb6hnw0KOLifiLkdOO33dageiXRnldxOvgha5A9DXDYAkPRKe1kfmjXwSouR/surs7eRojjBtJ5964FtRGx58eNHOLipar2LnMmh5BFSfnEYC3Q64aJjfuH1zZzb09F47JGqkXyEeGhA5h9KFPskH8gU5wQfwIR2G7tDuZlY49hRVu+/slJwcGJ+wRigqewQ7HB6Zw5vW5/JbhhAYqtNdhvQwt5x5zZBJqXdBE5ga2mvVOy6SgE+jUOde2YBmK26tgH6kfgeZlq13y+oDfnCMNk8cvHdPmWddcH0D17nqyqLOboS1lcKoi7qTfvDE7d2NttrJERUD8Y1eKEt07Ze2OxyEXRzwzpTrtnwsl79IfxyM/LoqQEZX1eAvb5EniBUM5ixd30S2GCvptLycDbTdx6TOKteNml+kr3ifBL+7bkPwQjBAoe9Idz6P17UvlF48iPQLIcu1Qcb4Lpy6b768HM3544gMYQt+lK6GVReKaELJWSrVxpPaBLcB3ymHaVWrL5eApha6nTridRFUjm X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0ywl2zFK3ql3c4H159bp46zePsh0v53ddrMgM8biP8EivqToTuhL1xpEaMpoZFYxuMp6xmcl8LPJYmuJaZQvLTOyyltlqqJRIU9ipQ48qn7ReWI5VQZfs8t1TQUluq/QCEvQSKIq7jBxziqbjUQ425t8vRXf3JkFp4q55k4SU/3EoleleMifVgj6nPPIb/Z/QjkSXh9gGaK6kPajV5hHpBgM/RnkCHyn6Wk38E9PyiuEVA3nRtCvs2ySUixAHJvguMZm0grO9dlZw+CU8lU1gwzbj7H9zpDl+oUUD47qtKkjRnTFyHPyA10366MnpTVZpAfds53obQhyvfuqDKgHzkH473uY5AtQkxfmjQ0TXwDVnLV7Rwoxsogv72qhLARsw+5WzBzy4+UKCC0ybrRS5np1hBCRxiAI7Q2bi9ZJPaXry1dX+JhfWiDwySswJpXUavEIBoJDeG711y0rMQdctDp24pf9p5Ud6o6EsVmAtHXsk6VpRZLwYyPNyVPU1S1rmf0hQoxO+U5jiXIY7gh0qzxzHGOBkN2IWJILw34C58Rzh0v4w5OdRi1rjKNPBl13y85P4zgVjHCd4p8zweSJPYPvgwNaR7lb2VM4EBiCX0pMYUjD7kwqZ7nUAqo2YU6fNCfeAaID+HiA54kp4lNatr+cQ6C1sr2YYhji2rOnSp1TjBheZwp67YLFIu9otrUjAzo15lr/BA9TIGeAqGg05QQ49V96O2Nwj0zltazY5kSuioVdTKGzBr7wd7/Y9GXqAwl48GPdt76rzDuiYTZI8puGE5wJrC+1j2SOnqUSow1ji3NyaxAvoI6yS8VsvZkkS40+51YrpYUep+2tZ0ndbFNhc98SOtbJD3FFep6dSsBL/P4CA6y/ABIEfjLrHUPvra83CGp8+XUJax4qkq8kX4J3W/64MMqqcA4XGsqP3dELsvK15rNWZoBwpUb44iTvR9AexPeEcEc2Bj+hrPuN24ELaPpMY1RHlLnWpJiIBioFoeRc6vS80dFdouI5U4qm7Y8qJHhvjwlUXxs5SioUAAIZ+lc26DFCQi/tbn8aipdzh6+csycYPiq06VTQ+455kPjvkbK2Abag3BBC0Hwkaz48FXRGPJ7FtIQLaW0fkt8x4ur8jfas9SdLFl8vf02wJZE4X05SB6ryekldYhSeqGbOkRSVLUm3nk3SucKrNNW8nZASIS2Id8HAhCgFeiRJ/rUL8AonEIH7OkbXRX2OoNQu9spTlwT4hpg37yI1ny5SSVVm3avZppN03SCvcrjKcrxyrtx5v7tfIqxXKgTv2mg+8NgKY6pho7bdCH1vVgmwzck/dK3cNdh20bmnqngaR675TrH8WOuIjbqEgU5+KaiR04CJh1ZSEhqaDqMMQACW6WSCXY9vEGDCeFWe7OI2qIvXXfBmIdZNwYOzW69tqrtcRbq0QmgIQZSEEegrUpQnsE9mGNuT7UzeA+ZGdQZDWjMDJp9yIl5+JAunXkleb08W6+S3iX9Y8V2ShcufbQynxZHKk8PGIL1yz1qZVym7AP/iJiaVq81wez+kKzvQQac60rxKMO7LsZaeysEMvenDFXpjIc86tUILnUYwhXbB/4rT039I2REwDbNWP34uit3W+baWHZTJLkoVIn81Pw8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c964d0dc-aa16-46d5-6ddf-08dc07893e50 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:01.8279 (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: onL72W+FalrFTj+B4/2Uci2UN56aKa2YPHpo6ehNg3H9caN4+NOHlckRp/7rGxMtSvsK5nCyLP5rYm0F7BdctITSJ10Wv7/jblauTJbZdE0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org For parallels images extensions we need to allocate host clusters without any connection to BAT. Move host clusters allocation code to parallels_allocate_host_clusters(). This function can be called not only from coroutines so all the *_co_* functions were replaced by corresponding wrappers. Signed-off-by: Alexander Ivanov --- block/parallels.c | 128 ++++++++++++++++++++++++---------------------- block/parallels.h | 3 ++ 2 files changed, 71 insertions(+), 60 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 13726fb3d5..658902ae51 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -268,58 +268,31 @@ static void parallels_free_used_bitmap(BlockDriverState *bs) s->used_bmap = NULL; } -static int64_t coroutine_fn GRAPH_RDLOCK -allocate_clusters(BlockDriverState *bs, int64_t sector_num, - int nb_sectors, int *pnum) +int64_t GRAPH_RDLOCK parallels_allocate_host_clusters(BlockDriverState *bs, + int64_t *clusters) { - int ret = 0; BDRVParallelsState *s = bs->opaque; - int64_t i, pos, idx, to_allocate, first_free, host_off; - - pos = block_status(s, sector_num, nb_sectors, pnum); - if (pos > 0) { - return pos; - } - - idx = sector_num / s->tracks; - to_allocate = DIV_ROUND_UP(sector_num + *pnum, s->tracks) - idx; - - /* - * This function is called only by parallels_co_writev(), which will never - * pass a sector_num at or beyond the end of the image (because the block - * 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_allocate - * will always fit into a uint32_t. - */ - assert(idx < s->bat_size && idx + to_allocate <= s->bat_size); + int64_t first_free, next_used, host_off, prealloc_clusters; + int64_t bytes, prealloc_bytes; + uint32_t new_usedsize; + int ret = 0; first_free = find_first_zero_bit(s->used_bmap, s->used_bmap_size); if (first_free == s->used_bmap_size) { - uint32_t new_usedsize; - int64_t bytes = to_allocate * s->cluster_size; - bytes += s->prealloc_size * BDRV_SECTOR_SIZE; - host_off = s->data_end * BDRV_SECTOR_SIZE; + prealloc_clusters = *clusters + s->prealloc_size / s->tracks; + bytes = *clusters * s->cluster_size; + prealloc_bytes = prealloc_clusters * s->cluster_size; - /* - * 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 == PRL_PREALLOC_MODE_TRUNCATE) { - ret = bdrv_co_truncate(bs->file, host_off + bytes, - false, PREALLOC_MODE_OFF, - BDRV_REQ_ZERO_WRITE, NULL); + ret = bdrv_truncate(bs->file, host_off + prealloc_bytes, false, + PREALLOC_MODE_OFF, BDRV_REQ_ZERO_WRITE, NULL); if (ret == -ENOTSUP) { s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE; } } if (s->prealloc_mode == PRL_PREALLOC_MODE_FALLOCATE) { - ret = bdrv_co_pwrite_zeroes(bs->file, host_off, bytes, 0); + ret = bdrv_pwrite_zeroes(bs->file, host_off, prealloc_bytes, 0); } if (ret < 0) { return ret; @@ -329,15 +302,15 @@ allocate_clusters(BlockDriverState *bs, int64_t sector_num, s->used_bmap = bitmap_zero_extend(s->used_bmap, s->used_bmap_size, new_usedsize); s->used_bmap_size = new_usedsize; + if (host_off + bytes > s->data_end * BDRV_SECTOR_SIZE) { + s->data_end = (host_off + bytes) / BDRV_SECTOR_SIZE; + } } else { - int64_t next_used; next_used = find_next_bit(s->used_bmap, s->used_bmap_size, first_free); /* Not enough continuous clusters in the middle, adjust the size */ - if (next_used - first_free < to_allocate) { - to_allocate = next_used - first_free; - *pnum = (idx + to_allocate) * s->tracks - sector_num; - } + *clusters = MIN(*clusters, next_used - first_free); + bytes = *clusters * s->cluster_size; host_off = s->data_start * BDRV_SECTOR_SIZE; host_off += first_free * s->cluster_size; @@ -349,14 +322,59 @@ allocate_clusters(BlockDriverState *bs, int64_t sector_num, */ if (s->prealloc_mode == PRL_PREALLOC_MODE_FALLOCATE && host_off < s->data_end * BDRV_SECTOR_SIZE) { - ret = bdrv_co_pwrite_zeroes(bs->file, host_off, - s->cluster_size * to_allocate, 0); + ret = bdrv_pwrite_zeroes(bs->file, host_off, bytes, 0); if (ret < 0) { return ret; } } } + ret = parallels_mark_used(bs, s->used_bmap, s->used_bmap_size, + host_off, *clusters); + 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 = 0; + BDRVParallelsState *s = bs->opaque; + int64_t i, pos, idx, to_allocate, host_off; + + pos = block_status(s, sector_num, nb_sectors, pnum); + if (pos > 0) { + return pos; + } + + idx = sector_num / s->tracks; + to_allocate = DIV_ROUND_UP(sector_num + *pnum, s->tracks) - idx; + + /* + * This function is called only by parallels_co_writev(), which will never + * pass a sector_num at or beyond the end of the image (because the block + * 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_allocate + * will always fit into a uint32_t. + */ + assert(idx < s->bat_size && idx + to_allocate <= s->bat_size); + + host_off = parallels_allocate_host_clusters(bs, &to_allocate); + if (host_off < 0) { + return host_off; + } + + *pnum = 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 @@ -373,33 +391,23 @@ allocate_clusters(BlockDriverState *bs, int64_t sector_num, ret = bdrv_co_pread(bs->backing, idx * s->tracks * BDRV_SECTOR_SIZE, nb_cow_bytes, buf, 0); - if (ret < 0) { - qemu_vfree(buf); - return ret; + if (ret == 0) { + ret = bdrv_co_pwrite(bs->file, host_off, nb_cow_bytes, buf, 0); } - ret = bdrv_co_pwrite(bs->file, s->data_end * BDRV_SECTOR_SIZE, - nb_cow_bytes, buf, 0); qemu_vfree(buf); if (ret < 0) { + parallels_mark_unused(bs, s->used_bmap, s->used_bmap_size, + host_off, to_allocate); return ret; } } - ret = parallels_mark_used(bs, s->used_bmap, s->used_bmap_size, - host_off, to_allocate); - if (ret < 0) { - /* Image consistency is broken. Alarm! */ - return ret; - } for (i = 0; i < to_allocate; i++) { parallels_set_bat_entry(s, idx + i, host_off / BDRV_SECTOR_SIZE / s->off_multiplier); host_off += s->cluster_size; } - if (host_off > s->data_end * BDRV_SECTOR_SIZE) { - s->data_end = host_off / BDRV_SECTOR_SIZE; - } return bat2sect(s, idx) + sector_num % s->tracks; } diff --git a/block/parallels.h b/block/parallels.h index 02b857b4a4..493c89e976 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -95,6 +95,9 @@ int parallels_mark_used(BlockDriverState *bs, unsigned long *bitmap, int parallels_mark_unused(BlockDriverState *bs, unsigned long *bitmap, uint32_t bitmap_size, int64_t off, uint32_t count); +int64_t GRAPH_RDLOCK parallels_allocate_host_clusters(BlockDriverState *bs, + int64_t *clusters); + int GRAPH_RDLOCK parallels_read_format_extension(BlockDriverState *bs, int64_t ext_off, Error **errp); From patchwork Thu Dec 28 09:41:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505754 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D23A5C3DA6E for ; Thu, 28 Dec 2023 09:44:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuI-0008FN-33; Thu, 28 Dec 2023 04:42:26 -0500 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 1rImu6-0008Az-Jv; Thu, 28 Dec 2023 04:42:14 -0500 Received: from mail-am6eur05on20700.outbound.protection.outlook.com ([2a01:111:f403:2612::700] helo=EUR05-AM6-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 1rImu4-0008HI-05; Thu, 28 Dec 2023 04:42:14 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LIWZ7kJLUzelUzJsKjt2qM3fchxDJpDmwiPbv6g0NNR8Lnj45a0+QZvQb2etpE1orIUGEj6VeDzptRqIAdFMpRxh4fRTPy8aVT73ObocIwQiTc/U9lLfJEXzriAALbBtRx0i/uUSeGYCB/lC7Eiqma4/NNd/D9QUBpBa+fwghloUkFzpvjQ3rCOfGmIe/Ucnq8TaML+Fmi60lEWnsW6d56+LpsBP6DjYxdSugnwAsxVGI1bwK/kig9LqumFGqTPGx4zBYyoF8+bp0qZnZUVdS4UgrD5NP9XqQInrrx4TTtejNNmaweXBSadUxpPAL1GFCcImYN36bAQ8ZOfgf8qtrQ== 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=+N2JwpCNxcAlatSCQUrsyN56yKpu3V05h+Yb8Q3o20U=; b=hF8vkuDyBHaCbT4ZyZHmLx8aEaCUCWwOPv+pJXxcHpt82qQIKORV2pVWbbOFQnsHT4Yis/I+wmnxw4k0KtMzW0Hc3Eqt53XUR2/mliRdXzlG8z1VYs2sKA3veRF1S5iApf1WtiM5Nhjds/KjCDgzvpQ8E18WwStcTWrCyw3v0EU46sXSRWUq9cwCmYcvg9fUhBMIa+OSHsCBSVrOzfvgLCQIms77etLAt1Ct1dRqI6lJHG0CdFsGv65MJWL4QkxjmqymYdtr5xg2e7ZQ+ZfXQDHu7mEN5qkXvVCWXkfaoo2y28VPSFV5RK9WxB+TkSrREaiurhRLI2ONaynYqv/aPg== 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=+N2JwpCNxcAlatSCQUrsyN56yKpu3V05h+Yb8Q3o20U=; b=LcMnk0A7Y4Rg5KNAy6ql7AzqU6KdXQln+WM8S7W9qWSpWjakgBFtTngQjKQO73g3QRIkJQXwCOWLwz+n9W08wuJIm1DZ8iGSlbUvav8QCjFcyZnO97yr/xK3PxVH076TrQe7Qk3CH/H1UPkO9V7G+vaYyyE9QNKCMtwRkYRW2JB98aaEQ+zgfCg5yf+dtbArOfllO3Qk30wCPJHChzLXEN8FPag0C/lUvAF53cMMJ0APTjdz2JBZySH1Ta4GvS6YHj3OY0CJwkJqBTNkHsi16qXB64I3IxInVZxdSjPl1jg5DlYyQ7vOcCakIyDeOrxPPQd+f5D8atUpGxXmBTnuHA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:03 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:02 +0000 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 07/21] parallels: Set data_end value in parallels_check_leak() Date: Thu, 28 Dec 2023 10:41:39 +0100 Message-Id: <20231228094153.370291-7-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: 548142f8-7c00-4701-6c1f-08dc07893e8e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZwJwAcepU85mGStiHgOpt2fMyRrvvcjp3bQWlH625Auf836BRsNXWOmT6Y9WipNpwnY/BDEmjXnbAGCFDNgub6t7H7aLq0uTcjREpJWa3rH7ZK/W7dj5kHajg19LZbLhQWwbL7RwU70RL6s+RRirS/IrqAm4SqUssYda4IHI8eseQGomYoeoS5myb2/1Dn10cCfurjNCnhywNmqTZIK1m+p+DWa547sunTbOUzXaUh1YlWIRJ9trPK+gUQM5gNF9Kkw8ihafHhBqOFEICfKAwehA9/enhXZN32/ZLHE7mWOYhT7le6Pk+rwJYROOpA1MSeLO8KDTj75SiLvsD7kyta5x+oBKb42Oq6nlYOTsCtQq4UlgiBi5O+JfnFSgeyO+QggMWbNdjp6+rLtYgspive+ddEgePOeyPkim2nYNkx6TiyJIiQ3BiFevfUVdC7xVhMnBdNeqW6Mq0iS186V0hg1Id/ogU/uBcd5h348pG7i/bmEF5rkXCIBPWwo4Lzjn8dquWZhGXNg3FjOmzhEw3qOTkHbDn1LVL+mhVGJ1Uba/RUQFDm5/fTklhCAc635FoZf9L0e1gUU9hUXmPa1XbsUHGr9q5npEj3WjplXK4hLXc35yXi//CcGlnFXAdbf2 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(4744005)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362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U5JpxrUakAs6xmywjZdNHTIKMQ0fbRRLJmush4fdPf6BcTObhUo5PrFIDM5zaK4ltqu+4OmmNRrtjudmZESJD9mmQCofcjLBHv+5d5YUGaH3FUKxf4MedzKtzqwWtiIVn1h4BU+q3H2Awb7tc6FuQB8WxV9GUWHDAn+LsDT4lyFlHCWmJ87IMTY6t66BCTTv6NqH4ewbGfBhEBvLZ5lGKADTsK4OuNq5JS+5yMgpdFL//pdb/p8oCVhs9PpdXvQgicssKObG9tq2Bax2w4XyVGtUetTNpYlsD/NZ5E7KDZSAViJu+2k8dnPlZXkYbxPS4F6ZjDKzMh41M8U03NQMl3AjSuwvHLW3L5GzPNK/foKoaw6TqcxgvMZuBG4sDjm/yuZSVzwmYOECDq0s9chgfAVu5XDFGGTOKVa+nyC9WsQZpnW/ZtAIFYhkVqpY01kFn2WUlNSBQNZ7Z3sJhI5uiDoGv8xB6PAvl9aNc5eo4zqtg90fSq+swRmQO3c2hs3eZdgHmLZPXSIw2V8WC21sR7IjF9laKJgaglXJUXT0VIq3/CEhOu0czeMhEeEE8WC+Q8/Pl7iTJ3ksk/NEUK5dNUgDZ456lT1ChjI4nhGl14oscLghRjruzCBTWAp+wRbYkkcc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 548142f8-7c00-4701-6c1f-08dc07893e8e X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:02.3497 (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: 41AFi0ZeRwx3OEM/raABeOcyN3F6jUD6rdVOsgCUANlY8/xllUDUuHPDTne+Df34KSXiNqqZ846BRpwNNdZWnvixw3E2CTl1TgU5ynzquwM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 658902ae51..8a6e2ba7ee 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -806,6 +806,7 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res, res->check_errors++; return ret; } + s->data_end = res->image_end_offset >> BDRV_SECTOR_BITS; if (explicit) { res->leaks_fixed += count; } From patchwork Thu Dec 28 09:41:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505750 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 732EFC47073 for ; Thu, 28 Dec 2023 09:44:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuJ-0008I5-RU; Thu, 28 Dec 2023 04:42:27 -0500 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 1rImu9-0008CG-D6; Thu, 28 Dec 2023 04:42:17 -0500 Received: from mail-am6eur05on20700.outbound.protection.outlook.com ([2a01:111:f403:2612::700] helo=EUR05-AM6-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 1rImu6-0008Jv-Ql; Thu, 28 Dec 2023 04:42:16 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J2IfrwM996OhOpIsc1uWj1D12+oEU9J4gpil5/kVUrSeyoNrMIAPpK/uUAgZ8yZ0UY9sRmPfWGqUt+npqOYTnt4yrKvle18ZmEfJjlafsJNiFYr6vNacwiQkXN9ldjh8MRMm0UD+o/WeHo0gtEIayyae2n3yW5tBpwpIQKEeYANtg+kzAHr0G3NpEXL+dexO1j00cy/MmUw8m6SxzVH2S+/jtVYk/wLK5Bx0Xe4NBw9rxdtJgPNI6GaAepTgQOZUEd7XxmtEIXxLO9lxdGMK//oXFaYgbfDd7Eb5IfHAPLOnbdPCO9Y7e4Asg6v41QcrLDTM4U7f0FVWk/ooyQsW6w== 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=q3dDAqfScSQKpORpASGRpyoVYYLjILjPhIDAhREH9GE=; b=l8QBWtqtVqmNjrEv+3zLHy1eci8slMrz6t1e2oigpODtA8BDTEHonIDjOtw46rKG2Aoz0WOinJSuZju5XqBpXqFl+/I85mGfhf3zxW1bBpEP/UinyczcjBgb1LKoBNlCUmO4kH3PrYp8H/zrmiDxBxRYjstAr6Pb/NukyRX3T9Wbp1ERuVPweGECE1+dCiTlj6oScCcA4CLhbYtRLpgDQRNup2EKAOVP3+UF9dgOJWaPtRjPqOT2xOFxHEBZFMqLo5ZsF5HAc4Mqu4fRGAjD+TczMOVrb4JKc5+XWBN0/aPBZyDHo7AAgcWAHnaJPZU20zSidYYKyLgTr4NjWLv88w== 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=q3dDAqfScSQKpORpASGRpyoVYYLjILjPhIDAhREH9GE=; b=i9B4H3Y9aYT6E5KrnMdZqgKn8T3RlaTWLJw88PVCblSkCNL79F7BwtPVUYTGlUesLqrROe+swU7kFMETdDJ8tIAEOW8K0isdJHDn0o64MfQywM/4SMntvyt/coY0c/8HvM2Pg8yBXSI4X0bxjgF+H8mEgsxCWFcW+RB/WAiSFwil38kKFCTZWpnq/1fdYSqeHJeMljk0qc5V804v/IXdxIO+6Pt7vWcjyv2Lv19qbCXrNfQw9KTk9M6Tw4SkpzgfbkM3yKi5r339Eyz4ZtxGFt8OiF91oRDFmTgRMi+7yBVwsZ1hAVdR0YBBMSqnqD/7yLD5tdXVeeaxf98JNcdHLg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:03 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:03 +0000 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 08/21] parallels: Recreate used bitmap in parallels_check_leak() Date: Thu, 28 Dec 2023 10:41:40 +0100 Message-Id: <20231228094153.370291-8-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: 9aede8ba-c28a-403b-412f-08dc07893ee4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /ommW8YQSY8huPSWwqyP3UW3Rb9afeuoPQdcRg3X16WRr/zMBfHGLjqvfJNs6K+3HOHQIdUl0lOcjtpvUYtOQWLydoJdCJ3IgXjCbnCo19hNSV5JUSStWPdUBlVFUk7kfiQRbu3qKUCeZVwDxrcZ0rH2PAhNnGL3wQoxtaPtkHS8ev7M3UWM5tIcf+/eph/bgPELCYoAwV3aYCFcKQqWnRQWogPee+PQUiB2aGfLzpom+NppypnDEByMJlYjXKYcemCmXzsTRTWoSN+JF0pDycu8ZebkW+IG3ATxFQ63w41LHM6NYeKvTk8Y0YbkFvNvtIYZC+b5XSAqDfV/B5D/3eXLH9mbb/g2/MYWWQVzux83xqOpF72mgvHmWViCt+KD912ZQZp5pqepCORYt5VSXIvn2h924m2l547LYpgXv/oF6Oa8psvWUpWjko9Z/T49AWxvq1s5b9S0w4k4NvmBJsyf/S21kt6CZzVAszCAkFe9goo/PkKlvuWymZVlofeASGac2CBI9sRLvFF3Sj4hKi+1Ba8A2APhxsdutwf59XHeucFna3DGp97foEmbbw9PcWSwhUTfv3AUJHjGrbvJyZdtFvN26tnTp/Ep9QROEfQQ/P0ObuP95LRH81RgLl15 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(4744005)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jMc9xdb9f4u7hTjaA6ABSD3VQikjpt5TXPurkmEqXnfrGqpiKI+nfgE0+a7NTsio+iDP7Q+vUPoEjZ+Yg69a76lnsK4MCA7IJu/3gvuOHCLy7M2S6EQNEezjlBLWV8zJhs/ttgkWmUV5BloVy2GqrRPza92tSljJQEpqNGx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Y6oyLaYNPU023ia0LkA0twAAPhDTHE2YNoO25UZhaz7trM7MJvo4pZp+wcN+vac0qAzHA9QJGSq4OfhRcFJnGjLlWr1b8eC/USUay9ngbLp50Egrm6mq3dENCRgM0P4y0Ie7KkpIXq8tJTUtRCrZWIwJ2XSVqvagT+MBTjGXPtT3EHb9BVik4HJN39N8dTPhw2R6wRhLqhhaqqbnhr3otVsu8mZza6PnfLYkTPSDyv6vhTJPnsydnvcvuqevR7+QmsVl4AyHB5OaT4u4NCvCY7S3pA4eIjN0vHiOqFdHcu4TcAU812r6ruxJc4AxRMU2wKEMJeeJ4gJWPtGmpntrEN1zoYwJfnnkpBoNLu+c0IK/6vn10LSzrCPvKFtbPfAun0n6g2Nb3dI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9aede8ba-c28a-403b-412f-08dc07893ee4 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:02.8003 (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: gpWg7gcb+w3HwRTRKDNIBFPtG40KPksfKEPBia1JB2XR1tzUO3lBBaetrHHwoQOYBxnRcDISzTcdoqDDMwpBg6rtw5JZCGVshCYbn4/TRKw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 8a6e2ba7ee..04c114f696 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -807,6 +807,14 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res, return ret; } s->data_end = res->image_end_offset >> BDRV_SECTOR_BITS; + + parallels_free_used_bitmap(bs); + ret = parallels_fill_used_bitmap(bs); + if (ret == -ENOMEM) { + res->check_errors++; + return ret; + } + if (explicit) { res->leaks_fixed += count; } From patchwork Thu Dec 28 09:41:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29807C4706F for ; Thu, 28 Dec 2023 09:44:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuA-0008Ca-MB; Thu, 28 Dec 2023 04:42:18 -0500 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 1rImu7-0008BC-Jx; Thu, 28 Dec 2023 04:42:16 -0500 Received: from mail-am6eur05on20701.outbound.protection.outlook.com ([2a01:111:f403:2612::701] helo=EUR05-AM6-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 1rImu6-0008Gn-6d; Thu, 28 Dec 2023 04:42:15 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D7BwzpXDGtbPmP/ERayZ5GT60o1IGXF4OdarvLOum470E7oMHJDdascuy9sno94gRNnLNvKz41SlbAWC7JY5P98vcoJ1eXTPB6yuTOVdZdJ3P9ndqHGF9ApkTG3dXjouZ6vdqEwHIeBGBOLUZBsA8ALL2djrNRqU3uyKuh1WFQuz7iQZGLXz6xpQY9f2VV81Ar0Lh8M0IRa32sbZj/oUXQIL0zoyy/IB83pehbW43Wsl72gI23CDqIBwaRIsTQpAWc3Omjv4SNaAN5s+UGr4U9Z45lwnmF0Pbad5HUSNZDG1OJHB2/W8lj+8BgtEo6KQ4R+zTmonhQ00ZEmnlkHX6g== 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=6MTFvJZaRYxijrcCiOR6/WdsYJiwbnhEJy5neS3DPRI=; b=cIxtHcy8e5xyg3Eg/avhybpwD2u5KpHjDEwEWCIbSnMyoz8ZpCwaN9Pg2OJ67hNrs73Fq7m0u9BB07U6qM+9mMGIki6j5j7qko/A2XQIedf4qS+Po19jYDt5CKiQN1CDgheSFC7AW0wyqV3YH1MGjTMiuLywahv73RCzq5FGBOUvpQUIEmOIBeZG2OecBNc2W4plC2kW1dyE7DJH3gYZLyMrIDw0q5dDURZ/EAl0gh7kExoYOwygn/xY2lLYSuxDwOW0wPDAzVxUDkmkzX5EWPMfDOx3KH6e3FaumpZu8PK4+AUucO2Ft6ihC+cEiYQgo2BbnX01eKAi7RPjvr4PUg== 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=6MTFvJZaRYxijrcCiOR6/WdsYJiwbnhEJy5neS3DPRI=; b=JmqQZQ8PD+TnHT/f/WfRODDELtwlUpdcRla9oCyHR39BLDdHVOKe41GtvEWY7n4RNsCR/gUwX5rQzdGyhyc+FqFZerRYDx1ikrN6tCDjGTUrO7GzI6KlHLxzAWbEMwaR1MCS45rgP8xWkVwTwdXW3W0xJXKx6THP3CPnPd5FE7IvKr2UCiJ756JqryslfHoioON5ee2e7bRQWrjs30Iv0/w7VmcYfxBAiXoQpcsb26ySauVExnItjK8hxwfTRThpHS/QlLuYXzPncdj2kWeRYx7106OJw+RTK/qfIGla7icC6AzdSQ0MyMxcTO5xhIi8M/gJx6fSee1qmmiVxEfLag== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:03 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:03 +0000 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 09/21] parallels: Add a note about used bitmap in parallels_check_duplicate() Date: Thu, 28 Dec 2023 10:41:41 +0100 Message-Id: <20231228094153.370291-9-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: bf3743f3-8dc6-4099-1821-08dc07893f1b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 60jJNOTgB6YS6qOKqPFiEeashz8PQ4baFwhptkhPfw/bc2rJ+cqJBHCObGzdWviob5/fhDSI65ptl7LqqGGsV/lntiDhkF/a7FFaPJr1XynNLewKrfABXrIqZtDXCE8tm/EW2NwoFdBrH3KtMC1jlwFHy2NX1lvFHATkf0OSx1Rwhw6qczapPtG9Wpka3uoQZj6kpPdeNyiQcP91Vqo3q3QoqMPlwuNXYyuR33quXi2b+hX/flhDxRRHtXdNcXWsnFJAjwSXY34sfAXbmKKEHQkWlL6MmjOAUNXLwzpY3HKtaTLlGtM2P4GLldteiFmmWEsOHuXXh2lcs8xTtjF9jXxauIr5R82HcIsxX9ADFfVkBhRjp60hDcLlq89+PbfXd+N3YYTJABjT1NLIJGr0gE/SeZINNPij71iCYjxSMYXIG5kUM7Bjosg+gB52XdijTJ5fhZg7I7+9RQvZ/nPy9JEaxYMBm1Rlm3zWxe1Uf5ZPnlyAuI0R/lBGAFmERF2oQ7/V2VLp2VN/zkGgqf6isJfog+llrUJOb0/75D9A2qrBDWrspYBjhq/E2HbqQ6D0sT8mqtILrBg3MMCwny78cCUoJUKCe1xYof7tQRdSz116J/xwSQkr84AO3hG8xP/m X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pkucmxnLezJLZyPQKat0VoNrxqRj9BjmC+F3+ffI/dngkLcNS1b6htNc985GoJghUHfV2Ig+lcKsnwuR0o9bt8BQFNe9PiVcSlr/SPYETPfT0fGPurASNHD6E5+q4PcH9ltrsAUf1lZATJK4L+UUjtmEEtJqjuhjFSfRe5XhCCqzQS54qeqx+DNoMgRKlttl/L4uHRkID6DZiJuJgL7OHvHQ3p/alDSDGaBvLsN2DIun0tDobExzgLaxShhlGuugmjQeEaLaIALJkKr89wBTxiKiorHe8VmaTD9S8efnXlc0WQ8LtvYcXjEdB/Wvaelp0tuJHhDBmNf6f+td9WII1b4xOvbvdA4u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DWQMG/bOEsTxIOL2+BzeAYjXvrCdgSB6bJY0JvmnoybccDrLztDnLiCIdLwibUOynBCYu6cZD+aAfZxNPgTUsmowexT6Ys4RIrk1BtJZC9u/961lsN5ddCw+liRO8CUM/7Izag+nW4RoMzMMRoR/0DwSbszXgdmrQLmM3G9g2wBL7x4CTmyj4flAUmaGLpUQReps9M4BIpLU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf3743f3-8dc6-4099-1821-08dc07893f1b X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:03.1481 (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: x7uxrvRp8XrIhLQjpyeXuLmOaOJfZ92QnMSDl+u2hU1WBdMCCgcpB22XUkHFK7QazTxHay8mvRlyUzB49+L742dZxneCuDaxFBLhsW8ZEbw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 04c114f696..0ae06ec0b1 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -837,7 +837,10 @@ parallels_check_duplicate(BlockDriverState *bs, BdrvCheckResult *res, bool fixed = false; /* - * Create a bitmap of used clusters. + * Create a bitmap of used clusters. Please note that this bitmap is not + * related to used_bmap field in BDRVParallelsState and is created only 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 offset. * If bit is set, this entry is duplicated. Otherwise set the bit. From patchwork Thu Dec 28 09:41:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DDC2BC3DA6E for ; Thu, 28 Dec 2023 09:46:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuJ-0008HF-4v; Thu, 28 Dec 2023 04:42:27 -0500 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 1rImu9-0008CH-Cq; Thu, 28 Dec 2023 04:42:17 -0500 Received: from mail-am6eur05on20700.outbound.protection.outlook.com ([2a01:111:f403:2612::700] helo=EUR05-AM6-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 1rImu7-0008HI-9x; Thu, 28 Dec 2023 04:42:16 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gsuNWYmcKmT2pVXhIemT4L+P6HNdqrgvGAKJhtqAfA/CHCdBhgxhIOI4KvYkWZUkscGk03J6Z0JVrGf0PLDp1hd1BjZJuW2NCLRp7w6P3n90a+pE92DaZSdwLzza488UwBh6fNMToC9cpoO8lAFsHwWQnewuZRIdAW7lCVeObQ84GUyDQAKmMfJpBfBo94Bkul98KZ6q1SI5BU+PBDMiP9k0K+Wxpm1kIxexsHFxcqOH3MFv7TSQJOg6TcUlCh6c9RNX83y7ncY0AqfDKOXg/5AnpQe+qRHyYk5mIOrFriq9AL2VygMAF5wRlEOOZNrLVYfGTlrI9xoIQM+0TIHqgA== 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=e3JRRZLsEPXH1NNIs6vNbF/7zbteI2Z70fhLrLAUmgc=; b=T9w+6+PPtflXcfXtX/PCwBD79vwb2keMP4EQD50zH3p5sQKb0w2naKRDw1IzW+V3rdVAbmyUuZ26zvGH2pm4N0NT0ZkZ+1+f2V7P909hOupet5WmsbHu4IiKiIX5mItlYD2ZTAvZsKtAH1fD7FVer1FIjpzX/b+L1Weps5bTk33Mcp4m+QlL+t/8NJA2cFPAmIUb8TJhAWu2k3t1QNCvXKYkbwyHyF9MS8IFEIJAP5czyEt9kZ6Ewh+yZjIyB7evilNqfB0TI52ht78JdJZYWsYoCAgcU6KiqUlk0hK5U1BH0tLxFAnukZUWQDRsVVqWlnBMFo+Tk6G/0RckYcVKNg== 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=e3JRRZLsEPXH1NNIs6vNbF/7zbteI2Z70fhLrLAUmgc=; b=jdBMzk1vXDZhzGy1jAgbUAdALgDBexx32KLg2P7UKM5H+ouPuIplff9OKKw/RJlSjcgq2WmxUcBqFW229DKR42EQCeIRCemMMfP0fFStBZiDuC76t7OKvpb52v8/FdEwR8XFIsotAW+wB2Y0PYNYR3U82OrA7Fd9Yp1rhzTXN02UdG2w3UXH4NYITQqWYuvhpJqTOEY21AK/QccKearqgNb14xvgfni17fBH7m/EXD3XXxt2s9mQEQ6rwU29jUOKpLqBP1o73wFwmiJzK1eVlTuePxNMYBVAZB/N6em1zLTiLO4IPn3AXAvD2c/yRtt115BwDpK+N3vUEAso5+yL9g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:04 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:03 +0000 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 10/21] parallels: Create used bitmap even if checks needed Date: Thu, 28 Dec 2023 10:41:42 +0100 Message-Id: <20231228094153.370291-10-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: 92795731-2f9e-431c-2a5f-08dc07893f4d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4VlIWEwHETvWTHLGyR3XI0kW602uBv72tgFAKDNp87Y1fHupzada14GHswD85BaMPTadI1Z9YodsNOpauAl0RaVWpUb/lX25TsfI+CMd4CrAl0fzjkzHQq6/74zZh+BdV4AhfxYCrbhkyBefZ9pblrUcwTLs4FWs1OgvVOnUxFxplclvBt/b/ejZTv3XU4Lzv0CMV0l85SlhgRSLhH/kTiOgYVN510LyK/ofdaF0KNw3x94usN8RzF1ZnFQKEUkRJpY0wzrOgOsLyfG8A0WX7EOTVd/pSRQhdNy/gFnmj2DVpVaSvRaPDl9LWiJfytuxF/IOtbC6hT9FmpCgztKBu2P13Kggbt3/BkYJ9sW9dI1C1ggWwxhQeIdZ05ljLgMyu/IMD1LjKX+M8zX8P35rVCdFRAYFw0j77lFA6U7+rdZcG42ghcKae105AGmCtLaDAIkbQP1o7G5GZfCCNSGVHA/ulgn6IKS3aiDnjvXoudBPlwQ6a5obwayz+KXsQqIN2pyLMI/h1HPMoQwzmUmZcLuOaNhXuhwiEEvZ6cYDAmc5ZCR7kVYrNRKoa4mX88620TtN3mYlddAiBfqBmdvr4oKFqL3VJ+t0v2eOUOoPUm7UEfnDgq4aXAnoxCr6EvKT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(4744005)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aoWbd1VzvbiA0U4bTpyCjTJceTeVXsqr7dzIWmQhyjujjGA+D72fEBAJjeAAttuxwKo6O24jU/gp+7GMmRl9cP0b+qgr6UeLkjEQqO10BNOla6IUt2HfUblrgA2jtaZIdHzhh7UZk0VTGsVZ3axAUO1Xt7gQDBVV97avuMI2/a3YNqQqSC6H+fuSw/zUuRUyNrQZxMIgCjQW43qPDf6MrovdIwvLg8RFErD0iQZSr7orZCRTDxJoM4Rz6fUzIgA71CUavWz5aFf4oud12fJyboEftF5NpGLtu1xf/jTNWpJtfm2p8uze1OTex2DOL2n+ovp7dUzbfA1wM2Bte/rxVXVhLhPjv0cyn1EoP6KIGb0YFOkt/2+sFHXOZqL19hft6RheYSwdHDKYNW4CsfvAWuQIRKEaCjC3zKaM0BreVm18++ZTEkRT1c1Ku05j93T4qwK5MbNFZbB1uD0AUZAM42qndrcuAXghVemzY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zC93vYEVm962foulqxDJqCYBv5aqHU0eEf62bOPVxcb5GnfhyLFUWvcnr08po0oEpvGzIXoc4c8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92795731-2f9e-431c-2a5f-08dc07893f4d X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:03.4671 (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: FDq4+2nPfwQ3/07dgMl7hSEOt7bmK3KwDqEaPPg+uYsw9CBFGWYaLKjyZBSLZneN/wrjMhUaYPwl6os50i+sIddRRgjf2EcsOKVbXj9/7V0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 0ae06ec0b1..f38dd2309c 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1421,13 +1421,11 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags, } need_check = need_check || s->data_end > file_nb_sectors; - if (!need_check) { - ret = parallels_fill_used_bitmap(bs); - if (ret == -ENOMEM) { - goto fail; - } - need_check = need_check || ret < 0; /* These are correctable errors */ + ret = parallels_fill_used_bitmap(bs); + if (ret == -ENOMEM) { + goto fail; } + need_check = need_check || ret < 0; /* These are correctable errors */ /* * We don't repair the image here if it's opened for checks. Also we don't From patchwork Thu Dec 28 09:41:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92CF2C3DA6E for ; Thu, 28 Dec 2023 09:45:08 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuI-0008HB-Si; Thu, 28 Dec 2023 04:42:26 -0500 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 1rImuA-0008D2-VU; Thu, 28 Dec 2023 04:42:19 -0500 Received: from mail-am6eur05on20701.outbound.protection.outlook.com ([2a01:111:f403:2612::701] helo=EUR05-AM6-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 1rImu8-0008Gn-7R; Thu, 28 Dec 2023 04:42:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FOEVbhuJLwLaQxhlC89Ed8yLIOoN567ISTdVUuQuW9eaqjRuWF3X+5SZZWCQf/6t26dup161oWUVdVSgaYrAli8cuHpaLraDWJ0UkgmJgtxw1X0ICisFeX3n7rlK3o2MzLUaIz1qJu2zf5DDr29xa5axG+qAvSUhw8BGLvPRnWL8l6Ij2e8hWe63cErm8Vqfx70eARpcbev4Dqj0TpzMMwbo3u5e3/PibdMQmKEKXOe54d40fpCfoVzQ4bCa2WUO1mgsRKxZrqBB6XWCEQjbvkyrQVxtWz3HfvxjOaaTnqkMMwQnKKOObuw5RNOvPA4kOlN8BvdJBKW4U0zHk9EvyQ== 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=WpECAwRB8Lh7KQMAwUs6yNclzlBlaMN4Cp0X7tp96gY=; b=KJvGj3+EZbfrYoU2yvACtl8qhmacuqQ36Lxr1yWxjjMYXTdE451g436R6xPkabq7DLjv14/iuCUsEVrRFjn4H+neVBEpF435QSLZLO8ihDWOmJDJCQwsntN/hAGEq7bPE0WjNq030RSPG8BUWU0h4iMSzJTo5hWZs9c9zraXmx2e9yZfAeVjnVoe0R6UXt7fFZbFQbGNuqQYsaVwhnphPB/ki77TjhpfgSnYNbDK7zI6mg/EpTiPwJb9N7uQH11/cD5hRtGtjmMf96V6LnabZ3KKw/7HJNMeDVGVL7UzH/rFwlOZiGHN9eCoQ6fBahnJubPKG1qyA+Intx1rE3ZI4A== 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=WpECAwRB8Lh7KQMAwUs6yNclzlBlaMN4Cp0X7tp96gY=; b=shYGjrRB8R76ZiDn8Dp4/MhcfGG7xurNnQ7EZ4flI+spLsiC9Yp888KZvX7uyfr1fGlvtFtEI6kKBjJtBm5LHAlPj/qGH7sKS0FZqfol2zz5gvt0AO35vuwxG4FUmSKLDK7h57QP39qM7I/Fp8GGCFE57iCBSpE8F79tunKSW1TTpxbFnhi2zU0nELyidrW0IWuCZOYoT67G+e/sjiBTWjx9HLFWw7Ek4Su8YcOaD8TNFUjIk1gVlOL0UK3Ey2aahGCynfh1Gg47Sm6KcV+dpI42vGRTpGXy12A0YLxX7AbWc7ZGgmalhWQ27WpeGpTEy/4sQOP6+5xBrcQfUmvdbg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:04 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:04 +0000 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 11/21] parallels: Add dirty bitmaps saving Date: Thu, 28 Dec 2023 10:41:43 +0100 Message-Id: <20231228094153.370291-11-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c0a3f4c-c17d-42a8-0569-08dc07893f84 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qe6b7Wx8+Se6kzYEZtDbiPABlSy+s6cgTBGNLCL+X5sKM7qo7tIy0ZluGBRXiGf0cByr7oMdwHvU9atPObyXO9tH8tjFWztTHvVIluDx7NVrYOQQHZly3hwzIaqVQNllIJJNscrTIq0z29hheO7prY9VES5vB+sTpte0D7Nfxsp6n62vDmlA2Gc2Z1bs0eXvws8kJWGIKDjJMJ14glRsd7aMN63eVifBzbxW9kvc/h24UZwivlV1qI/Y3jTKp9i/GZtK13erDNbOuScz5BE0H3YsxexZ/eY1iQ4M6AmDoN4vPLKWJYGk02bKBC7e3sJTfzSRbLWqcymEeXoDGZO7r8ZXN9EJ06uczevsz46ebrlXgNrLMj/EiTwH5Tz/7BuKY65b9arfJUoGYY/cxz35hbQUxLX5fKH1Lb3/TAqTu0I0IfyNwYd4is8Dt5FHbKyf9+6nmqDt00Y0IWvb+uLAVyZzsQdrtjTkDv7fOH3Uqr2MC7w0BRb6JCFX2VlTf8Qgz5o5EyJ+b19L/4H0E2Bickli77wU1V5B7nNnjlxfLK91dlN2OFgOxM41E2K20y6ODU7BAAaxc0cOybg6cRW/JrELzBdO0qVZs6DK/G2ypkkDL1qr1Vnj58E/uR11/+BxsSrNscCGkgS48rAykwKb3g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B4p9MThU334eNN/73V7rzgJA3EptE/HH8HD84WJTt+sX8bU0cAlPoa7rTSU7BxKxn/wI/d1rkEId86HhPfbl6fAxUdEFiWWW3qva9jbquuX7FNZBG9YtryvJSal4Fs5RAXyZTM1gLTr+8fedFJpMo+9OYV8UMGBD156edAY2oNVAqOeb+gaCb/K31WSSjsCsq4VmC+O99AmOcXS+PNV4ABmm0H4No0N7w3nAKNNi1YenT3uSoA6ZSLonaLhrqlqhkL/KWfMocbb/INkyiMUaf4hsxgupLPnKWu8N/guz0V3555lokB0ubdtF/4q/nQQ6PBglnug81k03neuGry9pMVGpno+wg+/hnvTEMFufPu+ZetCet2s/ChkhLyrZ/kMqNxG2UaEfu2zhqWazEYHDkdV/mN0FossJNxsJCUH5iV9W/1I7WUpTCXpXr29/y4LyiuloPDKeETc2QxW5pMW0doVn9L/PhsGQVu6wbDcnWDL8Ios99jm8Gt+yh3qT+Vx5WlMBX+ZBF4rlcEO8QlYSoHxHIUHD7ORwWNgl2i+vREy+c9g01gijj1OIMJS1g3BDe4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o.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6c0a3f4c-c17d-42a8-0569-08dc07893f84 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:03.8530 (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: GU7yPFlJhDzEZ1OF7HPSLU+kq1SbsuiuXcvYsiqrly1plYimFuFqTdTlL/LUL1xqh+8jOe3rLXyat2BvJ8RUwgWSKNs6MU6N9ge+MBYIr4A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 | 168 ++++++++++++++++++++++++++++++++++++++++++ block/parallels.c | 16 +++- block/parallels.h | 5 ++ 3 files changed, 187 insertions(+), 2 deletions(-) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index b4e14c88f2..c83d1ea393 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "block/block-io.h" #include "block/block_int.h" @@ -300,3 +301,170 @@ out: return ret; } + +static void GRAPH_RDLOCK parallels_save_bitmap(BlockDriverState *bs, + BdrvDirtyBitmap *bitmap, + uint8_t **buf, int *buf_size) +{ + BDRVParallelsState *s = 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 = 1; + const char *name; + uint8_t *bm_buf; + QemuUUID uuid; + int ret = 0; + + if (!bdrv_dirty_bitmap_get_persistence(bitmap) || + bdrv_dirty_bitmap_inconsistent(bitmap)) { + return; + } + + bm_size = bdrv_dirty_bitmap_size(bitmap); + granularity = bdrv_dirty_bitmap_granularity(bitmap); + limit = bdrv_dirty_bitmap_serialization_coverage(s->cluster_size, bitmap); + ser_size = bdrv_dirty_bitmap_serialization_size(bitmap, 0, bm_size); + l1_size = DIV_ROUND_UP(ser_size, s->cluster_size); + + buf_used = 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 = bdrv_dirty_bitmap_name(bitmap); + ret = qemu_uuid_parse(name, &uuid); + if (ret < 0) { + error_report("Can't save dirty bitmap: ID parsing error: '%s'", name); + return; + } + + fh = (ParallelsFeatureHeader *)*buf; + bh = (ParallelsDirtyBitmapFeature *)(*buf + sizeof(*fh)); + l1_table = (uint64_t *)((uint8_t *)bh + sizeof(*bh)); + + fh->magic = cpu_to_le64(PARALLELS_DIRTY_BITMAP_FEATURE_MAGIC); + fh->data_size = cpu_to_le32(l1_size * 8 + sizeof(*bh)); + + bh->l1_size = cpu_to_le32(l1_size); + bh->size = cpu_to_le64(bm_size >> BDRV_SECTOR_BITS); + bh->granularity = cpu_to_le32(granularity >> BDRV_SECTOR_BITS); + memcpy(bh->id, &uuid, sizeof(uuid)); + + bm_buf = qemu_blockalign(bs, s->cluster_size); + + offset = 0; + while ((offset = bdrv_dirty_bitmap_next_dirty(bitmap, offset, bm_size)) >= 0) { + uint64_t idx = offset / limit; + int64_t cluster_off, end, write_size; + + offset = QEMU_ALIGN_DOWN(offset, limit); + end = MIN(bm_size, offset + limit); + write_size = bdrv_dirty_bitmap_serialization_size(bitmap, offset, + end - offset); + assert(write_size <= s->cluster_size); + + bdrv_dirty_bitmap_serialize_part(bitmap, bm_buf, offset, end - offset); + if (write_size < s->cluster_size) { + memset(bm_buf + write_size, 0, s->cluster_size - write_size); + } + + cluster_off = parallels_allocate_host_clusters(bs, &alloc_size); + if (cluster_off <= 0) { + goto end; + } + + ret = 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] = cpu_to_le64(cluster_off >> BDRV_SECTOR_BITS); + offset = end; + } + + *buf_size -= buf_used; + *buf += buf_used; + +end: + qemu_vfree(bm_buf); +} + +void GRAPH_RDLOCK +parallels_store_persistent_dirty_bitmaps(BlockDriverState *bs, Error **errp) +{ + BDRVParallelsState *s = bs->opaque; + BdrvDirtyBitmap *bitmap; + ParallelsFormatExtensionHeader *eh; + int remaining = s->cluster_size; + uint8_t *buf, *pos; + int64_t header_off, alloc_size = 1; + g_autofree uint8_t *hash = NULL; + size_t hash_len = 0; + int ret; + + s->header->ext_off = 0; + + if (!bdrv_has_named_bitmaps(bs)) { + return; + } + + buf = qemu_blockalign0(bs, s->cluster_size); + + eh = (ParallelsFormatExtensionHeader *)buf; + pos = buf + sizeof(*eh); + + eh->magic = cpu_to_le64(PARALLELS_FORMAT_EXTENSION_MAGIC); + + FOR_EACH_DIRTY_BITMAP(bs, bitmap) { + parallels_save_bitmap(bs, bitmap, &pos, &remaining); + } + + header_off = parallels_allocate_host_clusters(bs, &alloc_size); + if (header_off < 0) { + error_report("Can't save dirty bitmap: cluster allocation error"); + ret = header_off; + goto end; + } + + ret = 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 != sizeof(eh->check_sum)) { + error_report("Can't save dirty bitmap: hash error"); + ret = -EINVAL; + goto end; + } + memcpy(eh->check_sum, hash, hash_len); + + ret = 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 = 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 granularity, + 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 f38dd2309c..a49922c6a7 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1466,14 +1466,25 @@ fail: static int GRAPH_RDLOCK parallels_inactivate(BlockDriverState *bs) { BDRVParallelsState *s = bs->opaque; + Error *err = NULL; int ret; + parallels_store_persistent_dirty_bitmaps(bs, &err); + if (err != NULL) { + error_reportf_err(err, "Lost persistent bitmaps during " + "inactivation of node '%s': ", + bdrv_get_device_or_node_name(bs)); + } + s->header->inuse = 0; parallels_update_header(bs); /* errors are ignored, so we might as well pass exact=true */ - ret = bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, true, - PREALLOC_MODE_OFF, 0, NULL); + ret = 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)); + } return ret; } @@ -1525,6 +1536,7 @@ static BlockDriver bdrv_parallels = { .bdrv_co_pdiscard = parallels_co_pdiscard, .bdrv_co_pwrite_zeroes = parallels_co_pwrite_zeroes, .bdrv_inactivate = parallels_inactivate, + .bdrv_co_can_store_new_dirty_bitmap = parallels_co_can_store_new_dirty_bitmap, }; static void bdrv_parallels_init(void) diff --git a/block/parallels.h b/block/parallels.h index 493c89e976..9db4f5c908 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -101,5 +101,10 @@ int64_t GRAPH_RDLOCK parallels_allocate_host_clusters(BlockDriverState *bs, int GRAPH_RDLOCK parallels_read_format_extension(BlockDriverState *bs, int64_t ext_off, Error **errp); +void GRAPH_RDLOCK +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); #endif From patchwork Thu Dec 28 09:41:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 765D4C47074 for ; Thu, 28 Dec 2023 09:44:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuK-0008IQ-Jg; Thu, 28 Dec 2023 04:42:28 -0500 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 1rImuB-0008D8-EJ; Thu, 28 Dec 2023 04:42:19 -0500 Received: from mail-am6eur05on20700.outbound.protection.outlook.com ([2a01:111:f403:2612::700] helo=EUR05-AM6-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 1rImu9-0008Jv-Ut; Thu, 28 Dec 2023 04:42:19 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cH43IhTJmTW36RpW6wYGz3/KI9gNNNedi5hxIGh57QkweZSIicx2shEMYSGm6mBkpJFXFQedZLbn6LS1lJDO/OrXci9jC1UDYHofAgIqkY0V0LqBN/eUEf7Bg/B/bDz/xeSxuZrga3YI9haYChpwTli/qGxmlLqBfNcBcfqNyhBuYJ+HoRpOV0m0s+mOz/d/aHfMI6opVxqekwe3jnsQQY3kT20cIM8cDaA0xO2MohtdK61bGqqwk9vE9xiHNziVIYklMqgiq+17y0lJ9DHTeQq0V/hLSfmfiKOlT7Wc1I/yRwiPYa8WFosapNauY1aPYDE25mJCzZiS4o+iPQMxCg== 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=X5Oj30LUdw1Ptxbl2cnv9yLfr5rs7S0ow9Aga37sHnI=; b=Z8uvhN9NeR3KOe2u5pYe4z1kJWhyebfu/B0F5IOYWgZdihcMnr1EA3ogSo24dx8CpDYVRpOTJomyt0fssPBOpVKn/W6k9NCDYWM+o5nrn+1PQAxTTYJGfgugV4sFG/csiykWSuay+lV6w3SK0Nlvz8Cw639QZ1+9u7Xd7Z0N7ojFzyybgIUP7/JvcpXQH+l3nlNWvdYST98NMcXWv/Te72LVjnZj/ylS7ql/1Rk5VUSfU2nZdH7W8gzZcHDdXxt020OT9yJ8F4RFTY19iKck2sEZZlvCqWtqpSYDkIfcu/dKiV36wccVwwxnzF8AVMCXEFGfLVMsgYWGj0GEeZsTig== 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=X5Oj30LUdw1Ptxbl2cnv9yLfr5rs7S0ow9Aga37sHnI=; b=ihvoX/hBYYCFSRqvs4mvH8gjnUFz9SC3ASw4r8BqA6tAo6gzFsPft6v4G4JTrJzUQDIvq2HYCFbvBbnwH2kuy16gbVrq9NHBz+T7IIhPasTptbxeTovzV3JNFogRK0GO0HXPTHxrPe2oxge+ldVpouYIUeA2uhMM7Q2nxt2Tc6ZDcYHdywMMfEgse3wtCwfDBPtSrxdsPnOaMMnWH5mB6StjO+j7R2PhQAEs4HwZWsZtZevjcCChzh7igqNT5/5QOG7ZuZ0kWfhHN1Q2dstL9Oug1aczdqYR8mDXjNCw6N2hYCxzuxCQwVUG8muMtRsUwIXmRn537am6BhXvHiq7lg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:04 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:04 +0000 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 12/21] parallels: Let image extensions work in RW mode Date: Thu, 28 Dec 2023 10:41:44 +0100 Message-Id: <20231228094153.370291-12-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: 33371760-e5e2-4a3c-12b0-08dc07893fb6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dfupy2W3INmftBcUiSoj7gZUSe1Y5yYINiOuQ2B7fkT0HeLpuv+CjWp5vMl8txzKbxCGmv52lhkQreoE4LDeFUauPrtd1zIN6jVw33omum256U8anuqmoFKskB9RHl8ybqCSSKTs0ly3ECoYfc5Khxsd2b7Rkx/ZtpuhKv8x1yRMAI8f/AxIEXeOSxGbJgSoLmqRUkU1QyKTieNDvhtKCZVb+rXVhjZuVG+rWNF+WafZ3+749Y4i4XLEkPujNXwvpBEDt2Abj2c87bNVx+TzFFqdfIgJ7Opb2IIuqo+SyAqtkcnlTIuYlpqStS1nCi/GAsG1BvNUJzbBAeo0TWE7L9qGg1bVcMtQXTajXFqms/4DzsszCwmvh1l3ENB7HfBRZZLTY6nyzzrJSDT9fNYANATpUZdnUxwXmwCSn5CaN++ok7xuL84yCOUr9ffKDC07fgggzMOtDVSmufA0SdZObwG6h9fLkbLQLEfTvzIwzi7eFW13OIWN1uU0TfcwxGpTBpavNGtZU0nL0DGXrvN+yJ0jIEMBqL1dcqAfZIqgjsVcOEMM89Q+g4HJ2QmY6O7cCgEo9WiYZUqVcVRZ/0ourfNy78ywLfqvWh2uTePkNNVYVr8PnjAptoUH+5V1Yd9keoMaRSM5cI9wRpfgADycMkkdYFkdBzbTuomVYexfBas= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230173577357003)(230273577357003)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WsuUOFoqDRneQKyxDs7fYOEd+RmLKMtsGDd3MdpHVA7AmGW2BArc2BkqM565PLUPKWOxO/ORKnBpZ7jca27YwafrUOxAnWo5NAMa3IzsaSksc/V05uOE1R4WSdDMn6JlNVTZGIZOYlt0ynpYFBawYVesJcc9XQ28K4QTvlRy/OZaXM5L4Neq5oGoKCF0WQrsER+KSkhl2fbL5Jh1nT/DtSB6xRvycsV51eoRnsHqBPTv1lgPl8+XFjjZmhCPWY9mLs0R8JYY9eXDWDPV6MfpA3OfKgjA9G4sYn75Zs03eTCsQsIY5OySfvIa2/2uZ/A5+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G0vh26DfcgiL4zxBd5xJkddjr9KtF4xO0BS+5HHnrD1zSzvlG3BFI6F163Vilgh5Bpx8/DAOB0tz1N7ZnXVZqB+0Qk8zcNeYbU7OgiLZRY5z8w2VaFXckr0nVmXm7NEEzvGLaVq62dJXA7q8WVtVHhuEOq5DOS6FRTOlAOD2JrWQIwCCc+0Ablrwt9UPspPktvlNYsnZR0QoodJNDOQq5rN5HNSgyQVXWA+zBpFTr2VTsdY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33371760-e5e2-4a3c-12b0-08dc07893fb6 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:04.1606 (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: Tt6hDIMMj/V9igGXrvikqVlUwU7LYrvVSEfJe2gqopxExH03K6ZkKwaJ7EfMzy2nbywXrB2wMOwxo2fuDTfhlnFtzFpRNzrqJvLB1AcsCxk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 c83d1ea393..195b01b109 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -175,10 +175,6 @@ parallels_load_bitmap(BlockDriverState *bs, uint8_t *data, size_t data_size, return NULL; } - /* 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; } diff --git a/block/parallels.c b/block/parallels.c index a49922c6a7..d5d87984cf 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1374,19 +1374,10 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags, } 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 = parallels_read_format_extension( - bs, le64_to_cpu(ph.ext_off) << BDRV_SECTOR_BITS, errp); - if (ret < 0) { - goto fail; - } + ret = parallels_read_format_extension( + bs, le64_to_cpu(ph.ext_off) << BDRV_SECTOR_BITS, errp); + if (ret < 0) { + goto fail; } } From patchwork Thu Dec 28 09:41:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505748 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AF512C3DA6E for ; Thu, 28 Dec 2023 09:44:08 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuJ-0008Hq-KM; Thu, 28 Dec 2023 04:42:27 -0500 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 1rImuC-0008DU-8V; Thu, 28 Dec 2023 04:42:21 -0500 Received: from mail-am6eur05on20700.outbound.protection.outlook.com ([2a01:111:f403:2612::700] helo=EUR05-AM6-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 1rImuA-0008HI-09; Thu, 28 Dec 2023 04:42:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UFQTlE+c8PgyCsauSBDOyFVOjiSGYAH812kqsQCsWblYx4NNnTCIbKsTSX38eNfDD6YRAyMyJLmyaDIFp8Xr0kEakdV8PpezfUx9MT/zFEh7F3APn1IO1MjLQKfwOUy3Nu4eV1iGtJ6nR7DMUZ3Ht8BznWaMmBrtOj34N8Fx0mb6270n4pyxLCRQUzHRc/Jmg8+AW0EtspSPWpGvkWby2BlmudlXFPh6q1kBQKn+PeZxO6clpwHVz+f18AQHcvhgTOq3SQUH6vQfHPOo1sjI4k72DYtedz3/q3yeGGlMJBCiwpx3Byfn8H/1CZ6Dlp9IP4uMQ6JqsNpmGebVb9/FOg== 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=RtRIfsa8yMATIzeAlVqe/ZKQZpRciBlgyBwsHIDo9M8=; b=bwbhr0d2qYfZ47/d27PZ7Jn+L4VUy6SQ9DQxmI9YPPncVsGYlTXw8RLF6z8Y33/ZkLabHgSZ0K4T+++unR9UJEutOp9BUvHzJba0VvLAisVEZlvqZdBx0VFepm7wZtcw3yZB2GX9o8hzaag+B+m1U/UG21z1GA5R+lCA9AVYFTMY1Xhkihgv93yFAnrC4CzmvX9h5iIV7jLQQDLwk90nJBtD58zBMEVaKS+/Hs5RJ4RL8POZ34OUm9Z3XBFHa8FRxWLKqMp2X0MEKPSBbbkrAoDUG4rMCKUVv3lp82emBtS3Cv0Q2GVvYV9xz5TbwE0IkC1zMI3HXjBt+8zSQhnOZA== 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=RtRIfsa8yMATIzeAlVqe/ZKQZpRciBlgyBwsHIDo9M8=; b=YSy/llwRrzch4/xw5YQaBPGr1r0JeJpZNGzWRXOk2n/a7W/XPMXhQe8f4UQq8veeCi9omUeerzSP1r4Uhh3IBu4Y6dbWfKb9frqCyGIO5JGw3RawFzzoYfaBBVIbbRhk5+79pAxnIACOfKVnJDI/zLW0xBYKEgrdsv8GFt9WcfeKIYoPeRnoNJoi/Q+1sfYeTY8hzLZSEoUHaVOItAzZbcTnoKOmm9RUUAEOj7wvsyhR6Y2Le/1wDes6YUsYSebfNSkZubcH2DOX8X1Ma2XSOvIPm05WlcIQvltk/Hczh7//kLGFONe+/e5UKgrh/hhnSdeyak7JAaaPKXya3+WO0w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:05 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:04 +0000 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 13/21] parallels: Handle L1 entries equal to one Date: Thu, 28 Dec 2023 10:41:45 +0100 Message-Id: <20231228094153.370291-13-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: 367fa2bc-1eea-401a-24d7-08dc07893fe8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6K9Olv/kJxrCalS6M9ojMoLyl1qIyIRkxnbF58d74EuTtdVj9OWctULMTPMrWn0rcj5B2geboJ/NM382viCkYgLzMH9/hub4DMeF4q1QWUP6ZNeWvTofI8W98CMfQsscdrHZpcbfTEEpjj239h9tBrnxT/juEbyFQpjGbCX/cp17Guyxd20F2ngMozj/tF2i+fReGViSUbLamyclAvbvE+oVakhL7wkwl/vgVXmJPurJnnzM0RPRY8L7nwRvgsk37NNvnN5mmkC861sRZvR5Yz34CiJjk1PUFSAteJGRVdlNYpLvaQaQjVbql3l8PB+1HFI5eLgYpMqxVPzyi9L+9kQN8U5PX/QJ9iT9E9Pj42gjx2JVeAwi4Y98M4FEP/vx4C6dctGsuacbMIsPx2PtIG8p/o/0j5ZyR595one0Dth+Z/qgve5VwcfZjzHFg259w7NoZStBCaFtgVgNeRd9CorK4U2llM00isRHon0GvTDYzRb3bLIn7JYTDnjuIa5RnGn6oylTG2pTh91wzoDvXZzuI2Tr5PiDPMsHvgeCUulPXHOVdh3nnXDVGca9CBbphKohOyU6UWnytjcQJuEtkU7qzf06d2xLuuo/QhoHCDUJGtG9VVnxSq4caAFCNETB X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OjJGrjDofe3WP3UBnGqBiZQVigbl7+VbWcOpA1Ca8Reso2jKVT7Kt/H87QPFca3214PMH4Yxk3VuP5PKeqNZ63cMxScFoH3KIOyPRGUQcQg7tsez57qQjt7B8IC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J9cfAxq/JE+7R0KDsQtZNZ1v6GkQJKYgJI56nmsERyheS/XRXWPFxJRqj+uk5KalIXe1yxRodxW2HbVwHSFayF/Qx0FqqszGsvqnEXD9FC7ysRE7C3Hf7ppVJNqecp7ZjZtOqaIgNGwll8qHXWvs3QHgDJwYVh5mxBOdzpPhtbIkRF0faiBzpL4wcCgtaFfRRhVOy0htano6BuVF4MGgLl2A+ue2LF5CFE9r63tHhlO2nKVUizQxNTFM0Z+N112sCI1UeLgGhRAkotlt2PF5w5bgFp/nO8p4+sB2t6av+7SL62KcWdpRD4EH+ZQo3BaJZiB5+kH3yBok8A2fhgWqzSckhZd4nGS3TXlgKoumHyI8pDn6gOQtOkkyprCfpMxEtVl99irXeNunO/qjNCkrxHRYoDhokCjFRoF8RRi3MIr2L5YGwKqXg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 367fa2bc-1eea-401a-24d7-08dc07893fe8 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:04.4946 (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: +fhisP2HrvKg7+XituHpPNE4zef8pAqnZc4mLf7Qw0uPSswf6FLcJFLbpxkfIgMxMI5rmcuyha490k7is8aN8DcfQIL/1aZMwAgVsmeQA1o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 195b01b109..033ca3ec3a 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -354,7 +354,7 @@ static void GRAPH_RDLOCK parallels_save_bitmap(BlockDriverState *bs, offset = 0; while ((offset = bdrv_dirty_bitmap_next_dirty(bitmap, offset, bm_size)) >= 0) { uint64_t idx = offset / limit; - int64_t cluster_off, end, write_size; + int64_t cluster_off, end, write_size, first_zero; offset = QEMU_ALIGN_DOWN(offset, limit); end = MIN(bm_size, offset + limit); @@ -367,6 +367,16 @@ static void GRAPH_RDLOCK parallels_save_bitmap(BlockDriverState *bs, memset(bm_buf + write_size, 0, s->cluster_size - write_size); } + first_zero = bdrv_dirty_bitmap_next_zero(bitmap, offset, bm_size); + if (first_zero < 0) { + goto end; + } + if (first_zero - offset >= s->cluster_size) { + l1_table[idx] = 1; + offset = end; + continue; + } + cluster_off = parallels_allocate_host_clusters(bs, &alloc_size); if (cluster_off <= 0) { goto end; From patchwork Thu Dec 28 09:41:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA946C3DA6E for ; Thu, 28 Dec 2023 09:43:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuK-0008Ih-QX; Thu, 28 Dec 2023 04:42:28 -0500 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 1rImuC-0008DZ-UV; Thu, 28 Dec 2023 04:42:21 -0500 Received: from mail-am6eur05on20701.outbound.protection.outlook.com ([2a01:111:f403:2612::701] helo=EUR05-AM6-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 1rImuB-0008Gn-Il; Thu, 28 Dec 2023 04:42:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eMKGlacCvJk5YKKfvqHzgjEeYg8rahMK1h1SfBwZ4N/TsraiJ/6hdKkYzdj2pn+6pZBDhcsEuyhKXSVLp67OZrkTbSzwy6fw8IozWDr5J7q9Zp7IGuKJNlrguxGGb9xAsfEnQLd0PAkA4B2lLe0LRbh476eeYDka5VVX0I9qLlDEnz2kUEFXbTcpaS6nKb3+ssoPytepz/lFSttJFsf0izPQgwm/2ZUU3u8on+O0tUXazPMqMdEX8IgsS4245pqjEGc07LG8IeqRky9BPbvQih3vCmLn1GwupVCeJ3hT9sq7i4WFUNHWxd2JWQCuS3CIVo3AKv4XTYiRPlOvlyRhpA== 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=RlLc3sGjbjLxYT0I28zHA5XYRyRf4UFwkyTz7Ixlqm4=; b=IucbmpkpBuawmn8+faVTnEdQBB+fyFbAWhFdpTKf59LKdJ1S/8I3afICPhu61S6IPEGHBDTZaSiCKJQDmC3AE2mQiqpLMVLq9qh8BsJqEseXvZ0devXmXtcFTvY4v0zDZHo5UzJNpq0yPKs6XtxoboIKx84B73OjHdkbLYSDRQkhmrKBFtkIY/h/Ou2FpkUHiy/znGUCLln9DcrOZQ9CmZAh3n+6qX+KiVO67k/6xNpGmSp5xcoSYGgMIHMkdmDAMnRGTm+2Xc8YqHaqbfPesPfXvtK4U3LpPJBEGs2MyTLlXCw2QA0vcHoQBzwmS5Ee+vpvHf/NSJJlUQSeMEnDXg== 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=RlLc3sGjbjLxYT0I28zHA5XYRyRf4UFwkyTz7Ixlqm4=; b=RIJQ/rx4U10OeCJ6xzcLIgGy7k0X8Fz8j/rgAp8FcXHAC+Fy1AIz1DN5SyCZ907NZPgGXubLzSt4y0AY+SKw6xzdq/Ypd163nnm1lGTk4JLXstKg8ycz4mmKIeQYwzr/GsAmoznPkpd0bTGdQ5H47FTDw6gsdpHIM8IWBhY+eOJi/ntl6PVjsc9XY3GYZGESRxKW2NsMI2tUJ+IEL3SzxmxSJNBbwQPeFLdLdNYGOVhl5oHa//nUXEHncuYLYToDWJIoFsPC7z4xS6c6WqHt7bGFYEdI3KcArRQuUeypjLe35R2BR4kEDo7FpD+T7/z/RkD2qP8xqW9AqGFgGo+WGg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:05 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:05 +0000 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 14/21] parallels: Make a loaded dirty bitmap persistent Date: Thu, 28 Dec 2023 10:41:46 +0100 Message-Id: <20231228094153.370291-14-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: a80d8183-86ea-485a-3685-08dc0789401a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z3BanPbjj3EoiQKwNYBs/naVq+oLN3TTtzXDQ2YT+NDTNtmD41j6fcUwvguzaLlF/kKXxpicFQRGpSpTgkHc429ndT05iYbYMBbD3RLv0LKHuApXWmCV2dEfm7Q0BUTHLK++LpoPVYIPD/8P067S5RvFXZlKVv3PDCsuIrXWdOsYY6SVnejkQxIV2oRcfsTbQ67Cz4GqLoH7KvKfgfjZHDP1iOg8pq4RhiRK5nDuUbBfbT4VNnP+VLeOXYidieQcmt0W/cpgP1KbUQ1NludcCtcdLd60dwkBNpjvsshf6Tnz4/2UV9PYwgEqnPXMp/FkMS4K4IWWA4/jb7bdKlePJm8YibaHJFyXWuWisfk22o3aIsfAfxnqcgMkoAuFSuGW/FIkyON3lecjWQf6LtL5O+cRom7IDydz2wWKdtXUw//CLEeOaq8EO0odigPldJdC9BX9Z4m2FJYvFEzqg+zwtm22p/qtA/+4/oGmY1HK8zcHRLc0S8iNmpNHkdC2j2UkQ/MZFc7xnNmSrkW1pPeAAISnk6nLI42rIca09uZF57pFRmcTbSEZRlqYMr4ntpHFNWmjhbPER8m3NrbswtfWSSNpIfERLw9Mlch27iqWevor+8jeZ4Fs+spI8H2rGhS3 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(4744005)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001)(14143004); DIR:OUT; SFP:1102; X-M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6C+2ZDCxXPpiqDbewUZpjNXoCDx2OU4uOJmMTJZ+qZxv8cfh+iFRJoTRg0P7USVtKhRJdtgGsuyIXW5Q0M5fm4dEm4MVoGICgsNKTvm8YsqA6JQpLPSs2Q7b8YEqOkKYhN8opagXpyqeQhUmEF5fTlPsImsBNVZ9m04qJpmHRp/5gK7ea4AEbqBLiPaJVvsFREQ9yE4Jroi5tkGxhyrU884tmKWyCBLk4tGd8+FevdwkIiXjcyHCyXOOE96ezfeRBt+NhgotkmzspQw90xpXjHG5hdS8ziMhxvU8wwpDjrjRqxiIBzsSNogZReaWXqVm9H+s3bHzhSdugVq0HDyUFc3DLhOe7u8MOk/RhPpMIARRjur/mGs83axC8OZdKg9Ovrjp0IToToSbNz4IOIod/uKz138mUkEZuglj5b47BoGJ7FcZJaPgOTItPp0zj3rnnrUBlgiVaRc0Nck21ae4abeMMy3i/EaEsV16s1C+be08n3CgeTQfuCPSZJM4HVCY59VdWC5/O73RICVxRoMDE5N7DFKIQ7ZRpWme5oLjvOfWAk5Pt3bPxsdWCRuLVcpkp25nas+U/ICDFXRkiASekGgxrFmk71ozOwO40fhtUY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a80d8183-86ea-485a-3685-08dc0789401a X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:04.8638 (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: Pygl8KVRaA5eWHBzkAbmtFZUdtUlwk98DHd4VPJeKO9aMfJmvHrf/XDEHD8NiUEDeSXIjYr3gqtf2dK/WajCWdGKUU5gLjuz9GKMO4TOMf8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 033ca3ec3a..2a7ff6e35b 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -255,6 +255,7 @@ parallels_parse_format_extension(BlockDriverState *bs, uint8_t *ext_cluster, if (!bitmap) { goto fail; } + bdrv_dirty_bitmap_set_persistence(bitmap, true); bitmaps = g_slist_append(bitmaps, bitmap); break; From patchwork Thu Dec 28 09:41:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505756 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 91C08C47073 for ; Thu, 28 Dec 2023 09:45:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuK-0008IA-CW; Thu, 28 Dec 2023 04:42:28 -0500 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 1rImuD-0008Da-M2; Thu, 28 Dec 2023 04:42:21 -0500 Received: from mail-am6eur05on20700.outbound.protection.outlook.com ([2a01:111:f403:2612::700] helo=EUR05-AM6-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 1rImuC-0008Jv-2v; Thu, 28 Dec 2023 04:42:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VJOW9C5UtFZyLour5pBA9w5EZkmIoFY2xbNji31PqEvJ8BGSkBEIrT0TKsILbCpMHsN4BJdSvYGExrf5B5jr19BaNltCEEnYei+feXKCXqm1DRV5cF7eEFbstkQDRUk51/sAAxcdIgtLTR7Hy/daWvKSE84/yKdOO75f23XXLPJYB86dz+5rBRGjzeqmAZL6baK66A+AIBuQH/o4v3qjoimTapK2UYoDON5MaIHJhQLPZI6rH6yQI38MMMihb7mZx728+L9QRcBRa1u8euICD48nsGBcsdrfYKrxH8pyhUbgE5AlnRZ4gyups7N5+6eQp8v+Xdn70JWpwXbXsoWilA== 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=z84wjcZERYFHoLxhiNvThUkhuyvf/sVU/2uyo8YF85o=; b=OaXMCLQ4fLwMzxCU2qeuLVWu+NNiIG75qEhZLzB66HT0TSjJH9WcP7YPF5hhNIrEO0T8gHO8yQKVU/mYOvKB2aZQxfOGOTZ7RhEOfEU4Q4T+m6pEwblBo9kUJW+7bqEs9DdiVUDY/Od9MaSKNgIU+b0HWK4D8lfjEWnu2IryyQK/O8/i6PQA7NnrwGprbPVtvFhYygIt7792Q7EpXepdv2NnZ3DuWr+sTYfrgW87Zg5Fs36XJdqFkDeL2uyEhNoUsgep3cQqf75EsZ4d8TjW3gmWQOTihwYE5bYP4Lce+CIcbkf0sL6OyPD9mDRnlS/AlXLJwh4+GZITEnNH+eh37g== 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=z84wjcZERYFHoLxhiNvThUkhuyvf/sVU/2uyo8YF85o=; b=LztZaLfF+N4K3vjZwoIzQbXeqK0TCAlAWrhgE8X0JEwgmoIK1G5B4Igf26+Aqi+D3rAeeMmjIZS+u8vKJ3/J3R6+RdIsVazE42fDh36+qN9ecR3euRfR7Vj+XgMGmBCY391rQXT8UhrtcWTr9nvvT9b604XkXRTTMJIhei0wm12eZALeA0MLwsOR1rEaCkth3rNebXUvtdFLiLTXcdKondDyKcxOyLSCj10aDS/5Xfq82ojDavkqaExk/9g4Mi0rtLnIvFgAW9M3bt+Rq2CIQLFYu0YLepdKmnt0sj9Lhz1kdd9EcIj8J61ZaruJaMPcKwjkVLHoQ8ZnFg5xSnVccw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:05 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:05 +0000 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 15/21] parallels: Reverse a conditional in parallels_check_leak() to reduce indents Date: Thu, 28 Dec 2023 10:41:47 +0100 Message-Id: <20231228094153.370291-15-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: af728d1b-42ea-4aa1-6f87-08dc07894053 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VAomBNgdB+hEoA4YUOT9A8+pmCfKMBoXBqIennNO3syUNZQQdVlwfDXh1pVolZKjFaDmqyI403fA0X6ZSqxIiQjN/37HDnJjYy6Kv43AitPlfiEOcitcw/cbinPLecDGZfp3CGjvEFLzxmCSLd5Y+04WxtlN6qi8D5oJol31troAUuDiuFgJbd9BPkmCzOls0nnttqf8NkmiZZsfgZ1yH+DpuVhLyvkXjmr35xqo+Ju9HVnZOmKtj5gGV+GibcuG4LrKUP+7LPyogpCD+Qry/eyiw4ameJc0jEYN0hcq2PTAWd07O4YH+JnRUo8YW+gnacr/bvt9g9gspwRtkD9omCXwihhnTQ4w8gVDhfLVCyaYYCIMVbgGAiPP+4C+gRI6SeWkvoX+XEIar7L9smZRSOXTDBMQwzKTYbWocxxEv267pqvFR6JahSF09k0a/OCSe6iXPrm0ZgDGsjWIcenHkdr28pNLqd/XYDxOiOr9svfSG/QDYANKHvQfk4I5fVma5fq5ghnQzNVW68FjfxNaydT4y2hbtNAnTyZoqPczRrmd/tgCIewWUAUdvAfcsUUjB+zRKAIJdenCykk1AdrEr+nleDLKO9dxxcWIjq70NGRpV4fa4RgVbEvaCB7zetS4 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QDHVw5/7CTUWa1ewzaurFy2zOn3hF+kRmPIKPRhdgbzJD/NixufGRLN1DYMC3CCfmBEeVGyl+vmZ7p5AUHj6TIBA37OUUS5wP7HZ5cywLKYM6sL/m1FCFQnFuEvXKA6rZwc2PfEQVukajTYWecGuqVzuE97HtJFH5aXrcxDXHOp0MRp3COdgdLzuTOPMG8vqHu4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Eggz95EVM27wrk8deu8TSlmLWrMm2QBBL2P2Qf8XjNHGlvDlxGI8/dYTgWDah71uhluLEJFVKMiPxl7nFuMrUdMbJh/nqEpEKglp07rku+Qs0jryTF5SmduM9nL7qt3dJlYyjKA6Tx3agq7CqDwMAZOk9i/Yu/UCCFjWi5Rv7rJfPvtiAvm7SR25mmXN5QCDzbL8Yqo7t49Xpo207gR1e+ra/1yQd0UWbkaM6KGl41jPh977uYYNuVFRnstT/c74Xn/RfSDQW1jWslapzwvYHDyoub2ChIDxAvjNAYvR91WxyKnBAMgO4+9ZwXGk/BXqa8Qz0orMautyG/vBtMTWVUvSW3mO37tbo= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: af728d1b-42ea-4aa1-6f87-08dc07894053 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:05.1831 (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: yReXaI2UADzQJf1UM1MYUT5Wtny1pMWOSDXtD9hVtyW79w/fxCPMXBzNgBMjWnbG5YQr/jSBI9BhEDhh2FYjyMl5uDPh+V8g/Facln3/gPc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 d5d87984cf..fb7bc5e555 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -773,7 +773,7 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix, bool explicit) { BDRVParallelsState *s = bs->opaque; - int64_t size; + int64_t size, count; int ret; size = bdrv_co_getlength(bs->file->bs); @@ -781,43 +781,43 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res, res->check_errors++; return size; } + if (size <= res->image_end_offset) { + return 0; + } + + count = 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 += count; + } + if (fix & BDRV_FIX_LEAKS) { + Error *local_err = NULL; + + /* + * In order to really repair the image, we must shrink it. + * That means we have to pass exact=true. + */ + ret = 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 = res->image_end_offset >> BDRV_SECTOR_BITS; + + parallels_free_used_bitmap(bs); + ret = parallels_fill_used_bitmap(bs); + if (ret == -ENOMEM) { + res->check_errors++; + return ret; + } - if (size > res->image_end_offset) { - int64_t count; - count = 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 += count; - } - if (fix & BDRV_FIX_LEAKS) { - Error *local_err = NULL; - - /* - * In order to really repair the image, we must shrink it. - * That means we have to pass exact=true. - */ - ret = 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 = res->image_end_offset >> BDRV_SECTOR_BITS; - - parallels_free_used_bitmap(bs); - ret = parallels_fill_used_bitmap(bs); - if (ret == -ENOMEM) { - res->check_errors++; - return ret; - } - - if (explicit) { - res->leaks_fixed += count; - } + res->leaks_fixed += count; } } From patchwork Thu Dec 28 09:41:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505762 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E283C47073 for ; Thu, 28 Dec 2023 09:46:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuN-0008Kc-E9; Thu, 28 Dec 2023 04:42:31 -0500 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 1rImuE-0008EM-D8; Thu, 28 Dec 2023 04:42:23 -0500 Received: from mail-am6eur05on20700.outbound.protection.outlook.com ([2a01:111:f403:2612::700] helo=EUR05-AM6-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 1rImuC-0008HI-SL; Thu, 28 Dec 2023 04:42:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RQdSDIroAWW7i85ARHJHgm67k8l64/CS2fIZ/47E5Oygj5/nOPvhKkwca/KCdpeB9iTCqK0CO/c3inEqgTf+KYdnVEx4VDUByHuT2sczzI8uHyGyoandN/SYJmDEyZd5LbxY3azkSCaHSYk8l2UDcL4UTk3kn2uq/4Rll24wsbhql1GOJFJIJ35W3NnwTNVt0Cw3gk04U8fkY9DXR3OOt+ElIR5AR+6U8rc5bh15npA3ySXM8lwd4zXqeQSHOtGkl27FIRz89pdPsfF4UjsyaCgtDodLijnRC/eaj+H15uM5sMWFn3aDkcpBpAkbLazefAeeYU5WaeDkIU/SWVQDtA== 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=KZh0tPQajn5ZVC76nM9sowYGAr0ImIhqFCdVs8qjAjI=; b=MkY3cjkDt/krKaEFuIy4i/acEiV89q20DRvhuZk7LnGUQwtOilOuuwOjQ0wn8fOjVzdQJdN2tlxQiQo3iUrHaAR655cvjg1+ftpYj4vj1IqZmbp9GIC3Ou3DACwaqCK6FwqJXyprZg1QfMRaYos2z8eEmuCp6KwRj8De2UEF4nbd+HH7WDOm1EKq90Vil/FHegRrB9bFY7BjXSDPq/HXq56shAN8+MNdf5UiPiHItRe7SvjQmcGD0thQb4lVLOCt+pH7dnds3MKCeB/f31+X6pUTkJOOqppgtTIPJH+lNDbJWTJ962j5RciXetKcEY8GTv9wf2RKGvCKpw1CVGI4lA== 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=KZh0tPQajn5ZVC76nM9sowYGAr0ImIhqFCdVs8qjAjI=; b=DX2m3OtuUX4hNeSznkvqGQquEiWfKWzEqprWHEQUVpz9DR3Op32zkgFeCqqKRkksjv+ZL/zvU8u2ICmcEsK6HeXpmZj5vnxqxg6bu4ZZ1D2Wde6K9LgZvFXAzlpUc7QG987/6hCXXmkse+5tGE8WBJ6hrdIO9DNgPFkWvzLP6w2FQHGVlL2QU2PVTHl14FfDfz3xkjBogkYtjXaDoMw3pc6adtjgK802C05fqrBgWiBTFeVVK0ojC+CS4v/Znmvd9KbS02ADqxtJUKkYyOpw6V2rBN78jpI2zH1S5WcustUCSk+lHQmAFogMPKn97qXVM3enofB0qOcXkdk97bDHsA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:06 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:05 +0000 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 16/21] parallels: Truncate images on the last used cluster Date: Thu, 28 Dec 2023 10:41:48 +0100 Message-Id: <20231228094153.370291-16-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: b06bdc05-2f40-4b8e-8141-08dc07894085 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x43434HhDgFPuJqDhUy9RRYFnEbvHnaMFBogFXMvJW67wwtKGHy1hW38ti0ji4jcOSYXHda/dCPutRF8Kz7gR/iNQNZJSBIZV3dm1mK8V0DP67t7BMiQttSKXcH8+DmxRkMLC8wbeMlDcxA+MJrvE2G2wJxtYlJjJaB/lywZuPqK85ioTkASrCahcP68UeRmVEcBbqShG9/cZrgUtdKVSl0VAIFJu4Z9yqp5SlxSqyK58e3eMFArVjXtex0hie3IJ16zo6syHrY7to7YpUijMoCFtWgsHayP0Fh7RZwChYxFVQFAZcOAAzUUgvkn4wAg1sJAX88yLq+tfls2dIspNC2p5uTsXe/N3eZEIWafBezzbQ0mYEsEKUVjnqAJwRxxZ2y+42f/6DfDIJSU9pv+GiyUHaKISiUNVZrLXjZFhGja35fs0n+HugaOc7l2XRWrLn0p3DDz8HyjYy5Gie/JOkRzyFkBmBU3AEtNQPq8uQnCPeWRZmA7unydZEOIVLXYjqhkhyaDt74CM4k9yzXHXrzIpTmNT7ENNPWekd8zgG2pwCQvcgjsWpYm5wxYbBpMXTwyNsw2Aaaw0XZ5r5e3FHvfCvteATaCsfSwRlMqpbMYXruS0nM7AAVuNkdGfpPS X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: v2+1UI3oEGzLKNLiGC4uIL74SOCTXlFXvPfBobErSzl+pd9Q+QRViIrzB9sez4zagDWFdaWbmjfmk9IuqM4dcYu/qlFVhuq7pcFiopwWrN+BKukV9SZpWR45pp+eai6lwK55K6txYdzVXUIfecCnTG8zbHRoHpuyYWq09+gkceGo0ipPtcXDhPIG7Gq6JhTfRu5Y+KHXichlAEsQAMz4NeKPvWM56wJYIJx1R+8SGfhtvuOGAjB7QPL7aBQ/ywuhh7gkYledgaB7tLO11S6WS6iXO8TDRyO6UmPDoUHqsBRbAjBRgjnEoKtjmg7T086z4j3gNoelBstEVG0NV+YzlCrVkxryVsp9xB+ZCWZyl1J1NguEjGQCWWMX/iYNEeR8KemseSk7JeOSdaSifDB64SfV87Xn5al9R7b+6ZFynbnKU/10UgjK1UVHnZVcfGRNAPtLlLBuCh5hqycvUWAKOtGQ1t30Utqop/Aep9hz/v3Bf3kMqp3UeS2w3+ajfuTRkTKRRK59wuZOa4GHWKJFh+s6o34IuF3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0eyhevtnZUPQjZC0Y/JbfUDcWEk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b06bdc05-2f40-4b8e-8141-08dc07894085 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:05.5178 (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: JzXiANlSjw8yJHValutr/osJSsXpBre2VhXUe8PSTPnB8qQ+BIXg+kcNzv0E3sM+Lwi6RGJfgRI4lPp3aZI+P4LWHYikC0ZS/9f4c8h4V20= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 fb7bc5e555..136865d53e 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1454,6 +1454,23 @@ fail: return ret; } +static int GRAPH_RDLOCK parallels_truncate_unused_clusters(BlockDriverState *bs) +{ + BDRVParallelsState *s = bs->opaque; + uint64_t end_off = 0; + if (s->used_bmap_size > 0) { + end_off = find_last_bit(s->used_bmap, s->used_bmap_size); + if (end_off == s->used_bmap_size) { + end_off = 0; + } else { + end_off = (end_off + 1) * s->cluster_size; + } + } + end_off += s->data_start * BDRV_SECTOR_SIZE; + s->data_end = end_off / BDRV_SECTOR_SIZE; + return bdrv_truncate(bs->file, end_off, true, PREALLOC_MODE_OFF, 0, NULL); +} + static int GRAPH_RDLOCK parallels_inactivate(BlockDriverState *bs) { BDRVParallelsState *s = bs->opaque; @@ -1471,8 +1488,7 @@ static int GRAPH_RDLOCK parallels_inactivate(BlockDriverState *bs) parallels_update_header(bs); /* errors are ignored, so we might as well pass exact=true */ - ret = bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, - true, PREALLOC_MODE_OFF, 0, NULL); + ret = parallels_truncate_unused_clusters(bs); if (ret < 0) { error_report("Failed to truncate image: %s", strerror(-ret)); } From patchwork Thu Dec 28 09:41:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 91075C47074 for ; Thu, 28 Dec 2023 09:46:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuL-0008JD-89; Thu, 28 Dec 2023 04:42:29 -0500 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 1rImuF-0008EW-AH; Thu, 28 Dec 2023 04:42:23 -0500 Received: from mail-am6eur05on20701.outbound.protection.outlook.com ([2a01:111:f403:2612::701] helo=EUR05-AM6-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 1rImuD-0008Gn-I6; Thu, 28 Dec 2023 04:42:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jixAGze8YCecFw2cprCCwAzsoL0Qo3ffmqFuSx4ozbgp8RKydpqnp2DP/bCxFHiWhKFZwkFB5UmzO/YPu/BQH2uXcaP3l0LJWNY0orypumLyjG4KBefeWEYQX7FHi6V+N1E7MgiM1uDVeVlX9CwNZMquK8hMIdiEpXDLNxd8xnqiegc/8311xT0TDQh7RQzwe1me+Qu9O8pww4T5jfCm8Lbt3zxAz9ebgKnd/gCdZyJ3SGlAHvrZua3k4xOs0GJYT4xkejVGi8az4S+P4/0j44eJmkr6gOvlPL8z2+W4CNBkWIFxNDn9cvM6kRYx5YQMJfblrRqjVI1sJslo2OTmWA== 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=U7P+uRNFOiA3jbxt02/V9W2Df0T3Qf9rsJ8x0mN78yo=; b=AdiW3d5XR6CCeahOABNBraze+R4xmW3F9MquWNWkgSNy70H4whpbks3i+7+2Yoo8i9Yo5tnvHyCKUJYM9q8U720gWd3d34isZE3ymKK4y8oK2lPx0qvhhhviPwPuDMKoJDMsrau7bTkqna69j1Wldbtozl7YLRS/iWNOK27ZR9dml8qfFSqp5SHWbxYQRztfAnQVUKVebJQP1bQS7fs0qaWrJJcRBnb1vCdnlaMbakfCvljZBec2cusTX9QH4q28yWvnAGvZB59y1Vl5TnW2Xl604t+s4qzLFspTCN5Rgz4dZv7CPtNjNo3xclKzMRXY1mUGgY6k3LhmfmQrOfCWRg== 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=U7P+uRNFOiA3jbxt02/V9W2Df0T3Qf9rsJ8x0mN78yo=; b=S9xu0G/OQKtKX665Lw2suQ+4bazNw5V2UrRtMr5UGZgMBXx4ODFlxuj97t1vXMxO3UgSq1mM/0AEED6mevYHxf/IWhxPAlkl2tbVjEhJdrmSAzAYMmYub91qQppGB27eEWpMhkgfkcIuexoHyVWXx+/HVrcVxSOKL0xrp1JfqIkoJWrQDOzwA90KwgFiDxoyT4ka5/nr/OXWIzUikCXNBI86cHYb9kHG41BcHnmvJEQgYuXxEI6tW1CeZCG/EDeGLYUjYY6iEocfrGVp1pD5yoxRgxXVwWnusH5txwb67dINwDHnV0nrqLE5L4bV9hMggBksXsxJHJFJ4TqmtiwpcQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:06 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:06 +0000 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 17/21] parallels: Check unused clusters in parallels_check_leak() Date: Thu, 28 Dec 2023 10:41:49 +0100 Message-Id: <20231228094153.370291-17-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f04ed68-809b-4601-1d00-08dc078940c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X38UxhNbuY8RJiqkdPmq68mMh70LwMcH8kwXDevS+vex8El4cmaDP5fNvhmT6R84Hy9bF53vANZmSf4rJXPj2oAi0ihzxju43sVC/QnEhqgl6ceZla1tpz55UEjbY6BDvAJrUrsktTXNxqk3TGgCyCliBD6K3Zs2LPN+J+smdpOR99V1Y72I1DzIVRZkAw9OuU4FUuvahFRpdbE64QRI2AHezC2QIUzducDGJIqkt/nEubryhd7Z/5ZXZJTb14VCGC5gr10tyk9u6j3BcKPlh1d9pWlgJXX+JPAPJjHYnuR7xuxJPo/Vu5awsHKXtq+WenKJiYRFU1XnfaDrfFR1c1HQMUJA2CZfPUpP3FrDAlKfeLYPS+iJlul9OkLG1b2DeHmsOkw7y01LDK+zhZFAEX9BBitLQx8quxI/kApKPTvkNmSY1kMKjm9qq5/V1dOQmtv6Z4XA/Rm7kosxXggKjEDMj1FkLDBSIATb8oEGDGwkuPv+NyhMrUb0vB5JxfmijchWFyg9PcM+bof7sfAb6eT1D1yNUvDs87ZCtvWz/Cy4LnSO5R15fmZkk0f1T2dl0gLD/btFSfCjJ1jWF/nj3YvOMQeQW+KVRLCFHFPn+q0SvaqhGCdT3UzvXTUrZwon X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1KYpXrGTXPLxBlZwAxJNV6eHRPLduY6gB6mQuQFYiWBsFPHKj3O1orj5Xw8eQ5jzIlnCIgqt77pQxXdojVkF2oaYBQbQ6OKJqGBx827oCP6gFRa90OoJ3lTzxCGsIgKpiACoyLDW9HolmfiSwSQridJu6ub435kdJbQaxxh+NBCOPp47pGFlr8xRvy7PpW/p3ngZSQZYHn7MhkFDrcanHdD1blANFCfGzkZCQTIbHy6Y9IKZwoZeJOfcXAOroZfgb0tsEto+rPeZDbneU1yQh3aYs6q2pDBc8H42S4Jk815ywL6XcyqbiNbbkcLa2B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0XXljdwj1TjcKXxsJ6movRekMsbrnTA6EHDUM1L4UnxXVsAvtPS8lUZKsCPKsOM0rV2KGJqkz3qQcqtJKrqwO8jKfHhqMIrwNTpZkEiXP9lum7+uX7s3/n/NjFRpnIZ/czTBCQU7JJQfLtmV0oqMv+FlbtSoMaF3oQRpPxxlDA0KeBopxfYcBSSBC05mMFZzOiRiywx6fQvJgJrdm6dps7QNTEnEGpddHMQv3tNK5EBElpFs7I= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f04ed68-809b-4601-1d00-08dc078940c1 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:05.9449 (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: LwOCb7UK1eoFqJ24HlPdDf9k7T41YLSF7dJY9+oX/U5Ufta0RWoeknYupl3p0+U8IN+0XHudp1BqQqwNyTAQSOu42GaWZJdQtMqheI7DFeU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 136865d53e..5ed58826bb 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -768,57 +768,87 @@ parallels_check_outside_image(BlockDriverState *bs, BdrvCheckResult *res, return 0; } +static int64_t GRAPH_RDLOCK +parallels_check_unused_clusters(BlockDriverState *bs, bool truncate) +{ + BDRVParallelsState *s = bs->opaque; + int64_t leak, file_size, end_off = 0; + int ret; + + file_size = bdrv_getlength(bs->file->bs); + if (file_size < 0) { + return file_size; + } + + if (s->used_bmap_size > 0) { + end_off = find_last_bit(s->used_bmap, s->used_bmap_size); + if (end_off == s->used_bmap_size) { + end_off = 0; + } else { + end_off = (end_off + 1) * s->cluster_size; + } + } + + end_off += s->data_start * BDRV_SECTOR_SIZE; + leak = file_size - end_off; + if (leak < 0) { + return -EINVAL; + } + if (!truncate || leak == 0) { + return leak; + } + + ret = bdrv_truncate(bs->file, end_off, true, PREALLOC_MODE_OFF, 0, NULL); + if (ret) { + return ret; + } + + s->data_end = end_off / BDRV_SECTOR_SIZE; + + parallels_free_used_bitmap(bs); + ret = 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 = bs->opaque; - int64_t size, count; - int ret; + int64_t leak, count, size; + + leak = parallels_check_unused_clusters(bs, fix & BDRV_FIX_LEAKS); + if (leak < 0) { + res->check_errors++; + return leak; + } + if (leak == 0) { + return 0; + } size = bdrv_co_getlength(bs->file->bs); if (size < 0) { res->check_errors++; return size; } - if (size <= res->image_end_offset) { + res->image_end_offset = size; + + if (!explicit) { return 0; } - count = 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 += count; - } + count = 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 += count; + if (fix & BDRV_FIX_LEAKS) { - Error *local_err = NULL; - - /* - * In order to really repair the image, we must shrink it. - * That means we have to pass exact=true. - */ - ret = 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 = res->image_end_offset >> BDRV_SECTOR_BITS; - - parallels_free_used_bitmap(bs); - ret = parallels_fill_used_bitmap(bs); - if (ret == -ENOMEM) { - res->check_errors++; - return ret; - } - - if (explicit) { - res->leaks_fixed += count; - } + res->leaks_fixed += count; } return 0; @@ -1454,23 +1484,6 @@ fail: return ret; } -static int GRAPH_RDLOCK parallels_truncate_unused_clusters(BlockDriverState *bs) -{ - BDRVParallelsState *s = bs->opaque; - uint64_t end_off = 0; - if (s->used_bmap_size > 0) { - end_off = find_last_bit(s->used_bmap, s->used_bmap_size); - if (end_off == s->used_bmap_size) { - end_off = 0; - } else { - end_off = (end_off + 1) * s->cluster_size; - } - } - end_off += s->data_start * BDRV_SECTOR_SIZE; - s->data_end = end_off / BDRV_SECTOR_SIZE; - return bdrv_truncate(bs->file, end_off, true, PREALLOC_MODE_OFF, 0, NULL); -} - static int GRAPH_RDLOCK parallels_inactivate(BlockDriverState *bs) { BDRVParallelsState *s = bs->opaque; @@ -1488,7 +1501,7 @@ static int GRAPH_RDLOCK parallels_inactivate(BlockDriverState *bs) parallels_update_header(bs); /* errors are ignored, so we might as well pass exact=true */ - ret = parallels_truncate_unused_clusters(bs); + ret = parallels_check_unused_clusters(bs, true); if (ret < 0) { error_report("Failed to truncate image: %s", strerror(-ret)); } From patchwork Thu Dec 28 09:41:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07770C3DA6E for ; Thu, 28 Dec 2023 09:45:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuO-0008Lc-9G; Thu, 28 Dec 2023 04:42:32 -0500 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 1rImuG-0008Ee-07; Thu, 28 Dec 2023 04:42:24 -0500 Received: from mail-am6eur05on20700.outbound.protection.outlook.com ([2a01:111:f403:2612::700] helo=EUR05-AM6-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 1rImuE-0008Jv-B3; Thu, 28 Dec 2023 04:42:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lRGmKrhgqi5KsmL/LqtyPHp01onm92q53z3s1ciPFERuz7/ahKuXSxs7TcLDiNjkeBWNYChRYug+2qGUAlkn/W/5moggNeTARgxAK6xPsHmXkrai0TP8qZbiy7/O+kjkuzL2SwY2cmsEoRJ2BswNXb2C/6BpDYrzrP7H/CGH5dyfWC0ekkdGdOyGXFfGIx48hRj1kfw2E5Cyf/j6+1IKG/iEKNweurTw6eOF8YhIBkY5S6D2jrFAQBaFvh/V/m+HloCvmE8EQfWyA4K41aRwvcItaSWGYovyhWi6kYJ02TCYWXh6bzWglX+UzzozPN+W2GGHIDG5pejpwdV09/8KUQ== 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=XaAGGTbyMKywUXOYFWi8PjBTqSV5La+m5rxkBDvvPoo=; b=E1sOvB2Gz0P5s2bn3NC9wA8p8/SKcaPZW/YdA5oA+EcQtac0bVuvT01lXBkKGeWBp56pUP3odKg+CEspE9Nt0LsCKJJxeZKc50l34yzoTofoK/+wKO/4leaXeCzcS9ufwmBpjbTKoaAU4chvSgXBeK2sNGtYcE9pYh71ZQgpb2qK6QIrrk2bAERtnipHY/uJC2+RplbYQ3ho34afSD+2dGK/JTqeMClg2JU9K+cYnjnfLbXDarb2wt2+zroVdwcwSaTL4FEZlY2VKl6hR5/HttXUYs/+lb+5RjgfbXZMX1lz431FanM39W9efjGDC5o/PWMCnYkD9vHSQ8Z8keC14A== 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=XaAGGTbyMKywUXOYFWi8PjBTqSV5La+m5rxkBDvvPoo=; b=X2EDjEqc3rPCqQ9mVG/HEp0nPwA6RBQUh4T/hHsL8fH+OWUPqjr1KZsiRYIMOwYbMv8xeb6PeZXKkyWEjSRfyDWJmEVfFTNxlsoXvqyUJvMrW1Mec9OeFHAiacQedepHdoP8hntuMnBK9INpgo8zyLXpnN0iXR6ODPmqauCax0pwLkxYC+squqSdrnv1IgG/33itFTEBE7SSICQG6SFX+gnvh46nC7fHe1ymuMjcrSj34ps4BKAnTuKSbeihP5zj5mxSjHQzl7DUtVr+HSjiEi0r+8kmB89sWnbf5JczNn8jAVATvLN9aHDgQqdKkMFS8qi/LwUgrr1R5gu895o09w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:06 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:06 +0000 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 18/21] parallels: Remove unnecessary data_end field Date: Thu, 28 Dec 2023 10:41:50 +0100 Message-Id: <20231228094153.370291-18-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: 3f6d86fd-e60e-4fd6-f396-08dc078940f7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2H7PlP9DMqgWnWh1lpFxxLbY+nyTHGTAIwv0b6D4doPdzkYbNM0kCHQSxJgUliuOVTjJMy//CIXK4yNYLUlsk+6baNXieCfcyeu6sov1TuuqI8ZQEMmt8LTQyDihq3twW5qAlTCdd7RTzySibgqcG43vU68GvniyAs8z7qb6iMRULCFVo6KCLMWASdXUHw99XjYiuwHVEcTX44IjNkblhSlGbuRDnDnrfaCLTG3lF6f/DftuuR8LR6fe6klmxFpYW55UlYlUkIunM17HoOK9Mf7TtQaWgxCVHrKSA/pZCKIF00QjHHUaUKcpUs2tsO5gXCxcia5ckhfoVw0X8Ewrnecz/sXMjOMRan0f/D8hOnYuzZomUd5VekRsKvF3JgfXOERAZRO+nACtfxyXtzAxEmO/fsrbDhIJtlWI9MCBfWPVR0toll+6SyUqnBw6oT29HczJagTHUqCUOVsAy0C5Od4fZP/zgHDxx66ZYG2eyLuMn1/waNNs++XtaaM616QkALC2NG4YaS5oB53dyH5ZXhA0+g2yURp79kGkJPj+ouHapG4W4fp1c8SXPgmXdSWjE9SC1AT1XwTs0hmwC7ybuqFDFEbEvzQ7g/vVno2BSPWWvRVUzGryuTPXcSefbXbc X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: irFCFfTQ5sJanuX4VaE1kbTL7NQidYiHEhTXSwD2tGJfqm6qEEEmWOFMt6e6ts+nd8HC6euQAcj/srHdMtjwN9FGWLXQLJoYrB3qMKhdt9+wRTL73bnFP0DLrRSuxSjwYGsF3KHNCbqATxap8kKl6PhS7C1zRL6lEb9sxW8AueDr/R0olafx19/xYZ5cL6KRLxj36VrcWUbXC4NCAcD+wJ9A+i8RHNcvsV/BQo+VziyzJdAvYJZiXeaJ+2Vyc+JoJY1U8bFKPeXFRMWL0cApg0u3PVxknFWtpgFljACJW27wkWmrsjzO9R4STzSk1L0tXH6W290JXq6dtQ63o7r7qIY2l7zhMF5E93rN/xa11e04leD6Q4vc+hDkI6N++Dih8bDOmuyj1nuHfUbEjb2C28dy8gRhrdzGlEq1LaS/gDdBP3zKw9opPKibCMKUGRJMi8PKwyI3RG5pCxjlfStiuNf0X2ZrmvYyBN7G75g60btY/8mDg0vZk3qNLACns4L/Md6ei2F2MC2KKS2heRzwSMxBZZigRcICi5Z6A/RyhMLDFo2ITy1d4Qel0oe12pGlcCdZAWmXq9cdR5HNPFE9jl92lpYfqVxVASswMzNBmx7D17GrLpn4znnnEYrw9074uLVkPnLwRuo79nvxMf5HlsPh7Epj20uvpY1siy1kYcEyk01ZAn3BUe20/Pne++cw0ZCc8B04M/IDVfiFmw35JrFR/4ApwUJTRwhlMz3qhs3mRjXYLlGTR9fQgYLxYzRwrzYOebfggqgOCVUh+Khu/HUXoYRavHhrKyaUGP75A1ZINQPVfCAxM+R6HPAzLOUP2ay4Zc8VCuW7jGeWr4OlHyQyE+WVTxCiS7jy0GOlPoxYS1IrIj280zWmnuD371QbB28vdZM56PJRkW2B4YKrfWpnfQB/waFy0r9wzuewgcLJ/jjvHZacuZTiPzeAX7e5WipCBKfcIB+GGPYeAklqwcRBK7h8RLWmdpJQXkYO/A1Ol18GgbDkkAhRrw6+qvBbVk/7D5HU+yKS2Y6GgynK+IdlGFNcDBZcmpBG+XmrsLGRD48Eqev2/k5jwTL/xIkneLzDv01U8SXwcSyglJTP2krlEvJhrKS4JtQM971PALm2VqX1+Tn8ituYybu3tlTyjCrs2JNPBo8b2XyoQPtbZOgLwt3VsoUMyk7fzpz18GGjC2ZJlenov2o/MQ1ddOXyKiDKbg3yHfjl9xAmLj0SzKVC5zRYUWDc0HEd8HkW6o9dg764AASjnmI+SapJkmThBL02yLkQwddOZflT1RgjibpPErXTx4t1Qql7jxdrGU9BJHReh1KGHO1+5hRnxUxXoYZvz2TN8azB2dhEZW4CN909iJ1v0IkZgBt3BwO4Q9lQKXkQ9PTxBB6Q6j8nYUO2LsKucj6rezBTSMprvvpJ6nhqE8hTb+3nfSDQ1crZ6dP4qyMYZIZha1YYTEpXWgVSIarmk7dtSqLqWTWQ1uOu8INiJHjEhGKrGp7cXG/8Z8rajhxEFLV3r9rPGlS8WBhI0ciUiZi+sMgBo5yj7Ly9qyZ5l+ajb7U90t3BEdVufXHiEhyTCbAl/u/7hokCc4KG6NyaY8yclY11AiuXGFonP6a6M3jIMWpxfa62W71wfA0= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f6d86fd-e60e-4fd6-f396-08dc078940f7 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:06.2874 (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: A71pjuCg8zqj14QYu4hyS7ncQBFrzMUzshhPBu517NoWofwn+uuSWUxDR4D38TmSv7HUGUJlVXcF8NXhtn2G9HGienxGMoEOmZIv4ZidUHM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 5ed58826bb..2803119699 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -268,6 +268,13 @@ static void parallels_free_used_bitmap(BlockDriverState *bs) s->used_bmap = NULL; } +static int64_t parallels_data_end(BDRVParallelsState *s) +{ + int64_t data_end = s->data_start * BDRV_SECTOR_SIZE; + data_end += s->used_bmap_size * s->cluster_size; + return data_end; +} + int64_t GRAPH_RDLOCK parallels_allocate_host_clusters(BlockDriverState *bs, int64_t *clusters) { @@ -279,7 +286,7 @@ int64_t GRAPH_RDLOCK parallels_allocate_host_clusters(BlockDriverState *bs, first_free = find_first_zero_bit(s->used_bmap, s->used_bmap_size); if (first_free == s->used_bmap_size) { - host_off = s->data_end * BDRV_SECTOR_SIZE; + host_off = parallels_data_end(s); prealloc_clusters = *clusters + s->prealloc_size / s->tracks; bytes = *clusters * s->cluster_size; prealloc_bytes = prealloc_clusters * s->cluster_size; @@ -302,9 +309,6 @@ int64_t GRAPH_RDLOCK parallels_allocate_host_clusters(BlockDriverState *bs, s->used_bmap = bitmap_zero_extend(s->used_bmap, s->used_bmap_size, new_usedsize); s->used_bmap_size = new_usedsize; - if (host_off + bytes > s->data_end * BDRV_SECTOR_SIZE) { - s->data_end = (host_off + bytes) / BDRV_SECTOR_SIZE; - } } else { next_used = find_next_bit(s->used_bmap, s->used_bmap_size, first_free); @@ -320,8 +324,7 @@ int64_t GRAPH_RDLOCK parallels_allocate_host_clusters(BlockDriverState *bs, * branch. In the other case we are likely re-using hole. Preallocate * the space if required by the prealloc_mode. */ - if (s->prealloc_mode == PRL_PREALLOC_MODE_FALLOCATE && - host_off < s->data_end * BDRV_SECTOR_SIZE) { + if (s->prealloc_mode == PRL_PREALLOC_MODE_FALLOCATE) { ret = bdrv_pwrite_zeroes(bs->file, host_off, bytes, 0); if (ret < 0) { return ret; @@ -758,13 +761,7 @@ parallels_check_outside_image(BlockDriverState *bs, BdrvCheckResult *res, } } - if (high_off == 0) { - res->image_end_offset = s->data_end << BDRV_SECTOR_BITS; - } else { - res->image_end_offset = high_off + s->cluster_size; - s->data_end = res->image_end_offset >> BDRV_SECTOR_BITS; - } - + res->image_end_offset = parallels_data_end(s); return 0; } @@ -803,8 +800,6 @@ parallels_check_unused_clusters(BlockDriverState *bs, bool truncate) return ret; } - s->data_end = end_off / BDRV_SECTOR_SIZE; - parallels_free_used_bitmap(bs); ret = parallels_fill_used_bitmap(bs); if (ret < 0) { @@ -1394,8 +1389,7 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags, } s->data_start = data_start; - s->data_end = 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... @@ -1436,11 +1430,10 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags, for (i = 0; i < s->bat_size; i++) { sector = bat2sect(s, i); - if (sector + s->tracks > s->data_end) { - s->data_end = sector + s->tracks; + if (sector + s->tracks > file_nb_sectors) { + need_check = true; } } - need_check = need_check || s->data_end > file_nb_sectors; ret = parallels_fill_used_bitmap(bs); if (ret == -ENOMEM) { diff --git a/block/parallels.h b/block/parallels.h index 9db4f5c908..b494d93139 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -79,7 +79,6 @@ typedef struct BDRVParallelsState { unsigned int bat_size; int64_t data_start; - int64_t data_end; uint64_t prealloc_size; ParallelsPreallocMode prealloc_mode; From patchwork Thu Dec 28 09:41:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505752 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D051C3DA6E for ; Thu, 28 Dec 2023 09:44:27 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuM-0008KQ-TK; Thu, 28 Dec 2023 04:42:30 -0500 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 1rImuG-0008Fk-IT; Thu, 28 Dec 2023 04:42:25 -0500 Received: from mail-am6eur05on20700.outbound.protection.outlook.com ([2a01:111:f403:2612::700] helo=EUR05-AM6-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 1rImuF-0008HI-0X; Thu, 28 Dec 2023 04:42:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gu/fZsASy0jyqFNVIr3mvGIKnKnogr6bPHpkBRJrjSdpPJNbMcX5gOuY5+ae/TeLvi2/HklgH2ycRzrhHtBgK4HDJwUH2/G0UU5QTo5kansLa+UPkv7u0On9E1mIXQH7KBWCwc4BdOjroPyS4K79PSy8BzNafmDKkWTL3wGBLBBWstVMrFi4jDtJpiNO3y3+J3Qsgrs8NlOzMGcBohxeyRmHDoWwCzhQ3x6SDk4trg0eSn4UesYh6VLb9AmEod40qedMAWRDpnAyGoH4B7ZrU2Kpon1rGQHZhoi1gJCcjm0dUmAS3wjDyyOCl3KzRDSzmP0VoPZc9AVcDcQsOtBrlw== 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=Iutxc8tg7YChZVrBnNEg2aHUVzHlrCXYIXjWGG/15z4=; b=E0N/Hn6PjV+qPcVa/TFW86aOeKmH58KThJ+sfUGo2CBKmE87OP4ESvnNKQBjHIpKJuyLinFJCy/cxFc95myX0ygn59N3vMMLxkWfy8DRPMtL/Kn8tssH3W/bkB+UfIkdG7OeKs10KQeblTCbXtq4zwp456xEOrBPNKRawmeXcmW+KzCbDiDKsC+66xB1a1jBu51tmtJcZZk4BBJbB/QKKGnL24IGpsy+8Z/1HOjhvE3necZoCGrqYR5ejfu4i3tM/lD7qGAn+BR/pFsLPHqu5DLChK2+Nl97T53SUqWb0uy0hzvQEpMLRrST0Cysqs7AMQVF9uEKxHdG+5oYqMMQdQ== 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=Iutxc8tg7YChZVrBnNEg2aHUVzHlrCXYIXjWGG/15z4=; b=vqoBqp9N271ZEoK3TigCCS6gtR+PR5bhJVtrgrIoWuhvuO9H8e7SoDsX0I20q84MHFipWAigeeTwMuztwKRlDDo7Lbcvq63CDVDyzUSWPD8pIUAq9kIwO6buDOzUfdVZIB7BE2Xc9uYgrUTB4HntyiK2f5lffx+il4t6YnfUEP4oupkHkUec6gBCuVu+zIimXn4KpJhMtMVAEVTMQoPBVgnwjFRFHrEGy+oh7moSL+KEq8bep9sKHrUCRya8O4x+yzZRW1mvy7fvWBqi8nJwvDNWMdxEzDL34TP9z0ZKqQgielw4lUx4YMD7IMvMl9El4YO5rn5uwUZ0BZ7JmujuNQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:07 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:06 +0000 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 19/21] tests: Add parallels images support to test 165 Date: Thu, 28 Dec 2023 10:41:51 +0100 Message-Id: <20231228094153.370291-19-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: e053e66c-cb63-4568-6806-08dc0789412c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rwakORyIRpGnAnJJitPNeuESWqSoDdtL07syOKjgjjT/uZA/leagx71JT0Wnp9jiDhpaKJ62AxtFbXq1Y+IUMXkJWG3oqlIRIbwX6BO7OObOCdKFriTXczQLL1z8ULnlUN2HLpj9Ak5eAEMDeUuTn6i0JVOkNMzSeq6JxdB3mQjkzwagE/c3gAoxKTWoKExsB488CvElYCKqrGjaggnZCiKDW40pqQ+sIwmPgdspOb1yGQbR0i2pIwW/Fk+TI7e3dGKsTn2m2spaqFC0mIZTqGC+7ps1GB+d+Uuq9I5L9OxIe1+TsyWvGnQx11QA1S8XM1Bj3Sj37MTVwONYWtgKnyXyffbGbQ2hHgtSJ7s6LZvinKfPQd4OkSu3PSSx6tvczBNsAmhSaKfeDoMPRVY+5kmK3LzAc/p8jULREy20wIJHpfDQbO/41Ow+rSA0IhrZEdRxwRD2G/X2FcUBnhCen6eE313NlErM4eW3iP2DmXECv3PNmw8q2NlGF12uQTyXvy/01XjAviB1qvVoCqJuJ0cRTEPvLZ/GUjNjwmytE5Y8BFhKxu3noe1kMjQEQQSUOM44As3puMoWmN23RJcTPBmuS1icxTUcOPSIUjGLTNIBlgQCkaqjuvjyAMuey36K X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +eBDspf8G1rVpxhH7gI7YAMDWXOXdfWuMMREd9TECAaYHdM9rm/vfoLohQqAPlF/PJlmdQoCMnZTGClDTyUQuUR2vTK+N7BGq1srsRp/FQeuzmTo/Pi6o6sHz4Mc2c3r3Ho2/CcbNRA27yEsGxjhpMzDbMbkG7Q/aFtvisBinx/cm+pD3X4XF61Iiq0cDkYCHiWuwrYcw1trvlcLW0GUH08VLIqaaLEqZibr51c050eI7kFICefusKo6dtS+VqsX2tEoXeTts1mLfhvG6QVNH7oevOazScCrQR140Xn85auNRFndXXdADztj9bVu5gSm49yESyXxyFIiPeloRsIUf7vPO9fBDvvJH43cRmsSsH7BjLAH61ye+DaJ3DFFrgoj5+vdhHSqfNSSKyGk/RFT4bz7iP+izmzJr5bqmneM2Oe8Qg1egBo9ls/XOGNYcrcSih4MG0Kp0CI3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PY6z8lwlVrbAmmVGBZ93ZeM/dkZc6mAX3Ls9hmmn7KIhlS1tpq2CgUSPlItdLRRw7b1isMtucJiVQvfjnJwkrx2uJ984UzPwE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e053e66c-cb63-4568-6806-08dc0789412c X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:06.6625 (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: 5sjE6w92we8XX4ywoeZYTtJEk64hzkfvZqLjLhoGUkVXEDt6B5zd0BpXs84etYkxMZZSQGHvQdg+xPKmsIaBBVfXM34zgUHllFSUWAfoKZM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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): def setUp(self): qemu_img('create', '-f', iotests.imgfmt, disk, str(disk_size)) + if iotests.imgfmt == 'parallels': + self.bitmap_name = '00000000-0000-0000-0000-000000000000' + else: + self.bitmap_name = 'bitmap0' def tearDown(self): os.remove(disk) @@ -50,12 +54,12 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): def getSha256(self): result = self.vm.qmp('x-debug-block-dirty-bitmap-sha256', - node='drive0', name='bitmap0') + node='drive0', name=self.bitmap_name) return result['return']['sha256'] def checkBitmap(self, sha256): result = self.vm.qmp('x-debug-block-dirty-bitmap-sha256', - node='drive0', name='bitmap0') + node='drive0', name=self.bitmap_name) self.assert_qmp(result, 'return/sha256', sha256); def writeRegions(self, regions): @@ -65,7 +69,7 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): def qmpAddBitmap(self): self.vm.qmp('block-dirty-bitmap-add', node='drive0', - name='bitmap0', persistent=True) + name=self.bitmap_name, persistent=True) def test_persistent(self): self.vm = self.mkVm() @@ -117,7 +121,7 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): assert sha256_1 != sha256_2 # Otherwise, it's not very interesting. self.vm.cmd('block-dirty-bitmap-clear', node='drive0', - name='bitmap0') + name=self.bitmap_name) # Start with regions1 @@ -135,16 +139,22 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): self.writeRegions(regions2) assert sha256_1 == self.getSha256() - # Reopen to RW - self.vm.cmd('blockdev-reopen', options=[{ - 'node-name': 'node0', - 'driver': iotests.imgfmt, - 'file': { - 'driver': 'file', - 'filename': disk - }, - 'read-only': False - }]) + if iotests.imgfmt == 'parallels': + # parallels doesn't support reopen + self.vm.shutdown() + self.vm = self.mkVm() + self.vm.launch() + else: + # Reopen to RW + self.vm.cmd('blockdev-reopen', options=[{ + 'node-name': 'node0', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': disk + }, + 'read-only': False + }]) # Check that bitmap is reopened to RW and we can write to it. self.writeRegions(regions2) @@ -154,6 +164,6 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2'], + iotests.main(supported_fmts=['qcow2', 'parallels'], supported_protocols=['file'], unsupported_imgopts=['compat']) From patchwork Thu Dec 28 09:41:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505749 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 48AF7C3DA6E for ; Thu, 28 Dec 2023 09:44:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuJ-0008HO-Ax; Thu, 28 Dec 2023 04:42:27 -0500 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 1rImuH-0008Fl-IX; Thu, 28 Dec 2023 04:42:26 -0500 Received: from mail-am6eur05on20701.outbound.protection.outlook.com ([2a01:111:f403:2612::701] helo=EUR05-AM6-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 1rImuF-0008Gn-Vt; Thu, 28 Dec 2023 04:42:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mu8HvYc3aPyxkqjLhhrgejWwogcXFAClkQ7i9VPVOuoeJbYgols21wyCYiTmjyK9OeIMTF66IFqq9dJnoAlgWCbvi+8VZdRbNXiLymMH4hoYdwTZjOQhy4chia3V2CrmpZjGLLVbELMilvUC9aflmMIVOBM//pMGCQYpI2sQaOdN85ykWaL/A8Eib6mJTdFnkhRrCOQocGwxDuRmpbyyIpB54/1kygVQfNIPaj+4vG+NYh+nPpsEDk2AsjNCKraAelv42kB5ZF7haZq/ecz1+rGe+mWDpZANJwQa+8ZCsxMaMv0EKNSkkPJ4xg3pQGrbcxb+OyW6AMoODXgoJjPdLw== 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=ylUSNpntRN+gDmFyGythjkA4Aww04xqGG3xhlvzvfEE=; b=bxkLj3QAx5PbgonCGTHYa17f5tbbE/cAGebcHn4il5qWfIAZLzyPRttSkok8yN4RJrtHXZb+1El6DxRCX8LjKuzV9p9oQaup+9dR6fjl9H1q0cvJW1P12i2EhjPkgH8E7e8iZFJyqOI55k/B7iPXRho8dSCU946Ky2tRU/tkZY2ih9UwbU0/5Dpd8PlOMm8a9i0yJundlR2i7uu63GgH6khh7bgK5Cyxcyx5XK7tyDnzw1kC9I9xyck5Cd9CL+U+Rd3RdHv3Ejv2lJoVYgy6jsrMoAui4c3I/WvlbZIyYBcfjx+FJ4PtMS5ZVqi/1+T+ZXrAXw3fqrO/DPNBAhqj4w== 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=ylUSNpntRN+gDmFyGythjkA4Aww04xqGG3xhlvzvfEE=; b=EGkBxQnOTXDeN4pxJVPRA2ne3whn8T4JOLfZm6RPbcDn8UVbEacRP3iBneIZogTutUP89o6ZPtbqYvP8pZPbD9JZza1pGVuLnRtM8bDzDZMdOuykWBAISOKce8sUE7gEyVXsUiCOzjX3EDZ4IgFdW9CWIvXoBaXnxMklwolHXmdtrGgtzxa/79i0eaknTkgqaGLrxZgn7wQXItIKddVFNAjrAXxDpWCC33nOMq7s6GW91Q3GAjhqaLdD6WQ/IG0oqlY9kLSHnkFQyOF39zHRC8K7vY+nd4sETLI+yt4onnudXHDHkjJuZMnmjVKSBFvf8NtkiuD/KF14yQUgmcvC4Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:09 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:07 +0000 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 20/21] tests: Turned on 256, 299, 304 and block-status-cache for parallels format Date: Thu, 28 Dec 2023 10:41:52 +0100 Message-Id: <20231228094153.370291-20-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: 4285f885-9a6c-4f31-2ac8-08dc0789416f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NOlTWkGCEmYXMyS052ZZXajd8O+8sN0sda/AbiSr6PflnZBzzXXoEnJsJuqyyCRQgLOQpBfVLFxON9R3hlMzw2YFpoanuyFLN01r4Bw25UOMGCbwGD1mVzAIbfFUKuv19WQSR9pPFHa0DAQLr6MoUVD6EJMj+K185ZG8ix3WSmwRgKhHPPBW7gG8SBtMFLCjsrN3RI0atzdpsnhlsFC/0/TjpL37hwhdg3eI6r1ENwcvW0BH3b65pznpqakgyYUgcbMn/g081XugK+2B2zksaojdYZMhzJfHk28hOKwmeYmNSR/7/b1OpZIV9zz9ouqAJ0WtdQ9pWnmM4JVx95B8PnHqS7lRp6P3lBspUtPG7soFDfAuy3Mc0gGcZ0tv5wQXXVl/CqllWfKL7Tii0JAfQ4gNHxY3qwfEqKNOgrxJnJBT91dzIGbRbPTbDaCQT03nn4JvXgc1nxXAiH53dtWb8lsoblohyKDngW/DZMvM9wOa85b4sD32pSlWFxKAoNR2aUJpKLbjoBSdZAjdpzhXP0/HGYbmFVFz/s2fPcADFvEvISKdbNoZyWIW8LL7LPley1jkQM+dqoQu1+poF2dKeOFnEOdoO8wowiIFoDieAICWAb/UdMP0RoMTZcWSsECy X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: p7VmP8xA6+JI+d3ePgdj8XsNY6H7/fSRMcNumvqsBWYl1LU+n+e/yiLGj+QTwnqxZ3CbBu0UlDotHj818CAdO8ZW7aW1ftmif7cFUjG9MPi44M3gtlmHUUBtrPuMJ3N1JQYXJwrPQUEbyspP6ybr1pxxz0Q8MbPocZLQWyodXGG42svk/ey4xdntbcUHDqPLxo9Bhyfyh2jmsWwLGH0Tpipq84G1Ej+d0dQx943dfOAGAnkb44JjnICSRHb93tqqHx4cq9Bozbys5mbZJ+U2f1ebcpySPQGTHd/up4fSlUyJFRetFjEq8oMTj4dOJvQHmds85pvCqKpFnQ2ys2G0UY+Vnt8NsI3QzuI0l8/Cf24zLWyetAqTsNDAn1QhjPgV07Zzxr0bMbXX2+EoIvaLgSWxffUbFfNYGMgepk6NEvqTN4FVvdEIJhNuWqaF4wuojkgUAwU5s6BNIzrO2JabdZGk9iZt3ZC5O+K18h44CIYHSUh8nC8np2IXBz02DhBKQzSebwhrDMZ+QJ5OQNRTSS8g2GKfYANUASdFrN7uQGDEmh0JrZPQqy38kOXPHvS/xJLtVIZm5xTm3s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ginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4285f885-9a6c-4f31-2ac8-08dc0789416f X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:07.1675 (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: rPO6otOkys06TCajj0feGz8d+uRK2Crw9QEmh9sfI4SSzrNDA7eETNVX/PgynaQMxOaqRNP3uAR817cSooynIUYAes2XNkY04BnyOcGpCTU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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 iotests.verify_virtio_scsi_pci_or_ccw() -iotests.script_initialize(supported_fmts=['qcow2']) +iotests.script_initialize(supported_fmts=['qcow2', 'parallels']) size = 64 * 1024 * 1024 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 # The test is unrelated to formats, restrict it to qcow2 to avoid extra runs iotests.script_initialize( - supported_fmts=['qcow2'], + supported_fmts=['qcow2', 'parallels'], ) nbd_sock = iotests.file_path('nbd.sock', base_dir=iotests.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 -iotests.script_initialize(supported_fmts=['qcow2'], +iotests.script_initialize(supported_fmts=['qcow2', 'parallels'], supported_protocols=['file']) test_img = file_path('test.qcow2') diff --git a/tests/qemu-iotests/tests/block-status-cache b/tests/qemu-iotests/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__ == '__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=['raw'], + iotests.main(supported_fmts=['raw', 'parallels'], supported_protocols=['file']) From patchwork Thu Dec 28 09:41:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505758 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 53F60C3DA6E for ; Thu, 28 Dec 2023 09:46:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rImuK-0008I7-55; Thu, 28 Dec 2023 04:42:28 -0500 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 1rImuI-0008G8-5d; Thu, 28 Dec 2023 04:42:26 -0500 Received: from mail-am6eur05on20700.outbound.protection.outlook.com ([2a01:111:f403:2612::700] helo=EUR05-AM6-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 1rImuG-0008Jv-Ls; Thu, 28 Dec 2023 04:42:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BEsDXxpetbP2LpOQpStiz3xYtA5sC49ZzZy9z1iyNT4mhD+8DLxdLnSqzEuWTUxX4jPwxnfmcPAa4IirEAqUXkRyiiho7jC2x9N91wrLTuhJTt8ty8WeGUxDBkrymXDqIL7zBpBl80ofJSfksWVFzhCJ2p0o2vYBlRs4518K5WatugkjNfS/JPnXESHGAC8CqB1B2NktJvJH62PTFx7g3ZIDejp2foOjg2sB7jLEv9fiFRuJpaWaoo97xaJ16Dx5JVgNvpAahU2OgHeS8YkI8dCgqbPxOBhhIyoeezZaeVNocm/aPybAQf/EN+ZTl1xsEgHGLiVsMtF7bwjPME8XbQ== 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=L5qMnrtW+URLLSQA/qmDJG7cxeq/+eDCKAIuYlOL5To=; b=kh1+X2qdIuvCw+VO5iw3giNYwJufUX920hUmdSTS2gn1Qa6Fj9prBhwmbV6l4tjvFZryX394VrSLvMLcOhY0eM0EJe/WsGnCCK9HzDweWTxD29NiuwB3NenLXUjviSsp0/nM7T20HLavD7rtPd7kduPQUDQy6PJu986HhOEPaaGKbyAO0E8VK6ckPGeFxOWdIlKFlqSFakZdQD/EIElWHEnLoEZEl59YG9MLQ7FN2wDzkBMSL4LGg54uS/Epf56xu5Kx5yudjIkuWCUueUDDhzrGGKljYkeASnvsuKZFPJlWZd1MmjN7hNIKE/PKCqXiq7QKCU9RAF5DxZybPWXPyw== 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=L5qMnrtW+URLLSQA/qmDJG7cxeq/+eDCKAIuYlOL5To=; b=d6slJU0BeW6gdKWEVvcLQz4Bvq+PINKfCbVPb4fZFhYy4H7eYeaxqqpdcDt6i7pHQU7slEGu6XUUiSeB6MxE3ppYTwgjg+O0uhlnbZQZVGVLmIYyyHx3r3HFRTjHbQwQmmhVD4XVSo541WBZEvWKcBaAhXyHn5I/9DCh+hlD6k1QtSOoB2+pUjGNiiJG9Y8HyoJAteNvRoVAszvn0oVfh5NUs3NxFjv6EmoeZ+erJBYYND9GakuwkwezEcj0jKX/tufisz3KXsmvy6TwuETd/Sy7kQkS6szPRs7YXGIIu7ZosdPTg/ioSCFJi1KYqRjdYMVV4AW10ovnJi4xc+LaKQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by PA4PR08MB6064.eurprd08.prod.outlook.com (2603:10a6:102:e2::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.20; Thu, 28 Dec 2023 09:42:09 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::60f7:3267:9f9d:cdc0%5]) with mapi id 15.20.7135.019; Thu, 28 Dec 2023 09:42:09 +0000 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 21/21] tests: Add parallels format support to image-fleecing Date: Thu, 28 Dec 2023 10:41:53 +0100 Message-Id: <20231228094153.370291-21-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> References: <20231228094153.370291-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VE1PR08CA0003.eurprd08.prod.outlook.com (2603:10a6:803:104::16) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB6064:EE_ X-MS-Office365-Filtering-Correlation-Id: f272e50d-f67b-444b-b1d8-08dc078941b6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2EdhVIUTFb7I6UW7KpcHhtGdk3EZAmNulpAeHblckaZU/PdhWseBapRSyJy0slHl9LmHAub4dWyYCT9Ok3WIHqmedMf/n0y+i5azlu6VOgZDyrAwfsQVlz0TmVgQpEKi9P5o/hUI+irLiS999SEJK3ZWcr7jjs4SQDjnpo0eU8JPOaT54kTNWT3WurHeq8pEexb1+eJozOgHwdKN+6iRguOQJbNL5ncmu4e6DWLd1p+vnwIqjUOFO/3/PlOmgMZDmMjpgmzD2gxQYaeBKKxVlmT+ml/pmpC0G21TDGapq3apjG1M+QHMzVo+cYe71nM/25qzFD26HcHpYRRvgnQHrmBZFy3blIePwdINCsjHnt95TT05ffTLvQNP6FCkGHN5Nttk4V8bhbB2Xn8USQW5BTzytiffq1tOenNdOx/a7Imae/lmT8zNB2/AFPmToU/aSfSKEGd4xbe2ONkEdpW8vdWG6uVdvMox7aQO5m69P3fFgBp/UJ7DkSTo2/OLk1nCU8hjL60ejPw1/qtX+wLVj9kXwJXGWHQ+JwlvvjSy8gzGWnhyUVWrpXYJbUxq/SJjiNb1eOe25kiF4+cpfVpj/dGmJBB0LB3A5hFDcmbjtaDCm8FtNnP1KGYg8jAz4Wkr X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(39840400004)(396003)(346002)(136003)(366004)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(66556008)(66476007)(66946007)(6916009)(6486002)(4326008)(44832011)(316002)(36756003)(8936002)(2616005)(26005)(1076003)(83380400001)(478600001)(6512007)(6506007)(6666004)(52116002)(8676002)(5660300002)(2906002)(41300700001)(38350700005)(38100700002)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-Message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aE1axiEByF2GqdljGdkxyjIvYx39rjLDVW7JybUK7atAD76q6+b9xkfqh827vgwKg56RGs3r4VRRvMRESN8Fw0lz0DOps8MW8sjYQWh+v2paMCj5dH14eTker0zo5rWS+vNANniAXhbA7YmqqGdojO+8PjxneQuJGhTXHX4BPgFHaRWgiDWEfxQT9U0OOgF5ZnCnds7XmNG4v5woClJg5AQX/vR2VqmP03Gz2KAafhQfVFKAA6wikAGI15ev7NTzhqpd+NWK35bDO1z2FJio/5uKjYknfRlf/NILqv3Z6F1RA6JZwElIAvd1V0+2Q6ql9/gVtvZVJuF3KhfviM071AtC0JE+FeKypHkuPZPohkHtZnaWsNzhH0qOUiHWwTzl06u14L4phAxFSWdxqlDixHY++2GsNWCBSfyfGJYyEBtZCbUsmRP/NW4AkIJxdWzngZimbtBJD+Ezd/BxYEDfescTWFkSeAho6AN7oq1bXinrks/fMyl1LkRlWXu/sIbBphaVEoqlyoG4kaf1i5aHxf38wEndR7faAsfPdfR/buQPTQRD0mpU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f272e50d-f67b-444b-b1d8-08dc078941b6 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 09:42:07.5714 (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: zju35Ozdu0ltojKpGDA72pRVf/ZYexnFps5JY5ZnnJiyj/usmqPVdhEvHyeH8/jFfMKPz/9jgYAEprkLkyxq2tQhNDhHp5+Lde3gXJUqq/Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6064 Received-SPF: pass client-ip=2a01:111:f403:2612::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-AM6-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, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 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/tests/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 iotests.script_initialize( - supported_fmts=['qcow2'], + supported_fmts=['qcow2', 'parallels'], supported_platforms=['linux'], required_fmts=['copy-before-write'], unsupported_imgopts=['compat'] @@ -61,12 +61,17 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, base_img_path, if push_backup: assert use_cbw + if iotests.imgfmt == 'parallels': + bitmap_name = '00000000-0000-0000-0000-000000000000' + else: + bitmap_name = 'bitmap0' + log('--- Setting up images ---') log('') 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) 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') if push_backup: - qemu_img('create', '-f', 'qcow2', target_img_path, '64M') + qemu_img('create', '-f', iotests.imgfmt, target_img_path, '64M') for p in patterns: qemu_io('-f', iotests.imgfmt, @@ -130,7 +135,7 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, base_img_path, } if bitmap: - fl_cbw['bitmap'] = {'node': src_node, 'name': 'bitmap0'} + fl_cbw['bitmap'] = {'node': src_node, 'name': bitmap_name} log(vm.qmp('blockdev-add', fl_cbw))