Re: [PATCH] fixes and cleanups for the new command allocation code

James Bottomley
2003-02-05T15:59:49Z

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

The patches to block after prepping the command are attached.

James

[-- Attachment #2: tmp.diff --]
[-- Type: text/plain, Size: 1001 bytes --]

===== ./scsi_lib.c 1.65 vs edited =====
--- 1.65/drivers/scsi/scsi_lib.c Tue Feb 4 14:19:00 2003
+++ edited/./scsi_lib.c Wed Feb 5 09:45:45 2003
@@ -814,8 +814,6 @@
SRpnt = (Scsi_Request *) req->special;

if (SRpnt->sr_magic == SCSI_REQ_MAGIC) {
- if (SDpnt->device_busy >= SDpnt->queue_depth)
- return BLKPREP_DEFER;
SCpnt = scsi_get_command(SRpnt->sr_device, GFP_ATOMIC);
if (!SCpnt)
return BLKPREP_DEFER;
@@ -827,8 +825,6 @@
* Now try and find a command block that we can use.
*/
if (!req->special) {
- if (SDpnt->device_busy >= SDpnt->queue_depth)
- return BLKPREP_DEFER;
SCpnt = scsi_get_command(SDpnt, GFP_ATOMIC);
if (unlikely(!SCpnt))
return BLKPREP_DEFER;
@@ -950,6 +946,9 @@
* lower down.
*/
req = elv_next_request(q);
+
+ if (SDpnt->device_busy >= SDpnt->queue_depth)
+ break;

if(SHpnt->host_busy == 0 && SHpnt->host_blocked) {
/* unblock after host_blocked iterates to zero */