To make the scsi-mq work, add those operations in scsi_mq_queue_rq().
Signed-off-by: Jianpeng Ma <[email protected]>
---
drivers/scsi/scsi-mq.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/scsi/scsi-mq.c b/drivers/scsi/scsi-mq.c
index 918b443..eccdbd5 100644
--- a/drivers/scsi/scsi-mq.c
+++ b/drivers/scsi/scsi-mq.c
@@ -20,8 +20,10 @@ static int scsi_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
struct request *rq)
struct scsi_device *sdev = q->queuedata;
struct scsi_cmnd *sc = rq->special;
struct scatterlist *sg = sc->mq_sgl;
+ struct Scsi_Host *shost = sdev->host;
unsigned char *sense_buf = sc->sense_buffer;
int rc;
+
/*
* With blk-mq rq->special pre-allocation, scsi_get_cmd_from_req()
* is using the hardware context *sc descriptor
@@ -66,6 +68,12 @@ static int scsi_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
struct request *rq)
if (sdev->host->hostt->cmd_size)
sc->SCp.ptr = blk_mq_rq_to_pdu(rq) + sizeof(struct scsi_cmnd);
+ spin_lock_irq(shost->host_lock);
+ sdev->device_busy++;
+ scsi_target(sdev)->target_busy++;
+ shost->host_busy++;
+ spin_unlock_irq(shost->host_lock);
+
rc = scsi_dispatch_cmd(sc);
switch (rc) {
case 0:
--
1.7.10.4