qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/4] ISCSI: Only use READ16 for SBC devices. Use REA


From: Ronnie Sahlberg
Subject: [Qemu-devel] [PATCH 3/4] ISCSI: Only use READ16 for SBC devices. Use READ10 for other device types such as MMC
Date: Sat, 26 May 2012 14:56:40 +1000

Signed-off-by: Ronnie Sahlberg <address@hidden>
---
 block/iscsi.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

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,
-- 
1.7.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]