Commit c8329cd5 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

scsi: ata: Use scsi_cmd_to_rq() instead of scsi_cmnd.request

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: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent eb43d41d
...@@ -912,7 +912,7 @@ void ata_qc_schedule_eh(struct ata_queued_cmd *qc) ...@@ -912,7 +912,7 @@ void ata_qc_schedule_eh(struct ata_queued_cmd *qc)
* Note that ATA_QCFLAG_FAILED is unconditionally set after * Note that ATA_QCFLAG_FAILED is unconditionally set after
* this function completes. * 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) ...@@ -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) static inline bool ata_eh_quiet(struct ata_queued_cmd *qc)
{ {
if (qc->scsicmd && if (qc->scsicmd && scsi_cmd_to_rq(qc->scsicmd)->rq_flags & RQF_QUIET)
qc->scsicmd->request->rq_flags & RQF_QUIET)
qc->flags |= ATA_QCFLAG_QUIET; qc->flags |= ATA_QCFLAG_QUIET;
return qc->flags & ATA_QCFLAG_QUIET; return qc->flags & ATA_QCFLAG_QUIET;
} }
......
...@@ -631,7 +631,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev, ...@@ -631,7 +631,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
{ {
struct ata_queued_cmd *qc; 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) { if (qc) {
qc->scsicmd = cmd; qc->scsicmd = cmd;
qc->scsidone = cmd->scsi_done; qc->scsidone = cmd->scsi_done;
...@@ -639,7 +639,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev, ...@@ -639,7 +639,7 @@ static struct ata_queued_cmd *ata_scsi_qc_new(struct ata_device *dev,
qc->sg = scsi_sglist(cmd); qc->sg = scsi_sglist(cmd);
qc->n_elem = scsi_sg_count(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; qc->flags |= ATA_QCFLAG_QUIET;
} else { } else {
cmd->result = (DID_OK << 16) | SAM_STAT_TASK_SET_FULL; cmd->result = (DID_OK << 16) | SAM_STAT_TASK_SET_FULL;
...@@ -1496,7 +1496,7 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc) ...@@ -1496,7 +1496,7 @@ static unsigned int ata_scsi_verify_xlat(struct ata_queued_cmd *qc)
static bool ata_check_nblocks(struct scsi_cmnd *scmd, u32 n_blocks) 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; u32 req_blocks;
if (!blk_rq_is_passthrough(rq)) if (!blk_rq_is_passthrough(rq))
...@@ -1531,7 +1531,7 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc) ...@@ -1531,7 +1531,7 @@ static unsigned int ata_scsi_rw_xlat(struct ata_queued_cmd *qc)
{ {
struct scsi_cmnd *scmd = qc->scsicmd; struct scsi_cmnd *scmd = qc->scsicmd;
const u8 *cdb = scmd->cmnd; 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)); int class = IOPRIO_PRIO_CLASS(req_get_ioprio(rq));
unsigned int tf_flags = 0; unsigned int tf_flags = 0;
u64 block; u64 block;
...@@ -3181,7 +3181,7 @@ static unsigned int ata_scsi_write_same_xlat(struct ata_queued_cmd *qc) ...@@ -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 * as it modifies the DATA OUT buffer, which would corrupt user
* memory for SG_IO commands. * 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; goto invalid_opcode;
if (unlikely(scmd->cmd_len < 16)) { if (unlikely(scmd->cmd_len < 16)) {
......
...@@ -48,8 +48,8 @@ static unsigned int pata_falcon_data_xfer(struct ata_queued_cmd *qc, ...@@ -48,8 +48,8 @@ static unsigned int pata_falcon_data_xfer(struct ata_queued_cmd *qc,
struct scsi_cmnd *cmd = qc->scsicmd; struct scsi_cmnd *cmd = qc->scsicmd;
bool swap = 1; bool swap = 1;
if (dev->class == ATA_DEV_ATA && cmd && cmd->request && if (dev->class == ATA_DEV_ATA && cmd &&
!blk_rq_is_passthrough(cmd->request)) !blk_rq_is_passthrough(scsi_cmd_to_rq(cmd)))
swap = 0; swap = 0;
/* Transfer multiple of 2 bytes */ /* Transfer multiple of 2 bytes */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment