From: Alasdair G Kergon <[email-masked]>

Refactor dm_wq_work() to make later patch more readable.

Signed-off-by: Alasdair G Kergon <[email-masked]>
---
 drivers/md/dm.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

Index: linux-2.6.30-rc1/drivers/md/dm.c
===================================================================
--- linux-2.6.30-rc1.orig/drivers/md/dm.c	2009-04-08 22:28:01.000000000 +0100
+++ linux-2.6.30-rc1/drivers/md/dm.c	2009-04-08 22:28:02.000000000 +0100
@@ -1437,18 +1437,19 @@ static void dm_wq_work(struct work_struc
 
 	down_write(&md->io_lock);
 
-next_bio:
-	spin_lock_irq(&md->deferred_lock);
-	c = bio_list_pop(&md->deferred);
-	spin_unlock_irq(&md->deferred_lock);
+	while (1) {
+		spin_lock_irq(&md->deferred_lock);
+		c = bio_list_pop(&md->deferred);
+		spin_unlock_irq(&md->deferred_lock);
+
+		if (!c) {
+			clear_bit(DMF_BLOCK_IO, &md->flags);
+			break;
+		}
 
-	if (c) {
 		__split_and_process_bio(md, c);
-		goto next_bio;
 	}
 
-	clear_bit(DMF_BLOCK_IO, &md->flags);
-
 	up_write(&md->io_lock);
 }