summarylogtreecommitdiffstats
path: root/0005-btrfs-Fix-500-2000-performance-regression-w-5.10.patch
diff options
context:
space:
mode:
authorgraysky2021-01-04 13:03:39 -0500
committergraysky2021-01-04 13:03:39 -0500
commitd5d93117cf1627bffcf79f9d756787ef3331870f (patch)
tree919ffc0501647852d1b71dc307af10e2ce54c70c /0005-btrfs-Fix-500-2000-performance-regression-w-5.10.patch
parentc31e8674d62205151c226329c0700b6a297012ef (diff)
downloadaur-d5d93117cf1627bffcf79f9d756787ef3331870f.tar.gz
Update to 5.10.5rc1-1
Diffstat (limited to '0005-btrfs-Fix-500-2000-performance-regression-w-5.10.patch')
-rw-r--r--0005-btrfs-Fix-500-2000-performance-regression-w-5.10.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/0005-btrfs-Fix-500-2000-performance-regression-w-5.10.patch b/0005-btrfs-Fix-500-2000-performance-regression-w-5.10.patch
new file mode 100644
index 00000000000..c4bdae79103
--- /dev/null
+++ b/0005-btrfs-Fix-500-2000-performance-regression-w-5.10.patch
@@ -0,0 +1,61 @@
+From 0128c7314a4d856461caacfdd528a7bffa03d41e Mon Sep 17 00:00:00 2001
+From: Josef Bacik <josef@toxicpanda.com>
+Date: Wed, 23 Dec 2020 14:41:00 -0500
+Subject: [PATCH 5/8] btrfs: Fix 500-2000% performance regression w/ 5.10
+
+Josef's tentative fix from
+https://lore.kernel.org/linux-btrfs/0382080a1836a12c2d625f8a5bf899828eba204b.1608752315.git.josef@toxicpanda.com/
+
+With the conflict fix mentioned in the reply.
+
+For https://bugs.archlinux.org/task/69077
+---
+ fs/btrfs/space-info.c | 25 ++++++++++++++++++++++++-
+ 1 file changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
+index 64099565ab8f..8a1ce11b6ed8 100644
+--- a/fs/btrfs/space-info.c
++++ b/fs/btrfs/space-info.c
+@@ -480,6 +480,28 @@ static inline u64 calc_reclaim_items_nr(struct btrfs_fs_info *fs_info,
+
+ #define EXTENT_SIZE_PER_ITEM SZ_256K
+
++static void btrfs_writeback_inodes_sb_nr(struct btrfs_fs_info *fs_info,
++ unsigned long nr_pages, u64 nr_items)
++{
++ struct super_block *sb = fs_info->sb;
++
++ if (down_read_trylock(&sb->s_umount)) {
++ writeback_inodes_sb_nr(sb, nr_pages, WB_REASON_FS_FREE_SPACE);
++ up_read(&sb->s_umount);
++ } else {
++ /*
++ * We needn't worry the filesystem going from r/w to r/o though
++ * we don't acquire ->s_umount mutex, because the filesystem
++ * should guarantee the delalloc inodes list be empty after
++ * the filesystem is readonly(all dirty pages are written to
++ * the disk).
++ */
++ btrfs_start_delalloc_roots(fs_info, nr_items);
++ if (!current->journal_info)
++ btrfs_wait_ordered_roots(fs_info, nr_items, 0, (u64)-1);
++ }
++}
++
+ /*
+ * shrink metadata reservation for delalloc
+ */
+@@ -532,7 +554,8 @@ static void shrink_delalloc(struct btrfs_fs_info *fs_info,
+
+ loops = 0;
+ while ((delalloc_bytes || dio_bytes) && loops < 3) {
+- btrfs_start_delalloc_roots(fs_info, items);
++ unsigned long nr_pages = min(delalloc_bytes, to_reclaim) >> PAGE_SHIFT;
++ btrfs_writeback_inodes_sb_nr(fs_info, nr_pages, items);
+
+ loops++;
+ if (wait_ordered && !trans) {
+--
+2.30.0
+