Patchwork [3/4] ISCSI: Only use READ16 for SBC devices. Use READ10 for other device types such as MMC

login
register
mail settings
Submitter ronniesahlberg@gmail.com
Date May 26, 2012, 4:56 a.m.
Message ID <1338008201-29078-4-git-send-email-ronniesahlberg@gmail.com>
Download mbox | patch
Permalink /patch/161448/
State New
Headers show

Comments

ronniesahlberg@gmail.com - May 26, 2012, 4:56 a.m.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
---
 block/iscsi.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

Patch

diff --git a/block/iscsi.c b/block/iscsi.c
index 2ddb9e5..a015a52 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -379,14 +379,25 @@  iscsi_aio_readv(BlockDriverState *bs, int64_t sector_num,
     memset(acb->task, 0, sizeof(struct scsi_task));
 
     acb->task->xfer_dir = SCSI_XFER_READ;
-    acb->task->cdb_size = 16;
-    acb->task->cdb[0]  = 0x88;
     lba = sector_qemu2lun(sector_num, iscsilun);
-    *(uint32_t *)&acb->task->cdb[2]  = htonl(lba >> 32);
-    *(uint32_t *)&acb->task->cdb[6]  = htonl(lba & 0xffffffff);
-    *(uint32_t *)&acb->task->cdb[10] = htonl(num_sectors);
     acb->task->expxferlen = qemu_read_size;
 
+    switch (iscsilun->type) {
+    case TYPE_DISK:
+        acb->task->cdb_size = 16;
+        acb->task->cdb[0]  = 0x88;
+        *(uint32_t *)&acb->task->cdb[2]  = htonl(lba >> 32);
+        *(uint32_t *)&acb->task->cdb[6]  = htonl(lba & 0xffffffff);
+        *(uint32_t *)&acb->task->cdb[10] = htonl(num_sectors);
+        break;
+    default:
+        acb->task->cdb_size = 10;
+        acb->task->cdb[0]  = 0x28;
+        *(uint32_t *)&acb->task->cdb[2] = htonl(lba);
+        *(uint16_t *)&acb->task->cdb[7] = htons(num_sectors);
+        break;
+    }
+    
     if (iscsi_scsi_command_async(iscsi, iscsilun->lun, acb->task,
                                  iscsi_aio_read16_cb,
                                  NULL,