[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [Patch] dm.c: Use wawitqueue_active()



dm.c: Use waitqueue_active() to save a couple of cycles.

I couldn't think of a reason why event_callback() was using
wake_up_interruptible() rather than plain old wake_up(), so changed
it.
--- diff/drivers/md/dm.c	2004-03-01 15:44:41.000000000 +0000
+++ source/drivers/md/dm.c	2004-03-02 10:31:46.000000000 +0000
@@ -255,13 +255,19 @@ static int queue_io(struct mapped_device
  */
 static inline void dec_pending(struct dm_io *io, int error)
 {
+	wait_queue_head_t *wq;
+
 	if (error)
 		io->error = error;
 
 	if (atomic_dec_and_test(&io->io_count)) {
-		if (atomic_dec_and_test(&io->md->pending))
+		if (atomic_dec_and_test(&io->md->pending)) {
+			wq = &io->md->wait;
+
 			/* nudge anyone waiting on suspend queue */
-			wake_up(&io->md->wait);
+			if (waitqueue_active(wq))
+			    wake_up(wq);
+		}
 
 		bio_endio(io->bio, io->bio->bi_size, io->error);
 		free_io(io->md, io);
@@ -716,7 +722,8 @@ static void event_callback(void *context
 
 	down_write(&md->lock);
 	md->event_nr++;
-	wake_up_interruptible(&md->eventq);
+	if (waitqueue_active(&md->eventq))
+		wake_up(&md->eventq);
 	up_write(&md->lock);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]