From patchwork Fri Oct 27 07:46:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13438170 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ABC08C25B47 for ; Fri, 27 Oct 2023 07:47:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZ0-0007KX-NB; Fri, 27 Oct 2023 03:47: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 1qwHYX-000779-32; Fri, 27 Oct 2023 03:46:57 -0400 Received: from mail-db5eur02on2072e.outbound.protection.outlook.com ([2a01:111:f400:fe12::72e] helo=EUR02-DB5-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 1qwHYQ-0003oB-1q; Fri, 27 Oct 2023 03:46:56 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IxgoRhwzZj3oSuYQNP9I9gDakOwC57VLSk9VuOaA4LJwPoV7zzp2dsYSVS/xPEeZm40CwdE5xzdKbgJlIquhZmnyInD/G2cMST8xk8JMd/6IFyteWfzfKLrKjaSMp1iZc8hTZuIY+MR7m/NYXYGHb2C6DqXYFZ4/qFpa9fxBPeEfdjo0VApADC4YlHtqyQtMhxiwTEjqvZy6brjWM5NTY9zzhFKM992uctSY89YnCPfgOR6PQCMMm5WHiKoldx/X+74kOwYkDnEe6T2HREsZMKfl6zcmkzWhE9jntEzobpHu+/zFNMIj9NN+r2dzOov3O47QHpZBiRmQMIVXfq5Ehg== 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=FJX5n91qwCXUk4APlYK8YlvcjkcmYVcnzmXsaC5WqA4=; b=Jj+RvAEUBGItpsV26wCzWTclzyKUScDaZMoJrWL9n+X4pEyLZG1nQ0ls83/Hx9hdoMLONLCYiOGlogzczsmuw+yCMPOCsRawAHbLC8zkJUbQ1yTmPgFwUaJi17Bc6O2PflZFokbkk+D1ZB/Ijtk6LXFzm1I2DzA/B7wIdfGJ8BS7EnFkbePLYuLSrENoMS250K42Vof8ggGO05Q6PhKyJCpDh7GgDek4HjlZRUKSA67CSpSmTSzvZMIBSmBBu4LcE7HaKmrsry4uOHys2qnjN/SRVhGJyRV6/wUi3Di5dutOsq1dPPoi/pkal3tnX0IkwUkbmMJbxsLfcXZvAMo7GQ== 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=FJX5n91qwCXUk4APlYK8YlvcjkcmYVcnzmXsaC5WqA4=; b=Uu3b+D4kZJHYlbuvDqr3/7Q7Bi2S4Zo2vX/ZDgikCyIq5pJj5RA5rCJKy6qOXvfpUwzIRijIhAPnQ/mnVzW/T86vlU+ratd7mfbFZ5Raakr44BcKPMOQEn1g29UFN+shCjw10FxShM1lwoUzh5Z9u3lzyqCYCSn8XOCtbkPuAtWoaSxHSrDphTuq0yyLyUt7skeEGWqcajfTgShvXNHfKDc1z6Ly7fNoqjj1PRkYz31l1O7Bl34P5X4vBVCzVeeltUQt4UEto55cQkbiaAzL5wG/1uvGc8ZVmaxjOiGCHtUR5LewzbNKUASDT46L4NhidKtSSvRUzWGHt1TUfbGEoA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:44 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46:44 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v3 01/21] parallels: Set s->used_bmap to NULL in parallels_free_used_bitmap() Date: Fri, 27 Oct 2023 09:46:16 +0200 Message-Id: <20231027074636.430139-2-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: 02d922df-90fc-4de9-17a5-08dbd6c0dcfa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: l6szAIv1YtJcfsF+8i1hfK/JexDwI//DjRX4amZTKZP0LWxEWTy9r0AatzBmkA/acireQ5I/P6+g6J26g3GDHEwAcqPNoxlCuyRpDz7Q+SLH8f0HOoXv/D91YAYTpFyfuBdfYFn1YMhkix+Pp6RYBNcDQ/AZB/kLN3oSwTJxmwx/crBYHyPbN5TPq27iuAoF0SffRKZEniwNdO7xBGL8LqM8YA6JvTvl9BoP+QRBpOOMJiPYdihZ3IFeClV0wz5VZ5AezfXdxMDNdomnLXSZTeESaqfrS9Dpg8Kdcsj1+d14sS/0aJyy89jcqLyseMC2WvLIWCFsP0xbEKRWBYZ3YWle8OC5JilJXT/gE/rwpy+O+xrbKdSXQcbb1SWbUn66G6UPA8CxLU1FDCMQXQY2/MeUvb5scoaYG68ahye/U/yEKFLWQyFVNmVP43I0/wQ57GaZCawcKq38PJYi5uJygxKNbG6goIM1lZdT4rjrXjfp37sdmsXbjpkQDAxwTQv9bL6FhXHQ9q8k0kiuYhWYFBoPl8cBcsV50fDWidkH0zyAHqA1Nam9GrWYuRJ0J6bMZ6fK0IKBbZhpePAg65kHkVWfT+54g/Pb9I7kJ3+6n0MR2/UermU0STHqPEHFCnsh X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(4744005)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zLRI2Vo2WOxY74wAfIHcU5LzLVeOQGQaxHb+USoYJHt0g8dq+wxcXaHp7TukQ0Y+AEYd4Dbu6HB7mxS1fi6UOP2gaUudVGfxobUMsEL3LDcbPenhJP77RHs/oW/TyryBZzrSMRJlyfKAq8pIzH9OoEPH6FOYwByTmILlIBYgNotP6l02Dn6rbeM+QHI0/D5RCkDoHfCD1aE1mznWUeDPsLoZ5h/56E/Q3yp+MInO9u/I4JEU5m5mRFFEPelFdwusnnXHjVuN3wE6tDaqUOAQlQogD/zdvxHXzUS8kQiWcyytPHqPWVMX9kw8uhaXk973VerDUxQLk9FuvygmA/45BwOBQ7J3Mcd27HPPfX4sjLxHtf2VjPaopFpepyxvbR8J8n13UTT4jcOviJkymCPbqgu1FDyUsJc9k0Dh871Vg5uDvl4Hs1kejVaAqvDUZOd5zu2rKDayPu060KVlqujUkIvfdXs9NrBVwG22P9bYT+ITe7EsjvJA5LJzaCJjnR13UvNlux0zYgtP/0DXRTOncpXpd7dqtD2xEfa4CtncL6nQqbrpv+E5WNPbfkdzL7txiLv5VV/gasQhOc6eNQRazr9VIBp49SgISXE+4fMXcVkyVyxG3mzw1TCWIMOHwc9o6G0Kuo5WaAIAwmCeyC8nXmuAN4Kw4Sv7TQ2vDZ8efIoR+L1Q/JB2Gpb3nI5a9d632dgaECY1X6L6hM2eDisKmlA7QH5cLmuCx6bTbTyQ+v7f3C1ysGzXuXnlVMYrySbcxQ9DYALcC2k8n/leBj44RQMHLGOZFERySiI3OhMWLcfAanXQbuiwaltvmoyYEnN0wzDz+KBkngzXsle6nJ8IzziYnjJtuomMpaZvHnmYcF61WJaBl5E9FoIcvm8eek4mn3ROZcOdtMlomt56xEB3KVTR44Mckw71ZXGCyeBKgJLC0v/gInXEjuqUFto+TiPMbuDCGwb92RbHpNSTUU3AkzbZEcu1tDBlPhCFZWcOou40+g6hhpa+yBSHRWXrV5qbJscDTXh8hAGdNJxWPCf6gRfVuxrjA4vN9q9lvE2k6IjdOwngM2j2piaDOCk9U8qwb5PUMhfxS2SEpKAD6ZaAmT7+KHmyaW1KH3dsCW/ZiWwWlffUGZ3k5ObscnlDqPGuFloLWYmQBFTUDwDW2rrKHa94fuxR0K2AuVrUDvn2I62E8SbkCxQMYB8b9o0a8m1zvzkS6fHElfGcuqmCS8nPwg3zSDzFYHAoEFenbE6tFIwjYdnZb3F85Cbz3Hi44GsQVVPh2biA7ZnvECyHrKk6oXAaI1hQhWrlctZyPDwyYKcZtPM9NsRnrZUPw7ufLBTk4ZQ5x9vWd/n3ug98EbySV2zUcMQzzABsMb+UYv2rhjAFRrXsvv4CuoXCUOrhahXYIvH3LbuukTlVsU5yyNFuCiZ9ls9U5vpep42SPPxnG42+MEdPaSf9j+nzpE6N7S7U6ahcihemyupHvbeActWraMNLa2uEkgFhS6IrecdBEYhClvEkEodP+r63Ej4trvpw45vjWmhAZ+tQ1U9HpLa978aCbI1tx5kWkRrz/bb8Cd3P8eKJPw7oWoDBML/1gN23rs36V6dM91g1SjuTIzc9dqVUBGRLxLhp9kV7hrKAuVY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02d922df-90fc-4de9-17a5-08dbd6c0dcfa X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:43.4584 (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: Sv0enxTTde/AQPjST+pspexRWgfpMxTvY8aHOmlP1noQ4vJK1O6buNFB8gY2g1MyaGbHftXBr7lYh9SaMLeHZWadI/ldnieWIeFMrbDZxbk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::72e; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FORGED_SPF_HELO=1, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org After used bitmap freeng s->used_bmap points to the freed memory. If we try to free used bitmap one more time it leads to double free error. Set s->used_bmap to NULL to exclude double free error. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallels.c index 1d695ce7fb..01a61a4ebd 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -245,6 +245,7 @@ static void parallels_free_used_bitmap(BlockDriverState *bs) BDRVParallelsState *s = bs->opaque; s->used_bmap_size = 0; g_free(s->used_bmap); + s->used_bmap = NULL; } static int64_t coroutine_fn GRAPH_RDLOCK From patchwork Fri Oct 27 07:46:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13438171 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6D2EC25B47 for ; Fri, 27 Oct 2023 07:47:47 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZ2-0007LQ-6h; Fri, 27 Oct 2023 03:47: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 1qwHYZ-00078v-LE; Fri, 27 Oct 2023 03:46:59 -0400 Received: from mail-db5eur02on20701.outbound.protection.outlook.com ([2a01:111:f400:fe12::701] helo=EUR02-DB5-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 1qwHYX-0003ya-De; Fri, 27 Oct 2023 03:46:59 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jodTTJfyIFZ8zL3/sKUhsMynDRtoyMII/J+NFkybEYslMpoo0VOdd3swob55qKwKPKGKHOjJSB2e83UCLmyXpBo6VdgdqJdNGp+s8AwJS7/KSE+gffR2JrG4rZjiVknkqljyc6nelsw7HbdwOfeLiFxKluTagwgwBXDlyrcjs6+fb5bTtboqCvPVnVJ8Hp8J/0iIzzPeCY0WTz9CXAnpdFucqy8lmlmoiOEiaAzgeiUsqnCWW3XcPXPUH7VJrrp/PMsuwRoigvMb7eK9ne6dmQSFA0T7D6RQRV5LVabp8HQmI+s0YgW80qoPJfvBdR1pcS+HTf1a4HwhsFtdIWZQ9Q== 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=akDO0OoBweI+xl2r6MzOa2bwAvtCS00NTm6TkugQl3I=; b=cc6gNtUvQ/n5TCV7TNDMlt+ZUsIySDfrqRcZHVX87HKPnnPV9AAzmeTUvjqZO36emNCTa+iFrebgC5ytgSZSg3fzFG9LWngNS/T90pB37ydtrN8rbXdu28tDMXBonFTOl8aACyJrE895ETQLgFaWD2nz5x/SHoamJhM2foYnFuqP4Msfe6MIKP/AdfpXyTQLs8QNQ6uev1YDx3cllZ6D/K/D6sQqilsPTIQDGDXto0zU1bi49beVGSBaUQbjFiLoGuu4filgPXMVUTDHsZh8v8E0JWaElUN64vVFl62h7PZA3lzYn4KDz24v1hfNa/r2FDiDNrqguEpeQivYcpz8gA== 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=akDO0OoBweI+xl2r6MzOa2bwAvtCS00NTm6TkugQl3I=; b=LDKrkurJohAbfUXSJi//LZkVietMLr9AyvXtxO60R/vmULlIXOfKt0C0e+TWNJn/+x394OiTOK0jlESkwPTAlg44WVQwlAA0Q69DNdhUj/u7MCHthTtE/0VIATx5igHfnEbEoqCqmmR8GLgBfreOFO1NXv+bAOc/sNLURjHRa/y/L4HxcfO2M5S8loP3d00EZgZIzaGEU6vtb5fu8FOyUbI21JySri6rIAldDlLUNKvtefBl9i/I5tpQH4sqdtR1pYbFVWlklRB2rQ63FjIbE6dwK7z78gMPd3pDieISOTXenJv4fgu4nJmdDyb9kme9qSf9Eh6cGTfLE0dKaHBXXQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:44 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46:44 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v3 02/21] parallels: Move inactivation code to a separate function Date: Fri, 27 Oct 2023 09:46:17 +0200 Message-Id: <20231027074636.430139-3-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: b5428472-290e-45ca-6479-08dbd6c0dd46 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YcOW2Ot3nMmu4ZPJ0PJ7IAI0ZFo4+6xQa12vDAlv8j/ovrATY7Ej6rakDp1f/j4tygkgtGAO6qnuC9aZTOwvrj5ubM3jcZE6ycqs7MHNpKT/JNIT0P1Lt4moswUtRi+V5QXUbUTUksqEAky9ovp3upQajmHTdhPqAeGEGHWvHAloqsFgjrE9mlARjXL+Lqgcb9FXOXSLTK9ZMV1yT7jY280VrF+eEUO1TvUbw/DTXwNyv03wCSaPOpn3Obm/GiCMMo3VGwfo7n2NqH+FHJreFcgAjPqHOxkY6L2sU+Mrd/WEu+y2WALuz95C2/PBWzI6/H2B/nDrlvB2dp13VWciGZDidCp4MYLj+2nhw6wkEaaZio6PpRIVVj4vMrbwBjKP+DD4sWytflvuD1QGs2L+hpb4m81WAk95DLM/qQAFIZFsfy6tAdR3GeVDOy16yROHzFw9MlODprTYTe07Eaf5ufpW2uNMS9sxFa4dPE6hIqT3NG5myGrsykyJ4LK7WB7K6gwiPaOTiAFLKtJ/xva8tazLQoVEVCHi62hQSsGwGlwvj6SDlc7pI7sBe0JhGmM9EQv+AP+R0VYlFypQ163fCqBrC1m0bTYXVCoehIic5+2y58MKQX/T9WKpiWRqUzpJ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vXnOD6FXBOg+3C6Hl8FGAM9R53619lTxvG5HCOWP9u2aXF4CB2m+OEChmJh2Ap4YrchqF3tMLzYd4D89J9oMXXUOFDNgmhwlqV5Is0p31v9FM8SeBq7/YMnvXXhy+8CHgKd8khHqHY91NJyINQcOnqUer+NaCJjfATel06bvKfrOSzne+JY7v6XThrb0vtoex4x6niuAzxWy9IIZS2sH97ZtPm0wP3bXYvTjMsOEUzewBRPip1umNKRUIaygPPinRIFzPYqWw3Gksy7Q9J0naqTjF3gxGZJcYZLENPb5GeeEg1JcW8ZMHWybnUgtn09TZJ4iQyRSnFe+6e6tHO8PSPrmEgIFL6+sJY/c6Tt5qtAsubzL2yyQn1SCk5nPKHFAwkF2p7uukpJ5/gLq3tJhZsXfDVsFEzx9YaIlpxx9R34FshcA4E9hfUF8tmWCv5Vy9+MN7mZETz6ubfQ2EEPcEoZICjZbfZBWDX1Kox3b4sFJ6JQEpEVX8a3BfMho+RG9SSMjv3NJ9gSny6aUEyNlybMwT66DzjJJZ4tMgztxYIfgpF4wyxsGnGov7UFQSZpQ7g/xwaFfcyln40YsE6Xqat86ULuK0VVJmCQWgYc/Vdl2Luu9o+6k9EPpxzhm8dWYhIuVyQbZaHlgFm3XL+zFEtwUEBYO2zt+FmOmjfa/0elIlkASUSvdB04lompu5RDLgUCxmpL5nUi/0Rud71icmFqVy3GhLgcNTNfSHG3+0KPMgLYySJrDR/rL0DZkT1G1Icct135W3w2gz4G4QccHCFDqZp6txhSGeBsZ5AhqzPcqMfF+aew8JT7LFSP3reDI/Hwmu+K5y3c47ixVAS/nqdHdBOPnW7LuqDy4SuHjohwUwYOBtogy8eI+KliG0W/XnEJAPdxl7+0TPMqrCqOzEdqOuRy5yeDjOigl9WLcIJNCqaysoxxnzXHGgT11f64y5FhMBqWNaGCrGJ/7vf27+uPnKI0jaO8GNpRGNPF3DJt2/Dd4iGTmpnYNU+cKkIpjDFGNq/t2Yo5J9GGcfRgFRMNKMpsnY6TrbAFYqYqHVTbJk3WSTJLanEIK+mLDRVT9I9KuDlacD9C3tTjzbpKzgq3156zFyiL4iOYqbYQypC/wiSpCqHWJTiUiQ9CEHdKR3AMPz0uoB54s+ktsNQQkXSv7bqx0OoBcNuTpecbWNWL86PTJ9COuQN8VLS1tNrLKmzTQiUOjR2ddD66XQkZJmhsLI90K51O/O6ZAK6gR61Ydoa7vIV1kxrNKjDACGDifWvF8nGlAThLe9lylZgW9TsQ7v8zBwmoTknpHI1K83YWpaKTO+32RsQCJX8gBLDLfm+6Mc0KLsjl+WcTGUjiESDnvPrZsiCqG6HTU9WVUFrVcGCzUkX/JbVZEEpSwf6epG8F2JMoZ8aTfFPUVjntu6WLQRravU5PvdXLw/oawuF34BlSTuRcgccqAV9nsggi6Qo5rQO9oY1REwo1MITKkBZeB5ppvwgpo+xyQ78pkk/vonend/zH/GdJIi7T1+f7y15Dj/dDLG9yxJa11QrUhgt9+x73k3EIrGVCImim/4TMjvPAvUUSseh9IIIYlT2tZc9qCki7v55IdJoBSHpJMziEDBbeNKJFAAb6we3RDOqA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5428472-290e-45ca-6479-08dbd6c0dd46 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:43.8573 (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: hzpyha9+NgauA4CWPFn6C1h6Lgd1r5nUDqo000yChms3TJ09GPgIwJN3kdbm3QMH8HDXbWuMYjJagTGtbqlbHJRCx6Xz1BV9qkixBvHiYHs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org We are going to add parallels image extensions storage and need a separate function for inactivation code. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 01a61a4ebd..8962bc9fe5 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1428,18 +1428,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); @@ -1478,6 +1487,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 Fri Oct 27 07:46:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13438174 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05EF2C25B67 for ; Fri, 27 Oct 2023 07:48:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZJ-0007ZI-1W; Fri, 27 Oct 2023 03:47:45 -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 1qwHYb-0007Am-Ed; Fri, 27 Oct 2023 03:47:08 -0400 Received: from mail-db5eur02on20704.outbound.protection.outlook.com ([2a01:111:f400:fe12::704] helo=EUR02-DB5-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 1qwHYZ-00040L-0j; Fri, 27 Oct 2023 03:47:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gyQYdCkqTmC6qRGYXVhZ8YrIMYpEsSw+Wd/uGeTepPbWSWNbcCW7er0sobJu1HTdPkNJPgau5W8zEFOivTrKO6JOHi+zGoJhVCZg9FEA2ODVSMzIYSXbIgpKEiqcxlXn6q2e0D61RywbnmREVAGJ/QAdwJtY4aafVu5aGy5svJdXt6vXW/TScJ8pBpY3OnqRiYvQN0oaOM25BQbKjiDraB/mLqGtC3qxbAZTL6jypKBC3bH/+akCP5XBTRB2lIZVvgeafWR6gHSaRjFeMiRh7OLM/J8/cjLuWNN7SLs6XJ14elyIZK+xx1oPjdc5Hh0E7aVMQnBkRg4Xmq42U9i6Tw== 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=uC4wNRY9AEShD4pxrOKSGs4Rr1nckEx8pvNdLfePCVo=; b=EClQZ2dSt7TGhA0fx07s7NkFDx0W9i0n5ywPJG8Cr7aIcWwnHDMnJZeeOhki/vSGaWleQP+oKfClHiskjdl33QzpSB58tsieEU9HdK7ZwJ0ABxXPX5BESMk7ycF3EQDEHxpxbhTir8q3lucDq99cL4lUM6hWKx6e0htx44GBJHRHTJL/und7CrpOiPBxosCllczlIWLrdoQA+c1dJJx+RK2pA8Tk/qioGQ6bLldbRjcEaKLVkwbBFdwjz6fOIZBMhHombfskM5a98mDWkzVIulplI/Bx/J9qGYkhWSs7ypOe+BVyaHrYnu+vyJRLIdfeZEj+uITBu5nxwVzxR5lApA== 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=uC4wNRY9AEShD4pxrOKSGs4Rr1nckEx8pvNdLfePCVo=; b=IC7OvAeX4MVAGCHuKJ7l96KtC22PUS3wYhNvFZ6Ju54Vdj1zhSn1EOCQP1Xp+zZ5aEErr7J8mqiwRMxGCxlAjDEFOU6KrbZgZszCLeiCjTa7FV+Xj0ZMgL8LTWHcMT87QNcd0lBMe3GfatHROV6zpkaNexsyG+jo2JXwhQlVe5MOVyJBG+iSkexdnUi/DjO0oHGFImLO8wGPphDki3tE/eRdp34H7xIhMn2tdNRbAqnW5/LdOsKRZwQ1eootgsgS+x3Wy8oplN5xSPWcaybM36GWz3OnVdT19k2kmcC0o4u3ZzO8MsOi8tRFwQlDQdGUzVRlxy9qBDpDUCmVbha8Vg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:45 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46:45 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v3 03/21] parallels: Make mark_used() a global function Date: Fri, 27 Oct 2023 09:46:18 +0200 Message-Id: <20231027074636.430139-4-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: f44079b2-638d-48c6-d947-08dbd6c0dd7a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oNm72LOA8qqBc4CK1m1XXHNPmg8GSZ8aK7vgMEeGuBPsK+VgnL81GVS7jvdOAlHVn7dGyXjisq/TjeILrw9a83p5uhQEUGxCQVMLFYjAnXDrGwpQquc/OoF7pqEUWRweh6jiWeqq5zbfpKhS5LVmGe9oAKld8sFB0WGZ6ggPVMA3VHJWo8w896DzvEeDfuDtH9N4SIRsR67A+z9L0Jjk02WmTlL/01D9PDP9ObCjVwK84dohrhEjQe8waZ+ubavwE+uPj5Lb9OGqTaCe4UyvGTQPE7laI3+ZWSvcNw/0/crsyU6In3gagHKKEriJmyE2+bHPtBx6DJAECw+fe2kIQ4az78OtDC0SnbjvlDkB4jYuXEFtZrz6s5oy5/p0NfHAG+cd+OFjcW9Ir634nh/1WB5A4K2OGO/6EPW2/KDkoSPGYEWUHixnQVgQajDQLaUFAJPHrk+UDuFVO/DbcwhBAqHm+97fa3IRFNKxucUUIhIC772/zfdXgWuA2V7YHtIQZiB/LSPBhU1wSQ7Iy/SmghHYZmdwy5kZp2g5LWZhpl5xl7hwlxwQeObNJvhzCRzM03o82Tj9P5gdUTTsNZbgwVTh2Ytsgr1Q0Pw6ZhoAdOGDjg/JtP4BGDh9PWvrgTMC X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QJDvMKQaeJwCH61A2bpfNArg9ypDqSX16z6UBlTd2u8aWh5AepGllrEV6milpIil9U+DzsPkvGS7ixzuRYiuBHw8FcI553axvwdSi2wenF0Ezi1o9ebzsjG9l1KPB+apmDxcY8EnmxszaQRkngy/cG2H+3p1XphUULwn9CMxDQcj74I5OfB+ijcAC7Zg94Xc36mX1gsPL7ay143rnmRprX9myGNr2skgIJ1AUjfSJDPjjAgLqCR3aAAQeOx1gM8v5jkkDBKhr3Zh0fDCzI0CrIxJLwKEZdWmBC+oXgOWA13U7jTmFJ+MQBuyJjXGO1obi/ZZKf21gyIEHnQqm95I4ozSRSH6tuozje559GMf8iU2nUa2PmJmo4riaJrzW4l9qn7cSoq60Kiqp9F/Euc/PqAdbXp776AxgMaFSSNoEQ7O+MzXPt0+kEf4kSe6geSstTflNID+ZuF5WwfPEuBk6/PKj24FKdsvKi9ZQDevR/VtTpqjzTlVRn0gU6xQI4KIHPhW9K1SNdPnLlctZWqnzFhyIgmknATcxPWoYjWHIBN9TgP0v1MrRO95LsQdli9YE/a4/jDmeAyiL081gdcBP5+exYzWVSM/SlojWawHCihqglAlHHav4NDfTcLl6zORmJjxxXNphJ4cyxIb5UxsF7fo8UWEWWv8RriL2SVUUoLNWNEyVg6jlh4/be7+rtRgO1LcA8D03Z9fvsmRrhDUuum+hgFWIckTmcUzYM8PJpR9xmnBWogzX+AZ0/6jucRkNxeLIPzw3ZV6uXD++l3SEQArPM53EZnNMicwakiy/eBOTvEatUM00iJCxqct5E1TNJPohwnaxT6nbl+p0FYEJoCJHORooI+NW8auLNBk332ruuuYk0Mt3FByjuqAR2T2lR6uZZfdpdwxupgiMXSG0nsS7DcUGRHkZrZY4AIZVCRZrnVS+sCGEDL75shTQqj/EEf4WShVSg5Eauai6hBGCvjxms53p0aYRLt3j/o8COe/ISfGDpzzxwmxu0k3Gqbu9NRZ1KMoSyFl30SOdjdS902N/54lxhZkMs3ataaA3Z5u6JeixhZfvd0Qo9X8e5cJRn2ORUrb2cizAxDWKUZrBoa/TU+UY2SAZisMvKFAdSoJ1vh61+oTLEcjLFtT7t2/NxTHlfnfQPsQ/1gi1rL81GLuITZGKvEQ7qfVPw2CoUioeW3EqHIj9swaXFfRupHtAUSEZp0pjbqMMk+hqMKWBweJjJQtyEUkrIWR5Nr7Y1bfULk6MbrMxdiLaNb3Zihf5eFds4rHMhkcaVqZv8njP62Jx1kUxj0KfqX1zrI5SJfe5iAVRPi0uHGm5r99hYPuQqj+EjRtcvhlbn8mD4D/9XzoEctEdUFTughS+hJzZ+p6/N+PeiBdYXiviPeSOe6sWcLVet3ajl7QYx0jFORIFlhEqwQiFq5lyu8gcgx7Z9J9kKu1p0uhnbQ15a+1erg2nbM7ED4V4hrqps/PE2btT9m/dgahKkXRE2F3CwnDgHCewMYjRYzMWNyM1OmtCBfrTUeJ9ddepxIUB/ydgt6iZqPQPESIVmL2VclpBTVBp6tyjJ08+HnMZYmyPRyuWeKx80+YBjU+ceXgx7bpQBvPGe4L7tK/iI1V5XM4z9P8nBQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f44079b2-638d-48c6-d947-08dbd6c0dd7a X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:44.2401 (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: xURHLLx9XHM6aczn56NXV4pGKkg0vZXapWmt7hXb9l232RYiEXCrpprStcdjdnM3PSMyca9XQn/snYyuR3TDE6OQzIWiMhjyY07ZB+s0NkM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::704; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org We will need this function and a function for marking unused clusters (will be added in the next patch) in parallels-ext.c too. Let it be a global function parallels_mark_used(). Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 14 ++++++++------ block/parallels.h | 3 +++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 8962bc9fe5..e9a8cbe430 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -178,8 +178,8 @@ static void parallels_set_bat_entry(BDRVParallelsState *s, bitmap_set(s->bat_dirty_bmap, bat_entry_off(index) / s->bat_dirty_block, 1); } -static int mark_used(BlockDriverState *bs, unsigned long *bitmap, - uint32_t bitmap_size, int64_t off, uint32_t count) +int parallels_mark_used(BlockDriverState *bs, unsigned long *bitmap, + uint32_t bitmap_size, int64_t off, uint32_t count) { BDRVParallelsState *s = bs->opaque; uint32_t cluster_index = host_cluster_index(s, off); @@ -232,7 +232,8 @@ static int parallels_fill_used_bitmap(BlockDriverState *bs) continue; } - err2 = mark_used(bs, s->used_bmap, s->used_bmap_size, host_off, 1); + err2 = parallels_mark_used(bs, s->used_bmap, s->used_bmap_size, + host_off, 1); if (err2 < 0 && err == 0) { err = err2; } @@ -366,7 +367,8 @@ allocate_clusters(BlockDriverState *bs, int64_t sector_num, } } - ret = mark_used(bs, s->used_bmap, s->used_bmap_size, host_off, to_allocate); + ret = parallels_mark_used(bs, s->used_bmap, s->used_bmap_size, + host_off, to_allocate); if (ret < 0) { /* Image consistency is broken. Alarm! */ return ret; @@ -831,7 +833,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; @@ -891,7 +893,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 6b199443cf..bb18ee0527 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -90,6 +90,9 @@ typedef struct BDRVParallelsState { Error *migration_blocker; } BDRVParallelsState; +int parallels_mark_used(BlockDriverState *bs, unsigned long *bitmap, + uint32_t bitmap_size, int64_t off, uint32_t count); + int parallels_read_format_extension(BlockDriverState *bs, int64_t ext_off, Error **errp); From patchwork Fri Oct 27 07:46:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 13438189 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33DD2C25B67 for ; Fri, 27 Oct 2023 07:51:59 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZK-0007kg-9O; Fri, 27 Oct 2023 03:47:46 -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 1qwHYb-0007Al-EI; Fri, 27 Oct 2023 03:47:08 -0400 Received: from mail-db5eur02on2072e.outbound.protection.outlook.com ([2a01:111:f400:fe12::72e] helo=EUR02-DB5-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 1qwHYY-0003oB-00; Fri, 27 Oct 2023 03:47:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jh7MSmMtYfRY5oyTUXCth/q+hieUOX3Z5looueyl9KsGsVTy6l/lkvJQPOTz78223/VTj12ApX8wM3QXZq98hRwocu8QZfYLMhc9FJvJ0Kq5PqM8E5x8ZleDAhGT/FlwShQPVOXKGlH9xHA/MkKeY7U2G0Sc3JZhn21Kg2U07cRqwa2TNgmu0q42MHfuoMA4sFIVP1zeuknD7MnByTagf1voVAP5KSlIi6rdjRlRg4xroxSPgDYGn6IjtMM7xawREdb3fLkt+ItK3v9zhsdAav8wer0cCwaa7D3plj2mYYtdruuah68sSxw99HgbDl15faQ45VD1XBDVsE0G07KIsQ== 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=AvKeDMX2EBy1kTgcVxNzT37BwWLl9FTEGKKWL6qtGqg=; b=IU4AufGe3w/H5MMVVsgJVfzeRG1an2GpmfkHKrGUKqWFyo+/kFLxY88j39u9ylKxNFOuDKf9h6h2J2nwJw2Bv81FymRKdfLuJHDHFoQCk14jwb9v1edQiouzs5FRGGg3KYqB3WF7GN6iCGxLdoZ1wF1pCCHSFwFyB/UEp7EIXWDh0L606gufdFPF1PwNi7RDMWEM77vtluq3Urgdyt9a26f9N0BEMlf5Q3i/q4mibg0pP6JfygrXJDQFTvEps2PL+rYaOCl+jFaOLmiGLPnLw0S2cUlGc8HWf/nzzHN9G/K1bQpkgRGn5sEa4QZPRXqvhMXD3op2sdLjFM/MrZCzDg== 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=AvKeDMX2EBy1kTgcVxNzT37BwWLl9FTEGKKWL6qtGqg=; b=Vok8ldUK4nqqe/cfnm9iuqirj6tXnlTNNUN41pWPaWubTLY9FamKG/rD8WRwfNG1ugj5ONjW/dUckJ84ixKMYhWbVpomdXa/vKJcNLdjn8jEoMuQzP1Rp9hbaM5DdqTY4U1g/kMvUJ0DjNYmGCgcum1QGtWMQ6aJvWsQiiLODF8gQAKnngA5P0rJEY4PpNrPJC1k/Y1zt+22HU4CQ9LujNb5EnaepD0hmgTC74Vox0hqpzlfOt02cW+n9cArIugbJO1crgqtUa+qd/G/X5At37hLUeQRfxo6AGEXExwhYcxERWHEGJkW+zGOcbpsHTam2wLbi6VrfngJ/NVzaHc81Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:45 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46:45 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v3 04/21] parallels: Add parallels_mark_unused() helper Date: Fri, 27 Oct 2023 09:46:19 +0200 Message-Id: <20231027074636.430139-5-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: a598567f-4d24-43b2-b0af-08dbd6c0ddb1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Lvd/H0D5ja4SOonJ0UXqkkMK2RR/+fdeG5vb7fjt4V3eOuA8VaIgy2wWb4SU+aXx1ceboc5rmc06ZAtOqIj0cLL+I51tdX6LyIDPkRX5ZyKRp7WInT4fgfcRM6+dLpwclbdJQwPlcik3gEvlpouSi+4L1wTs8Mupk2LXhN1Ppmxc4tPoyqtkF/pRzxDLDL3eatK3MgoZeAyR42Xcn0PpV6HMmgCqxk8WRBLyCMiOZP5CV4/wiBKyLcscGneFdV5TRVYjtdAU3jtxGqHsNuEbuqMFkcYr/q/pmUvdmdCGNIcGfMP/zdjaYcRdymW/vGGhLGDM5cgLMjT9N1ep86OiB8hjwpmEAlQhf2d9Q7pmrv+JtNtKqPFtDzyjNUn1F+/gnAMvnfSktASdffoRob4g3wp9suX7rFTnbd2F3WxpE0mygh5CcYhHlMyAjHtVj+3wZzNDglmtKiTT03jvrHu6ctnT4AAifUQIzZkKDT2WKOMe/lN0+LsrtKp238OCAgSUVI3v4Cw0nTvBbZ/HAAvVMyoNUUukLClTZWCjr1hj27ZAM89rJsmVCAlQpkGfBbfonXYTFwTQjDgfEpBnvxum//lQAsZy3VFM0//NbPW8ogzeZcXxdLzvTBjgIMHYBL5L X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PAWP4mLenkI6XHgOwbE87M0aGtjZb8Ej6PsIkcSARveNZfG6EIcFE61/bRTFOZ7mtUtIb/3rwzE7nNTB9cq56xEPR8fyl3XgKCL8OoHRpfT0E+8+7ah/3m5nEzpSBLrnleCpovugCj04P4LAsiTRqAofZNRDLayQgQfVuO2CyAjqJ8/ookL6M8O56nhuGQ8wFRYq1Wubril+DU7TRiUDDR/gz6PazXLOi2V3zbESVFBEuYnerYDGM8/IGMHd71ROE45uPrEIISbbrhostZEDeAwGpvX3kacPhRoGUtGSabnGDKiZJ9dmMCcyxD7oKBfcJ+lFrdywKc6ltrFBxpls+aobw5qbI6O7E2Uih9RKZBFa0YtxQAt7dgxy0AMf2+V5UwT+hP4sL/W2ug0E3N/F0cCA0nPHJZqc+HJzZAJM4nQjxZHxg/itmuNrcxLxLzStkPa/vMiivHws6yTJJQ3ZI+4xIeWQ/zNiXoFccXVfCWOhIwIfSKtjfKwizR5P2WmZokq/4fJvQHNrrYjUlEMgK+rVywO4Lwe4RO1XuzUOQ6smdQwb2mLBagnoMRVWHuXVzWFfHxdaoOXjXF3Q8ts8BnjD1MzB6m3Erjj/B5KEWLW+C16LtcTTZ16t30uiT901+8i5w6Ch8eI+arogU3wVUvfCdWMXBFmAzUJwUeY2O0EjX5CKaYnuVAgfd+vICNrv4oF1Hy3fuDm2iWAa1C7QYbp8MJ5JmdIvvfQgZ4Ak2/6QDAbvUVAtBc0vHVMU8jd8KxlpY7rqEGzRpQitjwMfU3mnTkyzizHORJ26dKkWh8a1fOlOiuJ+OR67EbK4WEC8PbwM+zNSqTB8xK4AOgGRsoAsJfLJWtb8NN1ThvVkagDjZcg+W2RlnutiNWwJKrZnU6/XVaCY1du0W8+G/0LNAI77LGfmDPJed8AHSXmulN1iVr46goIPa07LKXrm48+9ScuopxxtWYnShkNQbOO6JoeoxEI/KL58mSZ9Z1XdydnVz6cmV2JnsjMQfDZRYYNgfYnl7D3IJ46iY6iA1KiITmlz0gNpm5ZKvTvX3SramYfU7nCT+vpopFcYRzu8cjMZJ/rLgfSqwzjSJo0/UiDYfhkgiufUC25sluwGWaxrmRyic9TSFuBQlLAA6fdodGjuTwfGqOxw4uN5Q8vFVnT5oETY4g/tkT753cRRhkoKR3s6LIAjCc4Pl2rwFZoA7PWQaXquZ1HHxAm8GaH3bgbHBQEDHFq7CMfslH2PVRt8xaG95ZBHEdkIicutCGJQeD8ENEzME2Hc1SO4+puRWagmbHO2WSaOt1Pru7um40FaLwzQ4JaQuA9DicXSjGNDft6gw9o4tO8YLVStTmzxU2pm1CaoErhP26Finmzx6UdhQ35sh8IbSGSRfhH6n+4TRcONJ4m/ySOP3PilOQWTLA2UzvuWb1mBZcLzL9dM57KZn+uzK8sDkYtmaXPQyw0cqDILXKv6H52pHQiYV3Na9XXEFVjqdLNpdKNZQy5oUDN+XElysb1ow7eqhbBT8W3fDSeDU+3E2GHoar/OmxL9PGHLkPymB4udreTXxLs8QjpMCQrfvyftr95yvWeD7LmhGznVYuST0m0Ou0JbXIJvI2cgOdcuu4QE5K6VieA0TO+K62E= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a598567f-4d24-43b2-b0af-08dbd6c0ddb1 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:44.5785 (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: I1E0MhvjjCcZ3dY1wDo+V2/ObpNGIE3QF+sbzl+YR9pVYDT1rADDY41SAGVY/Xvj0wock3tX8s0YisFwn1ZHLvpt3bLx6aIdyk9fT4t/gnc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::72e; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add a helper to set unused areas in the used bitmap. Signed-off-by: Alexander Ivanov --- block/parallels.c | 17 +++++++++++++++++ block/parallels.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index e9a8cbe430..a30bb5fe0d 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -195,6 +195,23 @@ int parallels_mark_used(BlockDriverState *bs, unsigned long *bitmap, return 0; } +int parallels_mark_unused(BlockDriverState *bs, unsigned long *bitmap, + uint32_t bitmap_size, int64_t off, uint32_t count) +{ + BDRVParallelsState *s = bs->opaque; + uint32_t cluster_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 diff --git a/block/parallels.h b/block/parallels.h index bb18ee0527..31ebbd6846 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -92,6 +92,8 @@ typedef struct BDRVParallelsState { int parallels_mark_used(BlockDriverState *bs, unsigned long *bitmap, uint32_t bitmap_size, int64_t off, uint32_t count); +int parallels_mark_unused(BlockDriverState *bs, unsigned long *bitmap, + uint32_t bitmap_size, int64_t off, uint32_t count); int parallels_read_format_extension(BlockDriverState *bs, int64_t ext_off, Error **errp); From patchwork Fri Oct 27 07:46: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: 13438186 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02F88C25B67 for ; Fri, 27 Oct 2023 07:51:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZK-0007kJ-6N; Fri, 27 Oct 2023 03:47:46 -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 1qwHYe-0007B0-A8; Fri, 27 Oct 2023 03:47:21 -0400 Received: from mail-db5eur02on20701.outbound.protection.outlook.com ([2a01:111:f400:fe12::701] helo=EUR02-DB5-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 1qwHYb-0003ya-NL; Fri, 27 Oct 2023 03:47:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QZ1PgXCD1/mQpDgNJOfcb5rwcbYZ5edWxyZ1kzy0RxdiauVCzMX80qsdcUNpDdZJ1HMzu/ssHxAdnxybw57KWk0OPSfXKe72M2FjVjDUAeB8Z9tRu27Rp+wGnaFUcrYLiJB6EOF4eBY/iuORF004GRAc/lAg4pxmdOtZJzl7yv+rTtKbVFuCSiFA5L2jpxuYhFpq9TrIhUiugm22/0s6gVpnP1jRh3sXc+GmdEKlMXE2LtbJEmiwwh0ybaQMrV+7pIRY+Vq9hMzau6Os7YDKPq1J8U8JnWKlw86EGHhbDoZ2gIgdm5f/4tpDKXHxLF1PazFKCQxVZGwVEOxoaXik4A== 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=6aseExujQTqvVy9E/a2V5FLxERrAg7pyhaSBNO7pbNo=; b=jYJGtBk3El2q+RxwCC/rhKaXeep1zgPEkfwhHulwb/PiIvXyTXc6Ekxd/Olb7xiG/uBgGBLP5RyJ2Red6x1qje50HHiOOQxDWn3Zn2mwqREcS0KnS+NwA2ZbChUK0gW8ZWQjyR1cuvX2//vRIRjkeoluJblxldTxF6h/ltFALJm0emA6NdypmM53m2H9lIxF7i103wssyg7AFyzswWeQkaU3vIEoXFZ3pqayhdEHB54qVk0mU/i/cPsr+20hvjkwVHwc/cmS7GzkPCDlVlAw8h5PlLawFdkb5564J/f7rB9XRlRvV2pVbhtpNewxglyyDRy+NZvF0vejS6YOach1pQ== 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=6aseExujQTqvVy9E/a2V5FLxERrAg7pyhaSBNO7pbNo=; b=nVsXCF+DogpbR3Vz2viPTR4C9F13sQDx0E7fgio2VrpzD+AmxJFCUvqOBXXq8FB6iMVmofgh833JXfB7ZxEtPr/WoqVRl44VyYnNacD/3HW47YrR6u2sRk/sT69QIQaZK/lKcjZT9UtZovn33hYtYn18xyKKD8ilI85Juzcaosfe+vp2+nyJ053HfYiU1J/E7f9SuHvm0JaIn+F2AnO5+P72lk3wG0cC/OiKy/73Bj4mCBdUyFWfiSSXvwfjUnf6tLILwP62K9m/fp47XCoM+GC8D9n0F0UAsnnrzCkqiYjjGiG4yQGNTT8stB2TDYAr2H9bEFQz9pCliHBKNHV+6A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:46 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46:45 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v3 05/21] parallels: Move host clusters allocation to a separate function Date: Fri, 27 Oct 2023 09:46:20 +0200 Message-Id: <20231027074636.430139-6-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: 0e339f58-bf0b-4772-ea51-08dbd6c0ddea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MVCG1A1vNRBgT0pNz/fffYpwITFw/tGaMNJyc2gCG2cuVqc+fH+N/5OiGNT8UwmV9pQgd68nmUpJJZj+012qTgRKDXvrY8h9dWPfBmYnJSDKIJTiHOr2V3DX8Dfx9z/h2nH2qlULKf+iqNv3aa8NIlKrzJxoYYjH2/dThuQ8wz1FqzM4eiUDwAA0xC+IPVHB+JMbUnOQ4iEf6BU9fqcMzoeq3BFS4UZcm9MrfWF5qbr1GoWlnSbv9UYil/c5GRl2KkIk9fb6DImwZLhAeV4ag/4hTWCJ3zf3xSCKcRKl7ozCbZW7Gxn9jfRUV598NlQRAMPT9BIpZewnXH0mHQvFQExJOlipHfaiSCQFjsLuubWGRYtMwF+fjaS32pO7HmZPOjmpi1Q3EC+dCHgVvFzddbCBB4u0s8kbObRBHzg6UIgii5vkQnQXfKIMwFwSaooyvqLuSYQaitF+lqDDTU3OLjbFj7aE9LovVIJ4ABKI/h/UlnqAxLm0y29OweeJg+t0+FV4EE+zpxBjSQ//U43Z1fiQ4tdoWea6YqcPguNPsG3aSXtBJACTslAdv+lqeoO7Y2OLnLbHZaxEhQ7MohpbPfirrCl0nx+mt71IAlZ60rBiNHCYoWyEtdQEh/RubNV1 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NKetHXm2gd+eJdDJVhfheKuk6ZuSr/Tmt3v6BDkmfgEi8tNxV2Y/9IJeL+Rpi89FjZOSs26PmTEWgrk4FriyKm53B8nOFjWvhtXOm1/S4H7UX4oBaNMOVl2D/rNPoxlJzTLIFlftsPFpbaWXnh1W8q7hoX8/Z+UlmOnHCNOEMtay2tCv68/bGjtkyzXjFV2dK75rzV8hDAa8ux0WpbSU1SaKYEvmKEhjJC6qtZBQni2THKDvGz0UU053ycZOZyi+Adsllb60oOlxY+3PC4B74kRSD+ullXMBgIno0vD+fDcFW6oQNAfiIpZhNB4SjD5ahkGTws2iY0qszNG3Hlmx2YpH0E2FQMbYOaOFH1aCd/jUJWQQENhp9Ta5pTlM5Uh3JTx7CegARh8y+QH12JkCZID6SasUptfk07HcvA51FElDfNRe6t1R3fwj3sIdv7CPqUGXgHoHT2iwKWADNs/l1L3XxwLpB0vqmxfZ5ObvQED0iY9bNoeB/bMkAGwlKMLiGPG7ayFIfTItLC4HKTiH8H+1cwkpI2seEjG7Cvex0zxHbO85LSIJN0QdWL4TovHahg1jeLWsauD6GMrgXp3AEAhNwCSvwt89rJmmbxqho4m++FU/ow1jwrxR5ZKXIqgQNXPyWirhFP2ab4TmJFnYZFOA57FyIjZs3qLpM3RJBCJJA9oKibV+WOqxNteuTZCur+gst3p8ZRRC1fOdbgut4o6zPefPLm5AHBIW4nuzlbPz1/mDhYA+MAUKB1C+ryorrvly3zKXHHOkUWVUd07cGA2+A7otvS4e2I9hKSxnvYmuVltCNp/qCVtNi0+FyLU/5zqQy/bX56dy44B7KZW3VD0mRlBqNBBc+bK/ygLBBsoIwGHkgXzXO5IsvB6oVCEWXYphsCvyVCUnA67Q60+z94K5hN9niDLKn1Gw0eSJaKZX7BRxPi1lC0eAPNmQBgcxo0qrJKQYsA/yKPwquQt/DqD3cLvBClBHh//yKSEunx050R+HLHG2vBAU12gPSUX87vvi0Hu/hGk79ccQptCnk3fHf9B4A5QANucjh8aXkStE5zVqxyqb7KXE9qbebCpdsODOKP3XhdTbSOPq2UMR83g4I11cwAtF8NqMdBYmEmo9p32hwEdWxJgcZxcX43GkLIyqnIyFcDWm3fHzgGtq9J11SsgfSJsjP28Bq9z+qCCr4hKMqoxPNTfEaN4vco0/otUocWVcUPjV1JE2yYLLvp8wml2VGWPaI4nujQjV8rVhPKh8WQabiid7kYRnwZhBydbOjP6PfSvxVGy/k5Xj0EyHIllX4BVjS158kOLKFCr3Ag7eWJlkoLnd4ZZFhofKiIDY+eLnHNxUGbefFMANQVEZ05M5YuMSiGbsnBLAMWspITgMBTW1z8RwwQvIsXss0Q2F+hQ302xFkTPeCK4KE17bt2LJ+G2hlJiX9XqwITszOFRfiH++AFNofpnHTaNo0bPWxTxU2IG6yZ3WCEhwHmzEgc7yhLGvg7nBjYAY8sOFrD0fki/SuPMGodczU2o9gzn4/FBMRcs+JUFl/vMW30Gt3Sx4TSln92neEwhnB25ha9HEkW3PC8O2KW9O7aEmaiJzL0cvV6tuYkMI8c/P99z2s08t008iZ9zzJplDhCs= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0e339f58-bf0b-4772-ea51-08dbd6c0ddea X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:44.9628 (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: N5+e8eR8H0iboNtj29xl6wcigMkmIyBa9PGxsF7FEdk/jNj5o2gSNDOYZtjWX/w4V2K1kXPqN885I1ULVb4JijyQBsoFBZBBf11pHuJ2RHY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org For parallels images extensions we need to allocate host clusters without any connection to BAT. Move host clusters allocation code to allocate_host_clusters(). Signed-off-by: Alexander Ivanov --- block/parallels.c | 128 ++++++++++++++++++++++++---------------------- block/parallels.h | 4 ++ 2 files changed, 72 insertions(+), 60 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index a30bb5fe0d..33bb8f1084 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -266,58 +266,31 @@ static void parallels_free_used_bitmap(BlockDriverState *bs) s->used_bmap = NULL; } -static int64_t coroutine_fn GRAPH_RDLOCK -allocate_clusters(BlockDriverState *bs, int64_t sector_num, - int nb_sectors, int *pnum) +int64_t parallels_allocate_host_clusters(BlockDriverState *bs, + int64_t *clusters) { - int ret = 0; BDRVParallelsState *s = bs->opaque; - int64_t i, pos, idx, to_allocate, first_free, host_off; - - pos = block_status(s, sector_num, nb_sectors, pnum); - if (pos > 0) { - return pos; - } - - idx = sector_num / s->tracks; - to_allocate = DIV_ROUND_UP(sector_num + *pnum, s->tracks) - idx; - - /* - * This function is called only by parallels_co_writev(), which will never - * pass a sector_num at or beyond the end of the image (because the block - * layer never passes such a sector_num to that function). Therefore, idx - * is always below s->bat_size. - * block_status() will limit *pnum so that sector_num + *pnum will not - * exceed the image end. Therefore, idx + to_allocate cannot exceed - * s->bat_size. - * Note that s->bat_size is an unsigned int, therefore idx + to_allocate - * will always fit into a uint32_t. - */ - assert(idx < s->bat_size && idx + to_allocate <= s->bat_size); + int64_t first_free, next_used, host_off, prealloc_clusters; + int64_t bytes, prealloc_bytes; + uint32_t new_usedsize; + int ret = 0; first_free = find_first_zero_bit(s->used_bmap, s->used_bmap_size); if (first_free == s->used_bmap_size) { - uint32_t new_usedsize; - int64_t bytes = to_allocate * s->cluster_size; - bytes += s->prealloc_size * BDRV_SECTOR_SIZE; - host_off = s->data_end * BDRV_SECTOR_SIZE; + prealloc_clusters = *clusters + s->prealloc_size / s->tracks; + bytes = *clusters * s->cluster_size; + prealloc_bytes = prealloc_clusters * s->cluster_size; - /* - * We require the expanded size to read back as zero. If the - * user permitted truncation, we try that; but if it fails, we - * force the safer-but-slower fallocate. - */ if (s->prealloc_mode == PRL_PREALLOC_MODE_TRUNCATE) { - ret = bdrv_co_truncate(bs->file, host_off + bytes, - false, PREALLOC_MODE_OFF, - BDRV_REQ_ZERO_WRITE, NULL); + ret = bdrv_truncate(bs->file, host_off + prealloc_bytes, false, + PREALLOC_MODE_OFF, BDRV_REQ_ZERO_WRITE, NULL); if (ret == -ENOTSUP) { s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE; } } if (s->prealloc_mode == PRL_PREALLOC_MODE_FALLOCATE) { - ret = bdrv_co_pwrite_zeroes(bs->file, host_off, bytes, 0); + ret = bdrv_pwrite_zeroes(bs->file, host_off, prealloc_bytes, 0); } if (ret < 0) { return ret; @@ -327,15 +300,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; @@ -347,14 +320,59 @@ allocate_clusters(BlockDriverState *bs, int64_t sector_num, */ if (s->prealloc_mode == PRL_PREALLOC_MODE_FALLOCATE && host_off < s->data_end * BDRV_SECTOR_SIZE) { - ret = bdrv_co_pwrite_zeroes(bs->file, host_off, - s->cluster_size * to_allocate, 0); + ret = bdrv_pwrite_zeroes(bs->file, host_off, bytes, 0); if (ret < 0) { return ret; } } } + ret = parallels_mark_used(bs, s->used_bmap, s->used_bmap_size, + host_off, *clusters); + if (ret < 0) { + /* Image consistency is broken. Alarm! */ + return ret; + } + + return host_off; +} + +static int64_t coroutine_fn GRAPH_RDLOCK +allocate_clusters(BlockDriverState *bs, int64_t sector_num, + int nb_sectors, int *pnum) +{ + int ret = 0; + BDRVParallelsState *s = bs->opaque; + int64_t i, pos, idx, to_allocate, host_off; + + pos = block_status(s, sector_num, nb_sectors, pnum); + if (pos > 0) { + return pos; + } + + idx = sector_num / s->tracks; + to_allocate = DIV_ROUND_UP(sector_num + *pnum, s->tracks) - idx; + + /* + * This function is called only by parallels_co_writev(), which will never + * pass a sector_num at or beyond the end of the image (because the block + * layer never passes such a sector_num to that function). Therefore, idx + * is always below s->bat_size. + * block_status() will limit *pnum so that sector_num + *pnum will not + * exceed the image end. Therefore, idx + to_allocate cannot exceed + * s->bat_size. + * Note that s->bat_size is an unsigned int, therefore idx + to_allocate + * will always fit into a uint32_t. + */ + assert(idx < s->bat_size && idx + to_allocate <= s->bat_size); + + host_off = parallels_allocate_host_clusters(bs, &to_allocate); + if (host_off < 0) { + return host_off; + } + + *pnum = MIN(*pnum, (idx + to_allocate) * s->tracks - sector_num); + /* * Try to read from backing to fill empty clusters * FIXME: 1. previous write_zeroes may be redundant @@ -371,33 +389,23 @@ allocate_clusters(BlockDriverState *bs, int64_t sector_num, ret = bdrv_co_pread(bs->backing, idx * s->tracks * BDRV_SECTOR_SIZE, nb_cow_bytes, buf, 0); - if (ret < 0) { - qemu_vfree(buf); - return ret; + if (ret == 0) { + ret = bdrv_co_pwrite(bs->file, host_off, nb_cow_bytes, buf, 0); } - ret = bdrv_co_pwrite(bs->file, s->data_end * BDRV_SECTOR_SIZE, - nb_cow_bytes, buf, 0); qemu_vfree(buf); if (ret < 0) { + parallels_mark_unused(bs, s->used_bmap, s->used_bmap_size, + host_off, to_allocate); return ret; } } - ret = parallels_mark_used(bs, s->used_bmap, s->used_bmap_size, - host_off, to_allocate); - if (ret < 0) { - /* Image consistency is broken. Alarm! */ - return ret; - } for (i = 0; i < to_allocate; i++) { parallels_set_bat_entry(s, idx + i, host_off / BDRV_SECTOR_SIZE / s->off_multiplier); host_off += s->cluster_size; } - if (host_off > s->data_end * BDRV_SECTOR_SIZE) { - s->data_end = host_off / BDRV_SECTOR_SIZE; - } return bat2sect(s, idx) + sector_num % s->tracks; } diff --git a/block/parallels.h b/block/parallels.h index 31ebbd6846..4e7aa6b80f 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -95,7 +95,11 @@ int parallels_mark_used(BlockDriverState *bs, unsigned long *bitmap, int parallels_mark_unused(BlockDriverState *bs, unsigned long *bitmap, uint32_t bitmap_size, int64_t off, uint32_t count); +int64_t 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 Fri Oct 27 07:46: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: 13438175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 222D7C25B67 for ; Fri, 27 Oct 2023 07:48:19 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZL-0007q3-Pg; Fri, 27 Oct 2023 03:47:47 -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 1qwHYg-0007BD-H7; Fri, 27 Oct 2023 03:47:21 -0400 Received: from mail-db5eur02on2072e.outbound.protection.outlook.com ([2a01:111:f400:fe12::72e] helo=EUR02-DB5-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 1qwHYc-0003oB-Qx; Fri, 27 Oct 2023 03:47:05 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G1j8tcAY83sbeQv8vjWaTytbx1YXQWux34cw+YMVd5f8oUZLT8YrJb3vnm34CqVM41Rae0J/O78blZfcZSE11KCTFr9rv6A+iDW1wnVXBujkNgymvc2OArjIueyKUkL46LqSJhOL4mQieHxxidzruJit93WHLbubxw4XKgiFEwRog2tByGupcZtYK/EpczKiCbeT8TIt3H7WnJOlYPazVpb9Rv/yPaHKUPnbxwldAdHSCDfXQd4F8DTAbCwm+F5JWBtoOqEE0/WgNFiD0ZrTopduUKTACPpPJHirfVJXEBxFrjwSHPilQisRH2voisyQuDh7MlJT7Mu28nE7SQ4gew== 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=H5maZsP7dUdy18yzJAs3ERgqRMtGnX1B0lZ+3GOQoSk=; b=lyocBvDPsFU1mJQw6NEYtmkogq3YpffFJzCWJqCJ+luDQtEV1WY9ctk36OaBYBviveM6MlDziQA/NCWXSh4bGLnncgoFAlXevs46YNJfTn1wcxw9WMszdFQOm0S0JHDtstmbhQ7bpKtYvbiRyW5PjXnva42zgeQYCWSACF5Yvr8A19guFYIDjRf+0oUJtSzf1GQhfBQujqw6NE9At+y7LBEW07D21HG56I+3w5bS4+CvdCJ4BipSRnvcsAAotDmn/YITogyhyN9phlEo7mkjrY3BviTE5r7Ya2JG4Z/63+a4sWUXJx4pf2tAyY0oSRxj9/xYTSJ/H6tS3Ucaz8rrqg== 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=H5maZsP7dUdy18yzJAs3ERgqRMtGnX1B0lZ+3GOQoSk=; b=vU4pqKlnuqZ05XkCxfVctaZRpyQoPDHQqD8B2F6jkf3Phc+a+G7IqEZ7V47xsXyvCEQ9GoueC4ZOf44f7slHENHo9/hn2QzeFz6EF4sGSZaU1TeExzAx4P2jkQAm8qtHHiEL4ixQbBvExcv7RH9DHdqBDHoJ3Rc6hBBGVXJErQMZA8Ywr2BPOgpEUlUwEkGLEbS6EqefHlA3yttZxXCt2yCDpayapaE7n8J5RVru+nESvbJDEwrmhvYcTERyrXzCrA5C08aQjcJPHEMgRmMNfyD+0oZyWE/uvYcnc57v/wsDilQdXNAPrYLbE273vtnUjrAeWadLh0lbFvUvvZ6Arw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:46 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46:46 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v3 06/21] parallels: Set data_end value in parallels_check_leak() Date: Fri, 27 Oct 2023 09:46:21 +0200 Message-Id: <20231027074636.430139-7-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: 65f88207-0d5b-4222-5f09-08dbd6c0de1f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PcecocJ6donb8oZEY7c/nfx1hRRGLaDZ4K7I3O3+PAIfM+MOB210Khm34ecKXUL0f7DoPQhUmxaUVMfwIVy3AEIMO2p7lSFIxyKtVz/yyCvEB68WPrbI1Taa9OUSf7Qb7d5jvfBAl/DmQBrdzhSiEuzVvvdtD2PHntBQdugorj0A/YRGoP+WmXB0Fi5Hoj2wcOtOzfWJMUUMXhnAJYCoPf61E5Eh8JaS5pVaqoT6QyD0KX3vhXFLvl/9S1BDI3xwNlloCHHd1vOqycRFxXXY23VHkOVIX1UujkhZBk/pC4fOI7ROqSz2u9ABk5BKLhDJeA4CH967iCkET3VB6YDmLkj6YGE6zS7R+Y4/O1DWB5PR5nwcFmxRvO1fWqG5ftnCl29rzw8rMwe2ErkSqTpWLrr8BXTJuhYp4ia2WSXs30fXhpB12SbYfxYbJy30zfVw6Bl0yrUHUZNorN3kstpd9CNzYoYsGDSxe6zjbzfpNwf565t0w3pMl0bv2mB36dQ9K/xJP6mmcFopIJCwfqSrfG1bro6BbwDkzZNTeyS3VK0F/Vh1PPgr4qsvfPE2sQU9gtFLv8tiAgEhNcxHG7/UoImE/k6PO0l8ecqqm1uD4lPuTCutxUiMDeyt8z95fuwM X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(4744005)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kgyFfVSKbq/9vxojCk0RrBXtM7I6N+ZNb8na8+BTdOiEZeTqflXYDrFCPNxa1DB3TzC7Ibn1gFgpsG9dXLhVLvfOlb66ICfeTeoV0R1QAzfYQwF2fNUMdsx2x8wecZnrMxWictt/MNS1MMDq0elq4qPTd59xZpAjKD6EpltPQKc0mg6grIImjn7n+XiPgFDrAwQaYGW0bx1VxC79g9TsNZF/Yjcxg8p073UxqO2sKZ7niQOTZUJ1ozZY5Y3GvMssyvOqoNTwURsXlCVdY6Xhg4p1IJ13AWjq4MjbN9J3mCfL1dpqN2etorno37qlx6zyaKaK7/N4gXJ1slqvnpIMelsEB+/nBvZmZvXgIco6kZQk96fjKpiuj+1HE0CVjQPCeHGZgtvd9piuTOjKry06HmJiPAo7MVyBC28eExSFgfgtPuS9zY2LeB1BDOZaDnpcmlYJBpvqlofUUpV8TUgMYaOodOcD3vPQGh1sfnQr1d3hF92K2zWfYA/6C2i9SuEorqIM9F8QMRgvsDbwoDVgD2opFi88brzheOou6s/cJItpBpzZSy7YXX735hTCAOOcIcuFhh+Xb+ufp1u69fa2iKycP1IQSyERzd2a+U0H7B8m4FMcrHoa2atxhjsr+G7vD9+8Y98+hRF9k1fysGumE2pkVncyz5wp+82N+NO5EjbbpTpOKPhCZtasIZafEPOXQ7u8vyMiw1x211WZamxTVOIjtInkU7Xza1NFkXB7EJCbD/ROy60/vYtZrt6JNQiq6Ma0yAtjt9siijMKTiWHds4yeLRtzzsSkMM5y2c4bkbP+l/zbkQ7sB15EXR0TRz86pktBJBYVnBOxF1mbIcaprXESHbqE06ewlSwk3iyJcCVwJau6i5sVvlvG2VRBRr4SRTqCWoti6jMEPSCo/uV7Sa7PbjfNe3EVIq3vWjlG9QLMRjgaieYZ/Sx4AOmlHx+2FECgjVGScai00oSMPBHa+0voAA/0bLE3fc+wCdgzbzCOO6LP/3PsgnchhVnBfsc1ZewhfrUAaAWjXQz2nRtgDgoQHoLqSAs2nexHO1DQC7Y7PDS59pyLpKqGCAawJZXIFC2xNJ+jnMGOVRAvYDRKVT6ONJxwJ2+OSrx7kkXtpVG5O9X0qdT+q+4d4tmvu77C6G5iLq/vI8N0q64v7y0SBKMDIHpx1Vjz4twJX8+e3nr3+4TPfMtDnxQF7O2B3XFMviXfRSKGOL7vs5sq+6CrYVdolAHET0UxzJroxMGQWtnmDM4GE2JcPpWPURzGc1gDLBICzqM6Li9DLvelY60dPGVjkV8zld5pfA7a+8CTdN9DcbfE+ggtU/6qhnGkaYUOg6QgSoYzfsNJRfIkQUFt/H0Cqmozt021Kmgd5f1OJjnl/XZKXeMtWVXHgjv4D+8o5UBtqAJPUBoF40elxHAYq+VOXbkELZxIht7/kIEf+f3FvPuYyHNJIKJdeg16GfKl57vWfpSWGO8hiBsn2yeqYKX4zGcNlWIir1od32qxV7Yjian1IaRIjTktrAT+2huzKx+rnBX0etP/wXfVkRl64FMU+nCSmDfwpF0xyZyIl6d091Sm6hk5LWe/ED7h0ld5opsdyWK0gP9VLU52k8d/TWDi/gu4Eexy3BxqSwrchY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65f88207-0d5b-4222-5f09-08dbd6c0de1f X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:45.3365 (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: I+286afHoPglFx8egIMNJjeVrRWjDP0SkTGzu3JJCbwFmBcK+e/CeW8mlRg3cQIacxjaax9DaeeuWc9IwsCgruICidGXpXsTy6783TNNXic= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::72e; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org In parallels_check_leak() we change file size but don't correct data_end field of BDRVParallelsState structure. Fix it. Signed-off-by: Alexander Ivanov --- block/parallels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels.c b/block/parallels.c index 33bb8f1084..d6dbb6757f 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -808,6 +808,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 Fri Oct 27 07:46: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: 13438176 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E3FDC25B6E for ; Fri, 27 Oct 2023 07:48:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZg-0000co-7P; Fri, 27 Oct 2023 03:48:08 -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 1qwHYm-0007EQ-5c; Fri, 27 Oct 2023 03:47:21 -0400 Received: from mail-db5eur02on20704.outbound.protection.outlook.com ([2a01:111:f400:fe12::704] helo=EUR02-DB5-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 1qwHYc-00040L-Oj; Fri, 27 Oct 2023 03:47:08 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NtTERGH6WiBTJCwtT/qi00Pt/Oex9jPZacbwabf/xGHWtCjtNzKzMe41lE8AYBuW8O0oj2T/CFt+p88EvR8zvo6jZtejrCEgz/rb3L/kIH0pRiCrTdkhYD8noj3QTYbccioOOh7YlvqIiIxENPmeHaTuKWLtnLThyl9hQ4FH8FbQKKNNoxzisZpSPzKGiEC4P4TExowlixVLPYdtJ6kCSSlVGk9+Gf+dA4DqoZ89y8/ygYzv90pDhxAjIVBiN53OWRaSx7p1Z4KQQipzQ2RrUBQP8fV0QFPnWUXYDvQyJYERInawB6eD6vH5GiAUa+ZpVcANMD40wrn8w1U3Q2i77A== 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=8r6mB3zQJM6dQzkUf0KM+AriCgiob8b8EfOfSHgWHL4=; b=TunTq3QXJSZWjxMt5H9oD+bzoE7RbYBSe8LQ01JXIPWowGtu8VDhoiE6yyclzrNayhGA1Re/QeZt7k2wFgMd+tT7r7zAiLEwwciffxuAdf2gTb7PPAmq5xirgT8G9RsbRMl9/LxXlryqtd3sd3IqLHtM3TOlTZkC1AIzZ0lpVJp5kIzOHMfqgsWGt5U0FDP8U2gRDCq0Z+LpyIxSFi1CvxLNr9sSxw34mZ1UDuCu2Zy4opD13TuewjUfkdGxSFEEUQ9PGTTfo3oiewB/JCoFTx2MaCIeS3cv9qGZhTZgueC5tCnJjs5rkAWts0vEhoXNI/CoxkvqU9vDisNhmGprDQ== 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=8r6mB3zQJM6dQzkUf0KM+AriCgiob8b8EfOfSHgWHL4=; b=RlyPl1UIPtfjtUvVbfBJLMXXqmS/+5wpVQ4dOPDCl91SxXL4qg7S0MGSO+iLzretvm9hYr758HVb3tt4jR1E8tD8DnkK6G8xq1tr9FdO9WMxRyKD43RlsdFz555SlMdv3QQ/0xIxdn9zrLVMtH+Fz/eq11TTKoTRm8FL1eV/Gk+P7K3fzaYDYSPD2dn/eL0hznJXqeuQAJVXWzTs2jegFsnWorY0BJ2yBZKkFLnYB1eKqHx9/V6pLp3onkloJ7CVcgnYfbsTeUa7MBoywNad7SPsIOeOdWNOuYsIeEveWv56qcULl52XsqKw08uf0I3qkej40z5QTlxBnNgzsdXllw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:47 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46:47 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v3 07/21] parallels: Recreate used bitmap in parallels_check_leak() Date: Fri, 27 Oct 2023 09:46:22 +0200 Message-Id: <20231027074636.430139-8-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b4bec72-c7fc-400a-5d7c-08dbd6c0de5d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X8w1d2n12cYYRL6ca8s09bUUA++XgV/dtbPEU81+dIXkI89QNKuFUsAgwaPSfEC2afVy5srk9DjEb4TzHBTdQHFNmgrvKBkXug9HZavuN1VaIeAPvxa2DblCdZAF8q/+pBM4emqN5AIWIP/WgB93lOPYssszPeGb0y/KZq1SNaTU8Jajs//sVwCNE2P40tpe6fWfwgfK9ysBzGXrz2bpK7iEKojc925XhDEFUugD+z7qQX6wRrgYqbaT1ZAvbXgtNglpuuRC4wMMiXm0jj9gf/h997cUPjKfMawbBCSPE5qFW3JYVrYZm4n+Kk/URxA308C5ousAWpGGPXfFhrWVOUivZ6LyUnXx4s+/FeKXWub6cUjjfobPjFavVdp4gf2lJTm6Yau9pDPE1yU7QAdQ6GxOcYZET9/FoX0J9w073/N54w6tcJ49Qq2V7ZCtoW57ft3YabSsqBPtrMTAsLZ7KSoQ3ri9kX3prQ4vvFOBGwPy+rZq2UmnwN7g7dbzXpD6bTIeM8wnPbet8AiF7tzJERR4clPdUs6cLHcIOp2qTt1kT0PUjxxinTqyha0ce8dlnbld6+XByLpYeXQW4T9yhqrHrsIeQDhvy2Mr8dIOp1oniyeiiGbwuMfK1IkPARMM X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(4744005)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4eTBSzybI/PHFpDZndmngp8b4+fzZh1dlug06+VjYcIIr7KFi71h4h3EnaVt8ZmAROQLPV6LV4xeuQPknLb2klIrO7GqR4PtJlaHzBsimBviN7hT+n3GvJnhkCGxhwcGxczCGWpjHCwkn98JPBk1QicL2XuhHAmYgcnIfOe+NvSwzQyicJ/nErPBqUsvCYAjUwFI6+1S29YGM0ptOwvDJNtCgKZpUFpqhuudUspqqL5hTsYOmrC6VCHF9YC+dyD0irZ/6UJWisadtbN73YvmbbkkJ5FAwDB51fHVG3BYjeZmQzHm9ak8TvkaFh28SE/awmXyhqqa25v1Oq61NNzzzRFyf6rv3ZkFQgwnGzHCcZdM17XTM3tPSAfjin0xvJ81QsB8n93VTX0Gl5gV0aATsBf7nkkOP5bO19KHbL9VTImG30nAW1QyKSZc9/2byVMcr7xb9A64k8Io5GWl6K6jSMGaSLIQ2HCbo1iMNySMOt2zK+fCi8TKmJ4oz9Hn3cMUSSn+Wsmqy4/eTdotAo0a7oufN48zwfFwT6BTXZtMEvP7lKUp6xu1mHCXEOTXwGEUzQUMeP+bcyfvucH/B464PQ+K4cts5JzwH/NL/yKXZ9dssknKweZ+E1FHUjWppqp16BaDKkHes97lfqVXNYS65ekVsBzXwIFWcDJPNrFq2TDf7ExFi6Ls4HTMdnM3QODoleOB+Ys7LicHODwo/Gjo2gFCy64CiyLdOHB0YfHxEeem4UR/YeWpJjoNOa+DsZ9kZ1CAv1ClVDnnHoilv3LA2EtDzwvFBZ9clcV/0cW7e0B9SLFICL4eklQeC+AsVjRzkDHEzNcHSJBPtvJL9TYgg0EyMqFogGOrQZGDolp/GXDM3HIdyAbUf88OeNDBCmfrxys17KT/8GpeKCfa7uXogGNSg96mVsv+pCHDkvzx277zi7YmyfWHMZC3835Te01gnmFw4EI5eHF3YHDuWv6fGzvUE+5N6um/xTT3+uzFEDhVC1VPeFRXOjXoNalxLKtEDv3UwsmEb29PR9SX1T29E+5RWERaRRwOCHU6TVJ5rlyFT9Di/f6thQNbKUdsHnEO4aLzGF127xmYu/G55u8+KjsZfqxnOJ3NwUE/s0gmxVKlLU5eNw3MquLaQJ+9eI17DEIiqHlS8lgoDYJ/qkbieviURxMAGWK4RcnMSIe+uSlyxE5+kdKeDkX80yZQI2T4IPEJcSkA/ASbjSNxzl7wio0iBVSE5T3ufVaqYiivLTuc95gleDnZtR/6HXkvqcly9KaC6tSjbQGTZrAkSSv2I/Z+zmxor626GeJEvMMikdzy32rsjsd4OMQ7DwQ89I89Ju4ttljWwUV3rxyOiQyh2g+96Y3H//tYlhxeaA4XfGhYCGxKQekLXeplG+iAT2gCfrf4qgimd76dJgCRIPjxdckUcwWScQVJTCuwjjzFMMmZRxfE7woNMDE+4GVwDvQQVcGEGCCm4JSPnCtxv23WI+byhiMYUuZfuH1cAeg+Ug/mVmp0ct9kOuejpO7V/bIHOdDoaJKJ8R1TeEgJ5LPy4svxNgsFO0ix+2eVuXMk/kiAHvRfzilwWNHsvSSAYPZD2Nh9YYpLMCeytUlCLsyRNKUvIKrm1vGYsAOfiDga8Ss= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b4bec72-c7fc-400a-5d7c-08dbd6c0de5d X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:45.7022 (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: QIz+7jg+P8vDPi51hKNOop/drsj5Sxk6UPMCBhr6CuUzeEGhVvKQxgFfQ3iece17hiHazQJ4gMAKkSp6/crH2IF/hOwg46WarH9OlqWlD24= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::704; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org In parallels_check_leak() file can be truncated. In this case the used bitmap would not comply to the file. Recreate the bitmap after file truncation. Signed-off-by: Alexander Ivanov --- block/parallels.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index d6dbb6757f..2ce3e40ce3 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -809,6 +809,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 Fri Oct 27 07:46: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: 13438184 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 716F2C25B47 for ; Fri, 27 Oct 2023 07:50:08 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZb-00006a-To; Fri, 27 Oct 2023 03:48:03 -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 1qwHYm-0007ER-63; Fri, 27 Oct 2023 03:47:21 -0400 Received: from mail-db5eur02on20701.outbound.protection.outlook.com ([2a01:111:f400:fe12::701] helo=EUR02-DB5-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 1qwHYf-0003ya-2M; Fri, 27 Oct 2023 03:47:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mE4wsPfrCVWiaZfObYTnGlVSQimnB2Z+htV9ojMhcXe18YqJMvEQyhxiaJL+a+E7SLh217ebAsY1GjQLFlESDEnhBozrssOdoxEki82LN2k6VPj5p41vuFMyH++xVA0HegET5IgGWU/a43rAb8p/H9PEwajnL+dqy4sPqJHy41ilh40SdcJXNcHBAxx7JNIi2aZk97RjVMcq+P4DDmI41vgeJ7bXzPYiNwJYKWb2VSkiXndGUmhPYq0eNHPJFeiYNwM4jh3qm004pUWlMC5XvNT2IIIFUQYuhVaDexT/JCUyz7tJUt+6flMZEtAP2oD4PXiAtwEMmbYgfkoAxAcDJw== 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=sfC5f5aaTOH8AnC560aZJtAvpUwVT8OctGCaLGlsUng=; b=CV96BCvqaEUFcTwHdAh7L9dDJSxi+grCUEAcc8RvhHUQqvYJ90drIvRofXLzFjaMlLbFRWbEV16JR8mQYoVxfkanYNGXQPeP4hWJ1O+Rn/qg9x8JKJZjStlN5VvkzuhtVydU9BxON126a+MXE7QBuJgTS+DChLd+rGeDctGRrzZk986OXV2Zf5vVgQlbIxmqefu8zoHBRnIaB0TSoeqZFuEwH/VonRCbaHjzTCSXsfDPy0Yf79JdsEWedy7AXI/6cwp2akStXBou/oGz3VPD6ULnyxbmvsM4gUDPLNta4cnKggyitBVe2RVtXphEGHKGx9A79EZSgv5Xxux+mPHfMg== 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=sfC5f5aaTOH8AnC560aZJtAvpUwVT8OctGCaLGlsUng=; b=fHBhNxc5TXrS54Bawg9S77NexRa1/82/2FmzTgu41kmAKhN3+4G79j2JQQEqoiH6QIjdXabZv+SyknlSqFYSfWG1X8PhK5ctCV5WfJa517pPtTPZd8rM4DGabbPccZJrO4+cXsKtwrvK95pWLuzU1WqeOZha7BNWWFhxkKXAptHDrMjGV6UHVm0OCxEwsnKZFsvYh/7fV9pQoKpl2y9vZ8zZmhfDGVUYFzTaITUqXi61wnF34cAiRfyTaxAPE6/x8ULhYIre6P3sUILyRQPQNwuq06YhQpnNl4cmE/e3Ib/KqRpZXvY/QR1/xp5bi43N3nEQfIe/hsfxDRVEFfY0/A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:47 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46:47 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v3 08/21] parallels: Add a note about used bitmap in parallels_check_duplicate() Date: Fri, 27 Oct 2023 09:46:23 +0200 Message-Id: <20231027074636.430139-9-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: e1664f87-df99-4093-34bb-08dbd6c0de94 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XV2sYahfJ/G+H0xlkm7fXOnpjWMqHFy53DDCIULt/4MlP9dxDDWin6JVsfzK68gwZnXjDDn1UJDHP9shI2cP2pOL3Rs6Y7OWfIxYlb9YcYqSmlw7dIRHpJ5XPWSauAk4jO/ASQzIbPv0spZmMXo9SfDjf5bgfOiysaxgeelaXVEGIHGRvHfSzLUuMe1Q7c9oDEztV6BY4QyLUnu45MD82Q2Xbzrf+EPiTchoUY7gODZi+GjiBz68/klV3JT5ZvfaKxUFos4Fk3WLpzSti8HN1HHVLazSa+1XGus6NqDjvek7mJwlZw+mV+zsX1OT43e93RqyyRdCqYeneZrG6QOLGOWxuPtyviH05eey7weHEgLlbFr3nTiIqLflR5vLPye13uvYMZKUg8vrWWNdE1dP0+3fQ8NR0ieRDNfTRWsMZt4UNeezSCPua5Dz3+Q6rdM1mphgtNG3ICAEOLxiSd9F9AKxuhe7pOJNmsQ5PADcmRPSqHXdWQQfAzqxSWb6D/4Hmxf3d3cI3aYCH8rwH7iOax4Za1ofQyHfgCHE+UmkdAsT5Iw3tTp8gbJpNxolim0huLJDPs2HTTEIcwG69seUSOBXZAq5EjLA0Y0uAXow94gcVmvQn06mMhLN4jPEiCkp X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Ob5ANLDi7qYWvLsjKHVHqomFMaCLTagOkO0yNIin8ApGoLtlAHnpOlIiqbg58Cw0qpxpUJlwj0UOmcLrGGuiB4erlw2jR0iJufWisKNJ5ffGzftmoJcBvY/VyZIJyiQGkzKoEkxqr5NzJrtO3q/qV2zmvv8fD5H7ewxX5CghpE/hMNmk+Maf5OZoiBLNXmkpsXeuV+wP/YN3NgFK8UD9wS6fZoEV3WpuDtQJ2Dv99HsrVL9ojDZ9UUrHIyympEJ/iY8JnTR1cRkNZAjkodhuX+K3xlu0HuSW3hsMucvcCI+KLrnvbsHWlBMR4BJndjN32li8E98JtmvLfUMqQeW5UH3wYMsdR+DeH/RoPHN5+YKATBrw+msOlilxBCaaw5U0sVZX/8GjIoVXdg1LXYxHGFrs9N9D8gccCFEcEGIZLqAf2Z7Vvogtm0M8cdoR1g9rBMpRrrxQmexamBmVmPHYzM38E3P6W68FkL4BykXSTwhVT9SvQKw1uyi8OuGf8RdWTFVdAKY3Ea0ypkhVEpK/ITwudP13UqxAr0WHCq2oLMLWHnabxx7miAxOxciWsjY/biyl9kOV1L0mpzgJ1s07QcH1rm/2mLlOczzk2hZ/WOcKCjC6ZPf3LnXL22C8Futdh41Yae7o+7XL72pkh6OlQN5teU4HYoE1me9+aQdKKqKXH2EvFTd2NcAocz/IX+4AIs5gTxsjK76/OCxZFTJfqwFOUH+dTIDxGw60q2YVRgR3/hGCRvSTFuQwioECGipPUcLXehd+mHTp1uUddC5Jtm3T6HkhgxIgL0U0L8lckp9YhdA0IQnAaK735F1/zx2jruh1NxAQNM3p2UHnaXomzg8eI5eswdhklBUzBgyzPRwz+E0+Vwcz3nWoveKl6nSlH2RoB2ikNPqtN5Jypn976tnpXqZsODvxKXRvy5BFcKiRR4MvZJxokRwne/KG202oA5bSkG8JwZ55AOinylM/ItCoovF/a4b83NIlAU/Bw/QhTF5JQo9ab8GyUP2BFdpJ6IoJgxS8KmynkPNi46AvIhjkEMsNzXSUc0gbXpz7TcKVHsxE6lUmSBXbaU8MznlfZe6lYEwY+DgRswf51/8waizOYDvo+ROxweHkGF+vWycWqZLtUtx4iqQEUSg8BW0wJjqZit16gxJ7nLuY6oiJsOJFjDqaaNmcCl0u1DPyHqKdbhPSlGhCJAoqrSj3lm3OTYHMKRpCVWe2gETLsgIhM6LpWOqfjinefYIk9nvJR96xnAo7x4vVSwoMeMKcgNPExwOBDE3Y0w90deeVPSeXD43xny++VlSgh3h1ZCR/2Atg5xz++E8L0Buj5cIVnHBY6UG5zmv8ZlQS9VZIlyy8OaHSYqvRFJ34zpm2mHTGz3AT6+fiGCNiEDF0vzaRD7bsj7oW6O1nPhVkUy51z/hT2Gp5/S9ylwkCOZ9dOjTj6FaV0mU8d4o9sTKI1vsHPqtXwiMv0dlBzqi7gkvfjxdXLznu19IEw88N5HrKuuplnAgGT9xMLrZZwVmhUIZ7rnvT9u6MYnihzKWHIgPOKBKNhwSzXCgwepJn5g4BMMYJuyATIBp0YpKG0cQqpEz8RCaQPMSDfHz2ylfD9yJgbHEiq8ISPaTPSgYlpsbGbly8qYE= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e1664f87-df99-4093-34bb-08dbd6c0de94 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:46.0519 (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: m/sSPwYzRwTj9MNcl261eolkdkJcJqiZ+NumYzQ97MImynGuz+dKx259BwDLm1HMnBIKf6/cxssIGEBG0wnOFrToCovq1ewvqCXF+PeaAq0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org In parallels_check_duplicate() We use a bitmap for duplication detection. This bitmap is not related to used_bmap field in BDRVParallelsState. Add a comment about it to avoid confusion. Signed-off-by: Alexander Ivanov --- block/parallels.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/block/parallels.c b/block/parallels.c index 2ce3e40ce3..481b6992f4 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -839,7 +839,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 Fri Oct 27 07:46: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: 13438179 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D2E49C25B67 for ; Fri, 27 Oct 2023 07:48:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZL-0007q6-Pi; Fri, 27 Oct 2023 03:47:47 -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 1qwHYm-0007EP-5R; Fri, 27 Oct 2023 03:47:21 -0400 Received: from mail-db5eur02on2072e.outbound.protection.outlook.com ([2a01:111:f400:fe12::72e] helo=EUR02-DB5-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 1qwHYh-0003oB-81; Fri, 27 Oct 2023 03:47:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZFoOzuiV19gEdP8DxZ0gwdKAGxFYdy4sjnxMSdpavCNAlgC7kTToI5q765XbX7dBpXgaZy+OWXZkAkvasY/qPDPFELAWVN2K8HnpqD58YGFI8zwYSF4t4G0sT0dg14k0zoNoPQErnSWuZ7oOC2dhrcQ61EK4C84WaF3tpNGcu58BjE71R4UeWQLL5dW1dfuDl9XyDJtYj62O8TC0uCfBoNTYHErNneuZ3IGgMC/Zu0lzfUHJiFJQ0bN0b/QaTLDZEwbw0yYwuCmg6kgbKJACtMYSmhXwyFG27dgc5MDLXkTGCywbOzqHGDD/FZn8K4vMtn1BTA7jMMZRvzYj14atNw== 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=sDmo7LAvzK9QaWsuJVA1/nreuMd4fYKvz4iP8ze4nn4=; b=Sr6jMfuBCDeZRPrBjQN2RtwijpQp8yfn0EauPKjzjfsuziSL4NrGiELZUtOcMe/4xzgDleLU0KxikvyZmvDiRmQ4RrBEwukePIkX+4dT6bG7FwU4T1UqqZ3cK3IQ5uidJUSHMV4Dx/OOTIVfDdWmjhc4VrJhKN1OAwD0kjIX/bX+PYFRIg5j0qsvsqQcwwSTTpYKQtr0aGuNygW1nui3IaLyfFWG+cBq7/0mzJ6DoZxNdDz+IdSYn+A2jNUna97X7gXyhATVqK8XAQRLvJv6/zAx4qIt9IFPofzEuJA7eZikKmjespMHJfYIyD0nC9Iwj5t6cfwGEBZ06SVv2uJCTw== 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=sDmo7LAvzK9QaWsuJVA1/nreuMd4fYKvz4iP8ze4nn4=; b=g6kv4kxLtjMehNrsT4jwquPfd8wf29pcjzrXnVdqDjCVbrwXAA+IjgzEMSrIvlTd8AuPt9Zh9KySGNQZ+rX52nwFKTCWQqyYzLblZ6TsRag7uTP7cGPfqksfiy2g9VHW+8hC6XqRmQTu22Qp1P3NehSMLWZgk/lx6wvbS2TKk73XrimdI37yKTVrHRheTvY3Dg+eNBeIj5dr9Y+jXhnbBC9Bd+a2f0XcRnsCG81U9XwkAQrYFBai2bvRXaCQNyvewPGx8gdGtaw/ZdO36NAHAsaBWS3GY+ZF1bq4PSzndpUaI6SR6H1S+NbSYtd1ndCTJZ0oYH7j0JQWjwlvAHWQpQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:48 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46:48 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v3 09/21] parallels: Create used bitmap even if checks needed Date: Fri, 27 Oct 2023 09:46:24 +0200 Message-Id: <20231027074636.430139-10-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: d71b61b5-614f-4f14-d0be-08dbd6c0decf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bKZm/Gs67gS9AmbYSSndLCjDshW8DSj28EOGJvEotOQ74PVRI/g4lfV30ZPrgAmyb+agAzc+d2zAlSENrCRAtF/E11iN4R2DgdLVcDBULgZQHbaHHoFrcP59IUm/1UEi9xWtd986Dv1y4xV5f2LDPv1GELl/vwbkVOYGhLAlgfJhcmWfroUr4v0BLuciZBUXI64boTyhhLfj4Uli+cjDUi3vLXevNElR0hOOqg7XDPZP7Xu8zhZB3wDo4K4Z2+TIhGsHJKcCF7I18Ir0SMvhzsiuiU9RB8O9MEPQ7a2RP1AXxZtbweumJHLfeByx12RIXhJuOOaBfHgAzpgh+hTQe9i2YYv//x8VrU1UtdDLQhOMVOMCv7LtiUdm/j9jBnU4HFEfBHv58mkdesMKTluQ8vZnN87G5aUaP2KmJWTn7WhuvYnIrPETDZy0XtAzfKX0O1xoDWn2TVofEYB24vCfFDj4Kki/iBUgPBQ7AB/PsPSNwnKLbi087Vj9MomefHt+kjZ0WyZFoPIpKJdhziOwFRLKDFG6X7fX9/hJKmnSzYsC7jPwkIK817HAvlrgLax8iaNpkxEyDY5flwNzjpXgkFTfIsNQtmQ8YzQdWGZVloOoXg24krq9FOUa+YItd93N X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(4744005)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JbaxMgebiFTFXkwYhic3rHQWZyYv6CjNazK7W93RKTSzn0j4b47jfi05oUULk9QdOyqqAMavtKDZ7HZfpk54vFTmylkGWC00lHzRR153tVU7TRaa2Jiy4qv13jm5tokUuMGDteL+9fArPyoLWpgqlzYxH3xDGH1gB8HNeN8vN4xonT8rMlViQP0TJ0Fn0DAeoPswVayjplv4Cr04DBTARETUN97tc16jkNeXSqpR1u815thmPeEWPa7eyYOWxRM6YJC4+/PqHCzZnPQY3pogldEo3hHQQRP9AlrIjbdbuisnroVhloK8PqZk+R4kjL0A1mWLU+h2UyE6YwyW27eToRB9YvORVA5kLc74siSOFsrnP6mN6w05XGsGWir91YuPyLj7+ckTNM5mf5ci9152lt2zScX/YaKfEv42mjdKICLI5NRj1JkbPAey2O7lsh1QVZ5qy4BGIcAKpYn1KN/D22tw+1LqjesSYTwkkK35iSOk5venkEByBlLf2OO4Dg+Ar/VVtorMiiPUhjHM7SLY1+wYSDCczr0AQnbv2BDUEr4ex4IEOLDRjZcAHU9Lk0SVAgc4RnXYRbRZON11h1dese1N213l89SQgdIJ8aj9yHpIFUjatcIgBZbAtZqQhP8M+iXi5TJgSs3Oew/de+U8o1glp344Lu5D0Md/90mCaxXWlU8OZmhy1HYEw73Jb7VR5r6hZ3nnFU7LcfXj050lLLVGk/bGXpa1UPBiWLhn7qjToH1kADl9f1bB1G73/DML6uFw1r7P4ojiZi6EOTK7FvICtApV3jJXnUF9+7xiCfnM3ZTuZ7wA4w4xwNcW8Zucfi2ZYDhSClxDfMrc1sCTf4b/+IbuphNj6wQnlsAqMCXG/9UMOevwOILp3hhQPAQ1IH7kvVdbFzQq/C5nwzB295Om4j6Q4x6X9CYGLsrXnhYbKODEkpAX8kP5RK2T9BV6BOsEbKymuFr2lFYbO1N8wW0cumiDcOZaf87xib3tNAw3umWg+6Dq2SleH4pzFtnEcSaLeX6ya3/R+BMoGb2Q5ZJEAEm9CEjNRiyopLJPVPvxeleE5udhASiDgL0t3zHyDpwwUNItruhnMOdVLcHcM9/OcKzTjrv+jKeDEIW+ALFWix1ChwnbQNbdfdZWmLpy2O8scL4r3PbcQ/t8V30OrpjsM/BADZLLS2Gelagu7f2b9nLCAR+V7QOgFixjxNMU/CPJbgQyHXZTLeJs76uCmxg3Njw+GBSnxsooCiDJlm2oVZyXFjO/VvSXRcK/Y/eefpV7/Iy0dksVQhIB/FKa3rBxhkLZnpIf06c6VJ5HIgUuV899HkUxTNqIUMQS05dH/hmnMVmwxOSc5xu0RdoVawt2JEVUhm3kZ5lHfB1MGD9QBd7YPWuGlYGxV6tuPgI/Z37QpfrirxyBo9QOJN24tl9RX8apYGcXnUe65CLYwYCyWWT9s7CjF9sQttYkMqE5+i9NWHl1j+SLfyqC0PU0tIw35X6exiGa1rdlLEnA6CnEtadxDaNaRp4HCgRq5U8Lg1zIjiqM3NehvmmjxlL9iXpfeJdouP+gx5m/i3+UAQ32pcg5eW/Svl3tZUkO4DMZKxJB/FPnK95W4nanF2hRqS895COrvyz99Eic6asWwQY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d71b61b5-614f-4f14-d0be-08dbd6c0decf X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:46.4302 (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: SiI3g25micV0v+lpiLB3dLfd6vFpXOP26jFjj59rXqpnLggQlgeaFj3SBP3IRZjpHXH6ACDnRpwbRdwLuRZiBfwQDgj3NCjf1WWx+i7r964= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::72e; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org All the checks were fixed to work with used bitmap. Create used bitmap in parallels_open() even if need_check is true. Signed-off-by: Alexander Ivanov --- block/parallels.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 481b6992f4..925aa9e569 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1423,13 +1423,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 Fri Oct 27 07:46: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: 13438180 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92B19C25B67 for ; Fri, 27 Oct 2023 07:48:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZc-0000Il-Vd; Fri, 27 Oct 2023 03:48:05 -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 1qwHYs-0007IT-Q5; Fri, 27 Oct 2023 03:47:23 -0400 Received: from mail-db5eur02on20704.outbound.protection.outlook.com ([2a01:111:f400:fe12::704] helo=EUR02-DB5-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 1qwHYm-00040L-QX; Fri, 27 Oct 2023 03:47:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mr3uBQagVzx/8Wc7A2iOwVIigLR3lbYfO6eKYux4YlXLymKZQ+c/+m2OTq7JLUB6mCU1UHGMoxXd0Pu7IJZsAQminty/kW3qnPaMISIVkSAW00fakGZ85yZS+1CDVyYIeWfHA7eFEMH+KUgDn33oln2HENdEDtWVzQtwVsOXW8gx9PDdSV7Qjb0jrwfqz92z1B2FBpdD35LbCE4m7MLt3Y+V34BURJhDFhl7u5+Ogn3L84rB3tf3ZVIT1peX0mRqIb6uCfArc3XV/PqNcRijhtFDGVsZ25lbJHzg2JvMxvnQ6AgOud2Jvu2e2je98aG194yESwLZkK/SvZ+0lim1qg== 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=SjqSBFKXqJU2hAUfhWqXYXDLCOB51EzNML7tEqlJpl4=; b=HRr18ryBex8ti2A98nZLzxHFmYxkPhnjWA8pVW7AoVZZI5pGf3L6sZE6cvvGZg61H+BQUx8mWcZkg47wbsNho/BP1owOj0wSlViHScR30zvJYGXnOZlys6ftgzFCWwCBQR1Qm/1BBDayuYK69mZJOiuOwr+HSDjq4lwGttW0mJaMcu7Br0m0oJ4Rw27ZKoEAG8DnJVDN9k5SMYRURzcW8zUfiqt3185H/GqvVZ6XBNXJ6soYxSlRLYcmstzcddIvJicsgTJGNF7fYcbgVb2XtiPyjAk8od2TBi2iFPnxgXTN6YEjzPPWQrF69hk3D2+y3JjP1gNrFic1MMPJUZ1EWQ== 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=SjqSBFKXqJU2hAUfhWqXYXDLCOB51EzNML7tEqlJpl4=; b=YDpr2m/NoIcceKYzFhFT18qduDjHAHUJuEX48rDwskVTmE/6Mp9b2uxQdryIHDuGdasKpJtnu9M5j511jfQV6lqHtfpDR8cG8J8JNyjn7knsnuQ1rB54ODrNQKXxpACr0RTy0nVh2C9ZmHWSwMVAyOLsGOfhlebOmMfifgjCyTnymgFX6eNHUt9Mhoa3A2sGLwiFy80eIc8G30PiOLjfQphOGBCBWa7HND/KhAvXlmBj1UZWClerVilJoAKyjqq7+2+lUsiv1sf8ULaRRjxfLRBFEvvkkbVMDJzn7mP3MA78TCzAsX6ElnLhSWAU/y/FHKJasxiFqudNX9yQx63Jmg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:48 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46:48 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v3 10/21] parallels: Add dirty bitmaps saving Date: Fri, 27 Oct 2023 09:46:25 +0200 Message-Id: <20231027074636.430139-11-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: 389bf89d-0d2c-44d1-e32c-08dbd6c0df01 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g1BX/M5bP8TTOdAzphtwC9gQNsh/v5KgyShAHy2Ok0HXocFBoLyUea7P0s0wyvgPz2Z4K/furp/kYxY7KJ5BgwdwlLuXmmnYnmvcfnq1Zt1XKuU3Wn8j0MBfY/TEGz7KV2BpDfrSk2NtNv/nt91Xqv9BrQh2xyBsuEWDgkr3aSndDt4ZWVZqbWt+xuyi4dDp2VDKOErw1+Ym1arnpFv+5/2MgqDMFvEvUydIq1Se0hEya6AIw0rFixt5Yot22J5LkhRN3AAnN/8EGjydSUpMkEoVXBUB8ATxK7fH5prCYBrWIWGvnwoTP2l7tMuDCh6uxuDcwC7MJyRN5sShYUcb3gNZLtCrGofZmZgDTVv2/AoN6zaOBWRVuQxqbGXdyHAzWXAgN3vwYOMbJDxyM5Vrn9JcRmnn6XmVsg+DffDyYbxBVPNZNqnDMwMNgR9Ts+/I1Vb3EaU3whDgwHLl/Pz1S9cqiYzNH2+zxGvWCyaxByNHCXAXLxAvpm4Pm2pXoyQyOmwpj/U5NSi/iNaP9BlIPm9RFUGXSA3B3nFaL+/Ohy0lrSREVyWq/B9FNwmEhsq+kKiS8FmR3BjsUkq7rdJk9WjXMfhaRkZ29W6Yd4HKegdxV2oUN/fVG2xo3W9QeA7UbhdmsF8KsuBXEYy3ul5dYg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: w1Lw7XXclY0XekJCJwEdAmZHrrBx+aDAshm5bTMiDP+yBjIQdCHMt2GsX436JWIpQUbANeYzlK8NbWVajGrUd6k9rgmmwXbMe9RjFEdu9RsvVLmbmJEk4D1VZuvy6jFzjOBU0WqCs1p6ptY9ZaZso0ATSt7mmYVmX/IB107zy8Jw1YbqxLwaMP03i7qwNv698JcDeupMZz63iC1MrX0dUlaa7iXvn1mPyR0hHBIs0nt9bWZMsUme5R5fbhCnUthesNv78AAHWdzFW5dgEa9xwFRcDLTeBA7yHmnK/fwo6bKfjHGZ8KshBCq3TGRXAtGNwsTHCQThJU1j3NP4yYFlWZt82szQlWmtpyEjTb3Z1NUer1uhvRnXWXlzqSDpTlYw3YrELdFT6KJ0TVWfQNsoWd2qyL76DvWjBgGjB4V8irfFAGv9RYjQ6YM0BVmXeqnHswAMp6H0DY5OtQvamTLC1bqsuMWamyQa0ZRhL0BuMAB0h/A/FwBe6w/PjKsEfxFtY5j8LKYBuhng1lYZyCmkOIxEdDSfevcg0O4hxsQhcoVti7KfqrPC/t/IDQ+Ivlmw5harAL0e1R7mKlwO0WgFIhWdUXQ5qeiKBPoWDl40F7Mp2rqlkt2R5vsXfr+lqQczzJUa7BG/FpkVxz+JIWMASqUMJuyX0H4eQcYNgVcqct6zAt8EaKFa0qZf79GYzK8fpEhAr8kRT5PAPGi4IIFg6olpRgGaSmtnvRrJvEIYlbIVk9w48JBzEixG1vloMBHM8k9IV9x0iCB1t4JWQO+UkHjbaAIa6LqQEHH1sxTSbyrGA7d5WS4cp8K0Lk2bsZshqrBCnA5R4xtv+2JBBubuUKWhzEu2xGIeWLbj1vQS0DMQp4hxHnAVziiQqBoDEk2wwan2UOzIH59bLwfiTGMgiNip+/DwekHSg1IICepRrRAoM5ayqomoiTibBfUdZ1TVO80cX6IcnOy/UA+UB2AnVcnnZd3F41XGD9z99PjEFJ3tM9oO8XcHgxNj3WlWvJyqfwIgEFiLUFtjRtuBP6AOaNT0LksblczwrpCwLKukWqGwwtgtkqFNUUW8BgKS899L6mPXjrZ7WArxmqrsmkHeKX9zGkMVTmU6no0ObwyF9lnesesOP6sbLEbfdAAxEL2f8rKnAGICRtUnP2MqFHUHv6ilhRUH0Hc7OVAvyfp+OSPyAputc+xIcau8mxLktMmhCnGb3i6Bxw7pJ4lnO4UqiDUhX4qbagcZe6q54HTICzMfZUVgKpJXZGzpYeg4sVrRYK7Xg8ZAH0oTyBq+aIbUXza3BYaLMR62lxpZLSD/HzL5oLTFOGoncL8P7UpiYZ4vqjRpRpJLNBoOTSi+JCDbTXjaLWlHOJd16fVCwwmbVgJYh5/CpswTMIcWyL3JiXwhQcov544NFnkVhik5U/FAj+FY1EByrUjsuDMV893q5t5/bUgIaaCRxGv9QF2KLDN4mpht1ksXFPTuGRl/efZQoUQolhMmSXs43wX/WdggeboyDlCC6DitQfEx23vbJX6iS5e7Loccx3hAlaXznqnsKds4CD3r6UpWq1mXxL9J+6GDH7meLV10OyInAJkHR1fXSzSaui1Zl7tNqGE/WSP+pT3y1kAJBvdkxSOYvbjF3Ks= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 389bf89d-0d2c-44d1-e32c-08dbd6c0df01 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:46.7715 (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: Aigh6oJNRhXNHAEjeFoy2o8mSjk7AemZW0xw4HipLQ+gZhNTFGT+E6oFgupKACz8NQw3VyR/Ghk8ml/7g8cX//XP6Rtb6NwdxqbiOtSiu4I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::704; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Now dirty bitmaps can be loaded but there is no their saving. Add code for dirty bitmap storage. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 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 925aa9e569..2d82e8ff6a 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1468,14 +1468,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; } @@ -1525,6 +1536,7 @@ static BlockDriver bdrv_parallels = { .bdrv_co_pdiscard = parallels_co_pdiscard, .bdrv_co_pwrite_zeroes = parallels_co_pwrite_zeroes, .bdrv_inactivate = parallels_inactivate, + .bdrv_co_can_store_new_dirty_bitmap = parallels_co_can_store_new_dirty_bitmap, }; static void bdrv_parallels_init(void) diff --git a/block/parallels.h b/block/parallels.h index 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 Fri Oct 27 07:46: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: 13438182 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C896FC25B67 for ; Fri, 27 Oct 2023 07:49:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZW-00089W-Fq; Fri, 27 Oct 2023 03:48:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qwHYs-0007IU-Px; Fri, 27 Oct 2023 03:47:23 -0400 Received: from mail-db5eur02on20701.outbound.protection.outlook.com ([2a01:111:f400:fe12::701] helo=EUR02-DB5-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 1qwHYm-0003ya-Rk; Fri, 27 Oct 2023 03:47:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LE1EhhBzgWdGN9vSOHOggf7RgimCEQKX3ZJB6ctXe+wknqkylZTUacRedIonzK39asT8jI5EAccj7BcsOfIFRuZxABNkCGMieHYo9q4CasL4v+bqt1tXTQf7Cuput2az/QMCB3JGLaaohuwDQi52Iyo1QwUqHRWpMAPgta++u+/L08yBhMqhBSV2U9AhdljXY3YOtYCgVzKO/MvE8a/XtyzI4X3DEAWBan2gyzX2Gjyu+3TBs6BKSYscQh2Y/lDRpi5FyyxLiX5g1tZV3ugEv44qDOkg/m+r6GDB0gFWvyfYrTphs/T6cSWjSFW+noeh0Aot7DGHbG5BJFWgXnRnKw== 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=pAHDWvdr+vYn61+Lo68SnuBI28aNWSrUGFbEi5BAGTs=; b=Qb2hfWU3AGgERHseBxJuEKxT/6XJiPmdfUD5AKtf7/YpVsqZ7OShMo+rhxH4bM/xkx//bP6wiuAt3j3xZ5KUwIuh35V0ZBlBDdqBScfVut7/Ypcj0qTfypgzVx4hUMclwvmyZ9vLnVx77LBtKcySXsULbEXYAQobMUskqd673mdp4zoHGylZJBnR14iIL3//mPAauKIl86grP7Skn9qaqQLatpYt3ERteguwR1L3FKz/y4R2H9ImWBBNuKLvS0pmUIbPQiMdkhBmMlPhY0RSDz+x1bIC+Hmoi1WSP4yQzCDBtW25/A5La/QVl88vDPzp6E9N7s0t0yeXZsxk3tZQxQ== 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=pAHDWvdr+vYn61+Lo68SnuBI28aNWSrUGFbEi5BAGTs=; b=UX0LK3W5ojmMzlCCQnPtbFn4Q4TynhLVzdD4bf5+iuq8X6wXv614W2znRxUImYt6uhZhhPIQKE3n5r5U14qpsoWi+ugn32FAdmPgTrTtE6KNct2fCAhtHVTIxCl3YDfsA2wJU3kxUd9D+qlaR5kks/gq3rLsOHSRzMDBxXHWpc4gPPd6qg5TINsQf2AYj/JAJBL49aC6iXOW0glEOu+HjEqnpS6pRd0Vzrx0ObfrGG74lO2PpTcArhc/Alown6RVxmShSVc3IjwI76JPSY3XZNWNCagWTY+KbOgZ8vMrd4d8gUXk1is2I4Yszzq5Un3fu3I58tMIy3ECoD7B1vvjXA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:49 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46: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 v3 11/21] parallels: Mark parallels_inactivate GRAPH_RDLOCK, guard parallels_close Date: Fri, 27 Oct 2023 09:46:26 +0200 Message-Id: <20231027074636.430139-12-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: a45db872-1644-4507-e1a1-08dbd6c0df3f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RTeFNdI6Kki3Vl1rsqELRP6lr57eL3TavmK/S4ByYOmXnSFCVj2KiYnulMVUdbWQfqOpbo87nLO4mx6vXqHfXaYjjRTxUqMo1LXttcEhSNgYYglgVeww+7XkSXxeBtTLiRiiaJEHq7d0MLBiRNX+AqozrJQcJ8AszCqL7aQRhrySCa+1LYsF0vQfIbA6snAeKSQCKzeHV2ymKR7mEz0ljfEN44Dvv5MVryMAO7fdOpWLEK3ntTjiNDDt8A5fCNuEFQqWQhxIRwkJeWcd7JsoptUmRgIymwjiQaZMyYhUH9VldCqqFhuldEYd2J1c/I4mZZmqfQENUhz7ZIAeml/8hQQqKsbo8N+HURlaZyqJN8qy1Kiwow2lgm+K4aLVkwDj3JZ7Z7AqJjdprC96p9S2Ai90zYqHXfVqDOop4y9kXNsvIpYSaXSAsi+IlmBNbZVPB2M4mtQX1yO5wvixFGh1INx51Z12hqsNld5JXJsGPdIgihBgay6UsQ2zNBAmVsATt9QAP5S7gMVlaGJhJZWzkl2mmvbYF+Q/pgVdvqAVdFB9ZtPqJWEPeYIsAMkjv8u4zP+GhNbjOEYb9jOJA34W6Bta28u42JVkFgnGvL1237NQGPj9RPxpnJfs+CtQyBKd X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JhH7eyC4cOQc99RsgBe/34nctl/UUIhW1Lq2mf2kuUhNbRWknmo5LZK2dnThY6tJn36NwYFUx1XhuonF+HKEJfMwu/nnY2BMeyGAMTImZpQgGbypn2X/DA1zTboTROzXc9n0eovYzkkzT3qvIyrwCbjLpc4QqL38Bq2RibXP0HtXpptXLA0xv2fHMWlobm1Qne88FSZyKlJF70GuxQ2UTZThiqR/2w0SC/XKpIWpFqMi0HrSIJgqXRxjKftKSstfnT+8bw74J7VSnSlBz7Sc9ay2GuAfMpqbw/5XPZ3J3IEUHyP3p8+QSJ08sA85DQvwlAaIVI2E39/HG5WFvWtmy872hhIGC/E+Pf/x8Iw9fZ9+zkb2TZUSLZyF/xZa5f+CJa9ig9XSjchFzfpzUDRdDnWj5GIeSMPcy7BNwgulFY0CJPrXXDvkqXpnrUxOlFg/mDvt0juezX56zofz8X1p+LbnQqnDXEBG5r+y5EB6RxFMJoHcqBhUBHYlkmxxl1NTAO0XUmsniFAGX6sBgdcZpOhNvYgWReASF1z8ml4X+MKDQiH1bGm+YLMOTUxKT5wUh693iYYJvdzAvIJOHigXUgCQrSTn3xK10bKKqmPbt6y08hAYIkyIC2fYnMQtoQLoK1RE4bZYkomsWkDRBC+Z1CQpmGnwhf1J18SNgABw9bGvRnMMJzmqeIp7H6XdVuaqpWK9rRdxQqVbXoN3PHoezV/ogjOyinEUku3+Y2eo5RLM5DzZNgG7UOiArhUyQrG9+AEfPxBQZYEFW+OWWJnoQaoTSQ0EXiER11Hxa78vJpnv26ISR0nesbAqCx4Fsq9kqAfe1UqcVjgmT8QMTB3/EQKzuEo7mMYg6ZFeAlRxffj4opPvmCp13/+DOAjW8jR9E9DYQn84U1O0N3fU+VU5ZNZ0MU0EGZSek6Ha8Cp7bslP0pfmzKlT4+zIe+NmwolQWlXXwdL3XyW/oeMLohkqzEsVVF1yHb4rJ6R6CLkq/4hW+gfOgCyhxWLAuVUF5Fi3PtwK6x4zm6H39+IqZa8YrE4vI4lOAgcVWG/4Zd/p9mciPx6DP/XD7DUIvnG1Se/uJ5YrL77n6afhu+LkesVBB94eiJ2kw5ON7kCnZjoNY5JbBdduSyU29m1xqwfusaILCVRostjRqa1wbCFeUKoexpJSwcWZXtVcOzPgaPiYYni0fa/2UQLUNDre47/DHhNIfT3JtzlaU6PMLlTC3fScy9h+nV6T8xUKm7bC6U6W95w+09jtf71VO0tsspv8jaZAbPCp2iB5d0NDAMf7MJlHhXLTdxORLNCHM/T0AI2SA6x0O6qs2F234w2kBT5WED+3gBCgK2Jlw388TK/FUGIXvKthjt1wFyqyYPTygrIf7lnoh0TekoH7FSg41+eVzGUqbSK+uOKwmn8bqaBCCJ9RttYLGkIPNtQsph6UmsniKEnV0cTu8JRPW2yCyZ4AJ+602LRKbOCEpFpWiok5HVds3HxBK1n4lzjAxo4NTKI0uiSpi6EPuFYDlOhhrpSNPr8Ptie7IY/EnsyrUHTIOzdGlozupseTFepC+srTp+KtDcWlQBDCxhD19udwFxWgWV7SCOZLiib75m3qKoKzBjp60sVHHC2CQ7q21DphzMpP9+0= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a45db872-1644-4507-e1a1-08dbd6c0df3f X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:47.1594 (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: 329YaaEQwD18kYybLKmv1tySwLrJuoIl6b4arVIBTApx96Sb8EyTsXeWuo8qb+eKlI5+2O5s38cfZ9FoeupB8DWjloyqiK3Den4iXqdrpH4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Add GRAPH_RDLOCK annotation to declare parallels_inactivate() have to hold a reader lock for the graph because it calls bdrv_get_device_or_node_name(), which accesses the parents list of a node. Assert we are in the main thread in parallels_close() and guard the code with GRAPH_RDLOCK_GUARD_MAINLOOP(). Signed-off-by: Alexander Ivanov --- block/parallels.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 2d82e8ff6a..4c2cb09e43 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1465,7 +1465,7 @@ fail: return ret; } -static int parallels_inactivate(BlockDriverState *bs) +static int GRAPH_RDLOCK parallels_inactivate(BlockDriverState *bs) { BDRVParallelsState *s = bs->opaque; Error *err = NULL; @@ -1491,10 +1491,13 @@ static int parallels_inactivate(BlockDriverState *bs) return ret; } -static void parallels_close(BlockDriverState *bs) +static void GRAPH_UNLOCKED parallels_close(BlockDriverState *bs) { BDRVParallelsState *s = bs->opaque; + GLOBAL_STATE_CODE(); + GRAPH_RDLOCK_GUARD_MAINLOOP(); + if ((bs->open_flags & BDRV_O_RDWR) && !(bs->open_flags & BDRV_O_INACTIVE)) { parallels_inactivate(bs); } From patchwork Fri Oct 27 07:46: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: 13438177 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2CF12C25B67 for ; Fri, 27 Oct 2023 07:48:36 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZJ-0007Z9-1e; Fri, 27 Oct 2023 03:47:45 -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 1qwHYr-0007Hm-Vr; Fri, 27 Oct 2023 03:47:23 -0400 Received: from mail-db5eur02on2072e.outbound.protection.outlook.com ([2a01:111:f400:fe12::72e] helo=EUR02-DB5-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 1qwHYm-0003oB-R6; Fri, 27 Oct 2023 03:47:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jdS5N+RILEeVhraAAN/aEGHrL2EuPJAJ+AvEXwSdqZ24e79ELF+ITAa4JSBCzcsmTEqATGOfF6jeXK34deUnCwgvjM0svJf5ZceW/zrHf8ii0PCalf8vqAZ7uPVr1F0NO1B9iDXcLMLC349PZ//EvkHyTDuUXoxT8dlwCBDpMC5jWedyWyHB+NTHThA4lkX4TRlFzKsxKChQeO79NP6G05ivJQBkyFmYDJidND/3nBMW7eSXTWAY5e7ehAqrpv5WpHI30gwFDEYs6RS5+l1RVCQ2ehWyw46kX4OcYDrcNy6lMNaKt11/veAIXYLkopZd2gfUlDiw5gTkKrI3mheZWQ== 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=QE2iCla6rY7glxNoISym/FTt+shMMY16xHIaDHHE84M=; b=fdJ+Jv/al2rgsBdnInGSdgKIT+V08U6i37nrA+ViRPhjQRn+D+7f37QGh48GLhPUjyI6vlQ+tsCzQZtWJ1obwqvj17kdpjd+qN0xmdsqk2vTbaJd10OAK824CB/7LjXi71FKXGzVx7bUvkvlQekHSkvu//yC511aLKMCy5AblP+ZiEnmntIXUT7rXgSIfPsbSpOP3+BVlZcaJvW39jV74foLgLTw3ybQhH3gvwsumTIiQ7JvVA4jgMHA37BHX72QVSupm8fBJgYPXhwgoyF8fhSCZQZS/yiclLgiPEZmthLtl7qk7x8btfQpB9JG8tP+tWgioROJxEB7KvpLfMhuTQ== 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=QE2iCla6rY7glxNoISym/FTt+shMMY16xHIaDHHE84M=; b=Cziz8zyrQ4CtJPpAXi0pL1N8BaA2RgIattQIDPvXpLnu2UlB/ep4m8ZhtBRMEkRLvaoWbYRUOyCtY24cXnDJnCENt5j2sGZG0zi0t6fhrz9ucroemsgILm8f+r4PMHclupmLkcldouhN3FQ569VdqAP+/5cU2uj4bi51PEG62/BGgofMQQ0UX5TEbvlS6sp+IiR4RjUQY8ezySvsC7AWBQNTRHq9UdJHiAegLmdWXmoC0/0ppQt5P+IKcpUYk1mkojXJBmxyC1RM2gXiwjSmsupJYMetNBMJsL2w+tmcznOEMmnbb8H21sEZptRdzMVULkDjWSZZzcAdvroDzTspVw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:49 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46: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 v3 12/21] parallels: Let image extensions work in RW mode Date: Fri, 27 Oct 2023 09:46:27 +0200 Message-Id: <20231027074636.430139-13-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: 4065d1c0-03bc-46bb-f418-08dbd6c0df71 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gl4lnqnz77YRFfu/gwT+awJHraGDHdfu4GlH1B5gOWRzwUnP2cPsyNrPRqY+ZjmUDlrYi4j9Rxy7X2QMvoIsLz4hNVD2brqXCSVg5Bk2CqLFP+n6nD6PP2ustODDR8d/hhrUwU87ERAZs9WfelQDTzSIxpVDdlZi07cYyOjqZ95mkPR1M+PF3BUOHRYvzNR4I4tZVUk0pn+vXY7jrm+VWmhbapf3Glr/Vkne5lpkMixjgbG+ODY1rwGppx7EyBBlrJFbOJcZV1vZ3Tb2ANQZZMYwivTJGWr26Bl+w3zVq5ad3RshLba5pM9+UcQsTYAMNmYmrGITAdNy1gI7vGD8jlunOSYIrn0mvGreaNahIdEqjh6iS7p79jo4skVSW4EhE5VLGXygpnAW/KRXnpUpNEhwS0Ze6eUkroWeOeZSh5IOALMRzouguFcf/1d13eGDIhrHmpsEWIbT1+o1Lu24XGemW1K4OXsI9UKBSTJ3T/iuSKO7shlFo5gEa9eNmZ0Zg/YGATFU9XfanjfNX8zWFV8GmPHbt1SLiugrKke8vR3K+MDIR/92lxI9edsQbGNal46vjam3tni3nSbB1ar/l0jv+waApZqU/fEBperD1KXOLq/F0pBCPqMhY+R5uyARm+OtM6GlQLlW/DDJW76dBA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(230173577357003)(230273577357003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rseseDY+KS9icM/SCrb/btqHJ0q8iLB+w8/kfMVr2PlnzOdQd5mqfS+75bn0TchX/nPiKp8v1+2/LGbrzoP6iCKLZjeh/+dfIo0kEn6mciD0u10EeCYoOJNLZvQGVwbiqVxb2pgQNc4jEfy3p0HKfU4KgbpkhT6mFRzKqYz9ka1lUAM5OvdDfsuRCALfYlJFQkxnNxDlN611bs73UWsnL33t9QsmuVLQGCSyOw2p0KkY+ZhuimQorbzqbIu8fYFrw5DuIKgwDpNo9vnGMV9m01XjGI3WjNgEUk/N3ZfDNPCAYX2rUcTLQzEXnHRptuHE0oUKIl2ZcNEfk7uidBoBqvhqoT0tKc2snp7dqTmuMjUfI1n3A/lm3PK4SG4Z3gDHO/gJOmwP+Q0MdIBj7u79CMFlf02xEKaw3iahOdCuJdfFvvb1xcmBGWTF9/Nh9p2wTEHbS0Dn6r3VEvbO/MPVc7ix00ymzbtYafKS7kbZ7GgJpmOHy4rwcfsqFSnmlCT0rYk/BA4A+DT71+wdzOYzzwfbttHxAtRj6RUqkldjs4D3OT9AAE05IO6REZRTjW2pnmNNAki7Gr6M0FEXiTes3JWmx4RuYxOgMqTxv/MXFhvWHPWYQWkS4VAEFZ4PGq7HYmNcAFNrMid8dOH5ffR6dErGVHpz4sx2NXL2D/35GQlxZBFPV1dU3rDdSU4DArPwvCUJgj9WrnlkAWJ+wgPFeIKmD88ADPgpTUxkSS08PlrwLIYrpTWyPUMrYvQHJBxsj07xeTOiRZVo7lxj0bRRZ+0vraVXWDOIvVJZ9ebSUxQ8X38Rgt0M6Tbt/FLNaw2yOoEl5bw6SHj5Mc6IW0qS0ANnknNcQRG0NHRmwA1rYiTbe/BXR5VrUttLP++4NXmpb9el3D0zSXCbVRbxQ5I/H6U4q+ocQOrROOnLJJWyqJjsjbQMsc5Ulxcj0bUljTEAotXKH0J2bI08tTrojFi9XlU7TsDfk0PKtf2wJrImwqJPl/RlonOXXN5xmYGP/Pml2TBMKc59cEtYmMtPkvYVsZxy9KM8oFJvu4GYXptwtzxLq83WIC71s+kbvhxhEIINZrGxRIG7Yzxpw6323jFJTT3AC784OtGBomsQ5XjZoyERMukuXIK+WGFzb/00HK0a8fogE8VJiYsZhKbo8RfWpX2+ZWYP2uqYr0lR9N4NU5zJTXFmZ7IUBlIRVQrhqOgkp3w3zZzFZ3S1DHyeOGNzXgaUGMyAu2ofxrOhLO6xb93+T8fY3rFTe7If66zDWNFm7gQejGPqt/UDX0Pco7YSF29n4aYkNIkioaFvAp1g2BAb3ZZUgXw5yCFSO4dKuVIohmGaVA/ojB73Tpj0TQROUv3j7qOHuB+Sf5SzB8aqkYwjpYczQ6VCXVa3kVIU1svwTgW7QGr/aprE4WEfvuf/FWQMQCo1ZJ3FrGMZw6eYLuip9KJJjplTNEFwNTh85FGqxCITYp+YMf6eMNcYiOU7x+p+ahRdbGfPogOGbWrVl/QBD/XXT0QbX8qH9UdE8TYp4UnyHL+bsPRpukRV9B9SNzDlOFx/wZKvZalU89lBu37c9yjU1SAHSA+1/pN71iZKmoqN9cuXPaa2ESBjRTtIF+Lsb0Ut6AXGEQiCoWDkD+I= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4065d1c0-03bc-46bb-f418-08dbd6c0df71 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:47.5025 (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: d0HmZlQUaxlqlVf2mgK2xjyFimF374kI/mYaLI15xJO088j1bMFcGgm64luQMtpbr4XO+C8qhsd4YhDtBqpLuTk0mpsFck/jii0XUFRuuhY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::72e; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Now we support extensions saving and can let to work with them in read-write mode. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 4 ---- block/parallels.c | 17 ++++------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index 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 4c2cb09e43..0a2956b45f 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1374,19 +1374,10 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags, } if (ph.ext_off) { - if (flags & BDRV_O_RDWR) { - /* - * It's unsafe to open image RW if there is an extension (as we - * don't support it). But parallels driver in QEMU historically - * ignores the extension, so print warning and don't care. - */ - warn_report("Format Extension ignored in RW mode"); - } else { - ret = parallels_read_format_extension( - bs, le64_to_cpu(ph.ext_off) << BDRV_SECTOR_BITS, errp); - if (ret < 0) { - goto fail; - } + ret = parallels_read_format_extension( + bs, le64_to_cpu(ph.ext_off) << BDRV_SECTOR_BITS, errp); + if (ret < 0) { + goto fail; } } From patchwork Fri Oct 27 07:46: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: 13438172 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 83FC0C25B47 for ; Fri, 27 Oct 2023 07:48:05 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZb-0008Pl-4S; Fri, 27 Oct 2023 03:48:03 -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 1qwHYv-0007Jz-CP; Fri, 27 Oct 2023 03:47:25 -0400 Received: from mail-db5eur02on2072e.outbound.protection.outlook.com ([2a01:111:f400:fe12::72e] helo=EUR02-DB5-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 1qwHYs-0003oB-Uu; Fri, 27 Oct 2023 03:47:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CJENksIURukkIiqBfhdktB0d6pMu64Cd9yrUoB3g2StnyDg4Cc5OSJHOzSqqSfVNneijdo715M8/2cXJ8F8Rs6JcbHnxanDenbWqZq7AYx1PqRVwSVZm5kW8+9uJMBMiWjDvBZL8HAoO4EenHsZYHtbpQAVej4ekQMTd0JSnfuEArcauLVvgWJeOFpUEeikbDLrI0t1b5+DriXe3eD4CGfYGp2JD1GtUQUqh1k0NyB2Ez9+Id5uj65HAKAPZc9i4C2kROw9/iCacoGVALy77su/5ZS4Y1DQOdEU/l5wTjBikP41Lpzn4sqhX12YzrSExdPTp/3Lg1xluLNUWJmMvmA== 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=UEHJpShifFiJ71Yfm/RY1Gujtc1sId7UCn0Rw3xAaColKJx3E9O4AodTHH3GY1yLFmo2E7aK+oOwKHqpI01veOgREMxSLtb4xBlwrR21iJu82EeEp+C8NxbXmZOrUkkcPrp/S9kBuTMzo0tK+Rx9WlU7ZGspb2S/LETFuw84vL+DlFjKEOmxyJgrS4OXcFLVzjXvRnjJq4m6gVDwjCoh6IfHaM7DUYWKRq7MXU3PdL39OklK/Drk6UJ+FBkS8tOjg39avcSHmxuZ+/fTF4WZEn+CfZf5IuGdsiwMzvzbc9fvISTwuMYfcQxjg/EUaLYq9B+JJC6Q8DGvHZUKn2pD/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/k1oANas5MIf55ewby6rPkY5+MPfOFhL+ASOIh1bWOk=; b=EAU7/MZVS+KR9SwlHsKIhlm4CSV6OZh5snE3OqlKfh4z5rXav0JwFYgym2FsCYlcZsx32aIo69RQLbLt4s9FT9bvEab9T0y3M+PLiOhClXcanVhQJcGsuWUewnpOZY2e5YUBjHR51qA3XKAItDDiHr+vDaOcmZlBw+xbCOaw/7gR3+M5Zx1J9CJxyfZSzDr+txuMvshdgStPQyeEcgfPbNt1aKtyk8K5tEbh8YmP80m4RIcq/EAeto/HMZhZBBaUQV8cGTpjPcJEk14kl9DKwrgVN80OV+Xlj96erEWRBFta/XeDAIz9I/aL6HfMOgwkmdqh0Tl0zKQsAzUOpHzPyA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:50 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46: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 v3 13/21] parallels: Handle L1 entries equal to one Date: Fri, 27 Oct 2023 09:46:28 +0200 Message-Id: <20231027074636.430139-14-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: ccc3fa63-82bc-4e7e-7c1f-08dbd6c0dfb9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qxTW1GLUAxcJ4IG1Mj/HIVd0Vc3og6yObrlDcf6lvZWVNpLqjOUe9PWFirR+jw8YP7WdHXIiv+B7sCW4LCtukGekbw2z5xoNB85DzhFME1rTlpd3NymocuricSBJ2MA/FXudYDvhY+pJrJKJICp7xN5BInzmycHr2kms4Qo2LqSJF2rHcUDZhSs0HSYkArFYB9piKVt057yOycAYl1ezNnAlmREd/1q30dihmY46FU3a1Wy1IWgC/KsbFZUqzOIo4oINcqJLc84fX9kwNHxs400BTK9bnAbC8mzaqPI/gCYU/DbOV7AjwiVuGjY2zu4TMYcMl1QG8zYZCpU47foP7FNCtctnyW3b8R3ItuMJMzgFdkCk1mWpXsBTxdVWIJ3wMUn7zRcpjB+dnEwvbH4QlBkIcR5eiH28ftgyQyed0sW4OvkVog184m2UZT7TfuhlNSBZrqcyIxzFbVbfus6/4x1hZg4od2LWH9ZQeebB07qOSIIZwrXwCaXZdZ2OR5zU7n7U2hEwBAH/vwjHhvUmXH2sxi51VTQLOVSmghRthCWBSAa//zfNHyzrgEyyR/5Ssvt8DAjuICJEMCZuS48d7Dd38ClDftGkiAKTcccpcNJCrJizVdfG8JN2XKOmazGU X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 91E96gfkXKbR42+QrD+HJPVwsTCp4W7AMAivOFNb08C9ex9eGuuYIwggrBQUZtHW5v+l9qeULMkwEiHhae77ulCztO7mmi6W5n7vBMOCDn4sFZ5BZy26Safmc5ZNVZQMaJRBikbhTTqH80W29wjFK0tOIDE3uqTfJf9URCKmCBwHaXik+KidfnRBws4Qy1kmXqKqZC/o6nppbP2G2pp9n1WXRVd69n5jbnGU7n7zGwzXld8oidlhsTEJURAAysxYYKShlRI0AGWa92WwQNdc+mU5dQILGx+g/eQc62L03kZefGklxLuyP2KQaNhn3PHI/0OnFo6ZemEdDLrhNDADbJlXeotrsgwBjzXA1t6BQWTCb9u4E+BvlI/LRbQ6srWMpAJrwh0O7cmlbfMVlnWjlYW8kn/GZzTLfpxHCn+yDaufMr6in+8JxGLPBOjr18atD8PEQ+Ac9Wr4RYLEbqUHstwenRTxp/+NJ+8AxtCgxXUS9/VN/noCmACqnIA4bH2Y7YijICjJXezTj6xpLSE84XdNIU/rhc//x/yLzhYGeSsipNQgEVJYcSa9otPXvR18UM8cWmVp2Xs+Ov6dotL6XIiUtutsrqh4U5K4RB4FKeV1ddv1WU4y5cFpi8KNMdAsJU8RIqrHEtPOOMhZ+VCmsm+yMYlslZZet541S/T32EEuWoTvuySuYFByNP/t1Zc8gWxoyEZ9wUQg2GS0FiYrJwHIZNvZvvBNMDWDaRHL2gk01bTq9hE3at56JtOhf7g2N6GcHmu9AqxPNWgRVEERkzCrEeQ7ZoJIEFTYThYpLEeAWVHLPitI2XV8jPceT9GbHo4Pkxx/FK6lai9w1fUjO2oxKClNXeChiWBHKmd7Ep0Kf1fZZ2De7JDK4nqWYzGnzfyIcUR0Lo8KRZaGXvkOvjQV6+XgCZ3mmDEp2IWOT3vhQnZSZ5WW4SsaVrxXMF5suLTe0+sYt1vo0oPmj4eyk0OTrQEBCh0QZ9rrMheZiTYaRk0M7BxE/pgQXDwb+clFRuOfHdsXrqE9Ft/ou4EruuVAxawwTPUookm+wyg+6w9Jn7dTu4Jy4DX9F3d3xxgQ6BEW7RfYHdbzdltki3KTwpWWMaBUHImp5QylAyYhHNd4orqUpGmeWm1HtOxk98KvuqC5h6dZKiRG7BunnUZsjomYDhzEFcBmvdGCUwp4QZ/EEOu3aSaaUhp7VoXf0jzdDHmNv5VAK5mCfJeBrk0P7a7It5xlgBVfJcJwO9/prJpT3J4nL5gHt9mWB/+tQNd6bAxtPLISHNSZTqkHjL993/oVRHbl6XK09OmPXsnwdjiqIT8Vo6kZMTPYQ4B38F8xtAuqqGYPjZulUqV1P5+uzF4oMhy8hefNAQHFDG6GIZQQ83u4tJVix9opQL/nWu2HThvgLeHTGUolnFaH0Okep6sM2C/gk2GRR1SNipYqLoCQD2anEdYAPqISuXWcn4HSI85O+gt66yGbXCN0okk80DeFua9cJeaVkORjgw5xRmOwzvavNeHDMlohQLgImnrufVol063t5aV5nGRcpJD3PBKfY2wbwsOaIKgmEob585/GvdG+SmV9HFXWC4d5nEHXDGq7vXXOnU69Yvwkmmk/mmqpBnG6IgQwb74hr/aglmI= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ccc3fa63-82bc-4e7e-7c1f-08dbd6c0dfb9 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:48.0165 (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: agRksvvr5xBGm3YeH3WO+aUG9yN9PKA/s5XyTv2UEvuVg5LVSzGd4XFdS9XBvVi7Ipvff12DlQC05BY9OkQuPanK/JSJye5+/Hh6axbnplM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::72e; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org If all the bits in a dirty bitmap cluster are ones, the cluster shouldn't be written. Instead the corresponding L1 entry should be set to 1. Check if all bits in a memory region are ones and set 1 to L1 entries corresponding clusters filled with ones. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index 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 Fri Oct 27 07:46: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: 13438185 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 57DC0C25B47 for ; Fri, 27 Oct 2023 07:50:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZa-0008Mj-Pp; Fri, 27 Oct 2023 03:48:02 -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 1qwHYv-0007K0-CW; Fri, 27 Oct 2023 03:47:26 -0400 Received: from mail-db5eur02on20704.outbound.protection.outlook.com ([2a01:111:f400:fe12::704] helo=EUR02-DB5-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 1qwHYt-00040L-Ly; Fri, 27 Oct 2023 03:47:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kAy2Sb1zVRLGqPzvu9WhqUirwDyKacy0ZysHUp4BJFQxC/68HVWRFDiWC6Is/fQtLPaJD04N1uNqv+bePiWvaGLCdEp+MZICcFl+OaJpZoeeuJh1ABsi8g3Hl/IKxeB3iAtvafvmWYaYRx1hQNeQgkMBdX8k8uVpNrcjxVxPqWhQYlCSROybw2/KwjozOyqPTZDTvv4IzHe1j1aZAuH6PG+YArMkvDGspWfJl19POFD9YEAaa3LsGQiqqW4TLtgloQN8ZdH4lr2LP8+LzVOcxpUbpv342HUSd0KQIppMMHAfd12EV/wD9PjrGvi2Py1pA7k1YiKqJ6cCFVC3ApNTDQ== 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=aq6AFpVbq1bPJHQ+3ek+XtJn3Sr23QRxLZdcSDcw2hWDNBqQzsMBS1vpT1NEwdiA2ttkWVVFJH/7Fjsp34G7rEds/bi0uKuRTazQbpNWcwJlzN/FGDc1Ee0dMpaApIfhYelCNG8/3st3hQnqKlO6ZYwvmD5tWZFlz5mNThQ7vINL/Xzv1uxi/d9d4H39rqua21GZwF9bR85bY2LjqOPeaXzwkQfdCcqLyZUV0/i9q1AC1XIWgnYSAGDKCLhgeb7FMn6fKkMwsKpE2qIQwdpHPVDYnYK3pxHl30+iaosf5sqEWO9Fdn3I708q6AD5VJMB2EEOpB5tck2rs4FPDeTuQQ== 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=JL69t6Ufk/ziyhRxL6wf8NOiNmhK1hNEXmQcy/NTLIGORqwNt7vnQROGQ5Ix/fQ+oEPLRY5FbKcQNlXxSDuYdl0W8rOLxcZJM0XdbAB9Tx5DVx8uTZ0g81eq+QGa2+NjjCwjCpO44xd6J4a/m64r4vQcPLsFgebuHavpI3t0LpZVKrLlao5P8H51x6Zzke9Yrgky344KaU4OkLm6Ab9PbTAlcu3AcZguaDBQdWkUZH+3HaLO3C/AhPoVT7ydffV4hJwZf31AYhtwgIqc9WVQqLqZnf7lmbSmG7rbo3LAKpG7cxGBTjFsmLDL54v4PXc0U4XQT0hOSztR2bsp5zu0Eg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:50 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46: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 v3 14/21] parallels: Make a loaded dirty bitmap persistent Date: Fri, 27 Oct 2023 09:46:29 +0200 Message-Id: <20231027074636.430139-15-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: eadad7c1-59cb-4fed-dcef-08dbd6c0dff9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7AQcVKR3SLrOl6+9DoQUYCmztARSiBAY4AQYO37bMGuDQhwvoBsnYvmcKc/xnQVvvxFUzCXHlTv/5ZMq+ovqfmxIcD572U+8veynw1TC48uXzPVY6t7223z4+1FZz3EFth7DVeE2X1XvQZ1n/MoaCCXQOBRPIsHz/KXvIaNqTuBh60EV50wyWmyfuk700AgwooxZFTySCUDFuSLpW1TmQfq2IOli3+P1J0AIfR15xVSqohittnC1tCZonKqT8A7Ngk5PywDNtLvhqLhdfLn07QfVko+Ry+Oeju86vksrQOipvdcsMClGTqEhXw0itiNpB4F1/zVaUxNsErzbzXthROaJ8kOCw099Gj0OKOVi4CmToAx/hllWGdsMt69+JVukXaZq9YAmMcUsdzimU7Nc8SkebpTzH0yYMnakTaz2HRsb2SmTYfr8Pb9XjdFpQplLqywfMH1y/DBmg6BMxGDc5Gja7Oi9SnEdOutwqs1BWgt1YrM+6cGkOOzQj0Vfmf+NXPyYbH+2l2EPf0z2F5+XelF3SgV5JiZbNn2efxrihEoJteEJHrp6kV3pC8XUxBYRX8jK6eB1HJ7jEGsYWyEwtXbozEdu27uswpiqysBEozKVQgakNzNMkMd5Po4tpYZ3adYv7r+v3zD7GItstXsvIg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(4744005)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001)(14143004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7pIY35CUlCMm1sbu92jdE+XyoqdufKZ/0T9zbFLVLz0PjyAGuKRS0sAU0s5UXNgWzPgEjhsqfMBqc4IU2/nB6VfMJPBdnW+/CDUO/oaEPACml5wAo9avNdwaJrEf8DaEUT9GM+ulLyD5gABSY8G7bzs1Ynvw3amCvpXUFiDL+121vGLBdeFLucUaQVnLX7gqv+tD6t2senn2p8ti5OTdZEy2/g0ZO+LmmWwPxmx87t+a8zs9AHeg8UHv1TylrmtpHWIx+Fs5pSgZ+IiNN1z4uU99NczKuL8TXUmBdCEykwCojrJD27mIFBLqILa8p0DqL/0vmgzAiXnZaqQC8OVi7mddkk3SPVfZaAHd8OInp6nEUKblqkxt053MsAAT2MOV0tstxfSU5FZqNdCg1Yir5Vl73yVhCUAtE8Di8QjOWa9BBavtmmdt/AOrJlbyPHhGoXLfyUvAG/RM1hBWiVrKib2U6NNgBkJmU7nVaxh1nk7WiiJz9gNYZcz8igsFOAgPyTUJOcCnmuWAv6b1LKvGvfqfKGbzW3qtXm7FHiBLBxuzK/VPx8o3lAymdkWo+KtNtcyVPk+9cEkpqhOnwKgWevFdTNv0rVb3k680D9SUAEYQ5ZmYOs+mCitGR8MSRfYM76XlRtVBBaiK3gXRnJcQlV9MFOpylBEEyjIdo8rG1mRJahxUiBdrESaIgWqPcjyHtzQVVOidBDDLYRCxANwyPade2k2qt2DYv8wMk8s+poZtihYAss+JXdSB6vUQbC1BNzrHhu0uptHKLDUOOJVKwjJyTrCLwyYSyo0NjmJFNDwjCqP5owQpcD0LNd07RIrzOUKV12kG3vr8C9iE+g7qu8KQvCHzcDdG64CkdlSIcK/X0rqgVkscomHtj7kRgUp0AT98m5791WgjYrgGwQCew20JE7itlfZKQjP8Co04ZYyg781TYQD55+jTjUDnytaYNR6Xedg0981+OnOf5r//889h8loGrN96XofsKuYiPIuWSrisketBGtdkerl4KYvC4MAbcM61PIgtGv9bexlAqFhl6m0lyoES8WNq6UbpPsMjqjRVxlwCUxpw3sLdqLhWXlN/9NUUf8RhovL+5M1VO6/4lI/Y+guhcdHzCeor0yyT0mU5Ier6/1JRBBSfskEL4d2ApWtTmTj5g3w8QQhp47pASa3rjG+FZfQy7TdEJBUdnP5MMVEybh+qOqn4rL7UeOZR1D231Yiyt9cpJ++VguwFP1VRUFwhpgM/xoW2Iwlrbp/KnevRzMGAYfmRO5Xg8P3LOM0xgwtZtqLvXMmAppeTIOtD7tliqr8nUzgpRVF4PT70oTOD2b+M6x7zgLDRDEC81cLLFv0OtXP+1HokJp9Xtv6u9IsdQMZuWpKPEqQzOgGEoy6GY+Byh8hLXLIPgMWWzIPVQR+IISEfqQ+5xXjtMF+S5ptpQ60MYLt4A4nzVUkn08pYxwp8/a7PgWzGdt4Ob11ardfcJFPkghBwwgAVvWkOqFRBneC9s2a9GeOFajuMdqs4ebeze5mmHbKddcJeoA0vrUKMJCoqIcH56zm26JTcw30689FiuQ033AHRDu7OCKghqjD0tgnhG4cxnpcxbUoEhiIGfgIdP5w/7P/kGIu4SjTWt5yUsTXPOl8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: eadad7c1-59cb-4fed-dcef-08dbd6c0dff9 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:48.4828 (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: CW+T4kEW2c4bLUVuKySge94/gjH7dY7mwlLWse3/0zdYFnzS4IRHikghRIciCAmQf4wyQGm07hshA9/PkDLgS3sksv50iFQQ0u+VnOdMm98= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::704; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org After bitmap loading the bitmap is not persistent and is removed on image saving. Set bitmap persistence to true. Signed-off-by: Alexander Ivanov --- block/parallels-ext.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/parallels-ext.c b/block/parallels-ext.c index 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 Fri Oct 27 07:46: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: 13438188 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A57A6C25B67 for ; Fri, 27 Oct 2023 07:51:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZd-0000JC-3W; Fri, 27 Oct 2023 03:48:06 -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 1qwHYw-0007KA-O4; Fri, 27 Oct 2023 03:47:25 -0400 Received: from mail-db5eur02on20701.outbound.protection.outlook.com ([2a01:111:f400:fe12::701] helo=EUR02-DB5-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 1qwHYt-0003ya-Mo; Fri, 27 Oct 2023 03:47:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N7R5g/vxBFm4NOJStShfSoCiVNME2a4J8y9fz0TazlPc//Aj9KVVB/GJpbWfWOWXbUM2fo9DiKT87j9v2av6DZUIFEV+1z+3mXQrNhOuqfvC4BjA3FZqIAyrJHrGJPdIlFAbcryyt0DrqUEVlXTYNoKKTRMHgRTd6KZ13+Ia1lmdsxR3fRo/rw0f1i5XYj+5vdZK2gMpWnFlQIjEm2AawXXOJMc945X1fRxM9NdsyNQ+zhonWj348p4KEINF3LA2OmvOYUXFjAugwp2XG04Vsr5w/HUN3OHkA2VKYUn2PNBLuaBqbCjg1MLqIjImyaNFmpG4eeoVjiroRuXmfRyX3g== 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=AwOWlMWKuKlvmeinISKFZiL3UyyI2sCGxN87M5KJLKs=; b=h6oh/cXkoDA74F91aLHw7wgDTo4yKNHDYoWFUmkS1v51YS0bbHH3OnAq0QdsmwJWiUfU5BLlBVQ782TDESuG6mZOQwVjfLZ1IEbOVpyicaQDvnzPflmGjyQE8ZDU+kPbJzq3w18P9lDz/tExt/C6zl9x4JKoy7HxFDDq0RbN+3GLmnw4JMhDXDqbfrFmGTqtoq9SaffqcFlFJgib9+qKfjKJs5po9kIA82hVfma1ab0Es2iWfWoLn+9Y357puBHtOvjze3AWdkVN38756eMwFj6L2Fzyy6GV6cwOYglu7sCqoeOW0kHNqSh91XRZIm6Lz1HHS4Mb83p8orppCK6yTw== 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=AwOWlMWKuKlvmeinISKFZiL3UyyI2sCGxN87M5KJLKs=; b=V5KrVoPkSU4Jz6oK1rVXRaflkD5aFD4lCNdRxE4iztvjmycvcO/gWCTKCdh9Sv9+KJj3H2dxE2+SoyalSUstVGbgF0CH2Mn60e2MQCXIfvsziZygBCVLgJuleqvxdM8xcw6QKwZxctJnonXsDqF5s43j5SISetE6L5xTu6prTHQtLNjMPgOxgkcy0EvNHCI9GEz/I//P3R+6mQBx9qKPFaHdU8x9G40+G8UFG6JUTXosutycDNPqg5De1JBxce3CZNEng3WNm9Fdzu3r+6hadySC1MIQlHXnM3lVk1ikGXEUxtcjPR9d0y2IlKJlhC7H6nKHtPs2fDJU9who+6DGnw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:50 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46: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 v3 15/21] parallels: Reverse a conditional in parallels_check_leak() to reduce indents Date: Fri, 27 Oct 2023 09:46:30 +0200 Message-Id: <20231027074636.430139-16-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: 18f9b32c-5b03-44fc-02a1-08dbd6c0e03f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eb9slyuPpcwr0LGwN1lOr6CeOx8aV1esYTa0a0VgRvy2x9DOwy2FRTGtiYz1SiT7tpG1LXIv5/vmSR84FVNc5gL2sMUn5GDCSxQRu5O+/et0Y0iGLjaA4MoIfNyrAWLdV1H5ZL6tOm4z8A5/M5iRYzSezMgvvhRM9mO8qPWoZJpFIMhng1Po/M7j1EuGO5CdUHevPdCqb+mTh1YmvpNFUsIPYfw0IgwVjZvNE3/x6FwvHv5RGe6p6N69oEyX+sNeVntMYRtlDXg6PNJOn+xbwobO5+Db60ZEgMDl4IITTZjrkEaMfh6iQx1IPOXxohsJd0FBWatGEXGO4HjSdziO/NCGx8SyINwuke9OOf7N/eXMtqc44zwP6ibASMARYISJmRG36wZ1k+YWtbTVhK1KXChZDZfODpaWIMuRx97K/ezcWQShhOMF9vve3xrvxPdKcc3OOwav+RVghPBHGvzHy3pbn0hAxBTfv1YY3O9NjV5nXGvnRIi3x+UdCld86PHuAe/Vc3ueQFZ7ih3El6AQDQEk39W6mh02afwylDTfbI9I6jurml2ZDd5bYsjFI3FRAfrbifawducWgERQgidh5mEmBHELsorxYlB7Oo66WH8oac816jv9Z53p1B+3gyR8 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6g/h1KOStmk3RL4zqKe3Tefe7a+A4FzYdncBVF2DaOv+i9aaNxSHNSKO9Fq77paUY3WPRH6x/KYs59qH6O7xZGgqxhIDBM8j33ZeLSEb267+mwK1upDqUj59gqVyZYj0eOr6uWR7uM/9i9cX/dr2bJ+o/ZEA814qIw2/G+c/1Sr5t/buZcjJUsQfV9ymKqPGhuiATHsGBN+n8AidmvsEptm4UWaf0T1zCtNpWsh+FHhUxWV2dsZY5ZEl0ZOJ1fraDIk0Eko0ult+djG5ESpalcs33LrlUFn6UzVdwJmrVUnmfmr5pF0p0abzO8WTzLy8Tskl2kDBwJvQsZxpfX6itvxIoxD2jrdPNnhO1uNsqZpq6ylvfCjGtDQ/xiWAirIm4bpz4V8sIkGBMlRTiqty5bM5uQaD0PvxEB7xJOI/c8zvi2wdUDeaebek88+jfidO1lDutrkT3mxbeSuESN2hoKpdlnXFtYehkBsOrSlRYm4EUk2zZt8XLiDXCYj8Xr/vZYVNTJS4PKP3mWed4q7aTFTEGLmZ1i1wsXD2kkMlNtiHuTq+MgkbaUBeP4dI2nSy9PagXCUVjhluRPM4SMZRItNm75my6N7RmbmHb+p1oabjuHQWikF/GbnzWwu5r6UbWJFHzIIVRlBiDz41fXTC2bLWA/5sJL6aM34z51EZo4B5de2spORVSABCzJnGAHN6diRufk8pQcuH4QYU8iSaIWHLMnRkRKHIFRU0HJ2PCyjya/0cXu2O2jeYYDh3ymEOu7fbxP4VWMF1b4vp9UcqKJdckHb+EfWb80iq+snmFew//DqLPsPXWqQAhjcAcWZqBw8h1tWhrRN5wX8VxHOsbzltbY4ncZChXaJyjojxHrox7oCWWwVgxE0QYQcTvy0d9ZaGK/nmI2Ss/wZH2IQoh6LjjnyEtdWXHe0+I1RpvUdGfx8T5HtHur61+L6Ff/a6ulC2KEZnGlekUDvyRJqK4QoBdJCe5LlxiB5U42GtKCxZ83/IZ0XyOM6S2oXVcpBmHBw1JtpRJ53+bpUKz0EmszfBvZZh4IQnfj+lNeKw1HfCGZjnR9zSkeFH1hc3MCYynxaKfILB+i+odTbZpjZqOGC4hdDkZc3jj0RqBAF10Z8BGH4Je5SfeN4qYDnvI9sIrwHgdjOS4kVEP0F645ktII4uIoiOIYiHGZOJ4P+HWwZIY5RtzwbVYgyGHScBwJFm9e7nB3VJShsEE5tbYW810lfAjOGlf8X0kDqTmgiLcDzty3wgeJBYWpw5TJQZIb6lcDgeyWjRHYmGXSixziS/bcTc0GU/tox+fvSBVPN2URG2LKireAfNk9WpJu0pa08jT4+F/Zo5vBqDWQKtKhRoFWfPzIzv1INpM5ZKD+waxcYmbk2Oy+sDPnjEmf+lwMBJuCJF7kylhk5Bm3C53AKEzYoZYZEjAvhNmOwUIJ5/6BCyzHYdw3N0B0RB1Mb4IexH0EUCTIMrZHyF+btIJ0L/kHdC8mfst36Jd6yr+pcUKKv5u+EADaXf+H0j52Ua7mlr8HvNbxHANhx1e6cPiySC+ZyM2Q4NphP8vHHEGKgDt+UzlhIa2/C94U9GOzyG4OEzPwKbQ+UW06xs/FPCHZlbJT0pWkA74NEVNA9sckqWnXY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18f9b32c-5b03-44fc-02a1-08dbd6c0e03f X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:48.8561 (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: HOI0kNyjdp9aL/qRC7fPQ2PMKBOj8/olqQPNRb+tmlFWzc68bb0BgZZBbrL37JnQ+k/q6DKmGdQI8wirN8drQoU0NtRNYNMCcMfXK/ELp64= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Let the function return a success code if a file size is not bigger than image_end_offset. Thus we can decrease indents in the next code block. Signed-off-by: Alexander Ivanov --- block/parallels.c | 72 +++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 0a2956b45f..354fa0f2cc 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -775,7 +775,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); @@ -783,43 +783,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 Fri Oct 27 07:46: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: 13438187 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5DDE7C25B67 for ; Fri, 27 Oct 2023 07:51:34 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZa-0008M7-Nu; Fri, 27 Oct 2023 03:48:02 -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 1qwHZ1-0007Nk-AQ; Fri, 27 Oct 2023 03:47:28 -0400 Received: from mail-db5eur02on2072e.outbound.protection.outlook.com ([2a01:111:f400:fe12::72e] helo=EUR02-DB5-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 1qwHYw-0003oB-8d; Fri, 27 Oct 2023 03:47:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gHVqEP6I65K2FGoR6QysRk2b8e3LKZ6TqRacEWQxbA0Iu2HxnkHDRpEdERm/tTdWudAWGQzqFddIouXrKPxmrJF0vimMqEXtwUV42Ei3Hdo/C8C1++mkywh4qVaBizyufCCUnASaWgxs7ApsVZUUWR5ZmaRlIwqHUfM730VpbYW6AZBVlOo9WnYabuv9Z7lChpovqQ24NYGjsB9S34va/TZDd+eFhc3zE3u0XkISmngZLNhzJtJQre6jjA6+hgFENySlue29ViPVHvQIAEIM8JtmKqQgnGHAyZ96uzRfE/hfIZB3je9MiS31GwmL+ngD8JCawwhc3wuPc9EQn9nr4g== 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=smoM9hlqAl2sN4XDK7Jss4bKvBM82Bc4k5v44s7Xfuc=; b=WODzuOIFvAiRMllWRlkNhSatg16ev5VoJyQ/stgAPzBFBGKKMzvDSZyPTS1Yb796S4hR+eRhrI58vFR22qMfhyWImSdCcVkd66XSK21sxce9KDbQ+WQsh1X8sCCJSKQlB/+KPG0DJ+Ai72gGQh2FhH/lCMxiJ7pmXJ3nBn53PjuRWL3wir1LphKfTdNYTN9BVY+DiBkyR25c56B3eZrRBnjLFayp6UWZlL/FY7nw6VTyMZxok/SE/mm0nDfnhqKqGYA6Wcvlak6+QH3Ijqeay2KNoaSHJoo7kFU0ZOUYMNMz9dQ6CdAJcQlJzbWfDM6lMcCY0zHm/2hn5OyLcIC/3Q== 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=smoM9hlqAl2sN4XDK7Jss4bKvBM82Bc4k5v44s7Xfuc=; b=rxiv6NLDl5xzolD21n5AMisax9lEZ7d8CJsBQMjk5eor/jDB+g9d1PTkUAnZtQUz81jqJaN2ztYpEmN3cWVlM+rqKkyIkRJJ2LEDAKS7059zTE8AZ/lT+YRyMTsqoT+dYxYaBfqwGbTqAK0j6vWO/9A+fD6ywAAU7b3FtwJeF+vCXO9XNDQgFAnmbrFD4opGXmH6owknBooOlBh8+/VOSst45R6lhvjoN4rjsZcmZQ9btrawp+QhHrR7dIZCYK4ALjOisVnKZ0Z8NMX5xGwqKe3xoemkx/qAKwqoQFLFNDJ5aNqak7EwajB9PmpAMggDKiTIqNBt4u9PeEagfVCAkQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:51 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46:51 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v3 16/21] parallels: Truncate images on the last used cluster Date: Fri, 27 Oct 2023 09:46:31 +0200 Message-Id: <20231027074636.430139-17-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a7f0d38-fe67-4b45-151c-08dbd6c0e071 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gkzIaWx1KTeri+QqARMtK7g9TPV19AOFcXCrTWVuJB1iN9YHBZvzfSby6Nc256WyLu3nRgyjV33A5EwVJfi/KfpTUNZPjs1IHcFnmld9aWUGhMw+BWkj3xBPMqQ+5rFDccc32NkI/QfuwfSRZtZRIJAht0CtjxsIv8C2BQnUzMhn3VM/5QV/VkffNXUpgUt0FQcgzLS2ABwmUvYWO8jT4KvJQ0FE9fKnKfTM0uoKKuBJZukgZMtMdPty4gTHmhXqoJ3W03bZNqh9CT9uUDUNwWL+TUsgzFBzBFQrk9RWBDhp8MP83/AIwuXx1gru5mnH8hiJSJLEDNWCYm7dM1bD98TQH6vYVQzHLcErXHPB+bS9NgYt09FzukRRvuUc8/JGxbQlwmEJ7uEbVfG9jayYzEnAMnv/+NCy4smPeSEWFiptXMNqU/xi9dC0Ab2ZnPj6F9jd5l0pWUrCtBLwdVmR2EEX/aLMCLGJDfjabljVR715ehCCW5S/GzwFWB0UWHcvidYxY60PBwcSEoN6O7RsITkPPDCjkjLnwGd6Ik5Pn67CUhuwP+L5yevR/f61NGHsfEepdFej4afetAt6CMKtPhRerbnfdc4RTngpUQUnl7TCqo8hh8C9T6lRW3N0iOps X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q/4afLP5tsefO6uq0jhzB7D5GLvpVBSdIwYS+oLs9iiLxL5G6w8MDVhFNuacSkKKumxC+xIhT9owksOr1ulFMOYpmyEzJ2UT0NIb/DDjyjYyQHK+/Vd7S9AfD+6FGvJlES2SnA0S/MnMlpHuKqmWiUX6H9aicPsWIvhhO2n2554BQqJtHzIjGQx95VdYkpiUg0EP0smw5GoYtEO3bC6ETnpnYx9UkJKGsQIZ2pz7yBmf1+79p0jZkbsInscJfLUbUqvIUdvbMoPuLmtKSQrBRemwo+xa8URK+Oi9V7Ru9j6caJNUOX4yIvMTjVm4+pR0p0J3J03iUm68/Q5vPHqjBirPox0/uJ2sjzhH45kbRUiQUA9PoFouOZ5d2MF8S5NrLhdiWAfigEhhhCLt30n/VyK20cvmYB08HF/6KI7+5cPTzpTzdP/VPuykb5qPRdexz58IHVmy4PDQJ6iHpLMWrAOLUI1VN8XGs4YqwK9n9hTPjn511Hd9gIUd/IDsYoiDPRrpHuks+HICfvIjXpb+yLqvTcdpRSQZFRpFCbrQ7Ap7ThSFHaCjeDW1paDl9olClzQ7J59r888Ca5BbuveeBRyaB4WIbGwdj48n3AZtqTAYkx7WomHuh9DIbvmxH2b5i0RRyfA+dm0YDZpkVb0jh4s0LX/V5gSvZXuAsgfNjFoh8XrloSz/EED7c9vzF+iY4D3GMxHJQ7F7w5pfW/m0J5E35hsZYLSPRw4tlVhgc/StV8uc2NPhP+3J8EMi+/HaRmCnuvvbkORA2iF8tp1kD2eEJ61jBdENKfes6gV5lC5B2fNIJ4zAztG3Q7ajNjKqSMMnTtNO0oPkkp386EIkt5F08MSrIV/4h/RzUM7vghW+zmoNr8iO0ZBceZt9ttHV2qBhDkz5QlmFvZkAFD9f8K0vw5+vRPFkTIymYfKxcLm7rPz+fHqZBlWtDcJ1fsTBViUYmgjmZuK5UmCSbUnAUSXxYby7B5RS98tWNVNFbrZkU/txeKhYmiNJgn78Ga1K98763qAktdgJXrkpS7EK5zBJjGjOjivzgpvAlSIOnuslb7y7wqu9bljQV6NWbEXekm5LsDRCTiioZ6Tm87p73+wv+KOQUn2TwiStKlMODREOlov9IVH8vjHrc7i2ynDvOteA2syUBpAKnS4aJCIqF/okLqa7JC8TpAeRN/DbLmrGemWX3idMCVdIQghmc7jNPI/VsdJd2ZkjRvqk0EncQ/h2SPPr/7Mwb7KE6XtQN8MWaZkeXFhd8JNxRtlzZliHwjaetqAV+F8mROK4zq4BYrCa7oc6lLSfg7nPSLvZId+mczi3UloKzajXwssFIzG7M+89XgsFR/0+x31k/YCmmOrVzRsn22bxYiTQKOlH9jhskS+odon7cKskdJOfgY/+pmoHG5EqR4DHlvV0GrRTbwn6TYthH5nNssfKB3PATmpjhOGK87NcNi+e+UK/JxaeBfUJQ3ouhPncEndoZ1Q9tJ3tGjagBNM/MXyv9Dm1ipAXJLl5LxA24DjgHivAX52o2PM3TwoJwcDDSG+FkCuMfJVX8swx0Pc5TaBMw/6U/a5TnshghrA7fho4M/2bvP0Qyfo4pDltQ9DlhwSv6PcD0LQjSYLR5pwngtoZoWH5C3M= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a7f0d38-fe67-4b45-151c-08dbd6c0e071 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:49.1860 (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: LEjlnDq2qdO1C8FsL/I0/oDuYPNfevOY70nS5Yo0bZgcAddvWaJD8/sYgTmjAFuIBuxpY+JoaX8MPg1DIuvW37nNK3GETsBk3iTIQtp18H8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::72e; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FORGED_SPF_HELO=1, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On an image closing there can be unused clusters in the end of the image. Truncate these clusters and update data_end field. Signed-off-by: Alexander Ivanov --- block/parallels.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 354fa0f2cc..472311e2e6 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1456,6 +1456,23 @@ 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); + if (end_off == s->used_bmap_size) { + end_off = 0; + } else { + end_off = (end_off + 1) * s->cluster_size; + } + } + end_off += s->data_start * BDRV_SECTOR_SIZE; + s->data_end = end_off / BDRV_SECTOR_SIZE; + return bdrv_truncate(bs->file, end_off, true, PREALLOC_MODE_OFF, 0, NULL); +} + static int GRAPH_RDLOCK parallels_inactivate(BlockDriverState *bs) { BDRVParallelsState *s = bs->opaque; @@ -1473,8 +1490,7 @@ static int GRAPH_RDLOCK parallels_inactivate(BlockDriverState *bs) parallels_update_header(bs); /* errors are ignored, so we might as well pass exact=true */ - ret = bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, - true, PREALLOC_MODE_OFF, 0, NULL); + ret = parallels_truncate_unused_clusters(bs); if (ret < 0) { error_report("Failed to truncate image: %s", strerror(-ret)); } From patchwork Fri Oct 27 07:46: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: 13438178 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE6A2C25B67 for ; Fri, 27 Oct 2023 07:48:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZp-00014p-RH; Fri, 27 Oct 2023 03:48:19 -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 1qwHZ1-0007Nm-BU; Fri, 27 Oct 2023 03:47:28 -0400 Received: from mail-db5eur02on20704.outbound.protection.outlook.com ([2a01:111:f400:fe12::704] helo=EUR02-DB5-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 1qwHYw-00040L-7x; Fri, 27 Oct 2023 03:47:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZUAZUN87KRUI7/RSvNYXK85RIVT9g+uwMNV5IZRvt0E7z2UH3qTYuJc++auoXHJgOdRfE/8fX/BmSiBRohoFwAfkKQW68YbvS3iL6DB6nwKAZ6YQMTA2KfBSjjbyyHKb5l8CtuHKZJZh7bhGdSjgwcc7ugq3Mk4jDHbXUYzBAiDXvBbaivE0Lh7ejcZwXirbsCJMCBS6CXoCCwH7DxQqEHjJo29Hq+fEqbCtiZxJGaUME8sux2xJyyZ5BcF+rj12Gr6T15Gcd85CBmnifnKDd7I5RTCedvaLrO3Bcb25fBAHVebusfBkvPiq3PACqBITrbb8wMePhWWnl0eDwqrl2A== 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=GVdlrd9E0KA0wnXYG4RCIh43wDwoF7uchSJR3rqTr9U=; b=fNRML8szeVl9BeYmZfvAiK98e9p6spOLZ3mT/8yp+Ms+Tcb7QLsK6gx/NjzuAo5HewoIpqvKMNXad421F7mhP5bjfqujLuhNkvruT/lsUvhZPo9/vsiqQDT6VRCk4eNvxpefYQYG3pAU+1NVR/3UAxGrEj0z+0gMZCMQ1K2WYEwq/yFuBuRMisoxxjJd/M310BoKDMdLDK3jsAuxZeUi4yYhLEdfolEkca261dDiafCawVrUq3Mj/LbDMPMb1sUj2BAQAhscy/083Mq1/TYHmRH3v6d6IBrJHZOMraJih4VIJgEYtYhhUmwIMJ2enbn+j54+43bI61mqSfEo8MtGgg== 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=GVdlrd9E0KA0wnXYG4RCIh43wDwoF7uchSJR3rqTr9U=; b=E95jyyURwcmr/koKqfJkibYNIuFM7hiYm7YaN6yrnFOt+JwYWyz2LQny5nFFt+G50+Ud1ejH2I859GM/KtEXZ3ikOSowSqnAPPx2P0i6RyJ+7k0RNXKSphAxsSqrfpKXI5+TOSmLqgu6n9KAqPHPLW6jfXDXZuGN7Om3nI29qFpqVXy15tto13iQHcA/JzYFTN+8nYyTuT6PUF6NVjjrevKXbKy5QtxKNDLAP29Bmq/qkXthC0d4VPvPH/cN9nLII1xysAArS9cTHXMvfW1VR+5uHGIpavvaP3Dmybyw4zouT2sPnX3NPSN2YUQeHu1jZPDVewuEWVEDmAT6Eav2Ow== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:51 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46:51 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH v3 17/21] parallels: Check unused clusters in parallels_check_leak() Date: Fri, 27 Oct 2023 09:46:32 +0200 Message-Id: <20231027074636.430139-18-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: 71f1a7c3-1dd9-446b-2785-08dbd6c0e0a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OashZnPmCCGUvJ1TzXeke1fzDQw57LhIjXND+DwK2Ch7mTBc/vfOVsbV5q4F6ko/u3tXumdCyN1jm5HEyZQZdk/iF2EKUTesijYjCAhMGvigczikYHt7/q5LZNlvCfDjiKBJ8KDaOxOPSbFDgTIxIg8BoXbFXuoHDQMaT4em5Lt8uvU6NR2erx2F8PDZd3Jq1a/1d9lJGeYxJe1ORL3C0DMf3+D9lYLBqdxutA0v+Hsj4ANSPoa03cnmZ8nvMHBl1CpyphWhnuKVAt+xwb4SLmvui96JSSIxSVGa92qA9h7GcDh0It+DRHcOmH6RQxVMMAcq1SCw8lqpCbVUawN4pqhRJyfUwRiA//zQmwBSd4hMtSXMTmtgGXh+u6c6SlXhAzw9ml0o92i3DWHwrR14ebGhHXuOuoGas3mgfVQB8o2lr2ERz6zCGRlWigher1BnAjg34TxftKB9jncuy9DnxQKZHLG4Kn7PtE+kC4cBvMx9nh6xb1zB7iCWh9ogUwj2XIsNE19L02o3bvT7N1pSN0EwGfM1VTusatkhAuL5w+mKSqMChbXe4ICEfGrKWuW5rZp0aVip6LT5/qAuumLuxN29Biuahrsmz17Lv1tSbFgqucevwnLs3sGbkLn0g/vR X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QzmHo115KJkGtlQkrQdm44EWvHNivWLXp/StiR0+MNPr0TqXSYRkSlHQIp6We6GqDeUDUB67z2uCcjyOcOv8qkvbkdISo4voS76R7hfGlDAo1ss5zICxbB0qMj9AmrIoPt0ia7N0KX246+rSGLCs5QvY/ooajzxhniIONAMq3bVmy707ZEHALA3Z257YqPPgLWUdpNhr/kjWB3HclujxsN6AL9vh7Lzzl8sK9sNxEWkk4mMC/mN45nlopDC9t9iZydIlaC9XzsY9LwJ3yQSpPpj7lRJAzfhFlPUsp2a4msrCjy1lWTFoftJjw4rLyumLKmz7CXlb/JWHAydTePuILCVUh3q4M8cTfkAJ52Qn9pPSf0D/7IXHsJtzEJfs2BmqVqQ3QMLPPOcFWqzWoluTkWkEZ5Qf/5arq7H+cm0KVFYodE49pqB+6iXSiBtukVgSrkAmswH4xqffucPZ1O97RLpADWGw4DCMMPQs9mPoroIC2FQd2iqXXNGlYNPZht+LkzcKk9GJz6PvCmSN/bv/T0F0sBqFoG5hzCnQ4jxIzVQRo+wCrL3Fzu42MYZ8RB29dcPhqqu2nR1nh3DbZaGmBMnDIs+tJJRY0NiFqKt5vttkRFhyAngDDk3Swj9zuMNH3kEyU2eg9pmYqaybNuRrrEpJBfYx70CEo4ov1O0BYBOtgClLqMnciuolwBFnUWCSpDJnOCaBZRxKFwh4tu/PxgsblRdS54VY/LSXE5Kd03icJp2omdIGJgv0hN/3AP1tkNjSFQv0VGGH/QxABJOXjCvhSWS4Mi7ocgqLPQfN9d0UpTa61A6xyGNWcgYhOaTZUYlO9Pn/Q9Q8bAW6HFTUriLl/KI8SxS1B4EAOxO10Esao0OMVMLuPM4JjAvp7pWs0fPBBLKxnrK9fRxKkcRVoQpH8mSPS8ZLDpIHy9YYW4Vc8lhez+TPaUiMDF6e2Jy+wMUf9UTJqMFHO6n7SqLrdHunv44XkNwkJrp00VKnCoMZLnPRD3XWxTjwJ/MWqRvVGRVx17dNWAKHSDjmbQBot4eDAQQNvbd6xVXabUZiUfs32KjZax7FT9onvLdyYdgjfgtfjC4FZ9ouywxDL9x/9DDZtNaLKdltRWElOfCSiIhZSnkzxplJoZ9CzO9TIlYYJCbcRG3Vx2qNTIrIPZOz2K7vFRsZX2E6M97PYhVie2vsMudb68M+vvZDuML/hRfaxhCvgca0j6b6HOo2qQ4SXD0OvMUxGHImSyYUrSqPZ5kelsIuQuP9QCJaBwP0aviZsdNVhZF1X+FqCwbuqfnM3GYsgr34tjh+wdlo9m33JyTnVRikoCX171cZhCZsTPI5YXoci5IY///SHpDQcFMcENa4visngv9y+unAvUvAynNlaMgixpz1NkRusJcTFDFeywC9i39LBkWndEm/LAWLbgS1IG1rmWeKD78PIegU6zKKpl4TAjvjIyOQHI2uklq/Nq3YNzvLXRQfanPMdLFpfHugsKTS7b6EcOqexuICuCUzVwBO0DdFcckllK9vUdxlTaW902x4Lj5EQXzWxhuhqzWMGvgd7zcVITB1oNEaf/JaSlHQqq7pwX0xJeC7bkAYgO0RBWvNYdEP5/4gCa0F+tIJN/HliGfGwJi3nXQ5kNo= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71f1a7c3-1dd9-446b-2785-08dbd6c0e0a3 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:49.5239 (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: 76ydNoORGCdyfiO4WsJOfqesuPdhWZz4mEKAxDsilTPzFnLjy4EBr+9bN4GWP2TlgLhv1QGHYdT38G1iDG3Llvfk5XGcceDtNVbAOKTtvjI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::704; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-obe.outbound.protection.outlook.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FORGED_SPF_HELO=1, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Since we have used bitmap, leak check is useless. Transform parallels_truncate_unused_clusters() to parallels_check_unused_clusters() helper and use it in leak check. Signed-off-by: Alexander Ivanov --- block/parallels.c | 121 +++++++++++++++++++++++++--------------------- 1 file changed, 67 insertions(+), 54 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 472311e2e6..d497cdbe41 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -770,57 +770,87 @@ 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) { + end_off = 0; + } else { + end_off = (end_off + 1) * s->cluster_size; + } + } + + end_off += s->data_start * BDRV_SECTOR_SIZE; + leak = file_size - end_off; + if (leak < 0) { + return -EINVAL; + } + if (!truncate || leak == 0) { + return leak; + } + + ret = bdrv_truncate(bs->file, end_off, true, PREALLOC_MODE_OFF, 0, NULL); + if (ret) { + return ret; + } + + s->data_end = end_off / BDRV_SECTOR_SIZE; + + parallels_free_used_bitmap(bs); + ret = parallels_fill_used_bitmap(bs); + if (ret < 0) { + return ret; + } + + return leak; +} + static int coroutine_fn GRAPH_RDLOCK parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix, bool explicit) { BDRVParallelsState *s = bs->opaque; - int64_t size, count; - int ret; + int64_t leak, count, size; + + leak = parallels_check_unused_clusters(bs, fix & BDRV_FIX_LEAKS); + if (leak < 0) { + res->check_errors++; + return leak; + } + if (leak == 0) { + return 0; + } size = bdrv_co_getlength(bs->file->bs); if (size < 0) { res->check_errors++; return size; } - if (size <= res->image_end_offset) { + res->image_end_offset = size; + + if (!explicit) { return 0; } - count = DIV_ROUND_UP(size - res->image_end_offset, s->cluster_size); - if (explicit) { - fprintf(stderr, - "%s space leaked at the end of the image %" PRId64 "\n", - fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR", - size - res->image_end_offset); - res->leaks += count; - } + count = DIV_ROUND_UP(leak, s->cluster_size); + fprintf(stderr, + "%s space leaked at the end of the image %" PRId64 "\n", + fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR", leak); + res->leaks += count; + if (fix & BDRV_FIX_LEAKS) { - Error *local_err = NULL; - - /* - * In order to really repair the image, we must shrink it. - * That means we have to pass exact=true. - */ - ret = bdrv_co_truncate(bs->file, res->image_end_offset, true, - PREALLOC_MODE_OFF, 0, &local_err); - if (ret < 0) { - error_report_err(local_err); - res->check_errors++; - return ret; - } - s->data_end = res->image_end_offset >> BDRV_SECTOR_BITS; - - parallels_free_used_bitmap(bs); - ret = parallels_fill_used_bitmap(bs); - if (ret == -ENOMEM) { - res->check_errors++; - return ret; - } - - if (explicit) { - res->leaks_fixed += count; - } + res->leaks_fixed += count; } return 0; @@ -1456,23 +1486,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); - if (end_off == s->used_bmap_size) { - end_off = 0; - } else { - end_off = (end_off + 1) * s->cluster_size; - } - } - end_off += s->data_start * BDRV_SECTOR_SIZE; - s->data_end = end_off / BDRV_SECTOR_SIZE; - return bdrv_truncate(bs->file, end_off, true, PREALLOC_MODE_OFF, 0, NULL); -} - static int GRAPH_RDLOCK parallels_inactivate(BlockDriverState *bs) { BDRVParallelsState *s = bs->opaque; @@ -1490,7 +1503,7 @@ static int GRAPH_RDLOCK parallels_inactivate(BlockDriverState *bs) parallels_update_header(bs); /* errors are ignored, so we might as well pass exact=true */ - ret = parallels_truncate_unused_clusters(bs); + ret = parallels_check_unused_clusters(bs, true); if (ret < 0) { error_report("Failed to truncate image: %s", strerror(-ret)); } From patchwork Fri Oct 27 07:46: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: 13438173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00E1AC25B47 for ; Fri, 27 Oct 2023 07:48:07 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZc-0000Bb-F0; Fri, 27 Oct 2023 03:48:04 -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 1qwHZE-0007Xk-1o; Fri, 27 Oct 2023 03:47:42 -0400 Received: from mail-db5eur02on20701.outbound.protection.outlook.com ([2a01:111:f400:fe12::701] helo=EUR02-DB5-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 1qwHYx-0003ya-Mf; Fri, 27 Oct 2023 03:47:39 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e04vBamurhDydwEas17OtqjalkfMkIRVvathH0XOA+2Z/WZqsep+9k/ZCkAgUEdDDjlvNYhu5giuHl8qPPDmsvah+dOkH7X7unRetaggoTkRYBzHU0hVkPf3GXHaw3yjmygVhcvtvo8QwbAijwA6TPIc5vQTtPEhkikcMVhb31G2jtGfkrvYPfPrxyve44gES5tN2X1WJ0hHTDRReJgCthSkyq5g8gPkz/7kqJYDFHA9eXvObYwi+daOS9zeHNvCRl9ISFXHcURPsqB+2b/XgRttQGnpd6Fr8gEtxYASLVY6EW/VxLVqd6Hj1qakq8gWMz4pkf2I7HrgmJ+HrDoMew== 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=gC/UjxZVDVJFYLyiM5idcqbNmNxCyC8qvhUYQzFfNJs=; b=Qvtdhh/SNprgoVD7MsfhIF6d3PvjsoMxN14ZNl1WFegIOH8Tepphxfu4XjWiZio62l1M6XO2+YM9mUuBcBB4UxZnSsUQOq5KBWAxGlyIyr7OVtg0tbLvo7NNstcpK2CrQKm/kt2ogAqozZsOEuYAs8wZc4Nk1UVLR0KVrIplGXDvK33yAOMAfYWqJGy7A93wCK35kHeJQ0o8qOWMZFkKnOECtgVxVeWe/4uS0HA7PnGP774R9KunX3tAjLItqXb//8hSpdSo7gdlr6w4iGmr6S5b9w1QWWcqVK0IhMwQDcmZLMzUZNwp0gItjQlfYSfownijVDrPEXb0xepfOjblcQ== 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=gC/UjxZVDVJFYLyiM5idcqbNmNxCyC8qvhUYQzFfNJs=; b=K8xHNIA16U/YZ1c0DaXSrXzIRP8XYIfDDHmsg79jWgUrjjbOzOWRtvtAoLcUvbLa2ZGZ4ldSWM1ehE9FNGinatNEFag5lB7v7fWOSRLNvZ4oY/adNdSa4VYLlV1QdjfVmipbg5DXyLVUWXROLx9ZQyaeCdfcixN+KoV/shu/I0Juw6JnQuM6V10Tqyk/Tfi+Y+Zt8cqFt5GTravIFoFksJeTJTUyeV2hO6UJp6F72jBp3yCF7NU6Y+z9TDFnO/WkZj21kdFxmmjbFRDu7nppkLAyT/NwuvKkulBXL/lZpJcm7j0DePxvNZpVB38ChzhDI0+AwBcKEYYf7Xl18uIxJw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Fri, 27 Oct 2023 07:46:52 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46: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 v3 18/21] parallels: Remove unnecessary data_end field Date: Fri, 27 Oct 2023 09:46:33 +0200 Message-Id: <20231027074636.430139-19-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: 6726f18e-7d6b-4d56-9c5e-08dbd6c0e0d7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7RGrqW6C5otXqcfujMJ2pdBQnufoHyKAdeeEyCX823q6niYEFMsqzqtDvV8YgZVz19I8hUPPV1wKveB6tNGijJ2QL/M67a+WbmIc8hLSyNc8INto8WSNH8f19dHEoizgswAkq3HZScnnxwbempyWEP4KtTsFbFSUTx94/Wqzqubt5YYJYMv54vqXRUtibrG4m3fGfM7fTIaO0qG9966dNxh6tH+EawRhdt5kWvlj+4M4S4tOvLTjW3KaUn8ZYTioOByT5a2Hj26x22gahMv/HIBLTeaonEYk6swlKoonKLunR4UXY2wJSsE4KXoiMKjF8EyRNDaSD764+KWmo2hZBXvey3ftFtoHvYstFdwP9kG1UA5OGSdWU3FMRpnG1xceckJ/gNHB08IwZ0e1IWRFwUAIcu2UiPBKY5UrS6msbVOSlAwCDmLK0ASSmASNM4FGJTm0Sluy7bnkyBPSBtdMFhNoXp+mVwE4CV7ranOQufr1cBiwE0WJDenOLYsml+b4emh5iMn98oW1KGYqz/92wNlOFTn6d5PFNNCvRiq5YTs954li2EYoazBwkVgSodzUSq4alR4Nnz+TP5WTt4HLQjnjW+Tjt0Xz0NmIYjtF8cXMqd71WuOAKY0cN+3KFCMb X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(136003)(346002)(39840400004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(38350700005)(6512007)(6666004)(52116002)(6486002)(6506007)(478600001)(38100700002)(86362001)(36756003)(2906002)(66556008)(2616005)(26005)(1076003)(4326008)(8936002)(316002)(66946007)(6916009)(44832011)(5660300002)(66476007)(41300700001)(8676002)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KNNo+U3yfFqC8RS5qWC3nF2vUJms/dyPxPfyz0OVJhPZPZOrld7oXXUuE6J1JKj17b8EUVKosNymvef0hv1rzTP4rZVYGdzk9nevbL1Y7iDVGt176NHUyef/W/8evgZ13yJlfPwjX8y/dEGXSVQTYfMAYkLZJ8QqRBGJ8QYla+/9UCn2in56Ywd/IP1NflsLa8UjfE4BN54rjFybF9CDKxWyu22Py3nvaQNQbe6R3KErc51PgUmz0OVhffkO+BRIBv9UafDAVZNFiqbAD22sfDryG0zNTu7l0AWlMVBMU9YwivKMHpB1i3HUIgtZVZrLrlD0wCtcQ5UFvtmpyyaInDiij2uoxKMBm9rC1u6vPnq5I3ly/t6U+ShcUIpEsadnAAmpYv74cJ1CYnA5Mecm1dD/5hLvP1mRhVCbWXnJQMv0i52RJcUBzLOGa+KG1y7DDMePKvzZ1OwpXhCbFpRhJ9ozHuLvvIkIP4BMlUJ4S/h2B9iRtooGsfBqZ/ftcI53/9qKKQdCeURjArQYcP+0rabFoi9Mn1IiVjyRePgmRJNTOsvWAf1SMt6EvmoJudOvAYhLoZ74qF2TRIr0deND9RcumkOGWQJxIbHoURHFwkGCUHaqm5m+3QgfRcIHXJ6bhhd1Zj0WRWmOLVjUg9KnA8IWJgAWBSnSvNhvdFSxeTavisazu89tYAy3WsXHwDk7+Iom47hv1OzZX2RoVfpNghhtfuLClyUuWPSYuoIWuaTuxVV9pVNpodqbXl+/OoKgfz17CZUx/NpjJWCBODOuCgof5MVFQdWo8rmPZHWfp8RBFeBYTqbJUjo+xovAx971wcfkV83Y/MzQQQheUKedDo9AfAMW7rIZF0LXn2P2Gfg9qjn6icU0CpxTVjvEfpBJoxv0DhVmrsY85kZ4Nz4bLvN8GTL0ibTeChPS9p4wy0Lb5qdD3/oVm9QHFPFsHg1W7GhqRr67Zk91KLl2XUAvlxD4eSi1gbnTFFa97isaDL9TZS3dfIA5oJBloO3IzHSqaYLj4Nvg+xZJ1eO52syaABB1hw4jphe65qszUFLyGvDX8616BDzw71eimrxDHWDfzzwF+hx+68nxA0Nu/p2kZB5c0XFpOWy+a0FjwOKI7n3/HKUYMdGFypOhw7bqmG0zxUhNU8GqAMzO5hl9aqbyHk57YC/IySVPykjG87tIGsOvyglMQ6+sWh1+yS153qNrLMSU9ikncgoTNjkwyQQmTDq1M7cWTLV6hdTSGbhNrtC1OGkz0M6P6sl11uRs8bedsmEJPSm2rj0sw0eWbOM85uwEY5AZ+79xnZJoY9wNDumrzOgVBVPJFfeenGVBlAkf7XfORc7jrk59KCvjMPOfVELzu+b2FAZtFmVhAOA27mDbLgjyDvP0grS4YbbKJ9ApvSlvUEpUlvd+DwBqZPI4f7bqXdLNlQWydjdjD9I//g/kwso9NI8kvAmAXtWdmuY3E+80DazJXER3qsLrb03Pe/7EMdz+XBjvy2awkJZ/6o+6INPRNBSJUu/pIu6gy87MrYIfnxoi91xuJW2nC8r1//zVSUqvs7U4IujDgIiws9BuYhuMVORSZ0ss7bMwTvnCKnNeW1Mv7bxOHRcrlTqGE1BUTcq92Eb+6pQMEyDK2/M= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6726f18e-7d6b-4d56-9c5e-08dbd6c0e0d7 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:49.8472 (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: SO4py1eUunO7srLHRF6gjatqczmL+WwCPwRDvTS2ji317SU520UoayP/C0oXcJN8iY5a0YhS9Y5Moh558cPXWmllf3t0z6kaHZ2LjQAYxS4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Received-SPF: pass client-ip=2a01:111:f400:fe12::701; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Since we have used bitmap, field data_end in BDRVParallelsState is redundant and can be removed. Add parallels_data_end() helper and remove data_end handling. Signed-off-by: Alexander Ivanov --- block/parallels.c | 33 +++++++++++++-------------------- block/parallels.h | 1 - 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index d497cdbe41..98967dff90 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -266,6 +266,13 @@ static void parallels_free_used_bitmap(BlockDriverState *bs) s->used_bmap = NULL; } +static int64_t parallels_data_end(BDRVParallelsState *s) +{ + int64_t data_end = s->data_start * BDRV_SECTOR_SIZE; + data_end += s->used_bmap_size * s->cluster_size; + return data_end; +} + int64_t parallels_allocate_host_clusters(BlockDriverState *bs, int64_t *clusters) { @@ -277,7 +284,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 = *clusters * s->cluster_size; prealloc_bytes = prealloc_clusters * s->cluster_size; @@ -300,9 +307,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); @@ -318,8 +322,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; @@ -760,13 +763,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; } @@ -805,8 +802,6 @@ static int64_t parallels_check_unused_clusters(BlockDriverState *bs, return ret; } - s->data_end = end_off / BDRV_SECTOR_SIZE; - parallels_free_used_bitmap(bs); ret = parallels_fill_used_bitmap(bs); if (ret < 0) { @@ -1394,8 +1389,7 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags, } s->data_start = data_start; - s->data_end = s->data_start; - if (s->data_end < (s->header_size >> BDRV_SECTOR_BITS)) { + if (s->data_start < (s->header_size >> BDRV_SECTOR_BITS)) { /* * There is not enough unused space to fit to block align between BAT * and actual data. We can't avoid read-modify-write... @@ -1438,11 +1432,10 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags, for (i = 0; i < s->bat_size; i++) { sector = bat2sect(s, i); - if (sector + s->tracks > s->data_end) { - s->data_end = sector + s->tracks; + if (sector + s->tracks > file_nb_sectors) { + need_check = true; } } - need_check = need_check || s->data_end > file_nb_sectors; ret = parallels_fill_used_bitmap(bs); if (ret == -ENOMEM) { diff --git a/block/parallels.h b/block/parallels.h index 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 Fri Oct 27 07:46: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: 13438183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3F0B7C25B67 for ; Fri, 27 Oct 2023 07:49:30 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZe-0000Rr-P1; Fri, 27 Oct 2023 03:48:06 -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 1qwHYh-0007BE-3D; Fri, 27 Oct 2023 03:47:21 -0400 Received: from mail-db5eur02on20728.outbound.protection.outlook.com ([2a01:111:f400:fe12::728] helo=EUR02-DB5-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 1qwHYd-00041O-Fm; Fri, 27 Oct 2023 03:47:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KxwPy1JUfWPCxD197YzzsLWfWKddxGG24QqJse5ocLGt8xQvJgZBmsG2ntI+6WcdzmNJSlFktfVyY9Zqhnj+AZan4o0GTzX8htfeARr/HFPYRf+n+K0wvxyXAQorI4SpCKgO08byZNqP0SHvMM84rJzzzPGlgwn3v/Vp/uDAVogzM4ZQPQcBNAnQ5lpZ86Y6uGu6aeF/FNaCAXZY9SX3sMr5UQH8qd8Gnnrhbj33FhxSb5LHDEX/uGHYPbOg+WWu44GQN+mvGOTy+fDPJuCIEVkV3ABwNYAzI6wb54Y17VJL2OEZd1927xNnjcOsNKN93s0Pe9ZGhZTOA1jQgUGc0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oirhDp1aJ+KaHzsTnY2r8XLS49vYxHQU3xKKAox1B+w=; b=N6E5Q3qwYe5UFCieBHAS6tKIy2iRlhQH6R2i1tqro2ptyA3BXqHCp39HFg+9nzcfUwug8dV7txUnWG0luROZygJvaeD53vfnu6o6xUbVwADQhgtB4QMXNNsLF5ElHZ7tzfQ0pz1Z62ScqLsGT4nw/um4obxreMxlcoZC7gOsO0Ylaq+ReoWun90OWgBXdDRkEuNcihLpiiCcXhoSdXB5NJyAJSs5gEO7EIoq9MXZ2wESUhc/LpwvPv/G8qpYqV2pi4eYiFiXus6DG8/u6NQJtBeI/zZ/vBtB+cl9CDA8yD/CqIGI4e2ntqRad3f4S7vzskg3/MR3KQ/0Lxj7Sl0hsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oirhDp1aJ+KaHzsTnY2r8XLS49vYxHQU3xKKAox1B+w=; b=YdeTgR/1+HuM+ZpqkLFejRi+yFeDqM6X9n6nxI1X7UbIdSN+V9NCv7S0uSPPIUQS5F9NB2cxjg52i1JyPJzzxPyg7U7lP5UZGBWcBFvfAVY8Okpwzvo9hWMvcYR1ndJ+EIajAQ8tEuFN/xSE6O8FxKjdrJ4x51TnN34KOdk2mhWo9qQtqJsDeAV5K5YE6ZAzde1lYsP6OzE+M/c9HlJb90Vm448yIvySDWhH6HGs93nqYhVYPhqKrMF14IRFgGHPaMzYfl9PAT7blEuc9VrrM13nCEB8yh3bDOpyEvLuY39wysks9uGjhciame1QtGrKkM/qcp8sh/+ufdk5K1gJ4A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by GVXPR08MB10715.eurprd08.prod.outlook.com (2603:10a6:150:157::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.22; Fri, 27 Oct 2023 07:46:53 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46: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 v3 19/21] tests: Add parallels images support to test 165 Date: Fri, 27 Oct 2023 09:46:34 +0200 Message-Id: <20231027074636.430139-20-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|GVXPR08MB10715:EE_ X-MS-Office365-Filtering-Correlation-Id: 064cba19-da39-4cea-4c61-08dbd6c0e107 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3qKBqENe9WjQsicPm2YPasoukco6p65Lwi6oa2YyS3XnbQSlrTq3cE8Ji2wUT1Ol5/SX/5k1zZ7dAkHh4+XrzTWaKNPJIeOL6tLWLCySndktmPAVkZPGcEybfQTf90Xu3Ic+lAihdfvODpk57gi2UZFYJaF741ZZnhg/Qmoi21pzYZcbNpDGXn6kvREOvOzamzY+p2EoUjaLshysZ58x5gGeZO7u2Z+NyzuUAAkxi9gzEHoHOPHc2AJuEThnK45LZ+b/dPgbIuqq6bkSg1c4MyQDeGVs6CuLBMhNLabtspVwyUG6tuHWn1st2B9Bft7sLo3BaTyQCfTe/y8tpTAt6/eV8Idqfq8zRuXbCV1JNqKvgrvrYqCI9HLnvBgFM2aZz29ZL9b3W/Obe6aaKnIm1MV0+dZTjjosVwiHOnabmOIkn2UTjtzUH49YrsRmHfpv4mYv888XTqfbiBTFMrf9mfrAhWsI7nJkA5VKAy/y4tpYDWL5WNhr1uuv1Dh6RnLF37pttmsyRp+zwkOPLOC9GUMnMqw7QAuPpZfPgKfHH1Q6u+sfqz+uN2uLk490wyy4CICoBleLd/qhAFtuNMHvF0b9Q8us9Ten11lG9X02gztYbZ1/y9PbkQMe4AF3lEbK X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39850400004)(346002)(366004)(396003)(376002)(136003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(8676002)(4326008)(8936002)(83380400001)(26005)(38350700005)(5660300002)(38100700002)(86362001)(36756003)(2906002)(44832011)(41300700001)(6512007)(52116002)(478600001)(6486002)(6506007)(6666004)(66476007)(2616005)(66556008)(66946007)(6916009)(1076003)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: arCx2ab8R+Krn8Y7rYCKU0POx/kAQ10v4Rakqn2c/hmXIPllMBOCgNa3bWiTUMQcnD+CVUy9MshFlN+9me2jAiPt/DWMIBbzHXXrNHilia+eSbXGd0XgMQokIyxyFXnLi9Bw1pZIdFvY5wzWNKuAC9O4gf5KbgMBv28J5ojpyJ4UmxVVgujhcvkRtubn6cYB5DJGy/gv2sl3fc9ByXiSXEJJ20+gtmNTju6TW8ai9/6T4vUfa89rJLUgq9lPV5oZER72foPKtwwnDBTWiEjm60gZhwscd+85YAP300S2ShNyd3/XDcBiEjVc3LOhXN+BkpRl2kamTETY61bxEq7Xh3cevgdVI2KaZf3wEIy0SS8n2IOjSQwR4DWTPafl/6kAdDfz6IONZC3x/Ce/iMD9sxGxT8pVIEW+s5bN36vnhUnrrtSq6E6MZNRbA+GonL9o0f5bb2cX6dvLIVJmbU98N1LK8TwLnuliysvZCYgRwS2j9cPivp3ews0XXbOcsXI7unF23amWg/CdRUrJjlJaJFc00RB06NVVKdVSepCOVgpe/6pAMm3J2zvbzGdaOmOX1yFOmYqnMgIRZbqtxbaLprN92Twx2RzypJFi8nqqmIKBkW7rru3u6ilPhtWg/l367THcUxn218PQFsfda3t4OygD50pFGNV7O8Ybj5JeG19cA1G7Fdt/8AevYjNdnzvzuSwOrqCvOs78mysdBwV2k41xGEU3c5/DVTd2WZIPzdYpFZw//YE7nnu/8B95Natwa0DhWi//cuL5CLVtcBzzA/i+oz748YyU0oBPLQcZ3/OxRAslgQDRADoDhwkLsIk5Ab5/AnpgQ1r1HUh0OuJtFAyewON7AUO8CLNtKbqex78nZb0FvdxgAcPdCRFSdShb3L+PFZiMEHGrMhjIOKHSoQKty/nYECu6rqTMbUuRDMnv2anLPxCO+LvESQPn2SB/Z3kO894XtPNNX36L7iHqUHFq+E44l5kOQbib5nlB7PieUt1uQTuqBhUa2SO0PhCWx6DUEZF2s7Knok+VXkUje5WLajXSUeq7IWVrJ851nipaaGs4sTFtMnmVgtOGqny7mO9ueWwiTUgxl7XkoiQ8nIOBgufcKzYEhmLrY+EnrvJRC6YgoyEC508mqW3z2lkPvtXp8rOtJH1vsoOYH52XQ0ameFSia76wcgODDHodigbBbL2y31isfyuQaAt+N1cZFtx7De9AG2WpRftYJaGtguD2Gv3S0nHUF0OGQeqUZw8Gx52xC65xZRHMHcKltSXgkSa7fm54O0BCSKcvYlWe7jobxIhxAF7PLYZldQ07sxZ+yL4yN1DhoTSGMbaFwSaPKvxyH5XEpw/TR9etR7moCsMD8IQAnGCaBowBQaOC1sEXH1ioQonwWTOeiFnzu19Yr2ghXxLwsTp4xG4ze3IeASIPwBwulm1xA+cQXMa5I/cdz7GQcmK8Py6tkQoJoOh/4BAHYIyK1tN9J4Ocmwwu0eOC4HYfZtBei3IBNa66oRnYCavQwRGW25pyvh3iBk3oX2LPqrmKqCt4w+B1402qJO/tuHltcDAeekz3MiMnlZAREJejlLkcYYeNd7tWKRYBABeOJaDOf4rg0zijNlKP4X12l50YHOaRMzNXD23Zk3M= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 064cba19-da39-4cea-4c61-08dbd6c0e107 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:50.1573 (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: VERMpxzA4F1yR7tTFm1ro6IsUiJnvB2SE2EEpX5hrpmuxP0EoNjiH3S1jwOnJW/MQKSMvoXybyhSAL4Fpcywm95NxwLhlM4psV4yGtdyshQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB10715 Received-SPF: pass client-ip=2a01:111:f400:fe12::728; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Use a different bitmap name for parallels images because their has own ID format, and can't contain an arbitrary string. Replace image reopen by shutdown/launch VM because parallels images doesn't support reopen. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/165 | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 index b24907a62f..f732db257c 100755 --- a/tests/qemu-iotests/165 +++ b/tests/qemu-iotests/165 @@ -38,6 +38,10 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): def setUp(self): qemu_img('create', '-f', iotests.imgfmt, disk, str(disk_size)) + if iotests.imgfmt == 'parallels': + self.bitmap_name = '00000000-0000-0000-0000-000000000000' + else: + self.bitmap_name = 'bitmap0' def tearDown(self): os.remove(disk) @@ -50,12 +54,12 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): def getSha256(self): result = self.vm.qmp('x-debug-block-dirty-bitmap-sha256', - node='drive0', name='bitmap0') + node='drive0', name=self.bitmap_name) return result['return']['sha256'] def checkBitmap(self, sha256): result = self.vm.qmp('x-debug-block-dirty-bitmap-sha256', - node='drive0', name='bitmap0') + node='drive0', name=self.bitmap_name) self.assert_qmp(result, 'return/sha256', sha256); def writeRegions(self, regions): @@ -65,7 +69,7 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): def qmpAddBitmap(self): self.vm.qmp('block-dirty-bitmap-add', node='drive0', - name='bitmap0', persistent=True) + name=self.bitmap_name, persistent=True) def test_persistent(self): self.vm = self.mkVm() @@ -117,7 +121,7 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): assert sha256_1 != sha256_2 # Otherwise, it's not very interesting. self.vm.cmd('block-dirty-bitmap-clear', node='drive0', - name='bitmap0') + name=self.bitmap_name) # Start with regions1 @@ -135,16 +139,22 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): self.writeRegions(regions2) assert sha256_1 == self.getSha256() - # Reopen to RW - self.vm.cmd('blockdev-reopen', options=[{ - 'node-name': 'node0', - 'driver': iotests.imgfmt, - 'file': { - 'driver': 'file', - 'filename': disk - }, - 'read-only': False - }]) + if iotests.imgfmt == 'parallels': + # parallels doesn't support reopen + self.vm.shutdown() + self.vm = self.mkVm() + self.vm.launch() + else: + # Reopen to RW + self.vm.cmd('blockdev-reopen', options=[{ + 'node-name': 'node0', + 'driver': iotests.imgfmt, + 'file': { + 'driver': 'file', + 'filename': disk + }, + 'read-only': False + }]) # Check that bitmap is reopened to RW and we can write to it. self.writeRegions(regions2) @@ -154,6 +164,6 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2'], + iotests.main(supported_fmts=['qcow2', 'parallels'], supported_protocols=['file'], unsupported_imgopts=['compat']) From patchwork Fri Oct 27 07:46: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: 13438190 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 22634C25B67 for ; Fri, 27 Oct 2023 07:52:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZK-0007ke-9Q; Fri, 27 Oct 2023 03:47:46 -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 1qwHYc-0007Aq-NR; Fri, 27 Oct 2023 03:47:14 -0400 Received: from mail-db5eur02on20728.outbound.protection.outlook.com ([2a01:111:f400:fe12::728] helo=EUR02-DB5-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 1qwHYZ-00041O-TC; Fri, 27 Oct 2023 03:47:02 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mbtAJ/ifmtb+XG7OWyhRtHtGBHKLpROaKntpc6En4QM0myuH4I7KE5XWOEi9n1Wc9p1lV3QVcy7qaVqrFC0jhaJBkvqEvXv9jkEnjlxnkkKjO0BzcoiDjkFKy0gMy6i54oVw6pKESM7LOiolg7/yT7wDwlx9qHG4iWpa9nTIm/Lhm10BBEJCLji33VZz5plUP1V4fFWMZIC2aPZqNw5uKqYoO2v/aFgPtXPJ6p+d4u9agqic7xud+kg7bCdGu4xr3aqTFGFyrZdsbkr2aP0YV07joiFqkGWcJhqusmQ7YJSnf/ISxI4Vjs07Sxu/S6ReZ347HINo3YEsVBjYxPwbSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=djhWzR1OD9wSw+5JwkKqbMpl26LmShHjJ4ERxNNSq+8=; b=TnHDKpsr+Ne9kSWn6oV+kRCqdIJXYY6IpzopQk6o0d4xTA9brZ1t5+Yn+KMbGgi0HjTMOAS2D7yeXFUXX8oFAChPw2Io1374gi5T0rxAMVhDz2IFyukZCiuHIc1IlcAiYGrs7iBZV8xcj/8SmDvnmKyVjYUSYztxBUh+oyuEGGYyCwLKLrxXYMJ51Vh5/1FNBIz0QHz3HRL7fOW/53B03Osm/ehJVmMzxgcfjG4g6+UGvNll12eNdKJe6Axx/KPHxt9MqYK9kW4CzAARvndpdiVuaaVL4YxpDFNlp60cdG0ysHqaYnSjBy2M9kxIpBeL0nH73tJrhkpfB087n1JvZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=djhWzR1OD9wSw+5JwkKqbMpl26LmShHjJ4ERxNNSq+8=; b=VKZ4PpjG3VuK8SCKKEHB/RgN6AxpY433ReH6AEjfNE333qmZWG3OsoF61TxvHWHMh+Xqkm7HyjtbXFcV8eQ7ECZV+n/Z3Z7sC7oXCwT7jWdLnfrbEOIUQpyuaIEba5egnxWIbhcCFGQFWH6/bweWM3nHZkQCnGxz5x5ug0H+f40ZZXgVRBVMEJYiKibHkTslCLxERtPB/7Jkq91LFfT2eliyaqSC3/Qnh+LEMf4puikjYgZHf4mT/2H5jb2UbkhcblGfCtLfGut3aJrHk0x8TzluLycXrEa5K/wI8CNGusJFuyw8CynO8P9TRMnZk2sDMB3Ze0AHeokGUx2MZzwh3Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by GVXPR08MB10715.eurprd08.prod.outlook.com (2603:10a6:150:157::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.22; Fri, 27 Oct 2023 07:46:53 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46:53 +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 v3 20/21] tests: Turned on 256, 299, 304 and block-status-cache for parallels format Date: Fri, 27 Oct 2023 09:46:35 +0200 Message-Id: <20231027074636.430139-21-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|GVXPR08MB10715:EE_ X-MS-Office365-Filtering-Correlation-Id: d5dd57c4-748b-4139-fc75-08dbd6c0e136 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7i0ErnS8/UqvsfyUqwjsbOYUb7EajwGJ0n/klOZAc2IbdZ4HqvHia2VxZuJTFKmJhKhLFj/ThP63hfcSCwuR/YHmXHD2qND4NcLBBnF4aHf/TmDBXBs3JGfVAz446UngEEuuKDpXgGSzpsmpFu+yYqmY5J5XWIC4HbkZPBt5tkGNZ8c1Ft2sbuX3oalhPagIPPDT0qso12rHIdgjZm5XSU2kDBDxUmmiYYP8GKP0oyinGaJpEa/WbCrZSDLaiHX7GPFhxiDZu8Hd0PLYUqt6dtmrmmVrQp24PZB2e5eBFckWAQGyFC/8BpowZS6Y7FHadEJ3s4CXK1ksaShUP/3HxGOwQz9GhjryPai5Dhz6YV2yxiYzm5qbtK1N1LS+FZ648/6oLxgFLMpGNRGnHP+AoUFGqoDCCC4LCDAALohnF0E6+3RK4J1U01sg8uo2Xw/BgOHJajfnLdEp3JnwtTRAdJAHCCsm+Ilqr/7ZPy4sfZwG7EZOBIjmuZkGfcxogdUn9+6Hjaw1F/eNUzp8RHUBod8IEp0Pr0YEcFWkFywl4nKjum7g90xB+HebqKi3oEteOHoo0EqLTs8VVB/7+AO4yFhNWa0B5IvTdDECoU9FzV4DRDnMto4dDLL4GNwShyRQ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39850400004)(346002)(366004)(396003)(376002)(136003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(8676002)(4326008)(8936002)(83380400001)(26005)(38350700005)(5660300002)(38100700002)(86362001)(36756003)(2906002)(44832011)(41300700001)(6512007)(52116002)(478600001)(6486002)(6506007)(6666004)(66476007)(2616005)(66556008)(66946007)(6916009)(1076003)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9ikJFKO/bws34AJw4v8IFsl8FiFO5xq9JRHUZMX6nE3fp+9tDa5c+YtHjX3x8HXWhdCmWgXFnB+oABcN5/LjV7ZNpiQw1/NRtQrNKkyXy6xEo0LS85CHmjvYgtm4WkNZkX2lYzi8izXUNdWn5IXq/NL20yWmaLuATOl6MBoQ6FOtRgl8Ew+CRfUe05r48BBKHSkto3FySrCTvVn6MYBW95ISwJg6zqi1Wdhz7uwVzqbsFBveDi2EAyW0kASl83RBtE1BYaokee2R2SHHsfu9AOQdi69qJpK1pr5ScMT0tUm7vduLo4dE3S7E6+OP6rp6J8+c8iUNwueD8OG9Qbd1MTft5IMdciQ98wGIppC8wnZ6bC9EpJukXFYweoYjQ+Yqlz5ov+w/mXucjJlwZuSHt0V+1UzbErNmnQeJzu1NzSFjYKC0P1lkmeewEyWCQ4dZw0o7iwS80FgFaKnzVohII7/zc/w14w258fL0Z6oCXSNrhxP0Iy0tnKKW0uD9C2v1EjHW3TxGf/jURKMZSBPlF5rBwqUUDrokqtcscdwQxO4WW5HIFICBctV+GUa5GLgo8Pq02xXd3IPDcEa2bSqs3y7IpyEejHLNOMlQT8VqxUwJCrCWrWEaB6ZHM46XgQ5wqfbXGvSvcnCDpPyo4zMLq/YADhJvFzwUKeudvCk/6AFTYdc25bTyMNTtZgvFUTGv+BKYbKDeN/b4Ir1kQ1SV5fYEmMqGE9cKp581Zm5BlbaTD/0xIU/Xg95Gz79tjGs6ztqmi6iOT+3OlI0YfUejwxjbrbSoaID7VS0HSJQSSNqQbBigr/uy9YcfjOrYAbluEjTqMMnyptPnXghcjsu43+8CMzMDEogHIFOGbFw5zZ+twMlJcE5RXZ2R8lM09YG2TlG/Vppfaj1Y7FPUAbz3RSeNrceIBjbYfDeGIQXtBfMJGjn6iqjiEFaxPbc6QvOn9Nd4fOIYyMyH2vbdFeunB1lamZb9E1DtaaLZF1tUja2WMxdjjKpcYICU3plfpUI1iUP0F5btG3jwqQWYQYtyEAoAeGwd/AHRmBQhtmiUlNuxfzuOEJBBAFhTZ+R1sOZ1i197cVQPE9+vEX5CeSl8oWDgs/2pGDAe6EvQmESLWetzASudPjFtIybChIWMTYWKMIabu4Z5PBxjjep3DDTj9BbbUfBrmMtoe0SW+AELFtKt3bUHw+0njys1xMlCWT4IBlg9Uf2DvbRJnW3YWSL8z8DM6J63CDk9ZVbGpY9kBhDBlwwvWcxRhBmWR3Bf6TMsy9OEC4DNMRyu901oYB3RrkHO0gPTIoPGtCxSaFCMMeJxIRfNyTVhq8P+nILxiGSOipTzc9BC2HxeXdeQIqOaN/Oo5EiBp02V/wI6HttT4XJenOh95mTyjmd6KhyQmE6f9ptQ4wcLAj7snobbf4aRHm4SxJRdP/QbXTx+a96gUiyzIq6aaRnDJcV7rjQWxUYXQXC9nqF54naBMRepiTOUI68IZvxcf1BOW/0hYy1KHBX+S3UHBDe7qSxTBIHzInfzTW3e6PIpST0O+qTiNbYsHKop8CdaypMTShTeR4TH3XIMEFFWZ1IyS+8TGpd5bW5uLBxjpsu5W2AK9jucp6RF7adHiZ43/rZOOP565giJTeg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5dd57c4-748b-4139-fc75-08dbd6c0e136 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:50.4710 (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: 5/fPoZ+sgacc/0JOBI3He0wpNLAy1JqUP8nIH2GNM4V791NKHD0arFHLUcuPecOdYu7VIgxRHmuMqVlpLTgRyNU7w/oC4QE9V2T2PwcY7E0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB10715 Received-SPF: pass client-ip=2a01:111:f400:fe12::728; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org These tests pass with parallels format. Add parallels to supporting formats for these tests. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/256 | 2 +- tests/qemu-iotests/299 | 2 +- tests/qemu-iotests/304 | 2 +- tests/qemu-iotests/tests/block-status-cache | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/256 b/tests/qemu-iotests/256 index f34af6cef7..1a4c9c6885 100755 --- a/tests/qemu-iotests/256 +++ b/tests/qemu-iotests/256 @@ -26,7 +26,7 @@ from iotests import log iotests.verify_virtio_scsi_pci_or_ccw() -iotests.script_initialize(supported_fmts=['qcow2']) +iotests.script_initialize(supported_fmts=['qcow2', 'parallels']) size = 64 * 1024 * 1024 with iotests.FilePath('img0') as img0_path, \ diff --git a/tests/qemu-iotests/299 b/tests/qemu-iotests/299 index a7122941fd..d8c4399446 100755 --- a/tests/qemu-iotests/299 +++ b/tests/qemu-iotests/299 @@ -23,7 +23,7 @@ import iotests # The test is unrelated to formats, restrict it to qcow2 to avoid extra runs iotests.script_initialize( - supported_fmts=['qcow2'], + supported_fmts=['qcow2', 'parallels'], ) nbd_sock = iotests.file_path('nbd.sock', base_dir=iotests.sock_dir) diff --git a/tests/qemu-iotests/304 b/tests/qemu-iotests/304 index 198f282087..1ebf999930 100755 --- a/tests/qemu-iotests/304 +++ b/tests/qemu-iotests/304 @@ -23,7 +23,7 @@ import iotests from iotests import qemu_img_create, qemu_img_log, file_path -iotests.script_initialize(supported_fmts=['qcow2'], +iotests.script_initialize(supported_fmts=['qcow2', 'parallels'], supported_protocols=['file']) test_img = file_path('test.qcow2') diff --git a/tests/qemu-iotests/tests/block-status-cache b/tests/qemu-iotests/tests/block-status-cache index 5a7bc2c149..ade3d5b169 100755 --- a/tests/qemu-iotests/tests/block-status-cache +++ b/tests/qemu-iotests/tests/block-status-cache @@ -131,5 +131,5 @@ class TestBscWithNbd(iotests.QMPTestCase): if __name__ == '__main__': # The block-status cache only works on the protocol layer, so to test it, # we can only use the raw format - iotests.main(supported_fmts=['raw'], + iotests.main(supported_fmts=['raw', 'parallels'], supported_protocols=['file']) From patchwork Fri Oct 27 07:46: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: 13438181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BF37C25B67 for ; Fri, 27 Oct 2023 07:48:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qwHZU-0007wf-ET; Fri, 27 Oct 2023 03:47:58 -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 1qwHYo-0007En-Af; Fri, 27 Oct 2023 03:47:22 -0400 Received: from mail-db5eur02on20728.outbound.protection.outlook.com ([2a01:111:f400:fe12::728] helo=EUR02-DB5-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 1qwHYi-00041O-Pc; Fri, 27 Oct 2023 03:47:13 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TCKsbWgXmvjjB1u2vzDUr0hdIc4nZPHwfgeQkO+0HxeR4yj18VUPcMJmI0rCYGB9WnI2W3LNA6H2rRLvWi/wcbQGFE++FnNrjuxHJBSoT967mO3R9VLqS+tNAGluXny+qpMXktRcuJffUEBdXKf39w/TlWer0gNvTf17Ninfl4BSqGECcfUHIAdcfLxlGOIY0Ri2iULhvl71Pq1CKK8FRVcHbUYdANjxtVbsLR4F0CHRHM5JVTR9G2yG2B4wK24vqobG19Lbx74/s7hAykNKsYKBNz/O0jH2F8tHOylVlUbgAASRF4976Qfpqlwhkd3nO4bqpNgy1Je7G+XvJK+s5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OQY3VTqKbLWc1ugDai63v18GJcmUxZY7ZT4nVkMImmo=; b=BZyZf564U6jk0d5Jjf5a1N3iOfzy2JCI8x4zXWSheUnayPD6mkikNTlPVf2ODqHSDxe6NCqWVkR8bUfIHt6/KHd6F/rQ6haWEfXkT6w3dgnJLwCN9xl7F1TKjrRjx5ThQWlcsf3UIgnVuWCCmEaypfgtgwJ9OCYpsQ74EKb1sVDk/DhhZ44xyoQ7K0TAM8CxEo486Il+yeA1876gdUblux5AjOL7E/mRWoNKiRc5wjqESee9YQwncfgeQ2b12WCEpSVAj9YDEH/FJZXP4KZko6Yy+Jh77e4VwzZ3QywW2/iuFQFWbtqUQV3N8I5gd++aHsbTl7Doomr+62M7ERPtkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OQY3VTqKbLWc1ugDai63v18GJcmUxZY7ZT4nVkMImmo=; b=pBmsMTcwZL51/g3f3RFf9DNMAF55r3jy6c7ocxBLvtvdTgRY3U3Ds/uPi7kpb6xbGr6K9j/PcFaCPxqJRrog6vTcw/mbdaBMRO6Ae1R75qHoZVu03c5ePGLZE5UBanyZH6eZd7HBqWO/ikfLq4ffqSIwSx5+TmHbFDYs0V+fmwgUVi7j6BT4LVXYJD4ZaN+4KP5aMm4RGvVFeZc+qAIsJDW8RdYT60XSYUf0h/RwqxLSZdTU2xEYXzM/QvYkMZNf7BlJXW0PEypDAvIl0KBoAF20/O3NwQvI1yAWk7i8M703AuuX+xbvvS9liy8FDzYiPC9RGAEy2pdApYfRyFX5eg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) by GVXPR08MB10715.eurprd08.prod.outlook.com (2603:10a6:150:157::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.22; Fri, 27 Oct 2023 07:46:54 +0000 Received: from VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371]) by VI0PR08MB10743.eurprd08.prod.outlook.com ([fe80::22f7:6498:de53:5371%4]) with mapi id 15.20.6933.024; Fri, 27 Oct 2023 07:46: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 v3 21/21] tests: Add parallels format support to image-fleecing Date: Fri, 27 Oct 2023 09:46:36 +0200 Message-Id: <20231027074636.430139-22-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> References: <20231027074636.430139-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: VI1PR10CA0101.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::30) To VI0PR08MB10743.eurprd08.prod.outlook.com (2603:10a6:800:205::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI0PR08MB10743:EE_|GVXPR08MB10715:EE_ X-MS-Office365-Filtering-Correlation-Id: edfbee38-22b6-4273-ac7a-08dbd6c0e166 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xvmtKsBTdt+iw4KvQDRXWKaD2pXEf26PquvrePTH/PQJrA3mRPdaLNMawiiHkjQyJ+2f6eqgUTdN2nmv+ZvE4nGfGzLnQya5zOKlgqg4ZTvcjMCEZJgbs3w7tgLEC7A1muBdG6fxkcDknugm1TBhTnwVZuKTKoN91pcZk2nzuNdrMIzh7sNT0zJURFcMDvjs8yZClU7Vj+74s20gljBNGwNDwCkj5ejZmYvEmqOUT+rcMI1BwGb0stk91SM7RAn5BQpyyZwzygC9jXVcZeq8EsnXdYqZF0QLO85EByXCY93lGYe0f4GHYnmrnwyR22Jfxd3HmV4Qo9tPhORXp1OPZ/zK+kg3QY15ZJjFqaW59Ib4j+kg+/zkMNcBDOKmHaVZq6DwFjEHk8EnPBDVwrQTDXqKbdqcOkkQz1XcEEBUFc+8rZscGUxXljLX0E02teasYsMzpIOT4emKlaQ9uLw7vMF95UPmGmzZwXEVxBI3ENDNcIXJHc9rNL1qdGCP3I4XND0HKVLIJ7aDAfvgm9qzHvDy/aSYKCf8geYh99EtqIddUyE15XJ7Ku2RjZERGrDvfN0mxfcNufS3YM/MYCm2bYKbkFbQlEuvyJrpw5Ii+DzEAK8wJnOIG+nzLEteh4bx X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI0PR08MB10743.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39850400004)(346002)(366004)(396003)(376002)(136003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(8676002)(4326008)(8936002)(83380400001)(26005)(38350700005)(5660300002)(38100700002)(86362001)(36756003)(2906002)(44832011)(41300700001)(6512007)(52116002)(478600001)(6486002)(6506007)(6666004)(66476007)(2616005)(66556008)(66946007)(6916009)(1076003)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LfqLkrciTZnb2tu+cF8qjazJrfGJvu9vpEYQVJ0wkUmK2AWWgejaFaGXgUu92RQLKKeHPE61coevI+m7pa25GEYqI8b2z6qvqRxwwsRJKoO5m/z9sdA/nhLqMdOve6gF/c+N7e+sRy7UUDeAt5KzRWnGbqjB/eNszqDIM4Nb5/B3503/1hocOD6XAHUoNM2422oUd8nmVejXMLVL3x6ZWTIeQvOtcxGrpXXeTp/M9ur50HoDmjmINJQqvdAc0w9rYVG8kaeRlJuos+rM1R7SM5JHJdRlkPrkzlaymxChT/d5zCk/4IWoKLpA4pFCXSt1yVmEb9P1wBDMdgac9Mx8ewXtmpTGme4/AX9bFNgNc2/gb9Y6dpCOc+hYj1SNAH9A5GWhzaK4wEe+8NLSlgJws28pBWQKrs64bYWD/SclXt1mYXvSP22iGl7kSQSeoLM4R40+Af1j1dPMuK1cOHhPREBJLcCFaZ4eOB0g9Xc7Zgh6dPJ/GHCHW8XqNOv6PZqDc/iVaL02At+eKlKGDfzfeduG/Jk33JFtEP+TaaMTWzyVN2kOSEiPZ/vXVIHV34Fo49NBA/NNJWM3YmrYakntcsl9nokjVqOiVJ8DpOBnJY67XlDCceHPQm2p4M3qgQQUFNS7t+lFkH+RHUpgEnnun0N6dSkYd8KUmlYXJwvH9hcNeVSw+Cqzp0QVlKpFfduQlFHOgkOqv5fxSaHvK4Z7dfazZwmapQ1DQ33Z94414d/M1feetrItPGAS/6yZjsplZ+iIMCUTvaUUJ/MWDB1re9uk/8YC9KqUJaYjeW36CPApBeyCoDmt+5KJafYvQDx9IR0yw4zQkPWQmGyoi9h8Rp4ZSG7gZqJzNi5cJZ6J4/8lJy8jawK3S5IzRjRz2PKUgnYYKrHJxpaycR6vSLAiyPi+TWij122nbz5RKF23/2F8tBF9Z10yvcxsSPhKjGnqHuYoyyj4wFE/GORrdhY3BEmlIvCPjrMXdc0lQD4TcE0MLQD5KHOQCce8Ll4IzwqGCkeNiRNRjrNKS+2hQUn7TDgIv2mxNdYqG8ndqWa1nHvLZIpa2+vT2jln2cTJuVXGjAls7pe9M7/f6Bs6Bk2K7uOiYkN2XCuIejCi+FQgHwVgIfwLXiLyr7RODAwRdv49fxZBc6nZv27Mb4Dx/Xm+eUGZlBxsyBDvzzM/Dd/WrBQTOf2R85zeL5oAih6W/jFhLHaXjpHoU/Skx+C6uJAe6+ClWmGqNormSe/EuuO817L/1KWZe7oSdiPlaT+xwTiW4drHmxbYmBmS466CccrOq/VdVtuO3bsykZsQENCd3rDNtMr9WrE72qrODo+gkAcuCD//XXg86+IzKV702Qap+x/LsOO3qHrRRukCMe5cGgzzX1e5vS2/KqSkD785AEUPK8r/3cU92zbOt/V3q8ii/2JYfGqu8XtJPwuX01fgrrx6biYBGipqUKywJdJkg17s7ML7NPkHpIBaifq8RDgWMjXjSbD7ZqDvnJvVsxRJXAVXyFJ1Xjpt+pTf1XhMqekHVdoqRZyl+wASWBTDjGl2eOwmkXEeLYK3Y9TvycEfvByeBg+aab22yxYdmQb/WkTuKf7Ub1bGI/iJ5C9m+62dD7X90D8dyIiUOvQ9Btq2owA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: edfbee38-22b6-4273-ac7a-08dbd6c0e166 X-MS-Exchange-CrossTenant-AuthSource: VI0PR08MB10743.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:46:50.8037 (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: vHNgg1BqnNIZYfN7XMDgXolhnZVznP/M+jUpFF+HPeU34E/GwCYBHVJTGaE4op4ciYjms0u4KXniBDpB6TmXqix/xXyC++Lc34gP8nOXSMA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR08MB10715 Received-SPF: pass client-ip=2a01:111:f400:fe12::728; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-DB5-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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Use a different bitmap name for parallels images because their has own ID format, and can't contain an arbitrary string. Replace hardcoded 'qcow2' format to iotests.imgfmt. Add 'parallels' to supported formats. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/image-fleecing | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/tests/image-fleecing index 5e3b2c7e46..dd940b7203 100755 --- a/tests/qemu-iotests/tests/image-fleecing +++ b/tests/qemu-iotests/tests/image-fleecing @@ -28,7 +28,7 @@ import iotests from iotests import log, qemu_img, qemu_io iotests.script_initialize( - supported_fmts=['qcow2'], + supported_fmts=['qcow2', 'parallels'], supported_platforms=['linux'], required_fmts=['copy-before-write'], unsupported_imgopts=['compat'] @@ -61,12 +61,17 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, base_img_path, if push_backup: assert use_cbw + if iotests.imgfmt == 'parallels': + bitmap_name = '00000000-0000-0000-0000-000000000000' + else: + bitmap_name = 'bitmap0' + log('--- Setting up images ---') log('') qemu_img('create', '-f', iotests.imgfmt, base_img_path, '64M') if bitmap: - qemu_img('bitmap', '--add', base_img_path, 'bitmap0') + qemu_img('bitmap', '--add', base_img_path, bitmap_name) if use_snapshot_access_filter: assert use_cbw @@ -75,7 +80,7 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, base_img_path, qemu_img('create', '-f', 'qcow2', fleece_img_path, '64M') if push_backup: - qemu_img('create', '-f', 'qcow2', target_img_path, '64M') + qemu_img('create', '-f', iotests.imgfmt, target_img_path, '64M') for p in patterns: qemu_io('-f', iotests.imgfmt, @@ -130,7 +135,7 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, base_img_path, } if bitmap: - fl_cbw['bitmap'] = {'node': src_node, 'name': 'bitmap0'} + fl_cbw['bitmap'] = {'node': src_node, 'name': bitmap_name} log(vm.qmp('blockdev-add', fl_cbw))