include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / block / aoe / aoeblk.c
index d4d9796..035cefe 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/backing-dev.h>
 #include <linux/fs.h>
 #include <linux/ioctl.h>
+#include <linux/slab.h>
 #include <linux/genhd.h>
 #include <linux/netdevice.h>
 #include "aoe.h"
@@ -37,7 +38,7 @@ static ssize_t aoedisk_show_mac(struct device *dev,
 
        if (t == NULL)
                return snprintf(page, PAGE_SIZE, "none\n");
-       return snprintf(page, PAGE_SIZE, "%012llx\n", mac_addr(t->addr));
+       return snprintf(page, PAGE_SIZE, "%pm\n", t->addr);
 }
 static ssize_t aoedisk_show_netif(struct device *dev,
                                  struct device_attribute *attr, char *page)
@@ -118,13 +119,11 @@ aoedisk_rm_sysfs(struct aoedev *d)
 }
 
 static int
-aoeblk_open(struct inode *inode, struct file *filp)
+aoeblk_open(struct block_device *bdev, fmode_t mode)
 {
-       struct aoedev *d;
+       struct aoedev *d = bdev->bd_disk->private_data;
        ulong flags;
 
-       d = inode->i_bdev->bd_disk->private_data;
-
        spin_lock_irqsave(&d->lock, flags);
        if (d->flags & DEVFL_UP) {
                d->nopen++;
@@ -136,13 +135,11 @@ aoeblk_open(struct inode *inode, struct file *filp)
 }
 
 static int
-aoeblk_release(struct inode *inode, struct file *filp)
+aoeblk_release(struct gendisk *disk, fmode_t mode)
 {
-       struct aoedev *d;
+       struct aoedev *d = disk->private_data;
        ulong flags;
 
-       d = inode->i_bdev->bd_disk->private_data;
-
        spin_lock_irqsave(&d->lock, flags);
 
        if (--d->nopen == 0) {
@@ -176,6 +173,9 @@ aoeblk_make_request(struct request_queue *q, struct bio *bio)
                BUG();
                bio_endio(bio, -ENXIO);
                return 0;
+       } else if (bio_rw_flagged(bio, BIO_RW_BARRIER)) {
+               bio_endio(bio, -EOPNOTSUPP);
+               return 0;
        } else if (bio->bi_io_vec == NULL) {
                printk(KERN_ERR "aoe: bi_io_vec is NULL\n");
                BUG();
@@ -238,9 +238,9 @@ aoeblk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
        return 0;
 }
 
-static struct block_device_operations aoe_bdops = {
-       .__open = aoeblk_open,
-       .__release = aoeblk_release,
+static const struct block_device_operations aoe_bdops = {
+       .open = aoeblk_open,
+       .release = aoeblk_release,
        .getgeo = aoeblk_getgeo,
        .owner = THIS_MODULE,
 };
@@ -268,9 +268,13 @@ aoeblk_gdalloc(void *vp)
                goto err_disk;
        }
 
-       blk_queue_make_request(&d->blkq, aoeblk_make_request);
-       if (bdi_init(&d->blkq.backing_dev_info))
+       d->blkq = blk_alloc_queue(GFP_KERNEL);
+       if (!d->blkq)
                goto err_mempool;
+       blk_queue_make_request(d->blkq, aoeblk_make_request);
+       d->blkq->backing_dev_info.name = "aoe";
+       if (bdi_init(&d->blkq->backing_dev_info))
+               goto err_blkq;
        spin_lock_irqsave(&d->lock, flags);
        gd->major = AOE_MAJOR;
        gd->first_minor = d->sysminor * AOE_PARTITIONS;
@@ -280,7 +284,7 @@ aoeblk_gdalloc(void *vp)
        snprintf(gd->disk_name, sizeof gd->disk_name, "etherd/e%ld.%d",
                d->aoemajor, d->aoeminor);
 
-       gd->queue = &d->blkq;
+       gd->queue = d->blkq;
        d->gd = gd;
        d->flags &= ~DEVFL_GDALLOC;
        d->flags |= DEVFL_UP;
@@ -291,6 +295,9 @@ aoeblk_gdalloc(void *vp)
        aoedisk_add_sysfs(d);
        return;
 
+err_blkq:
+       blk_cleanup_queue(d->blkq);
+       d->blkq = NULL;
 err_mempool:
        mempool_destroy(d->bufpool);
 err_disk: