Message ID | 20180809215307.18241-4-lbloch@janustech.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> 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 <patchwork-qemu-devel@patchwork.kernel.org>; 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 <patchwork-qemu-devel@patchwork.kernel.org>; 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 <patchwork-qemu-devel@patchwork.kernel.org>; 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 <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org>) 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 <lbloch@janustech.com>) 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 <lbloch@janustech.com>) 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 <lbloch@janustech.com>) 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 <lbloch@janustech.com> 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 Content-Type: text/plain 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: <CO2PR07MB2615B62B386FE92905508E7DCA250@CO2PR07MB2615.namprd07.prod.outlook.com> 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+o5iYYtwtHebOEXZAM7Osk8XjTmxTE0z8CoICGkfSm9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dWp+hJ2Fjju9PSPhXeizG9Cij3b2LgcLrH0h8mnOJM/l52b9BeRSIiDeX4GHlNqWkuLhnNwaN6yc2OzTzYs9sjmgQ6ilWkcn993lfxBbEy6xVR1+RZq0FiByINkqIaHJG8wWbXTOXLKX1ybnCRH9gQG2rcXrrvxSY7TZqtva6yUwN6EBeRpF03Z5mmCfzH0wojrfN/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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: Kevin Wolf <kwolf@redhat.com>, Alberto Garcia <berto@igalia.com>, qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>, Leonid Bloch <lbloch@janustech.com> Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
qcow2: Take the image size into account when allocating the L2 cache
|
expand
|
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 ||
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 <lbloch@janustech.com> --- block/qcow2.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)