scsi: Use blk_mq_rq_to_pdu() to convert a request to a SCSI command pointer
authorBart Van Assche <bart.vanassche@wdc.com>
Fri, 25 Aug 2017 20:46:32 +0000 (13:46 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 25 Aug 2017 21:08:07 +0000 (17:08 -0400)
commitbed2213d01de474eb8a6f3891070eec6be6fe772
tree7cf1ff22eb30ec502abf3f5155cb04ef64d9a72c
parente7008ff5c61a13e673344d3048baaf8e0652fa87
scsi: Use blk_mq_rq_to_pdu() to convert a request to a SCSI command pointer

Since commit e9c787e65c0c ("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>
drivers/scsi/scsi_error.c
drivers/scsi/scsi_lib.c
include/scsi/scsi_tcq.h