linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian King <brking@us.ibm.com>
To: James.Bottomley@SteelEye.com
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [PATCH] p00002_scsi_tcq_qdepth_fix
Date: Tue, 03 Aug 2004 12:50:35 -0500	[thread overview]
Message-ID: <410FD06B.3010500@us.ibm.com> (raw)

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


-- 
Brian King
eServer Storage I/O
IBM Linux Technology Center

[-- Attachment #2: p00002_scsi_tcq_qdepth_fix.patch --]
[-- Type: text/plain, Size: 2177 bytes --]


Currently, it is possible to call scsi_activate_tcq with a small queue depth,
then later call scsi_adjust_queue_depth with a larger queue depth. This results
in the scsi layer having a larger queue depth than the block layer knows about.
This results in these additional commands being issued as untagged ops rather than
tagged ops. This patch changes scsi_activate_tcq to call blk_queue_init_tags with
the maximum supported number of tags so this cannot occur.

Signed-off-by: Brian King <brking@us.ibm.com>
---

 linux-2.6.8-rc2-bjking1/drivers/scsi/scsi.c     |    2 +-
 linux-2.6.8-rc2-bjking1/include/scsi/scsi_tcq.h |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff -puN include/scsi/scsi_tcq.h~scsi_tcq_qdepth_fix include/scsi/scsi_tcq.h
--- linux-2.6.8-rc2/include/scsi/scsi_tcq.h~scsi_tcq_qdepth_fix	2004-08-03 11:06:42.000000000 -0500
+++ linux-2.6.8-rc2-bjking1/include/scsi/scsi_tcq.h	2004-08-03 11:08:00.000000000 -0500
@@ -11,7 +11,7 @@
 #define MSG_ORDERED_TAG	0x22
 
 #define SCSI_NO_TAG	(-1)    /* identify no tag in use */
-
+#define SCSI_MAX_TAGS	256
 
 /**
  * scsi_activate_tcq - turn on tag command queueing
@@ -30,7 +30,7 @@ static inline void scsi_activate_tcq(str
         if (sdev->tagged_supported) {
 		spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
 		if (!blk_queue_tagged(sdev->request_queue))
-			blk_queue_init_tags(sdev->request_queue, depth, NULL);
+			blk_queue_init_tags(sdev->request_queue, SCSI_MAX_TAGS, NULL);
 		spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
 		scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, depth);
         }
diff -puN drivers/scsi/scsi.c~scsi_tcq_qdepth_fix drivers/scsi/scsi.c
--- linux-2.6.8-rc2/drivers/scsi/scsi.c~scsi_tcq_qdepth_fix	2004-08-03 11:07:16.000000000 -0500
+++ linux-2.6.8-rc2-bjking1/drivers/scsi/scsi.c	2004-08-03 11:08:28.000000000 -0500
@@ -902,7 +902,7 @@ void scsi_adjust_queue_depth(struct scsi
 	 * we allocate a struct scsi_command for each of these and keep it
 	 * around forever.  Too deep of a depth just wastes memory.
 	 */
-	if (tags > 256)
+	if (tags > SCSI_MAX_TAGS)
 		return;
 
 	spin_lock_irqsave(&device_request_lock, flags);
_

             reply	other threads:[~2004-08-03 17:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-03 17:50 Brian King [this message]
2004-08-07  4:09 ` [PATCH] p00002_scsi_tcq_qdepth_fix James Bottomley
2004-08-09 17:56   ` Brian King

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=410FD06B.3010500@us.ibm.com \
    --to=brking@us.ibm.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=linux-scsi@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;
as well as URLs for NNTP newsgroup(s).