Linux Kernels

Btrfs: Fine tune the btree writeback exclusion some more

This change “Btrfs: Fine tune the btree writeback exclusion some more” (commit 448d640) in Linux kernel is authored by Chris Mason <chris.mason [at] oracle.com> on Tue Nov 27 07:52:01 2007 -0800.

Description of "Btrfs: Fine tune the btree writeback exclusion some more"

The change “Btrfs: Fine tune the btree writeback exclusion some more” introduces changes as follows.

Btrfs: Fine tune the btree writeback exclusion some more

Signed-off-by: Chris Mason <chris.mason@oracle.com>

Linux kernel releases containing commit 448d640

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "Btrfs: Fine tune the btree writeback exclusion some more"

There are 7 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 fs/btrfs/disk-io.c | 4 ++++
 fs/btrfs/file.c    | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)
 
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 8a74f9027d65..de0552532d23 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -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;
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 9dd2c5c23b56..ba624ae16e61 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -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);

The commit for this change in Linux stable tree is 448d640 (patch).

Last modified: 2020/01/11 09:41