[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dibws2hdldmuefxvotoeo2gitzxie6oc6uinfl33fh73jizh2w@t3us4sfqcb7l>
Date: Tue, 6 Jan 2026 15:33:07 +0100
From: Jan Kara <jack@...e.cz>
To: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
Cc: linux-ext4@...r.kernel.org, Theodore Ts'o <tytso@....edu>,
Ritesh Harjani <ritesh.list@...il.com>, Zhang Yi <yi.zhang@...wei.com>, Jan Kara <jack@...e.cz>,
libaokun1@...wei.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/7] ext4: propagate flags to convert_initialized_extent()
On Sun 04-01-26 17:49:16, Ojaswin Mujoo wrote:
> Currently, ext4_zero_range passes EXT4_EX_NOCACHE flag to avoid caching
> extents however this is not respected by convert_initialized_extent().
> Hence, modify it to accept flags from the caller and to pass the flags
> on to other extent manipulation functions it calls. This makes
> sure the NOCACHE flag is respected throughout the code path.
>
> Signed-off-by: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
> ---
> fs/ext4/extents-test.c | 2 +-
> fs/ext4/extents.c | 5 +++--
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ext4/extents-test.c b/fs/ext4/extents-test.c
> index 4fb94d3c8a1e..54aed3eabfe2 100644
> --- a/fs/ext4/extents-test.c
> +++ b/fs/ext4/extents-test.c
> @@ -422,7 +422,7 @@ static void test_convert_initialized(struct kunit *test)
>
> map.m_lblk = param->split_map.m_lblk;
> map.m_len = param->split_map.m_len;
> - convert_initialized_extent(NULL, inode, &map, path, &allocated);
> + convert_initialized_extent(NULL, inode, &map, path, 0, &allocated);
>
> path = ext4_find_extent(inode, EX_DATA_LBLK, NULL, 0);
> ex = path->p_ext;
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index 0ad0a9f2e3d4..5228196f5ad4 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -3845,6 +3845,7 @@ static struct ext4_ext_path *
> convert_initialized_extent(handle_t *handle, struct inode *inode,
> struct ext4_map_blocks *map,
> struct ext4_ext_path *path,
> + int flags,
> unsigned int *allocated)
> {
> struct ext4_extent *ex;
> @@ -3870,7 +3871,7 @@ convert_initialized_extent(handle_t *handle, struct inode *inode,
>
> if (ee_block != map->m_lblk || ee_len > map->m_len) {
> path = ext4_split_convert_extents(handle, inode, map, path,
> - EXT4_GET_BLOCKS_CONVERT_UNWRITTEN, NULL);
> + flags | EXT4_GET_BLOCKS_CONVERT_UNWRITTEN, NULL);
No need to keep EXT4_GET_BLOCKS_CONVERT_UNWRITTEN here as the caller has
it in flags already? Otherwise the patch looks good.
Honza
> if (IS_ERR(path))
> return path;
>
> @@ -4264,7 +4265,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
> if ((!ext4_ext_is_unwritten(ex)) &&
> (flags & EXT4_GET_BLOCKS_CONVERT_UNWRITTEN)) {
> path = convert_initialized_extent(handle,
> - inode, map, path, &allocated);
> + inode, map, path, flags, &allocated);
> if (IS_ERR(path))
> err = PTR_ERR(path);
> goto out;
> --
> 2.51.0
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists