]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] md 7 of 22 - Use wait_event_interuptible in md_thread
authorNeil Brown <neilb@cse.unsw.edu.au>
Tue, 18 Jun 2002 11:16:07 +0000 (04:16 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 18 Jun 2002 11:16:07 +0000 (04:16 -0700)
It currently has several lines of code where one will do.

drivers/md/md.c

index e60dc0d1864172efc8991b194c2199e0e3bb8f13..e5ce11d4b8219aa5be9b8ca238489ed87c10cecf 100644 (file)
@@ -2929,17 +2929,10 @@ int md_thread(void * arg)
        complete(thread->event);
        while (thread->run) {
                void (*run)(void *data);
-               DECLARE_WAITQUEUE(wait, current);
 
-               add_wait_queue(&thread->wqueue, &wait);
-               set_task_state(current, TASK_INTERRUPTIBLE);
-               if (!test_bit(THREAD_WAKEUP, &thread->flags)) {
-                       dprintk("md: thread %p went to sleep.\n", thread);
-                       schedule();
-                       dprintk("md: thread %p woke up.\n", thread);
-               }
-               current->state = TASK_RUNNING;
-               remove_wait_queue(&thread->wqueue, &wait);
+               wait_event_interruptible(thread->wqueue,
+                                        test_bit(THREAD_WAKEUP, &thread->flags));
+
                clear_bit(THREAD_WAKEUP, &thread->flags);
 
                run = thread->run;