dm: per target unplug callback support
authorNeilBrown <neilb@suse.de>
Thu, 13 Jan 2011 20:00:02 +0000 (20:00 +0000)
committerAlasdair G Kergon <agk@redhat.com>
Thu, 13 Jan 2011 20:00:02 +0000 (20:00 +0000)
Add per-target unplug callback support.

Cc: linux-raid@vger.kernel.org
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-table.c
include/linux/device-mapper.h

index 7e2ec3c055502fe21b0d9b01153cbc67e83111db..dffa0ac7c4f0e135ec410bcc0e30dff9a443a78d 100644 (file)
@@ -1278,6 +1278,7 @@ void dm_table_unplug_all(struct dm_table *t)
 {
        struct dm_dev_internal *dd;
        struct list_head *devices = dm_table_get_devices(t);
+       struct dm_target_callbacks *cb;
 
        list_for_each_entry(dd, devices, list) {
                struct request_queue *q = bdev_get_queue(dd->dm_dev.bdev);
@@ -1290,6 +1291,10 @@ void dm_table_unplug_all(struct dm_table *t)
                                     dm_device_name(t->md),
                                     bdevname(dd->dm_dev.bdev, b));
        }
+
+       list_for_each_entry(cb, &t->target_callbacks, list)
+               if (cb->unplug_fn)
+                       cb->unplug_fn(cb);
 }
 
 struct mapped_device *dm_table_get_md(struct dm_table *t)
index 4b1c63d478ab972e328e279486255650b84e75d1..272496d1fae41bbb7de1db89b1131ab87283972b 100644 (file)
@@ -197,6 +197,7 @@ struct dm_target {
 struct dm_target_callbacks {
        struct list_head list;
        int (*congested_fn) (struct dm_target_callbacks *, int);
+       void (*unplug_fn)(struct dm_target_callbacks *);
 };
 
 int dm_register_target(struct target_type *t);