[IA64] Fix large MCA bootmem allocation
[sfrench/cifs-2.6.git] / drivers / block / rd.c
index 08176d23a46cd421690aca1d13a2edecf1499b71..06e23be70904423afc8e6646832eeda664aa5484 100644 (file)
@@ -56,6 +56,7 @@
 #include <linux/backing-dev.h>
 #include <linux/blkpg.h>
 #include <linux/writeback.h>
+#include <linux/log2.h>
 
 #include <asm/uaccess.h>
 
@@ -189,6 +190,18 @@ static int ramdisk_set_page_dirty(struct page *page)
        return 0;
 }
 
+/*
+ * releasepage is called by pagevec_strip/try_to_release_page if
+ * buffers_heads_over_limit is true. Without a releasepage function
+ * try_to_free_buffers is called instead. That can unset the dirty
+ * bit of our ram disk pages, which will be eventually freed, even
+ * if the page is still in use.
+ */
+static int ramdisk_releasepage(struct page *page, gfp_t dummy)
+{
+       return 0;
+}
+
 static const struct address_space_operations ramdisk_aops = {
        .readpage       = ramdisk_readpage,
        .prepare_write  = ramdisk_prepare_write,
@@ -196,6 +209,7 @@ static const struct address_space_operations ramdisk_aops = {
        .writepage      = ramdisk_writepage,
        .set_page_dirty = ramdisk_set_page_dirty,
        .writepages     = ramdisk_writepages,
+       .releasepage    = ramdisk_releasepage,
 };
 
 static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec, sector_t sector,
@@ -365,7 +379,7 @@ static int rd_open(struct inode *inode, struct file *filp)
                /*
                 * Deep badness.  rd_blkdev_pagecache_IO() needs to allocate
                 * pagecache pages within a request_fn.  We cannot recur back
-                * into the filesytem which is mounted atop the ramdisk, because
+                * into the filesystem which is mounted atop the ramdisk, because
                 * that would deadlock on fs locks.  And we really don't want
                 * to reenter rd_blkdev_pagecache_IO when we're already within
                 * that function.
@@ -437,7 +451,7 @@ static int __init rd_init(void)
        err = -ENOMEM;
 
        if (rd_blocksize > PAGE_SIZE || rd_blocksize < 512 ||
-                       (rd_blocksize & (rd_blocksize-1))) {
+                       !is_power_of_2(rd_blocksize)) {
                printk("RAMDISK: wrong blocksize %d, reverting to defaults\n",
                       rd_blocksize);
                rd_blocksize = BLOCK_SIZE;