public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: David Miller <davem@davemloft.net>
Cc: mroos@linux.ee, hch@infradead.org, axboe@kernel.dk,
	linux-scsi@vger.kernel.org, sparclinux@vger.kernel.org
Subject: Re: Sparc ESP problem with blk-mq
Date: Sat, 18 Oct 2014 10:57:03 -0700	[thread overview]
Message-ID: <20141018175703.GA16988@infradead.org> (raw)
In-Reply-To: <20141018.133132.1505060820853861420.davem@davemloft.net>

[-- Attachment #1: Type: text/plain, Size: 257 bytes --]

On Sat, Oct 18, 2014 at 01:31:32PM -0400, David Miller wrote:
> 
> Christoph, I don't see how the new tagging code with blk-mq can
> be providing compatible behavior for existing SCSI drivers.

It doesn't, and that's my fault.

Please try the patch below:


[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 3646 bytes --]

diff --git a/Documentation/block/biodoc.txt b/Documentation/block/biodoc.txt
index 2101e71..e465344 100644
--- a/Documentation/block/biodoc.txt
+++ b/Documentation/block/biodoc.txt
@@ -740,11 +740,6 @@ one outstanding command on a queue at any given time.
 	Initialize internal command tagging structures for a maximum
 	depth of 'depth'.
 
-	blk_queue_free_tags((struct request_queue *q)
-
-	Teardown tag info associated with the queue. This will be done
-	automatically by block if blk_queue_cleanup() is called on a queue
-	that is using tagging.
 
 The above are initialization and exit management, the main helpers during
 normal operations are:
diff --git a/block/blk-tag.c b/block/blk-tag.c
index a185b86..5daff44 100644
--- a/block/blk-tag.c
+++ b/block/blk-tag.c
@@ -71,20 +71,6 @@ void __blk_queue_free_tags(struct request_queue *q)
 	queue_flag_clear_unlocked(QUEUE_FLAG_QUEUED, q);
 }
 
-/**
- * blk_queue_free_tags - release tag maintenance info
- * @q:  the request queue for the device
- *
- *  Notes:
- *	This is used to disable tagged queuing to a device, yet leave
- *	queue in function.
- **/
-void blk_queue_free_tags(struct request_queue *q)
-{
-	queue_flag_clear_unlocked(QUEUE_FLAG_QUEUED, q);
-}
-EXPORT_SYMBOL(blk_queue_free_tags);
-
 static int
 init_tag_map(struct request_queue *q, struct blk_queue_tag *tags, int depth)
 {
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 87be398..06d1254 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1142,13 +1142,18 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk)
 /*
  * tag stuff
  */
-#define blk_rq_tagged(rq) \
-	((rq)->mq_ctx || ((rq)->cmd_flags & REQ_QUEUED))
+static inline bool blk_rq_tagged(struct request *rq)
+{
+	if (rq->mq_ctx)
+		return blk_queue_tagged(rq->q);
+	else
+		return (rq->cmd_flags & REQ_QUEUED);
+}
+
 extern int blk_queue_start_tag(struct request_queue *, struct request *);
 extern struct request *blk_queue_find_tag(struct request_queue *, int);
 extern void blk_queue_end_tag(struct request_queue *, struct request *);
 extern int blk_queue_init_tags(struct request_queue *, int, struct blk_queue_tag *);
-extern void blk_queue_free_tags(struct request_queue *);
 extern int blk_queue_resize_tags(struct request_queue *, int);
 extern void blk_queue_invalidate_tags(struct request_queue *);
 extern struct blk_queue_tag *blk_init_tags(int);
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h
index e645835..c977a25 100644
--- a/include/scsi/scsi_tcq.h
+++ b/include/scsi/scsi_tcq.h
@@ -67,10 +67,13 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
 	if (!sdev->tagged_supported)
 		return;
 
-	if (!shost_use_blk_mq(sdev->host) &&
-	    !blk_queue_tagged(sdev->request_queue))
-		blk_queue_init_tags(sdev->request_queue, depth,
-				    sdev->host->bqt);
+	if (shost_use_blk_mq(sdev->host)) {
+		queue_flag_set_unlocked(QUEUE_FLAG_QUEUED, sdev->request_queue);
+	} else {
+		if (!blk_queue_tagged(sdev->request_queue))
+			blk_queue_init_tags(sdev->request_queue, depth,
+					    sdev->host->bqt);
+	}
 
 	scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), depth);
 }
@@ -81,9 +84,9 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth)
  **/
 static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth)
 {
-	if (!shost_use_blk_mq(sdev->host) &&
-	    blk_queue_tagged(sdev->request_queue))
-		blk_queue_free_tags(sdev->request_queue);
+	if (blk_queue_tagged(sdev->request_queue))
+		queue_flag_clear_unlocked(QUEUE_FLAG_QUEUED,
+				sdev->request_queue);
 	scsi_adjust_queue_depth(sdev, 0, depth);
 }
 

  reply	other threads:[~2014-10-18 17:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-13 22:07 Sparc ESP problem with blk-mq Meelis Roos
2014-10-14 14:37 ` Jens Axboe
2014-10-14 14:38 ` Jens Axboe
2014-10-15 13:35   ` Christoph Hellwig
2014-10-15 20:53     ` David Miller
2014-10-16  6:43       ` mroos
2014-10-17 19:56         ` David Miller
2014-10-18 17:31           ` David Miller
2014-10-18 17:57             ` Christoph Hellwig [this message]
2014-10-19 12:10               ` mroos
2014-10-19 14:10                 ` Christoph Hellwig

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=20141018175703.GA16988@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mroos@linux.ee \
    --cc=sparclinux@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox