Btrfs: Handle writeback under high memory pressure better
authorChris Mason <chris.mason@oracle.com>
Tue, 27 Nov 2007 00:15:16 +0000 (16:15 -0800)
committerChris Mason <chris.mason@oracle.com>
Thu, 25 Sep 2008 15:03:58 +0000 (11:03 -0400)
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/extent-tree.c
fs/btrfs/extent_map.c

index 39be6baccc36fa119efdec09d11f199faee9b24f..3c00f967eccb713d4fcb4ad8ce7e59f6c021bc5d 100644 (file)
@@ -961,7 +961,7 @@ static int find_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
 
        level = btrfs_header_level(root->node);
 
-       if (num_bytes >= 96 * 1024 * 1024 && hint_byte) {
+       if (num_bytes >= 32 * 1024 * 1024 && hint_byte) {
                data = BTRFS_BLOCK_GROUP_MIXED;
        }
 
index a4e9096754fc17706db05bc4184bfeee8ad8a40f..55f272c335c6ee9bc1e16ff34ea9b8ee8b570d13 100644 (file)
@@ -1861,13 +1861,25 @@ int extent_write_full_page(struct extent_map_tree *tree, struct page *page,
                          struct writeback_control *wbc)
 {
        int ret;
+       struct address_space *mapping = page->mapping;
        struct extent_page_data epd = {
                .bio = NULL,
                .tree = tree,
                .get_extent = get_extent,
        };
+       struct writeback_control wbc_writepages = {
+               .bdi            = wbc->bdi,
+               .sync_mode      = WB_SYNC_NONE,
+               .older_than_this = NULL,
+               .nr_to_write    = 64,
+               .range_start    = page_offset(page) + PAGE_CACHE_SIZE,
+               .range_end      = (loff_t)-1,
+       };
+
 
        ret = __extent_writepage(page, wbc, &epd);
+
+       write_cache_pages(mapping, &wbc_writepages, __extent_writepage, &epd);
        if (epd.bio)
                submit_one_bio(WRITE, epd.bio);
        return ret;