]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/md/dm.c
[PATCH] dm: store md name
[linux-2.6-omap-h63xx.git] / drivers / md / dm.c
index 8c82373f7ff31f24b8c0439e17c00d5a8873f30d..f140d499602a14f217a7dfc3d3bd85a6ef828ef7 100644 (file)
@@ -69,6 +69,7 @@ struct mapped_device {
 
        request_queue_t *queue;
        struct gendisk *disk;
+       char name[16];
 
        void *interface_ptr;
 
@@ -823,13 +824,11 @@ static struct mapped_device *alloc_dev(unsigned int minor, int persistent)
        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);
+       md->io_pool = mempool_create_slab_pool(MIN_IOS, _io_cache);
        if (!md->io_pool)
                goto bad2;
 
-       md->tio_pool = mempool_create(MIN_IOS, mempool_alloc_slab,
-                                     mempool_free_slab, _tio_cache);
+       md->tio_pool = mempool_create_slab_pool(MIN_IOS, _tio_cache);
        if (!md->tio_pool)
                goto bad3;
 
@@ -844,6 +843,7 @@ static struct mapped_device *alloc_dev(unsigned int minor, int persistent)
        md->disk->private_data = md;
        sprintf(md->disk->disk_name, "dm-%d", minor);
        add_disk(md->disk);
+       format_dev_t(md->name, MKDEV(_major, minor));
 
        atomic_set(&md->pending, 0);
        init_waitqueue_head(&md->wait);
@@ -1109,6 +1109,7 @@ int dm_suspend(struct mapped_device *md, int do_lockfs)
 {
        struct dm_table *map = NULL;
        DECLARE_WAITQUEUE(wait, current);
+       struct bio *def;
        int r = -EINVAL;
 
        down(&md->suspend_lock);
@@ -1168,9 +1169,11 @@ int dm_suspend(struct mapped_device *md, int do_lockfs)
        /* were we interrupted ? */
        r = -EINTR;
        if (atomic_read(&md->pending)) {
+               clear_bit(DMF_BLOCK_IO, &md->flags);
+               def = bio_list_get(&md->deferred);
+               __flush_deferred_io(md, def);
                up_write(&md->io_lock);
                unlock_fs(md);
-               clear_bit(DMF_BLOCK_IO, &md->flags);
                goto out;
        }
        up_write(&md->io_lock);