Re: [PATCH 04/10] ext4: factor out journalled block zeroing range

From: Zhang Yi

Date: Mon Mar 23 2026 - 23:18:54 EST


On 3/24/2026 12:48 AM, Jan Kara wrote:
> On Tue 10-03-26 09:40:55, Zhang Yi wrote:
>> From: Zhang Yi <yi.zhang@xxxxxxxxxx>
>>
>> Refactor __ext4_block_zero_page_range() by separating the block zeroing
>> operations for ordered data mode and journal data mode into two distinct
>> functions:
>>
>> - ext4_block_do_zero_range(): handles non-journal data mode with
>> ordered data support
>> - ext4_block_journalled_zero_range(): handles journal data mode
>>
>> Also extract a common helper, ext4_block_get_zero_range(), to handle
>> buffer head and folio retrieval, along with the associated error
>> handling. This prepares for converting the partial block zero range to
>> the iomap infrastructure.
>>
>> Signed-off-by: Zhang Yi <yi.zhang@xxxxxxxxxx>
>
> Just one nit below. Otherwise feel free to add:
>
> Reviewed-by: Jan Kara <jack@xxxxxxx>
>
>> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
>> index 52c6a86ad9f9..d63d455831b9 100644
>> --- a/fs/ext4/inode.c
>> +++ b/fs/ext4/inode.c
>> @@ -4002,13 +4002,12 @@ void ext4_set_aops(struct inode *inode)
>> * ext4_punch_hole, etc) which needs to be properly zeroed out. Otherwise a
>> * racing writeback can come later and flush the stale pagecache to disk.
>> */
>> -static int __ext4_block_zero_page_range(handle_t *handle,
>> - struct address_space *mapping, loff_t from, loff_t length,
>> - bool *did_zero)
>> +static struct buffer_head *ext4_block_get_zero_range(struct inode *inode,
>> + loff_t from, loff_t length)
>
> I'd call this function ext4_load_tail_bh() and AFAICT the 'length' argument
> is unused so it can be dropped.
>
> Honza

Ha, sounds better, will do in my next iteration.

Thanks,
Yi.