aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_map.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-11-20 13:44:45 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:58 -0400
commit7073c8e852946274e4d50fdf072438612f9dc845 (patch)
tree4e2a1e366aeb0903504c77fef36d7f21eb7add38 /fs/btrfs/extent_map.c
parent3e9fd94ff0028a044d55690eb0a801fd1472e3c6 (diff)
Btrfs: Make sure page mapping dirty tag is properly cleared
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
-rw-r--r--fs/btrfs/extent_map.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index 7fd4eb7a8f03..a4e9096754fc 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -1825,12 +1825,18 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
1825 if (ret) 1825 if (ret)
1826 SetPageError(page); 1826 SetPageError(page);
1827 else { 1827 else {
1828 unsigned long nr = end_index + 1; 1828 unsigned long max_nr = end_index + 1;
1829 set_range_writeback(tree, cur, cur + iosize - 1); 1829 set_range_writeback(tree, cur, cur + iosize - 1);
1830 if (!PageWriteback(page)) {
1831 printk("warning page %lu not writeback, "
1832 "cur %llu end %llu\n", page->index,
1833 (unsigned long long)cur,
1834 (unsigned long long)end);
1835 }
1830 1836
1831 ret = submit_extent_page(WRITE, tree, page, sector, 1837 ret = submit_extent_page(WRITE, tree, page, sector,
1832 iosize, page_offset, bdev, 1838 iosize, page_offset, bdev,
1833 &epd->bio, nr, 1839 &epd->bio, max_nr,
1834 end_bio_extent_writepage); 1840 end_bio_extent_writepage);
1835 if (ret) 1841 if (ret)
1836 SetPageError(page); 1842 SetPageError(page);
@@ -1840,6 +1846,11 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
1840 nr++; 1846 nr++;
1841 } 1847 }
1842done: 1848done:
1849 if (nr == 0) {
1850 /* make sure the mapping tag for page dirty gets cleared */
1851 set_page_writeback(page);
1852 end_page_writeback(page);
1853 }
1843 unlock_extent(tree, start, page_end, GFP_NOFS); 1854 unlock_extent(tree, start, page_end, GFP_NOFS);
1844 unlock_page(page); 1855 unlock_page(page);
1845 return 0; 1856 return 0;
@@ -2408,6 +2419,13 @@ int clear_extent_buffer_dirty(struct extent_map_tree *tree,
2408 } 2419 }
2409 } 2420 }
2410 clear_page_dirty_for_io(page); 2421 clear_page_dirty_for_io(page);
2422 write_lock_irq(&page->mapping->tree_lock);
2423 if (!PageDirty(page)) {
2424 radix_tree_tag_clear(&page->mapping->page_tree,
2425 page_index(page),
2426 PAGECACHE_TAG_DIRTY);
2427 }
2428 write_unlock_irq(&page->mapping->tree_lock);
2411 unlock_page(page); 2429 unlock_page(page);
2412 } 2430 }
2413 return 0; 2431 return 0;