tcm: Move transport_emulate_control_cdb() into __transport_execute_tasks()
Subsystems (2)
PATCH 1/5 tcm: Move transport_emulate_control_cdb() into __transport_execute_tasks()
From: Nicholas Bellinger <[email protected]>
This patch moves control path CDB emulation transport_emulate_control_cdb() calls from IBLOCK, FILEIO and RAMDISK spa->do_task() into a generic location in __transport_execute_tasks(). This code is called by all non TCM/pSCSI backstores to handle internal SCF_SCSI_DATA_SG_IO_CDB emulation.
Signed-off-by Nicholas A. Bellinger <[email protected]>
Reported-by Christoph Hellwig <[email protected]>
--- drivers/target/target_core_file.c | 3 --- drivers/target/target_core_iblock.c | 3 --- drivers/target/target_core_rd.c | 3 --- drivers/target/target_core_transport.c | 17 ++++++++++++++++- 4 files changed, 16 insertions(+), 10 deletions(-)
drivers/target/target_core_file.c +0 -3
@@ -783,9 +783,6 @@ static int fd_do_task(struct se_task *task)struct fd_request *req = task->transport_req;int ret =0 ; -if (!(TASK_CMD (task)->se_cmd_flags &SCF_SCSI_DATA_SG_IO_CDB )) -return transport_emulate_control_cdb (task); - req->fd_lba = task->task_lba; req->fd_size = task->task_size;/*
drivers/target/target_core_iblock.c +0 -3
@@ -584,9 +584,6 @@ static int iblock_do_task(struct se_task *task)int write = (TASK_CMD (task)->data_direction ==DMA_TO_DEVICE );int ret; -if (!(TASK_CMD (task)->se_cmd_flags &SCF_SCSI_DATA_SG_IO_CDB )) -return transport_emulate_control_cdb (task); -while (bio) { nbio = bio->bi_next; bio->bi_next =NULL ;
drivers/target/target_core_rd.c +0 -3
@@ -710,9 +710,6 @@ static int rd_MEMCPY_do_task(struct se_task *task)struct rd_request *req = task->transport_req;int ret; -if (!(TASK_CMD (task)->se_cmd_flags &SCF_SCSI_DATA_SG_IO_CDB )) -return transport_emulate_control_cdb (task); - req->rd_lba = task->task_lba; req->rd_page = (req->rd_lba *DEV_ATTRIB (dev)->block_size) /PAGE_SIZE ; req->rd_offset = (do_div(req->rd_lba,
drivers/target/target_core_transport.c +16 -1
@@ -4253,7 +4253,22 @@ check_depth:transport_complete_task (task,1 ); } }else { - error =TRANSPORT (dev)->do_task (task); +/* +* Currently for all virtual TCM plugins including IBLOCK, FILEIO and +* RAMDISK we use the internal transport_emulate_control_cdb() logic +* with struct se_subsystem_api callers for the primary SPC-3 TYPE_DISK +* LUN emulation code. +* +* For TCM/pSCSI and all other SCF_SCSI_DATA_SG_IO_CDB I/O tasks we +* call ->do_task() directly and let the underlying TCM subsystem plugin +* code handle the CDB emulation. +*/ +if ((TRANSPORT (dev)->transport_type !=TRANSPORT_PLUGIN_PHBA_PDEV ) && + (!(TASK_CMD (task)->se_cmd_flags &SCF_SCSI_DATA_SG_IO_CDB ))) + error =transport_emulate_control_cdb (task); +else + error =TRANSPORT (dev)->do_task (task); +if (error !=0 ) { cmd->transport_error_status = error;atomic_set (&task->task_active,0 );
Signature · 1 line
1.5.6.5