On Thursday 10 June 2004 9:53 pm, Dave Olien wrote: > This patch removes the signal handling case from the sync_io() routine > in dm-io.c. This seems appropriate for several reasons. Couldn't we also just convert that whole loop to a wait_event() call? The only real difference would be that the loop currently uses io_schedule(), whereas wait_event() would use regular schedule(). But perhaps that's a distinction we need to maintain. Here's the patch anyways for review. -- Kevin Corry kevcorry@xxxxxxxxxx http://evms.sourceforge.net/ --- diff/drivers/md/dm-io.c 2004-06-10 17:12:17.367130368 +0000 +++ source/drivers/md/dm-io.c 2004-06-10 17:12:10.216217472 +0000 @@ -535,6 +535,7 @@ static int sync_io(unsigned int num_regions, struct io_region *where, int rw, struct dpages *dp, unsigned long *error_bits) { + DECLARE_WAIT_QUEUE_HEAD(wq); struct io io; BUG_ON(num_regions > 1 && rw != WRITE); @@ -545,18 +546,7 @@ dispatch_io(rw, num_regions, where, dp, &io, 1); - while (1) { - set_current_state(TASK_UNINTERRUPTIBLE); - - if (!atomic_read(&io.count) || signal_pending(current)) - break; - - io_schedule(); - } - set_current_state(TASK_RUNNING); - - if (atomic_read(&io.count)) - return -EINTR; + wait_event(wq, (!atomic_read(&io.count))); *error_bits = io.error; return io.error ? -EIO : 0;