Merge remote-tracking branch 'torvalds/master' into perf/urgent
[linux-2.6-microblaze.git] / drivers / block / loop.c
index 578fc03..d58d68f 100644 (file)
@@ -53,6 +53,7 @@
 #include <linux/moduleparam.h>
 #include <linux/sched.h>
 #include <linux/fs.h>
+#include <linux/pagemap.h>
 #include <linux/file.h>
 #include <linux/stat.h>
 #include <linux/errno.h>
@@ -663,7 +664,7 @@ static inline int is_loop_device(struct file *file)
 {
        struct inode *i = file->f_mapping->host;
 
-       return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
+       return i && S_ISBLK(i->i_mode) && imajor(i) == LOOP_MAJOR;
 }
 
 static int loop_validate_file(struct file *file, struct block_device *bdev)
@@ -1212,6 +1213,9 @@ static int __loop_clr_fd(struct loop_device *lo, bool release)
                goto out_unlock;
        }
 
+       if (test_bit(QUEUE_FLAG_WC, &lo->lo_queue->queue_flags))
+               blk_queue_write_cache(lo->lo_queue, false, false);
+
        /* freeze request queue during the transition */
        blk_mq_freeze_queue(lo->lo_queue);