scsi: scsi_dh: Convert to scsi_execute_cmd()
authorMike Christie <michael.christie@oracle.com>
Thu, 29 Dec 2022 19:01:44 +0000 (13:01 -0600)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 14 Jan 2023 02:34:08 +0000 (21:34 -0500)
scsi_execute() is going to be removed. Convert the scsi_dh users to
scsi_execute_cmd().

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/device_handler/scsi_dh_alua.c
drivers/scsi/device_handler/scsi_dh_emc.c
drivers/scsi/device_handler/scsi_dh_hp_sw.c
drivers/scsi/device_handler/scsi_dh_rdac.c

index 49cc18a8747313e5729fccb02f55c292d58c52bc..55a5073248f84d2969235b0e8c9f0882927157a0 100644 (file)
@@ -127,8 +127,11 @@ static int submit_rtpg(struct scsi_device *sdev, unsigned char *buff,
                       int bufflen, struct scsi_sense_hdr *sshdr, int flags)
 {
        u8 cdb[MAX_COMMAND_SIZE];
-       blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |
-               REQ_FAILFAST_DRIVER;
+       blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV |
+                               REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER;
+       const struct scsi_exec_args exec_args = {
+               .sshdr = sshdr,
+       };
 
        /* Prepare the command. */
        memset(cdb, 0x0, MAX_COMMAND_SIZE);
@@ -139,9 +142,9 @@ static int submit_rtpg(struct scsi_device *sdev, unsigned char *buff,
                cdb[1] = MI_REPORT_TARGET_PGS;
        put_unaligned_be32(bufflen, &cdb[6]);
 
-       return scsi_execute(sdev, cdb, DMA_FROM_DEVICE, buff, bufflen, NULL,
-                       sshdr, ALUA_FAILOVER_TIMEOUT * HZ,
-                       ALUA_FAILOVER_RETRIES, req_flags, 0, NULL);
+       return scsi_execute_cmd(sdev, cdb, opf, buff, bufflen,
+                               ALUA_FAILOVER_TIMEOUT * HZ,
+                               ALUA_FAILOVER_RETRIES, &exec_args);
 }
 
 /*
@@ -157,8 +160,11 @@ static int submit_stpg(struct scsi_device *sdev, int group_id,
        u8 cdb[MAX_COMMAND_SIZE];
        unsigned char stpg_data[8];
        int stpg_len = 8;
-       blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |
-               REQ_FAILFAST_DRIVER;
+       blk_opf_t opf = REQ_OP_DRV_OUT | REQ_FAILFAST_DEV |
+                               REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER;
+       const struct scsi_exec_args exec_args = {
+               .sshdr = sshdr,
+       };
 
        /* Prepare the data buffer */
        memset(stpg_data, 0, stpg_len);
@@ -171,9 +177,9 @@ static int submit_stpg(struct scsi_device *sdev, int group_id,
        cdb[1] = MO_SET_TARGET_PGS;
        put_unaligned_be32(stpg_len, &cdb[6]);
 
-       return scsi_execute(sdev, cdb, DMA_TO_DEVICE, stpg_data, stpg_len, NULL,
-                       sshdr, ALUA_FAILOVER_TIMEOUT * HZ,
-                       ALUA_FAILOVER_RETRIES, req_flags, 0, NULL);
+       return scsi_execute_cmd(sdev, cdb, opf, stpg_data,
+                               stpg_len, ALUA_FAILOVER_TIMEOUT * HZ,
+                               ALUA_FAILOVER_RETRIES, &exec_args);
 }
 
 static struct alua_port_group *alua_find_get_pg(char *id_str, size_t id_size,
index 2e21ab447873c1646253b1b42c54d067a85af2a3..3cf88db2d5b287c0ada6b0cbaefc81d23add85cf 100644 (file)
@@ -239,8 +239,11 @@ static int send_trespass_cmd(struct scsi_device *sdev,
        unsigned char cdb[MAX_COMMAND_SIZE];
        int err, res = SCSI_DH_OK, len;
        struct scsi_sense_hdr sshdr;
-       blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |
-               REQ_FAILFAST_DRIVER;
+       blk_opf_t opf = REQ_OP_DRV_OUT | REQ_FAILFAST_DEV |
+                               REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER;
+       const struct scsi_exec_args exec_args = {
+               .sshdr = &sshdr,
+       };
 
        if (csdev->flags & CLARIION_SHORT_TRESPASS) {
                page22 = short_trespass;
@@ -263,9 +266,9 @@ static int send_trespass_cmd(struct scsi_device *sdev,
        BUG_ON((len > CLARIION_BUFFER_SIZE));
        memcpy(csdev->buffer, page22, len);
 
-       err = scsi_execute(sdev, cdb, DMA_TO_DEVICE, csdev->buffer, len, NULL,
-                       &sshdr, CLARIION_TIMEOUT * HZ, CLARIION_RETRIES,
-                       req_flags, 0, NULL);
+       err = scsi_execute_cmd(sdev, cdb, opf, csdev->buffer, len,
+                              CLARIION_TIMEOUT * HZ, CLARIION_RETRIES,
+                              &exec_args);
        if (err) {
                if (scsi_sense_valid(&sshdr))
                        res = trespass_endio(sdev, &sshdr);
index 0d2cfa60aa063ab161a53ca70b4449d8fc5ad952..5f2f943d926ccf2b8af2f28267a2ef86f930c153 100644 (file)
@@ -83,12 +83,15 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h)
        unsigned char cmd[6] = { TEST_UNIT_READY };
        struct scsi_sense_hdr sshdr;
        int ret = SCSI_DH_OK, res;
-       blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |
-               REQ_FAILFAST_DRIVER;
+       blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV |
+                               REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER;
+       const struct scsi_exec_args exec_args = {
+               .sshdr = &sshdr,
+       };
 
 retry:
-       res = scsi_execute(sdev, cmd, DMA_NONE, NULL, 0, NULL, &sshdr,
-                       HP_SW_TIMEOUT, HP_SW_RETRIES, req_flags, 0, NULL);
+       res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT,
+                              HP_SW_RETRIES, &exec_args);
        if (res) {
                if (scsi_sense_valid(&sshdr))
                        ret = tur_done(sdev, h, &sshdr);
@@ -121,12 +124,15 @@ static int hp_sw_start_stop(struct hp_sw_dh_data *h)
        struct scsi_device *sdev = h->sdev;
        int res, rc = SCSI_DH_OK;
        int retry_cnt = HP_SW_RETRIES;
-       blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |
-               REQ_FAILFAST_DRIVER;
+       blk_opf_t opf = REQ_OP_DRV_IN | REQ_FAILFAST_DEV |
+                               REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER;
+       const struct scsi_exec_args exec_args = {
+               .sshdr = &sshdr,
+       };
 
 retry:
-       res = scsi_execute(sdev, cmd, DMA_NONE, NULL, 0, NULL, &sshdr,
-                       HP_SW_TIMEOUT, HP_SW_RETRIES, req_flags, 0, NULL);
+       res = scsi_execute_cmd(sdev, cmd, opf, NULL, 0, HP_SW_TIMEOUT,
+                              HP_SW_RETRIES, &exec_args);
        if (res) {
                if (!scsi_sense_valid(&sshdr)) {
                        sdev_printk(KERN_WARNING, sdev,
index bf8754741f85a4dcee6abe5f23e49eb8099ce899..c5538645057a6883cef0cff5c7de451007370c2e 100644 (file)
@@ -536,8 +536,11 @@ static void send_mode_select(struct work_struct *work)
        unsigned char cdb[MAX_COMMAND_SIZE];
        struct scsi_sense_hdr sshdr;
        unsigned int data_size;
-       blk_opf_t req_flags = REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT |
-               REQ_FAILFAST_DRIVER;
+       blk_opf_t opf = REQ_OP_DRV_OUT | REQ_FAILFAST_DEV |
+                               REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER;
+       const struct scsi_exec_args exec_args = {
+               .sshdr = &sshdr,
+       };
 
        spin_lock(&ctlr->ms_lock);
        list_splice_init(&ctlr->ms_head, &list);
@@ -555,9 +558,8 @@ static void send_mode_select(struct work_struct *work)
                (char *) h->ctlr->array_name, h->ctlr->index,
                (retry_cnt == RDAC_RETRY_COUNT) ? "queueing" : "retrying");
 
-       if (scsi_execute(sdev, cdb, DMA_TO_DEVICE, &h->ctlr->mode_select,
-                       data_size, NULL, &sshdr, RDAC_TIMEOUT * HZ,
-                       RDAC_RETRIES, req_flags, 0, NULL)) {
+       if (scsi_execute_cmd(sdev, cdb, opf, &h->ctlr->mode_select, data_size,
+                            RDAC_TIMEOUT * HZ, RDAC_RETRIES, &exec_args)) {
                err = mode_select_handle_sense(sdev, &sshdr);
                if (err == SCSI_DH_RETRY && retry_cnt--)
                        goto retry;