Message ID | 20180924225357.24245-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 6B80815A6 for <patchwork-qemu-devel@patchwork.kernel.org>; Mon, 24 Sep 2018 23:08:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D65029908 for <patchwork-qemu-devel@patchwork.kernel.org>; Mon, 24 Sep 2018 23:08:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60AC329915; Mon, 24 Sep 2018 23:08:31 +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 ED24B29908 for <patchwork-qemu-devel@patchwork.kernel.org>; Mon, 24 Sep 2018 23:08:30 +0000 (UTC) Received: from localhost ([::1]:49149 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 1g4Zxu-0003on-2l for patchwork-qemu-devel@patchwork.kernel.org; Mon, 24 Sep 2018 19:08:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1g4ZwI-0002Zr-47 for qemu-devel@nongnu.org; Mon, 24 Sep 2018 19:06:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1g4Zl2-0003YY-Ea for qemu-devel@nongnu.org; Mon, 24 Sep 2018 18:55:15 -0400 Received: from mail-co1nam05on071f.outbound.protection.outlook.com ([2a01:111:f400:fe50::71f]:6784 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 1g4Zl2-0003Xg-7o; Mon, 24 Sep 2018 18:55:12 -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=jS1XoaXJ2fQ0eWm5KWEhHbY5Vo5ZTR5O4rtmfAvoSbU=; b=EQxMObBjoJvU+UKZfs3SvsYNLawnsmPOH7629EI9mFOi7Nv9onFKZdY/b2fo/YCgEDYA+c8xZUhaWIn6MdIALzTjYyjOgHZq99yFfsj17XAAGNfs46B1T503ZTqi1f89diwfwqhIeDcImntFiur5UymUYOtmkfLt/3SLRc8WRyo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Mon, 24 Sep 2018 22:54:51 +0000 From: Leonid Bloch <lbloch@janustech.com> To: qemu-devel@nongnu.org Date: Tue, 25 Sep 2018 01:53:57 +0300 Message-Id: <20180924225357.24245-10-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180924225357.24245-1-lbloch@janustech.com> References: <20180924225357.24245-1-lbloch@janustech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: LO2P265CA0063.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::27) To CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f06931e1-9462-45a1-3410-08d62270bd87 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:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 3:YOOjLPq5K6Li/aMZopJvQgDBNG9/ToEknha1cjZsYSbV0HHw8tLazf1q4y6jQ1v057Eq04NxcVHGDnuRCcAdv3br1Ss/FpTmsJlyecBJ3/9aoi12RuoP4ZPsBQtU8NKEz0/gV7HeacG0N6MSBYyUqNzBaW1KV/R8KenHZz9c+yC4k3Blq9Fgy6tOPyhjSOx3cUarObYUIA9/CudH0j0esf2t6msNQy+ZTUCE/MSYURrBqTdRP1myLvCc92XJtIlA; 25:VW3hfCVxWbrhA90TQ743ftsWDVGW2liNJAHVP4r4ZCUfua4R8Wgu3szkNS2j5oy/x2WWdkWF/yR/M930WBZwPW71tj13cjG46GJOMPlqTcUlyEdnjVG7nKZIBAf2/z+TgrAt28ccUYHCW3afeBYUI/SrE+gmQmmj/N6+a59s1HTnOMcGFHz90N7LZUQHB8WZUse04JXh9LQ4AE5k5oiwemSVvKRi4+SRBodfpMSvir1siVd4Wy2fLHgatuMa8bpL0HiLh9IetjS84Gx2OPGDsIpo8e8X7+NO9fC3gBOHBu9wzAXGbkLUgRcSJsRK71eprBQEgc/iASz0ZT2z9XWqiQ==; 31:NEfRuOwTZdPXXWETYDeC6wwQJt1FuAyH7w97mLyH41WjiE9pFm53fp9hSiNLPHQIOFBpg7igAqax63r5eRFwN81e3PpWcZhUCOgjVPDlMPplStfgK7kUmRLcKF9JXu/pAbl2QryRnRLOjknAi2kqt4hkaj4g7RXz7drxjGSJa6427toD3s0IoCUhWLQzlXJRgtCQacoURrcvawtu5CO8chUvl8Yk9SR+/8WI7ua+ZOU= X-MS-TrafficTypeDiagnostic: CY1PR07MB2617: X-Microsoft-Antispam-PRVS: <CY1PR07MB26172B3AE25B4CB34ADDFEC7CA170@CY1PR07MB2617.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)(8121501046)(5005006)(10201501046)(3231355)(944501410)(52105095)(93006095)(93001095)(3002001)(149066)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(201708071742011)(7699051); SRVR:CY1PR07MB2617; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 4:py0jB7vDjPB0zQ6oo6+y7K+K88P9m+Fsj2mrJtwCpBgkBL9tcGYsxpg1FK20XwTWV21/R5PXm1UT1HPYsWQENawldudkJ0nHVMOEX85YIhveeg8Qh/G0r8X+38GWQ7DXDs6nAHeWHTV7+2x06dBUbiZfDeUdoAPheoXvxavgHIp2/yUDmmIadC7PyI3BCQyGNLBpLtnijkoT40ktUwISRxe1yDZQHZM/j8zCwjKVrd82q0uPYTkmaSaOqKiH+htd39k3ChBxmuehUJi/zPw+dQ== X-Forefront-PRVS: 0805EC9467 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(346002)(136003)(39830400003)(376002)(366004)(189003)(199004)(476003)(54906003)(68736007)(14444005)(956004)(2616005)(16586007)(105586002)(86362001)(66066001)(7736002)(486006)(47776003)(106356001)(51416003)(11346002)(76176011)(36756003)(446003)(6506007)(2361001)(316002)(52116002)(386003)(97736004)(186003)(5660300001)(8936002)(16526019)(1076002)(2351001)(81166006)(8676002)(81156014)(26005)(50226002)(6512007)(4326008)(6916009)(53936002)(3846002)(25786009)(107886003)(6486002)(6116002)(50466002)(305945005)(2906002)(508600001)(48376002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2617; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2617; 23:DILykj8SfwQMxjDd6ntI7KjubTrnWolMHucO7VVFP?= 4CB7WbTByYnvFXyXOIKCslZOgc/jcCMYqGhyP9rg2EPSek91vok7r9khP5Afs7p+H4JfgSLTgFHhx7qzosKT5hFbG1q565R8qev8wAlNAO0ICfWbIzym5uV76vyXCQl/zflRfPm9BQY7Zi9ZqVBktkoTuZQ+LHiESnEiKN9z2gfRArLwi4IA8YQTIxeAAxhxDJl1InY99GMiWXYa3QHbOg1rSteP1pVCQYjMHpGnJFnNhHWYbsztMNPfcBy3+VynWp+PsEIZYWEva/IQPcWkTK+sJcW3s/Gd7GrEnReDnHvK45Tb7dDH5AE3D68cZ15K2/a7ewCX7urFAlByB3eTWT+D5zfQqwwVvEMge0ijerxH49HqtLbWlsHNJEN97gcjtpWugPeMghH7Ei+Iiv6XaaLGRh9XHttQn/6QoYhLfxrXchPKgHAdeR+C82EzI4JOh3tO13y+Zy1B9FAPGlqu9Cniv18md1y3cQryZB0eadfzzi6mWAu8zkeUuRQv8auEdQb8KsPja/b1EPdqsCsrngyhYYyrrnsgkTrhsxH9aGGGWB+W94Vs38uhh44+AhK72lrvG9RWctv1s1jz4OJCFob2NosPqSe4V91LejOwZ+++CtcqtyOBeFm0/W2OJApaYBu1MA8+SCawKBOHaDa/kwq7gdCLTqGGLDBTf+7OT2Z+AEKn9vqbdSos0ler5f0A61hNTEgDWiohSx98zVHIQufnfSkjkB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brK+GqE8NfHs9UyrZMs3pBJIypHjRZBFZfSYL0FNqsJ9yU0LtoEr+PuemLvsscSkDqJIyoSwYpT7ZEF4i6WU+YzZoqJw9nh5AY06LQCj/SALlN31tLgRceOGEAN+1ZrAzAMilfuX4kFXnfQUR5c8KoB2KsprvnkTqrb7ssAmWiyaOtTfePxJ7KhY7c/RLrn5ilgw49RJYA6YlWjTX0QRAv6OmsyIi97xvGPRaf5ZCrWcFXkc3Io4xcEap3bvimwM9HEPTVIqUDHfW0v+vXmdTMZruhp4O7GuY/41xZmN5cQzGGPrRdjRMNNRvmZHQ==; 5:rF7oxe4l2nx66iewx/p004xJe00V/RbPbNfG0zPGGcdIgpBoUe1ZpmsHoSQEAwIaFhE9gY5eXsUEi5ia//8qnIOGXLCrC6k6DkrLAe000PJvQqMgWi2Qz/RM7PDBnJ9FxcGSAy7VcDnR6+TOoQ9hVGYdqd50a+1+lDysQxP99ME=; 7:wcOiHYZAmNpWcJ44CrJybOD4uluPirNCdalZ4zxqcw3qQW2MNcYex1k4SrLg5SLX4QP4hHM/KQqfG7Mz9jRcVcrp0fHb/1X1kAph+O8BK2pcZhq500yBliCil0iv+vCojpK8n095gVPN8sZVRfC2HbpASYH5R1gmlQaRD/KaArlGbMYlku+MQts2wSC9yBsUlcCJOevs9L9qChKU5r4BPZGuSn4p+kkygDQH1ZcJjV2sGsZqcdhb8zDwZDhSmBdj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2018 22:54:51.3283 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f06931e1-9462-45a1-3410-08d62270bd87 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2617 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::71f Subject: [Qemu-devel] [PATCH v11 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 3c1859f9cc..983d4361d7 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) {