From nobody Sun Feb 8 19:43:37 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 1516982397173972.9726274055386; Fri, 26 Jan 2018 07:59:57 -0800 (PST) Received: from localhost ([::1]:35265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ef6Pz-00016H-GN for importer@patchew.org; Fri, 26 Jan 2018 10:59:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ef6Nr-00081D-Hc for qemu-devel@nongnu.org; Fri, 26 Jan 2018 10:57:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ef6Nn-0005aJ-IB for qemu-devel@nongnu.org; Fri, 26 Jan 2018 10:57:43 -0500 Received: from fanzine.igalia.com ([91.117.99.155]:33039) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ef6Nn-0005Zj-62; Fri, 26 Jan 2018 10:57:39 -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 1ef5VR-0007gx-RA; Fri, 26 Jan 2018 16:01:30 +0100 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1ef5UG-00086f-RS; Fri, 26 Jan 2018 17:00:16 +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=RfQbOuuVSJgYbU3/Ylb5rLURvYEjqf/WfQPpYikz2zc=; b=jiaDBFKtV6H8YrFNUsVar8KbGHZuvXVd2nN1M7EaK2eOSe0+xFGcEkVEFaKhrUAwaSD4d9N+oIDrcEdOfTVIf3GRapDEsl66mwJRNRiKfWAm8VFZSGp78QnKlkW1bQzvoHNdCVY2J49yVE9TRnOv0HjBVzHQTwCaHYKklrB3obodMkMBOApzAT/VLpSt/F/vNwhiTEbGxLU1JrOxEIRPWs6slQGLZcRqUijNkOZ/CBpQwDzP309DHWOWqp41lCIQqXdQ/nk9euyQA3TC7SWA5Wg1nr3uRgWIb3qgQ+fyjBLn0fCjh+QnFHQ+N7PuVXTN4ShkfiaWl2OZSPpbkFGeQQ==; From: Alberto Garcia To: qemu-devel@nongnu.org Date: Fri, 26 Jan 2018 16:59:34 +0200 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 v3 07/39] qcow2: Remove BDS parameter from qcow2_cache_put() 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 function was only using the BlockDriverState parameter to pass it to qcow2_cache_get_table_idx(). This is no longer necessary so this parameter can be removed. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake Reviewed-by: Max Reitz --- block/qcow2-cache.c | 2 +- block/qcow2-cluster.c | 28 ++++++++++++++-------------- block/qcow2-refcount.c | 30 +++++++++++++++--------------- block/qcow2.h | 2 +- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index 07603e6b15..3b55f39afb 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -407,7 +407,7 @@ int qcow2_cache_get_empty(BlockDriverState *bs, Qcow2Ca= che *c, uint64_t offset, return qcow2_cache_do_get(bs, c, offset, table, false); } =20 -void qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table) +void qcow2_cache_put(Qcow2Cache *c, void **table) { int i =3D qcow2_cache_get_table_idx(c, *table); =20 diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index 1f279a9151..4a7b46038b 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -318,7 +318,7 @@ static int l2_allocate(BlockDriverState *bs, int l1_ind= ex, uint64_t **table) =20 memcpy(l2_table, old_table, s->cluster_size); =20 - qcow2_cache_put(bs, s->l2_table_cache, (void **) &old_table); + qcow2_cache_put(s->l2_table_cache, (void **) &old_table); } =20 /* write the l2 table to the file */ @@ -346,7 +346,7 @@ static int l2_allocate(BlockDriverState *bs, int l1_ind= ex, uint64_t **table) fail: trace_qcow2_l2_allocate_done(bs, l1_index, ret); if (l2_table !=3D NULL) { - qcow2_cache_put(bs, s->l2_table_cache, (void**) table); + qcow2_cache_put(s->l2_table_cache, (void **) table); } s->l1_table[l1_index] =3D old_l2_offset; if (l2_offset > 0) { @@ -620,7 +620,7 @@ int qcow2_get_cluster_offset(BlockDriverState *bs, uint= 64_t offset, abort(); } =20 - qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); + qcow2_cache_put(s->l2_table_cache, (void **) &l2_table); =20 bytes_available =3D (int64_t)c * s->cluster_size; =20 @@ -638,7 +638,7 @@ out: return type; =20 fail: - qcow2_cache_put(bs, s->l2_table_cache, (void **)&l2_table); + qcow2_cache_put(s->l2_table_cache, (void **)&l2_table); return ret; } =20 @@ -745,13 +745,13 @@ uint64_t qcow2_alloc_compressed_cluster_offset(BlockD= riverState *bs, * allocated. */ cluster_offset =3D be64_to_cpu(l2_table[l2_index]); if (cluster_offset & L2E_OFFSET_MASK) { - qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); + qcow2_cache_put(s->l2_table_cache, (void **) &l2_table); return 0; } =20 cluster_offset =3D qcow2_alloc_bytes(bs, compressed_size); if (cluster_offset < 0) { - qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); + qcow2_cache_put(s->l2_table_cache, (void **) &l2_table); return 0; } =20 @@ -768,7 +768,7 @@ uint64_t qcow2_alloc_compressed_cluster_offset(BlockDri= verState *bs, BLKDBG_EVENT(bs->file, BLKDBG_L2_UPDATE_COMPRESSED); qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table); l2_table[l2_index] =3D cpu_to_be64(cluster_offset); - qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); + qcow2_cache_put(s->l2_table_cache, (void **) &l2_table); =20 return cluster_offset; } @@ -957,7 +957,7 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, Q= CowL2Meta *m) } =20 =20 - qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); + qcow2_cache_put(s->l2_table_cache, (void **) &l2_table); =20 /* * If this was a COW, we need to decrease the refcount of the old clus= ter. @@ -1175,7 +1175,7 @@ static int handle_copied(BlockDriverState *bs, uint64= _t guest_offset, =20 /* Cleanup */ out: - qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); + qcow2_cache_put(s->l2_table_cache, (void **) &l2_table); =20 /* Only return a host offset if we actually made progress. Otherwise we * would make requirements for handle_alloc() that it can't fulfill */ @@ -1334,7 +1334,7 @@ static int handle_alloc(BlockDriverState *bs, uint64_= t guest_offset, keep_old_clusters =3D true; } =20 - qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); + qcow2_cache_put(s->l2_table_cache, (void **) &l2_table); =20 if (!alloc_cluster_offset) { /* Allocate, if necessary at a given offset in the image file */ @@ -1690,7 +1690,7 @@ static int discard_single_l2(BlockDriverState *bs, ui= nt64_t offset, qcow2_free_any_clusters(bs, old_l2_entry, 1, type); } =20 - qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); + qcow2_cache_put(s->l2_table_cache, (void **) &l2_table); =20 return nb_clusters; } @@ -1784,7 +1784,7 @@ static int zero_single_l2(BlockDriverState *bs, uint6= 4_t offset, } } =20 - qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); + qcow2_cache_put(s->l2_table_cache, (void **) &l2_table); =20 return nb_clusters; } @@ -1987,7 +1987,7 @@ static int expand_zero_clusters_in_l1(BlockDriverStat= e *bs, uint64_t *l1_table, qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table); qcow2_cache_depends_on_flush(s->l2_table_cache); } - qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); + qcow2_cache_put(s->l2_table_cache, (void **) &l2_table); } else { if (l2_dirty) { ret =3D qcow2_pre_write_overlap_check(bs, @@ -2018,7 +2018,7 @@ fail: if (!is_active_l1) { qemu_vfree(l2_table); } else { - qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); + qcow2_cache_put(s->l2_table_cache, (void **) &l2_table); } } return ret; diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index 5434e7d4c8..65af05dd23 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -277,7 +277,7 @@ int qcow2_get_refcount(BlockDriverState *bs, int64_t cl= uster_index, block_index =3D cluster_index & (s->refcount_block_size - 1); *refcount =3D s->get_refcount(refcount_block, block_index); =20 - qcow2_cache_put(bs, s->refcount_block_cache, &refcount_block); + qcow2_cache_put(s->refcount_block_cache, &refcount_block); =20 return 0; } @@ -449,7 +449,7 @@ static int alloc_refcount_block(BlockDriverState *bs, return -EAGAIN; } =20 - qcow2_cache_put(bs, s->refcount_block_cache, refcount_block); + qcow2_cache_put(s->refcount_block_cache, refcount_block); =20 /* * If we come here, we need to grow the refcount table. Again, a new @@ -501,7 +501,7 @@ static int alloc_refcount_block(BlockDriverState *bs, =20 fail: if (*refcount_block !=3D NULL) { - qcow2_cache_put(bs, s->refcount_block_cache, refcount_block); + qcow2_cache_put(s->refcount_block_cache, refcount_block); } return ret; } @@ -660,7 +660,7 @@ int64_t qcow2_refcount_area(BlockDriverState *bs, uint6= 4_t start_offset, refblock_data); } =20 - qcow2_cache_put(bs, s->refcount_block_cache, &refblock_data); + qcow2_cache_put(s->refcount_block_cache, &refblock_data); } =20 assert(block_offset =3D=3D table_offset); @@ -836,7 +836,7 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(Bloc= kDriverState *bs, /* Load the refcount block and allocate it if needed */ if (table_index !=3D old_table_index) { if (refcount_block) { - qcow2_cache_put(bs, s->refcount_block_cache, &refcount_blo= ck); + qcow2_cache_put(s->refcount_block_cache, &refcount_block); } ret =3D alloc_refcount_block(bs, cluster_index, &refcount_bloc= k); if (ret < 0) { @@ -874,7 +874,7 @@ static int QEMU_WARN_UNUSED_RESULT update_refcount(Bloc= kDriverState *bs, table =3D qcow2_cache_is_table_offset(bs, s->refcount_block_ca= che, offset); if (table !=3D NULL) { - qcow2_cache_put(bs, s->refcount_block_cache, &refcount_blo= ck); + qcow2_cache_put(s->refcount_block_cache, &refcount_block); qcow2_cache_discard(bs, s->refcount_block_cache, table); } =20 @@ -897,7 +897,7 @@ fail: =20 /* Write last changed block to disk */ if (refcount_block) { - qcow2_cache_put(bs, s->refcount_block_cache, &refcount_block); + qcow2_cache_put(s->refcount_block_cache, &refcount_block); } =20 /* @@ -1319,7 +1319,7 @@ int qcow2_update_snapshot_refcount(BlockDriverState *= bs, } } =20 - qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); + qcow2_cache_put(s->l2_table_cache, (void **) &l2_table); =20 if (addend !=3D 0) { ret =3D qcow2_update_cluster_refcount(bs, l2_offset >> @@ -1347,7 +1347,7 @@ int qcow2_update_snapshot_refcount(BlockDriverState *= bs, ret =3D bdrv_flush(bs); fail: if (l2_table) { - qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); + qcow2_cache_put(s->l2_table_cache, (void **) &l2_table); } =20 s->cache_discards =3D false; @@ -2847,7 +2847,7 @@ static int walk_over_reftable(BlockDriverState *bs, u= int64_t **new_reftable, new_reftable_size, new_refblock, new_refblock_empty, allocated, errp); if (ret < 0) { - qcow2_cache_put(bs, s->refcount_block_cache, &refb= lock); + qcow2_cache_put(s->refcount_block_cache, &refblock= ); return ret; } =20 @@ -2860,7 +2860,7 @@ static int walk_over_reftable(BlockDriverState *bs, u= int64_t **new_reftable, if (new_refcount_bits < 64 && refcount >> new_refcount_bit= s) { uint64_t offset; =20 - qcow2_cache_put(bs, s->refcount_block_cache, &refblock= ); + qcow2_cache_put(s->refcount_block_cache, &refblock); =20 offset =3D ((reftable_index << s->refcount_block_bits) + refblock_index) << s->cluster_bits; @@ -2881,7 +2881,7 @@ static int walk_over_reftable(BlockDriverState *bs, u= int64_t **new_reftable, new_refblock_empty =3D new_refblock_empty && refcount =3D= =3D 0; } =20 - qcow2_cache_put(bs, s->refcount_block_cache, &refblock); + qcow2_cache_put(s->refcount_block_cache, &refblock); } else { /* No refblock means every refcount is 0 */ for (refblock_index =3D 0; refblock_index < s->refcount_block_= size; @@ -3173,14 +3173,14 @@ static int qcow2_discard_refcount_block(BlockDriver= State *bs, offset_to_reftable_index(s, discard_block_= offs), discard_block_offs, s->get_refcount(refblock, block_index)); - qcow2_cache_put(bs, s->refcount_block_cache, &refblock); + qcow2_cache_put(s->refcount_block_cache, &refblock); return -EINVAL; } s->set_refcount(refblock, block_index, 0); =20 qcow2_cache_entry_mark_dirty(s->refcount_block_cache, refblock); =20 - qcow2_cache_put(bs, s->refcount_block_cache, &refblock); + qcow2_cache_put(s->refcount_block_cache, &refblock); =20 if (cluster_index < s->free_cluster_index) { s->free_cluster_index =3D cluster_index; @@ -3233,7 +3233,7 @@ int qcow2_shrink_reftable(BlockDriverState *bs) } else { unused_block =3D buffer_is_zero(refblock, s->cluster_size); } - qcow2_cache_put(bs, s->refcount_block_cache, &refblock); + qcow2_cache_put(s->refcount_block_cache, &refblock); =20 reftable_tmp[i] =3D unused_block ? 0 : cpu_to_be64(s->refcount_tab= le[i]); } diff --git a/block/qcow2.h b/block/qcow2.h index ad332ed380..96626d151f 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -653,7 +653,7 @@ int qcow2_cache_get(BlockDriverState *bs, Qcow2Cache *c= , uint64_t offset, void **table); int qcow2_cache_get_empty(BlockDriverState *bs, Qcow2Cache *c, uint64_t of= fset, void **table); -void qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table); +void qcow2_cache_put(Qcow2Cache *c, void **table); void *qcow2_cache_is_table_offset(BlockDriverState *bs, Qcow2Cache *c, uint64_t offset); void qcow2_cache_discard(BlockDriverState *bs, Qcow2Cache *c, void *table); --=20 2.11.0