[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/4] ISCSI: Use READCAPACITY10 for MMC devices
From: |
Ronnie Sahlberg |
Subject: |
[Qemu-devel] [PATCH 2/4] ISCSI: Use READCAPACITY10 for MMC devices |
Date: |
Sat, 26 May 2012 14:56:39 +1000 |
Signed-off-by: Ronnie Sahlberg <address@hidden>
---
block/iscsi.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index 39d75cb..2ddb9e5 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -700,6 +700,42 @@ iscsi_readcapacity16_cb(struct iscsi_context *iscsi, int
status,
}
static void
+iscsi_readcapacity10_cb(struct iscsi_context *iscsi, int status,
+ void *command_data, void *opaque)
+{
+ struct IscsiTask *itask = opaque;
+ struct scsi_readcapacity10 *rc10;
+ struct scsi_task *task = command_data;
+
+ if (status != 0) {
+ error_report("iSCSI: Failed to read capacity of iSCSI lun. %s",
+ iscsi_get_error(iscsi));
+ itask->status = 1;
+ itask->complete = 1;
+ scsi_free_scsi_task(task);
+ return;
+ }
+
+ rc10 = scsi_datain_unmarshall(task);
+ if (rc10 == NULL) {
+ error_report("iSCSI: Failed to unmarshall readcapacity10 data.");
+ itask->status = 1;
+ itask->complete = 1;
+ scsi_free_scsi_task(task);
+ return;
+ }
+
+ itask->iscsilun->block_size = rc10->block_size;
+ itask->iscsilun->num_blocks = rc10->lba + 1;
+ itask->bs->total_sectors = itask->iscsilun->num_blocks *
+ itask->iscsilun->block_size / BDRV_SECTOR_SIZE ;
+
+ itask->status = 0;
+ itask->complete = 1;
+ scsi_free_scsi_task(task);
+}
+
+static void
iscsi_inquiry_cb(struct iscsi_context *iscsi, int status, void *command_data,
void *opaque)
{
@@ -738,6 +774,17 @@ iscsi_inquiry_cb(struct iscsi_context *iscsi, int status,
void *command_data,
return;
}
break;
+ case TYPE_ROM:
+ task = iscsi_readcapacity10_task(iscsi, itask->iscsilun->lun,
+ 0, 0,
+ iscsi_readcapacity10_cb, opaque);
+ if (task == NULL) {
+ error_report("iSCSI: failed to send readcapacity16 command.");
+ itask->status = 1;
+ itask->complete = 1;
+ return;
+ }
+ break;
default:
itask->status = 0;
itask->complete = 1;
--
1.7.3.1
- [Qemu-devel] [PATCH 0/4] ISCSI: Passthough updates, Ronnie Sahlberg, 2012/05/26
- [Qemu-devel] [PATCH 1/4] ISCSI: Only call READCAPACITY16 for SBC devices, Ronnie Sahlberg, 2012/05/26
- [Qemu-devel] [PATCH 2/4] ISCSI: Use READCAPACITY10 for MMC devices,
Ronnie Sahlberg <=
- [Qemu-devel] [PATCH 3/4] ISCSI: Only use READ16 for SBC devices. Use READ10 for other device types such as MMC, Ronnie Sahlberg, 2012/05/26
- [Qemu-devel] [PATCH 4/4] ISCSI: If the device we open is a SMC device, then force the use of sg. We dont have any medium changer emulation so only passthrough via real sg or scsi-generic via iscsi would work anyway., Ronnie Sahlberg, 2012/05/26
- Re: [Qemu-devel] [PATCH 4/4] ISCSI: If the device we open is a SMC device, then force the use of sg. We dont have any medium changer emulation so only passthrough via real sg or scsi-generic via iscsi would work anyway., Paolo Bonzini, 2012/05/26
- Re: [Qemu-devel] [PATCH 4/4] ISCSI: If the device we open is a SMC device, then force the use of sg. We dont have any medium changer emulation so only passthrough via real sg or scsi-generic via iscsi would work anyway., Andreas Färber, 2012/05/27
- Re: [Qemu-devel] [PATCH 4/4] ISCSI: If the device we open is a SMC device, then force the use of sg. We dont have any medium changer emulation so only passthrough via real sg or scsi-generic via iscsi would work anyway., Paolo Bonzini, 2012/05/28
- Re: [Qemu-devel] [PATCH 4/4] ISCSI: If the device we open is a SMC device, then force the use of sg. We dont have any medium changer emulation so only passthrough via real sg or scsi-generic via iscsi would work anyway., ronnie sahlberg, 2012/05/28
- Re: [Qemu-devel] [PATCH 4/4] ISCSI: If the device we open is a SMC device, then force the use of sg. We dont have any medium changer emulation so only passthrough via real sg or scsi-generic via iscsi would work anyway., Paolo Bonzini, 2012/05/28
Re: [Qemu-devel] [PATCH 0/4] ISCSI: Passthough updates, Paolo Bonzini, 2012/05/26