All of lore.kernel.org
 help / color / mirror / Atom feed
From: majianpeng <majianpeng@gmail.com>
To: nab <nab@linux-iscsi.org>
Cc: linux-scsi <linux-scsi@vger.kernel.org>
Subject: [PATCH 2/6] scsi-mq: add operations about device_busy/target_busy/host_busy in scsi_mq_queue_rq().
Date: Fri, 29 Nov 2013 16:41:47 +0800	[thread overview]
Message-ID: <201311291641444406166@gmail.com> (raw)

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

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
 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

             reply	other threads:[~2013-11-29  8:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-29  8:41 majianpeng [this message]
2013-12-23  6:31 ` [PATCH 2/6] scsi-mq: add operations about device_busy/target_busy/host_busy in scsi_mq_queue_rq() Nicholas A. Bellinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201311291641444406166@gmail.com \
    --to=majianpeng@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.