Message ID | 20180809215307.18241-9-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 E27711515 for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 9 Aug 2018 22:28:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77F262BB58 for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 9 Aug 2018 22:28:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 690832BB5F; Thu, 9 Aug 2018 22:28:02 +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 C9F232BB58 for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 9 Aug 2018 22:28:00 +0000 (UTC) Received: from localhost ([::1]:53300 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 1fntPU-000468-1g for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 18:28:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1fnsta-00052h-Il for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:55:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1fnstW-0006p9-So for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:55:02 -0400 Received: from mail-co1nam05on071c.outbound.protection.outlook.com ([2a01:111:f400:fe50::71c]:30903 helo=NAM05-CO1-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 1fnstW-0006oN-Ly; Thu, 09 Aug 2018 17:54:58 -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=g8NCtHJdRVFiK/MXyCIrGchSaaVhaS3RPtdhvjsv+A3sc3NQvBBlGusv7tWivhp91x5iXt5MYZmHWMyUEOPjhgSVcriMurbTMM4oCJX0GzmLWdamRmF1XLPa0P/UfkwqDUCbrs55Qv0bNYUHvEQmDH8FUukh5mm0S66hj78wU4s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Thu, 9 Aug 2018 21:54:38 +0000 From: Leonid Bloch <lbloch@janustech.com> To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 00:53:07 +0300 Message-Id: <20180809215307.18241-9-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809215307.18241-1-lbloch@janustech.com> References: <20180809215307.18241-1-lbloch@janustech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM4PR0101CA0050.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::18) To CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c185b32e-187c-4974-a87a-08d5fe42b52c 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:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 3:7+g4NdfrqZbnUzU96Ke/eUvYaHWYWKSOv3Wl2tvG/7qnlL6ojODC4rwJahud6leT9EQzDCqxqhdI0LAlWVLtqtCz20hhX0wty2g7fOJdIb4peFqMjQTroVMfcoo27a5LIpjcGLS0W56usq5DA7bl+6q1Rt4nOBVwlNb0buvc2d5KvxKbKCoM3bAS4aJG3OSryEKI3cYvsTrfR1el43g91yylojo1TfyLdHNrrq6fywjirFZOkcFKe6al85aBwmSY; 25:PIiHomqMNDrEBYyHkjx3eTO5cyAnCgNZlxffBDPJItfTqh/SWHHi8gcWAKq/5NQeUc/8Emkexkp0q1jflS9ZgHRtTuBUJLLSps0ecrCNQ3lA2ni0OLz4zfvz67bFtIgOiUMW9aMbr5mkROlpFFfiuQSzsJ2KFBi0SfiZcaIH+IHCIeQn4JBvSWGVWnpZ2wZHfnV7dsuxgtv/T072Hf+XD/IvO4gST6CbJiDKxfdTWT8ocgmycUvTU9S75iSGZt/I6d1WFQ0Y9Ef+6Z5jFEAuWg/F6cViMRWRJ6QoDKPNQ/gOLEpWe42xHUyPqi1lLbzAjlg5P8LhDQcfQwAhcnb9FQ==; 31:jmipbx62u4YB/WunTZqfTCxGtYsBJMg2L2jMnl0cI4nnlAD/xlL8V6CL6c+tizVqLdeNc/eswNHV7N3jt2KXztjLp0xxCFCF7bb9hcFa8pzoiIb8KLW3LzNOOs51KXBC5VoCq+f1Y2wb+vMfjLM7v20hGCIvgyWVz6JSy6VLaEhNTo42oONxtVgIEuIhY437qbWmUmnkdhCbSk03vrgtE5/1p4rQ9H5NZN8qJOEe594= X-MS-TrafficTypeDiagnostic: CO2PR07MB2615: X-Microsoft-Antispam-PRVS: <CO2PR07MB261535CC6ED195B3DD2A0B4ACA250@CO2PR07MB2615.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)(20161123558120)(20161123564045)(2016111802025)(20161123560045)(20161123562045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CO2PR07MB2615; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 4:debF3zvZLzCGv1EEn1OJUob5MJZq2o/5HM+U8Ec1N1r10wZzwvIATKSTugPmHMF5mpuQTIgdUiX4yUWlzohzyEKFoexRgQvWLVHCXhILmHMrt5GdcREqL/ImxUGB1+v3HJfjlj8Cue+d0PLQQMT6/Bmue+4QT0GMlACy1n6HhX5XBd9zwxBJ+4715RUD1DNhcui0RnUmi1vyJnSDJpWbbXET2UftxN0mbaOOxuZl98bowrYw86KfG/GeZS4Ly73NIXkGajzufllWzgK86F0h6Q== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(396003)(136003)(39830400003)(366004)(199004)(189003)(486006)(2616005)(16526019)(86362001)(6486002)(7736002)(8936002)(16586007)(48376002)(575784001)(478600001)(446003)(81156014)(68736007)(81166006)(186003)(476003)(26005)(305945005)(386003)(2906002)(8676002)(50466002)(50226002)(14444005)(956004)(11346002)(25786009)(316002)(52116002)(51416003)(6116002)(6506007)(1076002)(3846002)(5660300001)(105586002)(6512007)(106356001)(6916009)(47776003)(36756003)(2351001)(4326008)(97736004)(53936002)(107886003)(66066001)(54906003)(2361001)(6666003)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2615; 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; CO2PR07MB2615; 23:8niszRgGlP5HALt6iUFJPUXlpT6Fbd1RFhH9lrBa1?= nZWd/a4DIK1VSZOWYzJtG50k/ixSYC6NAfLnIpVmxKap9SISSOMRssW503BEDvWCW4MUHJHdD9+z0qXviltt35LnHxqCC6TjECheQ9hPMiqwFOS9UOPR9xufQKsBMDaFpPzcsgahijABAt50mSSkoMBkGzf9xbOvL/WJ1oquAVLptFjA1yoDTzphDP/WMFRZNFOEX1adMZYkTCavW7+xDqZofrMl/w5ne2JZHNzBOWw33ZWFm7oUhGKa++V3C2pHoHrMKXtpESeErvhn/QtJAY2KN7zykQ5EdBAMI+Ho7FhQMpZQ2ON1lxJJpI/ka6cftyH18EvlL6XF4XVwZLwdVdtppUrQlIhyyA5LFBKnDOQIvasidh8cBJXptO7D4nd+0wZBE8jTdoAVmhM35tutTxmVOCPedCsbf6FTjsK05ayG27ZXseZiJDmoxUpuU6RmK7bVzJ6l9J4RiogMutTum2Az7TCJdCeADu6CJsWnv8xbuT9KEvS1U+AOojVW/N8HFo43v3ujjuch/kZh1tqqiIM0C3e7PRb8vNm3/vDfy1fjuT5Z9o/na4Uk4uI1k+KYFFNDVDFaC5p2oJhh7EEiRrl65l5gEeOtdpIIE4YNP1ZAg9naPSGPfg4ZVWfkMBxzWLfEFio4wywRh5gMrBYHzuzNsktQgWDYBKex9flN6ejIKkkB2me2WvjFh9P7i0+Cz26QuE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JRtyuqW2Y6bq8FOn8ZSuT19YGMgd86quqvWoTCHMss7fL7I2D1yaHY6s1Ugp7IKUrcmIXfVeI2GFHzxvDVpJgH8ZGEYxkpzHBPYMkJKvqdBaY7rwlAsjc+65YWIJ6YPdDlnbFbJeKlqtGYG+BO7o8QGpfFugtwM5nbErCd/TOCmUTX6VM+rLBUaCxQt4tPwG3ECYTmFlTAl0s3BflwB0liKzFX0fo1x3fUlOfmYsfdLtLeWWvY3ORPFUl1ec1DB4gMBOGp16JEYDAo56h3gJCEYmrAIUkniNAXjU4QQCbQ4zBLeBReskrsQDPh7wMqLuNzCUZCR/4tladX10BhdUmXH/aGQjVg2w8ymtgyZ0HvoLWLsc1cVx2ugyAMHW/YJw==; 5:iF2tD2CYmu1MxTLq7tHd59yjZqVbATW1xTtkKMJ83Pn7yIppn//AlTRDZo2nFAGxqb4g3spZJkVvj5cscnC+kmjHb9lBglvIo6JqdUVi9zUxYtGjLuQWUfwjg0FzFz+7eF83Jku7D0NUjjYY0wYRTIpvoz777NDdvPeUX948sAs=; 7:87h3Xp7i1kBktNK03HcszGKtPM1dLcp3SL5jcZiw5Ey9pmERBS7ItNwIkZsrjuSeTGDNaaaH3041wNbrh4HyIJus9egt6YBeYt0Wo9bR3U6FDrN5poPy8pFJ1dJXExtbYKY2Tx6HsrIf2FNLUOZPJPYQP7liy4lJhebxPOdWo3LowkjBEkij1SWuztJEZjncC99RB5HfYfKQjPONwpjvlDZK4Bdt0s9nlhAMfOxli9SQqyil3extamaPyip/E3sf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 21:54:38.3474 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c185b32e-187c-4974-a87a-08d5fe42b52c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2615 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::71c Subject: [Qemu-devel] [PATCH v6 8/8] 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 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) {