From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZePAN-0002O0-94 for qemu-devel@nongnu.org; Tue, 22 Sep 2015 11:07:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZePAM-0001DP-9E for qemu-devel@nongnu.org; Tue, 22 Sep 2015 11:07:35 -0400 References: <1442589793-7105-1-git-send-email-mreitz@redhat.com> <1442589793-7105-21-git-send-email-mreitz@redhat.com> <20150922143551.GF3999@noname.str.redhat.com> From: Max Reitz Message-ID: <56016EAA.4030509@redhat.com> Date: Tue, 22 Sep 2015 17:07:22 +0200 MIME-Version: 1.0 In-Reply-To: <20150922143551.GF3999@noname.str.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Baw5f1Uau9wVA09P9fUS2VLdJU8NPS2f6" Subject: Re: [Qemu-devel] [PATCH v5 20/38] block: Prepare remaining BB functions for NULL BDS List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Alberto Garcia , qemu-block@nongnu.org, John Snow , qemu-devel@nongnu.org, Markus Armbruster , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Baw5f1Uau9wVA09P9fUS2VLdJU8NPS2f6 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 22.09.2015 16:35, Kevin Wolf wrote: > Am 18.09.2015 um 17:22 hat Max Reitz geschrieben: >> There are several BlockBackend functions which, in theory, cannot fail= =2E >> This patch makes them cope with the BlockDriverState pointer being NUL= L >> by making them fall back to some default action like ignoring the valu= e >> in setters and returning the default in getters. >> >> Signed-off-by: Max Reitz >> Reviewed-by: Eric Blake >=20 > Hm, okay, maybe bdrv_drain() belongs here. I just reviewed the end > result for completeness and didn't check which patch did what. >=20 >> int blk_enable_write_cache(BlockBackend *blk) >> { >> + if (!blk->bs) { >> + return 0; >> + } >> + >> return bdrv_enable_write_cache(blk->bs); >> } >> =20 >> void blk_set_enable_write_cache(BlockBackend *blk, bool wce) >> { >> - bdrv_set_enable_write_cache(blk->bs, wce); >> + if (blk->bs) { >> + bdrv_set_enable_write_cache(blk->bs, wce); >> + } >> } >=20 > WCE is part of the open_flags in BlockBackendRootState. The root state > doesn't seem to be used yet, and I wrote about my concerns about it in > reply to an earlier patch, but as long as we have it, should this > query/modify the root state if no BDS is attached? Seems very reasonable, will do. Max --Baw5f1Uau9wVA09P9fUS2VLdJU8NPS2f6 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 iQEcBAEBCAAGBQJWAW6qAAoJEDuxQgLoOKyt7wcIAKNrTK0crTT71ubqSRxs3Z6q c/CAWw4PeCaQlRW/iC/bdnzI3O3n1e1O7ET/v9k7sCobO0Ycz/inc73V26Q0VK3V OJa/v2ZwXvFydEd9hxzBYxj8zyIFfgWO/EuMa8htRqq+GfKcLH6klZyK3yKu9a0e 2DWIDqpV1MpHiQcuZa+YM1Unj9WHSjuupL+76qDbr3Jted7/G2ABuG9skoGXA8En QszacA56j7jzyDuagsYVojKKBKS/BOD2Li1FcdonYN5ZDFn1usZp2T75RhwlyoUQ b301eeGklO4tKrmG2Ap40/++np+oSH/x8m8aWb7cUzRs8waXhc3xmvwSTLiEe+8= =Ea9p -----END PGP SIGNATURE----- --Baw5f1Uau9wVA09P9fUS2VLdJU8NPS2f6--