Message ID | 20180918152923.24824-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 CBA685A4 for <patchwork-qemu-devel@patchwork.kernel.org>; Tue, 18 Sep 2018 15:35:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBC512B5D1 for <patchwork-qemu-devel@patchwork.kernel.org>; Tue, 18 Sep 2018 15:35:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA5462B729; Tue, 18 Sep 2018 15:35:46 +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 520232B6FC for <patchwork-qemu-devel@patchwork.kernel.org>; Tue, 18 Sep 2018 15:35:46 +0000 (UTC) Received: from localhost ([::1]:40872 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 1g2I2T-0001CL-Fv for patchwork-qemu-devel@patchwork.kernel.org; Tue, 18 Sep 2018 11:35:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1g2HxQ-0007Du-4O for qemu-devel@nongnu.org; Tue, 18 Sep 2018 11:30:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1g2HxM-00049t-3o for qemu-devel@nongnu.org; Tue, 18 Sep 2018 11:30:32 -0400 Received: from mail-sn1nam01on0112.outbound.protection.outlook.com ([104.47.32.112]:11872 helo=NAM01-SN1-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 1g2HxL-000482-TZ; Tue, 18 Sep 2018 11:30:28 -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=VYKTeQc0J7XhyWzfbeUpyC7AneXfF8/LjtqsnDrBjN8MWSRksBowCULmcdh0X7VLzHfESvsHVr60KA+vYyx0sATqWZYzneqsjRuACVR64N8hdfmxWqjUjdjdx3Qa1zNbCKIRKlNvgcAcvecI423MURFe9C/6wPYzokcF2WUHfyM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2614.namprd07.prod.outlook.com (2603:10b6:102:14::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Tue, 18 Sep 2018 15:30:23 +0000 From: Leonid Bloch <lbloch@janustech.com> To: qemu-devel@nongnu.org Date: Tue, 18 Sep 2018 18:29:23 +0300 Message-Id: <20180918152923.24824-10-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180918152923.24824-1-lbloch@janustech.com> References: <20180918152923.24824-1-lbloch@janustech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM5PR0701CA0016.eurprd07.prod.outlook.com (2603:10a6:203:51::26) To CO2PR07MB2614.namprd07.prod.outlook.com (2603:10b6:102:14::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81a30594-bbd6-4ce9-fc6b-08d61d7ba7a9 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:CO2PR07MB2614; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2614; 3:QnMQ1yOEmbIYr7wbDD9IsysRd6TbB4OfOaBKp7KjgftzZM407O/VN14O1R42VRG+Lcc9s684236qCDmkIT1enT30ab0qbif80qpOfHw5hivznj/VOJTqnI7bpp4D6iTDxqbXfFf1/7zbvl3RCRx/bdmD0EQFAS7UkLPpGppp1wQDjhsT+sJyNEmXeKnLbxBUS5PWLHWEFZTN7gaKhAmf+Yj/f6xk5tF7pj787NfgKjq0IFTmU6r8zCoqxQTB6y6s; 25:pmOdyMJw+8ok11eNKl/NdbTT+OhxPgRYKtSSUz9F+/DAFDcaxItf7Hu9DcQfY5Uo6m5WDbTc5V7Cn+8xBLPm75uFlB8kCrrTEgiy84wILqpXTDc5DVFn7ejS9tUVcgXv9LwOX1NH+QpASEj8VFigfSHkGZd7VjLNRX1Hclak1PhcuSH5NnnhPWdzr0LLhK1KrLjgoMUNOuuKbVfcKloWvWiEKNuZRPxTwNiF5tOsWO0oOwT+xvphHB0dGksmJujNC9tXvpBvLd/dqUgQe1NMSpaDqe0wKxQ2aEZ+V+DrfvnHNfGmxbP7OXIXMt+AZ8Pi5HVBu03+af7qal9HdhXwNA==; 31:o8X7UWQ1BWoo/u6GQSMMZPtCGPD5LmFLVMvb3uSzlt6Yl1n5J6Me3lHiF6TqdWrxGGlUknmy9363SV4HV4gX9J+Wg9DKDYgToPDUIoslRmDMogj+lskxbzskKZmPviN8cQRehm+ODQDr2y3AGiosaNAP+A6o90EcxLcO/K5hjejBseGZQk1glcGUFag7D4B1OkZCfheOTDGMjH7C3271Bmm2BNlzO/CwuEZTcs3E01Q= X-MS-TrafficTypeDiagnostic: CO2PR07MB2614: X-Microsoft-Antispam-PRVS: <CO2PR07MB261449CDE2BB708E4A14A86ACA1D0@CO2PR07MB2614.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)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123558120)(2016111802025)(20161123564045)(6043046)(201708071742011)(7699050); SRVR:CO2PR07MB2614; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2614; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2614; 4:bUBCJapnGlCD/2Qb6ZjgzTdy6qnSwQZAcHhXOMIwqDN6QHkX4kd658e0qFQ/zNpBsvZ5opbq5zPD5B5ZtKQ+vt7NaHjuD5CMrlU/oJM9cffzKOwM53nudmIkZy9d3Lm4s9TOlKLqvXjDe3jwyWDLFP/DihLRrQhukv8jhn2RmvIW3UlGHm111Ris8IqpOrbo7Tf6GrXCeG0tgtEs4XvDAN64d/zTqaUZvq7RYN0LMYuiMq1tGl1TuBN02csWs2IOBlhf5LzMGa6l4Fo8yELHIw== X-Forefront-PRVS: 0799B1B2D7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(136003)(39830400003)(366004)(376002)(396003)(346002)(199004)(189003)(386003)(956004)(47776003)(36756003)(66066001)(14444005)(68736007)(53936002)(5660300001)(6916009)(486006)(6486002)(8676002)(305945005)(8936002)(81166006)(81156014)(16586007)(54906003)(16526019)(446003)(476003)(316002)(11346002)(2616005)(186003)(6116002)(6512007)(7736002)(105586002)(52116002)(50466002)(86362001)(575784001)(76176011)(26005)(6506007)(97736004)(106356001)(50226002)(25786009)(48376002)(4326008)(107886003)(2351001)(2361001)(3846002)(508600001)(51416003)(2906002)(1076002); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2614; 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; CO2PR07MB2614; 23:0zxutbg7szkax0/2qULSOTGFbvSAdtrvaa6b1bW4U?= scK57JdtFrypfQBpKUVhIrTSV4hv7TneI6ZVKrG2mLjN6p91We2C++fscINUROHIdJjwcy2cuilwRh5LHVAfeKb9pYkjQUF1Al06GRauXDYYk/y6LFCuXKNCMksbC2VYVaZEI4xeqqCq8jHxNbVw2Ho77UJtRaURZN1vtnQ0S11U+sMmJpPQIET3RQ05QtcO5q7IKtvRfOTGYo8K7KxV2Rau+8K/sAj5fn4Xq9rH0S4+HzuSvPCAegNV4jov6sdfIY0KSQsxWkHrc2EjFalY7FNIaHwYMJ8zBrVXzvIjrZyTTS60QSkv7PtZ6Pgrv8rEK5/FLDjOIv2/BlEsgFOS/8+TF2ejwTUm4cHbOffpGvm7RNFcDzOKrpVqjE4hVaaPeHhWG5fYrxU8zPo6xAuzGN+zXzW/5gITlEwwVK39qJbFZvHK870U2HCzriJLtwfOkIRw8XJwQKtXKSlqqwHP5fI4LM9ZSkKg6IW5rsqpdCmmPPuipMNK302VyQOnQXu+RYjJjIc7meRiNIoSNMYuU8ipBW/r6vWD4DDENN4B0oPyeFln/hb2fUnrh/roSBMa918Q5pHqi5weWDJPjuRTjJJSfjqRcmjbyqpGC7i037AmWTzuvhDTTTGnoxmzYDnxgfcuB1aq1mXq6qK8Ea+cZOtljcU2gTxWzgSVN2i+eJpbmFzqj574/s6/xvAMMnJC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/8tOW2mZ4Dd/miCOQdTGN+hLuC8BIuPF5myMj78zQK9NaFN+njayCZX9Af5515WNiASPQibMaKeYYLPGNdn8t2aGdZgHnhUWQB9Am6fTkGRXTOoFujpDv+MxUwOy2ItVn4vuA45Xub9CE1xfRYfUUV3sJTnxsAQjvxdPHcfzEDlHulw7X746HO0JjPQcE7bLTsuOE5vY7uzusZ9ENbnKKOnx3Mo1HDRJlIGpVxITlHdjUpj6CZZBWDFgZx6FP30BZpj05wAk6NB7YkctlZS7h+1A5/UKWASklCKtdkRYAwOgFr0s7zh4H9t/brYlz1sb/wuOemvTAHIcENwF8FbuUn0f2cHz7GdOCKWydJKjlag9+QveoxWPQ==; 5:j4QLYEXHwmcInLOyFcUD0NI42TzSVs5VYcVs5DWcFiZbBrqPTEuDTq2XQTYP/bjCeP4MrwJ/dkqdqkKrcbJM9jCfSjgYgc8diG7dx3A0UflwQ5RkF6XQXvADPxElNJbwHAdK61OyRfujYFA5pO0hDzXjR82qiOc6UFBy4uul1v0=; 7:ZtT8CAcr6/50oBh2bcjakkUX9qgPXvUnMDx/wjdiXi2u4M63UErEdPvW0wmynF0Wo7O9o7tx8TrQgpjFS2Q77cGWJYcXZyLmJVNZZ0MFE94EMBeAo9FXZf7zFIltF7zw9OqaHs6MTC0ZwGS17lp4djWUVTWtBnnxEb5y0ApC4znyGSUCIpfnngkoVNC86QGYGKYpZTbojJG6CAmWD0MmXy3z/7m0ZQgIHh1H3qrfzvpvZd3jb9ziNpdxYvMUSQOY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2018 15:30:23.1175 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81a30594-bbd6-4ce9-fc6b-08d61d7ba7a9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2614 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.32.112 Subject: [Qemu-devel] [PATCH v9 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) {