From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akysC-0002y5-Av for qemu-devel@nongnu.org; Tue, 29 Mar 2016 15:00:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akys7-0003GQ-BN for qemu-devel@nongnu.org; Tue, 29 Mar 2016 15:00:16 -0400 References: <1458675397-24956-1-git-send-email-kwolf@redhat.com> <1458675397-24956-10-git-send-email-kwolf@redhat.com> From: Max Reitz Message-ID: <56FAD0AC.8090900@redhat.com> Date: Tue, 29 Mar 2016 20:59:56 +0200 MIME-Version: 1.0 In-Reply-To: <1458675397-24956-10-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LeDeH8ciDQT4Tbk0wrUejQ6x2mEN4aGTB" Subject: Re: [Qemu-devel] [PATCH 9/9] block: Remove BlockDriverState.blk List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LeDeH8ciDQT4Tbk0wrUejQ6x2mEN4aGTB Content-Type: multipart/mixed; boundary="8CjJGX6aNGCdgIXNbTTc5fNBdtlO1eWwL" From: Max Reitz To: Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org Message-ID: <56FAD0AC.8090900@redhat.com> Subject: Re: [PATCH 9/9] block: Remove BlockDriverState.blk References: <1458675397-24956-1-git-send-email-kwolf@redhat.com> <1458675397-24956-10-git-send-email-kwolf@redhat.com> In-Reply-To: <1458675397-24956-10-git-send-email-kwolf@redhat.com> --8CjJGX6aNGCdgIXNbTTc5fNBdtlO1eWwL Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 22.03.2016 20:36, Kevin Wolf wrote: > This patch removes the remaining users of bs->blk, which will allow us > to have multiple BBs on top of a single BDS. All checks that are > currently in place to prevent the user from creating such setups. I think this sentence is missing a word or two. > Future patches can allow them and e.g. enable users to mirror to a bloc= k > device that already has a BlockBackend on it. >=20 > Signed-off-by: Kevin Wolf > --- > block.c | 8 -------- > block/block-backend.c | 8 -------- > block/mirror.c | 4 ++-- > blockdev.c | 19 ++++++++----------- > include/block/block_int.h | 2 -- > tests/qemu-iotests/085.out | 6 +++--- > 6 files changed, 13 insertions(+), 34 deletions(-) [...] > diff --git a/blockdev.c b/blockdev.c > index c59cf3e..a658869 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -1774,9 +1774,8 @@ static void external_snapshot_prepare(BlkActionSt= ate *common, > return; > } > =20 > - if (state->new_bs->blk !=3D NULL) { > - error_setg(errp, "The snapshot is already in use by %s", > - blk_name(state->new_bs->blk)); > + if (bdrv_has_blk(state->new_bs)) { > + error_setg(errp, "The snapshot is already in use"); You did add bdrv_get_parent_name(), so you could use it here... > return; > } > =20 > @@ -2492,9 +2491,8 @@ void qmp_x_blockdev_insert_medium(const char *dev= ice, const char *node_name, > return; > } > =20 > - if (bs->blk) { > - error_setg(errp, "Node '%s' is already in use by '%s'", node_n= ame, > - blk_name(bs->blk)); > + if (bdrv_has_blk(bs)) { > + error_setg(errp, "Node '%s' is already in use", node_name); =2E..and here... > return; > } > =20 > @@ -3439,7 +3437,7 @@ static void blockdev_mirror_common(BlockDriverSta= te *bs, > if (bdrv_op_is_blocked(target, BLOCK_OP_TYPE_MIRROR_TARGET, errp))= { > return; > } > - if (target->blk) { > + if (bdrv_has_blk(target)) { > error_setg(errp, "Cannot mirror to an attached block device");= > return; > } > @@ -4023,15 +4021,14 @@ void qmp_x_blockdev_del(bool has_id, const char= *id, > bs =3D blk_bs(blk); > aio_context =3D blk_get_aio_context(blk); > } else { > + blk =3D NULL; > bs =3D bdrv_find_node(node_name); > if (!bs) { > error_setg(errp, "Cannot find node %s", node_name); > return; > } > - blk =3D bs->blk; > - if (blk) { > - error_setg(errp, "Node %s is in use by %s", > - node_name, blk_name(blk)); > + if (bdrv_has_blk(bs)) { > + error_setg(errp, "Node %s is in use", node_name); =2E..and here. If you consciously decide not to use it there, and after you have fixed the commit message: Reviewed-by: Max Reitz > return; > } > aio_context =3D bdrv_get_aio_context(bs); [...] --8CjJGX6aNGCdgIXNbTTc5fNBdtlO1eWwL-- --LeDeH8ciDQT4Tbk0wrUejQ6x2mEN4aGTB 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 iQEcBAEBCAAGBQJW+tCtAAoJEDuxQgLoOKytDhoH+QE3KOB6nL0h4HUHA7wFhXV4 CpBY+3yMqaCeRiKwICghTKQlsKCeGPdmwLj9neh2X018r//Lqo1uK4BlGl68aYfw VoaYtKR+kuYNepJhAkirh4nsbsCdJ1zL9NxoUOE/wFxAVF2UvENO90OOEP0pnpPO 72ILY4rpcSGtOXstDxu3LQcwgtWMvhsLAPaZj9QCrgYuEaWfekSB5dSg5s4WR0bw ETarSuOmU7b3gtRQUdKsNEPJBHezffzCttIVZyV6w6p2GQla8r0CEw19uLVrXHN2 UtNzapCohhkidyC3uz7Pnxoiu/wpiGBgM7UZuLtiiWFIMl+yruSPXqlzKRwadxw= =NAUi -----END PGP SIGNATURE----- --LeDeH8ciDQT4Tbk0wrUejQ6x2mEN4aGTB--