Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: Boris Burkov <boris@bur.io>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	"kernel-team@fb.com" <kernel-team@fb.com>
Subject: Re: [PATCH] btrfs: make periodic dynamic reclaim the default for data
Date: Wed, 16 Jul 2025 06:24:05 +0000	[thread overview]
Message-ID: <df3f4610-cd32-4897-8172-5fe8b6a9b281@wdc.com> (raw)
In-Reply-To: <52b863849f0dd63b3d25a29c8a830a09c748d86b.1752605888.git.boris@bur.io>

On 15.07.25 20:57, Boris Burkov wrote:
> The explanation of the feature is linked via the original patches.
> But tl;dr: dynamic periodic reclaim for data is a way to get a lot of
> extra protection from block group mis-allocation ENOSPC without
> incurring a lot of reclaims in the happy, steady state case.
> 
> We have tested it extensively in production at Meta and are quite
> satisfied with its behavior as opposed to an edge triggered
> bg_reclaim_threshold set to 25. The latter did well in reducing our
> ENOSPCs but at the cost of a LOT of reclaiming. And often excessive
> seemingly unbounded reclaiming.
> 
> With dynamic periodic reclaim, if the system is below 10G unallocated
> space, then the cleaner thread will identify the best block groups to
> reclaim to get us back to 10G. It will get progressively more aggressive
> as unallocated trends towards 0. It will perform no reclaims when
> unallocated is above 10G.
> 
> With its by-design conservative approach to reclaiming and good track
> record in datacenter testing, I think it is time to introduce automatic
> data block group reclaim to btrfs. This does not conflict with the use
> of the tools in btrfs_maintenance. One thing to look out for is that the
> bg_reclaim_threshold setting is no longer writeable once the dynamic
> threshold is enabled, and instead is a read-only file representing the
> current snapshot of the dynamic threshold.
> 
> To disable either of these features, simply write a 0 to
> /sys/fs/btrfs/<uuid>/allocation/data/(dynamic_reclaim|periodic_reclaim)
> 
> Link: https://lore.kernel.org/linux-btrfs/cover.1718665689.git.boris@bur.io/#t
> Signed-off-by: Boris Burkov <boris@bur.io>
> ---
>   fs/btrfs/space-info.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
> index 0481c693ac2e..8005483fbfe2 100644
> --- a/fs/btrfs/space-info.c
> +++ b/fs/btrfs/space-info.c
> @@ -306,6 +306,12 @@ static int create_space_info(struct btrfs_fs_info *info, u64 flags)
>   
>   		if (ret)
>   			return ret;
> +	} else {

Why else? If I'm not completely blind I can't see a reason for it.
I'm running it without 'else' part through our perf test because it's 
stressing reclaim quite a bit. We'll know more in ~7h.



> +		if ((flags & BTRFS_BLOCK_GROUP_DATA) &&
> +		    !(flags & BTRFS_BLOCK_GROUP_METADATA)) {
> +			space_info->dynamic_reclaim = 1;
> +			space_info->periodic_reclaim = 1;
> +		}
>   	}
>   
>   	ret = btrfs_sysfs_add_space_info_type(info, space_info);


  reply	other threads:[~2025-07-16  6:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-15 18:58 [PATCH] btrfs: make periodic dynamic reclaim the default for data Boris Burkov
2025-07-16  6:24 ` Johannes Thumshirn [this message]
2025-07-16 15:56   ` Boris Burkov
2025-07-17 12:55     ` Johannes Thumshirn
2025-10-21 18:52 ` Chris Murphy
2025-10-21 22:39   ` Leo Martins
2025-10-22  0:37     ` Chris Murphy
2025-10-22  1:02       ` Boris Burkov
2025-10-23 23:27         ` Leo Martins
2025-12-13 22:09           ` Neal Gompa
2025-12-26  3:07 ` Sun Yangkai
2025-12-30  0:00   ` Boris Burkov
2025-12-30  1:29     ` Sun Yangkai
2025-12-30  1:41     ` Sun Yangkai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df3f4610-cd32-4897-8172-5fe8b6a9b281@wdc.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=boris@bur.io \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox