Message ID | 20180926160447.5149-8-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 E3D383CF1 for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 26 Sep 2018 16:10:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D700E2B41B for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 26 Sep 2018 16:10:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE6C02B3AE; Wed, 26 Sep 2018 16:10:04 +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 22AC92B3AE for <patchwork-qemu-devel@patchwork.kernel.org>; Wed, 26 Sep 2018 16:10:03 +0000 (UTC) Received: from localhost ([::1]:59618 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 1g5CO2-0005TQ-Nw for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Sep 2018 12:10:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33889) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1g5CJp-0001yE-5R for qemu-devel@nongnu.org; Wed, 26 Sep 2018 12:05:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1g5CJo-0005ob-7r for qemu-devel@nongnu.org; Wed, 26 Sep 2018 12:05:41 -0400 Received: from mail-dm3nam05on0720.outbound.protection.outlook.com ([2a01:111:f400:fe51::720]:12480 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 1g5CJn-0005mX-Vv; Wed, 26 Sep 2018 12:05:40 -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=GBvzJu6NvSqyvgZxFPfkyyscJHWOpEy/HRtwqJV0Ows=; b=ojUpvn2AFi5hlAvuRSidz0S1tY+0tISAfJR9p0R9vnBeJceeB6UDBqom/E5qhtat6UrTUi9qUCyGg0VUpleYgmFO1ENUNKQYU5eJytfgmB4RUG53cVMk1duiMAZTAvj2hOwi5Saxm6d7PtF5EDVEgwRSrorbR6UzEV2IEkXJdzA= 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:36 +0000 From: Leonid Bloch <lbloch@janustech.com> To: qemu-devel@nongnu.org Date: Wed, 26 Sep 2018 19:04:45 +0300 Message-Id: <20180926160447.5149-8-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: 8fc9f404-6bbf-40a1-050f-08d623c9e6b9 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:B2sDjr2WD/bcMi3ke9M7uipRgnr8VJceK+Y6NsJEFLIH6lMJLdZuT22DBNns8ysCNB5Uyj/J9pThWlqLdcHlbfigxslM+WEM2C48FJGyHlB0Fx0mjYpqGStK+T34i5pFP50VGKgPRrBTjP2L3kNyZzFwTkCQEIGwsEcbNWB09bgA8HEQMeNvH2+DUrIHLON1hH/wAFzMAy1sL3uDGy2t0i1VRp9+u5RD9q9YxD/lyyOpVs6P5iVP/jtqlinDvMFo; 25:zW1qlkqXCbmyOMJNH1OsGNNF+nXSOWdZ3t23nIQB/kncBi++3AlyhUSiih2Wtz6JSqqVtYo7H0UR6huUS1FHzEbThXuPex1Qvns3/qgzs2cJFKdoLgR1zTRdWaWwQikA8uVScp6lTt5Z5z7b3glwqNT0UuY9rNhK8sQbHP4PEUo/MnRMQwWuadjScBsLVYhDtmSWwkJ8YVFajdL1J5kyOHRH2KxbynYD/3Su2KXNUfh8eNtc1ThkG+QfKB22f9TZRfqmM3e4SwchIzHxM+Z2LR0ug1tzgFzCUDNBgYsRo4VOkRXloT1IsxakGDEy2jwNRaElSLBiYA5QVzrEU/jp4w==; 31:MGZxLVfQZ8Wle3Zi9zF34hFjDR3/Ky/+mbJ//0mO0TVJHr7z6H0zfAyEuTKh70k8yNkTJBXhYnWNupjNbvbhIGRWAhYx2WuvshAFIFNVW8JGLI3I0QmwgMhefLxLbd0dxMGEGb0EGSgs6c4qBxf6lJinKzOa+rSWUs7WQSlwNditL/fs7A4aIMIen7OPPtdMhOG2o4GKWgrZxOQ35FvsuVsJ83B/UYmif6j+B+bV++A= X-MS-TrafficTypeDiagnostic: CY1PR07MB2619: X-Microsoft-Antispam-PRVS: <CY1PR07MB2619BD77FFF8ADB8B5EB4F18CA150@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:zH+mEuCrryN1qrnWzF7gJMxFKyDZFOF33IKdUbV9m+ivSFYabPdLB6B/RuG/DdHRmie6NiLjW0BGVErmY4WA/fOwX2Io9gacnJ/Fdh7B9g2Ch33Ta8eZHlXOZzkXilU4FBTEF4XEYGIyx6IyIAkGClOVElRTXeeQ8ri3bL6w+4xjxrzmLHwX3ApwynsDosCQGEmBn+pYF55zNP5PiAhXsiXATxG2s+aG1vI2QDIIw+8M09+QyGf3VfsHBwTakr0mJ96zGmM3jHbycdGz428xcQ== 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)(6666003)(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:6bI1sTH3y3pIY/UqF9p9z4l1MciefJc1oBsT4y1vF?= K1U0NJM6osrL7OQaq0Klmr5rxQwFcY2bUI5nFVQ/eVgTU+N78eUTpHN4Q1FCvr66gKo353TmddrTGKuf+/YufPLRMQ1rgIlolsqpjS5Q6uMMvhZ/3tm1ZZcQokIX+yfjl724E9ZdSJO1dGK0Zx2IdFNtF0XW789HI66e0fF4bRDpr8MvZwR+0oLRFHUn/S3syjwlCmOLZW/D/oRDVfNjzLXUs0uULWiTe2R7pzVwLvh+qbnYK13qWxwNdi+5KgNZoEkEHdv63kD2dxhbSDLZS+eDn7ezeQzvQWgIsqf3HcMz63yh6ZoXJ+ouiITAJ2TA+YVk2qgNIxsELxvSsy86k6JcT8v0xVA84ip5acI12c4FoxkXo2WSOjZHT59aoisKDnV9kvkVCDJOi2MMfa9NdYBdir2H6Ws++QaN+yL9xMgrXqG31vCgU+hIjRilsECTgQbW3ASzhhdF2HdRMz+j8YW4SosUboiIu8bQe8EJ017G+a0MV71xl2PutJXHbieU0OZU45+Bee3SJNblGNY5EQthduuNyRx1K0BH+F9aanEXFe+JPtJRh1bCRA0C6q32DCN/KF+gcI5NcKlTYuvqY76aHKYiOpxNw9hY4g14CX8AxUJeRHL5x5O+dsbxGQLDzolBIIKEHWk3aUQcb9PQiVVAkVN2M4SZnMeFqxxv8uY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eVuhpblhIt7wPjETqkn69BZIUBiTRdGkIdKfwo8LVkXKc56v36BhqqIZiHxhpb9BJrFsQUsHh5QXQqQeYtJ//ZruMMWc2QdU9qq21SFQL4qvVGGU0ot/wq+H1DcNxaL03Sgt8W0ne24GAwF+dCyiBvuKqj37wF6RThZ8R221L2AemZAx4t6igUx/nHgx34NXs0IaS01Q/+PsY343RaCROn3dcDLX2ETJLvPp8FPD22Yxu2OlObQ4nr2ampAiIuQAFzmSb6Vb9X7x1WECeT2cHy7x21ISMcxIJa8BuE4u9X0HHvsSTrpbjJ69YE7nSobhi8OLY5+oGRlSG4H6J7AEUKsdWDtGKluuJJ//O9/eH9639UBkJgInnC5YaC2uGkgg4ksam70TAm3kHpy4sr4rc/6eQ==; 5:SGFMMJvDj0xmZsdZMgEGkimp5Bm/nUUAVbWsauDVmrV0qL9xJZRrLJyp1wXSO8LMG+Q63pKiw+VQqn5uW9nSz/463AsUqc0OVo2b1G6XSZ85li3SZseK0OuDtPCveXSUs+RS/IZeIt1Gfe66vR++eogVK92L8vJTlSYYUAga6wo=; 7:s1rrMqdr2LZTrBPanMqibHPi2di/0PiVunmDIpJtDEAvmbCcGtTBLouSuCM0wOZw2NbSlHNXTiAynGuHbMlgCeqMths9jp0rIsMMPkHOvt7tmRdI3HzCpUHZP9x+W6bQmr1Eg+ZaWy/8GTu8v3mAkaaELaMtmcOyrspY4PFc3cSO9dgyp2y5cg5rlOoWB9+lbfGzzyGHSKh9b9vb/i9cmtQhQ8/MgTI3LrSZmskwSeGKZKKJKaeZWAlohD5PaGWg SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2018 16:05:36.3508 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fc9f404-6bbf-40a1-050f-08d623c9e6b9 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::720 Subject: [Qemu-devel] [PATCH v12 7/9] qcow2: Resize the cache upon image resizing 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 589f6c1b1c..20b5093269 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3418,6 +3418,7 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, uint64_t old_length; int64_t new_l1_size; int ret; + QDict *options; if (prealloc != PREALLOC_MODE_OFF && prealloc != PREALLOC_MODE_METADATA && prealloc != PREALLOC_MODE_FALLOC && prealloc != PREALLOC_MODE_FULL) @@ -3642,6 +3643,8 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, } } + bs->total_sectors = offset / BDRV_SECTOR_SIZE; + /* write updated header.size */ offset = cpu_to_be64(offset); ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, size), @@ -3652,6 +3655,14 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, } s->l1_vm_state_index = new_l1_size; + + /* Update cache sizes */ + options = qdict_clone_shallow(bs->options); + ret = qcow2_update_options(bs, options, s->flags, errp); + qobject_unref(options); + if (ret < 0) { + goto fail; + } ret = 0; fail: qemu_co_mutex_unlock(&s->lock);