[Devel] [PATCH hci-8.1 2/2] fs/ext4: ensure ext4 transaction credits while swapext

Konstantin Khorenko khorenko at virtuozzo.com
Tue Nov 17 17:00:00 MSK 2026


I won't apply this version, please send v2 with the changes below.

On Tue, 17 Nov 2026 21:25:08 +0800, Alexey Kuznetsov wrote:
> The patch is suggested by Claude. It looks reasonable,
> the technique is borrowed from ext4_block_write_begin().

Items 3-6 of my reply to 1/2.

5. Before this patch one call of swap_one_extent() swapped a donor
extent in one transaction. When jbd2_journal_extend() refuses, the
rest now goes into the next transaction, so a crash between the two
commits leaves that extent half swapped.

> +		 * sure the handle can afford the worst case. If it cannot,
> +		 * return to the caller with -EAGAIN, it will restart the
> +		 * transaction and continue from lblk1 + replaced_count.

6. lblk1 is advanced together with replaced_count in the loop, so the
caller resumes at lblk1 itself, not at lblk1 + replaced_count.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list