From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeR9d-000560-6T for qemu-devel@nongnu.org; Tue, 22 Sep 2015 13:15:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeR9b-0002wL-Ii for qemu-devel@nongnu.org; Tue, 22 Sep 2015 13:14:57 -0400 References: <1442497700-2536-1-git-send-email-kwolf@redhat.com> <1442497700-2536-2-git-send-email-kwolf@redhat.com> From: Max Reitz Message-ID: <56018C83.7030207@redhat.com> Date: Tue, 22 Sep 2015 19:14:43 +0200 MIME-Version: 1.0 In-Reply-To: <1442497700-2536-2-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="CxlJblndVkDEkDfK4CnUCfWUK1bMpNH2t" Subject: Re: [Qemu-devel] [PATCH 01/16] block: Introduce BDS.file_child 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) --CxlJblndVkDEkDfK4CnUCfWUK1bMpNH2t Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 17.09.2015 15:48, Kevin Wolf wrote: > Store the BdrvChild for bs->file. At this point, bs->file_child->bs jus= t > duplicates the bs->file pointer. Later, it will completely replace it. >=20 > Signed-off-by: Kevin Wolf > --- > block.c | 12 +++++++++--- > include/block/block_int.h | 1 + > 2 files changed, 10 insertions(+), 3 deletions(-) Reviewed-by: Max Reitz Although I have a small comment below: >=20 > diff --git a/block.c b/block.c > index 6268e37..2e9e5e2 100644 > --- a/block.c > +++ b/block.c > @@ -1487,11 +1487,17 @@ static int bdrv_open_inherit(BlockDriverState *= *pbs, const char *filename, > =20 > assert(file =3D=3D NULL); This looks strange now, without the direct connection to bdrv_open_image(). I'd drop this... > bs->open_flags =3D flags; > - ret =3D bdrv_open_image(&file, filename, options, "file", > - bs, &child_file, true, &local_err); > - if (ret < 0) { > + > + bs->file_child =3D bdrv_open_child(filename, options, "file", = bs, > + &child_file, true, &local_err= ); > + if (local_err) { > + ret =3D -EINVAL; > goto fail; > } > + > + if (bs->file_child) { > + file =3D bs->file_child->bs; > + } And make this file =3D bs->file_child ? bs->file_child->bs : NULL (or the= respective long form, i.e. if (bs->file_child) { ... } else { file =3D NULL; }). We could even put this after this if block and drop the NULL initialization of file, but that might go overboard. Max > } > =20 > /* Image format probing */ > diff --git a/include/block/block_int.h b/include/block/block_int.h > index 14ad4c3..d0dd93e 100644 > --- a/include/block/block_int.h > +++ b/include/block/block_int.h > @@ -381,6 +381,7 @@ struct BlockDriverState { > BlockDriverState *backing_hd; > BdrvChild *backing_child; > BlockDriverState *file; > + BdrvChild *file_child; > =20 > NotifierList close_notifiers; > =20 >=20 --CxlJblndVkDEkDfK4CnUCfWUK1bMpNH2t 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 iQEcBAEBCAAGBQJWAYyDAAoJEDuxQgLoOKyt13wIAK5C7WLDKgeOHR3ENbDfRIKu BOcwSPtIKCnevose8wZS8kSVsbf4TBuLqLja1BB6EiWnl0NQPfqyS4UfFOkl7D7d FkT+8X64Gx+w97CEYBT81ROKDTCKSft/RH42Lk4kH/KTN8/oMg+gxhZnF4QDBccO 6PvFsRV5weH+42y67IHedMEsx6XI57sYc29y52KtljSmb89MBfGJgh4NRgMrtqcs NcNehoQDvTPZF+xW7+wKAGhipKxU0cvyvW76OjZExYwRwCMGnaKkzR13R9aeuLPf ogLVwuUwMBrRjW7lHwVzXwCHYjIImc2P0xR0WAMVRGWjOotsNC+6+p/2MJ8naXI= =Qpsk -----END PGP SIGNATURE----- --CxlJblndVkDEkDfK4CnUCfWUK1bMpNH2t--