Message ID | 20180926160447.5149-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 3721314BD for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 26 Sep 2018 16:16:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22EE72997F for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 26 Sep 2018 16:16:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 152F22ABBF; Wed, 26 Sep 2018 16:16:32 +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.7 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 8889B2997F for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 26 Sep 2018 16:16:30 +0000 (UTC) Received: from localhost ([::1]:59678 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 1g5CUH-0003jc-9D for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Sep 2018 12:16:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1g5CJw-00024i-ND for qemu-devel@nongnu.org; Wed, 26 Sep 2018 12:05:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1g5CJt-0005s4-Ix for qemu-devel@nongnu.org; Wed, 26 Sep 2018 12:05:48 -0400 Received: from mail-dm3nam05on070c.outbound.protection.outlook.com ([2a01:111:f400:fe51::70c]:44064 helo=NAM05-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 1g5CJt-0005rs-Cc; Wed, 26 Sep 2018 12:05:45 -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=q5e0yaAAra3gKwOjak4dBYkP3OSJ2GBKqoB1DeO+tVM=; b=NhLXNv0xY+fhGykX0W6JuUBI5dBg+ROJ+9OVJx4JwPplvo9vpkm8uxsO8TJ4ysuG765+239st+BTZLgwWbw1kC6BhuaiZCHPGWiHea5R1xrbLXnPzYFgUlUioIhBlh3a/8lzUz2q5lpcZng357ldGVN1W2Tbm2qiYrpWJ1qhc1E= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2619.namprd07.prod.outlook.com (2a01:111:e400:c637::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Wed, 26 Sep 2018 16:05:41 +0000 From: Leonid Bloch <lbloch@janustech.com> To: qemu-devel@nongnu.org Date: Wed, 26 Sep 2018 19:04:47 +0300 Message-Id: <20180926160447.5149-10-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180926160447.5149-1-lbloch@janustech.com> References: <20180926160447.5149-1-lbloch@janustech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR02CA0116.eurprd02.prod.outlook.com (2603:10a6:7:29::45) To CY1PR07MB2619.namprd07.prod.outlook.com (2a01:111:e400:c637::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9be4d355-9192-4d40-5f46-08d623c9ea0a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989299)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2619; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2619; 3:WzZ1gQxmJWln/uXt/K93aU6JnMGnWxotctq5vXW+nwuhBx9wjL6tiS7c0iqyJfzNddDG7da6GvHbHy3rYyk3gjCGqDdkaqT1tcjgN/pqUKhV8jysNfwavki7hK4zt/BL4Vfli//vZn03anFzl8UgTQXUVrDesGkCi33d0hmpjNXbCCp1bUf/+UZxrAvJN7Krf0cpezRNF9G1znYMUMsUf7fPuoPH8tjJXEa7LtDe0pjCsLOk4bk8N/O+GqAkcf+m; 25:BSuZ6aIRdKU5IIKJqPIHlu52RwzO/NW/rhp6Lkex0RP4kG9XIdNi/TnU2yD0P4uZOIUSzJa7kT5I4JiCUxYejra7v9L8a25NO/aMo+K8kb/AG4dqkFZLVao/rJR1K48EdPmj/fRWJDAarGTNiMSiJ4iXvIWTMaQwxWTif5wcuQ9jEo5miyF8Ary3RkrajaVRpZejWmz7Lx2oMcZLdU8EIy13KTuI6gCo1fVFsWsDugV/gN9tdL/t6Kd3bAy9IZ4avcDiSufa1vNqn2xftjwFhz5MHC6R6wqUom7nCf1lez3LyvsHPocFAlAOFv9MdfF+t7yH3LvvAQM7WXD7YeADHQ==; 31:sBFMEr6ytAtRmF5EtMztT5tq57ki6E3W6VRYxEAG4pBwGVXEuuv4Cv/vVt9WXBS/ihrgqyPzHCpm0WuRwEOEkYV2ziOnPDceeLwrzAzSEUg7dOsZiJ3oW6Q95XOJsL/HXqgRQloufiurUcvVT0rNwANTLezYS6HGiMPRblcpYCUb99DaZvxTsDFjhEg4lM23ONNFr+hDl1h0SR6fWRFcgsGI/YRoAOUEkK9DSIBAt5s= X-MS-TrafficTypeDiagnostic: CY1PR07MB2619: X-Microsoft-Antispam-PRVS: <CY1PR07MB26190D3A14038E8814097FF7CA150@CY1PR07MB2619.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)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(149066)(150057)(6041310)(20161123562045)(20161123564045)(20161123560045)(2016111802025)(20161123558120)(6043046)(201708071742011)(7699051); SRVR:CY1PR07MB2619; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2619; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2619; 4:TSQBaBGO09/8vzV7s8BUH1G6XZyGrY9wP6nHHhq8Yl//846jn9q3TUzgWmkuxbKFeJ+LwIwg8aPPTfnFnsavweZy5d7sPNfuAXcyyym8mBfaXK6/pCMpsEEnyxYI3yDDEGOLSxavKCunAOLI9b2f4NFnwAjaNGCeeCdArHCIQDS4edNlmReRgrryetipI6eKNnz8fJqqK8hoeFn9eF/yiuyABakRs+uez3rFHY/LN2nYgYdI0vn5tis9zWQYk/Pt1KOrEt7MFFxqtOBfmorjsQ== X-Forefront-PRVS: 08076ABC99 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(366004)(136003)(396003)(39830400003)(376002)(346002)(199004)(189003)(106356001)(508600001)(66066001)(6512007)(47776003)(4326008)(48376002)(2616005)(107886003)(446003)(50466002)(956004)(11346002)(36756003)(486006)(6486002)(476003)(2351001)(105586002)(34290500001)(316002)(16586007)(14444005)(54906003)(2361001)(3846002)(6116002)(6506007)(386003)(1076002)(51416003)(52116002)(76176011)(26005)(2906002)(305945005)(8936002)(81166006)(186003)(16526019)(7736002)(8676002)(81156014)(6916009)(5660300001)(50226002)(97736004)(25786009)(86362001)(68736007)(53936002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2619; 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; CY1PR07MB2619; 23:ObMWlRd7l1B7W6U+AJFU91ocRmh1mdkJnwOn1MD95?= bG8lepwik7Bu/LGgZlDhA/bAbleYfXgihwdWEhFhxacKHrs3Veuqx//U5arU3uM05c3j64xDKfa9zQvElSRZUoiq/lI65Fkea9S83iCpNVoaR80AqTga35Xl499Nl4RvTXMlr2GUlSkn9YLvH6kKlCgDTF9XCGWfmtvnr4yoSWlXfCK8sE0WYHjpdJ8cxgUrUyvP/sMBR1JPIr+sxlceiT6efltsqmMSalHrbjP69Jp4l1jG2pz3H3SjB3rqimylUT1t2lAodY4El792zpLecc+iez3YNVPtaFqwDGOj2/o2ZSQuxdVnqP6VWWeEzj3FD7iuQkGIZwgvk4pKTcRM8PeAchvLOqfaduUmPEX+SuGN3MMykAuqQQXx5GVhXjWobDfEMNmnZL1avj+2PtrR0CYK/MI4xTuzkfOuir9k1oI2gg5q1J2+Ih5UlUvTORjXC/6XgDkdcPbLC86esNdn3wuHyiWrVXUamyuyunzobqRt0z+Fn2zWCyXZclX8FfWFWm8Hxcz9s1QMBoKRYwhlCXbhXZAMIF/bdi9vt4Wc7Aw7oymRiNBZqz4BgpOtl2yl3aLEuQGey4nBIbHQQKuN2ffaTs1k4HLI73Hj14SrBq8xcp+RNlj8sTsv/XrezFaS/4pBngw5xVcFCg4uVwMaNJk7pg6Hm9Gzg7T5Ee3ON49EEE0+HQqiD6FDxkJ1zgU1AyEN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XJ1cbWC2RyjpaYcOUCyb22BlGAzaUPimecOv2u+cm69Nuk5aoJuluC4D8spaSh4bf/SBo3QuT9x4bLyAU84d78HaOf2NShuXzqaaGORLB4Sy7DXTOKpS16VXHRK5e44/s6wa7ufknKT4c5mIJgkJE/0dDPB4KNvd3o0WBKFCXRpcBCmCJoeQ5FB8TGpIWp29jBZ9AjsyP/wp6NoH0r9jiHHK0wRHpK3zgRuwiFBomFoCghWtVX//GFEjsNC645gswwih6Ql9sWY5/DlJoaUgFY++5x20Cli6Vw4QxuzaIh9K0y5TPO6ZH0C31LM1Z31pGoshrex47nWjXU8tdYB5kVDDC1o9a8Dx0OqbK4EXig==; 5:NRaZuf/o772pWN7PWQhwIBHHdOImZj01arDvWBAQ88K9sB/zrg+DFhZJ5skDnOWLAnZqL8ECR8szv4E4RS/iSnpasijpJbTn0ii9Y7FJT7ya38Q5y5ASo4Q7r6W/iLmlaFoTj9VtUj/L1sHkD93HuxoWBHzb6DyrlNl676sUHgg=; 7:Ue2YrpxTmDpSGkRKYdhXpPXn15zbnjl5Zd6LREZpSRPOPR/DuMsQRL/pJQ57MJk+7zwZoNYTdxbMKwnzaxRhoV9OAKOociO6geCEWH/Yksp4+s4I8nEGyE7qREqBIqLuZFIpXOvswKaJDEzKA/0w8JB4kL0V8wgf9lPyXXc5w39roYGG7vOiCUTxsjTtAAvLqW9Mp7ciB46e5k1eG2Krx8y9IkMDm2R4ZGO7FfQnRFJgbfCqdMkbt9upR39uOzuM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2018 16:05:41.9185 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9be4d355-9192-4d40-5f46-08d623c9ea0a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2619 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe51::70c Subject: [Qemu-devel] [PATCH v12 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 95e1c98daa..7277feda13 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) {