Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Bart Van Assche and committed by
Martin K. Petersen
c8329cd5 eb43d41d

+9 -10
+2 -3
drivers/ata/libata-eh.c
··· 912 912 * Note that ATA_QCFLAG_FAILED is unconditionally set after 913 913 * this function completes. 914 914 */ 915 - blk_abort_request(qc->scsicmd->request); 915 + blk_abort_request(scsi_cmd_to_rq(qc->scsicmd)); 916 916 } 917 917 918 918 /** ··· 1893 1893 */ 1894 1894 static inline bool ata_eh_quiet(struct ata_queued_cmd *qc) 1895 1895 { 1896 - if (qc->scsicmd && 1897 - qc->scsicmd->request->rq_flags & RQF_QUIET) 1896 + if (qc->scsicmd && scsi_cmd_to_rq(qc->scsicmd)->rq_flags & RQF_QUIET) 1898 1897 qc->flags |= ATA_QCFLAG_QUIET; 1899 1898 return qc->flags & ATA_QCFLAG_QUIET; 1900 1899 }
+5 -5
drivers/ata/libata-scsi.c
··· 631 631 { 632 632 struct ata_queued_cmd *qc; 633 633 634 - qc = ata_qc_new_init(dev, cmd->request->tag); 634 + qc = ata_qc_new_init(dev, scsi_cmd_to_rq(cmd)->tag); 635 635 if (qc) { 636 636 qc->scsicmd = cmd; 637 637 qc->scsidone = cmd->scsi_done; ··· 639 639 qc->sg = scsi_sglist(cmd); 640 640 qc->n_elem = scsi_sg_count(cmd); 641 641 642 - if (cmd->request->rq_flags & RQF_QUIET) 642 + if (scsi_cmd_to_rq(cmd)->rq_flags & RQF_QUIET) 643 643 qc->flags |= ATA_QCFLAG_QUIET; 644 644 } else { 645 645 cmd->result = (DID_OK << 16) | SAM_STAT_TASK_SET_FULL; ··· 1496 1496 1497 1497 static bool ata_check_nblocks(struct scsi_cmnd *scmd, u32 n_blocks) 1498 1498 { 1499 - struct request *rq = scmd->request; 1499 + struct request *rq = scsi_cmd_to_rq(scmd); 1500 1500 u32 req_blocks; 1501 1501 1502 1502 if (!blk_rq_is_passthrough(rq)) ··· 1531 1531 { 1532 1532 struct scsi_cmnd *scmd = qc->scsicmd; 1533 1533 const u8 *cdb = scmd->cmnd; 1534 - struct request *rq = scmd->request; 1534 + struct request *rq = scsi_cmd_to_rq(scmd); 1535 1535 int class = IOPRIO_PRIO_CLASS(req_get_ioprio(rq)); 1536 1536 unsigned int tf_flags = 0; 1537 1537 u64 block; ··· 3181 3181 * as it modifies the DATA OUT buffer, which would corrupt user 3182 3182 * memory for SG_IO commands. 3183 3183 */ 3184 - if (unlikely(blk_rq_is_passthrough(scmd->request))) 3184 + if (unlikely(blk_rq_is_passthrough(scsi_cmd_to_rq(scmd)))) 3185 3185 goto invalid_opcode; 3186 3186 3187 3187 if (unlikely(scmd->cmd_len < 16)) {
+2 -2
drivers/ata/pata_falcon.c
··· 48 48 struct scsi_cmnd *cmd = qc->scsicmd; 49 49 bool swap = 1; 50 50 51 - if (dev->class == ATA_DEV_ATA && cmd && cmd->request && 52 - !blk_rq_is_passthrough(cmd->request)) 51 + if (dev->class == ATA_DEV_ATA && cmd && 52 + !blk_rq_is_passthrough(scsi_cmd_to_rq(cmd))) 53 53 swap = 0; 54 54 55 55 /* Transfer multiple of 2 bytes */