Re: [PATCH 1/4] btrfs: zoned: flush active metadata block group at btree_writepages() start

Johannes Thumshirn <[email protected]> Thu, 23 Jul 2026 16:02:27 +0200
Newsgroups org.kernel.vger.linux-btrfs
Message-ID <[email protected]>
On 7/22/26 9:01 PM, Boris Burkov wrote:
> Furthermore, I feel like this is actually quite redundant with the whole
> EBUSY pivot logic.
>
> So for random reclaim writeback, we walk the ebs in index order and skip
> any not in the active bg if the active bg has dirty ebs. Then we reach
> the active bg and flush it, submitting everything. Subsequent tries to
> writeback the non-active will now wait on that submitted IO and
> ultimately win and get to become active, and do more submission.
>
> But we could save the bother and make things more direct and simple if
> we just had btree_writepages() always write out the active bg first then
> the rest. I don't know if we could fully delete the EBUSY, though, maybe
> there is some racy case where it would still happen a bit, even if
> mostly it didn't?

I got a v2 with your comments (and Sashiko's) addressed. I can look into 
that as well, but that feels a bit more involved and we're seeing random 
hangs in our CI system due to these stalled folios and we have one 
report on the list because of the hole -EAGAIN, so I'd like to get it 
(hot-)fixed possibly in this cycle and take care about that once the 
hotfix is there.

How does that sound?