On 05/13/2015 10:11 AM, Christoph Hellwig wrote:
On Wed, May 13, 2015 at 09:43:23AM -0700, Andy Grover wrote:
How far is this:
https://git.kernel.org/cgit/linux/kernel/git/grover/linux.git/commit/?h=tcmu-iomode-option7
from what you're describing? This is enumerating all actual commands we
want to send to userspace, is it not?
It goes in a different direction actually. To demonstrate what I mean
I came up with the patch below. It compiles, breaks the full passthrough
case and certainly doesn't work, so it's only intended as an explanation.
So instead of passing up anything resembling SCSI comes we passes
what comes out of the bottom of sbc_parse_cdb: reads, writes, flushes,
ignoring the discard and write_same cases for now to save me work.
This uses sbc_parse_cdb the way the other non-pscsi backends do: to
sequence down the complex SCSI protocol to a few simple building
blocks that all the backends can implement trivially. This gets
you support for BIDI commands, COMPARE AND WRITE and all that
magic for free.
+enum tcmu_operation {
+ TCMU_OP_READ,
+ TCMU_OP_WRITE,
+ TCMU_OP_FLUSH,
+};
Seeing all the code helps, thanks. Kind of close to what Shaohua's first
version of TCMU did :)
So fine, we can let full passthrough be full SCSI passthrough and do
something like this for the "just want to emulate a block device" use
case, and not keep trying to cram the latter into the former, like I've
been doing.
-- Andy
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html