aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-04-03 12:24:35 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-04-03 12:24:35 +0100
commit784a5592c9e7721d9035a83570f09a286cf75284 (patch)
treea40de13d4c39a9fd9c3a6d33bfd97668cfff3141
parent97891afab801a31dc65e265ff9210a951b952e76 (diff)
parentc97ca29db0a68deb281a901f535cec5ea4862244 (diff)
Merge remote-tracking branch 'remotes/bonzini/scsi-next' into staging
* remotes/bonzini/scsi-next: iscsi: always query max WRITE SAME length iscsi: ignore flushes on scsi-generic devices iscsi: recognize "invalid field" ASCQ from WRITE SAME command scsi-bus: remove bogus assertion Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--block/iscsi.c19
-rw-r--r--hw/scsi/scsi-bus.c1
2 files changed, 13 insertions, 7 deletions
diff --git a/block/iscsi.c b/block/iscsi.c
index b490e98c05..21c18a39dc 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -417,6 +417,10 @@ static int coroutine_fn iscsi_co_flush(BlockDriverState *bs)
IscsiLun *iscsilun = bs->opaque;
struct IscsiTask iTask;
+ if (bs->sg) {
+ return 0;
+ }
+
iscsi_co_init_iscsitask(iscsilun, &iTask);
retry:
@@ -838,7 +842,8 @@ retry:
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) {
+ (iTask.task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE ||
+ iTask.task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_FIELD_IN_CDB)) {
/* WRITE SAME is not supported by the target */
iscsilun->has_write_same = false;
scsi_free_scsi_task(iTask.task);
@@ -1330,18 +1335,20 @@ static int iscsi_refresh_limits(BlockDriverState *bs)
/* We don't actually refresh here, but just return data queried in
* iscsi_open(): iscsi targets don't change their limits. */
- if (iscsilun->lbp.lbpu || iscsilun->lbp.lbpws) {
+ if (iscsilun->lbp.lbpu) {
if (iscsilun->bl.max_unmap < 0xffffffff) {
bs->bl.max_discard = sector_lun2qemu(iscsilun->bl.max_unmap,
iscsilun);
}
bs->bl.discard_alignment = sector_lun2qemu(iscsilun->bl.opt_unmap_gran,
iscsilun);
+ }
- if (iscsilun->bl.max_ws_len < 0xffffffff) {
- bs->bl.max_write_zeroes = sector_lun2qemu(iscsilun->bl.max_ws_len,
- iscsilun);
- }
+ if (iscsilun->bl.max_ws_len < 0xffffffff) {
+ bs->bl.max_write_zeroes = sector_lun2qemu(iscsilun->bl.max_ws_len,
+ iscsilun);
+ }
+ if (iscsilun->lbp.lbpws) {
bs->bl.write_zeroes_alignment = sector_lun2qemu(iscsilun->bl.opt_unmap_gran,
iscsilun);
}
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index eaad925cbb..ae921a6a75 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -101,7 +101,6 @@ static void scsi_dma_restart_bh(void *opaque)
scsi_req_continue(req);
break;
case SCSI_XFER_NONE:
- assert(!req->sg);
scsi_req_dequeue(req);
scsi_req_enqueue(req);
break;