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.
> 
> Add a new method to distinguish this.
> 
> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
> ---
>  hw/scsi/scsi-disk.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 

> @@ -239,7 +241,7 @@ static void scsi_write_do_fua(SCSIDiskReq *r)
>          goto done;
>      }
>  
> -    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 = blk_aio_flush(s->qdev.conf.blk, scsi_aio_complete, r);
> @@ -416,7 +418,7 @@ static void scsi_read_data(SCSIRequest *req)
>  
>      first = !r->started;
>      r->started = true;
> -    if (first && scsi_is_cmd_fua(&r->req.cmd)) {
> +    if (first && r->need_fua_emulation) {

...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.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to