Message ID | 20180810062647.23211-10-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 50CB3174A for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 10 Aug 2018 06:37:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CE322B37B for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 10 Aug 2018 06:37:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B3902B382; Fri, 10 Aug 2018 06:37:57 +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 A1A762B37B for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 10 Aug 2018 06:37:56 +0000 (UTC) Received: from localhost ([::1]:54597 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 1fo13b-0006Ni-Vm for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Aug 2018 02:37:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1fo0tl-00073A-UW for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1fo0tj-0001qI-99 for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:45 -0400 Received: from mail-by2nam01on0130.outbound.protection.outlook.com ([104.47.34.130]:39856 helo=NAM01-BY2-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 1fo0ti-0001pL-VF; Fri, 10 Aug 2018 02:27:43 -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=s2B5HBAfuIKnZt11pQ2ykN1XuCD0HzTixa4L9hTeFPM=; b=CcY5H37DWsVNCX5f1tXC8dbJXP/NNbmiEQ4gpg9S467urdXZUVAd4m+AGgCm/2Vtw9Del5Mh+WD6hUZX6injNwxfa/RvziqSaoRH0EkqMbNM7uJxXuD8RISIsMHdk5VysLBcXOJnEKzV4wGbeDT6v1J75/wEUEXglB8kqV4Egg8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 06:27:38 +0000 From: Leonid Bloch <lbloch@janustech.com> To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 09:26:47 +0300 Message-Id: <20180810062647.23211-10-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810062647.23211-1-lbloch@janustech.com> References: <20180810062647.23211-1-lbloch@janustech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR05CA0232.eurprd05.prod.outlook.com (2603:10a6:3:fa::32) To SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a922cd23-0d45-472b-1557-08d5fe8a5fc9 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:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 3:b5YMNKtT03MOLNzqYfy4HH8Eq1Ul8HdeGvqaLGU0iygheDyfXI2UdqTwmzCLb9lGjVenBmpCSC/FS+laQ/Uisf40oUS63bu3eUleG9P6gSgOl8xAE1rjb+0kPjjrwkrgBCHYpjzaFzeRkabvqkqw2Q9TRSa8siwmK45tld/CuSAx0WKjUQWntjg5q7k8oyL69GNs91HVDWoLc+Bb4ZieGj6ywaxRtNqpQ/iTJdveteBMhxuFG9Wl+7Hl7q6Vb+oV; 25:p2ixhHbVe5uZX+Dc9nqrlsOIHVRd+YrSsugvHz05i8ex1I6oGhJI8p4goWruXk3ai+XwGNrZ2PiC/MOjrj/DkpW69u1ZOVU9o8JAJP+aPM1HC0HQPw1QMnxB5IZZgMv0nFGB9lJq/QfjaiZ2wWpXn/qYSR6zEx0JgNKB0gQ9Uzt0pOPIirVexljgnO+cj5cyukYgJmbnNI8qxeuQ6ChXucoqi0DS6quLMRFPN3hGHd3hFayIwBBdkSqxGMBGMTPGBf/5nQmbhR9Q/S579sVRHwvia1iHIRzm0FWbpBSRWAWg2P6Myrwmg/MlY6SB0p9s6xlMahOBe78gjY6JQgnelg==; 31:0n9qiLkxTiKuNtWQBzZi5CxaqTiQJbJaUsAWHcq9hdlnyFAUvSUAZtLtytzr9p9t4EOweSAFUHiAF7XecXB875jb6BjljSh9M1r+7ZVr+oo4FdYOGK1XbSv6r4kqEkeouNkzoihJKswaAlRnCdebFeeG03lqK9In5G0zIr5WTmmNd8LEBEyc8pxgrIjsM7ocUX2wjNG4s2SnAKtxmF3Hq0Qppp1kKCnEXldIBEvute0= X-MS-TrafficTypeDiagnostic: SN2PR07MB2623: X-Microsoft-Antispam-PRVS: <SN2PR07MB2623454D4611BF82EAFC216FCA240@SN2PR07MB2623.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)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2623; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 4:r+0UOF+yP+IysC8hkjpgZL66c1L8cyFsOz1wsTS9Rq4WlsBFtOLC6TPDR+lpXyDs2YNIGhrHPWLIyWAIEnMn9dNDnudBVAgEOoVk/RkzvBtSvszJ9H8srEzeHHYUqDjI2C+Ky4ulAtGS+0QtcSJByZILx3UdnVpHipd0q//8FouYBDPQWCavXAiTRNHh00U07drNvBkIhymwLveTqkNcfPW3k8j90Ow261jYnXhprrDs2zMeqfQ4bjEwTM1DluKZYzh2RP1i/GpeicwoEI2mlw== X-Forefront-PRVS: 07607ED19A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39840400004)(366004)(396003)(346002)(136003)(376002)(199004)(189003)(36756003)(2361001)(68736007)(47776003)(107886003)(105586002)(4326008)(5660300001)(186003)(106356001)(16586007)(2351001)(6506007)(316002)(26005)(76176011)(16526019)(86362001)(575784001)(6916009)(54906003)(6666003)(386003)(25786009)(478600001)(11346002)(6116002)(8676002)(3846002)(81166006)(50466002)(2906002)(81156014)(2616005)(53936002)(51416003)(446003)(48376002)(6486002)(66066001)(486006)(7736002)(476003)(305945005)(52116002)(50226002)(97736004)(14444005)(1076002)(956004)(8936002)(6512007); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2623; 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; SN2PR07MB2623; 23:MEeWuJXvUxxXDp+78LlRDj94oExUpHF52sYPdBGnr?= 6ef5845nepk00/qu/+4XGsYFshJ0oQlnnlZ/waD3j6ZmsWAZlg57psbvca6lmg+JV/rnfgNPfgkzgsiel5fzLGvPybazHrRw2dwDFitekMzsUYZ9rIPzl1K1hcaTjSp5LHsLnNXEWR9uvvrEVn7uuuqxu6OAKXiaaRlLVzusSiV3EKVKyeicr0Naz+8E0pQ340ZDau0gitP/1tOTBnfVrxtJ1GhUzbteicOKXRbyaUVm4xWx2pISMc+DvUKAJz0Ygx57kRG/acb7V0FcwBTMOLxLypID08KOqtKiigT/tsCSaFLWyheohFGNtOECUe1fBN0e5spVvJXFUZg9XYbzHAvYnKiXl/3zpNGxxYzDZZEM64qmvtjLGuuQg1rNqQKiyrPYvvarNq9j0vPuf07js10nvbFyCaFTFyRV6jzTjZoNX9gy+t/06nxudojMKmsDhUNKV7dG32XesJ8eDTr/bXSLTu1mndCTONVlWMbS116+WhbfUuYcugzHyjnUCQ+c12eGTAZv4lRu3fDBZgC3gAnX3ZgE6j5jF9+V2Y7+e9SG/2t+xvdtjwIxXxK62OX8dSAy1r7nJ7xitpWyCQRa2PYrw5laHqlyiyG06dIXks0IfDpVC26U8K6t0vRY0SF17oWQi4VYegAoZFEaaXVO4TFYMezNlaI+6l0imIzNxTZpmRTODTjk7QdetNHQQeOEr2xJJpu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Wtzu3E5GxgprmGhn/ycVcPuEF7wNLxl0Nms0+rfyqmSrJNIc8OSJ9wywVDI7xdDEMCdOOdZquTth7OlSG5JCIK/5qdUqwzcwQuGv5oKNmwpvFXYQ9Fhtkdlk06klVp9m1nDzeAUnEDJc7BAN5NhEnmR4ajV7ojw6qCjTi6YjRl3TiU9m1oh23Kub6pe4OgK+iCU77QRO6tkEhaRliQx7LL6NnmtZjKR/F5FyJ9m6XGkPg3mBSa2/9Ljs1rJBDSbLvIz/13L0WRRVDEdgHUTW8xzzfI2GDol2wcZmZdgiNP2hp11kplzBXtU35fe/CAvoel+y3eeasWw33nV6roVQjkqAMVmTlQKo3qgO4oB18yWs8l/E+K0jbtl8WQR4rdQpFl8JmUtrxsUIKw==; 5:eDSnE55gdV70UsTMeT/sI8+Jg4So++QS4YBctlQ7QRxQFh/Uway/BiC8Ilu6FLQQk/cL8l18h4HKVV0W0rLwqBOV63wSV90wBokKY1mXAlOKnoYreTi5AgdNNnqVSNe/EPOsq/Y5rkOVEsi98iKBmfx4Cb0ixVsOt9ajv6KoHTg=; 7:VkgiXMh5eH4+tZuft73XU3W8ze4lwJJjRt4cZ+NgeHjbLPtun0eeMEIikuMPg7/aJC0QkQQVs1PpOVuBGr+tqcihLM811M2W+tsR7Y9w9DkWQWRQauSl++ZDTBp/tPPliiD96RSTOp9dE2qWpa4w4jE47uRHmGsP8XLjbSznTHC+DZFDqe5E0c4WjN1T8u4j21nM2IZyO1ZePn2gLgcZ8kTCqDkydDk0iryxXYW5Sjv/8p6zBT4nSVYFbYiGVD5R SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 06:27:38.5780 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a922cd23-0d45-472b-1557-08d5fe8a5fc9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2623 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.130 Subject: [Qemu-devel] [PATCH v7 9/9] 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 |
Take the image size into account when allocating the L2 cache
|
expand
|
diff --git a/block/qcow2.c b/block/qcow2.c index b4f291765b..b0e20aeffc 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) {