Message ID | 20180921172310.10068-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 C19575A4 for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 21 Sep 2018 17:28:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6D1C2E33E for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 21 Sep 2018 17:28:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AC982E354; Fri, 21 Sep 2018 17:28:28 +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 235D52E33E for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 21 Sep 2018 17:28:28 +0000 (UTC) Received: from localhost ([::1]:56725 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 1g3PEB-0003MV-G5 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Sep 2018 13:28:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1g3PA2-00084m-SD for qemu-devel@nongnu.org; Fri, 21 Sep 2018 13:24:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1g3PA2-0004Il-1L for qemu-devel@nongnu.org; Fri, 21 Sep 2018 13:24:10 -0400 Received: from mail-dm3nam05on071b.outbound.protection.outlook.com ([2a01:111:f400:fe51::71b]:40250 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 1g3PA1-0004Hz-N1; Fri, 21 Sep 2018 13:24:09 -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=qwUAp4YzzERDI76s4ULzANf9hAKOfzQBXFzpa2umNgAT9eSn/3baRRJS/5ZJO9m2dq31Vg5BYYO4aBJjbiYdx1BIjon0EZxwN9O+t30R0OUN4kG24oAABNiPF65qH0Gq+EW0GlYM+JeFSSVmpwCvEN6UNguVJEKdKGZ2MyALnQg= 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.1143.18; Fri, 21 Sep 2018 17:24:05 +0000 From: Leonid Bloch <lbloch@janustech.com> To: qemu-devel@nongnu.org Date: Fri, 21 Sep 2018 20:23:10 +0300 Message-Id: <20180921172310.10068-10-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921172310.10068-1-lbloch@janustech.com> References: <20180921172310.10068-1-lbloch@janustech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR08CA0065.eurprd08.prod.outlook.com (2603:10a6:7:2a::36) To CY1PR07MB2618.namprd07.prod.outlook.com (2a01:111:e400:c637::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1d7a9a7e-0a58-4d3e-e70c-08d61fe7093b 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:CY1PR07MB2618; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2618; 3:astMrqgkIL/O0DbjL75qXpRFeyA8wCLfWjh/jvcSXDQPGh4l6iUWClmEJyiLGdIk6dsJyXxelRIPSBQ5+9MiYjaM8sNu7UzWaSKSI96C8wggO3uw9QCALSt/DD/kbiY5cY9dYEHdTXguvpPvif9/dOB4F08+N5jA/l9kPP5FI4Q7cOqqZck21+b5TNWHZ1qlvlnzHN2sg2AbQ8nrd26lSEmm362Hli4Cm0/1ZnOXZCnTVn5Xm18braPRfqbv0SR9; 25:dHJDAmk99rttS6mXqMMysTYfl0aJVX/7XaqaNh736uu7HNVAk9oLSw3TEFjw69cRWCb8O94PDWFeoKzfxhCXzFw3ehZvZfHWqcAhIc6RO6laA8HqCxmF5sk/D3c3rEWL5l6DAIsSL7Dpf6bbNYB7ZbwhZucmuC+ET+1/7fcLod1R8gszNpySN5coTSBXkJDKupk5e0C2Z6wywr4wSxBuEjDnBCSBzieexGK4RJgkWnjtBCkcI3V7s9S/Rvk276ogdqNf9tCZtLfLBoRx2KSfuJHVce4GEPPiLlI1I1ywKBcouG1YmFdwCub/BpDGJzt6Amtks+cE4lc48d++KPUwHA==; 31:ig22fG2ns0lABdt6wurUXzodekRdrKQfzU0cFMNFCDQRnAPEbMq6Ltm7rGFxyFygpZtUSpNjqOpiQzZAwXIpwp3pkxZroIQmD8uOZ/Np5Ok2eUmcAUOs0oT7v8LrjhQk4vfMoh7vQHmRYJdukppxn5wovXwzecCrj3gQ2mOWjx+6eNpCHrxrpuBU38X71EYYe0LQq6xjQf5ghHLowZjvX7PJ9DUE9IgnIoQMgHtEoeY= X-MS-TrafficTypeDiagnostic: CY1PR07MB2618: X-Microsoft-Antispam-PRVS: <CY1PR07MB2618BA2B52BD8183F2AAD235CA120@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)(93006095)(93001095)(3231355)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(2016111802025)(6043046)(201708071742011)(7699051); SRVR:CY1PR07MB2618; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2618; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2618; 4:B237kalYO1o4DT0mmV2ujVJ+bS+nRsOXQtb1VkbbZRtflqAxKy6ZRbYEiKGktQUoPgYZ+xf60Px4BCaG0XkG0EbwBPZyHWoXlkDiwsT050wVvqJoIZlUMdDxe3xqHG7kRfeoylk7CfQzJiSs8Cov3Qv/NEjsAjK4CxMbgWZbdQjSddTSO5rAcA87C8Iln2O797JQaEVvANzQ4V1Br/UxifXcNQ7CncClYNSH0Li04Eb280nJfCwfkyUOTHxk5PCPvvDQqSib8vh2+By6XLX+cw== X-Forefront-PRVS: 0802ADD973 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(136003)(366004)(39830400003)(346002)(376002)(199004)(189003)(86362001)(68736007)(50226002)(106356001)(8936002)(1076002)(2906002)(6116002)(4326008)(53936002)(305945005)(8676002)(7736002)(5660300001)(81156014)(25786009)(3846002)(6486002)(36756003)(6666003)(107886003)(6512007)(14444005)(11346002)(81166006)(97736004)(508600001)(47776003)(105586002)(2361001)(186003)(51416003)(48376002)(6916009)(50466002)(486006)(54906003)(476003)(956004)(66066001)(6506007)(2351001)(16526019)(2616005)(386003)(575784001)(316002)(16586007)(76176011)(52116002)(446003)(26005); 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:mmguttPbR5ODBBNFgYFJ90tFPwW/Vwhi5qww3MmkD?= nuUspmbTvuHhc7Cuh1GiHPSuHBo2Sejeb7w+lsQRULyXbPOr29yVAXM8NAwgPo9LQ0z0JUSx62w0KLPrz9dWpcwiOI2XIT3x2aVzmuFndOFffxG3mF2UGMOBQUdyWKy+SDLP06POdRL8CwDjGe0nFTFS7IoFaQp29u0Xgsq7tVRg/8qQlmtHJ8u9pj6gkETqkeKe7Lzawv3lV3spJtNMaBFj2WvN76gwXRe8HuMb4wpitLNSGXEOxcwdaSiKECTA67eSE5n1mRjlFtt8RsTzqu0rDTBrBlWcuT962VNGC2Fnn2Q+9gFFdCadSvqKTZRMdIZzdiViWfBM61gNAo+mmWQo7eiQQExdjM5590bKW4miRIjRwzylfjrMt6Xrut9LRpY/6q1IEuFl5jJzCiYYK+YSUTJLzzU5cWSjEIOfv7yaOoCI9DPgBeoHBwJkPHG+0a6JBTb4U8rm8k6BIdAYV78GDKMMcUMSmJZSgehEYE1Bur5CSETBZlS4C+0CED2UNFuZS4D98H3hyHcsL1ro2Q3KB8m8i+fRqauKyAXY0pAn4B4tqye/rjfnsRPhHI7ygGFZJ+kDYGDjoKd6mhDcB8jCjpBFODoA4n9Iau5hvbF8lr4w4QFnQavifRHkGMNqo/EW4ANOPJ6cgbY0biRbZpPBrPQsmbxFfRhd4QkbItADvr7zO5PUH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+ldwPrHJY9RLjBU5sPNd+tTKLnnOgie26yRVJnIZC7cuada79M14j09vto937pVLdZZiYR7FsnG0xsQ740kc2zT97cvmrJZlvVf7Cug12LO8F7FefyidW2/+k4CCdVCMlnP8AwT5Ql7SMVJDjl7tu1VLUudtj75FnBACjKK8sugwLE7+51mfYxDtof8kLz8usRuGIjAoCCp15meBP5YWnDHv4eWMyJ4K+k4TYEq0APMzHEfgPZyewed2iUsHk+nzQDqeGTl6/iGUBHN8jDNsGpPYUd2+C02mO99l5/Uw28+1lsZVxwuNt83znK1MlYFL3+uCL4LIye3LdvR2+pmz3KRumid3n7VMguj7yWNNqUFlKQjJnPSyfzIJo/FiRNcEJqdm4tm1Qhpt0HJQ0yqoMEssA==; 5:oTukDbBsPxcoDV9MYQDCY53Y4cdQvcD1g2NcC2+O2n/Wk6fscGdYTrufEtoo3T8kWyOQ68l1ziYgf0/L4q1Pxn9ttdslzCFRPLbKCGIEED95WzRxEjO7+I7wUrfeWqgjTVPk+Jls7qV65Bi5C9I7lNVeWoiVBIjZPxyxviDACPY=; 7:pjceDWBORSrvFyK+GrfVWP3RnBckXZrAQ74U/bJQ3/k4SR1oqbwZL/GLchtjblxeUh7Oo2S57ux/8fypcGK2OthQIXPlIP71x6fw/mc5jUGyLjIDPR1eli3naESqmQERbrMhaZT8wjIll1I/fyqmqNZM2DaYw5xbIpxySMZS3BdvbGk/ddQ2fg94DIIvhVo0/pk1mnn/3Sj7B2woBeAJq5PnmVoDtQYeaC6G+F/ZEnWt6FSG0TyShazL2gftJBfG SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2018 17:24:05.0143 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1d7a9a7e-0a58-4d3e-e70c-08d61fe7093b 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: 2a01:111:f400:fe51::71b Subject: [Qemu-devel] [PATCH v10 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 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) {