From: NeilBrown <[email-masked]>

Add per-target unplug callback support and establish the raid_unplug()
callback for dm-raid.

Cc: [email-masked]
Signed-off-by: NeilBrown <[email-masked]>
Signed-off-by: Jonathan Brassow <[email-masked]>
Signed-off-by: Mike Snitzer <[email-masked]>

---
drivers/md/dm-raid.c          |   10 ++++++++++
 drivers/md/dm-raid.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Index: linux-2.6.37/drivers/md/dm-raid.c
===================================================================
--- linux-2.6.37.orig/drivers/md/dm-raid.c
+++ linux-2.6.37/drivers/md/dm-raid.c
@@ -366,11 +366,18 @@ static void do_table_event(struct work_s
 
 static int raid_is_congested(struct dm_target_callbacks *cb, int bits)
 {
-	struct raid_set *rs = container_of(cb, struct raid_set,
-					   callbacks);
+	struct raid_set *rs = container_of(cb, struct raid_set, callbacks);
+
 	return md_raid5_congested(&rs->md, bits);
 }
 
+static void raid_unplug(struct dm_target_callbacks *cb)
+{
+	struct raid_set *rs = container_of(cb, struct raid_set, callbacks);
+
+	md_raid5_unplug_device(rs->md.private);
+}
+
 /*
  * Construct a RAID4/5/6 mapping:
  * Args:
@@ -455,6 +462,7 @@ static int raid_ctr(struct dm_target *ti
 		goto err;
 
 	rs->callbacks.congested_fn = raid_is_congested;
+	rs->callbacks.unplug_fn = raid_unplug;
 	dm_table_add_target_callbacks(ti->table, &rs->callbacks);
 
 	return 0;