Re: [PATCH] btrfs: write-protect folios during data writeback

Qu Wenruo <[email protected]>
Newsgroups org.kernel.vger.linux-btrfs
Message-ID <[email protected]>

在 2026/7/10 02:48, Boris Burkov 写道:
> On Thu, Jul 09, 2026 at 06:16:55PM +0930, Qu Wenruo wrote:
[...]
>>
>> In that case, as I mentioned in another thread, I'd prefer not to call
>> folio_mkclean() too early.
>>
>> I'd prefer to call folio_mkclean() inside extent_range_clear_dirty_for_io()
>> instead.
> 
> The idea is the zoned folios submitted by run_delalloc_range with
> pages_dirty=true. Only the one main folio will be cleaned in
> extent_writepage but several get submitted in this loop while locked
> (which is asserted by the pages_dirty check).
> 
> So assuming we want to clean those folios (which I think we do)
> then we need:
> extent_writepage (main one covers usual large folios and inline)
> extent_range_clear_dirty_for_io (covers compression stability)
> extent_write_locked_range pages_dirty = true (zoned batch)
> 
> lock_delalloc_folios() covers the last two in a single more
> principled way, IMO.

Oh I forgot zoned cases. In that case indeed lock_delalloc_folios() is 
the location that covers all.

Then the code looks good to me now.

Thanks,
Qu

> 
> I am still making sure all of this reproduces exactly as I understand
> it, though, to be as convincing as possible :)
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.