From patchwork Thu Aug 9 21:53:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562059 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 D67C715A6 for ; Thu, 9 Aug 2018 22:09:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C389E2BAF0 for ; Thu, 9 Aug 2018 22:09:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6F932BAF3; Thu, 9 Aug 2018 22:09:00 +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 00CD72BAF0 for ; Thu, 9 Aug 2018 22:08:59 +0000 (UTC) Received: from localhost ([::1]:53086 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnt75-0001ZU-5B for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 18:08:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnst2-0004GL-5Y for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnssy-0006Vo-HT for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:28 -0400 Received: from mail-eopbgr700109.outbound.protection.outlook.com ([40.107.70.109]:22016 helo=NAM04-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnssy-0006UJ-7f; Thu, 09 Aug 2018 17:54:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janustech.onmicrosoft.com; s=selector1-janustech-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NieT6e4sGvEML8t1ZN3fAKC2L+NA8AiFDMne61fe0Y8=; b=XacanyZ1IA8n+FCEmn3SsTFa0TykxqjE5NexHwvM0rX1ywIUrl4Jecyvil7G7/qhyP/dCH0HpGOdyB6hvZUsL513co6VcxIVVtswwP/6vA6NoVcYk9Xpk0HS8z1gxsq9mNqosJKJDzSV/GEnKBfmYc7Mv4mJLx1Cc6+Q1Ca6i0o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Thu, 9 Aug 2018 21:54:20 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 00:53:00 +0300 Message-Id: <20180809215307.18241-2-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809215307.18241-1-lbloch@janustech.com> References: <20180809215307.18241-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM4PR0101CA0050.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::18) To CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81fe516e-5bda-4654-07ba-08d5fe42aa47 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:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 3:DXZMe46NUnYaVHlGzRJJX7cTlPwYwyfflFGa/diYnOaA/Q9OfAu4jCKNvHdByF0XDge7BFkGwpvhjfbVllCqctXgoeEJhgeBkOnMoB+5bKL/EbFQHadjcQcNuvV0c2kukvHCFvIsAtmGafGzMDtybw8QT+SDLyDbEPEVAJ0FJk+gpYz8VGfDRpSq9lP+PRqYcf5Wl0xjihJhnjx1X9KznWS7eI9OcBuy5ySU+xF9Fvu7YE9zmraoBgRoH8f6iTRL; 25:UqN1WmgzEyXFmUbWLFlCvw0VD7qVwrn458kUYRreLDmwkb1vlRLPklQb2JWpeP+Dp0kq/qxc/s0y8HN20ZaiApWdMhxsDE2E1uoR2viPRCIjSH9JvNUBdvTG4obRU6HdYV/PZP9NvaL7lloP5Zol7+Zav0Xr7GtNbIAvo/ZXKpAU6/sNlt4BOdjvoVAlgqNnq3zglaDlVfjBUqDd27x4taDEW76qiAX86NyJ2koJU7B0E3GVIQRLLAzjh1JAhUct1Qi7vk/gZUwFMF90VHkfQKXlQ+gTm0VnB3LfhDdwhRJ7B/2HGT7mLeBHP+7ISuUPk3e3lqRPE4Wp9iMBkx4P0w==; 31:82qakJX6epHfFBU+pTRG2NP8Jc6Isk0SXgZepWd23ifWctdcDS0U/fTm7SNpsprG5r0SAcaGPmj08Lrp/5n0Igq/b5rgYQ/PUxjx+RInt9qA/F5bp9kHyn2LRbWUfWO/OgU5IMhY3FA/kdkuvzvLrmP0fF4LdSzpt+kbCtS1Lodrzwz8eP+Vp/uPjq3ALgGS3CNg6yIm/nxnxdbyP3TbGWpXupYsSN1bC/juNTYiJW8= X-MS-TrafficTypeDiagnostic: CO2PR07MB2615: 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)(20161123558120)(20161123564045)(2016111802025)(20161123560045)(20161123562045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CO2PR07MB2615; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 4:KzS/3u8dbbg8KXH+wucKi5miwOY4wEmAWuqfFFFTWA7abCshLC5xnl7uOt5HO7DbfE5hmf71mg2hi23NpzLhgdQnuXGFl9b0IUiCIA9kaR4oXBZSAJqOZF3MZUhObhlWdVq3GKOBNELYbKfdlkBnYZzf82xJ1/w8J0w1ffZDWNhFsF65E+QTUqVh+9qSe/ysZ7DZSNF5fdf6z4YNCjsCL9n9tLO7wQd6/0gZEQB6+k7mdA4X0H5tD0M9VIsMP/Edi5We2nCIzRcOCbk/k9MzrA== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(396003)(136003)(39830400003)(366004)(199004)(189003)(486006)(2616005)(16526019)(86362001)(6486002)(7736002)(8936002)(16586007)(48376002)(575784001)(551984002)(478600001)(446003)(81156014)(68736007)(81166006)(186003)(476003)(26005)(305945005)(386003)(2906002)(8676002)(50466002)(50226002)(14444005)(956004)(11346002)(25786009)(316002)(52116002)(51416003)(6116002)(6506007)(1076002)(3846002)(5660300001)(105586002)(6512007)(106356001)(6916009)(47776003)(36756003)(2351001)(4326008)(97736004)(53936002)(107886003)(66066001)(54906003)(2361001)(6666003)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2615; 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; CO2PR07MB2615; 23:hNrCR9LVTorqzOcpq5nH8MhE47aDVP8U1ieLrEsgh?= qYKj/hWQOV9nU+8CYBisUJH0P5mFwbOSfwMCnvmv31iGjUhKXGRNRNj6drZ+/TQHfzMtpocBWxkfvfHt+SEhgVFqW9fJ/eKokpwwTd02fkhDWL8LII97equDwlpLDy0omiNy7KdL+dWCOItAeU0wGWqtJyiR+QZhCnCAqO4VQAJqZoamq5fN0/oxqmWw46oOx1bFClEblYg/03AKqCHfHAFKrnYe/VYcRyMdIV4MpRV1Qsx0qsRAPvCbp24jGGyFe+UNh7551B063OAVl0Mver8RDr7oDa9/V1JieeeFGDnrWezXNikTMM85NuiGlp42BoXMAueWdlgh3XnKvC/niqACiDauNhKVmtfo1HG/hg23jzGhQducuAMA8M/k9UtKimVNQ8DVzHgTX1DKpRvLHWYqh7O3JIx+3d+RdFlar+fDGmMBtojNYjVTTS9FnM4KUBo5P/bFfse5g8UPc0Hs0AhMJ0aY8ihooSpL9ScuSSSfLGwu9wEigINN74YNC3VYEZRbJGCD3vNftkyk1zwI5Id2OhLD1uDgQmeFuCwFFgY7kNrKr6Wgb7SI/rA8mWkzS//e/xSaUzi5PprF9gH0QMxEfll6Sysw/z1eQg0E8+HjC0+k6iTUwGuF3YNfvAgQkln029ZORUHHC6UYv9+OWh1TzPKh3wHIyoTsRQf9CEDcaXTFmNBMF5g7PvhXpaFYELuFR5eoVLm7Pd+nvt7PDQ9QzTeTeGncSUF8E+b+SbanhrZqUQ46NenuZT8WcZAIX0VgApRU+bTu7tJXuIiC++m1n8ZuE1PvZepOxGT9QbIga/ikmuikRKgYpL5B9ZoTKGB3EzW6xHNd/iJXf7hoxsHQmWndTJAbqlJ8fX039Q+Y4iH8ru4XFtf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bx84QQsYJLVmnfMzt8qG+6M59rAe/93gr5nNjPlR03//bi03NnEWQyq5mKBToAn4clsju+Ke5/qaNDd3kVVFWRXuSr6e2DKvf9XhYot45HCy6P2MjJpRLJBkjKT5RSeMzexh20+JU3UeRm1nPG4mHvUUB2Dt3H6ZcHIZCYN/BtZoxknuKl8DlA+SDazuqWfVSbvTH/M1tdiWxxkWKqb7WqehBFfBW8UFiuvZw==; 5:Dl3HjEtxo/0fssFJDp16Zo7Ks0G3+TKzKTuBTJd21QNNWFxFe+ByfdGXA7dM+JN8N/+pdR2XF6WaL4YS44ahXSLtTjBesHtwgxEE57o4M2o4wR+ySsYieLbQiVHU6PT+B7yV+adyfnAGHByGPMtIY/XJtLZIpsQar7zs55PWeAQ=; 7:91tMhx2ZnmdrZJKYyYOWX2j5gopBIPxe/EKT2HR3Ne48fgVxeN6ma43SkufXj7LwZlJOTIPBUfl5M7rNzMUuM8pJOdymRUej2MYAC4QOsi6RqCvRStmx3RbIAKGZ5NdXtm1Xd3G3e+DNUmwfNXB1iFw5W7T/JAjfL861FPu+KGicEoimpLYrJl3X/1NmWYnGY8RyxasomD9JvK9aRZ1WScxDpMD4WZuHAWpdryMcEhf5TKvd+QOXqaRXfxdYTkxM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 21:54:20.0623 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81fe516e-5bda-4654-07ba-08d5fe42aa47 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2615 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.70.109 Subject: [Qemu-devel] [PATCH v6 1/8] qcow2: Options' documentation fixes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Leonid Bloch --- docs/qcow2-cache.txt | 16 +++++++++++----- qemu-options.hx | 9 ++++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 8a09a5cc5f..0f157d859a 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -97,12 +97,15 @@ need: l2_cache_size = disk_size_GB * 131072 refcount_cache_size = disk_size_GB * 32768 -QEMU has a default L2 cache of 1MB (1048576 bytes) and a refcount -cache of 256KB (262144 bytes), so using the formulas we've just seen -we have +With the default cluster size, to cover each 8 GB of the virtual image +size, 1MB of L2 cache is needed: - 1048576 / 131072 = 8 GB of virtual disk covered by that cache - 262144 / 32768 = 8 GB + 65536 / 8 = 8192 = 8 GB / 1 MB + +A default refcount cache is 4 times the cluster size, which defaults to +256 KB (262144 bytes). This is sufficient for 8 GB of image size: + + 262144 / 32768 = 8 GB How to configure the cache sizes @@ -130,6 +133,9 @@ There are a few things that need to be taken into account: memory as possible to the L2 cache before increasing the refcount cache size. + - At most two of "l2-cache-size", "refcount-cache-size", and "cache-size" + can be set simultaneously. + Unlike L2 tables, refcount blocks are not used during normal I/O but only during allocations and internal snapshots. In most cases they are accessed sequentially (even during random guest I/O) so increasing the diff --git a/qemu-options.hx b/qemu-options.hx index b1bf0f485f..f6804758d3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -752,15 +752,18 @@ image file) @item cache-size The maximum total size of the L2 table and refcount block caches in bytes -(default: 1048576 bytes or 8 clusters, whichever is larger) +(default: the sum of l2-cache-size and refcount-cache-size) @item l2-cache-size The maximum size of the L2 table cache in bytes -(default: 4/5 of the total cache size) +(default: if cache-size is not defined - 1048576 bytes or 8 clusters, whichever +is larger; otherwise, as large as possible or needed within the cache-size, +while permitting the requested or the minimal refcount cache size) @item refcount-cache-size The maximum size of the refcount block cache in bytes -(default: 1/5 of the total cache size) +(default: 4 times the cluster size; or if cache-size is specified, the part of +it which is not used for the L2 cache) @item cache-clean-interval Clean unused entries in the L2 and refcount caches. The interval is in seconds. From patchwork Thu Aug 9 21:53:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562071 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 80E9B14C0 for ; Thu, 9 Aug 2018 22:15:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CAF32BB95 for ; Thu, 9 Aug 2018 22:15:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D14D2BBA6; Thu, 9 Aug 2018 22:15:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5612F2BB95 for ; Thu, 9 Aug 2018 22:15:08 +0000 (UTC) Received: from localhost ([::1]:53166 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fntD1-0007xc-DB for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 18:15:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnst5-0004Kz-24 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnst0-0006Xw-QI for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:31 -0400 Received: from mail-eopbgr700117.outbound.protection.outlook.com ([40.107.70.117]:52025 helo=NAM04-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnst0-0006Wl-HN; Thu, 09 Aug 2018 17:54:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janustech.onmicrosoft.com; s=selector1-janustech-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RLbPvh6ml+sdi7+vkh/qiPcJVZJhttLkt69wrdChoLo=; b=V6YTMvaMhYzzKeR1sJbdLjmLofDyohf5legxeaCcmEP8tQaniQ25Kz5ZdfgUeT/X+1pdEjPPsXi8i+1FrfKLG+s80zAs0rSui+NAuxTBuJgaysQVOG9d0hBvDuhu/11+B5TJ8+Lf78Rg1BmiA1lhwSFX33rTTTJ7X5f8glp9qbY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Thu, 9 Aug 2018 21:54:22 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 00:53:01 +0300 Message-Id: <20180809215307.18241-3-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809215307.18241-1-lbloch@janustech.com> References: <20180809215307.18241-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM4PR0101CA0050.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::18) To CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1fb94a51-c3d1-421e-fee1-08d5fe42abd8 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:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 3:574FkSSq6H5BsNUpNLEIcCBnaj1UeOl0rCyf8MkRkbSWtww6hKKHVEsX+8CJ00uG7xOjUuJ1FTBEibJjEtpaFZmhcSKw0SLNwMlaN3+1P0cUZ0+xCoRO5+oO+HaGAOxv6pWAyFbMXbCCobtHY8uM3X4Vj+DfABSuocnuzk6I2mwquY07p3WG1jt6cCCY+CEgmgaZTJreWOEan2WNz42ZNk03UC1eCwX5H1PbPhH0swOXG9kmCKzLC27IwvfGc4j8; 25:vOn3hb9uy5oHth/r+zKMeGcRSO3flRpzLr1fS/+MDxnRL5rmkLJIzActlWAI9IeTRyKpgesP0xYr6vC2ABUEJacMYfKpQD4mWQ5Kk/vPpeKUk115uH2IVZSV3ko1/2ZMHmB5Z9nx5iYDNL/w8eMzv3oC9wjjMMoRt+ecqetW9t0+71G5nWmdBPjQl1qdAbHioe+ZVsEbqoZs0nP21JCHHDEniIC4jDh3eB2x8BdvGK8ey2PVxVTeXKD3y/veGUyqF9G0/eH4EFd9EgfRi017LophX55GTwN10ZzyQChgF5oWFVeyWEa1Q3rXj6ybFecfXLdB+f3QhJTE8zlzEpDR8g==; 31:l4wO+01R5uKOkBPWJ5GwqGbXEU15xZr/IuMi7pofe/wkZdSaZB7kgrevX0VEzvAbpw6GDBl/lBkxRTDU/DpgryDQ6B1FT5+tVG+C4knHeSxlNbbsQyBzozvsAA0nbA7psV2SC4UQdtk+ytMj84Jomf68ewsCbUFlTTio3ffCXrM1n/YilFM6MKeezl8XuFLLTnTYCIOb/0SVExIhcar+co0yaWRN3ncJHsr9ZX0dAJk= X-MS-TrafficTypeDiagnostic: CO2PR07MB2615: 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)(20161123558120)(20161123564045)(2016111802025)(20161123560045)(20161123562045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CO2PR07MB2615; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 4:PpQj0RWLy1ZH8eMzW6MQtwG1jPoi6JG6jKa1u0u9EnHa9+yifrahrX6uYe5nM/xcqBAjvqMcL3kR6RBFsRrt1p+xqoCZ7u9ncXIY+UAiNpyJXvHov+fQS8TvUIO+MBLpM7pe2/5eGuruXlBIwicOZSsfiULOqefDfYLw7tWBTv470BYavFYWr5ZLcT1QsFU0rwgMXE8ZPYcSbLRVejNzFtE+IhY/rNzBpT3pDQDQv6VfRFU77TTEMuFFDkyMrt9BhZDKwPLZRbAG5PSL7MRuhQ== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(979002)(376002)(346002)(396003)(136003)(39830400003)(366004)(199004)(189003)(486006)(2616005)(16526019)(86362001)(6486002)(7736002)(8936002)(16586007)(48376002)(478600001)(446003)(81156014)(68736007)(81166006)(186003)(476003)(26005)(305945005)(386003)(2906002)(8676002)(50466002)(50226002)(956004)(11346002)(25786009)(316002)(52116002)(51416003)(6116002)(6506007)(1076002)(3846002)(5660300001)(105586002)(6512007)(106356001)(6916009)(47776003)(36756003)(2351001)(4326008)(97736004)(53936002)(107886003)(66066001)(54906003)(2361001)(6666003)(76176011)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2615; 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; CO2PR07MB2615; 23:LZ+ZFnWdbIRuPbRo25zmwp0Xc2/p48vUZDMg1iGWB?= jOhWS84asxiHEoKuxRIpelYFUDZVnYM8ELfEX3Q9wL8vO7oZmw2eBmJiGqmMwCepCT36hKsU3tsHB8Mo7Kje9LLmeQSty5VfqaTFNu+Xg9APRaG6jUqqz/zupBv1BLbpgpqCN5U3VvFaSk+PTldFrKvyvgkKYYkQLs7vQveiSlB9bRJMEIQcLPqF9/ML/iAiiTAxY3yPXeLsONJDVs5aOUK2DY9sfmhEx1flC8qyJh8ChYHrmJiNTmnxIC/lYywsABBUD3/aRa0Ncf8T90X5ky/wpkeWc2YRo+A7VbBfGgUyV3yjerH6iNVpjWQEFp/6n6YxEOvm/WaTgDaCcJDzKDNSakz3p2GgelpOluxNC7b9Hb1DltS5UtGBsqaSBEwZ7d48VV6LIuT0W5bR7yqqHL8cr5OUSk1HZM2g7Db0RAPKk76IkV1wn/Lg5FzWGx+G3RHovP7B0pUdxYoC4Dtk3wHccOqjaPDSi7SPA49U+HNMZjjzt3DqAEsyLOMhWD9mvMTMPTdzBU47dAb4mGYIJPX85ce0MKWrZk3APyVH+hlqLD+n9gFu53PQhQNi5uRD4sAKzSMryyGosEoV0hVKwOUGXcBjg4a3hVWve7FWTnfI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FWjzjp+N/2Ks= X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 6:EHMgHLoAMOCbm719qbfCvibLmORC+VWtEhgq9cbjd4o65MIdBo1KmKD9/dtyruBKxWyehRjOl0cM7b7s5mv75rNS4SWW6ihNydfwkYKF9N2YW60/fzBFZ0Q8vyMmLAnywJBWElUqh6cSjhglYwIShtwzr8XcxI92U+EJC71kr239R9tkY7K0c9LW2R8TI/sC1qNpYqC/Ux7S2zMi5sRIiiu1Dl90oRHDXH1B3WaAZyZCdfdi6ZGHfiVVPmyGt3wglu9I9ieDeER/3ee5jAlUvCGO+A++IK0JMOqYk22tK0RzVUU3evyuRVuhw9y3P6id0JXqQAMZVpVZayO4wpxEoG9UDAFKziZnkWvIAvdZ3s6FPAWuqV//bP62Y78cdkYNR9Zgjjj8mwtNzJqC2QBP4VkxIWHGCzTCD9cUgjICP4d1Lp4sI/DVFRdJTdHrG7MgWkrfIRvVk3bHC9h/P2qBiA==; 5:Abc0vvSBZ0fnbu3WUQ9vWQtFtYL7UZATUU9W8NMlE7B5VGoyX3JwiAc98tmJtWFlrjbBy5ZfV/7hHkFFf4zZcDzsmInCf1Dz32EaecB83e8tMorQcOSOK5UiJM+m7vILPJp8eUke10aWJEY7FD0UpKrEiKzqsY6pUqCnLInUrrY=; 7:M8oOqYXCbcKAaONSSChG/RW9TTAu98sD8UzQSpcndWrHC14zhlD2SPFEae0bJJMG9hETwbO+z6uZg7360pCna+jV21AOiixJW9gonmQu+65YVloS/2yPwCX1qPfByi5AXlSA6IMWALnHxrJDVmiEdvK4+rpMAl5Wu8/XUp07nd3MeDiffD1E6rlhFXmMTh1HVhBSvhUfLlnJ5l33Lr97++9SGRf4dclFojzHG9x9E6hnxg4G9Wi/x7HAsTfU96N9 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 21:54:22.6986 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1fb94a51-c3d1-421e-fee1-08d5fe42abd8 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2615 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.70.117 Subject: [Qemu-devel] [PATCH v6 2/8] qcow2: Cosmetic changes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Some refactoring for better readability is done here. Signed-off-by: Leonid Bloch --- block/qcow2.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index ec9e6238a0..3f4abc394e 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -790,8 +790,9 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, *refcount_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_REFCOUNT_CACHE_SIZE, 0); - *l2_cache_entry_size = qemu_opt_get_size( - opts, QCOW2_OPT_L2_CACHE_ENTRY_SIZE, s->cluster_size); + *l2_cache_entry_size = qemu_opt_get_size(opts, + QCOW2_OPT_L2_CACHE_ENTRY_SIZE, + s->cluster_size); if (combined_cache_size_set) { if (l2_cache_size_set && refcount_cache_size_set) { @@ -823,8 +824,8 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, *l2_cache_size = max_l2_cache; *refcount_cache_size = combined_cache_size - *l2_cache_size; } else { - *refcount_cache_size = - MIN(combined_cache_size, min_refcount_cache); + *refcount_cache_size = MIN(combined_cache_size, + min_refcount_cache); *l2_cache_size = combined_cache_size - *refcount_cache_size; } } From patchwork Thu Aug 9 21:53:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562093 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 A716314C0 for ; Thu, 9 Aug 2018 22:25:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92F422BBCA for ; Thu, 9 Aug 2018 22:25:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 864592BBD3; Thu, 9 Aug 2018 22:25:38 +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 18E602BBCA for ; Thu, 9 Aug 2018 22:25:38 +0000 (UTC) Received: from localhost ([::1]:53262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fntNB-0002C4-9O for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 18:25:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnst7-0004Nk-CD for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnst3-0006Zh-EV for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:33 -0400 Received: from mail-eopbgr700108.outbound.protection.outlook.com ([40.107.70.108]:54605 helo=NAM04-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnst3-0006Z7-5M; Thu, 09 Aug 2018 17:54:29 -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=ere0v2onYxMfeecCxLJX64rSK/hbLR8F5bzMiOcDOfI=; b=O2j8v+6+IaJu/hvY9csRD7r9ItZupZk+BRbldsPHgs5moC3nc7/osQ66zxjMw2jQQ7qtUA9XbuoWcXvH0K0VlLaXncamtyEC3IyTWqVhF6DhbNoYrYBTAiaSw6TBcPxL7+3t4GTexsrh0PRrFeJT+TQoMn+wUbPDT0gwCawl3AY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Thu, 9 Aug 2018 21:54:25 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 00:53:02 +0300 Message-Id: <20180809215307.18241-4-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809215307.18241-1-lbloch@janustech.com> References: <20180809215307.18241-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM4PR0101CA0050.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::18) To CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 76dec44c-a246-4501-c203-08d5fe42ad5c 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:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 3:SLLC9PwUmlewUFKZBnKwXuOow3q+hsrR+eXsvg8ADvCHzamJblXgiIGzz6CGcIvoc+CCe9tS8hagocNEpNRlYxV61Xliq1Q99h3plRIxu2lL3qF8ezdaPtmZuM7x0cOX2gCjzIhDwqDHM4szQyfhGkMnhlNYfPLKsDMPcTHtTbMpEktgpcFNZyUrSS8ryW/wzm38OfqGYdvj/j6wmWtpDXm0ymVSnKjLspZpnfhucGX1A2PbPH9iF+eeinCBdV+5; 25:UuPycQY3akqSJMyQLCO98Ihc9XWQMG023XMN8M0hQ1NJsE9fg9dzGQTy+NMARw3b+25WEQJA3y91SKOEZ3vI5KWF/r8W3ykG6pbZe34wbvuwTcV+fgsYGY2oOeQm4cQxak0DriBAJ1hBPENp9Scaj78RtRKL4ceo0wOxIseGW3Yge1zEWUqqK3HJDduEBv+EYyN9GI7BzFryFpQCCaY/NaWIUQpaeqOaJdJE+DiHgEW5HxV2NTGcPA7XjOjckf+rAmBSCOj/Rw01I8JUJeusb15cQ909qpPrWB221CWXtGtxSS08Sb6fo6gX5Aq1qacGVXEeA9baTLZeampWv6uIvw==; 31:fFQqPt61zRaRJLs78ehOdUn0CEBofVDZrVhncxLpjET3OypVPZCmFPZr35oncPmJiyPref+/pBc8R57ISCCnonfbUmHDK/O+WKCl3EPEFPY25ix5CvyF37h/T+7MbILlROmHjTLzNGyOgC2AWX/oZ2fHCKgzol3HjkHw5MsE4PlBPDOfdRl3fO8MErqm7ut+r8dJXaKCg1LfXNF9aixDQyfWjhDF5UPX0rptWIl6KZo= X-MS-TrafficTypeDiagnostic: CO2PR07MB2615: 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)(20161123558120)(20161123564045)(2016111802025)(20161123560045)(20161123562045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CO2PR07MB2615; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 4:nKee9Eta8SgZy0ZzpRXJtd440QBDXw9nPKme8oMfhFj1vZK3xSqOAlQvKp4k22mmArNcY6+WTWqW/s5CO7Uq2fxpIt2RU3FZs7VTI9reQnzlyaH/91ZxnxYS+CtrqJ5mxtWdJCFnj6Vzb2UAgGZMWmbFVB4Ra5q5ES6IZcGbDxpukaT+VX7GO4jVPDyHm0mLkFrSbshVKnr/qtRFXr4zyRgFRow+il6isH8eV9Vfa+2NG0u+DJw/lEW87+wmjhHBBXVBse8o4ac6p6/F2fo2rg== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(396003)(136003)(39830400003)(366004)(199004)(189003)(486006)(2616005)(16526019)(86362001)(6486002)(7736002)(8936002)(16586007)(48376002)(478600001)(446003)(81156014)(68736007)(81166006)(186003)(476003)(26005)(305945005)(386003)(2906002)(8676002)(50466002)(50226002)(14444005)(956004)(11346002)(25786009)(316002)(52116002)(51416003)(6116002)(6506007)(1076002)(3846002)(5660300001)(105586002)(6512007)(106356001)(6916009)(47776003)(36756003)(2351001)(4326008)(97736004)(53936002)(107886003)(66066001)(54906003)(2361001)(6666003)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2615; 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; CO2PR07MB2615; 23:d6XaMXMnvsJuO2xd5jWD4ysUSdY6hKASR4zM6RLG/?= St6kQ7VdovVi2DJ6nZpWG7fasSDCsvss8/9wMnVS0JgVu/2ErLXixfixjw3LNFYv3lL/YIZNUL2CLeS2DfiKZWsVqCN6LZajbKUw/xZUShKbRbb0VAuvjWvv1oE3WD0eFzYVqfaurfvRwG061nCvczi5m539bzpf0bXq3pUkjvXoUEEZ4udTAnNHElqXL+CkxWuwzeXteQg89llZzfps0hLAm5qHACNH7qBSiAwdduXUAeFpKhpPTtM3FPbHlfLoNXc+sWMdFOIPeTh3tTGx6K98lPlDWNwBj7/D6Hs49dDTeedzRgTvEoq52LteF/Vo+EfKSE4UrxOawUOIBU56f/XVy+Y5j93fvnGbAaqjEdSVm/i7jhGbGnWFchWKLt2jatBSi5yV7JhhkDw9dANY+AdTXZ+IhKGYnzSZV2+WRtt0PM714Fz24s9GLm9dzrNeLVwb5/qxedlGhkZkDabDvY5Yq/7urNRXr5Bt3rWQBuZqp5U2uu1NHfNmaPbSljTtDjCEuuhJnnvFmYazwdqWI+TMsGzeAmtPZJ7qC9vxZ0b5xEESoOa7v3ZfU4rvhMfXHY+8T/dUhz7jq18KWXkFIkjCR2HWi9xPOemi2NMzi8z4tVR6efict18Tf3Moi3ifKOh4F3x6ehjrAuO7tZgv6/9QM9AsMUvsfxUi+o5iYYtwtHebOEXZAM7Osk8XjTmxTE0z8CoICGkfSm9s/QR1RXJM06/uiAjl9uwwVSzNRxaMikWT2sJz2RBZmwD5qgwx/zWKRt0a0IrmGkmL/nShqyQJEzlur7HiaEVFJlWWtv9VySIwBzO9tkBCDYyG3jLZ0Vh1jAkRi5bzHcNNqcICsmthmOFlo7KKJUjAKgGx1fCXKI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xSY7TZqtva6yUwN6EBeRpF03Z5mmCfzH0wojrfN/mcwbdYFrlkU+rywixDaaLOchQ2BtyHmmEdQ9oQYah8uK5oXbehz96dhn4nCRsW1U91KSM1yPteDnCsfE38grZ5UNMF6j+LsOK3Gx4fVC27KkmWHZlHWgNqt+NXouOJRD2oNLRaUHd544px+13/A==; 5:QZTF0o4znIcS6U+EDdHeiJISLAnjjxhkH+OP8In9nrn+U7hjezRqDzMHS6Uz7oWlqA+XJDX3g8npo+VduS40aRfq+Rf8NdaZDwmgmlyasyQ5P+d03KkfQHpMQA79nr07T6OkXh8wyMQtm/Zzaqo5a/UbbJUxgyYp5pk6D6oT/58=; 7:7e+x1zpTYVVWToqauVeYT/l119f45vWOgo7dtfkcxQMNDo1FVidhO0FQX3zxKDMyZfdqsC0kEo5qbSbETtSCqiiQfKxDTc/sZXVH32sEHVezdpFhdmJkv/9nSnGdrXdnPAexT5NvHxlR0rNQZYZLr++nfKoQxku91yi6cOaZyDo7KJ6cAYtQl1VkIpkM7gbQQpvyE6mbWOR82eLIVmtr60DgqIOYC+qv5jFcbv+NR/GkXmNVb+7HRcs2gIbfCqC2 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 21:54:25.2409 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76dec44c-a246-4501-c203-08d5fe42ad5c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2615 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.70.108 Subject: [Qemu-devel] [PATCH v6 3/8] qcow2: Avoid duplication in setting the refcount cache size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The refcount cache size does not need to be set to its minimum value in read_cache_sizes(), as it is set to at least its minimum value in qcow2_update_options_prepare(). Signed-off-by: Leonid Bloch --- block/qcow2.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 3f4abc394e..a8b65189fc 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -829,16 +829,13 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, *l2_cache_size = combined_cache_size - *refcount_cache_size; } } - } else { - if (!l2_cache_size_set) { - *l2_cache_size = MAX(DEFAULT_L2_CACHE_BYTE_SIZE, - (uint64_t)DEFAULT_L2_CACHE_CLUSTERS - * s->cluster_size); - } - if (!refcount_cache_size_set) { - *refcount_cache_size = min_refcount_cache; - } + } else if (!l2_cache_size_set) { + *l2_cache_size = MAX(DEFAULT_L2_CACHE_BYTE_SIZE, + (uint64_t)DEFAULT_L2_CACHE_CLUSTERS + * s->cluster_size); } + /* If refcount-cache-size is not specified, it will be set to minimum + * in qcow2_update_options_prepare(). No need to set it here. */ if (*l2_cache_entry_size < (1 << MIN_CLUSTER_BITS) || *l2_cache_entry_size > s->cluster_size || From patchwork Thu Aug 9 21:53:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562075 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 C6F7D13B4 for ; Thu, 9 Aug 2018 22:18:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3EC62BB0B for ; Thu, 9 Aug 2018 22:18:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3C2D2BB0E; Thu, 9 Aug 2018 22:18:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 053E52BB0B for ; Thu, 9 Aug 2018 22:18:00 +0000 (UTC) Received: from localhost ([::1]:53182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fntFn-0001ky-La for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 18:17:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnst8-0004Oz-GM for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnst6-0006cE-Qc for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:34 -0400 Received: from mail-co1nam05on071d.outbound.protection.outlook.com ([2a01:111:f400:fe50::71d]:44661 helo=NAM05-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnst6-0006bI-FY; Thu, 09 Aug 2018 17:54:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janustech.onmicrosoft.com; s=selector1-janustech-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p3ogQsDfqHAGpOYmTKKWX4A8pNpamGCuEyrh8Chkxd0=; b=ZzP7o0Kyajs7kSgpOe12H28HJlpfCd+zi1WxbCjwhBCk71wAKAJr/aCLyFKYIdIMPXOiDCvppLzyeK7SYrormJA4IQbdw1XrSL+VakpO1Le4juZiqhpM94JIQWgPDk4k4iAwEmSpfq3devUDDGCUqzUzY+/IyP3x98PAAdhxqWo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Thu, 9 Aug 2018 21:54:27 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 00:53:03 +0300 Message-Id: <20180809215307.18241-5-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809215307.18241-1-lbloch@janustech.com> References: <20180809215307.18241-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM4PR0101CA0050.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::18) To CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8d8441e8-16ee-4144-f1f8-08d5fe42aeef 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:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 3:rnXC3SPYT1CCdJ0v1GqunPfrJm2tcZSVtz5mmqxH1d7pblAo9sKxbwf+Oj6Ksk8B7M/xSi1/waN6v7pXPioE22CWG6pxZq5AQGiNeTmdTllvUUpVdJ0/mM8aigLIhC47YoDiZe44M90xOLQ2Ps99cjSGG7nZ25E3JaM1oGmByuvDOjJX1aefgnoiNir4kdX8Wm+BAcJqxyqK6D9DIfokOxWTDqHi+i1kOM58hxzLU0Q9tithMIt1ADqb/j5T0mDy; 25:urUjgllDzof6+5RslEEKVX1ajn4PiwTj/+umb+QXTdXluMVbONJMNWY8lgHAxDCrgvKSc74uJFtyU4cOSPwpLSxjadcnOspp1Wzzf14SrwXvjA9ZpOtJgNxEoEbDP4IsjbE/iMP/1DTss8Lp0JdT6l699rmf7hIWQxObMiD5q0j1NEzPOHEGTHKUimn9Y1kYbG5yVnVeansA43ZDTtQZPUaX8OgTM4z7nLfycaI5WWqyyUv3cTvhKg288IlKpCvooLP5lMf8BN6dYTx6SQmif7TfM5rVzqSthu5u98mRUASByjZ+el4NjHbqvJzLLoiR3mHj1wcQrljvhFa6jeSnnQ==; 31:6yzROVmm9q3xGoGB9gCMHRWLm8I2JK2+nWSNQU/p128I1DjMqw69T91aVaCCUO/HEdOw2ZRLEZwmfbZfyv8lKYIy+IeS4eBh4ceeQr97q0SEDVyZit6UuAE7Yw/efpFbxmN083knaMG7+0yV941H1OiSj3CWJWhOsxgD80SZUpKA+ZVYNb2igGk5MVciEuKpmFsQff9tuicFUgHwmbcL88PeCT7TBVpF7xuc2zf7T3Q= X-MS-TrafficTypeDiagnostic: CO2PR07MB2615: 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)(20161123558120)(20161123564045)(2016111802025)(20161123560045)(20161123562045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CO2PR07MB2615; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 4:7fVjcKpTaolwvBod3K2xUkHmoQnAAfAtgwDMIzISyR6UZkGR0x2j1XR+OdxqCYOn40Xv8xDzvLuyQd3Te7apZCtixxhVSlP2R8hKRW1KBvV3qOpwvhCuAhpZrYMl1nkCplmmjEPey3yq4W86Es+e2bbH8/rkYRD3isWyNVgYPmPiGV3PaGSi/LFEE+++vKX5Xjbvxw6mmO05aTinbpgM3n74Geh1ECCQWMZbQxFe+8K99asFPHXiZWSRKIfwg4Lvuf5Bxi91yxiJnqspgQLZng== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(396003)(136003)(39830400003)(366004)(199004)(189003)(486006)(2616005)(16526019)(86362001)(6486002)(7736002)(8936002)(16586007)(48376002)(551984002)(478600001)(446003)(81156014)(68736007)(81166006)(186003)(476003)(26005)(305945005)(386003)(2906002)(8676002)(50466002)(50226002)(14444005)(956004)(11346002)(25786009)(316002)(52116002)(51416003)(6116002)(6506007)(1076002)(3846002)(5660300001)(105586002)(6512007)(106356001)(6916009)(47776003)(36756003)(2351001)(4326008)(97736004)(53936002)(107886003)(66066001)(54906003)(2361001)(6666003)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2615; 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; CO2PR07MB2615; 23:XkfLDl8N1JFiOnLpGeo+5VpIBG6qQCNYh1GDBLynU?= pKQtygJeXSBz4bHAoYpJuIP95O7jZ60Cyn1Pdas+i+HNOnA3XCDLNZNYnMhtjAKPUchbXWAQd+RECqLptOLwNNJ5h6a3sAIY/AEDgvbftn//zA7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xPK2pKF9WPj9Rp8vNfwOroOXx6sghItEn4ri7UzT9KF58funleR5JYpMInrnYFZKdU=; 7:rSnzg7Td0LyyiDeVfAzePDSFUqumC7Ks5+GHUuxYfuJbj9cTPbGvpvCDpaIPxszBEQXjjFodi2PepfNIlj8MZ4iFgs+BSgydqhmx7s1LC89pmFG2I2jO+T7bOBBUq3JotHRxXHUqqFfl5BzNdVJLq58aDzc7K3mhbO0Kp9Tv40Uebbvn7MkcjfYFqs2VYkvq11TlghGs3K9MZS2MLeumsKaL19mWB2xqT+HW+NPic5FOBZ3QxifBihb+8wp61fzC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 21:54:27.8802 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8d8441e8-16ee-4144-f1f8-08d5fe42aeef X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2615 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::71d Subject: [Qemu-devel] [PATCH v6 4/8] qcow2: Assign the L2 cache relatively to the image size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Sufficient L2 cache can noticeably improve the performance when using large images with frequent I/O. Previously, the L2 cache was allocated without considering the image size, and an option existed to manually determine its size. Thus to achieve a full coverage of an image by the L2 cache (i.e. use more than the default value of MAX(1 MB, 8 clusters)), a user needed to calculate the required size manually, or with a script, and pass this value to the 'l2-cache-size' option. Now, the L2 cache is assigned taking the 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 1 MB by default (enough to cover an 8 GB image with the default cluster size) but can be increased or decreased using the 'l2-cache-size' option. This option was previously documented as the *maximum* L2 cache size, and this patch makes it behave as such, instead of as a constant size. Also, the existing option 'cache-size' can limit the sum of both L2 and refcount caches, as previously. Signed-off-by: Leonid Bloch --- block/qcow2.c | 22 ++++++++++------------ block/qcow2.h | 4 +--- docs/qcow2-cache.txt | 13 ++++++++----- qemu-options.hx | 6 +++--- tests/qemu-iotests/137 | 1 - tests/qemu-iotests/137.out | 1 - 6 files changed, 22 insertions(+), 25 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index a8b65189fc..434fb89076 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -777,16 +777,19 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, uint64_t *refcount_cache_size, Error **errp) { BDRVQcow2State *s = bs->opaque; - uint64_t combined_cache_size; + uint64_t combined_cache_size, l2_cache_max_setting; bool l2_cache_size_set, refcount_cache_size_set, combined_cache_size_set; int min_refcount_cache = MIN_REFCOUNT_CACHE_SIZE * s->cluster_size; + uint64_t virtual_disk_size = bs->total_sectors * BDRV_SECTOR_SIZE; + uint64_t max_l2_cache = virtual_disk_size / (s->cluster_size / 8); combined_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_CACHE_SIZE); l2_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_L2_CACHE_SIZE); refcount_cache_size_set = qemu_opt_get(opts, QCOW2_OPT_REFCOUNT_CACHE_SIZE); combined_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_CACHE_SIZE, 0); - *l2_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_L2_CACHE_SIZE, 0); + l2_cache_max_setting = qemu_opt_get_size(opts, QCOW2_OPT_L2_CACHE_SIZE, + DEFAULT_L2_CACHE_MAX_SIZE); *refcount_cache_size = qemu_opt_get_size(opts, QCOW2_OPT_REFCOUNT_CACHE_SIZE, 0); @@ -794,13 +797,16 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, QCOW2_OPT_L2_CACHE_ENTRY_SIZE, s->cluster_size); + *l2_cache_size = MIN(max_l2_cache, l2_cache_max_setting); + if (combined_cache_size_set) { if (l2_cache_size_set && refcount_cache_size_set) { error_setg(errp, QCOW2_OPT_CACHE_SIZE ", " QCOW2_OPT_L2_CACHE_SIZE " and " QCOW2_OPT_REFCOUNT_CACHE_SIZE " may not be set " "at the same time"); return; - } else if (*l2_cache_size > combined_cache_size) { + } else if (l2_cache_size_set && + (l2_cache_max_setting > combined_cache_size)) { error_setg(errp, QCOW2_OPT_L2_CACHE_SIZE " may not exceed " QCOW2_OPT_CACHE_SIZE); return; @@ -815,13 +821,9 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, } else if (refcount_cache_size_set) { *l2_cache_size = combined_cache_size - *refcount_cache_size; } else { - uint64_t virtual_disk_size = bs->total_sectors * BDRV_SECTOR_SIZE; - uint64_t max_l2_cache = virtual_disk_size / (s->cluster_size / 8); - /* Assign as much memory as possible to the L2 cache, and * use the remainder for the refcount cache */ - if (combined_cache_size >= max_l2_cache + min_refcount_cache) { - *l2_cache_size = max_l2_cache; + if (combined_cache_size >= *l2_cache_size + min_refcount_cache) { *refcount_cache_size = combined_cache_size - *l2_cache_size; } else { *refcount_cache_size = MIN(combined_cache_size, @@ -829,10 +831,6 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, *l2_cache_size = combined_cache_size - *refcount_cache_size; } } - } else if (!l2_cache_size_set) { - *l2_cache_size = MAX(DEFAULT_L2_CACHE_BYTE_SIZE, - (uint64_t)DEFAULT_L2_CACHE_CLUSTERS - * s->cluster_size); } /* If refcount-cache-size is not specified, it will be set to minimum * in qcow2_update_options_prepare(). No need to set it here. */ diff --git a/block/qcow2.h b/block/qcow2.h index 81b844e936..0bab3d8b94 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 1048576 /* bytes */ #define DEFAULT_CLUSTER_SIZE 65536 diff --git a/docs/qcow2-cache.txt b/docs/qcow2-cache.txt index 0f157d859a..69af306267 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -124,8 +124,11 @@ There are a few things that need to be taken into account: - Both caches must have a size that is a multiple of the cluster size (or the cache entry size: see "Using smaller cache sizes" below). - - The default L2 cache size is 8 clusters or 1MB (whichever is more), - and the minimum is 2 clusters (or 2 cache entries, see below). + - The default L2 cache size will cover the entire virtual size of an + image, up to a certain maximum. This maximum is 1 MB by default + (enough for image sizes of up to 8 GB with the default cluster size) + and it can be reduced or enlarged using the "l2-cache-size" option. + The minimum is 2 clusters (or 2 cache entries, see below). - The default (and minimum) refcount cache size is 4 clusters. @@ -183,9 +186,9 @@ Some things to take into account: always uses the cluster size as the entry size. - If the L2 cache is big enough to hold all of the image's L2 tables - (as explained in the "Choosing the right cache sizes" section - earlier in this document) then none of this is necessary and you - can omit the "l2-cache-entry-size" parameter altogether. + (the default behavior for images of up to 8 GB in size) then none + of this is necessary and you can omit the "l2-cache-entry-size" + parameter altogether. Reducing the memory usage diff --git a/qemu-options.hx b/qemu-options.hx index f6804758d3..22e8e2d113 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -756,9 +756,9 @@ The maximum total size of the L2 table and refcount block caches in bytes @item l2-cache-size The maximum size of the L2 table cache in bytes -(default: if cache-size is not defined - 1048576 bytes or 8 clusters, whichever -is larger; otherwise, as large as possible or needed within the cache-size, -while permitting the requested or the minimal refcount cache size) +(default: if cache-size is not specified - 1M; otherwise, as large as possible +within the cache-size, while permitting the requested or the minimal refcount +cache size) @item refcount-cache-size The maximum size of the refcount block cache in bytes diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137 index 87965625d8..e3fb078588 100755 --- a/tests/qemu-iotests/137 +++ b/tests/qemu-iotests/137 @@ -109,7 +109,6 @@ $QEMU_IO \ -c "reopen -o cache-size=1M,l2-cache-size=64k,refcount-cache-size=64k" \ -c "reopen -o cache-size=1M,l2-cache-size=2M" \ -c "reopen -o cache-size=1M,refcount-cache-size=2M" \ - -c "reopen -o l2-cache-size=256T" \ -c "reopen -o l2-cache-entry-size=33k" \ -c "reopen -o l2-cache-entry-size=128k" \ -c "reopen -o refcount-cache-size=256T" \ diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out index 6a2ffc71fd..70f245ae7a 100644 --- a/tests/qemu-iotests/137.out +++ b/tests/qemu-iotests/137.out @@ -19,7 +19,6 @@ Parameter 'lazy-refcounts' expects 'on' or 'off' cache-size, l2-cache-size and refcount-cache-size may not be set at the same time l2-cache-size may not exceed cache-size refcount-cache-size may not exceed cache-size -L2 cache size too big L2 cache entry size must be a power of two between 512 and the cluster size (65536) L2 cache entry size must be a power of two between 512 and the cluster size (65536) Refcount cache size too big From patchwork Thu Aug 9 21:53:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562079 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 AD233139A for ; Thu, 9 Aug 2018 22:20:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C80A2BBD4 for ; Thu, 9 Aug 2018 22:20:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 90D8B2BBDC; Thu, 9 Aug 2018 22:20:32 +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 036A72BBD4 for ; Thu, 9 Aug 2018 22:20:32 +0000 (UTC) Received: from localhost ([::1]:53196 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fntIF-0004G1-6F for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 18:20:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnstD-0004RJ-1M for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnst9-0006eC-0E for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:39 -0400 Received: from mail-eopbgr700129.outbound.protection.outlook.com ([40.107.70.129]:34372 helo=NAM04-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnst8-0006d4-Nm; Thu, 09 Aug 2018 17:54:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janustech.onmicrosoft.com; s=selector1-janustech-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=D33CEUHZRyA39E3/K21wnojuniyTTgQaelwlvPSfSl8=; b=UE/JU5586ooDl+9qA2Usw4FPOskBH8K0JyaG3vHbpmQq5g+GFGmOM4cMe7iHJVyMzp79H0go4nktmJasdd/yu6HgZbhPCKuQuLfH98OPBrwTx/Rj2oTR+SbAsLcs5thy926NEwOKPt00letNPO6jS7Wt7RlcDDMGodmCDhykfjw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Thu, 9 Aug 2018 21:54:30 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 00:53:04 +0300 Message-Id: <20180809215307.18241-6-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809215307.18241-1-lbloch@janustech.com> References: <20180809215307.18241-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM4PR0101CA0050.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::18) To CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a0fe77fe-13c6-45a0-9ea2-08d5fe42b07f 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:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 3:1msJl1IOdOLdXutpb62QYBBO0SIG4GgXVi0AFz3xhS3c9D1tq0128ju5OhofzprOmsvkM25Ofzj7X8/S7XQOnIdSAMDD4x2PnES60l+nHTlaO43AV3G5cQV15at7ClCXhOPlloqo4np9sjnHkvo9jXxIt3F0FQGEqb1BLaDqtBjNM0QVYEW8qNcZr6tXpuhw7Nng4g5S0ouwrI/CXw8Q2gWlq4cezv3UeRfb1aRgcpI+mwcjlOlr1MzufRwSzHaO; 25:YoGdyqSlIqj2FTar3dm5fXGzX7D6F7FeIOD0ngng8naNVOcZ5+suHuhjpPS27zoJxC2szNn9zOEQgT+NpZMP1XHBn0O3OLKtUZvGwMVXZmWEwywY29SqIxY0U5Q+km1QyvOwwjgE27RAKWA/MaIyHAHURvjcMAq49ug+q70d7w0c4dWsDngXI5tPOjLgv+qpuonUwutZMqH2ILrNvQRnXFvREVfU+ywfzK0muZlvjX+cbuyCcrheY0yGVtLIljtAAURvt8W9+D31Vm9/LFbDi+1FEd0soqYwSqW2N82bZj9ZbD/+K4ladrMqWwEPNTFgfjjAvRPldKCZYUzvX35hlQ==; 31:wmivB4Zye6b6hYA8sD88pGmIKFnSWMBqjjdc/NYyp0EeVmfL8dGXQHRPN6Q0CuSZtmGdaaN2GfPcGs7avSJzprtI1paFlAtdJ6PRNGi+6EwZa1mmK8vWtq6uSx7NcPe0OtZ4M7iXviDdTx8o0p68AzRvg/HVw90uVxJ7+mLs2SrJPAPcfkAv+T2FA/Nx4sPQo9Sxv2eFvzntZMfu/6TJnAV5FneEvX5EtYm0pCZODsE= X-MS-TrafficTypeDiagnostic: CO2PR07MB2615: 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)(20161123558120)(20161123564045)(2016111802025)(20161123560045)(20161123562045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CO2PR07MB2615; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 4:6Qi/pE49Ep04EFEO+1OmEkD6W+0ZjBnES+Ikh7jSvmsSV20mYXU99uhPAZOF2fOwvjtG0NVf8Ge1RvytX60z2hZZ2fQOGY9OLPQitWDLcSIJW3QIERrquUVTC91dvrzk6C5LLfSzukVGudrijgCnmHqBh++ybBLvjLzSHDiywe3QmTNZytTbBS3vVqoq8qDYS4jP4aEAmmGuynyvxO9x2dAcGS0KnY6yx1NJ1FoFYYJVBSLy35n4iDInRLmiUvpeJs1MdYivj/kqSyy1y4t72g== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(396003)(136003)(39830400003)(366004)(199004)(189003)(486006)(2616005)(16526019)(86362001)(6486002)(7736002)(8936002)(16586007)(48376002)(478600001)(446003)(81156014)(68736007)(81166006)(186003)(476003)(26005)(305945005)(386003)(2906002)(8676002)(50466002)(50226002)(14444005)(956004)(11346002)(25786009)(316002)(52116002)(51416003)(6116002)(6506007)(1076002)(3846002)(5660300001)(105586002)(6512007)(106356001)(6916009)(47776003)(36756003)(2351001)(4326008)(97736004)(53936002)(107886003)(66066001)(54906003)(2361001)(6666003)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2615; 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; CO2PR07MB2615; 23:KiE3bPo3SkhNV6YjuajggjPG0ApH09MA8ftQxuYm0?= EweoY9X5X9YReICw2tX1xYqf4QO7ZGoQO6Wt+Hu0s0lGvomJx8PYIE1MY2sGEo3srAKeE3ZS/b3w2PPiYwsSNVI+y+j4hGruUomgQArfsPMViFYvP7/GVHPlySnDsljuwpHDmY5Mv2QliL9zKfjXso3kqnV6bshia6X8V1aEjvNm89me0Qv3kNMkJcdxzbtIZ4jVz8ou4p8eVB8ZfELlPfqFBgqlDrKqYb5vHF9axLR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vF4ewVb9glB9Nb6P1HKksiw2hV6UIkfIfyOzm2tnYeNfi4qSQKg6u+vfSdj08COb1r+dUZERP4CSGXBKSD+rrIazBM05Yem6L5D1fczdyDvlka6ua0KEOnXiJ5r1Ujm3aYJAO45UO17nWw7KTasKFOETKgEPPTDWre9pF5MfLy9F9T8shVPn70kCnrZeE4a6tL29ZS SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 21:54:30.5005 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a0fe77fe-13c6-45a0-9ea2-08d5fe42b07f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2615 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.70.129 Subject: [Qemu-devel] [PATCH v6 5/8] qcow2: Increase the default upper limit on the L2 cache size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The upper limit on the L2 cache size is increased from 1 MB to 32 MB. This is done in order to allow default full coverage of an image with the L2 cache for images of up to 256 GB in size (was 8 GB). Note, that only the needed amount to cover the full image is allocated. The value which is changed here is just the upper limit on the L2 cache size, beyond which it will not grow, even if the size of the image requires it to. Signed-off-by: Leonid Bloch --- block/qcow2.h | 2 +- docs/qcow2-cache.txt | 6 +++--- qemu-options.hx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/block/qcow2.h b/block/qcow2.h index 0bab3d8b94..d77a31d932 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -73,7 +73,7 @@ /* Must be at least 4 to cover all cases of refcount table growth */ #define MIN_REFCOUNT_CACHE_SIZE 4 /* clusters */ -#define DEFAULT_L2_CACHE_MAX_SIZE 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 69af306267..6ad1081d1a 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -125,8 +125,8 @@ There are a few things that need to be taken into account: (or the cache entry size: see "Using smaller cache sizes" below). - The default L2 cache size will cover the entire virtual size of an - image, up to a certain maximum. This maximum is 1 MB by default - (enough for image sizes of up to 8 GB with the default cluster size) + image, up to a certain maximum. This maximum is 32 MB by default + (enough for image sizes of up to 256 GB with the default cluster size) and it can be reduced or enlarged using the "l2-cache-size" option. The minimum is 2 clusters (or 2 cache entries, see below). @@ -186,7 +186,7 @@ Some things to take into account: always uses the cluster size as the entry size. - If the L2 cache is big enough to hold all of the image's L2 tables - (the default behavior for images of up to 8 GB in size) then none + (the default behavior for images of up to 256 GB in size) then none of this is necessary and you can omit the "l2-cache-entry-size" parameter altogether. diff --git a/qemu-options.hx b/qemu-options.hx index 22e8e2d113..4c44cdbc23 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -756,7 +756,7 @@ The maximum total size of the L2 table and refcount block caches in bytes @item l2-cache-size The maximum size of the L2 table cache in bytes -(default: if cache-size is not specified - 1M; otherwise, as large as possible +(default: if cache-size is not specified - 32M; otherwise, as large as possible within the cache-size, while permitting the requested or the minimal refcount cache size) From patchwork Thu Aug 9 21:53:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562095 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 60DEF96FA for ; Thu, 9 Aug 2018 22:25:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D5B02B407 for ; Thu, 9 Aug 2018 22:25:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EC612BBCA; Thu, 9 Aug 2018 22:25:59 +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 B0FE12B407 for ; Thu, 9 Aug 2018 22:25:57 +0000 (UTC) Received: from localhost ([::1]:53254 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fntNU-000140-US for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 18:25:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnstC-0004RI-IX for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnstB-0006fY-CZ for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:54:38 -0400 Received: from mail-co1nam05on0724.outbound.protection.outlook.com ([2a01:111:f400:fe50::724]:21479 helo=NAM05-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnstB-0006f0-3T; Thu, 09 Aug 2018 17:54:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janustech.onmicrosoft.com; s=selector1-janustech-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5KZMmlmN7dOAE01Wi8hStPLGyKFALSicNbHHp0xlCmw=; b=n1EhhSYVul20vhKMQ/po2a+/jw4lLrhZe5AVrRSor1EZpDbA2XXwdvkyVZMdZ5xzWRetR1FGL/2rRyErkP5CNtTmNNsnxrccuNyFYUFiXW6lgVMYxMUAov1wVd4aVaGyZ7f0cSg+/8tNTCY8MUm3Qko7F2q6vND5F6WqLmrxLz4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Thu, 9 Aug 2018 21:54:33 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 00:53:05 +0300 Message-Id: <20180809215307.18241-7-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809215307.18241-1-lbloch@janustech.com> References: <20180809215307.18241-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM4PR0101CA0050.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::18) To CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 35f1f67e-ebc2-4e7a-2f77-08d5fe42b209 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:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 3:fBIN3Nxt16EEfLcz14w52EHhSA06fSrCOoPXSsE06KK/r/jb+kniMDlq4T4Nqp8yfEcMB8liMm2VslQzcQHV6dG/2QScUvkA7tQQ60en46IvXJx3VZ4CiRNWR5KkVS9IfxrWKyR7uKPbpbfy9lrWw6BflSlEPEyuRPHdBrK0OzqK2rTo8PJePsBXevPQd/Ei5TXOJDHZu92RnFdDianrwbIBStlJI116hzRo+31sARnQwad3PoZ7Xf3CPtHQO8fG; 25:WtmBjk1UeVvR2K3PtPA7XVHc7Ckh346Vlw6jd3zKncihXg8uq6tayHCFulDPTr+XjfO3SZjDVIQ/jb8CpylrcF39p1VYKO0K25zdv90ewRRvPNK2Oq6OOh+4IUhybFckQTIT9FpY0k7cUITTENwhpQcifo64q8GGY5VKjLMs0OxgusU3AuUBmphJfW7EdGiBUpbnECh8w/XqJXTb5UdaWOxIUrxYywJ/N9/Efc96NpOS1XglHiK133PjCm498ktzKeQnr2EsNsuqc6ifrU73oB3MHILb/0Mzoq+mRG6Reo3oDANC6gcNE2qhN4DWF8WrhbiPVERDtm9E0/AXmUf7Yg==; 31:YwgNmFUI+YYJeoneZz2NMe5dv5GCMNw0bLrZGtE9BMnP7QDLhn54b/angk5xo4Dsa/2zobnd6Sumx8ZDgZjCUio0+URYorZ1J66b8prbX6L79n5xczYCs5LtvxNoc0UIvIIWEr0cnefzUoFfMCr1tsDwus2rAHT5ST3G0pN7I7xN91iqMDqXTk+4pH6ogiCGX7efXppqKH/xfMnU0mClM82Riq/8qLXU0dPPyvJGsDE= X-MS-TrafficTypeDiagnostic: CO2PR07MB2615: 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)(20161123558120)(20161123564045)(2016111802025)(20161123560045)(20161123562045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CO2PR07MB2615; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 4:6o1XwLwkWL8iV/DHt6tNUc6SSPiHRqDNxwvh01jYPVNr8P6/Za56f6Lzqf/b5nmel01KjXCwGe0TDXl3yGjmKlruNl4K+9eXjxaxXMtEJUVENChUmfKz2W8T3gsSfqbKI/CyS8R4gnSBJh218X86M9Cx8V4MTtic2Bv3YupWd5sdwmsE1m2T+MobTExnYCq+WyYRO5wtwUNrqxPeeVQrMbeZpgUtlmqL+yef9Drn+2SS6tj7EpE4lRW3bbKKEoVMnB4qcp8keqmzp5VlTI2yNA== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(396003)(136003)(39830400003)(366004)(199004)(189003)(486006)(2616005)(16526019)(86362001)(6486002)(7736002)(8936002)(16586007)(48376002)(478600001)(446003)(81156014)(68736007)(81166006)(186003)(476003)(26005)(305945005)(386003)(2906002)(8676002)(50466002)(50226002)(14444005)(956004)(11346002)(25786009)(316002)(52116002)(51416003)(6116002)(6506007)(1076002)(3846002)(5660300001)(105586002)(6512007)(106356001)(6916009)(47776003)(36756003)(2351001)(4326008)(97736004)(53936002)(107886003)(66066001)(54906003)(2361001)(6666003)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2615; 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; CO2PR07MB2615; 23:wWEsMoaGm5F+FhejQhuFmy8G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irCFv1ppaVMIwlKECHUtc0s/416h4Qi6gBg9LOjPA==; 5:hN30AIbbf+x7i6wnWZeSaH+QrqJaGwoEGwRvzSe7NIWrSbH56SXKJ2nVeluKyI0pULrhv1QLsILkCzzkeKF4Zb70GG2ruBLgjeiHWRcsJf4JJaEvAaE4uj6HDmNkywC43lkKYlbltws8UBVjHlB40d/jT5XJTpF1Hcyf0yFC3sA=; 7:p/wEwJPXmohZMnuj3YtEF3qBKAZmMPm9qGrZc9HfKlOI+vhmc87VUn6BY/VTmJaB9+QixQRYzigj3s7AwYK1Qr0sQG8YSxZWWH1k4UjUNkMh/vdsv4Cv6q38gu23eVET6+Q7tmLvDavMLA6F45ECGVgke70GbTyGEab1m+r2+EddgpOKhBlLzLLBJwwUZ6JdOsJ0y39YPuR+oaso8WrtV4F0nWscgTQ6Gi4YKmPIPXhw5ByW3J+lzGKoamlh0QHW SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 21:54:33.0798 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35f1f67e-ebc2-4e7a-2f77-08d5fe42b209 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2615 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::724 Subject: [Qemu-devel] [PATCH v6 6/8] qcow2: Resize the cache upon image resizing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The caches are now recalculated upon image resizing. This is done because the new default behavior of assigning L2 cache relatively to the image size, implies that the cache will be adapted accordingly after an image resize. Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- block/qcow2.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index 434fb89076..ba4dfae735 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3418,6 +3418,7 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, uint64_t old_length; int64_t new_l1_size; int ret; + QDict *options; if (prealloc != PREALLOC_MODE_OFF && prealloc != PREALLOC_MODE_METADATA && prealloc != PREALLOC_MODE_FALLOC && prealloc != PREALLOC_MODE_FULL) @@ -3642,6 +3643,8 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, } } + bs->total_sectors = offset / BDRV_SECTOR_SIZE; + /* write updated header.size */ offset = cpu_to_be64(offset); ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, size), @@ -3652,6 +3655,13 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, } s->l1_vm_state_index = new_l1_size; + + /* Update cache sizes */ + options = qdict_clone_shallow(bs->options); + ret = qcow2_update_options(bs, options, s->flags, errp); + if (ret < 0) { + goto fail; + } ret = 0; fail: qemu_co_mutex_unlock(&s->lock); From patchwork Thu Aug 9 21:53:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562099 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 D5DDD139A for ; Thu, 9 Aug 2018 22:30:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFCB52BBD5 for ; Thu, 9 Aug 2018 22:30:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B47F62BBFE; Thu, 9 Aug 2018 22:30:15 +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 220182BBD5 for ; Thu, 9 Aug 2018 22:30:15 +0000 (UTC) Received: from localhost ([::1]:53315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fntRe-00063x-9i for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 18:30:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnsta-00052f-IM for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:55:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnstW-0006ox-J4 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:55:02 -0400 Received: from mail-co1nam05on071c.outbound.protection.outlook.com ([2a01:111:f400:fe50::71c]:30903 helo=NAM05-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnstW-0006oN-9s; Thu, 09 Aug 2018 17:54:58 -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=Ha1eiX9E45t2eLttLAnFseAE2krJtm7sORU/EEKM8D8=; b=nqCcDkNEdGWmWQQE93eiVk1V8JKhoW4Anccz+iQVUuQdDy31PWgyCLVzTMfc53j0u2YXh14JwKhKUwizr7y0dBQY69DMApzHzwV5aprZrQlthOqlganI/x8XBnSlrsk0H2W1NQN0k7tTh1a77TF+XkRQQ/s3kmTbJFVXKFkIisI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Thu, 9 Aug 2018 21:54:35 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 00:53:06 +0300 Message-Id: <20180809215307.18241-8-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809215307.18241-1-lbloch@janustech.com> References: <20180809215307.18241-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM4PR0101CA0050.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::18) To CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 224473e3-0218-4b83-631d-08d5fe42b39a 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:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 3:jN/iqUfrV+pEzCmJ9x6BT0QXRcneYWytiUDuUinrToc5A7y6as25MUlyIvswY7eEe5N0MlvfBoDkQb88cKRYcgO5h/xcc/hIMXIJMAs8QUt/UrAI+jVRFEKkYiTKzz4DHwlmj9nREpIrB0LfTeUt2Nocx371GUyPpzcQ8yiJ/nWs53oPXOSVUXJsJUuul8Abf8/ZBunKqxzjyTC941xrQfJ1tD4sVESno105pgKY0DKCu1RNLHXayFAcPJ5u3cpV; 25:uk8DRj+8WCEcsyHtDsLmO4/YrPZcmIHVPd9a49+7gQz2G1vudiPMW9ktUSCgtZeh9LCQw2K4KMOsMR4GqZI9rwPXYe9cBKmowNWvNoPPi3l11zIcxm/Mn2/df9ijUfFfTvYKf+E00TnhDnoRsWluZYNy7w52wgB8wyowZ7+mB5yJZ15O0JYNbEvv7HcnUYdvnXtwIoKj2kZ0QvhGNRjApaN1QFLU8QRc0/I9lh1P77InjpCECKrdMnC0tJD0fD10HCJ32wTQuEO8PoORGJah8o7+Ha8ADeVKpL2KZ9z6zzW8r35emCMcm/ba66C9hRdhuk/7JBsGNad1nNrl37/gOA==; 31:2DKNDY4vpsZhimjfN9PHuquq9AD6HqCrkR1MKTQvq8wmygjk9hOFfu5qLjtLudmokfs1afKFuWWd9U7ilYdZXJEAklz1z9OL32y7TWb4i8bUhj2NSciJPfafo9tMCzLo+7Fo3/vASRq/LIjeKfNHS1XIC9rvXYCbUiifKI4OyCDZ3bWO0G5g3lqiUcT60XczyNyWvx/11B8jePedtn7MSu2155N44y8Ov0IhYuyNSyo= X-MS-TrafficTypeDiagnostic: CO2PR07MB2615: 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)(20161123558120)(20161123564045)(2016111802025)(20161123560045)(20161123562045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CO2PR07MB2615; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 4:86iSEzhOd0BusYqmQDrf2DxRKqyxAXHbr9w+XuNk1Ezj78g0cYUN+DsqftVYy6TXiDwCVTpcYLKZBknV2C2cM5qVQKNnrleTxs+8IUxdFkumpCDWZLq/WKp0K1OJO5uiByU8o+nRzEq0wYvPvFt7xdQ5GQkmDOLAj7IiTp0Be35VqqP0aLVhzE3tFrmoRi5gEFzDU4TlsoUzfy5ucyZ6CwEKS151aJxDen9rn8hlRJIxnsNcUcmrtkKPcqVoL5TP/f8XBE29iNxauVg6but8Ng== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(396003)(136003)(39830400003)(366004)(199004)(189003)(486006)(2616005)(16526019)(86362001)(6486002)(7736002)(8936002)(16586007)(48376002)(478600001)(446003)(81156014)(68736007)(81166006)(186003)(476003)(26005)(305945005)(386003)(2906002)(8676002)(50466002)(50226002)(14444005)(956004)(11346002)(25786009)(316002)(52116002)(51416003)(6116002)(6506007)(1076002)(3846002)(5660300001)(105586002)(6512007)(106356001)(6916009)(47776003)(36756003)(2351001)(4326008)(97736004)(53936002)(107886003)(66066001)(54906003)(2361001)(6666003)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2615; 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; CO2PR07MB2615; 23:kf8sAC+u39We1uhWIsiqMTNImQyYB7KqIrES7rj7D?= 8d5KkCUPSHSLcwZZvP3e7M5TYJ48Vt4KrjBfEvXms+W4EP0huZ+pLZj3BmqPQDIUzSnHfjIR9fflhcavFyELX/kURn3kxtNnxrccbMIpedRCi0hg0hXaIUbCyc1eW6cphlNzO8BFXYVELRtNiMQMARR94tyBvqjeDBJ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fH8idJQ6votaJSrPTTDLNwVaRmyQFPHmKY3rAFrbhNiWZXFl5Ut14iyY9jqdOHLUN6et6QOak0Q1yUk8EkJjFujUc7O7jc7nXeoCNXkvlLFCpV+eVLzYNVFoZoYwn8MvHFf3K7SaEoNyFOMJ4FKC1PVcflRtobCVO0Kiay/oCGrW7ExBUsGjp8+jXOyQuo07UX5yW0hOOBfFsljdISFYK00x47fuUyTvYkftIpLHFwjgldQvApZwrRKFK3iX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 21:54:35.7101 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 224473e3-0218-4b83-631d-08d5fe42b39a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2615 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::71c Subject: [Qemu-devel] [PATCH v6 7/8] qcow2: Set the default cache-clean-interval to 10 minutes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The default cache-clean-interval is set to 10 minutes, in order to lower the overhead of the qcow2 caches (before the default was 0, i.e. disabled). Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- block/qcow2.c | 2 +- block/qcow2.h | 1 + docs/qcow2-cache.txt | 4 ++-- qapi/block-core.json | 3 ++- qemu-options.hx | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index ba4dfae735..b4f291765b 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -944,7 +944,7 @@ static int qcow2_update_options_prepare(BlockDriverState *bs, /* New interval for cache cleanup timer */ r->cache_clean_interval = qemu_opt_get_number(opts, QCOW2_OPT_CACHE_CLEAN_INTERVAL, - s->cache_clean_interval); + DEFAULT_CACHE_CLEAN_INTERVAL); #ifndef CONFIG_LINUX if (r->cache_clean_interval != 0) { error_setg(errp, QCOW2_OPT_CACHE_CLEAN_INTERVAL diff --git a/block/qcow2.h b/block/qcow2.h index 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 6ad1081d1a..684147ad45 100644 --- a/docs/qcow2-cache.txt +++ b/docs/qcow2-cache.txt @@ -204,8 +204,8 @@ This example removes all unused cache entries every 15 minutes: -drive file=hd.qcow2,cache-clean-interval=900 -If unset, the default value for this parameter is 0 and it disables -this feature. +If unset, the default value for this parameter is 600. Setting it to 0 +disables this feature. Note that this functionality currently relies on the MADV_DONTNEED argument for madvise() to actually free the memory. This is a diff --git a/qapi/block-core.json b/qapi/block-core.json index 5b9084a394..9a6a708a37 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -2830,7 +2830,8 @@ # # @cache-clean-interval: clean unused entries in the L2 and refcount # caches. The interval is in seconds. The default value -# is 0 and it disables this feature (since 2.5) +# is 600, and 0 disables this feature. (since 2.5) +# # @encrypt: Image decryption options. Mandatory for # encrypted images, except when doing a metadata-only # probe of the image. (since 2.10) diff --git a/qemu-options.hx b/qemu-options.hx index 4c44cdbc23..6abf3631ec 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -767,7 +767,7 @@ it which is not used for the L2 cache) @item cache-clean-interval Clean unused entries in the L2 and refcount caches. The interval is in seconds. -The default value is 0 and it disables this feature. +The default value is 600. Setting it to 0 disables this feature. @item pass-discard-request Whether discard requests to the qcow2 device should be forwarded to the data From patchwork Thu Aug 9 21:53:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10562097 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 E27711515 for ; Thu, 9 Aug 2018 22:28:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77F262BB58 for ; Thu, 9 Aug 2018 22:28:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 690832BB5F; Thu, 9 Aug 2018 22:28:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C9F232BB58 for ; Thu, 9 Aug 2018 22:28:00 +0000 (UTC) Received: from localhost ([::1]:53300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fntPU-000468-1g for patchwork-qemu-devel@patchwork.kernel.org; Thu, 09 Aug 2018 18:28:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnsta-00052h-Il for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:55:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnstW-0006p9-So for qemu-devel@nongnu.org; Thu, 09 Aug 2018 17:55:02 -0400 Received: from mail-co1nam05on071c.outbound.protection.outlook.com ([2a01:111:f400:fe50::71c]:30903 helo=NAM05-CO1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fnstW-0006oN-Ly; Thu, 09 Aug 2018 17:54:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janustech.onmicrosoft.com; s=selector1-janustech-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s2B5HBAfuIKnZt11pQ2ykN1XuCD0HzTixa4L9hTeFPM=; b=g8NCtHJdRVFiK/MXyCIrGchSaaVhaS3RPtdhvjsv+A3sc3NQvBBlGusv7tWivhp91x5iXt5MYZmHWMyUEOPjhgSVcriMurbTMM4oCJX0GzmLWdamRmF1XLPa0P/UfkwqDUCbrs55Qv0bNYUHvEQmDH8FUukh5mm0S66hj78wU4s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.23; Thu, 9 Aug 2018 21:54:38 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Fri, 10 Aug 2018 00:53:07 +0300 Message-Id: <20180809215307.18241-9-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809215307.18241-1-lbloch@janustech.com> References: <20180809215307.18241-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM4PR0101CA0050.eurprd01.prod.exchangelabs.com (2603:10a6:200:41::18) To CO2PR07MB2615.namprd07.prod.outlook.com (2603:10b6:102:14::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c185b32e-187c-4974-a87a-08d5fe42b52c 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:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 3:7+g4NdfrqZbnUzU96Ke/eUvYaHWYWKSOv3Wl2tvG/7qnlL6ojODC4rwJahud6leT9EQzDCqxqhdI0LAlWVLtqtCz20hhX0wty2g7fOJdIb4peFqMjQTroVMfcoo27a5LIpjcGLS0W56usq5DA7bl+6q1Rt4nOBVwlNb0buvc2d5KvxKbKCoM3bAS4aJG3OSryEKI3cYvsTrfR1el43g91yylojo1TfyLdHNrrq6fywjirFZOkcFKe6al85aBwmSY; 25:PIiHomqMNDrEBYyHkjx3eTO5cyAnCgNZlxffBDPJItfTqh/SWHHi8gcWAKq/5NQeUc/8Emkexkp0q1jflS9ZgHRtTuBUJLLSps0ecrCNQ3lA2ni0OLz4zfvz67bFtIgOiUMW9aMbr5mkROlpFFfiuQSzsJ2KFBi0SfiZcaIH+IHCIeQn4JBvSWGVWnpZ2wZHfnV7dsuxgtv/T072Hf+XD/IvO4gST6CbJiDKxfdTWT8ocgmycUvTU9S75iSGZt/I6d1WFQ0Y9Ef+6Z5jFEAuWg/F6cViMRWRJ6QoDKPNQ/gOLEpWe42xHUyPqi1lLbzAjlg5P8LhDQcfQwAhcnb9FQ==; 31:jmipbx62u4YB/WunTZqfTCxGtYsBJMg2L2jMnl0cI4nnlAD/xlL8V6CL6c+tizVqLdeNc/eswNHV7N3jt2KXztjLp0xxCFCF7bb9hcFa8pzoiIb8KLW3LzNOOs51KXBC5VoCq+f1Y2wb+vMfjLM7v20hGCIvgyWVz6JSy6VLaEhNTo42oONxtVgIEuIhY437qbWmUmnkdhCbSk03vrgtE5/1p4rQ9H5NZN8qJOEe594= X-MS-TrafficTypeDiagnostic: CO2PR07MB2615: 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)(20161123558120)(20161123564045)(2016111802025)(20161123560045)(20161123562045)(6043046)(6072148)(201708071742011)(7699016); SRVR:CO2PR07MB2615; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB2615; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB2615; 4:debF3zvZLzCGv1EEn1OJUob5MJZq2o/5HM+U8Ec1N1r10wZzwvIATKSTugPmHMF5mpuQTIgdUiX4yUWlzohzyEKFoexRgQvWLVHCXhILmHMrt5GdcREqL/ImxUGB1+v3HJfjlj8Cue+d0PLQQMT6/Bmue+4QT0GMlACy1n6HhX5XBd9zwxBJ+4715RUD1DNhcui0RnUmi1vyJnSDJpWbbXET2UftxN0mbaOOxuZl98bowrYw86KfG/GeZS4Ly73NIXkGajzufllWzgK86F0h6Q== X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(396003)(136003)(39830400003)(366004)(199004)(189003)(486006)(2616005)(16526019)(86362001)(6486002)(7736002)(8936002)(16586007)(48376002)(575784001)(478600001)(446003)(81156014)(68736007)(81166006)(186003)(476003)(26005)(305945005)(386003)(2906002)(8676002)(50466002)(50226002)(14444005)(956004)(11346002)(25786009)(316002)(52116002)(51416003)(6116002)(6506007)(1076002)(3846002)(5660300001)(105586002)(6512007)(106356001)(6916009)(47776003)(36756003)(2351001)(4326008)(97736004)(53936002)(107886003)(66066001)(54906003)(2361001)(6666003)(76176011); DIR:OUT; SFP:1102; SCL:1; SRVR:CO2PR07MB2615; 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; CO2PR07MB2615; 23:8niszRgGlP5HALt6iUFJPUXlpT6Fbd1RFhH9lrBa1?= nZWd/a4DIK1VSZOWYzJtG50k/ixSYC6NAfLnIpVmxKap9SISSOMRssW503BEDvWCW4MUHJHdD9+z0qXviltt35LnHxqCC6TjECheQ9hPMiqwFOS9UOPR9xufQKsBMDaFpPzcsgahijABAt50mSSkoMBkGzf9xbOvL/WJ1oquAVLptFjA1yoDTzphDP/WMFRZNFOEX1adMZYkTCavW7+xDqZofrMl/w5ne2JZHNzBOWw33ZWFm7oUhGKa++V3C2pHoHrMKXtpESeErvhn/QtJAY2KN7zykQ5EdBAMI+Ho7FhQMpZQ2ON1lxJJpI/ka6cftyH18EvlL6XF4XVwZLwdVdtppUrQlIhyyA5LFBKnDOQIvasidh8cBJXptO7D4nd+0wZBE8jTdoAVmhM35tutTxmVOCPedCsbf6FTjsK05ayG27ZXseZiJDmoxUpuU6RmK7bVzJ6l9J4RiogMutTum2Az7TCJdCeADu6CJsWnv8xbuT9KEvS1U+AOojVW/N8HFo43v3ujjuch/kZh1tqqiIM0C3e7PRb8vNm3/vDfy1fjuT5Z9o/na4Uk4uI1k+KYFFNDVDFaC5p2oJhh7EEiRrl65l5gEeOtdpIIE4YNP1ZAg9naPSGPfg4ZVWfkMBxzWLfEFio4wywRh5gMrBYHzuzNsktQgWDYBKex9flN6ejIKkkB2me2WvjFh9P7i0+Cz26QuEMkZAL5Sm8njqKyfNrArKnTvHYlJe2zPFJrB0iRrPQEWUrRP/eNx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HY6s1Ugp7IKUrcmIXfVeI2GFHzxvDVpJgH8ZGEYxkpzHBPYMkJKvqdBaY7rwlAsjc+65YWIJ6YPdDlnbFbJeKlqtGYG+BO7o8QGpfFugtwM5nbErCd/TOCmUTX6VM+rLBUaCxQt4tPwG3ECYTmFlTAl0s3BflwB0liKzFX0fo1x3fUlOfmYsfdLtLeWWvY3ORPFUl1ec1DB4gMBOGp16JEYDAo56h3gJCEYmrAIUkniNAXjU4QQCbQ4zBLeBReskrsQDPh7wMqLuNzCUZCR/4tladX10BhdUmXH/aGQjVg2w8ymtgyZ0HvoLWLsc1cVx2ugyAMHW/YJw==; 5:iF2tD2CYmu1MxTLq7tHd59yjZqVbATW1xTtkKMJ83Pn7yIppn//AlTRDZo2nFAGxqb4g3spZJkVvj5cscnC+kmjHb9lBglvIo6JqdUVi9zUxYtGjLuQWUfwjg0FzFz+7eF83Jku7D0NUjjYY0wYRTIpvoz777NDdvPeUX948sAs=; 7:87h3Xp7i1kBktNK03HcszGKtPM1dLcp3SL5jcZiw5Ey9pmERBS7ItNwIkZsrjuSeTGDNaaaH3041wNbrh4HyIJus9egt6YBeYt0Wo9bR3U6FDrN5poPy8pFJ1dJXExtbYKY2Tx6HsrIf2FNLUOZPJPYQP7liy4lJhebxPOdWo3LowkjBEkij1SWuztJEZjncC99RB5HfYfKQjPONwpjvlDZK4Bdt0s9nlhAMfOxli9SQqyil3extamaPyip/E3sf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 21:54:38.3474 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c185b32e-187c-4974-a87a-08d5fe42b52c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB2615 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::71c Subject: [Qemu-devel] [PATCH v6 8/8] qcow2: Explicit number replaced by a constant X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , Leonid Bloch Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Leonid Bloch Reviewed-by: Alberto Garcia --- block/qcow2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index b4f291765b..b0e20aeffc 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1324,7 +1324,7 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, /* 2^(s->refcount_order - 3) is the refcount width in bytes */ s->refcount_block_bits = s->cluster_bits - (s->refcount_order - 3); s->refcount_block_size = 1 << s->refcount_block_bits; - bs->total_sectors = header.size / 512; + bs->total_sectors = header.size / BDRV_SECTOR_SIZE; s->csize_shift = (62 - (s->cluster_bits - 8)); s->csize_mask = (1 << (s->cluster_bits - 8)) - 1; s->cluster_offset_mask = (1LL << s->csize_shift) - 1; @@ -3450,7 +3450,7 @@ static int coroutine_fn qcow2_co_truncate(BlockDriverState *bs, int64_t offset, goto fail; } - old_length = bs->total_sectors * 512; + old_length = bs->total_sectors * BDRV_SECTOR_SIZE; new_l1_size = size_to_l1(s, offset); if (offset < old_length) {