From patchwork Thu Aug 9 14:20:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10561457 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 5488614C0 for ; Thu, 9 Aug 2018 14:22:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 423342B566 for ; Thu, 9 Aug 2018 14:22:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 332682B568; Thu, 9 Aug 2018 14:22:49 +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 A395E2B566 for ; Thu, 9 Aug 2018 14:22:47 +0000 (UTC) Received: from localhost ([::1]:51143 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnlpu-000702-OR for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 10:22:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41581) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnloV-0004Kf-Et for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:21:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnloS-0004a8-D2 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:21:19 -0400 Received: from mail-dm3nam03on0120.outbound.protection.outlook.com ([104.47.41.120]:52704 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 ) id 1fnloS-0004WW-7F; Thu, 09 Aug 2018 10:21:16 -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=QO6MpNI8YBuxATeA8UlNDawXJhxE2Fv2Vkh0fu6gdCs=; b=A+Cg9plamV0uq6uOKQou562ji0FufRLISMeLsBRyjJ5oLJEA6xLWlyZaU5mg+cwQDCXgnicPGnoNsnCvU+t2EfTjgFaqqduPKsZkk5nDz/iIUQkdLpv/29A9BrOQIRe9Nxgi7MfOW3F8KzKjm+DYyLTW/gxx3sU9fUaKEjpNvDo= 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:13 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 17:20:42 +0300 Message-Id: <20180809142046.12311-2-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 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: 4a4548f2-ed4e-440a-d6b5-08d5fe035db8 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:oT8WMtYN5Og2Z2tWYm51S4x5MtpVhYi3NMblrER9jJExaLj7pRnNeY2hpnILQPDAytNXg5xUfu8R6ZAVsEqgflk0WN6mCNP1FgVpdmAZ5Xk7pu7TY9d0sXKfApN1Whk/8mNf06OTkjfpbNgA+I2VZfE8HO0wS50Y3BlrA6GPvVMmdD5rOrwM3fkxpl2QaR3MXU78n6Ib33ujDPvNrxhxD9hCp6qo4noxQJSK+oVAtNX0ehFMi0TTK8yfeUmm/XHL; 25:eDcO7H1flJu0xwCDoHAQz/IREFVG6/rqWShJNFOk/Xfe1k9EXyJ3taiKZNuKNlcdv/yij6mmH49IJV5Pj5NuU1As8jV36/yjuqeoX4EjXmxw7r9qMnuVC8taBDpBxLNGBVAWKNyCxtV5VXauL9/tOhwg4neMBb8J1jkRh5fkxbSwJ7ayarsjeC4HL/NHpVOkH/OLOsJ0L0N9igA9pOjx94D+ezHuulxCmTQSxkzMiPabiBLlVITeZ1wScOp9k2Kam6y+SX5mb26HrDs1Nx1+7hg5E4cotjJBhCOW+zLTCV2MFHuukm0M7hS1FEntjzGT0xoi3nNyRuCgcUVPi1V3ww==; 31:X6HDKH8a9BUAXbrAH3lfHmz1oe5c+y7lKT4d8i2NQXcWs2gTsyke56Dm1p3PdAeIWJpmrN9TtTc0aMcy1D6H2L2URyBynCz3RzVhjdUB/eaACnftOO57LsY1OavtzlaOsQkPCL/S4Q5Aycsl+dxLpqRA+dqpmtVD+f31zy4SHFBFfdDEpUTLFWP6gh3E9vdJlLGoO7EtNUsMU8u2l3zKjTm7GAVV0XpFx8fDm+4ToXk= X-MS-TrafficTypeDiagnostic: CY1PR07MB2618: 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)(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:Flkwx1DY/sylBkveXwoFfUr/RkexB3Bt0UHOfuP1H0WX42fd2YHp93RNqnjxTN25UQ67wuN3h/RK5jHmpBWTiRO/EASnvzmI1+3lg1NfyBGF1xrIZqo2LljcrbefP9S4gWApNTeIfzTgqevO1SllL7oXZ4PNbl/Iq4cXCBn/OklxdwnOxbhrV8+MjYbKq6MqTD64KRxwjrRlqiNIwCsbX68OXzN4KAds4JM9yxbkSBAx42KoRz9XX2DjHVZKa6YaXXEwYtLW0vW9/BgWmkh6Gw== 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)(551984002)(186003)(66066001)(26005)(2616005)(956004)(446003)(478600001)(11346002)(486006)(16526019)(386003)(476003)(6506007)(575784001)(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:KU7JQ4sB7lJQEGYee/fK4QMs3Nk/bG23RLrsq0BZm?= ozKISeOCGGcnmB3gfs+doOxfHAt80AE0+KksUJiOoIhDqPpV3VAFSU0fgoO/Wcr0zsIf0fLDYKswa9EJX8UisXkEgKr6KTUgpYi4N+HbEDCuY/LfoIi6JVXoGtJfdYsb3ymsgdFAgfT7+H/Qy18s7OBquBKLc1rYO3ASZrGCn7PLfJnL0EI5u8odGFUz4FcxzBq6YZatKg6vuk5tWY7aZZGg/4IJvv63uurjVMYW85EJlwH+HKRKrgbjglm+4AWPE5lfL8GgP8zvy/cpmdQlb7kkZ1Onlk2n26az45E0tD0Ad5yw97YNK7abxQtuEodRo8crjBr1U4lfyjQ4fMzzEUZbChVCLCcDGxPSRHqbotsO4CFtHL2pOn+NeeLh1x4yeSs1iSx/PfZnL/gjR3E+IwzgtvjmCVGFQlifNUcHBfmQkvuXIfLesSlx0DXNp6LcPRFlgOzK/iQfUoVU3uGx01fGR3AJM0oXw4gNvcGpEyLVvEtNUx/mJhauhf9C8yW4UvVDbpbqeAjV85W6Tpzs7FyfDu7KMQ4ng3qIsGAoDbTvLecqY+63wxW37ZNCgJQAXtxzHr+mQ3mLVLinmDVsKoKDDWHECnUTrn1QNst2QeUP2bJTehE4ZVDfvTPP2aQrNyi0+CmLD159aMZV8ereClx/Eu67BzcETU8QYHjt9eZ8R/IA3jmi8VI+TpCaMBiuRC+dZTEmIhpK5MlK9axOdst8BIkI+PT4GkhTmC23vwriNK10JEW9Q+9FmSbzCUKmppfhH3f2qBWGGGLriBSYDGx9sLgOTKq9K7eA9rQtz0cs+J4pEgtpBwAfDQNtLoq3LLji2AyGOohP2rQDf0Kp2S2OVovDML84BvZlbqJr2aUeYp5RibdktGG80mQp3S7u1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MIG+hdbanei02YC9jcRtIbsPMYPIKsDbbGMkbDPtqPuW5WnP8EhWpuUIchCllE6sKZLU6Lv3Pjobc7tisZPOBqTTk7+dFFNxjuGp3N8zTvmSJc4dhVPJqPX3b8mUrecjoqcYntA3g4nsaagRsTvigTDnutZW5AjMWRUhI3mnCwpVFhqMZN2BvytAC0BVYwI90XVMkUTntMA+vIFfs8VEVlYOl3Q==; 5:5XJ1OrRVClJXkdEsAeCtLUoPKhulgK0p6BKNB56v95H70X9R0ADGviMc9EExgSOUYcIM/W6f97wZBQF4Z7JY2/9mykRtLsQAPf/Qm3WYhtfXN1kFfAAh7IJFrA3bBm58mBnZtH+5600qsXYJ0xjuHu9WTh274QbcHkKEdcr+aB0=; 7:qIUNmfjpCpR4cwqowFuji7gD5z+wbcF12jaJdfq+DP1/pbdjrVh126RC4mGvdiWrv+rMOrD3/JfpUbUA5mH9a6N9B8/J0gboMC2RSM8EOx1VgB4kvXH7Uk268slmCgfRZBl6ZjWP/z+lK+vKEhkgkSWTERfyhzvPPztyvckpHSUhEo/hpYeLM8MTkdHuU7SL6ZVSY3bCPPbBzaUlytUaLcIF2M0DY8JOJcjA1cXGjBDaRi4f84eJfXdwN17FTlmy SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 14:21:13.5419 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4a4548f2-ed4e-440a-d6b5-08d5fe035db8 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.120 Subject: [Qemu-devel] [PATCH v5 1/5] qcow2: Options' documentation fixes 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 Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- docs/qcow2-cache.txt | 3 +++ qemu-options.hx | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 8a09a5cc5f..5bf2a8ad29 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -130,6 +130,9 @@ There are a few things that need to be taken into account: memory as possible to the L2 cache before increasing the refcount cache size. + - At most two of "l2-cache-size", "refcount-cache-size", and "cache-size" + can be set simultaneously. + Unlike L2 tables, refcount blocks are not used during normal I/O but only during allocations and internal snapshots. In most cases they are accessed sequentially (even during random guest I/O) so increasing the diff --git a/qemu-options.hx b/qemu-options.hx index b1bf0f485f..f6804758d3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -752,15 +752,18 @@ image file) @item cache-size The maximum total size of the L2 table and refcount block caches in bytes -(default: 1048576 bytes or 8 clusters, whichever is larger) +(default: the sum of l2-cache-size and refcount-cache-size) @item l2-cache-size The maximum size of the L2 table cache in bytes -(default: 4/5 of the total cache size) +(default: if cache-size is not defined - 1048576 bytes or 8 clusters, whichever +is larger; otherwise, as large as possible or needed within the cache-size, +while permitting the requested or the minimal refcount cache size) @item refcount-cache-size The maximum size of the refcount block cache in bytes -(default: 1/5 of the total cache size) +(default: 4 times the cluster size; or if cache-size is specified, the part of +it which is not used for the L2 cache) @item cache-clean-interval Clean unused entries in the L2 and refcount caches. The interval is in seconds. From patchwork Thu Aug 9 14:20:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10561461 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 95BD914C0 for ; Thu, 9 Aug 2018 14:23:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84D142623D for ; Thu, 9 Aug 2018 14:23:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78F8326B41; Thu, 9 Aug 2018 14:23:01 +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 8D4C72623D for ; Thu, 9 Aug 2018 14:23:00 +0000 (UTC) Received: from localhost ([::1]:51148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnlq7-0007CK-ML for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 10:22:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnloZ-0004Ng-NN for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:21:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnloW-0004dE-9m for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:21:23 -0400 Received: from mail-dm3nam03on0126.outbound.protection.outlook.com ([104.47.41.126]:30151 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 ) id 1fnloV-0004c8-Ux; Thu, 09 Aug 2018 10:21:20 -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=4jKo4stRFsF3p8U316SMAJbWBGdtuvxz7r5TBp6T6vc=; b=gmaMu8MKXamulZj+n0Zy4R2XnbOYOrTMkYQs7nm6X57z6WLconxc0peO2d7nw3MhIrNpr4OrlhvE54fjRv0WmjGGEu0iGLO1IfEsjN9E5u9zicAaBrtigwDP0oegbN78hCGkEkeg9dqPENcH1W7ocSD6hHJLmwHKs3TDSETuKTw= 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:15 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 17:20:43 +0300 Message-Id: <20180809142046.12311-3-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 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: 90e31ad9-f6ac-4438-b308-08d5fe035f38 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:ilVcW0LtCY82iooR3JxOW5aCKYhFzwfsMlgfEXBQbC8s9t5twe7AQ2uRUprH515wCx6LJIY8wBNENkhULcfd5AkLf0PcP9HH48hOyDefYVZva5jJlI/ArXs4PZwsyMZRsGuZ84dDeP+uPD4imu3KB0uslcGcvcKW1+Wk4TMjuDGbaWVzEANUGAVn5fcUCOcoUsbp/j3VDBxkzPc/hqSuV0RJPpQ3g19OhOxrsOO135zst9dk4nbS8+87xWtdbnl4; 25:tPvGvstvJd1zkFTcHGrFTxnS13H+L1W7eOgTm9zGM0T/czp4m0NB2KzEw4Tod7k8+fCIzmGFAmqvUxXf3I1E+KCSMhCzN0GNo9u/MX6W3cYTcgPF+/uN+pWbmMT/lC24ikBf83ssAxICBTHVeTHvYS45+rhk8j66/q31DEogBb5q0cAR6Bf0dXQrizSI0ioxLbExQ+jEFacSmf1Pg0uiTcgIsf4Mb53mCqSBIFKSXhSHUpJN8T3oLEf9kLJYid7JcLTjvzF1PIhlczAwrmX+r9CbpOuFg85/vCN4uVh3pjCAq8o+TpTb+Ce/bhMhMzAjuZy0SS0yrHNkSf3ENdr3Ag==; 31:xKVIseh8Fuvz4NH/7WL8c6SDRdpnYJP4vtzGJs2xm3pJ6sMeSmlKdzkhT0HYCn8e+An/skgM3XJbrHR/sN5YU2XBopyjNoaGXhxeB3qMxfg3QV1r/t7L9SIcc/Amuz8ETZUFU/29cGT/+qOzaYYJFLqH3jVF0+gRtGqS+Kz/ipGfQNx+G5uc9ELG7wUG8/HztSFIM+a4ZzRutZA2G+ApVBLFOM+jWpY5FAIHLdBr61A= X-MS-TrafficTypeDiagnostic: CY1PR07MB2618: 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)(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:+mjZoIf/yj36KgMcYoH0iX6FRrxtBE5Q4rQtB735CSLByhy+8VUT8WDzTj2jYJBCH7b/QxpQWz3QXmIsx0+B1DopbTR8DwH0WfKmJ2iQLtQiht3pBZ6w8kaeox0N3KyTSzv5jOwXhaqQPwcC7iF2xodyrPmmT4ccSCBd12gu+Aa+UHQjyA41TIePTgfdLTv035EyhXNVxQ3p24zTKjz30f2954QVXnBhnlfyxskAw1tYJ7A2vXlSB6WDef06Bl3Uh/Ch76Z9l7Qam3HigBOlFQ== 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)(551984002)(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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XWiD4VX6Yt9+nysqP3noUXEauRjc8sCQ+5uOJRjK+qQhvsDZuQObpGpbA0Ryj8cK4sD6qPTKtHxrfFOQ60B6x70TkWI3lm4dY0SgpdPy+4V2jNA==; 5:gamkTPmp9IDVjTYnj7IfAIp7IGFWNkVdNLUK42ntCAKlUw0qPXxHvf4iHqNoOORm3dnqM0HZTfr219A9T4p+vg9ZSDajQlcHAdVWUmc7ahHoX+QIR3b7mrGJ/NGUyHbVP+qK62LwZA4ASQRiPJ3WbLUG+y6gyBAmL/9MiU3FNMs=; 7:5ZdZSGlO9oefSKaOBFWB7BEjBJSxFVt9oYrtKb2AY/EQ1zItmKZS4L3+p6Fadys5ysVzzW9x++W8ZHIkEQkyfAdLkfqdZ/EaIGn3FwhiozyQn/VvZjYKyuBuzUa/PoF3KETWripdD5ATco6idW468b3YYDxlHVsyxlTIUAqxemIDTZZrqFs25ljSigvRB3P8HztnqQvvbmxcWTxOCnMD5Dnvl/NTZkBVXbujuXhUPrPZF5vwyNvkTVhGtEKI/Kaz SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 14:21:15.8857 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90e31ad9-f6ac-4438-b308-08d5fe035f38 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.126 Subject: [Qemu-devel] [PATCH v5 2/5] qcow2: Assign the L2 cache relatively to image size 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 Sufficient L2 cache can noticeably improve the performance when using large images with frequent I/O. The memory overhead is not significant in most cases, as the cache size is only 1 MB for each 8 GB of virtual image size (with the default cluster size of 64 KB). Previously, the L2 cache was allocated without considering the image size, and an option existed to manually determine this size. Thus to achieve full coverage of the image by the L2 cache (i.e. use more than the default value of MAX(1 MB, 8 clusters)), a user needed to calculate the required size manually or using a script, and pass this value to the 'l2-cache-size' option. Now, the L2 cache is assigned taking the actual image size into account, and will cover the entire image, unless the size needed for that is larger than a certain maximum. This maximum is set to 32 MB by default (enough to cover a 256 GB image using the default cluster size) but can be increased or decreased using the 'l2-cache-size' option. This option was previously documented as the *maximum* L2 cache size, and this patch makes it behave as such, instead of as a constant size. Also, the existing option 'cache-size' can limit the sum of both L2 and refcount caches, as previously. Additionally, some minor related changes were made: * Refactoring in the immediate proximity of the functional changes. * refcount-cache-size is not ensured to be at least at its minimum size in read_cache_sizes(), as it is set to at least the minimum size in qcow2_update_options_prepare() anyway. Signed-off-by: Leonid Bloch --- block/qcow2.c | 38 ++++++++++++++++---------------------- block/qcow2.h | 4 +--- docs/qcow2-cache.txt | 26 ++++++++++++++++---------- qemu-options.hx | 6 +++--- tests/qemu-iotests/137 | 1 - tests/qemu-iotests/137.out | 1 - 6 files changed, 36 insertions(+), 40 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index ec9e6238a0..092bd17975 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -777,21 +777,27 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, uint64_t *refcount_cache_size, Error **errp) { BDRVQcow2State *s = bs->opaque; - uint64_t combined_cache_size; + uint64_t combined_cache_size, l2_cache_max_setting; bool l2_cache_size_set, refcount_cache_size_set, combined_cache_size_set; - int min_refcount_cache = MIN_REFCOUNT_CACHE_SIZE * s->cluster_size; + uint64_t min_refcount_cache = MIN_REFCOUNT_CACHE_SIZE * s->cluster_size; + uint64_t virtual_disk_size = bs->total_sectors * BDRV_SECTOR_SIZE; + uint64_t max_l2_cache = virtual_disk_size / (s->cluster_size / 8); combined_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_CACHE_SIZE); l2_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_L2_CACHE_SIZE); refcount_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_REFCOUNT_CACHE_SIZE); combined_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_CACHE_SIZE, 0); - *l2_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_L2_CACHE_SIZE, 0); + l2_cache_max_setting = qemu_opt_get_size(opts, QCOW2_OPT_L2_CACHE_SIZE, + DEFAULT_L2_CACHE_MAX_SIZE); *refcount_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_REFCOUNT_CACHE_SIZE, 0); - *l2_cache_entry_size = qemu_opt_get_size( - opts, QCOW2_OPT_L2_CACHE_ENTRY_SIZE, s->cluster_size); + *l2_cache_entry_size = qemu_opt_get_size(opts, + QCOW2_OPT_L2_CACHE_ENTRY_SIZE, + s->cluster_size); + + *l2_cache_size = MIN(max_l2_cache, l2_cache_max_setting); if (combined_cache_size_set) { if (l2_cache_size_set && refcount_cache_size_set) { @@ -799,7 +805,8 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, " and " QCOW2_OPT_REFCOUNT_CACHE_SIZE " may not be set " "at the same time"); return; - } else if (*l2_cache_size > combined_cache_size) { + } else if (l2_cache_size_set && + (l2_cache_max_setting > combined_cache_size)) { error_setg(errp, QCOW2_OPT_L2_CACHE_SIZE " may not exceed " QCOW2_OPT_CACHE_SIZE); return; @@ -814,29 +821,16 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, } else if (refcount_cache_size_set) { *l2_cache_size = combined_cache_size - *refcount_cache_size; } else { - uint64_t virtual_disk_size = bs->total_sectors * BDRV_SECTOR_SIZE; - uint64_t max_l2_cache = virtual_disk_size / (s->cluster_size / 8); - /* Assign as much memory as possible to the L2 cache, and * use the remainder for the refcount cache */ - if (combined_cache_size >= max_l2_cache + min_refcount_cache) { - *l2_cache_size = max_l2_cache; + if (combined_cache_size >= *l2_cache_size + min_refcount_cache) { *refcount_cache_size = combined_cache_size - *l2_cache_size; } else { - *refcount_cache_size = - MIN(combined_cache_size, min_refcount_cache); + *refcount_cache_size = MIN(combined_cache_size, + min_refcount_cache); *l2_cache_size = combined_cache_size - *refcount_cache_size; } } - } else { - if (!l2_cache_size_set) { - *l2_cache_size = MAX(DEFAULT_L2_CACHE_BYTE_SIZE, - (uint64_t)DEFAULT_L2_CACHE_CLUSTERS - * s->cluster_size); - } - if (!refcount_cache_size_set) { - *refcount_cache_size = min_refcount_cache; - } } if (*l2_cache_entry_size < (1 << MIN_CLUSTER_BITS) || diff --git a/block/qcow2.h b/block/qcow2.h index 81b844e936..d77a31d932 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -73,9 +73,7 @@ /* Must be at least 4 to cover all cases of refcount table growth */ #define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */ -/* Whichever is more */ -#define DEFAULT_L2_CACHE_CLUSTERS 8 /* clusters */ -#define DEFAULT_L2_CACHE_BYTE_SIZE 1048576 /* bytes */ +#define DEFAULT_L2_CACHE_MAX_SIZE 0x2000000U /* bytes */ #define DEFAULT_CLUSTER_SIZE 65536 diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 5bf2a8ad29..6ad1081d1a 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -97,12 +97,15 @@ need: l2_cache_size = disk_size_GB * 131072 refcount_cache_size = disk_size_GB * 32768 -QEMU has a default L2 cache of 1MB (1048576 bytes) and a refcount -cache of 256KB (262144 bytes), so using the formulas we've just seen -we have +With the default cluster size, to cover each 8 GB of the virtual image +size, 1MB of L2 cache is needed: - 1048576 / 131072 = 8 GB of virtual disk covered by that cache - 262144 / 32768 = 8 GB + 65536 / 8 = 8192 = 8 GB / 1 MB + +A default refcount cache is 4 times the cluster size, which defaults to +256 KB (262144 bytes). This is sufficient for 8 GB of image size: + + 262144 / 32768 = 8 GB How to configure the cache sizes @@ -121,8 +124,11 @@ There are a few things that need to be taken into account: - Both caches must have a size that is a multiple of the cluster size (or the cache entry size: see "Using smaller cache sizes" below). - - The default L2 cache size is 8 clusters or 1MB (whichever is more), - and the minimum is 2 clusters (or 2 cache entries, see below). + - The default L2 cache size will cover the entire virtual size of an + image, up to a certain maximum. This maximum is 32 MB by default + (enough for image sizes of up to 256 GB with the default cluster size) + and it can be reduced or enlarged using the "l2-cache-size" option. + The minimum is 2 clusters (or 2 cache entries, see below). - The default (and minimum) refcount cache size is 4 clusters. @@ -180,9 +186,9 @@ Some things to take into account: always uses the cluster size as the entry size. - If the L2 cache is big enough to hold all of the image's L2 tables - (as explained in the "Choosing the right cache sizes" section - earlier in this document) then none of this is necessary and you - can omit the "l2-cache-entry-size" parameter altogether. + (the default behavior for images of up to 256 GB in size) then none + of this is necessary and you can omit the "l2-cache-entry-size" + parameter altogether. Reducing the memory usage diff --git a/qemu-options.hx b/qemu-options.hx index f6804758d3..4c44cdbc23 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -756,9 +756,9 @@ The maximum total size of the L2 table and refcount block caches in bytes @item l2-cache-size The maximum size of the L2 table cache in bytes -(default: if cache-size is not defined - 1048576 bytes or 8 clusters, whichever -is larger; otherwise, as large as possible or needed within the cache-size, -while permitting the requested or the minimal refcount cache size) +(default: if cache-size is not specified - 32M; otherwise, as large as possible +within the cache-size, while permitting the requested or the minimal refcount +cache size) @item refcount-cache-size The maximum size of the refcount block cache in bytes diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137 index 87965625d8..e3fb078588 100755 --- a/tests/qemu-iotests/137 +++ b/tests/qemu-iotests/137 @@ -109,7 +109,6 @@ $QEMU_IO \ -c "reopen -o cache-size=1M,l2-cache-size=64k,refcount-cache-size=64k" \ -c "reopen -o cache-size=1M,l2-cache-size=2M" \ -c "reopen -o cache-size=1M,refcount-cache-size=2M" \ - -c "reopen -o l2-cache-size=256T" \ -c "reopen -o l2-cache-entry-size=33k" \ -c "reopen -o l2-cache-entry-size=128k" \ -c "reopen -o refcount-cache-size=256T" \ diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out index 6a2ffc71fd..70f245ae7a 100644 --- a/tests/qemu-iotests/137.out +++ b/tests/qemu-iotests/137.out @@ -19,7 +19,6 @@ Parameter 'lazy-refcounts' expects 'on' or 'off' cache-size, l2-cache-size and refcount-cache-size may not be set at the same time l2-cache-size may not exceed cache-size refcount-cache-size may not exceed cache-size -L2 cache size too big L2 cache entry size must be a power of two between 512 and the cluster size (65536) L2 cache entry size must be a power of two between 512 and the cluster size (65536) Refcount cache size too big From patchwork Thu Aug 9 14:20: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: 10561459 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 5572B13AC for ; 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 ; 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 ; 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 ) 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 ) 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 ) 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 ) 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 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 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: 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+5KczlA8Q9IKCIrLXPbfdpYi2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DiagnosticMetadata: 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: 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 L2 cache relatively to the image size, implies that the cache will be adapted accordingly after an image resize. Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- block/qcow2.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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); From patchwork Thu Aug 9 14:20:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10561463 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 7A66813AC for ; Thu, 9 Aug 2018 14:24:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 675662B441 for ; Thu, 9 Aug 2018 14:24:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 592562B55B; Thu, 9 Aug 2018 14:24:18 +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 C95252B441 for ; Thu, 9 Aug 2018 14:24:17 +0000 (UTC) Received: from localhost ([::1]:51154 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnlrN-0000fo-2G for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 10:24:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnlod-0004Pf-FI 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 ) id 1fnloa-0004f2-2l for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:21:27 -0400 Received: from mail-dm3nam03on0106.outbound.protection.outlook.com ([104.47.41.106]:60131 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 ) id 1fnloZ-0004eW-Qx; Thu, 09 Aug 2018 10:21: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=61HXpQJyq6RI3GZTlx+esLZKnZN2JEIxsOflHnYDkko=; b=SCviGfedD2sufGOyVbnezb73ysUyL3KHRFNBO8AbTFplMEhSeglgYqxhdVRbtt0Ar3dRa2KySzDi3gTpmCXvkLCtt+Wi//KlBVUfooE5Fk75UxFRoOnL4XPHRrbC2FAZdX0FQCpzlzIc7scZ6BGBHXVqPd9mMHXCGf7lI9J959k= 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:20 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 17:20:45 +0300 Message-Id: <20180809142046.12311-5-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 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: bdcb72ee-0330-4bf5-8122-08d5fe03620d 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:cFaaUAK80qo3p+4SF8oTc6avE+Kbd+1UjGb7m/715lLgNNSaKZ+iHFo5O8MQOgrLE+fElcrPZAvUZsTIKeqa9vXbQfnrR1epd0iz4vMge/PpXpMfz5zn4KzoxGJUUCQNvPEeDDiVyxMtUXHeqebg7o0Do9OyHWR5dFYoR7iiuibNiEVBaZi8TcbFMc20J/eeUU956+PTSPktpl2seXDLC08YfLyJ/59tZLy3evBYlzL7ZnoFzqE3UAWLdN4UGDhf; 25:jfew44UZ061xxNGwlaZMNy7ZpSVY3bD7uEEgC+Mi+i8p/gXsCaRxnRNRk5IZOTQjcVcHpaLp3OlbvFo0AHKT2KqhceF6kcW6XlnqJgtAFph+mkh3ySE2oIKMDp/uMYiAolCLzXt8ptitKASvGVEegSBKtnPHmihqC+r0NUTWK6kvVkXVKlNkVHZButk+92fI2YR4hCZ5Tghcla9u9bYcr+lVL3TP2o43cegjzuV55shznMuj6TYDmLQuxJXo/wEs1usDun0NjZdeivTjtZNlUFWuveWaqb5mOxzcAv4Qm+uH8FnyQzuInBaeAcMX4H+oqaSUb1yzQHpe6Op4JwBXeA==; 31:Fp6E3C+mn7GrfXCVP8yfDm6NYZEHUSVR4NeTuNl1BFIc5/TzhFwc2soc24AKUh18CKfRCBejMaij24yIGWNSNZMZvIxGEsWhsB/JxWWrGiEy2++0Qb9CQNuoJn5Sh6ZwNAH5CRlOgkNYNUttZGUyOgu8hjPqiwq6dJaMZokRd0uY/ysuKTKpItdg0bNyRxNOltJYLuLn7bR60eg7/tJuychszTf84p2raytYG9dtQ3A= X-MS-TrafficTypeDiagnostic: CY1PR07MB2618: 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)(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:L9uJCp2JKYV0FgwiaPt4Y49PkTkOREuFYHn99sXQj9+zE/4geLSpvB6y3BPgrNj6lbaR/oIUKSJOsyXcSjT5/U8pMf2qVnUJq9Mv2WxniC0Zn3t1P/LgHJLuxS2f2x5m7tvBNEprbon/mn7mI35ID6q5+HYHdxpSGS3JsjXsnGBCm48tCAzvKGaV5jzVyPKM5l+iaPH93m9tCAZoBADamK3XDkZrTeRVHpilq+5HVpKEAhpWNh8Lmv84/M/8wq0Stt69J3juuVPOra+qnnwa3g== 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:Ay9QQQNvtJfkfxrBOb7+f5dkqtW8alD+TBtMC5yPW?= 1uzpBDMaKYoukXqWYrrYVrWaZ5w6M+0ImwhBgEhKvg/2lzUC6NfL+zXHM71afjeES8K1EfQnUoZqxjw168CVMdyP2CvJu7I+TjnXlHbVmDQUsd/0F1ipAgF3gVIxE6dpHHTJX0ysAh0dRQDnNoufFa1TOcv4mRAzWN7LutEy9PLbfJG/Me4uAjgRqrne44oJOdtNJeyuGTPb63hwRTKQv2z0YsD44Rgz1qcTC77tCz/azWWtEEFODDXLIEFUn7efWxP5UPcl7ORVPR9A1tc6xiriJSmBhCPQ38Mlcf9sOHExxaolFj/BDrmrEF7hZHf7Watb2Vs2/llh06yfDSVIQyKSZwgzvsQMCZalhJ08N1Nk7u+oIoOIaoOXw3+tFWEfn8sVlQ8tstDCLbKl3NZ2TlXFE2Y+QxnDAblpk81WuAc/pRGCPkCdLXBfOKndtPB5t8P9LWSsvz1RAnuqBhO0MIGXOa+T+lHF1b7S5PGJBuP9xJjTSZtGX+Xi2466MKSCAOwDt3h0QtL8DEY6wyhW1a6q3TJbc7UUeri5fGA3oXdnhbj4Kh784BYI/i1TcBAt/DsP42DELqO2B7OxlTjISrZtkaQKoUSC+v1iQFlQ1rEOSA0CiwH9tNgkEQhYaUevbHC10vOIVXDw8t9mydEvJ8UYugc8NVv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8fa4/xGZywbZw118V86/bRYJ2c3yPqEcT8O31DLstdS8thaooiOIif9xay293LlKomteSviLyLy68sTtqGLbM/8bWA3WZ+sCncwfx0e30zPHPhYHlu00yNd+/NJ5k+hcKzCgJu2twxeTsbwL3ZcwpWcVcSj2NUfHE6HtssD/zdVZBHPYVIUsRjHg1WtmEWplzHD/AvbEX0nQrjQ8OLLm2JsPz5yrySegOb++Fvl4BTLqIaTvsRavvoaGQgSsiWwuWlufypH7tNz0E5FoEe0fwJW/Armq8PAy1e78u84aPfk99HeABllbmoZtqBotuMwYMi0x36Fl+HJf3cqjbXuFMlQjFlljC/BzmZqUm4UxwFC3YDKcynK1/1bOCXCgAbwGfSQYA24RG06gUQAFgw==; 5:kMKnB6t+v1OA/ZIbPLMsbiMng1TkEuATs/GbnjAnApR1rn5W9rG9M1nObuZnB6pBgv3zLWmNBAs7S06dUzVYb6Z1tZkU4fNFBB50EHNyypcobAsS4i3xBScW5X91n8qQI9Bznqf8VXp5xtqsbCJk7eC8StkQBPVxcCalsJbbTpU=; 7:NE+xzrnZBWspgeXD33iyWZWDv/CJufQx09kLOUnM/a5ndmEimOX782CtDyKt3Q8gcNSEAzqQAemXbbDBA3PIgqyiNFILVLFJMjGdepwM8U8Qe8LbLiq4J0D5KIiklKZhiQBWYnZ+4r1BpKhRVwNCndromx5PfQya1I/sNV8cUVUeTTo92dYkPb8KI4tbigq1ExpQpEHFsryOaGCaWfn0xUHtEVw4xtwJh1s/VFXXFy6wU6Yhxra8pp2cbzaD3DjC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 14:21:20.7920 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bdcb72ee-0330-4bf5-8122-08d5fe03620d 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.106 Subject: [Qemu-devel] [PATCH v5 4/5] qcow2: Set the default cache-clean-interval to 10 minutes 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 default cache-clean-interval is set to 10 minutes, in order to lower the overhead of the qcow2 caches (before the default was 0, i.e. disabled). Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- block/qcow2.c | 2 +- block/qcow2.h | 1 + docs/qcow2-cache.txt | 4 ++-- qapi/block-core.json | 3 ++- qemu-options.hx | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 36113d199e..13715bbf2c 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -942,7 +942,7 @@ static int qcow2_update_options_prepare(BlockDriverState *bs, /* New interval for cache cleanup timer */ r->cache_clean_interval = qemu_opt_get_number(opts, QCOW2_OPT_CACHE_CLEAN_INTERVAL, - s->cache_clean_interval); + DEFAULT_CACHE_CLEAN_INTERVAL); #ifndef CONFIG_LINUX if (r->cache_clean_interval != 0) { error_setg(errp, QCOW2_OPT_CACHE_CLEAN_INTERVAL diff --git a/block/qcow2.h b/block/qcow2.h index d77a31d932..587b053453 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -77,6 +77,7 @@ #define DEFAULT_CLUSTER_SIZE 65536 +#define DEFAULT_CACHE_CLEAN_INTERVAL 600 /* seconds */ #define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts" #define QCOW2_OPT_DISCARD_REQUEST "pass-discard-request" diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 6ad1081d1a..684147ad45 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -204,8 +204,8 @@ This example removes all unused cache entries every 15 minutes: -drive file=hd.qcow2,cache-clean-interval=900 -If unset, the default value for this parameter is 0 and it disables -this feature. +If unset, the default value for this parameter is 600. Setting it to 0 +disables this feature. Note that this functionality currently relies on the MADV_DONTNEED argument for madvise() to actually free the memory. This is a diff --git a/qapi/block-core.json b/qapi/block-core.json index 5b9084a394..9a6a708a37 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2830,7 +2830,8 @@ # # @cache-clean-interval: clean unused entries in the L2 and refcount # caches. The interval is in seconds. The default value -# is 0 and it disables this feature (since 2.5) +# is 600, and 0 disables this feature. (since 2.5) +# # @encrypt: Image decryption options. Mandatory for # encrypted images, except when doing a metadata-only # probe of the image. (since 2.10) diff --git a/qemu-options.hx b/qemu-options.hx index 4c44cdbc23..6abf3631ec 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -767,7 +767,7 @@ it which is not used for the L2 cache) @item cache-clean-interval Clean unused entries in the L2 and refcount caches. The interval is in seconds. -The default value is 0 and it disables this feature. +The default value is 600. Setting it to 0 disables this feature. @item pass-discard-request Whether discard requests to the qcow2 device should be forwarded to the data From patchwork Thu Aug 9 14:20:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10561467 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 9994E13AC for ; Thu, 9 Aug 2018 14:25:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88F8B2B500 for ; Thu, 9 Aug 2018 14:25:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D1FC2B567; Thu, 9 Aug 2018 14:25:39 +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 105AA2B500 for ; Thu, 9 Aug 2018 14:25:39 +0000 (UTC) Received: from localhost ([::1]:51158 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnlsg-0001MZ-8g for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 10:25:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41706) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnlof-0004SJ-Q6 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:21:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnloc-0004gF-Fw for qemu-devel@nongnu.org; Thu, 09 Aug 2018 10:21:29 -0400 Received: from mail-dm3nam03on0098.outbound.protection.outlook.com ([104.47.41.98]:48061 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 ) id 1fnloc-0004fc-7n; Thu, 09 Aug 2018 10:21:26 -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=OeIhqc/PlSFxaVjlAn4Dkv8Wo+SmcG2/p7ssdHIiYi0=; b=RcKQlydnfxbKkrY/C5Xq3F6aVOTEncFxolvP5SO8BR28Mli2qi+xvJabp4HkUwKwwNvop6owHex4gbNmHYgCVt0ijtHcm46K2dRPsAuEDSZSqYF60bv6t0s47A0jaLhTSf0AzUK+GNehbNI1gZFQ6qJqKZzKaOHT0Si1YWSwgHc= 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:23 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 17:20:46 +0300 Message-Id: <20180809142046.12311-6-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 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: 0e85416a-e6df-462c-c143-08d5fe036370 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:W/d1UCR0DQbFwpkMVtjRmXtjLy6DhEtM0MZjme1Kkb9cUW2Bv0PthnvwioCgdFzT1ymlwacXrPVgMvF51R0zIRELRWOeU6OcVWSvbYENK516jIwjL8niphOYpJYs9tv7jW0kHqZzsTCjXrJLcSpWRRIae+DOzCwIAmDGVtFC072JSFUbTg08xe9DQP+5KCqGCnl8WpKCr2cCqPX6aLv5tzFGFCt4nNKFeT3Jn7BeCw5AhZvXnjQy9hY5TWUEA5kp; 25:30nV31FIj3Xd/V4ITHc6M/yNcjKOrJ8Vf8Rczgh8/qhLmnFk4o1VtVWxRv8APWf7vKEod65GoTh9tFs+0yCqu3jzc5TDEFAXuSSX6yGni+Gz4zjF+YmVHQWBLJApx3kBzUgFaEs+c3yd3k1f5Zh+g3LzMSvHaH6Qpd5RL+yu02VwnCQXPbosnoDMDDrS3rIHDoqVWBFIqdFP6cJWwq6NcvwTwNwLk0Js+H75tSGWI3yhaaAF1NRIZR6ysKc5M6OAfwAN8qGSgE7rcVHm0EjdarOX2A50woz6aJkS+Ym7Qn00Uk8JdsfLgPiYp4nR6JRJz0r+Fuaxr4ZVqz6i7xUMEw==; 31:OfBHkWE12GrzqkMycs88ryZ37cSqueW2VgvreLe8oupSOusof4aE7ymvii59s5mRVR82xjaFJx/tf4N8mSKY85k8pftijFqslk9FUQAzsmqT6M3zL+tlxMUklsI/IlvWZ0LS3oBtjuPqS8u5+oQXvMTK+Zd2eAaKSeC7z33SYupOlTVK3F8zTpponWoX3RexwHTFJfS3KFilM9PdhUIldzufmqOSf3UitkLueWg62po= X-MS-TrafficTypeDiagnostic: CY1PR07MB2618: 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)(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:V8IwhpkyPWlLcawdMuOhhg+f6b/9grLbv6w176RSczsrVqNK2cne5CM9f1zjnG0OemJzLrRB6ThAy1HPFbodTS+OvbnuRzQKh1wW4aPBr7AGJ5kflhwgqawqH8ojHsnIr0px4uO2F2xFjEg01gFAX2Z0F0IMIPiLwAfbPi4QA8Rxf+xbWc9hx+7aE7d1Pp8Hn614HCeJ79ozniLY+/1TLuEatEm9rihbsc9Deh7CbWdZPC93/FxW8WtKSZx8gGRiHnnwbtrUXxm0vXvc5+V+kw== 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:lNIJRMOOCzExb8qa2jlD1tfEO27UMom7dVlklkzP3?= POlyuw54CPJCp5odl6OJ1JyJ24u2JbcNopsHlXsCnoNuqdgnzRJu2spUS2EOnicIy77xUk+EDcOfxTATggxdQttXz1WDZ+CkvzNLE3ONMZjq/Gaz8YsEiRoKGtiWt466af1wTreSX3uTLbBL+5z2nkZ4Oi83m1TgGQGuX0Qx9vgG9gusavj1lYNS36529H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ZQ== X-Microsoft-Antispam-Message-Info: 9EtbdMKxNI0DEFsSD8XfJYE0X8qtrV+GFcZOEM1C6QK7KaT3ldkhEoluVUQuxARRnF2qGKjM+FK5edDqF0xS18vrdP+Ssan8zs/V0enNzvdZKxo0oHwTOVzJYgcp+H1FRylc1LJHTOEzxQYBbhgMFlzvnlSh6MGFCkj2/G2Z18wx3KNPw8DiJTdumtBB7VXHTHS51miW/Rxp+iylanBcOrk2OQwiClbRegCXggecT+KW6AllAh+ULQP2vMvLfLDig+kuTmeDH+IsIEBYUg249KmbP82t7aUJ/BuxOOxfADlKZjQu/YekEPM+kOD279UamLLABaXzz8RHJey4jRzlA/B2ogobnUCgutii9XXD+OQ= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2618; 6:XD2/PteLt5NCVAw1OjbALFVCP5Xik98aE2fQTVgPpMysWUM4/gPnJcqQi2iTxbJrlejD59P5PVd6tptYOg5yOJMRf13wS/tpwoF1EEhi0ynoQKnBgdaV1v/G2VegUsEVOgGJTyvgHE7XdHouS4Xnj7dYH31hhT1fuRcsRShXgvBLORoAVhmzLBWu3+leALKT9UUyOtJqxZ92PhpZbKvC/gG6+XhN7W5Nj3jPc/41aCnQeVp+XzBEBAilzX5CWUVQr8YkBuN1qsKhS3qT602wPXBv3q671/u7OuKaxena7MDgfq3o9RLvp8voNcEFAQpBZYkTf06KKGnfEi6K/Y8fkcymtegsEuQEKAP9gSuXUQMvYkH11hicxw/e59w9e94CRPp/RIRahi6kVy7G98Z9IKhiLvGWjtydNcsslbjzN3z5H3qSNJXvjK3AeI2Y/aQyFHGH9CTBUrOY0No2aQHGeg==; 5:mudFTNO75Xg/X3dc4hZjxzjdLo5V1nGDvwepvYoLSBwEPNl3X1DcfWQskLJ21eykyjTb8nCQ9rqaxASXaStRAI09eyDBByOE7NS2Ue6C7wP17txvjeJuYZizsv9VrnaSWfKL7Spr19UJSZ+vZdm3OE3tPdB254vWfH9nTyLG190=; 7:O4/W+nyTDm62u9/yEwk7EIjNZUl/4aUpcMd8Bl1JdpTnoGT6WFTvLvHnmd8Hy+XuM6+VQ2+9TSFvZpvceL+/OBJYdx47V1JdDy61gdMqqbnFNszW+j+Owjt/tGp9fo4D1VCZXKVYEwLozYcYGAxS3cfsjfiO0bzMEfaYqV2Nj27wbKmvDPRnSganZxayxXAo2KniAcinKBkZeWTYIpEVs6JCfmbZdgDcs0BEq+XSWjsAu8HuQD2xX1pgWyRU7pC9 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 14:21:23.1202 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e85416a-e6df-462c-c143-08d5fe036370 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.98 Subject: [Qemu-devel] [PATCH v5 5/5] qcow2: Explicit number replaced by a constant 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 Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- block/qcow2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 13715bbf2c..6e1a717b71 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1322,7 +1322,7 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, /* 2^(s->refcount_order - 3) is the refcount width in bytes */ s->refcount_block_bits = s->cluster_bits - (s->refcount_order - 3); s->refcount_block_size = 1 << s->refcount_block_bits; - bs->total_sectors = header.size / 512; + bs->total_sectors = header.size / BDRV_SECTOR_SIZE; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; @@ -3448,7 +3448,7 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, goto fail; } - old_length = bs->total_sectors * 512; + old_length = bs->total_sectors * BDRV_SECTOR_SIZE; new_l1_size = size_to_l1(s, offset); if (offset < old_length) {