virtio_scsi: use cmd_size

Taken almost entirely from Nicholas Bellinger's scsi-mq conversion.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
Christoph Hellwig
2014-05-01 16:51:50 +02:00
parent fdbcbcab0e
commit b54197c43d
2 changed files with 16 additions and 18 deletions

View File

@@ -133,6 +133,15 @@ struct scsi_cmnd {
unsigned char tag; /* SCSI-II queued command tag */
};
/*
* Return the driver private allocation behind the command.
* Only works if cmd_size is set in the host template.
*/
static inline void *scsi_cmd_priv(struct scsi_cmnd *cmd)
{
return cmd + 1;
}
/* make sure not to use it with REQ_TYPE_BLOCK_PC commands */
static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd)
{