From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53340) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ajuHl-0004J6-RY for qemu-devel@nongnu.org; Sat, 26 Mar 2016 15:54:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ajuHl-0004eN-1I for qemu-devel@nongnu.org; Sat, 26 Mar 2016 15:54:13 -0400 References: <1458325289-17848-1-git-send-email-kwolf@redhat.com> <1458325289-17848-11-git-send-email-kwolf@redhat.com> From: Max Reitz Message-ID: <56F6E8DD.7010809@redhat.com> Date: Sat, 26 Mar 2016 20:54:05 +0100 MIME-Version: 1.0 In-Reply-To: <1458325289-17848-11-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9bR7V2gDAKQCraWpbW9el5PwGrDs9L1N1" Subject: Re: [Qemu-devel] [PATCH 10/20] block: Move enable_write_cache to BB level 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) --9bR7V2gDAKQCraWpbW9el5PwGrDs9L1N1 Content-Type: multipart/mixed; boundary="tBjW4Xococ2cB6KpmBBBswamdKnLxpPKo" From: Max Reitz To: Kevin Wolf , qemu-block@nongnu.org Cc: qemu-devel@nongnu.org Message-ID: <56F6E8DD.7010809@redhat.com> Subject: Re: [PATCH 10/20] block: Move enable_write_cache to BB level References: <1458325289-17848-1-git-send-email-kwolf@redhat.com> <1458325289-17848-11-git-send-email-kwolf@redhat.com> In-Reply-To: <1458325289-17848-11-git-send-email-kwolf@redhat.com> --tBjW4Xococ2cB6KpmBBBswamdKnLxpPKo Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 18.03.2016 19:21, Kevin Wolf wrote: > Whether a write cache is used or not is a decision that concerns the > user (e.g. the guest device) rather than the backend. It was already > logically part of the BB level as bdrv_move_feature_fields() always kep= t > it on top of the BDS tree; with this patch, the core of it (the actual > flag and the additional flushes) is also implemented there. >=20 > Direct callers of bdrv_open() must pass BDRV_O_CACHE_WB now if bs > doesn't have a BlockBackend attached. >=20 > Signed-off-by: Kevin Wolf > --- > block.c | 26 +++++++++++++++++--------- > block/block-backend.c | 42 +++++++++++++++++++++++++++-----------= ---- > block/io.c | 2 +- > block/iscsi.c | 2 +- > include/block/block.h | 1 + > include/block/block_int.h | 3 --- > tests/qemu-iotests/142 | 4 ++-- > tests/qemu-iotests/142.out | 8 ++++---- > 8 files changed, 53 insertions(+), 35 deletions(-) Reviewed-by: Max Reitz I'm not so sure about the state bdrv_{set_,}enable_write_cache() are in after this patch (e.g. the NBD client will always think the write cache is enabled; and bdrv_set_enable_write_cache() can be used to unset BDRV_O_CACHE_WB on BDSs), but looking at the following patches' titles, they'll clear that up. It appears to me that multiwrite will ignore the writethrough status, but then again, qemu-io seems to be the only multiwrite user. > diff --git a/block.c b/block.c > index 172f865..9271dbb 100644 > --- a/block.c > +++ b/block.c [...] > @@ -3618,8 +3626,8 @@ void bdrv_img_create(const char *filename, const = char *fmt, > } > =20 > /* backing files always opened read-only */ > - back_flags =3D > - flags & ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT | BDRV_O_NO_BA= CKING); > + back_flags =3D flags | BDRV_O_CACHE_WB; > + back_flags &=3D ~(BDRV_O_RDWR | BDRV_O_SNAPSHOT | BDRV_O_N= O_BACKING); Actually, this is the only thing the @flags parameter of this function is used for. Maybe it can be dropped since we already regulate the back_flags pretty strictly. > =20 > if (backing_fmt) { > backing_options =3D qdict_new(); --tBjW4Xococ2cB6KpmBBBswamdKnLxpPKo-- --9bR7V2gDAKQCraWpbW9el5PwGrDs9L1N1 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 iQEcBAEBCAAGBQJW9ujdAAoJEDuxQgLoOKyteXYH/jPWYNaUmJ+vA+ljRrAx8SiS 4zN/Eh9gK65pcQrOB4aMrSjma8Lx2zihwjPGOdQcvBYDLR3GSoFYUrnok2sBbX4M fdG1YhRnP2h8+gq/DW36ACEgZv2EWR7AinDBsa0EqVFAM3J4GLIiZYoCekhwVG8z JwIVf2D7Epwz08jdewLbB7u6tO7ayzpGFQpoPuJlbMjfi0aTWtU1Bbc2vNHkVx3k boilk9Y/av83DmG94anmGggX9u+1CpUhPOO2iXAik0l5MpvJLaQovg28YnsoelI3 AuBtyZmdJYZURaqUQM1maqwDis47jI0dxLjr3Sj2+foVtxxMYlQTg7sFkzleGhs= =Lm52 -----END PGP SIGNATURE----- --9bR7V2gDAKQCraWpbW9el5PwGrDs9L1N1--