]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ext4: make ext4_punch_hole() support large block size
authorBaokun Li <libaokun1@huawei.com>
Fri, 21 Nov 2025 09:06:34 +0000 (17:06 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 29 Nov 2025 03:35:26 +0000 (22:35 -0500)
commitd37a7ddd3a384bd34f985273d6e776d3d50b0edd
treedfb29cc887d4c07781bd50f44117bd8f801eff8f
parentafa6d5a16bf2e354e183a4fcbcdb8578798e9942
ext4: make ext4_punch_hole() support large block size

When preparing for bs > ps support, clean up unnecessary PAGE_SIZE
references in ext4_punch_hole().

Previously, when a hole extended beyond i_size, we aligned the hole end
upwards to PAGE_SIZE to handle partial folio invalidation. Now that
truncate_inode_pages_range() already handles partial folio invalidation
correctly, this alignment is no longer required.

However, to save pointless tail block zeroing, we still keep rounding up
to the block size here.

In addition, as Honza pointed out, when the hole end equals i_size, it
should also be rounded up to the block size. This patch fixes that as well.

Suggested-by: Jan Kara <jack@suse.cz>
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Message-ID: <20251121090654.631996-5-libaokun@huaweicloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/inode.c