Commit 48944053 authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[PATCH] disk barriers: devicemapper

dm bits
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 91173b0c
......@@ -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);
......@@ -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);
......
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment