From patchwork Wed Aug 17 15:53:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 12946182 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 D118AC25B08 for ; Wed, 17 Aug 2022 16:01:46 +0000 (UTC) Received: from localhost ([::1]:40946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLUG-00089m-T9 for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 12:01:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLN8-0006gF-Q2; Wed, 17 Aug 2022 11:54:22 -0400 Received: from mail-eopbgr60132.outbound.protection.outlook.com ([40.107.6.132]:65374 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 1oOLN7-0001M7-1u; Wed, 17 Aug 2022 11:54:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iP5JpIVWr9jIIppol1FarTjgFdEwj9kJFEEe46zxxDt3BzhL+9w/gvRlT9pj3my3SruguYakeGlcvkAC4F2K5do+mAjyF3TIguisxaBsXFTjJPaV8SHwUfFE5aUQ4oCw5e5F1HusY2OeMRyQWgAEGxCNLIHYAlt08GshSRYwBAfI+aDcqGF72iGDOxOZCxXs7M/mkMNsOXH6/9ioqIRyi6PekbR53f7+d8b9Sk9Ybc5Ue1P384ntSz1+vsPwaoeMFsZNmyNI5tOzRlUxWvijm9uTbIjfRNVrL3v/2F1HB4t/5wXa75Lr/sfyWv4UKGVs19LK9rALCU+5/yg2eqNnmQ== 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=D9aenJPjZ7YXBX3x/Fb0ofevr0c/OQpaS57fYNdt69U=; b=VUSTsTuderDd8O0vl/1BpyKrNVeTCL81QlZrqlD5nXdam3eIoSaHTzn73KAsxIqWrF4C0Cs16ZzROSFYSHxzfi1kM2UweZTtRONopjg1TKQFCP7BWSGhm5xfg4fwSUilfRl++w23UEV8kAE4No5t7cpIeiwXwB7xB6PWY8AnXehNOqDkokabqSA33AIwKXJhRCrWDKxE8qr+G/ZuHigoi+1rxDUcTYpPoShLZSQ7RQR5KC1brTpTWU17UHvLmylSnRi54ywDE14t0jPau6iE7Hl69o4g22GFykjOHGk4rBashEtdM2D64Xmfm3+TkDzsu4kPLxhfLoJd69OiF33M/w== 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=D9aenJPjZ7YXBX3x/Fb0ofevr0c/OQpaS57fYNdt69U=; b=fuMcnKo90TpNW0ne7RiuMyFmmxagbOFEv5ezfo2NrTzR3QsqAZJEJ9Fs8oluXq7eqxWlO8M+41SHCHDPymYJ05U7mBduzCx/2eO21MTMCg3rPu85hS4zJVL6iedeltlci4F8dlukkXBb/XSZHDtRpOTsIhuqbruLd/DxVsIyy5LkP53FgP4typ/jMjb5yqgjsKyZ0/c0Ggx7bchUP+8gA0G9Nf3JfyWptUpF+WgrBnOOwWqK9svyHZbE4rLt1D+xcjr+LEy9oigGvOLIYx9gcdK/HSVzx4N/ojRjGS9rErZ0LJDd2pN26/MnenXl4o//szahh/Ez0SzxmAXW2m3PEw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) by PAXPR08MB6783.eurprd08.prod.outlook.com (2603:10a6:102:131::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Wed, 17 Aug 2022 15:54:10 +0000 Received: from AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2]) by AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2%6]) with mapi id 15.20.5504.028; Wed, 17 Aug 2022 15:54:10 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 01/10] parallels: Incorrect condition in out-of-image check Date: Wed, 17 Aug 2022 17:53:52 +0200 Message-Id: <20220817155401.2045492-2-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> References: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR0P281CA0111.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a8::12) To AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6a7f9633-518c-458f-7ae0-08da8068b965 X-MS-TrafficTypeDiagnostic: PAXPR08MB6783:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t7AoGPs3PUdp+G5t/5DS5tSkitkrA0xiHdprQFifwvqtUo8Fcg3sPuMZIyzxNQ3hgm5jrLFVr8d5d8zWO+7FHz5XeuSwbzmGt50Z4qegQCVIa4oNLfeQ7tguWQcDeW7+NUx+wCY3wO1xHHcFblxgmPJxF5suESBnONTkXDCMJDeauYJMG8PfxnM1fRAL/XAup79Zx5MGijlDoMbFa+WjZdcj1ZpoNAzKOcNZiX9pkzWtlmlKvyPo1fJPm3EV3aSNVeOfS8gbOqBwbQGyyXOp7vyCpUvnd4gQgi+s6Xytj9LHLk1vdtPe9QB+9Ja5GdZtGupL72bGm8E9D8FYcnL+LMhAWvi/e1Kn9AyL+V9lJ1fvFBp6mTBD7okYLdU0idrxsTelNNjAyPgSKxHdiqpkdDZZFgADgZyf4ZBYoU7FNlQy8v6RGGzrtftL6Rz93FPqZanedwizfftXDe4Zahxf/e3l6y99h02SsqYMGinXa+ku4uMBQjjaMB5vuQZqcj0JHKVhyTneyz247DfOo1EqcuVHMIz9U/NhPqzjv9cDASh/I+eNzPPaaZpFF+EdlzsqXWDyehjiksKGrEfIWqZgFsbknjCP9uitJeud2w/XFQO6KjJaJB3TMj5MUTtL3IiMi8NwvvTT/dp0Kb+BvLs6hWHtcJDLde63jzNV4u0aA1sChH4PsRXaO8Kyd31DdXPg21FkMxwtcsA+oeUXtaEPCkcOWVGn/N7WPDTp3XAHUzK2WGXKk33AQ/MJsnLpvDb8/PX8hwyJ3thqSTqXrn/7wMIT2/1GIDJ928FPaR0CXEw= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7095.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39850400004)(346002)(136003)(366004)(376002)(396003)(66476007)(66556008)(36756003)(4744005)(5660300002)(44832011)(66946007)(6916009)(316002)(86362001)(8676002)(6512007)(52116002)(6666004)(83380400001)(26005)(478600001)(6486002)(4326008)(38100700002)(38350700002)(2906002)(186003)(2616005)(1076003)(41300700001)(6506007)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dNcizeFn+CbVTFNDJVQMd/TFzAehlO0oIFVTh31RfI2iHd9NVdch9OOw4wKLHEhDBKqqqJZT74bYxxB2sT7JMcqxkgWfqvmOn+fi315e8yvx+NZLWVwwGIb3+pnPqUCtWvQyOtwSu3imTYBUpgAVr3dApN1z0fXP+IZuNAbz9e459lDl6JSlfG4d5rFBMjG78tRRqR1YoiOqk32GPZQoLPPQOamfCgbAtS5SN+4kLT9bKdidw7f6EqgtEy/25QZnBRB9Ax/52rM17y86bN/pE89ksHoGUpaMF3Wd48xANGaa/d8ZPw5Mh7bqZ1rOabHPqGfPO9EwZYcq/HHAchwxpHERNouZguoCPxudYiBici+dES8H1ilxgb+i1ZsLnsEieEyDsPcyYw3oUy99kIWdoZhfJdusQek3l4Vn297WxMeSRNgTNqDdqTKzSQ146nn/Ql3Gn/8iWqv9AFxZzIksvWMHNH7/2+0J8XyRe7AZxKRjC1VOAX1/Xe/dD5G5EJD73WfDCrD2ctE8z+Z5XxxMr8y4kaLsERi8oEIcnxVULJiaFtoYQ5UjVfDA2thw9AjYOKg/p/lWWy3yagVuchmn2Nra4ScEhl0ykZnHNFDsLGO27H0Xe0B22zhy6mj2SK/EDdzF/9jfk2+vQ/+m06k68OImN5Pb99tej+Z84LzkaaCa1Me4i/QaMjF6k898NSEWInoddTPCGDi6Ndi7VovkdSfQTqDzgXeaMbikA3MhnCG1+oeePLyCgQpojUiO4cGA0dcYkwNHypW5iZt3SoSg5eCsSj2Pl2cKeQBMXMU004yxNOx4Ms/U3FTAkrCUN8QHONX6Avqj1A8sMh4c1Hy5myqyfwh4IZNzPak1t//YhPF+w/US5hHg8EWSRVVYOkvdU6IBToenuf3V7nky6fCIbyEPTEqbrpH2/Uh66OvqrySexuiU0LlSxSqGKLdpNUBPwgUZ2LxIRQrEPPc4gpHdfWJIiTWXSsOokbBcAYXpcNhfI+qZT//sPc/JNV9IvxWxXTrjMliAgt9pg8pUD2eVUUVme3vobU98Cj5NXnYz/9YGyvAYfrTd/SvQCGHSuj7W8jc0m7F4VnmpqdT9aApFRkldmE/nP9CbLKF6aTZN1fmZ0T7L4O6Scfe11sw0iYH1w1JvlLULkAd7LyRSBMpt/meMosGHPeW06u939A1JlyMkKTfel2vbC+0gmdw2wGjBTF4b6JFDzKbtwwtiwppy/sXGoD4dCKeSp+KzHEDTefk310GKpzYvwg3oxTVRzD8h3A2nfu27yCNhaiWkBt7FDXhF9HKsZabwDBZtBuWCpjreYtpjQFdaah2bc/h3JktBvezTEDB94hYySWv8TNqjIKs+oOvu9LWVuHhgJ4ekQoenmSRUOpfEoBwMJEInBnLGTLMUi9eF3bVM1nwfZI6yxXEnGGLlBnm1jlMYeIuFDY8rbZGTFrLxo6o9/mAOe4GwkYkWmCAKvNyr+HDruXIf3tn1h4ZrGhOTLsG/cq7SihFY9udjKRGcdL4Cfj0a373KpkapYxrvdLKvZITZN0ZTtMlu5qApACjRjVKKebiK9bVyywMcR9BSg2ML51Knq6QQup/hoCL3/sJq1YPaHXvBrz7ChvivKWVwIqvs0pCkib4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a7f9633-518c-458f-7ae0-08da8068b965 X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7095.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 15:54:10.3142 (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: 6+Yh2d2/KL+LLNPE9UG2+NGDZgEwEv/hyAQpUVa5tJa3VvvxyrDtgrFLjCeenBFSZ2U4WJDHvQpNlpxT2Cs45xUaJxNfQD02ZjokKy4vqbM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6783 Received-SPF: pass client-ip=40.107.6.132; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" All the offsets in the BAT must be at least one cluster away from the end of the data area. Fix the check condition for correct check. Signed-off-by: Alexander Ivanov --- block/parallels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/parallels.c b/block/parallels.c index e124a8bb7d..c42c955075 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -455,7 +455,7 @@ static int parallels_check_outside_image(BlockDriverState *bs, for (i = 0; i < s->bat_size; i++) { off = bat2sect(s, i) << BDRV_SECTOR_BITS; - if (off > size) { + if (off + s->cluster_size > size) { fprintf(stderr, "%s cluster %u is outside image\n", fix & BDRV_FIX_ERRORS ? "Repairing" : "ERROR", i); res->corruptions++; From patchwork Wed Aug 17 15:53:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 12946181 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 537BFC25B08 for ; Wed, 17 Aug 2022 16:00:46 +0000 (UTC) Received: from localhost ([::1]:40944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLTF-0007zo-EG for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 12:00:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51772) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLN6-0006Xc-3w; Wed, 17 Aug 2022 11:54:20 -0400 Received: from mail-eopbgr60098.outbound.protection.outlook.com ([40.107.6.98]:6277 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 1oOLN4-0001Kk-DA; Wed, 17 Aug 2022 11:54:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VbwC9VTfA7jbiqjY86E0qS2H0KR3T5Zvhz45gWxUit4o3p9u5vo0YeVe8hdrwem/7GxTUUkWKZoGu7IHZ91aVj6peWKQdw9gHB8474f4plKa3elKf8DEUWXRNbeD/JrLHAK7jN/jCmHTEOaiz0ut61VDocpb4n1W39hYwS6WZcsS+NxnhJpRZLcgR4Eae3tTFBauKCT1iCXkPO9EvJt7CmmolmlIi0SyOwvnJsnsBgMx8SwjTmnIWgHDBLqLVVaax0zg1TLannxQWIgD7F5v91gxZT+CJZJAaotU2dBU+CkEVGlBF9jkrubMXmrAjpnRyeMwaloGtcaNFm81zduTaQ== 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=eO0Xm0JTQOmQHxQjGfmOiiL858aJoGmGW9JmNGT+GFQ=; b=BBqNiqLAGHRGuStCj8GQ00fZnknSKxpD/eWbJsDNmnDxf8VJnaRfDjfZ1yUx3UdCVaEK2Qnu3bLRTsSkOZ3qcWlXHzQNjJF4FBXyGII764Um+4Oiex1pzjHGXWo120druEWZJorRN2E94B0mA9TieyTq0G39Z49+bMdHZK4KkrRydIkbwYBsZBG4JrtjxQiXgmJJnOhFRe0qKkI977HdOSYpwPQLEMcvDGaSvTsi5dNEAxkI6nBomz/WcfPhjXg49vIujODRw8okO9jZiIlZ664bEJK+EG1If54in1zNeQaoAFz/yhkqmsR3vx+nQUimqegq++V07+a7pQAPjco/SA== 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=eO0Xm0JTQOmQHxQjGfmOiiL858aJoGmGW9JmNGT+GFQ=; b=wV/g0HTFLh6P3HFHZ5nNUE83Vqx2ozQG9a/zMuj2pw+lS5GGUZ0QyJNw9mPdagj6pq4bRt+sEpHaXf43BOxyxTpHfO1Cc0YtQYFcjYsB451MT8yOQUu6NIbUi4aI9SWJ1xYCjxN3sPR3Pmfmz5Uv1IgHLGLaw6ix22Mg3QNo9AEuwjq/PYAQZSPyWnvjnqkyUAhOClwi4shXYH/qhStnSC86Hs+hvc+8wQ0Scmxajh4yZsRj45QeXmDoiyvH1v6EHeMZNSZlnqrvnGxxSHzLGcI8gifXYa0ngjm/4h7deMnDI4aXkoo+KSFxIg1T7F8ryAG38XRu+9EXCAfQCal+2A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) by PAXPR08MB6783.eurprd08.prod.outlook.com (2603:10a6:102:131::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Wed, 17 Aug 2022 15:54:11 +0000 Received: from AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2]) by AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2%6]) with mapi id 15.20.5504.028; Wed, 17 Aug 2022 15:54:11 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 02/10] parallels: Incorrect data end calculation in parallels_open Date: Wed, 17 Aug 2022 17:53:53 +0200 Message-Id: <20220817155401.2045492-3-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> References: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR0P281CA0111.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a8::12) To AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a57970a9-57f2-4f11-aabd-08da8068b9dc X-MS-TrafficTypeDiagnostic: PAXPR08MB6783:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s8n2/PuqjiI9F4E4YUJpgDWN+5NsnaG61Ub0N/BVoSOhc5U8Aj42+ZQCjx+AKMdhWFGUscJAtUt1a0eMQXHdGKcVKlp4O8h+3NnnbpE/MBNB2M/EpVIf+NVbi7zq9axbmJ80wgMYlZ72acEPiQz4a4Rjcdl/mxqdHR6qpEQZcGWxNGMML/+hDW2oigch7kQ3+X1rODadLKDq+2ZgiGvTbOHM7urVa+RHoN8Tdzc1y0Sr9KPIP563LhRJJGgYzRb/F5Q12w6aglVuLrXR3HRCiNm1O078ViyvgjfpD+guaCe3f6ik9+Is2C/tkFvx7qgFeqdFU5FIagvBssFhFW5H3YIwm1f/3gE7h3uOyO6tXwdu9upohta1LJY/iQS+9JfleIMWsv+0aO8jVzz4KdgOROKE2SfmTWzP/mvZBGcp8nggwh6Pmn1KkfBXo1wJR1j7Ja2zRjPt7ftUU5oZKxbL892W8XaFCeDfOwMRvkzvuwHJCgZtqoeRFkqbsi8m/azvZiXPOevhKByFMEFofKoCQS0Y0pXDGGvpiJo86qSdQ4ws2DCxRyF8WinFnLbRqbWJVrYYXu0aVEraJNuMLiE9CEmQJ7HOKatl5SywVnznbqM6E7vyLmjygCrnTXLbUQ+F1+uUMjecEOySBa1kfQPDxmwjV4eB7SAN56GZxKxDrV/CpFaEVuFLYlL4HugwH4sIMjsaaFmvRnUup0BlQUrUNyg4IauCcypy2PzvmjXbDe685QAoueX8nXKyU742jy42qK3nchUyGxKbKifSDfQUW01xLN86RSrA+eiDMKW3IRX3lNZyzWE0AZ1kuuiap8yM X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7095.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39850400004)(346002)(136003)(366004)(376002)(396003)(66476007)(66556008)(36756003)(5660300002)(44832011)(66946007)(6916009)(316002)(86362001)(8676002)(6512007)(52116002)(6666004)(83380400001)(26005)(478600001)(6486002)(4326008)(38100700002)(38350700002)(2906002)(186003)(2616005)(1076003)(41300700001)(6506007)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vRFXf/pID4JlhgzUjruyZKWjx4o9z7YPf+3rmLY8uZWdQwl1g6TynPYVeH7cl6xo4YjZBQMYn2sYEA/uQfG6nHc2tAJAwsGcamIAnKQUH64GMj+5fVq6npwvy/ijIzOBhKUnLKcTenhpFbgJ6E4mNbSTHEYXI/yiagj1lV4EjOAXoLwbnJ3Ht2cY69azubK5atBfHvN3ptu9AT8IvJ8C4GwCn9RlCEY55p5mrRqlQdzZ4icAY7gw9b9PTNprdreAzfX0RAReKxlRSp2k3BfJigsfR6n337n3rWHplcmxTrN7HNmGdUhE2WhrpSc7igjGmuXiz+DJuJV26yoggwwO8TaMtQ3N+sPTTsYpQcCQuUOjVpJGhXWRcmkaS7Eah3hi3wBbMuEw7suvLwZ3gpZUypDEBVskvJVkevPkN7GzkxRPjJ6lqi8vZPOlOq7mo7QsCIOVkj5gssegFKm8XdU7qv3RNEhs2ZQSaW/IAL8fkcWzzCrKmSDmL+Dei8OVw68gcEulJHwplhOz0uqcja3PFv1/Gf0NagcztgnZ9HywoHNc6lRk1/Qhywxij0e6BA50BGolxMsPrO/RBncnyaCiK1ZvLb87eqabfFf7ah7MYMn7w8IXjQSjusMy5sYvnoEI1BkCPiUbQ+nEQDhy9Tykhg8yfBrA7N5R5xYD4xZjSlFV5ssqPpCaoVG0QoLtWZtCUkM8Lacwr1FQog5bktMyRjh4OkPg1H4bIeTE2lmEDODN+QBPiciQBDlEK8rK+UiuFdebayL/oO0MWycOhpqv5HRqp2MHiqyN11DtafD+wVstXqxArYUztMhOsL0VqokGL9dtA2MRoXTOmwp44fS7KhzZFf6e26+IVyD910UoOT/b42QAeYRpMrSQeTFKAAgZJQz75TzP5q79qxLsrm3duQiaNpUPd4DowpwyNUkmlPJcGL1ifP/z+6jnc95KyWZN0tdGBNTDNJnrdfIxpXhnQUQYR5gvUNR12uHMpN63uCo+yEHWeKELt7L3tFsnMuz+4IGLinmmWwpUfip6Gqe4sitPN6zUDCOa9nglVfJceEG/oWZZ7OmSqkClOBQmTRPlYQ4wMfnHLExusDRVHF3HeJSZ+U9vjyd6AJrshd0yKDg0P3Dx7TzGpCEnMkv92EFXZCc8T4Dd50cZ6ypRHSnqeVwiDGpxGSvQJLCFNkwzzpQbMEsDc9CUHE7izr4L6COPTOlbsd9QTEJpfK/FM9OdqizU6vwQZ0zeJF/0qDUYVtpklxpM7SuuEAuIJpwRgReIQKANv3yiUyNRa/T/U6KcnABycLuKRsMBK7epSdijiOOBVtKfH2Z8HeDBPokkVEwi4um/6pw3UMlvF1cHKkhrZkzp+CLRr760gOvyvKfUOS8j7zlxZr6HRJuyCtkgbq9nw65wJbezsAdk+urblOEXthwmZl0b/PcgCReIKYz54Di4kKgtYm0axnjYTuPUY0/tghZkMUz0z8XiIv74uYCArKg2orVEFF1AA8BTKwgNqbva4LKHKskR3m2qPUzC02MrwrZM/PctmHL3Mt0lnWxLi1e8zfaAwBifQ05/yt/FkF3ToPcp6vXmSZ9os8xsK920j7xUjRU9M/6Kh8KDoZ2eewBDvar8fMrQmai/4nQ8DT8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a57970a9-57f2-4f11-aabd-08da8068b9dc X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7095.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 15:54:11.0496 (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: yPrFG9YJ39WciUF9GqAUsFxWZqSWZvmJ3x9KQ6c3wdf5KOFKIBiODJGvsXM8UidXE4FBswCq2DkR+VFfNyhfN/AQDEWe0xQZdQZk+2TMGqA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6783 Received-SPF: pass client-ip=40.107.6.98; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The BDRVParallelsState structure contains data_end field that is measured in sectors. In parallels_open() initially this field is set by data_off field from parallels image header. According to the parallels format documentation, data_off field contains an offset, in sectors, from the start of the file to the start of the data area. For "WithoutFreeSpace" images: if data_off is zero, the offset is calculated as the end of the BAT table plus some padding to ensure sector size alignment. The parallels_open() function has code for handling zero value in data_off, but in the result data_end contains the offset in bytes. Replace the alignment to sector size by division by sector size. Signed-off-by: Alexander Ivanov --- block/parallels.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/parallels.c b/block/parallels.c index c42c955075..ce04a4da71 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -850,7 +850,8 @@ static int parallels_open(BlockDriverState *bs, QDict *options, int flags, } s->data_end = le32_to_cpu(ph.data_off); if (s->data_end == 0) { - s->data_end = ROUND_UP(bat_entry_off(s->bat_size), BDRV_SECTOR_SIZE); + s->data_end = DIV_ROUND_UP(bat_entry_off(s->bat_size), + BDRV_SECTOR_SIZE); } if (s->data_end < s->header_size) { /* there is not enough unused space to fit to block align between BAT From patchwork Wed Aug 17 15:53:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 12946178 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 83ECAC25B08 for ; Wed, 17 Aug 2022 15:57:22 +0000 (UTC) Received: from localhost ([::1]:59054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLQ1-0002Nh-9C for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 11:57:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLN8-0006fB-H7; Wed, 17 Aug 2022 11:54:22 -0400 Received: from mail-eopbgr60098.outbound.protection.outlook.com ([40.107.6.98]:6277 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 1oOLN6-0001Kk-SK; Wed, 17 Aug 2022 11:54:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ehnu1VaxJZmV1g527XMi5t04TmK6ky08tulmu8kNFFbT3WqwLpKNdtf0PN8eIAw2nfPrOeKRKfWKvtR5/oxaCcas0P0TzIY0V2hnfvhYAMZPJb9t51VsSU0G/qPdzt/o+dHKHrUyGR/P0PJlIn0YQEZgiwP6Et/txl80JzeESmtuShKZwCALqscEr/OzeLblZ4mLVU6fVZRARd00750Pee40SKn2m0yttodbqUI+HmoBFJXgEx8MSHZJyVFxJUmmLvMXN6PVhZwCgAp3bO97D+53H0r+MPCOcTv7l/bZVGeoI+VKqz7yZ/4qgjiUdvuL1/TO6Wl4eEN6aQ4bUFk4jQ== 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=PD4nza3ucLUn2Vc1fnExtoFoGv04/vpL0DlNmzvipaI=; b=WRuWXKR8J7tWPUCewhIrtPeqrJYtAz8yS5Whm516RN1flzs2z9JYhRVAaZvavtEDmJnJP5XJZkAGKFNv3+L6OSGghQ9ZDHdTFf/iWz2YHiyKXvG992kotobhq1dPMVf/6k8Zw92oWtLHvdZnvdefWNOPt27Ye9Mx2ZZy874+RpKX7FQqEfx6WA94UphndQMEitlP51FTuGugIIkOkAArGrUQjyzeNmbfVwE/SYaUCuBdnZLwxoSZagMrf1UFxNeJ9pUzHeMHLuZ1nMRNfz2x5aF4zSudfVXneOtiG4RVngVX0L9BQXc5Wd6drwr0nDpD1A4F3lEnkOVlfm3+b3pvGw== 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=PD4nza3ucLUn2Vc1fnExtoFoGv04/vpL0DlNmzvipaI=; b=KxBGuvt8CiDa5HOef8PnVz2SwyNcew4YQgZt9YiYqadAmxlzyGK0f3fRU5BRhqQQ1J5sWDCrj2OBX+zAjhVNPGoY0HOZIP4vTwk/wRmEMKj+oBUJ0Bct9Ma59LApyw2bQU34mdLy/Scygps18oc3lDUPYQYQoTGU54kdU4S7RJ6OSCjhLb0ppFk/F+OZhOFGT80Ftegp+safeJ3QZseiDpnfPF9HkmmsGpuBonwa216z4/OsAaGR4rnZfEGovTi805nKQJu+Tjq03Ty395R0nXAo3yNe3wZVofmjW9ztJiWyEu3+nbSvzUJbNsu5tQVSbOqb+ugWUFRet0TveyDOCg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) by PAXPR08MB6783.eurprd08.prod.outlook.com (2603:10a6:102:131::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Wed, 17 Aug 2022 15:54:11 +0000 Received: from AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2]) by AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2%6]) with mapi id 15.20.5504.028; Wed, 17 Aug 2022 15:54:11 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 03/10] parallels: Create parallels_handle_leak() to truncate excess clusters Date: Wed, 17 Aug 2022 17:53:54 +0200 Message-Id: <20220817155401.2045492-4-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> References: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR0P281CA0111.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a8::12) To AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0119452e-3104-4063-5a3a-08da8068ba43 X-MS-TrafficTypeDiagnostic: PAXPR08MB6783:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8bKqPEw1FStnPMSQMYJkeILpiq72HHt1+cya2Aosb2jaWTVTgmvv889n1KHToIsvKveFkHZqXybxz3P2Q1l+MiI+Ovk+sXBAYRdGTjvPm1v7UNgxLb/ygU3EWOgi+zil0WWIoLo4gF95+UAXv875rksVsBvs7Wy5tvpDCyfo/RXLaNVQKtPUPmKBZ3aRMd6nH1Qv5BtipI99zap/vhnSf80r77Ax+ZMjg8gUR1Bw4sOT8ZlzYbDXlIjT73qWG9LnVWy1cHLTUuQlFurDO/s0fAsEcraYBZRJz8sdPHVf593M5M4+bJMBIMeMXwi29ORtl0/Pn3nIcuoup2swUVVLzmwiI5mS6nEffDw3xmrljlhlmqHRnOgH0VmpZ8p3UJJSCcRZWwpw8dYyg26VMOwW8/q1NpAVpckQ+FDIN6U1SMmTelxgZAZfKYeu3k1ICkTHezbQqYoR3C1Jb5Ub6KWSFSHvjHrUSYJ/+N3FjhHypv5JPOdRkcJS+8xMXTowMDEYCQjDt9QY/Pgn2iiaXKqDrMxteRraEJeC/YYgfXWBwOYHY62J/sHPbOnhBbRWwtJbGuxI9UbDp3znCe7R7JHM9qnO5nky9IQv7xBq2g81XmvaWIT1bnrbIxBUl4RinD3MotxcsrqCcBzrlQAU4pV6peB2mVtNsXl8pq33ibrIp0olmpNYD376HEePTvia2XDn3a5bkq9jFtMBZKZizKly0bK03RWggkDbnPeV3C1Ppn639k8KXU26mk4qfsy3km6SP/QjfjUXYzcQy+QCPS8NXSoEp3tkYE9smf/9Z3xwYd1uM2r4Xib0RnBLXxts6ydp X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7095.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39850400004)(346002)(136003)(366004)(376002)(396003)(66476007)(66556008)(36756003)(5660300002)(44832011)(66946007)(6916009)(316002)(86362001)(8676002)(6512007)(52116002)(6666004)(83380400001)(26005)(478600001)(6486002)(4326008)(38100700002)(38350700002)(2906002)(186003)(2616005)(1076003)(41300700001)(6506007)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I7K8gUKGRUdxL1xQAT3R9QsrH5lZKlmPmACpHkwX0WVVZQgysMCcoP+DqIYwm5yvRAYmiKSNH6XJvQNdrovFv55SkJbp7sU7iNyH7ujNFzkg4ZfN7t9mt9fkVD2zBOVF3Ep2EHBumSnVijklVf6dJGuOsvxSnh0SE/kMW4lbq5j3SDegyRafloWOIhW3p+iJp8ZzdcIN7xaXUsilv3SUibHl4mWDX52RJjpyX2iWUNevmo9sIsTrqMZhwET0o4QCUoUaygPkIzY7qVRHZlozu9OfsCiCCHlspUHyK7J1GyaZqHSv3TYzytuki7NMJGDmAGhiVO+8Pki+9woK+p8a/juOaeT7l7NYkn9z7BDRBMIldgqTV3W+61zI4eumbiHTO+mkYvA/TnKwj2daD8t5uBxXsFBZPHVKK8s4eH0M1pngPjoOrEGRfV0EeTl8WTI3SNgtRcvxwsL3D33FrHjKi2PYUzV1xAKOpPpWeNLfeMDD/zA7FKynWJm9qYyfUogXtqSAuuSZpRF6uxwFHvFa9iT3m7+C3uKOW+76m5mmBGrWkJv35DP6PVEfHvL+8TnMrXxzRTkStxBXFHY3sxMlvkRQPwQv+IIemo38wQuJT6jM80s+GrKCdr/Se2qYEePK6CSQI0v5D/GUIvXcZ9L7UDVJPM30aezz8k0Sg2we62Wea4fSbI4I+gI86ugqyf6OdCZmoI2cdOiT5YW6SeeqF5dHarUeNaXAfaVbAx4y9LHVwhLQBcv9fAnwTWZuk/kjI9bF2+QTASV2a/TEn+DsNVSsvm5y6QTQYEadNpj9eW1XcrIbfENwtz419wfDJ9lzVbE2sLeF37BK1jVhwGh4fdPm9CdX5nVfFxzwramlxwuryulM+wonvvWWvdG+iK0whHZgn9GViM9heKOKaPrYAgo4fMKZ2WWiDxLCMZ+qam62tDEgPgZzaVRFv8H1ocggV1ZcsMm/1NAHXgWBAHkdBNV6yMwujI9u7sBSwf9pGXzhSsCdoMoUG2afYfITqyI+QZ1yzNOtvMuoOodObyFAgvF8IDZkAl53SP4O/zxsZcuNRIRjPUNJWl91Jhy8tfZLh/JJkOt6E0kmcHUyrrhgNZlMRfG2r7QJQiro5GbVENvtX2+qotEjHThtigmWs4osLBLgO1LgK/05Ayougle4NTlLoFbb4JuDhUylb4Y4LgxWTkOm8urQoZ8ey3IGfPEuYlUVI+L8CofjlZCwEkPXN+/EJPfny01Cnv3kDsLSoRhTPpyFULweifbsYOBV/hdjE8ViwLuY/KkqmfEHunb0l0eZ7yj7uogukm/Yu1Ybiyj3TfaoqYbHnc6IqpUdbC7K77oEUI0Su2/ceXjB+z2FEHnCf4aXoR/nbJ2bwJ6iXD0yRAe1M+UqukinTQMypWBIbXEke6HviEeGRWZ38uEe/ZBQeI7Zookoa4d9oyhxYxYI6p21xXLSVGFKabWC2qU9fALthaWHyMGldAJqjT396IMQaF9fvwM9mXbf6gMb8SgbvURZXMZH1vT8HkujBkb7LtLArerQOGnmfTgoujlZO2qkBmt08VzOtD3pGsSI8zGZmVyoIE2NdzzMBJmYHYPddHIaUhe/h5BkyAayi7BOmEA6L3ZRiEQD5gaUXvgO7Rg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0119452e-3104-4063-5a3a-08da8068ba43 X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7095.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 15:54:11.7526 (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: suPgbuh/le63raWmKdHBaA0E9vjdui7SH1EPSu44DKV49WX+jF/b3g26AClGCgRYU3BZskTkqk0RuQw3Czk60P3TzSHQkv/J6us4z+F5nDs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6783 Received-SPF: pass client-ip=40.107.6.98; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" This helper will be reused in the next patch for duplications check. Signed-off-by: Alexander Ivanov --- block/parallels.c | 83 ++++++++++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 30 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index ce04a4da71..eba064247a 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -469,19 +469,48 @@ static int parallels_check_outside_image(BlockDriverState *bs, return 0; } +static int64_t parallels_handle_leak(BlockDriverState *bs, + BdrvCheckResult *res, + int64_t high_off, + bool fix) +{ + BDRVParallelsState *s = bs->opaque; + int64_t size; + int ret; + + size = bdrv_getlength(bs->file->bs); + if (size < 0) { + return size; + } + + res->image_end_offset = high_off + s->cluster_size; + if (size <= res->image_end_offset) { + return 0; + } + + if (fix) { + 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_truncate(bs->file, res->image_end_offset, true, + PREALLOC_MODE_OFF, 0, &local_err); + if (ret < 0) { + error_report_err(local_err); + return ret; + } + } + return size - res->image_end_offset; +} + static int parallels_check_leak(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix) { BDRVParallelsState *s = bs->opaque; - int64_t size, off, high_off, count; - int i, ret; - - size = bdrv_getlength(bs->file->bs); - if (size < 0) { - res->check_errors++; - return size; - } + int64_t off, high_off, count, cut_out; + int i; high_off = 0; for (i = 0; i < s->bat_size; i++) { @@ -491,30 +520,24 @@ static int parallels_check_leak(BlockDriverState *bs, } } - res->image_end_offset = high_off + s->cluster_size; - if (size > res->image_end_offset) { - count = DIV_ROUND_UP(size - res->image_end_offset, s->cluster_size); - 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; + cut_out = parallels_handle_leak(bs, res, high_off, fix & BDRV_FIX_LEAKS); + if (cut_out < 0) { + res->check_errors++; + return cut_out; + } + if (cut_out == 0) { + return 0; + } - /* - * In order to really repair the image, we must shrink it. - * That means we have to pass exact=true. - */ - ret = bdrv_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; - } - res->leaks_fixed += count; - } + count = DIV_ROUND_UP(cut_out, s->cluster_size); + fprintf(stderr, "%s space leaked at the end of the image %" PRId64 "\n", + fix & BDRV_FIX_LEAKS ? "Repairing" : "ERROR", cut_out); + + res->leaks += count; + if (fix & BDRV_FIX_LEAKS) { + res->leaks_fixed += count; } + return 0; } From patchwork Wed Aug 17 15:53:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 12946180 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 7D1ABC25B08 for ; Wed, 17 Aug 2022 15:59:32 +0000 (UTC) Received: from localhost ([::1]:59992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLS7-0006zD-Js for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 11:59:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLNA-0006oF-Vx; Wed, 17 Aug 2022 11:54:25 -0400 Received: from mail-eopbgr60098.outbound.protection.outlook.com ([40.107.6.98]:6277 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 1oOLN9-0001Kk-5B; Wed, 17 Aug 2022 11:54:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Enx64UbdmPrFP/cdlgSFPk6WHTKV8c9qSGKm04ec0XvkZ2wIBHDrTfJgYKufAO5E/8rVLnU6UwHV/gYHQqxStcVw87yzYkcQgvveaGWuBWjn9YyUyvzEEeb4JwgTf1RZgduNeqVVoz6VzrtQAkdmT2Goju7etPyFwUzhZeXU3LVHR8JLyqdJNWZlPSer6qmRujqjYH2KS5qwA84G/87ffelNOefW9GUnllloob7yOCmQfzmlsWHLA3gFpDvaH6k1C2ASzY8zCbKy4/Pin9+Sa29XUcIHJwEKCaAl5qe2W8H/jLwCTBh+H3rDe3R6eaSkFhCx6kCx2fGNsvIQFlc/Dw== 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=+sIzwjz4l/3PAnNA05/8DZ2l9Vu+py+GBj4HIzSBoh8=; b=crMqujKaUWXMBt0LwDWISQ4B55Hv1AWKHTAeoP4foYOe3UBEFXAaIyOELzEOnCas0UIGpqHwXsqGjlOrC07bzmfuvmgkus24r5uZAd4/ChdmoTSev9Fv5uhqpUfyHo/al7ckKF+dxF9Z5UO0rQTep5clzDuJciyYp5oynatPmxKUR2/kFV1rzvJRSBIdUScgWalq+G43YYUj9T+xsE2nB8SbuAkzocMSv9GJGXaWJ8aDRyl32myP0k359c6u8KCgPYAiUeNbzsaXwd3vcnFDAguWzcf/0mdTduJdq0wDOX2je0Clg4yZEQnkysEwULjacIBI24DsR0H14mmVN31C4g== 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=+sIzwjz4l/3PAnNA05/8DZ2l9Vu+py+GBj4HIzSBoh8=; b=lFRB+wxlGqt1YE0Rl/LivsNWUsZpddNQ5FMnFGTJpkTrxRNr0oxgYb33YKRqomqzbcq1T+Sw3a3IPkZGTb6WWXloh6lo0EDw5aCmCCwIUUWEXnzddEo0hvV+Xb6jzxxh6DxSngjWnPGMG+L9P7d1eQcQ38bK0QWB2NA/q+ES0QQ4vp7CMYhFEGHsqGPkSJvHtefqkpZniQ3rtbKa+rErJIKHtBKj16VeoBEMHXfYe7IEbkoTiOZhtb+AbRlpwb1yXq91tGwSK+3tt/TflIl47J8CElyvIGk29IkwpeDnRf4Vb/DBpRB0+D5I1QPDa0/2eac3na9mp3MB9j21CWrxxA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) by PAXPR08MB6783.eurprd08.prod.outlook.com (2603:10a6:102:131::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Wed, 17 Aug 2022 15:54:12 +0000 Received: from AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2]) by AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2%6]) with mapi id 15.20.5504.028; Wed, 17 Aug 2022 15:54:12 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 04/10] parallels: Add checking and repairing duplicate offsets in BAT Date: Wed, 17 Aug 2022 17:53:55 +0200 Message-Id: <20220817155401.2045492-5-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> References: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR0P281CA0111.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a8::12) To AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a75320e2-3fb8-4a55-bb27-08da8068bac6 X-MS-TrafficTypeDiagnostic: PAXPR08MB6783:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FSx6OmEx5A2fIL2VGOWQK3lOvItUHjRkSaOted+k9wE3Ah+gEhtUfvNJNvu8xdcMR0b9t8sGvA+OCWb0jgxVcb+b9U/OgIUB6tSy6VFG42hNLfHS9sFyZmYr+EPVMfC3ghPQI5DlSV7W+MEk7mQhcLrIASYkcKCSndhKUWD4MG9VAMRULcRWdWfEyGXTJezC3iZz0LX4AYWv0l8bjQfw5WkAL0xFqr0R/cHbU5dz/0KJGDuhmDg++EFHC3IUKeGiXx7vKeY0Og/TvPPQR3tbpJcpUbK3M6QmZmyUTLcrAtyFCZF9nVyB6GdKCQT13rwvRdRQr0QR+Gp6dkDf3QTqEHgJ5QPUiSe8NucjSuk7V2d6gU2r7EyTzDg4+E9InjTEitGeUikbhLISxwGAQrEGfm/KJk5+CZr0Thfmg8s1CZXcYvWk0IfAlkIyPbiNGvKCE3ZP7FDkwkV79sk9PTNhdxLfDXzKjMpVVcWIxHwRihpMe8La3Fch60/ZshBgYWg7RS+XaU4F/qlIQtOCb2e6Ty0ftNuId+y0xn4EQ6vCuidw/Fzg16pSyrMzTYJFhb3TLrGu1WkmH7tFevIxaAKKFcLUYX7dex7RA28qg2hWJJWxNJoiPU+4o9n+1GEjW6WlpwWoHs0bIXi7tdeoA03HVj5CUyOolJHdVrVA0UXdYHg3EP3Q6uO/DW525ruPvAnPlDWuOYymrOSEusItSwpHw1jxnZUL3+M2PbVV5sf/s0Aa6DlSVCa6woRk7xpzXIv8LuBlGvlVGBXxDRCq/dpHcqUYKwSZM8PtVo9revVrRgl/yFXD2VmO7EM4F2epV4w6 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7095.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39850400004)(346002)(136003)(366004)(376002)(396003)(66476007)(66556008)(36756003)(5660300002)(44832011)(66946007)(6916009)(316002)(86362001)(8676002)(6512007)(52116002)(6666004)(83380400001)(26005)(478600001)(6486002)(4326008)(38100700002)(38350700002)(2906002)(186003)(2616005)(1076003)(41300700001)(6506007)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oO/7NLZDGNYCYQUiMIqGb5rQ9KK7LvPxCKLWkCidcdijHP8U1TwnTB+pcoXFRsUXRLgtNlBS8Lty1RIdNcZb0VUsH7BrMvV4oXAGB+2QqFUYtbltmcrwDKdiRfkuMmF7vuIAZ6mTBi4QEQken23pZJ4+XGeiuzoHV5muis1u7AAb3BKDWM1hsMcsKMTTeLzpUI7+EGR0tSbV3BQB9Tv/erRxXooV2uZBNqTDOipGQT95U4W4CyYZamJtMVnmUoujWePDsKdpCVO0AsVMwNY4pncEsZyk3sTxVUSlok7sIdJMRXUsaGNVRJHt8QqhD91Po4zT3533Fe+7SSA/MjSrwBXSuK5/IRIullFpi5paRHAuEuJAnHdjwsYmJ4K73VOa6jZauQZgeQpVJx1YLxZTTJTrLlzOOrMuykXU6CnKFxCcutTaM9mq5Yc2W+jVYSbZPkOa9FNSz8zXLxfUObmA/tYW4SbkzG5Myv8SQBEzK1+bBAtMGDqxEPtICsfHZqv8FlE0EjDfu4D+9EkZc43rLvu8gxuLiXhpGfKuxyq0O2ZTw7X1+fQeFtz52J4GDEW8YoR6SU8t9OexqnJaUQhppHJ/2lfZjPODr5cF4E/1Va7bjw5uEZwHPgp4bpx2yXCGPb6aMssyZ00SOqfJ0mHWY4CQjtX7Jpy+KATxg78Tmzom53jMP0rxNuH/wc/CYXYoirsb47/exWlvkI64vnXJhVhjxsGOROWkcSpg+GCVzftwINyusC/S43RnfLjcQaRIwZ+lcCJ1MWufWdSBiHDpdqb7bF704kChz75irWyrHm3LdTQUI7uhhUCaLJEudSERMTPpfnNMqPxxjit/88So++5p4HHLjsqRBLLmlvhdKl9yFk4mbA6Rtu1dYzG+cB2plzuSOkVfMXxCLDuY7YosxIl/nLZfKXy8BHnQpyPRH/7/OKZhmwcoxmNSYaDaJgAWhc1xwdODK1mTYaWQYB+Alj/mo3nFVQ0iJGaOnwfCmGyyCBGcFh6FE0K0Qnx3fHik6rNzuw5bUSr89HEuRCwq8U7yEP/ktgUUP3JokE8j5+NqH13oE1B0o2/IxCQQDGCc5/LGUGK8qGYgm5bC/zYolN675cJE/CBFuEJeYzd1Y5yv+SPg0JG5jOijK3rS8o2vWOIZQpCNlz/r3nD2/S7skYJPH9OVvH7umIbEb303fEqYgqEw+ZiqTq3FI2a3LWp3RPZZ2Rwhbi2mv5Vx3t4VBoS4j0W1BhLyhqmgBim2PHEXyeQ+6d5K6b4t0XbJ3ibak00VvasmlBYjI2SmfPIAKShynBJfXPujOmunmHAeaMzLV2p0TG4gSiP4HpI0FFOP3veYFCIabrYMVOXRLR6/EIhbgHfXiP/LhS0xtB19AZgMyEuDLnshqzQW836i8Wa481dtLBkhQ8H5n9jGlmsx5wnsdgtKEfbyN9FjwqwgNtqgYOuMymTHuJDDh6z6TbvcfK+6Gml72TCNnsSMib8TACSPpEDo/cW+4SxZyUWiiZ1/UaQVJQwDdtNBJfr03So6uliVXUvcU3nh0thxEE3OGbuiDRk0WROhXkPBK8E91jKHXlufxRofxw7tMN/AByElGy6wrDb0rl9mO6tcEk9yaf6Ss3hNod/czO5lDBWCJfk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a75320e2-3fb8-4a55-bb27-08da8068bac6 X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7095.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 15:54:12.5980 (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: AsLWjvB5KScMFE4wpSg5xidHWPxNXq7AvuthKYcyCuG2cc33SoPnffWEtlit8FGGjsrMPhU7ZsR5qKmVWYZBcYUFmr/hdgJadq2zQYc1xIU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6783 Received-SPF: pass client-ip=40.107.6.98; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Cluster offsets must be unique among all BAT entries. Find duplicate offsets in the BAT. If a duplicated offset is found fix it by copying the content of the relevant cluster to a new allocated cluster and set the new cluster offset to the duplicated entry. Add host_cluster_index() helper to deduplicate the code. Add highest_offset() helper. It will be used for code deduplication in the next patch. Signed-off-by: Alexander Ivanov --- block/parallels.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/block/parallels.c b/block/parallels.c index eba064247a..bd129f44fa 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -136,6 +136,26 @@ static int cluster_remainder(BDRVParallelsState *s, int64_t sector_num, return MIN(nb_sectors, ret); } +static uint32_t host_cluster_index(BDRVParallelsState *s, int64_t off) +{ + off -= s->header->data_off << BDRV_SECTOR_BITS; + return off / s->cluster_size; +} + +static int64_t highest_offset(BDRVParallelsState *s) +{ + int64_t off, high_off = 0; + int i; + + for (i = 0; i < s->bat_size; i++) { + off = bat2sect(s, i) << BDRV_SECTOR_BITS; + if (off > high_off) { + high_off = off; + } + } + return high_off; +} + static int64_t block_status(BDRVParallelsState *s, int64_t sector_num, int nb_sectors, int *pnum) { @@ -541,6 +561,114 @@ static int parallels_check_leak(BlockDriverState *bs, return 0; } +static int parallels_check_duplicate(BlockDriverState *bs, + BdrvCheckResult *res, + BdrvCheckMode fix) +{ + BDRVParallelsState *s = bs->opaque; + QEMUIOVector qiov; + int64_t off, high_off, sector; + unsigned long *bitmap; + uint32_t i, bitmap_size, cluster_index; + int n, ret = 0; + uint64_t *buf = NULL; + bool new_allocations = false; + + high_off = highest_offset(s); + if (high_off == 0) { + return 0; + } + + /* + * Create a bitmap of used clusters. + * If a bit is set, there is a BAT entry pointing to this cluster. + * Loop through the BAT entrues, check bits relevant to an entry offset. + * If bit is set, this entry is duplicated. Otherwise set the bit. + */ + bitmap_size = host_cluster_index(s, high_off) + 1; + bitmap = bitmap_new(bitmap_size); + + buf = g_malloc(s->cluster_size); + qemu_iovec_init(&qiov, 0); + qemu_iovec_add(&qiov, buf, s->cluster_size); + + for (i = 0; i < s->bat_size; i++) { + off = bat2sect(s, i) << BDRV_SECTOR_BITS; + if (off == 0) { + continue; + } + + cluster_index = host_cluster_index(s, off); + if (test_bit(cluster_index, bitmap)) { + /* this cluster duplicates another one */ + fprintf(stderr, + "%s duplicate offset in BAT entry %u\n", + fix & BDRV_FIX_ERRORS ? "Repairing" : "ERROR", i); + + res->corruptions++; + + if (fix & BDRV_FIX_ERRORS) { + /* + * Reset the entry and allocate a new cluster + * for the relevant guest offset. In this way we let + * the lower layer to place the new cluster properly. + * Copy the original cluster to the allocated one. + */ + parallels_set_bat_entry(s, i, 0); + + ret = bdrv_pread(bs->file, off, s->cluster_size, buf, 0); + if (ret < 0) { + res->check_errors++; + goto out; + } + + sector = (i * s->cluster_size) >> BDRV_SECTOR_BITS; + off = allocate_clusters(bs, sector, s->tracks, &n); + if (off < 0) { + res->check_errors++; + ret = off; + goto out; + } + off <<= BDRV_SECTOR_BITS; + if (off > high_off) { + high_off = off; + } + + ret = bdrv_co_pwritev(bs->file, off, s->cluster_size, &qiov, 0); + if (ret < 0) { + res->check_errors++; + goto out; + } + + new_allocations = true; + res->corruptions_fixed++; + } + + } else { + bitmap_set(bitmap, cluster_index, 1); + } + } + + if (new_allocations) { + /* + * When new clusters are allocated, file size increases + * by 128 Mb blocks. We need to truncate the file to the + * right size. + */ + ret = parallels_handle_leak(bs, res, high_off, true); + if (ret < 0) { + res->check_errors++; + goto out; + } + } + +out: + qemu_iovec_destroy(&qiov); + g_free(buf); + g_free(bitmap); + return ret; +} + static void parallels_collect_statistics(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix) @@ -589,6 +717,14 @@ static int coroutine_fn parallels_co_check(BlockDriverState *bs, return ret; } + /* This checks only for "WithouFreSpacExt" format */ + if (!memcmp(s->header->magic, HEADER_MAGIC2, 16)) { + ret = parallels_check_duplicate(bs, res, fix); + if (ret < 0) { + return ret; + } + } + parallels_collect_statistics(bs, res, fix); } From patchwork Wed Aug 17 15:53:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 12946192 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 C14A8C32771 for ; Wed, 17 Aug 2022 16:08:29 +0000 (UTC) Received: from localhost ([::1]:56224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLam-000633-Fn for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 12:08:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLNB-0006oH-03; Wed, 17 Aug 2022 11:54:25 -0400 Received: from mail-eopbgr60132.outbound.protection.outlook.com ([40.107.6.132]:65374 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 1oOLN9-0001M7-Ez; Wed, 17 Aug 2022 11:54:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JhUWjkMvCdP3SMadAd2kWN+FTGOJguDp2AixRldLYLXo2V2qBe5TfOwImymCIc/9C8e3GPKHN+wvZ6tcUWzWk2zLpMB5aoLtK0aJG5RUiCB5glVRLn24N6NjeKvxvGUQSbOMF++pPkbO23OQY/T3FFKsO/fykGa+8ws76cZXH/0QHSM4zJzcZ25vOh5R5N6QkrwkLviKVEGmWpniE2NVDmPf1SeAYgRrXNekX3xlduZhEcyqt5AzhApPyOJUSjl82+jEY5eZ/prekfzElnbj+hsSZPKg/5Xhsh/VVUh6knWJdTcLNDaIlWZHaS2Q2gOoX3JV5JItYt5r2luYKanA2Q== 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=Xz+DzqXqW919FkRy3ovwPtYiU6BGZbAT4qhL5eD+l8o=; b=ms8cmXaNQ5PCsHsp6OIKySCaJQnrqxeVEQNVkhwgZPFTInJBx553bYrWyIltvbKrxgHcZHD7j5Uw9u7gf8GHwI1TFvngeK+oJyqAwJMV4tWI1kOWmq3OkPp4fn1NJyrqTW1Rkir61iyediQN7UFvAT6Rvh0pYbw75bvaGHFGW8vme8QEMIeNDRA9dxnbUPgAh19keskkk+WtHv1qkMhwTbkqxiPHBHqHr8mnwz1I2wCsQogIjugLm18+qQgLE9cT3jgwNzXNStkE9SSiFNK8NRjfRH3R7xfPf2VxSbSiAECF4EJKtDoIXsiuw5QonC2qeXfaKLBo/xZzXIqlf8BUPg== 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=Xz+DzqXqW919FkRy3ovwPtYiU6BGZbAT4qhL5eD+l8o=; b=OL6G8Zu55aaHEdMkYbJPT5KC0zFrYN/xfdpIrX4/CgRSfpLzXTdjIZtc+2MTdgxplauQw6py2WcHQVqBr5odbT0bFM6FEXQihf3F//hJvmbSoGE8zGI+VuM0UHun2lRt/PFuM0VTWtcMQQulZ1Fb0drS3UjiL8V9X9z4xSlotfIhQ3iBqHqgVevdlYtMl8cC7iKpYD8eKGsNJkCJ3X4S8GoMrk91i8dHdMHk/3tbOj6KLrfhtut8ipYATr8CQkLpZ6sLsZY6vqVSCe0m++gCgXdKQxTG2r7DfxTToclIVVLfMoy6GOdVp0g2qHeGmIX8xcxocueDRq/0jo3LLN8hQw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) by PAXPR08MB6783.eurprd08.prod.outlook.com (2603:10a6:102:131::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Wed, 17 Aug 2022 15:54:13 +0000 Received: from AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2]) by AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2%6]) with mapi id 15.20.5504.028; Wed, 17 Aug 2022 15:54:13 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 05/10] parallels: Use highest_offset() helper in leak check Date: Wed, 17 Aug 2022 17:53:56 +0200 Message-Id: <20220817155401.2045492-6-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> References: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR0P281CA0111.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a8::12) To AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a2408715-a6f3-4bec-f575-08da8068bb36 X-MS-TrafficTypeDiagnostic: PAXPR08MB6783:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GKGDogt9iyzGugtKsszcpPUhhx6X02oyG8fmpTcCjh3w7mKPI11TCS27+H5zwRWFLB2aVgD5DWH8wbkTKmemn2zQGcdAad3GfYvRy3jkJZRLcPjngPqiR4TVjRlWvo4LgpALioHftf5cXFqv44UOB2BppSa9x9GW8dlNnooHb8myAD/y7cqgYg9C8JWNDn3gBxqFRy446Nl4rEPiMK5T0EFe44/7PeiZQ/HFi/Ta9PT00ZDRA95o2DUobyn4RrSzSBfkwPs/N2G03Ic/V3x9e8UtMMHTcuoowYK49rMuuvInKF3hzBSOHB4sqE3yp4KQQRi5LF9r7K8kgpzVgvNWko8Km8RGydzsE+OGlq2qiNhAAFi42h8P1/VZ//WcJH1ZyqutqnBy8+ywPou8XJs3cE8FLaCIXMmqQ/fgGTZzqfCjS387ikYF9NQ/flei+p+6CKr4rk0YfhEFwMY0hMSRj1J6xH0TY77HtCW0Q+iNHGSeHsUx7WFJkha/HuVV4vrhGP+tfYMwUc02A1jZogmljHYuQEfV96BAmU2GrrP/4N1ffHDxTlNMfCw709fq26w/gb7bdKq646h93hNlLggAbjFrTaYNWbV+eiuWTrOkdaSV6U5Hi4T8H79T43Od9CUH5PckjD0JARZOlN1OF6eMZrn57d0kgXy+BimfrKK88pBNZplzv1OKfunuPB2/odGJhS5wKh2xTBI0qe1pbvbwNg7EmjhYnYUeTKgh1S0FN/xedR12zviPcwq1nY1HopkGr+7m69CTD/dYSzv2zAVLV2h+Vb8ErKaAPUJgvLE6dkjbDzFgv6QcrP5xbf7yM8ux X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7095.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39850400004)(346002)(136003)(366004)(376002)(396003)(66476007)(66556008)(36756003)(4744005)(5660300002)(44832011)(66946007)(6916009)(316002)(86362001)(8676002)(6512007)(52116002)(6666004)(83380400001)(26005)(478600001)(6486002)(4326008)(38100700002)(38350700002)(2906002)(186003)(2616005)(1076003)(41300700001)(6506007)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: h+RPygArKXOI9NY7Ff1rHUZmSP04IJ/rPLAMBrU+987yIg+folruKv1lwo8NHL8oJ6/ApfJzsIINUUmOZ7qvzSDhLyc7ybdjQQ0ij14yPJb2OeTUECjYIpvK5u8TS2x2qJ0JvoiL/5CVP4ltm+3Njiecy4L/U55pUaKXpAeGryVQVA4COmDHaTPd4G2eDG7k9NqZElWu948xR9liZuoA0zymwyfnozwlJFydiV5SO1JADp1kF0BH9P3Qc0KBJ8Hf6McjRYJZC6PzGUgSORMDUeFwNgbm0KPg4VIdCYLKbFYwROhwNKtnV53snuPuxmL0YaGJa84SBbz5NABuYQaHchHmHY8/H9MgWbDx05QZJ29l67BDtXmXbp0oGa27/WqbblrkQqLPhxLoXbvc+XZg2cY62KQ7wOpDcGGAnfMDxI4tFY0KsazwiEI47MWml2SoXIfMW2ho/3ILTG+CqT+ZQuM5PcHXAP36wOVyK9wAmqCTaW5iNjQItoooReXRRwsWujJCt6rUktCyDnW6S2+o1b2Etm+8l2a2s8C5gWvagP+WNIZ7KB570Kh8G8NqkTOMoMzPbWeLUeiKpfC5Is2Ha9nFrTlB36o3nrVvairP9wH+xW9Q9VSIadJxxCXrGAGchi1FzxixIV/JhsEZpdCI8s+IRjtsTFkBtZ1kKUgBtlG/KdYLyvfbCkCTzAptmP0RAe53DDz8ixh4d3aHimX/E/YtbJPduzXdnWO6zSaN24+E2w5ZA1xcNqXjPPoGfczpXwLihDva2hdCLHQOeIRWNgFpIJadvORxTrY6+sbH9e9QcICrTjDWSAie3OuWIoOkbcgGtFrqAOI0tKpJXgF87k+CLd7qZKvzZWLQj+nDenrsBLHr7mVh+YQrRuqRPa/cbhKJJ0yPEFpb3S8/L4Y3o7QtQid7Oa9uG6RV4XuyQhd3fvPWNfxPLNjPCbvo2YbTL+xyqWdOXmzZsu7Vo6a/x/Cm25KrTn3bUV2V/gH3+Cx1bl6qjmscBshnFTYwuZ08e8eLzKZdPGMCdJLrd+rYmw2P8m2b9vqeGhUzGrIGDw28N9rlGViHELLjaZJZgrD2XNFGa+sP7A7SAAHHjYN3BqT/XILPAzHxIBJ80q+3OFE2OysrkjzjeArEFs6lDGPy0UkDlj6rCzH7Wt3SzSDpse5lry+ugtUGrs19twYqsUfWYANX8nKJ0LnlN60wDZ3aEg7yS4yBOjflP/mZL2aWr+LanFcbsBM6gGkMDbAeNhpSTy20wBWWhNRa2Xb9lN5wDYO34yMYEkEH8DpFFP+Q3t+M+n8dHfplSD7R6ttLUK69pyd0tunpZYvJy8TKH3NeSJZNXi+70CKJ4mkG0+lkRTJsthNP7H1FnFyPO1XjcoFwfVyD1zyiIGYP2Cg3KM9zBgrfXevDz3RhPtySybWEYoGJwktuT0o4leMfKJBiPc+fIur5+XUlswcBhGyMtxHhgBHevb0CwnvLHJDhVsD2Y0EaHUS9cBnkUAV6+ZLFkENXL3k3/TGCMmolE4kyRrInYJiIlSGsrlZLy+fdBZyuATYzhgAT+xZFhVgxse62YlOkio0CSmfesYck0DfotP3EuI8UTSv21LOHKVZruvz3Cep3FvjgVzWLlmnzWXMQ6Vk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2408715-a6f3-4bec-f575-08da8068bb36 X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7095.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 15:54:13.3492 (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: IfmPoVUruElcCX715wcDkViE2ZfN3tDQ3oMsO35DSTs5+PCZwLDXnt0fDjwiyzZqxcli2EE4swz20uBp3+/zBjMpzC7RxzgU5VqDOKhkzyE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6783 Received-SPF: pass client-ip=40.107.6.132; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Deduplicate code by using highest_offset() helper. Signed-off-by: Alexander Ivanov --- block/parallels.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index bd129f44fa..93d21804f2 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -530,15 +530,8 @@ static int parallels_check_leak(BlockDriverState *bs, { BDRVParallelsState *s = bs->opaque; int64_t off, high_off, count, cut_out; - int i; - high_off = 0; - for (i = 0; i < s->bat_size; i++) { - off = bat2sect(s, i) << BDRV_SECTOR_BITS; - if (off > high_off) { - high_off = off; - } - } + high_off = highest_offset(s); cut_out = parallels_handle_leak(bs, res, high_off, fix & BDRV_FIX_LEAKS); if (cut_out < 0) { From patchwork Wed Aug 17 15:53:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 12946206 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 1BB5AC3F6B0 for ; Wed, 17 Aug 2022 16:13:18 +0000 (UTC) Received: from localhost ([::1]:37058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLfR-00042V-0y for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 12:13:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLND-0006ud-G2; Wed, 17 Aug 2022 11:54:27 -0400 Received: from mail-eopbgr60098.outbound.protection.outlook.com ([40.107.6.98]:6277 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 1oOLNB-0001Kk-Ma; Wed, 17 Aug 2022 11:54:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mNqTWzt97KEtSlRV/1csNvZHg75BvyIb0nJVtHnlaF7aFX0snJHbd+ILCqLcqk9D5Ffww2zs+YpHHvdAJ6BuWwqSNlUN9jGB0O2+eEvL1I2QnQAGiRD0T+unaiQX0bK9loPuTyAGZd3mWqRy66FQ6RWFgWicHYHk0+BVHQbk2gjR+dkiHWRVYPhhj6tbX49kEKCf6kqH5upkz8imJ2aXx12x4IbGViWqRZ2nTNnQKCl7syIFJG43Laf08wX52IJ1PwpY/PzMlhBDCFd8XpI0P4Mk78tQDtQ02njLhX4XkanWxFoxqR9go1KgEd/HHixNOOShqa5y6uHJP/Q84wy+ZQ== 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=RBgGvVKCBrcK1Ig1VxZ2R1dZCAF98IpY11F0Fbuh42k=; b=EM0cLS/tC/dXay6yBW1TGGyoEK/Wv2Ji6nNJL4Cd7gZdrmXVglk8krOM9bFFGfo/LwoRP2kbBJdNfMcvCt/BjIUQxgd9Yvecm62uGMiKJTm2MOFNjYI+4Blf1auZkQKZfNQYuKFp8n4MubAvrjTOc6zWLp8HoY96gfx8qWwnh/o5/f8uV9JKHPimUK1CjxeM0Yi73KTeIJy/f74v7bV+v7g2bD6fIvf1CvA55AgMT/S8bzP6fDa2adUx10lRXHzANQY+bsNCJGb/YkP1WdrPCw7OxRkEmngdqH5QUz2cZpcC9oJGWY5L9SAq/cl24DGTFv+cSM3X6kD4G6z0sMhGAg== 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=RBgGvVKCBrcK1Ig1VxZ2R1dZCAF98IpY11F0Fbuh42k=; b=UppfQWPblhhJ4VOtXZZY2SUUV5Y2lhw3BNLYfy2tJKjWNarOfKTBt6fEo+4nSYap7vHwjBjVYRaoTyXJbBHArCDZHzVJbX0Cvd5hml5e+Fc2aRrugow5p2v7kMpK6iNPe5b7uRgvnbCZe+s9jzwjm1rfYtmN859/KxI8SVMLn5jbceN3D+xcu+ILJihKRvlCTMHdT2zj2dGF/TLQmV4erLm3Pq8dCtX0hsJJlvWiPjHleZZ7B9ElPnbOarj/wiuUXYWko+tkHieDUg+R+BG7co/JsjyK1CSlQ02O4f5XrFalPjg0b5hd2YwLqL8aN9trLYaChijSSNwB/nGhSEL6wg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) by PAXPR08MB6783.eurprd08.prod.outlook.com (2603:10a6:102:131::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Wed, 17 Aug 2022 15:54:14 +0000 Received: from AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2]) by AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2%6]) with mapi id 15.20.5504.028; Wed, 17 Aug 2022 15:54:14 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 06/10] iotests: Add out-of-image check test for parallels format Date: Wed, 17 Aug 2022 17:53:57 +0200 Message-Id: <20220817155401.2045492-7-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> References: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR0P281CA0111.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a8::12) To AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 09488925-1686-4740-1061-08da8068bba9 X-MS-TrafficTypeDiagnostic: PAXPR08MB6783:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g8vk+s2SnvLx3vT6ll01V6ozIsrTb4CZM8sgoZ2KhRg5+g4kNbN45NqsaC7xazOBR9VfOsqY9rATPrODvbFn1S4t/D7MwruPZX+PGkzVVv4KnN8/0dclIWn+Zim7XbU1t0vt2ldnu7DGu/xgpsMmlUuAjtN4NHjWo8Xv5NbdGHx1XDX6T/oXGv4Ch6BDQszu2F/DaBCVfFpmk1gt0W2A6obt2WOClHuYC+hZUIhnGiQKW4EJDRyaKnrVkpR3fg9Xk10YfxwzOO65DxVm0hzUpjQDuIigDdpAtjVfk56SVZuR3WSk8YPBcNQVNfZaPsZkCkMWbGKN0Jmqf3vOKDD4FRAq3dr4+RMsaEsl350+dZ0LOXS7l4Rd69acgWWTiZPXwOjLEFi3BxpQg4pqzHvcm5vSgoQIdui/aqcBHd+H4D/ahKTcpZGP4TcyPyfAa9l/WYCusQaJ0Dmg6tJ6eby6kX64OJ+yeYpfYtnuhZsjhusIA9DO3ASBiPHaeVuZw7l1ALuOeclWHHZD6PzYNmD9D1d0T3+SiMxsvmuoemMRRPunOTwTGR541N4DWF1042xWLx4MvFiD79k1+R73u7A0BufHffbhvXv740m+FNFOrcX76ZbikvkxrzbtwrZuRlKcsXvIgG3VJDnXtSeDbnZRNfvK1Ah64b0SJf65ltj2Fv3JDHT+33lPT8I0jkRD6k/BUUCoMf0B8Qz/1qErAuo1awvZTmVDCvoT5JM949uFXIFIsk6aTgNol4SCoZkyVE14spI1UCgvhvjlVYvg7fqnty+hQykoVzUe1xKPjhcvZKAA9PWkWL4v1FfLIBZFSDEw8WS352a8qk53yKJhmlLOhe4b9FdfVao5i6N3jO6AB6zFP1HSloDLFoCaUM6bkDXB X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7095.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39850400004)(346002)(136003)(366004)(376002)(396003)(66476007)(66556008)(36756003)(5660300002)(44832011)(66946007)(6916009)(316002)(86362001)(8676002)(6512007)(52116002)(6666004)(83380400001)(26005)(478600001)(6486002)(4326008)(38100700002)(38350700002)(2906002)(186003)(2616005)(1076003)(41300700001)(6506007)(8936002)(2004002)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8MTkZ2GOnrkQevTL+wD5b9J9iMA9tOAGCaFAqkUmNXcSZ9eyhyjysGdMP8ifW8fXVG7Sqcd9ki1TuIZBNt3yKzo/BLtcGXhd6atLxM1j1bgRVDv13tv5hbRqD1NQ8miNo4VEgGptm+gaXVz+r371CQwT46LDR4/ESQrgJPcVJ22et3jAED6i5bopIZ1UHckfobtCUL9aCzAtrxQcSk19kG0A9Unexd9FltmZba58eInSU64R38CqY3fas4VRCuFZ2cLqE2j1qq1Pv60fSnniomsjywPi1b+f7Cw22KIwWRW8Es4ZPrhQelkTRM0pMfWuty6VkjaEodD386o/FJZIL5kximyA2jKiTg/saoRZfD/OY4LnoP55CNiY5605GXVlO//t3LCwc5R+qc5UUcOgE++zMOht0CoYDSPQMdh7NgZNqiLDvdb5aS2OChGWn2HhKGIhEUR7ztgT/inFNPYPwsLFK2sKcRQUkVcpTGsk1llluxYspOwtO45r6XRg7NJ0fO1/NCLfGsbZA6ta7mfIv6W+bZM1IoxBsYIPpyF0M+SDhFhP5TthNkRgc2Yhy60oN9M9UmZ8StLXkMsgbsiAqGJtK8CpzThElG4c4Iil/xXbi0lV8a7ZUM2tUvuTNrB6HrQGHUeA1oraTzkVrNqTpDnBtn2lemxtghw/OteGLfGUVlyQi9avwCtOocQgjt8S47CJriI26m1MtMoANTrQHZXAXfFC8yxtKMJ+TcRXdA4+5wrmXPQi6ll4S5fC+2L757Lx6NXQ+JOCD0NktraasowO3K9w/DuS3IwqOr3BCoA8hVYcc7m6v45+9OocHs0xZ39+MYh4dtDO1eL0Kw+J0No1NNubQrUFWcC90ys//dBp56fDYZCu3dWkTpmztIZxTCSfLy/iXTZh2/td15pFhL6/TCuubO9jD0Hsm1MPOMYy2AvBVYUSQCS04tx0iO/coEtNMX2Bbs8+bd0QvHUsDDBM5UAG/l/ELnEHEd7OqtAsufNPzM2gTWBCGKGfjtPyvD9qE1l8iclMa00s7v50s3tjpAM6Qg68+Ghf1r+WJ6TFxXJ/Qv9wBQ/BZoensPn9GljvwwN8aOpr0tBXGVK5WBwt4pYspq//rKPPFU5RbyqU1aFSUZ+ODwHP8fJ3xPgFxezj60JyL4suIKsYrHOD1c9wAsw0KSoKvDkik5hvtzsT+d7Ib5xzPGysxFbeDPFXulGRH3audSFg+xGb1A1WUZBWwLt/Dt6xRo+co7GDRgP4WXN9koDsRp2r6YGfSpFvAf/WtaNAcLSpqaMAWHsMPd633en0l1xe68wNU3YGdu/fnNTdFujzr7/2V0Yg4EGSLghje9j/OkW8k1ZpJYaOJ/rpppn8LtdiZr4p9sU5IUKu1fj+Sm36OookUBCuku2/+ThFvBkSgKr+6IwLmpw5JnECnQkgEjtOuQTBDs8OHKPbwlcZ+0ykOQgf9kNbTwc7rSTqUnjizNEruwfDepTdGeYLuD+uD5F2gx0sIEE/OvZi4zlcrghCjC67JEZ4fI5NaY52eeVhWn1Jya6waTqUu2cntAwCoteXK34G0H3FMEwEw942qR9T+TZu5gkuW6nWBamYAWBACKKJn+0nC4j3g6aa0NltWTvZ5IhZLmYytPQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 09488925-1686-4740-1061-08da8068bba9 X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7095.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 15:54:14.1281 (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: rCRUnitF9MaI0fALfAxT6olrc0vDex7fSmpyVYUUchVCuMbXcU/RsKbeglZnHzYW/LFRO+nDsfWID1cKmKBL48/udtFeDO6cS3yHL2Y65mU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6783 Received-SPF: pass client-ip=40.107.6.98; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Fill the image with a pattern to generate entries in the BAT, set the first BAT entry outside the image, try to read the corrupted image, repair and check for zeroes in the first cluster. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/parallels-checks | 78 +++++++++++++++++++ tests/qemu-iotests/tests/parallels-checks.out | 22 ++++++ 2 files changed, 100 insertions(+) create mode 100755 tests/qemu-iotests/tests/parallels-checks create mode 100644 tests/qemu-iotests/tests/parallels-checks.out diff --git a/tests/qemu-iotests/tests/parallels-checks b/tests/qemu-iotests/tests/parallels-checks new file mode 100755 index 0000000000..5aaadb0c74 --- /dev/null +++ b/tests/qemu-iotests/tests/parallels-checks @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +# group: rw quick +# +# Test qemu-img check for parallels format +# +# Copyright (C) 2022 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 . +# + +# creator +owner=alexander.ivanov@virtuozzo.com + +seq=`basename $0` +echo "QA output created by $seq" + +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ../common.rc +. ../common.filter + +_supported_fmt parallels +_supported_proto file +_supported_os Linux + +SIZE=$((4 * 1024 * 1024)) +IMGFMT=parallels +CLUSTER_SIZE_OFFSET=28 +BAT_OFFSET=64 + +_make_test_img $SIZE + +CLUSTER_SIZE=$(peek_file_le $TEST_IMG $CLUSTER_SIZE_OFFSET 4) +CLUSTER_SIZE=$((CLUSTER_SIZE * 512)) +LAST_CLUSTER_OFF=$((SIZE - CLUSTER_SIZE)) +LAST_CLUSTER=$((LAST_CLUSTER_OFF/CLUSTER_SIZE)) + +echo "== TEST OUT OF IMAGE CHECK ==" + +echo "== write pattern ==" +{ $QEMU_IO -c "write -P 0x11 0 $SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir + +echo "== corrupt image ==" +cluster=$(($LAST_CLUSTER + 2)) +poke_file "$TEST_IMG" "$BAT_OFFSET" "\x$cluster\x00\x00\x00" + +echo "== read corrupted image ==" +{ $QEMU_IO -c "read -P 0x11 0 $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir + +echo "== repair image ==" +_check_test_img -r all + +echo "== read repaired image ==" +{ $QEMU_IO -c "read -P 0x00 0 $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir + + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/tests/parallels-checks.out b/tests/qemu-iotests/tests/parallels-checks.out new file mode 100644 index 0000000000..787851a250 --- /dev/null +++ b/tests/qemu-iotests/tests/parallels-checks.out @@ -0,0 +1,22 @@ +QA output created by parallels-checks +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4194304 +== TEST OUT OF IMAGE CHECK == +== write pattern == +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +== corrupt image == +== read corrupted image == +qemu-io: can't open device TEST_DIR/t.parallels: parallels: Offset in BAT is out of image +== repair image == +Repairing cluster 0 is outside image +The following inconsistencies were found and repaired: + + 0 leaked clusters + 1 corruptions + +Double checking the fixed image now... +No errors were found on the image. +== read repaired image == +read 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +*** done From patchwork Wed Aug 17 15:53:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 12946205 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 72B85C25B08 for ; Wed, 17 Aug 2022 16:13:17 +0000 (UTC) Received: from localhost ([::1]:37056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLfQ-00042E-9U for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 12:13:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLND-0006uK-Dq; Wed, 17 Aug 2022 11:54:27 -0400 Received: from mail-eopbgr60132.outbound.protection.outlook.com ([40.107.6.132]:65374 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 1oOLNB-0001M7-Mb; Wed, 17 Aug 2022 11:54:27 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NApMi7Q3SGnMcpzAY3KtudB5VBM4RvT3L2QqN41kefMm1+QdHJNhjao8mHn75JokAsjgAKgb9euAazL2pNkaB1KZsfMSjvesjQAtFBZkd6LoVsKp/nAjpG7czhsPZLbaK5gd8E4sutK01XIn2MWAqn7DzevB4EnTHknWyiVeSkaff1Sx/p7ytasefajEsu2R4SRJ24u+OYYFxxMO6L0NXQbdDVOgKnjdVCnIKCkCJp9nNEgIr9kJ0lJxRkEEY3N0xntZSgLfXoaKbCpDNpDXx6oCG4fa0UX4GlnX/iWqhrUI+thl6aLpQGSbP1fkud/rnvFEpBL8Hp1reoKOOk9FNQ== 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=Yr9G2ndpvrtYIlDQyw75oWRpBdNTzx0CL+e36ag47VU=; b=gSHdqeY2988TtIvTKtOxx1Nq+rklfsds2xVfmavU8wkTa00H/UxUcuvMhDaLW1kY2PtNssIpEmHiLFVbvpxKSL48kEgIqnBSgyIrdDbZ0WusFmyUDdaLYmwwnNyi5trCDR4toAO1K9L+JdeF2GfAVKdCswcFDIrurzsqMyNxZx9yJgE/roe/11kXVje0w3LQyRRgBTRDHYuPXKm8fywZCAg8lK4A2X9CUGTAS4BkpKMwjlB306fKhOeVl7/RAObi4KO7C1a+EtmPoo89NJ3rYzhrNq2IAQ+67vQPJ4e/8KcdPcgvsZej+rv9s3R26TC4YbnwWgh8+dJGWZE1g6SXaQ== 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=Yr9G2ndpvrtYIlDQyw75oWRpBdNTzx0CL+e36ag47VU=; b=BKGJrqHpSt1xOvC1VRFSuGWk6HWcIOEohBYX6urRWrhnIHUqOfqApp6/4HgVYErdRhKk+FsRY41sX5PfGT0q4Ur0e+2zEk2eftUhbKJjRPZ8zXe0Y+kqrRFzO48YX00eK2nFO+xjz4nDkUXkFDoHUCydz73n0cgOxmRBk9LTEsEoTRJiuyqdMlAQs/4E4AsblixoseILz417FL1VpcRQZ9ecFqukmqI6lYU5H/Pc5cw50LV51KMSHZKt/IfTX9sNabe3vyHraMDlvCEHog5apyxDGKBlt5Z4AVw2sq/7tVuMEoNlri5zJtg8ZxpG684tOArqx+DMRwZBL8xxUTx+Pw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) by PAXPR08MB6783.eurprd08.prod.outlook.com (2603:10a6:102:131::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Wed, 17 Aug 2022 15:54:14 +0000 Received: from AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2]) by AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2%6]) with mapi id 15.20.5504.028; Wed, 17 Aug 2022 15:54:14 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 07/10] iotests: Add leak check test for parallels format Date: Wed, 17 Aug 2022 17:53:58 +0200 Message-Id: <20220817155401.2045492-8-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> References: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR0P281CA0111.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a8::12) To AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ec9d3a23-5540-4766-dbae-08da8068bc1d X-MS-TrafficTypeDiagnostic: PAXPR08MB6783:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 39ANi6ztvOatckWhERvmOY6IygWjhW7WQkruKH8k+/0IiHCyjCE5WA2sT3sY6mmFt1kyEifh7/sYp6rHw50NefFHVmIZPVjEZk3nlMc/h2+GGW9fMhB5iDwFVhRPPwisq2EAuz8QnSBUegb2tWDtT9uIBdoGKVadxBky39xar6lbm2Jbiw97x65DueHuwtSyd4Moya6eikbcD3ZsDus5kDY4w+dMCUhj5kJa7cqoYroDOuN0u/79YMYHR3DJQfaK3QHQ32pkyz2S1saoFauraz1RbrtJsZskqAms9SiXv3sHOjpeFExREckyBti4e0m47D/1+funxv45Ot0VbNlzrN+yE/gafkJ9FBXBss47Pfo+Gc+U6EUOx36GwfFkTmW9+XoLxEj0vcbrMouUWtV7kq+DS3Xs+zp16wJsu3yWMoqjqqwMA7+g4xHVFCLzaczWYXcO0C80tjfckyb90pV5yPb4ZDZX6Lj4LUMLweYlYYjbk5h3bOeN7BpSN8J1dZlP0V5IgCeSj5nkPdBmz/lwLuAXzI0mMuHOWkj4qfgfRcXUaiODEnsuGVriWBPhgfIDo8RENi8hgiFE7cfvLYKMPNqN3q/DEXasSmqGUab8FT6QwR8Ck4s3U4mot0lTdW+fVt8feOk39OTBDJgMoOtncQ0npFctUt/nlz8Bdmgyxzk1tVq/Z2CwcK1ocj7FPsgUTZvcAmvCwsG/2NIqmsHLfITyZdr4sSz5YEQhfoH1Vw0FRaxsE22ieMJG4lIf9DSjL3vjRIJLOGLHy26CDco5IDPRgiCetAAUAmGq6H+hOEVmkEg13SPU4uqhXJ8sYw2rENCmsiovIkaJ+pd9p9JxZQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7095.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39850400004)(346002)(136003)(366004)(376002)(396003)(66476007)(66556008)(36756003)(5660300002)(44832011)(66946007)(6916009)(316002)(86362001)(8676002)(6512007)(52116002)(6666004)(26005)(478600001)(6486002)(4326008)(38100700002)(38350700002)(2906002)(186003)(2616005)(1076003)(41300700001)(6506007)(8936002)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iRsrQq8d2kQ0+293hlnrRyKAAkffQVFOCfBUHaj5uftzWNbZP1rOd2xCTXnvf4Tlt5cVfs6yf81GWuRgIb+bqYhET10cHiVjB2llW5gBtIvj20jWwIAzdgOLYaKPtEBi1EKj5e79co11cPewCnn6nOjLdGXT3WDnA9MNHQsCbwr/DyXs+Q2WolRUZYN9xm+Q2ehWsBRGx+qJMZoee+kl+nWjwOvfwEuqjT/ZgzD4dHLIWK9PnFPBgnT+60f0Qc4VBAjOAwTOl2F+krwcmA0l4ChcT5IJ8q6ahk2LxozJi1zoe3jZuabuLk8jVJVzPFknhkNWONMIGARUOZxc44DG9n5eoSCsJBu/IEtwY3sJfC2IHU3mDMTkqYLa+KP+iBP/L8Fq8+bi/jRyPBuyadBW2PaakakMR/i/EIcdHygZsRdRjS65kHK0juNLvYTE7vKsnM9z1rqePqdT78X4mUA9D69T8GaL/+h1evksMiJW3vjDE/Us7k5NEugHI1skb+3TC4owWDJXFYvt/Wls0S5L6rbnkyhriNZXd21fRIxAHvAoc9lcbiYyUiDIK8X4MunKrXV43qocNWqQNk8D1TH2XEcBMVeIPIagIh/BmwOl+ro1uPNBkfp1Jc4tzpYEdJGAqnDV/PQycqqhlug3WDcxZx6F593WtxnHp5L+JjcBwSZZK4XM2xoU7ik8JkBSgUkAfRJ/jMlWjOgMScLxVUzeCUEMbQrBihojoUWd6Q5rY8ZGXaV/JxVvoJb1o/LQQID+Rsi1/AiY+LgNPaovsZ3K+XQNqFpKcXrLz8d21fS11FKyxogalMQIVNQs/+sQGIrMpm7irW9LJFSn5KqvxhPDROU0HsIFdmiMC9aj7vwrPjV+1h3y1YO59new28A9yGcIlYPehVbCAmHimFzPkXX9rO/NLYxRqe9fQbtUYsKz0xGHrp7i9Zq5/uNFF0uYxnkp2iuRi4+/NgTqirtQG+FT/Usitl1iJ/in46BDtyyUBVFJWNDYanZaWJCByd9BrJzzF7jbjbOaVVZlTgTKILALIpvC5vLY76STYPH5UCLMiEB48IAyL8ZaiP+SGCBVVP8tlZNyrp0EQhxtJw4ih8oI9kBx1JeF2fhOEObyqeDCihDfJ0M5D9CSRhrZUFzXGoMkvEEFVZIw+X99UOGeD3DS05WZulknKetscWJaqHj29Vlcr/bayNxI+yHrnXdktZo0Z82on/8LHpBL9eMjVyF9QKEOetrORpkwszH62QbnnvsmRJ+9aj0/XEEwZiW3iq9p9by0kCtOhQ4MfcfMvJgdU3sHtK2waiQDZZCTSHhRQ43JHUwRnEObgpq/xWBtu/UvzfdnQ/h4ruCQIs44/s0wykB+BChAalOwIgfrCP4rjrwlra6E2lu+dG0l+n6Xzn1Aiuy5ejU1WL/6CZFrjJxG6ZEHBRSxPUwqkycRYkX8J0a9shyGzw2j36kAoQZYJz9pPvk/pXh/zmdDBqyJgEkNQYbvr6aLWSo5TBlhhyLm7y0NVsQVj1pT2V67g99yQdioR2kZRJdIjweK0wvwc0izOkhQR4btpdPfUPijmeXRlpIxJIR+atqtmecFQjFUd++BrjZchM4GZv+qENJXzFhvFz/9IRHisekgN34YIyuBCXk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec9d3a23-5540-4766-dbae-08da8068bc1d X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7095.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 15:54:14.8467 (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: vYaziIofIi5H1cPV8xBS9mdi7p9uMtr/VRsZtFyBlbi10U997MqmjHu9PUuFqaVnlM/6mDpLm3HcBltMGf5mkLrYmlaKp+DkgUAFxIqnAqc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6783 Received-SPF: pass client-ip=40.107.6.132; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Write a pattern to the last cluster, extend the image by 1 claster, repair and check that the last cluster still has the same pattern. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/parallels-checks | 27 +++++++++++++++++++ tests/qemu-iotests/tests/parallels-checks.out | 22 +++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/tests/qemu-iotests/tests/parallels-checks b/tests/qemu-iotests/tests/parallels-checks index 5aaadb0c74..a793b8c2fe 100755 --- a/tests/qemu-iotests/tests/parallels-checks +++ b/tests/qemu-iotests/tests/parallels-checks @@ -71,6 +71,33 @@ _check_test_img -r all echo "== read repaired image ==" { $QEMU_IO -c "read -P 0x00 0 $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir +# Clear image +_make_test_img $SIZE + +echo "== TEST LEAK CHECK ==" + +echo "== write pattern to last cluster ==" +echo "write -P 0x11 $LAST_CLUSTER_OFF $CLUSTER_SIZE" +{ $QEMU_IO -c "write -P 0x11 $LAST_CLUSTER_OFF $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir + +file_size=`stat --printf="%s" "$TEST_IMG"` +echo "file size: $file_size" + +echo "== extend image by 1 cluster ==" +fallocate -l $((file_size + CLUSTER_SIZE)) "$TEST_IMG" + +file_size=`stat --printf="%s" "$TEST_IMG"` +echo "file size: $file_size" + +echo "== repair image ==" +_check_test_img -r all + +file_size=`stat --printf="%s" "$TEST_IMG"` +echo "file size: $file_size" + +echo "== check last cluster ==" +{ $QEMU_IO -c "read -P 0x11 $LAST_CLUSTER_OFF $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir + # success, all done echo "*** done" diff --git a/tests/qemu-iotests/tests/parallels-checks.out b/tests/qemu-iotests/tests/parallels-checks.out index 787851a250..fa0fca953e 100644 --- a/tests/qemu-iotests/tests/parallels-checks.out +++ b/tests/qemu-iotests/tests/parallels-checks.out @@ -19,4 +19,26 @@ No errors were found on the image. == read repaired image == read 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4194304 +== TEST LEAK CHECK == +== write pattern to last cluster == +write -P 0x11 3145728 1048576 +wrote 1048576/1048576 bytes at offset 3145728 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +file size: 2097152 +== extend image by 1 cluster == +file size: 3145728 +== repair image == +Repairing space leaked at the end of the image 1048576 +The following inconsistencies were found and repaired: + + 1 leaked clusters + 0 corruptions + +Double checking the fixed image now... +No errors were found on the image. +file size: 2097152 +== check last cluster == +read 1048576/1048576 bytes at offset 3145728 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) *** done From patchwork Wed Aug 17 15:53:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 12946228 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 4D725C25B08 for ; Wed, 17 Aug 2022 16:17:04 +0000 (UTC) Received: from localhost ([::1]:39284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLj5-0001RA-50 for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 12:17:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLNF-000724-Mb; Wed, 17 Aug 2022 11:54:29 -0400 Received: from mail-eopbgr60132.outbound.protection.outlook.com ([40.107.6.132]:65374 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 1oOLND-0001M7-VP; Wed, 17 Aug 2022 11:54:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EcWC7ob+xRC0Yq4+eIX8mEq76bYeIogB31AQOFBJ3bqNUK/CRyXkgA1O3VtSTbwVtVorm9kNe4NWZ8dn2z11QUdMRv484Bb9HZm7ZitBT8m8WZqxVvy43WMovCJkwXr4vDsUZORkbFY76URvnUXGRfKqlJkuepDf29fKw9sKdnWTUiiqcFI2EzKmtpkafgXVmU5f/Lhiqr6usmlkxO9rusvlRTkNJoiqnBjT63UwHkZy+/dixH60CTvMnaRbHnw1d+shwH7QvXSvMaEpbVuAVu7JBn+/VY9MgplKfxql160knMhtW2V/38HUp3401lx0+WsiJU+XYFm0qk/9lQR77g== 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=L7lJOtTCoBtOhh9OoW9Jg1WbG/3EUp6jj13m+UFxdX0=; b=dhORGOuPbTw2ViNWLRXxeHMI5KhUzsJgYM1YRNZ8DAoUNnFm/Zk+xHh9YXumaaC74kIuljV63ZXLMaLRQpTVH0yb3JuWo/IG2a5VEHGbBqhXJmb95e5YdL/UCIvQRP0KfanNdF4Ziz8fEKeSj4sxK6zPu0elb4LWrfCbeJIPgt5yqd1vuBsYlkWwWo0mcZ89GY0tXXaHBJHAm+M2+nL0SF7awn0l9O9ZFeGYl/2TeqFShK3AE3aQrFXyS62IzNj8OV5IxtxExhKjgT0+zDXBrLGMjnN+EppFu+6WR8mIymISZKfvpkovx/5aJQOczC/7snh3Ofi+0b3oYqDgYYmm9Q== 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=L7lJOtTCoBtOhh9OoW9Jg1WbG/3EUp6jj13m+UFxdX0=; b=tuez65odbSSr92oy+7YsDC+Zq9BZeJ/iCGJb/pXagpEDrQ4fttXFcDOSd0NWCTwTvCeUYuuaSQLH0XRjJDSHv1PDqL/eaQYQHECMOQ8w697V2Z153MUhLcTf8xxkvmU46sg8c7oboI/mp0vMS+zMPlpdGGGYcIjSt1isKQFT4kg90PxoDa+CyDmmZcCGArkfnnDscRbQ0Xea3ZW/u3oy3PRohEiRYWzNAUFnBX1gIV5xjVdmLKfa1fe1gF/owgG6cPSGVr4R2IjrG8weBdakdSFsHGp9sXPjP5nl/vlEPyf5/1I7RButSnS6xKlVofz4JrM/sQfwoVJjhb5wu5eOLQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) by PAXPR08MB6783.eurprd08.prod.outlook.com (2603:10a6:102:131::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Wed, 17 Aug 2022 15:54:15 +0000 Received: from AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2]) by AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2%6]) with mapi id 15.20.5504.028; Wed, 17 Aug 2022 15:54:15 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 08/10] iotests: Add test for BAT entries duplication check Date: Wed, 17 Aug 2022 17:53:59 +0200 Message-Id: <20220817155401.2045492-9-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> References: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR0P281CA0111.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a8::12) To AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9f4f8723-e008-46c9-9dbb-08da8068bc97 X-MS-TrafficTypeDiagnostic: PAXPR08MB6783:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fDqgGxBgHYBLOHb0woxUNxAc3sMjqTPOWGGL8DdCUqdCXLxwphee6LTIjLqAD+NWyzue+DGoVbzb1c6UaJxjor9bYsXUxRBfGIwrryTKsn+QO1MdK3uG0i6GoPJdQgRE1dOez6RDHPxgLO031G1I1Rl4zjeL2mcIMPD0itiB13cBIJHoIOPykLw0QSA8eJBSCOHbuR/BWqPEc78hFQbv21FEnJFJuB5SCvG5eiHj5sYHsyCfn5V60lelzLiAFQ+000ysQz4BAunO7tnbUDAXJIcCV+trUgxPmqVFqxZS6W0ldfFItSboRizypiQ4s+cbsCklrASB9OmRUaolX/SjgIjepycuUyoKBGB2UIBE0gDy0yqk1fA9k1uyyXXxo19on52pWwL6jl2jBZzcqkJt7pXnGKe/RbxxGfCh+MFaILH7zrHAJ03grSSo8y6h+nHFyrj4MP1TmJfLPOiv960Q3w4/uCT65/cmttAI7ohCOOwJ9parUxxLB1T3xnPrXxe5/QbfcK9wLs5nvx85ovHuG/tN3XMgmUEcQdhWXpdu/oM5ARJNzDEDCY/nEFVRGS2sxH+UEorP3HU8EsaiNlF82yLpEJN7IdA1TwAJxS9Qr9xfIMlofrSMUJmhAq3lXM90cfAH6de3Xdp6jsOZR6eLLbm3F4N5J+DP0zl0pE5566ssNk62uRaL9t8iBqrL3csjmAnyOaN+xV34ZCIBCAETAlVCntrrCioMKkD9DSiHxHAYTJ7sSae8dQ/C+dHp6beRP9joUYskH+AVGg7B1qkKU9J1PcAT2Vnri3/fl1AhATVagHAF4hZLb/T3lUNT5Sti X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7095.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39850400004)(346002)(136003)(366004)(376002)(396003)(66476007)(66556008)(36756003)(5660300002)(44832011)(66946007)(6916009)(316002)(86362001)(8676002)(6512007)(52116002)(6666004)(26005)(478600001)(6486002)(4326008)(38100700002)(38350700002)(2906002)(186003)(2616005)(1076003)(41300700001)(6506007)(8936002)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hB9Kuzkin1liAoxD0SJFoDlg9LVu9bDADrDFf/mhSSCabM+1gJECto5U5hH9YCVzxCtBg2fPMtuE4T6z5qBYxVisqlwVzReeWcdVz2EhUy1lU5w+iRBYK3u0EZ/n1cqjJsSbBfiWq2Y8AUFOoUS40/AnRm5x+9wFJLIXGeNri8hykjg4ZJjxWFnI6CwfjEa0oVj6o7s/Ksi5d1t/YX45PfwTogAzGR5f4quvj0jT30ATGVcdmJEJtAV7TOadhf7pXSQSOt1bRT4CST9YgUuFIqHNOoZey3Mq2ZDWaiOqURIk1FGjHqwhginwBjQBMwCdZ2ZS8ctegEcacyKxPrkYWljqnBxFaHIK9Qqg9ya/UHHEBsDtujvr/pb4VwaPtZdN0LEguBlc/wnNioSIxXRWyLC5ycJpYP6Y0AdrpLIdLKJFWrIyZ1Ut5HC/ofqrmEXVySYBX9hflpkZxtrqadrPeQBoy+i8a1sw7lXinbz5kleMaIz/lBpJ/8CgczE12Po/HfEg8ZTG1X7TdIt4filuM4ShOyDb7WtKYpAs3goc5ORfQrZVYCkRablotbpaj+FDw+21gONfCmWtmjeT9h2xMCd27uAYpe3GMUVFyM5PlSffs5+iEwd/t76kmptoxw409itcm1ayCRdjMALSj4gXfr9Fu3MAlqQB2vsVuJrhjREpTCfPKQsyk+xIznFl4R0XAfdCjLCZI9jBalHmTj8XDUFqVhE7Aqc/EdlOdrmHRSrVwKT+PWDQO/7islus4Rg6+YQqwdjOfegxQkVQFoxYnEOfvwnWZEGpjlq5VxHAn/Wh0YJLCUyBMFvdnWXOC2qmINYgEYIZhzp48CuoReNUw2W9xo1uNfc3DGIaosxJD/ezHCd9THxRz4xqpOXrGeXSoGwXqPUzCg5apr3meGhWX5fud89737vJAft+5pnoFzZfXW7bPTLlZWMubt8UrpVLIfvL/xni993j95R/yhAK2kb16eVXDyDipwbqEBVjx8ioIWHN0Xj51+xud6qQFAgg+0hTHhbQ3CpbdxQ/LZJ0d8nmToKt3pDm7LxQgY39BOemv+uayTlk1/dztSUiC+ma9j/J1OgnhXnQ+8Vq+nxmyJ4ItVwdRRYvWjXcABz3SvDy1iFBuKe4KCbpWorU34MUcqCJrxY9Ye0qUv1LBRIxnDIik0S6CIpzPYus2LTbNCDxBkP103OFaTYxoSWXHcbO0ZWhat1OoJ5S+/HyLWOA+9yfIotUdiwb9ZrTsu65BO0aHI45zb+C4Xr+TY4RMOXHFpwCTG5WTJ97uGQdXvq9pzqVgioYKT4yL2UEDSSJ4lUYYUGMP2HJeYKevT/gcCnd0J8TCIIa4YkImDvB99j/VBHOKITIfIVQOCPfROxws1cnE/rIsmUmRLLhPMJtNz0qqMl1pogPRZyaIg8mA9hv2H6ZA3TqQLvCGhMZFVsiv9qx9VK0+xemTVp/HMAe2AZ1gy7Be0s2YiHWK0ya4kTQQ8yoCbStomQ/c/3QT1y3YE5uVafR801NChEJeckUErJrhxh7qgfQVYWYkUkJ/4GpIL0XEUX21xLtqaXga2Yc07P6kU9bFu+uNFiuMds87hDF/VBETH1WyHTIw5epf7mM9/bekLuIH7ukctvK1Kb0iis= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f4f8723-e008-46c9-9dbb-08da8068bc97 X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7095.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 15:54:15.6447 (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: L2qKUBnGxVUvL1rWzkFesNEP0A4y748le2eLmA5+PqlEt96knQPcEUz8APYutTEk4Ui8MV0cnFW4jyhdvibvD5CJZ5boE6srUd6/Wa0Xwig= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6783 Received-SPF: pass client-ip=40.107.6.132; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Fill the image with a pattern and write another pattern in the second cluster. Corrupt the image and check if the pattern changes. Repair the image and check the patterns on guest and host sides. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/tests/parallels-checks | 31 +++++++++++++++++++ tests/qemu-iotests/tests/parallels-checks.out | 31 +++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/tests/qemu-iotests/tests/parallels-checks b/tests/qemu-iotests/tests/parallels-checks index a793b8c2fe..64d9f9c273 100755 --- a/tests/qemu-iotests/tests/parallels-checks +++ b/tests/qemu-iotests/tests/parallels-checks @@ -98,6 +98,37 @@ echo "file size: $file_size" echo "== check last cluster ==" { $QEMU_IO -c "read -P 0x11 $LAST_CLUSTER_OFF $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir +# Clear image +_make_test_img $SIZE + +echo "== TEST DUPLICATION CHECK ==" + +echo "== write pattern to whole image ==" +{ $QEMU_IO -c "write -P 0x11 0 $SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir + +echo "== write another pattern to second cluster ==" +{ $QEMU_IO -c "write -P 0x55 $CLUSTER_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir + +echo "== check second cluster ==" +{ $QEMU_IO -c "read -P 0x55 $CLUSTER_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir + +echo "== corrupt image ==" +poke_file "$TEST_IMG" "$(($BAT_OFFSET + 4))" "\x01\x00\x00\x00" + +echo "== check second cluster ==" +{ $QEMU_IO -c "read -P 0x11 $CLUSTER_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir + +echo "== repair image ==" +_check_test_img -r all + +echo "== check second cluster ==" +{ $QEMU_IO -c "read -P 0x11 $CLUSTER_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir + +echo "== check first cluster on host ==" +printf "content: 0x%02x\n" `peek_file_le $TEST_IMG $(($CLUSTER_SIZE)) 1` + +echo "== check second cluster on host ==" +printf "content: 0x%02x\n" `peek_file_le $TEST_IMG $(($CLUSTER_SIZE)) 1` # success, all done echo "*** done" diff --git a/tests/qemu-iotests/tests/parallels-checks.out b/tests/qemu-iotests/tests/parallels-checks.out index fa0fca953e..725420875a 100644 --- a/tests/qemu-iotests/tests/parallels-checks.out +++ b/tests/qemu-iotests/tests/parallels-checks.out @@ -41,4 +41,35 @@ file size: 2097152 == check last cluster == read 1048576/1048576 bytes at offset 3145728 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4194304 +== TEST DUPLICATION CHECK == +== write pattern to whole image == +wrote 4194304/4194304 bytes at offset 0 +4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +== write another pattern to second cluster == +wrote 1048576/1048576 bytes at offset 1048576 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +== check second cluster == +read 1048576/1048576 bytes at offset 1048576 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +== corrupt image == +== check second cluster == +read 1048576/1048576 bytes at offset 1048576 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +== repair image == +Repairing duplicate offset in BAT entry 1 +The following inconsistencies were found and repaired: + + 0 leaked clusters + 1 corruptions + +Double checking the fixed image now... +No errors were found on the image. +== check second cluster == +read 1048576/1048576 bytes at offset 1048576 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +== check first cluster on host == +content: 0x11 +== check second cluster on host == +content: 0x11 *** done From patchwork Wed Aug 17 15:54:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 12946229 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 3D8C1C25B08 for ; Wed, 17 Aug 2022 16:18:28 +0000 (UTC) Received: from localhost ([::1]:50658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLkR-00024r-5j for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 12:18:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLNF-00072M-OG; Wed, 17 Aug 2022 11:54:29 -0400 Received: from mail-eopbgr60098.outbound.protection.outlook.com ([40.107.6.98]:6277 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 1oOLNE-0001Kk-1c; Wed, 17 Aug 2022 11:54:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YKmrrI6iqS9PF8FVV5D1oK7Bmo9RFaRAHutR+6LpmgVYEiaW+NUT3/EiaF8XvCFPf9fZLu1I3d7FUFRnJxmoqjhDBZCbnnUDELR+w+f5j6MRKhHAHjNZpqIHlhtG//3oxELlRiJrHAHYUDVMaAsJWhFq+tNUD4NSRdWFrQgD6V+N3gyxX7ZL6PCXLnzUrFGhjP71ZIUq4icQSRVQLHwZ1dY0EIhbfNGlcgtbaWtPx12JT4zeDh0viupGDk4VR10Vu6b+QE9F0UV1T2cpzUXiJw3Ken9QZlb6FyhxkTphUZWlSyNK7zNf7gNv4f/a74B9bzZYQyPXgaUrxee7Td2ygw== 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=uk7I4dAzmdN29D9AIJXGJSiGT8T8bEMxyKtmA16X+IA=; b=YRy978qWNAQ1HyyHAxXIh7CJIfxdKeep1L/6A3Zu3TbnZQMaYqc4p3BSe+/gVFpcSa/inWPWGLS9oM1fIhyr97HEMjBnJirCZpqi45CWbFH0F54bOgL3rjHVS+nq5YcEvBWdNXYBQyYLji6+Rzf3U5oMt5f9u5DXrY5n/UcfbFC8G0cygnQm3HYJm1FxZuJm1lF2P1mK1Ugbn+ZBc1Zw9VmrFg5dDvbqrBpaT2nX/eu6w3fDK+IRHM3nABcl/tYe4sDb1Pkf0Ur5rgADTZuVdvT0VPIFLs1TwhMDP/Y6S5sQ+pAPZJq5+SnMxSWCzcORnA0E5StCgxPe34DYL//scA== 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=uk7I4dAzmdN29D9AIJXGJSiGT8T8bEMxyKtmA16X+IA=; b=NpjDRYX/tvuInNRMELBeriAbQgRx7J7nrgsT+ldj7AP2bAHPDnasB8sSZE11bQPf2P+03ESd8xL3ueL2B9iAtLJ0/S0KzvXyOc2zZ2qghNcY9d3qx683VrMMXRJX4lCcs2R+X2fr53DWK+F3HAZOkDUgq15484MwVvIjqVKKkI4LZEmFWzQ++liXPIEsK6WbE1ohIemLa+icK7d2j9HFClvsHxTCAl/eSCgzN2giT+lOJvCARDJHfsNMNrYL57T+9wg2kar5iS8VZWqdXDvFnIdM18sAk0j10baASy0GYG/r7Bs1KzOKeoFzceqSA0wEaabR4KWBGx98Yu5wMo6JAg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) by PAXPR08MB6783.eurprd08.prod.outlook.com (2603:10a6:102:131::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Wed, 17 Aug 2022 15:54:16 +0000 Received: from AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2]) by AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2%6]) with mapi id 15.20.5504.028; Wed, 17 Aug 2022 15:54:16 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 09/10] iotests: Refactor tests of parallels images checks (131) Date: Wed, 17 Aug 2022 17:54:00 +0200 Message-Id: <20220817155401.2045492-10-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> References: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR0P281CA0111.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a8::12) To AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cbda8bd1-178e-462a-a769-08da8068bd07 X-MS-TrafficTypeDiagnostic: PAXPR08MB6783:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dILWmsbjdCgATTxCQnlrPV8RHuoL6MMnRvOhhcXaH1Cm/PoTbEtj3pGnapxAYmTZpa/B6EfjREiY6rv2s0DKI7McJvJ9Rt3GvwZJZp/0KwoLNDR0HaNxyolboCHZgwC68eHFArK/4wL/KUeAnZu07keti1RgfEwEHM4Di2h+3qhQJhMImF/TkDM66jynt6CgPX4vhdlK4A5sJZy7Ej/AHnhFcTKp2bupUjziUtnJ6o1V4IHt9qJK6kKnNZZ3YQd0VP0sHrUbVfGY5GxCUotUBpMk7e3s8Ci27WEWsOf2fEfAQl9NLAXMHzAZQcDIJSvPVyyzuCi0SgqvBiRQ1niYO725EQaXTyjHtVNzmiIolbw5UEdYHK8lCt2ZiaCxtp7xMPwl+V8kZRQppg2pJexnSQTpYxnaNokdJvizU22S66HMt+06n3KUCKdChpZdxk0lzuzeR34LMMPjLSitrgPzreH+taxaF7n81Lkrf9a1MKPMm4RaOspjHR2NrA3UCmuPxkUDdrcG2ouH0B46xjoe3rPL0LeG2FZ0jZ+mYIb494FZRugUVQT3azO20lt4XxX+Wnl6UcChOqF/5oz15/NSk4sE5zBi0eB+u3oAuRUeb4awKFD7CGnN3JQgee3ge1TuVCmdo0HrgC84Dq3nVd4Z9zww25ThGQL/ejpWf6upIDBocf9ldRV/WkKoQXV7jrzErPUffIfijVsumOyWVapef3feSq+kpT/dS3PnzwkXHsLfEBno6A3r0OGVm1x0n3oFZEvWeHjLbCGAlNNdR13Z6yRvFEjjQcNsIeH+pdeQUmCTGzimvyI+iRcJXkpFYHAT X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7095.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(39850400004)(346002)(136003)(366004)(376002)(396003)(66476007)(66556008)(36756003)(5660300002)(44832011)(66946007)(6916009)(316002)(86362001)(8676002)(6512007)(52116002)(6666004)(83380400001)(26005)(478600001)(6486002)(4326008)(38100700002)(38350700002)(2906002)(186003)(2616005)(1076003)(41300700001)(6506007)(8936002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JJGrkeWmJysp3tOkw67/n/7Vts1f2P2o17wX6YtoR2fhmvapfeikW+5trUTg5jrjnTblT+UlZD11XkGSbCP7paIY+Xw0Chbpo5Oy9zoK1HfU6uVXpM6wiFkugXirT5ZhmxIBUqwk+FEdMiy7owVRYJkwpVqEFcgJ8PmzBEK1jWV5xdTrm3POI7GQwayKVeuT3Vg2tsSL2GS2rM/Ae1DmLMsdop8JVDHi3EXweGpZS+aiMXbTFntDtvVqQfaRtxbxhK0J9kCQ3kPn/BJL6nHnVd/AgEaVzLYZ1974zZ0HodUmNjJFRfAdyB6IvVLAZevFZpQqfvSY+cu8yBpxAtTE9CtSpSZi2Ig8NNSRzFjdSGbie7vHCLf0P06uxepo3g+ZuYbYW4K7qYLNje5pWxRnzXqwgNzfTdNBjmz1c0j+GxJn/SzXCLrLHa4ThzFa7COKQ/FCj5Fu0Og9BoptxYqqtjRUyexgr5WkcaG/S3g8Yd4k3gO5YuQsNHeYFboMAeO277RD2ZbK+sz+BBF5u8ehb2x7tllwvRqHpcnFq2WQlrXLPAr40b4DimfPyIR6m+qqchnTEQdwvipZaugGWgd14QiY6Y+4B3PTJq3HyQQCvXD+Szoz8VUnLpRI7s2DZ85dz5nHpzb291RjT0qCihrdjGbt24K1RWfddQFR/ma+PO3AFrTNSRclhtSr3eFTnr2nJ6HuodUmJFQg+IprK/+d2SeS928c/dSKpGF/ubsdQ9IFkVr++ck869hbdN7a+bXTFWenHgq+50xN/Nf1BZmk7F6w7yt6iEQxEKfKdnDBAZRQ1dkX42ioz9evUteAQ4kCELXK5EiCkjAv0994p4F5/cLbfY8HeX3B6+bMcDkbBLpAEhGhmy2X3+rT5y0/9k+hf5mupw5F/4D/0kn+IzESdg1k2jmsXMLIsIS07sC30neFUOZ9OCpca+WhuSOCHPeXuowGKFKkToTRrb/RSKNizB04h3ELR5T6JBeqC6QVXAP4miYjOKy3k1YsJxD7udp3l7PvH5f9fwVrW49LWQ2bO4ES00MQL38cfzbLvbVE8UsGoS+FbcRW+QEyyIigBXmUIEbEIfcgXFwRDFyOvo+nP4hKdJ5TkRI64DJZHGz2CrseLOr+LZzYUTUUljj6qfqDiwtAsAHlJEnb6siujv0pwcmY0dKFCZ8Hsn3bVchhZBz5t6/6oeWXWy8BGPyZ505OaXkPXTYAPKDDB5haiMJuzfEdFF6CkqFouTroVvYIQv5KsWR/6CCRYPmR3tO0mjcrIAkKkUa0wlkHTKCdUf0xljDu8AtIZsC8XbTrHIPdz0bAk+qib84X8GJehuQK73+1Ou6eQmmoDxH2NbyLV2UQKOGfJBhiiPrwEGjhAo68yOLBOn5bBms2eWzaCk7aZ3vckf3vTKx85/G3jX3ds79hlUVJ+xJSChDj3xjgNK6iT2vuyiHHvTj6EbLJ6bT+jaG0u7907SMh6/f5LKo0NABBzwKzxEh4OHS4aivwNgLLxt4PhkNJN75FkkZdt42AXI7/nnRWsVK5Qumi+RlWO/HXFbvTJxNaq4Xk6P+6EuE8oyZsLAMn1/wnfkfuSpzkpBvh5qDchpl+141wGsTfZRilBnwiq6mu9ZbYk7oUF/m2j2s= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: cbda8bd1-178e-462a-a769-08da8068bd07 X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7095.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 15:54:16.3789 (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: W9VYV3pF1BP1S56sQ91KTk9vpSxWi4C+ZVQqKUTB6i7km1zRSs0Mew1GlAhkQ82fqFIGf8/2Pkzay/5y4BJQsqzSM3vlYdE9NwzjqRtTTEk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6783 Received-SPF: pass client-ip=40.107.6.98; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR04-DB3-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Replace hardcoded numbers by variables. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/131 | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/tests/qemu-iotests/131 b/tests/qemu-iotests/131 index a847692b4c..601546c84c 100755 --- a/tests/qemu-iotests/131 +++ b/tests/qemu-iotests/131 @@ -44,31 +44,34 @@ _supported_os Linux inuse_offset=$((0x2c)) size=$((64 * 1024 * 1024)) -CLUSTER_SIZE=64k +CLUSTER_SIZE=$((64 * 1024)) IMGFMT=parallels _make_test_img $size +CLUSTER_HALF_SIZE=$((CLUSTER_SIZE / 2)) +CLUSTER_DBL_SIZE=$((CLUSTER_SIZE * 2)) + echo == read empty image == -{ $QEMU_IO -c "read -P 0 32k 64k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir +{ $QEMU_IO -c "read -P 0 $CLUSTER_HALF_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir echo == write more than 1 block in a row == -{ $QEMU_IO -c "write -P 0x11 32k 128k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir +{ $QEMU_IO -c "write -P 0x11 $CLUSTER_HALF_SIZE $CLUSTER_DBL_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir echo == read less than block == -{ $QEMU_IO -c "read -P 0x11 32k 32k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir +{ $QEMU_IO -c "read -P 0x11 $CLUSTER_HALF_SIZE $CLUSTER_HALF_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir echo == read exactly 1 block == -{ $QEMU_IO -c "read -P 0x11 64k 64k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir +{ $QEMU_IO -c "read -P 0x11 $CLUSTER_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir echo == read more than 1 block == -{ $QEMU_IO -c "read -P 0x11 32k 128k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir +{ $QEMU_IO -c "read -P 0x11 $CLUSTER_HALF_SIZE $CLUSTER_DBL_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir echo == check that there is no trash after written == -{ $QEMU_IO -c "read -P 0 160k 32k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir +{ $QEMU_IO -c "read -P 0 $((CLUSTER_HALF_SIZE + CLUSTER_DBL_SIZE)) $CLUSTER_HALF_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir echo == check that there is no trash before written == -{ $QEMU_IO -c "read -P 0 0 32k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir +{ $QEMU_IO -c "read -P 0 0 $CLUSTER_HALF_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir echo "== Corrupt image ==" poke_file "$TEST_IMG" "$inuse_offset" "\x59\x6e\x6f\x74" -{ $QEMU_IO -c "read -P 0x11 64k 64k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir +{ $QEMU_IO -c "read -P 0x11 $CLUSTER_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir _check_test_img _check_test_img -r all -{ $QEMU_IO -c "read -P 0x11 64k 64k" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir +{ $QEMU_IO -c "read -P 0x11 $CLUSTER_SIZE $CLUSTER_SIZE" "$TEST_IMG"; } 2>&1 | _filter_qemu_io | _filter_testdir echo "== allocate with backing ==" # Verify that allocating clusters works fine even when there is a backing image. @@ -83,7 +86,7 @@ TEST_IMG="$TEST_IMG.base" _make_test_img $size # Write some data to the base image (which would trigger an assertion failure if # interpreted as a QEMUIOVector) -$QEMU_IO -c 'write -P 42 0 64k' "$TEST_IMG.base" | _filter_qemu_io +$QEMU_IO -c "write -P 42 0 $CLUSTER_SIZE" "$TEST_IMG.base" | _filter_qemu_io # Parallels does not seem to support storing a backing filename in the image # itself, so we need to build our backing chain on the command line @@ -99,8 +102,8 @@ QEMU_IO_OPTIONS=$QEMU_IO_OPTIONS_NO_FMT \ QEMU_IO_OPTIONS=$QEMU_IO_OPTIONS_NO_FMT \ $QEMU_IO --image-opts "$imgopts" \ -c 'read -P 1 0 64' \ - -c "read -P 42 64 $((64 * 1024 - 64))" \ - -c "read -P 0 64k $((size - 64 * 1024))" \ + -c "read -P 42 64 $((CLUSTER_SIZE - 64))" \ + -c "read -P 0 $CLUSTER_SIZE $((size - CLUSTER_SIZE))" \ | _filter_qemu_io # success, all done From patchwork Wed Aug 17 15:54:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Ivanov X-Patchwork-Id: 12946191 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 14C18C25B08 for ; Wed, 17 Aug 2022 16:08:29 +0000 (UTC) Received: from localhost ([::1]:42626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLal-0005v5-Pq for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 12:08:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLNC-0006sZ-HV; Wed, 17 Aug 2022 11:54:26 -0400 Received: from mail-db8eur05on2123.outbound.protection.outlook.com ([40.107.20.123]:3297 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLNA-0001NL-HR; Wed, 17 Aug 2022 11:54:26 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dACfP9JgqctqDBX1lIUTlNp9vahKj6Fveq9ApxwYNcMCUixqqpJet9/p+L6paExphIBRCUlcUxhOnZX3TRuFT/53ThaKWouujRULrq/19AxTpbXdAyCUCzw8bFoJg7WFeHM1+fU8sLYNkRgH4CLQXePsmQdniin5pM/EDc6B4h3pqXsYFxxfCDWFxiLJRsmUx+VGzGUbBugU4GwloOOboGOEDXd/8HKgW6mYlgotbF9Itm4Uiti/qSbIJpdJ5d7aAAlNpkYYXKGjU1U8lyVIa4xm1El3Ajs8SYzOaJJ9SGC4zCaFMYUWkhv6wzoy9HgI+RHQGWMQNdvjA0eQv+y49A== 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=GUzIX6u3DKOmDHmvbTdFQOrIOj/bS00MEFboiZ23OBA=; b=O5d+gujL+hfH4zLqQiBbRI4BAPSrdwCVEJ2SrtyFkS+V2yW8OOfPbar7adbssBQckE1MOqqCGSzieWRJFyqe601aIvseSQ/uSmx5Ccztv8sXle2rVNCOrwIRaJM6Eu8DCkOod921Bg+klRdMqMVcbdszclKSM8z5IKDI+E+21NxZi64hCakClQg2Fehdm1mmA5O/aNBnNuZxFeecHpgUMxg6LqdTKTiXudNosZMvsWqG3HXgMaW2jAKWZxfj2KPhyRxbBtFAvp84BQbmq/WeGhiVsUEtn5yw7zsnaJXngLrrXGFjtnFliAfgtKFv5HLA1m9ma4dnO40aK3QiyFz5/A== 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=GUzIX6u3DKOmDHmvbTdFQOrIOj/bS00MEFboiZ23OBA=; b=evFs4HQ1QghefO8MN7mbUCw0zHrV7dLgRSRxtiu6kjn+QSLYvU+CzUFQqjxFGAmowZ71dx65T+KNZokedqh0sbEZZ14lWGQEt3g9pNdpjk8u5Povrl8puOr23arzAoVeF67U5Dv3o3R0g/BuzdQDeuKiDNa7IAnha6EE7oeNeS63qRGIAcbfT7WPu6OC4y/48kK5nI3DFqZRdCzwxYY+pmsczrhCTQybKrUCUjdpxjT4uct1xDj253P9SXYEADT6exQWHBVZMzw+PgEfBJe//VGA2t6/VKDxRJxTxroIKO04HneSjqbiRuNNSxvsFW4rdaJnEEP6uWIWYv8qqMttlQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) by AM0PR08MB3873.eurprd08.prod.outlook.com (2603:10a6:208:10c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5525.11; Wed, 17 Aug 2022 15:54:17 +0000 Received: from AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2]) by AS8PR08MB7095.eurprd08.prod.outlook.com ([fe80::7da2:4a5a:2854:26f2%6]) with mapi id 15.20.5504.028; Wed, 17 Aug 2022 15:54:17 +0000 From: Alexander Ivanov To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, den@virtuozzo.com, stefanha@redhat.com, vsementsov@yandex-team.ru, kwolf@redhat.com, hreitz@redhat.com Subject: [PATCH 10/10] iotests: Fix cluster size in parallels images tests (131) Date: Wed, 17 Aug 2022 17:54:01 +0200 Message-Id: <20220817155401.2045492-11-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> References: <20220817155401.2045492-1-alexander.ivanov@virtuozzo.com> X-ClientProxiedBy: FR0P281CA0111.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a8::12) To AS8PR08MB7095.eurprd08.prod.outlook.com (2603:10a6:20b:402::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8bd6ebb7-7f1b-4ba5-65aa-08da8068bda0 X-MS-TrafficTypeDiagnostic: AM0PR08MB3873:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pBW9x4nvkA5KdXNZ4xXw233+rm09vuINpTHyEuJx4/Y9i6WTKxzHRrf7twonEKpOJm+tDSBVOGWDA5mG2wnm9WU6b6G1+cr9rH8JSEl9K+s4KI4VNjyy/tU/a37wqzQA0WIGW6clsxt3FQg183lLDvdwUTrB7SZGh8E4JpfKI7feMnmEH8STSwiVTXBDVDYqls6oMUyq7PX0b7AR0MoVzzdfs3FcEkoXytHtlEU1UiG95NkJj8aJrKbAGMyZyQon6vD+6YypePrj1Itt3/qrik+nSk8wfZLhVIEu4AFVOxTtq7lBlwl1PVfkK8q1AwN0dIoto60gwJH6os8Kga4b+PaB8LrQFny0aMPiHraRI+rhbeNWuzTqtjrRbT5VZvZzCYAgZUsFrkGNt97IPtPxXRwm1i+Te2y2o11jlFdPnGZbO7boWFkYZxtKQbfJmKK2iKVuCbhmANJ9yd26n+lhy4o4w7Hs29dKhabuJ74vzv0KPmjIe1p73JkkFd3Tui/G4tMg60rr1bWA+Bp2QWoyu6nzRg97BUh9mf5fmVPcn2Ow7M00iQ55F/rnJz9oVaL1HGFUYEm4mElbpAPyriyl17u3NMP2R14692qi/8bkP7diEgbf3if2PPeMg0pB0U12630fcbBxQn+EeWbKWOpRdgN2ZceLVWVK+fdmYsy92PzFhVyC3OfbN5yb5qhAz+gGqNaOgiWUCA2c3SGC24K2q2s3Pi2pvIED6diBQ7zt9H+HrSbqKxEbLdRKrH7MdKDTocFrsrPqoj65Dez1y1R3gPfRsdsVLy04xYEKHD1c+p9IdIAI2/2ZHCp8ysWLIfquXgsABdauet7rbs5b9vN9eQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB7095.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(4636009)(396003)(366004)(346002)(39850400004)(136003)(376002)(66476007)(38100700002)(4326008)(38350700002)(8676002)(2906002)(66946007)(86362001)(66556008)(316002)(8936002)(6916009)(44832011)(2616005)(5660300002)(6666004)(1076003)(186003)(6512007)(52116002)(6486002)(41300700001)(478600001)(83380400001)(6506007)(26005)(36756003)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DTQ8DWY3wwmjqofrwFY6l2ASkFCZnH/UKNSBOtXOqLD1tly9nfAumQkiYAAaaVBhR3pW42hOPsf+dNAREx6HWRXEIsAnWDLP95+3hOKlD4GsoAYajwj3JAlGHOEuVXCt6mIpILgbajCjccDxNDdtiBmiMctirukDGUKOimkzTgx/m+J7S+OMRuydQmp2nsbDJHPT2jOJ5bYS6Z6kC27TrBtyHt9SGbDO8rBAkdkYIQs8QqkcqY01N3bq4nULy6fz7/gYZaV/Iok5bGbzQj0s6YRUaDjmhf7r3C6wCb5TEMt/B4TI9LG/YnM3e7CW69amD3wrgWLTn+2ISKLcGAHUpKHzAI9lqauDTNNf480Op7M2lSGiAOBOoBopaPo2U0vUvHiUr5BuZ7dS2hEovYjC5YzMa3KNiFp+0m4S7eBM95oETXPbeIYopXY5IOXDnQRIWgawT1+pnqov1XDIJZHUYp5z4T6xwAJIx+FCpVFvGO3fHzLI+g/TQKvzCZFmdP3bm7ebYkUB8/4XADPvF9TQW9iR+AF6jBp7Jmzcj2J/gibFX27qmlSmRbTqP4ICiHZ220K+BMc5c8DRO5TBCexIDoo86HFSIjk//wPiS8qrTxwQwz2L+E9+/rKOUssv1KAaeAokjdF0rquEXadEz9ExxxS/6L4XTWIHRcGJcsUWNhHtpDLj/ZxhsYGihHeGrx72yK1QdAkz63/C8GepQGRJiSyYW/VcgsjKwVKR59cxC/ol1t/SkZDyrDa7gbxksFzin3TDQnssv3N2tVr8C8626vDHKpXHJ2vnrYkfsf9nyS4fJD/63vQGyYPQ5Z/k6yryPysySpfi+j+gOETZ6W+3qNFEcykUx7jgFm/mitvj59xW7aV3xv7We4QjPRDbwf82ZMXemMJIUrcWZpUUCrEJCG0Qe072209DEDOJJEeHXXYuJtm93edDXiZp/sOin36ojpCBiN0NAkn7ysXNP+EQSvKYnj1LkPdsJYHtcVJy4uMDER0QhGWVgReSQ5H8lWyc6LlFvmSl83YsSrfrYYK44PjIhlIuL41KxrJDPLJ3MSwcsGntx8QkJfHlrQJTjdiWXlT8sjzBeVC1gynHg60nqvXaRRj9POz1pKdBBRRHd9eFoPtm3E5gUUUrTiQMhN8/dFEh6t0VtkoXEq1qAdehKwikpLvoLHkV9XKoIhqAHe5DMZR65KiMLyMaVTfRrKfOdCBni9lfEfZSgHzVrABP/m6/qZfYeKX8ZtjJcczlqKJwMzqB9TNGULwH473D27QA4rmIjojZ3qMnGYhNLHNnMJ5sbXbdlHko0O137YfvJxGkj6P3nuyJvOwwOta+SA3lOMkm6c8ZQnNtbH7B2CeBOIFWdgGgx8ZGjyxNDBK/rwxz8hLEOZS+b1n6ODYWkZaUZYBYCuQjwXtKXVCFgxBiEg+DE1T9/JzEgRMUMwRc02tLlPJqbtUdB3RQtgtwtlNYohyyhBalB5zhEbZrVnnQJzO1RV6ecc/1hcxrnLk2t/UrNQE5nwkphgtsxwPApEU1fJwbRrMBgD63GGdC9YpAigvPSwg34PmQm7GlGopsyQlhGJBV/qXXTK7Xih/o592zbTyYvAt5rPOcum0EI0qFr3onikzOnlmhFuAWGV2Afmw= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8bd6ebb7-7f1b-4ba5-65aa-08da8068bda0 X-MS-Exchange-CrossTenant-AuthSource: AS8PR08MB7095.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 15:54:17.3799 (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: hzP2eXZoUkk1YOcGoPmBfFcMsJeeEg7NdXtm506wAXA2Yk8BKJedBt+97w+XTBWp/k629NXvJkbMpUeqbIzqBQrY2kTi/RMl2SKI06mXeDw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3873 Received-SPF: pass client-ip=40.107.20.123; envelope-from=alexander.ivanov@virtuozzo.com; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" In this test cluster size is 64k, but modern tools generate images with cluster size 1M. Calculate cluster size using track field from image header. Signed-off-by: Alexander Ivanov --- tests/qemu-iotests/131 | 5 ++++- tests/qemu-iotests/131.out | 44 +++++++++++++++++++------------------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/tests/qemu-iotests/131 b/tests/qemu-iotests/131 index 601546c84c..78ef238c64 100755 --- a/tests/qemu-iotests/131 +++ b/tests/qemu-iotests/131 @@ -44,10 +44,13 @@ _supported_os Linux inuse_offset=$((0x2c)) size=$((64 * 1024 * 1024)) -CLUSTER_SIZE=$((64 * 1024)) IMGFMT=parallels _make_test_img $size +# get cluster size in sectros from "tracks" header field +CLUSTER_SIZE_OFFSET=28 +CLUSTER_SIZE=$(peek_file_le $TEST_IMG $CLUSTER_SIZE_OFFSET 4) +CLUSTER_SIZE=$((CLUSTER_SIZE * 512)) CLUSTER_HALF_SIZE=$((CLUSTER_SIZE / 2)) CLUSTER_DBL_SIZE=$((CLUSTER_SIZE * 2)) diff --git a/tests/qemu-iotests/131.out b/tests/qemu-iotests/131.out index de5ef7a8f5..98017a067e 100644 --- a/tests/qemu-iotests/131.out +++ b/tests/qemu-iotests/131.out @@ -1,26 +1,26 @@ QA output created by 131 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 == read empty image == -read 65536/65536 bytes at offset 32768 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 1048576/1048576 bytes at offset 524288 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == write more than 1 block in a row == -wrote 131072/131072 bytes at offset 32768 -128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 2097152/2097152 bytes at offset 524288 +2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == read less than block == -read 32768/32768 bytes at offset 32768 -32 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 524288/524288 bytes at offset 524288 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == read exactly 1 block == -read 65536/65536 bytes at offset 65536 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 1048576/1048576 bytes at offset 1048576 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == read more than 1 block == -read 131072/131072 bytes at offset 32768 -128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 2097152/2097152 bytes at offset 524288 +2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == check that there is no trash after written == -read 32768/32768 bytes at offset 163840 -32 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 524288/524288 bytes at offset 2621440 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == check that there is no trash before written == -read 32768/32768 bytes at offset 0 -32 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 524288/524288 bytes at offset 0 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == Corrupt image == qemu-io: can't open device TEST_DIR/t.parallels: parallels: Image was not closed correctly; cannot be opened read/write ERROR image was not closed correctly @@ -35,19 +35,19 @@ The following inconsistencies were found and repaired: Double checking the fixed image now... No errors were found on the image. -read 65536/65536 bytes at offset 65536 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 1048576/1048576 bytes at offset 1048576 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == allocate with backing == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 -wrote 65536/65536 bytes at offset 0 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +wrote 1048576/1048576 bytes at offset 0 +1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 64/64 bytes at offset 0 64 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 64/64 bytes at offset 0 64 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read 65472/65472 bytes at offset 64 -63.938 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read 67043328/67043328 bytes at offset 65536 -63.938 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 1048512/1048512 bytes at offset 64 +1023.938 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 66060288/66060288 bytes at offset 1048576 +63 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) *** done