diff options
author | Christoph Hellwig <hch@lst.de> | 2014-01-22 09:29:29 -0500 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-07-25 07:43:43 -0400 |
commit | 74665016086615bbaa3fa6f83af410a0a4e029ee (patch) | |
tree | 9f9d8a692bec91dce69fd303eeedf16c35b41ac6 /drivers/scsi/scsi_error.c | |
parent | 7ae65c0f9646c29432b69580b80e08632e6cd813 (diff) |
scsi: convert host_busy to atomic_t
Avoid taking the host-wide host_lock to check the per-host queue limit.
Instead we do an atomic_inc_return early on to grab our slot in the queue,
and if necessary decrement it after finishing all checks.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Webb Scales <webbnh@hp.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Tested-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Robert Elliott <elliott@hp.com>
Diffstat (limited to 'drivers/scsi/scsi_error.c')
-rw-r--r-- | drivers/scsi/scsi_error.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index e4a532463f9a..5db8454474ee 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -59,7 +59,7 @@ static int scsi_try_to_abort_cmd(struct scsi_host_template *, | |||
59 | /* called with shost->host_lock held */ | 59 | /* called with shost->host_lock held */ |
60 | void scsi_eh_wakeup(struct Scsi_Host *shost) | 60 | void scsi_eh_wakeup(struct Scsi_Host *shost) |
61 | { | 61 | { |
62 | if (shost->host_busy == shost->host_failed) { | 62 | if (atomic_read(&shost->host_busy) == shost->host_failed) { |
63 | trace_scsi_eh_wakeup(shost); | 63 | trace_scsi_eh_wakeup(shost); |
64 | wake_up_process(shost->ehandler); | 64 | wake_up_process(shost->ehandler); |
65 | SCSI_LOG_ERROR_RECOVERY(5, shost_printk(KERN_INFO, shost, | 65 | SCSI_LOG_ERROR_RECOVERY(5, shost_printk(KERN_INFO, shost, |
@@ -2164,7 +2164,7 @@ int scsi_error_handler(void *data) | |||
2164 | while (!kthread_should_stop()) { | 2164 | while (!kthread_should_stop()) { |
2165 | set_current_state(TASK_INTERRUPTIBLE); | 2165 | set_current_state(TASK_INTERRUPTIBLE); |
2166 | if ((shost->host_failed == 0 && shost->host_eh_scheduled == 0) || | 2166 | if ((shost->host_failed == 0 && shost->host_eh_scheduled == 0) || |
2167 | shost->host_failed != shost->host_busy) { | 2167 | shost->host_failed != atomic_read(&shost->host_busy)) { |
2168 | SCSI_LOG_ERROR_RECOVERY(1, | 2168 | SCSI_LOG_ERROR_RECOVERY(1, |
2169 | shost_printk(KERN_INFO, shost, | 2169 | shost_printk(KERN_INFO, shost, |
2170 | "scsi_eh_%d: sleeping\n", | 2170 | "scsi_eh_%d: sleeping\n", |
@@ -2178,7 +2178,8 @@ int scsi_error_handler(void *data) | |||
2178 | shost_printk(KERN_INFO, shost, | 2178 | shost_printk(KERN_INFO, shost, |
2179 | "scsi_eh_%d: waking up %d/%d/%d\n", | 2179 | "scsi_eh_%d: waking up %d/%d/%d\n", |
2180 | shost->host_no, shost->host_eh_scheduled, | 2180 | shost->host_no, shost->host_eh_scheduled, |
2181 | shost->host_failed, shost->host_busy)); | 2181 | shost->host_failed, |
2182 | atomic_read(&shost->host_busy))); | ||
2182 | 2183 | ||
2183 | /* | 2184 | /* |
2184 | * We have a host that is failing for some reason. Figure out | 2185 | * We have a host that is failing for some reason. Figure out |