From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ajvOn-0001Yt-TZ for qemu-devel@nongnu.org; Sat, 26 Mar 2016 17:05:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ajvOn-0000W5-00 for qemu-devel@nongnu.org; Sat, 26 Mar 2016 17:05:33 -0400 References: <1458325289-17848-1-git-send-email-kwolf@redhat.com> <1458325289-17848-18-git-send-email-kwolf@redhat.com> From: Max Reitz Message-ID: <56F6F995.1040906@redhat.com> Date: Sat, 26 Mar 2016 22:05:25 +0100 MIME-Version: 1.0 In-Reply-To: <1458325289-17848-18-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="piLsmHWqEKOr5eU001MfIJKcXTgkk2FAh" Subject: Re: [Qemu-devel] [PATCH 17/20] qemu-io: Use bdrv_parse_cache_mode() in reopen_f() 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) --piLsmHWqEKOr5eU001MfIJKcXTgkk2FAh Content-Type: multipart/mixed; boundary="U69cr4BMwBaDufD8tpSUn10F3mGCScNKh" From: Max Reitz To: Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org Message-ID: <56F6F995.1040906@redhat.com> Subject: Re: [PATCH 17/20] qemu-io: Use bdrv_parse_cache_mode() in reopen_f() References: <1458325289-17848-1-git-send-email-kwolf@redhat.com> <1458325289-17848-18-git-send-email-kwolf@redhat.com> In-Reply-To: <1458325289-17848-18-git-send-email-kwolf@redhat.com> --U69cr4BMwBaDufD8tpSUn10F3mGCScNKh Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 18.03.2016 19:21, Kevin Wolf wrote: > We must forbid changing the WCE flag in bdrv_reopen() in the same patch= , > as otherwise the behaviour would change so that the flag takes > precedence over the explicitly specified option. >=20 > The correct value of the WCE flag depends on the BlockBackend user (e.g= =2E > guest device) and isn't a decision that the QMP client makes, so this > change is what we want. >=20 > Signed-off-by: Kevin Wolf > --- > block.c | 18 ++++++------------ > qemu-io-cmds.c | 14 +++++++++++++- > tests/qemu-iotests/142 | 2 +- > tests/qemu-iotests/142.out | 2 +- > 4 files changed, 21 insertions(+), 15 deletions(-) >=20 [...] > diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c > index e929d24..7de3754 100644 > --- a/qemu-io-cmds.c > +++ b/qemu-io-cmds.c [...] > @@ -2136,14 +2137,25 @@ static int reopen_f(BlockBackend *blk, int argc= , char **argv) > return qemuio_command_usage(&reopen_cmd); > } > =20 > + if (writethrough !=3D blk_enable_write_cache(blk) && > + blk_get_attached_dev(blk)) > + { > + error_report("Cannot change cache.writeback: Device attached")= ; > + qemu_opts_reset(&reopen_opts); > + return 0; > + } > + > qopts =3D qemu_opts_find(&reopen_opts, NULL); > opts =3D qopts ? qemu_opts_to_qdict(qopts, NULL) : NULL; > qemu_opts_reset(&reopen_opts); > =20 > + flags |=3D blk_enable_write_cache(blk) ? BDRV_O_CACHE_WB : 0; Shouldn't this be bdrv_enable_write_cache(bs)? With blk_enable_write_cache(blk), reopening a non-WB BB should always fail because bdrv_reopen_multiple() accuses us of trying to change the WB mode (whereas we really don't want to change the BDS's mode). Max > brq =3D bdrv_reopen_queue(NULL, bs, opts, flags); > bdrv_reopen_multiple(brq, &local_err); > if (local_err) { > error_report_err(local_err); > + } else { > + blk_set_enable_write_cache(blk, !writethrough); > } > =20 > return 0; --U69cr4BMwBaDufD8tpSUn10F3mGCScNKh-- --piLsmHWqEKOr5eU001MfIJKcXTgkk2FAh 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 iQEcBAEBCAAGBQJW9vmVAAoJEDuxQgLoOKytIn0H/18sg2g1UUABEkjqNFc4JAnf 952QWxL9cAhisuocwOWHJcTfUyGBVHaaUgRyqvie0QHDw4htm8V35W2Q14KMCJRU Yqq2I6FNR1ES7of3bniOstvG6G7xy7l0RgJZpm5zzyc0ehPtkUdJxVrlrcuhLvk0 jLOFNfiX3B45zNvKa/QjVrZyGVqYE0+JWAeqGqeZln0PoVe4mMJIkq8tDi1C5Y82 6u9DgeXsJf6A/oZufoAeNev2mwU66a8YQZNbJ+p6SxuRfogXBdylI4yV9eJQpUdD 7NsD0BVUyaop9Psofgy2qGKjU74YuP7cp8E/Kc5OdgN7NCHj6e8sYxmoZa9XVKo= =WF7B -----END PGP SIGNATURE----- --piLsmHWqEKOr5eU001MfIJKcXTgkk2FAh--