Message ID | 20180809142046.12311-4-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 5572B13AC for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 9 Aug 2018 14:22:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 460772223E for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 9 Aug 2018 14:22:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3978926490; Thu, 9 Aug 2018 14:22:55 +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 BDA062223E for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 9 Aug 2018 14:22:54 +0000 (UTC) Received: from localhost ([::1]:51146 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 1fnlq1-00077E-U4 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 10:22:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1fnlob-0004Oz-4H for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:21:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <lbloch@janustech.com>) id 1fnloX-0004dw-Qd for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:21:25 -0400 Received: from mail-dm3nam03on0111.outbound.protection.outlook.com ([104.47.41.111]:27660 helo=NAM03-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 1fnloX-0004db-Hr; Thu, 09 Aug 2018 10:21:21 -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=faoP144B78ZHUhzKcpyPTMFwNZgLk5P9Ms9XKnB3Vkc=; b=OYBtwRP66fir7wnqx3PFpkx19b1WEWgTmxChiWV78l6Qh2mRlzQCljE7QGhW0QiOPv+TLJeKIlA5LgJOaENpKNI1Db+ZbH2n+HYSI2yUeMmpdgBT8kRPp0mYDyx1vRz0k9cJnfEyAQGlZdhIR0dcyBVD4ppW12pGbLoELIltNkM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2618.namprd07.prod.outlook.com (2a01:111:e400:c637::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.18; Thu, 9 Aug 2018 14:21:18 +0000 From: Leonid Bloch <lbloch@janustech.com> To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 17:20:44 +0300 Message-Id: <20180809142046.12311-4-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809142046.12311-1-lbloch@janustech.com> References: <20180809142046.12311-1-lbloch@janustech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: DB6PR0202CA0004.eurprd02.prod.outlook.com (2603:10a6:4:29::14) To CY1PR07MB2618.namprd07.prod.outlook.com (2a01:111:e400:c637::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 273c95ca-bd38-49bb-a39a-08d5fe0360ac 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:CY1PR07MB2618; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2618; 3:VnbYH39gRbdY5ZjNZzjGCF2QyPyubiU8TpeD7oMzxLwNjYqAP+PxSA1K2pFdBBUcBELl7VwCtgiU02+XX6HbPSeo4+nO6WoATt9jaZswEGooXnGxxmkl+1UoIImf8dlywKeuL0rzsv8uu+kyi+5ar9xsG3yRMMrItxoSN3GEhfmvwkXW2buqXmgHhiDNE7ogDNdVa0/TGoWP35uyiBiD/IIXfDgIwqo/FN0X6ZnJNfjuYYcONVvCF8w0qoxGGR1w; 25://sgfXNQmlpkLUrYb9GcxKt+MkNTr39fWv5Xd75BW57VqeRV0aZufBn6GndEEWAdNstJXED8cJ+aXWYxJx7BnvUlbVXGnoyQgltz8g9UcEyHie5SFrHSdxWIV2vVWvmJTxK45KEia6gCNTBFfY6Scu6LkLch3nEajC2mi65sOU9OKHKzjzZ+zTSjVanZHYxBW0+S8kdJvDsujp2P4+YqQmb0zKna11aZSDsQp3dky19MJusBpVsrKhpfYvV+EqleO255crpSoeWIUDWxqWFSPAN5TRAgm84yAKBxipg7E8X0td86AVtB8uywHa/f0rbsrVdUxVcPipDDaAHQ0x+23A==; 31:IYkMsxGRdjWv0LhPk1w0vjIf6ZO9pjen1PM+/6sjKrScWP8MA2zsn4KQ8/a0EpIc6XIwD7HKB7ZN7ABLSKl4wqwpXg2PwBqS3iw36n9ahyqTUUNJUjV4W2X/a+Aajl31ZFaa9BuNiGF4oNUXW6v4Bw6V7ddzdobNJ/O5MbUrqx+XZR0+JbKYIsY7eS72SMteuEQoaXJyhL3Jy0McYSBMajR4l0yCtd99fIY63Y6b0cI= X-MS-TrafficTypeDiagnostic: CY1PR07MB2618: X-Microsoft-Antispam-PRVS: <CY1PR07MB2618109CA146C36FDEDA1D27CA250@CY1PR07MB2618.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)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6043046)(6072148)(201708071742011)(7699016); SRVR:CY1PR07MB2618; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2618; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2618; 4:/oTOxR2cxYNRSn4nEqaCXvtoGyZ2f3YllsHZobF5FE+Ut38ZN6kxuWS6d8fj5sWTJqcKvP35GqthnUSZ3Xv+czea/THoOeE1Ho4bPMJQOww9HdSjDQKesJ43v23R8nhXzlY42z6JjNg2wUdYkKsO5FCYLYAjP1zJk8VjpIPRsSnapyVyCPk/nbY5RXnWWTDq+BU/p0jzow7VKYYWO9DHqjiKBVRo6DG57ETVWhr6j6Xdos3GbbNTCKK8NMKC3idXY0va7sOsaEyR3BAwwxN61A== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(346002)(376002)(39830400003)(136003)(366004)(199004)(189003)(25786009)(68736007)(53936002)(6666003)(81156014)(14444005)(81166006)(47776003)(6916009)(50226002)(6512007)(8676002)(305945005)(107886003)(7736002)(4326008)(86362001)(186003)(66066001)(26005)(2616005)(956004)(446003)(478600001)(11346002)(486006)(16526019)(386003)(476003)(6506007)(316002)(106356001)(105586002)(50466002)(48376002)(5660300001)(8936002)(6486002)(36756003)(54906003)(16586007)(51416003)(52116002)(76176011)(2906002)(6116002)(3846002)(2361001)(1076002)(97736004)(2351001); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2618; 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; CY1PR07MB2618; 23:5whFTIOQrGvlpcHIYshoDYaKosaYWvKwCM1HSxF9U?= j9GfeJfNFnt3SVMzcxGroP1qOUa0DOGVCeKP5iMK9eo2Mm5PCESLLVYKUQuHCamHDYKyG5po54Zu9437le36g2FFM19m+3dRlyoSBJ83V4qf5kQ6s8bfVvRPL4NPqf5TZIX+tJHnTrH8ZxdiSZA1XaxIeYgvllnuO+Hx6BtJ+YP2LWCMiJxaRaNFn4eGbxNu5fl2iwDFdh85Ib2AtTk1WlOrOhJf/yWuziKfjj0RxauVgEzCbPrsi9fylkyYMq9ibmiyKPSQtB08Vyg9EMGcF7rWh9jstKiF+jFugue5vHb2ZCDOB5Se8YSm34up+fwGaiGVtXxEnTwh/HAthNcWfKc6l0ORHBZdTACRz2T1JaLzNZMjAxz0r2TzvIiuZqERpo3mfeRBSYyVIcmQkBgNA2l/aakxhf5F/mCZCunr5pScr+5KczlA8Q9IKCIrLXPbfdpYi2dfYbjN2luXuBXjpdJ3aJcyaX6hwRhd4iDwVCpwzq+LlPBfnHcMgdPLPxKcdl19GMgQkcPB5ohQd1Z6QeUJROvC116p6ePA5yTBjrQhXznEA3c2qQQnm3ArWu6QwUclkTClx0QcBhP/+R3oX7qWcyK3fl+GA8tO7HYKgu0yvvsF+fO8MrsJDjplPU3Hxuv/4If9cBqkZQFvAhhBtbOsfyDfMv3oTvKYbIbrkWAD0omjY6eGisdRAu2qPT/z0hwvMhwYTaHN6axyMBr4GpLbKy9mWsMQYUY9ko2JIibuIWgRcF03X4OOqotYsE8fY/4MYCUxctajXMnKffEdzcbQlZYVuKAFJrJmXB71Y4/DM1LGyJc4nbqjkN1FEXlJzOgCJwGg41pEcrpnrN2OWB3R9TnXc4BnHeYGxa/H2grMldhiinLITcvwWXqV8x3tI01TgbkbZ6RVXl2kPtq28FrfywypoJhh7+TUvBIf8Nbm3nz00BadCTgdAHOWxSKmn/+y6xhS//W7BR81CeVwOoH+R+7TCDIup4lso31ytX+/O622wUKIGYUR/f6YvrhD9Sam0A1ceP/ymaRKuoXj14ttCw0O4W3Nvdon375TgdAymjsiF8oR0MupDoQ+QJYOhv/Bk1xU0kOLkLuUP01LpjyDoTVtcc9IhY7B57u33htIClH3Uk2Vk3ri/emXBciXpTHcz41zz3Jzj8MJWqaynbyO20Gpscgky5JsIYbWI505AerQqLgpeFTM2TmrQpMfDW7OsD53qDAPTZ2dmTqOb4z11zfwcEFbTfrUrBeXf3V3Q== X-Microsoft-Antispam-Message-Info: maOHDvg1N+U9LhEtKvBY+sOL7OjeFoCW6fVWahCrvGItAniHt2F6eZ1FM/g/7/OBbQNcCagqkSOThdCEQj730YoGuy6CiE4+iDhonCcmre+pof4ih1owRIT/BE6PqYW1JVnaUs/SfGYmfeTZsqi/MOx3q3oL7/OiVL87frV4qfz2XBfRgjYZ6wSOrSJrhmcbSlkIza2/g2ttSe7dJs1+GN3flNqqngFrHwX5VZNNuVYpD/BDiutSDZmlGQIOe27kOJM6K5YZLMix1IGn6HLBI+GGgoXSlspnck+Qa8n0ueW2mVsquK7fr8yOY3UdnUbsEYDwWoTjlLT4ST1+V55tYOs974SDTLszhlCA48hNiuQ= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2618; 6:rcmbswtQSfXIreAEWQIk5lUM94Thb2qbemPgxA+IxyCRN90OsVzLc73iVFt03G4QKeEAtoNeZiNgCbQ+q59t21gQ+mlSqpqFBvEZuZEa6DtE3z+tMgQK4q6oOAjn2zWRBDHu3w7Anuzu1brmyE+a3DdawU5h8JI1/bomOy7RX/A3YHR52uxEXrg/nj5uERMT8G9R6gr/fba4kZ0jrNSwx9bgc4bqYAU4EtHVPhhsYUWpLlF3dmmx4rmT51V7EOcXOc82sZAhMgJ5F8rhJxANknA6cdMb28YT9CV1cn2fz7BJ2XKqYgJyHIsn1ipGLLUN/8yJFCs9sv7GTBbVouLmkVeDVt+BCACs1alyFlF3z5NjNA6Bu3rcas0FuvHgs4SQtO72+27xQXgPtvBUa9ZIXExsxzB3FjCUIMl3Op1lR0z8vORePGLoEskyB5SstLYH4qzaCCSqxQGJqGaEHE9dmg==; 5:4X73uJ+SBk+U+FK9Cw+6S3yNEx7/LUZo0GbTn6nMdIiIu3EoRVOjcaPcqG9GyXyLaH4y408erWrb+Bq2Kj4C4Po46rWdYcd81pkUZUU4Et7JRSOuqYRLsMBG5c50Fc9nk0REB2rQ+FI73dEN1/H60nE1BL3U6CNzLWtzuNstKcQ=; 7:mT+xMJdDCjZejqubIXwlAl9Q5D4hQNVKJWEej8k3Zf0XnXmQi/TOtz1Ty0dcawtMEe6gqyZxiVblk19qYj/fQRSHdcvB7M3TIzgkPh1lQswKB0rRHCWWP+y0ocy+Mp37Q9qZmfTnqTeDc7VLVmhz1fb03oh6h21H0+du1+WdjTZiv8bzAHtlxBjjdPPKWNdzyArsdoCj6ByZ7j7mOhR4OEY985qbGLZbCt1COGR3M+WgKqp1lDI7R5y97TzZJHGA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 14:21:18.4951 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 273c95ca-bd38-49bb-a39a-08d5fe0360ac X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2618 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.41.111 Subject: [Qemu-devel] [PATCH v5 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: <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 |
qcow2: Take the image size into account when allocating the L2 cache
|
expand
|
diff --git a/block/qcow2.c b/block/qcow2.c index 092bd17975..36113d199e 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3416,6 +3416,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) @@ -3640,6 +3641,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), @@ -3650,6 +3653,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);