]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/block/aoe/aoeblk.c
block: autoconvert trivial BKL users to private mutex
[net-next-2.6.git] / drivers / block / aoe / aoeblk.c
index 035cefe4045ae76f076f3d56a85b058c3bb68fc7..f21c237a9e5e124a07c205c9770379831df6d8a4 100644 (file)
 #include <linux/slab.h>
 #include <linux/genhd.h>
 #include <linux/netdevice.h>
+#include <linux/mutex.h>
 #include "aoe.h"
 
+static DEFINE_MUTEX(aoeblk_mutex);
 static struct kmem_cache *buf_pool_cache;
 
 static ssize_t aoedisk_show_state(struct device *dev,
@@ -124,13 +126,16 @@ aoeblk_open(struct block_device *bdev, fmode_t mode)
        struct aoedev *d = bdev->bd_disk->private_data;
        ulong flags;
 
+       mutex_lock(&aoeblk_mutex);
        spin_lock_irqsave(&d->lock, flags);
        if (d->flags & DEVFL_UP) {
                d->nopen++;
                spin_unlock_irqrestore(&d->lock, flags);
+               mutex_unlock(&aoeblk_mutex);
                return 0;
        }
        spin_unlock_irqrestore(&d->lock, flags);
+       mutex_unlock(&aoeblk_mutex);
        return -ENODEV;
 }
 
@@ -173,7 +178,7 @@ 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)) {
+       } else if (bio->bi_rw & REQ_HARDBARRIER) {
                bio_endio(bio, -EOPNOTSUPP);
                return 0;
        } else if (bio->bi_io_vec == NULL) {