Message ID | 20180918152923.24824-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 B305D5A4 for <patchwork-qemu-devel@patchwork.kernel.org>; Tue, 18 Sep 2018 15:32:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0EBD2B356 for <patchwork-qemu-devel@patchwork.kernel.org>; Tue, 18 Sep 2018 15:32:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 931A62B334; Tue, 18 Sep 2018 15:32:25 +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 2EC8F2B334 for <patchwork-qemu-devel@patchwork.kernel.org>; Tue, 18 Sep 2018 15:32:24 +0000 (UTC) Received: from localhost ([::1]:40865 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 1g2HzD-0008R3-CS for patchwork-qemu-devel@patchwork.kernel.org; Tue, 18 Sep 2018 11:32:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1g2HxJ-0007AZ-Ku for qemu-devel@nongnu.org; Tue, 18 Sep 2018 11:30:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1g2HxI-00044u-2L for qemu-devel@nongnu.org; Tue, 18 Sep 2018 11:30:25 -0400 Received: from mail-sn1nam01on0107.outbound.protection.outlook.com ([104.47.32.107]:28492 helo=NAM01-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 <lbloch@janustech.com>) id 1g2HxH-0003aG-PM; Tue, 18 Sep 2018 11:30:23 -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=U+Plu5YJaZ5toMP22I/9oxo5JqDx9GRQe5EJjyUSoBY=; b=jahrRWczf6dd+9l++svx/mNRiMw4b/DHp3QOxY18BMa6acB2llMuLttaTDJrhPgLIXI6wl6Gj2cQQ5M46Y2MOT4rDL/yeSpZCuUWX9jBjM0P1omjmkd7Oi4I7rnBj8E9hh8QSx3dODcm6FFJZokyE8o5kUQUAY4qVMCPewBzwNo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2614.namprd07.prod.outlook.com (2603:10b6:102:14::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.15; Tue, 18 Sep 2018 15:30:17 +0000 From: Leonid Bloch <lbloch@janustech.com> To: qemu-devel@nongnu.org Date: Tue, 18 Sep 2018 18:29:21 +0300 Message-Id: <20180918152923.24824-8-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180918152923.24824-1-lbloch@janustech.com> References: <20180918152923.24824-1-lbloch@janustech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM5PR0701CA0016.eurprd07.prod.outlook.com (2603:10a6:203:51::26) To CO2PR07MB2614.namprd07.prod.outlook.com (2603:10b6:102:14::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e8763227-2804-4734-da82-08d61d7ba498 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:CO2PR07MB2614; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2614; 3:fx8ttv8lR1JnOrrsR2pO5T8UMvBuL9X/HoGZ3mDUGCnVe1RJAn0MYIRs5WwodCZQySiMPTRj8aBfaLVcTpFd9KsiBs/Hui8Tf92L6J+rsGbEyBU4HnUgXPeMapLG2MhBfKnY/ysPra+b8gz+Mx6IgjsWr6a5l/cSz1XJGRAi8+8nv8G80E7Twu7nDyyBevAP9aCh6YLVlQTudIb4Ni2fC3PULF7BRtfMZ0HM6aRZ4hNwS+JczBgGSRJLHIBMpBtE; 25:H7vf7GcimU6zHr82BA1iPOUFORJcvmaau6RaTzNSGKyf2LBxkJeH5tPCSLqrhcwPhAKsqwEV/Qu82FmXzu9qI/ioyE16qgSQQG55KviafiwXchbQ8Qg579JsX0avariI/at/F0t65+sftifcRNZZwx92eyNWAxS6nC2cdRVYtFDVKES9GzMPXDzzmR3O2QNLwelh64WIQPkxDbPrIoAHzyaRIWKEyaWVAV3Xv373UcIt16SRg2Hm1ge68Fyfv1+vPX1fbvgSgI68gMnTOBnh/xBisp2waGsCdOxw/06kc/J7xOepDpHCpux7OCZ0Z44/GKD9PCc6KeRYd54rhSFC/A==; 31:CAhEToNOZII8vhMQCHXBHgpTsJF9p6syONAUkn07jE9A5wM/He3d7FQeteoG8cFVnG0jHcnDpIeJql3DyL1yqfcByVUnuIqoRn+mgjwOnzSVNKVtAG1C5GGYxhsuVeb62ZWkJ3veJlei5uDD0UKQdIF2hFOoJmG/loZcf5e0o8AqzIuQl7ViMryLd6LSgoCzL7RhoOrdGUAezdYGc4uBQ+4ppgc0en+/KJ1ZrUS4W/c= X-MS-TrafficTypeDiagnostic: CO2PR07MB2614: X-Microsoft-Antispam-PRVS: <CO2PR07MB2614E2422FA63730C328BD2ECA1D0@CO2PR07MB2614.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)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(10201501046)(149027)(150027)(6041310)(20161123560045)(20161123562045)(20161123558120)(2016111802025)(20161123564045)(6043046)(201708071742011)(7699050); SRVR:CO2PR07MB2614; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2614; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2614; 4:50eUs5ejOPDcRQugyfC40RFMWmIfmfl4Fc3/po1gtbJeQ0ilZAIk7NKXB9EgKlQ915L/ndp3EbRwQBOYIlbFgvgw/Ma/v2nCrlmKdAHrPGUN5GWYLVxOeHhqbVR0K6U0Lcnkm1l09oP9Ss9LB5V6pncmjMCzeFtWMoERd8WtNJTfQqatCKUMqRVHA89Iepu6c3+YMTcu5C5SNoy2RyEm/C3JeMmxE8/BnVTzQFPSCslA6ccAZHE7UtxuZ8J6gAhGl/oSLr8vJ3/hepxisRYDJA== X-Forefront-PRVS: 0799B1B2D7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(136003)(39830400003)(366004)(376002)(396003)(346002)(199004)(189003)(386003)(956004)(47776003)(36756003)(66066001)(6666003)(14444005)(68736007)(53936002)(5660300001)(6916009)(486006)(6486002)(8676002)(305945005)(8936002)(81166006)(81156014)(16586007)(54906003)(16526019)(446003)(476003)(316002)(11346002)(2616005)(186003)(6116002)(6512007)(7736002)(105586002)(52116002)(50466002)(86362001)(76176011)(26005)(6506007)(97736004)(106356001)(50226002)(25786009)(48376002)(4326008)(107886003)(2351001)(2361001)(3846002)(508600001)(51416003)(2906002)(1076002); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2614; 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; CO2PR07MB2614; 23:veuKJ/Mw20eIH5k3wsp9ItfGll4O7/vG5iVLVdl46?= VsgztgM9U3Auf9OWrqynEVbiUZxRft0+knpObJg91l6Auft0ZMPiMujMosx1a9z/ZzdSgPzEf29dyT/yItHRpyuUPmhmSAVHwpwVeIJ55qX5ijz/9QbwKvw+ACOYtg3Ktycf6IWRlBydLdgJiJkyNWxzVxX2gcltU0HUbllb8/6OvLlRDuQGKADk0UGu4ZXOvtyIoDIHIW5ynDWoTPoEp9QmqLBGotiqFJ/jYx5HZ9AaCBq4VCavrKw/FTZSgCz2IydDQ+m+E7mAfSKWX5Bg2MW2rTdowLy6qq8Aq0QcIDsANz5wqUC5tXk3mBA9OvwkJVvLzh36X8dYvmh6NRDu0wuFFbSDJ9O6LBOXqIqgq7/qhNImWDyCoQ1e/Yg71+Q2xVziA9qGvMzx6FgE2hbXsRhPfGYHOyZy206jKIm3wOXbjWy0qFtudM6AG4X8XS6ILDC3UDvcqLEt393yxI0yWJUOwqHyrDpja72BBAqThTA9Hz0c+7/EDY9H8uFwUyAsJnmUqM306+MTtVQ9igbtbi0p69TgtKQlD5Yim8xy69HRiImJojfG+zlBwt4PrRNAlf5+iLhzW3uidYzTJbeuh5CHozwJLCXejfPW6VCTdJKYt9FJxE3a6IQbjJTGZWV8Lix2PEheUEjne3nIAicgD0unUu9EzGqFN3o1keKwzzDKj1AslXRPCH6pj41hx6bfvCeQs4RSOz9zuVjyDYBN+NhwiNQiSIGKyDLx5C1LciHBjLlpjigQL87+vji8NBMygRvSYShIFyW1CIdVmRDyUrTmUY5uO1/sjF40uMauqfbtl2kD1mBmjlT8lju+838qFbih4i/v+Q4rPwRNySu201iDk+y18LQVexiJUmLLSVTq5irWLoOYJxM+VjM/0TIKVupavoDwgJJW918wTHoPMjs9PrHzZhdAF9J4nNJf4boItVRoF43+fTWdlHx6y+fvTIZ61l4yt7rjPkaZPzPWJkjpGMiT9l3/KqCY8692Gkpo1S0VDpt+/NO0rXmdUY95gm5DN+5NKMT8nJJROGckAuGIqg4voRTqzkAwWLzCMKzjOKozywOv+gxJ/aCQCHSXpBiROJgD8KrR0F0wejr51MIIwxze0GzE02gOqtTxnAQhAc72PXfJRlmab0oMN0Bk0ph8qxD7HNY9ACHbSju7xf4tpgjBWuDZzjsQjfGApEmi5BrbeuYiCb9+mAn6c03QC4bBJMprfZxSwZs5mo+upAYmmI/yLASnD+5LLe8VgdXzA== X-Microsoft-Antispam-Message-Info: Yaupym64AZDoRbvbNtG+5UHQoeS4IVrgU/P7ghGq/4GsHrukG8jg9B9EM8vdYpUgs+6OiluZQQZow5DXu2TOHqVYR+7dzf57ibkfBJ41XBkuGkwlGEeSS2mnLd7dgP4wybMQyKZI1PQ4UIn4NPuikclYV6PpUgKD4H1CnKnm6pmoz1vqMojDgvAYvW7ovpGWzXG+c359TM+MH9wnhj83mBtQYMrNxwuBmHVdGrOw8N+4xbQPKv3zwj6hoA52822ZKKr3pbM4bH1RsRU+Op+ZiuENfjmAse6blPOX6g/cr+TzXVfF8xTA8k3yQPJyVOtKQrvRi4F0q3MPrXatWAgu42wD+f3xk4WoxPErGBQnGdY= X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2614; 6:dntzTwWgIsmG2BTELL7ZliErQqN/zZN61UDk4YnM51GSjEUXatA6kZM0pUzNPm4W9FxMZC3kV/9j55j2nmRd6l2+94XMemqmFG8KgGibmP63isVBCDHAV+Y2WKDEn1g/ZFkwve2V1c7k+Ts9y3BX0/7xoJCferV/xh1FNa7LwaXRSclFIvRVCDeLuVan1hePAsSF5B/Wo2w7QWgN8PIy19BUMANAQ86uwIfyLMVmREztn13Ezy2309gWxLS10hPh6QH6GCch0e/5j4UGN0t8JDafJhRpP3gNqT60Qgky4ALOO/I/ceDhDUk9z1Xs07rZsmmtTr7/GCRiAXgpCCoRA9lMPfMxtrlxVLhPeWJFEQDHFIKezll8yy2nIxU7DTZHOPWLJEhNbMBh8bdGAvb4I+04TZKe4oOnbv0qr4V01Lx/ZQW1fxx/gjg7oufMJVWaCcTXC3L7fvrYMFUlrycc3Q==; 5:93smUzxCCQfIhI0BYeOghYgLXTwPlObvxaV6VAVqp9t+UwNzNcHV3YZArerwOvAu2d659ArMe8cF5vjnOFeUqjJe6oRxXxTWEWhXwJQh237Ct2HQZGDQpNm6Ia8441SDRHldOq/lJiCcchEsNmRIrgJG4Gwm9uR9vIDd5XavKjI=; 7:KRgkFRjCb4AF7hgydbNkLMB8U3vs8GB3Ayd52OipwvYoZVIID5al54k5AXFjzchxIsnCH0FBaRN9tdwThLDr7/tWbSIAdsOTEgdeJQUst2MbmGO7kdo2tXFnmKc9J9boi7QQsdMAuUPbGWTdofnVWhBXLwXP/jn7dcQIDrYBoUcLOXoq4ZpTuJhhdKsnWDKna58y3jumjZlfkfqfQsFrKE2aHuWaOImvT8ceRqMRhRSYZkQn/MPkO12lQdRlRKDQ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2018 15:30:17.9630 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e8763227-2804-4734-da82-08d61d7ba498 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2614 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.32.107 Subject: [Qemu-devel] [PATCH v9 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 01c39c56c0..1445cd5360 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,13 @@ 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); + if (ret < 0) { + goto fail; + } ret = 0; fail: qemu_co_mutex_unlock(&s->lock);