[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH 5/7] scsi-disk: add need_fua_emulat
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH 5/7] scsi-disk: add need_fua_emulation to SCSIDiskClass |
Date: |
Mon, 23 May 2016 10:34:47 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
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 <address@hidden>
> ---
> 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
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH v2 0/7] dma-helpers, scsi-block: use SG_IO for all I/O on scsi-block, Paolo Bonzini, 2016/05/23
- [Qemu-block] [PATCH 2/7] dma-helpers: change BlockBackend to opaque value in DMAIOFunc, Paolo Bonzini, 2016/05/23
- [Qemu-block] [PATCH 5/7] scsi-disk: add need_fua_emulation to SCSIDiskClass, Paolo Bonzini, 2016/05/23
- [Qemu-block] [PATCH 1/7] dma-helpers: change interface to byte-based, Paolo Bonzini, 2016/05/23
- [Qemu-block] [PATCH 3/7] scsi-disk: introduce a common base class, Paolo Bonzini, 2016/05/23
- [Qemu-block] [PATCH 4/7] scsi-disk: introduce dma_readv and dma_writev, Paolo Bonzini, 2016/05/23
- [Qemu-block] [PATCH 6/7] scsi-disk: introduce scsi_disk_req_check_error, Paolo Bonzini, 2016/05/23