Re: [PATCH 3/6] ext4: track partial-zero outcome per edge in ext4_zero_partial_blocks()

From: Jan Kara

Date: Thu Jul 02 2026 - 06:48:22 EST


On Wed 01-07-26 22:20:06, yizhang089@xxxxxxxxx wrote:
> From: Zhang Yi <yi.zhang@xxxxxxxxxx>
>
> Replace the single bool did_zero output of ext4_zero_partial_blocks()
> with a bitmask that records which edge (start, end, or both in the
> single-block case) was actually partial-zeroed. This allows callers to
> distinguish which edges have been zeroed, preparing for unaligned
> FALLOC_FL_WRITE_ZEROES handling in later patches.
>
> Signed-off-by: Zhang Yi <yi.zhang@xxxxxxxxxx>

Just some text corrections 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 0b31fa873743..d68f7be4ff02 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4256,13 +4256,26 @@ int ext4_block_zero_eof(struct inode *inode, loff_t from, loff_t end)
> return 0;
> }
>
> +/*
> + * Zero out the unaligned head and tail of the [lstart, lstart+length)
> + * range.
> + *
> + * On return, @partial_zeroed records which edges actually got
> + * partial-zeroed. Set EXT4_PARTIAL_ZERO_START/EXT4_PARTIAL_ZERO_END if
> + * the head/tail block got actually partially zeroed (in written, dirty
> + * unwritten or delalloc state). Cleared if the head/tail block is a
> + * hole or a clean unwritten block, in which case there is nothing needs
^^^
that needs zeroing.

> + * to zero. When the head and tail land in the same block, both bits
> + * are set together on a successful zero.
^^^ zeroing

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR