From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55314) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2lQE-0007n7-C4 for qemu-devel@nongnu.org; Fri, 26 Jul 2013 13:03:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2lQD-0003f2-4w for qemu-devel@nongnu.org; Fri, 26 Jul 2013 13:03:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32637) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2lQC-0003ev-T7 for qemu-devel@nongnu.org; Fri, 26 Jul 2013 13:03:17 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6QGUSkA003197 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 26 Jul 2013 12:30:28 -0400 Message-ID: <51F2A420.2020903@redhat.com> Date: Fri, 26 Jul 2013 10:30:24 -0600 From: Eric Blake MIME-Version: 1.0 References: <1374584606-5615-1-git-send-email-kwolf@redhat.com> <1374584606-5615-17-git-send-email-kwolf@redhat.com> In-Reply-To: <1374584606-5615-17-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cPj1H4tcbau1H3Afd79fORED4Ag05HFw1" Subject: Re: [Qemu-devel] [PATCH 16/18] blockdev: Split up 'cache' option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: armbru@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --cPj1H4tcbau1H3Afd79fORED4Ag05HFw1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/23/2013 07:03 AM, Kevin Wolf wrote: > The old 'cache' option really encodes three different boolean flags int= o > a cache mode name, without providing all combinations. Make them three > separate options instead and translate the old option to the new ones > for drive_init(). >=20 > The specific boolean options take precedence if the old cache option is= > specified as well, so the following options are equivalent: >=20 > -drive file=3Dx,cache=3Dnone,cache.no-flush=3Dtrue > -drive file=3Dx,cache.writeback=3Dtrue,cache.direct=3Dtrue,cache.no-flu= sh=3Dtrue >=20 > Signed-off-by: Kevin Wolf > --- > blockdev.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++-------= --- > 1 file changed, 47 insertions(+), 10 deletions(-) >=20 > +++ b/blockdev.c > @@ -452,12 +452,15 @@ static DriveInfo *blockdev_init(QemuOpts *all_opt= s, > } > } > =20 > - bdrv_flags |=3D BDRV_O_CACHE_WB; > - if ((buf =3D qemu_opt_get(opts, "cache")) !=3D NULL) { > - if (bdrv_parse_cache_flags(buf, &bdrv_flags) !=3D 0) { The old code calls bdrv_parse_cache_flags() with non-zero bdrv_flags. > @@ -751,6 +756,31 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInt= erfaceType block_default_type) > =20 > qemu_opt_rename(all_opts, "readonly", "read-only"); > =20 > + value =3D qemu_opt_get(all_opts, "cache"); > + if (value) { > + int flags =3D 0; > + > + if (bdrv_parse_cache_flags(value, &flags) !=3D 0) { The new code calls it with flags starting at 0. But looking at bdrv_parse_cache_flags(), the first thing that code did was zero out BDRV_O_CACHE_MASK, which includes BDRV_O_CACHE_WB, so I think that in reality you still end up with the same bits set at the end of that parse call. Phew - that means you are actually getting rid of a dead |=3D assignment. [And you proved that the block code is a twisty maze of back-compat hacks.] Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --cPj1H4tcbau1H3Afd79fORED4Ag05HFw1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJR8qQgAAoJEKeha0olJ0NqTMoH/1HDirewt8mskmYPfq6tFKN0 NkZ3W0o8wyLvxyuVhgrxWxSfHDnrGSIiPpjSBNkSKB4s5OMEslnRx5/pgBUzWz/J epzd4dxKsf8TUPeIOlIl6tCPLSNmjNIM5Wi0+oj9v1lpHXXoh1nPZSfO1xd/ohHY YAHPNzy+QGYuXIGqn90HL+dF7RmLxD7HVfScWp43+MAmLYA6rAxtFvLAsWNuGh5R HlNsDQuOiUGi5juptrGhVivTVnSbixNQpt6059lDN0e17jGzuV1EvC+7CovnTGUq Ie6zC5Jj9pZGOTscDp6iZi+Edb54Z4kAgabAYGGQWt2+IBaDO0PGC24+mN69zXA= =yG8R -----END PGP SIGNATURE----- --cPj1H4tcbau1H3Afd79fORED4Ag05HFw1--