From patchwork Mon Aug 13 01:07:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10563815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4296C13B4 for ; Mon, 13 Aug 2018 01:10:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E28A290F4 for ; Mon, 13 Aug 2018 01:10:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22C8829113; Mon, 13 Aug 2018 01:10:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AC15E28FA0 for ; Mon, 13 Aug 2018 01:10:43 +0000 (UTC) Received: from localhost ([::1]:36972 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Nb-0001Y4-0Q for patchwork-qemu-devel@patchwork.kernel.org; Sun, 12 Aug 2018 21:10:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Lj-0007fV-Gs for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp1Li-0001k0-DM for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:47 -0400 Received: from mail-co1nam05on0729.outbound.protection.outlook.com ([2a01:111:f400:fe50::729]:24113 helo=NAM05-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fp1Li-0001hW-4Y; Sun, 12 Aug 2018 21:08:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janustech.onmicrosoft.com; s=selector1-janustech-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+KNjyg4kkc/w6krUNmgeM64EvRCavZPcNlKd2Xxy4SA=; b=VceoX5so/sw/YgZWwY31wgM3cn8wkA6LHAm4xTb1glLZz5Ro/26Jc2Ng3y79LuNn5PAHGDFgTTh233SDy87NhhZ5UQDF5XPwso28nSJLD9HWq8xptkCmnARQ2DdIhqH7nRVOPIYlDqds9Qmxm+cGeJMf9i3vngGEr7yLsro66aY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.19; Mon, 13 Aug 2018 01:08:37 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 04:07:29 +0300 Message-Id: <20180813010729.4844-9-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813010729.4844-1-lbloch@janustech.com> References: <20180813010729.4844-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM3PR07CA0120.eurprd07.prod.outlook.com (2603:10a6:207:7::30) To SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc2f4e58-c5d1-44ac-32d6-08d600b94dd5 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 3:KfMVBLGw6+Cao7R5o1JCwDux58NBrRgMJuDBLsgyof1NvJwPIJznHRr94ehJNRVZpoucNcKBELJOD9W1PHF1BLMEpPzrkYiCiMlHinNGPUdlKvS5X6cAGyY2t26Z7jkNi/TB9b8TbEloAE8khLXkjBUALHMBtWmdeSz2cJNyiijO65nom3f9weqtOoGB5V91+RYLvMU0VtmvEWt8lOpUjMW7LnNxELESxDlxCv+MJFmb/E8vzI+0h4VEPw4fAHWQ; 25:iYyym2VDb8+giWTs3Za1AYe8S31R956n4B2eb3wF/glVR89XDRsHHPV3/1InRqBOh3g4J/Gu6GDQz09uQiHcIDOl+uBnXPykAYa1c6hx4GrxxM7b2iuURqpdQPMjXkEd1qFj8+sdMHh5Otlit2FgMFsixafWA160dNR47jHfz2FRCnv7T8TexWyqJqj3p8fTg5SpWf3To31OvJeBsTP62fM0IQFz0+3Nx/YGNbrHEE+dumRaJoKe+CVNMtZ0NP7e/EaIfCqqpZSoM0jkh7jqUC3KW5qUouP78OAY9UpW3+YIID7rqaip8mBPLcMcjOOJx+fkw46S0N07NNxT4kJcig==; 31:s+nLa1ASIaLFOc0U//JacMh7NTMa4VspJWZNpgqNKiJ51mq37F4gqu5prB5SGLy0zq9zll6JzJsnjjreyN6jGylqtQHXx7r14sCn1+twgLBuxosNKJM8GyPQ2v8NnkuxkceslShJbvLbZoC2qgLiJJGP5LbzpSKcoWaQxKMlkIApdiJ48p2tlWxqg+zJWDIU/ct0Tk7iHNqnaly5TyRWX8nx2bVpDXo8xQSCzy5h5uc= X-MS-TrafficTypeDiagnostic: SN2PR07MB2621: X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(2016111802025)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2621; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 4:qlTVhFrPRc8VMg3geQfYUgYMJEeis40xTmyMrd5lhyrVB/rhmQ8rKNaYZB6qpWwj0CERAI5rikKe8Wrp/cUdtZQNS2lyCJneoju8UzXF2ILkXPvvkgZba8pK6VcUruxwsxersqa4NZdujQDG1RcA7a8LbpopduLHWQkog15n1+pDjbJmmghUPODypJOb8v30hf8kamILJkLlEh/0C7XHacdYq5xd2wWnd2i58AmjVOhYuSrYnwtwkjVuxkTKCCcV8UyMlWgwStTJe7hidZMh9A== X-Forefront-PRVS: 07630F72AD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(346002)(376002)(396003)(366004)(189003)(199004)(478600001)(105586002)(11346002)(446003)(50466002)(48376002)(8936002)(106356001)(7736002)(81166006)(305945005)(2616005)(8676002)(476003)(3846002)(68736007)(956004)(2361001)(2906002)(6116002)(1076002)(50226002)(81156014)(2351001)(36756003)(575784001)(4326008)(6486002)(97736004)(25786009)(107886003)(47776003)(54906003)(6512007)(66066001)(486006)(6506007)(386003)(316002)(14444005)(52116002)(16586007)(6666003)(26005)(53936002)(16526019)(76176011)(186003)(5660300001)(51416003)(86362001)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2621; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2621; 23:JJ39qEbOJpRvefUm34jWDMh70awngIz3IczVMJNIl?= N4fC1pbS5ZEsr7gX4rVHAyfrnx7MH2c0ZB0+EaFiZkJYgIQ1OyBnZHWB1y41P+tk8196nXLMmJaH5eoovrGj81mcCgkXFT5kK9cCiTTSJBDigrYT0SfIJXw6dH7HhBsizPmG6kBKCo163X22o/zV84YQtl9koyczyoiKh/zH7B0eRMUb4ajg1bKZaidz1u6TpU4U5gxcF+0VIKVIdkfCowIfPwmxUEuGwpr03PnPNFXVm/dr4yd6Vi/TRVNWv64hIcUheWgfiJAURE1kD6cYUDAn32Q86oXldzNDSPJJF0XC+nhVm9BEWDxZFv61dEn7uWXapeIXHA7zPMBhuxjKNKP2H19EOWa2p/JL49r8mqgTB0KaPs7ncGIQn2EFqZXdDe7+DJY81chPUSZonWkcoK1BJMQQM+03FNOkmc2qTyrVMAkfX+f8vyF/rX+9xTRmAzLC5LsksiSlMDhYVLXrHbtadaIISLMpXCj4xl2UK3I5UkGuGvqMfMZiJXuqMrGuAmRqikQTE8AHI8//P8Pu+cO7CMdB60sydQoNxhbMRfTFWgOCaqJsd0Gnx0dwi4b5mdpdbDZWWSU2Z9mK5rKei7cx6aJw5O933FXzJX6wMcU1yM/G9xD1E/1YMRKMmvdM+1yeHKu7M2QIurjRZ5rXu4TVo/tJp8rrjhPoL4DOIZTeT87LM/8DAjvtNvFK49g3ghGvSd1u14yKQEJc8GNHFQSUahi5AASmM1POsSU/GtW1p8Ry72HM+a8ZQqN+qnWg8KY5JAhuO/bbfrgAPPTlPBv2/PlkVfWdLmRqjIOl5Hcem7BQWUorPO3kkwxLe6W6LNdfmb/cmPhjJLBFNjm4intWKDyLyrP18/cPDfHtDvLHwl744u4C1BYngK/2mN6eSuLiQ6HfC73VJlbtNFmUC6IpYbSy3ebrmIyvjZGq5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D2M2t8WUf/CYyofrHKSQUw+OL+pYI5caAGffr4sTgRLIAM06NbfRmidOUUgtC0+JBeAfCWOOaNsGy5onYZbooWz8U7iLc5STWYY3emuLUZAdsZRLIY2qKdh0xnD0q4DHgXCYS7qCMom+BC00Ny1LAtiZ4PWV9D4/0EdkmgupM+Ye4Bw==; 5:cAWVLVrvB4Giaf1zqG1yCXtTzae/4MvUDAOWscsFTxK7lnnA5SPk4JaD4QJMQaterBEhfHt4YrcahX6xZ6W9NuIop5fA63XTmleyZdmCgsIAN+n1yHwLBjgbK66Lyy/URL5LuFmtrmiinOLGnRI5toWmW6Ga4F5dbTt3X152pis=; 7:7S5c9GAhas5DHwdONAcdKJarH2SVmo37WcLjKQOQTTbF/aFP3FWVldNfD+fYwMd8L25M2pGjdxoqRl4UhJ8Jzb2Tmk31RYKRe2pJzzhKoARS+ZOpq/TGEF3flg/yJcwLS78lSdn3a9+z/negXCaJqiVhOnF3aRMwlGOMadiPkWI/R3G4rdrJDnwn8BEOAH8VPVtGjLXam9CV5B0ki6xPrVInGqUeeyoOU8PRsnQaxkoy66jRb0sMbfuqBmNek8n1 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 01:08:37.6927 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc2f4e58-c5d1-44ac-32d6-08d600b94dd5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2621 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::729 Subject: [Qemu-devel] [PATCH v8 8/8] qcow2: Explicit number replaced by a constant X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- block/qcow2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index f885afa0ed..ffb4a9e4a1 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1324,7 +1324,7 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, /* 2^(s->refcount_order - 3) is the refcount width in bytes */ s->refcount_block_bits = s->cluster_bits - (s->refcount_order - 3); s->refcount_block_size = 1 << s->refcount_block_bits; - bs->total_sectors = header.size / 512; + bs->total_sectors = header.size / BDRV_SECTOR_SIZE; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; @@ -3450,7 +3450,7 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, goto fail; } - old_length = bs->total_sectors * 512; + old_length = bs->total_sectors * BDRV_SECTOR_SIZE; new_l1_size = size_to_l1(s, offset); if (offset < old_length) {