From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4soj-0004Gk-Ba for qemu-devel@nongnu.org; Mon, 23 May 2016 12:34:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b4soh-00027n-8P for qemu-devel@nongnu.org; Mon, 23 May 2016 12:34:56 -0400 References: <1464008051-6429-1-git-send-email-pbonzini@redhat.com> <1464008051-6429-6-git-send-email-pbonzini@redhat.com> From: Eric Blake Message-ID: <57433127.9040403@redhat.com> Date: Mon, 23 May 2016 10:34:47 -0600 MIME-Version: 1.0 In-Reply-To: <1464008051-6429-6-git-send-email-pbonzini@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8vk7FQ1l8lPrpXkUJsSomO16T8P23xntp" Subject: Re: [Qemu-devel] [PATCH 5/7] scsi-disk: add need_fua_emulation to SCSIDiskClass List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --8vk7FQ1l8lPrpXkUJsSomO16T8P23xntp Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/23/2016 06:54 AM, Paolo Bonzini wrote: > scsi-block will be able to do FUA just by passing the request through > to the LUN (which is also more efficient); there is no need to emulate > it like we do for scsi-disk. >=20 > Add a new method to distinguish this. >=20 > Signed-off-by: Paolo Bonzini > --- > hw/scsi/scsi-disk.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) >=20 > @@ -239,7 +241,7 @@ static void scsi_write_do_fua(SCSIDiskReq *r) > goto done; > } > =20 > - if (scsi_is_cmd_fua(&r->req.cmd)) { > + if (r->need_fua_emulation) { BDRV_REQ_FUA is defined for writes,... > block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct, 0,= > BLOCK_ACCT_FLUSH); > r->req.aiocb =3D blk_aio_flush(s->qdev.conf.blk, scsi_aio_comp= lete, r); > @@ -416,7 +418,7 @@ static void scsi_read_data(SCSIRequest *req) > =20 > first =3D !r->started; > r->started =3D true; > - if (first && scsi_is_cmd_fua(&r->req.cmd)) { > + if (first && r->need_fua_emulation) { =2E..but while FUA semantics are definitely defined in SCSI for reads, I don't know if we've properly wired them up in our block layer for that purpose. In particular, while bdrv_driver_pwritev() definitely has a flush fallback if .supported_write_flags lacks BDRV_REQ_FUA, bdrv_driver_preadv() does not currently look at flags. The idea makes sense, but I don't know if it is incomplete without first making sure FUA works on reads throughout the block layer. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --8vk7FQ1l8lPrpXkUJsSomO16T8P23xntp 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXQzEnAAoJEKeha0olJ0NqtM8IAKXqWvnwGYyCoOlL7rPoaNeL xdgEkXDeOz0hBp+i38bwL/QzATrHfBlY2IOFGP0s6Z1TC3pkP472o0GFygOzPhdk 3ydnHVCYXvLiYr5mmbEz/ytbMYRveRuznoqTWvMHeGFTMNTq+uNc/yn3PMJJ3/JV cvdy4dU8wFvi7BfsRkn84W7AuWIC8FQNvZKSOdEZe/I110H5GtSUjN4Xln/kIUi2 +ptMKCPp8FFYIsfWl9uVG3rQQc0m1Jqz3aOOkci9TS2aqhbgARtXX2eDiWdqKhnU BuyMtZErhV7pqvtiEguw9bqkYdvKfO+3uR9ykCv/Nfas0k+A3Ao3AIWwrEsLrUQ= =WbiW -----END PGP SIGNATURE----- --8vk7FQ1l8lPrpXkUJsSomO16T8P23xntp--