From nobody Mon Feb 9 07:43:37 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 151334259630664.08584672450695; Fri, 15 Dec 2017 04:56:36 -0800 (PST) Received: from localhost ([::1]:46058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePpXG-00020I-ND for importer@patchew.org; Fri, 15 Dec 2017 07:56:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePpVE-0000WR-ED for qemu-devel@nongnu.org; Fri, 15 Dec 2017 07:54:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePpVC-0003Gq-4b for qemu-devel@nongnu.org; Fri, 15 Dec 2017 07:54:12 -0500 Received: from fanzine.igalia.com ([91.117.99.155]:48102) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePpVA-0003CN-UA; Fri, 15 Dec 2017 07:54:09 -0500 Received: from [192.168.12.179] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1ePpV7-000847-SK; Fri, 15 Dec 2017 13:54:05 +0100 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1ePpV7-0004D4-L3; Fri, 15 Dec 2017 14:54:05 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=RMdahYNO9zQB7WFYof+d4e0FLXucgDHMoekY2vBGvQI=; b=QdmAiEQb/G65wdH0WxXdca/gf9knTj+XhDRywYknkotU5zz5qmoQ6E5JXQtd10e/+7MY6E+AY4wtww9/GM/qXVvOo7WP1+PJf+Zxbj8aEfFDV8oDDYEJGUNY77rSw5ylTjaStp16HaaP9a0irYUwG5i0IWuC1/EMpbBsEVZQQyQ2NSQJfW9f7x+u11EKxlgNmyKstgJYLUXbYJVVpUZgmpx9NgQzSNvMuYJMYtolu65xLxJHBvzjGL0sDGydtA4Ph2MzTh5Q4qWDavomK0CODvmWoR+HgDmVI5lTLZiVbIlSoFOrp36ulcep4Vxy0P9vP/jl6LNjXoFUPJuBVEF7fg==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Fri, 15 Dec 2017 13:53:41 +0100 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH v2 13/32] qcow2: Add l2_slice_size field to BDRVQcow2State 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 , "Denis V . Lunev" , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The BDRVQcow2State structure contains an l2_size field, which stores the number of 64-bit entries in an L2 table. For efficiency reasons we want to be able to load slices instead of full L2 tables, so we need to know how many entries an L2 slice can hold. An L2 slice is the portion of an L2 table that is loaded by the qcow2 cache. At the moment that cache can only load complete tables, therefore an L2 slice has the same size as an L2 table (one cluster) and l2_size =3D=3D l2_slice_size. Later we'll allow smaller slices, but until then we have to use this new l2_slice_size field to make the rest of the code ready for that. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake --- block/qcow2.c | 3 +++ block/qcow2.h | 1 + 2 files changed, 4 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index bdac1c156f..c1e4bab391 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -797,6 +797,7 @@ static void read_cache_sizes(BlockDriverState *bs, Qemu= Opts *opts, typedef struct Qcow2ReopenState { Qcow2Cache *l2_table_cache; Qcow2Cache *refcount_block_cache; + int l2_slice_size; bool use_lazy_refcounts; int overlap_check; bool discard_passthrough[QCOW2_DISCARD_MAX]; @@ -878,6 +879,7 @@ static int qcow2_update_options_prepare(BlockDriverStat= e *bs, } } =20 + r->l2_slice_size =3D s->cluster_size / sizeof(uint64_t); r->l2_table_cache =3D qcow2_cache_create(bs, l2_cache_size); r->refcount_block_cache =3D qcow2_cache_create(bs, refcount_cache_size= ); if (r->l2_table_cache =3D=3D NULL || r->refcount_block_cache =3D=3D NU= LL) { @@ -1041,6 +1043,7 @@ static void qcow2_update_options_commit(BlockDriverSt= ate *bs, } s->l2_table_cache =3D r->l2_table_cache; s->refcount_block_cache =3D r->refcount_block_cache; + s->l2_slice_size =3D r->l2_slice_size; =20 s->overlap_check =3D r->overlap_check; s->use_lazy_refcounts =3D r->use_lazy_refcounts; diff --git a/block/qcow2.h b/block/qcow2.h index b9510827bb..2435fd786f 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -251,6 +251,7 @@ typedef struct BDRVQcow2State { int cluster_bits; int cluster_size; int cluster_sectors; + int l2_slice_size; int l2_bits; int l2_size; int l1_size; --=20 2.11.0