From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhIRB-0001UE-TW for qemu-devel@nongnu.org; Wed, 30 Sep 2015 10:32:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhIR6-0000FN-BY for qemu-devel@nongnu.org; Wed, 30 Sep 2015 10:32:53 -0400 References: <1442589793-7105-1-git-send-email-mreitz@redhat.com> <1442589793-7105-8-git-send-email-mreitz@redhat.com> From: Max Reitz Message-ID: <560BF284.6040808@redhat.com> Date: Wed, 30 Sep 2015 16:32:36 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1TC2KBNIcXWiIVat2njAEuq6uCVkIhdm8" Subject: Re: [Qemu-devel] [PATCH v5 07/38] block: Make bdrv_is_inserted() recursive List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia , qemu-block@nongnu.org Cc: Kevin Wolf , qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi , John Snow This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1TC2KBNIcXWiIVat2njAEuq6uCVkIhdm8 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 29.09.2015 11:15, Alberto Garcia wrote: > On Fri 18 Sep 2015 05:22:42 PM CEST, Max Reitz wrote: >> If bdrv_is_inserted() is called on the top level BDS, it should make >> sure all nodes in the BDS tree are actually inserted. >> >> Signed-off-by: Max Reitz >> --- >> block.c | 12 +++++++++--- >> 1 file changed, 9 insertions(+), 3 deletions(-) >> >> diff --git a/block.c b/block.c >> index 4a089e6..c4fa299 100644 >> --- a/block.c >> +++ b/block.c >> @@ -3247,14 +3247,20 @@ void bdrv_invalidate_cache_all(Error **errp) >> bool bdrv_is_inserted(BlockDriverState *bs) >> { >> BlockDriver *drv =3D bs->drv; >> + BdrvChild *child; >> =20 >> if (!drv) { >> return false; >> } >> - if (!drv->bdrv_is_inserted) { >> - return true; >> + if (drv->bdrv_is_inserted) { >> + return drv->bdrv_is_inserted(bs); >> } >=20 > If there's drv->bdrv_is_inserted then this code stops here and does not= > iterate the children, is this correct? Yes, that is how it's supposed to be. Max >> - return drv->bdrv_is_inserted(bs); >> + QLIST_FOREACH(child, &bs->children, next) { >> + if (!bdrv_is_inserted(child->bs)) { >> + return false; >> + } >> + } >> + return true; >> } >=20 > Berto >=20 --1TC2KBNIcXWiIVat2njAEuq6uCVkIhdm8 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 iQEcBAEBCAAGBQJWC/KEAAoJEDuxQgLoOKytzLkIAK5OnFq0AD18Sph1FM8cryVW /x7K+V+eoHQGWLd/oMwz+MCdZv3TQn0D34XO53zxkY5B5wkafkB3d7Uu8K6mQvY3 U2NVF4pdrej1vmm6Sf68wn3gk1RaCz6AGDf24FOqkuNoReL2PBSmTNNTSQ34F0iP DHsOdY/YE8ARv7ZJ1nsHtc7iFGrrvhsqNTueJFb5H3wpaoGdnen6nsRBA4jLOGIo 8AS1OTvnQVKCd/cO6NmuvEL8/PZJfQ/tzW4/DndPJEw52PgnaEaEj7bbVJp9gPjH U2u490SPuaXlB4ZEaFiYsKUz9cNfkb7gGxW0CkgwSZAXu6zfPsCPnqyheKcC8U4= =+WoM -----END PGP SIGNATURE----- --1TC2KBNIcXWiIVat2njAEuq6uCVkIhdm8--