Message ID | 20231002085738.369684-2-alexander.ivanov@virtuozzo.com |
---|---|
State | New |
Headers | show
Return-Path: <qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=virtuozzo.com header.i=@virtuozzo.com header.a=rsa-sha256 header.s=selector2 header.b=IWg97afR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RzZgY3jrJz1yng for <incoming@patchwork.ozlabs.org>; Mon, 2 Oct 2023 20:01:13 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces@nongnu.org>) id 1qnEkx-0001gH-GV; Mon, 02 Oct 2023 04:58:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <alexander.ivanov@virtuozzo.com>) id 1qnEkf-0001Qu-Mi; Mon, 02 Oct 2023 04:58:05 -0400 Received: from mail-vi1eur02on20713.outbound.protection.outlook.com ([2a01:111:f400:fe16::713] helo=EUR02-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <alexander.ivanov@virtuozzo.com>) id 1qnEkc-0003Qj-Bx; Mon, 02 Oct 2023 04:58:05 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i6kwPzw6fMLbYQvA+J4g1V4GIDphnZqQzM2mI/XVivp3G2vaOUFKpNwEtwufDIygiN6W0fiLPxxFImPRxONzUGVqgZvXPpbkPCeR63iKHoiX2WkWKF/fQ7aM+rSLd1kX8AQeOG5JahUWNGx7M3xQFr0FSyIB1UU8O36sLMoRkEbWb1MCmL8PBtHu3empX9pCf7uwnIZiGS9w/KR3lDr5MWeffdoAU5S1OeW0vaBLjVRBEgofiw501nMRcyp+Ugg2EjpwEbZ6MkhNqg6JBMpbRvmOph3wx6URCWsvggQIhwC1854WtNguopF7N3ipaS9yOigyiRbfXk9qnjT4OROtFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ntnX2giu7Q2KhyJ8pzAzkiMjoJlJRZXyWwsc3SfG+7U=; b=ieNOUWsjjzXlastPQmZ/cHN2mph12viCZeR/u69cMG42jegIc3K0UAfNwz+8iSUfTjzDFqRKR//azK9EVqXfpMaNW/fXqgufymks8KY8ZLASxRLzRnzKeGnbZ/cUC8+XVFUlMU4jumJXAqsWLM8Zr1XJRAybjGwtOX9zE0JBQjyCrFWDuHLPRdTEF/kBjGCSB/4ZKn7sXinRS0k2J+YVrrHWVRoS61hH5wSDrw3IpORGvN5b6B2lsM5lfHTA/SVsGNQJ66YRoGFeW7sc5Hs5dtdlZveF79xGZiRARq1T1bhm3Ko1NH1d13KD4VcMxe1v93yQgw2oqj5MOKjR+wlSYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ntnX2giu7Q2KhyJ8pzAzkiMjoJlJRZXyWwsc3SfG+7U=; b=IWg97afR/ffeeW3NwtHCNy+ALFK3SBNW3Yxfb+YIQTZTW+esB0P6megYlBmseK8wp9YhuOkXDj4VvuMd2EdLFCRmjSYD2PMhbBKJWJFcQAzYHxjWPX8m5AjcdSGVcYONQ3cH8v002bTwOCmxQDyPnS9fcjnvEbqc6Si0yDELM0zVklHHScMct3pxQkWGmF3EzCp2vDlIuefMSt5WTN+Po/ctH3a3NYQ5WQv0WNzLmFilHeCB8c2YqxHq1J0XNXHkitHqYoxZbaLWPEbBXtr//ivD4C3YMjNPGCaIltBgQDIJ5nLX6XKtawpoAj7b+dJrd54PeFIUE/gFBC2TpGPQNQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) by AS8PR08MB8273.eurprd08.prod.outlook.com (2603:10a6:20b:537::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20; Mon, 2 Oct 2023 08:57:49 +0000 Received: from HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77]) by HE1PR0801MB1931.eurprd08.prod.outlook.com ([fe80::4d4a:2d8c:6f96:4c77%5]) with mapi id 15.20.6838.028; Mon, 2 Oct 2023 08:57:49 +0000 From: Alexander Ivanov <alexander.ivanov@virtuozzo.com> To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 01/19] parallels: Move inactivation code to a separate function Date: Mon, 2 Oct 2023 10:57:20 +0200 Message-Id: <20231002085738.369684-2-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> References: <20231002085738.369684-1-alexander.ivanov@virtuozzo.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: VI1PR0102CA0068.eurprd01.prod.exchangelabs.com (2603:10a6:803::45) To HE1PR0801MB1931.eurprd08.prod.outlook.com (2603:10a6:3:4b::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: HE1PR0801MB1931:EE_|AS8PR08MB8273:EE_ X-MS-Office365-Filtering-Correlation-Id: 22ef2c5c-46c9-4d02-b96a-08dbc325a616 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fnK+k+nlvcosnrFbwWqDospBX2aFmQHqkFFzlhoKFRf+1Y0z4b493O59N8zxPuNqziQrw+Y1rYPYAzKlH0te4RGPRMNdyzBrYJHHT9oeb2nYVc6b6ujuaZUZcNegZn5S5w/vJPVkDK6kccODNBnn6BbJGlvspeSuwJWHxmhwHhHXQNB0m6k8iUy8+Q1cahr/VqdHlS9vW2pbpubnGIXdwO1lzIakH2s2JgoZHSviv3e/Dw5JZBF2TqVUEZSCsWoOrh7nMTXwbP0HlY2KSAl1CXopwoZwhaoECWdN3gvqSQPp18HJPZajZ6oM4qDEycnA+bVCe/3TwpqrSP2KSlTon1KOLQXWmd9CiCkHjGirYzzQ9hD4xefH0S2jT4CziyoqJvoQ785EYkUfK9X8AGLNviIFNOQJrT2jw+Rv11ZjX70AEy+VtmxXo5gnSEXi/h+C52VFIG+PvTqgNmE4MWLsEYLSVxzTWaopcBxWqZhxYs1EDwqNzSPJKDkxJrhLziQGU1QFDibXAbiesCC5n9TT2QHr63qugieThijmPFCRPy7i2uLifKQBnXAss0DDyWwWFqiRqBZoBy8PymyKrekITqlRjSMgOkMswpeEjIjrzrq7TuUbBXGTsrnq13xeI8NM X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0801MB1931.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(376002)(346002)(366004)(39840400004)(396003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(478600001)(1076003)(38100700002)(2616005)(26005)(6506007)(52116002)(6486002)(6512007)(38350700002)(86362001)(83380400001)(36756003)(6666004)(316002)(8936002)(4326008)(8676002)(6916009)(41300700001)(66476007)(66556008)(66946007)(44832011)(2906002)(5660300002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Vdl79t6JqLZ6hVzA6tLTUMIWWSOhZvwkn1EL4iDFmh/gQDhAbGasVrruucv9dFyKC++jPvNRy2CTY9/ILnnhWuN/srT6Wu6hfP7VtPXokXSCuIkFeaAV8egy0uUwulPMQxYMWF9fc3LR1yNovYK0F0YlZ4dpvwsADZzKy3e+lnXtYa5M+fBpEAioqG6Foc/U0Tdqcxvh68YTEsnVH5JjcGBlWL/ytlimQQt2kng0tAr+ZyzGr/DRI06F66xLaFOrrHxBgHrhgK70F7jfBj7aUlitXb4kzr//CJaAocl4zOTi4qMSjd6bPXzkcjsfWFZTaGP8jTqgkG554KJWp3U/WJXPd9fvPReIpafA+JwgCbUC5BQ14Oer0EpEwqbwlpjdlKp+d6d2VO6oqRrpq82rA6HmnJJkLI7Bvny4dKDLZsr0JuDE5XdY7urmsTuj/hm8fzkBDmNaGLAlevR0EG89Q3lX6vDcLtAxE9kjYr0yoPkgZWy8iQYWry8ekT3g9rLYBBTbSiaC7BvYdoTf3aMz8ApVns+Pxqo3/8uLjHYea3uut9mVJRngDQq//vuLDWiSQWpmtUI0TZWmKwlfzY0A67OX1cvtSXwWQsz4G28CnXGSz3F0s5XlKe3jdsEw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S-Exchange-CrossTenant-AuthSource: HE1PR0801MB1931.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 08:57:47.2194 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /j4QEHw0gQ05qx0TfogPStXOEvSVhEqhgH5jDvFspgvnNnk2XDecbIobRC5Xk1zzKE2tbX899JVT+b+C/gIObwjDo8NT1AlRJFedq4oNQGE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8273 Received-SPF: pass client-ip=2a01:111:f400:fe16::713; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR02-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org |
Series |
parallels: Add full dirty bitmap support
|
expand
|
diff --git a/block/parallels.c b/block/parallels.c index d026ce9e2f..d5b333d5a4 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -1426,18 +1426,27 @@ fail: return ret; } +static int parallels_inactivate(BlockDriverState *bs) +{ + BDRVParallelsState *s = bs->opaque; + int ret; + + s->header->inuse = 0; + parallels_update_header(bs); + + /* errors are ignored, so we might as well pass exact=true */ + ret = bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, true, + PREALLOC_MODE_OFF, 0, NULL); + + return ret; +} static void parallels_close(BlockDriverState *bs) { BDRVParallelsState *s = bs->opaque; if ((bs->open_flags & BDRV_O_RDWR) && !(bs->open_flags & BDRV_O_INACTIVE)) { - s->header->inuse = 0; - parallels_update_header(bs); - - /* errors are ignored, so we might as well pass exact=true */ - bdrv_truncate(bs->file, s->data_end << BDRV_SECTOR_BITS, true, - PREALLOC_MODE_OFF, 0, NULL); + parallels_inactivate(bs); } parallels_free_used_bitmap(bs); @@ -1477,6 +1486,7 @@ static BlockDriver bdrv_parallels = { .bdrv_co_check = parallels_co_check, .bdrv_co_pdiscard = parallels_co_pdiscard, .bdrv_co_pwrite_zeroes = parallels_co_pwrite_zeroes, + .bdrv_inactivate = parallels_inactivate, }; static void bdrv_parallels_init(void)
We are going to add parallels image extensions storage and need a separate function for inactivation code. Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com> --- block/parallels.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)