Re: [PATCH v3 1/9] ext4: use FGP_WRITEBEGIN for tail block zeroing

From: Jan Kara

Date: Thu Jul 09 2026 - 09:20:34 EST


On Wed 08-07-26 14:20:41, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@xxxxxxxxxx>
>
> ext4_load_tail_bh() returns a locked folio that callers immediately
> mutate through folio_zero_range() and mark_buffer_dirty(). Use
> FGP_WRITEBEGIN so that, on backing devices that require stable writes,
> __filemap_get_folio() waits for writeback to finish before returning
> the folio; on regular devices the wait is a no-op.
>
> Signed-off-by: Zhang Yi <yi.zhang@xxxxxxxxxx>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

Honza

> ---
> fs/ext4/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index c2c2d6ac7f3d..7b2face041ef 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4037,7 +4037,7 @@ static struct buffer_head *ext4_load_tail_bh(struct inode *inode, loff_t from)
> int err = 0;
>
> folio = __filemap_get_folio(mapping, from >> PAGE_SHIFT,
> - FGP_LOCK | FGP_ACCESSED | FGP_CREAT,
> + FGP_WRITEBEGIN | FGP_ACCESSED,
> mapping_gfp_constraint(mapping, ~__GFP_FS));
> if (IS_ERR(folio))
> return ERR_CAST(folio);
> --
> 2.52.0
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR