From: Josef Bacik Date: Wed, 11 Aug 2021 18:37:15 +0000 (-0400) Subject: btrfs: reduce the preemptive flushing threshold to 90% X-Git-Tag: v5.13.19~375 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a86481075fc3b6b70b297bf2bd1235353df313c5;p=thirdparty%2Fkernel%2Fstable.git btrfs: reduce the preemptive flushing threshold to 90% commit 93c60b17f2b5fca2c5931d7944788d1ef5f25528 upstream. The preemptive flushing code was added in order to avoid needing to synchronously wait for ENOSPC flushing to recover space. Once we're almost full however we can essentially flush constantly. We were using 98% as a threshold to determine if we were simply full, however in practice this is a really high bar to hit. For example reports of systems running into this problem had around 94% usage and thus continued to flush. Fix this by lowering the threshold to 90%, which is a more sane value, especially for smaller file systems. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=212185 CC: stable@vger.kernel.org # 5.12+ Fixes: 576fa34830af ("btrfs: improve preemptive background space flushing") Signed-off-by: Josef Bacik Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index 5e1de8f197d6d..088220539788c 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -833,7 +833,7 @@ static bool need_preemptive_reclaim(struct btrfs_fs_info *fs_info, struct btrfs_space_info *space_info) { u64 ordered, delalloc; - u64 thresh = div_factor_fine(space_info->total_bytes, 98); + u64 thresh = div_factor_fine(space_info->total_bytes, 90); u64 used; /* If we're just plain full then async reclaim just slows us down. */