From: Sun Yangkai <sunk67188@gmail.com>
To: Boris Burkov <boris@bur.io>
Cc: kernel-team@fb.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: make periodic dynamic reclaim the default for data
Date: Tue, 30 Dec 2025 09:29:57 +0800 [thread overview]
Message-ID: <b23c8a4c-7945-4d49-8f1a-2687e2d7aea4@gmail.com> (raw)
In-Reply-To: <aVMWI7bVCZX4RAAa@devvm12410.ftw0.facebook.com>
在 2025/12/30 08:00, Boris Burkov 写道:
> On Fri, Dec 26, 2025 at 11:07:28AM +0800, Sun Yangkai wrote:
>> Hi Boris,
>
> First off, sorry for not replying promptly. I've been in and out of the
> office around the holidays.
>
>>
>> Thank you for bring such a feature for btrfs. I love it a lot and try to enable
>> it on my machine.
>
> I really appreciate your kind words and your interest in the feature.
> Thank you!
>
>>
>> But I've get into some unexpected behavior when periodic dynamic reclaim is
>> enabled and the filesystem is nearly full.
>
> Oops! Let's debug it :)
>
>>
>> [12月26 10:41] [T20373] BTRFS info (device sda): relocating block group
>> 5214541578240 flags data
>> [ +0.012446] [T20373] BTRFS error (device sda): error relocating chunk
>> 5214541578240
>> [ +0.000033] [T20373] BTRFS info (device sda): relocating block group
>> 4540021997568 flags data
>> [ +0.008927] [T20373] BTRFS error (device sda): error relocating chunk
>> 4540021997568
>> [ +0.000025] [T20373] BTRFS info (device sda): relocating block group
>> 5606746750976 flags data
>> [12月26 10:42] [T20373] BTRFS error (device sda): error relocating chunk
>> 5606746750976
>> [12月26 10:47] [T12072] BTRFS info (device sda): relocating block group
>> 5606746750976 flags data
>> [ +3.960400] [T12072] BTRFS error (device sda): error relocating chunk
>> 5606746750976
>> [12月26 10:52] [ T7643] BTRFS info (device sda): relocating block group
>> 5606746750976 flags data
>> [ +3.960314] [ T7643] BTRFS error (device sda): error relocating chunk
>> 5606746750976
>> [12月26 10:57] [T20373] BTRFS info (device sda): relocating block group
>> 5606746750976 flags data
>> [ +3.954485] [T20373] BTRFS error (device sda): error relocating chunk
>> 5606746750976
>> [12月26 11:02] [ T7701] BTRFS info (device sda): relocating block group
>> 5606746750976 flags data
>> [ +4.561796] [ T7701] BTRFS error (device sda): error relocating chunk
>> 5606746750976
>>
>> I guess the condition of when the periodic reclaim should happen is unpolished.
>
> Yeah, it looks like it is triggering too frequently in conditions where
> it isn't likely to succeed. Hopefully we can tune up the heuristics (or
> just fix the bug you found) and it works better.
>
> It seems to be triggering every 5 minutes or so, right? Is that the
> interval of the cleaner thread running on your system? Or am I
> misinterpreting the time stamps? I would normally expect the default of
> 30s.
Yes, my system has commit=300. It was set years ago when I knew almost nothing
about btrfs and not changed since then.
>>
>> I'm still digging further into it.
>
> Were you able to confirm whether that negative reclaimable_bytes bug was
> the root cause here?
Yes. After changing chunk_sz to s64, this will not triggered anymore. However,
periodic also does not work properly.
> If you aren't able to reproduce but it is still happening on one of your
> systems, we can try to instrument the periodic reclaim lifecycle with
> bpftrace to catch calls to the various important functions setting it
> reclaimable, etc.
Thank you for your advice. That's what I've done and how I find the unexpected
behavior. It's really a good tool to know what's happening in kernel.
> Please let me know if I can assist you with that, or if you do have a
> reproducer I could also look at.
I've redesigned the logic and iterated some versions. I'll cleanup my code and
send the patches later. Maybe later today or tomorrow. It's not perfect, but I
hope it will be better than what we have now.
Thanks,
Sun YangKai
next prev parent reply other threads:[~2025-12-30 1:30 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
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 [this message]
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=b23c8a4c-7945-4d49-8f1a-2687e2d7aea4@gmail.com \
--to=sunk67188@gmail.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