Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/x86
[powerpc.git] / drivers / md / bitmap.c
index 519b1bf..eae4473 100644 (file)
@@ -200,7 +200,7 @@ out:
 /* if page is completely empty, put it back on the free list, or dealloc it */
 /* if page was hijacked, unmark the flag so it might get alloced next time */
 /* Note: lock should be held when calling this */
-static inline void bitmap_checkfree(struct bitmap *bitmap, unsigned long page)
+static void bitmap_checkfree(struct bitmap *bitmap, unsigned long page)
 {
        char *ptr;
 
@@ -315,6 +315,8 @@ static int write_page(struct bitmap *bitmap, struct page *page, int wait)
        if (bitmap->file == NULL)
                return write_sb_page(bitmap->mddev, bitmap->offset, page, wait);
 
+       flush_dcache_page(page); /* make sure visible to anyone reading the file */
+
        if (wait)
                lock_page(page);
        else {
@@ -485,12 +487,12 @@ static int bitmap_read_sb(struct bitmap *bitmap)
        else if (le32_to_cpu(sb->version) < BITMAP_MAJOR_LO ||
                 le32_to_cpu(sb->version) > BITMAP_MAJOR_HI)
                reason = "unrecognized superblock version";
-       else if (chunksize < 512 || chunksize > (1024 * 1024 * 4))
-               reason = "bitmap chunksize out of range (512B - 4MB)";
+       else if (chunksize < PAGE_SIZE)
+               reason = "bitmap chunksize too small";
        else if ((1 << ffz(~chunksize)) != chunksize)
                reason = "bitmap chunksize not a power of 2";
-       else if (daemon_sleep < 1 || daemon_sleep > 15)
-               reason = "daemon sleep period out of range (1-15s)";
+       else if (daemon_sleep < 1 || daemon_sleep > MAX_SCHEDULE_TIMEOUT / HZ)
+               reason = "daemon sleep period out of range";
        else if (write_behind > COUNTER_MAX)
                reason = "write-behind limit out of range (0 - 16383)";
        if (reason) {
@@ -626,8 +628,7 @@ static void bitmap_file_unmap(struct bitmap *bitmap)
        kfree(map);
        kfree(attr);
 
-       if (sb_page)
-               put_page(sb_page);
+       safe_put_page(sb_page);
 }
 
 static void bitmap_stop_daemon(struct bitmap *bitmap);