From patchwork Wed Sep 26 16:04:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10616109 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 C384E3CF1 for ; Wed, 26 Sep 2018 16:10:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD1512B406 for ; Wed, 26 Sep 2018 16:10:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAF3E2B377; Wed, 26 Sep 2018 16:10:51 +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.7 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 3C4A82B3DC for ; Wed, 26 Sep 2018 16:10:51 +0000 (UTC) Received: from localhost ([::1]:59628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5COo-0006DP-AR for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Sep 2018 12:10:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5CJm-0001vU-QE for qemu-devel@nongnu.org; Wed, 26 Sep 2018 12:05:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5CJj-0005jO-Jb for qemu-devel@nongnu.org; Wed, 26 Sep 2018 12:05:38 -0400 Received: from mail-eopbgr730130.outbound.protection.outlook.com ([40.107.73.130]:13864 helo=NAM05-DM3-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 1g5CJh-0005XJ-NL; Wed, 26 Sep 2018 12:05: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=HYm9Zg6/jgPh2CB6LPSSlwhXzJpQFugWhGKVEO5Cmfc=; b=brcVUu4pZOcfyqqLS1SD2IZsxMKj3nIaen3URDReNPcv+xTW9DDrrjW6uTSVjOGfFnWK4DBbHXVH7c+8swALMsIjMmZYd8H5NcfwtIG24ZluAf76uGFVyL1V51tvH/rReHdGbcv2SgCtLjmnwnX/HYbObaFNBE/67kw/KFeWDmQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2619.namprd07.prod.outlook.com (2a01:111:e400:c637::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Wed, 26 Sep 2018 16:05:24 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Wed, 26 Sep 2018 19:04:41 +0300 Message-Id: <20180926160447.5149-4-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180926160447.5149-1-lbloch@janustech.com> References: <20180926160447.5149-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: HE1PR02CA0116.eurprd02.prod.outlook.com (2603:10a6:7:29::45) To CY1PR07MB2619.namprd07.prod.outlook.com (2a01:111:e400:c637::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b7416bf0-4e6b-4f5f-511f-08d623c9dfe7 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989299)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:CY1PR07MB2619; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2619; 3:eOwVEJVJ0rmzvzEljDM4r32EAMaVLFEa59OI1w/Xu7CDuiK8DB3VYas8Na5YlAJgaxEc+mWiWFI7HqQ1kXcbO8ZzOn/fIvf9E9XaDtH7n9ZNRptXXtrjUHOYWow48NLtxqQSFODwQqzeZxxTFoU+RSxa0zQ29ZZl12uatbYvCr5knBJrs3nLgkenb28U3oyJlxEZCQY9hztfZdRgtSmjagziM9iaRM8SsepsUzvuJ+ebg6YPq3QlWPpETd2ymUYc; 25:X/XLCm8A1gPR6+e4zWGx6vQGoHE47yXKmHgqU5AGQg2B9Xu7fWZ7+cPkfMp23l2V1ZWJ6loBdzfn5glN43f4KWdW4IfDKTrxsVGSAPCa1qhvQ/LsnCMDY+HzyorfApyZjDahsSjJ9hiH5WHYY9FYUbxr8wZrrV4TTSu9vYPUryGc+WRw14j6YTvJjPYsadBHM2iWez+QBFTlF/Exdkzrag35n0WM5LesUDb0innXh8ZQV0VneYs8mMLyjjLSp6h5v2JlyrSVVEvfZT+q5gEHeuPFp/UFKIxo/DsBg/StXLQyrNNwdafHBttkTd2+d1ZpOm178T+RUMEyxMrjQ/cHrg==; 31:7Ezi4XMZt37STPr/bZLsNYjL1ZdXJoZguNwZaccv/jMMSbSrSOD81wyvphBuj/19G5EX2gpoPzrFJT9WnqlhN3M7024U46uLdaFMZ/bIy/KI34s1I01/O5rPUhSJX5krXf7do4IqkvRWeWZoyjTmwMO0dthjgvPAW9x6a2knEcvGYmTi3AGIr5xGFLnyuSDUUeUM5tB+Nx8LaORpE0ZPcQmFudHg72gle1aFzbI7n2A= X-MS-TrafficTypeDiagnostic: CY1PR07MB2619: 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)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(149066)(150057)(6041310)(20161123562045)(20161123564045)(20161123560045)(2016111802025)(20161123558120)(6043046)(201708071742011)(7699051); SRVR:CY1PR07MB2619; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2619; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2619; 4:UG2upRmRWpZ5R4xJFwZJQttFWcctvvg3xupzuhYDEsB3X6cJWMRXJ+4O8B2GfCqW67XgqSXPgc6VbV4rIKq0QoESj81wNKfr83XH/pLA+JCc+rb19jVB3+g9EFWNjhfX+w+C8Gm9ytqESo13IC3wnaawM715QIQhy1svnbqFkV1JYF+Fcn1zPFjikHjmc+RTC6pt30ZeC5iahd8CXVO1k+VsLZntIx+3b78BsgkcVj62xeMaU0R8soYedFvmMKcRsX1ud0aFiknhcU98xVNRKg== X-Forefront-PRVS: 08076ABC99 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(366004)(136003)(396003)(39830400003)(376002)(346002)(199004)(189003)(106356001)(508600001)(66066001)(6512007)(47776003)(4326008)(48376002)(2616005)(107886003)(446003)(50466002)(956004)(11346002)(36756003)(486006)(6486002)(476003)(2351001)(105586002)(34290500001)(316002)(16586007)(54906003)(2361001)(3846002)(6116002)(6506007)(386003)(1076002)(51416003)(52116002)(76176011)(26005)(2906002)(305945005)(8936002)(81166006)(186003)(16526019)(7736002)(8676002)(81156014)(6916009)(5660300001)(6666003)(50226002)(97736004)(25786009)(86362001)(68736007)(53936002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2619; 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; CY1PR07MB2619; 23:8uBSWdHJKvY4kDMN43pCWrBKeiQ4IsJII6LyshFA1?= SXQHqXJwb7qD6cY/CwYWhuZocNxoDvZOu9xNjg9MvMA6qULar5eNOAg2Xpn7OL2v8O4MF1PDVEuIxwAHyVuSxZ3NI1QmlfhRT5fLtOQ0KHf8usz/17WTPfLfxnrIJ9MXXu+EZZSliGxVcuj1DKyXZSLUAt6YxtDsW0CcA7GBeVRIAoxLtG6wifVD529bdByRQeplqhTsUl+m5pJFs1pYM7mjB9ECyaqvC3s/UQ8EAux+ujxt7T/FB3fjlIyJrZ1RbRMTqVfWSnwZqH3vu7+kWmG+ZhBHZG/Zus+quSW2LhQ0FQ/FezFxkzLIEH4pQZ5E+1L5ZWYeoDJN/LUTV+JLs8OIArBhSr++1AtijweUNFqxcEVnp+TegugbB8ws8UZYFJhhbL+WYByt8BUR6sYT2kDRphqGY/TDPaq3ArIYRZKrLXz2lEyFpxnnMlp4bUIkI3ikSz9MWwXgUC5+ySD/eSAJmQjwTN5pt28UkppLa0L0xuIl+G478aHWZHbjW/w7my2J0NbCGUicPYRCAZt8jvz3OmnlKIhxJ9FPyzzN71FWKP28JQ5b2xFby4HpfBlJayZLMyEFcJPucYqZutEIksSP0WVr037+2vNqnzigxuIr1fHeQi41Zh7LNiUBn/VuHVCc6SRYNA1gDXi7zbaFgE+V+lEobQXGJDVUnpL+9MaK1bpJHvyUp3B//3WmHO/2Ji/fQUrv5dCPseebUyK8dgCKx/m1TyEqTPvddB17UHMYNAsRURH61ILV9o4hKW4zBmkP8ZUFeoos5I2snwb/57nCbPhUxuah8RdwIeN/AXXEzPncVd/JovuwYcKlKYJ9NdGUB1ujUqUK0QNnsSQRr+EHfCzVMO5xj4SO5+1dOKGqnthlLnlbAODNwSEix/BBJx3Gp8gYX/sLSZHxXQd7lwlExF++vEVe4W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Thg5TfHJ2hm2/OTkUbIPFcwTTV2mEtTaEotJWFo6WKuGt414B4yE2MZycVQGeoWsBU7uipl9eGEKFBmKMf8ywPdx8AhtoYcJw2Q5OV+bW1hdNkX9+P6d/C0jHpwzCVHYrf3iaeuQ==; 5:ts0b9hL42T5Zop0aHuwIhyx9AG5ZiLNX0S2bXaGnaH3MFSM7nmJ/YbFRxjJZIfgnSAwCVC5tuqhL23n1rpBV3oj1nqr9wCYfeVfCQZXXAxq+tth5FyDHbl3AXOucx7rjFH1tuLfnz+q3LWI/L8OztbG5EQJGT63LIOP9GZeo4g4=; 7:KkvuX168UfKeRVwvziD+09xO+/ZuhKSLTF4AsmGnfpuoSJrHsN4kI7/CPZdqL7yPNErkl5yVUC9PqaCcaC0FTYeIpU1EDTMbAEgtDJSfUWPwfdhxyRoWzb3ZgxlI9y5RjLh8znTkklo+BxuXGGKSKTkMO1xsnTzHcLIj4+hObFOPDKu/GaltjOzKQVUygH7MTY8wd0LB5BIrZn5cN+bziyFlHwIP0k6wSV0EOlPBvb0Iuv2nT88YvoSs6ocUqGXa SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2018 16:05:24.9082 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b7416bf0-4e6b-4f5f-511f-08d623c9dfe7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2619 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.73.130 Subject: [Qemu-devel] [PATCH v12 3/9] qcow2: Make sizes more humanly readable 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 Reviewed-by: Kevin Wolf --- block/qcow2.c | 2 +- block/qcow2.h | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index c13153735a..d2c07ce9fe 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -830,7 +830,7 @@ static void read_cache_sizes(BlockDriverState *bs, QemuOpts *opts, } } else { if (!l2_cache_size_set) { - *l2_cache_size = MAX(DEFAULT_L2_CACHE_BYTE_SIZE, + *l2_cache_size = MAX(DEFAULT_L2_CACHE_SIZE, (uint64_t)DEFAULT_L2_CACHE_CLUSTERS * s->cluster_size); } diff --git a/block/qcow2.h b/block/qcow2.h index 81b844e936..a8d6f757b1 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -27,6 +27,7 @@ #include "crypto/block.h" #include "qemu/coroutine.h" +#include "qemu/units.h" //#define DEBUG_ALLOC //#define DEBUG_ALLOC2 @@ -43,11 +44,11 @@ /* 8 MB refcount table is enough for 2 PB images at 64k cluster size * (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */ -#define QCOW_MAX_REFTABLE_SIZE 0x800000 +#define QCOW_MAX_REFTABLE_SIZE S_8MiB /* 32 MB L1 table is enough for 2 PB images at 64k cluster size * (128 GB for 512 byte clusters, 2 EB for 2 MB clusters) */ -#define QCOW_MAX_L1_SIZE 0x2000000 +#define QCOW_MAX_L1_SIZE S_32MiB /* Allow for an average of 1k per snapshot table entry, should be plenty of * space for snapshot names and IDs */ @@ -75,9 +76,9 @@ /* Whichever is more */ #define DEFAULT_L2_CACHE_CLUSTERS 8 /* clusters */ -#define DEFAULT_L2_CACHE_BYTE_SIZE 1048576 /* bytes */ +#define DEFAULT_L2_CACHE_SIZE S_1MiB -#define DEFAULT_CLUSTER_SIZE 65536 +#define DEFAULT_CLUSTER_SIZE S_64KiB #define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts"