===== hosts.c 1.9 vs edited ===== --- 1.9/drivers/scsi/hosts.c Tue Jun 11 15:43:08 2002 +++ edited/hosts.c Mon Sep 30 15:29:56 2002 @@ -210,7 +210,7 @@ retval->eh_notify = NULL; /* Who we notify when we exit. */ - retval->host_blocked = FALSE; + retval->host_blocked = 0; retval->host_self_blocked = FALSE; #ifdef DEBUG ===== hosts.h 1.12 vs edited ===== --- 1.12/drivers/scsi/hosts.h Sun Jul 21 03:55:49 2002 +++ edited/hosts.h Mon Sep 30 15:25:53 2002 @@ -395,11 +395,6 @@ unsigned use_blk_tcq:1; /* - * Host has rejected a command because it was busy. - */ - unsigned host_blocked:1; - - /* * Host has requested that no further requests come through for the * time being. */ @@ -417,6 +412,19 @@ */ unsigned some_device_starved:1; + /* + * Host has rejected a command because it was busy. + */ + unsigned int host_blocked; + + /* + * Initial value for the blocking. If the queue is empty, host_blocked + * counts down in the request_fn until it restarts host operations as + * zero is reached. + * + * FIXME: This should probably be a value in the template */ + #define SCSI_START_HOST_BLOCKED 7 + void (*select_queue_depths)(struct Scsi_Host *, Scsi_Device *); /* ===== scsi.c 1.36 vs edited ===== --- 1.36/drivers/scsi/scsi.c Fri Sep 20 00:40:42 2002 +++ edited/scsi.c Mon Sep 30 15:26:41 2002 @@ -643,7 +643,7 @@ return 0; } } - host->host_blocked = TRUE; + host->host_blocked = SCSI_START_HOST_BLOCKED; } else { if (cmd->device->device_busy == 0) { if (scsi_retry_command(cmd) == 0) { @@ -1443,7 +1443,7 @@ * for both the queue full condition on a device, and for a * host full condition on the host. */ - host->host_blocked = FALSE; + host->host_blocked = 0; device->device_blocked = FALSE; /* ===== scsi_lib.c 1.30 vs edited ===== --- 1.30/drivers/scsi/scsi_lib.c Wed Sep 18 11:36:10 2002 +++ edited/scsi_lib.c Mon Sep 30 15:33:00 2002 @@ -754,6 +754,16 @@ if (SHpnt->in_recovery || blk_queue_plugged(q)) return; + if(SHpnt->host_busy == 0 && SHpnt->host_blocked) { + /* unblock after host_blocked iterates to zero */ + if(--SHpnt->host_blocked == 0) { + printk("scsi%d unblocking host at zero depth\n", SHpnt->host_no); + } else { + blk_plug_device(q); + break; + } + } + /* * If the device cannot accept another request, then quit. */