Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1545002pxb; Thu, 16 Sep 2021 09:37:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8mcpUS31+DO4a5NKGeBn7IdeqpkHncbCs2OrfcmsBAtaFrvAUrZ3Pj31jfAtTT13U9Fyi X-Received: by 2002:a05:6602:1696:: with SMTP id s22mr5231821iow.198.1631810246181; Thu, 16 Sep 2021 09:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631810246; cv=none; d=google.com; s=arc-20160816; b=c6YMVgZnM6iXutxIWdkslP4UERmICpLTO+f18c+WXv8SQFjG8I+xwjDyrJ23pt1seW HUBfsd7d7O1d4gJPEstCM43ayYe2Xf+uu23BlvnZmCKjyRjuLKvJHuRflbvM+ZbP6joR VIuXTMURlAzU4lANCQGsfQk/TqHYB+ux8nG2qNUCve1PhmL1Zlv4u1mt+GKoFCxfU4nF 3W+qSHp6EjTmGoye+4w5IPAFk9K4V1lZIi/P2mysP498H+HpvhQFqDPT4Gh6xahw8wqH 3LdBtCr68zOhMa6mnP5uD02d5+dn7kAEjz5nLeHvlCOkEptMBt+hrc3RRoLWCJQjE2Lb G3Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZD5felUNagP15P0GvGQr8w+1l/SxIxaKK1fPlk44TEs=; b=lTLgaiy2MZK+SjkIUrldjNwhW60+RbzWjn/rr7X73Bn49kwl8FNXpqC+mgANbknkUL v9TiV6Tc1qapxh34UgFzp23lUncs6DKmsS0J2jx3UZw+V9PrZDW8Esq8+HbWSeBNA1lS F25ELxx0qrTgHL9ZROfG2IoZm+ISDOrffqtERJeqU4w++nY/CeRPZecuqnc4jGul+lSw lb5V2JN2bwssV5HOO6e58RwEd7AflAiDvUWjSmwCXMnAPSS1nLHlJf/OQetUbihfPpt8 erWCrZUqAYqUQ5u/FMHeSzv/iZA0MQADk/JbY63MUuZtD9FBgaEbknbMbeEz5K59qteD 1h1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="t/XLCGKJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m12si3106671ioj.96.2021.09.16.09.37.14; Thu, 16 Sep 2021 09:37:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="t/XLCGKJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243893AbhIPQgm (ORCPT + 99 others); Thu, 16 Sep 2021 12:36:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:37488 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242011AbhIPQ3K (ORCPT ); Thu, 16 Sep 2021 12:29:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5500961374; Thu, 16 Sep 2021 16:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809101; bh=jbOO3JcidD+lx7f+8W+lPisLandk7RIrf28oPf5Cp5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t/XLCGKJqAmPC6EzDYSNvdYHBAsA4JStBahcdpb+YhH1RX+dDE3xRt4HskVBtIInf xaFzRqqX+Kx1kwJ0OC/Wf3IcR4b6yxkQkNHeiJHsg233dy5+KXxqvfkRdfG4QtQKRb iu+uyNE10JlmYZ7nrSpRyiZPoiDoltVLKqGLEywE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , David Sterba Subject: [PATCH 5.13 004/380] btrfs: reduce the preemptive flushing threshold to 90% Date: Thu, 16 Sep 2021 17:56:01 +0200 Message-Id: <20210916155804.123739709@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik 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 --- fs/btrfs/space-info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -833,7 +833,7 @@ static bool need_preemptive_reclaim(stru 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. */