* [PATCH 6/7] SCSI: simplify scsi_error_handler()
@ 2010-06-02 20:37 Alan Stern
0 siblings, 0 replies; only message in thread
From: Alan Stern @ 2010-06-02 20:37 UTC (permalink / raw)
To: James Bottomley; +Cc: SCSI development list
This patch (as1360) improves the scsi_error_handler() routine by
removing two occurrences of set_current_state().
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
---
Index: usb-2.6/drivers/scsi/scsi_error.c
===================================================================
--- usb-2.6.orig/drivers/scsi/scsi_error.c
+++ usb-2.6/drivers/scsi/scsi_error.c
@@ -1734,21 +1734,24 @@ int scsi_error_handler(void *data)
{
struct Scsi_Host *shost = data;
- /*
- * We use TASK_INTERRUPTIBLE so that the thread is not
- * counted against the load average as a running process.
- * We never actually get interrupted because kthread_run
- * disables signal delivery for the created thread.
- */
- set_current_state(TASK_INTERRUPTIBLE);
- while (!kthread_should_stop()) {
+ for (;;) {
+ /*
+ * We use TASK_INTERRUPTIBLE so that the thread is not
+ * counted against the load average as a running process.
+ * We never actually get interrupted because kthread_run
+ * disables signal delivery for the created thread.
+ */
+ set_current_state(TASK_INTERRUPTIBLE);
+ if (kthread_should_stop()) {
+ __set_current_state(TASK_RUNNING);
+ break;
+ }
if ((shost->host_failed == 0 && shost->host_eh_scheduled == 0) ||
shost->host_failed != shost->host_busy) {
SCSI_LOG_ERROR_RECOVERY(1,
printk("Error handler scsi_eh_%d sleeping\n",
shost->host_no));
schedule();
- set_current_state(TASK_INTERRUPTIBLE);
continue;
}
@@ -1775,9 +1778,7 @@ int scsi_error_handler(void *data)
* which are still online.
*/
scsi_restart_operations(shost);
- set_current_state(TASK_INTERRUPTIBLE);
}
- __set_current_state(TASK_RUNNING);
SCSI_LOG_ERROR_RECOVERY(1,
printk("Error handler scsi_eh_%d exiting\n", shost->host_no));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-06-02 20:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-02 20:37 [PATCH 6/7] SCSI: simplify scsi_error_handler() Alan Stern
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).