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

Boris Burkov <[email protected]> Thu, 23 Jul 2026 08:40:22 -0700
Newsgroups org.kernel.vger.linux-btrfs
Message-ID <[email protected]>
On Thu, Jul 23, 2026 at 04:02:27PM +0200, Johannes Thumshirn wrote:
> 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?
> 

100% fine to fix without going crazy removing EBUSY or whatever. Sorry
for holding you up on that, I just found the problem interesting.

All else being equal, I would *prefer* to not have the eb submit loop
totally duplicated even in the short term fix. But again, OK with
whatever you need to land to unbreak things.

Thanks,
Boris