diff options
author | Jens Axboe <axboe@suse.de> | 2004-08-22 22:37:47 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-08-22 22:37:47 -0700 |
commit | 48944053f81212b1f811206f72a5f805d7d228ac (patch) | |
tree | abbcb24b7a24448354558cf941189b9287e46d19 /drivers | |
parent | 91173b0cb74b5288c298fd37ce96854882574ae3 (diff) | |
download | history-48944053f81212b1f811206f72a5f805d7d228ac.tar.gz |
[PATCH] disk barriers: devicemapper
dm bits
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm-table.c | 23 | ||||
-rw-r--r-- | drivers/md/dm.c | 16 | ||||
-rw-r--r-- | drivers/md/dm.h | 1 |
3 files changed, 40 insertions, 0 deletions
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index d189f8549314a6..5881306bbc455f 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -900,6 +900,28 @@ void dm_table_unplug_all(struct dm_table *t) } } +int dm_table_flush_all(struct dm_table *t) +{ + struct list_head *d, *devices = dm_table_get_devices(t); + int ret = 0; + + for (d = devices->next; d != devices; d = d->next) { + struct dm_dev *dd = list_entry(d, struct dm_dev, list); + request_queue_t *q = bdev_get_queue(dd->bdev); + int err; + + if (!q->issue_flush_fn) + err = -EOPNOTSUPP; + else + err = q->issue_flush_fn(q, dd->bdev->bd_disk, NULL); + + if (!ret) + ret = err; + } + + return ret; +} + EXPORT_SYMBOL(dm_vcalloc); EXPORT_SYMBOL(dm_get_device); EXPORT_SYMBOL(dm_put_device); @@ -908,3 +930,4 @@ EXPORT_SYMBOL(dm_table_get_mode); EXPORT_SYMBOL(dm_table_put); EXPORT_SYMBOL(dm_table_get); EXPORT_SYMBOL(dm_table_unplug_all); +EXPORT_SYMBOL(dm_table_flush_all); diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 01794ed391a29a..b74b3ef735d7d8 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -597,6 +597,21 @@ static int dm_request(request_queue_t *q, struct bio *bio) return 0; } +static int dm_flush_all(request_queue_t *q, struct gendisk *disk, + sector_t *error_sector) +{ + struct mapped_device *md = q->queuedata; + struct dm_table *map = dm_get_table(md); + int ret = -ENXIO; + + if (map) { + ret = dm_table_flush_all(md->map); + dm_table_put(map); + } + + return ret; +} + static void dm_unplug_all(request_queue_t *q) { struct mapped_device *md = q->queuedata; @@ -764,6 +779,7 @@ static struct mapped_device *alloc_dev(unsigned int minor, int persistent) md->queue->backing_dev_info.congested_data = md; blk_queue_make_request(md->queue, dm_request); md->queue->unplug_fn = dm_unplug_all; + md->queue->issue_flush_fn = dm_flush_all; md->io_pool = mempool_create(MIN_IOS, mempool_alloc_slab, mempool_free_slab, _io_cache); diff --git a/drivers/md/dm.h b/drivers/md/dm.h index b4b915fbdf3ce1..8b75eaf87da4c9 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h @@ -113,6 +113,7 @@ void dm_table_suspend_targets(struct dm_table *t); void dm_table_resume_targets(struct dm_table *t); int dm_table_any_congested(struct dm_table *t, int bdi_bits); void dm_table_unplug_all(struct dm_table *t); +int dm_table_flush_all(struct dm_table *t); /*----------------------------------------------------------------- * A registry of target types. |