[Stgt-devel] supporting non-block devices
Fri Jan 19 18:01:42 CET 2007
We've been using the fine stgt code as the target for our OSD-2
emulator. OSDs are devices that store objects rather than blocks,
and they have a quite different SCSI command set, and do not support
all the block commands in SBC3, e.g.: there is no READ_10 command
or its friends. See http://www.t10.org/drafts.htm#osd2 for the
Do you have any interest in supporting non-block devices in stgt?
The way we hack in OSD support now is unattractive. To do it nicely
would require changing the abstractions a bit.
In particular, we want the iscsi transport, but do not want the
aio_bdt. So I define a new tgt_driver that uses most of the iscsi
functions, but points to a new osd_bdt, and redefines scsi_inquiry.
(This is all userspace, no kernel tgt code.)
In scsi_cmd_perform, most of the scb types are supported by OSDs
so we would like to use that code. But not READ* and WRITE*. And
all the new OSD commands come via a VARLEN_CMD (0x7f) for which I've
added a new varlen_submit() function in the osd_bdt that does the
command parsing and actual execution. Kludgy since this should not
be part of the bdt.
Some ideas, if interested. You could use a table to lookup scb
to find a handler function, then let devices fill or override table
entries. Or call a device's scsi_cmd_perform first to see if it
wants to deal with the scb itself or let the generic handler do it.
More information about the stgt