From patchwork Sun Jul 29 21:27:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10548313 Return-Path: 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 44E5C14BC for ; Sun, 29 Jul 2018 21:32:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DE3729B2B for ; Sun, 29 Jul 2018 21:32:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21F1F29B2E; Sun, 29 Jul 2018 21:32:36 +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 A550129B2B for ; Sun, 29 Jul 2018 21:32:35 +0000 (UTC) Received: from localhost ([::1]:49689 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fjtIo-0005Vx-Qi for patchwork-qemu-devel@patchwork.kernel.org; Sun, 29 Jul 2018 17:32:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fjtF2-00020X-8Q for qemu-devel@nongnu.org; Sun, 29 Jul 2018 17:28:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fjtF0-0000XP-N7 for qemu-devel@nongnu.org; Sun, 29 Jul 2018 17:28:40 -0400 Received: from mail-sn1nam02on0111.outbound.protection.outlook.com ([104.47.36.111]:45370 helo=NAM02-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 ) id 1fjtF0-0000W0-Hp; Sun, 29 Jul 2018 17:28:38 -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=31wvFH62IhtI0PSL7UFNhkLOyXMcI1lmzAxQSKnoAFI=; b=IIKF+LfrNeDXIr4SyibQrC9GqbKtoMiGFIxLpwMrrICU8hLsWWqoI0kn5U8SFTcu+I10fUYQEAj5E4jQh/GQWOJVyXpe+lC1gVh2RkOL591soWqeekxO750Honal1yf2bU9cLMjUoxFEw95/aTbLYvJEmb1jM1IZVkcX9cMV/GM= 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.995.19; Sun, 29 Jul 2018 21:28:32 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Mon, 30 Jul 2018 00:27:44 +0300 Message-Id: <20180729212744.23709-7-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180729212744.23709-1-lbloch@janustech.com> References: <20180729212744.23709-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR06CA0138.eurprd06.prod.outlook.com (2603:10a6:7:16::25) To CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f96cf20b-da58-4183-dfc7-08d5f59a3d8a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 3:MvD4+9QLvNOTMbqATFQKcNVfjIpis3CdzjT9yIW6AcWi/L9qOdM/JEdlj2UoGmX0K79IgtI5tyq7KwvwoKgXU6FzbbF6kF8UheKWvrevruDZgJ4tulmMNBd5G0WZp7Elet8GTjUn/UgPE1RDWDCCYlOVDQ/WBH2rxYRdW/JpxLMccTXgBXZl51+3wHStkTHNzI6K+7zcje5ZYcMok/U6rrYUZ3YzSyIAI7XQFI2EhAqwPTBclrmOyR5X6oxr0az3; 25:GDN3/xUp3MKi2N/tKIN9ywH0XIaHAlTibr+Gb1zrZ9d/RMGAVG7sSQWBnknEhIz6K376UmwH70Byx/wmJv1NNO7xEIvQY+76YTmAERDZRV66LARQoJgJbwJOYR+g2DEwoLy+TH8E2ThfUZS361jlrxIObzPAoedlaj3VWTgCOExsMgNHi5xnk6yR9ULzQ7gtx6O4ZwZPCw+3l5KQ1ss3dB5Oaip9Wm97UvjeAPs4LFocg3RIX90pv5HjbarGxa9hgBlli5usmCtpBPiYGA0nQRGV8x92MdbM4xDj6FavgKTCB6Sp0TQvkkJ/JDxuauuHRctHTw02avBTYtU8d4Nihg==; 31:/4IBSLunAjfD+d7729ay3jsAB0pWC+7j0ep19H/N+iBmqdoftPvFfb0RcRPbqYxLhhqdnSrFXJoE/LTNdyQup19A5Jox29mrh3ouKZ5VHVM4djTdHSlhl66C8SnaO00gANmG6m4UeQ2SKLS9J10hIwBEGncDKfFA29wbro9j5d5B5gzJMJjZiIRgz2dNA+VEH2Q96bTSN8MkGuhkAWbtfZ99Dw30M/TYWkB29AE0JCo= X-MS-TrafficTypeDiagnostic: CY1PR07MB2617: X-Microsoft-Antispam-PRVS: 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)(3231311)(944501410)(52105095)(3002001)(10201501046)(149027)(150027)(6041310)(2016111802025)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(6043046)(201708071742011)(7699016); SRVR:CY1PR07MB2617; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 4:MZsgCaLpre5UPCzb8EACHTjYYGJbOKJcLgnL0wZys+WM9by6kRlBkhXoluOS3f21nT6CcrtDVxYQZNoMyHClRO1g/dYu1PIqu283UKwetj88OcpA11Wg2tr+3I7L4izcIUqT6UUpLd7em0EvuHAiFoS707hr7zObEeaj1HkA65ubX8jicZXRO8Hc+sEO7DMJvt5sjLDYodNlYWGiX9zrrLTLspnOaF0iaFOZQcdhA8+cdKD7NieoAmIE3QkhBN5CdKvpZdgPBfC3VHYX45pQoQ== X-Forefront-PRVS: 0748FF9A04 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(136003)(39830400003)(366004)(346002)(376002)(396003)(199004)(189003)(3846002)(6116002)(4326008)(53936002)(51416003)(316002)(107886003)(52116002)(14444005)(26005)(486006)(81156014)(81166006)(8936002)(956004)(8676002)(16526019)(7736002)(186003)(6486002)(105586002)(476003)(305945005)(2616005)(6512007)(25786009)(478600001)(16586007)(66066001)(68736007)(47776003)(11346002)(54906003)(2906002)(2351001)(36756003)(106356001)(1076002)(76176011)(50466002)(5660300001)(6666003)(6506007)(446003)(386003)(2361001)(48376002)(97736004)(50226002)(6916009)(86362001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2617; 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; CY1PR07MB2617; 23:x0qW02/iCxYWi/41z/dMpX+FKiIUHguImUFVtYR90?= w6+VjIwZkchy7/3g6IVUdHpeXgm90uZNzbox9BR9PYtaVI0NFiOJbeumFMW7VJH2MUVLQo2wJKy+YmmTskXK8rG+9wPog7cFP5Kq+9HU4OACA59SF1AO2TJCGNEfvLkQFWjP23mAPNr1c549FEDmBwqpi/5slfvdPN6kaMp8Z+v6xsoZ+0Jqc8mbPHvqc1Nt+Q5g6pWa329FtWLRNobz/K49uXVVxT1RI4LfGcIoXbf05wq7856OLy00KoeD4ZAmBROlO19sJqmu6eBKqPQqo8BBGHPExJbqu7FLY0HJRz5bhG9CWBihbJWuP0YK8xicBTA/98CfsH3HUtG9Kee2/3GESpWS7zuAgaawakMvIYqnzbbXhZb+7HPqeZSijB6pTLT1KC6z8gOF9CY6YEyIJ4LUDaNa1f7k6/sgoxVu3H1rYjjK8JKRuz8Ltp2pCZE2bXLScorPcvvl+iJFXQzh6CjHKGELZUc1x9D9b7FwZyzI5wBaoeoGdtOjPZx/mWpAWd0FidhfPxCpMkl6C4E0PoYYNskmtrWaM1VnZ4I0NzQYOmlTShecRyb/TijkBK80HyJjJo+WpNFrMtwqUxB5SqKJLgT4H8xDPSd/nlzUZL41jWssCc2aO9ke2mF9Bh3yquyPEsqrCs/sg5MKSHpLUQ5BosQnPaYrG0Nyh4xmaviZc0mzVs/OWrhfbhp5zXEXoLL3eQ2efBGzSFv5z/y8WUrLiA/2kFtFSaaOJa/voIwGgg2DUJ+f0+6R/dtB92Wdpo/eQrqZeK+AwaAIdIJnTSxpM2rBieRQcpFeRGLU3Z7/mV6DEqWqjrQT4Z12FoV3gNzsMeNtxik7TwKku61QvuXfX1zVhJMB9kqI8q46LDkRlS81DJcuPuKmb05CIU+5q/O4K8Dx7UEekcBBuw/cjUmAr5wYeP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obccWXKOooMUD41g/Daj1fC/4Sevk494glncDYIpwAoIl/6SHobgcYYamDOXTdnUmUOTy2f6ziQ89+y1EfEa89OW54Te29UqPQteC9G/G46gBJ9Zb2fnNrewv+enwjzM0A/cbyoA7lajC+8Riq+sBg==; 5:nsIkUw1csOhBUd3hl9JXDBJOyQy1we+KFEl8EAHTU+hdHk1u+ZPAzQf7QWC5EO+nVlYytsTF6f0YJ++XQDb3Mh9L7dzsf1jNIaKIWMcq8IEjwOl9OrZtX/8LWeZcssILaPwjWsXw09kDUbaDXDtqU+CYPA5w/l0Ek/N9TW7hmiU=; 7:zGrh/RcWq6cDdElU9dO/Sn/X2jsON/HKn9jKe1CaZMZ6X5n/FsIF5dRfrg+oI9NHS9CBAWnUr+Te8Z2h6jBea7GD0ispDeP0RjV3F5u8UatTDblCVQllUygYMaklUxIBhOA25MzGOHKqoxDDS9QM9Bx5Mo3OHH7YR/XP7DO9geH/UJwOl3sFHmI9K8aJicAIKDBUXWIHX/lXEjfdHhRxXVCx6dWdMOiBiYuxN29dxDDWi5QYwjFJJdl7dfF3pV1a SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2018 21:28:32.9087 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f96cf20b-da58-4183-dfc7-08d5f59a3d8a 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: 104.47.36.111 Subject: [Qemu-devel] [PATCH 6/6] qcow2: Resize the cache upon image resizing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Leonid Bloch , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The caches are now recalculated upon image resizing. This is done because the new default behavior of assigning a sufficient L2 cache to cover the entire image implies that the cache will still be sufficient after image resizing. To put a limit on the cache, the options cache-size and l2-cache-size can be used. Signed-off-by: Leonid Bloch --- block/qcow2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index 74f2cb10a4..06fac1bb8c 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3656,6 +3656,12 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, } s->l1_vm_state_index = new_l1_size; + /* Update cache sizes */ + QDict *options = qdict_clone_shallow(bs->options); + ret = qcow2_update_options(bs, options, s->flags, errp); + if (ret < 0) { + goto fail; + } ret = 0; fail: qemu_co_mutex_unlock(&s->lock);