Commit 74a84824 authored by Brian King's avatar Brian King Committed by James Bottomley

[PATCH] Allow TCQ depth to be lowered properly

Ran into a couple small issues with the patch. First,
blk_queue_resize_tags wasn't getting exported, so I sent Jens a patch to
fix this, which he has now sent upstream. Second, the comment above
blk_queue_resize_tags says the queue_lock must be held when calling this
routine. Attached is an updated patch that grabs the lock. Other than
that, it looks good.

James Bottomley wrote:
> On Tue, 2004-08-03 at 10:50, Brian King wrote:
>>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.
>
>
> Sorry, been away at conferences with not enough time to remember what
> went on here.
>
> The reason it looks the way it does is historical...when the blk layer
> tcq interfaces were created, there was no way to resize the queue.  Jens
> later added resize (for me) and I forgot to incorporate it into the
> code.
>
> Another small point is that the max number of tags can be greater than
> 256.  256 is a SPI limit only (and even the qla1280, a SPI card which
> could use the tag as its global queue index would take > 256).  The
> limit in scsi_adjust_queue_depth has long since been obsoleted by our
> dynamic command allocation.
>
> I think the attached should work correctly (as long as it compiles...I
> coded it up on the flight home).
Signed-off-by: default avatarBrian King <brking@us.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 59fbf85b
......@@ -897,15 +897,16 @@ void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags)
*/
if (tags <= 0)
return;
/*
* Limit max queue depth on a single lun to 256 for now. Remember,
* 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)
return;
spin_lock_irqsave(&device_request_lock, flags);
spin_lock(sdev->request_queue->queue_lock);
/* Check to see if the queue is managed by the block layer
* if it is, and we fail to adjust the depth, exit */
if (blk_queue_tagged(sdev->request_queue) &&
blk_queue_resize_tags(sdev->request_queue, tags) != 0)
goto out;
sdev->queue_depth = tags;
switch (tagged) {
case MSG_ORDERED_TAG:
......@@ -926,6 +927,8 @@ void scsi_adjust_queue_depth(struct scsi_device *sdev, int tagged, int tags)
sdev->queue_depth = tags;
break;
}
out:
spin_unlock(sdev->request_queue->queue_lock);
spin_unlock_irqrestore(&device_request_lock, flags);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment