From patchwork Wed Aug 8 07:10:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10559581 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 4347D157B for ; Wed, 8 Aug 2018 07:15:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AC2228A35 for ; Wed, 8 Aug 2018 07:15:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B83328AA5; Wed, 8 Aug 2018 07:15:14 +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 99A0E28A35 for ; Wed, 8 Aug 2018 07:15:13 +0000 (UTC) Received: from localhost ([::1]:42148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnIga-0007Jg-N9 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Aug 2018 03:15:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnId4-00043n-3z for qemu-devel@nongnu.org; Wed, 08 Aug 2018 03:11:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnId0-0003BX-TC for qemu-devel@nongnu.org; Wed, 08 Aug 2018 03:11:34 -0400 Received: from mail-eopbgr700132.outbound.protection.outlook.com ([40.107.70.132]:36574 helo=NAM04-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 1fnId0-0003Ao-KJ; Wed, 08 Aug 2018 03:11:30 -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=6GY98t9WWipuGsNH+mpFhQLZk2rdzUU8Nn7LYJ3QnXk=; b=hAtHIXUr5EowddEUfK2I0wVDkhaUeWA8TCbiRg6jc5fIrGpHS8vKIdiyTokgDvs7W54I0dtcFmeNp/BCaFCjmkYFS03tX24ww2HAR1y/5zsJeahUBaKSuJ8dw0K71VGFFwAKtlFPU9bM4XJJv+g33HHB3J/dPjK1lI/jTU3qKtU= 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.1017.15; Wed, 8 Aug 2018 07:11:26 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 10:10:49 +0300 Message-Id: <20180808071051.30628-4-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180808071051.30628-1-lbloch@janustech.com> References: <20180808071051.30628-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM5PR0102CA0003.eurprd01.prod.exchangelabs.com (2603:10a6:206::16) To CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 46e681f8-8fe6-43d5-a0d1-08d5fcfe28f1 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:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 3:urUKeTqTZncLKVtz54dADzPHaLqekZu1NtKvtmsDYOaSzfiTPimG6Df9dsJPhMIiZIy48VUlLiAs38SoY5c/BgdxL36YyXn0txCTJPgUnJJDdbU//vjhl07InJrX8fJgRlf5O+JYiUXXzoRu7c2uDXW016y+l8M3ToVeUodQSivOugI2scQSsAep1LLqpUoUAo57YZNbGKYYF2nII9onarnfs00gUIdEfO8O83nqyzjfCPs0NPxqyP6uuxz42TjI; 25:Y2B3uyL6jYvQZ8vzuhjdh9SgKRk4v+e+HMLjkmkp9nk8e1adPsCC8WR1nLFCj9rNerqbGkfxFl0VEFH7v0hLzaooBl70mt3iskHgiE2vxMRiV9W1dI3CTq9tpvSAO9GW30X6WAZ7RFqipSii/EzgLyN/FlwSqIPZXtOmw9vcbNs3tLeEdLqhrLIHrj8FlKn0bv/dX/ex/dhcTtyPqs0+tFcO8SfUXu7TrKypjuHhqdge3/GAkCqHic2nKjMHmPaUQQpAtkSAzUsP4JfBzL6FGnL01wZt393s9b+tHI+cSlBZU/xrnAzduxqGb3p/XzDXoPxt6koBY3ooA+z4HFgwpw==; 31:Yy4cGH3GW7uQUpQhFpqTbimhDobQlmny31P0eyAEKb8h7FcnDljDOGvc9Z2lepSSWELFGAqmH/FBSWhAvjdYxWjkwYrEpqRQzYLy4PAjtn8pmzS4OKG5J9Yine4TXr8j6RE1UT+54jOklDQFldMDylNBbw6Ak0aNMrWOlGUSnqAQRhikEx1irXkjMlcXClJ0VyxMFXoTk+rt7ufJtAyDFbcLOq73fFLvD6zb1xav2Og= 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)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123558120)(2016111802025)(20161123560045)(20161123564045)(20161123562045)(6072148)(6043046)(201708071742011)(7699016); SRVR:CY1PR07MB2617; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 4:FWNKOueUFRkapKHVkQ9p5TaPRYGA7p/5SdW5Vl9jZYYNO4UEnOO1kwwUqxFGF1BAzC8N+Z8Ak+URr1HePw3n/snaRR7DjOL+vyYsdAEY9XIdOEg6XIt3x+v4VVr+/lhLmBuy7GPALlzX/SqTMRSfsYf9jEKXjTmuPdU1J91ITmFYylqSDKAbFsbhErdUkn/ApPejqSmopv5U3VSpbtwi9W+k0gEyc0rAg1k7M93CCGr5wZN6kLTCkaR31ncL/qfhTrn7Qxb4SSg+/O99z1IenQ== X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39830400003)(396003)(346002)(376002)(199004)(189003)(36756003)(6916009)(107886003)(6512007)(4326008)(186003)(53936002)(50226002)(25786009)(51416003)(81156014)(48376002)(6486002)(8936002)(50466002)(8676002)(68736007)(81166006)(52116002)(6666003)(2906002)(54906003)(97736004)(16526019)(105586002)(16586007)(86362001)(66066001)(305945005)(2361001)(2616005)(316002)(386003)(6506007)(2351001)(47776003)(106356001)(7736002)(76176011)(1076002)(11346002)(478600001)(26005)(956004)(486006)(476003)(6116002)(5660300001)(446003)(3846002)(14444005); 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:gwivwEj9sLmCXIzKYwjOHU3/OkwBNCxfmBKuDYvug?= Pe1GeTPx01VwEATOWOt4IIOic90MAob1ElMU1F4OJM+l3gdjOY1uMqk4Ll2n02NLZhz8UQf082YnUNx22HGAhKSVjZK9qS2Iksti1MFxYF51vGHjk1DkvwuVNR/h7r+3rn8LhcYAyAfm+8WcOwfPWLbANOoVjTKtRIaVIGiLpjVj6aDdxn+NfOEG1g6dohI5GeXGMFhT8nFagHBmTLYYVCjlvRk1lhSClLxI65GJvZKE8mpqQI5FfQ0dhmtF6Iw2f8v5QKk4UTqZ9WhLFNO3JiOyneRPR79Nrl7opn5munysrQNFZbtEZYw4pP1uo3X2LB8sIiOuOGT/Ku9tBJf4jltrFGYdvHkiKGNiZGvzdfa8PMsmnHv/stcfEuTb5xYu9tcBTN1KyLhlshWrCQkf14/8fxmfZekknfqT74bX25+GG31aSylJvjJbWQjjVutMr1WYqL3VmiqOwUcxOWs+WILK4qkS/Ig6jntcUuJpBQm+87MjZgPUZ6qG6PlB289/ZKWpsSebAWATksU2VM2KabeJOOCa0HHnN9dq1N18eDmLIDlTApGAnfMWf4Az7v2zhvnSU1Z79aZ9KkJBHDMFMDSx2hg2sikMRs8jSazPWHEqfbUBQLz3sg5o3I6tdXGb0okZfMjdFz8Hx+wyoSBPOlkhTOxQRhiJ2rwm9ON8A7upOwZwSfcQTKvsvZamjKtgePTub9TY4drSv+6XL3JuxcKN5gefdi1VNjwJa3rgBGOVZim/RmDKL5XQKXKkrkDKqfdDxHAk8bd6FOxehRFQHrMcj3vjMe7RF3rQIheUm+De3WjlcHqKquYpFxAuEic/bL9u16zVEbkH3ja5LH663oBA3uC3aYMA9+Tzk2aqBq82fPo35AmhWbZYfwubk5ASvSO8FZAA3Oz5jefO84rqGv2+vluiQDRiifuB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0iNNfBDqT7LrVnU4rAN8LsTxNmlRAmngHSxPE8/spnhgjfR+KsIKFXW/ZNnU7TJ3VPMhNysZx/ZVPI353HeNLEJOctTvtnmthzH5AaZL2XRlMN6C/01p933K+zWGW6HDUGliyW+kP3HCZGkRkMz3FMQ==; 5:+7Oxv3v/YCZ6Z0JB0V7FRrKPHxOX8bwE1sY1Q5n2bWaYYx5m3y0sv5V3z/C8wZxoQ+8ZqNJKoH5HksdEkHl8zGIDk4cWpPaRhiUmduhPEG2hzuRriX/WRa4Gf02J0Ywt4lsevHtzuQTxEU0WdGWTWKJdrIUEzJQB4Wj4NdS4nTE=; 7:KbVUcJfOBRRHQ22p1vkMh0psa/6mDFSTxFQ+vxvX5fAk8cdOfWGmFp8CUFnOZWCypAbvA9ZyPfuurRCdd/AksD/qEoW4Eiz2poS5TJrnk0XYh8P2z5+wP3kZaUOqC+8iwtA4hme0zYHBwRr4RZjVaB7n4rfgSXzusMyAd3EARRnkcFDiT8crYwb98ACAr7PTlKhTF6HrZ7txyqo+ERfXslOZEDXjRt2xk3zV9UjnjfW8VYtHfFBwQn0Diu115tzf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 07:11:26.3484 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 46e681f8-8fe6-43d5-a0d1-08d5fcfe28f1 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: 40.107.70.132 Subject: [Qemu-devel] [PATCH v3 3/5] 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 , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch 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 an image resizing. Signed-off-by: Leonid Bloch --- block/qcow2.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index 98cb96aaca..f60cb92169 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3639,6 +3639,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), @@ -3649,6 +3651,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);