Skip to contentSkip to conversation

SCSI changes for QEMU 2.0

GIT PULL Applied Paolo Bonzini 2 participants 6 messages Apr 3, 2014 Block layer

lore
Share & tools
lore
#0 lore raw

The following changes since commit 63678e17cf399ff81b93417fe7bee8d6ef6b6b1b:

configure: add option to disable -fstack-protector flags (2014-03-31 20:16:02 +0100)

are available in the git repository at:

git://github.com/bonzini/qemu.git scsi-next

for you to fetch changes up to c97ca29db0a68deb281a901f535cec5ea4862244:

iscsi: always query max WRITE SAME length (2014-04-03 13:10:53 +0200)

----------------------------------------------------------------
Paolo Bonzini (4):
scsi-bus: remove bogus assertion
iscsi: recognize "invalid field" ASCQ from WRITE SAME command
iscsi: ignore flushes on scsi-generic devices
iscsi: always query max WRITE SAME length

 block/iscsi.c      | 19 +++++++++++++------
 hw/scsi/scsi-bus.c |  1 -
 2 files changed, 13 insertions(+), 7 deletions(-)
Signature · 1 line
1.9.0
#1 lore raw

[Qemu-devel] [PULL 2/4] iscsi: recognize "invalid field" ASCQ from WRITE SAME command

Some targets may return "invalid field" as the ASCQ from WRITE SAME if they support the command only without the UNMAP field. Recognize that, and return ENOTSUP just like for "invalid operation code".

---
 block/iscsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block/iscsi.c +2 -1
index b490e98..2f96a8e 100644
@@ -838,7 +838,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);
Signature · 1 line
1.9.0
#2 lore raw

[Qemu-devel] [PULL 3/4] iscsi: ignore flushes on scsi-generic devices

In reply to Paolo Bonzini

Non-block SCSI devices do not support flushing, but we may still send them requests via bdrv_flush_all. Just ignore them.

---
 block/iscsi.c | 4 ++++
 1 file changed, 4 insertions(+)
block/iscsi.c +4 -0
index 2f96a8e..e68aa0f 100644
@@ -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:
Signature · 1 line
1.9.0
#3 lore raw

[Qemu-devel] [PULL 4/4] iscsi: always query max WRITE SAME length

In reply to Paolo Bonzini

Max WRITE SAME length is also used when the UNMAP bit is zero, so it should be queried even if LBPWS=0. Same for the optimal transfer length.

However, the write_zeroes_alignment only matters for UNMAP=1 so we still restrict it to LBPWS=1.

---
 block/iscsi.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
block/iscsi.c +7 -5
index e68aa0f..21c18a3 100644
@@ -1335,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);
     }
Signature · 1 line
1.9.0
#4 lore raw

[Qemu-devel] [PULL 1/4] scsi-bus: remove bogus assertion

In reply to Paolo Bonzini

This assertion is invalid, because get_sg_list can return an empty sg-list even for commands that transfer no data (such as SYNCHRONIZE CACHE).

---
 hw/scsi/scsi-bus.c | 1 -
 1 file changed, 1 deletion(-)
hw/scsi/scsi-bus.c +0 -1
index eaad925..ae921a6 100644
@@ -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;
Signature · 1 line
1.9.0
#5 lore raw
In reply to Paolo Bonzini
Quoted 19 lines · Paolo Bonzini

The following changes since commit 63678e17cf399ff81b93417fe7bee8d6ef6b6b1b:

configure: add option to disable -fstack-protector flags (2014-03-31 20:16:02 +0100)

are available in the git repository at:

git://github.com/bonzini/qemu.git scsi-next

for you to fetch changes up to c97ca29db0a68deb281a901f535cec5ea4862244:

iscsi: always query max WRITE SAME length (2014-04-03 13:10:53 +0200)

----------------------------------------------------------------
Paolo Bonzini (4):
scsi-bus: remove bogus assertion
iscsi: recognize "invalid field" ASCQ from WRITE SAME command
iscsi: ignore flushes on scsi-generic devices
iscsi: always query max WRITE SAME length

Quoted 3 lines
 block/iscsi.c      | 19 +++++++++++++------
 hw/scsi/scsi-bus.c |  1 -
 2 files changed, 13 insertions(+), 7 deletions(-)

Applied, thanks.

-- PMM