From nobody Mon Feb 9 05:19:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) 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=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516980203758344.65976927275926; Fri, 26 Jan 2018 07:23:23 -0800 (PST) Received: from localhost ([::1]:33176 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ef5qc-0000wC-TK for importer@patchew.org; Fri, 26 Jan 2018 10:23:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ef5nJ-000713-DC for qemu-devel@nongnu.org; Fri, 26 Jan 2018 10:19:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ef5nF-0000cJ-EW for qemu-devel@nongnu.org; Fri, 26 Jan 2018 10:19:57 -0500 Received: from fanzine.igalia.com ([91.117.99.155]:54086) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ef5nF-0000bs-5h; Fri, 26 Jan 2018 10:19:53 -0500 Received: from 88-114-101-230.elisa-laajakaista.fi ([88.114.101.230] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1ef5V7-0007gx-WF; Fri, 26 Jan 2018 16:01:10 +0100 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1ef5UH-00087K-Ag; Fri, 26 Jan 2018 17:00:17 +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=18rXIdkl9iX/0aVFHsGxXfd1/PSBfGjM5vUwSsSPqrg=; b=E7QkH13SX57bRbYalBGoGcxa43TnPV9Rdv1gmV0KAuvGeVkq7tEp/ANNFVAdQLkod/1yh3z9Wd1N8ievvZLylvrVc6xG9PKc67ddtssj1iDaz9U2IqT0jhLwTOd8m8SPTlnHLGa+SLFZ+Uks8sBPRruRY8FaXphiyNZCtGIJi04eoL9zYNcz4A2jTnls09V3YQwSxfesctdBt1CgpPI0JmZnNsG4zd9oKtNeklYzywqI+iNeyufYVMjjse024MSwIei1kobb+qDQ77cTmT7OkKVPT8XToqtMc2tTmm3tau6S7q8TVlalZGruztGE+gHSEBTX1uqC208XEzVBi7XBfQ==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Fri, 26 Jan 2018 16:59:46 +0200 Message-Id: <9c3d818ac202b776dbe73080d017e2c179c5babd.1516978645.git.berto@igalia.com> 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 v3 19/39] qcow2: Update get_cluster_table() to support L2 slices 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 , Anton Nefedov , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , "Denis V . Lunev" 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_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch updates get_cluster_table() to return L2 slices instead of full L2 tables. The code itself needs almost no changes, it only needs to call offset_to_l2_slice_index() instead of offset_to_l2_index(). This patch also renames all the relevant variables and the documentation. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake Reviewed-by: Max Reitz --- block/qcow2-cluster.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 0c0cab85e8..416d48fa77 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -660,20 +660,20 @@ fail: * get_cluster_table * * for a given disk offset, load (and allocate if needed) - * the l2 table. + * the appropriate slice of its l2 table. * - * the cluster index in the l2 table is given to the caller. + * the cluster index in the l2 slice is given to the caller. * * Returns 0 on success, -errno in failure case */ static int get_cluster_table(BlockDriverState *bs, uint64_t offset, - uint64_t **new_l2_table, + uint64_t **new_l2_slice, int *new_l2_index) { BDRVQcow2State *s =3D bs->opaque; unsigned int l2_index; uint64_t l1_index, l2_offset; - uint64_t *l2_table =3D NULL; + uint64_t *l2_slice =3D NULL; int ret; =20 /* seek to the l2 offset in the l1 table */ @@ -713,17 +713,17 @@ static int get_cluster_table(BlockDriverState *bs, ui= nt64_t offset, assert(offset_into_cluster(s, l2_offset) =3D=3D 0); } =20 - /* load the l2 table in memory */ - ret =3D l2_load(bs, offset, l2_offset, &l2_table); + /* load the l2 slice in memory */ + ret =3D l2_load(bs, offset, l2_offset, &l2_slice); if (ret < 0) { return ret; } =20 /* find the cluster offset for the given disk offset */ =20 - l2_index =3D offset_to_l2_index(s, offset); + l2_index =3D offset_to_l2_slice_index(s, offset); =20 - *new_l2_table =3D l2_table; + *new_l2_slice =3D l2_slice; *new_l2_index =3D l2_index; =20 return 0; --=20 2.11.0