scsi: target: tcm_loop: Convert to new submission API

target_submit_cmd_map_sgls() is being removed, so convert loop to
the new submission API.

Even though loop does its own shutdown sync, this has loop use
target_init_cmd()/target_submit_prep()/target_submit() since it needed to
map sgls and in the next patches it will use the API to use LIO's
workqueue.

Link: https://lore.kernel.org/r/20210227170006.5077-9-michael.christie@oracle.com
Tested-by: Laurence Oberman <loberman@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Mike Christie 2021-02-27 10:59:49 -06:00 committed by Martin K. Petersen
parent 919ba0ad7d
commit 17ae18a6ef

View File

@ -113,7 +113,6 @@ static void tcm_loop_submission_work(struct work_struct *work)
struct tcm_loop_tpg *tl_tpg; struct tcm_loop_tpg *tl_tpg;
struct scatterlist *sgl_bidi = NULL; struct scatterlist *sgl_bidi = NULL;
u32 sgl_bidi_count = 0, transfer_length; u32 sgl_bidi_count = 0, transfer_length;
int rc;
tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host); tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host);
tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id]; tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id];
@ -151,17 +150,16 @@ static void tcm_loop_submission_work(struct work_struct *work)
} }
se_cmd->tag = tl_cmd->sc_cmd_tag; se_cmd->tag = tl_cmd->sc_cmd_tag;
rc = target_submit_cmd_map_sgls(se_cmd, tl_nexus->se_sess, sc->cmnd, target_init_cmd(se_cmd, tl_nexus->se_sess, &tl_cmd->tl_sense_buf[0],
&tl_cmd->tl_sense_buf[0], tl_cmd->sc->device->lun, tl_cmd->sc->device->lun, transfer_length,
transfer_length, TCM_SIMPLE_TAG, TCM_SIMPLE_TAG, sc->sc_data_direction, 0);
sc->sc_data_direction, 0,
scsi_sglist(sc), scsi_sg_count(sc), if (target_submit_prep(se_cmd, sc->cmnd, scsi_sglist(sc),
sgl_bidi, sgl_bidi_count, scsi_sg_count(sc), sgl_bidi, sgl_bidi_count,
scsi_prot_sglist(sc), scsi_prot_sg_count(sc)); scsi_prot_sglist(sc), scsi_prot_sg_count(sc)))
if (rc < 0) { return;
set_host_byte(sc, DID_NO_CONNECT);
goto out_done; target_submit(se_cmd);
}
return; return;
out_done: out_done: