From patchwork Wed Aug 8 22:11:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10560515 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 A178413B4 for ; Wed, 8 Aug 2018 22:13:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 942B72AF13 for ; Wed, 8 Aug 2018 22:13:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87D882B05E; Wed, 8 Aug 2018 22:13:30 +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 EC79A2AF13 for ; Wed, 8 Aug 2018 22:13:29 +0000 (UTC) Received: from localhost ([::1]:45681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWht-0002SG-3M for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Aug 2018 18:13:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWgf-0002R9-Fu for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnWgb-00026j-UT for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:13 -0400 Received: from mail-co1nam03on0114.outbound.protection.outlook.com ([104.47.40.114]:31488 helo=NAM03-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnWgb-00025R-Mk; Wed, 08 Aug 2018 18:12:09 -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=sfv4WbVmigvgVMNOFu5+A/uXtUGn7+biya40VPMOagXQYi5ZwIPgFsDrtfV7oV7ycZ2Zr9idZAxYfi2om4rIRM2pvtDrMgKG4hcC53pmygIraThfHp3XBB8ueLMNAnQYNd9aCQmB0OT1Ym5MpeNJ6h6qcHaPccoT9Mbkkmk1zWo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) 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 22:12:05 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 01:11:34 +0300 Message-Id: <20180808221138.5770-2-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180808221138.5770-1-lbloch@janustech.com> References: <20180808221138.5770-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM0PR01CA0018.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::31) To CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b2afaa91-f6be-47a2-8869-08d5fd7bfac6 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 3:yfTQxrV8+Il3yo0h+sE4dl84QDN9ewH9r4YOt812nbIM1m+xDOkW2nyn2tGFGxnpJHddO6K2AKdpYQ3Xts5VVHcg7gD6/sImQ7WxwrjB+9CIy7PGPEHDrQAPhjXFTqmQzFbzY6Kw0OPVF7vfISWH29bv5KfoKV+uCv4qX7qd84MHaVq8AC1ibEK/AoG5zyIXjHF0TVRaihdfYQoA0fBnytBtn/z2MeiEWY7yuDJFVog5fDCzcnQexX2rDIh4pV5O; 25:yOyp+91ylrCkDyHnqAxnr8EQpTfHmtGi3yD/isvBhSBiuUmh0y2l9F9sXWxmyqFrCXTdk0FgP5PMFn9WlpSQX5Tu13U4Msa4a2WwYIK/XcZswQEEoHy6fTOFbrTRks26c6L65EoEBVzUyCZkyW0oMTDWlViEFG5JXzUFRepZMRoodX2gNij38VkH80LlRfvrG2xhXRxiRlQmZZ08qFCCUMvXPYBHvttwLi+XJQUHi2RgXnDfIFF1Y5pDzizhy8y5nxDKRNh1fFqWJNmwGONsgGrLe9nC0GPJ2luaH6gUH7tPFptqKtQ3qXl2eb+Awd27l5iwWAf4c58x06RWxhpjjQ==; 31:nxqTmyYd9B6p6yqLPzfDjHxUxSwSzg9AogaU8qqRsrJHHPR7hYeebLftH5dlI+UyXeGEgge1r3rbEM3z3AJtB1z4uZr+cY0BWVKW1WB+6Q0NdShdvkahjAYYlf6mBinoxZsveKvXW9vXWRe0+fNPQ1p1rucC6CR1xUf1UTalGRyOJnLNGx8nuu8IbBocHwrCcRXa5ToJFQyXGyvGTDhhFJZp7H8b8Qq5U83hXIQSRVI= X-MS-TrafficTypeDiagnostic: CY1PR07MB2620: X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123562045)(2016111802025)(20161123558120)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CY1PR07MB2620; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 4:yjU8GMx6sMi8AOVDyLetpILFJCuwI5oauVtNAsEmas9jBpTbZy0nJa4gVxqUtPIExvMmZtrSlCdYIy6RE7gKZeBSm7iPey9i8hcHf9E2wP3Y7gH0jlbRNzdVDQ2hIVwS2HZd07Szq7Zz9nq6LqgHjKU8aK1KqgqmG3m/khb3Xu2PWqrTTlX7bP+U7V58K/037mgfOvu2WNGCYDsmsWoIwwQhMSsT0kgrHv8hVNjDb7V1jUQDJ2v1Pq9Uc6xmhToc+xYj7V3QsDXdm57SZI52Ag== X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(366004)(376002)(39830400003)(396003)(136003)(189003)(199004)(52116002)(6506007)(386003)(106356001)(97736004)(53936002)(68736007)(2351001)(105586002)(186003)(66066001)(11346002)(47776003)(14444005)(446003)(81166006)(551984002)(8936002)(16526019)(76176011)(2616005)(956004)(305945005)(6512007)(476003)(7736002)(81156014)(26005)(8676002)(486006)(51416003)(36756003)(86362001)(575784001)(6486002)(50226002)(4326008)(107886003)(2361001)(50466002)(1076002)(478600001)(6916009)(6666003)(48376002)(6116002)(5660300001)(54906003)(16586007)(316002)(2906002)(3846002)(25786009); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2620; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2620; 23:a6E04RE/e3P7EVmGWGYcVWY8TlRXGVnaeObb+QPw9?= fdlnz42Dtaob3S+OYevITV29kj0koruPVNGdXWHZYXJ/DEpZWrWuCG4Q831tKUtkGQbncqHBDE9+56Ug9Dlc83l5wa/NAsIYbGJxCC4jEvpFHgjdlyRilsuHPxniKaS6pXwO5NKYAUDmNesZ05+GbD3WgM0QhDGTdA38bu3MWa9aJGAwKsscg6XlRiPUuwaGCjvwGTFC78F1v6D5DTaVuz1Sn5U9WQus2dwvUmk2itZDV0DuLLYvKpjlPsd5682bN78Ex++MnRd2nyWYPRYfsXn1NtcBPY3S/9P5fqYANvosiVMWg0vBHNkQY8hJ3/tkP54SDBeVyEIF70px0+C9ZzrKLVFo0KRIAlyOBUde26sPkwzBJKGXpd4esYFpKcGU8iRpY9y9HctlEYuLI7WgQzR6qRoSAV/4hzQkj4Mv72GwbekqQV3FFQLEM/CRMj6xiw/PZUbscA52HvQke05bSgKqIHU3mXZirMh4O+dPBm7bkbHC/fvZ2AACCDjE1q753k2zBFlADC2DD9nFzOCOh0uL2pqJj4KfbidkZa0wLv1nizLy5zkosC7jqODQevlz7j3UhclWxM6Wxym5hdEetMlo5rhY+4zz6FXjtViY3X2updir8I/xfL/we+lCELNxkPR+I9d7nUINp1/bvglEJlftrJYmKKoTf9B9OsU6G1RB+d2PVJZTBepHmY3Hiw/cb1vXVhYSQZE4kUtf74wsxtoB3FVpAK3r3ftSWBTo7Ix504tGZe/8Vw1T/R3KkwvmDinuNAFMtUkSwJZEZmNiVjZpRItmfYM1BBn0K2e0UUp5wEs/jyaUa1qhfhC4LhDd/DKYbLacJhG+ArVb+MWnw2u4TGGRSOGcERe3yuN6F81ihJM6UKzYdLyhEKN9AMM2TBPTVtQl8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6VK3DvCGG8TDaFOd0dWrK/l629xaMGZdcZCV6oNgN9ZsTQ8i37Beb5/+Pj4sXnjidxIm7ZPG9d1PISjeC4ieeR6YB+siWq77bU60XmyXWhoTdCKuab50r5al3oFFaQzWIsM0TTU1S8TAgoZiKnKjMse5hve9/sMUM8xkkP/G7mPAqiraeoTEaOA0Y0TtDAWhgoYcgM85bfir6MogXJug==; 5:reebILx51ECWpOmncWP5sUmE0WFvmcGs/XE16nw56nG0XP63YZ1tkOk8xse+2owTSSQMqOr8DGKNUfcLHJFjQplga4OPjAk51xtBbLdZv7yrTqWxkJzl09sO+bSAlIX5Fmzsl7TW9W8CJb8pmpzoNj4TxX4ykCdVCBD4uicH1K4=; 7:1acyW66tfvUlHlTb3z81E58unRGlH/lwqPnkSk174+zXElEHdphOwc1Ly9wn4mzs5MugwJdjIc9uOoRdDCdU8VHI1s5BMoYms9rtoeoSPgSsIjGRp6IX4IWy7w1xlLX9lTwmgjIE9ocwCe66IqCYNwPatDRe3s6RxBJe3lPFKDW3v8/sSlXcRSngFRLYW3n0eMFVlduXc+4jreJQeuNlorPhA+/fVoOszxE2xAP2N6c71zx+F53m/KAw6sQQ99Kg SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 22:12:05.4677 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b2afaa91-f6be-47a2-8869-08d5fd7bfac6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2620 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.40.114 Subject: [Qemu-devel] [PATCH v4 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 Wed Aug 8 22:11:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10560519 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 4FFE01390 for ; Wed, 8 Aug 2018 22:15:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B90C2AF13 for ; Wed, 8 Aug 2018 22:15:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F77D2AF19; Wed, 8 Aug 2018 22:15:41 +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 DDF222AF19 for ; Wed, 8 Aug 2018 22:15:39 +0000 (UTC) Received: from localhost ([::1]:45703 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWjz-0005AX-4W for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Aug 2018 18:15:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWgi-0002Rh-LW for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnWge-00027x-KY for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:16 -0400 Received: from mail-co1nam03on0136.outbound.protection.outlook.com ([104.47.40.136]:21263 helo=NAM03-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnWge-00027K-7U; Wed, 08 Aug 2018 18:12:12 -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=jTxUbhM1BV212haJ5JjLXnAChTfJTMXEWCrtgUd+M88=; b=VYNXDO8jilUc1oq/MZvzW+eeUt77ifHwNFK+wSRS8DBf2BruE/IaGztrLsRW7/2i5kgPYkGB9qo807RGtUYC1rF2zeaAvzI1r1rpDfog2PmP/Oe/8920IfedQt3ms03EA6EqzV5VaxCjExX0xEWX/nlm8ghGBmz2p82vl/HlM84= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) 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 22:12:07 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 01:11:35 +0300 Message-Id: <20180808221138.5770-3-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180808221138.5770-1-lbloch@janustech.com> References: <20180808221138.5770-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM0PR01CA0018.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::31) To CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f1a8cf72-67d0-4b37-cab5-08d5fd7bfc2e X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 3:QC2euQOku5xHvfAViDk/54FS4vQPKr3tqThG0sS2E2XDNQ0DI982hLXQGG4JnNz6JDOQSVjFLDnBuBSCZII3uidufyRzHXupj4xyHJVfg68a+2FYtOli1cCHOfKJmKMur302RrtidlpuZADXC5rDSySWEtYnTNvsffXWJdSHsPx/zG58gT00Nk5JgYM/DuqaBplx29PokJLEW+tUilWWQPo5NUIqi300wCvRWTemMKrqrTOtW12HRG/Fu8IclfRG; 25:Rrxe/gmWKSwb8pALL6eX+ke8pM0ho2al9i4rBfOMKpeBLXeoakrD+TqHI+wrx4odM6vzkgS/keYHUhmFeZ79wwMSRqGuaAd+pweyr07vcJyKCpVWLN54DXc05xHXfDycDMc5CbG1NqoKteIGe6Ml4/+RFAocRwQQKNchip1rY8D/S+C80YMmUhqAQ/uKcEuGOK/9j84k3Jg2iZKMf9vIczWGDhjbm1N8Cxh/u4ebQkwzDPuE02kFED5F0s+pJlgh72y5dSyWjxywPg4vFvDFwnrJU9ENwXqWZAH0A9YTmqmnE4WWJ+LG6VZmONJL89fcOzZqPqJGKnDPnTHZu4ZfcA==; 31:P6Z2I0izNax47GGYHlfjcyEECLu4jQlYMfRLB7WBYCHTNTHZlzrS0dRuloWsK2bJogGRISM8jOjOAwP+XCiN21kszHFpCSxJmh82IQDr2GLS5DOFGFKXZcOgqiUfHOFFjcnQDOBZJ7I6G/2p7NONEZfnmbSdvv7QHSW5zhtivfudIjqrtv5yYS7xvi/WhUIoKtC5Set4LHKtDvNqEVKGWEs8a8ifE4yUFkMt7xOVX/w= X-MS-TrafficTypeDiagnostic: CY1PR07MB2620: X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123562045)(2016111802025)(20161123558120)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CY1PR07MB2620; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 4:zuoTBBS6j3VcSZeZT1OfRmfuh6VPshT0Yb/EVijRj66uEGRmcJ/Phl5uZwCk/rZ/stGG7MmH85YRaB6Y5FqVDcOEj345spmnqphKZqZRLUIxwWEoFL4O+6MvsfboRH+1RDXq3Lafy4BYVvgS34i8f+/ieZuiWIHLCVsg/WdhbTuu7GDVvl0Wi+guAlLulNuX3Q2YKTPWWOXU/XtTmu5FFi4BNIA0LlhVTHTnyb8CAE5HQLDtPK9adVeXSdfzajjnLw+hNLV/dV+R43emxeNhBA== X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(366004)(376002)(39830400003)(396003)(136003)(189003)(199004)(52116002)(6506007)(386003)(106356001)(97736004)(53936002)(68736007)(2351001)(105586002)(186003)(66066001)(11346002)(47776003)(14444005)(446003)(81166006)(551984002)(8936002)(16526019)(76176011)(2616005)(956004)(305945005)(6512007)(476003)(7736002)(81156014)(26005)(8676002)(486006)(51416003)(36756003)(86362001)(6486002)(50226002)(4326008)(107886003)(2361001)(50466002)(1076002)(478600001)(6916009)(6666003)(48376002)(6116002)(5660300001)(54906003)(16586007)(316002)(2906002)(3846002)(25786009); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2620; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2620; 23:I9vOKFS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L99Pcsf6dZwpKRautoQp3eTwm9hPWS6Seuud5BQI23cX4flWt3FUWs9OqzHUxfwPOXn8apeS6V7+gRWlv7H1hViBbdMyz6YGzot/np/5NIVKDylZleAwLfEUxf+v9LOJU8h1fz6ztIBTGzcnEMkYJQGEWuxAwUh4IFmFRt3nKwUJtF7EJwrDyxJ+hapjxhn+/GXNb6VAk8Vg4reUSeqiGix8r7gKgPrtWqQIOL1109FH4SRImDs= X-Microsoft-Antispam-Message-Info: ypmgn2Ppf2Yl3BwpOnU7PDzDTA4RnF+5t84HTu13w2hYetDOHmCBX2papwUCirY/vj0K3r3gPmOPvkhG+QslyOBX9hvgl99Ew0hEeWOsYgGkFU56OVpo9CM5quSAZp9p3ZL74527zi9fXDXJ0q4ynQT6Coek5prGcAY04rvxaDDaYm6JUbfOkeayphBynjjbgScK3w4FDk+YALi33XAAITpVbM6Rup8pX7fCCcaPOLSfKx8/HGpYIHh0Vi9Ospl2BbD1C7+wATk0FaSANBQFGTlHsMGjn5RAJ67+4xNsCJOU6u9cblQas4JwwAUnBK7ZXQI1sBNfukjrSRDpJQpn+shD/qPZLnpeKrX4ej5sRGI= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 6:jzbCQwT5Lvs48CvpM5/BatKo2iEMecbHMX1fs8kaHeYfYG+cc1mcUodlP9E7DEGySSlk8heYv9RHGzaLfRE4OrHlawLSe2E9vuwyndbrKmQ+LfReOjTO8fUXeNzGbTXUx4eeYnrbrzPH5LxggAPUG9IcIXGTlOuRZk3JN8jIFuOtSlwvLRBCq5LpOs03yinLOv7ChUi3L62C24gaXt9PLMypE1N5jwYQt0NNt5AwuBNxS3O/5LdW7U47Wr87frrFysZgXby64EPvxtm3wt93949nd83J4oo6LIpesQFBpZkUXSh3q1UxJFMiFjCSDZ9f3FbdJJIW4DnszPUXrasRazqRAqc3B6Bw5YKrMQIYslCepbNVF99GhaMifcNDmA0AfHnQ8K1t+gNy2dQvzgspKfhTZat7247yD1iEMqPCz5SXey4tcUcLetkMOfQT0VUILngedEZxkkIZIseV8CTmaw==; 5:aMfQG1kjKQgPJy0rJ2G/syZqmUUOYWgj5zk3eSzUre0gYvXUocppCLXP66K5W76HPYQAEK3a1V/jpQbB4Wg3MaSzZyTHLWiyvssTVv3mJNJV0IYZ/qsng2zevTez2rkkdxC20fo9gbqVdBzcIkuex5SM2Dq8KbVJgCtUqKZkHbk=; 7:6xn6CBXqgKLAhgoRgtloYnSvmNtdnIySkykSv6tUk9sg8HOMy+qD+f6D3FRGc9qVWA9njL/UiBRUGxtqGD4nLpfleKPM03e+7WMABZdXFJ2xgVjA+L2ZkMP0o63eEql0sAwkv3wIPaUM5VdZ9fcu94M5ngb5cWZ305moAybKJYN38x0kgmJLnZFRSRod1UlVHpxk4Y2tQJyFX9Z+0A+Lp8x6P/KkSiuwuTGMBzoowQzEAG2gzIJ3U0VVX+ASIjtC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 22:12:07.8287 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f1a8cf72-67d0-4b37-cab5-08d5fd7bfc2e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2620 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.40.136 Subject: [Qemu-devel] [PATCH v4 2/5] qcow2: Assign the L2 cache relatively to image size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Sufficient L2 cache can noticeably improve the performance when using large images with frequent I/O. The memory overhead is not significant in most cases, as the cache size is only 1 MB for each 8 GB of virtual image size (with the default cluster size of 64 KB). Previously, the L2 cache was allocated without considering the image size, and an option existed to manually determine this size. Thus to achieve full coverage of the image by the L2 cache (i.e. use more than the default value of MAX(1 MB, 8 clusters)), a user needed to calculate the required size manually or using a script, and passs this value to the 'l2-cache-size' option. Now, the L2 cache is assigned taking the actual image size into account, and will cover the entire image, unless the size needed for that is larger than a certain maximum. This maximum is set to 32 MB by default (enough to cover a 256 GB image using the default cluster size) but can be increased or decreased using the 'l2-cache-size' option. This option was previously documented as the *maximum* L2 cache size, and this patch makes it behave as such, instead of as a constant size. Also, the existing option 'cache-size' can limit the sum of both L2 and refcount caches, as previously. 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 22:11:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10560517 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 CB75114E2 for ; Wed, 8 Aug 2018 22:13:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDF652AF13 for ; Wed, 8 Aug 2018 22:13:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B08912B05E; Wed, 8 Aug 2018 22:13:40 +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 42E3C2AF13 for ; Wed, 8 Aug 2018 22:13:39 +0000 (UTC) Received: from localhost ([::1]:45689 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWi2-0003W2-HT for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Aug 2018 18:13:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWgk-0002Ti-KE for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnWgg-00029F-M1 for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:18 -0400 Received: from mail-co1nam03on0133.outbound.protection.outlook.com ([104.47.40.133]:56091 helo=NAM03-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnWgg-00028H-BL; Wed, 08 Aug 2018 18:12: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=ztPiuyxnhtrMPYDUZX61bnCbF4fFDNBVbA5gE1lLclg=; b=Bk17OaCAnb24A4vrDgI87D57tRbfewqLJoih46Rpp0uqSiDhFMtlTmmWjLGL4KLTWk9/kgjRf5lylLAQEk/JFGNu1X/1koip5gcftSmYzNvCZyVhGmMxUYXS0h2cGV7R9afG+sj6Th55kyYjy5nXnyn2lf9tFK9YW8HU9CRgDDg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) 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 22:12:10 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 01:11:36 +0300 Message-Id: <20180808221138.5770-4-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180808221138.5770-1-lbloch@janustech.com> References: <20180808221138.5770-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM0PR01CA0018.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::31) To CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: db044590-98a8-4307-6434-08d5fd7bfda7 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 3:4bvXkSqQywBX1rI99eJt1UC+q06KXoO13KEMkZVC/pZw0ALNKnP4tPKbe+j2yI0G/8wsb2EC00JHlY589GlUGJHRLoiAMKZ1tNJ8T6UNLGCp/1cvxpTMzhXv4oP0+5d7mAOsCjDWfmFTtNqHvo7rHWUGtYGCG+NzHJFECBjh14nuWd1AHwHGh+RUXfp/tQuwAFcWZBgqhOScXCQWbY46gExrO3sBx2rJ/ponC/3OYkdQ0wOle2r3BUJV59At0eqO; 25:sclEtvOXVJWUEXib68qhtMVUSSgMsEbMuiQanoAxtCUy8I+s9TFdZOK0UtVIeSaeDkxmiqj55TjwquXZbe9pGS78Ngb3cdsjLrLHiDGzhIWvgWrA8yN0S3E6gmYE8NrEqQQpdhx1/ymZI5wTtoUDN/VkycdIkNKHfDDQUe6/LEDPOi+9S2KoQV+qoXj5y4HGCcefDRgjXeXbiSFHz/xu9lwqHa9XfPGbSn45yOlFZKPNWFfyJ8/tjagmVtKlsWcvzUbxjtPO+87EK7G5k/b0D5qQA8TRwtTaQKveOgwBzM6s6lBWi98fRBM81Rj1MO+z4ZVSWEMlgwH11iWgCOLbCQ==; 31:htk74nD1ODsGrw5JDMRVyl/Wg2xXEpaXWOctG5EMhOjbmHRqDQhFWfdlCgWqVdgdqBc2n1j4BY+/yjvkwmgrkjsuKgkd5dQ+XRUZTZWaUcoVBPOZtVUIOHDgM52qeGhe6iVYJx51R7SK+g4DbSKz24GTIe748sGoj3qT/k9xb32tWpP737lX0ZZ2OcaZa5h8gCD8IJZ4OQyCTBJIwOx3mFDqwcAtaIJ/VeRkK6p06Dg= X-MS-TrafficTypeDiagnostic: CY1PR07MB2620: X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123562045)(2016111802025)(20161123558120)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CY1PR07MB2620; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 4:Nz4F2poEawM9IrL7Lk827jdf870HxcFZSIalrzvalA1ogbLwDL3Aegirk+YmFm7NrZ1nkZvWwmZMCYMZTjB2O2D49/vMX6FZgSkC2Tgfw10SkTLwPP+Z1ot/EIEB8hTCX0M9k9+whwO6kRaDz4/DorDrYw0A/gaJATRh5Bw/t4im/uJ3ulv8jx7z6jZYQD1LBHhGiIBGqguod/hF34t3iXYSwXsKBw8Gja0v/gi07Rm+9JN72gS6OyQBPP1Krcam4h7b3IAVbBR6gVS83ePOFQ== X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(366004)(376002)(39830400003)(396003)(136003)(189003)(199004)(52116002)(6506007)(386003)(106356001)(97736004)(53936002)(68736007)(2351001)(105586002)(186003)(66066001)(11346002)(47776003)(14444005)(446003)(81166006)(8936002)(16526019)(76176011)(2616005)(956004)(305945005)(6512007)(476003)(7736002)(81156014)(26005)(8676002)(486006)(51416003)(36756003)(86362001)(6486002)(50226002)(4326008)(107886003)(2361001)(50466002)(1076002)(478600001)(6916009)(6666003)(48376002)(6116002)(5660300001)(54906003)(16586007)(316002)(2906002)(3846002)(25786009); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2620; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2620; 23:u63zneYBlrm3PVFwzahnRq51BsR4NHedYhp7UXtFI?= mqzHG9oPHU1N+mPvkz9tjl2scVDhd0ZGXpQ2BhawhMqsW4oxDLPwtkasZzv21fny8E1bnsb+SDxIhXqT0Cbf/JpbR+DDw67YmgyizJmyi6oAas+PZD4V1KHMDlr6AsKNPEENgcAJqhpZmph9xklsKmk84K/gqldk+yMvcHl3NhroxadTGsp1DuTVrNfq6cPvIvvojCUy/dBZQDAvDgTZcm6J96XrM9aqkT5fGLsNCXO8OAGRtsh312oWLjHtUj9EPHATf9aXIY0QwXwH6NTIMbmhAkq2ZCd4hY1u3QooipeGg7CXgiAW0jQdRYtRiqVYCAF1ZcGysnVOns5/a6iH26i95mY2lg0X8Nm5wHS3gq4vAB7apil1djatGvTbUZySmYgn6VGJn/qqJS6403a1CTyHYSMd/SNcyCZWvDjADZgZldzVX5ZZqD/c1/hoDpklStVjuw94eEnSnB++Pa7DElq3exjpFhhhSpzykfaErLUyt+JrNJsiPDrQJOSnd+Ad3fQ+/vs4HKKCkL6SJU5AZPIxylOV+ki7uZuI5YkQBHjeDVuiujQ1PiIGU+yKRLJR7bJwoOug445rMWUqirPtj6KjXC2NXPAZP53zcekQn6BLpgGqwM8LAatnhLFJfLZE4vmwpF0WNmy2UHXuEcZy7IvO4DMwQTz4Ok8B5xANA5u1n0HArfn/KrLI3PRVAysph2oab6zwoGriZK72kGbYR4YfC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KKFcPDw8PdFXDq+aN7UrOpgSeMeqxFIkctQwUp7mUe2qIsvjsIMPPS8l4efooOMf/TGOLzxnU7tPAC8u/Pjj0rS7lBKX9dL3YGHvo1JLw+1YCRgn2ZuPuew4M0GIpQwQVfhkaOm2LIo51ph882V1xlSGz8yK1xLsMO9XrQ3pu8OfuFyyjr5T8Eaf4JNek1BZbLu4zkmWQjJ0lIXmYFEz7eQMQKToXzxBr/xT9gJFBxvtohAsul356Zchwkq+amSGlaSXa0f8EcADV7qlfbGmSfk8N8quRFM46DOBqS32oiirJPk0NAvtUV3ZO9ZYA0yVVRcPuAOqBnPFvzqZRQ==; 5:XhT/i9fWBdvptViQSA8Q/Fj382Whf40nd7L5nhRZfdnlB/J4gx5TwTLnM3nQt1ofs6ExIlR96HoT4iRgQuI4omwLwWPOR7fIzjV24zPc5QcjBlj5jC/q22UcAYg65y6s2L0hyj3+lLpEgkcmjvlO2LSo5HxvtNRY0zyKMDhbrz8=; 7:fF1YAZF4TgfiBh1L1Ey8752AQ4vIcZfpqQcnZbm9CG26XZuVNS6WZ9qtBbZGXRM3ezPIOOAqxb7S9uB5Muzr5edY+ib9Vyv04EIUJ3evo+rKEhFz32ErhRetem3XJ+FHuu2V5N0uIsiFkEHjfNAZqUeIx2ig0CTNC/L1f84S4W+SKeX0bubwjsqlkDu2cP1VFwiulUT+ZR/Szd3R+fQBu7c9EBZnQE262UbpYo2MXnRjjbETL9mp0wW4DlU+fqFC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 22:12:10.2948 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: db044590-98a8-4307-6434-08d5fd7bfda7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2620 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.40.133 Subject: [Qemu-devel] [PATCH v4 3/5] qcow2: Resize the cache upon image resizing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The caches are now recalculated upon image resizing. This is done because the new default behavior of assigning L2 cache relatively to the image size, implies that the cache will be adapted accordingly after an image resize. Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- block/qcow2.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index 98cb96aaca..3f75b6e701 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3415,6 +3415,7 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, uint64_t old_length; int64_t new_l1_size; int ret; + QDict *options; if (prealloc != PREALLOC_MODE_OFF && prealloc != PREALLOC_MODE_METADATA && prealloc != PREALLOC_MODE_FALLOC && prealloc != PREALLOC_MODE_FULL) @@ -3639,6 +3640,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 +3652,13 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, } s->l1_vm_state_index = new_l1_size; + + /* Update cache sizes */ + options = qdict_clone_shallow(bs->options); + ret = qcow2_update_options(bs, options, s->flags, errp); + if (ret < 0) { + goto fail; + } ret = 0; fail: qemu_co_mutex_unlock(&s->lock); From patchwork Wed Aug 8 22:11:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10560531 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 7CE8F14E2 for ; Wed, 8 Aug 2018 22:17:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E21C2AF13 for ; Wed, 8 Aug 2018 22:17:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61BA72B05E; Wed, 8 Aug 2018 22:17: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 D3FBA2AF13 for ; Wed, 8 Aug 2018 22:17:27 +0000 (UTC) Received: from localhost ([::1]:45708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWlj-0006E7-4B for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Aug 2018 18:17:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35070) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWgj-0002Sg-Rr for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnWgi-0002Bu-Ow for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:17 -0400 Received: from mail-co1nam03on071d.outbound.protection.outlook.com ([2a01:111:f400:fe48::71d]:46817 helo=NAM03-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnWgi-0002AH-FH; Wed, 08 Aug 2018 18:12:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janustech.onmicrosoft.com; s=selector1-janustech-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BN4tGnEj0Huo1qjRFvlRpUtYEQFfCV93mJzDp37zAZw=; b=T1aF34MQen0Kvc9gdP9vcMLuEZAuyfQcGiyNDyUyyLvUjUxrzP/TGYNmUrdb2DTiLWEWALXjWf1TQhhRydogroauxO3J0Ovkn6bWifMsFvaaBLT2ZJWeBhdhUalAZ6p5HC3VQRVXRGcM6MZBQPT5nOD6wo4O85xtd+e8MF3Ou2A= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) 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 22:12:12 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 01:11:37 +0300 Message-Id: <20180808221138.5770-5-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180808221138.5770-1-lbloch@janustech.com> References: <20180808221138.5770-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM0PR01CA0018.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::31) To CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 88a206fe-fc88-4bb4-1f90-08d5fd7bff0e X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 3:UI1mWPE/UTl0UbK0mbtrbdPL9GepFPbNQOBTsigsQxqAM52GQRO9WAWkUHDdwSRzdPqQAaRqNfX47lZ9aibQpTymLkAN6DcUjOMO63ccGXrxS2iKkPR3rsjZk2SPypzMnOTW49qTYk1CeiRWtr6ZODkrOqxkoVbUoAp7V16PzEfK7cmZeppwqmk4wMKqoN3sGH/iA3bZyvSp+TufZMMzh33wlXk5mERhG5dX4lJhXBct32Ci3JP7hArWhODneoed; 25:tPXx34VqpZ9yBPypFf5mXzqL55RBXBBeD9fZpHRG5FK5ABZFHdcPoohKvrUYzZUzP/R7jcdF2i2Auvnyc5raJ4ek9xncpO0NGjW65AAOANBiZF/6YSl8NJCYp62nFWYjcHXuAbCN4ZYzUrVNnaYguUQGsPTknUedN1LNx7jTNtOotiwJDJ0T33uWSKhhcVYP4bHkPOcVp7tqEOqasx+7MNgFFxSpBtKZ323cicdUjz7syVZJg6ZZQj2suFQs67nKe1+JAJgsoiDb9iopBxzKCcVn6dR/Pk7nlhZtUjGCk56pbEDbAcfAdy61FHpYjM7xgOFS3dDjMWdZaegF9t5IbA==; 31:aV0HalqcnHBVhRjZmTLCrQYgGv1R/a9CCfHsSOOMIh2FPXrakkHDlmLPjF1sA62AOgR9mBnG/DnJrLF6umpv8vGiBFDJ0rdgFn77G1Wk1oeuQtK2MnLIvNezIvPu3AfEd2CxrwQYiJc5jerTd/FQebgj/JFGnz5oIz9C8bvc1/Ffwb+1nuy5nh4SDQ4P4coA/TKgVRvJpTt7SYrKPLqKg3hP13Aej18tB/VNO3TYVLo= X-MS-TrafficTypeDiagnostic: CY1PR07MB2620: X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123562045)(2016111802025)(20161123558120)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CY1PR07MB2620; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 4:bqREYVioVDeS1iumDk2KKbRfrsreJZROmxS6B9OKB17Ee1uWtfapOSCIEUYuK6Ox8gfXOO7tQN7cdcbNW9vSZPtUcfE2YFhXid0OEJQeynd4G/bOSFy3lwLZ/QFytkwgmEqA9ULOPYYzWhkKBc2EOZQUTumrUzklZUt2VRKX8WzSmPTsuESiZAdZjh9CikO1zkEhC4coNafhpz04NGjiA+gd5kcudzymdzHMzAxDZzxkj5XtcEACfCd663gqyVW2aje1gbZuZ+T4J9FDTj7EHQ== X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(366004)(376002)(39830400003)(396003)(136003)(189003)(199004)(52116002)(6506007)(386003)(106356001)(97736004)(53936002)(68736007)(2351001)(105586002)(186003)(66066001)(11346002)(47776003)(14444005)(446003)(81166006)(8936002)(16526019)(76176011)(2616005)(956004)(305945005)(6512007)(476003)(7736002)(81156014)(26005)(8676002)(486006)(51416003)(36756003)(86362001)(575784001)(6486002)(50226002)(4326008)(107886003)(2361001)(50466002)(1076002)(478600001)(6916009)(6666003)(48376002)(6116002)(5660300001)(54906003)(16586007)(316002)(2906002)(3846002)(25786009); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2620; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2620; 23:6kOQdnfQD2JQlfneb17+zS1VGwjegn1/IIXuIgccU?= W7fc52tfQDr/qpMFvTaJwmy4BXdt8ejL4WAxybuIUSIImI8g+qLH+4WmTpr03h+0qFum34G8qF9J6QODUbUP4ASOQZ1ui9tHU0X0PdGEgAxVBdH73BsH/LozLBEEGJ9ZZDlyA73ZGW/cst4CBPf59y2GS3zfllG4BjlgSK4n1J54MerY4cZPkDQBiOSjE1PpY47a75hJPc7I42uKhl3tfaWjGuxk8C9LehfY0bSEHL9uM53QwZM4dPri8jQXg0bG/ozOiCf/ICNJv4PmT9eLrL5cER0vdI6o6CFhUNlRdC1luSv//iSGAzSTYQKlhTGYiPcd4dJ5GG+tvepLelOw9bMDXACAzg9IwY1BEUAqotg1fFQ+c4LNM8CE2SLxBrTKOraNqCqoyGVV/n3Bd/2zj1ZnV/LGC4TrWHte615QnDQxY/qOyWRoW0Kz/TbIB/OxZksFkqP3RRSb55XJ/yDf2iLDS0gC444Q5IlDEl+JnvHMrmnAWFl2iglmKGTpt1DSXZWEtiFtOkfaqOmbLo8fqK38x5fAB2/DsYstUiDPA1MbysAowhXsyuLRm8+IxEmIl+9tn3zijIuk1iDAIlySwnD9yMXp9d/VxGTxadG4j+A6xK3jkGDqEuAoQGLHe1bk+0BKrSo+raKynHJAD8THWcAfltyTAWyAI7zPKg5k/sUp5WPM5utFQy2qrWDD7EupzrhnLxcSHUcmgsSiwjN7EMF3Rk7KLYNyTN8fzfM7RMp2lEhf0U+GXayPuOYq1CDhHeePRjVbSewROT8EIjIqiUpourLmZXNYJ604O+3cNuGhm5qvAsg9eruzUVawzD9Rm97NZO4ZwHDWOxK2cogspOWImiQ0lBdObFMgPG4FSx8l5Z8bPSyf2KozxJh0R5MheDRakNg2cOmoi2xiSRG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SUKqhIqYa+qDhyfXApcXLUuJ38vqlOObOYw7anKig7Mu7rlb2idc6SIhR6qH4mYEYVRHw2PkHwv8VjTy0AAO/+XoMdfzhnW6q+V4sULra8Ag4fqmXMAtrOKOt6+00BD06oLgUHGDAfopsTvOuRzd3qS020jN+b2+wSz3e3rtgDDjm4a1NQiBww==; 5:2LBq7eHF6YYwB5VeFvS2GS52GT9AciyXNz5i/+z8stXvj3AxZyNv6igIxZkY4haDDJCYQie2/Y92Mmu63cXOY8cNxtp3KnmRGzdJ02oOq8w3HVawVjBba7S8iVZ1ozqw79a78qqRow+SpSFWvjAyCWBXaU07HWDXjE8qXGdG5GY=; 7:2wnp/P18skzaWHhN2FUEq7zEZABzduka25wIOqDp1fE5rE3mE0eQ2X3Y+yTngRqb2OW0X6JqggrEKOFyQ7ANPU81qfcnkq3ajbJjhQVnXen8NE0HwxtoSJP/lbss0eLsSYAEKhPm8ADKwAHKKk0jP4Gc/pWDtAyzNoMvyXUVDCxSBDp0bnBjhQVfpEY5w4zA3rnmTUtBdhk8jwodFpbVkZgFu2djjPFSVUUClDmARbrM436DzRcE6yZLnCnk6Q0T SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 22:12:12.6478 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 88a206fe-fc88-4bb4-1f90-08d5fd7bff0e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2620 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe48::71d Subject: [Qemu-devel] [PATCH v4 4/5] qcow2: Set the default cache-clean-interval to 10 minutes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The default cache-clean-interval is set to 10 minutes, in order to lower the overhead of the qcow2 caches (before the default was 0, i.e. disabled). Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- block/qcow2.c | 2 +- block/qcow2.h | 1 + docs/qcow2-cache.txt | 4 ++-- qapi/block-core.json | 3 ++- qemu-options.hx | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 3f75b6e701..15d849d1f0 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..587b053453 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -77,6 +77,7 @@ #define DEFAULT_CLUSTER_SIZE 65536 +#define DEFAULT_CACHE_CLEAN_INTERVAL 600 /* seconds */ #define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts" #define QCOW2_OPT_DISCARD_REQUEST "pass-discard-request" diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index c7625cdeb3..9926f83ada 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 600. Setting it to 0 +disables this feature. Note that this functionality currently relies on the MADV_DONTNEED argument for madvise() to actually free the memory. This is a diff --git a/qapi/block-core.json b/qapi/block-core.json index 5b9084a394..7c6115096a 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2830,7 +2830,8 @@ # # @cache-clean-interval: clean unused entries in the L2 and refcount # caches. The interval is in seconds. The default value -# is 0 and it disables this feature (since 2.5) +# is 600. 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..8cebb0c77d 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -767,7 +767,7 @@ it which is not used for the L2 cache) @item cache-clean-interval Clean unused entries in the L2 and refcount caches. The interval is in seconds. -The default value is 0 and it disables this feature. +The default value is 600. Setting it to 0 disables this feature. @item pass-discard-request Whether discard requests to the qcow2 device should be forwarded to the data From patchwork Wed Aug 8 22:11:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10560521 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 E5F5C1390 for ; Wed, 8 Aug 2018 22:16:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D71E52AF13 for ; Wed, 8 Aug 2018 22:16:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA64E2B05E; Wed, 8 Aug 2018 22:16: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 5C6992AF13 for ; Wed, 8 Aug 2018 22:16:14 +0000 (UTC) Received: from localhost ([::1]:45699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWkX-0004rm-KD for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Aug 2018 18:16:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35122) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnWgp-0002YH-6L for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnWgl-0002Eo-6Z for qemu-devel@nongnu.org; Wed, 08 Aug 2018 18:12:23 -0400 Received: from mail-co1nam03on0100.outbound.protection.outlook.com ([104.47.40.100]:12992 helo=NAM03-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnWgk-0002DZ-Sj; Wed, 08 Aug 2018 18:12:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janustech.onmicrosoft.com; s=selector1-janustech-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vxNrlCEhkZCb0niCXitytWU6AqNbQuFVDdYGR0RKpiA=; b=qPOPPzyWUAGrzmny4i0ZW9OTa+Ktr99dQlUHWFQtGUArX3v2AbCYvaB/A8kR+cdHTVCbTjSQBM/jPrHjk1Hwsno1+7prY/ej9tS/xSaEo4sYc+BNCGfmOS2pWUstVW4zOwyTt9R5pM7X5qDvTkUSMC4BYQ0hBIL6snzIdCvBJFE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) 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 22:12:14 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Thu, 9 Aug 2018 01:11:38 +0300 Message-Id: <20180808221138.5770-6-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180808221138.5770-1-lbloch@janustech.com> References: <20180808221138.5770-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM0PR01CA0018.eurprd01.prod.exchangelabs.com (2603:10a6:208:69::31) To CY1PR07MB2620.namprd07.prod.outlook.com (2a01:111:e400:c637::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e69f5565-7896-470b-53ef-08d5fd7c0073 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 3:LijGJtl5Js1pEbP80BXEszOM16jyJ1QI3cOSUlvmwqi7vPuU7vWaAz9H56j/uyhVVv1WzEOIqBqeRGx0jwqBGiSTW7Fm/MXRgN7cYc7Yn2ljfyz007Fc1A44oMNzVN0pzTxfGf6X/lc9nLpLTRkiNF1Y05X/pwqTzeuM7q5AfgboSJJlvTaO0LpaG29PyOyN4qmseKgyK/wuGvoWhUt+I4GsfA8Zy8xknlEvHRFrkFY9ClSCwzhiLqbn+TvdCnXH; 25:jK/1IyUNfwJB+i8/P3ie9SXrhwNtoMr96vnWmmW2WixZpqXB+zXf3b4JP3yiBTRKg6fRa7fmHbbZhmKYxeSCN3xk1oqHhnFCGJ9+KqM/eeTIIKBmzzCN1MDh8J+ROygOlfe0q1POogsV1biflS/s5qffHpHtw6h5xpilZ0JgqENDm1sitbZaTkExJbjsKyNbb3nnsU6k+owFoODV3eK56x4XNnlDYpKbrxKukz3gVZ7FG2fsCCpRLLaJrjBlF4zyHiIxeD1x8shHl6X72mEWhiLZTaPPIh956qdx79lxsGZjgublpyIJ27K9YXbcjAiZ9g3+xofh6iqyFPsf99TxSA==; 31:Af5U1EMkoFF2QmOiZweEMFDF+MiubyPUkT8xIsbNXrbdwZQ3qOYyA+cqmv1S2ukbwERaD+xSP9YrS6F3RwAm4lQXf4EJQiSD8yf+Vlal5uEfd9ijeorKaZfnu3B0IAn1lRh8S6Haw/Cq73t9jhM2LNdH5U24SgB2FnK8NLSB9KRqbcAc2hiyCfMHiDwunZ31h+y9x8rkFH/q3Bn6krK+TCe2Qd4YiU91l/4Y/mLum3s= X-MS-TrafficTypeDiagnostic: CY1PR07MB2620: X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123562045)(2016111802025)(20161123558120)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CY1PR07MB2620; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2620; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2620; 4:B5SfbZuu7ybdis7GGtR/t0a74ePn+jrIJcZEjV9eDV3UiMpLZCrVaEf0lgVmDR0vbqycOlxomWg6lh3U4iDurhdA7ZT8gtJ8SXMlrsXFSyqBljq3CAjnunGTDczPGtz5twIoDWI4Tsm6GPQtsvsont3VHEPE+wM28VybUhEJ+J9AcU24p2ubZOjS19yDhUQr4q8m6oRdOLuIZeNx3PvBypJfXxC5aWibySpZd55BbIvR9qGrAjPA1eLGylD4Jb9+TtyQ18P64Lo0GUtzP0lDoQ== X-Forefront-PRVS: 07584EDBCD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(366004)(376002)(39830400003)(396003)(136003)(189003)(199004)(52116002)(6506007)(386003)(106356001)(97736004)(53936002)(68736007)(2351001)(105586002)(186003)(66066001)(11346002)(47776003)(14444005)(446003)(81166006)(8936002)(16526019)(76176011)(2616005)(956004)(305945005)(6512007)(476003)(7736002)(81156014)(26005)(8676002)(486006)(51416003)(36756003)(86362001)(6486002)(50226002)(4326008)(107886003)(2361001)(50466002)(1076002)(478600001)(6916009)(6666003)(48376002)(6116002)(5660300001)(54906003)(16586007)(316002)(2906002)(3846002)(25786009); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2620; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2620; 23:jgl8u5FkQbHJtLEZgC7EhwFHnQ4OhkamaUoY0FLvp?= q1hT/b2eOO+l6CvHyjU0GpUINgqvfZRwzJsJ8NcyMJSTwOSxcd323gDYvMfTBrZImPppZGzy18Eco02Uh+omvoKvh52hAGl07n7dF4y3ju3n2NPQvBKfWTd3imjuDtZ8jAGg1VAwBD0rZoARNHyHQDrSFzxiJMekPw+MWGxNeqlqtJ+B8rmQq2j+r3jGgrPomyOibArnl2BUpFNAZWrUFw3n2ojXwGiKAits4eJIqsqzk7PI4xcEK6wi04g7YEJO/ENFWtd0Uu6MjSWRVY2vD7oWa4eV2HJ3m5r7DkFG02yC/yr/X2KzCSMypM/cxtJ8CKZGnWNGio9mgQQCAUGtjdYWemwZI9mXi/xq06I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eYHwGrna9NOcfwIm3NvwnK4C+GikK7yo5XmwNnfIFk7HJldIcyj8Nvokpd8AbffEAsl5XuquGU0FoySSbPzfZhy2JnZ+fxc SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2018 22:12:14.9667 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e69f5565-7896-470b-53ef-08d5fd7c0073 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2620 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.40.100 Subject: [Qemu-devel] [PATCH v4 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 15d849d1f0..0d9d20e46b 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; @@ -3447,7 +3447,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) {