Linux Kernels

Btrfs: Handle writeback under high memory pressure better

This change “Btrfs: Handle writeback under high memory pressure better” (commit 015a739) in Linux kernel is authored by Chris Mason <chris.mason [at] oracle.com> on Mon Nov 26 16:15:16 2007 -0800.

Description of "Btrfs: Handle writeback under high memory pressure better"

The change “Btrfs: Handle writeback under high memory pressure better” introduces changes as follows.

Btrfs: Handle writeback under high memory pressure better

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

Linux kernel releases containing commit 015a739

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "Btrfs: Handle writeback under high memory pressure better"

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

 fs/btrfs/extent-tree.c |  2 +-
 fs/btrfs/extent_map.c  | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
 
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 39be6baccc36..3c00f967eccb 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -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;
 	}
 
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c
index a4e9096754fc..55f272c335c6 100644
--- a/fs/btrfs/extent_map.c
+++ b/fs/btrfs/extent_map.c
@@ -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;

The commit for this change in Linux stable tree is 015a739 (patch).

Last modified: 2020/01/11 09:26