From patchwork Tue Aug 7 20:21:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10559133 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 31EB313B4 for ; Tue, 7 Aug 2018 20:23:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2329528E09 for ; Tue, 7 Aug 2018 20:23:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1747C2A6B5; Tue, 7 Aug 2018 20:23:28 +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 491CB28E09 for ; Tue, 7 Aug 2018 20:23:27 +0000 (UTC) Received: from localhost ([::1]:40700 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn8Vp-0008Sw-Sz for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Aug 2018 16:23:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn8UO-0008SV-7k for qemu-devel@nongnu.org; Tue, 07 Aug 2018 16:21:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fn8UJ-0007oY-QX for qemu-devel@nongnu.org; Tue, 07 Aug 2018 16:21:56 -0400 Received: from mail-by2nam01on0113.outbound.protection.outlook.com ([104.47.34.113]:25184 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 1fn8UJ-0007lQ-Hb; Tue, 07 Aug 2018 16:21:51 -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=V6/b4rusnQuIR8IMXQW2oXE+NyUkxCFdOoS/KJsBzBFpmF0GBALQak/4kveEabwjmCIbPYNL4vl8/I2Zr0/7DuzEzLP5DhZdRo4Zk40JDgZovshkZ/ljx1JGYaI5RchsoszEwJrag9A6N0Tjj3YtP4gbN1P7voQTynLruz58DFA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by BN3PR07MB2609.namprd07.prod.outlook.com (2a01:111:e400:c5f0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 20:21:47 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Tue, 7 Aug 2018 23:21:18 +0300 Message-Id: <20180807202122.27006-2-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180807202122.27006-1-lbloch@janustech.com> References: <20180807202122.27006-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: VI1PR08CA0126.eurprd08.prod.outlook.com (2603:10a6:800:d4::28) To BN3PR07MB2609.namprd07.prod.outlook.com (2a01:111:e400:c5f0::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e4ccf631-8077-4734-8ca1-08d5fca367cd 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:BN3PR07MB2609; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2609; 3:GSY+68QmUwdvqaTEJHMFTg9XfrLXoCB4ei64sf7aMLhxep0HFWcHMScR4Lsu7xs6NVRogqhooLynq8m8iS9wdQDZkA12Kx5xgletbTTyqIOgwvhwJN8DJosH95l7JwjF9nsP9oGb9vfcqndEWzu8KlPsMHhN7O3j2la7gxLwz154aKBnrI8jVInp8WESARC+kWRj4aL6ZgYmdYWfeHeTNDeQL8Xk2GUyW/0gLPohsVPgivsw1L6JKouptCvAH8gl; 25:WlqA8PPG2bRXAl3uEQYeQX0M+NNIj/wNY6M+9sCu1ZdnGOPSaPvlT7LhXfwDbm+RwTue1KEkUcT1WA1AdFeoVNtJZTOmF/aDnWiHstSajDI6GRp1pGrXs3J0csv1wLiRvuS7QFzvBzCK3Nfak5E9wCulVB2zi5i8dc26q38iknbD3ebZWCPCsn0qtxH7XaBSgnbS/+fC8nLaZ2FAYHxCKwSLkgQbXTuq8xbV1Y0HlxdPFIGS+Bjzuw59eXf6rWZzAmBwJ1OykPNWfngAldFg+5Q4eYVvPi+ufX+aMYwkZSyej7zrul3MrnN8ak6eutHrDTzQUMDnyFrGWdqriDYRoA==; 31:YoaRu1fyQtIqnXjwaopBUBvmjQ0ILqg0AbUWm1ds1Mz42b9eLubEV2zzxB8JQu70zZpASSuox3pt3Zc04s09UYc5gmKV7ypIpPVNxxrN/JEZSvN4e25tx2MMcS09VhLRSiHBQrHEuvpbgn3NtjDVUBFoHnmDyMYVnOi5SoxznRw/vxAy2DjbdQRv3Q2j9ZsQZEJma8dxCRDQvIJ2InUC5r8S4KNF8roa7f0eTwTaQNI= X-MS-TrafficTypeDiagnostic: BN3PR07MB2609: 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)(20161123558120)(20161123560045)(20161123562045)(2016111802025)(20161123564045)(6072148)(6043046)(201708071742011)(7699016); SRVR:BN3PR07MB2609; BCL:0; PCL:0; RULEID:; SRVR:BN3PR07MB2609; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2609; 4:Nj2zbPXmEuxByXFeCDjbpAwjZkh9iDqV/ecPa8JBS+Pad85vmeevpsiYMRgxCwSk8+aU0NBQzWjq1RDJqNXnnUDQYs9c0+MxWKgRbo+p0DyvPKjP6SUuml3DngZZcEFpDD84AYLzfw1LEzocouqLBC1jpIrXriADivVa4dp3/AHCwIH3qZjJwq+rLHAohWzb2SMYfNjva2f47y0/sz+dapupI5TyL7RWKNbGxlgqLUas15fmG0oChV1Q1/ffOkAyVhGcINCOWmckukPjpALFjA== X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(39830400003)(376002)(136003)(346002)(366004)(199004)(189003)(47776003)(446003)(66066001)(956004)(305945005)(11346002)(105586002)(48376002)(76176011)(486006)(50466002)(106356001)(7736002)(5660300001)(2616005)(25786009)(52116002)(2361001)(51416003)(2351001)(6916009)(551984002)(81156014)(81166006)(6666003)(476003)(36756003)(386003)(6506007)(8676002)(8936002)(16526019)(50226002)(16586007)(26005)(54906003)(316002)(68736007)(186003)(6512007)(3846002)(6116002)(6486002)(97736004)(1076002)(2906002)(14444005)(53936002)(4326008)(575784001)(107886003)(86362001)(478600001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR07MB2609; 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; BN3PR07MB2609; 23:mGhtdbpulDooDAjWg1uRKXRQ3VzCfSHx0inSzI54z?= 0EnyUcDxY3I0w+St1b0qss/BADWiqFWPOPjLqbDpeoCrUc+IdxJAIl02oXT6FSyh0FB6QBrsBWoF+EXhcNlsllomEThqoCfR7jM2rZjKvBP9u68itzD5e2WXlakDCI/ZvZmJg2WLd1jEaTkNaBCC582osiquGaJrculVZFiBwo2NrMzYKeIwXA1C760ubK3sgwXTEWlUC9TkNxRXD1e8GAc7w/ARJ+qsHmi4c/AkOQohiftcG7ERdMqZpb6lZnURMPzRxyDwQxGkwYZOczNku7Upl0PK/UqS5A0BXvDP8PaHsQoSO4Y+agRVzx98PTy5VikA9b6RDNwCyG6/RLaP4Yc/TBTHNx2iAG8j5044QhY6Qe2vY6nvgcQfg42IL2E8bPWhMby5b6FM2jTB8I6JXtar720oHEsKdYMx83+zZS+JfUkWvxeJshiVzKU377i074AXrVer3s4aDCr4RJ+NreUElEdPPo2dsgGvYn0yH1kcdJxofbGkkXUtgueUvc5iwMx+Gz3PMr+p0MKHyiDPhzVFqosi9h08HUtNTSgfE7tWd1cva6nJnlQdtPIimgkzHcMjAi5XG1JTz2zvhzMo3aAspLV/I5kl03j5CeS6cCzO2ntuSJnAqPc6ZiUh9oI8KAdEmWQv4fk1ODGigL3D6+lAjeyoGNCFRkNihQVbS9bDth9PRFAFXsm/uqexJ2Sf2OWHZZcVJZJzJG8hdi91oKJXsVRoE1UuzlNYcgEm3rq8Dl72MHOLlx7W1QLgLHW3oxTKydK3qhr8ArKHffuMcQ0lgHJ390gUESE/qIyb+cVLxwf4ohrFS/6R+5ljzYhtNCj1J9MCH21gXkAC9xidrUYfx9GQ1P/9LoMUezzQoE4yG7WF96a2WZW93QSd7nhrWtwRkSkkuup54P2a2rO9p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OzRJ9IrZ2gCKNWSJaiqbqgR3li3oC3Zw0d/Z2kkfpFwlhl83JrZ9anm7wxOAW95kAsOkPwT9ROofJa4Q40FkfRWR8MFEAIIQt6xp/6FMUrjEVjMMAWjdDjV6ZfrhTdHeGrSC5RG3T1LDzjicekZO/qLvsp+yfjVpZ736BqZ5Mswlviq4Ve2J1YBElrx5CNhWQ==; 5:uMP8m5r4kS/G+w35V9sE61pTnQ+bsejzf9JNgGFeO34WfRB0TJQAyehuW8B8T8jiv5RLUkEXGDebNmqCT8BIGlk9eF5T+mtXW+ol0IIf9ptUxv5zpg94XNkJPh3WS+8+ICXOtI9NbsP1qSxSVhLbitv5UKtjQGqBIKnFQlQ587U=; 7:pv1wmZXOXa3ICVi0tij307j1BbBtcNW3rFlFN9UBjUaPUmOvLBwpgFA57Y2EsYwWnVyGNTL3M97cKDmgIBwGPbSxQy5muQbOmcerxi8yqxEysClfFFjPAi/x+Jc/7QPLhU47EqP0toD4ajsMO50d6TL0XqnUDaPpaoMTB0ILPZgJcn3a45nc8aNrACclQgwPjV/LVHIODvMzOLQpQtwkSrC1rY9bNjC0YpeRYToWizRT4oNv1QKc+qRiPe20nVNM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 20:21:47.8773 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e4ccf631-8077-4734-8ca1-08d5fca367cd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2609 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.34.113 Subject: [Qemu-devel] [PATCH v2 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 --- 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 Tue Aug 7 20:21:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10559143 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 8B19215E9 for ; Tue, 7 Aug 2018 20:26:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 791F92A6B5 for ; Tue, 7 Aug 2018 20:26:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BE0A2A6BD; Tue, 7 Aug 2018 20:26: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 6D7E62A6B5 for ; Tue, 7 Aug 2018 20:26:26 +0000 (UTC) Received: from localhost ([::1]:40728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn8Yj-0004Bw-6x for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Aug 2018 16:26:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn8Uk-0000DX-O7 for qemu-devel@nongnu.org; Tue, 07 Aug 2018 16:22:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fn8Ug-00088L-4N for qemu-devel@nongnu.org; Tue, 07 Aug 2018 16:22:18 -0400 Received: from mail-by2nam05on072c.outbound.protection.outlook.com ([2a01:111:f400:fe52::72c]:22811 helo=NAM05-BY2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fn8Uf-00086y-Ml; Tue, 07 Aug 2018 16:22:14 -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=Z9AYeYzD0bC2JGXP/DsRL51cdjXJLWKHkdVKrmkyn/PlFFbb5sdGeEFAK+SF941uAhD7a4Aj0zw1OoOt8DTKj32aN0nWrBh+Hm1J9Apx83hJGlqKFcn4bI1Qba2Iy9PO+Xye8vT4uVNLdaFPkabC60MQklkw324RHVBLN8hTuS4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by BN3PR07MB2609.namprd07.prod.outlook.com (2a01:111:e400:c5f0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 20:21:49 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Tue, 7 Aug 2018 23:21:19 +0300 Message-Id: <20180807202122.27006-3-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180807202122.27006-1-lbloch@janustech.com> References: <20180807202122.27006-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: VI1PR08CA0126.eurprd08.prod.outlook.com (2603:10a6:800:d4::28) To BN3PR07MB2609.namprd07.prod.outlook.com (2a01:111:e400:c5f0::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: adb17f16-c19f-4eb0-90c7-08d5fca36903 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:BN3PR07MB2609; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2609; 3:/Rz8uhUwqZywK0yqyV+o2cT61RXXXZ3w8D+helkdYzMyY8g1mrdynWes07nI+wnuCwmJEGWdI1YYw99e/f6sfrsYaIKD19TwuG3qOMCCxGcnJI03Tp/BEN30UL/B/yDMIMsLwgYkcJZ+Uig/aBLZCgKSNsWeULoGPZkSXrrbJIezf507PHshoC26mk3ii532D+KOajqhkwoYPN9Q2SQcC4Z0Jx8avrMyesdAE2jzbZILpLdcaACVHNz/5UU3xozo; 25:umZLaHnoWHXZl25Q08tB2i7gW9yyFvVrMSZP3NZWNgyhvQ6PjBs8r4lJ5xQmxMfR0l8Hs4FOEkSG5p0gcyfgEXcbM1IBQ0QUH6XMhYeSaVQJsLN0lHxqySy0huSND5rHKbat6ijzZcaBkV+LSLYdiFSAT+9mKGPHSnPgG/epBi3PDreiqJU2lMxvHs4UyjQ5Le7CLjXDWIL5NxXZdIwMug4j2oMvVQK2lWyCsHwVF1XpXO5azwgffV/5e5OnnjaeKT8llFSSlLaommK5hCOBjvkQlCa/3t31GLd26bJVMbg6y4vegbHTkgvi62/hiWQ5TzegWyt59NuaXGukP77gBQ==; 31:SVCP4wCC191LS7swRr35reYvkyFd8yPk8nkHqeH/tpQl+KGTZM5Q2oheNln7oDUqEMT0iwx90GSUswz7NXI8kKoHRdb+HjenLuJsrF397i1KOwQadpCkKVQ6B7TFjOpzbipye0E+NUDWhoJtpWSYvVI4o2NjS2GzyVCl/bbC0Ze18i2iaXIW76LpChfZuyTZUWtyzpGxVSsMRcvNL2OGt1cOvpzKZmI2vnEfZDiZkj4= X-MS-TrafficTypeDiagnostic: BN3PR07MB2609: 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)(20161123558120)(20161123560045)(20161123562045)(2016111802025)(20161123564045)(6072148)(6043046)(201708071742011)(7699016); SRVR:BN3PR07MB2609; BCL:0; PCL:0; RULEID:; SRVR:BN3PR07MB2609; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2609; 4:azVeqiwR8hoDW+JfSK/VYpWo69GPWHwb5XYwYfAxsyHliIIAEnbOW9nL1F+jWdIhpEvjEU1QMfBWIaUqvdWlIXh4vxuEzcwwgv3VMoz71yYVTZ7oGMEYXcbuWROgdz/xEjxNrZmSy9tAYQ/IH+PE9U8a4bX0SAAZXwiFcBTbdljONJBsC9x/MmLmr4eeL4R8Ogb6LkUbg8CxLKRm11syobLUBKR+Y1kRNoVKrNN5KmlK6l+B2S9zzA5m0p2Q+lIzaH3dOqIDAw0cqDHsitWYqw== X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(39830400003)(376002)(136003)(346002)(366004)(199004)(189003)(47776003)(446003)(66066001)(956004)(305945005)(11346002)(105586002)(48376002)(76176011)(486006)(50466002)(106356001)(7736002)(5660300001)(2616005)(25786009)(52116002)(2361001)(51416003)(2351001)(6916009)(551984002)(81156014)(81166006)(6666003)(476003)(36756003)(386003)(6506007)(8676002)(8936002)(16526019)(50226002)(16586007)(26005)(54906003)(316002)(68736007)(186003)(6512007)(3846002)(6116002)(6486002)(97736004)(1076002)(2906002)(14444005)(53936002)(4326008)(107886003)(86362001)(478600001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR07MB2609; 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-Diag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QBNl16Ce7Dr3uQOaQnwYTvEwcMkqwnJcrJNYVs2Rew26V9OR5a4dCN+mlDZpvG/bQz+pQi9eIZUt8WtPyM6yFfhWSLvKUZyjJAVAZLGWKqBgIULYt1FXtPN5Ezcyc6E5Fbuh+/An4qcT1iA74oH6sCQ==; 5:acFA6r5iAKF/hrGUUxh71fRx5nsMTAO/KbtdxmPV+7/ZmnkvwKPUJp5gK8PaIUPWPehwSqxevH4C9oGoOPR/pNRBArNEEQtsP5jDS7uxM+VL6Onr7hPZt+jlVguGkz2Xubl1bMnleg7ZV9Bkvty5WrzqVQzjRhjf1S9Z4Zrt/9Q=; 7:V0BMeTZrUWjsU00wouQGTeTnfStcH3YBQvHwStaDu8GHgZnEkrhKc3S4oKNUVLMwRrhEbbSKnwo+s4B9gBYIJk6caXwvFSSQBdrE+HTHVGFazyYNGqRX3FsVDl0Xp9daAeYdJqbdGVmoa1BlRD0oufTzjB0jhY0KyMjwPNZ8n/jSgKqpKlXV4iEBHqpGoyJKS+uK4Ij9hMpP03D+9wFyPBBuobMnSuDJFI5n+JzEqs0DO8yZjfnbhrO9+3piYPLD SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 20:21:49.9090 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: adb17f16-c19f-4eb0-90c7-08d5fca36903 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2609 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe52::72c Subject: [Qemu-devel] [PATCH v2 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 Tue Aug 7 20:21:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10559141 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 3ED8D15E9 for ; Tue, 7 Aug 2018 20:26:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 255DB2A6B5 for ; Tue, 7 Aug 2018 20:26:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 176432A6BD; Tue, 7 Aug 2018 20:26: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 982E82A6B5 for ; Tue, 7 Aug 2018 20:26:13 +0000 (UTC) Received: from localhost ([::1]:40727 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn8YW-00044b-Sl for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Aug 2018 16:26:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn8Ul-0000Du-6s for qemu-devel@nongnu.org; Tue, 07 Aug 2018 16:22:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fn8Ug-000891-Ll for qemu-devel@nongnu.org; Tue, 07 Aug 2018 16:22:19 -0400 Received: from mail-by2nam05on072c.outbound.protection.outlook.com ([2a01:111:f400:fe52::72c]:22811 helo=NAM05-BY2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fn8Ug-00086y-D2; Tue, 07 Aug 2018 16:22:14 -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=YiGMEmTvNJlrMvIKlnte1F771zexnzgNaYmYKsWoUppZ0iA7bCxyRdzk78esOO45EFrtBI19A35Qt6TyNEbYa3pZtAZf2PIdUXceREqr3GwG4lLBSg/XcuXjlLuca65i0Bd5qJqE6oLkdo9Moq16k1DO2MaI/6kEKoY63oulIrs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by BN3PR07MB2609.namprd07.prod.outlook.com (2a01:111:e400:c5f0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 20:21:52 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Tue, 7 Aug 2018 23:21:20 +0300 Message-Id: <20180807202122.27006-4-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180807202122.27006-1-lbloch@janustech.com> References: <20180807202122.27006-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: VI1PR08CA0126.eurprd08.prod.outlook.com (2603:10a6:800:d4::28) To BN3PR07MB2609.namprd07.prod.outlook.com (2a01:111:e400:c5f0::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3afe9e47-74eb-40e3-2b8f-08d5fca36a52 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:BN3PR07MB2609; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2609; 3:Jz+e69PpCXC1TpQWYuPYCGGOvHX7hkWhI6r2cut991lLPLa09e8oZk5G2GJi3ewh6QGnfqDggVGtWaDGt/gzkSVnJh78mxXpFYnfcO7H01n7lJoFcRKR3IgIcMV+g35iqSpesmQ0X1kcnmV15MxRPn/Qg+R/Xx9/RcHSJb6aJKwEoO0HBhz/I62Px7eTrHZFm7La6zO4aTUEw+XJD+Ka+LIgDzlfhaoKUgRfJLDpZDKujV47nHdnkF/quHcKLkTm; 25:dSmUZSMW0YrRLv3p3VwgyFmZcptdAMDxjGXM/J/QqHokSKMJpy2zVNl2vsdJLD/q84XrT+7rbX3elVNFXospoGj/3Vlyp1z7h++Zi0aWRTbYifRaXTCWOOWgEBRrABFWoLTSI7F4Q/+Luk8NClK0gSu65Wo7nl1zhtTSk9lczzkqktIomGZKprbJjBnubj2bS1E73jmzt9vaz/h3lzfV9cFmkU+TOxUJX2qDjb+7AV8gdMQq4BUnKdMLH3graT0UmybC7fBmJ78vDFx0kSq1eKYXuMEUUG/CcW/H+Q2B3rHqJi0Ag2qlVbhzw4x2x2H5u6rA+BxZ6YFPir6d8EMdcA==; 31:tAmnwQ1wPvJGr1061bPxeKlxSwGZzQvsAqlm7JgOg03g/unt88slDxZzxxb3CcKMH2R01wqxmEq0tY31ooluBO7RmWtCpNPgurJuTZ/jSwJKy+DLdqpNQsPfRwNAfePSn4kKQCOLqWj7zT3J0cRZId6lQ5nNc93lfDrz8yX5bA0f0gFhPOYUryeeDuuFogif9Dt6JhZnaWvucqJbyFPbwA7zG9kfySVkozV/+k0smok= X-MS-TrafficTypeDiagnostic: BN3PR07MB2609: 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)(20161123558120)(20161123560045)(20161123562045)(2016111802025)(20161123564045)(6072148)(6043046)(201708071742011)(7699016); SRVR:BN3PR07MB2609; BCL:0; PCL:0; RULEID:; SRVR:BN3PR07MB2609; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2609; 4:TPk160aI5ljhNXFA4jEjmUi+n4KjKVNK/OiU+Jki8puvUPDfuP4XhUjYLzPN0Ze6Wi+rDZaBjhV+bGe0SXOMkGBVqcCP7lhRktF9EFkFoSwdMLpequkjHiaZmZDRzgxoQJZfu8tMIfEimWM9kcDP0rIkOgPw0J87MCVaAx6/P6bxrWAbi9bnocNukqJD54wa6dgnHQCwdhGD1SHKo5Dnc/Zje/J6sPVSR/cbUIz8mScRZhbEEoLMS7IdgbxlsvGR5o89WoZWpljSgj+NsltC8A== X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(39830400003)(376002)(136003)(346002)(366004)(199004)(189003)(47776003)(446003)(66066001)(956004)(305945005)(11346002)(105586002)(48376002)(76176011)(486006)(50466002)(106356001)(7736002)(5660300001)(2616005)(25786009)(52116002)(2361001)(51416003)(2351001)(6916009)(81156014)(81166006)(6666003)(476003)(36756003)(386003)(6506007)(8676002)(8936002)(16526019)(50226002)(16586007)(26005)(54906003)(316002)(68736007)(186003)(6512007)(3846002)(6116002)(6486002)(97736004)(1076002)(2906002)(14444005)(53936002)(4326008)(107886003)(86362001)(478600001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR07MB2609; 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; BN3PR07MB2609; 23:R4yQgDSQ0g3iYDuhjDll506iHaJ8MMpL/40ag8HpU?= FoErJh3+EZAT6QBWcL5t9enkBkdTlG1XYExhg1U6+GKS5Jxg/b2F5vmKVWmjWl7Ath5YBPOHRi2XLBxt9r98TFa/eq+Qt/2BTBtKg3vkneRpQamb1QCEzHZULR+zCU2Pwt5tuVMHTfyr0xKYrs4oMPuQ6dK13sEXybvwPXt2JNu8B22cdwR/i+uSOT4GSVsoj2ks3WEzA88MopudrDy2a2SuHH4mhjVoPG3sDMFrNE3PW7dxNhCiC6PjFcqPVm+YNHakcHjNvRPuxiBfg/fbuQ3EN7LyPXCMqIUkbinbfqlKbLUibDA0iH50W5y4m084cd3Hr09gGypS9pSbBAShd+IiMBFj+tfvEXsbcelBjbxdx6UstNDHYxB5mck6FpdiZO8QCQy9/KvFh4BMJIfl8DetQKWhgcBVEfXIzJthd1aFsmqtC//8pOOBbFiJId92GjnTIeuGzv9uCqrCSc/K71g/UR2PvffwkiQ54qCCNKIFyX1KZLStvm/qvSwXF4C2RcHrZfG/wKVOOUnLHt2Wr3M9STcICmcrcdYfe3+WTD3P3JCWPA/Ar7kcKeYDZH5iWEn2w9c5XPdUmW3JuZRuNTIwOMy6FUi9SUmVgAbLVOzYfcLbRzOBXRCWDVc09sQY/27DKcDCAMNKPfeu+6CtVxPu4ucjBWsm7dbqPkV8ohh2Fj6pt9xZgN2fRHm/LBCo7ddm9v3GHvKovewaMUufN5Tu4Wz8EvoD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4W0uQtbS0q0jND1d9Dfr3sI58mXI/tpfBUFSvCu2+EaEjMVNTsixBZ3oiCxaUj0KOOgUZKf9lccGmO2W9wAajmh4m8j8RnO21HSCgSVOqzqJzwjpqscYPmDtqN5HDw9SxwqHH5PC6dOpmZmM5I+pCo5fImzl8sWu82CyncLEhZ0dYQ1uHdDmLHXG+y+gWoj3KQHfCweakoXKxss6CZDn6osZcIVEBGgUW3GFt68fQeNOsKopxYahY8Vce9r8sygPiDzEbO8MDy2qTOyMbmi2ZKlaZI9yTujr1WDuoi10Bq9uWWSH2S+JVSHGMeFozIH5YUbgoQM38lSMhTP0+1kZYqgVvda/oQ==; 5:FYGZDyeH9Xckn6xlGo+i2zLcTTVH9sNBGHDt+zYzQvFfPu5re2AO0s3V6dY1F3XDHESD8jCa/f+2PV3XzuWjDxXM+0i1B4yo0+8KJVKcuACzZ65cDJN5emEvqINChhWg+tThGUuWTFlYOq2tqmjgWzVFdegoAaTVU3IiL6aRqNY=; 7:g/rrrytCKTGAIJAqMPIh18wlaT3Fo9tqskriXAKOxE941bU7Upq5Lgf2c2rsRq0Cd9dIjPoXjUyX2Y/ftbGgHvuQw5Bnr+08MprQWu812HzzpcxV8PLRvcLDVz3bvebGlCEJt8Ow+mBOiKXpGJFk59D7+c+Ai7sxr+Q9vPTrONmAgamHjEuBHWGl9hHApy6bENIV2uGpTHc+u3QBWSTiBMXWgrLLRZGTn0KJqv6vl/S4CfHNzO2OAKy+ryoo9e1c SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 20:21:52.0988 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3afe9e47-74eb-40e3-2b8f-08d5fca36a52 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2609 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe52::72c Subject: [Qemu-devel] [PATCH v2 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 Tue Aug 7 20:21:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10559137 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 6B437157D for ; Tue, 7 Aug 2018 20:23:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5998128E09 for ; Tue, 7 Aug 2018 20:23:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BD1F2A6B5; Tue, 7 Aug 2018 20:23:56 +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 BEF8228E09 for ; Tue, 7 Aug 2018 20:23:55 +0000 (UTC) Received: from localhost ([::1]:40707 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn8WI-0001WF-V0 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Aug 2018 16:23:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn8Ul-0000Dq-5j for qemu-devel@nongnu.org; Tue, 07 Aug 2018 16:22:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fn8Uh-00089m-7g for qemu-devel@nongnu.org; Tue, 07 Aug 2018 16:22:19 -0400 Received: from mail-by2nam05on072c.outbound.protection.outlook.com ([2a01:111:f400:fe52::72c]:22811 helo=NAM05-BY2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fn8Ug-00086y-UB; Tue, 07 Aug 2018 16:22:15 -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=ziA1YsklL4k7LHLFr0hfWuYaj4WR5clhZjBOP1QFUAc=; b=joe58vKP+pJurB97wIVDKxO5XR8f//VKlXfmEKg5WJgAU5SPy10R9FlNZtt0+0CAahGHpLDd260QWgzjeGXvJ19I5WFqoXScR8z45OXJ+yRBe6jXAJ2HJGAWMKo3vdjut6npYPjs7Ta1YeO+HbdvtBjoNuK4AZBrQbx+BFXPmEg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by BN3PR07MB2609.namprd07.prod.outlook.com (2a01:111:e400:c5f0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 20:21:54 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Tue, 7 Aug 2018 23:21:21 +0300 Message-Id: <20180807202122.27006-5-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180807202122.27006-1-lbloch@janustech.com> References: <20180807202122.27006-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: VI1PR08CA0126.eurprd08.prod.outlook.com (2603:10a6:800:d4::28) To BN3PR07MB2609.namprd07.prod.outlook.com (2a01:111:e400:c5f0::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05822818-27b0-4a4b-52fb-08d5fca36b8a 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:BN3PR07MB2609; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2609; 3:USlFy2KW41XafkbUQXQFqeYkIC27unghC+t7mZgvM4oFgSgBAmv9FnW6ug+T8UQkNmKlbQSqUy01rq9CHuCpoe4npofioYd7BmNSwpQHMXam5OPg+legkIFYwAHnX8AwuaPYTCFyiXIOnfeLGlHmZP6W4pPU7KazFFz/yfMbk6IiztxAuCrTl2+4BPxA/ect4a8WKFqIkh+KxzsDfwrXLHtcnVNInRVavagsKRuj4JRJw8P8q2yT2VfYEcAzOqjh; 25:SdE3zad2y4ZUlr99jw/gW+qc7M0oY0ciGoBmh4d5JIsdCrWsYO9MmFsFqwLGNsr36L09szueFrXnS1dhy19Rl2iUIo9MxcvKYKOlz0o5PU1KLFyGi7c1KECgqmR9llvjKACJ+lYXFvF/ViGAZPZ9sPESEXB6PVU7ke8a2sfGNSG/oLJ4moulaMYiJZWDGFu0HlBB5jeSOYfji6dNWM8psPUoKQ/PEZb1xdfI8E5sPwCY6ty/BWuUD058/DXjJ/9TfDC11QDVSaHbBp95Ol1YAR3c0mo1Cdj9WlaezNYY8VxG2fZE9JhdYlncMQGgSAcRT+Ku8K2a7Was+ruZtVdr4w==; 31:93DNMYNyV3rf6vWduqfpJ8pd2D+Qg+M6TmkimGqj97cboZus+guKXOfluIxYAIgAUX6YE/HDfLfwCibz9EbGUOLseBSm03jautwewr7oY4MYgc7idn1ZBWo8Pw07ficskoNKeQ1VrMTnHARUNJtWZG+RXKOnhQbkoFOdea3C5FF8k5yIhCp1zrHm1o2B4037kGTfN/zSyMQ1XBYNi0lttDPnXQrEcQEZ94/eNSmmO3g= X-MS-TrafficTypeDiagnostic: BN3PR07MB2609: 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)(20161123558120)(20161123560045)(20161123562045)(2016111802025)(20161123564045)(6072148)(6043046)(201708071742011)(7699016); SRVR:BN3PR07MB2609; BCL:0; PCL:0; RULEID:; SRVR:BN3PR07MB2609; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2609; 4:5IOzFSkdL0hT83uYqf2Bv1L3YAqqrOz2tUM6FMhAWt4d53c2q65g33eg9yxztTqxa5p32ojJv5jkGUK3LHoAEm4va25L/K4mBweZ+Cm7Ar4BZjEn7aD2UszkepY6CUHOyGjnaLKaIbUrGWW3Thu2x0O6aMoxruF0P0R5xh1K0UYnOb7Pkeyc7xOgaCSOx7wJV5rFvB0g2ujAyWGYAqnulHX2nJsut4aVD5pNZRg9b5IpdfVaiX+S3f3XL4A/Wc7FhhM2zQ+1x8SL6VDl3EEThA== X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(39830400003)(376002)(136003)(346002)(366004)(199004)(189003)(47776003)(446003)(66066001)(956004)(305945005)(11346002)(105586002)(48376002)(76176011)(486006)(50466002)(106356001)(7736002)(5660300001)(2616005)(25786009)(52116002)(2361001)(51416003)(2351001)(6916009)(81156014)(81166006)(6666003)(476003)(36756003)(386003)(6506007)(8676002)(8936002)(16526019)(50226002)(16586007)(26005)(54906003)(316002)(68736007)(186003)(6512007)(3846002)(6116002)(6486002)(97736004)(1076002)(2906002)(14444005)(53936002)(4326008)(107886003)(86362001)(478600001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR07MB2609; 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; BN3PR07MB2609; 23:3e6mUaeMc0XVtGYhMIX/G3WOTQI3Q+5GQ16fHIp1v?= Ehd04QyXrUavY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:fIONkk1ke9CTMkhHZfHHr9NqiXs30VgU1IBGv04QORFMomCfm9sAXwf5unnzPpIzuRbrZJLKJqDlmCxg4t+uPqe7uupAFafzRzbGsP+4O/jWqYiudJ7s9MptRclkBeLSij4DasEJ5QjKa1lKUD4qqhZgQw5fPmbgT3N6ewKuKzM=; 7:P7uKke26SyVW5H0gCMEQZJF7lD6yHpEe243t+UBkWb+Ekh7vIG/Y4y9xoVRmDH7PtyhXLCqgj8J7EWPzXq5vjxwuMJ4w6zPY5/jLFzTmp4HA88a/0lmD7l85fZn7zHxgr+3vYGMRpiMsxkVA5Tq9BlSm2FeO45QOgUNKpb8iSk+M7UMs/IwzO4G+dhEMz9EPbZFUaaHzr6YRiouUrQzRnovo97nZ2k/uj2WHsCnzdhTEUmm2/pRsPKKa62iy112q SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 20:21:54.1456 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05822818-27b0-4a4b-52fb-08d5fca36b8a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2609 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe52::72c Subject: [Qemu-devel] [PATCH v2 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. Signed-off-by: Leonid Bloch --- block/qcow2.c | 2 +- block/qcow2.h | 1 + docs/qcow2-cache.txt | 3 +-- qapi/block-core.json | 3 ++- qemu-options.hx | 2 +- 5 files changed, 6 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..1e6711a63a 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -202,8 +202,7 @@ 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. 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..4d8fca9128 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. (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..0cda3d3c3a 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. @item pass-discard-request Whether discard requests to the qcow2 device should be forwarded to the data From patchwork Tue Aug 7 20:21:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10559139 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 CDA14157D for ; Tue, 7 Aug 2018 20:23:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD33628E09 for ; Tue, 7 Aug 2018 20:23:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B193E2A6B5; Tue, 7 Aug 2018 20:23:58 +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 4A02628E09 for ; Tue, 7 Aug 2018 20:23:58 +0000 (UTC) Received: from localhost ([::1]:40708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn8WL-0001YA-EZ for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Aug 2018 16:23:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn8Ul-0000Dx-8J for qemu-devel@nongnu.org; Tue, 07 Aug 2018 16:22:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fn8Uh-0008AZ-OP for qemu-devel@nongnu.org; Tue, 07 Aug 2018 16:22:19 -0400 Received: from mail-by2nam05on072c.outbound.protection.outlook.com ([2a01:111:f400:fe52::72c]:22811 helo=NAM05-BY2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fn8Uh-00086y-Fq; Tue, 07 Aug 2018 16:22:15 -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=O+v7IcLCEROuOEOhCdQQunTZiMVbPpJ/2s/FxFmMJeBvEx87wgsUXpqnhbw5O4arxGkXaPSh3chnqEzIDX/d03S0W5jVjchlg7q/jG6rf3sgVm9OX9JN845mYmMt6Ho+luxux3By3apbSwLNUa13HilWjKSQr3smA/SuwZiBSOs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by BN3PR07MB2609.namprd07.prod.outlook.com (2a01:111:e400:c5f0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Tue, 7 Aug 2018 20:21:56 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Tue, 7 Aug 2018 23:21:22 +0300 Message-Id: <20180807202122.27006-6-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180807202122.27006-1-lbloch@janustech.com> References: <20180807202122.27006-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: VI1PR08CA0126.eurprd08.prod.outlook.com (2603:10a6:800:d4::28) To BN3PR07MB2609.namprd07.prod.outlook.com (2a01:111:e400:c5f0::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aa69cb4e-15cf-4526-29d5-08d5fca36cb9 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:BN3PR07MB2609; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2609; 3:Fb411odVDE4bnhhujXFLFKRG/DWRjjiEWZcLhMFMiJ65GfhzLdgRdh97Dd9vpFoBfZAuss7Ae3NffzUOyfMmX4OjHEmEqzF1K8IwUSnu1FKYiARANMO8PeG9eSJhRMHQxlcWeYUhuWWhkgzRby+307VOrJVdqPN7mx21s8F/lICswUmeNzB5/utun4IZWIjxebuvtRURZp79XhSaj2AJfzl6lx0KC6H98Ef8F/aYJL4pmsrFR8+DC0ntv4Ry8hwY; 25:NSvlcdpC7Ge0ZgrdfWnzElj806A/gddGvRexGXop/jP0VFU2IVH73Lw/2mvXjFvdohMogRgLKFweX3TqXWXNpK6Z1cL5slA8QHv5OtiTIyw8bKVGeuomXZPeYCjcFT4p9tnhnUnra9HAVuljvOPxvLfvmETHB7cAvS8E1Tw3x10CUbRT7a3FgvIUNRQMuY3hrNN+Qr0OGQaB7IXO4teL5V9cKcE8JvfMPOLZWvof7MPzUUbLYgDXXaaAfBhW11TBJNaurWXlr+emNjPKqGPh+6ENk2mDihvrbFVpxXMTFDI+FXE+OBtsbmYjF17lO0UleddJGbLLZTmQtpIZrbTzUw==; 31:DlSwgy/PHpkMeNQHvo1/nH7SxaAX9suXqt0TUDCKYj1qc4QA+NwwZ/0vQH2mStbPVXI1SJKIMzT2sDIt3pS7dCBE4aitK2rX11NmaJPeVJaMaKpOo7WfS2FtQ5X3o9jp9EJuQ7dY/MWVh1WFeyaX9mjGpwtvQ7dKHP9DwW+zRmS4IQxqvKIlac/+NI8QBdbROpSy7RHwBwq0KeuYj3xakun0TNFAbnvA0EL/EkI1dfE= X-MS-TrafficTypeDiagnostic: BN3PR07MB2609: 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)(20161123558120)(20161123560045)(20161123562045)(2016111802025)(20161123564045)(6072148)(6043046)(201708071742011)(7699016); SRVR:BN3PR07MB2609; BCL:0; PCL:0; RULEID:; SRVR:BN3PR07MB2609; X-Microsoft-Exchange-Diagnostics: 1; BN3PR07MB2609; 4:pktNFu6xfzo/jw3Ecko8eYwPUN3GVL7vr3njyD87uPEoNcALx1UeC++jWGwsseHpilWYa5qCR8x0sLhl/JYZnqljdRL044xdkMLr0o41gddJh1TshPsfJrMt4ATS/nA34agpCfrIq90w146GfXjtoyHOQ0nFrjHSLors+F2SHX942Dc95LVkUDBTkT0mRZy3hu/4QAMCxHcWV1dCRpopL93nVbIlm7jJeK92RCZFlQzsKpLYuf+9lzWDcyXiBEBr1/Tc50nifvd6TxK+lMGmCQ== X-Forefront-PRVS: 0757EEBDCA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(39830400003)(376002)(136003)(346002)(366004)(199004)(189003)(47776003)(446003)(66066001)(956004)(305945005)(11346002)(105586002)(48376002)(76176011)(486006)(50466002)(106356001)(7736002)(5660300001)(2616005)(25786009)(52116002)(2361001)(51416003)(2351001)(6916009)(81156014)(81166006)(6666003)(476003)(36756003)(386003)(6506007)(8676002)(8936002)(16526019)(50226002)(16586007)(26005)(54906003)(316002)(68736007)(186003)(6512007)(3846002)(6116002)(6486002)(97736004)(1076002)(2906002)(14444005)(53936002)(4326008)(107886003)(86362001)(478600001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR07MB2609; 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; BN3PR07MB2609; 23:VsAY+BmKGDpgeeUAfWYhop1/xmpaEiAWinDRDIbrU?= EgJrDWR1OwfKGyAiPp4B2LUbqbtql5pdBk0kbW8QqsnOfRha1BhqraQ4V6t+I0kL+f0Dd39zPWMMFOwkedSDRVSAPCNpB2QnF+T85yGeV7z34rAzjD4iqtbZYYo6unWA8VEDRwB5GMoeqscCApkZNYYQW5pcl/Hr9FAZnm6PFwohigt0IrlH2mkwNOM8iUvYR/Sc9cAYLPNGntIA2/oPBZclX6FfvD9YE29dWPR+75FfrqypJ9Oy8LYeuCTg8obFI9B2Pz5BY/HsPM//07LQt1RkU+Exvw10oOMQgZHVHuBDO2PHQxvPEIgiXrprjBcIHP9FOV1MGE6FTFwLxn2WyAZdqxDaxHeoO4kiijiRr0bnh9PCP1Qv7IubZPOnkg0MZ4R2IV82XsHg1gtuF0aHL+ejbnW+PAuJAqG4cUzx1D4pvebd5FPunT0KpQjArajFb10eGF3KScaW7GgDYCxWpxGUrsLzHOIlljpEKbJ0R673MMX2LeMb968UmIZg3CsJtZyobsbGsCovSlT0z+O/U2dvFLYJbcgDO5/fnRtXm8fuqAAeUeZXMnHA/m4YoT9auDhRbBxp9d/0U5DBf7uSS49S7zMlU4USJuIffDZt76jZrhSrDEIw72vmp1PQ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27n6rGeAkIcTvmXdf0/Degus7km7bjyP7Pa6U0eaiK67aiKZA8lr7ZoySCdASeWk2XIRzQWEtikFZj6YtD42WUX1aCNS0aX44E6WFCR8nqHWZRkYE4MnOc+dWOMlI39KPc//8yrbXVHG9Z5yFVgSFxmnYxJf3aE5BfHwR3nhfnZISG+FMHu488L7oZ5vXXVjxQPjIm3OJt8ZRhQdDSdj9mIBWyec/OFNY/1PfcW6JFQNm3TZWhfWjHlz3w+JO866b+YIz7jixYbvp6uZzQux8WDRTMmG6p32eImN/fiDEIuyBl9k3uyrlyKOM3WLwJgn/Wh6mXrcGb/q7RADehcvJqyUx4Oo/Lmy2DL1HCqdDQg8jHDX8yab/6D07Cbs2BY4K/hYAbAJIKnm4da/1DFXJx38oTiqftj06OfEKwigSRLybj4AQKN/hA==; 5:g67FFdtH+heBskswgjKEVxDqKeJLyGY86ugsyRYGZ1Y6fnyhs/d5ONFbPWhqCakztq8vaNpcnIOWaaTYnR5bXpKtU8seRGEEIcZfSPlcPtJAF7+MZTwitGJ8FAMuf917l6Khah87/Kgn5lBNMFgHXGrKvrQTYp+Yd1Ct4WTEDe4=; 7:5i3dvSuWFKwIQybVsHQ6Z1FQAZJEvehQY5txeeQcWQ5dcSadnd5CvBvLbS1KQ6MK8DyUudbOOhO6K9Q2RZQvSsOvtrqqzpxX2ZMNkkEF24FrNxgblW8tjnzwQCbBpybUDT/7RB+YhgEzq1tPlnaraMYwtHCubBwLgdfnoqiXH3Qn5aecKe5iiGPmX66qVVQnufzFbflC778HlB0n8gyY6VyhKFoJdvfdR1dXP4Ydvo4X700PX6NqUX9M4ewLijMi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2018 20:21:56.1273 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa69cb4e-15cf-4526-29d5-08d5fca36cb9 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR07MB2609 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe52::72c Subject: [Qemu-devel] [PATCH v2 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 --- 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) {