Skip to contentSkip to conversation

virtio_scsi LUN usage

DISCUSSION Hannes Reinecke 1 participant 1 message Jul 4, 2014 SCSI

lore
Share & tools
lore
#0 lore raw

Hi Paolo,

virtio_scsi has this:

static void virtio_scsi_init_hdr(struct virtio_scsi_cmd_req *cmd,
struct scsi_cmnd *sc)

{
	cmd->lun[0] = 1;
	cmd->lun[1] = sc->device->id;
	cmd->lun[2] = (sc->device->lun >> 8) | 0x40;
	cmd->lun[3] = sc->device->lun & 0xff;
	cmd->tag = (unsigned long)sc;
	cmd->task_attr = VIRTIO_SCSI_S_SIMPLE;
	cmd->prio = 0;
	cmd->crn = 0;
}

As you might've seen I'm currently working on updating the SCSI stack to use 64-bit LUNs.
So while virtio scsi is in principle capable of using 64-bit LUNs, this peculiar usage makes it impossible to actually _use_ 64-bit LUNs. Can't we get rid of this encoding and let the backend provide is with correct numbers?

It should work if we were just to implement a REPORT_LUN intercept, which sets the correct top two bytes in the command ... with that we should be getting only the LUNs for a particular target, and could then just use the provided LUN numbers as-is.

Long term I would prefer to have another 'target' field (preferably also 64bit wide), which could be used to specify the target directly. But that would require a spec change and feature flags yadda yadda...

Cheers,

Hannes

Signature · 8 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html