From patchwork Mon Oct 2 08:57: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: 1841998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=IWg97afR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZgY3jrJz1yng for ; Mon, 2 Oct 2023 20:01:13 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEkx-0001gH-GV; Mon, 02 Oct 2023 04:58:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkf-0001Qu-Mi; Mon, 02 Oct 2023 04:58:05 -0400 Received: from mail-vi1eur02on20713.outbound.protection.outlook.com ([2a01:111:f400:fe16::713] helo=EUR02-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 1qnEkc-0003Qj-Bx; Mon, 02 Oct 2023 04:58:05 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i6kwPzw6fMLbYQvA+J4g1V4GIDphnZqQzM2mI/XVivp3G2vaOUFKpNwEtwufDIygiN6W0fiLPxxFImPRxONzUGVqgZvXPpbkPCeR63iKHoiX2WkWKF/fQ7aM+rSLd1kX8AQeOG5JahUWNGx7M3xQFr0FSyIB1UU8O36sLMoRkEbWb1MCmL8PBtHu3empX9pCf7uwnIZiGS9w/KR3lDr5MWeffdoAU5S1OeW0vaBLjVRBEgofiw501nMRcyp+Ugg2EjpwEbZ6MkhNqg6JBMpbRvmOph3wx6URCWsvggQIhwC1854WtNguopF7N3ipaS9yOigyiRbfXk9qnjT4OROtFg== 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=ntnX2giu7Q2KhyJ8pzAzkiMjoJlJRZXyWwsc3SfG+7U=; b=ieNOUWsjjzXlastPQmZ/cHN2mph12viCZeR/u69cMG42jegIc3K0UAfNwz+8iSUfTjzDFqRKR//azK9EVqXfpMaNW/fXqgufymks8KY8ZLASxRLzRnzKeGnbZ/cUC8+XVFUlMU4jumJXAqsWLM8Zr1XJRAybjGwtOX9zE0JBQjyCrFWDuHLPRdTEF/kBjGCSB/4ZKn7sXinRS0k2J+YVrrHWVRoS61hH5wSDrw3IpORGvN5b6B2lsM5lfHTA/SVsGNQJ66YRoGFeW7sc5Hs5dtdlZveF79xGZiRARq1T1bhm3Ko1NH1d13KD4VcMxe1v93yQgw2oqj5MOKjR+wlSYQ== 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=ntnX2giu7Q2KhyJ8pzAzkiMjoJlJRZXyWwsc3SfG+7U=; b=IWg97afR/ffeeW3NwtHCNy+ALFK3SBNW3Yxfb+YIQTZTW+esB0P6megYlBmseK8wp9YhuOkXDj4VvuMd2EdLFCRmjSYD2PMhbBKJWJFcQAzYHxjWPX8m5AjcdSGVcYONQ3cH8v002bTwOCmxQDyPnS9fcjnvEbqc6Si0yDELM0zVklHHScMct3pxQkWGmF3EzCp2vDlIuefMSt5WTN+Po/ctH3a3NYQ5WQv0WNzLmFilHeCB8c2YqxHq1J0XNXHkitHqYoxZbaLWPEbBXtr//ivD4C3YMjNPGCaIltBgQDIJ5nLX6XKtawpoAj7b+dJrd54PeFIUE/gFBC2TpGPQNQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:49 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57: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 01/19] parallels: Move inactivation code to a separate function Date: Mon, 2 Oct 2023 10:57:20 +0200 Message-Id: <20231002085738.369684-2-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: 22ef2c5c-46c9-4d02-b96a-08dbc325a616 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fnK+k+nlvcosnrFbwWqDospBX2aFmQHqkFFzlhoKFRf+1Y0z4b493O59N8zxPuNqziQrw+Y1rYPYAzKlH0te4RGPRMNdyzBrYJHHT9oeb2nYVc6b6ujuaZUZcNegZn5S5w/vJPVkDK6kccODNBnn6BbJGlvspeSuwJWHxmhwHhHXQNB0m6k8iUy8+Q1cahr/VqdHlS9vW2pbpubnGIXdwO1lzIakH2s2JgoZHSviv3e/Dw5JZBF2TqVUEZSCsWoOrh7nMTXwbP0HlY2KSAl1CXopwoZwhaoECWdN3gvqSQPp18HJPZajZ6oM4qDEycnA+bVCe/3TwpqrSP2KSlTon1KOLQXWmd9CiCkHjGirYzzQ9hD4xefH0S2jT4CziyoqJvoQ785EYkUfK9X8AGLNviIFNOQJrT2jw+Rv11ZjX70AEy+VtmxXo5gnSEXi/h+C52VFIG+PvTqgNmE4MWLsEYLSVxzTWaopcBxWqZhxYs1EDwqNzSPJKDkxJrhLziQGU1QFDibXAbiesCC5n9TT2QHr63qugieThijmPFCRPy7i2uLifKQBnXAss0DDyWwWFqiRqBZoBy8PymyKrekITqlRjSMgOkMswpeEjIjrzrq7TuUbBXGTsrnq13xeI8NM X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Vdl79t6JqLZ6hVzA6tLTUMIWWSOhZvwkn1EL4iDFmh/gQDhAbGasVrruucv9dFyKC++jPvNRy2CTY9/ILnnhWuN/srT6Wu6hfP7VtPXokXSCuIkFeaAV8egy0uUwulPMQxYMWF9fc3LR1yNovYK0F0YlZ4dpvwsADZzKy3e+lnXtYa5M+fBpEAioqG6Foc/U0Tdqcxvh68YTEsnVH5JjcGBlWL/ytlimQQt2kng0tAr+ZyzGr/DRI06F66xLaFOrrHxBgHrhgK70F7jfBj7aUlitXb4kzr//CJaAocl4zOTi4qMSjd6bPXzkcjsfWFZTaGP8jTqgkG554KJWp3U/WJXPd9fvPReIpafA+JwgCbUC5BQ14Oer0EpEwqbwlpjdlKp+d6d2VO6oqRrpq82rA6HmnJJkLI7Bvny4dKDLZsr0JuDE5XdY7urmsTuj/hm8fzkBDmNaGLAlevR0EG89Q3lX6vDcLtAxE9kjYr0yoPkgZWy8iQYWry8ekT3g9rLYBBTbSiaC7BvYdoTf3aMz8ApVns+Pxqo3/8uLjHYea3uut9mVJRngDQq//vuLDWiSQWpmtUI0TZWmKwlfzY0A67OX1cvtSXwWQsz4G28CnXGSz3F0s5XlKe3jdsEwESu0tDWl0NzY5KWCfusNC22WqFLoMqRdIzrQsimuWRBAK3BpHiK7yde6wfmu0Vz5CUF8tmr7NwhXWIHdbn1idP5YwbxAeLsSLbywEGrSZG/BlUC0ts7Dk4sNpBazAHCKOFmgl2i/LDxxvtA6AFN9HuHFhT9tOicweTsJPerIMuVytOLrs0RAgvBokx58cf6WW8a+j80Dp/bdWyi21vxHTdVjpKui7eydyK6kAH1u1+w3T2BCMfFVB+O59rKrRzbuUXvK/QB0xzKbMyozVnbfItx470AwtUhDySTby5e8JmvZzdO57/2IMtLr7Lfy9D0XafNgN4TqrR51a4M+HFJEgz2PbyIow/Iar4hrz00G0pjyuRUKaXaVA7JXhfeZHFNnuRz54TK+6Ny2HzQBz+D2sy+Uq5yonubRRhY0U3Ip1+mJzbS+FhNA+gpJgacD+L7TCLvWvRP8AWkk687hfCJbKDHqORXeCi3r3qNBleoROkWcVgVvFw5575hMOL03E4+DP6RYOX+6Ozrr4bpkt6kQWRizK30iWJ4uChftzXFd6tCgzqyXu/u42qJ6/HgmBd5BwXJr3C/aP8XFfmYekmGBDNp+KRf14X1mITBIBRKrL6az8Vmqz57xLW8C0lR5mTkLna+XdEVKpD8Qtr3tRXmRcr40/KClacerkim5ybiuRkjhSVcTO4mmXL/IL8HY+99S0thrs3eYbeCf8MI2AMwHmkNdkzdhq4/Rkigsmh/awyXORF1u1oNKVeSqvwwSc55QTdE3A9NQXsWf4C4QBDHkYecJb559zaLov6PIW4cVTVFKfkkF5Hgn75c/6QwZI6vYetcgkpO/A9dDatxa+L9wxtUt5mrVLU6WSRebDokvoRRy5xv5rnbk2r3itdp0raBSRQEhQWWqou4rSQrJ3g2hU8v8uO6wTS4Pd2rpUZikvzG1HP7AqAslkGNQRq5fzcQzbRs7SwC7NK+WQ1Df1V7eLg1zLvQa6qO/g/DM3+GfHUXTMC8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22ef2c5c-46c9-4d02-b96a-08dbc325a616 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:47.2194 (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: /j4QEHw0gQ05qx0TfogPStXOEvSVhEqhgH5jDvFspgvnNnk2XDecbIobRC5Xk1zzKE2tbX899JVT+b+C/gIObwjDo8NT1AlRJFedq4oNQGE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 --- block/parallels.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index d026ce9e2f..d5b333d5a4 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1426,18 +1426,27 @@ fail: return ret; } +static int 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) { BDRVParallelsState *s = bs->opaque; 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); @@ -1477,6 +1486,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 Mon Oct 2 08:57: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: 1841987 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=ejHed0xc; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZdQ1zvLz20Zd for ; Mon, 2 Oct 2023 19:59:22 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEkp-0001WA-Ox; Mon, 02 Oct 2023 04:58:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkh-0001RO-1E; Mon, 02 Oct 2023 04:58:07 -0400 Received: from mail-db8eur05on2071c.outbound.protection.outlook.com ([2a01:111:f400:7e1a::71c] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkf-0003RK-6U; Mon, 02 Oct 2023 04:58:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fnugBZwUhGLr0vT7WUAtqcwc4Ff2cy5VVwb2swxJyvUdsRAzX+lvEOIzUS2MtrZIX+715tb8kilzvs52c8rq/HYgykHz9mMaAaw7HdRAb7l6ORifdMv4zUBFk9utgFOXWk+gDZtbJ3bg5KQepVe+0qR3oXN5S+AeTQ86pqDBEuoc84xG8qrr6F34+OKgfXhjir4JMkX40u5zcvidx9iRt1Vx5itSwv6/pl3MHWIWPAw9PC2pVFBUl6ijb6RUNYZKVq43MrYZ6Q63zI29zH9YdjZUHLIhuK+VpUbP4k84C/rjIrSsobQGtj0wuUL3zrhWz/lhpFMgHF3XpgK0BcTbfA== 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=Bqwo7I0f1/bCP6x1bGw190cp0O8WAMRX3PUoVwUSAxc=; b=X2yWiaVBZzVvkNJj4DgWqtLZ3wVr4ePya5weUF1PvzME0ojCE/lIRQSEX+1ifPXYz3jN1sPRVpiUUSvXLtpsYKu3W8AmCNWgkiNTwW3JrF3RaAc1kd7cJvjordWXS5CUSPq+KrMLyAgVK+0gEo9QK9iLyEpTFpWdSRQWHfgrmvkYP8qYjIjQU4SCmcMi6Arh8SGdgmcFmogCvA4XFSp8yuJvzsTVXyG+uQIHIrAYiaM0wh4kEWI940EacatEzA9be7+Vm/47rGWMEM+f7mkMJ59QIKP2rWdlrAp+6RR0JNDTwR1e/CGDRqaA1DlLrpFmIxg4kz+qAV7jdoaWa08Q7w== 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=Bqwo7I0f1/bCP6x1bGw190cp0O8WAMRX3PUoVwUSAxc=; b=ejHed0xck+jKNQ6eG3KBt5pBCgQOvr4sOlFrDjwRKTxapRQOtU1ZPiHtbkvKggh9jYI7aY4D7A1YXylgAZIGGrxpbJg7a8xY97BHYzUXggM7ZU3BuX5jGvtKFYQPqDyMKMj1XShtWocERXeOfdTGtxJcU0bWeiSD795h77zokA3fUqVvO8tGnLpTmNmlXjVEfPJ3NG3wcuZCfOOCFS2eBXTTEr/baV+43KrL8MYznPynK49Xs3UXRq0FDeKKrBDnj7Y2AK9fiSUhN38rzcBIQ2TROKw4hWaNLVd46YjhkiR8WDD5E3MHhfZwskCR3q9xa78bpcAkEoRBw8OqgJXyVw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:49 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57: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 02/19] parallels: Add mark_unused() helper Date: Mon, 2 Oct 2023 10:57:21 +0200 Message-Id: <20231002085738.369684-3-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: 98934c23-8e45-4f75-c3f2-08dbc325a6a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s7a2BSMlXF3UtaXhogsGX4lQ0u8XXi33efdzBGUVGcb9PUV4kdqo5ZM6AQfEd9y9R+lCpBzdh3x1t8/D8REML9JT+v7ye2QajGL8kqzbznMKP5C7QQ02zOzl9vMiWJI04cXXKfSVlw2LeIuAKhUFpaEGxyQPndTz5p6UKHQP60qKSWjcwJO5HI8YaRWcHBNCq4aXE6CpREpitPdHlnVJ7tGLQbbShIYIB4+bU5jWcyrNAFcR45jS+TMTNFECD8T/l8rG0Z8hiLYZralLAQLvulHXxPDG1ie61Hu3JssDRWLHyGpiMm08AmtetslNLDF4z4xLx9Ffh5WpA8QraLjy6ckKN6pvaZNEIRLRIGvjIPaKcMUj6sJseQpI4xLVB6p7vgwsEvdshvhQcvV+VAzKbnWV2ctrqQm1v8q/kiE1FoX26itr9O8stXGYVg16/6CSu5RwsDHHmdZSyBRj7Fv2IGGsBSAfcnZcVuic8g4c6lywDZRFCHv7dx5BcLW2WuNnWFxrUXbU7mockCdSW9pz9PeFqJbbdc/2HiuIWmCEn8SbIwgEgDm8rzoy8WKjk42A6TtGBGKGM2DQAVnBxldq5xPLoMr0Ad3mnW/gYiWHXkEMGhL7L3jJ6bSBXzBH6E9+ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aEpkORutSSOh6NjtSmqyPLGUe0vRq1pjF/JpaCkl0Mk/vR8IHV5sRyXrLXyMkJtWNbaEzL5k9e4tMDDX6nxs9tOnktSm2PEFuo2wW3qK8quAqF7M+ep0B56leo0KXvd9d8XfLzuD2qNEycZiyFFOwqyWPG4ZLWn6C51p0SNWtrYCfr4EhQltwjWaEMNjxuOTozBFxLv8vEBwzRCavxz6ahSTQP6wz3+Xjon6kLiBdnKwQNI3qXNEVXuwOuz4T45L0RxDpt9wgMXT4V+nVSJyf+MoRsRnAIrwlkPHEkQ8QFUFYgze8Q/+149lGLbRVDWSSIC02eqhLpE8VfrPKZyv2DXWKkyT58y4B/MhqQnrZ7xaqxBYkB3/Hj5+D5w/yMGu9175DIvEOPm376kpC+yV6KjH8FVDHJS9f60WK9JYRR54Eiz3qnOcSV7O23n1cQqlUqb0FtpJqCYzWdBwL3FKh/LOEs/esUZY4MjXnC2Wdy9+XkP/duVA5F9X3R6NlEtQIQqWULN/yOLtwX+7ouhlwQiIEeyfUIlMshvDK1o5ZKSdClWaLFaIVWKgA8HuSSoy/TYJpBJFCQ9/8UsWREBADvj4Io0PbmVg7zCN8GwwJ5v7sZvHNouW1CkG2KHWPyX0N8fVcAnWWY+rIDzr2ILNeAQzUgZIawWj2EYz+pCZ5CQrAM9k6ldE17svdv/it8xyMM2xvz+XzqRnKYQjAlpmUu1wBCIUlkRX63Lj4Oq4IcgfX+1dBP0+P8mH2PtBYCNHliJksJ7mu9qA9VDSH5fl6r7CcZHurEqJ+6cuEUCyHW2slZUE1WuN4Lvzjx29l8BqskdKH7zj58TgmRp9KM7WzSeCIhECW9wQnhqBbqdNi/bZuQibO1lWYaHcppA11yzcNwZrb6Ytn1lrddGh6BX+QoBhw7o9W0YILJQ3MALFNWB6qivez+OaheXxWoaTv6DPNQ6q1yjZ6nMb8Mkyrc7W/WNozrolHJbDiuMf02WcZxasP0Mvwe8AUSk6ChHnIJGbP75WCKZmg1e59npXokwwitDLsK08HXtXGreMRE4W+xwjyDVU6VHqlrUzHH0CxDDCqgOraIG3sgKCxCxzXMeCWoceSDEnD2zDJeAS+0L6ptMNdGFbDglTOecP4rsyZemmaKCsuy1IbJbsMhQZsI43fgzaF1ExANp89PMR3ZJiSBqFVzf8utggXmqbwgLE1QNwqH6WYqeEG+9/Ey0+1QE08VTTd4+dhE/Y6j7Z2g7beys85VghGHjYGT1Vj4Z+9KWDejqvnaABXFPsvnCWLw3sS8gCNuf+O+LBWqrzeoZm4+e1kRUCBW3Su/Aa+7XK9/8rWLExZmIsYsw6wRU/SHfitLf7EBV8GXpnpIBiBHkpKe2gW+RieRq3WeZUt2hMHtjAh6gbGqCSlnRIVwdKhgxoxZzxr3OXrxCGB5yqUQcTHJtk5snpscU/gF0jRzbKiowAwEsKx/g9cVaIA2Qwv6yZX+/jhoNUUbhPsoEmb89vagam+ifuUCnTApMHilHxcNZiCWAO8Mcp5HgrPi85HUll0J/gjzj/tbqIQT0499tOywY3PMJLc59qJ5eFQF+eTBfr4HqAvWvIJm6b+v4k31G94hlNy/VZUS1H7zVKFq6dNAo= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98934c23-8e45-4f75-c3f2-08dbc325a6a5 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:48.2520 (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: ASywujF3oxVb+qfdpzVtQm28iAd1q2BqOYbCUZe39DXiFePu9cQ+BC+T58o1nL0W6r8bcaK6fNke9DqnU8jig/k4DwW5AHlYY4w07ZTOOP8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:7e1a::71c; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add a helper to set unused areas in used bitmap. Signed-off-by: Alexander Ivanov --- block/parallels.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index d5b333d5a4..b5e19ff921 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -195,6 +195,23 @@ static int mark_used(BlockDriverState *bs, unsigned long *bitmap, return 0; } +static int mark_unused(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); + unsigned long next_unused; + if (cluster_index + count > bitmap_size) { + return -E2BIG; + } + next_unused = find_next_zero_bit(bitmap, bitmap_size, cluster_index); + if (next_unused < cluster_index + count) { + return -EINVAL; + } + bitmap_clear(bitmap, cluster_index, count); + return 0; +} + /* * Collect used bitmap. The image can contain errors, we should fill the * bitmap anyway, as much as we can. This information will be used for From patchwork Mon Oct 2 08:57: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: 1841980 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=jlE25z0b; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZct3GMzz1ypx for ; Mon, 2 Oct 2023 19:58:54 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEkj-0001SU-M3; Mon, 02 Oct 2023 04:58:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkg-0001RH-Lo; Mon, 02 Oct 2023 04:58:06 -0400 Received: from mail-vi1eur02on2070d.outbound.protection.outlook.com ([2a01:111:f400:fe16::70d] helo=EUR02-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 1qnEke-0003Q6-Ld; Mon, 02 Oct 2023 04:58:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JHkRBEbCweH5KpDIyaljq2nyS4mx2vUfMfdLBNZDEMMx0Lk8ANdUmv/dxVy1K/dimwpW/3VkKPKXJCHnaNx7dToiTyLcWQE3WT0yyHXpqTQT3hxLUqEjUvXHaovuM0ieBlQZlqg8sJHKXDuzAyE+uRuAVJ3qfc2vYjL4+qOB+LJ9htUrwxMFc6nUWo/Knp/bFlkVB3FSsuPhipHs3F/hyLBz8ODliIQBwC5lrCNbfuZt61DqfsyTMd8tNDqmsI4yyOkoDd8kLn9Z1MLf5+oxSi//S2DgWQh4HLGf0amFo41otaQsryjjjKCqAN1q7EbA8LRkJjSU45tjkfHxCO9kmg== 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=v/YzbWkNcxjnPp0Qhix7dth/uiRO73xAHwUPv2TAIqs=; b=K9jhleO9TuTTvNG7RZcM8Xx52bXkzZeJacoXkUuXgbHbktaM/9i7tHZC3yPDnFkzJNZJbLcjEy+i2PAWHS9NCxUx9AY9V2zWUjgIrUotXS88QrzK1e0q5BOKVeYeSj3KWmZg5HRv6/GmvDWbV3/Mt8CBFuXomzFLCHHin+aKJLhlbi38XRpY5diWt7T9WN4hjImIu5pi9O3YyFKtPZQoxOBPqj0ec7GnZmv+6Re7lVppBvPzxT44ehIPKADwTDezcUbco+dkerZP97EjWW8R1+YflDbdDqnGDUpaKXt3BlPk2dzK8Aok7UZNWowwbXSrYHqnvLy5QCjCzoeXeKkYkQ== 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=v/YzbWkNcxjnPp0Qhix7dth/uiRO73xAHwUPv2TAIqs=; b=jlE25z0bwVn46nuIeZrB/MWlT3UgqI6n14TJVe72uxy6TAY5oChkKSZlaAntLkjc7MMdvEB1+ZjlvMgKN+NDD4oCW1J8gHYjW4fmzw93bY5hSNq+y7xybrckxtWIm0rCxTO5uccDOmfsqw91kFBrf5kMslvIqy1L754aq/1ZRxbnCEh0YKU32RqMTgKch69Di32VJ1Cvd96o9prKXs3KKZ9ReS4UOvDJJy5lpmkAr5crCJ0GGy/48rPGPEx0ZDQsvhNUUDSEETieIOJV8pYepZ+7/1QIgrVwsW0caYEiqlrN5J+TvACYEaMJQr1Yy35hv4huzy8oNxqekj76BXPVVQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:50 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57: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 03/19] parallels: Move host clusters allocation to a separate function Date: Mon, 2 Oct 2023 10:57:22 +0200 Message-Id: <20231002085738.369684-4-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: 18d40034-72f2-4023-1e4b-08dbc325a724 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 81rb99q7maFokd8z9W0bPj4qY7t3yOXxUsItDM+09vQOXmNHPWLoOS3kC5lK9PpcuHZZ8iBR5Tbvt4or5tovQEw2KcTtupKeHB9lxzfxsYRdaJVYc44x+BRJR1fnnn8NwUEd2Xti7E+Y0yuyRLBTSGB/wSORKIkjoLvUtt4QMYhq+ybYEOPkKuEvnMrvWU7FA4IzxAyYeq8787b42nw4FzCJgrct+J1AfXF31q5iIKxdR0jozyClQ2hF+0EseJwHaV3/OdtFHKjXiY0o8vRTxs4xO8bMPTEjtng0Dp9X+HhUSdK71MuTIoEOoqjCbpCTWo5kXHeFnp2pARBvPezO+LsfyPjqMDlrajtPmE5ERjUZvdiepORIdbsbeKtZdyAJf+nyzyMUvJglDi2Cv+TfZDPI5IHu0rnkkcknG7KbPRXOgQul4i2Bu6pFWp6mCxchUH1jYSZmmUOjXkpq2MLQQTMgOzVx3jnHHw/2UbhgJXl8Mlglp1YKdZ2xtTLRpORoU4dmG0DRo40ah5T6s8BWzgyYRAUjX3EKy3f83aYqjrybKmI1fDv+zqyVptVGIOd3JJ2fbErNUw8hWk9cUl3yYxH2mmuVJ1h0pdQ56WKJxzBG6zJtVjLWrmoD6QTWADZL X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0JUh3QvlWH6yf1aXgfpTg+kentD0AtEmZHJJSayAAyb6UBOBOgyRCxZGLFhSDlxhqlbezccecK9kG3Fp3pJDMIpaZT9RaVKfqxvj8Mn1XapcK1keGOTnjTfcgi1XWgXw2jeBHB+KSxHvW3wsBPHe+8nqQLR9RdeqSIPWfns1evBIAbJTNyJLbekE3G7AxPqZoVfCPvEJmmdHxCqqnk/CqEUny6fQLBmtr4r3M424VN3ccCCucDZD09PlYDB+h5BHMyR89XXU2HuRcqjTRqj405gqhF54Pm7kNyhP78fpk2ksS3i7QbIz1S+fv7GztuoaiwGAwAbcG3KoCzDFxc4HiMP+24BpfNWO635BKEHGdGxQe0YVGFxNJvmbUqzsFKsm0fU41JvyeZQyC/SEDKUNqnmzBM11A0GIdEDR1SO+Ei15VR3M/HJZKg8Q2uq0m761zyOgSrETe/dlJnnK2tPOUAcz5UzslKSsNFPkdYl/xQwGd+aP4Bsn9R77bV42Jg+Nvpwp3Bdw3yl/h/2nTE6BBJ22zcgsZhdTKJ+CkA18AS0shDsJfE02gaTS/h78GBoQI0qRrYv5g1eINj0voUPVJ+Hzbt3Dx3Yq1wnnZVB3AdAnxqnZfrrLox+xUTzc3sWc0qUJyD0yHlR9CZ86pZHn9oQE0rahloYB0S9sYDrDt0x5JxfbqBROJdnGuomHwIN259zr5/eQOfB+sxEuWCtcfPtKLaZbnJ30rwSJ3qVXx9NUUQEoi5l7g6uWzwKEjCvB7aTw4R26Ejwv07CkVh8HchLyFa+PJiwWpV3/itBxSFBOaooogVllJDbdqZr7C5ySXX+furyouTuLdDazg9I7silsaYPBbn7CwZbKXaywmpp9Eon35LT7wkhpWC1ZJNV1SouAr3vdxm6y4CqoMel1LwAWZNTIyRd7VNMgM4OiiEUjMDVMo704Y6ztiE4lJJsNAeZi3z5x8Zqn+NRPpwkvu9fQD1WlqKLO2QlHBj7uhyZ9Asa2eK9OXcCoSlNs686JwVXIrUXfyN4pUKuO3iSzB2qBM5uPkkkUnpQuB/Q2HdG9cvYKjP3jc83UAaQJD69UFsT3VK6uanz7vIpp9KvGf7rD7HW+ZLVf91hrLAC/dSzFpJ35bdJ+I3y83C5TIRb9aNln5CKrhYZT+N+5BZsS36mHUtAUec4A4YJXtTBEZz29RSdjG9WFxzE8pnrFU6k1eOhrw7s/QjfNduhIujqXLgy0loEY/2c3E1vfIyv5GzSzsmJYQwUw1o/zbZo0Nf0jOuLzCrakifpdjvU3/SOwiRF31EXAtSXFgA9lxYVOhqkKD8BnU1DW6b+/EVdFfgvmYPqGY/Nb/bwds3jV9JI9UUkZDRY08SNAg9A3SVvSHJDCm1Ie7NZAd9o25NXW/JRIR0Qeb3IY+JYSHjOrHxDHJTrUEaA3ODj/00ywg9nZMGL2P03fQcNl0lcQRq+CG2GwU1/2mhnlo9UbU+1ZyDp/leAJHtisjZfBcDogKZJ73k0F9FTZEAuUCy5E8r0WXOxHmqaMGHPVckS3etZvKwOV84GsvaQwHdLp6K4CRejhYC/XMKqUvuDK2juO+2V0TdAEtVb0QXvBLELHy1y3/wQBeoe3OgxqSihplr8f52fVIVE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18d40034-72f2-4023-1e4b-08dbc325a724 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:49.0444 (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: j9Bnqhz4QkuDSBoNIDPk5Gum0GTF93RsFWKzDlXjeo4+k/FDwZXCceaf8nKkZ9rjn1M5smkuJa7RBfTKc00SYKCRRayPmdwTdsKUERrs/Ec= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::70d; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org For parallels images extensions we need to allocate host clusters without any connection to BAT. Move host clusters allocation code to allocate_host_clusters(). Signed-off-by: Alexander Ivanov --- block/parallels.c | 124 ++++++++++++++++++++++++---------------------- block/parallels.h | 4 ++ 2 files changed, 69 insertions(+), 59 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index b5e19ff921..3c69afa04b 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -264,58 +264,29 @@ static void parallels_free_used_bitmap(BlockDriverState *bs) g_free(s->used_bmap); } -static int64_t coroutine_fn GRAPH_RDLOCK -allocate_clusters(BlockDriverState *bs, int64_t sector_num, - int nb_sectors, int *pnum) +int64_t parallels_allocate_host_clusters(BlockDriverState *bs, + int64_t *clusters) { - int ret = 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, bytes, prealloc_clusters; + 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 = 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 + 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, bytes, 0); } if (ret < 0) { return ret; @@ -325,15 +296,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; @@ -345,14 +316,58 @@ 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 = 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 @@ -369,32 +384,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) { + mark_unused(bs, s->used_bmap, s->used_bmap_size, + host_off, to_allocate); return ret; } } - ret = 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 6b199443cf..3e4f397502 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -90,7 +90,11 @@ typedef struct BDRVParallelsState { Error *migration_blocker; } BDRVParallelsState; +int64_t parallels_allocate_host_clusters(BlockDriverState *bs, + int64_t *clusters); + int parallels_read_format_extension(BlockDriverState *bs, int64_t ext_off, Error **errp); + #endif From patchwork Mon Oct 2 08:57: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: 1841996 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=qJO6WenH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZgN2L4Nz1yng for ; Mon, 2 Oct 2023 20:01:04 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEl5-0001n0-7Z; Mon, 02 Oct 2023 04:58:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkk-0001Us-8w; Mon, 02 Oct 2023 04:58:11 -0400 Received: from mail-vi1eur02on20713.outbound.protection.outlook.com ([2a01:111:f400:fe16::713] helo=EUR02-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 1qnEkh-0003Qj-QX; Mon, 02 Oct 2023 04:58:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a+b6Ev9KWJD/touac8kmS/GjSkakU0RaxCPf/ab7aEqftvsUFBqDJy1KaOW7plCvs1Lv14DDjvBaqvnRut/Lwcp8lZd4AdF1qMD9p6yAAZnHqTP7RW5LHuV7zvm5l8wib+UHUMhwYSV3kdmg6Nl4uGNlraUurqMDdXphcZSVHNaVEK1d/eW47jGBJgrDDU8x4g0Pgr2sKAGaQ88ckjqr1J55gx0VZf14CFeIHGSk+xVhTi/l/mQwwiKCTU050hIhmdIcuG4RLIGZtUUghnn4p82UK1H6h80WJcfLNIjI9pEehebBuPDFagMTkwWyvjfWzlPrqDoDYj+d47UmJpzFYw== 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=bSOC8T/RvkG1BGM2wRvFr+Qx1CXpkegjaxtGUI3juXY=; b=QG1tOXPeSoR6rPJacrFd0CCNOn1vtv2WLRpRdHA0HpqJWmAlfXp8iKD7r6Boiz6dJIHCP5sf/QylvXyBoiLfzucwJNPY2NzE0mhRqnK+2LceIGJg8h/ib3X7+vg28/omAbe7NuxCGsYp4iNszEFSYwHanaL1nMm48fkhSFZRDHmtTBYJ+068wGPSMGCQ1A0tvt8GKFg+FjX6pEXTdnpEiMZEaQA7bner1CLmVwH8SPH1scsj6YIGogb+0mxn8kL8R8i7jXm27lvWRoQuY9nSizTGV0A0SnhvN4BckIuIu3ywIq83oWHlMFgrWlIX7pjalJHS8a9lU+XejdMkW2FN9A== 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=bSOC8T/RvkG1BGM2wRvFr+Qx1CXpkegjaxtGUI3juXY=; b=qJO6WenHX1kwKoYYlflLCrUkwccW7gWtDgBFqkYTHMk1ao+AqLhyXB1nNcSlZsHMSJu3wkX/0bNp/G1aY5/pTBtTacntbWbgTJ82d266uEcbmFMdKnhZM1pRvU/Hhat6fVMPmA5/Xev8XP+BV5ChpcFYyRbsTm/MdchWRBF3oo7VCxeWgJLztWUrYSgp6S06Lk6KpDQf8JW9BX0sMGs2o+Civ8mOONzHO61Ubs0k4dpcAxEBZd3GTwNVouIvQQ3pU1OAPK7KzPgPYB7QANoPxSrcHMqAWZcJjb1aa9tYMCedix5QWkdOxSUAJbqkev4fQx87ABC3/I9LstilkXvpDA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:51 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57: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 04/19] parallels: Set data_end value in parallels_check_leak() Date: Mon, 2 Oct 2023 10:57:23 +0200 Message-Id: <20231002085738.369684-5-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: ea03a389-f7fa-4006-8b1f-08dbc325a7b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W02MVo5XPxizjSW29251DxHy3IA6DfjE3NQsD/PDobTr0meCRJnQ8STQ8M3AJncuSBcUbaBZfJBrlKnZelO9MDbMBUiAf0oaA2DEGdmTFaXH4JtFJx9As5UokYvNiXyCVHoytTKE4P0GQWfrzHgy1on25GHdj8KSGNh2sleSvfP/yIfIzDed2WpCW2Wa7A/ZvusKiw4W6g7RumGLHSZTNutM6FGbixMTh/sQwcwdxAWKNXxAdWmecPQnaWc66hAC2buZFgiG08ceO3J7J/U7a8cOFILOd514zl//hA2V2hWhxP79dnOWbWtOLRouiLIRCx5yGpVYkfSXCbDXgmHLZVULD6xh0Ux6DFU7LrUhMYUBsSRQGLaajKA30pbOy32Y+88hDOxZUGkv92CbEC+8L6x0xGTn8970bYbqlB24VWJG6VRqrkwkmtAW7dV9zzBLwhjoeM2ktqCLsGliCyHTIJFuAQJcrhZPTxt6HKl3Z9K334497UsL070qPVpawv3hGLnhN4QkKgLNAn0Q7NSeoN17Clh1zTFMR+kkPtABosFlJV8sXFuOGXpPKWZUaIkv9CXNYfwp+adnbSKVAPShF6svpeqMBQ1UGfs6oGMXN8lxCqM/TqOLF7mTmbLF51BC X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(4744005)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZBsvHIg8qFtG1AT7HeyXE79REz6ui89y2b4arvvlsR9iCjIz9X4IIig2lrpMd0hyPjICOKCk39yzuA0qs7P8nY4+xfVX/g5CWo5H8FuwBqGVNB74zMxf1R4SS4GS51xsxqG/hvrRmAvWG+mI+Sa+OUrrEvoJvR3kKkn9efrZhdgvf+xeiZgj5EEKtSrE84r1v886Qg45MJHiMcacCqppBfwBuWe9ovUccrESQnWCvKH+Jq0BpL3kUiiIyGq6deIaw5rMobt9D095+939GpDGcgCz7ypJiFAN0VpxuEjQm0kmQ/ZkSfHprCajhuZS/sDCIDILCOOpqVMNb6TFRpnoafr7Sk7Rv3K0KpJzv3TYnqsiMletYkevJYlyhhsguVFr7lcICNapQwFgJp2ifM2wdmTgPN2OEXozqdtKY7tFczDLout9JJCcFo1gbtIH7grU2I/jCZ8v4UqjD54Ui6ycZfs0U0OUqu6+ASPSvQC/40+ILJ8+f08KM7dhCluFWuMre0n7NpZuJM1McD/v2RYYirDgNI+6FfeTNYxLTuTDpc6Nxx+5+3HCmnPqQCS3SFDrAvnOq8yf2wNBWNYTRfQg858MzT3tGuL42t8HUBVFVosS5rmhdEc9DtHIEeLywQwZhwfuo2WVj6ilqqFgj4bdZkZ20kTZEVeo31DtG0fvyJTJb6Dxm4tfg6P6is4GtNySHW/tG3sq6H1urvA8Bob4ruQKHCLh9EJBIIvfISO22X0tMwueA9aUj3f1W3qQ5X7T1KMtEN0kyYyuGt3Fc7E69ivvofnCim4kLvHwHLviANADCetjcODcmr8oNOM4uz8kWmBDkhgaJ6plcyPJUkIhK+pZCgmVFw0GQ92L7Xh3vvw9AKddrRirfGMNySN4F6IwB+iuxB9rlphHQmNNaen0WuCvVoog8nOLTCBEbKZKFyHnWxbdO6HQnkudNC3x8BLuxqSdk/wCKuRBgBKkk6GxGsPFyVBJifpFTi+2Ewsdwm5SGjKdl/mr1VL8GcAxtIYb/QGR41BTvgkKNUK6nMU5UYZn+ASJ+dt9trCAGWfnHAZhyHUF+1Ewc0rXJGxgFcfN6Y15AT61L/M/j0VftjcX+lrG/Qa1xhS67qCM5xmZreq5gxhM2CGJGrEw/yibdjwUuyej94hzufDHrZvFHQIyAcy9lseFgZINh0aq+fQP/THrSVSX0p3k73SnKYWANU3xGMf6z5v50YEU63czzSfsgVoc/rSx3+1qgJPNE75WBfWiIfSj2lziFbHxLevXt9HS9/JaarSpTplno0BlEM7BiFTKe7i/HI1ZyLifu4D7w0L6ld/3HrNfJZeZeVUKB8BBaxVxJhCLbSyWsv6ULUJnNI8t4319UPrBGi2v8hjf9MSSQpV75rDbm8LlMQRAUx8w2YwgW4SwbVeGgjrP6UZC97gWSHi9PpMI4YXKZ7qDFodf1bs6AP8rJmkCVRDl+aBjhm4SonCSGvF1Qk0U7pGiBREpsqx4y3ym8796EDyS5GUC+HCrkVtwfB8/l3YsZSkLNpArjdZpKnvclOTmdfDm5PNxmEVT/WppvQVz6fpCv6C83EJVpqVD/5B6vh4M6hm58injwRiLL4mW9kSJymVhz4CT2ZsqaHga/ZBDvnsFhXQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea03a389-f7fa-4006-8b1f-08dbc325a7b5 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:49.9941 (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: OlKpywoE/IGbBjCJ6ra52whMTcr2+9nh9WrcCpf/r8hiC6abK78t4DbTJAnbmjYQZNbGg214mDekCftJbWQTbye2AooUTxpGGr7qo8gwGgA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In parallels_check_leak() we change file size but don't correct data_end field of BDRVParallelsState structure. Fix it. Signed-off-by: Alexander Ivanov --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallels.c index 3c69afa04b..e8d6d30fa5 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -803,6 +803,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 Mon Oct 2 08:57: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: 1841992 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=YVe2Uk3u; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZdx1CG8z1ypx for ; Mon, 2 Oct 2023 19:59:49 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEkt-0001bY-Pp; Mon, 02 Oct 2023 04:58:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkj-0001SW-Dp; Mon, 02 Oct 2023 04:58:09 -0400 Received: from mail-vi1eur02on2070d.outbound.protection.outlook.com ([2a01:111:f400:fe16::70d] helo=EUR02-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 1qnEkh-0003Q6-Dr; Mon, 02 Oct 2023 04:58:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eV6RyW1X2QdlkrPAFNoHod9YjdJWXalSZBCOtK3zzcvKH61nNAY0ZtGsP+exTIqeuAjVIEcYu40d0L6lSXGDo59iUR+w4U/WyofnN7fbBQpx+YoLI9Gt1lPM8Uvnj+L2eDqbU/nsM1+jIIKsJENkAEnUfGQGKEavkHdFRSdsPEb1ECPIDCWe31eRBGxX5+zc3BPUmZ8DS9ZnRJ7uqbZIRcI6UcNkVzcVCWyZz5lY4GtrZCrXeXg+G5C3HdxLAAL71QyQkatCoYi8tR5Om/hJEV7+pNeSaTawDe5UmO9iCTxEwpOm/uARL+qu+Exo83z53L/jnXfuFkwQwVK22S6csQ== 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=rP2WfR5LznZQflbxF8b4NflbJ+cE2L2sIVhfBFf0B8s=; b=R+KByZPYvtcAE8nM8WmdJKSkRRZ/qPz3qDA/1k5UN5rHhdASsRucMVJu5g54b7f4UOeQQy1xa02a+850f2JIIILcyGnZ22N4IJxfmRKU4QUh2AOREb/8LhqW6ArurbDdFE7W94DvicZH+pmKQJRZQs/VPP7VMFbXDuqGBrK4+PjLQMGjnEwi7wTh3EgsRCGk35TFvmQ8L0YWGmPRJSVaTDgPl1f9Lvhp6e21Fxvlf8oC99Tpx6ex9OF47LO4coOeePeKSETmgmf873pOkBBeGUXe3JKWbcInbpU5wMHJ3cWJkTEgJ0ScQNXtks8dTRKzfvrMF7PqwttnAQvSh2wF0Q== 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=rP2WfR5LznZQflbxF8b4NflbJ+cE2L2sIVhfBFf0B8s=; b=YVe2Uk3ujvk4RPIy5OM1gPImNumVVU7Ykk5BqMhb2IMoYeXCOLI0/QjKe36fPd4SS/PspwODThwkIq7Wc8Aj1eMaqbIt1E+S0SmHM9/K77YjNZ/667tuji3y5yA7j3kfwxuK5oNYnG3iGDPEpnIsoZWiATHZHIYaW0XAk8ItKyohDuKDzR7rnBmK/mhxVx0RTwtBbI8bH/VgjzjDh0shvnNAZTunb3fpTNzcjZq7GWKNlOnm0XoQ9Ra8hMBgsKDLLewgGemBS7DCL7x0uzYAeN61imPCnzn+B5SK1BCwOYchWotR0/2ZoVmSVNFQSKNBnUeJEQehspre6n/kitT4OA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:52 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57: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 05/19] parallels: Recreate used bitmap in parallels_check_leak() Date: Mon, 2 Oct 2023 10:57:24 +0200 Message-Id: <20231002085738.369684-6-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: 899d2dab-f845-4602-be88-08dbc325a82c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ErbZ/nx8ifZwPP/VRtj/QE3J3/EvHrVZcGlmM0h4e9L5Y+9cusAMwV/p9oWeFW+6DPg/0G3e/dN28Nt5KPnhlbgNb3XsgpNWL7ScSejReQoNicpsQmG/0k5Ui+i+Mwc08jWh6iJbVt57gI/jY3SguM/+pN8LN9twSLFgSHCrI902lLDy3YNh419Gt/GJAgro/2gVPN5aR4m7icmC5ZjCg7giwDR2aVjKW2q6hsoVS0Sg7bdlLR9x+7xhupLJp7Eao8jxMcQ3V/TUVJzVsI4ISVHvUbcEtTq5AJg3aSD1MYvU3fTSjNRqT2IJOn5r3NCE0HcFce0HiWFstzEpJ1btiRJpCgz8mooEcnRMycKJVGDZWYKR1xAZNqJ8chrdH8Gk2Jkv6UrW+bKyS4Gy/qkE7YLlR9XLOLRl7IY/6A2EIqirKsx1NMZEd2IJBvtTK7AFHikFjLjoaHMzbyg5HgF+UFtxz16rBsYOYWoWKf5w3yK2auDDv6SGxDJKHR/Ab++fXYkN1vQ021q3YUvPA+k4WGhbptoYcDc8LRRmiUnacpI3qBExj3g02AWTKSD+WAUTSlIsseiznYlKJL3cyfxbFu0o5KTPk1wY2jDhhE9VhQXdtJlSv0NAWXaGcqqvogAv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(4744005)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5er8JfwUMEXeNQHVNXMaJMu3/Qw6fsBNJGw93Ote31NOrSzai8CgUoTM6+yYMBRLPUJZ9DsWCM/npm57gv1H46uHbcUhkiCmgDi3YM7MXX+5bdCPEizfSEyh4CUaRoeu8T16gfivJETIzOzCNYbMbX52F6c64ogi7Vks4/hPN+QL0g9QPtUz3WV4bOTOtP3SuBlguc8fKbBPPxnqGhtsW6NgnpxfJq1POhRSIy1tYyiQNxhoEjXC8bWrf6oPSAwBwUv5o9DyKsSG9ohMooMoefuv6QTSgJSGCr6ETeEgBbJfoUmImQVSjoPF9GwdfMIylzllMICEZAfXyE5qFvnts/dLp/OEfDihT3yt/AGrwAyaDoFVSxqGJt06ObdJzW+LYOATNXc5XWlqBXGLznDl7HO1cRjwGs98nF6i4CCzAkvh+tjAqKpgx+uafjIibvHhaQcnu5iYtaST0hRJyJomfXti9B9F9B0EbTPj3qkkiYFwjaSJjcYCieUapgB+fk0E8eRoLFliW73VOurfZqEAE3llUt/YIPVKc0HCfxv7jzSj6Pn5iGhbd15ucm3o8NKFUWzK1YqEbDWvv7/Bb43+nM2b21PoeZ3My4f/h//jSQ/HPA1E1F4bPD0uZF7wguY3vOGPMLrCNDdbVMcbGkF0lueJoJElvIKBvPuK7Wmapy3mWZt7Ur+5gSht28TnEUBm8oq1e0LkOGNrval6RQFvXhT1ZMScWdRzMTDGWWVhOol34G8T8iQ9B9q9OajgoTaF39pGbAGcbA+0GtrGiXPmJjp7deyR8/g6TxaRfq4MLx3Whd6pOMwOCkUYOnJ0zvpI3KO7r8N+QBTiX+7GShMhxlc6bPc4f47SZVAazFqqpPQ3dmtSUJr1nD+wWcM4OTWB/ha7TvgLAkmX6cMJzw+2gIiAYd7nj8PS3MitIJkyiZ50o2sA9go70nDkHyj2uvyVdcQtUssr8n3sHC82R2b0Kim9w/PVrlrPiAzpIyVW4ntXLUMsiBh+gxjmOeutJ4QX4YGA+tclo2nxyR7kLb4TrGgcNGzOn+Dg0lUk2Ac6vX+lFvSAIaIWj7jTQVm1EndvEUW34dBxoGq5+iy0Ns7X0JWbanNJ+e/5Xm+1sLAuTBlhYniMeif4jBJezNxtBRjb6O3Mb0ZewiyUYy34h6PfZlXwMxpSbHN2sW6bLtR51HKhEkysO5BK2dBWDmEsGMZHkecsUvY7pt4ncbkrP8j71DPVGlTBWPDrg5yoryKAx+MDmIFUrn/qc+FD5PpxtOJCSe2df8fziROmAIdwCpBF2XHIXxlXH6bciiT8asAhZ1Al+verYOoNB5qp933k+DNoDwcGBIHMnqpqb3XPndsOpyAiX8gYd/LHN+g3UfNLYjXrBQ4ifMC+apqpKBYa11VDVUxA+BXgNnXb1mLimOCyXekSGD8sy1zzqvhS551In4B/h6YAwHQm1hFlHF6mOIb5oHZ4L0mtN3lcE95Ywg0Tzq8Ls5qUSZ+HuXNYj8B9BUbgT5jTYtTCBqptEEiv87F6TokAhgFgTJ1ad9vCbHhCMYi1QDu71au8bARJl7DrcMU4i/ck9WA0RbE8TdW5/7AGX4PcuKTgmlo1gcVKUcWyn1TCNOCQ9pGgJ0UfdU+AA2k= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 899d2dab-f845-4602-be88-08dbc325a82c X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:50.8078 (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: /ZTWo0ylS6c9qMUv4h6gEKVQp2xK+qkR/gy6ZNNS2dJ1KK37le6f/tMXP9h4Z3440pe8owvRopSkKjrT6CPzT3eIyJKJlXJZ6W15usnBhGs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::70d; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In parallels_check_leak() file can be truncated. In this case the used bitmap would not comply to the file. Recreate the bitmap after file truncation. Signed-off-by: Alexander Ivanov --- block/parallels.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index e8d6d30fa5..1a4f8d1eb2 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -804,6 +804,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 Mon Oct 2 08:57: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: 1841984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=jE3wWEHT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZd50nc0z20Zd for ; Mon, 2 Oct 2023 19:59:05 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEkz-0001kJ-Em; Mon, 02 Oct 2023 04:58:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkj-0001SV-Bw; Mon, 02 Oct 2023 04:58:09 -0400 Received: from mail-db8eur05on2071c.outbound.protection.outlook.com ([2a01:111:f400:7e1a::71c] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkh-0003RK-LL; Mon, 02 Oct 2023 04:58:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SlAoYetD5NS8ZYQ5rFXcXxOQ2z84h3HtTef/K7/ZR91WbVmKG3lv4KaLQ8y0h1MzX8F/hogzJwDSz5qHJy9e23VYtLl1kcU5xWd4iNd9HFk8JfMx7I2bI5xq5Pn8EfiFWKAyAgpUM/dDAoF7DK2QXI2bedSudgZz4ppPe46UVE5kJTwiAnCAfh9x6QoB3WF4tCUPolzocls7uz3jl7wqeXsVEG0rxrMaXu8snyc9vrsuycS8TbX5DWn41JFjrTyRk1shnJ5mZ4YQVrB5WI7kizta5BOehtLm7XBxaEz2zmtflcmBrXHNbRq7P5MRLZoPwIlqLUfhcBsMfSui/DUwUg== 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=eCqR52SWiqwGpqA01eoe8qm0htMF5yvZG+o1fGTYxNQ=; b=NBn5kvlQTqcqiA3s+BG2SHfLNjjYFXxL7BY0+jsDVZAhhRJ3gYnI3Vc448u12XWuPcQzx9PHh9VrsfMZu9QtRqZAhRPqWaSdYGRkgyUljiXhtogBrVzj1tFWcoz+Bgct7ICJ4B2fw89buPT6NglrTrpavWwRv79RykHskv3WNg7+p0QJI8FUkbVMm59mmlPVQKk58BqZAi5fLutHnYk9T5eYEifwnmez9a/gtcMflzrf6D4HDxDR6Q30c4GLH62Tka/+OHiKrj9VpoMEerktKaEBaTicCUzD1LKZnTyfCnG2aCVpQW8Sdyhmk/J7RiGf0yV22/8L9Gx6ktbVlt9pWg== 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=eCqR52SWiqwGpqA01eoe8qm0htMF5yvZG+o1fGTYxNQ=; b=jE3wWEHT8WzECSXGYSk3p3uW8qhXcyVVPmnMYMouHVTXWrlsx2WsvulMc+1cMNzdMwfO76CgfZ4qyyEjJXAWhaZ7Bz1kLGZkFYuKCTC0Hh7r3TqCs+iI/9+IdHtF8pAuOn4WKxuPzheNI8LtPK99lEUFZcODGtV85pFOUfbMj4tTRGfJj4J+MUiCVtEH3vY9vjdir1NrT0X/FhM9sX0iTYRxmDfSXjfxa0V7jajUwImfq3kYdv0qKy690BnNPeCKW03XcJCR+EYznpoh+eBSWlrGz+1VRsMnSnMItYiPW20cZVw3vTJMTeGRgonAYlKDoo6YR+KJKE0y0CexegyzzQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:54 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57:54 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 06/19] parallels: Add a note about used bitmap in parallels_check_duplicate() Date: Mon, 2 Oct 2023 10:57:25 +0200 Message-Id: <20231002085738.369684-7-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: f5b60ae4-4871-4a0b-60be-08dbc325a916 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M8wXoSnWp0Pkt9KIiyVBpgPoeZgKdNI/23tpg+gHH0/VHx3lc7cIG07R/2JQ265N00UK01puo+9xyma7KVvnzun/NKY1jIRC8j0QBqdheN3Fi1q6A6ZQ7jtBSesGNM8cSPy/VatfXHZ/Zf7BSun+2WT3hw636WYZ0dJ1Df6Xk5p3y5A0S6BkSGxdctPtl9Jdc8qsYMqYqh/mOO0iy8JpOuGKTvZpqBGBTPxI5h/zmQPC1JpburHrougXQInETyMxkrZkaYvKzXJbhAnu2FrRtGeYJjONfreLFM7vRYsFqE1Tzkz/edtzgv7ScSghoxhmSoYRdesoBfsmiPe1LmvwWBggB0PdpO4ntWUOaX5PuiD9kKteRm29rDlY0yVkw8/IGnCv0kpA4bzXvMWwNYWvrzxxS87PS/JmScb8veXb1yIMKJI+rO+n+jIdp69Iznh3h/a7zdSNhkB+r9GfWcOTh59CaOV0QhrZyxCpx+LbKgrZ3paviKluSI0um3WtjUIkWCbxP/MKnUSv1pOQH0p4F+vUyOmNu3l0rZdqrO8rYgSpSs0ONG7jxyi+BQnvG+vCghMwWHRVuRgkiPOXvrkQ4J8sWc5VG6X4Ucji/fZX2sqsUVyBeam+jWBQvci2AU7Y X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: n5+U680CNLw+CCGKc3bgzK5Q9/9ULRY/4FYBTKRUJGvCp08wqyuVPGf0L+unpFK9VxgR8ngnbCp7m8yaywDsgxu09Bc5uTxILVCRQpW1PaulS8Z5ESlVCymT2Cle+H6kHG8XUadp2eNxubgN58DZnvWSD2mLi/7D6tzascH9ByJ28iC2mgYIfAWicuoAF9PhHhQ/R+H39CQUT6GkpDpi8DDMg9qBkNp/HAy8TDZN1HCbaq4P1fI13FBUGxxGeaNtPZ9Z+k+s8DDVKjqYuLmVIcwZ5AzKu16sPwS721yEyJf9JrMsi4Yw4jUgUsOQsGAStc81ZrApglbNa1YXQzrjVSrIr6gIlSouBPtWPXFsjeNFr0HxeWw0tNKZzmjz8e5mFX4Xh+DwAuXoiXoSRtCailAT78E/8QomzMsNH38TG6AcZjNjxzjRJexLbdKoFnQMip9Cy9B860nQ0P7ZSeUXF4VuVirpZwl5Df8DQyVjtwLCuE7cP0q+1Tc3CEERD/1c6pZchto3ZMkmcgl0UPrYQL9VVY6rjpByOpPIc9+5RRFpyWskJXUOed+Jo8nO+D5Jb6GWZkXsRSaTceVSH1dWPWCoSzOQ3M+ayDNHMKU6Fe6j3Z24GJgF7ZCnPTIre/9w5MI80jwo3wHVn+WrOsnU4qqQlyzcamTDKoYcaRQ7TwxWefBhfGxtuQFyMCbXoBg3iwHnNu21QzpVU76nytgds+bTUDV5EP9tNMq3DLXG9lcSJ+UEZvYSY/yZ1tf6yT+IphTzJdKV6RulKRmRf/+L/oUmdgnN2R8B2xSsRu5AEbcQ+8ifVj/O5+1HxMm1MHBjO3bgxzNxtlkdfajz9oDZCZ+USPlXWTpd//WWm4V0jlDLazta1cXXEPI04w5wOEQMqof7CULHQ/FCo1ArLrrSjpcLkIO28cQj3nyf+emeidknfvg+bomDzOG2XufNA3CE/9L2Ndz+1Y7uVM/U00pIAGf1owbum908uNCUL+xUD0I7ktkE1GQ/0RYzJDC3zLWLU+Mix8WY4FAJzP5TpUgUPYzBX7E3rgFJjZIvsfIFA3/P+cGfWKI7pAJ+nbNqbT0bx3BwSTyn7nxcmuKvKAKmS5rg5dZ2axChk9Viaxkg89WAdZ3vYDqd9zEBvezwZQn8oYNdS2QuIkOSMm4zJX7lWQGhYYA8Ovm7x/ZKCsrJUQu+EY2SPliMjRnRRBnMN3X+T6AgMnMuz+CCstpQnwLTARoUPF7Ivahboq2HMAgbWsTFc37B7FwG+zNtLnWHWWchz7RPebrMqAdUtaQfCmnBjhMJaBygoJQ0ftsOfbTNpfFLsWKLArzgURRN6r7dQZiAKOENlGs7qp0ckSwWgo6Hsb0+LLhhuLctettcFCVf9kJk2yvIzqhJtc5Zwk1sDyon86DmAGtNH5BvBcpzPK0Po8CZGinF5A621V4FugBbPn3QyOPrNkD3zm1bL/k2+DJ+/R6yaWa74EYaLkXrKTFmKVP3fR134JHYlx752Qotttu5DwTLN0w2bPqpSvZkqgkRDa2X8kf2gy31OAcKNRggvwEkPiuZN8IkuaDS7E0Vy897aw31DnZrpdkcXmBr8cI212Hbjs7hQRklWkycqai7Nxn+V58AydH4oPWdH238PPc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f5b60ae4-4871-4a0b-60be-08dbc325a916 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:52.2951 (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: bsjeoYMPYa882M69uGzpiIHYTzWL5aajXJEbKyb9p7/AsNb+BXDPkqNAnIDcUCLDdJH3H36/Ti5HEsWWfm0WrkelzV0/xxUiYINPutDb8iE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:7e1a::71c; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org In parallels_check_duplicate() We use a bitmap for duplication detection. This bitmap is not related to used_bmap field in BDRVParallelsState. Add a comment about it to avoid confusion. Signed-off-by: Alexander Ivanov --- block/parallels.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/parallels.c b/block/parallels.c index 1a4f8d1eb2..b735ba8390 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -834,7 +834,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 Mon Oct 2 08:57: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: 1842002 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=gJGs2nes; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZhW2qVlz1yng for ; Mon, 2 Oct 2023 20:02:03 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEl6-0001pD-6X; Mon, 02 Oct 2023 04:58:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkl-0001Uy-Lw; Mon, 02 Oct 2023 04:58:12 -0400 Received: from mail-vi1eur02on2070d.outbound.protection.outlook.com ([2a01:111:f400:fe16::70d] helo=EUR02-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 1qnEkk-0003Q6-6M; Mon, 02 Oct 2023 04:58:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l/B32BHwkp8G/6N4HvIjeDl/8RFt1YHuyZZA451f4WO6RdF9HXLzdAIanNu0mmyBU4pQzRmsz4g9a5e8ST/ljnCktinna11OevTrK4br9HiIV9q/qIXOPIomOjqDt75jdoo2RQi5uxoEKSoabfbxiD5+4qmjnfzzuiB30DfpPEBYwHmqLmOHCZ/krcc6pIEj0RkPAi9ejRUol9bnYSJpBS+dRziEtK0qKaNUf2vJUmp17Moll9/NzIJzyBhFPExxIfnKbR1nimGht9oOeSfGnQCeYh30woo5fSP+nrzBUfijwgMCXsWkqK/hH752VHvKis+f0VyjgC4iy2xghE9drQ== 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=msTmpVNhqjvEFefXPwsB7dm4quOpNOlDM6fU8dd+8OI=; b=CVO/8nvImnYYhTxPJalGGpy5lYHV1kMaiFrF+ttr30qtWfvh/oCiBaUgNuYTRwRE7LKJIv6IKxHESIjd87GeeQQXH8q5Rj3jHrpP+gQJM2n3mCPKL3eE9p/lYvfvMfv/tLsTtBANx0wuL2FkJ1G5hbie584ydmtLrtN8yzJzzuSl/np5Fsl0A9VQ6aLMHM0qrIwuDcGQTl3NKg7cpj5Ixe1klumPfllTL9ECrl/XRWBJ8f5sbbYn7geZ7z6mlR53qFpduVVVIoYtUt81WMEwKW3l3lescSVNHE2bzXUH/JeCSDAecDLJYxj+OZFj/xvcB5cu9do4+dCaFO/lEcPz4A== 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=msTmpVNhqjvEFefXPwsB7dm4quOpNOlDM6fU8dd+8OI=; b=gJGs2nesg4Z2n85MfHG72/6gZn/QwvG5fp5snEN/r9fESI0fAGrOh8VaXC8nd7wkkt7GEu7fZJ5vqDWlGV4sPmyre6Dqz30kpoCwcpjJKWT2wRuU9QQ8KkUtRjMpz70aImg1aKl3muDSjG7/qif97/3fxvd2D2/sz+Kp4ocjCX3vQc5/NyiGEzy3D9KkZTgrhjEPWYTFwL9sydYW/mkMjoj6WftfSb8Q7vI/YWy2yJ/I65HV5urwZW2GiHC9Rtkx94/+j5t39bpvrsCzJEE69pOZ9alSC6YzLLCMeHv9QMnghRyMhMLBi4Qlxa29oQv4i8btE/SxbUJht/q5B0d8NA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:55 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57:55 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 07/19] parallels: Create used bitmap even if checks needed Date: Mon, 2 Oct 2023 10:57:26 +0200 Message-Id: <20231002085738.369684-8-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: e019d578-66f3-4a5a-6b3e-08dbc325a9a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 02ZsbUYwST+cVw0eeYNlg567IApSj9/RfZhM3LkQhYQr08Akbcks9/J/I1pubu5uqOeKMqzqxHhx2jGILjEaMmP8a8C7pOYgSHhvYthQJRHfPpRyWXxV2OjBhm6OeCOD3UzjQ1L4rHLczq3SU3RZmtAqGkYgDaas+5ZUTTW25Es5NXrQhlhMaQiNrwypyfE/tK2copp2imYAYQCsn4yJIG5r43a6e2hcmVvxNRiS8Ol8uHyinRCWf2efLREUbES84n3qg1YC/As05KzQkRTN6RCPnGFVg2uPcJYFLwCdHkFo+n77nWm8O8ZOtyarrGpFqZprWfVX8MZcOM2kYxdidzJLuR0hXfM5KhWkI+XBoSSTJCgE5l7c0uPbFUMLN3bhu/dDf0EWs2z0no4USAaNnvwr/3Zu9h9dy34HKNyoP76xlzepOKi7XvUgj0/LiWCeaT2k8+TATqXy8WW4+momNe9/auALc4fUhTGRJl1+tLWLDL7OlpFudJkUwZNYjcehjzR5guQO9Ydx314HyHVsUiAxPZqALcD+cKibCfCL33GEEexx2dm2ydOsxIzui+lIDy7htRt+2FznB2RHsPRdUH0DZx1U/vux75SZe6Tg5tWj10G1SGJSaaRCrDyAdtNF X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(4744005)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MtxxQ1n9+ZOZLgBk90fz0Fn04HV5P0IgvEg6MANokyJRh40Pc/2dvGupsmIwVQvEuH7fCcfZvWITqfM3fw+PCqLXMQpelm0Dhah03a4k4ZssV+JCorq/Gk/DpmExrU4KJ0NxZ3T0oCO4dPiLEUCiYEjeRYSNp4VrJxrqgr3A4lqd6cQQHlMVP5/SkRMTqGs3D9jWes1KA/vxKFAX1oIIQS1XaZNH8Ju5puM8gavGVH5lWfLn6SemYWNzmpfL1/O6LkcLEhfbuCBrsNzT2oQP0rlpG6Ca4/rnKmQk71JjXA6+W3v/BALDgm8XEVU7QvJdpDiXXckVtp7AGNMjy9VPcD/CcPHJKE+Uz02RvqVvpbGIGkEvB5aZOpiU66V2Onao0G0simKy5aDnXG+OQw+k3GagA4pyJQ8GbV8uEHKkwon8f9OacaUtFwqnKShe8Ui0DVCkXHTrdqB0B9644RJ4mZZhKwMstvTNdUVWteUpRRNbT7KvWjIXa2G8Q4ArOa2zldIshPUsv+1Z4terpjNUNXXUj2NHdCnSD6HgSPTc2RIlBe8c01KelgzWMN4dyS02AlAubHXFNn5BI+IqeiMMpRHELcR1MPqLdkpAf50kCLj8/J7qA6/v5BhqCZSQu/0vnC0FKpuDHLRVkHoeeCQ6MzVPrdswiogeqHjM5XlSHbEYbdjO1p0AagTZCchzZ7slMAme09OH1so2VqQ1QYdUHRG5WhoGirdS7EdcD46V1xxwh4cY9AA6gzP/LZvzT976ZkT3LuH4jVGqE+8xVn3bDYkXp0zyP2q/Bu5d0hzW9j7XYC3E5eKZnYTf5VA9JTJAtrrgvZCrRIn+Ut6J2i/GIZfVuOWLRIzSa+azhoX4bQaVr0yqL6VyX9NJ4s6QcK5chhqgTiJpIbNbHVk8sS8Et6XFHNmChvwGSbSkZWcBkbG0GVnZIy94UdGH/LOWdlsX3V0fTKyDhLJ2lNGatT++iuljxZTnSnAIrGS5K+DQ6ohJdmRBnYFlckgwG2q23GqjUmO+/QIOxkbprAyodp7rXR83Mz/mPOzSo3kLFi3PwFK99yBHheeI0j+NRSN3cVvhKuYUjzRPV6Lw3iG+nxFjkTSu7PkxlE8BfNwi+MHR+WhrxP+FU6qqDVLUyde57ANzYXGmJYhCqUGjtp+s6jgCCI8GEJUyvkhaFQAmuf11oCh6wKhEhpHbDG93AWT/Qb214Zha5aSnQOaPf/nOafQ3UMYxqrMtRIm/eMDmdsSk4EXgnqEqVlkxrJeYpHdjg6Wt6CNQKua5ErhFUTOsRn/Q1et8Wjz3SrKsEXVJE+cQjvso3v7Ip8iLren6pG/qSrPRKcrQKOtFthoCwf4DwnNoBOuEISSuB2Cc8eKzB8AwPwoYnppJ0XH4yEFolFYPoXOXJcOGeaTFISawlxVnfHXeb1RsBbIt2SlokQrDHxl15DIZoR72n2KAIcTdGC2Zz1asb/+DYT06hLy36xnE+kZXf8KVPVHLiTMMo1habl8xPiU5XnScgiJGWys7diPp/xd/Yeo2ZjljJ9otqJB2A2Wxh8UDCO/WtPxZPf2lq87mOIeEjsimp6y7GYwR8RvmtZSj0XCVBnbZNXrZ18Wi+K3IF/fybOmrD8iTqVljznxedSk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e019d578-66f3-4a5a-6b3e-08dbc325a9a5 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:53.2605 (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: CiLSVQs+Ie3vUOnB2SShJN4sUK51vHKlvZ76bTOTTDgYsfCzP02tqUqUpCCy5P2CKUMNlYmac9yvWgxR71vLcAGwzRElKu23CqxV9Hq+VpA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::70d; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 b735ba8390..8208c0bc1a 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1416,13 +1416,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 Mon Oct 2 08:57: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: 1841989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=bfSsdwNl; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZdX5bxZz1ypx for ; Mon, 2 Oct 2023 19:59:28 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEl2-0001li-Sz; Mon, 02 Oct 2023 04:58:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkl-0001Uz-RI; Mon, 02 Oct 2023 04:58:12 -0400 Received: from mail-db8eur05on2071c.outbound.protection.outlook.com ([2a01:111:f400:7e1a::71c] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkk-0003RK-3T; Mon, 02 Oct 2023 04:58:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nMALzO+Xxf6TPD/wNjeKUt+3vzINN4dgbRCIhB3wfVLzDPx+QXwv8VmdJBCfEMRQdUVR1srMHpzZygCumCdaOzJOhSqIvmkWEiD1sUqFDvpLgRlv22aF45Y4rfDuecomBIn099Y+MJniWDX5z4WA9YCiy/8dlEwxnQhjHMATJubuz7oQgs9f9JvpVTAu45OUS7qrIicfBzuoTVVo1lLH8yS4Ane8seiF76NjljgTP+vqlywTafIAgd1mOIfVe0d0hip1WYg7x9qRHA5dTrf6Tnfpd7a+bgWMtlzMGvQpkSDNyIW59XfuEYczoesg1RU+4RBlb3ouQg8QnP4GEjursA== 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=zj9+hB8ZBRU3lZSb5pn2qqRCz7DQGcUjmLtk4z/tFNs=; b=OiwzRIQbNM37tB10KgFKbJEqrWsltCw9tGnXDXmkckOPqrHpG2eh4lGOFDP0yR+cNAhSw2mCf2v5G11WGrafmc4c8hWI34lMsYmIcUoZEQFTTcWYZ1dhLs/BwyecexfbIW5OnFhir/QpSNiov/HSHqy/b/l3w2BZUIvlZ5QUENr8RPnsJAqZde3JlEEuavg0RUQ2A2FleR09NgXrtDJlJ7b/gZV/eAGo2zv0b0l5F6a6DUcCHKeubKK8oNm3+9qHjZEJeJ92v5UAhH0n6DQAZ8C1AlNCXqEsbhZ300z9MHpFEHlFBUhMoKrLyqbKUtQCWHdRlF4V12VPlsGOJSN2xg== 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=zj9+hB8ZBRU3lZSb5pn2qqRCz7DQGcUjmLtk4z/tFNs=; b=bfSsdwNlJ5K89zTuwU7qjyWUqsbUT5darnxluYdpsb9+QzQ0UcOqxzNRD71s6EdBjkopActW3mQPzfPhVVNscf4lP7T4wRQOnDMebeWmkR+QvI0HHcjAfd6KvYWI1STgRFATWfYJWSsZZK6US0m8j/z0j44O159bKZym29b8MGfOvcA7+jscd3JeaQWqIehKnziOTWIcrt3+gxazTE3MHUmq0FtIZii0IIaHsSzW4Mf1LroVCAtoFC+iQttHMO8F5E8wEfC9khaunLrAgzblBt9vCDmgojZeuoGiT7LV3FZRadaTGGLjvrpc3WFtjTbnxF9fzFCcFvArsPPAS8jY8g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:55 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57:55 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 08/19] parallels: Make mark_used() and mark_unused() global functions Date: Mon, 2 Oct 2023 10:57:27 +0200 Message-Id: <20231002085738.369684-9-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: 87f65909-4eb8-4291-6345-08dbc325aa21 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SERmA9QhNxKzeWVKt6TqpylnyLevOS0BoqFY7yegohWR7961pJJt7p2dL1eyVbacYZ+aPJexgzy3409+biHf4yciRJ7jhVyMRUTQLRUptFzUS/j7S7D5HgnuEhcb1Bq+AiXqu+EZjDSE7u/LDxWp/mzb0TvoGWq9dt0O6OQOb+fUfZlgVcyURkRDH6IPmcMtEXpDzoO12F7afHr/W4Cev3bqo7iRTq2DFpGEsJkA7LKjiEGYsXMy7L+No2+u4w+tpX3JLFEvwm3FAPtZPS3r7oT7F9/eqLArkIkz/9BOZDKkYqFyZwdiKbmj+RI7zpVhRL0xdhl/h+bpgCAH16YGne22UgyjygLytYcaSOZwLfW/uFL8kkqekWxGlosVRvbi7Tgzzg6dk99s1S3f7pX4WJ6yhBiheKMaHkwrIy6hz6Bhek05mrsSdOVzIJCpGfnanGjjnAp1/xaG1aRfFr4hAGl0YNv1iQ2aLXDKc/ry9x8Rxr1PjHXZhokP7S3DrIAu12tqs9hX7ugPkvcgOJ7PJFLljO0zsNNhedtGukrCK44rkmGDlN5J7+/8kOFh31yqNk3qFgiv7qRIbnMupGazNXqreWuNPCiK1mJtRvivJg2WMuTQtzmjWN2Qtn0lqJvI X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gSZxQtC2VFP82cineK3K9Vy3qL21mjT4VOeAWcw/dPvBwjtbSbdW15ts8mBdWmdXaI+SdPurIGjXqkhAL5D6vaPCQMUW7baBWxpRIDX0RawygxRuuJVyNdadtfwL47OePWzBk1xxhmuJhzdUsQtWIaMIQtMO3XUHpUV5u94wwnKfXEaCh0/WkdOY9hGw/c4huSaNh5FQalxaXY8HC2NW4+VqFT4W3c4We/+ycGWMw43GFLK/ZDmpZ8tItVnXQyCyCovHJCbNDmdj92tRFp1pgcjMuyqUzcq2Hp+bTwpA2Xtn1dnSxOlGhW3/fHioINHPto586DRPOigrLXuVQY5SnSBGaYWCeoENrLd1CWy5zWxcxX2+YpRx3ZLp99L8ptc55j7yhRNmPyICEyQxJZbX6dk+whufNn7o0G41AfJleGrzOEZxRVwjznjzE0QjhXg4iOM64kg5g0VIc+01GLwtRMwteHDXsuCFpYSzVWM6fLN0ilg36A+Iclah1Rwdo8JJlq0puoyEqZ7pdp4RGDjukrro7Xem8IzpnYj6/68DJ8SWxLIvKobsibwegIHWjs3LpZruLZDurj1OKylBU4JEe6YYjBu5E0/+3xKxuJbdXhrtJStrWbM0f6bkLIedTynHTlYZxTIKf4SgrwfzpYk3ZCn4YdtYMGuaKcdDOm1VqTIOU7+Pr87jU+xNXDnFKKworOJnqc2cJ/yCBdnfO0itRUohnEiAWrNeIXULTEIolvy8faVqv//s3R/MABOgNHSWga1lARjlKPsx+/wu0Itn5j1tI0bnotCARHlm/aA27jOX46YOy8tHdEYyUHPeVX5tK62wJXXQQl80xI0CT+WH8uDQNiqrYatf1ayP777EyNAyFxW11ADzh8cDKBmlN/0c35wrBpKHwIQKEXHfkWWiQI2+CWFFBWScTg4xrLyoFqsjHp9NxgPsgXum4ZjvP4eGDQQDoFWK11ZtVypwKzWBoktY/4ZLpnqdAM/+ajgK/h1L7LAgLoSv3j3pPMnUeH7rpCxT2fO5SSDNG62UqAa/M0cbW57ZZuG88rMHUF11rfR4sb1/TVl5c5Sz5RD6QXotTBp+9dHeyH7IUoTFOtckPwJ25SlwZY8x62oXaG3QX4j6sJTfl0wAZM1Ns5Nspe2FvFf5EoufJHu/cypOKPagxWnE0oUy0uuwPtgOa68UZ3IVJn5ZuvplZA8sJAQ1HFhf8VLYZ15XTvUP587ke1wAtvBFkCcNSVFVmJSS4Z2G274fACwxJHSEJGoFkMhjMwilQZ2Wby9BcHy/Vemz87jHt8FW28QIi+PXoOn98IjV83cd4gHwyRjwfP9D4Y2utG1ikhpbsBItFPa/6X4q4XhVp/XOELzc40FQPgyZgaPuDsJ65MsI2RuTOWcqvOm5HrCpr1N/TeqdryP0EzQAYcuYVpAYV+GbNoNJ9cnQkdJm/oJUme0FjH6qPcDwTijce1F47knKtgvU7aFQoq+1nyJelN8B3v/VlFkoVr8BRdsevVBBEJW8Lmaz0Sbbz7vhWtK8L++8Ijl+XZOux1l7cNS2aeiQ0wkUGcnh85YWjEr7TRSe0O+WhpttmlaCCbmJRKRRemxgQWwxuRsd9LS8Zw7IeDZa/DH1U6mZaGomKSm4Nig= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87f65909-4eb8-4291-6345-08dbc325aa21 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:53.9985 (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: uY5MHj+a7QiiS9fooo8ZXHvyHbeA2BG6JNp+tzLuVTARHARojqUPEfYJZaPSE8M+uAWhKafuAvgpugaxPcSwFzcaDW1jDD+4Rpry8THr/zw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:7e1a::71c; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org We will need these functions in parallels-ext.c too. Let them be global functions parallels_mark_used() and parallels_mark_unused(). Signed-off-by: Alexander Ivanov --- block/parallels.c | 22 ++++++++++++---------- block/parallels.h | 5 +++++ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 8208c0bc1a..adb43a7069 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); @@ -195,8 +195,8 @@ static int mark_used(BlockDriverState *bs, unsigned long *bitmap, return 0; } -static int mark_unused(BlockDriverState *bs, unsigned long *bitmap, - uint32_t bitmap_size, int64_t off, uint32_t count) +int parallels_mark_unused(BlockDriverState *bs, unsigned long *bitmap, + uint32_t bitmap_size, int64_t off, uint32_t count) { BDRVParallelsState *s = bs->opaque; uint32_t cluster_index = host_cluster_index(s, off); @@ -249,7 +249,8 @@ static int 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; } @@ -323,7 +324,8 @@ int64_t parallels_allocate_host_clusters(BlockDriverState *bs, } } - ret = mark_used(bs, s->used_bmap, s->used_bmap_size, host_off, *clusters); + 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; @@ -390,8 +392,8 @@ allocate_clusters(BlockDriverState *bs, int64_t sector_num, qemu_vfree(buf); if (ret < 0) { - mark_unused(bs, s->used_bmap, s->used_bmap_size, - host_off, to_allocate); + parallels_mark_unused(bs, s->used_bmap, s->used_bmap_size, + host_off, to_allocate); return ret; } } @@ -865,7 +867,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; @@ -925,7 +927,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 3e4f397502..4e7aa6b80f 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -90,6 +90,11 @@ 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 parallels_mark_unused(BlockDriverState *bs, unsigned long *bitmap, + uint32_t bitmap_size, int64_t off, uint32_t count); + int64_t parallels_allocate_host_clusters(BlockDriverState *bs, int64_t *clusters); From patchwork Mon Oct 2 08:57: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: 1841986 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=aDDq3A/G; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZdN6Z9tz1ypx for ; Mon, 2 Oct 2023 19:59:20 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEku-0001cj-Bn; Mon, 02 Oct 2023 04:58:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkn-0001VV-FV; Mon, 02 Oct 2023 04:58:14 -0400 Received: from mail-vi1eur02on20713.outbound.protection.outlook.com ([2a01:111:f400:fe16::713] helo=EUR02-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 1qnEkk-0003Qj-V8; Mon, 02 Oct 2023 04:58:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c8VJFMPxbVS799+5Yb6VsfE39uPpwaIhD4j44m7/JdKV4KgyaKqfUX8HvvS5D3TzPrCeA3vCTdz/zU7Loam9rQmSlt/7bWurN2TV5JW1/czdg+JB1z5z5RTn9BWWTyexoFvb7FPo2nl4oYdX/M4ncU/vKkhSJHQriywIygOCOqchOLhEa3Ck4BlWxrIGWuyv53KmqxBgls0yWxI013sy7fqYywAgFZrKyGRcDXHLE7WaixNDFiincnQFG1gFDMhpk3HKdK9DBfpC+dCdbIsvXHOdqWhDnbx8R1Y5uvt5LzeiquOMGVHW25FrPFQSPgr10/tcmjoe3AwOxM6/Jv6cOQ== 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=i6K6zzT9GO4UNAoOajoFS2DdUso8JcFoaNjCb6Xo06o=; b=M7XKz29rgZheN4UaXr4ufNwMCgirdXO+DbyzC56WioukqBs2dBYYAXYVmCsoCPSEql5RmYw785OxvIaRfXnt8zKl2Kzsr/0Til9+7EFrv31lnCFMfn3If/rWj69dvxL8m4+NPGCKJAEEeYVkZNOz0XL1Y3ebUWBvjEDO/RPoqw2CgC+CN7VPokRHblXCsv048HvnhkuADD42Ga7kiVHV8N+As/uSTosIvd8+luAoLxYZc3w6c2JT7aSGqqUAfMT+uh9Johrspp7m9Lb99lyW7vmnZKOg6oux2luNHdiNAudldxHSSz9NYj/GOArJSGXDx+q4SlztV0Fwpor4YciafQ== 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=i6K6zzT9GO4UNAoOajoFS2DdUso8JcFoaNjCb6Xo06o=; b=aDDq3A/G2J0k2dlfl15Zx/+OWzlKq12B5+IjED2lx588QS7yuSfrfHG6jZldyuAbpJ7titCWSBvlaKeZLl14WGbe3UFCBEyzhnudM696UDtqbg1MlmXBaFe7fpXH1abr0asRuuJynYvSfU7BnxTBBKFpOShqk+P6RYHarliQx8hBMRz0UKI+GLGFAYj5EADtcy44ZQWfTtm8LfBu9YxM/zV45ZNc3G6C2l7tjP5kUI1TNTAyViuIegO6xxejXhr/JJDHQk8FWxLUHKDP7b2/wvJD4h1BjiFthPjNzXJedfFY/XUdmDb0ZLuU08OudeRTW6ODK8HfxHEHKtZGwxau9g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:56 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57:56 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 09/19] parallels: Add dirty bitmaps saving Date: Mon, 2 Oct 2023 10:57:28 +0200 Message-Id: <20231002085738.369684-10-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: 342ceefb-c2bb-468d-1fef-08dbc325aaa2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I9H/xMKDk8MwnWkdQJfb4rNMULuzeCiTiXC8ruGoUhBDJetGxxAH+e4hVNJVk1lLptjEqUQpOacNvb7BYwUTI2po8QO9jd9zThloQoLbue1vZo3oC10FhPXWuC04q+MzjLV2SU0UGrFQ5amjaI8+bcBdzAXFaiJRngn4UVc3Q5WQw0oTNrzmgUl+OWunwbygsc9iazMWQ2AxPz6TjbJ/YjQJs/RDNEDYTZxkvl1ujsEmE1Gk6v00s/Tsk5ssI2RC8EuEeXno+MoaIkrcRVPhDge1pjBYNZNCJrNEMhaIB3hdRkk8CYERNvOjUWfYPI855IpsQL1D7KIeWHE1MA7+XrxeyaLb2m7a+CgFc8AvYCUq4Cf5QyK7NNsUDRvL+7CpJR4LLE55SUtKrgeFYSA/3AZ/EiBmmJ2yhAYmKxDzTpX3HW4CFPvO32NYOur5kaRsXhcUvyniKE0cxyi82juD+ZPTxf1DNrr+Ddpo0Y3ZmVjlbs19zxdf72ExqDfKAxnDJJM+TpbVtjHaMWVo/TqqxoF9G0JVJw7IQk/SPT6ZZ/2R6AimvucuyEqeluuWqpSoTWTcusbEWeVyt4Q/PPd+f7Dy8nxLm5FyL7dxMwLsS9+4gpNi/iOx+haVPA/0qdpPSu4GcZMK+/Z7gszEtC5+Dw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bsJeiW6KiD5DBM/WZVDPmj/w+qGQt98f1XjH3quvTITOM5o3z5efs1RK6hoQkkTMYus/B7BW6ibzIC8/5ZivmKwbPClpSyznegEzR/zghFzComJLNI/Bwb3LV4EOb0J0WJYvg7wwdWoxsibox/Ci1Srprf7bm+j1tqkGFk8KqBbBQZuqpfn64V2Qh6eb6a+07pUO59vDpOo12wdVU11a0y/VAPbPlOx46nIHcxQj9uhFq/jHjzQjci7Y0bDNkXGEBgWbl7n9yOUr4P12dtU82ZTS0LHkmhrzeU/vdHeXJRH7r2r/si5hc4f4rK2vXUOqB8EvqZ6GXDyYVgWQqWwwni4Om6M0qCAmY2ng7LPHF5CBwjcyTwXimGiogTdwwPBB8HY1c4ALL90ISocRSuh5K6WOAsFs05rp0NkBKtfgJiHZjn7DewPK21gSLpmYgLPdV/GXoyLAbFkuHYLxVoJDY5NAXoDPM6WinCkuCKIyXHaNeq0rcBuyyGXknIEMdUADuDtUsfLxL5fAlSoJxpethEngQakaP/LGhx394jLBepOtOSBF6BPeboCxfJ2sP3r60TL+WbOwFo5bn2Kmw4vOyg59dtLm6zs7aaL5h9PXSTS1JHG8cH0/FDaV3iRSj35jCNRtOk/nJJXA/Bunz3ID7gEyzI1kquNK1rX1PYDFNxH9hYkAuc+Buuyhm94xKRxAE7y0JWlC54qsYDXNHCXfgbAtkOf41J1srH+4FEAUXRuuAKOvpfppZhLM5hwsdkHqhfntBVOZLPFSJ77T88uMuMFLNQbyOOO0FocdJXaEh0lhmADdkRVxpxFGmqERcu64hBbs+41BVCReWFU40YchWmqBvyfxk7ZxAVu9yOerr5MC9DKHdhjY/KrdwcVi5QG1WREtLyJ3prmRJ6HU/RC9K23M/MhwJWgUvea80B9fD+HMhfNmVB2d6gZiouHI/GTPcmHoEEeM791Oj/UgohJWfYXOMkkWMK/tQwvdH09LEfdDwQd70VVxUG0rVpNQ8c6O6E6fVYfpFwVa3nD1CLDz5Ob8aSsu9N6E2xPlXJYlRoup2+pAXOXunFtHy2t+SW7U9FNGr68Fov5HMI+zfyXoL+sQZczgTvQxVYkCQv/ryTwQ11BUEo2dUHzg1sKLftSdlpuzd/A/6831cfl3UtU4p9B+VOxX0ftlmvVIVvDwZtGA1s0lg0ttKjqeprYGQ9eYknMs9O4sHVsBl26PJ5BMTVQNs9mga7OV2a2Yv8dW/YU4P8UrYVvhgga1I8AQV145+ZfRi/bqqQJn92joMO5mLaMdrLDNx5RGOLjiVs8O42GC5bnoZygmc6sVMtkGM//5vfJg+IE5TPSjPPSCpVOt6T4qKH2M4xT7OUPNm8q0OO8RbyluLa2NPLrkGRLM+7sE/4sBiUkNiCf6cY7COZceXEU+C2RmUoQedsCrWmrKnsqoIAMngXkOC1+Ofb2XNiEqtIOHOqJtfByU9OvJkaqC6s0xd0200XkaKQ1mKSyeN+fEScqFNt+5ycWqoo2TXuygZY30EWPGmyFw+fbbM8STV+EMd3DvKrzD/Tz8Kv/w/sHM9c1UDSI9BcPBZ0CxTNFER65KllxlWeltN2h7n6aNmWIptFr+jLHcNlOP5/a0NYY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 342ceefb-c2bb-468d-1fef-08dbc325aaa2 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:54.8283 (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: 7ihhLTryMSSX/uPucYkuZt+eapk4ztGjDIyKMneUIq7GKBoOeYeJ4ldqQI/h+0IpinXCMOJZp4kmVxOnyEwFHkgEvWSWeQGIv6hLuCKYxqQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 | 167 ++++++++++++++++++++++++++++++++++++++++++ block/parallels.c | 16 +++- block/parallels.h | 5 ++ 3 files changed, 186 insertions(+), 2 deletions(-) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index 8a109f005a..0a632a2331 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "block/block-io.h" #include "block/block_int.h" @@ -301,3 +302,169 @@ out: return ret; } + +static void 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 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 adb43a7069..d2a45e0c04 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1464,14 +1464,25 @@ fail: static int 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; } @@ -1522,6 +1533,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 4e7aa6b80f..18b4f8068e 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -100,6 +100,11 @@ int64_t parallels_allocate_host_clusters(BlockDriverState *bs, int parallels_read_format_extension(BlockDriverState *bs, int64_t ext_off, Error **errp); +void parallels_store_persistent_dirty_bitmaps(BlockDriverState *bs, + Error **errp); +bool coroutine_fn +parallels_co_can_store_new_dirty_bitmap(BlockDriverState *bs, const char *name, + uint32_t granularity, Error **errp); #endif From patchwork Mon Oct 2 08:57: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: 1841995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=vNCwyqtW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZg34YKzz1yqQ for ; Mon, 2 Oct 2023 20:00:47 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEl5-0001op-KK; Mon, 02 Oct 2023 04:58:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEku-0001cD-2g; Mon, 02 Oct 2023 04:58:20 -0400 Received: from mail-vi1eur02on2070d.outbound.protection.outlook.com ([2a01:111:f400:fe16::70d] helo=EUR02-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 1qnEkm-0003Q6-Ds; Mon, 02 Oct 2023 04:58:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nLwbr9oDHCCmMRa9yhd3icVfikwFGHqEaivkHnUFLhDFiQFwADyA+4GIcyh+vFOtD723pOnofGVSrmtkYnYYjk1jUa2yiMzefveQI8/BIJ+vZZI15DLnO97sdDLMYM4fFIEfuKS9QuRJAFE9usCPjOKvGkY4BJ0bjYfhEj4xqFLuZSpkbbpTNlzmbkAeTEtNyray6R1KZS1K8sBKFM1ZSpJ9V1dctJrN8JZumFZlBPZ7hLF3MLZloYqiRji+b0PzIiFes1OkxzYVqT7yYmFTWonhT3ewPSqXq5m1AJkumJNQ9+c+jRltk5As83yA3ow8DTvOmkbjlTfGmYKh6KDK2w== 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=LYaSUkEoXMo4QNirSEEcBel8na4gyex5ziLJ4RgbXio=; b=bMbgCKv8hzfSdWNb5fIsRGGtMyQHVS/OaXG1Uk9IVWSeQ7/WcZfcuP8M+IjNPhJBqAMAN7mf6fdLV19ZOjB+g4xpIJQSeFMXDCaELEzNSaf1VQxXuRoPXo5+uj1DQwG505IvQB/2cf6C6vJZIYmEPWeZOQl3w4zGrS7D/BSg3gieuMv0rw+WL4Fw0IDMBBMfcN19lBj5Lh0oObme96w+OkO/oLE5yfvLbT6PfwkvvHt7SXFSWGLvlySs2fRvPuqx/KSTDGousazoIWL1rn/4QHNt3V6pbjsgQ4iLlzz4GaYARC0/RXMvYJ3jYnxaUlCwzROufLpIjkc2K3EhOR+0Fw== 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=LYaSUkEoXMo4QNirSEEcBel8na4gyex5ziLJ4RgbXio=; b=vNCwyqtWZurinSHaWJzVXQen2FCdDdVFWUyDS2G4YS6dr6Lv0s2Y1qvZcCntu6yQiGb46bUAYE+wSRLhH5GwNPt7jkEPpkC7uVgejb2MLImHQ6lJP3Hs8olDumvtO1tGoRmzCUbptzPjTY8r9RVlphWN8em3VPsMzAcDEyb/vj4cifMhbfb0WOhSuc3gwujhLXvTUgdoiBL9ZBodP9xNbRAxU2O3SGI0noleAu/XGg7IYr8ZQ+4gwyyYUsg/jngIiy/1kHxBmAbVmiEOn25WQc0ASBSAN6UuuviVl1ZClG6IvTAx6AZTqxruLK0WZOQpuD0Y+LDB4ltd6IIBUwuBcQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:57 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57:57 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 10/19] parallels: Let image extensions work in RW mode Date: Mon, 2 Oct 2023 10:57:29 +0200 Message-Id: <20231002085738.369684-11-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: c0624cf4-0f9f-4405-8ebf-08dbc325ab14 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XVOI13GMzHoVPNYmm9HGBrOL0RdyI/q6RS2AoY5Z64Xbc5NnokkLTPUmoutCB2G5wJC5kc+TrMdrWvjz15KmfkLEjx62iSUU6zued7pWLotvB3KrW+m/+QMiY1NCR9nsxHlZ5QW6VZE+Jn6KWvSATYFBJ0AxOsqXPgCxkiJAzzoAyhTKxSgH+619xEVnBlaNgp9qxqhe4Si6PZaHNmKBs5Kyo6goTjHw6m09oFBRkavqHh9LAz7YKvhcL8kfx6+dtzWUxkFg3yuEIMvIEwgZdOOoHec/xo6P4DKIrdFPK643yZ80rfywxM/wD7qdXnTZERARg23hzmtrEtRmXkoziyrF5rleBN4pfcfGMqC5DHh2oZlSPnBSKdC3G92dZX8K4rSXVe6Lkjw/YujNyAz3lxMoVH6+wnLNSUPtMzNxzegxJLqHMLu6BKD4+j+jWEJKJfxhW2SxC1+HafU6dB67O/mpMWqoiUPrR6lsO0GIbu1y4luhNJ/4cTHyNGwgBVa3+9Sk85wfZwt/UrY0TU7tl/CI1TGTMXz4AHsx4tbSHHAJ2CiGT18ee/m2ndZiNOQxam0dcRtEGwv/gwlf8cWb3RwktwXXW1fINZ3TtFQaJ8I= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X+ZQWFrXel8pkRCjos8K14vL/yS9KQuyJhqa7R0vrCEi2uWlQNy/phsGhNcFu7EGnMPJ2MZjAiqfbxyxzlReVNMN8GEoGZ/3tUXwj4hrc2w7YMdkcylFF4z32/fLlADCoqXApfrM9FbUjq5ZK7A/i0YNSMeSSllhi2coTKvUeMG+rg38yvDmS9oNG7s6WObXsTEjWwcRyaHG0msNPbHNSkbSZ644QdEf55bjKJWBvf1lVF+D+KMAUV1WbRDFEqZ2UgZKP5ogUfnCljHrVYsFVw2J/pEu49LYvU7ShqV4QTSd6B9KthrnuX7y7cWoNO3I2TcIKayvwmr7BpgtnoJPYc9o04rsKv88JwfeMOWTx8J7XStiOh8U17aVQoiTLJlE7YmqEcUo2aMGaY5HHDeV7SZCvbGcW1eTcj9juTVZEs8uEv3zZBjCs4b3qaB1drJMS+81vJdGGGUk3rWrx5Sh1m+ZLpuRTAcfKFmOmc26hSHUT3wkogoNgN3qaqgMkCkYOYn5V8elXk1xYuDlYxeWYe8TFU4swjGGrKZvr10Dk1XQhMY2hDSc5VD+G/OAj1KhnHxsaynIn6YvqnqCzXGMfydrQs5gT4qyc2Wuqf1fUSlW2W5jTXdNxBI1SFjq/E88Tjw9bDLVgwbqSMG4qMzzNv9iK60qwMfIDtLy7O7+wsI4fSIa3D4VMeS9WbuV0BPsitSwsve9GUirNAspHWdimXNrgU62h9JGqKlXhC649yg738PV9p5SJ6eXPU7IX34/oPNbQXdNBqJbOVQvYUIgu5qW87gbQgCtEG506pzxV+Xkonq7ENXFqc6vDoJM9QzNoj/7sLQqDrwA+jHuxpbKlhI9449KFawhiiNMkL3/0VwEEN7THxjFaQ1oMRxzrzkm++abYcRyCvZ+qGPQZoPqq8K2933w463VseH7yap1Jy0L82Dw5hmXCccZBEtuAhgifWZUUU+YO4I6yCfoTUyGTPH4RSOh0hG/hpAJ3+CEXwamCO0d1DQBWU/g8zZiJZBkAzafbKtargdA3ccMjvtXwBFY77OtiHLhTFp3RFYu9zJIPUP65O/Pi/jO3/NkGQigbMAOj2Bq3ve/8XVNxPEH+tznTj1Bc+ALyxn7Jp94Es99lQjNHeGpzkvqwFBYNQy+w0zaUV3RNfgMHu4fgPTu8XHeFoZG9ixc8x7WMwGGw1DocL9TaBIIZ10Ndd31Qh6gf/KuWgPDuj0KjwyBwYyUOmSey0wlJwaZrt0868fCykWI3HbNgjdyqSO6knH9EPZW3TZTb5/nkMS8HEaAj7VSETkE7tMDGDjqixEYSCe/yOZHwwWvlzx4fngW4Ve+nt8qeP/fmOEVbaecHs6DeinJu5fbFC8FkdjHUErylwW6KR7ltB7Bop2HFNno9Ai63qcWKjvUT6UA+QR5UOPJt5flLBVmiw20uveb3qFfuFnmFdrooz6oDN50M5wfGRnD9VKORWXNfHr0zqVSLydMQ68lzuKcg6+HAgkYI3fPpiZdvLPZtl3s3OO4DeIArkVPz/YIujGsO+5eM2cUp0rkqhFqIRc8jfmjP9k7q0jwGH3YCixQ7aOistecmRR0/WsYZsXq+Pn5sV+rOJ/dj6AsOp/0k/ozG/K81QFPBZUmiLuHPi8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0624cf4-0f9f-4405-8ebf-08dbc325ab14 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:55.6074 (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: rFiaOkjoeFcypSHUJTbVCkFkYSQro0509yEaIM8ZbAtKjhD0Z/6gN8kzHhy85jRCNz6ulfycCEV6V7luEAo2wAur2l90juvJcxcsN+llgu4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::70d; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now we support extensions saving and can let to work with them in read-write mode. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 4 ---- block/parallels.c | 17 ++++------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index 0a632a2331..a0de4f1b07 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -177,10 +177,6 @@ static BdrvDirtyBitmap *parallels_load_bitmap(BlockDriverState *bs, 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 d2a45e0c04..772a8ca1eb 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1371,19 +1371,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 Mon Oct 2 08:57: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: 1841990 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=IuVpdCoi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZdc3MgNz1ypx for ; Mon, 2 Oct 2023 19:59:32 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEky-0001jO-LZ; Mon, 02 Oct 2023 04:58:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkv-0001fL-KF; Mon, 02 Oct 2023 04:58:22 -0400 Received: from mail-db8eur05on2071c.outbound.protection.outlook.com ([2a01:111:f400:7e1a::71c] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkm-0003RK-Jv; Mon, 02 Oct 2023 04:58:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R5aiDAPEvY8+LR8khPg/k1GfBdBCWxRMw7xaj8mImUEACOH38TyslYYqt8EMYdXmk+OH6Vs8B31TDmMsm+XBl69G1ynlm9Fsib8NIvckMWKWYY5iPeo8lPvlPJoyzBei730YisUu4YXorncqFTzNeAPcc5bRq+8ISYrvwrQBYidsN5TO2FlmntfAAVSpURXRq+bWYY5alzGTvrBs9XFgliHmkWkPUF5aI5UYL0aCFGAbvr803sdqq91xkjekOsxPiKDVZd0olg+QAl/3ImL1Ou0OtuQznkEMzGDjJxsWe7FNCmELLJer/8aRdTTV9JlT8KVZsZ2XCT4ltqWYcMn6kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/k1oANas5MIf55ewby6rPkY5+MPfOFhL+ASOIh1bWOk=; b=Fnq5qxgjqjHcsGPXSSEyoNuN+IMXFFCo1NMhEGzPLD7aGke02TM0jX/1wsbBahChxA6kPOuhcWahLX5ChD+NB3lxsrXmXplQrQEpDHps9bkiwzRr0sMDkqbhdfKgOMFyt6nSij50ah72sUZwJrykj3bZyGalejWxbBrsaBlQ9fM5aYHdd9FnA2emR3yVZRANoVOprfW2mrSQ2/aXpxZWn/p1BEDfmbK7NM+PVbr3QM+jHlfbC0vTvkRu7ba3IO4EsZESRIvCgDp4SIbWuCmj2MpVsQqa3LQLLRhPiINpQt1+2nDqpTsmRYMENhn5D2YiKO7V20rtR5Cqrsn8DICNFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/k1oANas5MIf55ewby6rPkY5+MPfOFhL+ASOIh1bWOk=; b=IuVpdCoiQHCO8vANrsjFWewqHtQ8oBRejYub8C5TxHz3Luk29P+VUC8qD/fA9yCkmCN1aEAAEWhKgWAaNmjwdY6vXEDuTbCmzR/ImlTnYWz5tIOMhw59QCRAR5gpXx71CbWeDRJqeGVdStvvU+d28C20X+IVlwdNzwDXmxUjd52ItzvUbPsO1xR68+X/Dhp94P8YXJVUk3c1ZoXMjpHFUkB0lr/QIez4wKWlKG+kxw9t0Q7/F5IT5J9URUev65mWUsN6CyzcipsLPtPywkVkjBF4IdFYRknQgafgwFfptwn/BDi59NI/QOHasPuzzfgxLCuo1VT/kNpangObFafZTA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:57 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57:57 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 11/19] parallels: Handle L1 entries equal to one Date: Mon, 2 Oct 2023 10:57:30 +0200 Message-Id: <20231002085738.369684-12-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: baa7886c-aa13-440f-5fda-08dbc325ab89 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sajspc7dBwO4RUpQjiSTVTdgYsBJY9KNcPA7sZSkPgQOldGIXx/qaakrJNYXEXx+92OTcMsxbbhFsEcaCYjK7VjQPRfqw3WYPNEvqRlSFva7NMCcH/u3aEIbEus+pkEaeuy784i0b67ZYQetsHcw7gujvvm4WxxjCaM68u3m2p2qvDDLMM4f8CZVDyAClHHPyUwl8GdNUOUtGmhUJmUxlo0+326+0DdmHYhamyo4e8Y1u73yokqGzxEuXVXX4eyV5MeRuORzSt5ifAuk/w14ojHhQTlYTAlTB5cYqS58lZjIUmrRGSQZTyFLGggXh4tHLsxZFutC8+HGpeSM5NZGKBwxAz2b8TrcPSR2tE9h2ouOzcjPKDBTfjlF5P+RHDzHzajus8AunqzrTXXKEKDjYhVmV2KsgKXDYvAadjFPA4iOIudfnJvFwuzXFprW0ib6nOF5WjDup6R9IyboMWZs+3y7EH7aq9ZbEg2bHg4zCDzrBfql+GvMq9BGHDxpoHmi8faAkWBHWhg8rAWKUT+pWZwugdUK8HFe55KY47AJi5rAy1lB+tm9X0+GF9l2HIY6npjFlYMdijFPJNMZ4Y8vll9OZ2LAB4BoSeBbLe2r2ymUDjbaWz4rt/6u1/0dxMbv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IxNy5ZDrNH36i63BSlsLmsGRDZrCv+wryUJEqZG1veFYEhzhM6RsP+oTslRX+kecfa2Tp19OO3EnPaJmz9cyqo/bc4TE+DTKaDKX0+rN9uFjaEJ3umBiCkkKotHy/DZ5Xer5a5zwbAqRrECtQhcqzHLWxmdByXx1y9Q+hJoYc5ybHUdeZz2trZeD0hPCDw0SsVangcz+0bF22McVUvEnxGWaiL935hbY4Q3Hyl9esvN4VqlWoA+mjpB/w+KvDJ0lXd0A92JxlsYkUwZREiL0uCGyHi9nspCTSXMmHydwhKKlaXm/HL6qax9+OsCEisjbG9uneVxOVMQSe/5VK+83NBp6NCqGqBJP0DkWxOhO7XtnsSwPoH8sGwABNet9w2tz1GzTBoA/pVubHND8UFv7IYeA6Vd0OOo3riehSrZjKz7FzijnHvUKVkrvyvtbdjJfUE/2Vkj/z/oLI0GfPeLFWpXA7CwTb2ozhmGUfIgy77dgs8M354fw+vIXx9PgQco2FBoxQNFbqKV9iZlpILMzUtviMKAfxVjigmlN96OT/7SWsLILxcEvu+Oz89r3GnZCUuWY6dUZHNsE0GEsKx6t+fybzGBRgtK3M3FdLslAC1mS8xouOFz66QJ1QWqXZPVPsNkI/KwXpYsXMOX/h6U9I68ED0j2RsojFvC1SN+/pF5qOP/x6aUDu7MQI1Lv1qCjpM3C1MYvDbwnocbgOLdGCv9P8XUJwqvrkOm6g5yKd3lPOPOaE7t/a/X2j4NVNrLpvfb3WR0AueQqFl9aqT+kw+DfV6On3xXD8nfdjR6elzzfb+pLRQmWoUX18t7veD673zMBdOVI4QuhUHA97EYYzdxpISBSeaLbapW3x6OAuVmU8Ka5reC9Jt4GlrNb8Z8uHILIXZ6A8W4Jj+1Gu8FVPBbwAvl2unOPUeFdq0TvXY0qXB2b8ogoXgDcRHqGoz6eSEYu1rmHE+/U2UV1h4IVQA6b49Y5gwLpDFiBWGHNKm0sBYIvRpGPprcjsUA1HOpaeC2wvNK+5T4ekACU9gE4lRjbKFoUEOSk6/Zf1oi/0pACVZq6ECpSayvsRuVAADF4JIh5mLLR2iCIY1ngVEwDw1gJvJ+atAQkXU/QqMRuQoXcs8aXkw91uevXdXFZFPFATbSv5bbdTBKYhlRUmN6rRCgNfcMnEKpsSSxRavlp0EcNCct+Ir2ElHJLQBeHzBXflXPqmcnzHzi36r7CFbHjk0ecnnEv6nMdMX1C90If6HiQjBWZsK0S33Ra/Xp/FMQSSG01enu33fBibxrbSaFXlep+pv/Q+A+XSCEe8pGOdV4/UA4iG1pMRZvXh6uFhbVel+s4ErgiW6MFhcNzKZVH2WJy5fw7U2bq+CCwVIJz07Fov8jt6ZFtcM8Z6gi56MBqBJDl4N0KWD7Kms/qMbez3tz4c2cVRySqVOUkljCtVk062+dlMxcq9iXRZfuPwmbFc3Vf1gElYtttZ14fZyTbuAqN6rcl6urfhhTK5aSO2sv5+GWJ5EUSCtGXROHIx8W4PQVX10Mxntqh1K2T0BwofTKzRM94nNyVKhBCFGLKESoFF3oNreyDF4csOndAkOCVc7w7hiXrrtycBXqy1d/IF1U+vrX3/cgHsBOvmMgS28o= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: baa7886c-aa13-440f-5fda-08dbc325ab89 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:56.4016 (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: /Y0DETwe3TV8m/5A00k/Q0rbHQ8kXkSeb4oJbejS80letPMnEaVsup93OSmpChm96PtlKzNUkrEsCHmi4owRbXIkjqS3R75lWZBsLHe18E0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:7e1a::71c; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 a0de4f1b07..ebda6b0a01 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -354,7 +354,7 @@ static void parallels_save_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *bitmap, offset = 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 parallels_save_bitmap(BlockDriverState *bs, BdrvDirtyBitmap *bitmap, 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 Mon Oct 2 08:57: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: 1842000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=RVh1GafR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZgt16mLz1yng for ; Mon, 2 Oct 2023 20:01:30 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEl7-0001us-Fj; Mon, 02 Oct 2023 04:58:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkv-0001di-5G; Mon, 02 Oct 2023 04:58:21 -0400 Received: from mail-vi1eur02on20713.outbound.protection.outlook.com ([2a01:111:f400:fe16::713] helo=EUR02-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 1qnEko-0003Qj-4c; Mon, 02 Oct 2023 04:58:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fzNnFHHyT0dPPRVQwHmnQRW3AHazomMLFDJFJqHhqPvDsmbcQbU+obIc1OsqMG17il7Xr41yhbVohZByHYxal/1q1sg/zwtvltorWUzIJVn/tOHHQk9HCynuiLhqsR2JZj09+IJUZED9wrZ6Q4T7na+mMi5YCyIE8+XmDVPZ3y6fwL8UzpMNZeNfEcdMyw7fEYEOHc47SkDj1vN7QjbqQ3nNXDA3xquorm3h8veLNAUEjhqcPpvLSVGS5od2JmXJQbicb+D4Xn14th7kU2qGZRf7A4NAINBL6q6rc6EPZzZsov7Cm0t4OVsf3DemKj/vnTJcv280yggSUpZVACkx+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=97ukfm6vS/99N2d/mWr2AxWxYEsWR6QQMKlvpEE00Dg=; b=IMZqLr3MdYwHWQeGv3UCPHNRqB5r2N0o7Uu7yKPZmSMZ7qLR6nqDDV/5LMdzgSmp3Yd35UxtUkWvYIksFqB4b3GvtBqyQIAuZnAvm3k3j1WPEvfRL0QW7apZueZ06zYmYvQAK9SuXnaLAjmlnCu0dDcc3zROGJfCckYIqiY5DzfxaeACZAfCAgNboSzNsXqmB52Y7M1OGyTdDj1EhYz25HEZZ17+vvsuRs+VmSPaQg6KgK8q8xZ2xyqfMSpzqdJtXc9qftVcgwB8Z9FrhEsA4Eudv+YVv+YJCrVP9I6OJQTvSvSoyJafcJrBVOKyZ03IDnY+Gy8Ia2hN2QdlMas5zw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=97ukfm6vS/99N2d/mWr2AxWxYEsWR6QQMKlvpEE00Dg=; b=RVh1GafRbkYvRbiPOWLBz+EOj+tM2yiTpAd0IIRBk2S3RH+UYolKFHi9+e+2vxBfG8qjGTHunJn4j9Ej6IoVJOFp35pkuAQH3EI0tBja8Y3h6zW64jEr/YVSiMABt9KXqcB3bDhe274Nf+eeox6ShDszSKCZyDvqpwJm2qYwOOH/nj2QhMf0w/tA+0w6oGDzSp/WSrgPfMZRJFF3+MuUbivONNxs2uRrg6BaAXBVtd+a/0DrEDV13HXTrOqxZeQiHvcRu7ofsZRhgnipWclF3ew7u0epgG0UGWmB0rlmFz6LPcDiX4ysfVzbKhlLRMZp7FvKLZ6pLP2qW4Ma98qjtw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:58 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57:58 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 12/19] parallels: Make a loaded dirty bitmap persistent Date: Mon, 2 Oct 2023 10:57:31 +0200 Message-Id: <20231002085738.369684-13-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: 165fa02b-5af6-4a79-57e6-08dbc325ac05 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zrI7pVp2zhL6JXpZwEp86TS9OJodJS0yCQ0y0f93mI3HvfS9Su9psQoUoR6vCIJ/Oh8oF6KOf6JS8xjbSf3hYjSUaffZC5xHukPNyHGvJDsvio9A88hLgk7BJ5lUaTs2vkQZQpqUHst+ZrqJYBU39CcXoAvpi4ZNqzM5NQvF+D5p/P1lQCBF1/SCN+BDEJqchDFOjmGRkeyVvnVH8lYcr46OVO5Ifj6+dH4DWDngKe8OyJTIt7lvYFAx3m8vPDzWWyJvHg+LFp7/CX4DO5Lpg9Dve8bUSWtp/xKq9RapbB+1BAhGgStd7UwkawRR9ERvH76HJEGUWQ3HdKa8XmUb4pL6KZ1EL7ify8FjQDyVRWE8QLQNNLN30QfZzVR+CoZEwyGCUPs9N91BSMtMI+Bh4dmWMGgCT+57C9U+tgbXK+TxayUJtFjNVGp0gJp3nQoj+FPz3p6gtfayBpnv78Fm9N+OWriyYxSumzZibxuM6MjKrx9C2S+BsH9gHI6u+PRulK0GG9DDdy9BqiyYQ7TLgrqfgIHCSNiF86zcVlIgriG+CCk9XOHxigp8UsTOxhBGdMa4G/ueL5kc70z0Y9Mi8oVeabHQBnWi0NXdEg4BDVDh9PfKlY5fVaDqN/XfyCg2zSvdD+Y2MxwV+CSqjzEsHQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(4744005)(2906002)(5660300002)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QGfknqDAP2lSH0a35hahfhN2eqxHzFLmY/eHd/QkXfJ45ilEeOXP8XH1+AAW0TMp6tDW5EyikYLYycSJJpWZIwsd7QtvjoV4YV0lJkIGNXxGld6/4JGkJ1Hl9Rzn8zZOuq2tJPXDgggP7dQQ/ll5vMT9ippiXhdGaU954MuK4J1uY7bd0LYNLcHrKTukR05AOc0e4hqrEFWam+ZVviwhC18QXOt0KGE5V/UXteiEtQHWE4oQO8c0ykDji8YIpNFOtv/LpbdljUR89599DLmRrnIPkbOzG4qZe0TI6U1Zf9iEjw+xoh1kcfwP0gP7b56d7N8ak6MzyIU9G3OZpJGsq3PYI65Y+GCVMFixHuTg5FRbMcyWZncEfm85yMk2IMg1ei9MAfnWywxldpxHWLSYO4HD8RR4fx8evQGK5pX19OpoDEQg2CfDZ8enFRYsUJ98nAWJlKdEDDPFt0fBzpzaybDIA9UWOUAECHWOQDkrGu7wIk+ORPE8syM8luzAZV3xVd8BZvMv5XrpDheXvmo9avvMYprS85d0scthERtc52CYZEYqDbCzGsOiy/er1ekKQ6UiSFToo7EGBBn7BSGr6hhjurZfc7zPKPCkjYsaN2YZ1T6HN7Z1+JPY36PLtNxCD4kS5Y+GfmbQIhuYJK3a5NZnYsa51hqE3WObgnZdGorPoGqNglBzy5AfJQBdAhX+OxRXvSWRt6/ULjrSDnAjhl3xJyLXrIZCGqzCk7QgmuBytDEPEF67gAYPn1+MGFKOSUT2kfk/mpVbS26KlmqJJr/xerqe3A7Zdi/t33enAO2ZB0ui0jiiI/V2fi+KB4EAHSEebhiJEKFPbTNBGPqMfAxnLQUd4YTAdIv+r++9TfOw8K4OflWM+jY1qs41xM0lmJEG1Sw9jmauW1ARRayah6xakSAeKsrXl29h7Dc3j6l7d6wObNBxbDQAdyv6wnLyWyU4lxsjKGAhFeG2j9kvRN6wFDY/bnFGwAYvry0griGm03G5g1AJ9z6VPRPocr14M1oCrkR5ZsGoWRz/x1tELf3GhGPr/NXyObONYR83cWXBXRl4/mfQcjeBPSgDBQLmjtqdoq3Y7CnIibXKlzhZLijWQdJxgAXTMBOZ9+Sq71Dl46hqeqNKj/Q4+9PVU2i1mv5wtNYC2g+pPb7L0Nb+AomO87VVtne9Zht9EHy/zCCjdi4wb3SP55m0Ie4pKpa8cbWjuVhUyyW36G5JnANuCzWcpi5e8F51Um91Cm9RNDCvSkbsEl69fTnoJ0WWUl5gAWbYPHnhqC5QhpdCa0RHV8ZuOxcVX1iUaCkiVLp0KXTlwLWwZcR7dcjwklW0mL5H49kTNCRoC7lDEEbnYQWAGkCEFZELMgmPBxfY8+qq32EIHz/kMFyMYkWf7kvkxnPmHq9roA/YuzhT5VTl0tYHa8OXADlRAlUkSkNZdZKBnN08Dt/Dd/JxHCJ2V1CDraOhfIkUk7bTfv2buCjwKZNZp6FylZYae4GBJx1IBpy8z9qyxdAncNOja6gjg33VJBFqs7dMJnD3M4u33D2vWiqufNvIatcaBRc5ixFjbFYGiuNz51NMQpK2QoAtV4+3mSW/XV5H2iTzoju0IzAKiHAF8M0ujc9Lefwn0+MXEmzhThE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 165fa02b-5af6-4a79-57e6-08dbc325ac05 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:57.3049 (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: BkjZGthNXCDLgg7vWi4xtftytqqZDaodd1SSHyerBfBGwfc2CbytaTwV9C6raVEBcr/UNC6S03d4XjGkB5/cZoLGnGFJurc9DuxXvWTi3iY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org After bitmap loading the bitmap is not persistent and is removed on image saving. Set bitmap persistence to true. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index ebda6b0a01..bb4478c350 100644 --- a/block/parallels-ext.c +++ b/block/parallels-ext.c @@ -256,6 +256,7 @@ static int parallels_parse_format_extension(BlockDriverState *bs, if (!bitmap) { goto fail; } + bdrv_dirty_bitmap_set_persistence(bitmap, true); bitmaps = g_slist_append(bitmaps, bitmap); break; From patchwork Mon Oct 2 08:57: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: 1841999 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=oO7H3YqO; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZgm0tc3z1yng for ; Mon, 2 Oct 2023 20:01:24 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEl7-0001tE-1e; Mon, 02 Oct 2023 04:58:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkx-0001hU-Os; Mon, 02 Oct 2023 04:58:23 -0400 Received: from mail-vi1eur02on2070d.outbound.protection.outlook.com ([2a01:111:f400:fe16::70d] helo=EUR02-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 1qnEku-0003Q6-QM; Mon, 02 Oct 2023 04:58:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BXyLzU6Eh6Ye8bkRjxnuNqPBusPlb9sTkotvX83SRaNcpQ0GjnJZY3R9tSP7dynGgVmmoaxMPTK3obxHWoE2bD48mDHulKJg96rXfHmBj7bg7gqIKz55SvcJ3n8Z5lG+p+xi2vYqMcRlTtUrNaZjb0wD4PhY4A7lMeGQfjys1ehQ6eyrHjp7AV8oAGIyYVGqoknekKpXR9hwzt6HbgBXGGRf5MmOb6EMnBimpCbBuIREaqOYXGj5+Jj9MYuZJOihwDTZctKOHv6w1PgX+LjSwndjEqrcSU4khZlLeeONWssyLkW4GWOY2WISfUK5Nf3oB6egA4SqipnafDberyGEkQ== 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=KntmpZE39WYEeN3cWNez7tMuwUZMtOdTqVd3CJwlC1M=; b=LwwjJgUvDPBxlrdcx08fK8M9/z0N1DQMsgQBEUHhEYd1ZqTKKTk/dgRZ8e2Y9bnBG6wmpVlU2+lIngRdx4M9QYS2BxvggWlj+Snu19CxOJodcDjeDGpWJ5btNz2hraPLIK3RkRDst9HMLLnkgY0OxXEpHv4evlcdlAh6LVjyBLLyuaTlomLAt6QJ44CM62WJ3LqTsbcWJqVPfUzXhVfEGcNw5fqi3KsiuBe0IT6Rb6LTe3QtZdiEWHWgMwFOr+LoGWsogRNq5uteFJqyrAq3JRkIgbuHRF/HfatMdwnJrmIyOcXP4vOpubMAWj9scTAZdiI4WZn7XRJiAdB+Us2S4Q== 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=KntmpZE39WYEeN3cWNez7tMuwUZMtOdTqVd3CJwlC1M=; b=oO7H3YqOf93w5BqNGuqxH8S3UZNWObY3m14sMeIYiuXMOX2hwc33DeIvnKn7q9lbstNrtwlozs5xfJn1ujbdsC9s76uqDYZHpWLT06Atn5FsnU3o/t/DEkfvLVtuWlNQv7auy5cNO1S/Fh+1QWdfeI/SGslyNY3C4uWhSH9S+lDf9fEzE0ipIHkfvzGmgCJJh8g+U8vD4P0DH+dJdbxkoNAG1zPt9of7m0s/Lv0Rp8M32OqEJb60zkb3F8+8jPGylEJw2mZD6yiVqzHj0nwnIHkS9uX4LNvchrwQvmdGkAUqqBB+MmSEi88Hxzez4X3encF2TIY2fY73j8V+R0HPOg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:58 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57:58 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 13/19] parallels: Reverse a conditional in parallels_check_leak() to reduce indents Date: Mon, 2 Oct 2023 10:57:32 +0200 Message-Id: <20231002085738.369684-14-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b8e2c2b-2085-447e-76e5-08dbc325ac88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TIOeygH1oTtRXb6cfq7GRwHorTayiOWwKYxaEEK/HEqXcfVUev5jPMyOFzSnQk95zjZYbhnrbMY3b1gCzhTl+mR4ZOLLG1GkQqK0TulefXBwXC0dgnDpvlrWTdD15H7KhbmCFtcgnLg1Gop0YVLDkSHTUThPv0i0gIL9fZVu0jFwHVV6j43xa11tTx5LMzrLxlrxLcwBMF+eBGKaZyNCbkMAOuM0hRoyLA6R0msCOqmelOKJVyBn00l/5n/i7Gy1D1uFxEc3RRhlZA9tfyWl9I4uaCKfC2WFM2oBCHd2r3EidYG1d9rR49VpAcdna7R9Kiyk7ccKATSgLjpB7jX7/HAIkoAT1QILTxmWlUTs/JlBnSUZaWEIFJgd819Of2gVV/qdfepmgrHrZMsGVB2XKVZ22xd6haStV9szFCn13UOcV3gN3qebdxfzgH4Y7F3OS6m+KUC/+0wBYX65cBSYPlAyyy5gy4VN2MMDniKADzQ9MK6S0h6g6qxwAFByATpm8xy1fAaotJZGsnRfCsXEcBOR8yqCOcGUlFvT+90z5HtJ3yifhYN8CWO8IFj44A3h/6QoHFj998946A7MlbcUVFIkQE7WnJIIMANhCemnRm8KBwb0MSH3RiQWMqDvd+NS X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X5HAQ9BqB1c+Kb7VV9eYxjq2ZjFMtiiz3ClfNGouf2bZhFNfnGJHjHQGupC8h9npnXaZOsD6kWRyY+XrnIZdjd6bq3hiqeuv1i37VCJXQavJhNnKS4JsRCnc6hGHub0h8gQKu+NkJpsL3v4QneBXkDmrMJxV+x1yHQdg/IEF1YpxuvTZhwD4Pdf3XZdURw1TywF6+UY5kF5rjLHK0WmkZg1xOFeVrB2n2LJlAhN+ap9bvzWI5DCrHJHAtmV7OPocuP+Hm1JzYFMAKhNvP1/u1nL4Y/esDvr4LpqGbSIYzZXaA3nx2Zvizes82Oj3lMINT+WVPT4tivgFo9YiWesyZWA5bRzU2ppa8Ova7OtVz9pfcT06T6S5rmzZBV4fUtmlzczTbPP23AChS6otoZRB2Gm3oHY9c+aS4+pGGGhQ8cUNLWt9NDZrRGo04g/gPlNM+OC+GtR/kQuNzuoI56rfzBrZMqH+FTapZ2jJ4FOVo5aNbshzF91+UdA5U2XzIalQGxELgzJWOxtPCE1gqTp5bR5HflkRXnaMeacOZyyK8BRsHTlFME/iI9z9fURUyjly0Bs3z5muXD6bDpVMj/NXChqYBs7tV4mf8JdMJZVLheNiyErPkLJEg1CgYa3B/1apE457L7m5uIU3dfwn0qzfRzlqJo4j8Zs6lUMe463o+rTDcXtkU4updxV33/5KwLfDH4UnuXjhTGyC6gNKlVIwzLuhTdp9568swV9dU/TVMcFYMtBTo4DZ6CRaGk9Yn7LEugihImxvNJb415hRgKRdpgpoxK/YXebi+0qRIaZOW1ISKDZjSfCbow4mqbEciQG+Ct0YnHaypTjCsVVGT6kGOBZpyZqyYINx8E/QRcJxGh+7IlCcGIBgcOzhRgajzhZq1hNoBPXqmbi56dPVshxYsW45lz8Q9xI2O2vooBIK175lZ5qmXEkRoQrOGpGfZTQNWX29QhLr3v6ebxmWL7/t0+ByCCUQ/P4wjiJFfUC1rm1PeQvV+MHPyKSzZG6KUSLxvI1Izh3sJMn5jdnGqEy3FnfMF3jdlpogriEDzi4+SNp1RtboiLiGdNY9Kc+IuBDVkPSmnJsYe9N53OjUGW/HgPwBjH/5a9n6dQ+mIy0KU0LCUzZUneiRxltKr1BO5XATrbIFB+ceKWzAugJeHfrqd5X9ONNIlK5/KOY7kMM+lfXU9LEZtfsfVqNx9/s72F0f/Y07e0BY7benRXqOUU4a2mClLXj25TE+axGytXHA4P4/dDcbpGzAAmC9PLoJMQPmIhXEIRFkViFrvmYZiLllvK3HiMtsVAyfaq2TvX9RudrHR5s5wWoRgHEwdqVUKdOPcSDAxlNX1PNt8wlbboKXDJF/qyBMLeitWRknV+p8VC4vZQejgUWNfNESQX0Z8EP+rOxeZNTN+X7JmTk4ShP8IrRscsZSsf5xBJxi0Y8d1JKiaTS1a7dYnOJG3/cVndVnE5qu1v6KLIUg0HAhCc9eQw8tFxtUiHCMS73L7hUry6lB3Dr85T7FstTCZ9SdwaULy4KdJ3DI6wq/B9zvbt+vB//X5mnhCvJKZu3DxnY61E8wCIU0bslDnKU8dXlRwDPMiGPZeRs9MCCg0KRnS8G/NihyrxsiUMXe3754QpmgBuQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b8e2c2b-2085-447e-76e5-08dbc325ac88 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:58.0232 (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: g0JZN3VKoQ15G/iVDR85ItEV5zNF1OiaBJKjZXLqvkLsyGqm8S3b3BJfCl6Ue0jdDRiNChI8H9GtDSOV6DkJDaAMY8VLE8swUTcziI3JSd8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::70d; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Let the function return a success code if a file size is not bigger than image_end_offset. Thus we can decrease indents in the next code block. Signed-off-by: Alexander Ivanov --- block/parallels.c | 72 +++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 772a8ca1eb..7b16ca2ab2 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -772,7 +772,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); @@ -780,43 +780,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 Mon Oct 2 08:57:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 1841994 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=vc+4mSuw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZg31Q0hz1yng for ; Mon, 2 Oct 2023 20:00:47 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEl7-0001wO-S8; Mon, 02 Oct 2023 04:58:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkz-0001kY-IK; Mon, 02 Oct 2023 04:58:26 -0400 Received: from mail-vi1eur02on20713.outbound.protection.outlook.com ([2a01:111:f400:fe16::713] helo=EUR02-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 1qnEkw-0003Qj-K1; Mon, 02 Oct 2023 04:58:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VhWlKrdpnGU3C+6TwsAfbJBCloHI4YfIRMGysfhjCj21BWHVXdtYa/oCZ8+uZ+vQMAV4mgtEpke+Yu0mdlg4KhRI/cFInhzteqsSvGJbZihliLOiDTx5QPdgD/gFVYkkeauxvjyh2XOQ2lCVWkDh0mqoEwNsUIEXf6qYKqZbEO/nFNY9j0tBBIQ2tQfUPLxy2PXagsRGXbYjuccsuIVOqB8iNE13QwVpNNj2S5pRIMXV3TZBmEhtO+bPLc2EZb10glE18kLLGnZ+bsJ1ALOKTRcGygAkLUh07oxKDSyP85iZT0CaZDGVOo2TvyaDWMXwLvkFU7O19p3b4zzt7aABWg== 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=NFvHSjhVwI08ra1e46C7tkjSIYf3GKDf2+a+7wCCjxE=; b=d2n1SXmm9wyERz31RZwWTjugHeZiBhT97FhVGEhKWWw/foRNBbdxvCM57IYte4nQC7EayhdYbU71xjTsak5EyFdOQ8culjcRPPhUNf46QvaBAj+02aKOdGlYr8d/yhLGmbJPliUK214dtEYFgFFvb0O12z/V97/OJRGyupFtMeThcZyAvtautuGb6h3/00VHKF+KkIGp9jQVQ5IMviEvusAkgvYp4Tymap6C/K7uUli6QalvPa2z5In6+9Hwg4Xpqu9HMcoZncIk8r1hzrdNvu2OrbRbUtZPjJSfdaA3yIQF3wuc0nDNjrYbSQs2zqFw06W6gJ0i3zcdNU3tuyJo9Q== 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=NFvHSjhVwI08ra1e46C7tkjSIYf3GKDf2+a+7wCCjxE=; b=vc+4mSuwKGgrHIxq8qJ+btS/Q2kyJjVEkbKK0biDo1oueeIiyRlwVsEpqrTOa57f4JcJJvpqUFw0T4FXw0jo29JLzWvIy64afTE47oVyrkKt4LEzJ5nsPIC4MUGSSRpXnHY4aqBLHSjhBHn77ad5hEE5TVF66tVxoKJEXXZOehpGq6W97jmtF3rbfEPgGNyZPthhjj6nFL0G/Mhc9/mQzzduOAzi0oiSBYofVjI0PtzYInxjQalSeVXEjPaGR0NhfRdNTtgpxPCUgHZ0zB8iVaVzavKAVHWYStLF75KWTDZ6/pWNCzmLvx0lr5cfhotNArE/h7Bbd1xA5VQh/t5c7Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:59 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57:59 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 14/19] parallels: Truncate images on the last used cluster Date: Mon, 2 Oct 2023 10:57:33 +0200 Message-Id: <20231002085738.369684-15-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: 9029a813-58ac-4e55-aa4d-08dbc325acff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y6nUp1QcBSnCiDuZ75ONgatGOcElZij4jcXSkHbUzEz7Y7EsH22k6aFTViWjChZBHl+Zt/Ah6pN3RNVxa13sw7vRLrDtd0Y4G6TCN7XdLBkjOMfDlWfyDjBA1UUiiVrisXIzF89OU6H4v6gLyCA/ryo1lEM2nW2zhD+Iy5dt6jNvHv61NUmOgch0xSGdSxNXNUCtUuBANBVku4gohrCehNpQ/6OORPwQbUMg0V+QaetNpos2wbUQbW+w66ODm0Cs6t3xzKWL1+3JIaWP/kmypf9U7TTjJc0+c7m+GtiZSBcwpUk1EVlLkJDh80T36agvAAjjwpskxCP5tuOMV/2Y5+aRx56OkYUTvQTYtXtHsb7GNIYm4vzRUIJYzcAo//8wYiKImKfmy8MnF0GmiplG0lQLw/vXWqJ1TbkiF0JVMhmTxGkzrWk8OLSPUGuBjeeUBseH2zqGc8UvMVhMX9hRYJLCYW/NlPshhN6A7Uf/5uAd1Xf88mh7EH77ph2nQiXcxmrJN9CwB2/z8h+ubdqcauh3OmotfA4UKcJc7kYbsyQ7gCU4D+z0+nI9Z6fz+rfmSDVXDHNHlS0yzmLuS8+PTnR/Mdb0t/BxFz26YL2vNXsIOZqwFSBw1FvFqa3wmQru X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Plt2We9PM6Z6CjxfYfqTJIpAKnwkBtp8C5cC09yn33kKmfwowRSssIhRsfInljGCsU+LdeL7YQYP843m26OM27CifPQk8nLWHhFdcVDk9I4nheULSdjjFo+cZVL19j3E0k1miYk9v6yY3SvJ6DL+dZZNcwwbPpGfeL7X7wgDiPLsBQdbJz4678S0KblkQqCJuAj/Ss/ytidws/Epom01ODtq3/NOEZ9n6RhX/ubCYpvC4a2dXv3rTMelPLtODCW4ZPXVhqg5UnTwnUee6AbieMGVtDAC82vJq1m3ZF7wwlRxqcjIVU7n81Skd3M7ZUxmgAEyU6soye4LYtB+o1mVuWnCC8sfOEP3/jdodZjI1CJxQDyEdQHsdtgG4vfh8a/BtDAgAvK29We7ooFHA9rMj/LaBmxDSrLde1Nayl/fHWNZgMgjZ0FPFQoA6BmKbIWY6acr7T6lUsNF+kSqf8TAkkdH7w5Lqr4VF+LyKpOAzFM5qHizTgQs0XGSERipZOXnNj0WyHIG3i5ZtGzA/L6u48wBwZUJu8DOrI6gMQCkCVRUAYjJXi4jIMAeJBDnYjMa2K1FJqS8S7phhjuo+Nyz/lEvqyEAq1cCrjAuD3WAOKtm+Rtk/3eRz24YLw3AtAGebTQXV0fpbNBXUTn4DRZzh0jhToLwvNM0jtCmbP6cjF4Sh90k/6zVpLy8bQmmn+QKTQPQ5JPkHU1gEUsYsPIHfnTIh9uEJfwpAxLMbz5mldP42Ck3sBqDjXduoXbOtiEect5jhIZV9epnFiyJR7SsHCaiwGq1YcsTnuSp+WG9wFEq9IwSGIq3ZfU5tNiSYI2VVhd0XemyyQMz7j3jdnS8o55iZjelRfFgA2rPeSrmqmGTEwOA/2O+hheF7iz8WiFId6mt2qcVkttYPixaxQP7YiAj1bCjgKSyNoiIqz4YbJBfTeuQjYVc5BZ+qfrPNXIIg92Dks1PfIOcCkg6Za5E/dBxSORWaagfJ8H2HuAmNK2iCwND/tUIlITJlmXroagc/blDUSYLEi+zBs8qw3YUhz6VjQfmJi590WtNj1dpsYJqCaoFiI4Dk5NXEcCn0JuYciBhFjtTuUOQ0wH6j2Hdf8TZ75Dw0ujOHOEsr31nF1tSZQJ6mA9B3Vje80U7/hLKTYLqgCSLzC+OLS12GSkpRLD4A084RHfGdbCFeHVFnysZss1BdKPwVl/RNnwx4i7rdEbOej2sLMgrpkTu7fwsY4qK5QqGQHiHiAmlfnkSZCbfiEQMNda+S3ZRlv8MPSvdOO/S4K4EPvpISnJDYJ/deXIXiRxWvAKScj6iNSOWTzXiCZqTcbh3EsB1WYsZ/OytJUq6Yx3QXk+d/uUIF/qakPIWWvY2OtGd0KhYilPme56MY9uZ/jHeqjulkhyvZzX/KH4kBsJ+S8MNl/ncefRjZsJE+h362p2kUDoqanvh5F7o3UhSYpFObpfGPAKChQNUSNcQYpEfEInHxOcymZ8tH1rvuf2WdfH4Htqm3qXKFjvl1UpYPmlGc8ZLDqoh3Agwc9tCAmyZTWSqN+ygOBGC/udIExWMUPSLUJhD8zSbzcaP7PAKd5HhoKig3hXcMZa+2rmFULSqLQwQTBALrmHxgxiTxeGQ1zRVd6yXFqsZWN8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9029a813-58ac-4e55-aa4d-08dbc325acff X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:58.8131 (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: 4xb9rS/gvZ19DsYMqdo9I/Uf4RptW/q1aqZ+JJM8L2Y9Q61MTxWDFUifDidz1HEkiYxOblqs4c4xxtfOtb64Brn/aX8zLWwEV62DEaucZY0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On an image closing there can be unused clusters in the end of the image. Truncate these clusters and update data_end field. Signed-off-by: Alexander Ivanov --- block/parallels.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 7b16ca2ab2..48ea5b3f03 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1452,6 +1452,19 @@ fail: return ret; } +static int 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); + 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 parallels_inactivate(BlockDriverState *bs) { BDRVParallelsState *s = bs->opaque; @@ -1469,8 +1482,7 @@ static int 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 Mon Oct 2 08:57:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 1842003 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=ehQ8TsGW; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZhn28Bfz1yng for ; Mon, 2 Oct 2023 20:02:17 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnElA-0002AH-I3; Mon, 02 Oct 2023 04:58:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEl5-0001pM-Uj; Mon, 02 Oct 2023 04:58:32 -0400 Received: from mail-vi1eur02on20713.outbound.protection.outlook.com ([2a01:111:f400:fe16::713] helo=EUR02-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 1qnEl3-0003Qj-8C; Mon, 02 Oct 2023 04:58:31 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fZurBy6PBj9GU8qSPSc6wYJn+d5evPg9s5bOKaF2otiPAJX7Qd2jRlJsX1/xRQafUTHDRMk+8q2V29n/wWEu8HyDmEe0dhLI6N+E8cPo/+cAuCzp3j4UQQDegrpzvrJ7/dxyLpivRLGmcQ/1W3BqtOAr5A4ODX+n9vvRARBHiVlxX06TpzYjfdNh8vic40ZO3Fv+AdTpqbngbnJetP1XN4svXtqWIPxmWl5amg+tVXrylkXmm1Jz9IVbS+BMiTcKLrLoplDm3YQrtQ3Q1PZv605hMmV+QdCLRqJKMAaXKgM9LIFAqlm4rUvQ8rLjzBfPMuJS9acNppafL44ihAeMJA== 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=i01mdCxXv0Ljgh5IqttweH0L7afzOn6zNTQCBaD05iU=; b=AQilie4V08aD0JtqCVE4y5nYQcYwmTjaLkHSnqoqmcGMBVk/I67SwDxPNKvxXEHPaCvHTj5qCcbSvb5Ot29SP3V41Fe5Ts6T3rORrfx3C4D0zVzCTkMnitGkA7DpVJctkGoWcZ5ewpBZxiStr4AtxU2nAULZZPK6pM32d68E8qVXpslYiQhLbuzNuc0Qj/Z3SIorr9GZlxCc0wg9Djg3rwBMclrGmPywiEf14oebtQXXmUK9ZYshyOCxzvqo61BTm5O5l588rkWaV+jC3Vjl3UdrtNme4ZgY+KBpdI1I+OwN4i8YklspBbVJXANVlrzeDTrlBNNIQHMaQv+HYLaZnw== 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=i01mdCxXv0Ljgh5IqttweH0L7afzOn6zNTQCBaD05iU=; b=ehQ8TsGWRxpoYDa9e86WeMMvh0k1nAWUoAo1Nh8yxTPJB5ADWZ73z8kn7Z6au7MuE80OaY1x4189ctQ2ujOUHabmk2ZxNlDe7NZ6sHDpRWJVs96IrxfBkrtFcXdFfilSWD66hCY684yKCYOP6EzvfR66VWM1VFtrT6Fa5/gwlkS9n2f6a7KZoCBt2VR5K+fw+bb0hbA5z1Nz3vkbssbfFhmQXkG5w4rXBvrfVIX7fPOMgAa5zJ8Fd0RnQkFb8IGc+vgq+3+Kd6o7ZzU/apNMhbEWgrbSe2uil89g211aR74rMr2DScG0Z55ft4k5WkKJtMWHfE+O9xZfI+YAhehHcA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:59 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57:59 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 15/19] parallels: Remove unnecessary data_end field Date: Mon, 2 Oct 2023 10:57:34 +0200 Message-Id: <20231002085738.369684-16-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d4c757f-4391-49b6-b6c7-08dbc325ad6f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bwmgex3UjTjdcnsn+5qtI8fYEjV7OtN1NH6lujn+HKF3pgZVI+DlVRocvnP8WIkcF91oeRVBD/dF4L56Ymwo9bM4Jx9OCAkVplY6tGjevIuegme7tJFBfy8f6Wxv3qidGkAfbS/yLhCrTJmYTOSttbkjhkDEI2nUAZl2UC5AFEuU+T+U3VkYPrR9BlAI2PTGWVh5hqKwdW5Kn7prUlAUWphGMa57Hxkn0XT5JnJ5DDWozzprcDC1RdgmhG7c/ESiKN1wof3tG036Yb7E0LP2gc4uZ1VP7Dl1evUehkeSrB6DQz85qikO9fFLnr2BMG3bZtmmlcSzQ3HkF1TJkge7gGKNYVD24av0sKtw0jVo8zYkVyadV/293e2RyQ7sUCW+iFRhZfphF/s3vfAi5Bj+Mrq2kqKgT2C3/HzhPRtztJV0/yTok4yckjGwZC9OdSzAPmPV/zxF050lw9f0xzLbQ0xiDvgbPK6Bx5yCRz6JW/J+sq/p7YcmxDLfbQVpuao/873at1nbZ+8EYrDE0Kt7+8XTMUOoT1iDJJ7o1TepVquTCf4rYxeIgpb1xX8a2CvS/ipZs66DNY5jSqUB2MHtZeRoRSRfgVlZ6Qn+KnWX8rikN4NDOMeIrsl8lWEvqX1X X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FoWigg3O/VKUrBzHE7A1KBnH/NCUDwJCKdBBMsY2OT87oLIG3L4OdydXIjMMf+5aEm3cSxltovHcVGkv5/+oB5ehiPF2qzAg3cqClnm+mjtBanNXaWwuZ5/hfhpEBNT/iyT2nqgn3PTXmCWZ0kFMt6pT7oLSn48IqpjUhqt6OXb40M9GsMTcEm0Cc7LiuLbtAwQT0Ct9Ys5sC9ymBvnSF5Y+Q8T0io7RAUQuXFaVjdHLcJeYhV6L19vkNMS5G+rKYEm1iTUGCq8Bsy4hqt1Oa5GDTblgUK3TJYPlOpRaL8Va/iI6txkpMsXDllGKKSm7X5ZClO08xVLx0ztTZhiiZ3EHflUbCO8fKO9qwuH9sWBa499JD004AZTM7SdAJJiaOM60G51OnLTX+M6h6Cxfg3cCa49NGuzlvEoF0F4yG3IHWk0B9rJFbXDS5M5wbOl3kVcXs38XCsaXJ+kvnjstMTFpzeq6HmhchHt8ayz0BDNwTWj8rKGCA3/YoZLvJjqI62pZD6uNpRRal5KbV5xxot1pCqyOX6Hh6ASxpOogfwBW6IM2YezJrLAhq50Gumut5b7qoRZJsaJgGEsQffaIVuSlw76kISYluj6Pmuvgrc0kZh8xAfStWBOJD43ax3bbpw4prEpQNVvFeNgdJt7wGI/tY7Vuzg19eq2BaCTJyx0anal2YbL37CwlEZ3DaaE1FAfqPeHH9+BtTuWsVb4aZg1HmVKiGH1PA4VOw7P5wjbcQHW6U8MxNAirubCCXPqnJI74ziBMQ5Z9cpQMp+hf0rwu5RHntFQgCTbn7jl9Q/0M98PxOkfBk4LyhWZ2eA4HlU783wnFQIfu+KUYWotOh3sXtG/BaKqJ+4htkECO25wfhllMA84FTdQW/9aTdlxnhih5NBKWZ5waPTr2LqL1PHNprIUGj2AZDBXQWuFRnSolD6eMWmtpK1pkDpJH73ZYKdGZcAbMt+8vuSM+8Sudl9MaJQgnrAOxyfSxvEnjB+6BFFgoox5xjPbhiT+k0KOKXtaY5JJvF6X2DR9WZHZwrctWtz+QGHgOQ60Hr+VhmNxTlfVhZTIvEGNyusr3bVOqRDOttkz4cpQED4PCpqCIazET+DUWC/A7uV/QBq9BgP+B8gH6G3wvuhs2gachtTBM4IWpvExK8HOi3wisWFpxRIvefVOB5Ythucy4P98e9aH9TiOpBSdUkladGQqrqsPdPc/ppl5estF1CgdMlF36sRQBQw4vb5DDLNAd0RWCeOyqVx16dhxBaT5imkbucABRFVEOxvIbRIcbudPT1xj6hKtt7fALs0QY5y7SznGE89wspPZqJ0t/YNNkDKBBinsYii4znlZWYaHdkxV4HHSVo01KrNrM0Sbm0dUz/TVBfYPxPrb/XLqRHs2ZsOsW/nPFNgTGfG7WMHzyQDfp0oKEiullTm5n2FHZy6YdzOIjugSv3cV/jveIKVyXdO6r2L9ZQ3dptjXGat2Kvy3ebWkLfXhDlgKGarlBQ16+lGqPu7dfsw6EtSg28bsPeJH7zs4JzxbldkkcFV9WdEQ7NpRyPtR+FfX6ZwvMMjJNYP/E/3mXAyC5fwBJI7+s8y6RfnDqtMSIfTNhf36RQiwBesmgRwCvCJ8ItdsTA2Tk5y5xZzA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d4c757f-4391-49b6-b6c7-08dbc325ad6f X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:59.5508 (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: AQERfl6zZZNwYfJV7Kxdj33I1CtPDh8WQ9cQI5d25tFSIIHQJlOlSF79KwxgTUSLi9wxUt1LSpHDldGi9KZtCZgIxjUihVC/l0r6arqIrMk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 48ea5b3f03..80a7171b84 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -265,6 +265,13 @@ static void parallels_free_used_bitmap(BlockDriverState *bs) g_free(s->used_bmap); } +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 parallels_allocate_host_clusters(BlockDriverState *bs, int64_t *clusters) { @@ -275,7 +282,7 @@ int64_t 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 = prealloc_clusters * s->cluster_size; @@ -297,9 +304,6 @@ int64_t 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); @@ -315,8 +319,7 @@ int64_t 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; @@ -757,13 +760,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; } @@ -806,7 +803,6 @@ parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res, 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); @@ -1361,8 +1357,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... @@ -1403,11 +1398,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) { @@ -1461,7 +1455,6 @@ static int parallels_truncate_unused_clusters(BlockDriverState *bs) 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); } diff --git a/block/parallels.h b/block/parallels.h index 18b4f8068e..a6a048d890 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -79,7 +79,6 @@ typedef struct BDRVParallelsState { unsigned int bat_size; int64_t data_start; - int64_t data_end; uint64_t prealloc_size; ParallelsPreallocMode prealloc_mode; From patchwork Mon Oct 2 08:57:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 1841985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=jzDJ3Q8m; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZdJ6scVz1ypx for ; Mon, 2 Oct 2023 19:59:16 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEl9-00025j-Jz; Mon, 02 Oct 2023 04:58:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEl5-0001nI-1H; Mon, 02 Oct 2023 04:58:31 -0400 Received: from mail-vi1eur02on2070d.outbound.protection.outlook.com ([2a01:111:f400:fe16::70d] helo=EUR02-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 1qnEkz-0003Q6-DH; Mon, 02 Oct 2023 04:58:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EmRnBQj+9yMaIIUJxQuMWPDkWxY6pAKdDeK9T5y8+BoDQ8QqVaGDuae1fzcguq+BMrrQ68D6zXpTLwt7ptMQXb0bJA142KOAHkMU+qvMpJVttt7F1BjSQuTnrdwign0Rpqor07p5ws1nM9/SFl/0gg48v0WM4SLGSHx8tm4hMMYUrLSN+8wg9FHBSnfc97z5/qzYhFhfz1+Hhk8YNy/bczRVp0eR76BuebzbsSEyv/nDnJVId398sTF02iN2SuLImKLS/05dLxchHPUhNcf3qihPogiLNv4cZJZtz34ctIMeECM8XEHz6uJGhSAfSF2NB5Ygbbvq2VrdL1z7GOZrEw== 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=F13z9GiHPMf4tAoe613lR3A620NkyrVO1Op57HmuxwQ=; b=DNi1Jz3LsL6wcmgf3KCgGl/pFlJIE6/3cdIGY5KTr0xCJu/gne69aTzl3uWTc52mFQ3ueYQFSP0Vs1hWbgqT4h+PgtgGnXPChxBn5ayOotRyh8U1nT6Vrw4I/iHW5vBwkbLhQzAhpHSNaqBkGWjmXIBXzwBNC8fKv1ll6w7AEVd50o4uq3f5uMRAPtmJMP1FO/SGLXm5e1E90Ntvad9eVcqkQ8PFEJ7yRQs3yi4onbMM+Z6gP8uoHaRe4o9nHIENDpdC4C/Sz2PkJgvYs1FVUugIda3aF0N2w/hhkMxxzgtU0hjKycbLKPSgFJ1ikQmSYgsSwYgKqQzJEXYzuJ4hpA== 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=F13z9GiHPMf4tAoe613lR3A620NkyrVO1Op57HmuxwQ=; b=jzDJ3Q8mnEW66DV3rPHlkgAARdp3123hIhidkOtpEQpu63fc4Ul7SId6rWWZ4nHGFjqzf/qeA5gbVEIPtMgzj3HdG9QCu6B+M1JdgaPF7+NuleaBkoMuELP6fQzkkwtpQamHFgp+bMaONPCg006lMg/3aaD9cMp2obcqF/sTEvfHcVlWLyolmSHVwJJNEDIbb34uRB2Td3zOpKuaxwT+j3ku+OyKqLc5ETPl+3w+5bm1Csy44RlRyOWo+MWJvrX57B1D6kFHXANiOPddnsIGYXpR/WfVDVaBv/+9VyWUBXoXMYO2tY87KYmMij+3qeLDfmYVqTeHGpG+3D35Y0jiOg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:58:00 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:58:00 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 16/19] parallels: Check unused clusters in parallels_check_leak() Date: Mon, 2 Oct 2023 10:57:35 +0200 Message-Id: <20231002085738.369684-17-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: dbe92b1b-6552-41c5-3817-08dbc325adf5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QRZYl5azY0GYN3aghcPPDY/c3Oz5/eqkeIpNcgIElNKCFw+Yvh/JZFVuBf3FkaDe5OD0emqdoCxNmEanhIJ+0lR/KcmSqlxDMz4JVxiOvBEAW+pRT8ignqXLN+RSe8mdW5WLjCcWwSnTckYGK4pTW9b0ce2pog6/H+6JKxMdran4/7BTV78nFwEJCvEH/ESdFqK5xwEB8RxToZNezMv/FdhmTDeF73WO5eNuodaDWWw75CQzKZfUm3SPWMpTVPAv7eSh6Pws/hv9g0hLIYD/pL8IcHFs0iAr4wuSuEnsborZwc1+t8iV3BgeGsLWdtiESJrxHoNrDbqMgZlQC8W5YDw0prgRU0I2n33/CP15+a2jPU5LYVowaceCYMGFB2q7i5pdwGB3olOpntgplB+RpmDrwkkSFb8QH/Au4Gpc18WjL3D5/lTKq6Y6j+w1PsFtOJej6WJOc0gEJSjmgkzrMqUHXqC1qemMClQz5iROYEN1wxfCe9Oe8xXAuXmKkT7Z3J4vgDWBRU3uynwc+CeCKhGcQBk9a1msrC0Rtya4+mxCckJjcrUQ7m9vWAAGgRnJPAYkFcnSZig2dkKLzYwihI+d7H+xCvOJoII0wtSZsRRgIqWhihzQuLfK8v1/bCiu X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SB21NBxqtbK22Z00KPuXVhfw4VWHsXhiGKEoZIPPpgvlRizdZ2RlQUPmI2WqJ2mjtV+Rqt6wgt5OnhotgMrrx21ApcxYPBGgvn57N2YiorQWRkjqb8SO7sCkX9KiOKLO3GSVxPO46hLhTXPguQMGyNgZaJemQ1alfhBM29BZc4wroA5IwdKm68dqYCOf0a5CnDT3NQyos89fXXiaD39uXkz12p4oz3RGt2hF2s6yMMzGc28YrYxefnL7oAAfBu5YvBeN2fwqx85l2kxLwObm0KaOjk/4T8gHzTp5DuKWP1MZpe9/Yy3fr11g3+igAMNXNYoneOqtwkKeF5L0W9se48A9AwE73EFYXNgBu+B6JtqVl/We2+RBCG8vhuyjRrbIMDduEwY7D2orvptBbYCVjDzJqmhITlakMXvJIsTX0PRz1Bd6rhbjeIRWZ7UjRHZedPRPPa3Xtz5sn6Lv9+pl+CQ8S2aW34P05SVXd0U/f+va56elH9eDzsk/Nq78GKZ7igMsBxOxuUs6jvqiIWHvVI+ipupfmFtbzbuZiH4dR6O9bOIfDb0MFgupFtVq6eDVD9aCjNou6e/XvB8qhKdtAJBAf+RrQar8YywSbUVl2dkEHsywCUs2Fzmqbl1zmfhQPa3n3ovITxDRe/YQAWx1lWd10aSRFbm2mdcOtjsQyKs2oRzAtWrg4sQrIqZhwj+YKUDqOndDFysjvbaQwSAIDaz+QVW7mNDkzlDc6ctiasx0URXXMyCH7eOUOwsSFZyFGmNx2olskjdtvRQfEjO+yP4D/GeI7u52fnKeBBRUvM5XRycs1mnaoObWPRGhsFUBFqJ9XoddYkUuvbEeUQamPxcK0+WeoAcXUnjYoMbvP5o7UiLiRk7Rj5DqFDHVhqKTakSMLbuNsNNb/mm4TmdYzTE5x3vDaiJNTpyMw6APxWyLNtJI/vLwOZMB+oZy7cegRBjcCrTXItRGaqjrE2cG1hWRnxawPP8c0SZorgq5OzdwgIOKevaedI9Ft2gbn5m/peipFBTzzjydI3Ls5gO0HBNa2JOSsfQ11OISBPEbSaWOtV1j8NDMHDbs1MOseLNq+hFW0tCPK4lgCWEvjxX2Kur7hrmg49FFljplhRB6FQ57ysp90Xo/mdz/DK9tFNVzrHsWK6JHabPjNyWNrBy0SMmG+sh6ILwoq5lJTyHIbTAChOTKaKgdEcJASlmOGSxikPkT5o4Pl0cS8Z5bib8W1N+6EQWF3s/VTXd+21dGWSsWU8NgL0207ivBj03g4ij1ljucnz4l+Jvxe6QvkUA01nX8l6zaWRdYzifCfvAbENQiF2meFCU1Ha154GZoXzAg5Qbb/M/E/62y4bRxmfEP+hieFqAnV0TrHADpT9EesAfqEsFwFK4UmaqZQdoL+OCx/7KMgdpzZCDAjcL049gC1fJVIwvQs+rRTPicBHKCoagwDsJsbImJY8cY9EGf7U7N0i22Awi8OPYNQWchoXnkh/a5XnhH35YegIgc5O4rUfrxKlIWOdRI7H6sAQ2gW+LyBPLIPMna+ri8cGGMTDIHfqkNlhzyP1aJu57crQEvR6PhNspKhpf1xAfNgUpOqIG5RAac3z3+l3GUXtURG9UJQiMb4y3daLw+4h2eQ2u+8xM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbe92b1b-6552-41c5-3817-08dbc325adf5 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:58:00.4297 (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: oGOs5t+f0LiOUmZcZS8VSE40Zsd9uZUYipZnDAUW5dwtHFf5OBJ5FHu7oi9xzruG8WymyGWqmtPDwIuSYqKjEjARlfznJDkotqgoe2wLysQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::70d; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, FORGED_SPF_HELO=0.799, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 autolearn=no 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 | 112 ++++++++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 49 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 80a7171b84..053ec0f8a1 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -764,56 +764,82 @@ parallels_check_outside_image(BlockDriverState *bs, BdrvCheckResult *res, return 0; } +static int64_t 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) { + return 0; + } + 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; + } + + 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; - } - - 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; @@ -1446,18 +1472,6 @@ fail: return ret; } -static int 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); - end_off = (end_off + 1) * s->cluster_size; - } - end_off += s->data_start * BDRV_SECTOR_SIZE; - return bdrv_truncate(bs->file, end_off, true, PREALLOC_MODE_OFF, 0, NULL); -} - static int parallels_inactivate(BlockDriverState *bs) { BDRVParallelsState *s = bs->opaque; @@ -1475,7 +1489,7 @@ static int 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 Mon Oct 2 08:57:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 1841991 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=0BhtUgL3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZdc5VPyz20Zd for ; Mon, 2 Oct 2023 19:59:32 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEku-0001bw-6o; Mon, 02 Oct 2023 04:58:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkk-0001Ut-HK; Mon, 02 Oct 2023 04:58:12 -0400 Received: from mail-ve1eur01on0711.outbound.protection.outlook.com ([2a01:111:f400:fe1f::711] helo=EUR01-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEki-0003Rj-DC; Mon, 02 Oct 2023 04:58:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bU8/WF18e75/78N+kwkR4R9lJtXRyk/bQzlxU398mqxW8DLisP0DtkXGgRNhx/X+saGIFwRuicbvkXvnh8/Gqv4A9sOEN8HAhEGO4YUZk3Ni6jy2Nj3Hy6gJoxOHbYIRwK7ZsSCZ48dyyKPb3oCq5AZBkmvklqsEikRSxTt2l9eYenZ27Mi6jDzPI1is961cmygFGhQ5QQfzGXB0reBmLKX5MKO+sUnyT8cM6Tk73O+yyPiIETIidCS3OwDXm7Rn+3bWg6QdhZN9VHnHeuNE7N59suDKW21xw343Lbadj+wlClEkNBpA5ckxzbupzBfuZc1QbTvIrbTZzgte0mf36w== 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=4zloRtBnEJvFUj7YTAKRwLq9g1gSpQBj/d0tbWJDAC4=; b=dMXvWTNmZ+Y21GZq7RoAu5wtHB8QfK0/uGbEu1q/DCrq3C13/8uftn9AkAsYp38+yZtKH4gG1fNZb/eanEOXfozpuZgPyvzVHrNxDCq6RF/T/ciqR23T0m4X/o9+o+wc1AQrJxi4G4O8oRBYeNAdLi9oZjtxMQUd8GF4MUSMjQjJ03XIMScgcfqCqMawWCcqs7QppEuDVL6d6txU3sQQMT5Tqn7yFF9+i2zuTykVtc3chcxJ9xzuv3qF63RHYSnb0s2SYwII8+gaG7zKqMk98pvUwvxkPIqMBUR+0mofoh9wx0VnmxQwjof4bX+PyYtZUzBStD2HEncXREa47drb7Q== 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=4zloRtBnEJvFUj7YTAKRwLq9g1gSpQBj/d0tbWJDAC4=; b=0BhtUgL3FTQGKQ41Gw5kDjxAifoo/dBqdd6t7DFL7kAMwn5+TnLwZNFliLvXCnzxpumgMt+2MMqmuYOMpsP3nIuwy2d2k/UMQ/q3QoWV4Aya7JlYOPFyTXJpGJdrQ2IYr/AAF3rl2o5Jf0viz/da3PQIxgS4vw7iInxDNXqn/efoXL4WOgF8ieD9F9aV0DHzo4M2MjBFwpJirXUjT0NpzOtQuB2e9CT6IIvF7H5vtG4GUt/nocuIe7rVAHoSVRO2u9oYk2sgZMyK8ewhbVWvsrkneWvN2cxyXzllEuL1HEF0FJYRP2RP6NHAdhT6gSI4mZEzVKjFlK23RhknK3Op8w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8657.eurprd08.prod.outlook.com (2603:10a6:20b:565::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.28; Mon, 2 Oct 2023 08:58:01 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:58:01 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 17/19] tests: Add parallels images support to test 165 Date: Mon, 2 Oct 2023 10:57:36 +0200 Message-Id: <20231002085738.369684-18-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8657:EE_ X-MS-Office365-Filtering-Correlation-Id: 49aa7eda-d4bc-4d6b-a6df-08dbc325ae67 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z30tYsZB2IDGshHLOF8lMveOr8EWBp1PlX/YwrqkhWZA8XOg1FZJWL4G85V80BiW9dCt7ETkG/69D9O3mqN3mJQuZY+rHwqRAZnRxDlwokj4W5+krXLzZ4+N5gss1WWV1g73Gk0TLTaDdA/svB6SviTCzMpVfYtQBrWHnPsF84OKOv51l4D4Wk782OxyJHcpheSCNTzO4XVG0ALYDVu5wrYPti6oFxNQmBVGiYkZDxHfNfu0OO/mqMv6BSGDICiT4KaXzcMM5wTZqpO2g0wDY8sZZZJ1lTc8rUvsBYP1z7stwvq74BoZlZswIWKI13CBQiqzW6Ex9+5cOybEmKzbJ23SPF0jflRK8zDNtd+4lsUlsK/e+zvXuFp6eJwGGw+9GyQ8xnzhRZXWPeroEFv7rnA8luTtIYra2v75cgSWWVhc80EiWOBi9UzyuRdFPOmWxwbIIi9y8c/lARddYFJC1IahN/MSuuck9rCjFlT2qdw3fvm54syh1gHED09pWwD7Rr/kpxxsGKPGqxBCLblODWkPE0z14AJ0IejWE9nO4PsLXmpiXU2ei3wtzOremPuUhwdug/RxHEbGDoLqIdaUB8TpOtqrFXqMcWfmOvCcT75iQG3cZgtm99b4/sR6CUiV X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(346002)(396003)(136003)(39840400004)(230922051799003)(1800799009)(186009)(451199024)(64100799003)(66946007)(2906002)(8936002)(8676002)(44832011)(4326008)(6916009)(5660300002)(316002)(66476007)(66556008)(41300700001)(6486002)(478600001)(6512007)(6506007)(6666004)(52116002)(26005)(1076003)(2616005)(83380400001)(38100700002)(38350700002)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CPYpIx0pjlSCbWEEK90ebc+sq7NNPS7QIcNzm4QZEYcAsMhbZWFVoze2Xhj+72ou/7AnM7md2eYjXU/2ra3Pe4rIKbR4K1WeaBYAWigVpCmtdwsTXtqvcq2dtCD5VeUewHZmEoljwxm5jC7fFL69H6nx88ABroCXItaIGtk+Y6MLKH1wfhHFbRB4d3kQChHUYo9yqgDei68qLfHvyiaKGIA61omrZK0vls6xSY1mN67vW6raqiosS3ft7a4GvcEbUnAWmqK4fFQlTOdqyIxNExpN+Gq9DfApZmlSWeNPQknucHjNxLKv+mWZbfIkj1fHNxL8IpUHMoU1EgpAB4/j39uJqgN+dw6d5G4n9+Yr4Fnnkbjh87CxjXp/RIku91ef6n5+TFVo9Pll0spBDTn8pJ1p5u5OtbHDfYNwAQxDNWAjFxAcPP4kp5ghGyNaXd/9qKOU8RrFaPS/uykbHPG5jCMZvPFlrcdtO6whqNJ1hRHpwlzvmRpb5aB+xaOnlYnYOmZ7fcWj4gGLbnm0MhYWg/BCkJ+wV2zs13qPy4P72FiLYC4zbSD3IBfeoBlOhQyMpsNmQkxLGwfDJdGFjEMS5Bo2hbltB2CZQI2auON0C+Mq8r077LMQMLlNPkHzmqajW1h4YYyqTKEJPWrIYaD0BsO5WkawMikjRdn+BvLtfLXcrTTg32HFNOdd2TopQc4TQg1fI3sjYJyFhLHI0gzM9goEd25Dae6bRGFh06E+2voYcqkYRAy5PEl+Skj9ouSpYC/5Ytnwx48n8o8zSbYRB4xuKzgILvf+6+MAAApzXy+s8mOfa0QnFmWMW34A9UBesYCi6D9KfPJsNUZQIDIFWoDQFqWwTle/DVwOLTJaJd7puHZQS8rj9F9AtYdGFXzYLIN/TkP1csXdNlcUVlgQj6r8C+k1kBWSu3NATRMkMRWWX0Jqi6sGmxdDfhLmDW0towUxokW/0SPR2e5txoHtIgMX607WwFKshcU1KiN/VBhIRNKQBgtr8R+N6GCEPpPjv1V88flvdfY0Q4hL6amKnOeGkfmnQDmsFIh66rnyLNYBoWy4PvEE5InIyAStrxAixosM6s2OevDQlscZcebSI22n1mjPHfzLXXbBaGITA0wFTD8anpOn8jU8oC/dfDvP19wgqMF5Mcb7iqEZA7jRRF1b02Q1UUJY+p6QgG/U6Qc7EpUCGcA7t6scOyapDF24szvwCxBHus0pA+sOjUOKkxn96hczxHGMS2TA3f1Ofe79F6CoVtLKGdaxaTJned9ybaJNxxlv2icvWvAGjt0wVamqpsbHXmuhhedCaDeP19oVHlDv/qEXQywnZHjlUwYSfJvTu8TcE/lqoDdaOWRVL+Wg12gpF+X34/HzQJaz2JuQ5PlmwpCUi00oga7Sltw5B+NLJLfbWi6CUF4UJ65YsLStjm8U+4iYlTWeNKRxxBsA0gQ5gT7IoQdOlUqWBGgAhYxm2iAkDNAuhK3PHuNcr1qGibq1l8UGVMKJB8i2XVDTn6lY6dP2J01YIBNCqgAbyEImDbF6QqzZBuZ/sKMvFPVcGXnJiiSbecffplDrF2aTTpfkPK78AMww7sL/DKKh9jp773af5Hoxh3+tQIgzeM7cev0H+wIj6SGdspZCrSY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49aa7eda-d4bc-4d6b-a6df-08dbc325ae67 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:58:01.1607 (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: YxYhmidQepsl0eiC2xXZZwUs2YHJzIKuECSAESg3ArC05+cXqAchA4sak+Ss/acssE7tkaUaRMsVF2kbs7ctnWWZfzubmlSxE36FSvRHqvE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8657 Received-SPF: pass client-ip=2a01:111:f400:fe1f::711; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR01-VE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 index e3ef28e2ee..3181cccb89 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. result = self.vm.qmp('block-dirty-bitmap-clear', node='drive0', - name='bitmap0') + name=self.bitmap_name) self.assert_qmp(result, 'return', {}) # Start with regions1 @@ -136,17 +140,23 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): self.writeRegions(regions2) assert sha256_1 == self.getSha256() - # Reopen to RW - result = self.vm.qmp('blockdev-reopen', options=[{ - 'node-name': 'node0', - 'driver': iotests.imgfmt, - 'file': { - 'driver': 'file', - 'filename': disk - }, - 'read-only': False - }]) - self.assert_qmp(result, 'return', {}) + if iotests.imgfmt == 'parallels': + # parallels doesn't support reopen + self.vm.shutdown() + self.vm = self.mkVm() + self.vm.launch() + else: + # Reopen to RW + result = self.vm.qmp('blockdev-reopen', options=[{ + 'node-name': 'node0', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': disk + }, + 'read-only': False + }]) + self.assert_qmp(result, 'return', {}) # Check that bitmap is reopened to RW and we can write to it. self.writeRegions(regions2) @@ -156,6 +166,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 Mon Oct 2 08:57:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 1841982 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=IhjmLfTQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZd46Qydz1yqQ for ; Mon, 2 Oct 2023 19:59:04 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEl1-0001lP-EE; Mon, 02 Oct 2023 04:58:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkh-0001RP-56; Mon, 02 Oct 2023 04:58:07 -0400 Received: from mail-ve1eur01on0711.outbound.protection.outlook.com ([2a01:111:f400:fe1f::711] helo=EUR01-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEkf-0003Rj-72; Mon, 02 Oct 2023 04:58:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OEDjFGXBk4jPBdsOdb16U6Dt3DwNnYr0wXF/MuTJxTZfs7Uq6ABc84BSRydrONUZNWaENmZKxrE4LWjXx/pdyvOQF60sJXar5Ia0TOMhKz1CWSMMiyTJKg0Rw0v7aiYPosrlaw+vGhkWiWswyWySD7tbImEDWCArYpHFZ1by0PDVnbETjj0fskqkKyyalqFdDdI9jN6IcUBAV2QidyvVrnHz9u3R61BsyHm4mhd4GQduFvqmpGWv4rsTtNn3L1WJEGkITF6NtdofiFppghJV3NgISQbYvGEucI/fIpJKei3TjV19JiwyMpp1Iwix2Cw6HBGTYbxu8WzKq94oxyBIYg== 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=hX95/OsRXapbuLFMQW0E3mhRS4vcJN++F3Atcc0YZ5A=; b=bBvzObPxILK0m3PeBXIjA0kbpIvq15vg/wz5MphxnN61wJBko4QUpND5U69xoYdjXngbmig7DXBTap7oTFNL1fYjUdKKM5wDFihn2VU030BNe0c5xQvEbySxRBWC7aJbSGwIWZtatB/uwkVHmOuB+e2Ugrv9mV6SFgi0EsrSxmloWoChJ2Lp2Sit++QXeUfWR0glEKa9nwS480Ws/7mvklwmsWKe42QkV0BYBfcfRG5F9kHIGaJig1j5CCbILeW7s8ZKh3TYpLunpTd/ewzL/q3/s3tBNdR2s9Tddl4XQtxVt7iDxB8GJIHShok40CSGvosa1P2iQtzwhwl3FwMfVw== 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=hX95/OsRXapbuLFMQW0E3mhRS4vcJN++F3Atcc0YZ5A=; b=IhjmLfTQdE/giYsbe9AsheYTk/HhLSiYkYGD3H5r4RPYn3NH0zFzZFCRtz4W7CQCPnglxw1BgOzKPkUmOkYTcxfdcXsN3JmnQfVxZvp3LTEpodMDAmGvOZXcAaZjoHO5geaTQ0OmZx9Skw6EQ6NIjhxRRxKUqHTh/IBwosd/MbDhNgSAHiX5Y6wbywymz6yjeVYtqWaUB6YBpWfG3muivmtjqUn/fvuOtlVdHbedRgdEMClDOnDWJdmrJBO3SvzeXav8on0vsy8rtnVPJ55Ug4z76RpJ98ZmMRjw4nCgaOVCmNF5uKDU84N+dg3kX5sW4J+jj3klYeVLh2CPey0IHw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8657.eurprd08.prod.outlook.com (2603:10a6:20b:565::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.28; Mon, 2 Oct 2023 08:58:02 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:58:02 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 18/19] tests: Turned on 256, 299, 304 and block-status-cache for parallels format Date: Mon, 2 Oct 2023 10:57:37 +0200 Message-Id: <20231002085738.369684-19-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8657:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f2b6ec7-b67e-489c-77fd-08dbc325aedc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 23Nx12nENEU9A4bPhZ1GNrfKwU3NT0g5yyghX97mPKZnxjS72jZQ9uTVX+9j54xkgTayGP6HcmjaknCSLkc88P7Fty+79A16+RReJj4EDOMfwFZmf2XCtyARdylTkm9gt0qxO+dPny4dJh3a4RHttFhKOPt/R4Ui8gNY9yh0bB7FBkctSELcd/IKoXcsWXUfb58d9ycFtzlSXEeajPriP73sE75UbapgR4gmpMjBwdI/57aIRRl1n/tbjYmobaXz4LJTa+YoQr59Pbrb4sDQbx+1nEXb6v9me6PqLpMVU4A9I7Id0tLHqnKPceKc7wiO8Fb4p5JHRbem4hid5ZkepvAldgGubRADzr1/SASq3n/o7PoTf10L54b+PWkKg0yOoPhQ+FiyYHQs+6haLhHZTJpASHs6fAGozT8EFJ7V+xFMg/Efr4dyFSnlWOinT1dQAsuTuwx800UwQA5XqsSMdVVDFYmxWImu25a6+QA2FupwtFxgiiMnBp9YOxdQEAaza70V4Y+FhKdmF5qr+NhHCogHE02QzWlPuotRHo0yPeoJ4GASo+Ve63+9E4V73sMR24Fwe+OyLtde0rEiOPe3mvbwX6UXPi5PsZ9SAoL072Gc4pk6IBjj0cFpH3CyRgge X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(346002)(396003)(136003)(39840400004)(230922051799003)(1800799009)(186009)(451199024)(64100799003)(66946007)(2906002)(8936002)(8676002)(44832011)(4326008)(6916009)(5660300002)(316002)(66476007)(66556008)(41300700001)(6486002)(478600001)(6512007)(6506007)(6666004)(52116002)(26005)(1076003)(2616005)(83380400001)(38100700002)(38350700002)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q1X6vyItI553iUfQOvhfDOoO39LZ17/lszeSfCiZxMLEIs0bdGDDolRgSqLuxg7MCAusnqvg/W0CHsMKXEioF5o00j13+1HQBDShOPOqcoLletKcQvajKkwAigoIaaVy9IKHeEhXrPbyymHRX+evPffUyJJPcgAZH4UshtXarW7LIjktksSAQB0CFkBax55BcIb8VFzWu7hGDiOgNKXIsPYTPY6exxr9iyfH6f5oXQ7ZQk+IKI0+CIQzhZ98MfnbZNhH1TkL3yNMUxdWX6GN9VV1sv2gYvKNhAJ4RwEVla0BD/oBMHhF8bO/mO8jRem+Kc1lpITZ/VFIs2B+3YoE+PM3MGAE2nEbt1J+0QqSFTIuSLkdBfB0MFSxlKSbe28VA7q1w0oIA4AUBuMjBobmHyreYg7h72ITkgQj5eLenMtiXkxys4cOtt7PhciFT8mbI0/dzLC9koHh8kXBXMlcL6J3Ila9YK0ChdubnXFpX1SlZcdmWDr3gQZUK2n3YbCBJS7Tb3ZSeD6leDmZ/cVsqBpWlXsljBWxk/UKDJ+sbiLzThxyRUZM2KLabSCUq3Dy0CDDCkV9LZ1980QOMP8ZdeMP6OkNHKJu9Ye+MTC2lQCQCxuHnkR5OQc5Ba0EDxcKmtZWL0MSOGjPUrRemhX3btIy94POw35jnpRMhz1QUZjJ8UDYHcqNwsMxeRsmqUiMS9g+3ZP1fc7eK4AIIIfyyiVPomLXD8L2ASnJ5hSv+eYQxZfQgsMs+9qn948MMj/EFIpTH1NOKjvDjG5wqVmDWhy3QN7ojaP7qHrmElGGWYsGPjEcyLVB64wtwPsna3fbu8VFXlW7fVHGHb27UnB3Jtv+6JvMNvnjyolrTeIiWwhW4BFN8aOJmmc9S9aF/mrwF+Q8JqrMJ+GTQWgYcdVcyc8G+5GGZ6MlCMipuF9yi4I1vdZHum59KeqVIQCEvD7L6Cw87bBqJhHW3iEf6JAUNtoJHkV3j+6hvV/AP5TO9BSN3FkZG2BaSWKTQOv0wXcgowRgIWc0RQOB2GUvV8fUC8sD2e52o0zOkXm9DU6TqSgnKsq6G0Se54XoAHn+wJJxllrOpX082he3dT4SFYA54fnAjnF5VxS+nZ5T19ZnnEypFxS213WKhwXxd9YZkZ3xLv3rhpPIv7lZxEhR/8MTzHz8L0r/tunYTpAYtgkCzDLs0o4k6orT/oEIVB8lb8OmpH4STHm40w6w9XMVbjhkXrAQyQFKQ7JZ2ZeBrn4/KEq4qqnTyl+pd+g/uWTSHrpwSK6jJ3Ciko9ry2zpgrBTYw4BzSsTVrTTk3POpbtmrz7XLOAH3Now9MoTLBmEY7x0jK4XAbUOWRtsTZ8vROk0Kp1uQO6Iod/VeclVTu87dt7pVGRmAz4uM1fXK/oLop9JncYq/9YlHZNL+yMNmLKjl1VC/MscS8Z78lY1q8C9Z5YVyls+oDRmCa6cEWjtvSHBQX2i4Qtu4f/vlPxGj7ITdyNZJ2a4EQQVsxc4jXcMf8N2vRhKGLlHwrochkWZ4A+NM+D6gKJ7Go7DjSzTDvVD4dT7XkAS+pdsAfVKebXNV9EVez+WwRG3Ez4rSkZFvYCdIc9Q6NeWpwV0NwuBb/UttvyBty8d+s1EevuEhR+7W1w= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f2b6ec7-b67e-489c-77fd-08dbc325aedc X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:58:01.9802 (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: YQiFSI7z3w4d9AearKUNvM/v7oc/AbP4dik2s6HE9tsf7Gd2fHNl5yXnGsCqU0fIXblflKz8g1wQ/1MSx/NBfsNAsQc+QYyszP+ZVJw4INE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8657 Received-SPF: pass client-ip=2a01:111:f400:fe1f::711; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR01-VE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.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 d7e67f4a05..1930bb017e 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 Mon Oct 2 08:57:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 1841983 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=zX77d9xx; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZd443cPz1ypx for ; Mon, 2 Oct 2023 19:59:04 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnEl8-00021m-OL; Mon, 02 Oct 2023 04:58:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnEl2-0001lt-Hr; Mon, 02 Oct 2023 04:58:28 -0400 Received: from mail-vi1eur02on20713.outbound.protection.outlook.com ([2a01:111:f400:fe16::713] helo=EUR02-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 1qnEl0-0003Qj-7e; Mon, 02 Oct 2023 04:58:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DQOJMnfOX4pQJycOSTguCaEiR6FfG4zqKVLCMRKGUByK5VLrbF0bApIJxe/4nCQL7JxmqfDsI7U1wUq1GO/oc4z886Oz7ZjTctJtXrf4gFtkFQLXg8E0Xs1928Z7FWoK6if03QgdfbWDnaoo26rToOSLjqJTdLbQwI4++Wu3F21WgOFpeQN8LSwtmumeLFP4Dkfc2QW+XizWquHzfG94iqfgKHdfgfq7i52YKnbhXas+yCgrTNKCf7y3kFsaCUmAyhchuTDXo6d7VkF9JHAkjO3OD2pOlwFlHgj13jC0ofe0dejUSBH3GyO+w62AfF6P7T+uxmzqVCzoOAN4lHZrUw== 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=KC/FPAuEawG9LlBXDeoWQTZvaiZbwgBf2K04C4SjZCk=; b=WKJU4zmHhy6kqMBGOwxRosTfINYs9dIEwbN/cKhv5hO+jAqRny/SmV34eSbuvCZGNa08nGw5Vk5M7P2bgLfuE90s2kSYoONfS9gzhEgDFpWWbkRVl4/80UM1Q+US/wDuBhrc9L6U6eJf+nms1K+Ln6CIunIEzJWSsNc3Q03ENuOw/HCa6DlX/6ADi4g2Njeir1xkdfEvEjazo37Epl7GOXNI3kHu30NprVCIjIJf4rZlWF6WN85fH5+y6Afgl+ZLFMV6M2kOSw7tL0j/gGtby4a2WaPcDA47vP0g2fMcUuJFqvzUR9zLbQPs4IluXqNBEEjEkPnjcXIcQVoy9IGZLg== 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=KC/FPAuEawG9LlBXDeoWQTZvaiZbwgBf2K04C4SjZCk=; b=zX77d9xx24DmPM31oulxbzJU3VyRgJx8i958Zs9aO2mtJXIrJucARaJ85TgKgnuzs53xcPQV/bXXlA4Q0OKTHdaeI/HM9LeMR/ZXjlL5wO8umZCKGsSeWrcwt+1SqgnnaWTxVKkQVSHTpMSLCvXv+oU5ILu6tiFEAqnoDM31WNxJXYZL0vZI4R7pW5sBsKNSMYKhNBJClxlEhBXZQTU90oJYo8t/Nvaed5s7vwDWFI5Ay44oJAodAnh8zQ5ZQ3A/b6aP7gpCC9tLwNyrDWXTug6ZkZj+xzgcrDuFNqIfPW+p4LCoqdZhnHUmz0gZHXcHui/GWfbe8tsx1Pm9BaP9gw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:58:02 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:58:02 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 19/19] tests: Add parallels format support to image-fleecing Date: Mon, 2 Oct 2023 10:57:38 +0200 Message-Id: <20231002085738.369684-20-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: 613c4d8d-e5e9-4ee7-0dbb-08dbc325af56 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +ZNkbE65U0nns9IfIVDuc9+f5QVDjRGuXInlusNQs3Gw2Y/JcGPEFOrP7IIs7zOEsu+h2qhdaAW2T2hbU3LXUKpV4Di2sv/DPKL0LU/65MFkc155qAYWJ1+TYRR7zyiOyNTGbGp01Pv+PCDGX+Mb0ZJlLhjagSLYE63PVz+kLTP5Go7gy+QhlWzxyWbrx6iVhsT3UxxbfQ9uOLcTflFUV9FLTTmaXU2mxs6lseJnad5+EGp+lB+eX2SqsJVDu9uz0YAccIDlrm+452ScCjvU6erT3W0Wg43Q7GMISegcd5m8+0wIk9at3unNg0XvpnHPLo8LlvcJFeVfFN5j2FiXTuf7QNan8reUue7CNpH49FHYhwAf6SFUyHT72fvZNkD0mxmXFIhmXLmgiQxiG6AsDxwaqfFmC1GQcWnHVp1eY/qZPoVhvbHlkGUTolm4Qa8OuLx8Z8v+vTEyifVYStU5YQHflXzA1ssaOof8JpSDgCaYeu3Re18lGSfd7cLM0uWZZ8EsiPj8Hpgi++lLqvwB4m1dw9JjcduqNMadt+NidJiwPio5tLKBfAtBoPUC3DAX6JETyYOorbvfcOVSfVacoohO+5ci0dA/zQ2Nu9S4HLz9bjv92U5+8p+aMJKG8gNn X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xG4YFEtM+cJuXna4Aww/0IkTxl3AYhvP5TiCy6bKpUs7t0Nfbgjct+JOPynvMQ+2qAOr5tPFS3ZDTqsSo1P0t7cQKhGub+LxMnmmt9tpvcX7PW5AI5b3GOC4Pnx0/9uNLb3VeeJlsVBIzkTobPy/FOyUGHvDqu44lRRMlJPJL9pWn51KUm4IvtG8YX4d0Jsj4x9NHOGXIbpOrawvgtQbdFC9g4x6RJ5oNiTHiHkX5qjlCwigfPoTp+XsakIssSxJ7IL2TQzz+FcL3Qk5t+IGTeGmh9ZBqJosR56siroLBrAHlPf+jOBi6dDTUzN0ir/bjxWXUdFnQdfgYKwgpQDyqiB+Y8blaqQrABIDBDPU+ZzmF3ocbCreExZ4Rin5bikC8dUvKSEgz/Bi7uSNnHb5nKn3ksN3ZjmAITgUNQNtLp7Nk8APV2EWxkm2YLx+1xA4huZmtjdQ577DxAzbi16j2hx2jGWQFQLO+mPmKJn/7jO+725Ktxi2ABNNL7LrUwQgdHqloU1nTqzKz9zDyd1twOw5xVdzyMz1xAoR2PBMPbjlmy3SjWky8k5B4eIli15NJ2+iA5gYnoSoIWE6Ljw7JA6ws1cE9Og3aXxWIT3EPJ7lLD9dtnuT+d5OrzHh2Fw8B3cfnn7h+AhedTOHR+ozRExv7NVHu17pjmtPWYOSeEUlzEvOABOMykiq1q0AijNvYFLWO1pJzV7HDUbqRuOzJjk7e6MUgHiPjvvqrMytnc9PSXPpynYZCNzI/zofVPXitMljFLP1sBJPULBPLrDLvmtB4COe82eHEOzeFtanVacRitK8V0zRBrk22gVtE+xFNojT/Ur4oLwbecT5OZVGO2C0QNNH7YKBU0afZ1DcAivEqY5acX3QU+OwCyZ4l4E3kuQg8Baf1+ogG6hXMyFtNMt+z7jK1h0l8KWn9a0zs8+lPvcmoKt+YfCUc6DLWz10eW7ttzFdPDFpIAgTgPwTKW+S1NBHOP+PWjUoxQOcf9sadfuJDUzMrYpMQaICDLej2/PzA5tN6TANlN+y8h1euR0NQYNJVvlRAAQUACrKg4pBDbuQKxwU5ZFeukNTrdaycE9OeQeKiEGsIvBHDsktEvF3VX9DK1wSuyhfoUASzhq+rqzeJFyisZ0nmDTlk2f7ThHNwZ3PW6RXSRCWcHHonfj8Yx8Vz9YipCGVjCNgWBeVw8AANNZm//CSrG3aBLmeP6sjQoLxN0MHwN1hN2++ysL1Vw7CxA9hp0XE/Igh3aaQlJOpysWtvfuIGvj9bgSj6b3HXa/wDQzPV9eBv4+kr4zRPkosR+gs9Zu3G55WNqQXMnvbrd5scd+Oc/ju1/pcCaHclfFucTiHT0YAi996CeVhB/GdHM47zuoYQxKB7TzOkfrJifRclpuB7r32Gr0sdTbvlD3PJiaV7lb0IjGbz6/CjEsO3f+VJpiWI+ZAeOWdbrZoWrdN6z1MdJoFzB9cnK0+HyI6fbUOLtV/hgF222OsS7xLUtIgN8+aaheG54mNogBy0uI7Rh7CghJmjpsYIDTbeXxaIQaV5FpRWwCarzA+Lpyk9ZISZVGwqQ5zRx7DjpQkXyOuqFr8IB+J+jM8s1acA9hJHQ+ykxb1XgNRm4sK1kaBoESM2dZn6k/7QrQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 613c4d8d-e5e9-4ee7-0dbb-08dbc325af56 X-MS-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:58:02.7734 (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: Fu5lxHzH791cA7SikQJ9mkeLZCuv7NVeyd28EjxhKoeTpgxQ6qxW/rpvtLMy5e7CaZZvNyQCmtbiyBgeLd9BNAjmJMROm1/2DAAQYs66xR4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Use a different bitmap name for parallels images because their has own ID format, and can't contain an arbitrary string. Replace hardcoded 'qcow2' format to iotests.imgfmt. Add 'parallels' to supported formats. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/image-fleecing | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/tests/image-fleecing index f6e449d071..00d7f37af4 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))