[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/48] block/iscsi: check WRITE SAME support differen
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 15/48] block/iscsi: check WRITE SAME support differently depending on MAY_UNMAP |
Date: |
Fri, 6 Dec 2013 17:36:14 +0100 |
From: Paolo Bonzini <address@hidden>
The current check is right for MAY_UNMAP=1. For MAY_UNMAP=0, just
try and fall back to regular writes as soon as a WRITE SAME command
fails.
Signed-off-by: Paolo Bonzini <address@hidden>
Reviewed-by: Peter Lieven <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/iscsi.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index 20f4f55..93fee6d 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -55,6 +55,7 @@ typedef struct IscsiLun {
QEMUTimer *nop_timer;
uint8_t lbpme;
uint8_t lbprz;
+ uint8_t has_write_same;
struct scsi_inquiry_logical_block_provisioning lbp;
struct scsi_inquiry_block_limits bl;
unsigned char *zeroblock;
@@ -976,8 +977,13 @@ coroutine_fn iscsi_co_write_zeroes(BlockDriverState *bs,
int64_t sector_num,
return -EINVAL;
}
- if (!iscsilun->lbp.lbpws) {
- /* WRITE SAME is not supported by the target */
+ if (!(flags & BDRV_REQ_MAY_UNMAP) && !iscsilun->has_write_same) {
+ /* WRITE SAME without UNMAP is not supported by the target */
+ return -ENOTSUP;
+ }
+
+ if ((flags & BDRV_REQ_MAY_UNMAP) && !iscsilun->lbp.lbpws) {
+ /* WRITE SAME with UNMAP is not supported by the target */
return -ENOTSUP;
}
@@ -1012,6 +1018,14 @@ retry:
}
if (iTask.status != SCSI_STATUS_GOOD) {
+ if (iTask.status == SCSI_STATUS_CHECK_CONDITION &&
+ iTask.task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST &&
+ iTask.task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
+ /* WRITE SAME is not supported by the target */
+ iscsilun->has_write_same = false;
+ return -ENOTSUP;
+ }
+
return -EIO;
}
@@ -1375,6 +1389,7 @@ static int iscsi_open(BlockDriverState *bs, QDict
*options, int flags,
}
iscsilun->type = inq->periperal_device_type;
+ iscsilun->has_write_same = true;
if ((ret = iscsi_readcapacity_sync(iscsilun)) != 0) {
goto out;
--
1.8.4.2
- [Qemu-devel] [PULL 03/48] vmdk: Fix creating big description file, (continued)
- [Qemu-devel] [PULL 03/48] vmdk: Fix creating big description file, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 01/48] coroutine: remove qemu_co_queue_wait_insert_head, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 05/48] block: add flags to BlockRequest, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 06/48] block: add flags argument to bdrv_co_write_zeroes tracepoint, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 07/48] block: add bdrv_aio_write_zeroes, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 08/48] block: handle ENOTSUP from discard in generic code, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 09/48] block: make bdrv_co_do_write_zeroes stricter in producing aligned requests, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 10/48] vpc, vhdx: add get_info, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 11/48] block drivers: add discard/write_zeroes properties to bdrv_get_info implementation, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 12/48] block drivers: expose requirement for write same alignment from formats, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 15/48] block/iscsi: check WRITE SAME support differently depending on MAY_UNMAP,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 13/48] block/iscsi: remove .bdrv_has_zero_init, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 14/48] block/iscsi: updated copyright, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 16/48] raw-posix: implement write_zeroes with MAY_UNMAP for files, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 17/48] raw-posix: implement write_zeroes with MAY_UNMAP for block devices, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 18/48] raw-posix: add support for write_zeroes on XFS and block devices, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 19/48] qemu-iotests: 033 is fast, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 20/48] scsi-disk: catch write protection errors in UNMAP, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 21/48] scsi-disk: reject ANCHOR=1 for UNMAP and WRITE SAME commands, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 22/48] scsi-disk: correctly implement WRITE SAME, Stefan Hajnoczi, 2013/12/06
- [Qemu-devel] [PULL 23/48] block: Close backing file early in bdrv_img_create, Stefan Hajnoczi, 2013/12/06