[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <rixkslnrchbru4bx3jzox5qxctabams37idsxtexenculvivhy@u2ywm4ojxycg>
Date: Fri, 19 Dec 2025 17:44:04 +0100
From: Jan Kara <jack@...e.cz>
To: Zhang Yi <yi.zhang@...weicloud.com>
Cc: linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, tytso@....edu, adilger.kernel@...ger.ca, jack@...e.cz,
ojaswin@...ux.ibm.com, ritesh.list@...il.com, yi.zhang@...wei.com, yizhang089@...il.com,
libaokun1@...wei.com, yangerkun@...wei.com, yukuai@...as.com
Subject: Re: [PATCH -next 6/7] ext4: simply the mapping query logic in
ext4_iomap_begin()
On Sat 13-12-25 10:20:07, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@...wei.com>
>
> In the write path mapping check of ext4_iomap_begin(), the return value
> 'ret' should never greater than orig_mlen. If 'ret' equals 'orig_mlen',
> it can be returned directly without checking IOMAP_ATOMIC.
>
> Signed-off-by: Zhang Yi <yi.zhang@...wei.com>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
> fs/ext4/inode.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 88144e2ce3e2..39348ee46e5c 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3815,15 +3815,15 @@ static int ext4_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
> */
> if (offset + length <= i_size_read(inode)) {
> ret = ext4_map_blocks(NULL, inode, &map, 0);
> - /*
> - * For atomic writes the entire requested length should
> - * be mapped.
> - */
> if ((map.m_flags & EXT4_MAP_MAPPED) ||
> (!(flags & IOMAP_DAX) &&
> (map.m_flags & EXT4_MAP_UNWRITTEN))) {
> - if ((!(flags & IOMAP_ATOMIC) && ret > 0) ||
> - (flags & IOMAP_ATOMIC && ret >= orig_mlen))
> + /*
> + * For atomic writes the entire requested
> + * length should be mapped.
> + */
> + if (ret == orig_mlen ||
> + (!(flags & IOMAP_ATOMIC) && ret > 0))
> goto out;
> }
> map.m_len = orig_mlen;
> --
> 2.46.1
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists