Message ID | 20180809142046.12311-6-lbloch@janustech.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> 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 9994E13AC for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 9 Aug 2018 14:25:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88F8B2B500 for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 9 Aug 2018 14:25:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D1FC2B567; Thu, 9 Aug 2018 14:25:39 +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 105AA2B500 for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 9 Aug 2018 14:25:39 +0000 (UTC) Received: from localhost ([::1]:51158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org>) id 1fnlsg-0001MZ-8g for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 10:25:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1fnlof-0004SJ-Q6 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:21:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1fnloc-0004gF-Fw for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:21:29 -0400 Received: from mail-dm3nam03on0098.outbound.protection.outlook.com ([104.47.41.98]:48061 helo=NAM03-DM3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1fnloc-0004fc-7n; Thu, 09 Aug 2018 10:21:26 -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=OeIhqc/PlSFxaVjlAn4Dkv8Wo+SmcG2/p7ssdHIiYi0=; b=RcKQlydnfxbKkrY/C5Xq3F6aVOTEncFxolvP5SO8BR28Mli2qi+xvJabp4HkUwKwwNvop6owHex4gbNmHYgCVt0ijtHcm46K2dRPsAuEDSZSqYF60bv6t0s47A0jaLhTSf0AzUK+GNehbNI1gZFQ6qJqKZzKaOHT0Si1YWSwgHc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2618.namprd07.prod.outlook.com (2a01:111:e400:c637::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.18; Thu, 9 Aug 2018 14:21:23 +0000 From: Leonid Bloch <lbloch@janustech.com> To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 17:20:46 +0300 Message-Id: <20180809142046.12311-6-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809142046.12311-1-lbloch@janustech.com> References: <20180809142046.12311-1-lbloch@janustech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: DB6PR0202CA0004.eurprd02.prod.outlook.com (2603:10a6:4:29::14) To CY1PR07MB2618.namprd07.prod.outlook.com (2a01:111:e400:c637::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0e85416a-e6df-462c-c143-08d5fe036370 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2618; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2618; 3:W/d1UCR0DQbFwpkMVtjRmXtjLy6DhEtM0MZjme1Kkb9cUW2Bv0PthnvwioCgdFzT1ymlwacXrPVgMvF51R0zIRELRWOeU6OcVWSvbYENK516jIwjL8niphOYpJYs9tv7jW0kHqZzsTCjXrJLcSpWRRIae+DOzCwIAmDGVtFC072JSFUbTg08xe9DQP+5KCqGCnl8WpKCr2cCqPX6aLv5tzFGFCt4nNKFeT3Jn7BeCw5AhZvXnjQy9hY5TWUEA5kp; 25:30nV31FIj3Xd/V4ITHc6M/yNcjKOrJ8Vf8Rczgh8/qhLmnFk4o1VtVWxRv8APWf7vKEod65GoTh9tFs+0yCqu3jzc5TDEFAXuSSX6yGni+Gz4zjF+YmVHQWBLJApx3kBzUgFaEs+c3yd3k1f5Zh+g3LzMSvHaH6Qpd5RL+yu02VwnCQXPbosnoDMDDrS3rIHDoqVWBFIqdFP6cJWwq6NcvwTwNwLk0Js+H75tSGWI3yhaaAF1NRIZR6ysKc5M6OAfwAN8qGSgE7rcVHm0EjdarOX2A50woz6aJkS+Ym7Qn00Uk8JdsfLgPiYp4nR6JRJz0r+Fuaxr4ZVqz6i7xUMEw==; 31:OfBHkWE12GrzqkMycs88ryZ37cSqueW2VgvreLe8oupSOusof4aE7ymvii59s5mRVR82xjaFJx/tf4N8mSKY85k8pftijFqslk9FUQAzsmqT6M3zL+tlxMUklsI/IlvWZ0LS3oBtjuPqS8u5+oQXvMTK+Zd2eAaKSeC7z33SYupOlTVK3F8zTpponWoX3RexwHTFJfS3KFilM9PdhUIldzufmqOSf3UitkLueWg62po= X-MS-TrafficTypeDiagnostic: CY1PR07MB2618: X-Microsoft-Antispam-PRVS: <CY1PR07MB2618B0497A3F442FC56540F4CA250@CY1PR07MB2618.namprd07.prod.outlook.com> 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)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6043046)(6072148)(201708071742011)(7699016); SRVR:CY1PR07MB2618; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2618; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2618; 4:V8IwhpkyPWlLcawdMuOhhg+f6b/9grLbv6w176RSczsrVqNK2cne5CM9f1zjnG0OemJzLrRB6ThAy1HPFbodTS+OvbnuRzQKh1wW4aPBr7AGJ5kflhwgqawqH8ojHsnIr0px4uO2F2xFjEg01gFAX2Z0F0IMIPiLwAfbPi4QA8Rxf+xbWc9hx+7aE7d1Pp8Hn614HCeJ79ozniLY+/1TLuEatEm9rihbsc9Deh7CbWdZPC93/FxW8WtKSZx8gGRiHnnwbtrUXxm0vXvc5+V+kw== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(346002)(376002)(39830400003)(136003)(366004)(199004)(189003)(25786009)(68736007)(53936002)(6666003)(81156014)(14444005)(81166006)(47776003)(6916009)(50226002)(6512007)(8676002)(305945005)(107886003)(7736002)(4326008)(86362001)(186003)(66066001)(26005)(2616005)(956004)(446003)(478600001)(11346002)(486006)(16526019)(386003)(476003)(6506007)(316002)(106356001)(105586002)(50466002)(48376002)(5660300001)(8936002)(6486002)(36756003)(54906003)(16586007)(51416003)(52116002)(76176011)(2906002)(6116002)(3846002)(2361001)(1076002)(97736004)(2351001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2618; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2618; 23:lNIJRMOOCzExb8qa2jlD1tfEO27UMom7dVlklkzP3?= POlyuw54CPJCp5odl6OJ1JyJ24u2JbcNopsHlXsCnoNuqdgnzRJu2spUS2EOnicIy77xUk+EDcOfxTATggxdQttXz1WDZ+CkvzNLE3ONMZjq/Gaz8YsEiRoKGtiWt466af1wTreSX3uTLbBL+5z2nkZ4Oi83m1TgGQGuX0Qx9vgG9gusavj1lYNS36529HCfVJmVZiKWs0CNOqEcyNLsG6tSxtC3aSUMPFBsJJfhHpahiWF9/nyiiUFTLcHDznGnB8ssX0VBulRKH+zrQ5kz+xBN5zyhdeSWEWClcDDQZgIPX0QNmJLcaWsJQ7oe/iwV2zSJdvLY1xEwLdFH0tlIZntmZAwtq9QYaNopmKDVC1cUb0PBPY1jTiOSTn93Cujm+0LZODgaoL9R+gNp55Lq/lV4Cdm1hgWkLIj02TZwu9EnPgXtN448zfMWv5IxyxnFb8XxWqDjMC5C/YQ9DdTFadMTd1lay9zsZ6RkK9ZqwL05QFoMjECdFFnRvFMK3E/kYpOwX2yEZfpLmswbi53EDE9yI5uXejezPJsQGPubij3LpKXG6xMeWpjqpyLcBbUX4Hu0YwPg3pgsQeJuWA5RPSKhRrZ2/xc+kKiRN0mPXYvM4nh+7WCP+h/iNqwcwpgefmhFy2U6pRAirD9IJsOxLE0qi2wQcIYCMnBAbIn5+D5Jb2B/y3GaPP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1EEhi0ynoQKnBgdaV1v/G2VegUsEVOgGJTyvgHE7XdHouS4Xnj7dYH31hhT1fuRcsRShXgvBLORoAVhmzLBWu3+leALKT9UUyOtJqxZ92PhpZbKvC/gG6+XhN7W5Nj3jPc/41aCnQeVp+XzBEBAilzX5CWUVQr8YkBuN1qsKhS3qT602wPXBv3q671/u7OuKaxena7MDgfq3o9RLvp8voNcEFAQpBZYkTf06KKGnfEi6K/Y8fkcymtegsEuQEKAP9gSuXUQMvYkH11hicxw/e59w9e94CRPp/RIRahi6kVy7G98Z9IKhiLvGWjtydNcsslbjzN3z5H3qSNJXvjK3AeI2Y/aQyFHGH9CTBUrOY0No2aQHGeg==; 5:mudFTNO75Xg/X3dc4hZjxzjdLo5V1nGDvwepvYoLSBwEPNl3X1DcfWQskLJ21eykyjTb8nCQ9rqaxASXaStRAI09eyDBByOE7NS2Ue6C7wP17txvjeJuYZizsv9VrnaSWfKL7Spr19UJSZ+vZdm3OE3tPdB254vWfH9nTyLG190=; 7:O4/W+nyTDm62u9/yEwk7EIjNZUl/4aUpcMd8Bl1JdpTnoGT6WFTvLvHnmd8Hy+XuM6+VQ2+9TSFvZpvceL+/OBJYdx47V1JdDy61gdMqqbnFNszW+j+Owjt/tGp9fo4D1VCZXKVYEwLozYcYGAxS3cfsjfiO0bzMEfaYqV2Nj27wbKmvDPRnSganZxayxXAo2KniAcinKBkZeWTYIpEVs6JCfmbZdgDcs0BEq+XSWjsAu8HuQD2xX1pgWyRU7pC9 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 14:21:23.1202 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e85416a-e6df-462c-c143-08d5fe036370 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2618 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.41.98 Subject: [Qemu-devel] [PATCH v5 5/5] qcow2: Explicit number replaced by a constant X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: Kevin Wolf <kwolf@redhat.com>, Alberto Garcia <berto@igalia.com>, qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>, Leonid Bloch <lbloch@janustech.com> Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
qcow2: Take the image size into account when allocating the L2 cache
|
expand
|
diff --git a/block/qcow2.c b/block/qcow2.c index 13715bbf2c..6e1a717b71 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1322,7 +1322,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; @@ -3448,7 +3448,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) {