[dm-devel] [PATCH 4/7] Don't optimize for failure case

Mikulas Patocka mpatocka at redhat.com
Wed Nov 18 12:12:28 UTC 2009


Don't optimize for failure case.

should_wake is just an optimization to avoid waking the thread up when
there's already something to do. Don't do this optimization in failure
handling code. It is totally pointless to optimize failures.

Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>

---
 drivers/md/dm-raid1.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Index: linux-2.6.31-fast-new/drivers/md/dm-raid1.c
===================================================================
--- linux-2.6.31-fast-new.orig/drivers/md/dm-raid1.c	2009-10-06 18:15:17.000000000 +0200
+++ linux-2.6.31-fast-new/drivers/md/dm-raid1.c	2009-10-06 18:15:20.000000000 +0200
@@ -529,7 +529,6 @@ static void write_callback(unsigned long
 	struct bio *bio = (struct bio *) context;
 	struct mirror_set *ms;
 	int uptodate = 0;
-	int should_wake = 0;
 	unsigned long flags;
 
 	ms = bio_get_m(bio)->ms;
@@ -561,12 +560,9 @@ static void write_callback(unsigned long
 		 * the main thread.
 		 */
 		spin_lock_irqsave(&ms->lock, flags);
-		if (!ms->failures.head)
-			should_wake = 1;
 		bio_list_add(&ms->failures, bio);
 		spin_unlock_irqrestore(&ms->lock, flags);
-		if (should_wake)
-			wakeup_mirrord(ms);
+		wakeup_mirrord(ms);
 		return;
 	}
 out:




More information about the dm-devel mailing list