From patchwork Mon Aug 13 01:07:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10563825 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 DA9AA1057 for ; Mon, 13 Aug 2018 01:17:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7BDB2863C for ; Mon, 13 Aug 2018 01:17:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B91502897A; Mon, 13 Aug 2018 01:17:05 +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 2C7AC2863C for ; Mon, 13 Aug 2018 01:17:05 +0000 (UTC) Received: from localhost ([::1]:37008 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Tk-0006T7-5b for patchwork-qemu-devel@patchwork.kernel.org; Sun, 12 Aug 2018 21:17:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Lt-0007nY-RR for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp1Lp-0001pP-Qk for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:57 -0400 Received: from mail-by2nam05on071a.outbound.protection.outlook.com ([2a01:111:f400:fe52::71a]:20085 helo=NAM05-BY2-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 1fp1Lp-0001oj-Gc; Sun, 12 Aug 2018 21:08:53 -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=A67MH3AcvGvkt3FanFl0skB1weXySxU5SVEBYW8n6/8=; b=EhtBp0dDaBbU+TKw0CcgeKPlsYTT8uI68/FcwOp/QytA/MZ8sN20vNq//IVRmvYK3dG47ewE1Q13oLQY7/bqWkNTbnL0p1iOC8lkOPEIYLixD7b+F/6+Zz7QmYQkd8OJTWj8q6dnC9h+MRXUG9Ku0VtRLULCsZH72oK2KJJnR3Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.19; Mon, 13 Aug 2018 01:08:22 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 04:07:22 +0300 Message-Id: <20180813010729.4844-2-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813010729.4844-1-lbloch@janustech.com> References: <20180813010729.4844-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM3PR07CA0120.eurprd07.prod.outlook.com (2603:10a6:207:7::30) To SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66078cf4-e402-4190-ed12-08d600b944af X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 3:W+dWgTc4Qwja4DbVd3Y5qoVGQj5sKj17icLJ5i9DMV2JfKBOrOv1/XR0W5My8+AeE/LG+3VAc9M16bmHVOL3jxl3IhAeZK/YyM8Ko8grYRvUjzeV1Ggm+9Y98jDFvcGaQz42/UM8WHO+fy6fpthDZy4LmfblfaHCxmtUs/yUj9dsNqDqAGOY70byIiDCBJv+o+hfUBexidztq8ykSgOU+JxPMQRb0k9IcWaZ5TmmgfytPj3hgTULqLpPg3a5VEdg; 25:CmXlnWu2ARncENarw89VshHOclYGHM7NIwCyC0ytOdifQ2UJKxAgi6n8ryg5wjh7LRnkzHXxtiNB2I61QtuBHkg8vx9p2CaJ4QpiMxFQm3Qtf6PsTmwRW2GgLttNcbyy40UQXf1O1EzUYoaWErWE+D7byITHgcFDTMFNpPQtr/qJK8eDabJdQESNLOOyY0o21dLDDeizUBplzMxtH2fMZw6c2UsuZuNJgHR4WL4xyWlC9Nac0Fmfyg+qRHAMijM2cQNx4KxayCghKCWmqHEGGuLvU0PzQ+H0HnvWLL2uxO5Bmw5bJRGUmwTta6Cr34AndPylP03MnPwXzpXecYBH+g==; 31:MUrDV/K5h3aBAecwW9YYyDbhWFdXyAGEQSsQvCE7Ub3ZoLwnDKUkffj5hTopj9SfYZxB8lfFhXtLEt5oTgD4676ZMu5GsYfjbjLBETbwu5qjqvAXL7aiccfjzuD8aknIKgSsOQXCohvQi4VgfC999CEhI/okXsUoo0AWYLURhMent5tWr7R/VQRINrXe/NHrQpllMRz0sxToOgvcLKlwXaHn3jIohdECUXWh16HjHIQ= X-MS-TrafficTypeDiagnostic: SN2PR07MB2621: 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)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(2016111802025)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2621; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 4:LcQ7QmizGgMW57qOzrl+SCZdxBkGuaP+nJJxsQ+9b9WyFFMfqu6MtYhUXmlXje8AFZ1hpyn1NaKADSJE+9/413gjqNziPEdpW1yor4HUhHSmwIuIkzvfDu1MBrIt6bfMiaBOi2gHsmW5PlVPg/SBbBbFA4pIl/gJaJXuMKvs9aFT921gO1h9ZB+7tbORnoCdIPalyvpz9GPRoh/ssYFyRjO7DsVS7PFiZzP4bIG1K23TYwXWd1jHEJLLJkpOTj2s9azSV0Lu89Aw+1xF7Esejw== X-Forefront-PRVS: 07630F72AD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(346002)(376002)(396003)(366004)(189003)(199004)(478600001)(105586002)(11346002)(446003)(50466002)(48376002)(8936002)(106356001)(7736002)(81166006)(305945005)(2616005)(8676002)(476003)(3846002)(68736007)(956004)(2361001)(2906002)(6116002)(1076002)(50226002)(81156014)(2351001)(36756003)(551984002)(575784001)(4326008)(6486002)(97736004)(25786009)(107886003)(47776003)(54906003)(6512007)(66066001)(486006)(6506007)(386003)(316002)(14444005)(52116002)(16586007)(26005)(53936002)(16526019)(76176011)(186003)(5660300001)(51416003)(86362001)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2621; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2621; 23:BVyfDDj8nMHiWJaIGPRDbDFWbVdVvbJWqf5hOBKWY?= smwitWcOpPN92WbxlnrbC6epX8f6C+1qvUvYsZJEHZdR8ZjGGXWCBHsNa4iRsDyFDPRsOLowdn+eol+CfX3XndZFgtd51W3t1LOctepD1Q/Jazr9+pMXgGzqt5txDXL+AKTvkgQR8j/evGKqcsnYnW1VtisiYTvXDdaCmLk/XFe3iP82R4b1KcQdCk17X8dILVVQ/HUE/scWQB/DcwXZYSPNYBmtVDalkclZivNGkME8F+0Z3jYwkAb9wEmMDZPrlAP7lBaJ1Zi1inI+fq75pM+c2HsVVhcKA8HTPnw+i2BSDaKhTFmfWfl9hKLzXoRpfeqBo0dTk0gip4hJug8Q9GxDwmKXKNEUT5mERjg260eEPyMB8icQdy76gNDHbhd5tEL1pOR76Se5FFBOzlwiDqwzvyLid42s9iiO/jOVO3LpkqmcFj9cjiMam3sa4dZJY3adZYp+uh2z0g9NgGYkIkF70Nmn+XExKkvyu+uXhyg/lvMSqZRh1XjrREglhkzUNe5UJVrzlAS0sd03HzpYz2O7XDdOYtAFyiaEWyCndUZMRbmf7jOZAAgd8uQvWBIEWReuXzg0iD0nTWxkVgj5f+ZLvpUOVANKTeNVU6ck0Qah9yQUw+t1VwXo/RGBS++EAnCOg35QQxglGV0YD8wDyujgQr88GN2bXKl7gBAHX0Bew6HaXU5VbISClf3oK6man46C/tLABNjFXmSholBcaz1rAhUcN92TEu38IOYvdgNqkA94k8qNQqCULnrZARoVoJ2dqS4Gg48cSYOKKlrql9udPCOkccraeyLCyvztkwDMDp0NEEDfyNiXGg8YWWXcaVjyIFqnhRpsSNsL1F57zRj4iHDSXjEXhVk5wU53cAj4LZT2fXpCAsota2E7Q/+Tqy4KBtH+XmTsGFTUbPH7MPbdGkyrJ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5Mct3BnXdqvwI8ybqf3Jdmg81LwgG6bNwjbZjtdHvezxU+uEm2VA2YpfiHdxGT2MhrPem5rkilzAwnZd0d+xjRu1GIGAsxdgt8E9Ju1uy55kTVBHlTYyBtP5ElNlCWpp7lqhODPKN65zRXO3lYi6mPRl87Nys6thzLPjiAlankX04EGlXaU/Uet86w==; 5:NxyhRCuiP4KJT3nio8rANvejazy/MPELbMhihjCPckvjQrJEPX6bVkuXJoY5Nh23n+jyGAYB8WS+Fcl2vXK+zLEmmBgMDz+CfromNWk3RXVG0c6GqgKq9XC3Xy1a8MJtZhjaYnxuoursf59oAzHZVPcXXnqhZPmv2TVB37xD4yk=; 7:O5c1BL3qwNc071PkP9sy9OK7Z6HVM2j4zAzLmukpxGTukieYoPUsdeZ4IXZeKwOlyt6CmKORdvdNuobr3icVECwDREpILvG+WBEkX6EBejGRUYa/s93SuPEo+YN9yQoslBVdeRgdAKuyH2hzuNNcWvcwMh6S3I9jq/R1muzS0PGxK2SkQ8c2trPJN0kvTraoyAuv7QCbPVrAvpdgQiYtmKJCHEO8okyUY87dRWIYG1iZknd9VmnkRc2DPzmTONpX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 01:08:22.3646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66078cf4-e402-4190-ed12-08d600b944af X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2621 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe52::71a Subject: [Qemu-devel] [PATCH v8 1/8] 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 --- docs/qcow2-cache.txt | 20 +++++++++++++------- qemu-options.hx | 9 ++++++--- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 8a09a5cc5f..2326db01b9 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -77,7 +77,7 @@ aforementioned L2 cache, and its size can also be configured. Choosing the right cache sizes ------------------------------ In order to choose the cache sizes we need to know how they relate to -the amount of allocated space. +the amount of the allocated space. The amount of virtual disk that can be mapped by the L2 and refcount caches (in bytes) is: @@ -86,7 +86,7 @@ caches (in bytes) is: disk_size = refcount_cache_size * cluster_size * 8 / refcount_bits With the default values for cluster_size (64KB) and refcount_bits -(16), that is +(16), this becomes: disk_size = l2_cache_size * 8192 disk_size = refcount_cache_size * 32768 @@ -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 +For example, 1MB of L2 cache is needed to cover every 8 GB of the virtual +image size (given that the default cluster size is used): - 1048576 / 131072 = 8 GB of virtual disk covered by that cache - 262144 / 32768 = 8 GB + 8 * 131072 = 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 @@ -130,6 +133,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 Mon Aug 13 01:07:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10563819 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 27A781815 for ; Mon, 13 Aug 2018 01:13:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17738283B0 for ; Mon, 13 Aug 2018 01:13:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B64D287AA; Mon, 13 Aug 2018 01:13:11 +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 907312863C for ; Mon, 13 Aug 2018 01:13:10 +0000 (UTC) Received: from localhost ([::1]:36985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Px-0003FJ-T6 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 12 Aug 2018 21:13:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Lj-0007fU-2j for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp1Lf-0001iN-FF for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:46 -0400 Received: from mail-co1nam05on0729.outbound.protection.outlook.com ([2a01:111:f400:fe50::729]:24113 helo=NAM05-CO1-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 1fp1Lf-0001hW-73; Sun, 12 Aug 2018 21:08:43 -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=ujK4T5m9J0ebnYy4TWdpNo9kpESzW2/6rJesFrki1/s=; b=KSzXU23/QMO+pwIHWlKcGLjhJMrCPj7YfQNLmdKzPam8S1s7GOnf2yatMBhEXE4x3ARA1eBgOv0GvUUTIzWTaOrUjXwgWlv2fpVJ2FLxXCiPE4pa85a8/ISGTOZI3sE9bFFI0oud2yazUJKLWjmBYq9cyFRq0ArdGyLNwf6e2gw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.19; Mon, 13 Aug 2018 01:08:24 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 04:07:23 +0300 Message-Id: <20180813010729.4844-3-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813010729.4844-1-lbloch@janustech.com> References: <20180813010729.4844-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM3PR07CA0120.eurprd07.prod.outlook.com (2603:10a6:207:7::30) To SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c1a8864-a430-4289-53ff-08d600b945fb X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 3:h7VlbYCty3fGeoF+QHLml56LhEZJWlnajLTC/Mn9/y5mYHbZp0fBd5RAgYlmeXGa5IKp0pC8m/zwSlCK0QQyFXXwDob6nEGBIC50BryEExhx7/Ap94d0KiD+iKdByLtbWXb977QywUCa7RbW9Ny8Mlil4M1XJdpucGdu/cJg8xgahnnd7FbyjyzLCEETjnJhVwIuSS5kCq1pXYje8NsjAo7pzBq0tRb3VX9Jacics04ru2URjcCzZwtKdLvsyBaW; 25:RLzwuVL9SyQkwzQt7gqXgRSUsknlLYBnFh1fVbn8sYY1T/ScPqR0LYbFlZAmmucBHe3i8KYqveDBtbQ3I7lVeYZb0+hbRwKT6Z2SLqjtn5+eVm+fnfw2dv3v9UEnzlO6zipRB4P1KAmFl8EGKa6AdaB2BLsS58mLaj2C2WQi81aYkaa89kiCVvti5kF1eUKheOZvO8+9SP0r1+z8X9WGcWNUfZk8/bd6PVtc/GPPzBWrK7HdC91D0vsEnHC1Xro3HpG6xqYIaLI9B9BLreMcbPivvtPHZKZnZRGH+ke6ey4CZBpWKbij1e3uqiLZH05yNn5XRaylTx38U+VWFeXM9w==; 31:j6AeZ2vkcpG3HRV5LYtv3YutHZxLkutbQ1J3aFS2VPZcmEIYVLgQ1YmKFD2nxdGW4bPS3RJsimJH1VCrnBmN8frxoUWsS+WrYHUWm2XW8+1J/pg2e+PqoJXAaLlxSGgZK0AWItLqO0vF7VDCKrrx7QOEnur62Q6vOqQ/SHVqreCCiKHKLeOokZ6mPJDXMUdLl/5ngLzMwEk0LlNx/LLwbxqHxsksJq7JNBy9jEWi5r0= X-MS-TrafficTypeDiagnostic: SN2PR07MB2621: 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)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(2016111802025)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2621; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 4:O8EVO+dmVlZchZAxidcQOvXyV45dlMbG19fL8cOKzmJxd3qOGccPRmk62w8n0g2GKYDS0iZnKuWop0cdY8cFIq95M9Fc5zsa2CK7s4F6/hDckA9MFzKMOb0ySejskcc0WGsiDeJvXyV/RiSMcWLyaoaoDtGhVMbCO/UNh6SHu4LK3PGpokS1k87dVoxnTGkdQhXQl2SkKmyAPJ8yXbSEhEa7NZMTZI8FiMH8cqtml3W5rlC3DbCKaRYNYD+3kf4Npfb9jgyjMyMbl9ttdbnS/g== X-Forefront-PRVS: 07630F72AD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(346002)(376002)(396003)(366004)(189003)(199004)(478600001)(105586002)(11346002)(446003)(50466002)(48376002)(8936002)(106356001)(7736002)(81166006)(305945005)(2616005)(8676002)(476003)(3846002)(68736007)(956004)(2361001)(2906002)(6116002)(1076002)(50226002)(81156014)(2351001)(36756003)(575784001)(4326008)(6486002)(97736004)(25786009)(107886003)(47776003)(54906003)(6512007)(66066001)(486006)(6506007)(386003)(316002)(52116002)(16586007)(26005)(53936002)(16526019)(76176011)(186003)(5660300001)(51416003)(86362001)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2621; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2621; 23:mQhiw3CVlHW812cytBL1QSuO4qaEd7SdlphnYH8eF?= Hcwd1c1EZxcZZ8sNSxG3fxLbT9qtHcfsIZU4pA7jh9APcAqEIP5ZiKZg6M+npxdKOQvx/xPoNqIHIDwNBRWsWiKMLsmhqCyZ9bsEYWZf2WPp2Ae5Ao7JvrABvP1YxneZjjQmLOt2y3ZGfkB4n/qbfpN22kicxc/7C3I0gPNWP4YMy4LjE26QiWgeXvILTaP1H/Yuas9mpbxZnrHUrjwsVb6+tV/mFj1dtG4ttTUaZ1wJRyH1V5F6Y1Qoi0hhq7Ppr9oPWU2uwnIux/be5fKtUTJ546XySpjJ2FtZtzHzZN5Xwn9R962Z8zuu9xrHr3/k8EbF0k4gZaSr4Is2XMCE4iveaE6dqYF4GV63sgIGAENwrJGcvdgU/ITorfDqoEzkskEsT8CfQYnlGJY6cOjvnzn2AZfYjtTmAkfhdumjFlPUxhm1f/6cc5HKC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adata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 01:08:24.5365 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c1a8864-a430-4289-53ff-08d600b945fb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2621 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::729 Subject: [Qemu-devel] [PATCH v8 2/8] qcow2: Make sizes more humanly readable 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 | 2 +- block/qcow2.h | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index ec9e6238a0..67cc82f0b9 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -830,7 +830,7 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, } } else { if (!l2_cache_size_set) { - *l2_cache_size = MAX(DEFAULT_L2_CACHE_BYTE_SIZE, + *l2_cache_size = MAX(DEFAULT_L2_CACHE_SIZE, (uint64_t)DEFAULT_L2_CACHE_CLUSTERS * s->cluster_size); } diff --git a/block/qcow2.h b/block/qcow2.h index 81b844e936..39e1b279f8 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -27,6 +27,7 @@ #include "crypto/block.h" #include "qemu/coroutine.h" +#include "qemu/units.h" //#define DEBUG_ALLOC //#define DEBUG_ALLOC2 @@ -43,11 +44,11 @@ /* 8 MB refcount table is enough for 2 PB images at 64k cluster size * (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */ -#define QCOW_MAX_REFTABLE_SIZE 0x800000 +#define QCOW_MAX_REFTABLE_SIZE (8 * MiB) /* 32 MB L1 table is enough for 2 PB images at 64k cluster size * (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */ -#define QCOW_MAX_L1_SIZE 0x2000000 +#define QCOW_MAX_L1_SIZE (32 * MiB) /* Allow for an average of 1k per snapshot table entry, should be plenty of * space for snapshot names and IDs */ @@ -75,9 +76,9 @@ /* Whichever is more */ #define DEFAULT_L2_CACHE_CLUSTERS 8 /* clusters */ -#define DEFAULT_L2_CACHE_BYTE_SIZE 1048576 /* bytes */ +#define DEFAULT_L2_CACHE_SIZE (1 * MiB) -#define DEFAULT_CLUSTER_SIZE 65536 +#define DEFAULT_CLUSTER_SIZE (64 * KiB) #define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts" From patchwork Mon Aug 13 01:07:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10563809 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 54A2613B4 for ; Mon, 13 Aug 2018 01:10:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D80C29100 for ; Mon, 13 Aug 2018 01:10:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B8A82910E; Mon, 13 Aug 2018 01:10:24 +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 65A9A2910C for ; Mon, 13 Aug 2018 01:10:23 +0000 (UTC) Received: from localhost ([::1]:36967 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1NG-0001Gv-92 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 12 Aug 2018 21:10:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Lj-0007fQ-1c for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp1Lf-0001ip-Ug for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:46 -0400 Received: from mail-co1nam05on0729.outbound.protection.outlook.com ([2a01:111:f400:fe50::729]:24113 helo=NAM05-CO1-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 1fp1Lf-0001hW-Mk; Sun, 12 Aug 2018 21:08:43 -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=uGSLkWKBjNggyPXIXPvoOaLTM4o2cNEEKa6kahOvxBM=; b=auV6Fd4cEeSBFlyffyDpn6BDdUp0LrR432BA13cP73YbLhbOdDXIjIxJCMvJaSyvH92J6b7zNeDDk0M0dU9rpL1qcrwaAck633qeIOzlAMapozvVeFwAUGP+2Dynzv69N1xtc8s5bubNV+GvF1P5TCn0ZKj+bet1g6BquwQeJQw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.19; Mon, 13 Aug 2018 01:08:26 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 04:07:24 +0300 Message-Id: <20180813010729.4844-4-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813010729.4844-1-lbloch@janustech.com> References: <20180813010729.4844-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM3PR07CA0120.eurprd07.prod.outlook.com (2603:10a6:207:7::30) To SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a5e34ade-12fd-4705-baeb-08d600b94746 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 3:oYOCK9++6IjPfs47f8NOWGK9XG6neSZN02jXn8d9S7Qk3hQxtfea//MUafS8okygkHYIeG/oD2mixuaOb2W9T5Z94GLu//eQSujPvGh14WH3+K3RxzJvuWeT/w0GSejh4DTw892dxTz0kW4QNXHsBCFWI1YFKSWKUGRgJ2fAWeCt/n0dDUzNAAU9zcPrNqfNxPI4EyXptzrWg4wQZGUlSfKY2FRnPPbR3ZEmwpa5hWk93+k54XV9HMsAIV1QNgBg; 25:iEMLXoIQUbU7vy1uLImuMgYsj97rfdaweWl6dvdbFJ4P7X6ua3VGkf6qcsYlZCuKsPe+z6Vm8vLzYzRx0qrlB5i/1WfhFjVI0jxb1lq8fwb5PaLbD27EIApyZO5aiNvxPEw278MkFgho/R76+K4Z6u8vNPDyCVPSrZ4ACbYCqaaQ8K/i2k1Mg7aWQQ5Vw/QGA2sf7iL4TdnzyBE2sU0KD9krtYbjl/ErQZUvuGTBItXATjKSte9LBnklqj6VuTx79M4c47wKhyTKh8ZH6pQRclQrBe0WnR769qdsW0DXOvCRqom8qDSlVdwPCQZ5gAY5xaUItd+3AJqmbHYmwgLfvg==; 31:PghNR2qSVBbzIRi86EO7Bi33vNAd/OPJrnJtpykbQ6GTeHq5aGMRJdwPPB5axW1EIveT3LfPXSmOp3q1S+lZmweon4qR4nFKH0kwG2fI8bVYOOE7CfMZbsd5LyCoASIVMQneHD6vkHWlbG+d1f6Cm1WY7TaWmsB+MahIH8Etmyt+BUkUkvzMw3rTM54frxX4lnbZSvPPIkwvojMW+nkGqtdIiA67cGOa3h6I01m/alE= X-MS-TrafficTypeDiagnostic: SN2PR07MB2621: 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)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(2016111802025)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2621; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 4:zPduWU5vAs8EXDkpBcbuH7INZyTTC0+sjmZbvT3GroO2bWrPApYx49j5DkSksIge3c7sfHaE9RdamLWFTWjQhcq6Cn6ooj23jgu5EdqwG/aZ/b19TeD2wAEbHLr/J9qFy7ybbRa22POON841NGc68wg/PlKFb3g8iNwjhFzlkL6NcSmPnEnX0El3l06fW8SIBc4VB3eX0yXnI2R+bBlS15Krpuw0FyOKLydG79wxEPJPRj70MHhy1laFfpERhnTH48aaCdkZJHs50dy77BFMwQ== X-Forefront-PRVS: 07630F72AD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(346002)(376002)(396003)(366004)(189003)(199004)(478600001)(105586002)(11346002)(446003)(50466002)(48376002)(8936002)(106356001)(7736002)(81166006)(305945005)(2616005)(8676002)(476003)(3846002)(68736007)(956004)(2361001)(2906002)(6116002)(1076002)(50226002)(81156014)(2351001)(36756003)(575784001)(4326008)(6486002)(97736004)(25786009)(107886003)(47776003)(54906003)(6512007)(66066001)(486006)(6506007)(386003)(316002)(14444005)(52116002)(16586007)(26005)(53936002)(16526019)(76176011)(186003)(5660300001)(51416003)(86362001)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2621; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2621; 23:EpyeeLljhM9N2BbQmLBE782ZBvggZN65GHmscckY4?= 3LCMgQBJFMGckpvuWafPgRuL2Wvl138YyKl6mM823oGy+5u5opfrDMFZ/DKCEAeTw85d3l8hCUwDB11oQo4FpfMcWDiCK2Pb9XCETWAN0iLJSGuy7CkWGRkY5M1d4hrA4YJA4Xn5CJrrpQID3ap9NBauSs+8THX2BSUf2s8tLbZ8ZD71wZ5CpCRrs7XAHP07+s30fmg0bgeApmvDB1slXqg37ECddeECvQEiVZ5tnAkKd3ZKho3QF9mSEnd+n84y4vtPWwQNDHVvFiHE/uPqy5FZBoGLQ44B1mly/wmGCYHjpo0X5kBKevie758wP/lUeRHxC34yjAukKUHyZDrI8qEPfZuSl3JGz4zRIhMkjRY5obRvF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WZ9gDz7yRhtZ34wkFYv5TnWSxT7MyCy0Tkc0LF83v SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 01:08:26.6927 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5e34ade-12fd-4705-baeb-08d600b94746 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2621 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::729 Subject: [Qemu-devel] [PATCH v8 3/8] qcow2: Avoid duplication in setting the refcount cache 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 The refcount cache size does not need to be set to its minimum value in read_cache_sizes(), as it is set to at least its minimum value in qcow2_update_options_prepare(). Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- block/qcow2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 67cc82f0b9..7949d15fc6 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -834,10 +834,9 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, (uint64_t)DEFAULT_L2_CACHE_CLUSTERS * s->cluster_size); } - if (!refcount_cache_size_set) { - *refcount_cache_size = min_refcount_cache; - } } + /* l2_cache_size and refcount_cache_size are ensured to have at least + * their minimum values in qcow2_update_options_prepare() */ if (*l2_cache_entry_size < (1 << MIN_CLUSTER_BITS) || *l2_cache_entry_size > s->cluster_size || From patchwork Mon Aug 13 01:07:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10563813 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 2766B157B for ; Mon, 13 Aug 2018 01:10:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 166E428FA4 for ; Mon, 13 Aug 2018 01:10:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1421A2910F; Mon, 13 Aug 2018 01:10:35 +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 44E38290FC for ; Mon, 13 Aug 2018 01:10:34 +0000 (UTC) Received: from localhost ([::1]:36971 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1NR-0001RN-EM for patchwork-qemu-devel@patchwork.kernel.org; Sun, 12 Aug 2018 21:10:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Lj-0007fT-2N for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp1Lg-0001j0-Dp for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:46 -0400 Received: from mail-co1nam05on0729.outbound.protection.outlook.com ([2a01:111:f400:fe50::729]:24113 helo=NAM05-CO1-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 1fp1Lg-0001hW-64; Sun, 12 Aug 2018 21:08:44 -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=0J+f19jfx6Mvmx8mi4zzZHe7Vy4ULjnXgayrhcOpOLc=; b=ZxEyiJkpa69CJDBQ/3SMU0TS6dYEd6EOrQX9FvQERVIx74ysCPkxS0jMxG0Jtk00nVlv3cZiCFzqXWc9w/YdN40nXV+rDwjP/JA3vnJ82+RAcdXzp7YzEn5WNzxe6RmdIbIKzRU9SQgM7GzXGpje5bbItGyfj5JofcqvJj4hGFo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.19; Mon, 13 Aug 2018 01:08:28 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 04:07:25 +0300 Message-Id: <20180813010729.4844-5-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813010729.4844-1-lbloch@janustech.com> References: <20180813010729.4844-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM3PR07CA0120.eurprd07.prod.outlook.com (2603:10a6:207:7::30) To SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7bd611b3-8e4c-46b9-ab51-08d600b9489b X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 3:CCORuIBD45RMAlPh2hl+igx2LZ51BAWMFzKb5hY3lGZU+Q6cooGnJZ3F0UK/1hisqSvPWRtlmY7TEwgph1lOFqLQdKdQAhFA86N0FYn0txPkxWof2XAPLHE8C1qeegtlgzsMwcTX6RVR3kQmiv4VJtkCJI0Gey3BXobmccBK3+WtrsTav665/RCqKGN2XJ+/sQ59TtjgMTJCcycQsTEKNPhnktXrVbdwInM6SJ/Hp5pvJa33ED8gisyYl+0obDEF; 25:9k4CxXPK+xD6yIHVbV20gCldFaROVX0HZD6ecZAEdbZ+fowz3OVVhiZuwvVyB6DUiRPejY3bgBQu3+f0U+q19N+5qAidgSfBDD8Ly5QAQRq8ilQneIHq2ag4kR725P508PaLjmJ8/SlX0vQakEHzUCLxtWlLzxlFTLSO4gioXVv/tpfLe3lROtJxncSCnqhq5cu4daowj96YMJi356As8D+ZhEXiLQr0qOoNIE3jTi8qsH6LCTX22MtcEqMACvtcPsZcp9gJbRuEZ1E5HAT/owiUykQWfkXW7gQ2HkaP5bDv+8prtd5nDCb28TRLb22S7ZopLRZyzN5CpzTCvfAD5Q==; 31:cn5hU8nOP6VX5/8zSlI5Za9b/PJVqDzhQ+YXeSBw/yyZ6EUBnH8X4hf3BCu8D5hLTVWDN5+Rv7/RYKyV7vKXsAZFZqyOE96J7nH3xVOVfd+hvFnB5CIFLrzYTexIKS6o5paCBhKgUhq0GVJjzTlORMIJXhw01QIz5qk5jh9gPCT0QN2BkI6nou+MJbbgfuWHxQ9D/cBQjV3I9kZI31nnKAvAIBuzPI39FLxkN1qHV54= X-MS-TrafficTypeDiagnostic: SN2PR07MB2621: 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)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(2016111802025)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2621; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 4:TFvOifUP8A/7BjY6/9Dnk3ETEGe5/HYGR/Xy2zJ83zwOBuXZf9o5skTYf4TsOl1mIS/bhSnehKBy3eK6PlMX/RszEsnkBL7jk2hdKbMA7wxqMPkC50S1WISKVdxT8/pXZswSbcjKh24YUTq6OleM7phQk2WwKwCRDW1jidUvlwSB9PR+Xq5zmi+LQW/lbmt/fqXXu66U7yf8U/7lrfoFcfxun6P9sxr2RNK35CRYCfAJQoxdq9UM6L344k7mE+8CFz3mPy3vYboaDxx0F+a/Ug== X-Forefront-PRVS: 07630F72AD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(346002)(376002)(396003)(366004)(189003)(199004)(478600001)(105586002)(11346002)(446003)(50466002)(48376002)(8936002)(106356001)(7736002)(81166006)(305945005)(2616005)(8676002)(476003)(3846002)(68736007)(956004)(2361001)(2906002)(6116002)(1076002)(50226002)(81156014)(2351001)(36756003)(551984002)(4326008)(6486002)(97736004)(25786009)(107886003)(47776003)(54906003)(6512007)(66066001)(486006)(6506007)(386003)(316002)(14444005)(52116002)(16586007)(6666003)(26005)(53936002)(16526019)(76176011)(186003)(5660300001)(51416003)(86362001)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2621; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2621; 23:JtNqeMstXIjk/sam3kkShV0yz8hClps0SwQTUZAvu?= 6swT43wBuVj1evbZS7yPQyEDqN14AfTs2WiAz7e1cYhM6p9Y6W79dgfwJiqJU0J1pybouDag80PlXKCLxUs50YbLHnqSIcwYRlqClDnZ297IkYnpFFkXCX/oMlmD718TUToqbJ+X0uBFC8FrfxfVY9+//J0TwmxE6LS73XFIH3eAKbosMbffmMHyVkBl3uEv2EjFWhEvw16LDnsT/bB2cVYH99uZwYQNwkKfd5fjcI5r2bO1aY2xaQyAhJ6K0mFdYehFijqJMUn1g4pjftMN7f7apc6bxRaj4x8ex2Wa9Ti+Wq4w3OKANfsKaV9FZrYG5lJeB51FlVnKIY4/zl7YdKAd6a7CSVivopYkmLUdSHsvCeaImC4Zqd9S0qmDBHCDMm5Tjrnk4pkdmbWUOyYSKTf1H201YqUyLnL0sJSN3+HP8jPL0bYvPdk1FJAv65nzYQNcVsyG/uU/9CzsfIz1xCCLu1i+KE89HwlmrCdyUMhi/NMr/oH46qlaEMJOaL99yZ+w9Y+WtN7GkKgWLOxc/Hr+Gp3oL9adP5kZkP/JaQPkyiyVB0OLsKABwbgrABBof5bVNBbbc+5EJmsQlrO8Qysfix8ufpNszkZptXFV4XRV04M1lSvB43wvGI4MaO62mF6n0FBNhPM6PF3PdWixId3sE+8pzqFWzz4cD3I6ceo7aDv6Q7czqE34Di+jRTDzHuf0ukhMeRObRHJ8wAKlx9n41WIaafuzcEaeXDkxpugfnrTeMK+zSB8wWTFc0BOIquzPsIA5yb0ded4jNFPbcrrU9rXnISCSwtXgfG8JkLk2D/yzSDUs8Hm8j4mf7JuMkXrXwNx25nFc3h7OWftatOjm/lBMNFc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5f4NQcV50vw+XoBY/rQ4YxZavG+KZ1FyT3//eEnbpg5rkkNraNPwZ7Mxtt4lQJD6gs/Msalu25h3j7apaTYWjp2vwOEE+6R/dg8mnU/0kE4O+jG+z8Mk5Msnhzmka5s3xKHRLFMvlGvAZwPhoVsr2hH2kg4v4MKN3QzoEsCm7LvKK1DtU//XV4YNyqEF7MIw7KMsdymt35OTjVL7aQZdxEALRau+zmK1b7UfXDdaDuTyAyFHJrqBxdokvl39qfw==; 5:d6QSaYiQP6CcGACDp9GZJzsArQFEFcaN9UCuVkcbsyJGca3SbJhEsEQPwcrlU0M8ChFotxjGT19XAAQ+pJyjmwgv8t0100Lxhvl/OfTh2FuyIeKJOVx0/v8cGceu0oablM9zvWix+ZkjtcN22ENNCJMk/qqasfJKQW7CcLbtiAw=; 7:jgB9T81ZRg3z0tvAbfpvm4HJTS+86kZPCGdPWz2Oy8A4brtQNd12ecc/uQHemyXCvYpXEtcMrKQVk4JfmVhYcEdShkWaRFrRjftVrRcr3yVqTqldD5WbpUNKugbl7YlVrbfWSSYWqCBjpxeFRFc4wqy/1jgx30KP5zy/K+tXmLdDK0LByqVq5DrjnLbeNHwrj4lYQ2WwFti8InRC08LWAU4RbgnpL5DS2zJ4xYjwg6K/WyRSEQ7jsx0CqKepg2Ow SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 01:08:28.9271 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7bd611b3-8e4c-46b9-ab51-08d600b9489b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2621 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::729 Subject: [Qemu-devel] [PATCH v8 4/8] qcow2: Assign the L2 cache relatively to the 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. Previously, unless 'cache-size' was specified and was large enough, the L2 cache was set to a certain size without taking the virtual image size into account. Now, the L2 cache assignment is aware of the virtual size of the image, and will cover the entire image, unless the cache size needed for that is larger than a certain maximum. This maximum is set to 1 MB by default (enough to cover an 8 GB image with 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. Signed-off-by: Leonid Bloch --- block/qcow2.c | 21 +++++++++------------ block/qcow2.h | 4 +--- docs/qcow2-cache.txt | 15 ++++++++++----- qemu-options.hx | 6 +++--- tests/qemu-iotests/137 | 1 - tests/qemu-iotests/137.out | 1 - 6 files changed, 23 insertions(+), 25 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 7949d15fc6..01c39c56c0 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -777,29 +777,35 @@ 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 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_size = MIN(max_l2_cache, l2_cache_max_setting); + if (combined_cache_size_set) { if (l2_cache_size_set && refcount_cache_size_set) { error_setg(errp, QCOW2_OPT_CACHE_SIZE ", " QCOW2_OPT_L2_CACHE_SIZE " 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,9 +820,6 @@ 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) { @@ -828,12 +831,6 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, *l2_cache_size = combined_cache_size - *refcount_cache_size; } } - } else { - if (!l2_cache_size_set) { - *l2_cache_size = MAX(DEFAULT_L2_CACHE_SIZE, - (uint64_t)DEFAULT_L2_CACHE_CLUSTERS - * s->cluster_size); - } } /* l2_cache_size and refcount_cache_size are ensured to have at least * their minimum values in qcow2_update_options_prepare() */ diff --git a/block/qcow2.h b/block/qcow2.h index 39e1b279f8..d917b5f577 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -74,9 +74,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_SIZE (1 * MiB) +#define DEFAULT_L2_CACHE_MAX_SIZE (1 * MiB) #define DEFAULT_CLUSTER_SIZE (64 * KiB) diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 2326db01b9..e89e74b372 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -124,8 +124,12 @@ 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 maximum L2 cache size is 1 MB by default (enough for full coverage + of 8 GB images, with the default cluster size). This value can be + modified using the "l2-cache-size" option. QEMU will not use more memory + than needed to hold all of the image's L2 tables, regardless of this max. + value. The minimal L2 cache size is 2 clusters (or 2 cache entries, see + below). - The default (and minimum) refcount cache size is 4 clusters. @@ -183,9 +187,10 @@ 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. + (as explained in the "Choosing the right cache sizes" and "How to + configure the cache sizes" sections in this document) 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..22e8e2d113 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 - 1M; 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 Mon Aug 13 01:07:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10563823 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 56DD61057 for ; Mon, 13 Aug 2018 01:15:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 459512863C for ; Mon, 13 Aug 2018 01:15:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 398C02897A; Mon, 13 Aug 2018 01:15:02 +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 D43F52863C for ; Mon, 13 Aug 2018 01:15:00 +0000 (UTC) Received: from localhost ([::1]:36992 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Rj-0004bT-Vj for patchwork-qemu-devel@patchwork.kernel.org; Sun, 12 Aug 2018 21:15:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44553) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Lj-0007fS-1s for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp1Lg-0001jK-Uc for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:46 -0400 Received: from mail-co1nam05on0729.outbound.protection.outlook.com ([2a01:111:f400:fe50::729]:24113 helo=NAM05-CO1-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 1fp1Lg-0001hW-MB; Sun, 12 Aug 2018 21:08:44 -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=P4aBJaMA2JMHk2ZUOg3jsqblglVTPr7Sig2rngLw3H0=; b=O930F2JgjcLKzRhv81OAkaX4FylWHOl01hqozOrkw5AQ+lYEa0E69rbb6LZIS7J1rttjmbNsnTmi1BoVs/w3I+9JCS7f6meON00UA+nA1M6XBja59Tl5m3yuE/CLHJrzOlE3OXl0WiULVCEf1oH00o4lLWe2DfdknSZoRbsKPyI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.19; Mon, 13 Aug 2018 01:08:31 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 04:07:26 +0300 Message-Id: <20180813010729.4844-6-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813010729.4844-1-lbloch@janustech.com> References: <20180813010729.4844-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM3PR07CA0120.eurprd07.prod.outlook.com (2603:10a6:207:7::30) To SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 62546449-d2fb-45ad-123d-08d600b949e7 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 3:AP4HWX/5zPEM7drFycQ0RyH212s3Fg3/xu87i3ILzL3ZSO7gxy1H1YIfYhtQOdUPRw+MdIDUXJ4FO8yxguOeZAlHThvY5tLZt77S0ZU9rXIw75sdYvGDIrG849ZNqcIAMtSXd5gYXtWyh8zKUmQnyxEmT0+z7oi/93w9cLZrg7vhnjFeTkIRme9gnvvJo65jH/PsA/gd+nKYPvVhpqR0/hizS04KWmgnSm6IeuFZoTRTFHNggP0SbIUcMkbl74Oi; 25:Yg+bixEVjWWhdZvr1gjCN0SYt0Ds6pxQ6iX5Si+OuW71Vk0lioEkIX2dA+rSpBpZG7cfPgj4yRMeL6IPMKwb1t9Yik3JAYHQtdftFOybQp3r1PPNcLwuhK0Bf9Ol2F7kOBs03ECOlAnu6X++NTEqex8xkuI3PrEOFkIuQRcZxq9b+55FHYW010Jv26lerpr6DZP0OdDkjGCL180PUF8QgoPj0A2VnQmm5xGO+CPj67dnZt4GyCLwYWBjb3VHeZO9cSrQ6xVYtWimvtKkmPWhtgmxP+z8bGI7By7rofSj3icZnhRXT684vIWFkSFOduaORkHruOxPEitd5SCVmjSKeA==; 31:/iGH/mUdFlbg1oASZ2m77ZH4AvvW232UFiZT2WLnIfCWIhMXN4evTwb7uSJERb7wyCbUHH8ah9JXMXD5UZtuelTnFtGZIDpQU6yUU76kZ6CP54T5ocPIbv0Lrqxzjkyn7XuA8aLqCzOHN5xAULo86DEep6g6ZXnQ36qP/26sjee4ohkBPsgV2/0eA9GRe7Z/gFFSkG88JHkRQTpS7ofjUS4BAdoH4WSrFpe8rK/K/UM= X-MS-TrafficTypeDiagnostic: SN2PR07MB2621: 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)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(2016111802025)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2621; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 4:FX//b2MyaZsjP9OTdc9shIpdvhqJaiOb4SHKA1bJQQQ7PMX9UFcKeEeOvRY1CHvJ0yZR8l7TJeIxu9OTYBDa6BHA0bwFhe9BYPpG76yr5gOoA+1wYX5AUalaE+oEvxBuyREWCPJIi1crvAmNGYOXcPS1QZ7AiA0xmpll6YD4c+4yWWtJZH+QGE6zh/p6UoPCQ7SGS19LGyWz4ZJPwcdfz+zGFX5/r9S1PJFr+5LwqK1vKQO/vu2eU+Dm/35onPJy1C7JH0/Npf7Bfs3Ew4bNOQ== X-Forefront-PRVS: 07630F72AD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(346002)(376002)(396003)(366004)(189003)(199004)(478600001)(105586002)(11346002)(446003)(50466002)(48376002)(8936002)(106356001)(7736002)(81166006)(305945005)(2616005)(8676002)(476003)(3846002)(68736007)(956004)(2361001)(2906002)(6116002)(1076002)(50226002)(81156014)(2351001)(36756003)(4326008)(6486002)(97736004)(25786009)(107886003)(47776003)(54906003)(6512007)(66066001)(486006)(6506007)(386003)(316002)(14444005)(52116002)(16586007)(6666003)(26005)(53936002)(16526019)(76176011)(186003)(5660300001)(51416003)(86362001)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2621; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2621; 23:w/FGUn2rlz+2Obm+lg9eaz36kOqSj4AG8qHMMlXHN?= ehrFvj7Eh4RX6OT2+it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VH79B3c5URGMNC5kq1eC8PgAbhYbFgXhM0NehfXrfgupPtfdqTB3qzu2ygz9ZoAMmAF7rxnX17EuxDSs4DR7WNzf6uuneQHZd0yiQ9m1PUy6pxTpp9NwRcpZsLnW1jLnoHOYxS1D2duklg+BjeU=; 7:l23jBVRhPmE4LrFc0zGDiXMMp1AYGGGByGEvUcGMnWOK/PaKLN5y1y6MxWy3g8FpwVtJ8pQPSSHEiqzPERNyqokQRScyEFduN1GVPMYWJDLA0IWA8ZH0PLFow07DtblEPigF+BKxNrKihEVeI0P7OHn5e5+ZRJvfmasNg94UW6j+VduYRMlpB94WCqLFAE2+/K56Kak7BV3OTEGpu8o8tpY76iWCWOE5VtqIvo9f6NpTEqpOlv3364WS80C0bplm SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 01:08:31.0990 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62546449-d2fb-45ad-123d-08d600b949e7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2621 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::729 Subject: [Qemu-devel] [PATCH v8 5/8] qcow2: Increase the default upper limit on the L2 cache 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 The upper limit on the L2 cache size is increased from 1 MB to 32 MB. This is done in order to allow default full coverage with the L2 cache for images of up to 256 GB in size (was 8 GB). Note, that only the needed amount to cover the full image is allocated. The value which is changed here is just the upper limit on the L2 cache size, beyond which it will not grow, even if the size of the image will require it to. Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- block/qcow2.h | 2 +- docs/qcow2-cache.txt | 4 ++-- qemu-options.hx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/block/qcow2.h b/block/qcow2.h index d917b5f577..e699a55d02 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -74,7 +74,7 @@ /* Must be at least 4 to cover all cases of refcount table growth */ #define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */ -#define DEFAULT_L2_CACHE_MAX_SIZE (1 * MiB) +#define DEFAULT_L2_CACHE_MAX_SIZE (32 * MiB) #define DEFAULT_CLUSTER_SIZE (64 * KiB) diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index e89e74b372..0fc438f397 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -124,8 +124,8 @@ 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 maximum L2 cache size is 1 MB by default (enough for full coverage - of 8 GB images, with the default cluster size). This value can be + - The maximum L2 cache size is 32 MB by default (enough for full coverage + of 256 GB images, with the default cluster size). This value can be modified using the "l2-cache-size" option. QEMU will not use more memory than needed to hold all of the image's L2 tables, regardless of this max. value. The minimal L2 cache size is 2 clusters (or 2 cache entries, see diff --git a/qemu-options.hx b/qemu-options.hx index 22e8e2d113..4c44cdbc23 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -756,7 +756,7 @@ 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 specified - 1M; otherwise, as large as possible +(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) From patchwork Mon Aug 13 01:07:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10563817 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 C1704157B for ; Mon, 13 Aug 2018 01:13:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A80EE287AA for ; Mon, 13 Aug 2018 01:13:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97FB2283B0; Mon, 13 Aug 2018 01:13:10 +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 240BD283B0 for ; Mon, 13 Aug 2018 01:13:09 +0000 (UTC) Received: from localhost ([::1]:36984 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Px-0003F0-8k for patchwork-qemu-devel@patchwork.kernel.org; Sun, 12 Aug 2018 21:13:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Lj-0007fP-1M for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp1Lh-0001jY-DN for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:46 -0400 Received: from mail-co1nam05on0729.outbound.protection.outlook.com ([2a01:111:f400:fe50::729]:24113 helo=NAM05-CO1-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 1fp1Lh-0001hW-5Y; Sun, 12 Aug 2018 21:08:45 -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=dhtR0RBQPd4zfJ8yWsrMrcfxzefBXd2n4Xt43vovVCpn72aZ6Gobr2u3qOQxZkZyhQXmbzsJ8zbRexXwEneKAYlcuTCd+R6sgj1L1KvkzpxdoFhwG97o30bKb9T7w0I27/lwqJhmBFHA9DODhB/mLLh6UkIDpGtdWgwOxcV7Mvo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.19; Mon, 13 Aug 2018 01:08:33 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 04:07:27 +0300 Message-Id: <20180813010729.4844-7-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813010729.4844-1-lbloch@janustech.com> References: <20180813010729.4844-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM3PR07CA0120.eurprd07.prod.outlook.com (2603:10a6:207:7::30) To SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce9ee0d2-78a1-4eca-7921-08d600b94b32 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 3:azivvtpS2aNPUUWL35xr8vSDy8eb+Bbwl6td9AkTPQq+s+ulW6lX6ghFnOx2/Cfp9QGuyFUlDRcPdlYeuWgKS+oVQO1hrQu/pDo8RRMcMNhNkOtI3e2gbEUKBHKDB1oQtqVKH91cLP8G/DhSb+JLHieiDeJwo7YzWWtIwqWZmVBd2Otn4RAQzZoEAo6oTv15bPOnLuVj7grY463Ye9gJfxIbJrhazx4rnN+3+oJrb4nF9xLjNgLVisMo6h6pjjDM; 25:pZfYSaZjnJC2lyYRnQND/DrEOggzARQ4TgT2+ySB7wfoLwl76IRqIEP0w68OXQC0H3a9oWXn1eeA6hUCeeeFn0VRy4z44P537G2m3m2hh3XKVr5KvmXdYN6+/PvMO7b93IT+GmGvqUEwXWl7MxTfAuP5xJQzsX+oxof7YDXemKEDrek65tzcdr5T3hQUzntOxi9z/U+ZZZ5yOLzemFZ5P7dRG+zjP4ZtrxZcf/dayHDwk4XndrLzp3uY0WLBRqzNukd1BxDjX1Kfro7C0nc/mV9g6/KTB8mk0CvsZ3Tx+0VNlb/dmQupwtBZVPmkbMMqTpxu6UHSN1PT6JENjpiJUg==; 31:Urq1ElfQx0cplswOIbWcwMF70RscblaSg9GOurTW4IDjVfOqXcWqNB28Kqb7E/8l5wcr4gUsFDMpzetFBsi951BuVSZ3I0ZdDl0P+iowO5ULTqbdwEge7LZ1stcsSrIOZTPLIzjmfcI6+4IwILLM3Yq1cHt6765COPbD2Lpd9RZ3m4dzzWiD5OCZ7ajPiSgOe5gJXYbMPds0DeVK++e8BpGEmweYvKVC6O21rXALkiU= X-MS-TrafficTypeDiagnostic: SN2PR07MB2621: 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)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(2016111802025)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2621; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 4:7q3203LNopI4HcaR6l5EJHrpVFCtJdkLPDtyjDX2NRc8fN9Rcbvx+DvpUtiRB5LFHGZdYYK+DX0UWxbZuwNZqnk07zWh+nuPY5eHN9VclWhYEC5qEMfnE/xld1ukOWvnz9QQRAnlFMCxhlAEdDs2hVAbg291pefMvMmaAlB3beRgmgFIk1J4uybOoNjBlwBVJStN6tYCuSnRNCQ3/olffHZ/aU7RPgFj08i4JETfjJl2qMmxaqlRHKy8M0EpT3QWjySJFx/ogyR4EdWuyEpRqw== X-Forefront-PRVS: 07630F72AD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(346002)(376002)(396003)(366004)(189003)(199004)(478600001)(105586002)(11346002)(446003)(50466002)(48376002)(8936002)(106356001)(7736002)(81166006)(305945005)(2616005)(8676002)(476003)(3846002)(68736007)(956004)(2361001)(2906002)(6116002)(1076002)(50226002)(81156014)(2351001)(36756003)(4326008)(6486002)(97736004)(25786009)(107886003)(47776003)(54906003)(6512007)(66066001)(486006)(6506007)(386003)(316002)(14444005)(52116002)(16586007)(6666003)(26005)(53936002)(16526019)(76176011)(186003)(5660300001)(51416003)(86362001)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2621; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2621; 23:1JazfvVQ5FsfSrYkkmsy3sOSx5Ss3yy2ck6yQgVCa?= e50g/Mw2XTL6UQjrPinTvlhC0O5IupAq6jIzCIXf5XxAIzDzuzhlA8ClA6m4xUi1HDf0d4Fz41HRqn01uh/WajigXyG4jfBI9QB091DFQRvqKeSv0+CC81gpORnsXTFB5unFcPfop9pUrEUwgvb1SSOkcQM6eE0/HSt1cqXmuKXB12AH4Zf87G7DOxZaedjIBTTxuvYABQuxQzfqwOjro9rzIfvJ4psrSBOFetIf14VGkWSuRNazzrApVv2VCt7GYj+VEf4gJPpwsVrIGB6XWn73/gfL3PWxQggNuGSs8LopLW3Fltg6F32PtT5VXSGR+L5RSx5j3CKNHyCvMkeqUpw0HIdeVZzMCeimYn90qFhc/xdX68yA/jfRTKPbOERZho6zeLJXy/vC3jmUgxFY3S2/mDuLtJ4NgtJN5jGf2d88rr+YiJ0xg8wcyQOY2s/E0YsZ80tinCHtDWLtdyWjtZtCgdSCv3tNZj4pvZIZngoCZ2HfJPobWs8u8QVGQnKKSz/CeE6O1SIn63DdfBK1dLUrejWHgChxtz0KPuV7x0aLqS+EPNdGdKPGBvyo8AUM5LJ8wMj/01BlGXVX72CJjI1Amjow7jcUPOO5yuFo1E94pHTHu9HF+5o3ZkUCuhBTEUDxpOjETSM0mk87vIRzeov66q5V8Ld7Dsy+NtBH5Zk6GSB2aSoA2SZ1ymvZyDUCQw30LlVUhIWKsK9JwXtT+hGcyBeZvTbrqzTmOqY4yhf9RwY5BWyvfoYetX6fSHtd1rEX4/CvgHVkSKA19yBJ9bSqLk0sMWDdF1NIJtX2PanpX+mhz88vizcp9li+hTO7J2Bt3KG9Nf2+Mwpre7wo+yASSqii3rtg46SNTYQJoXaxa/bdT/GCYjp9vwisxW6+pEqer4GDooIORt5D/WpAB5XKCb6G9V85mcWEHCYv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b2DB4GPaueDKX+fsvQQ1jaaJYG1SLK5qrOyIhHmWPQ7BsT1RLEtQFQFoOnBg7NVK2dGLDn58+iYsR4u3ZrNNE/f91v92BQ9HSR45QiXsDStk38yOXNoYrsZebivmZ9BWkgbn03i+TCEUFkw==; 5:pkPpn8GWdQ8Fg81U4shjg4uaMod3wdkXtT0AvjY9YzGf5FnrmWxDiqh1d9W/rKHFqFUIrkBGIdmCSYYBiJIRIcZeykRCKysrfepHSYfaz7g0/sSiEp+oHKps/8WtSh+FylNI7H7x1uH4nVW3WtvXQJsG/SaCp6nN5Hq/HC7xzKk=; 7:4PfCBkoKB3cfW/BeAzM8zW1vsKGHs795LYd/XOkRPsQtwvcaiANiIGCYhlazFJpTn6tV0MxKB/+VhOpMjpBOqhQ12zuy1h4T3rC+R04Jm+G8FWvMQQftTwpp4OiakJTDu7uh0iyZzlOpOBqvgAvIKmA00VMhA8JwtPr++upNQJuAgdQq7WUZjeBSkpHB8/ItReFWrwD07AOPYE44RpiXStOr1D6av5dada/RRXHgXVedNBrDprT6M/gkKRSOUyJd SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 01:08:33.2708 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce9ee0d2-78a1-4eca-7921-08d600b94b32 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2621 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::729 Subject: [Qemu-devel] [PATCH v8 6/8] 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 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); From patchwork Mon Aug 13 01:07:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10563821 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 9F161157B for ; Mon, 13 Aug 2018 01:15:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 887F82897A for ; Mon, 13 Aug 2018 01:15:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67F74290EE; Mon, 13 Aug 2018 01:15: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 D7ECA287AA for ; Mon, 13 Aug 2018 01:15:00 +0000 (UTC) Received: from localhost ([::1]:36991 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Rj-0004bA-Qg for patchwork-qemu-devel@patchwork.kernel.org; Sun, 12 Aug 2018 21:14:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Lj-0007fW-H7 for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp1Lh-0001jn-Tw for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:47 -0400 Received: from mail-co1nam05on0729.outbound.protection.outlook.com ([2a01:111:f400:fe50::729]:24113 helo=NAM05-CO1-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 1fp1Lh-0001hW-LB; Sun, 12 Aug 2018 21:08:45 -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=L1s9YUWAOprndIMpl+4JMdbnYtR9IQpHsDK8D10tCpI=; b=hdHldI1C02Gys1Kn2R4KZso44avoLTCFewbC/WnrXTy2k4F84SX6RWVijXU3ZPkcN/thIzWbM20kqwnwzI+ZGlzFVJ4LqCtSw2nrX/igVj1zW1TLRqyHsAcYIysqoF8zuIRLEpSIPBQ7ODdmx2SyMtstCfiN4I/j/1kgH8t5PWM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.19; Mon, 13 Aug 2018 01:08:35 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 04:07:28 +0300 Message-Id: <20180813010729.4844-8-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813010729.4844-1-lbloch@janustech.com> References: <20180813010729.4844-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM3PR07CA0120.eurprd07.prod.outlook.com (2603:10a6:207:7::30) To SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff8cafda-5ca3-4c07-cbdd-08d600b94c89 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 3:wIuqQVkoJ6bmFJfpbO5I620xCO/2zGnneA3j79iccS47u0lMadgw9K7KSmB5qkp48jT66Et+W92su9y5GFAUDafNk70FVrSsYt7qmgbt5k3kH4K9n8PoUxMCGXb3+zLJFNJG+2vt+KR1fsGUi+RJHo+Us3Dpia+0lyIwJVnWEjkoozTkSZM+4fPMXil3yW57IWebUg9AZWhhZ2COv2p9ozoXoa/kBHBdmzLl+8w88xeSTA765kFRWhrPuv/23tj8; 25:JoHrD9s2A4I1l4LTwT3T7znYMKAxQFO3gx4Dh2YnC/oUv5ZDeS3+iuvhhKwCo7O1nobDeBo3sznmFE9dYMNEbeIfvgyYWxL7c3Ku27GC6Hc0Qth0vnK22nRdJW/Ia4Io8EhWv1xxP5MxJ6RH77ZZmYCnsuRs70yAgH9kaUx9JIgA1/b88CJA96FLodYG51qnLpVEI9L4ONog6bZfRhdd9hPuXrp82ZpHhOndB3EBpcYy3gmw0a5EmgUegfqL2uCsIHuIyclwY2zoyvDJWo7mP1AglQRPfA9H3AWWytZ5gc4RnsXljbRic0Uo4S8kxJTa9Dx2zxupV6FW0Y0++4Xb6g==; 31:Cn0eP6cSPeOHT4FqHrpTHyrfMbmunrK1PL5P/hQ9iGKLz/+Ke7nTgmW7PlvUrIAuEcLpKdYgSCL2Wu0AKWEGGwnyxVtZx//nx1G/vVEyKLCocTHBV7UEFc9RA10mZP3Psv2Jzi3ROBzJM+StgYweiUqIcHSspA2wN8ahwtB6nYq7ReQsvDMEYG02l5Za/Gntz8gJR8JdssDUMBYrUySlv4B2TRKk+/b65VO2B4Eyhbo= X-MS-TrafficTypeDiagnostic: SN2PR07MB2621: 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)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(2016111802025)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2621; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 4:JbW4AKHy+9cHUT0OT8t+rUnaHkhJxxQ1i+0hPpwzVG9COIdwAMSF9YKH/zGL9YmVNfhul3FpcKFUp+nKNHw3rk0PL/UqHzOJKTnyVsggDywpx7Sq0jS68Izel/acKkCkmT/Cv+Dg84RiYf6zKD4f6KAElI1a9WZXSqjpCIcQsZD6p8PK+VXgh1p81wz+eA7rnA5rbnOL4JnCSJg0Mn1WZtYadBS1gj/TwFGnbFv29dENjHrWuThUDW2CuoKwlaRebtjvIawe8eVlZA6eP7sCvw== X-Forefront-PRVS: 07630F72AD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(346002)(376002)(396003)(366004)(189003)(199004)(478600001)(105586002)(11346002)(446003)(50466002)(48376002)(8936002)(106356001)(7736002)(81166006)(305945005)(2616005)(8676002)(476003)(3846002)(68736007)(956004)(2361001)(2906002)(6116002)(1076002)(50226002)(81156014)(2351001)(36756003)(575784001)(4326008)(6486002)(97736004)(25786009)(107886003)(47776003)(54906003)(6512007)(66066001)(486006)(6506007)(386003)(316002)(14444005)(52116002)(16586007)(6666003)(26005)(53936002)(16526019)(76176011)(186003)(5660300001)(51416003)(86362001)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2621; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2621; 23:DdjdB9vzMcbOVz5KT1sI/teb0z6efmenmpyj2rcTu?= 6b4WHmOuqTjT7h7usKN4j3bUZTCZtl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MoA==; 5:ZQqWMyUvpRE79i+6VslXgZg7Tg900AlqNIT1J6d7INT/tpWKoajGPM3vJWblv7w5o9aOTS7Cg4pFWa1EfcZ5Uzr8KBiPSS1QhJL5yxRalPbq16ISjMnwtVKDun4vNOuEwRJVCYpw0K0rIhpTRpemsC0YXDLTWCSR1m7dLGgrtn8=; 7:l23JLmJ59pW2RWJNwboR1G7MVJXF/kYVz6CrtUJrYO07HNTQnPcOd3dlK73PUXQdGr51xturTgsqJbIe7rU+NgN+Wqbm1DC6Y92T6kLXgKzfmgtixvkaUBveA12ZpdBDcB6LLp7yTUi5i3DM848IPmzp5bv5uL0zz2Rk6oeI8tWKb0NnuHGnxeuQ8tSsBSDrvD1BTjSEPt65XvuqVwMRKR4ZcGJtXG6dcDdNUBpuKhj9CzG5oNoed39FisGaoE8b SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 01:08:35.5365 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff8cafda-5ca3-4c07-cbdd-08d600b94c89 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2621 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::729 Subject: [Qemu-devel] [PATCH v8 7/8] 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 1445cd5360..f885afa0ed 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -944,7 +944,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 e699a55d02..5e94f7ffc4 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -78,6 +78,7 @@ #define DEFAULT_CLUSTER_SIZE (64 * KiB) +#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 0fc438f397..0530d79f5b 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -206,8 +206,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 Mon Aug 13 01:07:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10563815 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 4296C13B4 for ; Mon, 13 Aug 2018 01:10:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E28A290F4 for ; Mon, 13 Aug 2018 01:10:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22C8829113; Mon, 13 Aug 2018 01:10:45 +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 AC15E28FA0 for ; Mon, 13 Aug 2018 01:10:43 +0000 (UTC) Received: from localhost ([::1]:36972 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Nb-0001Y4-0Q for patchwork-qemu-devel@patchwork.kernel.org; Sun, 12 Aug 2018 21:10:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Lj-0007fV-Gs for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp1Li-0001k0-DM for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:47 -0400 Received: from mail-co1nam05on0729.outbound.protection.outlook.com ([2a01:111:f400:fe50::729]:24113 helo=NAM05-CO1-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 1fp1Li-0001hW-4Y; Sun, 12 Aug 2018 21:08:46 -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=+KNjyg4kkc/w6krUNmgeM64EvRCavZPcNlKd2Xxy4SA=; b=VceoX5so/sw/YgZWwY31wgM3cn8wkA6LHAm4xTb1glLZz5Ro/26Jc2Ng3y79LuNn5PAHGDFgTTh233SDy87NhhZ5UQDF5XPwso28nSJLD9HWq8xptkCmnARQ2DdIhqH7nRVOPIYlDqds9Qmxm+cGeJMf9i3vngGEr7yLsro66aY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.19; Mon, 13 Aug 2018 01:08:37 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 04:07:29 +0300 Message-Id: <20180813010729.4844-9-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813010729.4844-1-lbloch@janustech.com> References: <20180813010729.4844-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM3PR07CA0120.eurprd07.prod.outlook.com (2603:10a6:207:7::30) To SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc2f4e58-c5d1-44ac-32d6-08d600b94dd5 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 3:KfMVBLGw6+Cao7R5o1JCwDux58NBrRgMJuDBLsgyof1NvJwPIJznHRr94ehJNRVZpoucNcKBELJOD9W1PHF1BLMEpPzrkYiCiMlHinNGPUdlKvS5X6cAGyY2t26Z7jkNi/TB9b8TbEloAE8khLXkjBUALHMBtWmdeSz2cJNyiijO65nom3f9weqtOoGB5V91+RYLvMU0VtmvEWt8lOpUjMW7LnNxELESxDlxCv+MJFmb/E8vzI+0h4VEPw4fAHWQ; 25:iYyym2VDb8+giWTs3Za1AYe8S31R956n4B2eb3wF/glVR89XDRsHHPV3/1InRqBOh3g4J/Gu6GDQz09uQiHcIDOl+uBnXPykAYa1c6hx4GrxxM7b2iuURqpdQPMjXkEd1qFj8+sdMHh5Otlit2FgMFsixafWA160dNR47jHfz2FRCnv7T8TexWyqJqj3p8fTg5SpWf3To31OvJeBsTP62fM0IQFz0+3Nx/YGNbrHEE+dumRaJoKe+CVNMtZ0NP7e/EaIfCqqpZSoM0jkh7jqUC3KW5qUouP78OAY9UpW3+YIID7rqaip8mBPLcMcjOOJx+fkw46S0N07NNxT4kJcig==; 31:s+nLa1ASIaLFOc0U//JacMh7NTMa4VspJWZNpgqNKiJ51mq37F4gqu5prB5SGLy0zq9zll6JzJsnjjreyN6jGylqtQHXx7r14sCn1+twgLBuxosNKJM8GyPQ2v8NnkuxkceslShJbvLbZoC2qgLiJJGP5LbzpSKcoWaQxKMlkIApdiJ48p2tlWxqg+zJWDIU/ct0Tk7iHNqnaly5TyRWX8nx2bVpDXo8xQSCzy5h5uc= X-MS-TrafficTypeDiagnostic: SN2PR07MB2621: 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)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(2016111802025)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2621; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 4:qlTVhFrPRc8VMg3geQfYUgYMJEeis40xTmyMrd5lhyrVB/rhmQ8rKNaYZB6qpWwj0CERAI5rikKe8Wrp/cUdtZQNS2lyCJneoju8UzXF2ILkXPvvkgZba8pK6VcUruxwsxersqa4NZdujQDG1RcA7a8LbpopduLHWQkog15n1+pDjbJmmghUPODypJOb8v30hf8kamILJkLlEh/0C7XHacdYq5xd2wWnd2i58AmjVOhYuSrYnwtwkjVuxkTKCCcV8UyMlWgwStTJe7hidZMh9A== X-Forefront-PRVS: 07630F72AD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(346002)(376002)(396003)(366004)(189003)(199004)(478600001)(105586002)(11346002)(446003)(50466002)(48376002)(8936002)(106356001)(7736002)(81166006)(305945005)(2616005)(8676002)(476003)(3846002)(68736007)(956004)(2361001)(2906002)(6116002)(1076002)(50226002)(81156014)(2351001)(36756003)(575784001)(4326008)(6486002)(97736004)(25786009)(107886003)(47776003)(54906003)(6512007)(66066001)(486006)(6506007)(386003)(316002)(14444005)(52116002)(16586007)(6666003)(26005)(53936002)(16526019)(76176011)(186003)(5660300001)(51416003)(86362001)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2621; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR07MB2621; 23:JJ39qEbOJpRvefUm34jWDMh70awngIz3IczVMJNIl?= N4fC1pbS5ZEsr7gX4rVHAyfrnx7MH2c0ZB0+EaFiZkJYgIQ1OyBnZHWB1y41P+tk8196nXLMmJaH5eoovrGj81mcCgkXFT5kK9cCiTTSJBDigrYT0SfIJXw6dH7HhBsizPmG6kBKCo163X22o/zV84YQtl9koyczyoiKh/zH7B0eRMUb4ajg1bKZaidz1u6TpU4U5gxcF+0VIKVIdkfCowIfPwmxUEuGwpr03PnPNFXVm/dr4yd6Vi/TRVNWv64hIcUheWgfiJAURE1kD6cYUDAn32Q86oXldzNDSPJJF0XC+nhVm9BEWDxZFv61dEn7uWXapeIXHA7zPMBhuxjKNKP2H19EOWa2p/JL49r8mqgTB0KaPs7ncGIQn2EFqZXdDe7+DJY81chPUSZonWkcoK1BJMQQM+03FNOkmc2qTyrVMAkfX+f8vyF/rX+9xTRmAzLC5LsksiSlMDhYVLXrHbtadaIISLMpXCj4xl2UK3I5UkGuGvqMfMZiJXuqMrGuAmRqikQTE8AHI8//P8Pu+cO7CMdB60sydQoNxhbMRfTFWgOCaqJsd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7sTnZ3s9UhX4kD6Nmd5ipieOwQxIWNoU= X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 6:Cl8y9Hcpf/GMMzQwhdhZXO3WlpOyaH4IZvYnDbDP13sLI5pArZiew35bMGxQm1GUL9Tgr1I1Xq/6zNU1wQ2Z1gPwQmwgBAtVqBaomtbCNK2lcjG4mvWs2Eu9sdhTd8xs13eBri7KdSUQxKegGOQsXykQ3MvocCAl3P5ev/JPglzxYZe3wfHG28MZcc2PlsrqMMoMdx2iICYvgIcdwL1DE7PQ2OvN1b4zlgd4enD4vg9nUKR+XZQJ6R35OvXs252SsgwoYAIqhgXn2x5B/t2GfWf/jiWTzyjqlFSLl7yD2M2t8WUf/CYyofrHKSQUw+OL+pYI5caAGffr4sTgRLIAM06NbfRmidOUUgtC0+JBeAfCWOOaNsGy5onYZbooWz8U7iLc5STWYY3emuLUZAdsZRLIY2qKdh0xnD0q4DHgXCYS7qCMom+BC00Ny1LAtiZ4PWV9D4/0EdkmgupM+Ye4Bw==; 5:cAWVLVrvB4Giaf1zqG1yCXtTzae/4MvUDAOWscsFTxK7lnnA5SPk4JaD4QJMQaterBEhfHt4YrcahX6xZ6W9NuIop5fA63XTmleyZdmCgsIAN+n1yHwLBjgbK66Lyy/URL5LuFmtrmiinOLGnRI5toWmW6Ga4F5dbTt3X152pis=; 7:7S5c9GAhas5DHwdONAcdKJarH2SVmo37WcLjKQOQTTbF/aFP3FWVldNfD+fYwMd8L25M2pGjdxoqRl4UhJ8Jzb2Tmk31RYKRe2pJzzhKoARS+ZOpq/TGEF3flg/yJcwLS78lSdn3a9+z/negXCaJqiVhOnF3aRMwlGOMadiPkWI/R3G4rdrJDnwn8BEOAH8VPVtGjLXam9CV5B0ki6xPrVInGqUeeyoOU8PRsnQaxkoy66jRb0sMbfuqBmNek8n1 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 01:08:37.6927 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bc2f4e58-c5d1-44ac-32d6-08d600b94dd5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2621 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::729 Subject: [Qemu-devel] [PATCH v8 8/8] 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 f885afa0ed..ffb4a9e4a1 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1324,7 +1324,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; @@ -3450,7 +3450,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) {