[PATCH 2/6] scsi-mq: add operations about device_busy/target_busy/host_busy in scsi_mq_queue_rq().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To make the scsi-mq work, add those operations in scsi_mq_queue_rq().

Signed-off-by: Jianpeng Ma <majianpeng@xxxxxxxxx>
---
 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ÿôèº{.nÇ+?·?®?­?+%?Ëÿ±éݶ¥?wÿº{.nÇ+?·¥?{±þÇ,?ø§¶?¡Ü¨}©?²Æ zÚ&j:+v?¨þø¯ù®w¥þ?à2?Þ?¨è­Ú&¢)ß¡«a¶Úÿÿûàz¿äz¹Þ?ú+?ù???Ý¢jÿ?wèþf





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux