Btrfs: Fix releasepage to properly keep dirty and writeback pages
authorChris Mason <chris.mason@oracle.com>
Thu, 11 Sep 2008 19:51:43 +0000 (15:51 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:04:07 +0000 (11:04 -0400)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/disk-io.c
fs/btrfs/inode.c

index 42bf99168056ad70562a1c293fea45215d40f9ef..ecb74b7202627902cc77a1786992af37628a3012 100644 (file)
@@ -346,7 +346,7 @@ int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,
        eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS);
 
        found_start = btrfs_header_bytenr(eb);
-       if (found_start != start) {
+       if (0 && found_start != start) {
                printk("bad tree block start %llu %llu\n",
                       (unsigned long long)found_start,
                       (unsigned long long)eb->start);
@@ -592,6 +592,9 @@ static int btree_releasepage(struct page *page, gfp_t gfp_flags)
        struct extent_map_tree *map;
        int ret;
 
+       if (PageWriteback(page) || PageDirty(page))
+           return 0;
+
        tree = &BTRFS_I(page->mapping->host)->io_tree;
        map = &BTRFS_I(page->mapping->host)->extent_tree;
 
index 073fdd77c7848f7ec67168c8498a93a03f0d0ffb..24b7e97fccb9145a1d4d22876d9a89f23f4b8de3 100644 (file)
@@ -3060,6 +3060,8 @@ static int __btrfs_releasepage(struct page *page, gfp_t gfp_flags)
 
 static int btrfs_releasepage(struct page *page, gfp_t gfp_flags)
 {
+       if (PageWriteback(page) || PageDirty(page))
+               return 0;
        return __btrfs_releasepage(page, gfp_flags);
 }