Re: [RFC PATCH] btrfs: trigger cow fixup via dirty_folio()

Qu Wenruo <[email protected]> Mon, 27 Jul 2026 15:01:32 +0930
Newsgroups org.kernel.vger.linux-btrfs
Message-ID <[email protected]>

在 2026/7/27 13:27, Boris Burkov 写道:
[...]
>> Shouldn't we also check if we have cleared the last fixup bit and clear the
>> folio fixup flag?
>> [...]
>>> +void btrfs_folio_cancel_fixup(const struct btrfs_fs_info *fs_info,
>>> +			      struct folio *folio, u64 start, u32 len)
>>
>> Why not let IMPLEMNT_BTRFS_PAGE_OPS() to implement all the fixup helpers?
>>
> 
> I think the level 0 answer is it doesn't apply to metadata and the llm
> also went nuts messing with the macros when it tried to use them.

Right, metadata doesn't need such fixup handling at all, thus we will 
need to split the set/clear into (data|meta)_(set|clear)_func(), which 
is a little overkilled for a hot fix.

Although it would still be good to implement something like 
btrfs_folio_set_fixup() and btrfs_folio_clear_fixup(), so that we do not 
need to expose btrfs_is_subpage() checks.

And we can integrate the fixup cancelling into btrfs_folio_set_dirty() 
helper later, in a dedicated cleanup/refactor series.

Thanks,
Qu