From nobody Tue Nov 18 22:49:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613495857680637.965688414714; Tue, 16 Feb 2021 09:17:37 -0800 (PST) Received: from localhost ([::1]:40924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lC3yi-0008WB-6l for importer@patchew.org; Tue, 16 Feb 2021 12:17:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53032) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lC3U7-0006pz-B8; Tue, 16 Feb 2021 11:46:00 -0500 Received: from mail-eopbgr60108.outbound.protection.outlook.com ([40.107.6.108]:14830 helo=EUR04-DB3-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 1lC3U2-000776-Cw; Tue, 16 Feb 2021 11:45:59 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6359.eurprd08.prod.outlook.com (2603:10a6:20b:31a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Tue, 16 Feb 2021 16:45:41 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f1f0:6610:11f5:5e4a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f1f0:6610:11f5:5e4a%9]) with mapi id 15.20.3846.043; Tue, 16 Feb 2021 16:45:41 +0000 Received: from kvm.sw.ru (185.215.60.244) by AM3PR05CA0149.eurprd05.prod.outlook.com (2603:10a6:207:3::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Tue, 16 Feb 2021 16:45:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J+/D0CvtO03LGY6SGZGQjXtGa4oWBbsAWW2jIEobIc4LL8VMx1df7S7GQzEJMlaxw2sZklFK1gLwsSUoIS43WCK8oopWOWxTXMQhOIGGrPLP1l/jM/nI6RTkH1LegQxWp06EO+bHUUXz5mGnz3i1NO9nYSJU4w7imJIGaLHkdTiQgL6FRoHXzQ8cxYVAt15/MtVE1tmzwfkogK3ChHAikENZCuj7fZVvZ+xKP81Y8dxUMOu/zVkSPH41Yj3nxQ60T3XWMeKoGqKNLLQVYpuDBKa9qc87ivkFBUN24+MjE1CaugoZ/iwLMl9XjsnwLUUqy2KWOlAaa9K7wCJQFzHaYA== 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-SenderADCheck; bh=yoh9cTFRQJKuv4fY6dBmXCyRnsGPqk2Z9FlOp+DZ/lo=; b=K02ow2pUDRQ3g8IfvT2zR5A4YM6vszkwfvvYHENi2vSfw0hQgYS6Wp5jHIjb7CvxIkcIxv0FfOpvRB3PU4ZW6E0NUkdX3DGnJcvCh02xnn1MonPevIv1Wwv/RdtAyVxIPQu+qyeuQxUUHWXiYt5sxdMoVY7G4bn4c1zGMcTnnUfdUniviiuFQXUVMXs6WoMSXGMChWn0wFJQ8o6tV86XqoO4giYvSC+affqEHO+ZKIAqM1M3BA1kbk0MSiDnSVkvL89AbkvMgg10H7qGro4QjbQXDsPB6GOWHzVfrHBiDlMsIhGt2cqSWOrjIyHG5zbuq2nkCPhHBp9wfqFes5BxlA== 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=yoh9cTFRQJKuv4fY6dBmXCyRnsGPqk2Z9FlOp+DZ/lo=; b=vT0LjNB+v25cx+MAW27no2YuLaVfhjM/XoNK/9z6V+cOxQYDp3Krl0tMiE9nIG9QmWxqel71Qd4Ut6ehoBvOCaZWDFZ4HPz1balBErcCiNJh+NPVymamOZT28/4BmZGFpxg+DSpkt+iS/2ciYHfojm98MP7//6LoL4Yhq4IcBNg= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, den@openvz.org, stefanha@redhat.com, mreitz@redhat.com, kwolf@redhat.com, jsnow@redhat.com, vsementsov@virtuozzo.com, eblake@redhat.com Subject: [PATCH 1/5] qcow2-bitmap: make bytes_covered_by_bitmap_cluster() public Date: Tue, 16 Feb 2021 19:45:23 +0300 Message-Id: <20210216164527.37745-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210216164527.37745-1-vsementsov@virtuozzo.com> References: <20210216164527.37745-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.244] X-ClientProxiedBy: AM3PR05CA0149.eurprd05.prod.outlook.com (2603:10a6:207:3::27) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f925cecc-7229-4fcb-3de9-08d8d29a4b98 X-MS-TrafficTypeDiagnostic: AS8PR08MB6359: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:14; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xD9z0b1yuvFOEblNu9tFogsxq/Iu6T5W1WP5GcbvGJW2Wtuam6PndTmP+nywKg8y3nT4Xfuqe4sTXx4owKb1vbhEB+ogY0O3R6xI+FwxBcEgj6um6nlXqR2QzVcEijkUJKVjhLki/tn7KtzN+lhSKQV4ebjgT8EO+vUKVCM2xOx3JWJpU4PHL0FOOuob0LkqiWu2yIEX4R41V9jOnGVEV/w5/WLSP/meaj5mf4S9+ZcaiKK/VmC+W7TVwEf/HGIeEU++cf28r4Xa4f4liBIbzgoX1ci+F0w4pXg0GLWj6tWBQcWms+Oh+PWCgogax1xE+N15OM4/HkBpVtMak07atSe7mgt05Z6Gnv3eoNdUpAJIQgBZG/iGeKVDekaIkY746lvxOPX2Llf5qazUzAzNFNtPmp8ojqnRLfBOi1QKLGpX1tScfL4MzZVFqn1CFZiueAexT1xXq6kkmVrjh4EunHXVGvR0lrEc+Gv7dP9eoK1WJVT8UtBm24a0x9hDbVnshD5u6jmWFyNOM+pmYNbOow== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(366004)(136003)(346002)(39850400004)(396003)(8936002)(956004)(316002)(83380400001)(36756003)(26005)(8676002)(2616005)(5660300002)(1076003)(66946007)(66556008)(86362001)(52116002)(6512007)(186003)(2906002)(6486002)(6506007)(4326008)(16526019)(66476007)(6666004)(6916009)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?rXpdBJ0M5M41sjOV9ntmwz0Li8FVHnGWgG+16T/GReoxYyI0sBvy/+FzFa1v?= =?us-ascii?Q?8sJBmQqJBdrr0k7Op8Vw7L0BHZbjAsP3kd5dhKG56PPEkOSNfFCrS5rzi82V?= =?us-ascii?Q?VqSbv7JF/e1NQZsmFKeJJVKsd38yHpWjgN3VguYI9oAaIwjvR5U1yTdvgLFB?= =?us-ascii?Q?POVQxJcIenGzZQoCkiyAYcUh6n+wFJDown20VIirkWtea4vU8dxNNwPWTtvo?= =?us-ascii?Q?F3t6+/Vo6pnG/rTEm0iDssqgrfA7J2xAuskHpOnGPiR4JCH3cBI8ZcEv244N?= =?us-ascii?Q?ICzEtqy4vjBjqK57Y12e1jjstD5yWzIqE3dGzy5JmuuOznzQO792kr3Eez4r?= =?us-ascii?Q?QTqdFra1j76OlHBBI+NgWYxk3D41GbVl+q766s83CRACCQgmZuDLUpnfl9N8?= =?us-ascii?Q?IGFxbw96f5jItOubxFThzuXEswfT7o4zO44TSJ6eeiXXyVJ1F8yprUGHM7ow?= =?us-ascii?Q?LqOlS/kp79B1ul0fcWl/1dew8u3A3Nt0rMe2+ZuPFTXj/PVQCESUx73bDYaB?= =?us-ascii?Q?jOrvmPTymz19d7gkxnCxr6X7xi4b2BBXOKB4OHkYJp5mzhPIx8lzu7bbgxUV?= =?us-ascii?Q?2L0YeVNnvMbPu2sdgmjvU67B1jRuCDyQT5gmOpJZWs3kbqfUlr2J9+Chge7w?= =?us-ascii?Q?z9mJNAem2oYvVjEyCysLHrozuQjc1JwxDF4Hvg94LFYqlWubI0uDx/J+2qAX?= =?us-ascii?Q?AfDJ3aa01VC8MLrjBideCA9nJlSJrMLHJ1QuNt8FKWzkmtB4r5i+YkTIvxWZ?= =?us-ascii?Q?BC7AOa5rW6PE2JBVl0GKqNIc7gTAv3rfAgmaqFW4yrTY0ll58M3RQjQElqgv?= =?us-ascii?Q?lcB3Crcg+3ugvwWozPL4fM6M8ffBRo/y1WY/GRq0FbfuCGJUIYRHW/gRz663?= =?us-ascii?Q?iNdM7ecshFMi6NXF/C3U9Tia6LZNF7lPKbcGr7bFXT8QeZkIZzGm+2Q+z1js?= =?us-ascii?Q?8igqmSQTBiPQ2ylnL5P2f/ScjEha++N5gNHPj3nZhTb+dNY25dW26bvxxaMv?= =?us-ascii?Q?SJupBICaQ+lCHZ0V1GT9lsEU8GFzoXfQYli1WfaU1qzIkJaKVsOED7Xw8lmP?= =?us-ascii?Q?MVB6BV3rrvyJH3PzmUUEvovdsNFmSvPYVg1U07pJSLiHgfChhLkhBcXbrY43?= =?us-ascii?Q?vKigqkLJUSCtQuxwe3DEFE5HgpyjAeNjrRQV8fo1y2os47L91Cic+m1rNsSr?= =?us-ascii?Q?RStV05IK09sUoZYDgc4wXpR0oEutkAIrsETldkcOOsP/tldeeY+P7ifMr1D5?= =?us-ascii?Q?kxI65E89inEncS/5NEDMaLzj684hVIc5ev43AWB8PxkUir6rbfpDmsf0INhg?= =?us-ascii?Q?fjDq5hZtb7jhOTVhVGPqSl4o?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f925cecc-7229-4fcb-3de9-08d8d29a4b98 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2021 16:45:40.9881 (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: Xc3zc7Oe5c0o4QAK9COIRz7ziCBDz4gJCXifwZXXDqX3Q5MRAdfRL+LGehoWIIi1Uzrctiw7GcPY7/KQBHjjSZvD/jIQ73i/380Lmi2pDxw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6359 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.6.108; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" Rename bytes_covered_by_bitmap_cluster() to bdrv_dirty_bitmap_serialization_coverage() and make it public. It is needed as we are going to make load_bitmap_data() public in the next commit. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Denis V. Lunev Reviewed-by: Eric Blake --- include/block/dirty-bitmap.h | 2 ++ block/dirty-bitmap.c | 13 +++++++++++++ block/qcow2-bitmap.c | 16 ++-------------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h index 36e8da4fc2..f581cf9fd7 100644 --- a/include/block/dirty-bitmap.h +++ b/include/block/dirty-bitmap.h @@ -57,6 +57,8 @@ void bdrv_dirty_iter_free(BdrvDirtyBitmapIter *iter); uint64_t bdrv_dirty_bitmap_serialization_size(const BdrvDirtyBitmap *bitma= p, uint64_t offset, uint64_t by= tes); uint64_t bdrv_dirty_bitmap_serialization_align(const BdrvDirtyBitmap *bitm= ap); +uint64_t bdrv_dirty_bitmap_serialization_coverage(int serialized_chunk_siz= e, + const BdrvDirtyBitmap *bitmap); void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap *bitmap, uint8_t *buf, uint64_t offset, uint64_t bytes); diff --git a/block/dirty-bitmap.c b/block/dirty-bitmap.c index 9b9cd71238..a0eaa28785 100644 --- a/block/dirty-bitmap.c +++ b/block/dirty-bitmap.c @@ -726,6 +726,19 @@ uint64_t bdrv_dirty_bitmap_serialization_align(const B= drvDirtyBitmap *bitmap) return hbitmap_serialization_align(bitmap->bitmap); } =20 +/* Return the disk size covered by a chunk of serialized bitmap data. */ +uint64_t bdrv_dirty_bitmap_serialization_coverage(int serialized_chunk_siz= e, + const BdrvDirtyBitmap *b= itmap) +{ + uint64_t granularity =3D bdrv_dirty_bitmap_granularity(bitmap); + uint64_t limit =3D granularity * (serialized_chunk_size << 3); + + assert(QEMU_IS_ALIGNED(limit, + bdrv_dirty_bitmap_serialization_align(bitmap))); + return limit; +} + + void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap *bitmap, uint8_t *buf, uint64_t offset, uint64_t bytes) diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c index 5eef82fa55..42d81c44cd 100644 --- a/block/qcow2-bitmap.c +++ b/block/qcow2-bitmap.c @@ -278,18 +278,6 @@ static int free_bitmap_clusters(BlockDriverState *bs, = Qcow2BitmapTable *tb) return 0; } =20 -/* Return the disk size covered by a single qcow2 cluster of bitmap data. = */ -static uint64_t bytes_covered_by_bitmap_cluster(const BDRVQcow2State *s, - const BdrvDirtyBitmap *bit= map) -{ - uint64_t granularity =3D bdrv_dirty_bitmap_granularity(bitmap); - uint64_t limit =3D granularity * (s->cluster_size << 3); - - assert(QEMU_IS_ALIGNED(limit, - bdrv_dirty_bitmap_serialization_align(bitmap))); - return limit; -} - /* load_bitmap_data * @bitmap_table entries must satisfy specification constraints. * @bitmap must be cleared */ @@ -312,7 +300,7 @@ static int load_bitmap_data(BlockDriverState *bs, } =20 buf =3D g_malloc(s->cluster_size); - limit =3D bytes_covered_by_bitmap_cluster(s, bitmap); + limit =3D bdrv_dirty_bitmap_serialization_coverage(s->cluster_size, bi= tmap); for (i =3D 0, offset =3D 0; i < tab_size; ++i, offset +=3D limit) { uint64_t count =3D MIN(bm_size - offset, limit); uint64_t entry =3D bitmap_table[i]; @@ -1303,7 +1291,7 @@ static uint64_t *store_bitmap_data(BlockDriverState *= bs, } =20 buf =3D g_malloc(s->cluster_size); - limit =3D bytes_covered_by_bitmap_cluster(s, bitmap); + limit =3D bdrv_dirty_bitmap_serialization_coverage(s->cluster_size, bi= tmap); assert(DIV_ROUND_UP(bm_size, limit) =3D=3D tb_size); =20 offset =3D 0; --=20 2.29.2 From nobody Tue Nov 18 22:49:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1613494994; cv=pass; d=zohomail.com; s=zohoarc; b=nWu8BocxmgFY5mTc8uUbVnB6r0wnOZWlv29/wUhbcQ66Em4X+s4h+k3+xDuUZPGax8PBXnVjNgAnUDbCEaAEzlfoXYOUB1d/F3Q9v3LMRBblyv5SKvKeerVTcOoMKeBwjUOT7HK3ija4zZr1LBfPZjPHgLINDNp/SrL8Ww7czT8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613494994; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=n4UEnUbYTFoBKaZc+b+I+KyHCL+5hsseuOD2oqDnG7U=; b=chr94dcTRXvMTYP4NHw5F1K1xcq022wHlFbMe5CwwS/GaXmKCtFBrNk2zodGotXVsbVHnGCui0chOGMzdw2gVdaAe1ufGKKfKY5nvx7NVy7PJdJRuBs8vxGCu3C+QS+b76jacfQZMIgmpzwpXA6iB+lM+W3zoeSWgcW9Fjw5270= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613494992895124.50934039397589; Tue, 16 Feb 2021 09:03:12 -0800 (PST) Received: from localhost ([::1]:59490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lC3kl-0008Bb-JU for importer@patchew.org; Tue, 16 Feb 2021 12:03:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lC3UK-0006vk-UA; Tue, 16 Feb 2021 11:46:12 -0500 Received: from mail-eopbgr60108.outbound.protection.outlook.com ([40.107.6.108]:14830 helo=EUR04-DB3-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 1lC3U8-000776-Mu; Tue, 16 Feb 2021 11:46:12 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6359.eurprd08.prod.outlook.com (2603:10a6:20b:31a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Tue, 16 Feb 2021 16:45:42 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f1f0:6610:11f5:5e4a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f1f0:6610:11f5:5e4a%9]) with mapi id 15.20.3846.043; Tue, 16 Feb 2021 16:45:42 +0000 Received: from kvm.sw.ru (185.215.60.244) by AM3PR05CA0149.eurprd05.prod.outlook.com (2603:10a6:207:3::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Tue, 16 Feb 2021 16:45:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hzZr+rv0wEdiNFeIJylESztAC5oaH5H/SLzn+cuYEUkBNbSDsVwu/L/AgSJ/Z+c0lBUY/zXhzJx3n+bVadDraV6GlijGhQarNWLeNU5dWBRcgRqdsn6WolrzCXjWcNtHE1nAo74kpXTfOc6hobyFuRqi0M9AiS9/avijALh7c0b/mmx9McWqIIfeNgQ7Xhx63rZ895XqQMdd1sosX1DSTfTwfb6Ed0G0merGdFsCjZqu3JcKd20AHj53HEHPBrYcF0OxfLLWPNFYX0S9YFQsNg/7cymbehVBQpaSgmLP3PZud/Zb9/m/yHRBJDG9SMp8NyNrsFMCoKG2e1bf2aAlEQ== 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-SenderADCheck; bh=n4UEnUbYTFoBKaZc+b+I+KyHCL+5hsseuOD2oqDnG7U=; b=EJbqfWjDG+3y84IQxMnCaGOlhx3f0UD5cCui9R/JqeORVIpHQ0Q9Uu/8Et+yeOvFhttfUajoCPbenCD1I5lRxx3spTA6hHFzbbJG7ksKz61F9x5w2WOgVOZDuijLaMLgonTlvVzyiDE2ScEtKewttPmsCZrRm+g0R88/9XgQ+qAMoUIy75PijpP8GE74aJmior2G3Pp0eoqWNHAhOnG3sfk/VuJOF1kS2hnctA9UwrzWXnmCXW/HMgucl+16U75IhbzldXZNVTyvSlCBDAGgUWMC7ag3GW5tnvt3YypuX/wYPEUaaxsTCdlf33DvHLHzgsf/gaeuILlFVM9iuErk3w== 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=n4UEnUbYTFoBKaZc+b+I+KyHCL+5hsseuOD2oqDnG7U=; b=YTxvq1Ib+0+4jVsbVmPAhu//lwLko89cFXZwCyNMAw+StIsQeKIiRWgtj3PKuVMpsBFUwmzJ3sKReEg2b9nKnYQGxWqTDICv1P9AeoekTG4/q+BZtRluZLYCBhZpAAewRiupDTpSZNkJpN8Bu7hGI9dLpnk3urahXsBZGqHtzq0= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, den@openvz.org, stefanha@redhat.com, mreitz@redhat.com, kwolf@redhat.com, jsnow@redhat.com, vsementsov@virtuozzo.com, eblake@redhat.com Subject: [PATCH 2/5] parallels.txt: fix bitmap L1 table description Date: Tue, 16 Feb 2021 19:45:24 +0300 Message-Id: <20210216164527.37745-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210216164527.37745-1-vsementsov@virtuozzo.com> References: <20210216164527.37745-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.244] X-ClientProxiedBy: AM3PR05CA0149.eurprd05.prod.outlook.com (2603:10a6:207:3::27) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f0a6780f-dc9f-4bce-9e5a-08d8d29a4c30 X-MS-TrafficTypeDiagnostic: AS8PR08MB6359: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P1rJ4Y8o6AL7kmw5eX0Wuj5dsy1aMWyuNmps5znPVih0rOO4JCtfY84eO05Q10Jbg7ZmP8qkwKLviyiV3x9LPbpJw3IYSIyUdBFrC8A5JExVtRm8upqAtgY9KyRaa0mex1o2ARgGzHtW35rdHy2MVr4CpwWaAUOEPRXFk/LZSarMWjVN1bK9mDad2+PAOpaAoB/vB6agBJT+KXWGGefbpW9yDHQocRvK+UmEsCawSUNOoVcooRh69wgAnNwrkb0x9NR1xGSVV68EcUOXjTkqA3l7Bk/EO7Pbp2cMFyojQLI+WC+wcRE4WALuEWv1yGSqhF1Km/kp/ntMEWZx99WfgdbYtXU85LAsDHtzI0FUZQ2X3ArTDaZe8k+eIZerno6/cuXCqOB6B96kQSklwIcGUk/BWzC58hxcNkCWZtV7cms0wTrrPyG5e0nmJ5y/Z9r2EU6twoWWddcU80+For2n8XjKwPrfKNipdfg3mTgpd+SYHZuuwxo8w5i9XROkSNteRlvZuL4IsFDD92KBopxcKQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(366004)(136003)(346002)(39850400004)(396003)(8936002)(956004)(316002)(83380400001)(36756003)(26005)(8676002)(2616005)(5660300002)(1076003)(66946007)(66556008)(86362001)(52116002)(6512007)(186003)(2906002)(6486002)(6506007)(4326008)(16526019)(66476007)(6666004)(6916009)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?h08EGRaffNpXnW3veb3MjnBNTdPds39vBzcLa6kCQiWYOk7asleQ01p5y9y9?= =?us-ascii?Q?hPgXTrlX6qZPuCQUJJWK4g0FtJLGAF6o8mN4SLHLmBV6t1UEpcXLkzxMmmvM?= =?us-ascii?Q?Rf06AEsE0DmnDMoNJNCZUsKicdUUULqkJcjyOki4xsbcVuRb0EiD13Rc/4Se?= =?us-ascii?Q?nBjMJkHvx1nubXwKXAGzhkeznfrkaT+ST3vkmjc4LkmH11LcgQwsneBvsuJJ?= =?us-ascii?Q?16+NuK1WgCGmd37sosS0Ls0VMu7zf5LRt2sYDkR22ogTFdpyt7nElEgqs+Yb?= =?us-ascii?Q?DQabAyx3sDpkf+j/laJrE+vvCKwWpmZ1qw1AT/aMJOF4ga9JkG9g/T4KWDWv?= =?us-ascii?Q?ChPVe9wWeVrWpO6mD50Wwar08ehgUUWvdGv9LAkDphrgztLUW9+m0R3neLjM?= =?us-ascii?Q?4PyBHNl0uWQt84uzr/Bc7xFs3+kizys9vBV5r0OwJu7GcISyFcvW909HIfIz?= =?us-ascii?Q?XdU5nFrB1q6jH+uGddQn3sHcMgsdgGrjfUhjuNWJnfH9NGKIMD3s48WyV/V6?= =?us-ascii?Q?MKO7iTCANSFOkUs0tf7t8tBmNWonO2odJx4I2Pckgz2JbTn6x4e5Ky8AjDA+?= =?us-ascii?Q?UnXHkXybTh1MP2qdVGhdmdccJbK3XCgIWtD1jXITbSE+DnrfqdWrjyMzaZnx?= =?us-ascii?Q?uwlmmKbof9VPY1GITwoBSgyKuAeu5hWt67G4qWBNBncxFNeaMS2dveL/34z3?= =?us-ascii?Q?ej6DFRMFhN66oY4qIGLGT5RPfshLoDmKnfQB3LYMZUPAaXTp6h7ghyd4of6Z?= =?us-ascii?Q?xDD1JjKeaysA8ZFn2lepDx/LZR4SZLvZ3xQTqzBmYib771n+t2wDsVfmhogq?= =?us-ascii?Q?h3ObfZH1uZmRMF9SarWH6uYWUEv4g6hFuOnbcF7ztnXeWBGcEQP0Otspe0KK?= =?us-ascii?Q?MGO8OV9x7AkWpunQhALIypvGOuPxf43B2HwMDklfVKFddzd0kLt1Na4Sj3M5?= =?us-ascii?Q?pNuy+NMCm5T0K97cRHVzH60oZbKxL8POOxWmVd0Rc46V9iBSKqd5O/1sFvM/?= =?us-ascii?Q?t+yKywqMnP/MImlXgQb6rx8ZsKIW/+p25LUK7trpdmfR30t8h+fFqkOJJEpN?= =?us-ascii?Q?ZzJFK3PSYWXYwG+F/QNpw6Ej+dOywTwPtUHq31EVmVVjDe0xEEbFYmuQ2myF?= =?us-ascii?Q?eAVq6OhZWYMLVXBOtzr/weTxNcLPrZmyrocxhztKwtgrf3TCUr5ERTE8GJvR?= =?us-ascii?Q?R1Ct7OeNjcUbkEfWfYlKJhWOtXzu0r2jRvn7wYoSK5S9+Gum4CJftZwfY8dG?= =?us-ascii?Q?NdOQpCHv0S3EU0p5on0oMITYIxW96x9z3re/trBHDEWt8dBlYrNj/3XiRVPD?= =?us-ascii?Q?uoIowLT540u4Z7N8yM6WQhbm?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0a6780f-dc9f-4bce-9e5a-08d8d29a4c30 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2021 16:45:41.9967 (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: wfLahewbp1wzAiTrUJZeCyulKL6qx3Mo9jt7qS4tzQiKzyVMt+OGGjzeZlynI3uiZNo6TxBTA4HOlLRqcr7PGLwuyAUDAUjXQu1p/kP1RIo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6359 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.6.108; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" Actually L1 table entry offset is in 512 bytes sectors. Fix the spec. Signed-off-by: Vladimir Sementsov-Ogievskiy --- docs/interop/parallels.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/interop/parallels.txt b/docs/interop/parallels.txt index f15bf35bd1..ebbdd1b25b 100644 --- a/docs/interop/parallels.txt +++ b/docs/interop/parallels.txt @@ -209,15 +209,14 @@ of its data area are: The number of entries in the L1 table of the bitmap. =20 variable: l1_table (8 * l1_size bytes) - L1 offset table (in bytes) =20 A dirty bitmap is stored using a one-level structure for the mapping to ho= st -clusters - an L1 table. +clusters - an L1 table. Each L1 table entry is a 64bit integer described +below: =20 -Given an offset in bytes into the bitmap data, the offset in bytes into the -image file can be obtained as follows: +Given an offset in bytes into the bitmap data, corresponding L1 entry is =20 - offset =3D l1_table[offset / cluster_size] + (offset % cluster_size) + l1_table[offset / cluster_size] =20 If an L1 table entry is 0, the corresponding cluster of the bitmap is assu= med to be zero. @@ -225,4 +224,8 @@ to be zero. If an L1 table entry is 1, the corresponding cluster of the bitmap is assu= med to have all bits set. =20 -If an L1 table entry is not 0 or 1, it allocates a cluster from the data a= rea. +If an L1 table entry is not 0 or 1, it contains corresponding cluster offs= et +(in 512b sectors). Given an offset in bytes into the bitmap data the offse= t in +bytes into the image file can be obtained as follows: + + offset =3D l1_table[offset / cluster_size] * 512 + (offset % cluster_s= ize) --=20 2.29.2 From nobody Tue Nov 18 22:49:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1613495313; cv=pass; d=zohomail.com; s=zohoarc; b=WDd58FgPN+uu1ZmyG4OA2142POcbB+1IhIiWdq3W4Gp+O1bY04eQXboHZfncSEKzUZ1WL/aJGJbztKXcx5oKf2OnPxal71VpMPE7fh1hTiL5oHnUAifDZkTy+IdCnZHIIlDv7tXRvm4tHDCapPvX6drqmUdVtN8twKX/vqfiW8g= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613495313; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LuGU6TuagRtKV0lcjZFGdemn7Z7JhbICM9umZ7iyLok=; b=PvcbBQYYFbubLTYwIdtMlQx3juAl5NQUficry8qp8xtxOo21ERy61zlg9j8j7rKA2qTGz4NnrefduE51aJUWcN5hZgovbPnWQagnHEU6wrW5FlTL7/lNHVWBE8nAJi9M0p7X0DK6yPxZ5El66E5SPnYgZHu5yqAkbDmgy7K7Gmw= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613495312704217.56957663292667; Tue, 16 Feb 2021 09:08:32 -0800 (PST) Received: from localhost ([::1]:42922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lC3pu-000595-27 for importer@patchew.org; Tue, 16 Feb 2021 12:08:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53346) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lC3UX-0007E2-Bg; Tue, 16 Feb 2021 11:46:25 -0500 Received: from mail-eopbgr60108.outbound.protection.outlook.com ([40.107.6.108]:14830 helo=EUR04-DB3-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 1lC3UM-000776-O2; Tue, 16 Feb 2021 11:46:25 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6359.eurprd08.prod.outlook.com (2603:10a6:20b:31a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Tue, 16 Feb 2021 16:45:43 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f1f0:6610:11f5:5e4a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f1f0:6610:11f5:5e4a%9]) with mapi id 15.20.3846.043; Tue, 16 Feb 2021 16:45:42 +0000 Received: from kvm.sw.ru (185.215.60.244) by AM3PR05CA0149.eurprd05.prod.outlook.com (2603:10a6:207:3::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Tue, 16 Feb 2021 16:45:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EB+eu3PXBCJNNzAZe+Y2xKcDAdVABIOcCUsfHQqEmWRsGOsPAVV8uWPVaJtgjYtR/w6CYAG3UM201at7bmN6GnojsZeDGeEWIrf3NoYqUwvi763SmA2cVO3oCnZgb/8I15dtPwW2sFRCzhWVzgh7Dpq0VXiJSZlTw6Lvfdx8v8R2/d05aguYSPOdIKecn3hRy4qrjLBBRYjbrgp7jBhvSA47LyPautnncpw6Q2W48wnp/d82bkEs4IH5BxFAJHLALX7H/UOejlqSNV+OsFAvcmR7eRUb46kMFssLu4QE37Du8Hv3WeFMZMTjfZKJ8eS4aO+htG7nGdmO/PKZWLEUjA== 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-SenderADCheck; bh=LuGU6TuagRtKV0lcjZFGdemn7Z7JhbICM9umZ7iyLok=; b=UCguwIjC00pWLeJjGZgAh8pyI3jCjEoQdzvbena+GoQzOpR+RJG0PT4Hn2JhJEzpTbKX25XhiIF76DKxOhKy4soKzwpa/3aaGzTUmb5DWaxgRAN/p6vgt9Tx/mSxqDX2vxkHMpFA4oAohV0wDAqLaCxaqXbBV3MMa9rcUeArSZ6a5npEosUwr4FTtRnTZNP4oRlho19vglqkMBbHiezf8xN0XSvLRIP4P4+pM28vHog1japMIlL9jKdZeyYlTdIrtsf4c06OPBoDVytfVUGQp8Z2Odmf1UN5CLuJQ75aAE5cbVlpzhrombWTQYZmOOP9c1u0K/HeVAxKKPJxDN3xJA== 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=LuGU6TuagRtKV0lcjZFGdemn7Z7JhbICM9umZ7iyLok=; b=bIdX3Uoey/OW5Xk/b5J+J/aM2eEHeQy899nB10oHLhd7fUbtQQd4dCFna9Sl7tdB7314Xi9F8MvXf2wiyE+iJXlHXX8Yz7m1NExGFhh8IYdnsasXmNqH9LdWPbY1kn8Kcg4jg6nvI5wFVYbERqQ/kg5le6Z9I1Z4tGBmVX8sldQ= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, den@openvz.org, stefanha@redhat.com, mreitz@redhat.com, kwolf@redhat.com, jsnow@redhat.com, vsementsov@virtuozzo.com, eblake@redhat.com Subject: [PATCH 3/5] parallels: support bitmap extension for read-only mode Date: Tue, 16 Feb 2021 19:45:25 +0300 Message-Id: <20210216164527.37745-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210216164527.37745-1-vsementsov@virtuozzo.com> References: <20210216164527.37745-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.244] X-ClientProxiedBy: AM3PR05CA0149.eurprd05.prod.outlook.com (2603:10a6:207:3::27) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81a66dd8-d2f7-4fda-bd71-08d8d29a4cb8 X-MS-TrafficTypeDiagnostic: AS8PR08MB6359: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:293; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JJKDjCZzbW+ORfypPjr52zWbZLz5aDhP4nXbtjegDDSvR9mm3H2DjB/ZZL2xtUHN59c7YYqQKXDWzPJk+uYEgOUZsJv5pjvxR6WDGpPQp+DzumDDKpqmprwhszCr8L9il9mnINcoNn0VWBSBKQekUEtmxSa0lsMVDANo1Q7XrHwq9N4qFcJqAQC6NWAcpehGl8wnwHgR0r19KhlRTUgnDhJu4XItD7fkZAsvhRp/4Md/FtUQspDHxeDD0qKZnHaBkj8NyJdbgWaXA8VrMxnp8isIX9FLdW/Y1fjkWCV0YnV6itqezIWc6oRw6O1EoU5mLaODsFIL9kZQPDfEEYIu4vd1xPivUwcHOg4ogxZvk5miRPXtzMvunsjyuv5uVnzKkPuF0yt65mHPnGKAe2Zs8NkhmhvVHB+pAw2KdQFwz8tgbliSUjqLwXIKkbvZscz5ZxkVd34P5tkbdizRnhhhMMofhCupHA+AqfkL4NBzGCAtXKr75eVRgCF9d/XIx2mEgFgNDoUFMnOU/jI5E5gKbw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(366004)(136003)(346002)(39850400004)(396003)(8936002)(956004)(316002)(83380400001)(36756003)(26005)(30864003)(8676002)(2616005)(5660300002)(1076003)(66946007)(66556008)(86362001)(52116002)(6512007)(186003)(2906002)(6486002)(6506007)(4326008)(16526019)(66476007)(6666004)(6916009)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?gFd4a7H/MsmzdDQql86duo4zt1mfxhh6EC6MtboY+nTUGwJmq03X2ScNO5qQ?= =?us-ascii?Q?Ix0Gs+J6pnqrfZYrnDz/YxiEN8BsSxCRTrnWFrGS4dUDpgo8QxzNAi+AxccC?= =?us-ascii?Q?KeWsPq8gNiDvz7cE7z6I3kWYk3Jc1cz1Rmro8jyfWQH4LX+5Eo4m/KvguKQU?= =?us-ascii?Q?xiGMRR1BrXz6DG9ZVJrC/4b36oSOXDdsYQoI5mcYB4dozIdCmGsCDRdnHqWy?= =?us-ascii?Q?TEo0Kte1pIcZhsW57m8l/lkJAvqkr4GfamtrR7BhGrLhgY++4Z44cuT8ra0R?= =?us-ascii?Q?uOvtqLnh0gk3h8ZgVlMSQTKysWHGXwtY8eq/mUIsQtuNMtkxSxygF0gPUUie?= =?us-ascii?Q?mknYKNZqqc72wFWUvR2T3fzIGtDapW1q6wkgfZYUQREnP5V+oY+tim1cvvIU?= =?us-ascii?Q?jly8XIkqszAI6eu7PjkMR+SWmE9ru+pUVZTgCovdHEYgdYny2SCrRanQSmhk?= =?us-ascii?Q?NfNzX0AphPDNcf1tcc+CXvig6D5DSDxlRiR+nBVMSPIsuJkiSFbAEJl3AIEa?= =?us-ascii?Q?PPumsAg8pwHCSylhrmvkyzBpyILNSQ8XGppaf9d3oN5BFRxW44w1VMSqjbT1?= =?us-ascii?Q?b+XGK5BLe7hDNtlWfHhlWBSXJUd0snLp2rOIBLA5xnCxNlVmhMz+QNr5mld8?= =?us-ascii?Q?jABls7gsnB/TiIh3IMt5W1YF3welxdVP55wDQfgDO7pahTyz6fi+vwC6K+jy?= =?us-ascii?Q?1CdMLm36l7UpWJHmZOdJd5gpfCgoKeCyxXzkQdb/vgbpZdSvVI99I3fLwkuD?= =?us-ascii?Q?5NPGeWITpCPCF4hGb1I6PDplL8TWvz2+EkdlTg9aKD9aHDmuIzSl/QC+h9pU?= =?us-ascii?Q?y+drgDJSw49QSmZb2TlgPEeH4TT//jpuiSee7DBATT9YDb6MY6rv0lw4MH3v?= =?us-ascii?Q?dO4gKNjI5H7O3WXKO58hTRvB90nREVnzQJWcNJR5d+HYtHTiIfuRID21NI7T?= =?us-ascii?Q?ZeR8rFmaKNQKBGs0BGbsekbAOd1HNMbi3TMzSXzK19TXXH2Pb4sNKX7GHp6O?= =?us-ascii?Q?8AwoI/N3c2ON2vo9JEXiNg/JSEiXTuIYB91Btrnz51StE7kcstyMfqdqosn6?= =?us-ascii?Q?oV0Ugl15Ctrl3JBmWlik5avRhLwcvxu6vTK49AsPZtnwIaDW47EPhQmsJidz?= =?us-ascii?Q?1yy6LvD5ksdQ4SbA/X4Sxgfbvo2Ys3Sgg599xfon1yWdbzi+Ovjxstnb0DFS?= =?us-ascii?Q?nP/Piv+E83S+6MeJjT4uYrhVY6eS6xC/DSBd1/7E3rRKTCE17x3jrutlLqd2?= =?us-ascii?Q?x014LA883dANn4/kCssNag2klvdFCOXdfahlbCgvZiMPHJjK5PI2qZ1ERLMH?= =?us-ascii?Q?U7vlQrQOrCz+Uv6H4ylDE/Cs?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81a66dd8-d2f7-4fda-bd71-08d8d29a4cb8 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2021 16:45:42.8848 (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: YGh4yaNNze3hq/J0hjLXNkMQZW92E0fcZg4bExiwVKq/aUWP4b90HcasNNVpc8KtQVx0izM7J5y3pU6VnL0UPHdKUTndwV8591zI88YAwLk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6359 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.6.108; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy --- block/parallels.h | 6 +- block/parallels-ext.c | 286 ++++++++++++++++++++++++++++++++++++++++++ block/parallels.c | 18 +++ block/meson.build | 3 +- 4 files changed, 311 insertions(+), 2 deletions(-) create mode 100644 block/parallels-ext.c diff --git a/block/parallels.h b/block/parallels.h index 5aa101cfc8..2dbb7668a3 100644 --- a/block/parallels.h +++ b/block/parallels.h @@ -48,7 +48,8 @@ typedef struct ParallelsHeader { uint64_t nb_sectors; uint32_t inuse; uint32_t data_off; - char padding[12]; + uint32_t flags; + uint64_t ext_off; } QEMU_PACKED ParallelsHeader; =20 typedef enum ParallelsPreallocMode { @@ -84,4 +85,7 @@ typedef struct BDRVParallelsState { Error *migration_blocker; } BDRVParallelsState; =20 +int parallels_read_format_extension(BlockDriverState *bs, + int64_t ext_off, Error **errp); + #endif diff --git a/block/parallels-ext.c b/block/parallels-ext.c new file mode 100644 index 0000000000..b825b55124 --- /dev/null +++ b/block/parallels-ext.c @@ -0,0 +1,286 @@ +/* + * Support for Parallels Format Extansion. It's a part of parallels format + * driver. + * + * Copyright (c) 2021 Virtuozzo International GmbH + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "block/block_int.h" +#include "parallels.h" +#include "crypto/hash.h" +#include "qemu/uuid.h" + +#define PARALLELS_FORMAT_EXTENSION_MAGIC 0xAB234CEF23DCEA87ULL + +#define PARALLELS_END_OF_FEATURES_MAGIC 0x0ULL +#define PARALLELS_DIRTY_BITMAP_FEATURE_MAGIC 0x20385FAE252CB34AULL + +typedef struct ParallelsFormatExtensionHeader { + uint64_t magic; /* PARALLELS_FORMAT_EXTENSION_MAGIC */ + uint8_t check_sum[16]; +} QEMU_PACKED ParallelsFormatExtensionHeader; + +typedef struct ParallelsFeatureHeader { + uint64_t magic; + uint64_t flags; + uint32_t data_size; + uint32_t _unused; +} QEMU_PACKED ParallelsFeatureHeader; + +typedef struct ParallelsDirtyBitmapFeature { + uint64_t size; + uint8_t id[16]; + uint32_t granularity; + uint32_t l1_size; + /* L1 table follows */ +} QEMU_PACKED ParallelsDirtyBitmapFeature; + +/* Given L1 table read bitmap data from the image and populate @bitmap */ +static int parallels_load_bitmap_data(BlockDriverState *bs, + const uint64_t *l1_table, + uint32_t l1_size, + BdrvDirtyBitmap *bitmap, + Error **errp) +{ + BDRVParallelsState *s =3D bs->opaque; + int ret =3D 0; + uint64_t offset, limit; + int cluster_size =3D s->tracks << BDRV_SECTOR_BITS; + uint64_t bm_size =3D bdrv_dirty_bitmap_size(bitmap); + uint8_t *buf =3D NULL; + uint64_t i, tab_size =3D + DIV_ROUND_UP(bdrv_dirty_bitmap_serialization_size(bitmap, 0, bm_si= ze), + cluster_size); + + if (tab_size !=3D l1_size) { + error_setg(errp, "Bitmap table size %" PRIu32 " does not correspon= d " + "to bitmap size and cluster size. Expected %" PRIu64, + l1_size, tab_size); + return -EINVAL; + } + + buf =3D qemu_blockalign(bs, cluster_size); + limit =3D bdrv_dirty_bitmap_serialization_coverage(cluster_size, bitma= p); + for (i =3D 0, offset =3D 0; i < tab_size; ++i, offset +=3D limit) { + uint64_t count =3D MIN(bm_size - offset, limit); + uint64_t entry =3D l1_table[i]; + + if (entry =3D=3D 0) { + /* No need to deserialize zeros because @bitmap is cleared. */ + continue; + } + + if (entry =3D=3D 1) { + bdrv_dirty_bitmap_deserialize_ones(bitmap, offset, count, fals= e); + } else { + ret =3D bdrv_pread(bs->file, entry << BDRV_SECTOR_BITS, buf, + cluster_size); + if (ret < 0) { + error_setg_errno(errp, -ret, + "Failed to read bitmap data cluster"); + goto finish; + } + bdrv_dirty_bitmap_deserialize_part(bitmap, buf, offset, count, + false); + } + } + ret =3D 0; + + bdrv_dirty_bitmap_deserialize_finish(bitmap); + +finish: + qemu_vfree(buf); + + return ret; +} + +/* + * @data buffer (of @data_size size) is the Dirty bitmaps feature which + * consists of ParallelsDirtyBitmapFeature followed by L1 table. + */ +static BdrvDirtyBitmap *parallels_load_bitmap(BlockDriverState *bs, + uint8_t *data, + size_t data_size, + Error **errp) +{ + int ret; + ParallelsDirtyBitmapFeature bf; + g_autofree uint64_t *l1_table =3D NULL; + BdrvDirtyBitmap *bitmap; + QemuUUID uuid; + char uuidstr[UUID_FMT_LEN + 1]; + + memcpy(&bf, data, sizeof(bf)); + bf.size =3D le64_to_cpu(bf.size); + bf.granularity =3D le32_to_cpu(bf.granularity) << BDRV_SECTOR_BITS; + bf.l1_size =3D le32_to_cpu(bf.l1_size); + data +=3D sizeof(bf); + data_size -=3D sizeof(bf); + + if (bf.size !=3D bs->total_sectors) { + error_setg(errp, "Bitmap size (in sectors) %" PRId64 " differs fro= m " + "disk size in sectors %" PRId64, bf.size, bs->total_sec= tors); + return NULL; + } + + if (bf.l1_size * sizeof(uint64_t) > data_size) { + error_setg(errp, "Bitmaps feature corrupted: l1 table exceeds " + "extension data_size"); + return NULL; + } + + memcpy(&uuid, bf.id, sizeof(uuid)); + qemu_uuid_unparse(&uuid, uuidstr); + bitmap =3D bdrv_create_dirty_bitmap(bs, bf.granularity, uuidstr, errp); + if (!bitmap) { + return NULL; + } + + l1_table =3D g_memdup(data, bf.l1_size * sizeof(uint64_t)); + + ret =3D parallels_load_bitmap_data(bs, l1_table, bf.l1_size, bitmap, e= rrp); + if (ret < 0) { + bdrv_release_dirty_bitmap(bitmap); + 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; +} + +static int parallels_parse_format_extension(BlockDriverState *bs, + uint8_t *ext_cluster, Error **= errp) +{ + BDRVParallelsState *s =3D bs->opaque; + int ret; + int remaining =3D s->tracks << BDRV_SECTOR_BITS; /* one cluster */ + uint8_t *pos =3D ext_cluster; + ParallelsFormatExtensionHeader eh; + g_autofree uint8_t *hash =3D NULL; + size_t hash_len =3D 0; + BdrvDirtyBitmap *bitmap =3D NULL; + + memcpy(&eh, pos, sizeof(eh)); + eh.magic =3D le64_to_cpu(eh.magic); + pos +=3D sizeof(eh); + remaining -=3D sizeof(eh); + + if (eh.magic !=3D PARALLELS_FORMAT_EXTENSION_MAGIC) { + error_setg(errp, "Wrong parallels Format Extension magic: 0x%" PRI= x64 + ", expected: 0x%llx", eh.magic, + PARALLELS_FORMAT_EXTENSION_MAGIC); + goto fail; + } + + ret =3D qcrypto_hash_bytes(QCRYPTO_HASH_ALG_MD5, (char *)pos, remainin= g, + &hash, &hash_len, errp); + if (ret < 0) { + goto fail; + } + + if (hash_len !=3D sizeof(eh.check_sum) || + memcmp(hash, eh.check_sum, sizeof(eh.check_sum)) !=3D 0) { + error_setg(errp, "Wrong checksum in Format Extension header. Forma= t " + "extension is corrupted."); + goto fail; + } + + while (true) { + ParallelsFeatureHeader fh; + + memcpy(&fh, pos, sizeof(fh)); + pos +=3D sizeof(fh); + remaining -=3D sizeof(fh); + + fh.magic =3D le64_to_cpu(fh.magic); + fh.flags =3D le64_to_cpu(fh.flags); + fh.data_size =3D le32_to_cpu(fh.data_size); + + if (fh.flags) { + error_setg(errp, "Flags for extension feature are unsupported"= ); + goto fail; + } + + if (fh.data_size > remaining) { + error_setg(errp, "Feature data_size exceedes Format Extension " + "cluster"); + goto fail; + } + + switch (fh.magic) { + case PARALLELS_END_OF_FEATURES_MAGIC: + return 0; + + case PARALLELS_DIRTY_BITMAP_FEATURE_MAGIC: + if (bitmap) { + error_setg(errp, "Multiple bitmaps in Format Extension"); + goto fail; + } + bitmap =3D parallels_load_bitmap(bs, pos, fh.data_size, errp); + if (!bitmap) { + goto fail; + } + break; + + default: + error_setg(errp, "Unknown feature: 0x%" PRIu64, fh.magic); + goto fail; + } + + pos =3D ext_cluster + QEMU_ALIGN_UP(pos + fh.data_size - ext_clust= er, 8); + } + +fail: + if (bitmap) { + bdrv_release_dirty_bitmap(bitmap); + } + + return -EINVAL; +} + +int parallels_read_format_extension(BlockDriverState *bs, + int64_t ext_off, Error **errp) +{ + BDRVParallelsState *s =3D bs->opaque; + int ret; + int cluster_size =3D s->tracks << BDRV_SECTOR_BITS; + uint8_t *ext_cluster =3D qemu_blockalign(bs, cluster_size); + + assert(ext_off > 0); + + ret =3D bdrv_pread(bs->file, ext_off, ext_cluster, cluster_size); + if (ret < 0) { + error_setg_errno(errp, -ret, "Failed to read Format Extension clus= ter"); + goto out; + } + + ret =3D parallels_parse_format_extension(bs, ext_cluster, errp); + +out: + qemu_vfree(ext_cluster); + + return ret; +} diff --git a/block/parallels.c b/block/parallels.c index 3c22dfdc9d..d33b1fa7b8 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -29,6 +29,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "block/block_int.h" #include "block/qdict.h" @@ -843,6 +844,23 @@ static int parallels_open(BlockDriverState *bs, QDict = *options, int flags, goto fail_options; } =20 + 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 =3D parallels_read_format_extension( + bs, le64_to_cpu(ph.ext_off) << BDRV_SECTOR_BITS, errp); + if (ret < 0) { + goto fail; + } + } + } + if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_INACTIVE)) { s->header->inuse =3D cpu_to_le32(HEADER_INUSE_MAGIC); ret =3D parallels_update_header(bs); diff --git a/block/meson.build b/block/meson.build index eeaefe5809..d21990ec95 100644 --- a/block/meson.build +++ b/block/meson.build @@ -57,7 +57,8 @@ block_ss.add(when: 'CONFIG_QED', if_true: files( 'qed-table.c', 'qed.c', )) -block_ss.add(when: [libxml2, 'CONFIG_PARALLELS'], if_true: files('parallel= s.c')) +block_ss.add(when: [libxml2, 'CONFIG_PARALLELS'], + if_true: files('parallels.c', 'parallels-ext.c')) block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', 'win32-a= io.c')) block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref,= iokit]) block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c')) --=20 2.29.2 From nobody Tue Nov 18 22:49:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=fail (Bad Signature); dmarc=pass(p=none dis=none) header.from=nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613495579540934.6807627441558; Tue, 16 Feb 2021 09:12:59 -0800 (PST) Received: from localhost ([::1]:59968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lC3uE-0004EI-DZ for importer@patchew.org; Tue, 16 Feb 2021 12:12:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52942) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lC3U2-0006lG-8q; Tue, 16 Feb 2021 11:45:54 -0500 Received: from mail-eopbgr30092.outbound.protection.outlook.com ([40.107.3.92]:41051 helo=EUR03-AM5-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 1lC3Tv-00077d-M9; Tue, 16 Feb 2021 11:45:54 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6038.eurprd08.prod.outlook.com (2603:10a6:20b:23f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Tue, 16 Feb 2021 16:45:43 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f1f0:6610:11f5:5e4a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f1f0:6610:11f5:5e4a%9]) with mapi id 15.20.3846.043; Tue, 16 Feb 2021 16:45:43 +0000 Received: from kvm.sw.ru (185.215.60.244) by AM3PR05CA0149.eurprd05.prod.outlook.com (2603:10a6:207:3::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Tue, 16 Feb 2021 16:45:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mSuGrJuRt8uVyiLr9pA9/6vSxegKxMnT8/KV8+d04TBIYazrv2QGVGVwTGEClNhnYbS4hrz91IB+o9eqEo31OzxdUIxw612eWLQcEwoD5F0vk9tT7g0eXvP4hUyhfA8stXZuDUJbRlQS8Xbk++Cya3kE9wrauw3Ss1vRt2uytjlQzIuhMg5seXSm5wzWmtC6zBcTGiMiIT4uVG+RP1CRZqxvR9GLeAbEgKo+sV6+9aDoYbS1DonquloT/knRB8TTEDQQbZYemOYF4dG9AEtbA15nOVS5TxNxDY+ytKilvIWIsEChAfgt3wE4pxmPld9CUgnTLZceUXjpCN1PhAmnXw== 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-SenderADCheck; bh=SnXNCM/VmNuzNKz0FaJQwshJZh0mwggmke70IKp/z5s=; b=ZjchpLNEZ2LbIXxIARdFDrTFoYEiA2lKms6EXLjjn3e4BYuC5xuUkYZbQA5i2YIcA3XXvZ/qQn85yhHQ7VNlvEvnUO4ALxiCK4QnWYZVG53D5h36ePLNXVqGV6hIGnI+b30JvWZmJWd5JnpDbMtqLNWFwP0uaSkxcVZxJno2p+5Bhxno/QOjGNxnYR3DrBcGxCLUFDA/tmw1Dh3rm29wczXuAfFyXibERutArzF2mlTSPbOjK3we2FcfwSGvBhE8lKYF7xaROpDo30qmIBI8fzpmsYbkB67JR0JCapkngOSp6c0vYEpOAkwrHhNWDXzJe5NPdr5YYMq5JAv5XWVLvQ== 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=SnXNCM/VmNuzNKz0FaJQwshJZh0mwggmke70IKp/z5s=; b=dHCQ2aagDx59KPZ+95on4n2/nOs2O5cE3u2Y8VXfnTa2LDmdFo0JN2M/68HUK1P/6F75Ui2JG8CTSK7h+dpTcSYekpImVO4+IJjIApMmLCOrFLixTHDELLmRy/9uKJ9KuH8kpQgl5PeTG8IBraxT1WhQ9ckoqLNuZsXDNb4KNOk= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, den@openvz.org, stefanha@redhat.com, mreitz@redhat.com, kwolf@redhat.com, jsnow@redhat.com, vsementsov@virtuozzo.com, eblake@redhat.com Subject: [PATCH 4/5] iotests.py: add unarchive_sample_image() helper Date: Tue, 16 Feb 2021 19:45:26 +0300 Message-Id: <20210216164527.37745-5-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210216164527.37745-1-vsementsov@virtuozzo.com> References: <20210216164527.37745-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.244] X-ClientProxiedBy: AM3PR05CA0149.eurprd05.prod.outlook.com (2603:10a6:207:3::27) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 32b63c56-13b5-4991-3d7d-08d8d29a4d3b X-MS-TrafficTypeDiagnostic: AS8PR08MB6038: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1728; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Yh7iKI3za2LIoR1iaFC9Ym2jzgZJhOcO3QRV/3z8/KYwCdt2VopX6QP0PvLx0ut0hZ/BCHqi7iwaFrkUL4isbM4bUr/khlZkvwpUet1Yyhomvu44s6eOxVevvU29Zh+EvDCNXTL7ngyadLDVSLrcY9QactdincPdH/xyUi55gpvs79a29hIDSWbx3toudN1EVDUkOiQbv4+qjrIyVVWXX2JANV5o+8AR/Evh+Mllqn9pchSXAkbKWV91tkjzVZWKr5pE7MIvLtGt8Q5S5YAE0706lWAuNZk4WDLZ8CDBYqOTXbRPTbAEcs1SRWLg3NkUoxY7yFAyHcuLTQ+TpIPpxYGnDLLHM6aul0XYnfl7mpIyjCe0Yqs15zYccmWoBOZ0zJnRmOsZmbARAiErPDk+iHHQnavvH0Ge9WHzQ+9Y/NpjKtEQUgnT7yKAaTZSRQLdsVkOu5n8+XrgyQdPMyQro8Chjg5/8sZdhLjx0P17ufYgzvB1uPM1lVpMQSWcLcPlk4Fj9kG+6XccYzxVf9SU0w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39850400004)(376002)(396003)(346002)(366004)(2616005)(316002)(6916009)(6486002)(186003)(26005)(4326008)(5660300002)(2906002)(478600001)(16526019)(6512007)(956004)(36756003)(83380400001)(8676002)(66556008)(66476007)(1076003)(52116002)(6506007)(6666004)(8936002)(66946007)(86362001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?/hPvHzrkmAfbgvaaaxf5cMm/wBEsLPREW8WNUJgoiS2ZjiD68WakG1CIxNUP?= =?us-ascii?Q?+ljEBzGMhZIXbqAe6IXpH3ITF2YJcrGuW6D+ltXlW1xDIYbAEx2+bRYzLybu?= =?us-ascii?Q?rbx96ctv1+JgUsP6MzzCxgSYkSIDNo1bvVA63XxTdx0Ue8H4tn0xwnwncmR+?= =?us-ascii?Q?b7hp+vzNXYicOzqKQIJP12YrcoruRQ2TYoQNeCQ2K0MVn1l8wqTFqCcY1rjM?= =?us-ascii?Q?Q4c7jtTmj3zABMqiOC4BWMRu1YaTZ+0Bkt+dWx6FfDuzXwh+SLG9VVlZvDXm?= =?us-ascii?Q?zbrOv9ZQT7Y5pzOFy55EpODYPWujK1rV5NH51LfJgCqeG+hHsKOXWb+K7CY1?= =?us-ascii?Q?eHC90ntH0+9oGVw/lHLm0ahiUeD9TccdGc5JeEotFtiaZyvV6nh8c2dr4iFx?= =?us-ascii?Q?2BIRgCv8wTTZmc4T8GqrkH4mZdJrTquTqrtkkTrUIX4XTW40k3TmF7ctp5/E?= =?us-ascii?Q?JbGAyZwSQmv4476B04IF992NCKBrOveuTpHXU8s5kfcamITkzPFNUQGSJFQE?= =?us-ascii?Q?R9cWEiI41jciowLf1xM/c0oGI49FGEw3ve6ehdi96vyDKjYB6ELExDTDVqfF?= =?us-ascii?Q?yKF6Gay8ixQA/cvXLxd6CDMRX8tPhCJ9LcAlstqbBIp/dEf5W4csAdXghF8X?= =?us-ascii?Q?uN8GYTO3sJslgTVzOD0jim59HLz9aeykZnbGu17DZ4P1uQpBo7vw1ki5nhcW?= =?us-ascii?Q?3pme95RBxJvH2S50OgJtK2BdW5BBoBLNuzhL+DFYNs8n1SXGZbSiGdpqV0mX?= =?us-ascii?Q?RNCc0G87wh6kmwfT/5sG7QiWGdK9otcgdXCIAQ5w0FF7eRXjsIjqpSxKB/Un?= =?us-ascii?Q?5Ba3WkofvtwXtrR2x9uApWVFUsvPLxrz9xwJahpMdyGcZ1uvDTN4Ywt12ZNe?= =?us-ascii?Q?yt+38u3HkXr6dOBJpvTRoM0Ol1lO5ow1CmPSBlUXa68fJykw/kkJ7gzTOERX?= =?us-ascii?Q?6hTaYCsRCxmcSkVB60f6pOFzlL6y7/Cf/D383GY+xW4la26Be8HCtimhGz9s?= =?us-ascii?Q?jqbq5KQmt2AGvIuwZyFIqCUpzinPG0FhCAi9GPCiv9SmDoGJ7zMIpkkBhWQe?= =?us-ascii?Q?NyWIWsRXeO5bZStuIU2c0SZt1HzuAM0JR92Ory7TdQiXMYvUZ9DGQdJDjo2Y?= =?us-ascii?Q?nW2pOCXgh3wffk4K61Em/EX6l1ZMow0mzhHmtnXSlGbXRAdCVAPuDrKEaBZ7?= =?us-ascii?Q?LKbJnHMTZyZRtV4uuqr5rTyvSItii2KOeOSZzoFb6JaBUR8QySkJnXqHcb/a?= =?us-ascii?Q?4N9vzB6qcjomEHpLcWt7NEH+ZNPwTdhUBfqtE0nKPYL2jhy3sO9feZaM8iMg?= =?us-ascii?Q?Gz1JmhE/0cc+D0eRpAZLu6V1?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 32b63c56-13b5-4991-3d7d-08d8d29a4d3b X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2021 16:45:43.6734 (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: G8mdDsmCk/DEHMpQ5WU9IgKOR+ounFt6MoJMOZlFtGYnulEIiRjvFd8mrzYq1P44ISFT+GueFLL4NzU+B4XxOQI5+lKF2GcxWEqJI1cdli4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6038 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.3.92; envelope-from=vsementsov@virtuozzo.com; helo=EUR03-AM5-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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: Vladimir Sementsov-Ogievskiy From: Vladimir Sementsov-Ogievskiy via X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/iotests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 00be68eca3..ea6238f242 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -17,6 +17,7 @@ # =20 import atexit +import bz2 from collections import OrderedDict import faulthandler import io @@ -24,6 +25,7 @@ import json import logging import os import re +import shutil import signal import struct import subprocess @@ -96,6 +98,14 @@ luks_default_secret_object =3D 'secret,id=3Dkeysec0,data= =3D' + \ os.environ.get('IMGKEYSECRET', '') luks_default_key_secret_opt =3D 'key-secret=3Dkeysec0' =20 +sample_img_dir =3D os.environ['SAMPLE_IMG_DIR'] + + +def unarchive_sample_image(sample, fname): + sample_fname =3D os.path.join(sample_img_dir, sample + '.bz2') + with bz2.open(sample_fname) as f_in, open(fname, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out) + =20 def qemu_tool_pipe_and_status(tool: str, args: Sequence[str], connect_stderr: bool =3D True) -> Tuple[str,= int]: --=20 2.29.2 From nobody Tue Nov 18 22:49:03 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1613495353; cv=pass; d=zohomail.com; s=zohoarc; b=H4FdtbXze57vhBHFB7Wi8jhtMQxdEz14ichjX1zuCD6MToSx7pNS7skgztGajkjwpQrQT0MwgvHu5eLSwOyKElMMmVXUIR6BiPljmTUbijnzN+LWx+LvgVL03VdktCKwpO8JawdR7UUa9pTl4jZB0GD/g6hH/2g9q+Si+oWIjxI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613495353; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dusFbCOLG5HQswB3S9yxL1c96RNG13sbIfxgdSI6P6o=; b=VhOX95Qe/wUwsbPyGVjI5pSkcrSVetmLn1p9kbZq4oqRlJ3bsfZ11xL29bJnwZTrEO8OrD4xrtkhmQwi1Zn7U3fIc6iG6rCq1TafrBAkY+9fkTEbFsA4YVg1oB+Px54yjzgRjjJFyT+yw03hzdNmTl6x5GYmPhZ2zNBZDm7BRnM= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1613495353286862.1532138794623; Tue, 16 Feb 2021 09:09:13 -0800 (PST) Received: from localhost ([::1]:45932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lC3qZ-0006QW-Ux for importer@patchew.org; Tue, 16 Feb 2021 12:09:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53472) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lC3Ue-0007Tm-4S; Tue, 16 Feb 2021 11:46:32 -0500 Received: from mail-eopbgr60108.outbound.protection.outlook.com ([40.107.6.108]:14830 helo=EUR04-DB3-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 1lC3UY-000776-7K; Tue, 16 Feb 2021 11:46:31 -0500 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6359.eurprd08.prod.outlook.com (2603:10a6:20b:31a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Tue, 16 Feb 2021 16:45:45 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f1f0:6610:11f5:5e4a]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::f1f0:6610:11f5:5e4a%9]) with mapi id 15.20.3846.043; Tue, 16 Feb 2021 16:45:45 +0000 Received: from kvm.sw.ru (185.215.60.244) by AM3PR05CA0149.eurprd05.prod.outlook.com (2603:10a6:207:3::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Tue, 16 Feb 2021 16:45:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LFCc+UM2DfkdleR3R55doe9b31cmKEPIg3JV8+0AzQEzvxL0dyKjbM7989/AgoR8dmijGuthdawGWIjED+7V7aaQHyiasdBchEz0jGBtn8wkXYXoEUAL7b1OQMWd3dkzccpIskAozJs1vd8yUswTaFbRcwlOwXTn3wuHU/iTEeel2uFt9mYf9vMHn/t/pL9l2aHfLspkrY2nxjL494iWPK2AF/WcTShiq8DykvQRChpPEQ34Uy1YyKQlwDv0dxZise5zhW8pLgXgb965bn8so6CSp7ZmWnF97s3Wl4CZ47/D26LMp08v6MPmxYW5Rg1KM0ceAo00kCm5HGbJKWNDGA== 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-SenderADCheck; bh=dusFbCOLG5HQswB3S9yxL1c96RNG13sbIfxgdSI6P6o=; b=RdO1LCiwZWbHY5ZvZwzWWVa4XGAL2VKJMY/cb2U53zdObmsWgPSm+BGFXq52y9pLy1d3vCWW0sYsRmjPbOisYJ3NtI67y3g0bqsg2wukqajoLu50EWWpXfRl1VuYE4BkeuqsWmedi1t6+2/E8V5NBIPTxgE0XwEiogwRwLXYR25fRI6GWtHYH+RpkAHkCYlyUav1ye5ivQ6Q5zsjt9FuSQ17xTH+mcF/R6M+8oTmhwNUt9rwjGbcX/COfhp8CSyojcyPFxwqBoCjaVwkcNK6Y1DttEKAHrDwLEhe/kwKYTAmBj6T+Y13bAlvoDzbCI3NhuKNmk27SUf2495y4iDIlw== 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=dusFbCOLG5HQswB3S9yxL1c96RNG13sbIfxgdSI6P6o=; b=ihZWFp+hRLJInV7YVBcnrVU+pHdP/2Zyx4lEeA38Oo481tVrmy1Qdn1ENFNqNT2yoFS18OxWEb2P/KiUOghno/kHCPrVY3a/fbDFxGunaf5elmOipTTlbTKL3Cbyf2+QrpskRoRzJQQPbNDp696Tg79aHKTo42yxjqlWtybF+Ds= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, den@openvz.org, stefanha@redhat.com, mreitz@redhat.com, kwolf@redhat.com, jsnow@redhat.com, vsementsov@virtuozzo.com, eblake@redhat.com Subject: [PATCH 5/5] iotests: add parallels-read-bitmap test Date: Tue, 16 Feb 2021 19:45:27 +0300 Message-Id: <20210216164527.37745-6-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210216164527.37745-1-vsementsov@virtuozzo.com> References: <20210216164527.37745-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-Originating-IP: [185.215.60.244] X-ClientProxiedBy: AM3PR05CA0149.eurprd05.prod.outlook.com (2603:10a6:207:3::27) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6cf0d96d-cd37-4d83-d6f2-08d8d29a4e04 X-MS-TrafficTypeDiagnostic: AS8PR08MB6359: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:311; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FObpIGp+Ewx480fGISvUfFHAjc2Pg5nDYm3mvrEqX690AMjDN8+XgOWWy51C9reg6uuUeXzlUvr8W9n/IyoL7DAPu3yzJouNWcaM66hCjuDLmeDpUKW7RfWvKWO+rHbH/GU4y5lnWC+diixhOJBru6rpHo5OKDH3FaRKgmiHZ+lFfhPzdJ+EzVMyBodMbwwkw+SFAmwO8CoqVRoRz1DrVnM3rdF0v18CAb3+zF9MH1CAAm2KJhrUYZGrc8Vpxx9LA3+n/KrkNgXTJqqgr/Trot6O83IGTULHL7xoCF65kxzR9N3DKuHddBrxxs3p2yCv4s5nj1Oa4omGj0gEWDqBCQXJw7Dznxh+EJfjcavdKJVAen0YIsnUBaHQP3RlQrAMK+HOS3JLGuDBhtmdVDK+oiNGnY7mN5WHJoJPNbeDJbeiDeQFI+eMUwsdih31CzKs0LifbVNlVzq+InF3h27lg8PFjp2JZkVxq3fUukwYfkt+YCZlCExSrY7mKR1VjV/PbiSCJCnxYPOc+yr6LRIm3Tyyz2l6fyc1lJm5Slkr4Fp3WlrGv0ldTRqfMjcWjyc8NaXLwXH2/io7V7gqp+hrIzGRLe+Dde711D0h1FymNJh/EX3e7CO/Cq7GA8Zdc6vGfmWtR1r1ELU+wa9JeCFyFQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(366004)(136003)(346002)(39850400004)(396003)(8936002)(956004)(316002)(36756003)(26005)(8676002)(2616005)(5660300002)(1076003)(66946007)(66556008)(86362001)(52116002)(6512007)(186003)(2906002)(6486002)(6506007)(4326008)(16526019)(66476007)(6666004)(6916009)(478600001)(2004002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?m07qMjXimTr6cK/SpXt0CothjpD15SahYiFMXALKs6NGf5PsG5BuBkdEsahj?= =?us-ascii?Q?RWQxOhISM3+z4J2Dfvfuhb9BGoWX7Xt0s0S4Y7PJESAL23Fsb6g24f/HnDlY?= =?us-ascii?Q?j+bcShC4GA+LKCX2m5ZjWSD0o5SAqAC7fHhs7/27+GMLuFe8YOYHnj1PdleX?= =?us-ascii?Q?qU2IYMzr4WFdfDirmaBCq35XPrB1zieYPdXAfJXoJ9L4peONE5REkuzIWESv?= =?us-ascii?Q?BcX8MMrVUJ8I5G8b6StbvP/DaG4n72Ky9n7EL8WfKeMktKxxS9F7uf8w6Uvf?= =?us-ascii?Q?0x4qd2G6oqwiSDL2ltEN0jHOqqca0CEuug0IMS/UaaP21WU5jXT0+2VR7L99?= =?us-ascii?Q?TmJHpgP8NrJJoTtKY9EkpatD++C0Ng/svlLE0oz5f6B/n06XSs/oUG6zk7EV?= =?us-ascii?Q?10/uBZceU4N7ORQTzwjtsEAtFWeZBhzdY1vdEAGfI+Cs3XJSqcg5ZVpRIbwp?= =?us-ascii?Q?QJtc9y11VvwIKLnDSm0WfHanuqgrUxvQBp44CeI5fuWHuDZIbhRlp6UPnAf5?= =?us-ascii?Q?7U7KF+79g184CcZwpecHPkfESZtWvBbM0oWo3tAVnHbtxLOlftlvWR/XNm2x?= =?us-ascii?Q?stCQ4wxQLyBMKsG72tuuJgYyF0b8mhiq9R1zc6RDhZHRKlB0c8sHWCBzzSYh?= =?us-ascii?Q?IjZX7tTCBbv8zIhAfOYXSwmHioPGmP/n9auXmTo6lIS1+CiH+ORpKt7b0U9H?= =?us-ascii?Q?ZraGJ/0wdCRLFAmi+aOkvWXEKiMeKyRosGDtOoIfTD3D4IsRDmHum9N+T6vp?= =?us-ascii?Q?E0ZAkYMEkuQNsoGhgct2DZrBFPDdHHS7wHxX46dgUy2dc0nmDC6C7uKgijDX?= =?us-ascii?Q?1G0sXWMAfnb4BEPPKRGFRQQm6QirfZbAgm8ctw/4KcjknEZvY2afsMsbTPck?= =?us-ascii?Q?LrWiNQCzsuqxEgK/BbEgXjKN/CZtwELplhVOZZq41dXFrpXwElcEB2eChQxX?= =?us-ascii?Q?DE/QkzrxEwm4h+w2prrj1sYUt5gzElTIQSIQLvHz3TxEivIFnaeCsVkTIsK0?= =?us-ascii?Q?3v630naw0k6hmTB/tkegOYTDrWblzRqSx8cMzfagwnJPlHpSJ1gX83EV2SPB?= =?us-ascii?Q?brRio1riSqncXh7dORN5LAquxCtknG7p6I2GooULk2o8axdgzopeqHTd5MJt?= =?us-ascii?Q?vxkCBFjR12QBhqanJjuzedAcTceB0IbXxgRB5A3lTlK/sBUEjAb4/9Wi0Z74?= =?us-ascii?Q?USGqMI6Z9pmKK5QB/ZduMixXwKGwlQ2pQ48+YObuAY8XSRvtyujOJF2lSprO?= =?us-ascii?Q?cGcI/NyBWgXR0I/de4qxDuXm2fEBnCNqaN9rSMPIyYfE2VaL4dHGBDzHqG9R?= =?us-ascii?Q?4wXVE2Hho1f3DnhTnIB4haYU?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6cf0d96d-cd37-4d83-d6f2-08d8d29a4e04 X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2021 16:45:45.0364 (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: UFf9jrgSpAyBvdIm8VBAvuoNJXA7D8uq4hHv/tih68oR2RcI+5LefFePpNe3GLKf0MFpejDsTGvQ4rTv8L6zwJ0QPaHlrOB79A7oqbGObEU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6359 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=40.107.6.108; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) Content-Type: text/plain; charset="utf-8" Test support for reading bitmap from parallels image format. parallels-with-bitmap.bz2 is generated on Virtuozzo by parallels-with-bitmap.sh Signed-off-by: Vladimir Sementsov-Ogievskiy --- .../sample_images/parallels-with-bitmap.bz2 | Bin 0 -> 203 bytes .../sample_images/parallels-with-bitmap.sh | 33 ++++++++++ .../qemu-iotests/tests/parallels-read-bitmap | 57 ++++++++++++++++++ .../tests/parallels-read-bitmap.out | 6 ++ 4 files changed, 96 insertions(+) create mode 100644 tests/qemu-iotests/sample_images/parallels-with-bitmap.= bz2 create mode 100755 tests/qemu-iotests/sample_images/parallels-with-bitmap.= sh create mode 100755 tests/qemu-iotests/tests/parallels-read-bitmap create mode 100644 tests/qemu-iotests/tests/parallels-read-bitmap.out diff --git a/tests/qemu-iotests/sample_images/parallels-with-bitmap.bz2 b/t= ests/qemu-iotests/sample_images/parallels-with-bitmap.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..54892fd4d01bf743d395bd4f3d8= 96494146ab5a9 GIT binary patch literal 203 zcmV;+05tzXT4*^jL0KkKS@=3D;0bpT+Hf7|^?KmNPH-R Fx`3oHQ9u9y literal 0 HcmV?d00001 diff --git a/tests/qemu-iotests/sample_images/parallels-with-bitmap.sh b/te= sts/qemu-iotests/sample_images/parallels-with-bitmap.sh new file mode 100755 index 0000000000..e4a1d71277 --- /dev/null +++ b/tests/qemu-iotests/sample_images/parallels-with-bitmap.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +CT=3Dparallels-with-bitmap-ct +DIR=3D$PWD/parallels-with-bitmap-dir +IMG=3D$DIR/root.hds +XML=3D$DIR/DiskDescriptor.xml +TARGET=3Dparallels-with-bitmap.bz2 + +rm -rf $DIR + +prlctl create $CT --vmtype ct +prlctl set $CT --device-add hdd --image $DIR --recreate --size 2G + +# cleanup the image +qemu-img create -f parallels $IMG 64G + +# create bitmap +prlctl backup $CT + +prlctl set $CT --device-del hdd1 +prlctl destroy $CT + +dev=3D$(ploop mount $XML | sed -n 's/^Adding delta dev=3D\(\/dev\/ploop[0-= 9]\+\).*/\1/p') +dd if=3D/dev/zero of=3D$dev bs=3D64K seek=3D5 count=3D2 oflag=3Ddirect +dd if=3D/dev/zero of=3D$dev bs=3D64K seek=3D30 count=3D1 oflag=3Ddirect +dd if=3D/dev/zero of=3D$dev bs=3D64K seek=3D10 count=3D3 oflag=3Ddirect +ploop umount $XML # bitmap name will be in the output + +bzip2 -z $IMG + +mv $IMG.bz2 $TARGET + +rm -rf $DIR diff --git a/tests/qemu-iotests/tests/parallels-read-bitmap b/tests/qemu-io= tests/tests/parallels-read-bitmap new file mode 100755 index 0000000000..b50b79f509 --- /dev/null +++ b/tests/qemu-iotests/tests/parallels-read-bitmap @@ -0,0 +1,57 @@ +#!/usr/bin/env python3 +# +# Test parallels load bitmap +# +# Copyright (c) 2021 Virtuozzo International GmbH. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import json +import iotests +from iotests import qemu_nbd_popen, qemu_img_pipe, log, file_path + +iotests.script_initialize(supported_fmts=3D['parallels']) + +nbd_sock =3D file_path('nbd-sock', base_dir=3Diotests.sock_dir) +disk =3D iotests.file_path('disk') +bitmap =3D 'e4f2eed0-37fe-4539-b50b-85d2e7fd235f' +nbd_opts =3D f'driver=3Dnbd,server.type=3Dunix,server.path=3D{nbd_sock}' \ + f',x-dirty-bitmap=3Dqemu:dirty-bitmap:{bitmap}' + + +iotests.unarchive_sample_image('parallels-with-bitmap', disk) + +iotests.unarchive_sample_image('parallels-with-bitmap', '/work/mega') + + +with qemu_nbd_popen('--read-only', f'--socket=3D{nbd_sock}', + f'--bitmap=3D{bitmap}', '-f', iotests.imgfmt, disk): + out =3D qemu_img_pipe('map', '--output=3Djson', '--image-opts', nbd_op= ts) + chunks =3D json.loads(out) + cluster =3D 64 * 1024 + + log('dirty clusters (cluster size is 64K):') + for c in chunks: + assert c['start'] % cluster =3D=3D 0 + assert c['length'] % cluster =3D=3D 0 + if c['data']: + continue + + a =3D c['start'] // cluster + b =3D (c['start'] + c['length']) // cluster + if b - a > 1: + log(f'{a}-{b-1}') + else: + log(a) diff --git a/tests/qemu-iotests/tests/parallels-read-bitmap.out b/tests/qem= u-iotests/tests/parallels-read-bitmap.out new file mode 100644 index 0000000000..e8f6bc9e96 --- /dev/null +++ b/tests/qemu-iotests/tests/parallels-read-bitmap.out @@ -0,0 +1,6 @@ +Start NBD server +dirty clusters (cluster size is 64K): +5-6 +10-12 +30 +Kill NBD server --=20 2.29.2