Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Leo Martins <loemra.dev@gmail.com>
To: "Chris Murphy" <lists@colorremedies.com>
Cc: "Boris Burkov" <boris@bur.io>,
	kernel-team@fb.com, "Btrfs BTRFS" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs: make periodic dynamic reclaim the default for data
Date: Tue, 21 Oct 2025 15:39:56 -0700	[thread overview]
Message-ID: <20251021224005.1087028-1-loemra.dev@gmail.com> (raw)
In-Reply-To: <4c595af2-f06e-4957-9f08-67a78609901c@app.fastmail.com>

On Tue, 21 Oct 2025 14:52:31 -0400 "Chris Murphy" <lists@colorremedies.com> wrote:

> >Tue, 15 Jul 2025 11:58:24 -0700
> https://lore.kernel.org/linux-btrfs/52b863849f0dd63b3d25a29c8a830a09c748d86b.1752605888.git.boris@bur.io/
> 
> Fedora is interested in this enhancement. Any idea when it could be merged or if there are any outstanding concerns?
> 
> In particular, I like the lack of knobs. It's either on or off. And it has no effect until unallocated space drops below 10G means it's super lightweight, affecting only users likely to end up in related corner cases.
> 
> Fedora isn't installing btrfsmaintenance by default. We do see infrequent cases of premature or misallocation out of space. It would be nice to have this "it does nothing until" type solution enabled by default, if it's ready.
> 
> Thanks,
> 
> --
> Chris Murphy

Wanted to provide some data from the Meta rollout to give more context on the
decision to enable dynamic+periodic reclaim by default for data. All the before
numbers are with bg_reclaim_threshold set to 30.

Enabling dynamic+periodic reclaim for data block groups dramatically decreases
number of reclaims per host, going from 150/day to just 5/day (p99), and from
6/day to 0/day (p50). The trade-offs are increases in fragmentation, and a
slight uptick in enospcs.

I currently don't have direct fragmentation metrics, though that is a
work in progress, but I'm tracking FP as a proxy for fragmentation.

FP = (allocated - used) / allocated
So if there are 100G allocated for data and 80G are used, FP = (100 - 80) / 100 = 20%.

FP has increased from 30% to 45% (p99), and from 5% to 7% (p50).
Enospc rates have gone from around 0.5/day to 1/day per 100k hosts.
This is a doubling in rate, but still a very small absolute number
of enospcs. The unallocated space on disk decreases by ~15G (p99)
and ~5G (p50) after rollout.

Though fragmentation increases and unallocated space decreases the
very small increase in enospcs suggests that this is a worthwhile
tradeoff.

One concern I still have is that replacing the aggressive
bg_reclaim_threshold for the conservative dynamic+periodic reclaim
will lead filesystems to slowly trend toward an "unhealthy" state of
high fragmentation and dynamic+periodic reclaim will only do enough
to keep the filesystem alive, but not enough to make it "healthy" again.
So far, the data indicates these concerns are unfounded as
FP and unallocated space seem to stabilize after their initial changes,
but I'll follow up if anything changes.

That being said I don't think bg_reclaim_threshold is enabled by default,
and I am comfortable saying dynamic+periodic reclaim is better than no
automatic reclaim!

Thanks,
Leo Martins.

  reply	other threads:[~2025-10-21 22:40 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
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 [this message]
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=20251021224005.1087028-1-loemra.dev@gmail.com \
    --to=loemra.dev@gmail.com \
    --cc=boris@bur.io \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=lists@colorremedies.com \
    /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