Re: [PATCH 0/4] tcm: Unify virtual subsystem plugin emulation code

From: Christoph Hellwig
Date: Sun Oct 10 2010 - 03:32:32 EST


What you did in this patch is a good step toward getting rid of the
scsi logic in the backend, but it's quite enough yet. For one thing
the backends really shouldn't know anything about scsi commands, so
the call to transport_emulate_control_cdb should happen before even
calling into the backend. Second your ->emulate_foo callbacks still
are far too SCSI-specific, e.g. WRITE SAME witht unmap bit and UNMAP
emulation really should just go into a single ->discard callback
for the backend. And instead of calling into the backend again for
readcap emulation just set block_size and size attributs on a per-
device object and let common code handle it. Similarly for inquity
just set the device type and other variables and handle it in common
code. That avoid the special se_subsystem_api_cdb vector and simplifies
the code a lot conceptually a lot. Together with calling
transport_emulate_control_cdb directly from core code before going
into ->do_task that does all the required work to make the backends
independent of the scsi protocol, so we could also use it e.g.
for ATA or virtio targets.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/