From patchwork Mon Sep 24 22:53:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10613023 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 E306E15A6 for ; Mon, 24 Sep 2018 23:13:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF81C2A083 for ; Mon, 24 Sep 2018 23:13:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E34DA2A086; Mon, 24 Sep 2018 23:13:46 +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 75EF32A083 for ; Mon, 24 Sep 2018 23:13:46 +0000 (UTC) Received: from localhost ([::1]:49185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4a2z-0007eJ-4S for patchwork-qemu-devel@patchwork.kernel.org; Mon, 24 Sep 2018 19:13:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4ZwN-0002Rj-LU for qemu-devel@nongnu.org; Mon, 24 Sep 2018 19:06:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4ZkX-0003Hx-M2 for qemu-devel@nongnu.org; Mon, 24 Sep 2018 18:54:44 -0400 Received: from mail-sn1nam01on0121.outbound.protection.outlook.com ([104.47.32.121]:41408 helo=NAM01-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 1g4ZkX-0003Hi-Fx; Mon, 24 Sep 2018 18:54:41 -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=YVVUnv4wQe7HDTeZifxIY9Xtosy5QA7RTXOv/SZ8IZo=; b=QHAtqYK6g/wWIhobbzWsO9icgGSRA/voUiPN430+y3VdAzKv/5mknZl0NjHJwiYsraLqg0wzih5AH0EMNDbcROr0eOFrTh/AN37qPvGJPKxTegl4Cic60Ok+2QV8xweBrZnigjguzetIc7ouOA0rSVHrRQHf+a/BqSUQMok4tWI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.25; Mon, 24 Sep 2018 22:54:37 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Tue, 25 Sep 2018 01:53:51 +0300 Message-Id: <20180924225357.24245-4-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180924225357.24245-1-lbloch@janustech.com> References: <20180924225357.24245-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: LO2P265CA0063.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::27) To CY1PR07MB2617.namprd07.prod.outlook.com (2a01:111:e400:c637::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84bb5e8f-6586-4f42-3c45-08d62270b54a 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:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 3:NtbqTt+XNBjly1dL5trxf8Nj4iuEA+y7xvHFajNFUNL4rabEljzA78ADzgVQVDmSHRSb2/IhDKpXLqOutBSnFR162mZK3IaKjbtiubi/n92yaCx1UNrVu4x68NZrEAle6dXKXvsCYQSPWkGOrMFz792ZDW+4kRiuSNw1bKOIO11oJ3aieRmpjowzceXp5JYaXjAwUlPsc3vHlwwGMEihZoxzX4bdY5ILepCxSYhUEe24YLgpp8To3qgM4ptnPNRe; 25:Lug42BcWLFnx52vMS8OetesSKM4uVk8zweiZoVZjfpCAgagJM5rmL257T0w4fJUNAGxqROU471wbeIP5I4vitRS0wuxZv3GTrBOOkRUVX1AUrCUxqJKVDGvXqojfIvcwIre1HI1Fo+kIOtk7GLfLgGYycYYgvm5IXYcOnwiymaY4SctXv/K7KI11TfD3xrmy0s+ipAbuxNZleRXzgWNjW0yHNnlboN3sy5bUJQ8yuvPYjhPyIavEnzQIm1XqPSqOl5xMa+jtUAe+ml6D5fttCBMmlM5sJqQnnFZKamCJMgP2mF3xPNv2K1QC0K/+gp7Ut3L8p8RmwV0RmNywR9DeMQ==; 31:S1dj/A8npbhdJY2YU+jcX5a0ZklmeWDkHhUZM4l+cQ5Q2sJrfXs27PS8xDKhyXPN52K3nq462ig9fSQS1+RsTx5RvKqO81MuMWoMrDfb/zt7tGO/iiooUWOxFt5Ztb/gJej6EA5QjLbOMecg9knqt1isqIJhdQ/8Z4VeOe4GOXVQf6D+YdFQtWy2pO1ySzyr7KG65uqFu7uHRt4/XkC3ypbFUri9PK+yVh1jmlpwWT4= X-MS-TrafficTypeDiagnostic: CY1PR07MB2617: 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)(8121501046)(5005006)(10201501046)(3231355)(944501410)(52105095)(93006095)(93001095)(3002001)(149066)(150027)(6041310)(2016111802025)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6043046)(201708071742011)(7699051); SRVR:CY1PR07MB2617; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2617; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2617; 4:fwBujipmgF3alQ7D6Y1Vdl9ZxJ1LAt9+G1uxtl3PcYQzBACBNsue5dRQtv0QmHBEXskCSzcXUmk6YBzMBokRdahF2BiAjhDypyqqgKXwM7RuwACVthhii2IMOd9SB4kxiBtiqTGJTyyFsxDDyl1Y5fOnGZ0S3Oi77fZZBCDJtZBu/7g0/bDxzQvKlZP5z+cvBxo1VMmuJX7O5mzGxskupb+0I0KlqMzFiVUerQEiV8IJGnosAzE8DI8g9b35P1UcRckqg/uVcZztOo9l3N1zHg== X-Forefront-PRVS: 0805EC9467 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(396003)(346002)(136003)(39830400003)(376002)(366004)(189003)(199004)(476003)(54906003)(68736007)(956004)(2616005)(16586007)(105586002)(86362001)(66066001)(6666003)(7736002)(486006)(47776003)(106356001)(51416003)(11346002)(76176011)(36756003)(446003)(6506007)(2361001)(316002)(52116002)(386003)(97736004)(186003)(5660300001)(8936002)(16526019)(1076002)(2351001)(81166006)(8676002)(81156014)(26005)(50226002)(6512007)(4326008)(6916009)(53936002)(3846002)(25786009)(107886003)(6486002)(6116002)(50466002)(305945005)(2906002)(508600001)(48376002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR07MB2617; H:Jupiter.local; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: janustech.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2617; 23:iYIGcZvscP+mAc9CTOkfnbvN6TUzH/8dV9UHCieS2?= ASNN1yczcidfoqyndVrMmrRlJuCySaV85Wf1XxaKQwPvhmOim5WwhgQnmbXln2ElkWAzPfTF1vabjogi2YZiOIJqk1ICu5tdrixmiRVnNBA7CF8KaSB6CQWAC44JVNIev02TgKKyX40Lg3u2eRHd7mIb7vwaYBgV2jZC1SDmL+ioZdSHMCAdNUU2Kjhe/33d3yfZdESLtRKCVU6R/lY+P7jDvvAduPats13NLS0Ed+sioU7b0ZCQqqLEGZi7dT5Fk9/luDZ/C5SY1kgOZ6E8B1oVFyqx6OyVzMToCTp5dxGmiP8F9d70WxjB3Ga3LXzkR5uBxUZDwSErg/WN0TlUFAdXp6l+7hrh/GXWXzvQhwtySGwAFiNna3umu07732d0bFjwGaymk+CSu/0BGy5mlLi6AJAX5VFFBtUOxYZ7ttTSz7c/1r6PdCtDLPkhxzJN/qV/wCc2ieOvY5sE50SIz7XHxTSjv8EABWPSHnqwzBBGmDc1/cPcNBt1djNZgwb23rIdDdzZkUCo5rRosDcW8E8RUs0LRSbBV4TG7RxDMO9gifdyzb/kbMaOBdi9Edf7QRjy4xgEZw7/S7StHOl0HsXyL0erM8iNx3sW08/7eAv69NsbAXc0mSNsHLMYunxma3QSv3fYZ69VwlMCttiJPi/Yb6GYDTdCjmPoljz82hdwIaUPm7cCkM3gA1lbCjmbmtLkyGddiiRStRCvRKgPRhHQtFRJraEd6+9mo3slxiEP5R9mps2PBgdwR1o2Ai4dUfHXfaWS733CbFFCdC9j4r31CdQ2ZhA9Pjv4gVyZUvPewNj1d/JQqcJVSsh1vii5XwAzLA/18ybOHtsj4HRgD+J7eH0nSIl8Dsk0eQIdTt1LfaQceraHrAJ2p4WRVyoXd6/tqktSNVSeCxpOy6T8A19q61UYMoCOZmiUv24RlIm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TF4N0hobd21IJzBcRKmRRKPTCwxk29MVC+PMzaTd8ZcZC6xDYh8HyFvy4MFR2K0t69fIr2ll9UNPRmFF9mPXR+ISkuzDe6nBGyWMUe2uLvx1hQ7sLEw==; 5:2T1Jyj119TB806CcSNY8rEFMZwwRCSJBIz59pg167eu16maF/ezaQl9arQl5x7Ird/B+etsP3iyMeaKM7B2O27irVmcti1gS4qSNePOs/j2KsvBomWGmb8iHdhmiyn5X4lZbX2MD+iyWT4CBKeknNIZrLsuKyrqeE2Zbo22getY=; 7:IQbt1BPIG1ykcZaXbsgP0QYC0+GT7p6cNuewtKwHYDAca5ycfiu1Pk4duubfGXRkD8Mu/wB8Q+G3IblEOo0O0TONN/g2OQ0xWRafnsJ8ummAggE7jye2s80ITd7MBf/BdGpwWcZVrVfmPgUWJIelR3bo8AYRX4TMF/SmT8skS3Gj/xPCkZgfH37jBo5RVMGmN/UFBbnexFwKT5ntY+xUkghC/sYzO8WQ3c4g9CB3Tp607lpH8ttY29UYwkPN0A4S SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2018 22:54:37.5182 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84bb5e8f-6586-4f42-3c45-08d62270b54a X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2617 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.32.121 Subject: [Qemu-devel] [PATCH v11 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 --- 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"