summaryrefslogtreecommitdiffstats
path: root/drivers/block/aoe/aoeblk.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-12-21 22:21:08 +1100
committerPaul Mackerras <paulus@samba.org>2007-12-21 22:21:08 +1100
commitc2a7dcad9f0d92d7a96e735abb8bec7b9c621536 (patch)
treebf9b20fdd5ab07e5b0e4e0b95c6a3dbab1005cb9 /drivers/block/aoe/aoeblk.c
parent373a6da165ac3012a74fd072da340eabca55d031 (diff)
parentea67db4cdbbf7f4e74150e71da0984e25121f500 (diff)
downloadtalos-obmc-linux-c2a7dcad9f0d92d7a96e735abb8bec7b9c621536.tar.gz
talos-obmc-linux-c2a7dcad9f0d92d7a96e735abb8bec7b9c621536.zip
Merge branch 'linux-2.6'
Diffstat (limited to 'drivers/block/aoe/aoeblk.c')
-rw-r--r--drivers/block/aoe/aoeblk.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index b1d00ef6659c..ad00b3d94711 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -6,6 +6,7 @@
#include <linux/hdreg.h>
#include <linux/blkdev.h>
+#include <linux/backing-dev.h>
#include <linux/fs.h>
#include <linux/ioctl.h>
#include <linux/genhd.h>
@@ -210,25 +211,20 @@ aoeblk_gdalloc(void *vp)
if (gd == NULL) {
printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n",
d->aoemajor, d->aoeminor);
- spin_lock_irqsave(&d->lock, flags);
- d->flags &= ~DEVFL_GDALLOC;
- spin_unlock_irqrestore(&d->lock, flags);
- return;
+ goto err;
}
d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
if (d->bufpool == NULL) {
printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n",
d->aoemajor, d->aoeminor);
- put_disk(gd);
- spin_lock_irqsave(&d->lock, flags);
- d->flags &= ~DEVFL_GDALLOC;
- spin_unlock_irqrestore(&d->lock, flags);
- return;
+ goto err_disk;
}
- spin_lock_irqsave(&d->lock, flags);
blk_queue_make_request(&d->blkq, aoeblk_make_request);
+ if (bdi_init(&d->blkq.backing_dev_info))
+ goto err_mempool;
+ spin_lock_irqsave(&d->lock, flags);
gd->major = AOE_MAJOR;
gd->first_minor = d->sysminor * AOE_PARTITIONS;
gd->fops = &aoe_bdops;
@@ -246,6 +242,16 @@ aoeblk_gdalloc(void *vp)
add_disk(gd);
aoedisk_add_sysfs(d);
+ return;
+
+err_mempool:
+ mempool_destroy(d->bufpool);
+err_disk:
+ put_disk(gd);
+err:
+ spin_lock_irqsave(&d->lock, flags);
+ d->flags &= ~DEVFL_GDALLOC;
+ spin_unlock_irqrestore(&d->lock, flags);
}
void
OpenPOWER on IntegriCloud