From patchwork Wed Aug 8 07:10: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: 10559571 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 EBE3B15A6 for ; Wed, 8 Aug 2018 07:12:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3A9428741 for ; Wed, 8 Aug 2018 07:12:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C73E6287A4; Wed, 8 Aug 2018 07:12:48 +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 C530F28768 for ; Wed, 8 Aug 2018 07:12:47 +0000 (UTC) Received: from localhost ([::1]:42132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnIeF-0004zZ-2R for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Aug 2018 03:12:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnIcy-0003ya-A2 for qemu-devel@nongnu.org; Wed, 08 Aug 2018 03:11:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnIcv-00035p-DK for qemu-devel@nongnu.org; Wed, 08 Aug 2018 03:11:28 -0400 Received: from mail-bn3nam01on0127.outbound.protection.outlook.com ([104.47.33.127]:38720 helo=NAM01-BN3-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 1fnIcv-000343-7I; Wed, 08 Aug 2018 03:11:25 -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=pLHx9xKaBOiDTV2a45vGIWo+W90AZrxjHPn623UNZ8o=; b=q8IjjQUIQzQM1vtOlbnopOBibAsEFiOaFfq8004YMoag02HmmR9/5awrM/aapRxjhuqQc/1g7cSNPy+hnfQWDmAQ75768DA6rykESjWH+1oQTYyA03rta5NG6lPkYyrBXOzafxyumK+5LNbPuG+AMs3jPCHtflcEasg1QtYhlDA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 8 Aug 2018 07:11:21 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 10:10:47 +0300 Message-Id: <20180808071051.30628-2-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180808071051.30628-1-lbloch@janustech.com> References: <20180808071051.30628-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM5PR0102CA0003.eurprd01.prod.exchangelabs.com (2603:10a6:206::16) To CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad1dcd2d-9a0d-4e9d-7562-08d5fcfe2612 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:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 3:Vuh4CkXa+iWbRGtZdQWNkg0tEvwO4YWUHxvd69SvmkaNXXs/gM5dfaIXaIlGy/4M6t4axO61AcqxuXLNkmz9PrNmbWRUWJSke+/XFrLq3J/6p+x8z/gSc2LTJhk1Rn3E1m9ebcfIHSH5+StyOiyvfgmiTHdNIN1TTyEQlVHkvx5M0gzEN8PoSHpm+8W8j56UNpYANtvKJToR3s/xRXt4Xlc5zTu+4XVLrnnzAi19ZKvKp+IjEWMoSWUnmou3YMad; 25:60Ffe3x8RIGqTHOCXjy1AAR1OklFIpjiRhjctN+6iTNhpUuEyN18a9ibhVeCnCWubKoi4aSXymSUWMbAMH0GyEiNvmUqt9+fYN0JPSJdT6bS28QnSqHFdAr3jFpCNe+CwoSDrQE7PPmQUJCSLXccUyGPZ7YjlDFz7lXU6VZuBhA8DTFAwpKG38kfZgath3LUBbXcT6pQitYBTm9zYEurNMFKSCICr1CTyjJhuCmKEQfNGspgvP0s1zuWbOAsMdlI0r0i4f63iVIDEWBNCt+92POkWvBvu70kilD0jHANNip032qjt1aM02qp5Q6a35odeAhpVcdnfWh5xeVqiWoRhw==; 31:1z1mfqqezMxTTyfC0h3y4SXkwYfKudSSs9HbBsKlJISA7naKzm2bu6b562w15n5S8QPazT3wtsyN2pPVM29n9WAeAjRu3wk/EbefbEQUneov25LYgVGnZRrUo9FI8P7RP1zoQOcaOqdQwa3OynsZBNxX4C+KgfArXbBYezzNfN5cdZFOIgTD6isy873eX9KUYyEbocKG12nVGmlYBUlZN3Ksf7pfqyBfHTKTiA0ICR4= X-MS-TrafficTypeDiagnostic: CY1PR07MB2617: 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)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123558120)(2016111802025)(20161123560045)(20161123564045)(20161123562045)(6072148)(6043046)(201708071742011)(7699016); SRVR:CY1PR07MB2617; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 4:pnqR9N9+lHxr5MgIC+LYLLt2FvLZIVOLW/J+6wdQLrwdDlfvkdhpMnKcT70GF+hGRsmSKVNYNyRYi9rRVW4M4IrucKigCtlP2Fd5ASY/j1BYlCVsieEvXT+I+VRhtj28E9DKizeYDLN+DeIMtKRhIzosh44gYomZU/yRw+zFo8tE54RaPqLGNB4gxq/vHc5Oo8B3Cu1o7naQPl6DLWgM8T2R8KpL4g1TjnXO5Crgv8qj0GBRXfS1JpU/SpM69sgjgDNfm6UYKwEksDwbtGmL9g== X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39830400003)(396003)(346002)(376002)(199004)(189003)(36756003)(6916009)(107886003)(6512007)(4326008)(186003)(53936002)(50226002)(25786009)(51416003)(81156014)(48376002)(6486002)(8936002)(50466002)(8676002)(68736007)(81166006)(52116002)(6666003)(2906002)(54906003)(97736004)(16526019)(575784001)(551984002)(105586002)(16586007)(86362001)(66066001)(305945005)(2361001)(2616005)(316002)(386003)(6506007)(2351001)(47776003)(106356001)(7736002)(76176011)(1076002)(11346002)(478600001)(26005)(956004)(486006)(476003)(6116002)(5660300001)(446003)(3846002)(14444005); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2617; 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; CY1PR07MB2617; 23:6zztsxBAx9bvXf80Dd2Azola9SL7UvIWbzA45NMGT?= FWr0a3lAjJT+oBMNzTB/aoJeT90Ue1xwGqxyqJqdTVf4E1AHGFOCE+0EgGCASZ+7fTDtJKeaLrcfrs/MnoM7gP8d/ZkRZnsHzI25KULzKMQn6dxkAaOUH9LDStnG/3UEkFHzwKt/KXkLMSZ7m1dnWGUjS9MXAq2ni8Ss9meR2Avng3xCxIyqn+rcpyS/CH4B1sbKHug8JQp3EwDT6zOP/Sfn5xci7a/vcSKtlwWwk7F+Eswb8o2oA5qEkAcF/0qcqot1O3hEbOdhgKtObDM8SOTRqpTEqpGYkxwVPBitYWB8FjfJWJNqPYIxHY1hgOb2jxeoLwiHU8wszLp6AGFNyIqHuIwd9lSXXhOUyOFf/zl9x2tKR1/XPBahDqRpnP6fGNXy5HVD8+Vo6nlHrKN+f2VhP8E0QmKsRCGdPdfObizOJqTWuBfU5hOtwt7vtHFWVI3OFZruP2f5ThiA8hgnYIWS3lsGOgwdZe81/Pa06F/WmsRn4rQxSax1s8WOqqiaLbJ/Q19LN2vqTd1cPhla+Nl4y5cICtUzoVgY9EztRytSEZodgC56WimGRK2xvRNmygQTzR/6ML506zxOw01EjnjlVVGgd3nu930fwAJUlqku89Ak3Dp3xWpMd6ib24v7l2SRBwNFawiTa8g/CsM4iiBMZHwwP8dwwVCblBs/Ievx6t4EM28iCkIrLrwjTWlGiF8H+LfOWrcDRZBw/jeYKv7TR2tjKcJ7gv404LaqMbUq156bVG3jzn1TvykAupcyBwwh51rvB6GwYJkLCt4yCFniR/Mtlt+manjgrC8af7COND8LhHifi/tP5FyoJJNRyLPpXY9dQ1PY8wcXzj19seoYPWpfzmqOPtOfaYrASMMHW+hJwVk5jiIqk2dBAgwnqpuf7E9FraTTUbqHNOzvg+wH42jZWft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Gkzn9XegAv81eMyUg5BpzDNE+ROknvj7fymMhjMxvRill+GGelWtdaouzk5gM+WHhUHHgLnkKSeckrwUdP+xvYwJzOQPBY1zlfEeyC8JstmmMg3aiMGptim0qk93uzNPzIhzPSoQSsjiej4Ln1StzvjRMK0GCU5xiu8nDlh5fBOl5ku7/aSaTzdJbylOxirQ==; 5:OFyapcQvKVj0G2nwOXi7owpDHlqu1Kvb6mXr63kt910FqDyJ3yCWr8vQKQ6iEsks2qgCUyqmMz3vt/IDfNWBmIp3UKI+4ioa7zv6fj0OoMIk8ZjzEeqMB1y76bq0U6wbR9OSLVVFHpILEfOgdincpP+doJG5yIjvzRSIzQySlig=; 7:i8xQ1feR+LT8vqnbdUPQj9Uy8/Vi+xZLRbCVDGwPH39VOi1FwJow+I2IVRJNgmKQSUUWsWHCFySdqhUnuW39ezkLWzVg+VYemxR4wfeCLvkMYZpEgALgnpts+k+nYvFzHI1Cup6v+6hoU80KTTWcX9clJjUISq7vZhEsqc02MWlQv2/qlTBTQqghZSy680Y1ZLEq7vKlTI17+7OP/1vcJeztRjrOr1dDBAyWpn7IcEvcv4Xyuaj3g2PXQlurP20+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 07:11:21.5294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad1dcd2d-9a0d-4e9d-7562-08d5fcfe2612 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2617 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.33.127 Subject: [Qemu-devel] [PATCH v3 1/5] qcow2: Options' documentation fixes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- docs/qcow2-cache.txt | 3 +++ qemu-options.hx | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 8a09a5cc5f..5bf2a8ad29 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -130,6 +130,9 @@ There are a few things that need to be taken into account: memory as possible to the L2 cache before increasing the refcount cache size. + - At most two of "l2-cache-size", "refcount-cache-size", and "cache-size" + can be set simultaneously. + Unlike L2 tables, refcount blocks are not used during normal I/O but only during allocations and internal snapshots. In most cases they are accessed sequentially (even during random guest I/O) so increasing the diff --git a/qemu-options.hx b/qemu-options.hx index b1bf0f485f..f6804758d3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -752,15 +752,18 @@ image file) @item cache-size The maximum total size of the L2 table and refcount block caches in bytes -(default: 1048576 bytes or 8 clusters, whichever is larger) +(default: the sum of l2-cache-size and refcount-cache-size) @item l2-cache-size The maximum size of the L2 table cache in bytes -(default: 4/5 of the total cache size) +(default: if cache-size is not defined - 1048576 bytes or 8 clusters, whichever +is larger; otherwise, as large as possible or needed within the cache-size, +while permitting the requested or the minimal refcount cache size) @item refcount-cache-size The maximum size of the refcount block cache in bytes -(default: 1/5 of the total cache size) +(default: 4 times the cluster size; or if cache-size is specified, the part of +it which is not used for the L2 cache) @item cache-clean-interval Clean unused entries in the L2 and refcount caches. The interval is in seconds. From patchwork Wed Aug 8 07:10:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10559573 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 1094B1057 for ; Wed, 8 Aug 2018 07:13:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE8A92018F for ; Wed, 8 Aug 2018 07:13:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E25BE207A7; Wed, 8 Aug 2018 07:13:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0675A2018F for ; Wed, 8 Aug 2018 07:13:02 +0000 (UTC) Received: from localhost ([::1]:42133 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnIeT-00059s-8P for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Aug 2018 03:13:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnId1-000416-Ib for qemu-devel@nongnu.org; Wed, 08 Aug 2018 03:11:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnIcy-00039B-8G for qemu-devel@nongnu.org; Wed, 08 Aug 2018 03:11:31 -0400 Received: from mail-eopbgr700128.outbound.protection.outlook.com ([40.107.70.128]:57072 helo=NAM04-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnIcx-000386-Ui; Wed, 08 Aug 2018 03:11: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=V9k2+C3jiP1RGH8k4AbfeASoqvFXQEb9J7Fn7SKVFIo=; b=pZZ8Hxcq8JgqZxK4ZroQLM/1NMGJ6AH/F0rMOHtbIov/c038HZcGbQgR5mUSwIlt6UQNduqCyU3QFFRUuutexIujFvnM6eIbB4CIlEG/ZO87Qv9JOeL5yNQakCfJZdPJL5IjIqtEhVcVgOvDqSLzdsX2YOkH1vPztZwAbQyrQ1o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 8 Aug 2018 07:11:23 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 10:10:48 +0300 Message-Id: <20180808071051.30628-3-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180808071051.30628-1-lbloch@janustech.com> References: <20180808071051.30628-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM5PR0102CA0003.eurprd01.prod.exchangelabs.com (2603:10a6:206::16) To CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 306462c4-cfbe-4da8-cbf4-08d5fcfe2779 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:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 3:P4etYc6m13axEsX2nvU0Sc0o5upk6dxkNokycLCUiGr3QFhroVox9EgGS+5wRnRXuLwMoBKTWtleZKHAVVRno+a9ucfl+gRB3G4AnzFqKRTrUQJqD/uVXLq8Cxoe7Y1Bo5aL0/fvp2jRfkD5yJBXV5asOz5jQKtxGDqZl+4q0u8GGTLA/lnGQNmCz5TAy900oKt54xtxGYHabRQcFcjUyK+Mm075aSqW0aWtQ/BVXks2sk1BR7nQtnPPqlx1aJ7i; 25:btgQeB9SiHN8uSQspquWvQnvGpFMNmSoImrhRN75Pcy9GS6mO5/HUbVTjzMgU0aReAjkQfAUEyEhqSBNJ9Qmf9YyzqeHFH3Bal1mXfEnZY2hWYDyvMTxOkFSoWaduvht02P5DVrTEc7CeB00w0oqEWe9SBIFA4eQjD3W4TLxQFFtnNjkYv7TQEJ4SSkLiSvSMOrbvDQenMY1IiiDN77pvdweFslrzItPZaDOsZxJCOaZ0gLRzhV11dO6fcmciSMGtrdAVDDpOTllP/Bm84a1C9v1EJJTLc1ennKi4JqzxiwLcPPkk78mGxRHIgfhO+owKJi3ckdUFuxi0Q81loaD+w==; 31:dZU7TLreg+fFlSXYDcKYYL7PgSAn+RVSMVoJQhTJTIwBNo7B2hJVhsbeoSfgGh0D5lM8Jnw7HvS5XPQqLbLDvxhm9p9T2Am+ulKYVxFPSq22ZzhAKzpUNs54jC74fHQFEG8CpgxfDrBMwP8zSWn62NrR/TqhkzN4KgvktpKgL7srWn/+BQ5TAv2f2qDzNHkjuWtI7L7OYNHXY53/w3Wwqv/0/ChIewbBwtqAEii+f8k= X-MS-TrafficTypeDiagnostic: CY1PR07MB2617: 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)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123558120)(2016111802025)(20161123560045)(20161123564045)(20161123562045)(6072148)(6043046)(201708071742011)(7699016); SRVR:CY1PR07MB2617; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 4:evw2mmswE05Eft3TV9EZ0F2fg4kzPtcf6ykZ1eWjFwAyAqvOIecGqN2oLCkJLJ+A/hTdzevKm4FXabnGv/OkvQ5thvu4cH0hiM/ijHgzCcPIcnvGEAlC0K1bJze6E3jtl0pIJ21iJee+8ijnFYGcSoWGywDzCJYdQoNoK5SKv5gA0PzbDlSmWz4olANa0haTJ9RNFTtrYLtlaNINtgey/MoBx2F43bdvP5y31CnDQczSooAJEYvcrckTTsgWJNuC84ZQ4bYWvJtt0xfn1hwrZw== X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39830400003)(396003)(346002)(376002)(199004)(189003)(36756003)(6916009)(107886003)(6512007)(4326008)(186003)(53936002)(50226002)(25786009)(51416003)(81156014)(48376002)(6486002)(8936002)(50466002)(8676002)(68736007)(81166006)(52116002)(6666003)(2906002)(54906003)(97736004)(16526019)(551984002)(105586002)(16586007)(86362001)(66066001)(305945005)(2361001)(2616005)(316002)(386003)(6506007)(2351001)(47776003)(106356001)(7736002)(76176011)(1076002)(11346002)(478600001)(26005)(956004)(486006)(476003)(6116002)(5660300001)(446003)(3846002)(14444005); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2617; 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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DwMXJr8EhY49qZdf4YpSa08uJ3eWX+0W2H2tpzKvqOs7pSCRAwzoqC15S6FyMfG+lcNYgOkknp5NGR8CNiwpP/boxpG37ov+WmazIgWgnkzBWtuc4aWeZDsyCrKclAtkF/w8yiDpc0j6oKfXkgQZCryDJbrXXrbffPIichfLVJUx9sGS7eeuRoR9Ri0Sg2RDxRJE3GYwE4Vasjyr3zJVT6CaBKo6QhSayju4SNPkcYaifu+9UmHIs06xETWuecKbM= X-Microsoft-Antispam-Message-Info: 9s9KE0sWyDEsfnEm8IeGYwg7rf2z+EXs6SB17SeUmrm363e6Aq2AdvL0rjb/Mjg1WwsHvQk91WRfXVhlo75VLtayKvT2RPyx+/JOlYesWfiSV24UxK7a3mvVkv5RFLtqtDakD5Hk9Z0dtRSIw+fJTs7UVIS8JhhXtJZV3pUd/X3Y2PHotUfyijB73SZwlplFgNgLpHEUgmsyN1J19PJoo7nW5So34WF6AnRP1o6uUHvPTvU5PUWztMwElLXcz44j1hn2K/I3Z3ZwnCHhGNHmSHESza6gBOyH79uRJkDcGBLdA44pfndt5T8zdfNDeqJfL92wRL0os5P3idD9Vso18ePyazVyJQIsi2yPetbfe+o= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 6:rFnDWuKmlsXiBx7cmYaPhCR/vKvcGshXXj2s892QvrG/Ge04PDaWsh294uba/S70oJXg1IO49VUBX2C5tBS0DzoZQfCBleqn6vrsNCNuymdfWUgbX6qbKTftbrpz6KdrNXZbhBrtpD/45NrqpKOijH+YNBheS9VKevU10ItdjbH8v2plGhfeQms9Qv7KaN2agFcm5p5nkBWU0BuiLktTVg77rf78eWzYTzUvMX7omw8ygtGEMR4o9v+vVQANIENXRClRa0O7KdXg6nDCVygQUy7iaUUdfkdBNJTmQd2GjvhGwWeTlX6NqY66wWVPKH511ZnFMm4ersEZP5PIjBNMBkrx1t4B8F2VD8mACLJK7I2BUCP9FtYU6aXu5yp6AEO09Msk5ScjPbOLHnH/21D8r/+YqckEllgVEjf15PWf7+iW+ok2t1utx/7QpUAZY4kG4BfDJjQL8se/z7DGLHg1ew==; 5:DcJAKlQ6wJIQXQVO0SrZlCiNFobrC0BhlUe0O71f640z3SlQfrdfTuqL5pkyCp5f7+xKBjKgm85GIyL2mWA7j2tOOosPkru1otuh8SEZSjxdtPEvtvrZh65UF+n4b4ejv1uu4Xtm5vlwP8KXgTs4ZbbEzwA+OJErpW5bBkpsOf0=; 7:20l5beNyMYKzzw1yj+WhaF/RflJbLsMLY3K2/UA1fn1w2eXW3HDnSG9WTF6E51w6h66bKvy1RmFqppO+nxiHZM8XiCIKxaJ1uoZRs47MEc8sgzAGZnUDYGUuGVu68K+xqgyK2waKOCHCsJF6Db3P9WslKGLYcOLq7Uf+uQti8dIK4ikPz0R9p3CG81soS6xRfvO2UA9kcjuh2G80lRbIg8GnczkaTnohRQyODaELiKPh62KQEREutwsrIBhGySjf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 07:11:23.8854 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 306462c4-cfbe-4da8-cbf4-08d5fcfe2779 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2617 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.70.128 Subject: [Qemu-devel] [PATCH v3 2/5] qcow2: Make the default L2 cache sufficient to cover the entire image X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Sufficient L2 cache can noticeably improve the performance when using large images with frequent I/O. The memory overhead is not significant in most cases, as the cache size is only 1 MB for each 8 GB of virtual image size (with the default cluster size of 64 KB). For cases with very large images and/or small cluster sizes, there is an upper limit on the default L2 cache: 32 MB. To modify this limit one can use the already existing '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 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 | 33 +++++++++++++-------------------- block/qcow2.h | 4 +--- docs/qcow2-cache.txt | 24 ++++++++++++++---------- qemu-options.hx | 6 +++--- tests/qemu-iotests/137 | 1 - tests/qemu-iotests/137.out | 1 - 6 files changed, 31 insertions(+), 38 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index ec9e6238a0..98cb96aaca 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -777,29 +777,35 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, uint64_t *refcount_cache_size, Error **errp) { BDRVQcow2State *s = bs->opaque; - uint64_t combined_cache_size; + uint64_t combined_cache_size, l2_cache_max_setting; bool l2_cache_size_set, refcount_cache_size_set, combined_cache_size_set; - int min_refcount_cache = MIN_REFCOUNT_CACHE_SIZE * s->cluster_size; + uint64_t min_refcount_cache = MIN_REFCOUNT_CACHE_SIZE * s->cluster_size; combined_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_CACHE_SIZE); l2_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_L2_CACHE_SIZE); refcount_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_REFCOUNT_CACHE_SIZE); combined_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_CACHE_SIZE, 0); - *l2_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_L2_CACHE_SIZE, 0); + l2_cache_max_setting = qemu_opt_get_size(opts, QCOW2_OPT_L2_CACHE_SIZE, + DEFAULT_L2_CACHE_MAX_SIZE); *refcount_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_REFCOUNT_CACHE_SIZE, 0); *l2_cache_entry_size = qemu_opt_get_size( opts, QCOW2_OPT_L2_CACHE_ENTRY_SIZE, s->cluster_size); + uint64_t virtual_disk_size = bs->total_sectors * BDRV_SECTOR_SIZE; + uint64_t max_l2_cache = virtual_disk_size / (s->cluster_size / 8); + *l2_cache_size = MIN(max_l2_cache, l2_cache_max_setting); + if (combined_cache_size_set) { if (l2_cache_size_set && refcount_cache_size_set) { error_setg(errp, QCOW2_OPT_CACHE_SIZE ", " QCOW2_OPT_L2_CACHE_SIZE " and " QCOW2_OPT_REFCOUNT_CACHE_SIZE " may not be set " "at the same time"); return; - } else if (*l2_cache_size > combined_cache_size) { + } else if (l2_cache_size_set && + (l2_cache_max_setting > combined_cache_size)) { error_setg(errp, QCOW2_OPT_L2_CACHE_SIZE " may not exceed " QCOW2_OPT_CACHE_SIZE); return; @@ -814,29 +820,16 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, } else if (refcount_cache_size_set) { *l2_cache_size = combined_cache_size - *refcount_cache_size; } else { - uint64_t virtual_disk_size = bs->total_sectors * BDRV_SECTOR_SIZE; - uint64_t max_l2_cache = virtual_disk_size / (s->cluster_size / 8); - /* Assign as much memory as possible to the L2 cache, and * use the remainder for the refcount cache */ - if (combined_cache_size >= max_l2_cache + min_refcount_cache) { - *l2_cache_size = max_l2_cache; + if (combined_cache_size >= *l2_cache_size + min_refcount_cache) { *refcount_cache_size = combined_cache_size - *l2_cache_size; } else { - *refcount_cache_size = - MIN(combined_cache_size, min_refcount_cache); + *refcount_cache_size = MIN(combined_cache_size, + min_refcount_cache); *l2_cache_size = combined_cache_size - *refcount_cache_size; } } - } else { - if (!l2_cache_size_set) { - *l2_cache_size = MAX(DEFAULT_L2_CACHE_BYTE_SIZE, - (uint64_t)DEFAULT_L2_CACHE_CLUSTERS - * s->cluster_size); - } - if (!refcount_cache_size_set) { - *refcount_cache_size = min_refcount_cache; - } } if (*l2_cache_entry_size < (1 << MIN_CLUSTER_BITS) || diff --git a/block/qcow2.h b/block/qcow2.h index 81b844e936..d77a31d932 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -73,9 +73,7 @@ /* Must be at least 4 to cover all cases of refcount table growth */ #define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */ -/* Whichever is more */ -#define DEFAULT_L2_CACHE_CLUSTERS 8 /* clusters */ -#define DEFAULT_L2_CACHE_BYTE_SIZE 1048576 /* bytes */ +#define DEFAULT_L2_CACHE_MAX_SIZE 0x2000000U /* bytes */ #define DEFAULT_CLUSTER_SIZE 65536 diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 5bf2a8ad29..c7625cdeb3 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -97,12 +97,14 @@ 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 +QEMU will use a default L2 cache sufficient to cover the entire virtual +size of an image, which with the default cluster size will result in 1 MB +of cache for every 8 GB of virtual image size: - 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). How to configure the cache sizes @@ -121,8 +123,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, but is capped at 32 MB (enough for image sizes of up to 256 GB + with the default cluster size). This maximum value can be reduced or + enlarged using the "l2-cache-size" option. The minimum is 2 clusters + (or 2 cache entries, see below). - The default (and minimum) refcount cache size is 4 clusters. @@ -180,9 +185,8 @@ 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) 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..d6e15b2f06 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 defined - 32M; 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 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 Wed Aug 8 07:10:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10559581 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 4347D157B for ; Wed, 8 Aug 2018 07:15:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AC2228A35 for ; Wed, 8 Aug 2018 07:15:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B83328AA5; Wed, 8 Aug 2018 07:15: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 99A0E28A35 for ; Wed, 8 Aug 2018 07:15:13 +0000 (UTC) Received: from localhost ([::1]:42148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnIga-0007Jg-N9 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Aug 2018 03:15:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnId4-00043n-3z for qemu-devel@nongnu.org; Wed, 08 Aug 2018 03:11:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnId0-0003BX-TC for qemu-devel@nongnu.org; Wed, 08 Aug 2018 03:11:34 -0400 Received: from mail-eopbgr700132.outbound.protection.outlook.com ([40.107.70.132]:36574 helo=NAM04-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnId0-0003Ao-KJ; Wed, 08 Aug 2018 03:11:30 -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=6GY98t9WWipuGsNH+mpFhQLZk2rdzUU8Nn7LYJ3QnXk=; b=hAtHIXUr5EowddEUfK2I0wVDkhaUeWA8TCbiRg6jc5fIrGpHS8vKIdiyTokgDvs7W54I0dtcFmeNp/BCaFCjmkYFS03tX24ww2HAR1y/5zsJeahUBaKSuJ8dw0K71VGFFwAKtlFPU9bM4XJJv+g33HHB3J/dPjK1lI/jTU3qKtU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 8 Aug 2018 07:11:26 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 10:10:49 +0300 Message-Id: <20180808071051.30628-4-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180808071051.30628-1-lbloch@janustech.com> References: <20180808071051.30628-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM5PR0102CA0003.eurprd01.prod.exchangelabs.com (2603:10a6:206::16) To CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 46e681f8-8fe6-43d5-a0d1-08d5fcfe28f1 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:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 3:urUKeTqTZncLKVtz54dADzPHaLqekZu1NtKvtmsDYOaSzfiTPimG6Df9dsJPhMIiZIy48VUlLiAs38SoY5c/BgdxL36YyXn0txCTJPgUnJJDdbU//vjhl07InJrX8fJgRlf5O+JYiUXXzoRu7c2uDXW016y+l8M3ToVeUodQSivOugI2scQSsAep1LLqpUoUAo57YZNbGKYYF2nII9onarnfs00gUIdEfO8O83nqyzjfCPs0NPxqyP6uuxz42TjI; 25:Y2B3uyL6jYvQZ8vzuhjdh9SgKRk4v+e+HMLjkmkp9nk8e1adPsCC8WR1nLFCj9rNerqbGkfxFl0VEFH7v0hLzaooBl70mt3iskHgiE2vxMRiV9W1dI3CTq9tpvSAO9GW30X6WAZ7RFqipSii/EzgLyN/FlwSqIPZXtOmw9vcbNs3tLeEdLqhrLIHrj8FlKn0bv/dX/ex/dhcTtyPqs0+tFcO8SfUXu7TrKypjuHhqdge3/GAkCqHic2nKjMHmPaUQQpAtkSAzUsP4JfBzL6FGnL01wZt393s9b+tHI+cSlBZU/xrnAzduxqGb3p/XzDXoPxt6koBY3ooA+z4HFgwpw==; 31:Yy4cGH3GW7uQUpQhFpqTbimhDobQlmny31P0eyAEKb8h7FcnDljDOGvc9Z2lepSSWELFGAqmH/FBSWhAvjdYxWjkwYrEpqRQzYLy4PAjtn8pmzS4OKG5J9Yine4TXr8j6RE1UT+54jOklDQFldMDylNBbw6Ak0aNMrWOlGUSnqAQRhikEx1irXkjMlcXClJ0VyxMFXoTk+rt7ufJtAyDFbcLOq73fFLvD6zb1xav2Og= X-MS-TrafficTypeDiagnostic: CY1PR07MB2617: 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)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123558120)(2016111802025)(20161123560045)(20161123564045)(20161123562045)(6072148)(6043046)(201708071742011)(7699016); SRVR:CY1PR07MB2617; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 4:FWNKOueUFRkapKHVkQ9p5TaPRYGA7p/5SdW5Vl9jZYYNO4UEnOO1kwwUqxFGF1BAzC8N+Z8Ak+URr1HePw3n/snaRR7DjOL+vyYsdAEY9XIdOEg6XIt3x+v4VVr+/lhLmBuy7GPALlzX/SqTMRSfsYf9jEKXjTmuPdU1J91ITmFYylqSDKAbFsbhErdUkn/ApPejqSmopv5U3VSpbtwi9W+k0gEyc0rAg1k7M93CCGr5wZN6kLTCkaR31ncL/qfhTrn7Qxb4SSg+/O99z1IenQ== X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39830400003)(396003)(346002)(376002)(199004)(189003)(36756003)(6916009)(107886003)(6512007)(4326008)(186003)(53936002)(50226002)(25786009)(51416003)(81156014)(48376002)(6486002)(8936002)(50466002)(8676002)(68736007)(81166006)(52116002)(6666003)(2906002)(54906003)(97736004)(16526019)(105586002)(16586007)(86362001)(66066001)(305945005)(2361001)(2616005)(316002)(386003)(6506007)(2351001)(47776003)(106356001)(7736002)(76176011)(1076002)(11346002)(478600001)(26005)(956004)(486006)(476003)(6116002)(5660300001)(446003)(3846002)(14444005); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2617; 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; CY1PR07MB2617; 23:gwivwEj9sLmCXIzKYwjOHU3/OkwBNCxfmBKuDYvug?= Pe1GeTPx01VwEATOWOt4IIOic90MAob1ElMU1F4OJM+l3gdjOY1uMqk4Ll2n02NLZhz8UQf082YnUNx22HGAhKSVjZK9qS2Iksti1MFxYF51vGHjk1DkvwuVNR/h7r+3rn8LhcYAyAfm+8WcOwfPWLbANOoVjTKtRIaVIGiLpjVj6aDdxn+NfOEG1g6dohI5GeXGMFhT8nFagHBmTLYYVCjlvRk1lhSClLxI65GJvZKE8mpqQI5FfQ0dhmtF6Iw2f8v5QKk4UTqZ9WhLFNO3JiOyneRPR79Nrl7opn5munysrQNFZbtEZYw4pP1uo3X2LB8sIiOuOGT/Ku9tBJf4jltrFGYdvHkiKGNiZGvzdfa8PMsmnHv/stcfEuTb5xYu9tcBTN1KyLhlshWrCQkf14/8fxmfZekknfqT74bX25+GG31aSylJvjJbWQjjVutMr1WYqL3VmiqOwUcxOWs+WILK4qkS/Ig6jntcUuJpBQm+87MjZgPUZ6qG6PlB289/ZKWpsSebAWATksU2VM2KabeJOOCa0HHnN9dq1N18eDmLIDlTApGAnfMWf4Az7v2zhvnSU1Z79aZ9KkJBHDMFMDSx2hg2sikMRs8jSazPWHEqfbUBQLz3sg5o3I6tdXGb0okZfMjdFz8Hx+wyoSBPOlkhTOxQRhiJ2rwm9ON8A7upOwZwSfcQTKvsvZamjKtgePTub9TY4drSv+6XL3JuxcKN5gefdi1VNjwJa3rgBGOVZim/RmDKL5XQKXKkrkDKqfdDxHAk8bd6FOxehRFQHrMcj3vjMe7RF3rQIheUm+De3WjlcHqKquYpFxAuEic/bL9u16zVEbkH3ja5LH663oBA3uC3aYMA9+Tzk2aqBq82fPo35AmhWbZYfwubk5ASvSO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ctxjPnhURWW24RlrgqRsUTLeFloc02gQJ0iNNfBDqT7LrVnU4rAN8LsTxNmlRAmngHSxPE8/spnhgjfR+KsIKFXW/ZNnU7TJ3VPMhNysZx/ZVPI353HeNLEJOctTvtnmthzH5AaZL2XRlMN6C/01p933K+zWGW6HDUGliyW+kP3HCZGkRkMz3FMQ==; 5:+7Oxv3v/YCZ6Z0JB0V7FRrKPHxOX8bwE1sY1Q5n2bWaYYx5m3y0sv5V3z/C8wZxoQ+8ZqNJKoH5HksdEkHl8zGIDk4cWpPaRhiUmduhPEG2hzuRriX/WRa4Gf02J0Ywt4lsevHtzuQTxEU0WdGWTWKJdrIUEzJQB4Wj4NdS4nTE=; 7:KbVUcJfOBRRHQ22p1vkMh0psa/6mDFSTxFQ+vxvX5fAk8cdOfWGmFp8CUFnOZWCypAbvA9ZyPfuurRCdd/AksD/qEoW4Eiz2poS5TJrnk0XYh8P2z5+wP3kZaUOqC+8iwtA4hme0zYHBwRr4RZjVaB7n4rfgSXzusMyAd3EARRnkcFDiT8crYwb98ACAr7PTlKhTF6HrZ7txyqo+ERfXslOZEDXjRt2xk3zV9UjnjfW8VYtHfFBwQn0Diu115tzf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 07:11:26.3484 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 46e681f8-8fe6-43d5-a0d1-08d5fcfe28f1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2617 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.70.132 Subject: [Qemu-devel] [PATCH v3 3/5] qcow2: Resize the cache upon image resizing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The caches are now recalculated upon image resizing. This is done because the new default behavior of assigning a sufficient L2 cache to cover the entire image implies that the cache will still be sufficient after an image resizing. Signed-off-by: Leonid Bloch --- block/qcow2.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index 98cb96aaca..f60cb92169 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3639,6 +3639,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), @@ -3649,6 +3651,12 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, } s->l1_vm_state_index = new_l1_size; + /* Update cache sizes */ + QDict *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 Wed Aug 8 07:10:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10559585 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 1EA6714E5 for ; Wed, 8 Aug 2018 07:16:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 065F628AA5 for ; Wed, 8 Aug 2018 07:16:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC79728AD5; Wed, 8 Aug 2018 07:16:13 +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 6AE6528AA5 for ; Wed, 8 Aug 2018 07:16:13 +0000 (UTC) Received: from localhost ([::1]:42153 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnIhY-000867-J5 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Aug 2018 03:16:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnId6-00045p-9A for qemu-devel@nongnu.org; Wed, 08 Aug 2018 03:11:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnId3-0003CS-0p for qemu-devel@nongnu.org; Wed, 08 Aug 2018 03:11:36 -0400 Received: from mail-eopbgr700126.outbound.protection.outlook.com ([40.107.70.126]:54082 helo=NAM04-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnId2-0003C9-Oa; Wed, 08 Aug 2018 03:11: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=2Rptt42J+sckZtVEAJvLAi6SueWnBO8bJMzSCovJmjw=; b=Neru5wmMaQqVg6oLUWXpBbBSFUozKOJKADbgSYE0/XO0I6CSZCB77BHVrn51WqkFWfDegtnqtD/ue8WVXG4N2nCVOzS160nmFr1v1eEw3sN6WNFUr1iXX0I0VnfjUHKWh87sda9Et3yNP6EU1zoCSndy5onOUt2GRdwSZYncw/Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 8 Aug 2018 07:11:28 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 10:10:50 +0300 Message-Id: <20180808071051.30628-5-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180808071051.30628-1-lbloch@janustech.com> References: <20180808071051.30628-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM5PR0102CA0003.eurprd01.prod.exchangelabs.com (2603:10a6:206::16) To CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c2a76e4-e626-40a2-4bf6-08d5fcfe2a60 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:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 3:AW9X8UNxB+JnMt2BgBkPVaGxElLycPIagKW6xO2cP5asUsgHl19QBszs7h80tKUstE6zcOAIu6w9RD6FXtVgGfxh7GHdvPQifeL5Go1IwRCptAZhm0VYmHbSShGpeeKNeTZBlwfpCseBZ4VCV7gOBgEXjS14FtPqiqZCUzy2uWzYsclyn3pk2SosBLcV1RY42DDU1SAPMHv/hrXU1MhXb4jLlU4o3m8F+iGgkfFSrm1a0ndZ5VnUxfcLiSqUoh01; 25:sLHMpxc/HoTIrKQTC3IFVjRjK4FACgHf6hy1MUQLsdGYFVejnxgguX+BEyv53mu06m8x2SXyIB6u6Wbh1qEHztxF4XjxKnv4odqhri819lTQ37DIHDgGK1b5x2E2tPlEoM2mUKUv2IBsXpUagUaZpmD5cvBjzGNwCfifdgTRduwzOB5ZfKG+xbuBu3rAezGeRfy7L4uBOMibSRrrzuarSaP4/MNB7x/BYvCG9pKqKHVqQLLYOt54BShMqRcOU+F3rdJB7oBtyHvI0MNPdFZglrLmTwTfmGt2svb/mbNssSS+NeQk0PdeRSFhevhzcVzLqh1RCNLogvCYf3Ep8O/T3g==; 31:qK8XzlHJNnVJdmKaenFAHnerHdIyYZ7WdMlPg0RzGvqnWAbKzUYIIwJsSRA0PPG5tKPFOqlV73yRp4RVi2ehj/3SvqzTuyOg0YESl1911Ny9qvwMAD3LaybIPgYr2JhEIEawb+6KbZiCli7v31Ga/ct+H8fk9op+efLPtb+SneDbZF2ygUqgUySrVXWTpEbuTj6FB/9nomvRESEOhv4B7GXVPrW9+aWz7VqVxZZD5bc= X-MS-TrafficTypeDiagnostic: CY1PR07MB2617: 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)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123558120)(2016111802025)(20161123560045)(20161123564045)(20161123562045)(6072148)(6043046)(201708071742011)(7699016); SRVR:CY1PR07MB2617; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 4:UpSzQXqkimzC1hRn4Nl2LgjAaOsCr62+h/MS/ICcRfmow0Vo3PeBlDCzo3ks1r1zwDKEdfhHyKx5HheE/HSg23FJEKzIRYJ9DfoZjEFXlRvE1wkcaBkSB3Wq8c75UGksN+VXYpTB1+1G4epcqYsBMFcHlV+i14jglbFy+7F3kmFx9/0jTwB+D0iju1zfkoTHnxgEmX0Fl7nsZ1kXGHQO9TCuuIdEONhwiTkDWHzP0kpm2MkG4WtvqGxchwAMYqeg7tq+5ndoj+4lFYbb2o86aw== X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39830400003)(396003)(346002)(376002)(199004)(189003)(36756003)(6916009)(107886003)(6512007)(4326008)(186003)(53936002)(50226002)(25786009)(51416003)(81156014)(48376002)(6486002)(8936002)(50466002)(8676002)(68736007)(81166006)(52116002)(6666003)(2906002)(54906003)(97736004)(16526019)(575784001)(105586002)(16586007)(86362001)(66066001)(305945005)(2361001)(2616005)(316002)(386003)(6506007)(2351001)(47776003)(106356001)(7736002)(76176011)(1076002)(11346002)(478600001)(26005)(956004)(486006)(476003)(6116002)(5660300001)(446003)(3846002)(14444005); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2617; 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; CY1PR07MB2617; 23:2VL+LT8ypoAEuIkGMYrLvxfGGBceBQUqS41OCyXHO?= HILVVKny4U5Cd8U7wkbauASPHK02mEBIVqqyzUoDaRCzIEmljtUMKRsdxhf8WbWpPuLnrQlFiG/mk9ABkSbeYSrdpScIOwLaXINvAaMuSea3Tk06GiRO4UcRIcNRyDhdZPv5br5LVFowmUhVYgOCmFtWAzZI3FEDYjoZvjGLe6tSWZQx0hTy2ywMOb19ROds5Y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0=; 7:NOs4XzjaPpuzuvnUj8LJ6FcuHAYcs16oQgrwjQT92/6MAcp9oT4k7cCTY6Tfa+Nd18SdGaG3P90NCglp01okHX69p/33W6IMlXrZWSRDbvKlFGp6PQh0Gb66/MLZDcp/cNykTXl7Zjy/yuT9hGvTdxgOXHDwkyLHTkMsuBLipIfH9M7JlMcssCZN4exxmZDt1Wf01JonEr397XIlUJfIYLF+2HJpB0GlQUQG2TqFNeKKpyIWKoFN+Iwzp5YceuW0 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 07:11:28.7484 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c2a76e4-e626-40a2-4bf6-08d5fcfe2a60 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2617 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.70.126 Subject: [Qemu-devel] [PATCH v3 4/5] qcow2: Set the default cache-clean-interval to 30 seconds 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 30 seconds, 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 f60cb92169..453a6377ac 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -941,7 +941,7 @@ static int qcow2_update_options_prepare(BlockDriverState *bs, /* New interval for cache cleanup timer */ r->cache_clean_interval = qemu_opt_get_number(opts, QCOW2_OPT_CACHE_CLEAN_INTERVAL, - s->cache_clean_interval); + DEFAULT_CACHE_CLEAN_INTERVAL); #ifndef CONFIG_LINUX if (r->cache_clean_interval != 0) { error_setg(errp, QCOW2_OPT_CACHE_CLEAN_INTERVAL diff --git a/block/qcow2.h b/block/qcow2.h index d77a31d932..96a2808685 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -77,6 +77,7 @@ #define DEFAULT_CLUSTER_SIZE 65536 +#define DEFAULT_CACHE_CLEAN_INTERVAL 30 /* 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 c7625cdeb3..c795febbdc 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -202,8 +202,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 30. 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..f98cd14740 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 30. Setting 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 d6e15b2f06..a0e0763f71 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 30. 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 Wed Aug 8 07:10:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10559583 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 DE87414E5 for ; Wed, 8 Aug 2018 07:15:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C78CF28A35 for ; Wed, 8 Aug 2018 07:15:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB90C28AA5; Wed, 8 Aug 2018 07:15:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5440F28A35 for ; Wed, 8 Aug 2018 07:15:25 +0000 (UTC) Received: from localhost ([::1]:42149 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnIgm-0007R5-Gd for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Aug 2018 03:15:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnId8-00047e-H4 for qemu-devel@nongnu.org; Wed, 08 Aug 2018 03:11:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnId5-0003De-8A for qemu-devel@nongnu.org; Wed, 08 Aug 2018 03:11:38 -0400 Received: from mail-eopbgr700110.outbound.protection.outlook.com ([40.107.70.110]:16032 helo=NAM04-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnId4-0003Cy-VI; Wed, 08 Aug 2018 03:11:35 -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=u7R0mDv/oqXjyp4/c8DRsrMkN8ni4Y1myVPwCrkEqdE=; b=nuz1nNx1eZqA6ghLkqXXyVlSl4ESH/DjfU75XS/MhGi9tjLnvWVAr2FPeX6/tcR56wwh/t7l2USXnYMPCiBZwdW96g/OZMUvwQERn/86IoP5uisyvVEOUDDNJ5t2pnSjGDW3Ps6b2TDC3+Xk0QFgHkzdEHrE2625BCJDy4lQi9g= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Wed, 8 Aug 2018 07:11:31 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 10:10:51 +0300 Message-Id: <20180808071051.30628-6-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180808071051.30628-1-lbloch@janustech.com> References: <20180808071051.30628-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM5PR0102CA0003.eurprd01.prod.exchangelabs.com (2603:10a6:206::16) To CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 72cbf5b9-6407-4074-339d-08d5fcfe2bce 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:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 3:FV9nKgmbwdiT9oTREipywOg427OSDRmfTOcTjPX6a7AEYpC0SwhRxFvCoYF7YL0d+pyrRH0iM259ktfJIL+fJt7UQlBfv/YXPp/UK9NG2CFASJk63dl1ZBC0/TF5JhpPA3CBkBgOBwiaJ9JtuYUUiKWfVogZimbpPfknbHIM+L6dg6IHLKG+NqhXY5fZ3cgCsGzqvXbcGKSXaz6/bcbGzXaPUj6WCrkwyZWJ5Nm1hMV6LowJNUtM1CoIlOXRPn2P; 25:hvHQmKqMwh9FrXk/4x4VRdDENR8++OQE+VE+SEpTYynTnGkO9CX1LWj3mW6hhG+CNnWcGc2MgPTa/+5EllfwmaoycuP/TQySuuiSVArQBIQUI+LFgsJ0rXmnqN8On9s3UyCgAIvr+y0Rp/yo71Zy3shHd7ScWftS7YvUfY5BKIedU9ncMU8Y/dVe2DfRvdVejy697KS4iyIHWnlvPZiU0ph1R49bSmP2GPd6W2HURNx+mpgEJ5HZ0/BSK1xlbTTLNKkavhzL+As6AZV725Bj09dUD62IDq0EBmFyQ3P77XhPurigtNTwZd1SfFQmot5HYqa0/pKpuwFYWRKVXy2XyA==; 31:ygpqH2NneWTLViPzV3CV8Q3h578T3Xe/Cx2Lq2huO5UHadU59B/hkdLM337Gy4P7NHTGeKiRmjjZWkww3rtI1eJsDr7mlFP0REb5PsZOS2x3Gw+n/+j36aaGRF0BswCvtj+1f8loEAmiJYRoyTN4D5HndWj35ZRwaofxvo5vBm1Ux8vmN9kK+tot3TaWLGkdB6inObMt5J2nENBoB0HCuuzlmJkMsSv7x7UUi0Ybu0Q= X-MS-TrafficTypeDiagnostic: CY1PR07MB2617: 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)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123558120)(2016111802025)(20161123560045)(20161123564045)(20161123562045)(6072148)(6043046)(201708071742011)(7699016); SRVR:CY1PR07MB2617; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 4:rQjlgsPYYH8emFPTnFdBzJGDu2JLFVvpHOmw6SevTp4NOIHhVriRRQuBDfwUl5q3n0uy4g8AR9+w2lyZdMTeW68OH96rNo+S72KNNFbd5BWLVqJiB/F8QDaqNpYY4kYs2eaKWarfyeXKQkUvOCi2ejv6rupdeAlsTlx3vZbNwnNRWe7bRRHaSnofI1EFdEYK6ENbGVlDDbO9h2+o6SLKRRzMGFrAEuoywEbjwaQzcgDMvAt+KRsWYYeICcgsun7xLiKeI8I/oQinUpUO11eKUA== X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39830400003)(396003)(346002)(376002)(199004)(189003)(36756003)(6916009)(107886003)(6512007)(4326008)(186003)(53936002)(50226002)(25786009)(51416003)(81156014)(48376002)(6486002)(8936002)(50466002)(8676002)(68736007)(81166006)(52116002)(6666003)(2906002)(54906003)(97736004)(16526019)(105586002)(16586007)(86362001)(66066001)(305945005)(2361001)(2616005)(316002)(386003)(6506007)(2351001)(47776003)(106356001)(7736002)(76176011)(1076002)(11346002)(478600001)(26005)(956004)(486006)(476003)(6116002)(5660300001)(446003)(3846002)(14444005); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2617; 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; CY1PR07MB2617; 23:E0fRmd7Rd7CU9F+Pk1zwfKcTyqol8BG6r6NO6bJNp?= 53OjWXH454vCt1RwRXvgCbkyyc9iw4EVT09GxrJIx4E1XaDkXmcfVsYreJO/mUlbHVbF/H7OpKHySJ/25BBo6LR1Rzh9Bea4vyfNp6P6Bh3FUpPtaq7a1lq9M6Kp/AIR1UyiLKFaj9EINc50Bw4Rr+PvMR8Ff8vQtpvzJugnKQEFRCJikE3fwzlaFJbotCbE0Zq88n/S5nEZ20wS/J1TMdVVmpX2cSO7Xw3f8ZnIlcReYnXqeb/8ihnuxTOQkcUZYtAE9gi1/WtNSpJ0FwrGCXIqvpUd6HbxnOwIKUyTFm1r9SqH7GPS15O2fWorUzgQy9z+HPtxvJlTGRwodcXslxwCG9vs2QjTpHWPYdCWPKZSHYnSyT5eUVm7dwQAJ/vemzihF8euEbyi4QviU5z7PecZaJCiYMbDv3pHZa0Gh+Elu/EBDKyT8DwtK7dwIIF3T3NpXAhiytPph+Y4txoySZfCpkOSWeZc7rK97HywjRtIqnubvZ/cuwB2uyEsSup+k5j+IiQVWqYvHJcSlna8stRDoEvvzWq19NRmNJi5j877s6we/nCig9UIL4jHYKOq9jZHr2fdKloBPoJIkoSXdhTEpNxOd/Ve8tao0ioA42p+lFLjXreFPMqHgpXY2KhPjbyKCA6dRJlaXRgB0h4+iFjH0MeTbZUGsaiLBbl148n14xcjnJaBGsZk33pmYVVVqxeg/j69s6jxxOWjKNPRc+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Uf8yhvE7QObRzpoQI9w9v/WOtnrxg9rkzyzsIZ1hj2jMsu72O39JQVKjUNSBPxgt7s4XSsCFu3VqOGY2GZ4Cx6fHZXOc7jiQOdZ8TmudCQgs/HRAxjfck1cwtKT5pTz4F4tPuxapu/kx7Qwbrp1SgplQtCSB4Xsfx0L3OFIvIgE06arUgLk/fXLVuZ6VaesSR2MbrSc/SlEMTvNejqKsDgGH3q8N9M4I3ErTeJWV3gCZuW3UzyOd3MGFUFdQKYFThh7j1YzcjNncl4xRzKzw/ZSqhOyPyMvrmFprixONIeji3vsZ+w5U5a0t+kiFahEbHyZCFUf8xswvpDjd2lH1w==; 5:r3gTkjSUuNAFuqQTmW/48c/kHWPHJo0oNSxbxniD0gnIaHSjpNXAY69Pyy6XD5zRfHJJVvR8bOAupVQpLeHnyQ9MRO9vG2Wsqmh8hMMTRCAfZpbFZQekkOMjm0l7QAIYJZP9NPYfr5px63hvNjnTjAcoF72Ap07Mml9AKFqd1mk=; 7:Au09e02QtFw0KCNbD9xOqUaVAo8ONMnDzzNR2dgU1kRY7dvFBuZuc8PwmmZrZpt/zlguOhtilkCaVD3BEjQo3Dv6EUl724ZQL+UIqLPzU2W3IiF8qYire/w9zjCRWVK8dVuwa5h/PgQSt1wutqaPwPvQcMdMTzZDMuEMrz+Nf6o8ZnHWIrTYC5Bk3A3PFSuzDYI0WSKWIm6kGx/iY2NGgrsXus/eMTHczkAIvEU7fwzrokCy5VN1kO919Z4IJMWq SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 07:11:31.1474 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72cbf5b9-6407-4074-339d-08d5fcfe2bce X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2617 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.70.110 Subject: [Qemu-devel] [PATCH v3 5/5] qcow2: Explicit number replaced by a constant X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- block/qcow2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 453a6377ac..a54e20402b 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1321,7 +1321,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; @@ -3446,7 +3446,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) {