OSDN Git Service

scsi: ata: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
authorBart Van Assche <bvanassche@acm.org>
Mon, 9 Aug 2021 23:03:10 +0000 (16:03 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 12 Aug 2021 02:25:37 +0000 (22:25 -0400)
Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Link: https://lore.kernel.org/r/20210809230355.8186-8-bvanassche@acm.org
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ata/libata-eh.c
drivers/ata/libata-scsi.c
drivers/ata/pata_falcon.c

index bb36377..bf9c4b6 100644 (file)
@@ -912,7 +912,7 @@ void ata_qc_schedule_eh(struct ata_queued_cmd *qc)
         * Note that ATA_QCFLAG_FAILED is unconditionally set after
         * this function completes.
         */
-       blk_abort_request(qc->scsicmd->request);
+       blk_abort_request(scsi_cmd_to_rq(qc->scsicmd));
 }
 
 /**
@@ -1893,8 +1893,7 @@ static inline int ata_eh_worth_retry(struct ata_queued_cmd *qc)
  */
 static inline bool ata_eh_quiet(struct ata_queued_cmd *qc)
 {
-       if (qc->scsicmd &&
-           qc->scsicmd->request->rq_flags & RQF_QUIET)
+       if (qc->scsicmd && scsi_cmd_to_rq(qc->scsicmd)->rq_flags & RQF_QUIET)
                qc->flags |= ATA_QCFLAG_QUIET;
        return qc->flags & ATA_QCFLAG_QUIET;
 }
index b9588c5..f7f6304 100644 (file)
@@ -631,7 +631,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
 {
        struct ata_queued_cmd *qc;
 
-       qc = ata_qc_new_init(dev, cmd->request->tag);
+       qc = ata_qc_new_init(dev, scsi_cmd_to_rq(cmd)->tag);
        if (qc) {
                qc->scsicmd = cmd;
                qc->scsidone = cmd->scsi_done;
@@ -639,7 +639,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
                qc->sg = scsi_sglist(cmd);
                qc->n_elem = scsi_sg_count(cmd);
 
-               if (cmd->request->rq_flags & RQF_QUIET)
+               if (scsi_cmd_to_rq(cmd)->rq_flags & RQF_QUIET)
                        qc->flags |= ATA_QCFLAG_QUIET;
        } else {
                cmd->result = (DID_OK << 16) | SAM_STAT_TASK_SET_FULL;
@@ -1496,7 +1496,7 @@ nothing_to_do:
 
 static bool ata_check_nblocks(struct scsi_cmnd *scmd, u32 n_blocks)
 {
-       struct request *rq = scmd->request;
+       struct request *rq = scsi_cmd_to_rq(scmd);
        u32 req_blocks;
 
        if (!blk_rq_is_passthrough(rq))
@@ -1531,7 +1531,7 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc)
 {
        struct scsi_cmnd *scmd = qc->scsicmd;
        const u8 *cdb = scmd->cmnd;
-       struct request *rq = scmd->request;
+       struct request *rq = scsi_cmd_to_rq(scmd);
        int class = IOPRIO_PRIO_CLASS(req_get_ioprio(rq));
        unsigned int tf_flags = 0;
        u64 block;
@@ -3181,7 +3181,7 @@ static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc)
         * as it modifies the DATA OUT buffer, which would corrupt user
         * memory for SG_IO commands.
         */
-       if (unlikely(blk_rq_is_passthrough(scmd->request)))
+       if (unlikely(blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))))
                goto invalid_opcode;
 
        if (unlikely(scmd->cmd_len < 16)) {
index 9d0dd8f..121635a 100644 (file)
@@ -48,8 +48,8 @@ static unsigned int pata_falcon_data_xfer(struct ata_queued_cmd *qc,
        struct scsi_cmnd *cmd = qc->scsicmd;
        bool swap = 1;
 
-       if (dev->class == ATA_DEV_ATA && cmd && cmd->request &&
-           !blk_rq_is_passthrough(cmd->request))
+       if (dev->class == ATA_DEV_ATA && cmd &&
+           !blk_rq_is_passthrough(scsi_cmd_to_rq(cmd)))
                swap = 0;
 
        /* Transfer multiple of 2 bytes */