From patchwork Thu Dec 28 10:12:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505796 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 6AFBAC3DA6E for ; Thu, 28 Dec 2023 10:13:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInNg-0005Dh-BS; Thu, 28 Dec 2023 05:12:48 -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 1rInNe-0005DV-PE; Thu, 28 Dec 2023 05:12:46 -0500 Received: from mail-vi1eur05on20707.outbound.protection.outlook.com ([2a01:111:f400:7d00::707] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rInNc-0000Sp-Ie; Thu, 28 Dec 2023 05:12:46 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P9e34O2i1NHpsh6KYjV2RgB0jgXTC7O9jHB90w+IYjKY8eNW5V+v9XJwa6tWnMu/oI9+bXzkl4XGlSwauKNZhfH041u/0367eqgWHrHDCC7NdTjPkyLenI1Yce75z2mcgKjPSK9s/qbVvZukIlV9ASdqmV8H0af8b/Qkh2PbTBi+GcRcD1MjJxslWaqhTrLpJMzreZby5fgaDU17oYPbNhv7ZfH7h93qASvp8pdRaH3pNKbcTxc2n1l/f6jcdkFPy09OyWRGauSc1g7q/dlal479rDAS8yWcq79n6fpc1RjudKCzFhmbuCwf8uTBcVmzQ66XEyPZ6X7BIMpgjJJi8g== 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=gkEh1jvTNQ0MLaTydeNheQF51V4fz1YIslGTdqsvZACr+A3o9ilLuaX52Pj5nU3MgXV7P96LxWiFQNJAef7l8FjjGw9QPZUJtReLz6LFwL77hSIrnQfmMxfa+/Zxay3dB2aYVvxwS/2f9zXWLDTcCuwacrdzcyhlkYaGDNDJUybxm58/sYLm2kTRddYZbDNchxR1tHX9K61xqrHYY70TB3IEEGeYRod7psegIo6HRMuJriDMFQ+8M7GaEdHhDyv3iwkYmp6E8H3njRZeYsvBAmO6dmPY5CtE/pc1gmBMpc31iSXH5eJ4k5wyYRmggJHnoPR1XGe0o/linTn7CW5Neg== 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=qNx5+EuGfeiEvuI0P2NIAh6XjlTeV3NwipIJUdEFRgwfzwt6hUDFR4TsEMKgVulKEOBL7B6zIW2aGA8+C10eWUam2AkkcXbpCUL5+9sf68NB8WR+/qRwcsWQv6d+dJy7d7dd8vkPtKwiprsfkFM/uC05PIqlgCoSW9Wq42RH/5pI5Y23LEeH0ojh5qafoo0L8Oa8wbD+IzbPA7b0T9W/Mgo/cXm3bqcNdn5mFFpHRXviLJRWufWgXdPVqo++7PBMV4Tg1ar2QxrAeE5IkxiVRpskWfd1bz7j5XVAu0sr9nfoAbzfiIBo1EC5jOjsMYlq0lUlDahInfbmgQeLpRcYog== 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 PA4PR08MB7459.eurprd08.prod.outlook.com (2603:10a6:102:2a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 10:12:40 +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 10:12:40 +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 v4 01/21] parallels: Set s->used_bmap to NULL in parallels_free_used_bitmap() Date: Thu, 28 Dec 2023 11:12:12 +0100 Message-Id: <20231228101232.372142-2-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: b201b427-ea7a-42c8-39cf-08dc078d85ed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zrIqyAhBSMa/UZAmb9pcWiYXbgKHMXBwB59CO93+F8u4vOSoJ2osW3n5wNew8QQy6TXCtIz9PdWMhBcUdSG/sbt5enLaBwszKQbBpIT6IOLNC0gYPsjo1ZEJgA+WBzOq34qS+MpvobznjVG/pe9rwIekFQUJvwPkv7uzVWl79/DuvkOgGbGRoz6Lrlj86tY9841kcqOaLJMCsmK83R+4uqHfkoExCDJekyDJ1mlKoPyYIyg0NaYubR1r7aBhqrHwq1tJ/P2dgY7aFyCNfmHE7+7yAb6o/wGvSTUgS9uAnCu+fN9dXNA2cPwUGA4yTDXjk+95stEbZExFy45asKX2ZLzh/TXoavSXzgkT4iCGO/O+H6i7DCk7I48mCKX5F4YXIRmwBiKoyz7nz8xXpGDLWifdmrvOqAZVZzmrYIPRb5HD01/dHkXhQ19Lb0m6GCdezrt0UVgKuxTT2Xgf7qLh2MQcCto3D7fHMMVFvD8V/3HHnRUHgVUMrJdnl3hYLQPc4DSJDA5+ZnNeEXvDUGAJXw/x0jByEZnejeqXebsxpMdFuKJdQQUHTkcf7CFXnxP9bnUvODFto0qkcsM25di91/TsXe5/BOb1kfCGpALVBMWDrGKke3SBjimstTz51C0k 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)(136003)(396003)(346002)(39850400004)(366004)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(26005)(1076003)(6666004)(6512007)(52116002)(6506007)(83380400001)(6916009)(478600001)(4326008)(8936002)(8676002)(4744005)(5660300002)(44832011)(6486002)(66556008)(66476007)(66946007)(316002)(38100700002)(86362001)(41300700001)(38350700005)(36756003)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: faZzW4fHw7YQNUWQ6X3kmNklZWGMhjRMS3/jsKfSf0+MLeyXq7c9vQRBagYocP0K+ErlHz/Ip+KipILw71uKYU+lWSvyqj6bJ0sDiU0qytodQXDnQeNn0VEs5VrK2fpsHWU5x8cuy+IE9Xmkr5Gd9OYq7RB1ZO2nddOAh94H7ZAujwIXxKv1l7EEn0VYs0eDkAVTYVsDlqcIIYS3AuH2se3A16RZcEfK22L02BxG3awBCY1AhZK9hnjgvvZWZEancqOCfHWi1Gr6MEJqToh3vLPxNdCcfj1PZ7SMG9mzm09VvImQQKyWjx+Pl8xu0t6J+dqJLuSPNBlTmSSTJmX4B2IDjjY46CdOJKg8pPawDoO3Rq5AP6WwtWmG8OlvdwMKu7M3q1+DREJ1vob4O7dmLCSYQB2GA/yXAjc+f1sLOupgKbtjD3k572I9LxA2l1Wv3xKwctruda/midkR5RFARYeqpOiwxNhg1BuvcIOJbgzcnfA33WzEnr4Q/mdaUqqK4OQYGH5+/lolf53WBsviZLNIT4MtuI3y5RMH4jK92QNNt3yb1LQusSyN8K1amMVVUPBIwnbCR4cO6vKqnP0rRqtbJqEjrEsfi1OKtabK2qvC6Ea2pRxowOtHNRpgTOprzNxnya8jBCR8aMETllRTrIhEQy4fE4Yw8sMUTpNLpTA8gKPtd/B/DQ80NjMbs0Y1y5GMs/7NKl2Fv4hLKoIC5IV6FPEDWNXjXUUE5SeRWXQ4XohlQxuDIH62tjzDgPlgk4lOhC0IKoHi3fEUxOSUZpTstZN/huGUmCqvUrcRV5hnEd/8RVm4S8BTKXGf7j7QYix5omjmfIPH7/RgL5yCozueBk8EVKv6ZkAi0Lb/eo9Tjh2HQ+6OFaxJJjnF7BqU+SpN9qu0NMiv+FmIaafO0AY6DJWChkaLplmVg6ur+61SQPlnuVtMyMBOS6CsjalMeafyjcXqhDvCvw7vPzEvEFowpFuhoC1zc+daexKRcpMZoohrU0vTMiaVo+Tuj7YzYcgAp98kFcF0TNs94s6kmuwSsQckI1oytjuDkvMbRNXMlgujGQV0cBCzdZ7vLCuwkf/35j8FYturij7k7BHTO+UEc0RWQMe3oMq70ZXwtUp2AobfMJiB4I3XBip7uP1Dt0RYJHwpjGKlepFS/aSyLFed99hZrvWBlFed68mE1u+p4MENsiiUIl9R1wUMzs18nqxrhsGqQSKmYX/VEWfKDIPsz9w5kwL9Af9VhNgEnw8nhToNGw3bj0WEy0Pj69lYIx4KY6ZvRRHgfClyT6lC3BW8ZJGcnAjzIHVmCwIv7fvFEe6ficCVtWQDZtN68R40fu+5I738Y6zPcVBgoRP5MPxl5TI8RZfmlNos+prsDvuJHIvxVlmeEAv4KAnXRmWqfhvelJO7jsZMN5v5vG5RWujstXMNifAiQQtiua0MbrZZqCT1mnSPmGcEbMMWuNg6gGlEujDk8LMGm/wnXQ/8sHSTHBRF/JWpMhKvQqqdSWjLrgkd2YTPmzRmaKRyrmCI1sMhWaYAtqt73ySy8Gk6PGGK40ur0Hnn8tD9oOryUh3ibK6vININVRiFl1JIq8g4KSCce+nxIK4EQQjYSOosmrVm8mZb2mDdiu9lE/DKHAM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b201b427-ea7a-42c8-39cf-08dc078d85ed X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:40.0171 (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: B6jNsn91ihWu+XDe1L5PsaaYSTNut4q8lwd+UyDFOdFcPxC1NHnT0lQc2egWjmG3MT0wi8tmxiiu7TJdPjNqTGNFbtcK3EkJ28R4kW2X39E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7459 Received-SPF: pass client-ip=2a01:111:f400:7d00::707; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, 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 10:12:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505797 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 6D288C47073 for ; Thu, 28 Dec 2023 10:13:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInNl-0005GL-U4; Thu, 28 Dec 2023 05:12:53 -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 1rInNj-0005F2-Hg; Thu, 28 Dec 2023 05:12:51 -0500 Received: from mail-he1eur04on0713.outbound.protection.outlook.com ([2a01:111:f400:fe0d::713] helo=EUR04-HE1-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 1rInNi-0000at-23; Thu, 28 Dec 2023 05:12:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F6N9+IqwYI207C/ICzZehkfE4EncI4nooptRRUdbdUJm8pEflNrzrtcAVxuVuCEpMb6NsUBSmR4ZEBc+ZWsWt2Bf60vY7//8KbmbxkmdUjetY8Tc/eDOhgwiJODtol1ERDd/qZ09tYdNMpWuf6AWsqwuurdOcTCnYUJRAD5bV5X/aRHuZuVnv7gZFWn1IU++NaXWf3gqtxJeJvC/9nPjWd08ZNcEqUOHn+Cnkz8s4LEB5a9kYX/cnuauwDzu47t95ErNcQGZuocognPbebqGpChTkPpEjZAAGNjqitECDbkuKWRBgLaMKIcwXxJqcQv5oRB7suM5QGazEFZFmTrC3Q== 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=nVfmBnbNxp00oqPoNf5x/3gq7qwe2vqEeDQXEQS/KWjnKfOy5zwl1Zo8AMZuaJJZdvV+QX0VTSBycWqyAzJJWNoHHVMvKe/Rx3bE5u/zYgttCYWOKbx5UIA1wVCX6FFShaKIwePAd8ZwV+aXJ7G648d3fROZAxpB1WvxHLnM0D17lCh1dDsetiWtsbQwBAGO9jH8IQB7sg9z6CzxBZIgFDvzKyreAOWJ6GHL0XPYinaTVpG4to9nQXow825/RflJIvKF5qWWPkLRca5bGSUBTaMkcRByZ2i4EQevHWfvp48ZKROFwdWqKSui4tjJKjK/JOtOjAEDPLXYSMi40OZf7Q== 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=RXf3Eg0w0ebeYOx7xzEsy73BLzufbQI4lWl9xGkuSgbBxU7hFHK5wc/HDcIPCMycYeSZtHdF9dI7zBf0Ce6+3XbSb7r5LbLzm8+bLclK2CmIC3kmAwb9sYmFo7G0tYSm0oANQuUZqKOiFb+gkylQA/fqgjhynk0ZqVS2s7LGpU0KhXGi6lBeOJHhSFwbxYLN4PWrjilsqmu/abjgr2sZTvd8mzgKRGagokp/EO/LF98/wdL6lGYKM/Ylc4AFokvY98/nOX0oS/x8WIs1rrf+lNyIdJzmxeINAzNeRpEjV6zpe7qt3BIoIHYQn0m/jA4WDS80ErhOeRRxfFLcFtmPNw== 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 PA4PR08MB7459.eurprd08.prod.outlook.com (2603:10a6:102:2a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 10:12:40 +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 10:12:40 +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 v4 02/21] parallels: Move inactivation code to a separate function Date: Thu, 28 Dec 2023 11:12:13 +0100 Message-Id: <20231228101232.372142-3-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: b1f84a55-b7d8-4be9-d4d4-08dc078d8647 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cXfEihPpF5wMBqMyTHuYJQw410Q6umxN/rQ8TWOvc0cOcslE7vYzE7URvYN00TrvyO3Q5sCir4NUuOJS+kQ26HahPsY+ODzGsSoL2wT+g764U76VcKEnqCNsJOd4AnsTSygf11uU4yWBrUfYBkhvdiZmR+IteqSg7ZwpzbC24P20RGY+9WUqfZ9xOPDyIl1iYSKpPi08zof9Rt/32ER/cQWWsmh+kA7irJ7XZcJ4A81LjuFdu+KRYoe9l319hej2RtGCQ8sYMzF5hnAJHNSEhAgycigElMcz6wrglTQrNvyya4HHvwDDhGBsif7OAQ05Qe6rkXB/JHSgeaQifLgAg+79xC3KLIXU57TAm6RmKsjErb4F9NgpSPS9qBeCdpxQg0QGOXTsB01LrSJIJesAwT2AilFeuoyfsIY9TyvoC+yI6DgUH0WNbzicnffzFXYUg3DH18WW1VUsFWQfzgte23/m1VfhSosKIFx3KdMV3P3bh35aZdFY26dbkTiiglONatXqkZ3v0tOYwqtRf/WsEcXpGBszWybHEkUksGgprgiU+ZDyV5S2Mhx0etE49gHwGpAuoxNbck3kmDgRBezHXVCzARN/l8qnv/a9I0NR0cuT9FrQQYA+QazysjCfbwCN 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)(136003)(396003)(346002)(39850400004)(366004)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(26005)(1076003)(6666004)(6512007)(52116002)(6506007)(83380400001)(6916009)(478600001)(4326008)(8936002)(8676002)(5660300002)(44832011)(6486002)(66556008)(66476007)(66946007)(316002)(38100700002)(86362001)(41300700001)(38350700005)(36756003)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tw4r3a+ciOcBKqsuo63E/sz5ko5FtXxQTHJOzrBy0s3zskmU2Qc1Il6uvzxoqswNdQaNzz6x3fragtUbrprtICVgQFVx8U5Ht+fsOE/sk2NGtbxGMGExP2Hu+fjCOPq6c7VkdhyKQsW84bsxN3mu6zxP17wtUFXoiwoKMRq2FEdOs8hjzu1/o5Rp6vv3lVqRBB+YxZO5oY6LkuVwflwv7JiPQ9+UbIPNBKg/Cod7rw66h3PkZ4Hje0w+0fcb032fKmR3B1+Uu0jWW338k2/VemgpJkFXHSvEXudz+fXS5vLf5AjXnr1AwiaQN80OuvROUYFgMKbSPKdw/vp00s++4HlX/um7LzsBrBeVMjOgmq08DIUu91ldQdhrmhgXJTJxqw0ITM9tYERirWCLqOhdy0JPADuZwgZW9MGbiMEenhHl7mGutjVA1YHDRKAxCHu7Oqu633FNE9aToIF+i6rUbyPKkKj8yJJ/+cuDzeMAa7ab2p8HACTQuTyVWUxG/G67sWiq8fB4Wt6iqSGPyV4+j529SzK4G5azuDgZq+sUwDeoeYurLBHih9KViZMAOsmY45lqpff2pjadZ5hzOdrVSjTLqWoxngcWJJcJngXR0jYOQ6c2K+WpVMVW8pIU6+r5yh0UwvclnIVJVD556o6h/rYF4xApudDj75YHYQuvYMXI91cpHMxXisa9ZqpdoRu9wOo8oe/+CVkhOWhP7IV5pHQ0UOTSAZiu31qh18SYD2jW3waHXBfTxCQEdu6ujZh8KSgQtJB7Yac51xILzhkF0ifZ7ZNgntqt47K8qUlg+jeG9CNi19vPMJCKSXVqAXJj7UMF6arpD0R65jZYsB19tVLRKVwa+uPVu1doqwsgauQN/xkdOEQkp/bC64TYIh8ug619CrknJY+ZHjTBVE4FrL7Y8nJYPWcbM3C2kvDn2/AY+jz+FuhuCWjnDtg0FA1bkL21hM35U5O/F7RG+MOyz9LjUM+2rKgDYlbLO/2FU/p8Lon7DDPixE7yEbKjpY4FA+WZcusAEVixse4dm6vUCRU8u65rTqllacCQL4FgbKkgH8YRuM5F7bapiln3xPdr8GkQ+ANPGF/eXxkae6LqHeAtcw443bYBTlvYwAwAk4eQIYhVq9wex4//npG/pQCBSkPxt4cRv6UeeWKW9ApkplkLQ78hW0TECNEdHypBPbf+gd4jlUiJe9IsjrgalDnnovNOl547dx597tqOINc8tCn1VPvI8De3hgIkB+1gLAuWZiD/RiZdqL/FIq5W+PJqvrw2UApGdLIFTGTlSdsCvrJYaaspTEUU420A3JQ7kRkND2qybdQ9RSV95802NFCl49bDhsZtGE7bf8MhWvMXk7i/v7xQ4hzdu3yolr2+h0YdvlC8TilvinV7W+JC27oqWxsb7lldMAaIR16Tsr7TDpRaJcFVC2006Nt7CkBqie6m4L3cis/PWb4ARnevvp/VXVvPFFVKd9EYg/Yvjj45XauXqtTqosUhsYc+1hVT3g3eoy6aIqy5BawGi02fEHVsXmH/b9pTM0uRc30BOSBQqQ0PAmKwGGd+onbS6MgwvPkryQsuicA14IyMFLZIRa/HylAnZtTQsOkHCbLfbUoxM0CU+BaXu0sWexbrqMzVa7c= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1f84a55-b7d8-4be9-d4d4-08dc078d8647 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:40.5767 (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: x//GWWOszEJeAAbm4J1tQ4aGO2a+9UWlrWqYOGHvf9doaXnjGf19MgJ2GsE0JpU49ZNK6M/JORu3hve3CCwCj7uadsrwszYM6axSBVIUyJA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7459 Received-SPF: pass client-ip=2a01:111:f400:fe0d::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-HE1-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 10:12:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505798 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 9A89AC3DA6E for ; Thu, 28 Dec 2023 10:14:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInNk-0005FS-Dg; Thu, 28 Dec 2023 05:12:52 -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 1rInNj-0005F1-Ei; Thu, 28 Dec 2023 05:12:51 -0500 Received: from mail-vi1eur05on20707.outbound.protection.outlook.com ([2a01:111:f400:7d00::707] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rInNh-0000Sp-Sl; Thu, 28 Dec 2023 05:12:51 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N6LH/WsyjdvQhYKiJZPQJJgFmR5ONVRh0vES0HiYJmf2ew+8iurUAQfqd04CmC43aItfF/6oi0EzzPV2R4LWCinleAiWI7LTf5w7YFUDuAoWo8GwNBAxcklRCLeyE2Mv0njoV0ml0yNWqzM0YFGHOuGX32ZDnk3Fe4R0/0dI+lDLT2LpZfNF+axRbdqMH2s6+eXYzvdfTpRr7kCrH8lermmO2yC5XOCdRWzjqnEOO91mrW2kA+DpgXjNsRB9GnMbHw2rIn2akPBQgtDMfuBVpqr3K1gQiB41p8cWgsrnTYMrHA/6Z3VXjyjh/YWD87WrG6G1whn/AK3E36GsBDXNwQ== 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=QLXIwTuvzHaFWidAp/ad/rS59cToM/sgX0IteOUWWeUbaHdRTjiw6RkOvQMLELUnpBggcOmgotXbs+esJnd0ukrlBK0tGUMrsXcjp9Oe5So5SOtkl7fNAQNDghIwiNyddnDLv3jIQeRFiPVKuOJA4Y0tY+bTZrwcRPnhQr60vLkP36Prj2zfD0+ms1/xKZFJpPdzVlWHs1L3XB+vhOTv+SRAjxhmmWPhXQIKBur75N+DWYfi1DVYTMQqDQQjY1jwwhjPeWetlALRkJLaQFuFfGVZLywGOGjcSTez1X0MkAjiXQKR/SYmGwbzbFBAVyxdLNU0rj7UE79r/Ph/xPxP7g== 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=hlZmEzKCFRI7YfPqGbNZS/GzRiOeitgFA2vWNqitjh4WuAZGS901Qeh0X85m2/vSJsGHUAV6pOTXLvJAYlYPqcmBQ1Q5ixphdCsR1QzJdJ14BwiTmVZNaDRfw1h7hyEU22VauQP/uy3SwUQMy4QzmvDJ8WM+TmAo1ExGPxOwWVMtK2N9HI++on9wPILcYUFXf/8ufVy+1EyDsOLBuBuDIVSKhIV6WLZUsvaeVWE5dNAeQ5et9TkgD/yFkL7MzGOwaKp0zq8ZoSfEvLmDL2AM6efpvSx1GXHxryvqKlBvL/OqjX3dDBYmdtpCD7aQGch8eVXms8KklDtQb7bX2hiokw== 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 PA4PR08MB7459.eurprd08.prod.outlook.com (2603:10a6:102:2a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 10:12:41 +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 10:12:41 +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 v4 03/21] parallels: Make mark_used() a global function Date: Thu, 28 Dec 2023 11:12:14 +0100 Message-Id: <20231228101232.372142-4-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a3ce7e5-8c7e-4a94-6faf-08dc078d86a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ibe41QkepRzS01THvdA4/dB5XmszX5CxF50H81Ibe1z42M2yBgC5xTVKlt7KYLnb76BgDcbaRa9PwuDG6676SasdscluT+CkUgl662sav9MF2xot//7zyYdLnPVeA8OIHl6V3Dwx83Vd91Qfrm3UgrscyF13VVylLVSVhm9YMcHDf3zpvK6gbrTXx902qknSv4xiKr9ZSxOFZNkR7v0/0LcdELZUBLJunBOwJI3aEtNj3at5uUxqqeHzS92Aq4ocJMa7uePY3bJrigQ/d8Fedy8NiUtlJe4LAzcS5g0e+sEYKnYTYL0jq3WcEoxNWAS+63ibi6XtR6khkZQ+1Cx3R4Iu8SUw54mcZ7/S9S9CdCa+mXNX97ANVnEZXVPUDuzAf7HwxqnXZ5/schrgpxc6iRAsJdzpV8629YSpXOxfPNXQ25aqRJkFDbp1kBQEllJ/yfP4LoCQn2y2KIvWWxB4dXAwqeB035ob3mE/553DJwfwFv0Zzhonl9bDBcJ5NtC64idqMYB2QUltGassnejcHRH9N2G3b2qtHrgnLh8qHn+dgh+kY/ZAZ7VCcU1+BSMyfzL2Uwk3QsQB0cXkO92EAAydF2zyy54GMdt3FP8SIptlVTMOt9hGxCKI4HUNz061 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)(136003)(396003)(346002)(39850400004)(366004)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(26005)(1076003)(6666004)(6512007)(52116002)(6506007)(83380400001)(6916009)(478600001)(4326008)(8936002)(8676002)(5660300002)(44832011)(6486002)(66556008)(66476007)(66946007)(316002)(38100700002)(86362001)(41300700001)(38350700005)(36756003)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: t+yjKdzJ1PiLsv84MR2LtSFshvlQ2j33b2rmBJ6lfakNiAsZGIQwSW59cVytprOmPyzT2VJY6RbpKuYz3oJ7SqlP2zTPhmesRjB42DPTJc2SSprfwrIvJZsXvUHsAfARy/UUkkT6focfrozKM+DKCSB61jt/I428r0ACM62e/kE57jC2OtFi9P6ZuK5Alfi7oQuNXVDQjpvlu+85vVxEecDJYPyvRTa6EAXCNI4C0yOo6OD9xJNniNlJmempNDURPJL2kWXztXKBd/6LTMmR/ll2TvyPsemC8kryZaDDbCUOAuyUCcH17yaGY5BQ/G7HS10mfzPgWCiKWqxeLO+eIIwMBZJKrTPNRywN2JlH771/p36IQnK23EZOH/WBYI4UJSSVzUdv17xExOx7XYdn/m/6ww01pM1xA1nv7Kcj4TZjSU1z2WebXk+BFyrOWG6imBcJMYFd8e4cBmOjuDN1yTQ8RDFJx3ZY+cQLENVHakoeMYPgEfqZPGBC7QBU0WNv+rmEioyMninl2xd0F/ykuAmR4f2Gz90/AwRup58jKOyQj3Gjcg49pRxlw7gXepbXs09ccwlESCp1iYemb4CDpsEgAmXaV6j4GYaYFHLdSO1d2XK31bTHZFj2XqSi3zDeIU52WvqK8dZbSseZqEc9oac/GTJYlwUaPM/Nmh7k5nK7fZvqf8XP1g0g4rWgF5vX+w/Mvh81kEAEZJI5hXj1gYkssrBIx/soUcmPV1lzRudBJFl4MEmf9JVCY8lm54O2acxOE7SYrdCd0OBicfs50/GIWjpOioEKY/xhBbMEpD4UBquAMMSuI7Q8ygjhpM0Mr2F8hB+P+XLcDe/i3YYDjQoNQFZxqi+Z9qGFMMWOCq2Fy8vJq43IjZzmRLpz1CQvmksTvMhixcwVbU8DqV077bIOvPCCIUufY9bO2glGxChwOhwohL1YQ4AHicwEfz+gkXli9ikmW8s/9TiDUcFK6I3FB+18M8jg2tLConFHJJhbZg5oMSzCnoTnxDL4DMvLzC3hfzEcyl799HVZ+a4NUJVOur/0pDnJ093G3MidovxfBrec2NqrXEbyPRzMRY3dc7daK8jw4G8zxWpHygCC+i3DS1gawE3RUKXbsY0/MD0zdjwAz02zbhXCXRMeayJiZF8S0Bx7mv0AP1tkTu4VB+9gt0sPD9Gui1gkOztr90j3YfZ3Ot409OTyiIYso+bOMrdhJzqvwVjuLxUac7ieAK36+3D4hjL5t988P9+n5DOo/CRzltTPp6nieKZfmrGZJEFPLVkXIIUBxhof3aSHpJmMdxbETkY37Y+HmDxa6bGiRO5FgtzrcQiLNGGERrSInrJbWKwA5wnxiEnxdpvKk9tvXXhueW5TmaBdWeSsXdlEzwFUwZ8cEzMg2kmYhvkoMG4cFQkX4RekbbyQ71tsNlzQbL5ZnbP3GSQ3UitdbbVQvJsm0S8zviba492bwANfzvnFFLsI1reRSc+VRk9Bry7/PowPFZ8jXzX9PMH/cl0SlN2MNegKePhi5tXGXd3apZBxn3cqtV56/+E9ITK2skKwSre7VITYKcCn1ZO2cMgzed3Pv2B9p+AZCW3se3NIL2u5o3BCOpJskeb1znBQjPQAyM4zxLdqKBsXSqkucm4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a3ce7e5-8c7e-4a94-6faf-08dc078d86a2 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:41.1466 (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: mvR3+XGXjXLs+fkbLFnlGqz9pulD+hKDEyBgE/SzqQXE6EXvqeQA9+4WI8AV+mbsvGZ+vxLxjQWoE0smZglwkSB07pqKy9YpCjOSh5GSL6o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7459 Received-SPF: pass client-ip=2a01:111:f400:7d00::707; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, 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 10:12:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505804 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 43BA3C3DA6E for ; Thu, 28 Dec 2023 10:15:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInNn-0005Gz-0h; Thu, 28 Dec 2023 05:12:55 -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 1rInNl-0005GC-KO; Thu, 28 Dec 2023 05:12:53 -0500 Received: from mail-vi1eur05on20707.outbound.protection.outlook.com ([2a01:111:f400:7d00::707] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rInNk-0000Sp-64; Thu, 28 Dec 2023 05:12:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SuJsAHn/DP1XCock5URfGHtL49Hairqm2Vk2cjQTxJxkvqwR7BuRbSr6Rfr44LFWuKQMJIpbbXkpaMMMnJWSFhPu1e/c1lCacsY9mGvSacb0TWZOUKupK8OQE7ilUo7ddo5xN+9trg6jk+my5GX1zx/EBAOlG8SFZmqdf0hnIc5058t+C9b0oVsogZ3P35p070nWej25EZoy85wVujP/noFUo/SwkMqEfU4DT8r/WuGckBJRXi8bTPW5MuE1JFoQqfDkKu0DJh+Vj921n/9jk7TuPoKHDj1meEVG7ktchycLZRANUV3wG3tAStzfa2QSmEl++xqMI1j0xblB1JktrQ== 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=aR/0RmSPPi73V1OyAl2O2doCHlUfD9u3yA0c05HhQ8pYSn2R39gV/XfLe7ZCCWRDASCxVmxeMLqI12iufnGz4BFQTZnzib+KYGXeoMFn/IMc5d5tM91G0I7hVtlqkof03gh7R3VEwa1fxpvNlsGmL4I+H98PDADIjqvi4WRqT83EH185W+H8Xo9hUvnxr+SN+AHNr5DfzMAZ5wxUU3xfCn+le0Cq7gSWUNm2Np4i9HIfoWVmne/PUVw/d0HLM1QMpcftn6O8ecZGy20LJmt7cQ9PgXi00AjpRhUkNM074ajXPkQ6f3oDxecnvMijzTWBYO4Ewh0kEck4K+QQZa7/1Q== 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=tJdxnhxZVYtX+6MexVq094iUNqLCTR8+kdpUtfVUDI+IuoNeYgd3Mu5zSQZFMo4rOoyIBchVI/wiATRddWRDiaYQItsfII6/O3QtuM4YE+kx9WA/okbIfAdQnuXiSrbgdAa00d0fhoimdeWNR1h0CDe6Ix6UvteoOYZO7k62Dh8RTaqtnRFw0XAJdMUkMJQVQPWTvDO2pyIBP1U35juKChIKrllEnnfMQQAzel4mzC8H+JYl38dnJFKUrDfYE4FlFlThIlBypzmkSx3M6DWzFKUqGI6ZDftcg8fqafbzzKc33gBHyzN/hnbXXF46GCYxPEWKy6OiPZNFFfL2wnZFEg== 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 PA4PR08MB7459.eurprd08.prod.outlook.com (2603:10a6:102:2a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 10:12:42 +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 10:12:42 +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 v4 04/21] parallels: Limit search in parallels_mark_used to the last marked claster Date: Thu, 28 Dec 2023 11:12:15 +0100 Message-Id: <20231228101232.372142-5-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f4d388b-62dc-431e-0a8f-08dc078d86fd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2cjIN9UPO8lU/Ze95wqyGuFZWOBGfBzxcMyAFZ3R2Oz1RDJ694WwRMO3qDlTOzRb3xDHMKJxjyPyV68hwqBBKp2Pj85Nl9hXOLCKo28rLiQTY8S1vYohNBsTMshtRJ7JOkI1Sm5/pxgmrZbGzsJg+6dbN/qJqJjGw4r5GeRjlgSgN9xBWYzuEL4E8b2bKHX2iDIfPVvSL9ha/IUIq4veU3hV1uxgBbQqafJoWStuRznjL4LE/c/SkjxSErNflMWxUq1WH5Y/cqFD8nFvy6dwJjJ/4rUMI/g2JlMYWWeXH4cYmf+h5WfOxIwbaH2kDZjQ303R+hOkppxAsX53+f3L7oHJKtw32U53j7DbmVzdXV004z+kMF0WQfP4wVew2DOkI67pmisfHCGuLeYrSRGVO1UwuIM+SVF6tuOcfmiYuDxWJytyjECcOOqHXH+P+aYymPns0zAG0lgBwdKFV3dtnMep+lCQpYqyv2GUDXrBlzVXM34CtDbrcERyZLgLbRgFtiuScgZYWs2OBT2tmM16cIv6iPtk3Aaaf6GLIgSpjp8vo5Mdg1e21EMBX/jaLZpY+kcu8SDRAGlDQmMf77E2KGdm88lSEmVwP5qzFFNNb4q5Qba+JrQRQ2H2nYMz7Sgp 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)(136003)(396003)(346002)(39850400004)(366004)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(26005)(1076003)(6666004)(6512007)(52116002)(6506007)(83380400001)(6916009)(478600001)(4326008)(8936002)(8676002)(5660300002)(44832011)(6486002)(66556008)(66476007)(66946007)(316002)(38100700002)(86362001)(41300700001)(38350700005)(36756003)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: F8I7H+jkP8UzRwWZQoybKRu0J4MgPpqHnQCaW7xcxX4pCgC6n8VclEd0i+pqYyA3tTNflsrh9t3GHW1nXzX0GInkGsag6iuejtNS/AxcrxHMQbm/xHV7Gq3uSemzoW+Z1rzBRB0JUTtIJ0u87RU8/NSuZNsxevM/ZyrhpQ0smRCVa+lk8C2E8may+bNgQqhUjzZSXC6davlIP5ynlZ/t5lsQtE6Jr8A0pi4pLn4f4lcgLAeRz0GHJC3nVpbP4HPEeW6h5HmgnS0BWOHRmlxTtCzS2OcAf/cm/BB+cwHjN12lz7H9vyJMkkJQVaKbPfXK4n+UoFXQObl2HR+8JyEUrqcaLfrgmtj5vOPyA194FJwajP8mBT9HCQDsQUjfQ7lo1dvCb5+0NZtWmMze2yhhGIaliBf8tPC1uQKv+PI0e+5Tvzc2Wj2bSHmyo8JEBGQsNBVIR9ASoc4rpjLv0PRei7QX50LcNOczFNSC0YIBESl6cD63PDhaCSBMbLiedjgreM9S2p3PQj+LiRIcfbuZZutvbej2ztE0b1QjdKKDLMH6VKUmEI757LPBa2KtoEramXYUdCNEHaN3AsD5endYdAT6O1ss3DFLwOLYaOY7zHo6gevYxAByap5YQpAOPoqXYr6HqKSgf9kEVSGqggLcgV78Absx5f43TLM6k2gBdJRpD6V+DSnRU88J716vdA74uqA6W2oqd8b0iFqDR9hH7AMdB8Ak8fYCdIy46u1AxnLW3L2KwQSfc5ZxZXqjmsNcTkLzzJ+pRSFovYB7r0cvMnhDNTxCuHCQD8gJpjLXEnHm/m4/kH0shH2BTQNeSrlJU9scvWXcze/77uZQkDh/40SQI4zVP3nNywrCMoY2b6tqA85ETNTUwF9OzK8sDTRAdZfP+KS9qUUjQTaSW7dUGItVj99RqP6XRm/jkZ9nMILq6ffNOhzpp8j/6PVwcXEgX68u/pMWnalPkc+AkB5bVumgBgAe+E4EcLPCsEjScjbhAJnHpWtqpl0mtTSLRKevJ7NICQJcSIM/rgR+yqnYCm0rBLlymrDXqbfZ2NUcCy3EhsKSf6fJoeu1LCNAaCveO+LD/sgntkgrueYo3qNcnJx7S5VDah8zivpXe69uRFRSPV6ZrAv95icofOfho9ugUWjb+KlWlfXy1TS6pcx01sCXK80d4ZMUv2CPMQD2IdcEqWXD/Qv572HzY99SwEh0NhtdSliplU6g9rSl3uOS7G9RXh7qnRJsy/eu5THeSRg1zmXReAyhCsr7TQG6+OLwKmte+IJacdWudjTn1sVe/iYX0ZHbmrtNH/r0d9t/ps6SdH3blU8/HKGeGYFWNIZOEXzVQzdyVBk0Ak2plS/N8izumTvvDfdRT/vYA6+n3CzcCm1hYwGN1o4iOkUOz6noHRpChwoKkeo41YlDdZep7iU2NK4A9MWazf8fN3b+tF+w/6XZqtS4RtkaOvMo8tNlDrsZAnIyUJX+rAb0rKK+VysDdsXcQRGu6HRRK8heGb+2JbaQEWCmXreOMwARA+3EnpvH5Jg30ogUhOonUDytptWQ0onca4Qn8vlQq9AALSrN0QAtgkR5qS+Ig81WHEH019WU3ErTRNmPv8+DDmbmb6174na76IFK6AP2/uOgjlQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f4d388b-62dc-431e-0a8f-08dc078d86fd X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:41.7626 (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: 2lu/cK2QwXmTleHCyIQliIfwiP/cTG7EJc6SjqjqnLG53GZC6pVwYrKMdW03CpAZe1o0C+FhqGGpu02Q/Kgti/J8Wh2nqA14WrifmRx8OJg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7459 Received-SPF: pass client-ip=2a01:111:f400:7d00::707; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, 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 Reviewed-by: Denis V. Lunev --- 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 10:12:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505812 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 BA7C2C3DA6E for ; Thu, 28 Dec 2023 10:16:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInNs-0005Jr-5N; Thu, 28 Dec 2023 05:13:00 -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 1rInNm-0005Gw-VA; Thu, 28 Dec 2023 05:12:54 -0500 Received: from mail-he1eur04on0713.outbound.protection.outlook.com ([2a01:111:f400:fe0d::713] helo=EUR04-HE1-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 1rInNk-0000at-8v; Thu, 28 Dec 2023 05:12:54 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aMwXFhb4ra9fcewr2WmExdRlOis3Rqr0vx00TP8DCyDw1dGFu4VeK1+gcknToGBIAgPpcjSC1sN0lqqtUR7LF84TcRADs8Y6JbByBUqCMBGVO1Pmy392VM7V+v24fTZ5uxLv3J/LB/OGeiEiANeZ4dycRhFkdWzYibjiwRjmPgXOw83h2sSs/5cJD0cbYPpDiDAPF/uu6EmIw6n9nwymbPojtpIrZcu/ayF9LzTSf+nNXK0l0YjpDhboyoXzym0kRXqoxG9FUC1OwFkgdPUaiqh/aKaMYB6KS54a2GfYXf3QseeFGDzqRsx+kzwESinVA3avmh1w+a0LnuWt61bYLA== 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=AmG57QquwHLga+aZJ5B8DNtx/FeDLVh2/1PDy01V0uhvhgAAs0Q6xeCuI0BwOWX+tmEYlldJ5fnAShikberDmHUnOsFkwNsO7nve5Kz16YlG+dOdj4vQNheNRrwjsPV8936mmg/qtzZcjms0SLWtnSCUJ67OgivyGMBmTrrU3KldQevu2/UDjavrgPs82MMUduqdsKHaUsO7I/FXbZAsW53zW5kSnuaIcE+EszxnNRDIGDlfeqdp2n7G4PYhR026UEJr/ROCBxbaxjYUK9qf/zfTpJsqQxdbUxaisf1fbhEr6W+y6lSX8Hy2LEyutVThqWveBDcvslZM31GHypokwQ== 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=ud5ubTymXC9SzqsWoss9xJpcKlW63lxyOAp3GrmyLHfXGy3kcVZYG5eSv/iq2e1DEowxCddwajteKDuyxaONzqW8T8CbFqSD2E7jSWP/eon8Fm3DCkClqcBRCy/5k1IGov3PcoylzY+RobXR+atJCuz3k6kWOTnyYRw9IYLHS0HlnE9qSvULhUHpmcdkrjP9iwnnRm5yeRZMJk6JAqRbC0UYuce5t20U+/gsOVEH+C5I+qd7Em/x5jGR+qTdOQ0UeV9Hw4BoO73ixnmcmR6eS2JndjialxYCwh64UQ/O02O7XGp8uND518aSEkJvqKDZrTHcKmhWIPgkmqc6BktULg== 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 PA4PR08MB7459.eurprd08.prod.outlook.com (2603:10a6:102:2a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 10:12:43 +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 10:12:42 +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 v4 05/21] parallels: Add parallels_mark_unused() helper Date: Thu, 28 Dec 2023 11:12:16 +0100 Message-Id: <20231228101232.372142-6-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: 01b8de3f-1d67-4fe8-a5ad-08dc078d8757 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bfBzD6fvQbCCU5MfA2MP3NlwvFC/2nBTV/2mOG7qTONSGgVBvScgOD9ZZN41zuMIaFXZpavVxVQ5kO5FC29iKOCawagwaM4ansrjgdxznABkPGzVIyHDECfi1N+Q1ANpy72jXZ+GxCwBcUJDQppQTsEKp7nfCdYBirgRWKOJSzSIb/PXU2Cmg0M01hyLjJcPjD8VU8vv1NjRjoqG4hj0ds8o+vrwL5vwred2mn0mlOnVSMXWeoRNZW1F201zUVd7RQ+5VAlBp74tqH45oP381XjRfT8ByhXnlGRMp/iaO4Dd8QTv/8Heq+MOqQSBsYdGxhM4Wx68/Ukw8e0jb40F3BCAw96TBBHZcPxQJjwDgeyIjjwDhqGmg0tHM6Av2YuqbjgyPOQo9sM8TimaNdv8Sv3q2ndYEDmZzVNlbjIAoWbWy64Ol+1CG2puSeQJx78xA5znF/ySyFQMMjIv2SZKA2VU0+6NEcObD+2+6ySrz6ubMgRV7aazjavgeq7dIqUB5p1KGTSkiNxztOkYVI6H1IJQ2MoXCF0AhP1Fj/1bl77CciI5ARTmUy3kyDl1VeUNf7L93gcWYMVYcwk7AFnzhVHMrjJGGhZDLdqc2yVvbGkCSGz5jCutgs2JcVatDOTP 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)(136003)(396003)(346002)(39850400004)(366004)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(26005)(1076003)(6666004)(6512007)(52116002)(6506007)(83380400001)(6916009)(478600001)(4326008)(8936002)(8676002)(5660300002)(44832011)(6486002)(66556008)(66476007)(66946007)(316002)(38100700002)(86362001)(41300700001)(38350700005)(36756003)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 48U7exz5DqftcotPAKV6F3ijtvUDf9tMb5CY74DkOBn09OzNUYn0xdoT41Ttc4jhn/rkV73isMmtJuTlFtU1IU8gVviTcm54tVWi6mqKe9beI7UTxbGG380fQ9QUdz6yfDg/9dm7+6yJJhPEBCnSWsrFWp8yawF6fbb6K0/NqIHshFeJdsquC7hhzNp7WA9AOff0gzkn1iRnQTeX63NZYo9fbhmHPUZNRw2ik7WFutmwO9CVjChaCd3qEa/nxHJRNb/vXGTVZdGSU5e/60mf0n+7Ak8vZhtHGahbNwcY8ANU5Dmc6Z1locNkDtsJatP7d2NNxScJ0I29kgexX2ftR26TjIexY8bUEthNR1xlYjKOBZhj7Eh0x2AcAgssmZujC9ppWMRA/dtMFlXQI7geTRUmRUXgruTShsiMfpmBD3UdoN4rqZWNdxLttlWi7jvuDXZ/lv2pmAyWlB9ewFVeJl6S7IrXJ4RcQFbEEUMGfXKRGFKlkzewNywgCporio4k7LOVuq+voz1mhYu4z6lfG0s5XegDru+riEHONZKi150EEYZdjtmRzIhBmviLD1muEXcyj6J3zBLMnrNk4jc+Wa2L0m6Emu7IAVZ3SQt9YmFxCJXSds9rLgfgYEIOYLmjmQPusC+GNuW3SVPYU3EiVlmVqRSgXtwUjDgHUb3tNNzsFfo9KQvHvA8C642hYHwy+zmkaNVSg713Zd0jJbPxpbkj4M9H7VXDg/Nygw5LWLQawP+pRk3GS82DGMfXUqEpHIGGaPCaaL4odWwEFIW0CxzVP8tTHtmJ6v+8YYNoTbaYJYSYh6yli7VyovhvCVikoZh/L2YvtPMEllHqC2ghwnVI0MYTzJ2Nii7TJKQCXrjBvEWVSOS/icfwAOP1Ho7J/kNiS36HChRWMsGBWxtpW6t0FwTN0oZ6MTTwGgCkBr3asglWCgI4byPgHyA45vvmsC2Fmdh7o5nvooUUKVErDjAsWoNY3Qx6EPRveOixNRzeE6KXpTS6sjSYq4YmuTj8VQlNOOWAfBVnc2OmbHT/8C1CFixbAogE20wNow5WikD/LgitYvq8F0T6QrCbu1+zzR6ww6xy7pnRJmrhLBoQwSi5PI27VpO2m0zk8wCaZLveAaResj2Uc65sirEn1H7y/8b9C0W1v5jr5zeSvaH3JiI3wuR/LBxPjPgsUIeZZWrE18lLWWHQofzURIkKpvHVEJ/9ZAWTqdabGMU/mKb5kKkRh2+I17lbXPTAK1jIQskHfMLLacG7plu6uTVc5Jk8kGAGnCdsqDZSCj+hQj/4eSukpKa0iAAcWXd0FGViNUrNZ9TlGAx4HC5a4qoFLujYSgZUqgbxqbNh7PCYWM5ItJsxcPE9t0Bm9L3ogaQHx+0xE6gEoBiPnC63TIvZREQNFGl+qv9evloUL/tc87mvvltTiu0nTFl/j1d6nxJ8We/j7oaLj9n8tRvjo3YJxYDJ13YO6o8KZOmT0d2Q9va8jkS1oprnH9Ik9U/kJMRNB1hI9tKCua+J7GNmDH2/Ihjfz43snDr64CxjmnghdpO6n/sj+pV1/tHN9uUQlFUjKpNVk5s6qJdIjzyFFho1RXw9ElecuIGV0Gd/y6Et6Djq6EB6LiwhdVwMc9kEgo52BCc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01b8de3f-1d67-4fe8-a5ad-08dc078d8757 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:42.3276 (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: yS4QDV2PZ6QItyVYx3IcjMmrN6rkNq1/yBC3S9QbB8A2wLhQHcigo6kWQozru2FstayZaTlBeASvk8U/ryaze+Dg/gz8FEdLQwzLYfnSJuU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7459 Received-SPF: pass client-ip=2a01:111:f400:fe0d::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-HE1-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 Reviewed-by: Denis V. Lunev --- 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 10:12:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505806 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 50958C3DA6E for ; Thu, 28 Dec 2023 10:15:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInNs-0005K5-HP; Thu, 28 Dec 2023 05:13:00 -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 1rInNo-0005HT-HY; Thu, 28 Dec 2023 05:12:56 -0500 Received: from mail-vi1eur05on20707.outbound.protection.outlook.com ([2a01:111:f400:7d00::707] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rInNm-0000Sp-Ab; Thu, 28 Dec 2023 05:12:56 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XPgUaCJOfZyzDBvfQcFmoRO4cESXYgvN8F3CKQs/dXP0ABTG6Jk5x1IDeyjWF0noRWFl8jVU7mLv7Rp08CKR/hwWfAVjtGe1but6bYBXM0HFxMdykQglKkGoX0M2yfcIIfX+Ki4F+wbFFHwBh8E4VvAQwlItjMUTW+bMqZZu6fl4izotKgyES4lm2WnStA0zjlJgkO6PNztUtL7XNPl9xlQjYICgmdjH9aLZJ43fbO6N3MAari6SmKItb8I+yq2SuDC1lBIvRfi8bZgLflgtYsd6webCt5wAg5tuy3QN1o4g3bGcwZ852mSkXw7Y1pYeVT+wUFsYWsH+bC7vys/Yyw== 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=hSi1Kf1DLNvbr67hi+njQzdnK0EWL/4449eVnMzhkcP2cpqB6f+YlGos4WrQZe+vemWOBYjJjlhxDXZ8grOZ4CKxOpKhMB2bG0qegWqJx/gfcChUiTpuIakjRuRXI5NBVrHsaymYiKa4ZUbdQaQjRNS/b8vIfMJAsu20sc+0jHnzpE0TIMQr9hNH1mKz0vwMxGPOBCmNdAFeR2TsKus7UGYw19/4xelxZtyr0HklUZwtzyHyvznQYFhKbixr1YoyGAcGxJJlnA38X0TyHdgpemQprkPgAQp3Y1lOtCRcFeeKuoT9BxkXbxbqOiC6QSjDzQ5NUjJR5tqZs4T3mN59YA== 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=FvSO83IfOrJa3+1KiczI0IGOZGK9VEFgpRNk4RA5f5u5lj6iprf1TvR5bL8L5myR79YJOY7o6yYDxGM70RQm344aH3J7461E2vrdb3EwahMvnAvdMMJiZ3hw/F/5us+FQp3MKrqWm+BtUuItGW/yQcpI9iTaY1OCXuqRNi0nnUgPLmgC8R5nC6+jkuMA1sGxYSSU5A0XPA11VleVebe6x5z4ktUbOcnhr+M0wua1fR5F6t5bD7SfUMwaG13zriShEf6JrSfXLvJz1ORnDmTb7RbWuB5ZPk0CvjUX94uyWOOHzpvlg5JZ69qYxGlfrHRvvGvjtXCZ/AhF6ofoBxP1xA== 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 PA4PR08MB7459.eurprd08.prod.outlook.com (2603:10a6:102:2a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 10:12:43 +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 10:12:43 +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 v4 06/21] parallels: Move host clusters allocation to a separate function Date: Thu, 28 Dec 2023 11:12:17 +0100 Message-Id: <20231228101232.372142-7-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: fe39646c-0756-4fcc-191d-08dc078d87ab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5giPrEzPScV51HrO69+Ok4BLyV1AFw8tHvBwmTJ/Sv8Pd0cLerVFx+Fcln+o7/IcCaGWxVeqTBarR8WdIBCSCxjjqQ1OUt7+hx+X6ugRCY/2pxCbvrwJ/hQ7A8fdxVZcTq/vXDi8JT7P//A+blOx4wHDvOfB4eh/n9+2GiX8flHGCDK+6Zmny2vP8hyNNUIQJqAI5sY/JVjQQqtUPnwmT6PQSU5lRfiBugglJZfoqvfICwtJWJp/JMrLOxOs6EUTqxQaaya1vfIEQ3xKE4+r8BBlgyb08s0FObn6pe0a32DAT+h2+e9xdbTB+X4mzTAlIMl6tP2AWJE8/i4k8A/No0f5j52xJb2MrzfMy4nei4+2JsAIAYqbEkg5XUZR7Ry8SanW/hzOTGhsEHXklKZA/9sw20WtE3QCzBJfe3L7F5p/QeuxV/Pg0cT1HjNTAaeNgx9bVM8KHBT7GOGvJdAUVU7tUxYKAFmXs3DVoQIcyOU32hnMYh4X05TGtwMzvbxb8z+jfQxN8TIAYPDrPlS0Jf4V75/7Qnxu4duQTRdbEMOzcuC8VJZz1pr86/YDUnttpsmu5VaVquzkOq0bsDsOMSs/q9RMpLuLiywtCg1TJRJ8qvgIbMjHHG1osXSO5vmr 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)(136003)(396003)(346002)(39850400004)(366004)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(26005)(1076003)(6666004)(6512007)(52116002)(6506007)(83380400001)(6916009)(478600001)(4326008)(8936002)(8676002)(5660300002)(44832011)(6486002)(66556008)(66476007)(66946007)(316002)(38100700002)(86362001)(41300700001)(38350700005)(36756003)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nrNaXrYspHaG8eS8J7WP4ON4TGN/99bXIRrMVH/at7tdT7eJEiDOvcWgGUXyPIrTMP0zoC9lZ+9sDHu92CX9YxmXPzUx3l28gPkuhBXARgbQy3NDWcSK7LEeW1oXzeUPBryMyWKmBdTbXHzimJKR+CCqUpBBoIabXvydfMf4ZFmb4b0xez5PunhW37/FhMw8OWKMSz82hGdXxbDE8asFe3TKhOKXYkt1vUcPEMHtYrTYetf+vOgfdST7FLu85L5fPkqOXPl163YARqMZO5HVj2H6JLm2qhrjFJainZBLQ8BojFcBnb6XcYLRMFAxlwSbvr5FG8SZxKCLd6WC0VKcGJiRHCy6ea0xYfks4VtsztRX+NYebjdAlNfZZsHWsas8uiyjnotCvvUevYplsKXYFWmi+xf8gheLYwDewpXM4oenFAqzHC3jY8ArtS6kiXHW5TTJyKbIgqV4GLQH2X0AuiQSLFUjnvHeFCJ7dCOeXF7lSerlPEz6C2ZMeVbhBP4zhsd4fLnsLYoeW4ZhligmJjjgw6zjxaeZewAPpoVCE0a35L4y5Bb0woG3OtgKTFuVzA12WssrQsM52QCgbuoKR9V1Uc8DWM9iQjC7lfeS1rNJC//YlXJbF94OXV1GiFm1uH1SOQ5gUDDPa884GViTa+He9fupOorlCLvYUi9h2FO7oS6u8bZO6KOPjecrSVB0V8cRuJhahBMKDJuZa2vjQg/bzTF6KICRzLZFQp4aFcJ6c5KLe/gMxULW8NrXcT/ufxmP9hJzAG3C5h+SzGpaBWXSexNZeLGiXT1hru8WhRIDjITJXpxlnXTGD6XkwmTWl/f/5yIIW5+1TSdQBfqxRUOizAnbGfjd+6KN0AwkeHatkhD5zOjaffPWKfswQcS7xVqRh/91wr/7YcAj3a/gabGL2jowi86nwYm4TT7U5v5b4ejQzF9uemBu1Sx8MpoT+xhTtSn3OZYHuBzzRh5B330yc1mgUJQj4LZyAjc0zGHMPo0qy+Aeyz9/+vj9d7fG5Y7YDeJ/DTsexBR2Isx0TWXT/9WW8UGRbnuwt6BoGjl4m+pcojwRqKTih0KB+jYMHereClECKb2MIGzwlgPMCcxhY95hho0xia57+HfORJ3ndD3NRL9GbpiPknqClcq3AmKPMdxfY1AoeYyj+BIJRIWUGq298vtUeWLrRtJ47l1lz6nNNMbiKtx2XQfaN806pTk2MYRvqOKddYwLBmdcIYC93547TX1lIOwghHLQDVWO6LTcgQ7kKWaQKbKdiSE+t17L4HR2PKLLSbvVYib/7catEgWbsWC9rvyi1eERWQnWauC7NmU/epde7TwBTrALRj5KmrWFNOZbh6lpGOMcYLtEeu2x2yMh2W+Jsf2pAL2VhWMXrMsS1yzDDw3BscAfTgyzTDY6gE/FImaUrcTYdMpaLx0RDFw6deai02PQE6EUexzzlsN6BhwRqwbG2Kk6Bs8RYNlFfxia+TM22/V1Rgg3GL0NJWe5d86fp3wrJwvZiZYznwBdBPyNbmFnSTSno+Gj6diQ+y7tiPuk5qs9GcslPxA4OWy+XdQMWOUbPq2fUKdY7yl1gCWyMayTkqtCMv7exeWdoqKfeRVp4AFcEyXZ56nqmc7QsEewFd4tn2g= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: fe39646c-0756-4fcc-191d-08dc078d87ab X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:42.8976 (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: DTrIjdE+mLC2ZoH0WVs9HSuw/riU+B1VWolHs83wjDhF5+OAHjfi+WnVVPEYJ+cyw2MKXhlds+W2jqPSuDh5pi9hmkS1gi3a1mfIRF4ryyU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7459 Received-SPF: pass client-ip=2a01:111:f400:7d00::707; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, 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 Reviewed-by: Denis V. Lunev --- 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 10:12:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505800 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 589F5C4706F for ; Thu, 28 Dec 2023 10:14:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInNt-0005LM-TH; Thu, 28 Dec 2023 05:13:02 -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 1rInNp-0005Il-T5; Thu, 28 Dec 2023 05:12:57 -0500 Received: from mail-he1eur04on0713.outbound.protection.outlook.com ([2a01:111:f400:fe0d::713] helo=EUR04-HE1-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 1rInNn-0000at-NJ; Thu, 28 Dec 2023 05:12:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cLADf5TpIHvuMx0eTvh8uslGw/3Wm/vEJGHqypDXrsKW16c4EvvRHTE+T7XHOJz7yJdbyH7wNtnB8WXLk6/mFjq+jt6hfpLjzhlX+qvQnR/t4Kj4wYlH6geRJxNfnGgZ993Lj2pTcLsV0Gm8A9ezNgmYSN6raby23fF7KbOjWNCDJQ0LE/FTY24JBeCS24kEvVu4PEAzw8OAaCPGFINmGAZZM45YxpkHK5NMzJWCcS0dSqnWU7ZFDsdxyJEA/Yb932s8PAmBAZvB9Lve/GneN9/LKS6a5a3a7cq3fsx1AjrIIC3li8fEWHiJSKPa5M2veGjPVQlbbVkEGjLadSFUbw== 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=cWp66KOdkrYpXAUlcw2fnTNHkbg4zijngwfHC2Vr9GxS1wKjXovCWETcBQkcRVZ6dr+HjXPbrkKIQzAaoyJrcpyyUCcYVdOyFPFqouRr0phRYqAytYjr1G3fqkfnEp38tbj+aEtPUeaBiHiBnhrsXkd+jTV71ZEwbW3O9YZTUcJHHHubLh2UtGs41oiAw+2c0vKpPXdPJKH+5DsKFsF9iFmY9BToBbHaoyLfswZSmq01FrWOLwdIOClD5iuKpCkoNJd9J8DyQ4u4Gx1fRz9aU/utOJkAN1Yr0IqCaKOWGWaQapPqLeXR6hQ9+nCMEifvWjkwACpwilF6F8YUiZdvGg== 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=FQNMzHzGmq+X5Y7G/D6BZBclX30yD3kjEc3A1ZP29mvRjkXVxc8nbiPym68wARnG7wP87R1xoHT6PsBkqyWf3HHJ1HB4AIgqEwISETSUjGpYq4Ku0vK1CPIgzKt+Y+qnde9iGDQ3+T7xfNHv65VLBH2MA/57jJ4BiqDgPBRGGmVzP6e4YibQxkKT5BQDpJGBbGTe5jcYqjxTZRfOJyZpMJhcrchx+wGMiRBGBBjVJ8GHVAUL5kD+ERCCwudFm7iYoWxMfn9TxW2jgekUnBXEqNqS4tEQtdx68QS6HeOzrdXuFu10yIBgyxOmPQvNP/CWnxm7eqYrHpyQ0QYPaISkjg== 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 PA4PR08MB7459.eurprd08.prod.outlook.com (2603:10a6:102:2a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 10:12:43 +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 10:12:43 +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 v4 07/21] parallels: Set data_end value in parallels_check_leak() Date: Thu, 28 Dec 2023 11:12:18 +0100 Message-Id: <20231228101232.372142-8-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: e09a0feb-be22-495d-ef56-08dc078d8800 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rsz+bvSykrM/gSlIjrnnhqEzBHlSE5MYniCZaK0OaZUNpo0w5MSKYXGk1Vrv5CKyN5HG/+Oj6y7LOHKakb1sR3e4T0Zwg+nQ3iLj5qc/Z5nkIyC9k8WWBW5iISzXtyglFsnv6kgKRdxEXdGEEk0pLBUd1grPKV2vad+loAEDiI2gE7y5/QlJt/+1o7Cl4Sot1/1xVwzKkzVkNSd851fuybly8HT+yNeJt7CmU6h/RFHe7agVxyLixcOvZm0SUhnMSCwtmU4hGAf+0Ub5syjtCEqMA0gJ7Xy+vPsDH+Ym0WKa2JaGNIPtR6ZXg3hxNQ7JPG/7PBoReL8GgvxANGZF4pYoetz2jZY1XlriBGQLy2zgAT1iL2ZKVz+WDyKW/fJwWqPSGbem/2DxaoAmHnrLHWMmValBNXpWs0zrW4l6wS3dKfjQC749P7RYrHoeSIyoKpCfpd21PE4Zf6m2NB6yfCMYt7KhgrsKFg2YVJChky3P+MtHoTAIM7JY6eKZAop+/E4ht68+mKn3rkKHgnhEMjtILRoa5vjfuhWZ4FM1hq2crS6tZQ15ZCBC9YHRtiZoPXsRde87auXtD/OeM+lo7VLfzZKKCHz/ojC3/BlWa7oTIlSoYM7DkZrhAsQbVx0t 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)(136003)(396003)(346002)(39850400004)(366004)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(26005)(1076003)(6666004)(6512007)(52116002)(6506007)(83380400001)(6916009)(478600001)(4326008)(8936002)(8676002)(4744005)(5660300002)(44832011)(6486002)(66556008)(66476007)(66946007)(316002)(38100700002)(86362001)(41300700001)(38350700005)(36756003)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Xouc8eklUek+ML32DNKTbWk7X7Bch2X1kwUXGdM+4BrGtjAUtOkuKkOp6PbWWQz3ZbOcSwYrc3r7P+h7/A8lDwnsyFrQsh+iWRTLSf/HureuR6caMKEbFQqGCGbFc1LimM4cfR2/nCEncjX1dnyjdzeARxmeukxYWJpuLPhe4MQANX/xGT04soIJqe185IKZzhiGEa/MjH004nN1LFu7JpvL7xEeIznk8IXPLWA2T6Hk4qXgPJ/le6BNa0U7rlvPyDpI/e73jUQnSgHDR08T63j2A6CgPzaQUCcexT90qybsdhVoGwTAxsHqjU1REaNSBmT/KjNWhHsgbjzy1RTAmbisdattWMWXUWP4TE4/Tne7SsCoOYdJsx+HSwNDoRz7gDR8fws7rqgj6qh/3XjA2M2qf1Hnu5EW6ISPg1fI1halUqmOC1/iSex4QW3HYCW2IQHr9/CbjJ7mrscZ1x7vDE4F5lVvM1au7TOnzMpL4CfIDxQCh3Nyl0WJ9uXQRC5D8Inn/mDGDjapvv7wJgGwhgvoftsXM6PO0QPqpeZ+R5L5bT5LdTDVzgT+Ag0GcNz4ZW03O1L5uxNT7HLjIL5II3eXrLtcWbkLns7ptyzwiBLEBw/d7x7hWprHDtfix86e/bWS4RVWdPLqnlTVMxF44OqXxrbu+Wb8HD5FBXBRqzZW6J+TibNKmV/4v8HToD7fDAErUO0hYpaU/8s+9aq3CzZEGnK+fW3+cj2YbiCqrA26G1nFO3RizW5ygnB2XH+N4+Yl3H5BNs3Yr2nmEmWwre/3VI7svuZ1Rj/OOQETl++mqAx5XK0NpzhFACFYc0u5ElokHxuG7LbIFgvvThKiV+tJ61Eb1HskP58XqhbQ2lfXwBzLJMEZG4or+RGsleZbtS66RQdme1E0EMrlzD/Zgu+EvPSZXCbw5NWSCFgcwOUyfLz5USzLcalG+EsxQv/Xgl1oss5gMfLlnwTEH8Q5dLpcGc0ASuQ/+c5g+koPQcWxxzonsge/g5VtGb5SQBa7YHsKHYT7exhDhgucwKu5EowX4++HcbwYkBxt6ZSBnncoLfLY3p8qsn8O47Y5qv9R4H6LQki1kwm22Q7IGDKPJLaXZKHVMlv7tJOGvjd+/qanNzhhSy5JmJz9YKJwPfuLcd0DimD9BbKtQf//z3xP1eGXVgow0bKH7nrgOm4jQpWYN0P7xQQqPbG0kDh38NDcOGPXjQkTcMXBNX3npprnbbCIj2E3FLQf0ZWWr7dyrKxECZd1rLBcOWBXueRxV3SR3jwKxuAji1UVCzG4m3xBrx9XNQKlRM5Srk6EysZkah94LggdsZC8A5+MbhKB2Z6pfjXLtEn77dN5X5CLkveHXV0L5XocCr+O8qMcfvTOpNkak0mzLqqQ9vKLSysY0IPOgPS2xsOzj1odxy9FqAbPcd7SFU49pIUQS/uCMTK/LdO10/4vn7PeKIok63MlkMpM6z9gfyh+8qzN4bwUVhrCWkdwg6vxmK22DIZqji7rf7S86ZiUBr9+P2xxmLZIpd8fUqzr2vj1UJ8VrH8hEW+LCZtpnJMWnP81MT+u+E3BCW4gGftfWQA26somkAoilvSVw9KTw0QEAWF+eaJar5nNA/jhNroJAEhQW5oeJKrDei4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e09a0feb-be22-495d-ef56-08dc078d8800 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:43.4991 (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: tidZ9BdgCSyltktOaqlDH3mpfBnSYvER4M6w9QO7R0+R2NqbMT3ag8FKyVHrlQ+UeFWUePe452lljMocohsGQTaGYw4aeaw2lFImO0b9Ti0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7459 Received-SPF: pass client-ip=2a01:111:f400:fe0d::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-HE1-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 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 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 10:12:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505814 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 42DA0C3DA6E for ; Thu, 28 Dec 2023 10:16:21 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInOD-0005Qj-4H; Thu, 28 Dec 2023 05:13:21 -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 1rInNs-0005KK-UJ; Thu, 28 Dec 2023 05:13:00 -0500 Received: from mail-vi1eur05on20707.outbound.protection.outlook.com ([2a01:111:f400:7d00::707] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rInNp-0000Sp-8R; Thu, 28 Dec 2023 05:13:00 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TBVpIVAR+Sod96ro6Y0zjeM2gsPJoY0/liSJJDp/5450lIwNdIsV8LkG840++Kiji6BpVpVEtliaH7NP34t2qSrZC6brB/Be5OV6mi+Ma8+LfksZE/BW/BFk1kslkRjLrmLn+I4KXO6JOSoMkJABKKvcUvMnrN9t9YKXE/Nxv9lKSNbcV+LgeUHvioY+FR06rCu4lBwPGZBvomtmKtvBM5DeahSl0RXfYv7Xb1LQCiuNWXzOnPtqwqD4FniGgttzk+UL4bbWhFgIsSGMHE1lBIpz8uOdaMMw6Xvj213NVaRgKb0OsM/WqlYICK9pC357Tmwn3f+qwBrAyZ6X8F+/gg== 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=c7I3jOiPgIHFF6WqR9PeQEQmRcoVwB85NvPSTBmm5VmlhA4ZXKbtBHICEYObrAuf6tnWjC9ZW/kcK3/sBEGVqGk5mS11pI9opi7WBTffksTVrnIHyCuX+BMQJbB84j8zhmQJlIe9feN4dBlhL2faE1Jnw5O85PyZlhpr0xYG5zU2hm2NT0d68/2Py3OkSpGqD2DAHnqlaqi23mDpZCrlbv4pwICDQhVyKhX3s2eK94i3FtjAfBI3rCNPNVsFsXJYliRV4phR2/sZE5EuuJVcGVv/h9Kv2zA+q+DoFad4KrVzEZf85Q/CqPLcOWfvSgsybeec3eZKMSOoBocTOsZ1Gg== 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=NDiuYJ3PjqxKS8Zlan7ZS8ujUsKarutoZU+pA4IUzz7hkYvdBqL+QFyNnFP4YIOpdQFy9r6+Zp4NhUolJHqNEYgzPiZ1qTADTrNPPhUvbs4lBt3zyo8dglFc9fdy7pTvlD52kDxwrC/sdjiVxsg5fv592uJEarS8tl67SQ9QYC1h6/fECJIrtNzqKhmTaLqnQyhZV/DLjT5n3tHuG7Vf836AJgGa4a5nFSm/a1cIXZHbyfym1y6Q78QJ2c6cn4s+loigPpMg+fVc16VP/D4E6fr8qb23USulVwsFLTrTD1CLZvyST+5Q665dY5YKCNT4H+owz4nndivpJPWr5J/laA== 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 PA4PR08MB7459.eurprd08.prod.outlook.com (2603:10a6:102:2a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 10:12:44 +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 10:12:44 +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 v4 08/21] parallels: Recreate used bitmap in parallels_check_leak() Date: Thu, 28 Dec 2023 11:12:19 +0100 Message-Id: <20231228101232.372142-9-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: d2e355d3-f6f9-47b9-ed02-08dc078d885d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1/apI52Y9SXbuPXFy+cQturjRYJL/XU9FFzOGInie2wDNkCh4iln/knAYXS+pfTLt9m3hgSB2G1IS1FRFS/Fuv7E0oUaHvq+6SkAvZYA+vGR2ecHgrBiXAKeSEsw8vWeyYUIMOFd7NRhUaS2S3kziE5euWDB/ZJTzjePjtjqyjLweE1+Y7Y8UYW9qWYE6/Ybg5rRTt6blqB5DFwKhWaLD9I3CcujnGPnjOMzVwAME07V/NMtgVufVin6spkkmCu1QG6Ii60AZEXTOjsVgxXfbYNlnIBRbZVNk5sI26M2BtSSp/uZqDDZBCjhyGr/q/ya4nK0TYGiPygadqW/GrE5pdrEQHxieFBOiMs9gwiiD57fuWfKc1tn9DNJgyFLYqHZE3VDW9esMFbrunV2wM0y7DUd6Jie16Fui5ddDNoRXr9Z+Ea5vvSl5T9hF15FNJkbKTe2OHluGA7uk+UdAmSi+qyeJXeGvHFCR9pwYptUxNxti2eH7efyq86yIunCo0fmNwtZRW5CfJiMDhel6UEOBxyagsg+Ns8X6hF+2qBsZjvHRnsJCwmlz6c++5VyVcHQhw+2gFw7AwkUIPnGKjUKs+Dr0gXQCyD/DrkyV3AO89+SXyPuKUVhQ72BNrblK2Yt 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)(136003)(396003)(346002)(39850400004)(366004)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(26005)(1076003)(6666004)(6512007)(52116002)(6506007)(83380400001)(6916009)(478600001)(4326008)(8936002)(8676002)(4744005)(5660300002)(44832011)(6486002)(66556008)(66476007)(66946007)(316002)(38100700002)(86362001)(41300700001)(38350700005)(36756003)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UCF0Ql9FglyNV/gl6rpgB3VcvCgzrHIjpew+8eGeDsLaBhNHXziizj9j6mx6JXpbtowD28mMkiKOAcE12SScLAWYJnEGjSyvVjC62SbdmoMHLUkYztYwVt58fYAx1HiKYfVzONzQBdMMsXL36iFNLALtQMxPthvak8tVa6K06oOHNKjcby64EIXEuC9Wrw1bkzzuf2GVQUFs+p91teP+iUNWU1pVXSBb0JJgM40VWtnoi/80IOFKXteq0KS35nHzgA34UKLdMsY7Pg3pCRxF3K0udqKQxqy1lLYbBT/v5KGYqH3oDXJFzfo6psUuBcVbEyL01JUyvbnk6NNZmjeHcd8zTlEq6A63v+pLe2fL8COcZ2ideeM0SlMsk/GtCAc5/bU0jQ2+CKnQxc84uMy6lKv9XRR3luTdr5BT/eASAPuMToYGo91/ajUoDm7Ym4AAOEvC7DNM0CYvdE9RJnXd2GHP7+t/OFWC+VKJ7SJXMy+ICChePDXsHorq1IyXp9TdylXFW1guyMp6bONgn9Bi2Zz4sTUSuQBDO5Z9TMTUURUeBhR2Py7zSYzRyi2u2WFm/QEEefgxiXHyFc+dL2nQNsdnlb9pnaW6yUEudsyWoz5Fymu+wyLqQtGkznKytOo+L1cwGXhONmjAUkTojwqFBj4vVG8PIADZlS8mPK2RoRZiyhlCSsap43RPyocKQgpw3tBCXaMaCGSz50v2iKP/v0DP9qZ4KDzNK4gLHZSgniYDNrNlBPgTUNgLQKeJm3fnE/IV9QmB/zB/I6rd9uuAEh0XA07O6j4dCmB65FLAeEA9LNKXWOHSKP/VJNyCRV0kbb9sr+/91zHg8rUo9LIrNLQ7qLDghbtWORqQp7Oh+aSgyjeZw2mUUygbFAa/SbeXDAr3jnnTiWbumBMyD8wfnRzJASNDPnyXKfVd3f2mgvkJbhrFRi0LAMRJp1Ne6544taxNJSJtDRAJbuGg2wbVS0RrC9LpFGAmupm2H96VT1FuMj3cjcFIdkBDJeN12irE4FVyOnkCRUJNh9uknasSvETcO9qI014JzrdiIP6+mJpfPynYslgsvYw+3lYAvaPOI5M98+35cRDfHJTTGVQs96xI62l2bI6jB6s5holS9lsCRPMUGK268VMepEPIoDlQdqM8su294RT7nSSLo9QYxyfKunMpjU0PHtGW/83CQ4Iye0UinspotRHY32swXRcDrNrvBEGsg9GKWlhYirB+Dt1UJeJoU3qo27BB9tSpRf4rxqEboPv14Cjj7czWHoRi70dn/mGdrdo5+Kz2G445xcOndCnRrfDC4uxvcaQokpg5LR7pFeOdoArHGCJiz+DxrGErNn9+qlYl+UcXINqb+fIdZSmX6XBmRqlgn1nMVJgHY+w4ua6JWEPMIzltkTzVuvzkics2XijbagUOPCIYKIFVYQcWgew5ILG+eojUXi96CMFtvIHaveE+IH9GBBylTceeeLpJCf1TPt/pyjxjGo5wkb1lYNQBaKHP+8GLVGmmTpqQmsFmA7H5jrhXEy6sdYYSoBMLdqo7mNVbGDpYNbhHEQl8nErLBUM7XQm6G9DkoW+kjH9RpqzFLz4Ykl47EuagK63WG5ywBkn1WHNl59iLy43o4eYHTRqj4MnP2Ag= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2e355d3-f6f9-47b9-ed02-08dc078d885d X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:44.1141 (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: aFeZblnkskd92iiDfCq4P2MBYVOL6EJmRww/PSA/jG5MJaVrymmPKYOdzkVy6kLLeCxsQul5/z6LzZnnvigOmLRkxKIWEwO7y4Fo9hjbsX4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7459 Received-SPF: pass client-ip=2a01:111:f400:7d00::707; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, 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 Reviewed-by: Denis V. Lunev --- 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 10:12:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505808 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 78D15C4706F for ; Thu, 28 Dec 2023 10:15:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInOD-0005QQ-4B; Thu, 28 Dec 2023 05:13:21 -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 1rInNs-0005KL-UW; Thu, 28 Dec 2023 05:13:00 -0500 Received: from mail-he1eur04on0713.outbound.protection.outlook.com ([2a01:111:f400:fe0d::713] helo=EUR04-HE1-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 1rInNq-0000at-Lw; Thu, 28 Dec 2023 05:13:00 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kt5RZleJ7cVaWrR2ggCRwo3QWxjuUTzdD1OIQkmw2Hyy1hsu942bHcX98XFIwWPD6hzaxS37NTunD4mxwBEurrxHWgvMwStPHpUvRQ9fMB/lzb78mpUUOOZvBctgCf2cCnnlGfiQ3wGz8/XlKf57ypxUKzgZpjWedVvYbuf/50+wOW8GUImm/u3tKpG5azfBFoPh6twn95Fv9kNhmOrLr+sBIKUrYLhuZAEUPIoWEUx4F3jiJ4Pqf3PvVA7XVW6XRZVNJAzEyBE0974eFNES3tToZcPwHcO8wVdJOTMpdheRanvs06xB0Z0Ipuke3GnCYAqIKcBMs7NWfg9nA7L41Q== 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=EAY1fjkvp20Q7MlX5Fqfir/Yp89ptsSiMUoWIlU+ihDIQCfGYSHsBM2cNBQpODLBkqh7d+vnHBitsIU9XXtm2VkNM2djj+I2xpP9Fao2IP6WDgPiZJqxF0CWAxgVsSchs6oIrfKQbRML7Zd2JM7dzGp1/V3pwkt55COLTo7cKcEfQscwm3fc1GsRVCLr4/GYdDMGrCa+UKVjwYbfAMJuKTvJ4dFczMRfWTRbk2bZ7v05bKX5KV+7fYI7UE+iCN/YNBvzqVgH08wogtkbJe8E12vM1jAYHXQOjSh+XFrd0VTqrtKgcaSnrOhGPfNrV0Cib/wMVJZZilRrn6hjPR6p9g== 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=DQYf1ArQy/o+WsJjErpr1DcgpJ839wJZtvg7stczEnzjE7UwzMykajYde+kCyRVNKDEurFbF+m8w6PLxnVA3jxh/yM5U9zsbOrSoK6zeQJGQWGqAvMTSjEeuAwi1M7roc1m+oi1aAz4TFZL9FsW8Z/N3+OOs4c+KcgkD6i9ti+AvMwVbVS7DlCsAXeDlz+phfWsudTa5MYNtETQhYybR35sryt6Fd+uUIbHqarHt90nGbcY52RYCvOQ+hZwkc9FFMlJIWRLHR2KW5HuI1FJkpaSIwNzRb6J9J303ux3JOzDIdhFEc0W0+W9Cd2GAvKA25mVRMLp/kVc8jpaIB+eJ/g== 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 PA4PR08MB7459.eurprd08.prod.outlook.com (2603:10a6:102:2a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 10:12:44 +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 10:12:44 +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 v4 09/21] parallels: Add a note about used bitmap in parallels_check_duplicate() Date: Thu, 28 Dec 2023 11:12:20 +0100 Message-Id: <20231228101232.372142-10-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: 2d51990b-4af3-4aa7-5f6e-08dc078d88d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cAqDsTQ8tA/A8IDHAgxXORuagU8UxfB3M+apirzX0erBTNALqYUYibozyE8gut3z+644fDequ5AKi0AtQPeS2rCzJBEZytvh9d51zJsjj403Tzymd4kV0+nr0jx32jX0KtUa8sWiR1r8OZzBtQrIo7cAxIyyPPsjlAjbEgpA+uRRXYLzgQiZxqPH199B156jilrHl9FfpGSALydHa7WWyPLGvst9ziRrOwev0YBVffL4+ti/UA2K/+Hu0csQMT57zC5yTH1Ud3iIUwnCX/7yeKYY4d660x/9xX5LaPEQvOoOvoAjT1rTFBikjLX1UTZvhLyGZ+x5BjdQYJkxck3xn9cJdgF3p7Hz3jkj2WRD46v+p4upQeWu+3o3xKoPFw5Qv5/Zg7spTv0LUWaklOsJGsB/JMxSLcTZm1EUCqd5IPmvOe2LqB7r7kIA06a2X8w0YiZxgmgQVnhvTqaSw6S31CBDJbQE6SpBVzs0sQtGdXqpKJMqWTLP9QweOsBmYXgmvAMWgjhfFT8kUACJNX4rEmMfkiQwbInb43XNxlcHDTQdNWWo54W+fIt95O/x+aD4Gum05atADB0onLv8rI7PwwsnFvLSOBaPbdSuBATIABDFKN2o5vx5uEbpHQyQ6lC7 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)(136003)(396003)(346002)(39850400004)(366004)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(26005)(1076003)(6666004)(6512007)(52116002)(6506007)(83380400001)(6916009)(478600001)(4326008)(8936002)(8676002)(5660300002)(44832011)(6486002)(66556008)(66476007)(66946007)(316002)(38100700002)(86362001)(41300700001)(38350700005)(36756003)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W5XFRimpBB1YLURs9Xm0B84K0Y37eczIRGJrDkzvCph1/Xq1wSXRp+XFdTRhCT7DCuMHTL6Vtx7SZQm1U8eFgofoYSxwkjOTH0D6aQJcsxdJWhT1+2/iE/o83wmKkimyhbzA9giqjaUBU8DpR7H+t6+mWwKn7WBZPeG2G62O/TNwJSBsTLz3HHYrA2qh41rs/iZcCMxsmc/qyPjqDoInurWs+2ht5uLhLsv6TV6oiOyW+NfdrjSgoVMc8SJXseDz9hdhv0eCuZrwfQXGQhpLgvWPno+miVlRDzVPU+erQEqCYnEU3aY5NJ3MUckqXe8Fba5rzdNI8xjTf66D3eEPDfexLZTKx+P6n7M2BgOFB7+dzLlvvglHeLeYCHmI8Z1wwg1bGgpM4YJ1FxSQAMPQBE2XgFBfF/ssnG1yssrybgZjVdW52KoapYGPhHOuiPsBowfFkZO1jKm0c8fgXoV2RiGjJx9cdup9Jy7leOuObqsTmYu9v+Za9IVhxLARgGeFTnO2pnN5DX4WFdXmIB+Ea0cnBgb8tillFypRpwgaSJA18kwGjz79yObMOCKlXmYKj5WZaKa+mQZ9FrIbP5rXvt5H2VjodEhej5o1nIsXXpo+wHMlJtjHMIezzPwr8jdSSuUePKemTRf+pqwcgBJ4i3RS6vLUVXmM7dL2+2XJSSbakjeEAwEapAq60lu+KSDIMYOBtrGQxOKF/w+wrwkNsDkRPSKjo1+jgO3jqhpYH+VpaHzhvjgVw30lbNwTg2lCO1eDEj8SWKq3zPc94EsQ2dbTbS/RF7GEDhFeyHGO5+HNPDkZy+jg3ocVp8pDq1veAuZ6CFcutlQUJwYBj7yeYfWL9pzhb5lvtEXPYItf9pZwykkylX2iR+/gkC6rIf2GS0D4KmHlYpn+kMEk+j5rtoYyhLh0F+RLtqwR6gQ5dJJVJMEtmto1DfnVfETS6yIIuh0Tb4w0F6ghx4Cy4qu0VyIAu0upvYJo1CMGe4r/P3J0f4WZDtE8hLsYEChC0EfCr0MXqK5sOYhVAc1e4d0AUrn6vTIpDyi85v9qjS0MmLeyb2Mu76b0nG2IIrF0QaRYmrSsI8hhTvkQb60RYyZMBafopFaLOuwL3UKcbQGpEnT6H+r/8PHIiOXno9lvIhe8l/MbegUEfzHBF/H15MCMuIg6YMvbZGh1sUfPzO5doebXc2L6w+vj8mudWA89uTGeKcpyZN0tnfWEc1w7kxcOvquqXBMLhZnIQ4mcQpa9/d3exBLgQEzDXv1vu2kFQA/GNmlftsPNY3SLGwIED+eXWh4/K9qcemNUmmASULcGqhnAxeDA0e92rxmedyWKF9BtEtaesAFDLnuGfXhkcQv1I7oprFTK+jygL6xw1/UdknDyUWWnmkT/BUh3ZJErd8v4fL5kkq7CcU2B+GeJZt54IlIEILjodKigYH4Vc/DIBq49+JmXFHBbj1w03rMflqdzernKHOBLoH+QzqR/UuhhxJvc0NL4IdDOSJBdT4DEWbbAZ9QkxvwHITiT4K6FzGynyLBXllarZVL0U/aCDWg2vUSQFCkJ3cOLH9hDwIXM/x196Ur7IA3040jqQA88vmDbPMuMpOPzGjxGPAeTbzDvFxvDdgnYBaiLcY+iqdZYZ8I= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2d51990b-4af3-4aa7-5f6e-08dc078d88d0 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:44.8509 (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: b61VTH+xZBeRI6w8i9KP7nrJ/f0MoY2xzhvZ0hooyMIja5ADVQiSQOPVZr5MPxwD/UkDQmqCQqef7em+iFAYG3Vuu8TDdntYjzqBM1Yo/pQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7459 Received-SPF: pass client-ip=2a01:111:f400:fe0d::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-HE1-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 Reviewed-by: Denis V. Lunev --- 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 10:12:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505817 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 32698C4706F for ; Thu, 28 Dec 2023 10:17:28 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInON-0005fU-Em; Thu, 28 Dec 2023 05:13: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 1rInNv-0005MP-86; Thu, 28 Dec 2023 05:13:04 -0500 Received: from mail-vi1eur05on20707.outbound.protection.outlook.com ([2a01:111:f400:7d00::707] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rInNt-0000Sp-Ky; Thu, 28 Dec 2023 05:13:02 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BzBtrv+FYoKdjgn7ZFSmoVkmZYrgbqnmj5qbKFgtp8+OoW2opQTINYN9uYtncLqBKSLmzG9vNab6vBZS11nWuZMngQKMqxhLiu5nhZNF5j3w1ntdYTpSvu9505cxso9J80poCJu0OD9b4O42yEg6Wgti8TTfgzGyoJ92Pl8GghOXCmJUuB5/X8oUdIPWb0JGpJaOro7gUuPYTMKNRd3Q152Ayymig0SfMwQoLWxQhnrc9XcxKzqJmTRrjaR9D+lvJF634S68u6sdFVr8jsLJRES6/D8v/a8gyRWGFwqLdOgy2zSVVDDrtA4NArKp3XDhiWkZGp7564x4B8/VqGcnzw== 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=ghomKrYuOTyiO4ApNqYSsJBU9QTqoqbr9UdYR27DKsT8bdmqRUa6bpymvhcnqC03UOkdIuSvgnnPoGj8zGh0CCKMRQUPE3HLboa63pA9ipXWXaw0JEuxZuSUpFX0mYHytX0Ob/1GAg1KH0QOc2j4QWtzSqzt+ILsu0LxWNDYgMRK5Ii43dVN/0wRGoSKDc++bXQkuSprBLl6mFE1SLaf7n6Sj3NEbyzu5G1chLE3E0RFLsgwwEJIosbpy2U7buh/745+4wcsihdknjfHAOwxGPJwVh6ESVToFIcXutsjMGU2lcMQJ6PEsZKPFLJQjl7lnNJzFy5lIJbsHJduLsvW3A== 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=eqDG8qNHq+ABQu0do56Ou1efeOI2GX6UyRuYDwVd7pQ3Z2qVGzwfJt/9Q3m59lTBXzfkMS7ArrwwFjbjDbMXL4O9+COQW6mhwh4NU8vbN7tC+hZPMOZm1mwvjEPXoq55mqTHuWPZcXqQ2LuWbjb/Tdnlx/8ydC7DbWUTfIQNReZcarYIUiGIRN0rXsv/kfO0YZApoIH+iHlMppIBtlOIGzFWX6dBhG+UfmSmX0jfWaitL1Tg3KiyDGmxf5BCkz4ulDtTnLpauIc6rLnvz4nqK4jtqxGKgLqXWakvV4eoGZtpe9X24KVMogq4ACbAMwBg+g3glfYvCNlAWAAKwNRu5g== 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 PA4PR08MB7459.eurprd08.prod.outlook.com (2603:10a6:102:2a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 10:12:45 +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 10:12:45 +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 v4 10/21] parallels: Create used bitmap even if checks needed Date: Thu, 28 Dec 2023 11:12:21 +0100 Message-Id: <20231228101232.372142-11-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: c878398e-0aba-4d74-e686-08dc078d8936 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qX5l26dWspE2W19UZQ675sIqO6xoD1j/n4Lrt78ewCZpeNMKLQCzOsD/hx3T1OAf23/H81ND6SKb9JmOPvjZxIzEQCL5vXqon/AKbdglo2/rJdycXKhStWMlwTAJTy9VBVZ2Kv0MK1KZAuX7UDQb8swuQp9ZYT4cppGMknyF4WkPabrUeegXtYmTz1RPvD5mw83jmo/NkNHcuCdtk25TLPX1HKktCuR01Bbh5H/HVanppMGklbnUWh1l87KKHTQBipFPMYmpgEX3fHxEur0cp7YZiaKoLoOdtTl31mn50vaalcuomceXuT55KYTFInHrMYaYsXkTArVQyIrludkd2TTCuD5syroIlrhMe5Hvnl7se7LBdxPjPPqEkClVkx5iibZ30rN0+04YwA0hf89NaZlfxrqSMJ+yb7MTk24E6+vJTXfvGrY8kPh1C47nV0gMKOGT2WeGDMEY8bgnEEL8F/NeMqYfNLkyJdmjy7Qy0ET0FTdrHipgtJiZO7TsKeMK5TrJ8Sy76FJkGqxu7moaLL8VRMdAnWyTcNCkndOiOo/m0N9xiwLu2mRZhn6vEDKttgi3bEEtZLZbKKW6eLzOtbB0RmbGqBTbYifRIUT1Sw27KE6B96oCX3rS9plx+a+d 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)(136003)(396003)(346002)(39850400004)(366004)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(26005)(1076003)(6666004)(6512007)(52116002)(6506007)(83380400001)(6916009)(478600001)(4326008)(8936002)(8676002)(4744005)(5660300002)(44832011)(6486002)(66556008)(66476007)(66946007)(316002)(38100700002)(86362001)(41300700001)(38350700005)(36756003)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: j3McvvMQp9JGXLJjbAiPoYSX6VtJFAW8lsdHQinJxpk2uXzCAuQuso27n/AofykbrzUdB3XplLlEr/xWk1HqvPwlGOt6AYvGdR81a3AM3HL7z7PCMxoj8LVUdEOXr2DC2GOrMp1HPDio6SER+VcWzfNOKExcZAjGtWKuJPa1RqWLFE0k1cHLxYsLneHHSsYLqPmudv5xLt1c9uPt3STBqrog0uNf5Am5zh1R8TOA0ZbHkJa88z3wcNw94lKdmY3IsOfskFuxhWtSmSgeK7qMBZ+Tq9ill2tVDbtFdIS1DCJ8dMwTdCzPSLskvMpC6w44r+lU09Cc/OF2eBGGRCG+OkcUWXizlKBJvP/VHsaM+DG7s71Lm6vkphxM0mNVmZGxUP6ohEzTHfj66dXg8z1y8eS83wSBqQSwfX2ayiBufTcpYbD6nh5ejXRxP5GnfJfejdsRxxbKSm0+H2PUBJcnf90fY9GV2mlEn7iqfpn3WlurwFOfYEczO0MkHMKzCKlV9JlsDdVxE6kJf1eoR34Q5AbD9YuzuBZ8X6OpukluptjDMWlTFSUo/FowXZry9W66sHTxYlIt+SVfHrAXcgy7xWVx/7gq/fUdy/AP+/mygrt1zSzIyLyhV9ei5UTEG7bH6uzT0B5koIK2gZZ1N6uX1Jc1idsEOL8MYpHUhTSd6Oc1KLQxGAL56w5D5TvqnAHN1j61TQFvTGfy1ElWCEr4Emhk1E6dO7XlBcB6YdVIqlGZublHGTrXwLr6pdY7H933O0xyBZdkLei9B4Po+977co2Tm7h7B9hYn/Sf9lsbB2QKV5jJ3G79owxHQ55PLlhmIb9YlbCHVwRL/G6Ptj4iS+rXloBEF5H9cEA5HlLkOXmS72mcJNC5BFxh1wuSJhairxvETpbRYPtKi2QF0Sdmbuc25fg2/sEVitK5CoWt7Sdl5FecvK+ujFRwY04UgY++r8TcoBe1/UCN1NFhclNyn7fUG6ap3MrCYh5GedInswl9hGicLlvuHtNf5WMsSM4ezgyQijurqh41IDxFgxKEnf2TnP/bIV7+OZ/SSkcG5XD6498MABtepaUNA/iaaY+ymKKNQASwuODmY1Qootz1/5orMby1/yf2WwGj7IBRE2z20Xf+MW+56DlrrFJA7elP0AILDSYO4/ycDffjLKCDscyp3Ep1tnTXIuYGUtJ4Ey0cb+tZ7wj+bOrDAWUzWHkW9pF+kpCSnQ75TqMwW+wlAiJjU50/L21Y65xQFYmaYdZUa29tdJ4IEs1Syl+vLduHa0m6trduqRGPqME8uiYobuEv5e6TrWzknLK719LYv7M791htvuJ1eRVU3qVuJMwJYhqGego9+opAg+RO3yyH83C9D2YRiRibVb7ygiq6bwq8kxXET2gsG/vpfAsSgDFd/0s3jwTkID36EEXt3rwdQ57Jzp8TnBGHg75yL8NBz4Tk9CpduWO3/x3Duf2MSp4xcKE3cMeJ6EwiqulcdZU4M5V+J9iuXZrJ0hJPS4LqcsYbKHZjBc/BYKJkVZNKN95y/REapMObwHvV+2PJA5OW33dIC/kNJwCssHGBdCJb/+Hbp7aWzWjLVs4+cE06mKVTT5XdXXfcfc4+daaNPjjZ/M+iQfAy8GokMyfqXET8wyY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c878398e-0aba-4d74-e686-08dc078d8936 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:45.5171 (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: BVLdprERXsudFmg17iVow2IuykE52b40j+ZN6RAjWotAilnrRgxdDtsmQ1UT2271zVqqnwjn8QUhIsT0b/fHP/O9+ZHHboNeHHBCLulWCno= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7459 Received-SPF: pass client-ip=2a01:111:f400:7d00::707; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, 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 10:12:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505801 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 48AEEC3DA6E for ; Thu, 28 Dec 2023 10:14:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInOJ-0005XG-G8; Thu, 28 Dec 2023 05:13: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 1rInNw-0005Mm-Nu; Thu, 28 Dec 2023 05:13:04 -0500 Received: from mail-he1eur04on0713.outbound.protection.outlook.com ([2a01:111:f400:fe0d::713] helo=EUR04-HE1-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 1rInNt-0000at-MP; Thu, 28 Dec 2023 05:13:03 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SFs+jcHtcBnMg3cRoiyAIT1kbW99AleRe2b0ZDpvji8yOVfUY6VHR3vNCRMF4bSvW/dBF3MeklX/A5g9nMmLySdUJsYWC7rB5yiCDKHxUH8riQ3D6RuVy1k7FHu3JzkHU10madbiByZTRdVsBb6BQJh8KpCMnsmrQCsvBRrgvW874Ll22i02+VVQW4B7oxWSmBvvckZvoIWr5J0CbtbyxzucpfwtQqyOZI4MIWw2gi86mh4lwsAzeROyOueohCk+KBnBfbfMga7YnKMAoASuXFGOLLEkEGkRqk7BlzyBSNcluG/QkIj7CM1G78iSgbRWVUpCfb8a4V678048mAQHyQ== 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=kNgV9n8Jyd8HCZXWR5fz3AQ5BGBZ5swGlZ7mUURbZbA1E4q5w1ruwqUXDgZHRJkx7oqMVieIui9pd5KbGvAEOQ3lY+6x0z4/rvWHeHguLgcI534f9WJ0VtYyiOHDBML/ePJKJPJjmQtNbb8yExFbTFNqWFq/nrICQgZzJNbTL641FP1MZBuaNuuVeP96CZK9VBDUh4/gvUrRXpHdiDTOBgi1x0NOvzyFl3rMOqcpZIxepzRbFj4wR/lJcOqoyu0Agz86FJr12WkvGryuWmFKItJxHuZC7EuCfJGJJY4iwoeoayjblhF8WVaisu9r+7+De78AsHYjSPr2A0OSHphECw== 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=QhAvAA1NsiOIiJgpLRKAwsqGTx1x94cn8eq76UbP1xEtWMnbsX01tl36ZKQ8NamMJ6sLGFZmwstFbQGVRedar2Fq20vLeEfxnsjRE7ACRAiMGhQlBJOHwbXYnPmjQWtdawoWWnOMHGhDYlr2oej90yrKuHWIbYVS0bMZ0koNGCl1/eZ1ypF6oim80cEdiyR+/qfkdHp9GgwCJvdOnZYiiszYFsHgd8B99mfiZwcLYYbMdp8TOm6IG87RJIBvM1wVHxMhiQDPuIe7jYPHhg31L1IkMgvlRskqDaxs3wej9CockBLsqe88rJXXuMehRiQDGX5eldr4bTZuldWGlmhNUQ== 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 PA4PR08MB7459.eurprd08.prod.outlook.com (2603:10a6:102:2a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 10:12:46 +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 10:12:46 +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 v4 11/21] parallels: Add dirty bitmaps saving Date: Thu, 28 Dec 2023 11:12:22 +0100 Message-Id: <20231228101232.372142-12-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: 479ad605-d105-4eb6-e381-08dc078d8993 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ho9slYCPwe6wwYYMsyVjPhcIolk8lAUO0HFoxJBEj3a477iifgiRJua+HjzJBE7+Yp+m14Nc5/0aMGzuMSTudwPsGfODA4p5YkT/YN7yDeHK6jYxubTM2+YCH0dNvwcJQ5C5cHGEnyjuwheM+rzlhvSW2A3BrpWRwpbbcf6zKp3gZ/iqQD2VX4WAdkBe1crqDYB/5Nt6WWa7KY8Z8CGuYTCgsQA/5kjYPTT179fviKQaHfID3YTqeJdHSny5nhLo/NgWT8jBXN0qz8JTk7SNJfvWvBVp0zyCnuz7lKi8WYuE76uucEOfx30qamotAN7HPANWOPau9K4aDOgLv7+0LeSpaQ53gsMwn4tIWKpiEE9iAIDQXiOwebMWTHCyg0lFk4w+x+2UL71xRM7q/baL/eqJqdn/lkvfF/8dEePsye8+A3GaiWvVnm05uVGP3vZjMgTSDc+EYUeTgJM2IwQzmsnBSq+W5gh9XH5gh6EOFR2mcVV/YLQnzQZjkHpvlqqRIhFq2PM1tA9k4uxod2oS4X7FSS2cw9J8wQUH9j8K3Y4TNuwha0eLQoaSIQrGoNxTrky2rKWVwfPr1A6q/v7DJUR8YxK8tnzw2xstyxciFq6VhEl35DWfT2uMcr5yG4fCRE3CeiLUL1cpbVVYpaqTgQ== 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)(136003)(396003)(346002)(39850400004)(366004)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(26005)(1076003)(6666004)(6512007)(52116002)(6506007)(83380400001)(6916009)(478600001)(4326008)(8936002)(8676002)(5660300002)(44832011)(6486002)(66556008)(66476007)(66946007)(316002)(38100700002)(86362001)(41300700001)(38350700005)(36756003)(2906002)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rYEeg2zxbl9B6g64ZkeAgiSCB6GbWX5O8nb+sPTNQrjOY/kwKGPuZC2dST/RUzntKlImKNPgb8kggMNbWEago1A+GJsFuji/WrQQ+HmazlDu9xoTnzNUX9Esvun+Jsp61cMWjj4DWKquy7bcRm/aIyUpqzj/0ssbTMWkbTtBJ0KuZJeDrbj1VRSjTCDWoWVcBFR2dm8n+drZWxr62EvMIzuUaRD1blh+hM+Gi1gQOUA/67joZdQwVHyJiBsTIImaeG9MQxXagRg8M2Fzii1DdnCri5yrn5JYhiKF5mdA3G0MK3tUg5RqWSbgGl1GnrOrTcjYCTE+SB/XD61RCMSj5e8Hv6Zi/Tm0bBtntGFYOfwmIhRZxRKkXMmk/EsKq9Zo1toa0UmVFG4BvjapU+jyi1nUL9T3580EHGPkVMTXB1TQDrajAD3j/DWM0cdbd9Lc4eHb5HmtoonYp89QOX/0weAh9yWkgXnjpTg9EPvHDlNsyu1vwZqTMSff5bE9x3SVhxjVSsqwzq8HQwidac4dFIt0agxl2Vd4tloNLfux/kCiaQaSBUQrvBbz7WD7d+ya1bdhIrNUKUrSbGl3wr3HSkY11FDnTwUtw7P4DPAdJSrCpfBwev+Ovqwyt1uFOqCh/ARXtpl6lnTFyztyuInoVDN1JmkdJ2Ab3RD+O0psoF5EAZdFz49COj8ktecOA6LTZVwAN5QP8VwvOp7+/dACGtbAF0ldQGUWMjiORVpmrUIF8KBwE08XNLxbmJg7Fw5OknokPDGerD7S+5Xa6F9x55WIUlZ5c5h6xNUTtWn9GMDLcT5Tmkp+NkwhGcDliKzJaMkiOjj76rZ5SY+boY/i8iGgRZbKvGW/dSZxp2QmZfpCeuZD/baE3lodtaguXv9nPjwsJWNd8naDhvG1q8jGScqGqj3Ync+0D8gP1O20UxGrcGTIUpS/xcwyL8P6qfUIpsOsEWfj13ouQKw7NBZjt5OLMyyvmeeLuzNfpG3pA2b7Pw49TnayD3C9xUDHRFg6iBBt9kOPFmsDQE2hXhb4ARvBseGZrCXVLcGKubYaGvydhFGIetPyYyhFSc78q838PdUUhUG7Y87U5Bigcb7nFNYeI7bk+AlNdTDajaYKRUGppzwLpX6/9gS7g/UbLRcR4gsJfpHn5tLVS/63fgnoRevh32EEDJukNqN8gxUCVA2zdPDA1oJXl8xuq/Ox4Nr3toufeLx0rRLVGKnVvM3BXJOz+F/KGGeHwE2/qBl5QK/iM5kpKLk/iS8OENesDVkqX9vlHtLCWC50Z5itquDq4dZMX/lUV2s8gp9bSscz/9t/ZlDytZKuhGJ3OtQYVUE320tAmaJXZKkll7jg4TswigMLoBfCi2asxACItwttiNtPqjRTnD3VY8Z6bfXkQ82cUufFkmszn0B60KOB+DL/IanzTfhGW+0auKs2e5oop85Io/BmzuTqTROPKC2Zc+1RQRBfuIFvt9Cs/laV8soQsR/v8dI+J6LVpPX6ZWdiNKKKIW7xun5By8MbkgRl4WUVSF3lb1NRDOmkMz2Fj1Gv3TT/oNN/eFHHe1HGx1qPpA/Z/0zqgbL6/oFpO2DVc6o06gHhpzBYM0l6BtP7o+wFDX6Ow45rZZXBfUjCVwyGO48= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 479ad605-d105-4eb6-e381-08dc078d8993 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:46.1081 (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: 0ZLEcNChaa8HbqUaJ2Qs/+FX+VwwmzKud2Tz3j30qjl3sGAWi7atjpJEtVS1/yWCSO8U4V/U5Z++jE7GARre8JWIHhFwvWZqDNb2VY4dE5U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7459 Received-SPF: pass client-ip=2a01:111:f400:fe0d::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-HE1-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 10:12:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505803 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 EECA6C3DA6E for ; Thu, 28 Dec 2023 10:15:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInOK-0005Z0-UZ; Thu, 28 Dec 2023 05:13: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 1rInO0-0005Nq-2m; Thu, 28 Dec 2023 05:13:11 -0500 Received: from mail-vi1eur05on20707.outbound.protection.outlook.com ([2a01:111:f400:7d00::707] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rInNw-0000Sp-Tk; Thu, 28 Dec 2023 05:13:06 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EKMpIUm+H6OZ/8SlR9mvI5K44mxURzdWkMujz/ENTgRmTi1rKM/Jqf7t7Z3RlNwdzhPg/YfwgAVHt/TS9PhyFOgui9H5Xt0HS4mMQHZD3J8a1VYleXIQvtmd2uONWwJgDIng7Qb97JCm+R7GODDLEcHjXprvduOblPskfom4brmD1nZtONb1vFMmZ8MNCsIF9CwGTTLv/5wL7aXb6XFfLr4uPDXrPDbIZC56AVhaxK7rkRCW08uFAfUKPZd+BYbii/XKwfl8kGGVmfXVZIEnmlW+apCO9sYe88jDxzdJnTFWvj3neHMKWX55cNcB8Vj07pBFnw/2/U89TqQ28jjz7w== 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=fNEW3cf0gj3woLF12Gl3xFj4fkrn0HZkedIDxdHAIPhQMz3bNcNqMVBINAD8umjeJO/mIzhSeYSq/nLxS+HrU6hGwOx965gQooc5ectFv0ay4oMz0I6rtlTMhSvzu7qaciUlS6AVZouanKwVIKA6OmgdRzXPP0ZVb/MqopfKJvSdWaZDM6w1S9xanq0hwB1LcDXEQz5PqprX9NFi2iJShg9GxeedIccWZjIJEoX2fczWScxeHC81SxQgU9Dz03lmlefNaLNg3enQ9QvyuEIMjWyWidhACRUUlr3+W+G6v++Mgb/dGMVRLlba5SVDvGNJephJFyzbJD3Oi98rCqwubw== 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=DEJbZwcuZvxWvyYIXhxcUvgDXvgEjzRNp0XK25WSXBeXjLmGCheq2uwrycchB9dxXvJruyz+tp6e82xVtC3m1CX19Kx9iUgbLlSedFbuERaL9/9LS8CEsyZoJh693A1wZ+7h/Oef8rVAC7A4PmFetlgItVfni68atinN440jNM/hKiVqkLXx5Nks9Hu0OFY0q3k0bgxYAz28Pcq5Hm5Ekc1Uv7ivCUoQUHEGospq+PBlh6a9Dxz/wex+3P25bUWeKM4AysVTAoLAQh7SHTwIMcCpGHJvNRv6CKcu9GcnnsuqtXmB22qIAGjEJ40P8EiClrIrdvdv5OEx7g+bwsnKaA== 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 PA4PR08MB7459.eurprd08.prod.outlook.com (2603:10a6:102:2a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 10:12:46 +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 10:12:46 +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 v4 12/21] parallels: Let image extensions work in RW mode Date: Thu, 28 Dec 2023 11:12:23 +0100 Message-Id: <20231228101232.372142-13-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: 65936307-e7a2-47ba-6a44-08dc078d89fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LNfD60VB6e7mhM2I4POc8waIB1Dr2pXUVb+Uluidu0Exx9j0UPgTake+bD+c7XZSUOcsEs4mqZif0t4o3D7eoEhB0fW+ti5R5Ev26xn/uPYz14exN9o7lFFzYQ+Tu/3C/tIHTpI1DxOqW0PtHl7HToi+o16y/ljLbolaTfiQ/th89x102sUlDcfCAip2rlmBVti5ng+c/6PqLySeyXP4nRLiC9w25uFjM3yKqLKzsnDklj49YnStLfHs0aJ3tz8Qg9QUu6oVez+SJIrWOXR2gSuYld6vGDkRMQHpIEjMaoTEBsYSTUuKJIqFPplm6r2jHUVBxqet2+b5iME0r4zKch763Vxuw4DFzhm/c3YnQh3vvk+9u2Q7jspo7Nuy6jcC54zFHZ+gRGbR3tp2XOZe0h1G0HYcmAtCSpLtoADWZjLNagIi98K/VCNumdg3OVgmX8QnseD4GH5zNSOZpcY5KNX6jSs2hkLwmdexZ92LJNbGXQ+n57UiOjFQFIr/iHkQtrSqlv/BOT34h9dTvnnJ72tuMV4M50+M1DNuCH1LQUryrqDUmHre1on+3bacE/1VJq+z01UjyQsUp83hDxCji3Bi5ZtMiBLK+tSr+vxkHCg5j+aGtigqfNZfRbHnZzIzguKpUf7LZBmFzLuaGvLA2OMUdmCxE1CkLosd++8fRiQ= 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)(136003)(396003)(346002)(39850400004)(366004)(230273577357003)(230173577357003)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(26005)(1076003)(6666004)(6512007)(52116002)(6506007)(83380400001)(6916009)(478600001)(4326008)(8936002)(8676002)(5660300002)(44832011)(6486002)(66556008)(66476007)(66946007)(316002)(38100700002)(86362001)(41300700001)(38350700005)(36756003)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RUh7ptAvpPisycoSgVNcuRMzt0KKBkTJOrjmvgqD9XO+oovF9RwKnJdUbZZbaP3LOI1QlFmBymYWJa0jnPdiAzjB3ejCwGP7LWBhk0dY8Uj0X2Maq8g3t6MXUBBSpxLFUKEJHcfm3+l7/Z9zfbfzw68vJNw8pgy3/+mhkZaWQZiUqyLbriLjEvnzdDBN7DKX6x7P1lbenwhuRL7fCLxE+8RKZoZkAsXEeih2s7pqzuyQ/X0u190rhcTJHM7OxrolzrIFG8Vdup0Hkx1Npr/6+fVFOsKpgaeuhzFmVNCeXvLd2P8jRyZDtUNXEzpnaTEPNgfCmYNWNwA0iztMOIfacCz+Sj2trdFigxC4cNwlIZ4swg0bQ15hEdXraBrGpJ+Z4Vh1gxFCCJCKAguZSfYhX6OAQdwg6Io2Dixpuk9rEURNMbIlqw+terzapKTmhRLHWBHhMuytu+xtnKzu/oHdxHRoRIglR6EgpMhisP3Is1mwVrrlYUtco9Uk+ZWi5U5n4ibDo3cUyhENn3Qb/+Vwlaac+NLAY0u2dAli4hILkXY4ksndcnHLRgyvJ2XyZGXnh/EQvtOHxfFCGnls0ko+FG+Yq6o5pSeUEfFHQDkxkwM/klQ+BS5BolfEoUgjfzpNo9K5bPiJ42jSApuZqNw5hGSdlB+VHlklzVSdeU5PmIzzl//uPbA95JdhTSoo+Djm+f+QWU9eC/nReU/B8lHytPDNrkRdQmZX6w9TScTfMen/ugqyxjr14Bg+SEKuiSqWqY8j7HrHTzbeepFdjXM8AhHObvAUbeMfebUfCs1M40cL6bulMN8b6gAZtiogSsH+iabgSImAQA9A1/U5zQQJx9EuiqVVMCz9casYpufmyhCYc5lRF4AAoIjs5l1CUDjQhI5TsbIZaq/5rq0S5roCYpEG1OyMt8/Of2l0HvSWUx9PDU4jvJVlgxedVMNRH5vbQX0e7mHY7n5AaZooLVZAsy7TB3QUEQTt7aBCUkEEI928xinaYNu4sGuXwwG5KaFHZeTYf5vXfbkDsDKhb31PwG2OcWbvqZAt//pkVI1mUl9iylsl4n1JrVK75Oo/7vqlY3Rtxm3R+zd67X5k6krHsMcvGjJV6BiXOVGcIyhOnCPGlBSzOzN6p0GTrlshBUAHByM0nD9i6aCM5v/JbwsWaYOX0PMaxRFuGBKj8KNpvujXpSp2elJn6LFElMfFkuU1+pwHddjrc4E0xOtfWkgTJp5bxfK7jmakGqfkw+ROfQRCAZJt9dqq3M5vTRQG18YYcu5R54eFFc2AljoUjthKzY6Rjt7pHLRuiZ83dj2o4wCXXU3z/av3AmP8WM4jse66/DJloL7Q0bm9m8iTsn2y828TEYgXXZTQAn7v18AUbPRWkWC1iuf5NNWgqGfa4ugTgPj4HRYt+Gz00c2EA4CLptpP92kMjQeLboMay7mLH18pFD/bakvGrH9KziYkXsp++csp6e0375DQvxQqIjsVucNbIJsY5TfOxpbBzKmKJF2SKwZ7c8x8XsogFpzT45aT5J11jwB6R/4f4nRXdEqVnvpqKpZEAh29njL8hPqwfUeFe3OklSdPiWnD9sWKJauuB1L74Oo80lh4KyxwFzEDCNSjCmrhFYUS6HF+bYCLshk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65936307-e7a2-47ba-6a44-08dc078d89fa X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:46.7555 (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: cMLBFQrmb+vYI5oEd/xKXUzuc1u94+zfeMggUX3H4LDTgjPS2gHB66W4Jo/aLR5luzFnQYkpCfESu1EvtJneQmpHATvvze7JCNSvj6/i16o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7459 Received-SPF: pass client-ip=2a01:111:f400:7d00::707; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, 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 Reviewed-by: Denis V. Lunev --- 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 10:12:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505811 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 C1DC5C3DA6E for ; Thu, 28 Dec 2023 10:16:05 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInOL-0005bk-LE; Thu, 28 Dec 2023 05:13: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 1rInO0-0005PU-Q1; Thu, 28 Dec 2023 05:13:11 -0500 Received: from mail-he1eur04on0713.outbound.protection.outlook.com ([2a01:111:f400:fe0d::713] helo=EUR04-HE1-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 1rInNy-0000at-0e; Thu, 28 Dec 2023 05:13:08 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dSY+su3h1gGxZAL8v0y7yWWGEnBKYrDM/yJB8dWqofumiywU/rB3IyorbuoX2odV/bwcCsoL7BIi8d3VyBy+tG2hdlR2BIVdn0Jj3hamcyye2HuCVUVimD+6TFPTrmLjLwD4jzJZmQcTyaSmoa/F9IWmnIxmkiWTvTzftUras5JGrNWNQdij1+MUXnMlGwdkJTiP5za3tb/WWMuUadaOplTuK8N64ugDI19P8au/7iEyQ0cShnP2ZEbFbuosy4F3PfHn3kVN+xsrD3D874XMobZ120OGoQQcbWUtY6zPrSkrgxi3DeL457C8KXFBeiScKl8TLwhhbri2PSPPZLxO3Q== 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=aZ589PtSVB0i4Ojut8fG1Ewlb1ITBtNHyzax8BraLM7AVjwhDlExf72HXlj6mVvoie84FzNXMoTYabKSG21xXkdmi6/dFuMfazv+866hg4wF5Bz639fr/v1ol6NzhfACYnM6EBKHZHu2lonek9rXq7fd5LR2a8zweAZEj9bbKNcOzsJmwk6vgJlBVbE6vNrtpi26qNmg0hS2cGpUFJcIfu/juboebsaqdG3di95N8s3xn89rTu7/SOJr+0APmODird5BluAWBYpCbgiDS+AkVj/Vfx42+chZsjf2lXPM7lLatBzgby4J1ytmpQpdcmY1si+0taACnvEomHxIzWSLaA== 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=Ne/p3muW/014MtMsFBxe7guUHTIfuI9QWSsLwwwuAMdDwBDSSsQVMsWUOTW6/uCQZlJdsEHWiMACq3R/J5C5uUlCXDMXJxNEC6wrZmZsjsyHeGNc02ZxvP5DklgG5lb/HY0qIIhuNGvS3KlGmr+iR0Uu+2dsAcHBpfI8qGHeRhe5j4/4/vRNYg6xSlwMPygAgIPUzdYuZibaW2Z9RBqE7Tgt/8xKoSfXfpGe5pWPe/w+87ibsqbPVMh9x5rrtl8MgnZV9F2gIDwDykDOpUqy7A30Kx6PUG5ASaT2whvUI/e72gvaxbv2TGnoNA6GbKrN/dK2Zqt/dpL+8z25LEoRdA== 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 PA4PR08MB7459.eurprd08.prod.outlook.com (2603:10a6:102:2a6::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 10:12:47 +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 10:12:47 +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 v4 13/21] parallels: Handle L1 entries equal to one Date: Thu, 28 Dec 2023 11:12:24 +0100 Message-Id: <20231228101232.372142-14-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|PA4PR08MB7459:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d13bb3a-568f-41ff-6776-08dc078d8a57 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kJLlbQ5iV96JvScIl27YtAT3o3oNTwAWTV2MqWBKeDKs1PQ2FfHjybZKnT3JVKkAOPPLWs5VT4o8l/TCbTDlI3VqRkBarPXGibdtRN67tN7WAYG83yygQCi6CYY10pPaCNGygdMB3g894HPNFMCDCrZdKsdPzeMXA7I45acknwRqPjKW92WWSfcXkz6uTnopPv8mRbNZFhrRUecFpVNB/GYOMl0MloKYhxqBtDOXMKsU2y3LIRJF4zHAY6jNJWbKf30/wX5947a8YMNzfStIDRJyDFeOVRJ+Sco+Ux8hmoZlI22UupLZXBFFyvdQ7MxkDOw6gCs4Tls2idlfnOnCS57lNj1grLIySY4hDqH8XqqC05mdlP8fYTQtxFAoCRQvIg5YPEkhdVpbuhCdKHX1YNYnAiaVUsCmVDM543hq/DLLR1MtppDz9Kfj5VfQ3EGxzGr5Ie444fHB4+NaLDYmUCxJwtLpz57FIRcnBMKNBcfsrCq4VS5xdGMF/7B+/GTjNq4WkGzcrACMJWEoisNJ6WnzBbb0RZLJvt1+CkQuhV+smKkme4V51dB/wx2QO72bI7Fr25m3C5Xxuh6rYLxFYWZq8oZachwtJJLd3uWhpfcgc96Z61W9uVhfirKqP5fC 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)(136003)(396003)(346002)(39850400004)(366004)(230922051799003)(451199024)(1800799012)(186009)(64100799003)(2616005)(26005)(1076003)(6666004)(6512007)(52116002)(6506007)(83380400001)(6916009)(478600001)(4326008)(8936002)(8676002)(5660300002)(44832011)(6486002)(66556008)(66476007)(66946007)(316002)(38100700002)(86362001)(41300700001)(38350700005)(36756003)(2906002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ba4usCD01bYoOYkzFvPVt1YDP5YRTinkcXipb/VYqgk826uGxOfhSMgHC3iOBhc85X46QXQuvh1Chy7JsPYeb+E1E/zrRl1rwNPmnmlF+YiGaRBOsm5HENTIB2rtPjBx8dbKc8FD7xJIXSm4IBoRYeDWaNsdgQAKfJXcqFMLQwX0Udjnh/jCEGU035CgZo2iGI0EFh3P+Vo0DmhIiGkS5LiOFRS7VbCeD0z0GKJXD2dsnycWXCr6izYuVRk6KTyzbzbo/MNdVVD89Vl1uZDqvDLTMzJhOmaf5w+N86sKnOXeUISUhfqE0YiD4qz8TuOD0dw3vZKuw0NlNN1Hih5C9UjnWarxBnbHeFCow5E1m0HyK8txmfqPOfaL+znvkG9LExMjnTekOceGt19+OpYcxAehwdIq00L0PPhAL2T2kMxEFKHd17yrfTBuS72Tu9kv48GFystN4guvYd72+7xhYEu/y7gYRuJhJjMQwW68CTl1LvVoyGak6phnD1GDBjkZpzLfrEt+V6HEh6AI+n10BHwVs4HqviabbwqIJEuLx1OiwDNu6ZZeF66jDWeqKa+gLv2WC+D5Mv1F7oCt/ejPGlO6mKqYdJEAWF8sO2xKSPlA/ZtbYYaHUTiQIDnpXmuKtD1Q6qDw2SO+djoF5zKeWZk6YBdAB3zS6mQDH/7i1qBne8JFnKNSDM8V5ndeNBsozc3Jchcuqk8tErO70J1i1XNiemQRz7pqRNHI5VXZvCKKBz73Hr/CYdCuV9siPnXc0wQRE0z6t7sLDnPOtBRyuw7B1CblpnEYE99OuGB54Nnfb+7p/oiN/mxejkTFrGaqtlxlhUuB4o3LSXp9HafAc3KbfyIjxgk+ycfdvTCCajH/F5sW0IVwgUI8vhtXxBPnxAFq4t1KoKU1cN7hD5Xw4lx4WsSWiPZKBE6CLjXI5we/Vqouym+nQVF+MNOiGaOLhG5de/cseKmMWqwmX4DdCUqX/ug23KMXHZgiW2zbfFNG6cWFF01a1x1s2Ar7Dr6MNWp8TDCad6fz8V4i6hgreGltmHgb8YbX5pdyhMPlnD6hz6QpnukQDHj28qUpZaHhSDKIwJ0Nl+qjxqwQGvcTqM6KmIiQVx2aX8a4geiFN9GSXrYYtVZCrtvRp+d9VKsqqiEYuylvEgr8hJfg/+Ub+EI5F3Y6o2fjOdLLOvd4GliLnhZ+Zeqa5sWJ+ESi5BWSsnFayKc/rKdIDNFutrr/PrhBAMFqKJXuIDGUn1RpLSJMZbeUu8rhD8F+PJc8P0hxTsPhgiE4THxogwhNrERrqXAgDentxDeKAFYcdEdp0S7ipXTtYIQrswsgYJKvgwEpU2G7J4HN3wwzTVPGDPm12I7y4QdcS5A11LnvF2uqLZyoAPR0kS8Lq3w70j6gxsDFtX1cIwoDIhtVoNwfCxOiuFlqXadupvm8aUf8rcR3SnEfRBr0fLArYYoc1028A9n+7dcg2d8AoQ3ODOHNd/2KrowTavsyuJ6edZmEqwnwz7yj3euHQ6vAPYOGOS8KR2Xe2OMRnosPI3o8jO2mpHvls0yLdNxacAcyeYg8Ceb+ZXtDlD5XYwjCmromZlYy9+Cq2M0IVsWLSJD6e4f3MwwIvduxE6BKrlDzII/La8JJXgo= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d13bb3a-568f-41ff-6776-08dc078d8a57 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:47.3692 (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: LxFUbIGsQAfWMWw91Tkgpq7DVt2dazhahPXb9N8TFQwB4yqDIrck/4IUeDkS5GwazC46XVE4q1r4kpOJhVWg6piGiTnT96gbOU/yYYVg8OI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB7459 Received-SPF: pass client-ip=2a01:111:f400:fe0d::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-HE1-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 10:12:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505805 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 77E84C3DA6E for ; Thu, 28 Dec 2023 10:15:28 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInNp-0005HP-1W; Thu, 28 Dec 2023 05:12:57 -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 1rInNl-0005GK-Tc; Thu, 28 Dec 2023 05:12:53 -0500 Received: from mail-dbaeur03on20700.outbound.protection.outlook.com ([2a01:111:f403:260d::700] helo=EUR03-DBA-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 1rInNk-0000ek-6A; Thu, 28 Dec 2023 05:12:53 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O0db5DOoX6jDoglVDWdykmCGVdbAMkZLUaXeTUEXywn5iL0e2vFU3i1s+8G2AreSoAGEP8I61IXHcCOoQzTGVIzFCVi4QTtSHH23Sbl7UOSCJBpcuNH1Wml7iHFEAux3RoKKOCrV1x7P49++jJ22Uwo7GghCuvka/59uhSspNfdgf120qhEckd5dcDgKt2R3sMH6Y5GnbcPA3RIQ8xhvLEL8SXuDPwKOBTXXuZCHwVLvCRFvc8QEJ49RJuwXUdy3qE0UYrvUkfOhO1vg7QPNN9asl1IjBrEjot+VGYaa8rCkKaj7yy+lalkqMORW4RJvq4BbfvK3CFkAdessMsw8aQ== 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=mwOqKrXYxcjbeWJNq95+g7kXFeBu9Wd1GtRUFS1FBt+VjGr9nt2mlihNB/j/t4lMGG52LBplUL5dKmynqZ/4kBT/F2O23c4npw6yovCLoVhlyFSn18wlNF25RC1OjO9IlmLjLzIe5wHHIevdJoKTfOkz1GToxpidAfT9bWVu5Wm43MWYBVNf1gaJDrUA8+mkVnqTNLkS0KYS55ArQMCIf12M0eOjFOAOeYzOXEIyRC8bKkwZImJHymM9214UiCKv8dETIcso5TxxNtOTWg0TDYaRxq/K44YaV5+wxLe938TM933YfDIEK3E/9pxF6vqDxj6Nx4RidAqXQTjKIkyWqA== 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=QmPubgX2uoSYkpcElpyCc/QQIbw9QoL42pSXvzJDPpP0A3p6xcX07k69bD/2h+qx33GhgqvBF14NcvwthIdzPrG3gTHYUOuP59X7nuqPuaduzeoPPiRqP4ga/pUsHXedswoqsfWQkrmezPoV22Z3991eDvIglqXFDynfEBJ5+ou8tWDzpaWr+Wk4iJo3SaQ83QmBPO1c11CMYjM6b2GtOz34t1b+BKFgeiRPL/8XkIzJ7R4aJiZBkZRaRR5uCZJ+Xry45ZGglcNSUXUN5Wez0N/TuSnz0WJdyzwjlXSCJT0qizjQWCCZWp+IBRopmbzbvev4TZQKr5HyH9CnpudgnA== 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 AS8PR08MB6134.eurprd08.prod.outlook.com (2603:10a6:20b:291::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 10:12:48 +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 10:12:48 +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 v4 14/21] parallels: Make a loaded dirty bitmap persistent Date: Thu, 28 Dec 2023 11:12:25 +0100 Message-Id: <20231228101232.372142-15-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|AS8PR08MB6134:EE_ X-MS-Office365-Filtering-Correlation-Id: f5f595bd-3d00-4108-db1c-08dc078d8aaa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vxss1E2wXOme2FKmbbmgoc0tmvqGThOGntHz2Z0Ll6wtEeiBK+vw9FHr6JWHy7aVaeQ0+b5JnAF+uQnCANcEfdaw7hFicj3UcciK3YYU0A1Ok3/AMc8Y95kecmzmWWQkpZwunkfuw5kDpYKoMUwATfcBzH5dP4D+96Yx2xWrxv6w/6ET0uO7DlEY7H+Blsp4iYeFaUeF6/YNhsefHAwDaYpuopElQsTTE4XIAVRYXYHnmyZW6dmRXg+P02cRSSAhj5Sklo+7YiVgGaQwH7oNUp32ZuE48U3NhB4+h2FFMn4jkecmHkqKon6jH3b1ne236OppmbLBlMlqoBex6/k0aFKC7uijU9vdJz6xWsJCkHS6IBzrnSJwQACmy97Ef1zEhGGlgXJqUZxRvnIsHWdVFtJeaMnKMf4/EvGo/1ODtTXR7UfMB+J1X8Sy2f/4MakrIvd392mKK6fems/cdfaXPMAqjzfWiNGiWqI55az6zmUuvCggEOsWKA52FXAEfP31ffPYtgr9C0/Z7VcEeMggjjK/E+k493cg/OXk2ABG/T5J4OyeHVn7Nv/apbHilPOBb2/JdDe9SaZfnMTBFcuwpBScR/GRr2OxJPTxQBUd53HG0FsmS04CqDRAnVzYjClK 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)(396003)(39850400004)(346002)(136003)(366004)(376002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(83380400001)(41300700001)(2616005)(26005)(1076003)(38100700002)(8936002)(8676002)(316002)(4326008)(5660300002)(4744005)(2906002)(44832011)(478600001)(6666004)(6506007)(6512007)(52116002)(6916009)(66476007)(66946007)(6486002)(66556008)(38350700005)(86362001)(36756003)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r0LSF+eqnq/dSBcXrXkV01YbrRraJmJhUAK45duc3ApX1ypXR6atPFeUaRnsr6i77unLVhLjbhOJMiRLRIQb1XZhfKGvUYfDyPCa8KM6LeaRgvTTg3OlrSZU2hqMfDyrQspzRfyRepapSzt3qhGA+nmKKlSexIFK5uNcniiu8PAPVg7LDKapDFwxxw5sAAK0/nyAzHAAeFA2nNjafxEirXLANNM4XRvQBDAdLLbcxY7c4nYWHmZ7hh2ZuQokdlDZnYXkv4y4sRRPSRy/5ppRXJgoKZh0tFiOyGo5l9VkcRH2bvXE8ZJqWbaf1iv3rQF3mMSRxIes5dkdrjg1pLq12fHaaYEGHA/SrghPgfiWzqAUPby915hxVZxIw5gNvA+760pCNjlyetG1qKp+2OqKF2saf+3NKLB2/NvfX3LZgeHfL1jvNYGTkB78PmmrPOcegLi50fNRlHt6a1Y0Q7KjYXv4V+2paKb0ohIx4LSAu1WGK0A2PYVgPokSYw8QRFZTal1DceT7sQ3P0i21dtPzCAHE3kRBH3QpIW/1yJCD2vfwiofL0MmS2KlRcvdCS9eSPFdjpcyySTzKOEAtpi48b5tG6HOJg9BO+c9/ywRveui7RShebsPSsSBpYlJ+ZU4vUiOlXUeKxSw9Atpa/YKewPNfaZK0YDbXRnPeSY3Qncm1lYyeyFzhkKssmu9ZTmfEjprOySsqw4hIdmNRFev0uiopvH31ZKP7STQtdJMjwDK1B5pJxaNJuuf3sGd8/A9zDFDzicR5hguGzjTB1dQ6XyLzFnSC5uGX0vF19UVLM68m/0LMi9X3bKJxfZa8/yqmTIlN9dZaQTdqp8QXGFog/MWJcv83ZyJWciy3eCqpY4PwGrO98Br7Ac+k/qQAIuNiNP4W3LXAgjCasyp//mGnszs6Q0Au3MwlyzRFDV/gr4daFMKKpgyIQT/K+nynnRFHVkpLi33pAvw3MU4nUR8L8wokCYvtkW4jgCMC9iMaH91JSfbty5kAPl7JqIUK3Ly5WSIYul6pRK3OKjpWCCwsrpRj95mM3lqN053p/FhyM1a6MrnDkDubckss8CG1gvLwDxRoUPgcfbq39CYlXNDnCC+9Dh0HHGIwkJAbKNKW5lxZ1XjO3XV9IsJRo26Zsh8th/oWuxu9/5NSgml37uvP4l6Zr4kNUZ/PRxj8jIeD9HLGiNZ5t8pi8iLw1apTs723hvwIRLyWC5JNClR2SpPtop+9fZmu45jJ4xwlgabzAC1zd1CxasHfNjFjbJxWu27glPINjGItwunAEMjvi31a97S85WTEoWGXUoqoXdilh5df8j4pkX5f0o2Y6GiP1ML9s9ue92Z7fs1BOXOa8qHDqJasztlCAT9o6NUg2rfxRhg6YZm71m3YbbLQOX20LnHwrmmcImOnLvCeQrQQ4yzJ3DMDdJ3De2itqiJt54/f96GFO4SPlN81iYoEunyZJN38U92sLfuF20Ot6SptOS+T3rR+HRtQh6FaWA0+pHn/AV0jat/8yh9hlDyA63UmrwCjPR/xJuxewldIs6vWM16tCdElF0bg4AuTf0g4a9aZ3X661J7Xri1TvHLQjdA8iLMtQsCW1lx6cvLowbfYvoVKWGnEQSQJdUpgxcsCz0h8dIE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5f595bd-3d00-4108-db1c-08dc078d8aaa X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:47.9743 (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: h5bu99vr//52l5y16n2Aj+lTi7+wH815fn/SxljfehdF1QVTCq8W+y7xrI/cEHWUXxNDv21QyXPbftvIG4dIKzRw1wYo2ty/T97NGQLcGcQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6134 Received-SPF: pass client-ip=2a01:111:f403:260d::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR03-DBA-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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 Reviewed-by: Denis V. Lunev --- 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 10:12:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505816 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 7132BC3DA6E for ; Thu, 28 Dec 2023 10:17:26 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInNx-0005Ms-7X; Thu, 28 Dec 2023 05:13:05 -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 1rInNo-0005HV-P8; Thu, 28 Dec 2023 05:12:56 -0500 Received: from mail-vi1eur04on0727.outbound.protection.outlook.com ([2a01:111:f400:fe0e::727] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rInNn-0000fc-4w; Thu, 28 Dec 2023 05:12:56 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RK46IuqAOdGcSExQsSqAjsXvyOii4FJbpn9/8r2QUZ3YAnx/fNOnXgh/v+S0ltK9R4RUV9m98J/QAhAKgC8UZ11Ae3qLtlCgun1RaCxBUyLw4dCb3a6LkpVUFf21vewJxFmc9eodWai3+bku1cUSwDntfRMVjA2cKJ23wIZoYHvciEL+uCoFNvS9tXe63FPGxPR8CLFF2Et/K9xPIkBsg4cAl4oagsFYmTB6CvQ7NmZ8mZDM5CWQaXwFWq1dj2Kd91upKLBV/6K/Efj0lP8vDIAzb9QBB/VvW+yafuwOz6uvw7LGfwKZ+T8FtKzEzDehrG6QlmeVNQoesDoXLkD1WA== 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=cqTGt3VpoylRnP9AagUnairz5v/Z13ZeH9qDkcRGJbMoPRjSyRRM5nQjMjDD/Tfs84qvQclXe8sa+I9ZnssHNVlman0Gj9yQmlIUEixihhHHPZA1uCynyUlfSN99PCRzamngEh88S0o/QtdGzTj/QYHCgH2K/5HjK815RYSPv7500BbaIHVsByeTjUB9eU+UTsCoSuafRLQ1fTL8Btkw+gCx3NrRrURc87Gjc76hKH39cMGiwK61ETOSnCTYaBVXfuW8Z7Z33COt9kSSI7dzv5BYyS5wN/ojy0cRcF9p4hx0Y1lPDJUYpKxkLvIVhvyf/1zytq2qOI6ctfigbLsKoA== 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=pz5lFzJT2ItQjtu8Xppf0jSPwzDYafBLBKoNocT7FdsC9ckF0o+zQ2pp2qpPaXyNO5x+BEwLdgolLiV3qCoPhjFBei94q44FgsQ8FP04CojE5Pv7UIeTMVD+LMrY9rwBr6kRUnWlTOZusUgMS4ghQ4qGIuhwvIzMfw09OaYo2L9+4Iv4wdjVLbDLauBaAmL4GB4vWxCT6DSE0TvqRHPj98CDXx6+uMKIZjXptcIrVNfoRHs81V2RlHqLm8NBNcohwtxvUHNVQ5rF4INWG/ACCWQEAVyR4QVrPYHjd7fix0eoE3u5eb6zTi4GfsiI8qUHOl2Ed4SxrHt1sQzjj8ahqQ== 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 AS8PR08MB6134.eurprd08.prod.outlook.com (2603:10a6:20b:291::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 10:12:48 +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 10:12:48 +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 v4 15/21] parallels: Reverse a conditional in parallels_check_leak() to reduce indents Date: Thu, 28 Dec 2023 11:12:26 +0100 Message-Id: <20231228101232.372142-16-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|AS8PR08MB6134:EE_ X-MS-Office365-Filtering-Correlation-Id: 768e745a-ada8-4c28-9d3f-08dc078d8b0c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WNxT14SaWpsVIqbj7xi0SCLN5w0PWPfffNwO90UYjpOsNkmN0lD5119+7vnBZUjrUAFTMuDliY2CoMzlSM8IG9nQlL5mGQq8IBObOPF8b0iJ0Ug0vNTOSCt4DUCuZNXl2fwFbNkV68kv2uKUrRxmKWhA5THgw3fMIwBDO94jQ7d2vB0xaRzNXiYso5fsS47YEaXIaq7VvP0YkAzXb864bp+F+QsY6PFu8YDcpKv8xGDDaTnb/mvIWGIzLx/QhaLcn06es6gaHFEBw48sRam0+LMAytZheojmWeWJYnInh7hhyYfzJDtZbNYB5yCkonLJmDaNTDOP6GSfA+nviQ2jXB5tbd85tsqpcura/K8D0gmwBH5Zr8RyXFYPQJolyVg4JgjGoR5hCjuzA8wkMzhOBpCU6s3xi7UCAX0QeNNQWvhGRsTklVZ8GxlhRfmWLKxQ/Fj3jjUgP7Euh8JpaJJPVpjMwTAqwj7qUBlIRLzGK95LLLy2A7sQlLSZt2Y6nbHO1SX8cKXNkLTgkSm+pUESnHcUDhYg2LCUkEu7s4p73JpybFUo7wgkKWZVTpBfuJQYB2UH0K1tGW7FGgBmxgSe+IwZdlirFbT7Ne82hSvnLqmxNkJCAY7QOj+wAdsWFlv2 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)(396003)(39850400004)(346002)(136003)(366004)(376002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(83380400001)(41300700001)(2616005)(26005)(1076003)(38100700002)(8936002)(8676002)(316002)(4326008)(5660300002)(2906002)(44832011)(478600001)(6666004)(6506007)(6512007)(52116002)(6916009)(66476007)(66946007)(6486002)(66556008)(38350700005)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KKG3TZk+y53ne7XEhW1XPSeA5sj2sJP0d1GwCyXC323V9elFXzDu9YtmXLoRTJX4ZdpeFbNGP6nLOwKQ+278xzpa7Z/AzIC8lxC7SFz/ckKBCRtWMRMJgPPXlaBobSbBoP2ih9NNB4hIT14Pd3KDZgXXoVHu/MuEgp2LU5xPCL8A1lKuERuf4RQemX7TVuYmh5hm9MB1U1hLAk7/dffi5+E4znz2RrfsOzJ5vsdQCwd791dx4N4jvCQE+EFdYT4ei9KP4fBVnznmVlYpln8DLYseMI8fn1HefXXPUcOyCbIefDmeYOE+O3QT+AJaGrB21spONAPkJoCCUg1Ff94kuPiBziIPIQt2KI5z47ES6FdTxfbTk2JnDzljBpggdoBJ8r3Zt2v790JtLXH/RtHOk2vK095SBEcc/UiESvojTE3PsM7JZUhBf40vn6A9qzsjrQOOFxuJFudIaBbwT62m63qjCUvu+Ic2LbZihoEpIgoo4pVLPm7Rbepg1ePnlAeDH54rEzyPcLyGOJ1lk9QiN04aY0R7jEOGadtGXeM1TLANHDfY38o9KbrTAjoVAfj0C7XvuHeWh3VjqPR4XqJFec3hC5/Ptddpu9WCmFaYsX+Vn7YDcVPuxlMAZMNcLccMIzxrT54HE6R3vwf/lmlp99+a9NRgWeCCUDWW9rkxiXyfrgyrWZDGqlQGlW7a/CN0lhcrhyzfzdQyBs89q/n/DC6T5NPqUpvYBQ119wzZKb8d0vDBcN9W6B/9RPLlPqu+SHqyzmopEVhJEtKl4QsoDYKkPXObT9xLAj1QBFDOJE6DlYc2/UcKtouLm0S1PLJjuwLIemJGq1DjmcHXuF9A+4WdpKFWkSyuWbs1LPhEF9IMrklhFWjmOUvIfmF4fDMR77LxyLtWDB8KvKq9b/xVZAx231Fpeprj8sUBcgtYDsEek850INH2BTxACN9j47Ds1pER9XO48/vH+91nTmx/WwdaRhW3ZucseE04B64Y5A2noQv9qx5uw0fz7l6PZqjd4fXf0givC+0EKuJJd4ScGguou4UvZmUsaApFpOn78dNxalC3r3ZODPJp0wNl3esBYyEhT2j38k05sl8gTlGc9pwL6RMONU671cHLrkktCFpzWOs6KJsog6BuGtsJibMFWglsOVGEr6exs7D1bnIAIq2T4tMLZTvzuThRZ9NZZhCahtwfYWfye7Miq+USTQnwLXtoCImSbo9zMHvCVUIVzt8BIN2P9TOyfUtyWEaCSyeoFqilNbTZgMU3KdMtKw+Wtzoe9mey3jR+qK8uviCkGmuT5hZboLyInR1jOsRslXNaID/ViGKu9hW0jMMnrqsGnfh8scL3fpO0OcRKHCINo6484EO6hP1BeiBX46rLyWK0BS+TkoEV6rcxhnZUw2XG7gY+/GdQCkFMJcEZLWHPt/FeT9Nbd1jweMssxdiVVek2szNf36jpAWYQRXqSfMRgLfduIzZMQ0KUu0k8CMnGVsWbqxo/PVkWV0G37fnXu4crAqJRWGETt2DZ6NmAoEvlGdLDQh9Vc+yXSmT2Jgznp0bLX0lvcObADuKdSJ3UTK6SR7rd6lKqepGe8xIn6rJu38FGwdl92CEiE0oZmdK+NbfYSvIRlPM1ZZMykW42BPY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 768e745a-ada8-4c28-9d3f-08dc078d8b0c X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:48.5606 (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: Bxqry+wfSUFSPyJiVRtAe358H9AyVxTT/Wi62XjVxZWLVqkvZFAGyGcrhQBcrDcz/klUzQBMBcu72x1+hSGdUrC4NtQElDaX8UO0cVXlnNk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6134 Received-SPF: pass client-ip=2a01:111:f400:fe0e::727; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, 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 Reviewed-by: Denis V. Lunev --- 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 10:12:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505802 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 E8157C3DA6E for ; Thu, 28 Dec 2023 10:14:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInNq-0005J5-Pv; Thu, 28 Dec 2023 05:12:58 -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 1rInNo-0005HU-Hj; Thu, 28 Dec 2023 05:12:56 -0500 Received: from mail-dbaeur03on20700.outbound.protection.outlook.com ([2a01:111:f403:260d::700] helo=EUR03-DBA-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 1rInNm-0000ek-G8; Thu, 28 Dec 2023 05:12:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=me7oDFEL2ed15Bri/naoK4KbIgEzMWTvBF4sRVPqGcbFQuvAJyjG4EqcLqTBHiQNZBLxkAaFjsxLeilAMyOxp/j0Zdqt+MoQ5+oF8UM6uezP92nxolVV7LNhjF+8gMW1xvinBRrSyTi1pipluzIhnJKr8mdVDq+g3X+NNc7M8EN4LiF6oTcBX5fPe8WrwaxUMBGCyEPSMAQEnIP7FYBNyDUUUwleovOnIK5KQLX0JtWe7rk0HBD1wWhKFuQ1tSvRpLouDDzfQyWtDVp1cwnRuonwXtF9px4vVD52qSlCbt+ieKiktCffm/tn/jQQLSb4QMW1jVW+NVs1/Sg6hiBwQg== 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=DzfEaUYbOZvZxsqVnrFqshJC0m3pDr6UcsYUvRlXwX6e/tCjsU6jfNHqM9xXSXaQBRuQsWdG94BIuoiTEQC/e1LmO1Xn4LPlZtofU8SUmlhOm8HgMSMb9scnmcggUAf8QgG54xDpIm2gKS9ntx0d8XBeOhw0K43+8+QAiz2qt7HuxEMYsQyFahBvhaOQuKB21PZ2ryzb+0RyX64unU4DAna9sMxheIixVym+/+sFU48sA8xMsSru3zBVA9VYegbQzXT+va54D9emIYYQaU9U3jqIyGD1Hi3DRwCJ+5uU+XO05J76g9R5WqRFJ2cD3PnaQO/gXsMdxmFQQ4+/NwnweQ== 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=qvqQ1ml9z4H8AxjsGkemeZ/tX3C5uDSSvaJhDxfbsAVni/ETC9gKhfW6MR5q1dqnMSZ4yTpyMxeLsPEODH1RKy2ASPRR8sG5cDDVTGwp+YSE+xCDLng/V6dxlOn2g9U0Us/q+2pnhorhOP/m2uYXfqA6uvHGJekleLnGgBTafPA0i5ZUEluzdbAc7OwOgeUXz6mkaBwqIJMMNabiKrHY7xPRQpKbaKK+JXCXbseMm7AED3+okabHRdQolIfcnGrRtg/geyfr7HMT63J8zsIpqq2iG2LVvaOUdxdaSDU/VmDcrfGESLnf/YupWsFGvzdD6Lg9VVIS/D02x1EPbwXsaA== 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 AS8PR08MB6134.eurprd08.prod.outlook.com (2603:10a6:20b:291::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 10:12:49 +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 10:12:49 +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 v4 16/21] parallels: Truncate images on the last used cluster Date: Thu, 28 Dec 2023 11:12:27 +0100 Message-Id: <20231228101232.372142-17-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|AS8PR08MB6134:EE_ X-MS-Office365-Filtering-Correlation-Id: 752a0858-e54b-4930-5f5c-08dc078d8b6e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZoUMxE94Zyz5TnRlxPCK56gx4AG3bkEVwYH/bhD8v4pgPpkMk41UndhaEoq/fQzJD2kT+QzEKZqNDWGdzgtIgLBnWRdoDsrkbkNP92j8BtIz6P1wzwKLjT/mgoXldnjheRhTMUj/vc26iV7TUq0MKzscBbVDBNe3CS7frN2zcdZqSzOP+C4zN0EQgcuzxeQaqmBRgV6Fdae1EOk3l86IL01FY9Fycfx7rDOpsMsTCcSYVUJBjUuOaBraSpP4vIWN7CRwOuCk/Yeu95qxvQTy2rQWGaajA7v5hXJDll0Xa6sVOhOJy349nQQnMYhyXUfZLu+5MtJhqZ1TWP/wX/cIvtSc7iE7YHWr7lP+1R9Ra7ho2UHnfEssDJ5d1nt9z1JTGSFP8qT9cZcKezESONBvGq95BKuiwL4MM/fKaR+IK44B3Fj1PYSRoXEEbp04B1m+In0+cca2rk3U+JM+12++n3jsBnvwdicwkevwk3ZAAwgjY2v5oBd78LImbxibd28eQXTSiGuJWowUykINcy/P7KZvdQVW+Hm5op30tewZXfIBcHO/HNkY62oqfEjRcN6Zj/n7G59A3nlvQr6QRbW47a8QnuoqwolxY01wlaPu4GW86bF7FHhDUdM6xL/Gs7u5 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)(396003)(39850400004)(346002)(136003)(366004)(376002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(83380400001)(41300700001)(2616005)(26005)(1076003)(38100700002)(8936002)(8676002)(316002)(4326008)(5660300002)(2906002)(44832011)(478600001)(6666004)(6506007)(6512007)(52116002)(6916009)(66476007)(66946007)(6486002)(66556008)(38350700005)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KCm7fTrOCfSr0BUtrwh2bDT1yj8Vjp5t/RatLxmzAwxq3wvBumFXa7+uqHBfqu3kCaIp64TwQoDwdERoDWfOcuTXZXHsQKzYBxXf3dlj8DW5RMVK4PXcA6tzqQh+MvY6u5mfeOa2yf/wpEhDQseHq0680mzRyRvdrAkWlI4Fy/VkjFWesmsw7IbB4XRhOxN4rFN1LpG8BMpxYXn2pz5merCZYaYvSZBVLopNsUsSIGQz7gDQulDjoMeBWnMaZ4ehqhZL5GnSK3x4D4bE6nqNpgShPUJUSOpFA2feaJxppwXijV5Eb56qLKoUCPn9xb1KE759fDO2JDYLeeRLJA0wADiQINjwpM22kCdS3SZKGgBxMuZAP7lubIfMabxPZpvmmmLTdR7qGSUDDCULh6GMQrZDohmhJNbJeVLT+1wb0yNeZPawWAkkGNfmrV+ZtezLoZPOB3J77wZpqe+olQ5hSeZzGMG9x/f2ndIp6Pb19ienZTPb6bl4CO4Vjs4887K5UgE/agYwI69ocptElZp2ppHi0f+RlQXLO51Qdmac6reo28X6bfkCF0bG3jLJjf6KOUwDvz9W67AUNnXwGfQA64iziBy+snK6ZYlo5VSsf7MPnX4Fs3rZH/FRvt6BTiF6xDml71BWB5eNpbqEJtxb3GP1rTTFFYsQvkaNRVKa1g8lEPTd3b9ik9W531Kulh5g4tNGSeJOAo6cJDqKtFQyp/t4R/ErDjb6lQGkb6Ev6uC7lmg8LjahAH/e66G8IpnOZ71UswZD/bjFbe0vzSq7ngUApDtY6GLExndJ7qRiFPL8+2cD2tHZz9UCn1IxvNK1pTCI8tzOJ58h6wzQ28G2WOqFNh9wD79lhLU6itvrN7sPiADdyg+JRY9m7saWlV2Tb0JlIMFbEfWiCn+A14dEncoVg1M55lbZ4AqDUoapn8SjNz5BF0d2LKjGQqxo0prlXdhTpqwZW1rF+CtDklKpEGW8B7fcoAVxzqQ+hnrf1/q2JkXw/ZCSUtuzFVKBbxcUMLGb4fHdlBIbDzkM3rDx5Ftuo/HbOFsCFgk9OiiX2M46DyfQetreaMgUz1BpITYbXVID3pkDSemm2QgelbDjoLMr3/i0nXXJoXHJvKGCwq8QJrlW25jQQhJEbDceivq6bpcO/pCLsd9yDewfpB22qSXm9SKARrsWeW9n/5cYT8JnTBxhDbubL/urIFPOwukUFkDPHvRvakMlmYxXhvoMHOvtnPjiBraW/O+bhs7kfwA9nPWdBy3yr+TaganchypLXGf1MvofBmuKBpetiSAx7JjPR2EbBwDyRatiwMnwqBEKL3TnVhES+ZmnfIxhwThto5WUf+s2tIgIjB23cm5St0en4QzHh51MIRsE0lUlnw/02V0nRPonDNlxfB5PxBFgUC59N4y3/dAKgA7hieEMr7iPHyoPxHAk42YVdNStVze75/elywHNUO6MmDsz1x33uvUpRcx+MCY/mlQfFVJMogMvG5pU/DJxLFXMZoJTxG9N5FmKKJyvZer7ohFyJOatLw6mRMCobroyOELHMmMe0P0XSfqosAGDRsfUcCuDxU66Il8N1MsCSq1Sgvyetv4m4tI8AFi7g0yJv4U0MuVlVJK9AForB4iGwtHKcstC/nQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 752a0858-e54b-4930-5f5c-08dc078d8b6e X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:49.3400 (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: k4JyA2eFX4NamxTxmtB02sGgzyJQnNTm4v/BQtpmHBKffiPzsIGjf4A7EkyVHHrJHQXIcD09TquImcU1fgy3eeHsRI0k+cfZnm65wiusJ/s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6134 Received-SPF: pass client-ip=2a01:111:f403:260d::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR03-DBA-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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 Reviewed-by: Denis V. Lunev --- 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 10:12:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505809 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 DA51BC3DA6E for ; Thu, 28 Dec 2023 10:15:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInNt-0005KZ-4M; Thu, 28 Dec 2023 05:13:01 -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 1rInNr-0005Jc-Du; Thu, 28 Dec 2023 05:12:59 -0500 Received: from mail-dbaeur03on20700.outbound.protection.outlook.com ([2a01:111:f403:260d::700] helo=EUR03-DBA-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 1rInNp-0000ek-7R; Thu, 28 Dec 2023 05:12:59 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bvVenub4zFTItxNprG5XJLsszW5JpLsDSOkp0T3QijLP19u5W3aljGszF6VhJza/0vvVwGD8iVTUE3Uq8N/OjUFJ5ctOUVs8ZW/g6VHkDp2pb5uJy+EytZooWwMXx5ybGtNRSvMRKAbD9qgTD6la/ULVFcFiYg1PQ6rlMovb45hmlq7xjVqFm/xEGnCaaByHct/q9ETK+06DiaM3Hd+LkwITcrKMgdEVgdhjTkARtMLa5/cMcQ5xEUnKyfw9hOnhy+4DSLcQuXeV5MQccC+uJf7hg0Nv4xOYNIA2gQuRndU/u3qTXDYDVGHQM0ZsCQmvcw/vTDkigfd/clqh376XqQ== 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=bedRk4XyC4VXa6WPBbgI7Vr77gjnd/NKXEQiIkulafjLdtMm0GladRozigcpEnKzIZsbce7qi9IrEdPg+hAbk0iH3U1qLxkkScnURQMZ84gO3nRp+YY4pfDjm0Nb/SAt713kIVySfALu/4kwAIzeTFGrL0ySiDuoO5//xTibT3GKdMTWrFA5Kr9j0aKiV7lxvXLm8OnTtAyBvfSS8EOaOqY+u76Q31R+Gdat8FZR8vOZjjAWmX8QFvzKexG7ccRJVpbcu9LW6o/oaa2Yd8ImqRCuFYfdd8j0G9fZ4UpRY21boGN59xK80+6lvPzHv7hTgfnI1Q5DZMHjNMye+PprFw== 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=nHdjYwaFP1uqT2TH0PSzJcoVIONZdq4M0f6hJLcX49eRDNIbPl3dlmazggd0CWsMj+CFbX2w2vGlEysDTu2Us7+Q8jtay0ntrlkRLizsMx9h42dE/KCuYNKDBu8oK4KpWd+2bnbpzM2Qh7UorI4WhSE9nCZx7521da0G2iyRipAa+bQNJ39Q3J0ua0XgXLBZIHZCu1OZcAZvM72Fqt//o1jQfjKyjAFqznPTewm6C14SZzBe+fHFr0p2pZPzqZecmDVLZTlbU/1W0u33NGwtIT0Fb3/Ntx1RSm6mlBp84kqHLt5HjlLTBAaGa8QcZv64I2XKWHl73qgsd25jKtX+ng== 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 AS8PR08MB6134.eurprd08.prod.outlook.com (2603:10a6:20b:291::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 10:12:50 +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 10:12:50 +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 v4 17/21] parallels: Check unused clusters in parallels_check_leak() Date: Thu, 28 Dec 2023 11:12:28 +0100 Message-Id: <20231228101232.372142-18-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|AS8PR08MB6134:EE_ X-MS-Office365-Filtering-Correlation-Id: 42eb0291-afa8-4d5c-96dd-08dc078d8be5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H+X6EhB9xZsT2q8nSyGR7Zj+XXWpkvA6ascFr3OvGuQxPa7r9OPE56f0si69iGQbKkrG6D5rl1Ztr46hMR+J7V39T1Wbk19ncnYyAkKh0VH/9I/Cg7lPzpclxRofypnSuvURjotsRb8uQlT5BwArOlzA4ouIvzm8Q82VHRKltLJjDBNvs9/2RbwMHwxWTmyTAIGCwNA5oXJfJm5Woh9ntG3nkIaoRZPUAzVGFlyIq+AKGe6ZSMo1RjDC5vKtS4rJRKYbxi03K2UwjRcQk/SsS9mhunFgNQOV5/iwlI24vztlEud9mzJE4OfbfFhnlBXXfq0hGFBMGCWL9BCstQ+/hMZbqS0KVW4WdgAQuiLCxAAeORPiTgN1HGMLVlmeIgMuFL5+6OJBQMZm3XB0b/FIxNqmHHRGwVn+egS8sX32rUUyMRQGIhbvNm+Stl9KSp4Ko2OpeyrS5hYFq2ARactAKRrSkr/Etj43eB4OoTCmj9ORdMbkOnz8IL4jCv5qBbK4hWFi2qXcEhH3UR+k7sLopgMXG4AFUY0A7D7B1O2Lkg21KX/wXpDpgghFNJpbSDGVq9IfKV0aZAuIWJUT2zLVDrdulYtlp+zQmw+yyTIFpssFRvwqi4mvgxY4JbP9fJ0+ 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)(396003)(39850400004)(346002)(136003)(366004)(376002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(83380400001)(41300700001)(2616005)(26005)(1076003)(38100700002)(8936002)(8676002)(316002)(4326008)(5660300002)(2906002)(44832011)(478600001)(6666004)(6506007)(6512007)(52116002)(6916009)(66476007)(66946007)(6486002)(66556008)(38350700005)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wmCN45ShMAWWjEyE6O1GK79PNRDNUOC7Whw8GaAxfzGK2D7fV9BPzgfW6L9IrvWPAeIzeGLmdWgPTeAKxY/hBmTkKwJfTtgJvz9SLsmsQXe291N5A4COsFPfUEQI3YaBbo34bUw7kw0quUrrovtuH66JLbVySm0m8IarA5vWTABADtXUmf6vnCeHd6PJOyE3F5rIcUz0ZcHFBRlXWJoOO3c/FSEt31E42zWAWWhegoNhZGLbpp09pwdw28PVX16N7XBWSIuidqQSxle3kBG4fnEMN4/3Mi5uS2It1KYM3SKy44CTXSrLVtrOtDOeHBpHQD0PjfGnX8h5E1jgUcEt0C8qC7geqkc6LQpAbLUacPcIUfHOen798TOOGAud3DznOoZKLbZ04ISeWJ+UGkP/MdOJ3kY7Gxmx6yduvFB0oQcIi6keJ4JbwyExfido1YhCiFM1geJoTzsPwdq5uK2hafl7c2s9EzzYV267bIiPmvJJi4htQYSMAs8QCRKTwQpQK0yR9nIKyrJmdd6Ls3m/hUcBz4YIoHLAvmxlcFHabSgRbhQleFdQiVhSEYaCvB+Q002Dmrp3mW/Rj91XTmzGZ4w6zrNQBeU51OhgyXZ40/GD6if2PzOYathFAw9CTz+RjXFKtv6c0xLX4EG8xcChocuK3Pe+rQ6HUn2XP0ADNUD1MaO9FG8Ibbfgi8yBdNB++okk7Dl9WQ1Cqoqx9bYPjtrRwpoqbjAolUPDyPXLzRTR55LEL6/HWHT5Qag1XzmUuSULjcjnZZNyJJuKSJtvXLT8H8m4HRevDToUd6ae5JlF6OeCwxABX28YLvhqsdn6IVb14W3nzT/z1VpoYZopfAbBTURkmf8mv9GP761Siz3MI0WqmKEcaenT5l7GmW7JnT7mCmRHSo2xc74Rex9Smy/07CeqFpfxeLDQSzpRrik0ShzYQSeKOcknTmc7FlrTfkC4H08dIhomh/bg5G73P/qSU1x1VAtambiUsUt3WN4Kodxaw/3N52ugj3M7U5Xvs4jLFJz7VYh7ugfPllhXR+jRFceBRFhWMZ68Wqfdxbnpegh7/wIIB8JVQ12g0lo4XmfYsQ7UsSBS8wVXhzA3F0LxPTBuAVBxFmq8bXqn3LQorBmPG31gJ3gU4VOf1bVMWlbpDe0eARQSdfkCM7dpBjAELPnRkoNgeaqk+b+JubSU3pmd8WVhvKpX0akynZWe2fgQ8rYvkcGjCokm/Tl3taYeJOxx+B94OuUzUO1HVxLmTwEqnVe/m5qfjULBNHi1fjDHswBpxG3LgGldzR7flGjCCV5/fD2hGthBrOVsuUZI7l7lFi88bIEhtwSAbYs2O1L84a4ztsct3DgPFS3r/yu3Zh0Cn5D1/92KlCYVG5mh5CI5ZhSPPOtN2OmOTssXccMItOFRu/52q6zgRNn3eUm7q/JTXOYCXvRwpbR9DDWIMwFhskxDfahT0+pdnR0hinfo7O/iysD5UtQSo+XGXfEFaI2mcRXi9niXsMCZIafuU30fc3kzPNStlCENet3uKeVXlPUW56/3+xsgU+7WELyan9LfsmG0Ugg9MluImarSYfztvoKVW+zKwWjVXZLNRy3VsVpt8hjPwEgYIbX9lxumvEHh0VWsT8qEYs+S1Gw= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42eb0291-afa8-4d5c-96dd-08dc078d8be5 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:50.0032 (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: eWilVy2OISNY2yqaJD47dTMGRPSKyvJQ3yTO4vG9q52lEIWDhQskGAjnpRGTJ4/3HPujC+4UXVhVlXxnn+ZW7HAlpPT3oSEHIaXPALrm+BA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6134 Received-SPF: pass client-ip=2a01:111:f403:260d::700; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR03-DBA-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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 10:12:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505810 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 39A8DC3DA6E for ; Thu, 28 Dec 2023 10:15:55 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInNs-0005KJ-Ux; Thu, 28 Dec 2023 05:13:00 -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 1rInNr-0005Jd-EZ; Thu, 28 Dec 2023 05:12:59 -0500 Received: from mail-vi1eur04on0727.outbound.protection.outlook.com ([2a01:111:f400:fe0e::727] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rInNp-0000fc-GJ; Thu, 28 Dec 2023 05:12:59 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W0acb+KpnoV9gnUx5uqRak4yDvtPujCzPj3yLtYSojrne7J11jhpLSVzV1ie5TcBGDFMW5qjztzpT39TqUdp0Rze8ylLd36lZAuwZDzFFm0EMy85c76DUSM0f+D3ovh1hhul74vURdIqpvLlsjoDKKTBUAcvt6Hk7skrGN7FjxOUunAArLHD6zcqgTH4FAY4C7TQ8JUdUlhpTGcDapozaINBzh647X7X+Ha7HEdBTQS4Yss+0WfkB0L7hK5NOt8G6IyzaH4ZrJvvhxHjhyrReQwJ1fk8BLPtug+Dq7MWpV7VmUV4XXvhrGjWodYVLVIWSuXOkDG9dpBgvyVDYc5/3Q== 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=M/zvHu/ZXww0JAsuc6si6UHijhjH5+vTlwLPR4LGmqu4qfMIv58yv+ZPR9LNJWwuwIx0PxYyjOsSNsxkw+1oiLXORmt3UaFPnzdk5hgl3bgEVC0EAgWAq99JuZd3SPNfxE1d5xShFJpo5ppzw7JGpA2BpJVjhhx2MQQKbZQvaUx6tv7OrgdUEdpeSHkQb96svxxhtRNpgZyN/86TyL6OAX8YvtsXBu+q62rLnKhpK2Rg4WgLwuC3hAobNvtL0piElbgYixdebrpkkkLuz9B+SwQ04/AnI5X4K6yH626UJs3SzDPJt3thuaQKIuyCkInBtw3xDP8KBnUQsqGXxParUg== 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=qq9E5MczSNhK1PPeX588Y4WnKgWObmSXLrdnEj9fLcIpli5LcuSrs4o5PM9e3g3E+x4dBtDQEh/5QgcS7hFCMExoImsBqqw1+7xczFhs6CuQyCUAZI/7zYYakFpA3FwvlE6RNDSNIe7dUcjGs+GtMndCcxgZUNFZHPDT6qAfZLPWUqODa7Ioykli8i5RTPmSySr+xGiNPTw9O53lyRL+YaBMPr67ft1uHALHfB6c1PEe0/FKV3eFfd/38BAKIGj49xOt/Kr8Guyz/+OcBQ0vvcE91lViMo/EOXhhwQWVtouD9z8ePkRtL3gOmnkvnhdouxMXK/S7thDXdOfqsriifQ== 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 AS8PR08MB6134.eurprd08.prod.outlook.com (2603:10a6:20b:291::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 10:12:50 +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 10:12:50 +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 v4 18/21] parallels: Remove unnecessary data_end field Date: Thu, 28 Dec 2023 11:12:29 +0100 Message-Id: <20231228101232.372142-19-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|AS8PR08MB6134:EE_ X-MS-Office365-Filtering-Correlation-Id: 79e07fce-bfe4-453c-31fc-08dc078d8c40 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vD9zsaFuyiCphJz4bcnMv2Z4m7SEss+A05fNq8Wj7IBTcObYozi7U2uq5YQg1eHoDMXqGCCjy56c1ffsX78WhHycvTP6rz8l6LloS29juKmhgizu+RWIKKa7V/QCO6sp4sTAofDPiRIWuwl9DlYwPFzTHruNF8v8mW9Jv/S6FR4sggkWb9R2bVFq0GXWDHOc6Boyuh775Pj3Ar4VfIIPHj81wtKFxg6ATdPu2RArMZJY5jOaoEhp8AYqDWwaRanGZcYqwPUSx+yal39dToa0HfnjakzZP9Lq8u7XB2HEA0ea2jVVGIdNMGYa1mhjnlZal4c2sM2SCtAl0ag664tFhmIlyJ2VJ6bLdxJaYsRrg3x2pLDLCOrVHNwpYT22sTblsL7N1MIxDxQG7m2azMQ76mLF1EE61PS3gUcX63YpVX5PFs7io6xNHLsi/NrE6mip97GTwzFtoRmpN+sfW8M7MipgSVs5IU4KDsALL119sOuu3/jMUkG8eCVRu/taY4GLPTBchiMFxXW2Qt92NL0a1LLVgn3tznBlVp9hnz+9TELLBjuiTcLHQbY/0kz5MAzyy0j/mCltQHfR2L2Uu08N2iGZ3dJtv+IZ/KxVYzNLeqr08RhbWYDl6kEPK1OyOt6s 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)(396003)(39850400004)(346002)(136003)(366004)(376002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(83380400001)(41300700001)(2616005)(26005)(1076003)(38100700002)(8936002)(8676002)(316002)(4326008)(5660300002)(2906002)(44832011)(478600001)(6666004)(6506007)(6512007)(52116002)(6916009)(66476007)(66946007)(6486002)(66556008)(38350700005)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jxfBx3rhiPU2anjK8Wc1rnq4K8bnOu5BISv1voYQn9b9ZOmoXuv839BE0fNS0lYtfU7JBjVlnAipbNyeRDsWKHTOFnW+E1MV/ODNWAiqr86DszBw2esVa97/NfuxweZT/a6SSqZvdSJ1tkx0k1hw4J68Z97nsbWbmwoBtIGOmwoF3AazH88IsyoZI4R1xm7iSRPpZTJb5LOR33ap+xuuyezw0WSDLPXmqWlme4USY3eO6oJoRqTbZ1bSnhz7t2mPBC48TTF61Svn1vBG7WSELG9Vir8qQd2GpZZf0UfTIGx1BIyCTSL8bNlmzTXBtA0wYw936Oo5iCno5oluseNlDqfYMofIWXHN8cnoouINJ6L5CSX9wht4PqnnfeIi9XWWVJyEqdhlC2yJoAERiC5mISMbn8jNd5UXqSN+OgoeeCKqcXF160WTfFVm8FcqbGADlVrL7R9XDFKkKog4v+luktTj+tA+nxzHfF0umPqd9rGAlszsLAaH1aISgNJDbxSY40cH6dxkaAhQyntid5iUk8uTHLlAlcfYJJ35B9YsiLLqiT9hSn1X84WcSQz8JUomM4BLduqaNgkBR7k6m6vcn0bmLHK/9eGN4rCJqvUV/RoEUMs0S0ufPqY2INysuW4LwNooaw5/cDawk66TKc9gJlXx+g7gNyPMnLBmtmU8iZbr1cQK8t0oolfX8zJVuJi8yb3tNXZzY/f8cxUYVAyRM6t/bxO5yhfLECVvpE73Q74qza+bQqAvwmOKmw1+n8R6YyGZWFDH3sKjXJlvPyekYBUnazmYRVqUdwnEa6cUEDNK/FmlY5cEDT0EgTH0uUfoPOV5Aw1Rq0PKcj8ghOA9U7pMv3zjecfL+ws04C8dJnXMy6HJQnzpDnxdjvoQyyPspRLP3xEGy/6xIwCE9TfqXWxqZS6SxZwHGhNbcnPZQhWC65HE28hk0OgINJuqwFCZ1E6G86Ry0JjPWhu8NTEegiMqnr2ZjFbGmDvzsqi+NLVF/VVu8sb8oWc3+RiCPHFtw7L+pzGkNOgEruaIhAHRq8tNi2RJg/lj+ziP+SyiS9sVUamgjYgeRAxwNheQGXqPRgpjVhSQjvBlsirKBQyqEGGbqRiOtiKz/YtHpTAcfy0u2r//yhLH2HbRKSqJe6TAXtWnueGoiwI35JPHsCMgY/7fW5LIOHvKwG/FO4xjgvp8mrIbJoOltJqukV71/NRwztF2jStUJszf/t9B78YbCUwVED5GS6lk8E4T7WfDB+dt8XP9wnzLy3f/DyXfJtBiY7vM5pE5jbKKImZdpgd13Ay5wUJ62xpZFjaTo1SU2Z43onh/6kYlQyq0ofclm/qyvHlr1KjEGWKiz9pJMFZ/vGQxwJWQfY/B9IXwH+W8ib5fUP3QJzIGcNPO+QzedHn7Z80wx9aM9dkc+oufCOMm33Qz6js6q71RS1T13wi01nbS75NU3ts+B6nh+gBOWrfYOuePj/Zgbeetb78YGh04J3Lh+62SDbvbTnuuSVnJEuBEPxnDGPnUW002t1GT7bRo2LwshHUXPh9Km+39pF4ibonPdO/dxWl4Zhnj9nt+VBUkfK5XWy5nLZERgltJKoV//a1+PkkyXdfQpzHq0bBytqpQw15ZuuBgXesJmMuVHNo= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 79e07fce-bfe4-453c-31fc-08dc078d8c40 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:50.5702 (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: pP1Y4ITRLybCpTCTMhg2qUgyj3PPscUFtcbP6C/3QE0H8HN52o6bv1HKEVnHLUpEAedeII6/qRPFFaTJHQTrRXjenGRemn0MOLIhKfMShKE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6134 Received-SPF: pass client-ip=2a01:111:f400:fe0e::727; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, 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 10:12:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505813 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 A2A25C3DA6E for ; Thu, 28 Dec 2023 10:16:17 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInOL-0005ay-Cz; Thu, 28 Dec 2023 05:13: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 1rInO3-0005Pa-1H; Thu, 28 Dec 2023 05:13:12 -0500 Received: from mail-vi1eur04on0727.outbound.protection.outlook.com ([2a01:111:f400:fe0e::727] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rInNz-0000fc-LG; Thu, 28 Dec 2023 05:13:08 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C31bIajTKGAuI8dIdTVxyFtdgEXTJ+dzfRuFcntLWuPYa2r342NnzX+m4YIQdLXNWwbsj0GtLGTLt/I1wM1+z0bNe6i2vV+HMej2XdcMVbBaM3J/JvXA7zzI9Lu/NtDcTgebcGuEW97oGTNc9AHUwMiBLEEj5k7WG8f/xP6tV0yFNHGhngANUrDh4oPL6WZs6mgKUviupdADKFc3HHe3dcRjQnTb5JYhvv9EeiuKbcYQOe208nEQ7y+oNh+dAPn6tXJcMknwmihRmVVYQtWBMdKjvgLTSdw0tG450HLLdS3pKbSFNLvjVhqmt8beQcKp++Qle9aEgSpDe0M7bW+LfA== 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=KakrbuwDggi34dtDNQfn9BA+zwZfmIDQ9CRtxB6uyVIZRdvb7vjAnoGVIHstkjrxJSzyEVE6JFJrmi4UG0ZGYvTya14mX25r4F7nHcqxZBykYwvmjc5yvJtLfsRAx7qSWVat1q+qohHjkwpByIvROQeMQiDp9yzoNzcZONn1Jrn8nLdzLhy4ECLdJ+QHDN0oMJiFTH0RTGKp2ETkKZO4ISM3SIAlbPEFfVY2pooSfDB8rqLMdoALP7wEc68Ny3JXnAQ3GyE1PCDwI4R0a3QGh+bbxzBi7OckVFFl7otNSDttvd9hYcaycsFvKzqDdTnR4pH0Opjf4MBJskdP+CS6dQ== 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=hvAbT03aUMvLKeGvsg1u8FcOSWAoriF0bQB4sNKIMzCoQ8iyiWFpRF877BlDPgZnVUPpVlLTpLqZw4zpJu6KxhLuht7zpWlP1w8d7gqn6naXrWRxuPB8cP3IiU+Pgb9fnEhyCHBb1QKs2ahXczjBesnG7x0hYNrCzleE45Dxim/VJlairvXUTcgGiax4cXNlIuEaasOqHllHEOLTjrytFIV74uxbXTs/Z3u1JMsH2e1kTnynzDb9OdIYJ0TvzxneMp1mpt8yW5XnJtbeXzqpl75LIly6GJuHn1Qzx5QFsNjQMgZvLn5JqbjNf+nNGsttw5MonmZscFsFFBWF1J+8tg== 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 AS8PR08MB6134.eurprd08.prod.outlook.com (2603:10a6:20b:291::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 10:12:51 +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 10:12:51 +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 v4 19/21] tests: Add parallels images support to test 165 Date: Thu, 28 Dec 2023 11:12:30 +0100 Message-Id: <20231228101232.372142-20-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|AS8PR08MB6134:EE_ X-MS-Office365-Filtering-Correlation-Id: 6ed2aafd-1a1c-4a3d-a550-08dc078d8c93 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DbFPmUmqbbNu/rX0YWSdieBuEgFrBo6DvQP5OtwZXY5AwPzS4HKNXvfgoGEXZXrZsl6nc2Wa20ngnUSIjAXm2s7srtJPGKPletXFx95SIka89bKqEU4qzxYwLX9XBiceKQfhVUU91KyboQDMiU2ZJ37U5DeLHxsqk378wETPE+N3Zy+1H/4fLpjOnVOQDfrziXU/jBWppcDZdjsJrhqD49DEVN4bYJ1ExSnSUFM7TTqFxn7Pg/5oLxhWG9GaMVOKJSou3ZlqxZEj3CQnquYMYitRhPSmi3WPe44MfCdo6Skv7bvTXae9TKVLkoRPnR477WpiBTHzeEodyBvgFeNChdGX3qkdoLJdLdxjQgVHwZ761oGXKodmGrrU88/I5jZwwNHdKJGGmQpufZ5FrN/U3pbL2CjAYkE8TQl/A3aV0DCA+O+/qMomeAum74O7V0OAIb/jpQvQ5r99uEFp1wnq7TlvpLPwyGFT9O7KHae6vdowVdHiEJjMGSy7gVVt+17kWN8QDn12rPxJe0XP/iEIoMOwKA5AzrY/FjhalBdfETDbBWDXDDdv9X1vNR3+QlHlfmMmSNabExVaE0LV7HRZXJ8pEGIB4cTAVHDOuIwykJGcYax/NrPvCbbCfnT4HLeF 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)(396003)(39850400004)(346002)(136003)(366004)(376002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(83380400001)(41300700001)(2616005)(26005)(1076003)(38100700002)(8936002)(8676002)(316002)(4326008)(5660300002)(2906002)(44832011)(478600001)(6666004)(6506007)(6512007)(52116002)(6916009)(66476007)(66946007)(6486002)(66556008)(38350700005)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T+0vbxgmpqGMsNf2Qks9fC/HruP12ybyKZNd/VNNLArdwroogOFwO711bJEi+KcVpyvsuNTqNUjoTqE6vwla+nbEetF3dT1QitBfZ3BNDa9jgw1dYo3vAOtuZeUUSDdPzqfOVAU4vFc8pV0C2+i2l/xmB2sZ9sKzdlABcjAesIreOUk4jUP/aj76V7TyTRjtgomzKs/NtE6lf63RA6ccPyKkEX5hbDqd2U84UkysPqkdpqCGBBhcrHTbt0VmmpKsa9miDaAWU5FkvLym17bwgb3+GqbpkUWyA3END1e8S06P4nb6jAwIF37fm1oP82Gj61DXftPDMVjdqKbyyJGF8zsdfu//hSQCPDqCGKVUXsSPtZKtz+NvXILielFOW7/Z0wNUtV7VzPnYyjAuQ1UofmFqfNApPMnjNrodcJgImdkJgizYrxDGFXz6BkFTNaAqYE62J4fdR7kGe5/1LUNiJ8VYXMzPYs3yXpEUPny8WGGywuXw7gOsvUgGG5oqb3uDA+hwAQgmqEXkA1+NBD1MC8T4xySy5qeS52y59+XqxNDGVZbfys1oDFo2ZCw14BTg53sxuiXEs3l+JzWUFIP6LinR4EkVutpccRpNr5Ta8xQpCdQBZbszd/k6n/ahoEjYEEmDASSBhqt/URJNUWlAMCKL8tFKovALPNxPexHtQKMVmNET+vZRMsgk1iQevbD6XXd2hVo7pBgKtQvrVi8S5HwHvXqWxj27pXNgiiYrBMnlP831c/zJhDlpsVtXa6UCjU1PrxJg91YDbA063SGwYp1l4G1Ow0pTWhzI+xnp1lBnXmRc8MjX79SmG3MaKxtta63bQvBOQ/+dvUNRkz3mo13LWev6hKybPF/HJdncy1uAiOtYpKhfBa+O8YPOt95tGLoFlcs2duA2lMOeLggmiieI5mGQD1QrFhV0Xx1ZoTokkkBrwShVmJD5HsovMEEMMb2HlktVL7FqTa7GJgvE+Vu2Z+m5g6cxmFqvZr/mPhrCvMpetGTKZsKP6Q1aVaG4+0OWo0KtCRhMVLKJz5u+S6urc27dLCVHd/2ZKxwqML6x18f90gD7aYB14c9V0uxBC3cmV7m4Y/fl1IOQXnfKOhrlCJBlklSBwVDXu2DNG1dHslwl3QF98qyzK8IBnU10gZDfsBeKi2+2b8REUefCqrIyVZtE44NbmwSCK3+Ee6y841+EVaTU0ovJNvCWevTkiUB5DOBRw1WTW1fMlzGJgv6sBCX7OMLVkrFeuG4gkJjEUXGirDXZYV/moCVFOgnJtazMNMSc6VFhA4u1vNucIUTPXPszwb1Fa+VXMG9cbTFMLDRq/4rzMK6KNu9PnmWrdWZAcjT1ZgXjyyxCMiQ3P0KZi1nNTLKQJoG2GxHbaIWGlRtjjvPCubzBi7aGhmOOdfnfBiA5vsk95O1BMNv3ezGXkAGuOll3FljNgHJvOMF0gxxX+j09YZAbtuTKTzekc507eRy+cGLCRJ92RMwmITsOcFEiLZo1sT/CPYR2EVMIqMi1qezI7xURVZIUya95YIeY2JJlNYTmYiJx0TDFeUlLZC9sLxLjnlXrC+0WkIjCL72GVXBmgkE+cZNE0ocKKrudoGg2hPz9Jg2li2oP9++TI57IfGZrGnOqCFf2714= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6ed2aafd-1a1c-4a3d-a550-08dc078d8c93 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:51.1069 (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: wMx0W5kSfpn5wqViCa9auQaqeHDsC1wwOT5J1hRhYuQy4cyq/GomRgCkxWqgdWxESdqBqAD4poUFAEiR9wlYMCgQI6pwTWLaUAzR64E1kKA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6134 Received-SPF: pass client-ip=2a01:111:f400:fe0e::727; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, 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 10:12:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505815 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 EAC17C3DA6E for ; Thu, 28 Dec 2023 10:17:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInOM-0005eb-Gs; Thu, 28 Dec 2023 05:13: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 1rInNu-0005Lb-Dk; Thu, 28 Dec 2023 05:13:02 -0500 Received: from mail-vi1eur04on0727.outbound.protection.outlook.com ([2a01:111:f400:fe0e::727] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rInNs-0000fc-2h; Thu, 28 Dec 2023 05:13:02 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BfxuocrVSYnnPw9P8hwi/f/rT19pxSKmA3rtRPcz3c4BunNNFjKVyq0xwkkKODzMOJ+KLpeozgr2vJ84gCFbXElLltjXzAa5qkW9O+cHFY2N0npC+NSPBTlAnHNBgUSonCz7FZGHRIM4ler0+sPyXhmtSrMdR20CLR9oH9wex9rkb716n2q/xZFsiimPqj76tn+f3hEU2S32csbp69J/E3IFr1OTiprT8vgjaqMG3/Hm4AiceRPyxCU6QzgTEm7aNKZTonDaHReeC9U5lWAn1nPpPhU+DDOZBOAp03gmREIRCo3jGQy68HCvfBBxaosnpOejPUkVhfGaDvJwcIbvdw== 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=dm7WJmfSjQJrVSNPnqzsjy0ODMzw3TUS2q+AcsFok1XSRtqeBvzuS0KEW0lu9QUJv+4LgmiruNd94Cgo2yPCvLXWV5dYijskB4xBa0jTP5DaTJEvMGyCbu0wS3B6MshA4SADtKjoOfGueLF1vdCyfDOQ7mgQuHzB3L3gGZztqDrvJhdGzH+YXzrYlNAN72tyDTz8ZqYvaVqQBhGctmx4eEHMGzvDSlA6Yn+AxMiankybJvuySTj9ucT0T9k1e++WK/NeKrBJkQXNZ+rd1uy64g+WyRerAtUpmFLp8ti228Kgg/HGDLRu/hYfXUFMZRNGOkbjm/Z9na80+Tvl3eJn4Q== 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=sFrr+k8/rsNJdTBvyNHmt1xb8O8mLYZ+cjwYg80ZelvSDkbcyN+5GOnLpel9NZGp6YBrNwy3OyiWiINi39kAlrkpq7jv+X1kOCfH2G8mB96zASeqA+51K5bEHWvEoWDJAe8y7baBu/8ukaO0npApHjHWbnbSmPIoPqmRgf+C6wWFhtqHTJsJu/4r3gcv06nmK6qsO9zh01wjE0G75vJZbZ46B++W8+Q+j6sKJMFNYGWjSgWFsBJt/BJ12BOQWYykfVxKMRoYzAPAp0O2rtqj6VRin77H/eORxt7m+HG5QE4v1jcta313T5b/38n2O43SKVzA8K9XIoc5HCMICDw88A== 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 AS8PR08MB6134.eurprd08.prod.outlook.com (2603:10a6:20b:291::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 10:12:51 +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 10:12:51 +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 v4 20/21] tests: Turned on 256, 299, 304 and block-status-cache for parallels format Date: Thu, 28 Dec 2023 11:12:31 +0100 Message-Id: <20231228101232.372142-21-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|AS8PR08MB6134:EE_ X-MS-Office365-Filtering-Correlation-Id: 1b7e753f-a52a-4c0e-192a-08dc078d8ce7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wTFVGslErcdUZU7uZ17b7NdcWbiL9mhxMePUdry4wlNHNM31y3P4/S01byM2e3DNTnnWwDOSYYam0hl4MXgcRQrN65D80GjX+6DtZnt/wQqUG6UdCG+Q7zEmvpB5uLdn0w/8BTDdb5dj3pi97F2T2BaSCkMuvFa/144cL3zQTnTrsl87Hcrtz3NAfF+4H8c+9/Fk+jvL01GjcUZ76Bgeku4ouH/VxoAXtWyYfznAiQ1zAGXFkjts0CI9+oWe7Z1JK3iBaNNNo1VmSBu5Zx15i8R+VCHikr5GUEuR1JDBlhqaZh396ZlYwyAHdHDRq4yBd/IabVphFDoHXF0ezYNh4e+uJb/pZTIvG6J0eWpE42exUrdG159xBP1pYEddK/f+RaUIR0gJefd2hZ5G2wc4+JQrfDkOFY9patLHdXQzX330CUhdoZg287lTWNb/LeKNnTuwrtlCfUYoZIwkLHzOpLyCeEAMViuYhDKfOejcMqFlwUetSmuuW9zJ0oHHjpjsbGgN2oMb7KDPhuzbaP9Oi46Pm+D3pfLGtzyKd5SZxDkW6pLctHaivJtEERMvcXfGnNeZXVVwr/Ha1kJFjhvQgpyJ/epX3NslS9QE6LXTwiYJvuwTRxEoAiTIyPI4G+Hg 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)(396003)(39850400004)(346002)(136003)(366004)(376002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(83380400001)(41300700001)(2616005)(26005)(1076003)(38100700002)(8936002)(8676002)(316002)(4326008)(5660300002)(2906002)(44832011)(478600001)(6666004)(6506007)(6512007)(52116002)(6916009)(66476007)(66946007)(6486002)(66556008)(38350700005)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MkNC9FETqtB0UXfYDKYn/D1hMD3nh70oWvumdrDKRZ3xgwbs8PCpPDWIu8iyLytGyVlDJyy00ZeOVj6nmHdmS/AUb9JzrShZAiDNJ6D8LVvYuNaGznCFjir8S6pAUutoRXfttNd7NJZIg7X4hNtp9BVA98oxdig+Cwv8mZjikIKP4So7Wpfxfj0rZVRGCRYJI72g5qy+/lMIeUbozbgPVvcexmGxMTuZwefG9g65v7qXFctvcYZjiZ4Wv7VXz0+law7qvMTyuyKvmll4YYFvPx8b/QWpsYFbv6i0xkWPnn6rIMbYIg/EKmtyo01xB8XThCvWRkohAZPpCFd8I5avTetUlJW4geRYSLsc1Yz+UVCqt7dCesYnWgPjUs1uvlaWCNGvY5aenf6nGYNPGVwNrXfnlb8fzpWRXm89+VLiWuwB1c1o98TaaXtkQLBCLSh7RrzkwBZRvcHbQmlsOF0QxR/1/yKjOkpbsKfReLgEYvK+0baXVtx2Y27lfNVhOApq77jylSz1p4kj0FQw7F35ma4R8l9+aMxhbq5Gcjk3rhq0I2v0AIf2x2dX3udR0qtfFoaONBslscdEAphjUDORhw8fSuHq3t5Pb70pixIs5E5Ev4BT1ArqRbBCfCioBoXqnZO1kcHCND8CGZHmE+ered2K35xFOqMFiEO5+g4vQeAwVlkbsbQlcBxk7QZGeEjCqDdbWfvjouXUvGzbF/nztXiOVk6qNKK9O+StCysz6QuYiVRmXbuz2HuTu0KenValan2w50yC8Vyo2M5Fquh2l6/fpmFEj5B9bb3C6OnfEQY+VKJGTXhXp6iD294oTcQU1YUvgsA9s9HjUafSx+Gi78vrJWj0Y3T9sLMBxuBqCHfrmyxOMSQQ7wRJ7uQdSVhtw+XFMfo8L5WQ5Wdo2d4Dz0trokavJh8lCn2k2xZ0ZCwOm8KCgGjChrQV99VVDlNCkEKH/TpGyBBpvM5b4sJDnYapUbkUVXMuHNshnDlEqhACvhBUsrpNB71g+ws7BCsU56kAaMGU81kLAVP3tqAIeLCHC9H2bqZxY5t4lLRgBPt71N8vJv7Vkg65JjhC8oiPwhsO0f7ihIjG3/Lc3sVyG17vvJJZhGMs6E5ADwPqGbCpFbS1vX0WjLp/gc9aqSrrl8Ai2qFdl03FoJjn7aLIHYC/LPwrQxGeaDh+UG2JEm8a7Z3QDgFxBUvOwpMmyt1welrWReJg7DUMS+n8hZ/JIwqWMlBMApfDak0eqbjVq3Iu3ZJPCUGX3s5JMdKZii3ZYKCPB2pKYSINtGqS9kI75tP0QgrdUaQPrgaHz0mcivxKyLAdc+P4L7sQUKwsoERE24e2PnEaRatt4LeRYV/Iiyxe5BpGtqSSgmiYq092dH7qy+3xJzzGHZ/e17fjpQrRcIaeTyxu2A9uudFB4at1Vh3oDwT6NVmR+PzTsWLe3ayMQI8rk35dRJygjtmAE5Qfd9azFPOGBH4KIbsz4RTcxlfBbT9lrJxWV+7XNP6S02NVsN1X10B4aLYO0sTV9S8ADYfOWXZwKCxCEq+gu/4M10kmuonzlFlL/d5Ab3gw/v4IMpbQJR5gdtdEWADK8/moBXShv4AYwhaZkIbBY9O5IiuavTtLkFMYc3Ihynr9S+g= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b7e753f-a52a-4c0e-192a-08dc078d8ce7 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:51.6787 (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: d/8iIoT3a7VjAktyqA8NBZtnGn+oiQ7HngUxAlZwZy+TWUIeUSgLAMe21lRqz9+w3P3hIrYYjAI9O/ISkGP7TeKTXUbrv9mUH81ESCyHg5o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6134 Received-SPF: pass client-ip=2a01:111:f400:fe0e::727; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, 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 10:12:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13505807 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 4D4FAC3DA6E for ; Thu, 28 Dec 2023 10:15:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rInOO-0005hD-2y; Thu, 28 Dec 2023 05:13: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 1rInNy-0005No-Tf; Thu, 28 Dec 2023 05:13:07 -0500 Received: from mail-vi1eur04on0727.outbound.protection.outlook.com ([2a01:111:f400:fe0e::727] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rInNv-0000fc-9d; Thu, 28 Dec 2023 05:13:05 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GcsQlNU0duAC8oUUM+A2P6s14sfneA1COqGwVDhjOSwLOhOAIEeJ1AY2xH0cIWTHpON9/L6Hd26SdnxmkhhKOtuvmjzefUxeQ7/CKT05exzz+PPoyg+H8dIm0O0WzQOO6XpePKkpXRL8fpp0n5wWhqzgwLDOV8UEACb7VqqmBN32nPrRVxpuIn1rmpF+aXrIRrm22sEWRoSidEn2B7LRE5xpU5zAbUhs7FJHXELVK67BXPPlzv9w14egopk/lrBX3vupSMZkUGQvGoElNc8uLTzddcP/nENYGkBprCiu6KvR271j9b+FFHHdRax5OTueUY1cCKkS8s59d3PxcF3aqg== 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=nQez4IiDt3FbgtwWW82NE271SMeCipRtnXsXgkrBugHbx0EWk44EjhLpRs30k/a7JXGTO21oA0U4PT+pI8JB500z+/YmI8HHddYTKReOgfixMZYHqFllctHa3i24UgMco1gZKfkZmH1zn04gTjgpvlQYTA6uFb4JnCoXlssvY4RWuVGCcKQbnyvRVWv0ElT2qQ1UaJuU+TrDjSJmk5R+xPpEpxLkDW6nEsYxHpOV4S6O2ZBeBQmnUSCSqo/mG03mdWrDFQkwANeVQ51cuJ6h4iWFIsJkkikwDQGO9JkcCIrFbMTB+SrMX0UTWRtD4OKvt9LxKrjfJ1VTcgsD0HLcTA== 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=n4GuS25qSmj6djasGYXFTtLFywEEu1H5s/9WTewDAhoPG9taKHEtAYgSUgkGT7exNTHcRGK9fnwORiPLmqqEWL4cnbZ7HHhShJwltC2jVQ5k3rXqxCPj1kJD+Zl19BSMfK3m3xZozIpg8BeRpHqnvyyeiWVIZYJEFm9C5CYIH3/bOutRY/qRSKGJvLt1VLcr+mlJGb5O7e+LsCUJJejdbk/ceWBwKnFW+Nhr9xzuCLSlQeSaumBOgIuNu8AQlFOD5h68QujK4MjNYLGqGXMDGAzV++fZKZRY6AZea3jnwqGMu/tZUD3R4tTgZDXCVpVoHPu6zA3/+VP/3Rkto8kPgA== 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 AS8PR08MB6134.eurprd08.prod.outlook.com (2603:10a6:20b:291::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 10:12:52 +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 10:12:52 +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 v4 21/21] tests: Add parallels format support to image-fleecing Date: Thu, 28 Dec 2023 11:12:32 +0100 Message-Id: <20231228101232.372142-22-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> References: <20231228101232.372142-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR4P281CA0044.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::8) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|AS8PR08MB6134:EE_ X-MS-Office365-Filtering-Correlation-Id: ee79a86d-4659-48a1-16c0-08dc078d8d44 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PBxxtRCjOObWRRghAZs5Z8Favm4okJyCH9wpiHRtjJZTGnNmkFdVCKGtVHhXOghCzKYsgA8l72gmurahbicK9PH9eMNufoYVAjq5vpa9KUpSVVODEmawsii0TZYecQvf8pYHxX+8GV4wDfqKnWxvXl31bfJh/IZVfACFz549N2hasFX04VTKdApdfVZceXfTaNNRYZbIG7niHEQfeJXe32duIpwrdj5fYr+zAqAItJWd0yyBAjB+gZArrsVr4y+mEjJZqZWBmPdFRpxb6NzIKWcv6csoKpN9WJnPtENqI/Jm789BTUCgDVb+1mkBhZOrgopI2cdsfYa/6oh57uGeajpDkEqbd8oL8YUpv0aRJfJG9uqqnCyKogwVxDRz/tBYfYs2DV3eB3XRH/UluXLanTpxNgcLQBsVlMTQuVb6a7SzjLSr2K5MtOZlU0urpfQaIFohkMR86wlLXmIORSbW0ObVcCtoKOuyev4weBuGcuGwkSeMaUBdSzYK5KkxektXg4jD4jQnWckXm5mRKGx/nUc8rbhHqzuN+6MrjfqbbZT9vHfai6jpyZ1hRNeuZSQa9KCBDCiqswokTzofuE9oKigapR23KTzCHnefe8so3doYZprCkAp4/WL6dJAOvgtn 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)(396003)(39850400004)(346002)(136003)(366004)(376002)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(83380400001)(41300700001)(2616005)(26005)(1076003)(38100700002)(8936002)(8676002)(316002)(4326008)(5660300002)(2906002)(44832011)(478600001)(6666004)(6506007)(6512007)(52116002)(6916009)(66476007)(66946007)(6486002)(66556008)(38350700005)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: a4QKKLCPLS1mfnQxkYRQNWPqwEYx+TePv8iDQvth5KCYdVXRmKwGj53ZFujXHx8y/2z7A7GBRjbsZDYL6O2NFsed2NeXXcryeM9P6DRJvTuRUmLn7yX37Y4bLMNKyUFszvX4mRXUAg0xIFErNJPWXXKu2pDr4l6Ykp+Dnnl75rBBccgSxHW1GDqQzg+Osx8RYyTTU1tmtAW0B0aNnXJNxxkoGmdmNHc8Ajih8Ct/xqB7Vms7ddCQCCGeKL70zNt1e5vwCQy0uT1IEvyxeRSsVA/Mf+qaH16viVlO3XULgfrYHe0/qD6QzN5SP9s86KAhYiMUGSTBdHb0vaRe+aWWseMUMG0RNgdudaN6QZRY5VDqopJfUW/Vz2FxO5fRA162/xVsIYBFCXoJqmXzvlz+wUR+PK3msijcxSNFxNBTVIaL8lqfkmQZpJmQvhOkHqjHwk+eBvcR/GTIrB4shrms+HzKmQWrECdv9RlmQmiwM7RdazIymAMDaapA/OQh9/7KzI9cLbMCExN1+SR1Z4HI2fkuu+U4qqVHxxTwZ2+pcQLoO0oXGmrVWPiGWtVOGrmRB/q8sRMKML20t8Ooj7S9FAlCMrK1ZVThXzNlSi7W602bKT+vhkZqfoggba+ZXQ+xCoEmO/IcQNwzIRJzmBV2i70fQhyXw7Z/hlzmUd2kijTk6Z+3jMPwtfNPGlo0DMlctgo1KABGXb1mdrV96yUUSOmKT65MqWBDUra7PzmA4eBNn1Fv3eXDyCEpETUa/xXtv7Bo4+SsZi+bZgCp6oFmoMTjZQe11yfMv1LGloEkMPEDJ6pGBgM2o+bJRUFtRHqrXZmCh/nolC7Y13Zwmwz5vBv5w33fFB4h3z8tJ6rH+SAKhs7fyw3Bqu95iTHAG1OxypweFz4X1YmsYJKbpACpXsAGG5ZneeaWVTFKGLbuj+vC6JYeQIhXkaWkuOu6dVsKXoB+92I0A0qc0cUPrOHwqq3R4l+8mfpqPFaTJ7HZjUdmB/3+HniF0qjwP5e0zXhMn6l3Ntk+at+U9Vgus1FzoowjOKYbbFuLdlJjW3JQ/yZ0QO4EJXVz3dkZrF4F90eEK18yoj2e+Z5a0JwVUHj7u/MW+u1UCgX/CbB8n53MIOFV5Tj7h4ZsQPBKrgkCGUKXS8SfSF7nvoBF9mUzqPdiz+E6a5zKePzf9KtFgW1zu8c1wCL8YbRrkcny5uYywxj98USQUN8GW4afv7G3g+AWVMAx5BoTRddcE2EdH363p48n0ZL1Awjrvo9S41DyclWTjWxyht0U2wQYIDCbCe3LyNYyh8khVyaKGLPSUuR56XX0RB9u2z8WCd4O29Htx++3CgXc0WyORAcR+vleEwF6p1uh9nysSUNsmElQSnR1ddBEkIwMFEsgetkUzqPuDDGLj3MkdJWROjxT8kWUMrMTGN1znCPA08d0mTv6XgCpWOlTlumIqCWbLZmt0gDYTAAYxbPh7JcLdxNuqPN9LP1Mc+JuMiEZQNH23GIC0UTW4JeBaP8iY84CAJGrR8eQyYKagaO3K7kqyI+8SFqQ2q1ur8s++jvNmhSi4TRbIGYz5bQ1Gv7h46QBBaWttv8118wLL7AfGJkXfdrHmTr/5e4RMUGU/J+6PUiFNn2IsyV7OGg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee79a86d-4659-48a1-16c0-08dc078d8d44 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 10:12:52.2708 (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: d1np1vxHO0GIx2G1v4bVHtwxKBtKruam+S26Nkhruw01D6SEza8k5AUry+tygifSO9chikE65uuYu0gjlIFiKXiXbmEr2LGlVSCto6TSpzo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6134 Received-SPF: pass client-ip=2a01:111:f400:fe0e::727; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, 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 Reviewed-by: Vladimir Sementsov-Ogievskiy --- 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))