From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeRCE-0006qA-H7 for qemu-devel@nongnu.org; Tue, 22 Sep 2015 13:17:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeRCA-0004LI-IH for qemu-devel@nongnu.org; Tue, 22 Sep 2015 13:17:38 -0400 References: <1442497700-2536-1-git-send-email-kwolf@redhat.com> <1442497700-2536-2-git-send-email-kwolf@redhat.com> <56018C83.7030207@redhat.com> From: Max Reitz Message-ID: <56018D20.4030709@redhat.com> Date: Tue, 22 Sep 2015 19:17:20 +0200 MIME-Version: 1.0 In-Reply-To: <56018C83.7030207@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XK0kamoIIh1PbrnBvJejki6jJQItdmFep" 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) --XK0kamoIIh1PbrnBvJejki6jJQItdmFep Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 22.09.2015 19:14, Max Reitz wrote: > On 17.09.2015 15:48, Kevin Wolf wrote: >> Store the BdrvChild for bs->file. At this point, bs->file_child->bs ju= st >> duplicates the bs->file pointer. Later, it will completely replace it.= >> >> Signed-off-by: Kevin Wolf >> --- >> block.c | 12 +++++++++--- >> include/block/block_int.h | 1 + >> 2 files changed, 10 insertions(+), 3 deletions(-) >=20 > Reviewed-by: Max Reitz >=20 > 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); >=20 > This looks strange now, without the direct connection to > bdrv_open_image(). I'd drop this... >=20 >> 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_er= r); >> + if (local_err) { >> + ret =3D -EINVAL; >> goto fail; >> } >> + >> + if (bs->file_child) { >> + file =3D bs->file_child->bs; >> + } >=20 > And make this file =3D bs->file_child ? bs->file_child->bs : NULL (or t= he > respective long form, i.e. > if (bs->file_child) { ... } else { file =3D NULL; }). >=20 > We could even put this after this if block and drop the NULL > initialization of file, but that might go overboard. And expecting something like this, I skipped ahead to patch 5, which drops this altogether. An R-b without any comments it is, then. :-) 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 >=20 --XK0kamoIIh1PbrnBvJejki6jJQItdmFep 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 iQEcBAEBCAAGBQJWAY0gAAoJEDuxQgLoOKytxeQIAKzdAhJ4HcrDB+hkJimcil4W /R2SQUERADWHp7kwUMDdBIvP0cHThu4rGt2GUNHJqJOnLr9QoZIQf+o2XSNIAC22 LTdyAcHYHTmPaoxK40ShURWMHJ+ZThyFuUX8dZ2ds8KrexD4M5yIFXRYc4flF0Xu 8GKo+q64eS1NUNx5dX4HE47v9deqif7B+cTm+Np2a2VfYIDMHUMQVVAMRutMrNcO 4EYJ+s8418iu8TZ4+jGvZ9Z0tOF7yQfH34/y5VTxlwd4KeOyovPVk8XfPs1weyeK IWFXfwdAF0TWTsjR+nnwaYN4AJBTD0qh9v5lxk9vA5c9fFQRikJs7lf1ZC8oXC8= =oQBf -----END PGP SIGNATURE----- --XK0kamoIIh1PbrnBvJejki6jJQItdmFep--