From patchwork Fri Aug 10 06:26:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562261 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 AD953174A for ; Fri, 10 Aug 2018 06:28:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D7A02B3C7 for ; Fri, 10 Aug 2018 06:28:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 918022B438; Fri, 10 Aug 2018 06:28:36 +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 E9B492B3C7 for ; Fri, 10 Aug 2018 06:28:35 +0000 (UTC) Received: from localhost ([::1]:54533 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0uZ-0006ie-5L for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Aug 2018 02:28:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0tN-0006iQ-Je for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fo0tL-0001Xa-DE for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:21 -0400 Received: from mail-by2nam01on0121.outbound.protection.outlook.com ([104.47.34.121]:27720 helo=NAM01-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 1fo0tL-0001Up-63; Fri, 10 Aug 2018 02:27:19 -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=NieT6e4sGvEML8t1ZN3fAKC2L+NA8AiFDMne61fe0Y8=; b=hxesBY6M3CTUNz9QsQ+4gqoElLVQhY8Osy80xAGn2eilmU29Sar//OdbitjomCy6RClnbv2zfS3GD6MFcejlDPvUbZVTEe4r8SPPeod7UqLRQsYMuSMykSXIpRn4TcocIdJdOnOfYMKYe5ED4uHPqMzeCBAGwmh6ey4lt5lryk4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 06:27:15 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 09:26:39 +0300 Message-Id: <20180810062647.23211-2-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810062647.23211-1-lbloch@janustech.com> References: <20180810062647.23211-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR05CA0232.eurprd05.prod.outlook.com (2603:10a6:3:fa::32) To SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: af71daf0-8ed2-4673-52bf-08d5fe8a5218 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:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 3:N533G4AdWrS4OXvanLuoLWQiXjhdGavWk9oOwjZTYGJfcZtirG9CK76MyQK6I6rpZ3MuwSWM+VRZy5zLb9UXcwK6s66JuUW+25TMSW0kN9ZIoOWh4D2OGWdxHsv96WlfkFJvCxNkqg2AKDSSsuPIcCu2jqPNvE/utPV0yriR4GUzFmNIjDndVYZZRKJgoliu6LR1FmTT4wpwz7TPDVtcKg0yrwFE8pBK6p2TGKa83/d9knOXfDn8yYfdbja8lyV5; 25:5EYpz7V8OAwS64tKD6/Ex0djz2fXrbupYe4OUHp1lalHsuliK+PbdXnL+pOLwKF27ZsHSf4KoumTIjR1oolPuzZAGfjaujabUQ0poo63bnw+4X70DDnmyiC0E8gpIkh9ZOOMU9UdT7ehp75k86CF0cu3CAjS1kbUtCg4XSkVhscCS83+znPvdCvbzVyUt+iLZRmBGK6FOi04Ixy2x6SvDz6n8gEdC/XVy4axrn3j/iGP3waIKLe95LNO/1WbsSENgH5QjGt+UnOK3pQTHnsafV8cgBQ7QAceQZeD3p1Fah2QmIBulXYXimvLXNslYUzx76fx65Py3VMSbp76ROPMFg==; 31:8DrlvD55VvccfNDC9ginHIPiGXu3kS+1CRMs+9BRTe13M+QiCbrACEheMbpwLB8gNMCikNMaV/F7Q4eUqfNr8hPpum2+MqZYk7GfElJWVdHhk2Tzomw1XIDfrGwS0pi2FLphO4wbToBvlJdpUQi8OoVgmXjBKXxCocY33/zcOTadHsiIeReCdekRJn3kQEIPzliaRZHsg1EsGSHETYQXaYrDz+BO7/SH6TBVGRemV3g= X-MS-TrafficTypeDiagnostic: SN2PR07MB2623: 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)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2623; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 4:SfwJ9pBL9tcMqgNhcpyWAtqOvi/XnDUFnRkh91vChqBwMlD2v5iS6F9/wqhMHoH9zfCMSg6kJR3YbCR4htKm+gqF6p56OImRpGUYNoH23dOXt4cQtz+RMCH6gUOr68EEnCei8F9uwGO4oKk3NWatEEO+AaJll0Nyo0mIIwtGfd4+jq0sQ1X8oYs4fEU8fSsjUJxbjkxaYt0VQwKQpz56QkH/eHYKwqRv1axCHj78iabg/AKGoDlWVEMIeySBVIp69Pt+8xpFWHJZrJNRDhmmzA== X-Forefront-PRVS: 07607ED19A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(366004)(396003)(346002)(136003)(376002)(199004)(189003)(36756003)(2361001)(68736007)(47776003)(107886003)(551984002)(105586002)(4326008)(5660300001)(186003)(106356001)(16586007)(2351001)(6506007)(316002)(26005)(76176011)(16526019)(86362001)(575784001)(6916009)(54906003)(6666003)(386003)(25786009)(478600001)(11346002)(6116002)(8676002)(3846002)(81166006)(50466002)(2906002)(81156014)(2616005)(53936002)(51416003)(446003)(48376002)(6486002)(66066001)(486006)(7736002)(476003)(305945005)(52116002)(50226002)(97736004)(14444005)(1076002)(956004)(8936002)(6512007); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2623; 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; SN2PR07MB2623; 23:f9fx5h0EZhncPp4UiSF+5eWH/gmRnTl8RjNfyv/aQ?= n08/BA74mRlwYKOzkhEz5DNf6ZIj7qtMUtdTf7n2O69Oip44j3wVGx8nel/JMO0pTV0oOEFn6D83zuHXa9VEltMhnviil/+v2QOjLOZJn307/kFnJuQav79zvPizdRo4EMYd1tyiqc5Urq7+JFmzzMafG3oeidnPox1zpvVuEK3gYl1b072p07euJxl+QPIIbS8RpdF7C8RnhwpGSQ5vptpsLYT9KGuswgqqaMop9yS16Wyymt+p8WOlK/mDuVOTdXjsk1oIHH9x6c31pUJQ0dJ18IbaIwICYNyrN+1P+5oGzd9WGfhqT7pk+2UTDixipDZf+CR6RMFBRNTQ31RVIUfewK8wu+sgAL3QQVWMP5UVya5ZT4DwBdsj11QWZTpDusjjIWIzBfUtzCLqgpjZYIoXbAyfltkMj2XZBLUj8gZG3m67feU/iXQTX01b5uMUpgifPExsodCDPwh/wZqMg1owPnahbUD08HQRIn0qHz25JGW8HTxSZXzdPyrrgjHHF8IlwVBcM6zn30tQh1n4Z77Fik7Gyz89uER6IEkGTtBalXklR0GiuZxPY00F4pja3YexWb3KYrwYgJ48nS9+sDjosAKGzhKMjKf/tdb69NZX1t0LKAz3BTiEPiIs1tWwQhP6IrT/cnIpqxmPMCoRQh7nIJKxxNer7WjfTTl+8RmWtVkvxBU4hri+xvbP/+yDyoJbdwTFaoPZuBYHx86VhChDwY1ivaU2ek8fL4JgZ82YJ7N1SY1oD7fKct1a1suHVQrXv5xJDEV/hoU2e8hFtQ1QEnzqRkgIdzHBObTTs4xvw1Y9tya+2lYQNE0lLHLRu+BxtKVUtbsFqDFNFOMWU4sK8QYi6Sw4pbaqKsvatRum3G7oe1lAzDQPfNuJVMArsmI42MSLYfW5YamQAjHDeChZZDF8sH2bH0g9GJvOL/mdiTnH0m4sysmpt8w8X6PQIU5sWezCZbua3n+iqYqDnYxSP+1qEE4zGjWahhAmqaHsXOqQfDQk1wQlBr2HePK94o5XkYAt0AXXxvjtSa+EVzW+4HxAVamy02C/vWqwAi8CjWBhN74ElNBY3RLvLaT9DUW07AdDCYc+ouoVTw2YuWdhxj9w/yCMxWzpOdbqacqQBwu6s1/mnS+O/9JicAHlaWT1PYDEKwFnw+KAEqRUFYQwpvqvkbVricUudCSwN2OmSsn0ica6fD6il1pOyei2379INzYVIYOn//f3I+6CYczDd2qhTb28KYgMsFLA8eSx5+33LXqqbqcUTK3jXwCucPuACtkku+mgTkIINGWmDxf X-Microsoft-Antispam-Message-Info: eYERMH6bSNmfZQi/+M2RDsqNZMeP6Lbp4ykWWMis2XY8MaM7zQfijyr960atcLS2KicfH1WikoA3HsIdYWC30zxxphUIuzzaGNGIwHV8QUfnEobHmBArrumxOWfkqxzBoyMMDefSHPV83KFJJVi10tDhA+Wj2pqJBxUBUtskhj7NfNEo0RyFFMByKq4s0GEZp8/jzMiP7jU7MRBMrtua164Z6yXCFt1o5ALHgWYHgboq//5XNQVcJuY3m1ZVeGOWmt1sJk4aOtPgGIvVTDJncfKuUcg2/5HsKAvkqpGMhRrEJ1nOYGpohBigd4hDZZYAB4wz54CjlHo6OoebqZNwsf7pKHv3Z0SNJMyRsm6GSKc= X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 6:wbsalzCYs0fhJuJzmRmbjhy8DwHi6Iw1sySKHwhbJYGwzAuG56gLuz9R7tDZT+7kaJjfovZQyGAUncmC09JLwAS8ZeTJGObJtuyBeK4fRqacKgj1j8LGEaNsWelyIiYB0lz9n46mBBG3gUmNcALo5712GBAhx6/J6DBN5SLWTD8vK5AhxXTlZI6Q80imHbd9BbweqJWtNK0aE2fOuXOoObBvcNXH1ptQk09GzaRSk9+z3cZw9HZf9RGSq+MrTliYKLaa0ksp46LpP0EQDSn/wRQJgxfsFmIEeJE1cmNfGVzLXj1WGl5vZouRiK6ospN2P8Ix/Myn5oU8U45t1RgnkA3MgKU1AVa4O/H+Ge+YjtWNseP2uKVyJwvTdxxcxE1kpTp9P69bUwaXMioDCVTF1cX7Wf00KiTKuJ/ER2rZTEhGXjowsLu/+ueFyDjolYjfRfo4W2hCMkZbsNNNaVriAQ==; 5:qZ6GgNniN/sYO+JYVHiE/KtvFc1fTP9wt/LyEDoH9MrsmtW8WBVOyHaXWvoSrTstF34Z46n/zeUBKoDbLqCn6JM1Q4y/nMWLaCokNHhyX+sEYCQSxx3Fe5gDa+YcjErEL4YKvSsQxGh8H+I6u328oClmV48rvaR6nu2WJD1hlR4=; 7:BY9I8yVsexz7kS8aB61itXNgS2U0zS0ru1r2xBxW5UWDzjFTX7XZm247k4wJdKF4Rjtk23Mgxh8xgF6tGKblitknRN5ZcakYkI0QvMVL2Zb/TAzD+9cmRyLlcmtaYe0MJpuA2JJKx6eDTmOsIWzoa7NPMHIUNvEl2E25+nPCS3dx2Xkp8AfqeZ14EAeyWEMpr80hb98KDqOShl2Eh+CAPpnzUBqIpoV5CzJpSS1jXHMPaKmkeRV4QCKNdygRwli3 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 06:27:15.6248 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af71daf0-8ed2-4673-52bf-08d5fe8a5218 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2623 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.121 Subject: [Qemu-devel] [PATCH v7 1/9] 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 | 16 +++++++++++----- qemu-options.hx | 9 ++++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 8a09a5cc5f..0f157d859a 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 @@ -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 Fri Aug 10 06:26:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562265 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 A7365174A for ; Fri, 10 Aug 2018 06:28:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 962C42B3CC for ; Fri, 10 Aug 2018 06:28:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A3C12B41F; Fri, 10 Aug 2018 06:28:42 +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 1B8B62B3CC for ; Fri, 10 Aug 2018 06:28:42 +0000 (UTC) Received: from localhost ([::1]:54542 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0ue-0007mh-ST for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Aug 2018 02:28:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0tR-0006jh-Rd for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fo0tP-0001bM-8S for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:25 -0400 Received: from mail-by2nam01on0100.outbound.protection.outlook.com ([104.47.34.100]:26496 helo=NAM01-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 1fo0tO-0001a8-UI; Fri, 10 Aug 2018 02:27: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=RLbPvh6ml+sdi7+vkh/qiPcJVZJhttLkt69wrdChoLo=; b=mW+dI8L7OepOF3XzRYY35IuGAL9ceFuQhIucX/9j+Klf7/EbIhCwsce0QW476n/WSSEhIsVYIOxhwViZf2JbhKwNyWwnqW/wZIE5jN/iJlgCXwXQXbTcEWuKidzsGb/5T0oq5WT4LZXvHL895pfxet8IEzrt+zoZBm6qYlLRFMQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 06:27:18 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 09:26:40 +0300 Message-Id: <20180810062647.23211-3-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810062647.23211-1-lbloch@janustech.com> References: <20180810062647.23211-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR05CA0232.eurprd05.prod.outlook.com (2603:10a6:3:fa::32) To SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e5ccf71-4b43-4609-038d-08d5fe8a53cf 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:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 3:DhJXAipoQt1fdp4g8orI0sZtDalcuqHiO+aAMcvn83csjJBvz22odZep3UgWMtU2F5F17blu+WCpJf77dckKxgw5MV0qPTu7nv2UrRADrzN+8yf4LwA1bgiLjljLpTLdbIsuWQcxT1igeOuR6FiaNT2Xhr01SRcn/Mmto+wkZVC0vfzL/iXiXGDE6JjAOCXWC+w4Gx+MuFZmf2ZiaoRFGglO6B0ZOpAqlE0fcGV7fMLteDWfarPGtW8/OwrnLsI3; 25:4jyBuTlaB/qSE6BjlmG2oBggTcdAuMSESxayRvgClo6Er1kVsKN89Ue78UIZPJcbouTwJw2ref3N2W0fYQ+vLQJSZCKFbDJ6ZZhGISb+HiN9yWGepcJwbxQmFksy9aV/7ozEgVk7YTo2pnL+aq2M1wvVsGsCbjveoaAA8ZywM30ZJoGyb4v65doY5QytdJsiT32tTKHXjCHJ1NeE1HdtKxI5+0uijGszKkdSyU+wxKJVKUQZ+7fp0IZj7ENFQrr5x5v1hwjjqgIFQCO7FqgjqtxHiiQqvKAtMd9Zia0mUWv47BlsEx4LjjZiCXf32VrgpgAmnLb1GRHIhwi6qKJYCg==; 31:efQlF4cJpLv/m0hIfL7VkgAlJGilrWlhK3LXHEDQOrHdF3wXJ6dUnsrqvv1V0k70EBI9OhE+E5mkvd6/+t8fpMOFiBauccIKdWjdt8HeiA4GiStVQ2OLEx8+rz1mYcG9lRe5YZs7KNxvMKRgXlEOywBBzPRaOp9uZRpKRuw/Ly/nhw2FVd5WmlV+8tm7mlJRP1kJNsrNt9sfDW8q3qqvVLUnkTw951rZcHykhtwxBSM= X-MS-TrafficTypeDiagnostic: SN2PR07MB2623: 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)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2623; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 4:FzcqDPJkpDrJaXI98GRZ+cCGOsvd+F3nguFvembqu3c+2tcKDqG0cjwEC1j3qXqMnRDIcnB/fHYf3MF5E8zvmHN5PBe0tKMqXnOqAInlhiQfMJo3/x14xGKdRxY7zPj8RLUIZCIMmP2j9tSiFPDA0yowqMxNAMPEEL6IEnpYkRs6DGmAibXp5SaEkoVUNghGB/BMgjUr+wHLDKJsEZoxkswC4P8ybrpo69Ngqr5KxkBnq3uVHNVxDWNjuThXx8GJQqLuDX4y7tGJHT9s/dvj9g== X-Forefront-PRVS: 07607ED19A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(366004)(396003)(346002)(136003)(376002)(199004)(189003)(36756003)(2361001)(68736007)(47776003)(107886003)(105586002)(4326008)(5660300001)(186003)(106356001)(16586007)(2351001)(6506007)(316002)(26005)(76176011)(16526019)(86362001)(6916009)(54906003)(6666003)(386003)(25786009)(478600001)(11346002)(6116002)(8676002)(3846002)(81166006)(50466002)(2906002)(81156014)(2616005)(53936002)(51416003)(446003)(48376002)(6486002)(66066001)(486006)(7736002)(476003)(305945005)(52116002)(50226002)(97736004)(1076002)(956004)(8936002)(6512007); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2623; 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; SN2PR07MB2623; 23:hGP+ltMcCE2+1dSBE4Zo2yqjUJGYUL4jyNGU4SqLX?= MagLy/4jxQdeuwDbBJqoq8Ou3qoWoXcWee3BzMfXUpO8TbqoHdxCYn3VCIvb21PwtG1ejBWNk6Y1lZXrFxOQ/yRwKbjI90xL1T2oBzcY+RHDqbhvepnW/qOCeCFBNW96npyR+WwWnVlKUQeHySkyOotLXc5D+RpzM08f6hbaI2+fgOrmt3TQQs0h5zHtMlp1tpZIRGWb5Gqkk80oCCh1onwvnCg8NExnjoPcMGGdHpIGEvotnV+8XmCn3S21n2m6IeqLtLpVZ6fgdedCGt9BauUTO8zBfDcyXd0T7gUgHDaZqW2/0V8Vf+ehZ+1CcHbfjZKlqU1fouCN7jZ3XYar80lXeDjSAKX3iGzb7MJBjwqefYHES/t15A2eEn90m7p6CJGGEEWF5EgWWtFPEnj91XKyAglT6KOqk+1V4PmXWOgNb/Ofu7cfChZYSmkEheEzrxr8jg807tXlN65fFT8Ib0GIbsm+o/muATPAOqONNdjDNlB16h1KUlvOhE0A1wl9cNnCpyMVgyyqNyizTkJW1amcaDETAkNFYPsflJJezmDZ7y3AbEg91dJp6MUZ0MGet2PHmTI851JAxSfc0YScwbwMEcFG/aveSVJEMBBWjrLxfCI5fck6DzGOCwIIEBpO5OnYsUhP5Yd+g5c1LF+j2zTLL0M/BaJqdfZs/s7f4OKQIXTBPXoVUUoyzZVRvlg73gSEPsqC6pvj/WUL2ehT8y9InMrH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q18KP5r4hijdF8wAJ+pv3+bMYHl8ICS20JyNlgrBs+4osA32rIvR4XjQOeOVxJEMDHppmscdHt1oIwTIvve+e3vJ+fmEentkx72PXoWeB/IRvUp4/6SOKMWVaRn3DDLbIrj9WpYeTbasaAjXkbRMEnt4dTGGCj50EoUySQ0xdUQRghxwyPRoYqB358kzKyZHB8Z3faHQd+iKAfxMI7UGmRSzI/z5vN6+SesAzhfvbvhU0afC8Av1jSDAe8TSuj/uulFrOUMnvlEDA/3PDpIOCaFm+C7+AChX6REk85ptRoXEPERZsW6pD3m+qAJc/ZQ==; 5:9W1SvdDzmgV00it9pNbDDdGpeWS7u4nFlE116ih5VqnGhIEjBWxfDMua8QYzUAbEMsLc0oXNQ1gAh71JQ6XkZfYujvEMYK0gMCZ6+g++/CMSEoMkGeVcXdxopX8v89TmX1QV8CJJ7LwzRbs7wzRapz+TuEFNRst1bGQzUItJPu4=; 7:RargmAuBHN8y6q8+uina8E+xABWephV47yTAE3Y0PtGvWDC3zlKhihksAGuWNlV+0PI2UYv8Ah+JNVwsSWD7MEPCCByzkx9+c+FK0ctAM6LJhWOAFU0uxJcURGDxxocI576F061v83sHlOjK0RlnyWbabqzs/AJk2k6AOMCOwkxg2eXpCUXERkCKosmtcHpnj5W121JAYjFbKlEsurcbT1TVeUaQ2sHL49xqdAACRrwKenupkI97WPa2VMonk93c SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 06:27:18.4842 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e5ccf71-4b43-4609-038d-08d5fe8a53cf X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2623 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.100 Subject: [Qemu-devel] [PATCH v7 2/9] qcow2: Cosmetic changes 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 Some refactoring for better readability is done here. Signed-off-by: Leonid Bloch --- block/qcow2.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index ec9e6238a0..3f4abc394e 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -790,8 +790,9 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, *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); if (combined_cache_size_set) { if (l2_cache_size_set && refcount_cache_size_set) { @@ -823,8 +824,8 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, *l2_cache_size = max_l2_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; } } From patchwork Fri Aug 10 06:26:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562267 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 A89E514C0 for ; Fri, 10 Aug 2018 06:31:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97C842B41F for ; Fri, 10 Aug 2018 06:31:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8B18D2B438; Fri, 10 Aug 2018 06:31:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 08D202B41F for ; Fri, 10 Aug 2018 06:31:14 +0000 (UTC) Received: from localhost ([::1]:54563 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0x7-0001Sg-6j for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Aug 2018 02:31:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0tV-0006mX-0f for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fo0tS-0001db-Cp for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:29 -0400 Received: from mail-by2nam01on0127.outbound.protection.outlook.com ([104.47.34.127]:33504 helo=NAM01-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 1fo0tS-0001cN-12; Fri, 10 Aug 2018 02:27: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=4+9tTJYSjVlDNnJ+HpINYXXuhSo9mGOApIc8y0i1XYc=; b=aFRAVu2Ry48WN/1wXKq062fjEdMovmjUP2WI16yBl5cUL/D5B0A3DWUbpX4zJMtaiXuJA9x6J6qtnAwXkJGiXxdzlQCwUCuhj1kH1kdYY/R+vGTjamGP012N2cbyNyH85JvcbvoTc4frVMuK1hmLBTQjzehuZKjxG1uVdFz/N+4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 06:27:21 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 09:26:41 +0300 Message-Id: <20180810062647.23211-4-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810062647.23211-1-lbloch@janustech.com> References: <20180810062647.23211-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR05CA0232.eurprd05.prod.outlook.com (2603:10a6:3:fa::32) To SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 70b11761-64ef-40ca-524d-08d5fe8a5583 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:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 3:4SGoUOp/3qYBDnHhwf4bVXlGyfyjrf/fMVtYv8mhEumqrTxMVMLzEcnK0fEHvPP+CUsIHXCVXVZpJwsAXOjDZcfhgERZXUeTJ23q2k5oxAnFvEN1nwS7jJbrsQ7wK3KlH8pe6hBpzmqXqqLS7A1tgluXMHMj6nRAbZewWOADw6Kz/HIcZpfTEwp3L2lklYI2u8ioSoK5bEwF92mhLyCJTBd1fzz9Eu6f4wpUBl00zUMsW68nGyvvZlvx2rcJSVUu; 25:FFlEmEMsKCIgIljsJn0xzZxMb0THJUcCfpu4SYLhjMwNUMKmVZusoNljrsLy8gDx8HKVGbuJ+ZCTqfHy5EnpsSvDzJ6wEmhFwXDr/quYTZO5Qj8O4br77iqUYpGsQu8nI9jnF4QR0BTcw7g+TS5xsIP4hVaqZ1Dv7QSTWDc87NytIpHPTmn+YS6oIOxxmJnuR1TX92JQXCbEc2t2+mdcGqQXBxJgH6y7rcsYWGdWZk76jSHNNUy3jybj5yIViWq0lGtyXqtTLWSbWYQiIVmDIc02H5N4LGrcoDBHe4YRknc0neZUyoQNucF5rrRq/XYOeL/9Hki/KXgfpP2f9cgF1A==; 31:6tJtv7RvODiA52tDzJO9Y4/cKtidm9iqMhzuB+k3O79oQkUOAsK2ETzlaHnhMAOYVZGhwYJDMVrp/LAqryZa1SPr8Olb+i1jDyUQ6CSwvIn3w+imQGet4JLkIE+bx0/cqMMW7e081EXftqcsJLCyx6AZRA8f6d6+nxo7rVJHLLh3cgr57iXT0Au1pyzqaHwHWLxDwcYITlvYUaZE7xl1PLii+rnK0VCQdlWX51MjDrs= X-MS-TrafficTypeDiagnostic: SN2PR07MB2623: 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)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2623; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 4:qieaJ4rgOs2oMIDP5UNjohRCVH4GCaAC/MTq2E99vaXJkzrIQUH17GDv9jG9KRw4/xJEQ7266t92X3EPxkRgHt9RpmFkon0uca6agoNkjHhgJIuEMXd3JaTC9pSN1AVLxv3e8p1Y+bTROT5iKsUNGiLoSSbORujPo+T36gmZHx7yO05uE3TKHTxF8CHm9k3IQWG3vDwBB5VRGp9WgcsOQex1fHmoDr0Pzm9iWS9UNyx+rNibja7aWvqzecOOyZsw1pJeF1n21zd1rExqoESw+A== X-Forefront-PRVS: 07607ED19A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(366004)(396003)(346002)(136003)(376002)(199004)(189003)(36756003)(2361001)(68736007)(47776003)(107886003)(105586002)(4326008)(5660300001)(186003)(106356001)(16586007)(2351001)(6506007)(316002)(26005)(76176011)(16526019)(86362001)(6916009)(54906003)(6666003)(386003)(25786009)(478600001)(11346002)(6116002)(8676002)(3846002)(81166006)(50466002)(2906002)(81156014)(2616005)(53936002)(51416003)(446003)(48376002)(6486002)(66066001)(486006)(7736002)(476003)(305945005)(52116002)(50226002)(97736004)(1076002)(956004)(8936002)(6512007); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2623; 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; SN2PR07MB2623; 23:p3A/8SqKIcLzZp0vAvM+V1DN1/XSZ38ND4hWEnMu9?= dMmx1bL+1Izl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iyUyURCkYpinJU8XlFCIr4Wa4EEAQ0JvRUI6eM/ufzyeWb/veqkBR1I/4kHhxC+umpkCcBKzAE790L9QBLEuAKlyn0qA5Nrfz8R8uh+GvemDsr2i6FOn19GvDtQuA=; 7:6K/rVccmWLVm84/O6o4UIHj9rfRiKXcIOfCSArffDatyeOORd9uifIkWEGFEqxoXkyKw5eCpInW4WtVi0cvPMc40/hmOEdGzQm9uLU56EAN2Q78nft34I6AUEwEWtZ5ufmuLIWd8NHibT+/c+qUNYVPHoy5SGoxKipyD82aCxHuU8LdX7JCgzMSCOuWrtH+I4nr2tMZFshYg8pFrq4hgOMunuJA30RCObhLwzFYUGskhNcs2Xr6SMpSiDIhQb8FC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 06:27:21.3435 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 70b11761-64ef-40ca-524d-08d5fe8a5583 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2623 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.127 Subject: [Qemu-devel] [PATCH v7 3/9] 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 3f4abc394e..7a2d7a1d48 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -831,7 +831,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 Fri Aug 10 06:26: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: 10562273 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 182AB14C0 for ; Fri, 10 Aug 2018 06:33:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED8E92B53E for ; Fri, 10 Aug 2018 06:33:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E17AA2B54D; Fri, 10 Aug 2018 06:33:29 +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 9ACBA2B53E for ; Fri, 10 Aug 2018 06:33:28 +0000 (UTC) Received: from localhost ([::1]:54573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0zH-000371-Qb for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Aug 2018 02:33:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0tX-0006qM-Cv for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fo0tU-0001f7-NV for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:31 -0400 Received: from mail-by2nam01on0132.outbound.protection.outlook.com ([104.47.34.132]:8112 helo=NAM01-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 1fo0tU-0001eI-D4; Fri, 10 Aug 2018 02:27:28 -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=jJq5fujT0HImhcnteGakFqD+Ca6zFnpOqW8H7nFA5y8=; b=NbrYvzwt6T6+rdB7G6CUT4zWK7rAu+0KxR8FbBBuw1vR7w6eiwPQmQiB/DztG/3oFW7eLS4axLL7rjbv12i4vqOHJkEpHN9DIbABPmk/h6VRfkM/ajClIHjrZMaNgdeCKORQEQBGMWAVn2grJy2OQ67erNtzH9yM4+0Ykk70vkM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 06:27:24 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 09:26:42 +0300 Message-Id: <20180810062647.23211-5-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810062647.23211-1-lbloch@janustech.com> References: <20180810062647.23211-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR05CA0232.eurprd05.prod.outlook.com (2603:10a6:3:fa::32) To SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 26b4184e-95bd-4d08-031b-08d5fe8a573a 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:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 3:xS0X5yNdvoLVkv9YmKFcJgA6wsNsiOH2cNvr8Hh9QZAFTtHA/bcgp2zVbnMwlyqglfbZBpOj0/BPooC2UofLk5kvQ7cdoIfVcanzMJqS9zEbqmfhMMT6guChXp0ZeLZaQOcu/mYY0LXFsmO5GjyQm9PpzlFFfDjyemjmhRxFUjIa0Z+O/ot3lpg10mEAjkgcONk5PuiPlvDH7VvDn5wtJpEl5pFdU58bHywDOSGvy+GebFCmX6qne1PMk1QprM0D; 25:U3iMq79jpxmDUX1LaBww1TM1lv44/4Vi7VHM781g9K4M0eCAaOJH34ex29qFGYFwch+Aq1HHKgaNKr3aVfPD1EzlYfkGHlfqdcPbeXDTlANiJ+cSHVLzaKF2zFz0cs06p0mYua3B94mxlOdQw+TLbicGzt78FRHJYpOWynwUvvk3/+BsbwDqfrBYIKp6nJdYPf6BkpAvQIvxZFfy/aly3yX5746x5t8qS6PLsA1BgjUc2XJmB4OYqoNyAGXcuxViP8CMUhm+34Jfvb0ApeUdJtxdrBX1Mt1OWZ5SdaaWZ4Zn4SoCBVbs1hfc3PuhlSpfw+VXlHMm4w4+wcuIlIJ8Bg==; 31:fLdnpms6RebmomndogyMWT04j3jA8NpgaDmxoARjEGwH96V81QfjTJz10knxN/su4YNa0uDhRoqnurb34kyrvv7fg8hmkba5ou3JMXcNjWnCHv2i7nBcyEf5L281F6R0RgTIGrpfcEP9INqR+NgPb8/88mr/FEGOJ4EQvi7cguFMCVSBrLj+MLxOyRza9z1Bz/V5qMzSqnTJLllh7MQZF8cxpI2fdkcIb3843GFft74= X-MS-TrafficTypeDiagnostic: SN2PR07MB2623: 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)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2623; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 4:CUBa6EDGnmu+XAC2ze+yxPcSbzjI36aUwEfKCelVMmd2uM8R0TGOpFgpyl6nNRoGWqxx/dD8+aF4Oq/KdZyBDvdfEj121A9LLJcdg0azE9x4xPhrrQqm2V4I14BfLsS/6FHMFdubFnDhZGzX2XPxcJo9eXJJNsBPPD/2Fb0q90/xfLNcAgllrPps6b5hF9O6O78i7i6XeczLBoBM2KCZMG5GMAlNf3BsjoPx8QRYsKFjE7M3PnNgUbhqzpX8kS5vpZUyeJPTg7tLwAgWnv0Now== X-Forefront-PRVS: 07607ED19A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39840400004)(366004)(396003)(346002)(136003)(376002)(199004)(189003)(36756003)(2361001)(68736007)(47776003)(107886003)(105586002)(4326008)(5660300001)(186003)(106356001)(16586007)(2351001)(6506007)(316002)(26005)(76176011)(16526019)(86362001)(6916009)(54906003)(6666003)(386003)(25786009)(478600001)(11346002)(6116002)(8676002)(3846002)(81166006)(50466002)(2906002)(81156014)(2616005)(53936002)(51416003)(446003)(48376002)(6486002)(66066001)(486006)(7736002)(476003)(305945005)(52116002)(50226002)(97736004)(14444005)(1076002)(956004)(8936002)(6512007); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2623; 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; SN2PR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0x5XtnpjdOJfqOrXtizmk/tz6otvpHdrludR+rZzrwoA==; 5:gt49xogBS8qAk4JUeoEh+2TqfGFS+BHthH1Bo8QAEoufDqai0u1Uzrcn4iWS0MhH7DEfptnV+HTYdA4EPkF7lzjywGg/1L30kIe0GWY121BpfjBrqphyGw5tpM8Z3AMEiPNfDMxCZRQJulRH480ZQg1fi/P2DzFzFEkZiVnGgRU=; 7:JG27TJu2famX1Gsh5MN375atuW4jA8osS5qMdPFrDrQR8QuPYxyyWl6l5dvkK4cmsRjR8Hx0GNrqmeK8wdp1y9/kdX8OZj/SOF7VAyIldG+PNOFA/SGc2zqN0218ViC35AQVSnvBoK5z/iE1LqcAZ3FLTZ0VqkHs9ggSCxV+K40wz7x1V7qg+HqATZm77rcnMmPrUN9loJzq9S1P/sLa3zs3BLzbK/8vIjyRE4IiJlHRurh0oTV28CpWAWUr5X8o SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 06:27:24.2342 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 26b4184e-95bd-4d08-031b-08d5fe8a573a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2623 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.132 Subject: [Qemu-devel] [PATCH v7 4/9] 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 --- block/qcow2.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 7a2d7a1d48..053242f94e 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -829,16 +829,13 @@ 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); - } - if (!refcount_cache_size_set) { - *refcount_cache_size = min_refcount_cache; - } + } else if (!l2_cache_size_set) { + *l2_cache_size = MAX(DEFAULT_L2_CACHE_SIZE, + (uint64_t)DEFAULT_L2_CACHE_CLUSTERS + * s->cluster_size); } + /* If refcount-cache-size is not specified, it will be set to minimum + * in qcow2_update_options_prepare(). No need to set it here. */ if (*l2_cache_entry_size < (1 << MIN_CLUSTER_BITS) || *l2_cache_entry_size > s->cluster_size || From patchwork Fri Aug 10 06:26: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: 10562275 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 E3F51174A for ; Fri, 10 Aug 2018 06:35:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1F1B2B53E for ; Fri, 10 Aug 2018 06:35:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C469F2B546; Fri, 10 Aug 2018 06:35:08 +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 8BDF92B53E for ; Fri, 10 Aug 2018 06:35:07 +0000 (UTC) Received: from localhost ([::1]:54584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo10s-0004Ov-EP for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Aug 2018 02:35:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0tb-0006u0-57 for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fo0tY-0001hy-Ev for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:35 -0400 Received: from mail-by2nam01on0097.outbound.protection.outlook.com ([104.47.34.97]:27072 helo=NAM01-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 1fo0tY-0001gc-0z; Fri, 10 Aug 2018 02:27:32 -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=dzkM/FPwg7QoFfYAAG3zAZ7E1qVfLlb/rHHi76j0vak=; b=rI67EcJkbcRr0xenVRWn5G7RLz4ohVYTLsRggKQgRH8K7donU8Gh0inIRjQhLkB8W4XndarrvrcR4P+a2TAGHqbkY4+8bWlcvJ7eGMGBh7S4MhpxqMfsWwFfyktGJnCzDaVq77iuYkBQvf9t7eYvXFC2DwtUmdhLSDCZc9sRCDI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 06:27:27 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 09:26:43 +0300 Message-Id: <20180810062647.23211-6-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810062647.23211-1-lbloch@janustech.com> References: <20180810062647.23211-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR05CA0232.eurprd05.prod.outlook.com (2603:10a6:3:fa::32) To SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5c1141f7-6cc2-4906-5193-08d5fe8a58ee 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:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 3:p8fzNxVN2fMYIT8gB90FQjdbPJbuh8ZWFrt/DbCzpzjADlUfQDUGxLA4DERWbGadhrqbBwcsnzsqN5+top/YI8Hh5md8G/JY1XUBof7NndjghDDUGpvrtZEGvY+F0bvqFAViq701CkQ+T/SQS0gQ/3Fnroun6hKBCB0x8oN7w7Orug7P7I6Zk+uZmIZ3xmC1vv00A3Y+aKk0Dy+JGnXQvROVG4mwwYCSqSUNNtCvMfArv+TvqusO4VbPtz5V21VR; 25:15wIWtl+0XQltlAvNxHbwnIpoFw8K3qINZS/rICPFyIwQWJ71DN9O3x0A0eliEIUZf1sebj0XETBuVkNh8B2fb4hEhHHKB5SfLu57qmvkdJxuxvgFsJhidY57qxJ/EIErpBCGgSi6Bz12ZQZx/n4DZqEYOHFAoizrgNCN7nZS0cVTUDNpUh4XywywCZNEgZpV4YW194M2u/j4sJEBtVXLqNAmjlUnLxIdtY3huiTqZInGpdAft5Dlx+skQquICKIRfoOrQNYbkSFEjzKN4U/7nfXUIe08f1pf0mwvLocNSbmW8R/eMxaqhYxy6cjSA1hqIwhlTv1c7uY4949PqhTcQ==; 31:95/wUM2YxosiiUoJZ1nh1suzu7s/pfOyEVyPEaNmgq8x0yhHR929fo+ZGxwI7jb//j8boCm7SEA3Sr1LHIWiXwGMDbZpMjKVOj+MEEQh/XC5KblNTKVAgaJmLTiudsCaJuCtHVDOsF7KqUq90v0EXHC3JjnLwVxVxx/MClCXcQE+hhpn9Sq12MlldeEonCvXOcv43P04fwr2DDyiYP3If3xUIMlrIzEmTnzl9+9gCuU= X-MS-TrafficTypeDiagnostic: SN2PR07MB2623: 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)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2623; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 4:bLYB+lmV2GgwENB4bdIdQi+53eBmlnMOZ/VCiFURWHaEqnTinnruYtOAQ+FVXA24gPjDfVpB+R9gwgn9AWBEFu/VI0q21y2n3cE4SF7BbxA9+u/rTC5jn218gEKKn6CucA0M6ltVvdt2QmSSMBNkedUJ7SYFZG/gJ4nJgLZuZT4TqB14pJlpBvlQLYD12HVI7cev+AGIty0Ff6OueNYgh2ru6Vh6YP30r3dJcCxpOI/XJlteRKvQiYC00UfS8H6fsGeVaZXq+lLgDmPIgk9+bA== X-Forefront-PRVS: 07607ED19A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39840400004)(366004)(396003)(346002)(136003)(376002)(199004)(189003)(36756003)(2361001)(68736007)(47776003)(107886003)(551984002)(105586002)(4326008)(5660300001)(186003)(106356001)(16586007)(2351001)(6506007)(316002)(26005)(76176011)(16526019)(86362001)(6916009)(54906003)(6666003)(386003)(25786009)(478600001)(11346002)(6116002)(8676002)(3846002)(81166006)(50466002)(2906002)(81156014)(2616005)(53936002)(51416003)(446003)(48376002)(6486002)(66066001)(486006)(7736002)(476003)(305945005)(52116002)(50226002)(97736004)(14444005)(1076002)(956004)(8936002)(6512007); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2623; 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; SN2PR07MB2623; 23:OrGsAXPx1lxPLhlx0wwFRk4wtMVSs+RL3lwJG+Uzj?= TLaJLPQEaHnwXXBhLEUXumWgXPc00nYHe1OL5nAOiWHbAh4uW7yFfQHjYLLEv3scKxWft2nD/ZGXbfg0Eb8cM24+DmHcC0N9HUWJolexzggeRXIgjXfJIGSAgTxN827X1lUzxVW5NVNqnM1rbC34GQVEGJzEGChZua0kg7/ssr0gBJ5pYB0wt0C2wb+UZxfjzT+iKGJaXg3+jqAbmU41YbYmQqhYUuN+M+cPsbk9qR7sG3xGegXbOPGO3SIpibWNUv9d8ci8jYFylB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C8Th+mHLbgQPtXeZFRafq4I/GpHcN4Vnf1VlNikctGN7jEoCxNWm1POW/Ac4YKvtcSE01ZDQAPO4qGH7FOsqlASaJBLs49QWSGVpxfzxCwHml7IFKnxC+3ifvuMFs79n2lh7uHZRx/ucSkTRlCzsYMw7d4iGeFgk0IJkgvi2aQfQrmyfz462 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 06:27:27.0936 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5c1141f7-6cc2-4906-5193-08d5fe8a58ee X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2623 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.97 Subject: [Qemu-devel] [PATCH v7 5/9] 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, the L2 cache was allocated without considering the image size, and an option existed to manually determine its size. Thus to achieve a full coverage of an 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 with a script, and pass this value to the 'l2-cache-size' option. Now, the L2 cache is assigned taking the virtual 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 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 | 22 ++++++++++------------ block/qcow2.h | 4 +--- docs/qcow2-cache.txt | 13 ++++++++----- qemu-options.hx | 6 +++--- tests/qemu-iotests/137 | 1 - tests/qemu-iotests/137.out | 1 - 6 files changed, 22 insertions(+), 25 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 053242f94e..434fb89076 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -777,16 +777,19 @@ 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); @@ -794,13 +797,16 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *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; @@ -815,13 +821,9 @@ 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, @@ -829,10 +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); } /* If refcount-cache-size is not specified, it will be set to minimum * in qcow2_update_options_prepare(). No need to set it here. */ 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 0f157d859a..69af306267 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -124,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 1 MB by default + (enough for image sizes of up to 8 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. @@ -183,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 8 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..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 Fri Aug 10 06:26: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: 10562277 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 6296C13B4 for ; Fri, 10 Aug 2018 06:36:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 538CC2B194 for ; Fri, 10 Aug 2018 06:36:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 480412B54D; Fri, 10 Aug 2018 06:36:23 +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 BC2882B194 for ; Fri, 10 Aug 2018 06:36:22 +0000 (UTC) Received: from localhost ([::1]:54590 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo126-0004qs-2A for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Aug 2018 02:36:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0td-0006vY-2f for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fo0ta-0001jn-Fg for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:37 -0400 Received: from mail-by2nam01on0133.outbound.protection.outlook.com ([104.47.34.133]:54107 helo=NAM01-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 1fo0ta-0001ik-4V; Fri, 10 Aug 2018 02:27:34 -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=3c1xabaSzmctvDig+pVeJlQHXMMRpmHPpC3D72iLQJc=; b=iIdPqD3kcEqVKmzRiEmxNdv2SiiQGdl8mCIohy12eKSQT94ilQPGzYW2mKKqFXHD5b0g0r6DPCiu93mvzrHOFznsmm3Guz0Cfl2ECaVN13SGQGv4gE54aeOXWwRd8TBotYvQBAFBeGJj4prt3IFXDKi9QueOEVuS8zTZH79J0T8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 06:27:29 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 09:26:44 +0300 Message-Id: <20180810062647.23211-7-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810062647.23211-1-lbloch@janustech.com> References: <20180810062647.23211-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR05CA0232.eurprd05.prod.outlook.com (2603:10a6:3:fa::32) To SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bac2c20c-f894-4cb3-3df0-08d5fe8a5aa0 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:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 3:Oq8asFlWS39yenLRH6FhMAYQ/HnCNbjobj5UXR1Gv2upCNiwTW5r1/olsmbzB8jTisPpHFt+UJFfYCHMowE+3h+wrINvQ7B5pXbxyfwklr/3BNnf1R3b+5H4Gk8Mwmw9+Jkd1SsoF/mIWAbVPHg4S8rYx0dtZFbYOEhWN822jG+jxY/DJoWE/IphwBIPEYwMl/Iuf4pARKuxLOhmfkxWfQnCkhEpLuEzyRX3yzVZDa1goLUsw8xnCFwL866llBgh; 25:h2iwe1Wakk0V6mXPrFGRQW8arj+P7RN7mZ6ErF1ehcmA6eUBunpGnbm2fz1xno3uiHqG8cwPCE9UDUr6JOvKFSumjbik26bQdEgbF70WmftncdYXXbJmu6BkMi+gqi0I6kMSHHZq6PrW+D2OCbLf3w3BeiW6a7e1hBQazLOpYQJHSwocCRku4YfNx9Zu0V13LsUndlpV+twSENe0b6sHAnhWGTDkyUnGm7gxQyaYwoo4bmRpqd15zF8ZAYDVWBgNG8x97LMunPpKYCif0Y2vtRWijeIxdlCmB4mWVEim/po6SDdqiBvm5TRA/i8aWTewY4k2SeOpsQnDW9Qy2+Kzlw==; 31:E70AFVCRO8Xv4QAck1BetWR7HCVgAb5r1iexUCfQPdmdnRDfmsFOAzgY8zvPlEn2tUkj/gKuHutB58hZwkJHucWWxDNGftsaRuZI4AixygQS0faigPidtGQv+l4kYdxydW5h9YMAvu/QF2x/1OVfdxFtpDdvs6RBYJgmWx/7dmTDcSuElJ9SHm0Qm61ZdBvZ9teaO+a1Le6uUfkU0OHNL6cj6yoe5AAJyRQJ5eNMF74= X-MS-TrafficTypeDiagnostic: SN2PR07MB2623: 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)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2623; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 4:lxT07M0GfgokImUbqbJU7nTKwOeBS1BgICjTqieAbyrWgvQKawjx7pvUJgPSWWpVrXoMtLIR8KIdp+EeEs11twA16mKnrDrhrt+DfqTNqvtzEVuZe+12ZNEpENu3aJQ0P0/nJGy6BRtRjiDtkSLvWnIOnPXuUBb0/hYIqFbSIjUp4hA2WxBOmUk3tlo9z725+EP53ja0twm6e9AKN513w9JHRy1Bdkn0p8PYAButjPEEIJ0tgWpthCpxRioYDXyNUtc8jN89BWywJEMhCWVO5w== X-Forefront-PRVS: 07607ED19A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39840400004)(366004)(396003)(346002)(136003)(376002)(199004)(189003)(36756003)(2361001)(68736007)(47776003)(107886003)(105586002)(4326008)(5660300001)(186003)(106356001)(16586007)(2351001)(6506007)(316002)(26005)(76176011)(16526019)(86362001)(6916009)(54906003)(6666003)(386003)(25786009)(478600001)(11346002)(6116002)(8676002)(3846002)(81166006)(50466002)(2906002)(81156014)(2616005)(53936002)(51416003)(446003)(48376002)(6486002)(66066001)(486006)(7736002)(476003)(305945005)(52116002)(50226002)(97736004)(14444005)(1076002)(956004)(8936002)(6512007); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2623; 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; SN2PR07MB2623; 23:6rQFh5G3LTRAs9o/Obs4IG13Aw0PahIM/FKu/O6gD?= YZYjwxLqcsBoswppiBd4HR9tL8TaBjY8iJXcHJX8//F/cSCpqvtLtA22JPzrRcIAW/P+pMVEZM2mypz4q2z2mQGW9uChCQ5jmUrTvSmg7cpkMFNY5+qZ48WQMHprXZWHK4Z4tut0p8BJGAJCroWD9Z/xmlPYki/bLITnReh2+k7nqNIXzSfpMQcHmuQqTAwdnd80wkBlXuuN0YT053puA+jJXhUAv6VXO8aoFpNUhAv6DCc4oNp3e8hg2CEXPqsqazn0hEZAp8q+30W9eSD8UPEA+ldjo9AugSLkWs7DrWMspgAnvYYNbSALc8dpWc/0qP7mHX7uri+PQmCnBxz2QgC+fXaLzGB8P5NYMkauKUvuMIkkRb1/KODKcz0lbfgS3bEKiN35GZqvSVEJ3g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yBFEjt+cmFZGkjqUBMJTNwNWZTCaL2X3ZS+o+YV8XwSdY3F2DjpdVujjZ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 06:27:29.9373 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bac2c20c-f894-4cb3-3df0-08d5fe8a5aa0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2623 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.133 Subject: [Qemu-devel] [PATCH v7 6/9] 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 | 6 +++--- qemu-options.hx | 2 +- 3 files changed, 5 insertions(+), 5 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 69af306267..6ad1081d1a 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -125,8 +125,8 @@ There are a few things that need to be taken into account: (or the cache entry size: see "Using smaller cache sizes" below). - The default L2 cache size will cover the entire virtual size of an - image, up to a certain maximum. This maximum is 1 MB by default - (enough for image sizes of up to 8 GB with the default cluster size) + 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). @@ -186,7 +186,7 @@ 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 - (the default behavior for images of up to 8 GB in size) then none + (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. 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 Fri Aug 10 06:26: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: 10562271 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 0E415174A for ; Fri, 10 Aug 2018 06:31:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2AF12B41F for ; Fri, 10 Aug 2018 06:31:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6FFB2B438; Fri, 10 Aug 2018 06:31:27 +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 7A5212B41F for ; Fri, 10 Aug 2018 06:31:27 +0000 (UTC) Received: from localhost ([::1]:54565 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0xK-0001ey-NK for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Aug 2018 02:31:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0tf-0006xz-VK for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fo0td-0001m6-BN for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:39 -0400 Received: from mail-by2nam01on0135.outbound.protection.outlook.com ([104.47.34.135]:24126 helo=NAM01-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 1fo0td-0001l3-1Z; Fri, 10 Aug 2018 02:27:37 -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=5KZMmlmN7dOAE01Wi8hStPLGyKFALSicNbHHp0xlCmw=; b=aCvmZc+Sgh9I98lQATxGj4PMVVqTSRLbCz1Cqx2kT7gC6/UmTvS6SaNaC6Mschq8joIalKHxclNfu1YLWCaL5+VHpXmfaSDGUdDdmbzKC7hNh+ZdGC+BbgOGI24ohheQGeCzbrgX3uXpmoDkbVyCJAXvkuAOxGBGr5sz5c3UbX0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 06:27:32 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 09:26:45 +0300 Message-Id: <20180810062647.23211-8-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810062647.23211-1-lbloch@janustech.com> References: <20180810062647.23211-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR05CA0232.eurprd05.prod.outlook.com (2603:10a6:3:fa::32) To SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e55893e4-5e9d-46cb-eec2-08d5fe8a5c56 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:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 3:KEWU+I/vrJEL50icHZj+ubsadiYC4+LciB2BTrTQ8Ups4AX8hgqbiRj/tEZ7rg0rf+9a1M0K9kqGaQBRSC3p1c01DjyXxg/3gh6SZ/ElaLe403eXjDW2T2HUn1z3dBCG6I4EJS0mbqjNIAVBkiW7aZXqRb3HA4qaoDbwxZHqUCrtS/eZkoE2eNfZXCKRIiw9sIYc1nMly6taH7+Lf1mgM4qdJvcoQVohoB1gSzW5nKweaDCV5QQHAdRY9rUyvOyF; 25:L2ftel0RBz9oocZwZJ/bhQXODxVm5SnG1Ha6HQce5M3zFWs0G+wG60rFDBGHCjmx9+l9b2vbptJtae7vOzpd4OPTbnlGbCnriW4ZkUtbEE+nsasNa7CFTdU6fugZy0/SdcmWu6a8Ueaypdvadky9XfxS6PVGPi8PoRR12CexVrmZ6OYPQvvwRHKzx6rUAc/EtDi82Ozu/wwZk5iIUE7ytVlKPyRqKfuHCUqVIoS2A/lfsna30PjEhiA5xpibOtoSm3RVnH91gQusFONqWFLqn5BlPnYa/NiQlwItcF8tRK9LPN3ND/GxJth8fp5AOSsO1S/RIlQPUpj1SYu5Ici8iw==; 31:VFVAj/oYLIBpVwqObdPxJnhqE3XUwQIJwaD/lpqZpVVFcqhsnqqftMqNFNE4BqDjlbRL7OJUhE+A+aqzFuepAqj+y+wPc6fWkpuisbSg5d0qrXKlbdCWJOIcozpoDfZqOTDkJ0b+G30j4VxyltLwaq7n+LL7Vhv7Ir46WaQYhB9uevd0hyiTXeUVfuQxQf7d6UPaz1oGPpPNGvPqyZNsEX6tbSp5uKAkEQwNVkEVF1s= X-MS-TrafficTypeDiagnostic: SN2PR07MB2623: 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)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2623; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 4:JYzjiMlZeQNAlzPMHuUy8qjXVAspcXcqZw3yzs/NkItSABA+AT0kCyZh17Gwh+J2OLv9DwgP92UGjTihPT1nmZ1igMhP1gAEiW3XGsh5pV8kctXFJud4HryuaEVU6c6+FEOniN+e0nJjEygoBS6mo5Njs7DJig6UkUNSjjTB520kLndPdOhfAzxIb6e+cPF2dDkAFH63xgB4GuyhytvxVBmzEDO1E7dOMQNVFo9paqLGIdubpSW62mQOUg0N/y138YRVmcQ0FuipvnLKMtY1uA== X-Forefront-PRVS: 07607ED19A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39840400004)(366004)(396003)(346002)(136003)(376002)(199004)(189003)(36756003)(2361001)(68736007)(47776003)(107886003)(105586002)(4326008)(5660300001)(186003)(106356001)(16586007)(2351001)(6506007)(316002)(26005)(76176011)(16526019)(86362001)(6916009)(54906003)(6666003)(386003)(25786009)(478600001)(11346002)(6116002)(8676002)(3846002)(81166006)(50466002)(2906002)(81156014)(2616005)(53936002)(51416003)(446003)(48376002)(6486002)(66066001)(486006)(7736002)(476003)(305945005)(52116002)(50226002)(97736004)(14444005)(1076002)(956004)(8936002)(6512007); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2623; 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; SN2PR07MB2623; 23:bNCXZF5urIaWKFNLKsbGb8UYPe64e1VrJXJFLvuzK?= ilu1RXynw4dhdXrR8BDH+2D9I2yDDCj28zmvn/y2/IJLlYEKFY9iRtMxCFt/Jba4nYoX+RAVYiffGQEUYBwXLM5JyMfwjYjxQ5kx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/T9L2zZYE/78hRufRbiTuHIrKJ1uIoo0cPLPLL8uaPmReE1odmDsDNVHd23T30VOxSxvxLBA0=; 7:DxTe/1ypKodp9V0xZJ4vBWwrKrkCHLhFFROhDPwp/EPf+2O1bfcDLk28WvA/6ATYQ2BNoKywRpJ37W9aUqrXPcMJXe894k+tzRd79qNJQFlSZVxE64LgF7NwMoPaJ1oYKcAxUmRYZRxzfR2xIifQXZOg7bbm5fRZ3nhyjdC2uJFiAINS9haQ+J61gf4zkpM9dpWFFX9qaW4Vtme4tL4rVH8MSLzmJx/8qHTSPzmaUEXLdSeafeM48AAjDrnKwPk/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 06:27:32.7967 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e55893e4-5e9d-46cb-eec2-08d5fe8a5c56 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2623 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.135 Subject: [Qemu-devel] [PATCH v7 7/9] qcow2: Resize the cache upon image resizing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: 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 434fb89076..ba4dfae735 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 Fri Aug 10 06:26: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: 10562269 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 757E7174A for ; Fri, 10 Aug 2018 06:31:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65D272B41F for ; Fri, 10 Aug 2018 06:31:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5944A2B438; Fri, 10 Aug 2018 06:31:26 +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 D0A962B41F for ; Fri, 10 Aug 2018 06:31:24 +0000 (UTC) Received: from localhost ([::1]:54564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0xI-0001d6-0j for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Aug 2018 02:31:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0tj-00070q-Hb for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fo0tg-0001oP-Tp for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:43 -0400 Received: from mail-by2nam01on0115.outbound.protection.outlook.com ([104.47.34.115]:38988 helo=NAM01-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 1fo0tg-0001nM-Ja; Fri, 10 Aug 2018 02:27:40 -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=QfkMY/X+kMMa3EVzj2Zu+EoylnU1ox5aw025w6NZqto=; b=nlHybpGu+hbbmf6flmcnAVfGd+QypGmV8HBP1TgugPOtyxng+oKZhY3x+ILi3VudlhKOvYen/MHiQrhDUSdMINPlvyc0ppcfGuIRp2Vo7EEW8oFXUuwrsP4g5FC56GiQpM6hS1gmvrauRdItel8xR+mCvPcN4WeZK6kMsxTGNvE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 06:27:35 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 09:26:46 +0300 Message-Id: <20180810062647.23211-9-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810062647.23211-1-lbloch@janustech.com> References: <20180810062647.23211-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR05CA0232.eurprd05.prod.outlook.com (2603:10a6:3:fa::32) To SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e625aa39-9e6d-4fa3-c6b7-08d5fe8a5e14 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:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 3:J1Ki4XdBFNZs3kH+9JsABLDcn2RtQkLnh49sSXCmeqHIMTE/XIfStziqM6fQ4S4jnGTB6xHxGLCmG5nKZdItILzRKNdkMgYfa9M3NeyrtI7RQrqrezf0B/a5PTZF9TNDA4dSGVug0hayY2WgIBxZAOLUadwHGjyhhYzeCfXQqRrcYpf0tLwXRCkkW04uyEWL7I82iqHUBnmqtLDlHGYcdqRvYCI5tj8uNWGOW6GTkoQLzYbhK/cHeplGSz2RHj0X; 25:NvP4YMPc5bUF/I95I/JI5QL7MtHjziBXBlZJ1ERRuhkO0MOHe34qJ7KB1EmOUP/3AyRjgbm6W8rvf/U8hPV7EAKATutlCZjO7gH7Z3LHPrwUw6PeoPZxR51zALtPx3t7IQM9uTqgpsCpuX8n1OfHT+6cE+kNIuC6jmO7Ec2gcW41u8M8BJovAVoq1cyhe7iVnK3De1/DlPoMCWRpoVjhhBeZ8ehvC62H6bQQLV12DCaYeCAHNUjN0TkMH/BUnIpp6JkrWepPRfnAWNyIx0iQqzvrH4yAG2+1Whu71gaQH/EytdtPNyLTMRG2vdjS1d3RN53IrcjOWEGtF3ddHS4ovA==; 31:V3+eM+F7taMwZVcHYUZA35VZ5uSKUErI2zf/s2J9AtXCmGXPXSDEYNzCv5U/7HMYK3kLqrCAyHoHdTOCiIkopSONaq4NCPnHhpS+EYm7BpOa8G7PWUdYDxyr+2xnKq1s4OtdSlTD9+pr9CX+2SEm/BpV6VFzx8Ay0+U704uqJyF1Qb/MlU3bufVx4g0TzvbzTy1GKz+sYo1s9rFI2kK+Tv6oE1yfujpblT9sItiOn8g= X-MS-TrafficTypeDiagnostic: SN2PR07MB2623: 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)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2623; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 4:vivnlZ1K/H4L/VcmRsCKo2brv+l+NJf5cGAlsZiaKFskXYf6RXX3qMn7oJwEjNITeMakEieTl3/4Q61W4SyNBUvOLQL218Y0Fv4ktjfbJ1/MpreW0LKLWidu0YS4EGnB2VjIzx4oPkR7rY5a9itujYTph/2iTkdhmgikCukUsG4wjSu5TD6g+VlrEMOTAntiFsLF2y1ohLVE302ylTwCQ+lAnYiORQw3m9XUHBh89UPwzHbZzkor0bL+ZdWIGv9zCeYrV4aY6aGBtJXWjHXdng== X-Forefront-PRVS: 07607ED19A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39840400004)(366004)(396003)(346002)(136003)(376002)(199004)(189003)(36756003)(2361001)(68736007)(47776003)(107886003)(105586002)(4326008)(5660300001)(186003)(106356001)(16586007)(2351001)(6506007)(316002)(26005)(76176011)(16526019)(86362001)(6916009)(54906003)(6666003)(386003)(25786009)(478600001)(11346002)(6116002)(8676002)(3846002)(81166006)(50466002)(2906002)(81156014)(2616005)(53936002)(51416003)(446003)(48376002)(6486002)(66066001)(486006)(7736002)(476003)(305945005)(52116002)(50226002)(97736004)(14444005)(1076002)(956004)(8936002)(6512007); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2623; 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; SN2PR07MB2623; 23:SquuHP0k4oZBYd9+a+psIBVbwF5MMfH/xzoilp+c5?= LoQlrzwZUcWRWVWOEGEPhuN8X3pVX57Oz6/T6ElaCkNaLfLm8/1dOx6PNnQ5Myz0hSt8qLJsagqOmszP+4jFXZ++YScLIWAbeR/wyC88vMoXeEYrhdyREA/eUE9dvEc5kFAWtWTznVP8x1Zco26+AnAg7srK6DpCMPViLyKB7n/z60nzCEoVGgdrl8JGMIID1iUfjLBfJ7GKweo6ianZHF5O51blZQMkQg+vltyu4csrUzhCl1pKQ5TloXctoHo9bQvqCXleDViSqfoqRWiLsLgK0d90PF7SWsSEjZkIT4i+z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XoO8A33+//bYw5sumENry3iwPUu0nf6kciHTUcZ52DG8vcVkusgkPa0x2LjAOMWPr7+tHC+G0CFcrzAc5SXZPmC5plqEZ4V0q/52NXgNBvgLWxSLTHlSipCLpQmO6EXUKEZ3o2MS6R1xuR SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 06:27:35.7186 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e625aa39-9e6d-4fa3-c6b7-08d5fe8a5e14 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2623 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.115 Subject: [Qemu-devel] [PATCH v7 8/9] 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 ba4dfae735..b4f291765b 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 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 Fri Aug 10 06:26:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562279 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 50CB3174A for ; Fri, 10 Aug 2018 06:37:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CE322B37B for ; Fri, 10 Aug 2018 06:37:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B3902B382; Fri, 10 Aug 2018 06:37:57 +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 A1A762B37B for ; Fri, 10 Aug 2018 06:37:56 +0000 (UTC) Received: from localhost ([::1]:54597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo13b-0006Ni-Vm for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 Aug 2018 02:37:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fo0tl-00073A-UW for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fo0tj-0001qI-99 for qemu-devel@nongnu.org; Fri, 10 Aug 2018 02:27:45 -0400 Received: from mail-by2nam01on0130.outbound.protection.outlook.com ([104.47.34.130]:39856 helo=NAM01-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 1fo0ti-0001pL-VF; Fri, 10 Aug 2018 02:27: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=s2B5HBAfuIKnZt11pQ2ykN1XuCD0HzTixa4L9hTeFPM=; b=CcY5H37DWsVNCX5f1tXC8dbJXP/NNbmiEQ4gpg9S467urdXZUVAd4m+AGgCm/2Vtw9Del5Mh+WD6hUZX6injNwxfa/RvziqSaoRH0EkqMbNM7uJxXuD8RISIsMHdk5VysLBcXOJnEKzV4wGbeDT6v1J75/wEUEXglB8kqV4Egg8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Fri, 10 Aug 2018 06:27:38 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 09:26:47 +0300 Message-Id: <20180810062647.23211-10-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180810062647.23211-1-lbloch@janustech.com> References: <20180810062647.23211-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR05CA0232.eurprd05.prod.outlook.com (2603:10a6:3:fa::32) To SN2PR07MB2623.namprd07.prod.outlook.com (2603:10b6:804:8::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a922cd23-0d45-472b-1557-08d5fe8a5fc9 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:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 3:b5YMNKtT03MOLNzqYfy4HH8Eq1Ul8HdeGvqaLGU0iygheDyfXI2UdqTwmzCLb9lGjVenBmpCSC/FS+laQ/Uisf40oUS63bu3eUleG9P6gSgOl8xAE1rjb+0kPjjrwkrgBCHYpjzaFzeRkabvqkqw2Q9TRSa8siwmK45tld/CuSAx0WKjUQWntjg5q7k8oyL69GNs91HVDWoLc+Bb4ZieGj6ywaxRtNqpQ/iTJdveteBMhxuFG9Wl+7Hl7q6Vb+oV; 25:p2ixhHbVe5uZX+Dc9nqrlsOIHVRd+YrSsugvHz05i8ex1I6oGhJI8p4goWruXk3ai+XwGNrZ2PiC/MOjrj/DkpW69u1ZOVU9o8JAJP+aPM1HC0HQPw1QMnxB5IZZgMv0nFGB9lJq/QfjaiZ2wWpXn/qYSR6zEx0JgNKB0gQ9Uzt0pOPIirVexljgnO+cj5cyukYgJmbnNI8qxeuQ6ChXucoqi0DS6quLMRFPN3hGHd3hFayIwBBdkSqxGMBGMTPGBf/5nQmbhR9Q/S579sVRHwvia1iHIRzm0FWbpBSRWAWg2P6Myrwmg/MlY6SB0p9s6xlMahOBe78gjY6JQgnelg==; 31:0n9qiLkxTiKuNtWQBzZi5CxaqTiQJbJaUsAWHcq9hdlnyFAUvSUAZtLtytzr9p9t4EOweSAFUHiAF7XecXB875jb6BjljSh9M1r+7ZVr+oo4FdYOGK1XbSv6r4kqEkeouNkzoihJKswaAlRnCdebFeeG03lqK9In5G0zIr5WTmmNd8LEBEyc8pxgrIjsM7ocUX2wjNG4s2SnAKtxmF3Hq0Qppp1kKCnEXldIBEvute0= X-MS-TrafficTypeDiagnostic: SN2PR07MB2623: 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)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2623; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2623; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2623; 4:r+0UOF+yP+IysC8hkjpgZL66c1L8cyFsOz1wsTS9Rq4WlsBFtOLC6TPDR+lpXyDs2YNIGhrHPWLIyWAIEnMn9dNDnudBVAgEOoVk/RkzvBtSvszJ9H8srEzeHHYUqDjI2C+Ky4ulAtGS+0QtcSJByZILx3UdnVpHipd0q//8FouYBDPQWCavXAiTRNHh00U07drNvBkIhymwLveTqkNcfPW3k8j90Ow261jYnXhprrDs2zMeqfQ4bjEwTM1DluKZYzh2RP1i/GpeicwoEI2mlw== X-Forefront-PRVS: 07607ED19A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39840400004)(366004)(396003)(346002)(136003)(376002)(199004)(189003)(36756003)(2361001)(68736007)(47776003)(107886003)(105586002)(4326008)(5660300001)(186003)(106356001)(16586007)(2351001)(6506007)(316002)(26005)(76176011)(16526019)(86362001)(575784001)(6916009)(54906003)(6666003)(386003)(25786009)(478600001)(11346002)(6116002)(8676002)(3846002)(81166006)(50466002)(2906002)(81156014)(2616005)(53936002)(51416003)(446003)(48376002)(6486002)(66066001)(486006)(7736002)(476003)(305945005)(52116002)(50226002)(97736004)(14444005)(1076002)(956004)(8936002)(6512007); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2623; 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; SN2PR07MB2623; 23:MEeWuJXvUxxXDp+78LlRDj94oExUpHF52sYPdBGnr?= 6ef5845nepk00/qu/+4XGsYFshJ0oQlnnlZ/waD3j6ZmsWAZlg57psbvca6lmg+JV/rnfgNPfgkzgsiel5fzLGvPybazHrRw2dwDFitekMzsUYZ9rIPzl1K1hcaTjSp5LHsLnNXEWR9uvvrEVn7uuuqxu6OAKXiaaRlLVzusSiV3EKVKyeicr0Naz+8E0pQ340ZDau0gitP/1tOTBnfVrxtJ1GhUzbteicOKXRbyaUVm4xWx2pISMc+DvUKAJz0Ygx57kRG/acb7V0FcwBTMOLxLypID08KOqtKiigT/tsCSaFLWyheohFGNtOECUe1fBN0e5spVvJXFUZg9XYbzHAvYnKiXl/3zpNGxxYzDZZEM64qmvtjLGuuQg1rNqQKiyrPYvvarNq9j0vPuf07js10nvbFyCaFTFyRV6jzTjZoNX9gy+t/06nxudojMKmsDhUNKV7dG32XesJ8eDTr/bXSLTu1mndCTONVlWMbS116+WhbfUuYcugzHyjnUCQ+c12eGTAZv4lRu3fDBZgC3gAnX3ZgE6j5jF9+V2Y7+e9SG/2t+xvdtjwIxXxK62OX8dSAy1r7nJ7xitpWyCQRa2PYrw5laHqlyiyG06dIXks0IfDpVC26U8K6t0vRY0SF17oWQi4VYegAoZFEaaXVO4TFYMezNlaI+6l0imIzNxTZpmRTODTjk7QdetNHQQeOEr2xJJpuO65WUSU0bLqUAM0eF9qd2unYITvP9B5d/Ff86uh1omQ3RN8T3WCMtEcjtNa22Wft8SWkoaQVjyn1BJ8oQI1cn1q/0YfmuGHPpctfEcksx8NYeqLNmT1VFlA6uxpyftCGLYy+jDUiwUjel0AouG0AOJ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hEnmR4ajV7ojw6qCjTi6YjRl3TiU9m1oh23Kub6pe4OgK+iCU77QRO6tkEhaRliQx7LL6NnmtZjKR/F5FyJ9m6XGkPg3mBSa2/9Ljs1rJBDSbLvIz/13L0WRRVDEdgHUTW8xzzfI2GDol2wcZmZdgiNP2hp11kplzBXtU35fe/CAvoel+y3eeasWw33nV6roVQjkqAMVmTlQKo3qgO4oB18yWs8l/E+K0jbtl8WQR4rdQpFl8JmUtrxsUIKw==; 5:eDSnE55gdV70UsTMeT/sI8+Jg4So++QS4YBctlQ7QRxQFh/Uway/BiC8Ilu6FLQQk/cL8l18h4HKVV0W0rLwqBOV63wSV90wBokKY1mXAlOKnoYreTi5AgdNNnqVSNe/EPOsq/Y5rkOVEsi98iKBmfx4Cb0ixVsOt9ajv6KoHTg=; 7:VkgiXMh5eH4+tZuft73XU3W8ze4lwJJjRt4cZ+NgeHjbLPtun0eeMEIikuMPg7/aJC0QkQQVs1PpOVuBGr+tqcihLM811M2W+tsR7Y9w9DkWQWRQauSl++ZDTBp/tPPliiD96RSTOp9dE2qWpa4w4jE47uRHmGsP8XLjbSznTHC+DZFDqe5E0c4WjN1T8u4j21nM2IZyO1ZePn2gLgcZ8kTCqDkydDk0iryxXYW5Sjv/8p6zBT4nSVYFbYiGVD5R SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2018 06:27:38.5780 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a922cd23-0d45-472b-1557-08d5fe8a5fc9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2623 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.130 Subject: [Qemu-devel] [PATCH v7 9/9] 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 b4f291765b..b0e20aeffc 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) {