From patchwork Mon Aug 13 01:07:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leonid Bloch X-Patchwork-Id: 10563819 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 27A781815 for ; Mon, 13 Aug 2018 01:13:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17738283B0 for ; Mon, 13 Aug 2018 01:13:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B64D287AA; Mon, 13 Aug 2018 01:13:11 +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 907312863C for ; Mon, 13 Aug 2018 01:13:10 +0000 (UTC) Received: from localhost ([::1]:36985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Px-0003FJ-T6 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 12 Aug 2018 21:13:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp1Lj-0007fU-2j for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp1Lf-0001iN-FF for qemu-devel@nongnu.org; Sun, 12 Aug 2018 21:08:46 -0400 Received: from mail-co1nam05on0729.outbound.protection.outlook.com ([2a01:111:f400:fe50::729]:24113 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 1fp1Lf-0001hW-73; Sun, 12 Aug 2018 21:08:43 -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=ujK4T5m9J0ebnYy4TWdpNo9kpESzW2/6rJesFrki1/s=; b=KSzXU23/QMO+pwIHWlKcGLjhJMrCPj7YfQNLmdKzPam8S1s7GOnf2yatMBhEXE4x3ARA1eBgOv0GvUUTIzWTaOrUjXwgWlv2fpVJ2FLxXCiPE4pa85a8/ISGTOZI3sE9bFFI0oud2yazUJKLWjmBYq9cyFRq0ArdGyLNwf6e2gw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=lbloch@janustech.com; Received: from Jupiter.local (141.226.29.227) by SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.19; Mon, 13 Aug 2018 01:08:24 +0000 From: Leonid Bloch To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 04:07:23 +0300 Message-Id: <20180813010729.4844-3-lbloch@janustech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813010729.4844-1-lbloch@janustech.com> References: <20180813010729.4844-1-lbloch@janustech.com> MIME-Version: 1.0 X-Originating-IP: [141.226.29.227] X-ClientProxiedBy: AM3PR07CA0120.eurprd07.prod.outlook.com (2603:10a6:207:7::30) To SN2PR07MB2621.namprd07.prod.outlook.com (2603:10b6:804:7::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c1a8864-a430-4289-53ff-08d600b945fb X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(7021125)(8989117)(5600074)(711020)(4534165)(7022125)(4603075)(4627221)(201702281549075)(8990107)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603328)(7153060)(7193020); SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 3:h7VlbYCty3fGeoF+QHLml56LhEZJWlnajLTC/Mn9/y5mYHbZp0fBd5RAgYlmeXGa5IKp0pC8m/zwSlCK0QQyFXXwDob6nEGBIC50BryEExhx7/Ap94d0KiD+iKdByLtbWXb977QywUCa7RbW9Ny8Mlil4M1XJdpucGdu/cJg8xgahnnd7FbyjyzLCEETjnJhVwIuSS5kCq1pXYje8NsjAo7pzBq0tRb3VX9Jacics04ru2URjcCzZwtKdLvsyBaW; 25:RLzwuVL9SyQkwzQt7gqXgRSUsknlLYBnFh1fVbn8sYY1T/ScPqR0LYbFlZAmmucBHe3i8KYqveDBtbQ3I7lVeYZb0+hbRwKT6Z2SLqjtn5+eVm+fnfw2dv3v9UEnzlO6zipRB4P1KAmFl8EGKa6AdaB2BLsS58mLaj2C2WQi81aYkaa89kiCVvti5kF1eUKheOZvO8+9SP0r1+z8X9WGcWNUfZk8/bd6PVtc/GPPzBWrK7HdC91D0vsEnHC1Xro3HpG6xqYIaLI9B9BLreMcbPivvtPHZKZnZRGH+ke6ey4CZBpWKbij1e3uqiLZH05yNn5XRaylTx38U+VWFeXM9w==; 31:j6AeZ2vkcpG3HRV5LYtv3YutHZxLkutbQ1J3aFS2VPZcmEIYVLgQ1YmKFD2nxdGW4bPS3RJsimJH1VCrnBmN8frxoUWsS+WrYHUWm2XW8+1J/pg2e+PqoJXAaLlxSGgZK0AWItLqO0vF7VDCKrrx7QOEnur62Q6vOqQ/SHVqreCCiKHKLeOokZ6mPJDXMUdLl/5ngLzMwEk0LlNx/LLwbxqHxsksJq7JNBy9jEWi5r0= X-MS-TrafficTypeDiagnostic: SN2PR07MB2621: 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)(3231311)(944501410)(52105095)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123558120)(20161123562045)(2016111802025)(20161123560045)(6043046)(6072148)(201708071742011)(7699016); SRVR:SN2PR07MB2621; BCL:0; PCL:0; RULEID:; SRVR:SN2PR07MB2621; X-Microsoft-Exchange-Diagnostics: 1; SN2PR07MB2621; 4:O8EVO+dmVlZchZAxidcQOvXyV45dlMbG19fL8cOKzmJxd3qOGccPRmk62w8n0g2GKYDS0iZnKuWop0cdY8cFIq95M9Fc5zsa2CK7s4F6/hDckA9MFzKMOb0ySejskcc0WGsiDeJvXyV/RiSMcWLyaoaoDtGhVMbCO/UNh6SHu4LK3PGpokS1k87dVoxnTGkdQhXQl2SkKmyAPJ8yXbSEhEa7NZMTZI8FiMH8cqtml3W5rlC3DbCKaRYNYD+3kf4Npfb9jgyjMyMbl9ttdbnS/g== X-Forefront-PRVS: 07630F72AD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(39830400003)(136003)(346002)(376002)(396003)(366004)(189003)(199004)(478600001)(105586002)(11346002)(446003)(50466002)(48376002)(8936002)(106356001)(7736002)(81166006)(305945005)(2616005)(8676002)(476003)(3846002)(68736007)(956004)(2361001)(2906002)(6116002)(1076002)(50226002)(81156014)(2351001)(36756003)(575784001)(4326008)(6486002)(97736004)(25786009)(107886003)(47776003)(54906003)(6512007)(66066001)(486006)(6506007)(386003)(316002)(52116002)(16586007)(26005)(53936002)(16526019)(76176011)(186003)(5660300001)(51416003)(86362001)(6916009); DIR:OUT; SFP:1102; SCL:1; SRVR:SN2PR07MB2621; 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; SN2PR07MB2621; 23:mQhiw3CVlHW812cytBL1QSuO4qaEd7SdlphnYH8eF?= Hcwd1c1EZxcZZ8sNSxG3fxLbT9qtHcfsIZU4pA7jh9APcAqEIP5ZiKZg6M+npxdKOQvx/xPoNqIHIDwNBRWsWiKMLsmhqCyZ9bsEYWZf2WPp2Ae5Ao7JvrABvP1YxneZjjQmLOt2y3ZGfkB4n/qbfpN22kicxc/7C3I0gPNWP4YMy4LjE26QiWgeXvILTaP1H/Yuas9mpbxZnrHUrjwsVb6+tV/mFj1dtG4ttTUaZ1wJRyH1V5F6Y1Qoi0hhq7Ppr9oPWU2uwnIux/be5fKtUTJ546XySpjJ2FtZtzHzZN5Xwn9R962Z8zuu9xrHr3/k8EbF0k4gZaSr4Is2XMCE4iveaE6dqYF4GV63sgIGAENwrJGcvdgU/ITorfDqoEzkskEsT8CfQYnlGJY6cOjvnzn2AZfYjtTmAkfhdumjFlPUxhm1f/6cc5HKCHwZFf7lx3LtV9Icmw7OE4l1ktm/ZjW9M+xeLFoPNozBTG9SoGwo/qZlwe9y8ko0+gtjXt7rhFRtozJPM0jQPFLKNwNIIC+pIh2XGolFQHIAZNT3e3u/G7GmE/XgTkVozd5D722p9JN9Mf57dOInykfVlCgUKuQGyGXpZ5UrwgHbPTRTXxXRZxREus97guXFz43D/ebeUc3o+4EdzPb1XcClINSJDxBkcUXzzFgFMMmrjXDWf5TJIxazxjcv50tcc3W/Hp4sF+SshyjmKyMwYIVwlvrYAwHqUCtUCxXkTFzPmdn73R26XtXR4qurFQPM8H2Y2BL+uiUqgvC9E7fn/nRKUcNwPbKERMQoDdYouGBu/bhhOXOfH+70+Evdqbvq+3uPfWxnAliVnUl7KfWhOaYXsj3w9Am3f4cMW/ndZaz2ldDYaDFpVDj8h7NjHetieOlFL4PPmIi2KOBojF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wD96iHKkTiPGonJ0rAMZ2ECW+i/6YEQW9smUkmcLA+wGmvtlhy0dX/3H6pBckGguB+4EOVdnaN0vtDQX5B9J+V8l+P9lqPtakQMC/i2mxY6EoIPGKuQDGHqVSq6ZLy+0ueW3KNQWKxqERXTVQ==; 5:9kQlqaEZZx7bJB6MG4kmFf5g3f1bTIDqi+fmkmmsCE3KQrUk59Q1+agwePSP2n3wv43cFZu8JD8BQaR8jariGywyjii86stNxpGncVF06H+9dGTIWKQ5uu/D3xWLEZZpgL2LoEmGSsXkO9XBk0XTOPS/yRrdcQLJeWsmLh2zACI=; 7:SSahijU8oLRidyiThq4Y6WHgebRtUiHKmXtpscHpPPH09TLO68HW1tLLUmME4Y/NlfUkdUASTgSyQLUYcBhQ4zMbgI/wylI0JhJqyIvbzSeqkT4gNMTpvH9cwj63Mhm/4ZN39Jns0OzQI9MTasrfhABfwQIz9dfXGp8rffnbEEx9p2aCG5yM7tPfJschMRFK41nLTqfSCQIiOnJN9gLjHGslNgxVhQ33n0ZiAJmc0ELq+xSxFQAkWhg7FOjxzml8 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: janustech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2018 01:08:24.5365 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2c1a8864-a430-4289-53ff-08d600b945fb X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 34eb020e-3cf3-43a1-afeb-f5cf1310628e X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2621 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe50::729 Subject: [Qemu-devel] [PATCH v8 2/8] 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 ec9e6238a0..67cc82f0b9 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..39e1b279f8 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 (8 * MiB) /* 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 (32 * MiB) /* 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 (1 * MiB) -#define DEFAULT_CLUSTER_SIZE 65536 +#define DEFAULT_CLUSTER_SIZE (64 * KiB) #define QCOW2_OPT_LAZY_REFCOUNTS "lazy-refcounts"