Re:Re: [PATCH v5 05/16] f2fs: support large folio writeback

From: Nanzhe Zhao

Date: Wed Oct 21 2026 - 22:01:45 EST



>>> +out:
>>> +        /*
>>> +         * Clear the dirty state of the subranges that were written back.
>>> +         * If some subranges are still dirty (e.g. the folio was only
>>> +         * partially written back), the folio must stay dirty so that
>>> +         * the remaining subranges are written back later.
>>> +         */
>>> +        if (f2fs_ffs_clear_subrange_dirty_and_test(folio, 0,
>>> +                    (err ? pos : end_pos) - folio_pos(folio)))
>>> +            folio_redirty_for_writepage(wbc, folio);
>
>For folio order-0, if f2fs_write_folio_dirty_range() failed, we need to redirty
>folio anyway, right? so it's need to check err as well?
>
>Thanks,
>

In f2fs: handle partial truncate of large folio dirty subpages I have the following hunk
@@ -4514,9 +4590,9 @@ static int f2fs_write_cache_folios(struct address_space *mapping,
* Redirty the folio if dirty subranges remain in a large
* folio, or if order-0 writeback fails due to an error.
*/
- if (f2fs_ffs_clear_subrange_dirty_and_test(folio, 0,
- (err ? pos : end_pos) - folio_pos(folio)) ||
- err)
+ dirty = f2fs_ffs_clear_subrange_dirty_and_test(folio, 0,
+ (err ? pos : end_pos) - folio_pos(folio));
+ if (dirty || err)
folio_redirty_for_writepage(wbc, folio);
else if (!f2fs_folio_has_ffs(folio))
inode_dec_dirty_block(inode);
to solve this problem. But it seems I have put this hunk in a wrong place.
It should be introduced in this patch I think.