[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCyTla1NLJ4FGnLy@li-dc0c254c-257c-11b2-a85c-98b6c1322444.ibm.com>
Date: Tue, 20 May 2025 20:07:09 +0530
From: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
To: "Ritesh Harjani (IBM)" <ritesh.list@...il.com>
Cc: linux-ext4@...r.kernel.org, "Theodore Ts'o" <tytso@....edu>,
Jan Kara <jack@...e.cz>, John Garry <john.g.garry@...cle.com>,
djwong@...nel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v1 5/5] ext4: Add a WARN_ON_ONCE for querying
LAST_IN_LEAF instead
On Mon, May 19, 2025 at 11:49:30PM +0530, Ritesh Harjani (IBM) wrote:
> We added the documentation in ext4_map_blocks() for usage of
> EXT4_GET_BLOCKS_QUERY_LAST_IN_LEAF flag. But It's better to add
> a WARN_ON_ONCE in case if anyone tries using this flag with CREATE to
> avoid a random issue later. Since depth can change with CREATE and it
> needs to be re-calculated before using it in there.
>
> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@...il.com>
Makes sense, feel free to add:
Reviewed-by: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
> ---
> fs/ext4/extents.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 7683558381dc..ea5158703d2d 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -4444,9 +4444,11 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
> * need to re-calculate the depth as it might have changed due to block
> * allocation.
> */
> - if (flags & EXT4_GET_BLOCKS_QUERY_LAST_IN_LEAF)
> + if (flags & EXT4_GET_BLOCKS_QUERY_LAST_IN_LEAF) {
> + WARN_ON_ONCE(flags & EXT4_GET_BLOCKS_CREATE);
> if (!err && ex && (ex == EXT_LAST_EXTENT(path[depth].p_hdr)))
> map->m_flags |= EXT4_MAP_QUERY_LAST_IN_LEAF;
> + }
>
> ext4_free_ext_path(path);
>
> --
> 2.49.0
>
Powered by blists - more mailing lists