Btrfs: Fine tune the btree writeback exclusion some more
authorChris Mason <chris.mason@oracle.com>
Tue, 27 Nov 2007 15:52:01 +0000 (07:52 -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/disk-io.c
fs/btrfs/file.c

index 8a74f90..de05525 100644 (file)
@@ -214,6 +214,10 @@ static int btree_writepages(struct address_space *mapping,
                u64 num_dirty;
                u64 start = 0;
                unsigned long thresh = 96 * 1024 * 1024;
+
+               if (wbc->for_kupdate)
+                       return 0;
+
                num_dirty = count_range_bits(tree, &start, thresh, EXTENT_DIRTY);
                if (num_dirty < thresh) {
                        return 0;
index 9dd2c5c..ba624ae 100644 (file)
@@ -767,7 +767,8 @@ static ssize_t btrfs_file_write(struct file *file, const char __user *buf,
                num_written += write_bytes;
 
                balance_dirty_pages_ratelimited_nr(inode->i_mapping, num_pages);
-               btrfs_btree_balance_dirty(root, 1);
+               if (num_pages < (root->leafsize >> PAGE_CACHE_SHIFT) + 1)
+                       btrfs_btree_balance_dirty(root, 1);
                cond_resched();
        }
        mutex_unlock(&inode->i_mutex);