Skip to content

Commit 17ae18a

Browse files
mikechristiemartinkpetersen
authored andcommitted
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>
1 parent 919ba0a commit 17ae18a

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

‎drivers/target/loopback/tcm_loop.c‎

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ static void tcm_loop_submission_work(struct work_struct *work)
113113
struct tcm_loop_tpg *tl_tpg;
114114
struct scatterlist *sgl_bidi = NULL;
115115
u32 sgl_bidi_count = 0, transfer_length;
116-
int rc;
117116

118117
tl_hba = *(struct tcm_loop_hba **)shost_priv(sc->device->host);
119118
tl_tpg = &tl_hba->tl_hba_tpgs[sc->device->id];
@@ -151,17 +150,16 @@ static void tcm_loop_submission_work(struct work_struct *work)
151150
}
152151

153152
se_cmd->tag = tl_cmd->sc_cmd_tag;
154-
rc = target_submit_cmd_map_sgls(se_cmd, tl_nexus->se_sess, sc->cmnd,
155-
&tl_cmd->tl_sense_buf[0], tl_cmd->sc->device->lun,
156-
transfer_length, TCM_SIMPLE_TAG,
157-
sc->sc_data_direction, 0,
158-
scsi_sglist(sc), scsi_sg_count(sc),
159-
sgl_bidi, sgl_bidi_count,
160-
scsi_prot_sglist(sc), scsi_prot_sg_count(sc));
161-
if (rc < 0) {
162-
set_host_byte(sc, DID_NO_CONNECT);
163-
goto out_done;
164-
}
153+
target_init_cmd(se_cmd, tl_nexus->se_sess, &tl_cmd->tl_sense_buf[0],
154+
tl_cmd->sc->device->lun, transfer_length,
155+
TCM_SIMPLE_TAG, sc->sc_data_direction, 0);
156+
157+
if (target_submit_prep(se_cmd, sc->cmnd, scsi_sglist(sc),
158+
scsi_sg_count(sc), sgl_bidi, sgl_bidi_count,
159+
scsi_prot_sglist(sc), scsi_prot_sg_count(sc)))
160+
return;
161+
162+
target_submit(se_cmd);
165163
return;
166164

167165
out_done:

0 commit comments

Comments
 (0)