[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2ce98373-7c5f-45a7-bb21-82b4559a80fe@huaweicloud.com>
Date: Mon, 3 Nov 2025 14:19:16 +0800
From: Zhang Yi <yi.zhang@...weicloud.com>
To: Yang Erkun <yangerkun@...wei.com>, linux-ext4@...r.kernel.org,
tytso@....edu, adilger.kernel@...ger.ca, jack@...e.cz
Cc: libaokun1@...wei.com, yangerkun@...weicloud.com
Subject: Re: [PATCH 3/4] ext4: cleanup for ext4_map_blocks
On 10/27/2025 8:23 PM, Yang Erkun wrote:
> Retval from ext4_map_create_blocks means we really create some blocks,
> cannot happened with m_flags without EXT4_MAP_UNWRITTEN and
> EXT4_MAP_MAPPED.
>
> Signed-off-by: Yang Erkun <yangerkun@...wei.com>
Looks good to me.
Reviewed-by: Zhang Yi <yi.zhang@...wei.com>
> ---
> fs/ext4/inode.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index e8bac93ca668..3d8ada26d5cd 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -799,7 +799,13 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
> down_write(&EXT4_I(inode)->i_data_sem);
> retval = ext4_map_create_blocks(handle, inode, map, flags);
> up_write((&EXT4_I(inode)->i_data_sem));
> - if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) {
> +
> + if (retval < 0)
> + ext_debug(inode, "failed with err %d\n", retval);
> + if (retval <= 0)
> + return retval;
> +
> + if (map->m_flags & EXT4_MAP_MAPPED) {
> ret = check_block_validity(inode, map);
> if (ret != 0)
> return ret;
> @@ -828,12 +834,8 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
> return ret;
> }
> }
> - if (retval > 0 && (map->m_flags & EXT4_MAP_UNWRITTEN ||
> - map->m_flags & EXT4_MAP_MAPPED))
> - ext4_fc_track_range(handle, inode, map->m_lblk,
> - map->m_lblk + map->m_len - 1);
> - if (retval < 0)
> - ext_debug(inode, "failed with err %d\n", retval);
> + ext4_fc_track_range(handle, inode, map->m_lblk, map->m_lblk +
> + map->m_len - 1);
> return retval;
> }
>
Powered by blists - more mailing lists