aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/aoe/aoeblk.c
diff options
context:
space:
mode:
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 @@
6 6
7#include <linux/hdreg.h> 7#include <linux/hdreg.h>
8#include <linux/blkdev.h> 8#include <linux/blkdev.h>
9#include <linux/backing-dev.h>
9#include <linux/fs.h> 10#include <linux/fs.h>
10#include <linux/ioctl.h> 11#include <linux/ioctl.h>
11#include <linux/genhd.h> 12#include <linux/genhd.h>
@@ -210,25 +211,20 @@ aoeblk_gdalloc(void *vp)
210 if (gd == NULL) { 211 if (gd == NULL) {
211 printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n", 212 printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n",
212 d->aoemajor, d->aoeminor); 213 d->aoemajor, d->aoeminor);
213 spin_lock_irqsave(&d->lock, flags); 214 goto err;
214 d->flags &= ~DEVFL_GDALLOC;
215 spin_unlock_irqrestore(&d->lock, flags);
216 return;
217 } 215 }
218 216
219 d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache); 217 d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
220 if (d->bufpool == NULL) { 218 if (d->bufpool == NULL) {
221 printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n", 219 printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n",
222 d->aoemajor, d->aoeminor); 220 d->aoemajor, d->aoeminor);
223 put_disk(gd); 221 goto err_disk;
224 spin_lock_irqsave(&d->lock, flags);
225 d->flags &= ~DEVFL_GDALLOC;
226 spin_unlock_irqrestore(&d->lock, flags);
227 return;
228 } 222 }
229 223
230 spin_lock_irqsave(&d->lock, flags);
231 blk_queue_make_request(&d->blkq, aoeblk_make_request); 224 blk_queue_make_request(&d->blkq, aoeblk_make_request);
225 if (bdi_init(&d->blkq.backing_dev_info))
226 goto err_mempool;
227 spin_lock_irqsave(&d->lock, flags);
232 gd->major = AOE_MAJOR; 228 gd->major = AOE_MAJOR;
233 gd->first_minor = d->sysminor * AOE_PARTITIONS; 229 gd->first_minor = d->sysminor * AOE_PARTITIONS;
234 gd->fops = &aoe_bdops; 230 gd->fops = &aoe_bdops;
@@ -246,6 +242,16 @@ aoeblk_gdalloc(void *vp)
246 242
247 add_disk(gd); 243 add_disk(gd);
248 aoedisk_add_sysfs(d); 244 aoedisk_add_sysfs(d);
245 return;
246
247err_mempool:
248 mempool_destroy(d->bufpool);
249err_disk:
250 put_disk(gd);
251err:
252 spin_lock_irqsave(&d->lock, flags);
253 d->flags &= ~DEVFL_GDALLOC;
254 spin_unlock_irqrestore(&d->lock, flags);
249} 255}
250 256
251void 257void