* [PATCH 2/6] scsi-mq: add operations about device_busy/target_busy/host_busy in scsi_mq_queue_rq().
@ 2013-11-29 8:41 majianpeng
2013-12-23 6:31 ` Nicholas A. Bellinger
0 siblings, 1 reply; 2+ messages in thread
From: majianpeng @ 2013-11-29 8:41 UTC (permalink / raw)
To: nab; +Cc: linux-scsi
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/6] scsi-mq: add operations about device_busy/target_busy/host_busy in scsi_mq_queue_rq().
2013-11-29 8:41 [PATCH 2/6] scsi-mq: add operations about device_busy/target_busy/host_busy in scsi_mq_queue_rq() majianpeng
@ 2013-12-23 6:31 ` Nicholas A. Bellinger
0 siblings, 0 replies; 2+ messages in thread
From: Nicholas A. Bellinger @ 2013-12-23 6:31 UTC (permalink / raw)
To: majianpeng; +Cc: linux-scsi
On Fri, 2013-11-29 at 16:41 +0800, majianpeng wrote:
> 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:
Same with this patch, it doesn't seem to be strictly required for the
QEMU AHCI + TYPE_ROM test case to function with v3.13-rc3 code.
I've been avoiding legacy host_lock access in the fast-path thus far,
and would not like to give that away just yet unless it's absolutely
required for prototype scsi-mq code to function.
--nab
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-23 6:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-29 8:41 [PATCH 2/6] scsi-mq: add operations about device_busy/target_busy/host_busy in scsi_mq_queue_rq() majianpeng
2013-12-23 6:31 ` Nicholas A. Bellinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).