From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeSQS-0003wn-Pf for qemu-devel@nongnu.org; Tue, 22 Sep 2015 14:36:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeSQR-0002Up-Mb for qemu-devel@nongnu.org; Tue, 22 Sep 2015 14:36:24 -0400 References: <1442497700-2536-1-git-send-email-kwolf@redhat.com> <1442497700-2536-6-git-send-email-kwolf@redhat.com> From: Max Reitz Message-ID: <56019F9D.9020800@redhat.com> Date: Tue, 22 Sep 2015 20:36:13 +0200 MIME-Version: 1.0 In-Reply-To: <1442497700-2536-6-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Fbc8Lmb2NkXmf5TaN0C0OENjkVMh14XCV" Subject: Re: [Qemu-devel] [PATCH 05/16] block: Convert bs->file to BdrvChild List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: jcody@redhat.com, berto@igalia.com, armbru@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Fbc8Lmb2NkXmf5TaN0C0OENjkVMh14XCV Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 17.09.2015 15:48, Kevin Wolf wrote: > This patch removes the temporary duplication between bs->file and > bs->file_child by converting everything to BdrvChild. >=20 > Signed-off-by: Kevin Wolf > --- > block.c | 61 ++++++++++++++++++++++-----------------= ------- > block/blkdebug.c | 32 ++++++++++++------------ > block/blkverify.c | 33 ++++++++++++++----------- > block/bochs.c | 8 +++--- > block/cloop.c | 10 ++++---- > block/dmg.c | 20 +++++++-------- > block/io.c | 50 +++++++++++++++++++------------------- > block/parallels.c | 38 +++++++++++++++-------------- > block/qapi.c | 2 +- > block/qcow.c | 42 +++++++++++++++++--------------- > block/qcow2-cache.c | 11 +++++---- > block/qcow2-cluster.c | 38 +++++++++++++++++------------ > block/qcow2-refcount.c | 45 ++++++++++++++++++---------------- > block/qcow2-snapshot.c | 30 ++++++++++++----------- > block/qcow2.c | 62 ++++++++++++++++++++++++---------------= -------- > block/qed-table.c | 4 +-- > block/qed.c | 32 ++++++++++++------------ > block/raw_bsd.c | 40 +++++++++++++++--------------- > block/snapshot.c | 12 ++++----- > block/vdi.c | 17 +++++++------ > block/vhdx-log.c | 25 ++++++++++--------- > block/vhdx.c | 36 ++++++++++++++------------- > block/vmdk.c | 27 +++++++++++---------- > block/vpc.c | 34 ++++++++++++++------------ > include/block/block.h | 8 +++++- > include/block/block_int.h | 3 +-- > 26 files changed, 377 insertions(+), 343 deletions(-) Reviewed-by: Max Reitz > diff --git a/block.c b/block.c > index 2e9e5e2..93d713b 100644 > --- a/block.c > +++ b/block.c [...] > @@ -1929,6 +1925,11 @@ void bdrv_close(BlockDriverState *bs) > bdrv_unref(backing_hd); > } > =20 > + if (bs->file !=3D NULL) { > + bdrv_unref(bs->file->bs); I think we can use bdrv_unref_child(bs->file) here. I'd personally like it more, at least (because using bdrv_unref() and relying on the loop below is basically what the comment inside of the loop advises against). Yes, I know, eventually, we want to drop this block anyway and let the loop below handle everything using bdrv_unref_child(). But when we do that conversion, it'll be obvious to drop a bdrv_unref_child() call, whereas dropping bdrv_unref() alone isn't so obvious. Max > + bs->file =3D NULL; > + } > + > QLIST_FOREACH_SAFE(child, &bs->children, next, next) { > /* TODO Remove bdrv_unref() from drivers' close function a= nd use > * bdrv_unref_child() here */ > @@ -1953,11 +1954,6 @@ void bdrv_close(BlockDriverState *bs) > bs->options =3D NULL; > QDECREF(bs->full_open_options); > bs->full_open_options =3D NULL; > - > - if (bs->file !=3D NULL) { > - bdrv_unref(bs->file); > - bs->file =3D NULL; > - } > } > =20 > if (bs->blk) { --Fbc8Lmb2NkXmf5TaN0C0OENjkVMh14XCV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWAZ+dAAoJEDuxQgLoOKytFZYH/1EdSyh0RBAZKhZVVCDFt64E dYYi92rtjoq7DRCjga4qa8FCeUVFz+b2iANriRyvrCmnLk3udaOcXzFGAavRbb8n X8HUzZ4H4vRVCQKEct5c9pZRi6ZxAcOQ8zP7kRRw1s2fl/yr5JZJspn9tOelKb+x ir22ybi5ipStsGAruhHp9h+ESDLHOallhvTAxoxJ7TJx5COyTWaa3AduGJ/iisf5 zn3QO6NV4YqeSe/Zfr3tiP4HKISPuSEE+Qn4t8inyleLWd/bi9fwq/O/tatcUj5Z +0xDZCTobHPyZqRzkb/zBtWMW5D/Sp8N3+CQDbLdwdM+LS8HqDArlR372A7AZ6A= =gXCf -----END PGP SIGNATURE----- --Fbc8Lmb2NkXmf5TaN0C0OENjkVMh14XCV--