scsi: Use blk_mq_rq_to_pdu() to convert a request to a SCSI command pointer
Since commit e9c787e65c
("scsi: allocate scsi_cmnd structures as
part of struct request") struct request and struct scsi_cmnd are
adjacent. This means that there is now an alternative to reading
req->special to convert a pointer to a prepared request into a
SCSI command pointer, namely by using blk_mq_rq_to_pdu(). Make
this change where appropriate. Although this patch does not
change any functionality, it slightly improves performance and
slightly improves readability.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:

committed by
Martin K. Petersen

parent
e7008ff5c6
commit
bed2213d01
@@ -39,7 +39,7 @@ static inline struct scsi_cmnd *scsi_host_find_tag(struct Scsi_Host *shost,
|
||||
|
||||
if (!req)
|
||||
return NULL;
|
||||
return req->special;
|
||||
return blk_mq_rq_to_pdu(req);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BLOCK */
|
||||
|
Reference in New Issue
Block a user