]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ext4: correct the journal credits calculations of allocating blocks
authorZhang Yi <yi.zhang@huawei.com>
Mon, 12 May 2025 06:33:16 +0000 (14:33 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 20 May 2025 14:31:12 +0000 (10:31 -0400)
commit0e32d86170121c2d43508e923cb171fb58953b42
tree458e45a2001d673b0740304fc8873ca3734196a8
parentd6bf294773a472fe4694b92714af482f5c6aa4c6
ext4: correct the journal credits calculations of allocating blocks

The journal credits calculation in ext4_ext_index_trans_blocks() is
currently inadequate. It only multiplies the depth of the extents tree
and doesn't account for the blocks that may be required for adding the
leaf extents themselves.

After enabling large folios, we can easily run out of handle credits,
triggering a warning in jbd2_journal_dirty_metadata() on filesystems
with a 1KB block size. This occurs because we may need more extents when
iterating through each large folio in
ext4_do_writepages()->mpage_map_and_submit_extent(). Therefore, we
should modify ext4_ext_index_trans_blocks() to include a count of the
leaf extents in the worst case as well.

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Link: https://patch.msgid.link/20250512063319.3539411-6-yi.zhang@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents.c
fs/ext4/inode.c