ALSA: hda - Add new GPU codec ID 0x10de0083 to snd-hda
[linux-2.6-block.git] / block / ioctl.c
index 7a964d842913f92df4bbe7942f494f9cb8153e16..77f5d17779d6875d0595f23410cbd61116491450 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/gfp.h>
 #include <linux/blkpg.h>
 #include <linux/hdreg.h>
+#include <linux/badblocks.h>
 #include <linux/backing-dev.h>
 #include <linux/fs.h>
 #include <linux/blktrace_api.h>
@@ -422,6 +423,15 @@ bool blkdev_dax_capable(struct block_device *bdev)
                        || (bdev->bd_part->nr_sects % (PAGE_SIZE / 512)))
                return false;
 
+       /*
+        * If the device has known bad blocks, force all I/O through the
+        * driver / page cache.
+        *
+        * TODO: support finer grained dax error handling
+        */
+       if (disk->bb && disk->bb->count)
+               return false;
+
        return true;
 }
 
@@ -445,12 +455,12 @@ static int blkdev_daxset(struct block_device *bdev, unsigned long argp)
        if (arg && !blkdev_dax_capable(bdev))
                return -ENOTTY;
 
-       mutex_lock(&bdev->bd_inode->i_mutex);
+       inode_lock(bdev->bd_inode);
        if (bdev->bd_map_count == 0)
                inode_set_flags(bdev->bd_inode, arg, S_DAX);
        else
                rc = -EBUSY;
-       mutex_unlock(&bdev->bd_inode->i_mutex);
+       inode_unlock(bdev->bd_inode);
        return rc;
 }
 #else