mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baokun Li <libaokun1@huawei.com>
To: Zhang Yi <yi.zhang@huaweicloud.com>, <linux-ext4@vger.kernel.org>
Cc: <linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<tytso@mit.edu>, <adilger.kernel@dilger.ca>, <jack@suse.cz>,
	<ojaswin@linux.ibm.com>, <ritesh.list@gmail.com>,
	<yi.zhang@huawei.com>, <yizhang089@gmail.com>,
	<yangerkun@huawei.com>, <yukuai@fnnas.com>
Subject: Re: [PATCH -next v2 7/7] ext4: remove EXT4_GET_BLOCKS_IO_CREATE_EXT
Date: Wed, 31 Dec 2025 15:55:46 +0800	[thread overview]
Message-ID: <474927ab-e7e1-47a1-9704-ba057580519c@huawei.com> (raw)
In-Reply-To: <20251223011802.31238-8-yi.zhang@huaweicloud.com>

On 2025-12-23 09:18, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@huawei.com>
>
> We do not use EXT4_GET_BLOCKS_IO_CREATE_EXT or split extents before
> submitting I/O; therefore, remove the related code.
>
> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
> Reviewed-by: Jan Kara <jack@suse.cz>

Looks good. Feel free to add:

Reviewed-by: Baokun Li <libaokun1@huawei.com>

> ---
>  fs/ext4/ext4.h    |  9 ---------
>  fs/ext4/extents.c | 29 -----------------------------
>  fs/ext4/inode.c   | 11 -----------
>  3 files changed, 49 deletions(-)
>
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 9a71357f192d..174c51402864 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -707,15 +707,6 @@ enum {
>  	 * found an unwritten extent, we need to split it.
>  	 */
>  #define EXT4_GET_BLOCKS_SPLIT_NOMERGE		0x0008
> -	/*
> -	 * Caller is from the dio or dioread_nolock buffered IO, reqest to
> -	 * create an unwritten extent if it does not exist or split the
> -	 * found unwritten extent. Also do not merge the newly created
> -	 * unwritten extent, io end will convert unwritten to written,
> -	 * and try to merge the written extent.
> -	 */
> -#define EXT4_GET_BLOCKS_IO_CREATE_EXT		(EXT4_GET_BLOCKS_SPLIT_NOMERGE|\
> -					 EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT)
>  	/* Convert unwritten extent to initialized. */
>  #define EXT4_GET_BLOCKS_CONVERT			0x0010
>  	/* Eventual metadata allocation (due to growing extent tree)
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index c98f7c5482b4..c7c66ab825e7 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -3925,34 +3925,6 @@ ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode,
>  	trace_ext4_ext_handle_unwritten_extents(inode, map, flags,
>  						*allocated, newblock);
>  
> -	/* get_block() before submitting IO, split the extent */
> -	if (flags & EXT4_GET_BLOCKS_SPLIT_NOMERGE) {
> -		int depth;
> -
> -		path = ext4_split_convert_extents(handle, inode, map, path,
> -						  flags, allocated);
> -		if (IS_ERR(path))
> -			return path;
> -		/*
> -		 * shouldn't get a 0 allocated when splitting an extent unless
> -		 * m_len is 0 (bug) or extent has been corrupted
> -		 */
> -		if (unlikely(*allocated == 0)) {
> -			EXT4_ERROR_INODE(inode,
> -					 "unexpected allocated == 0, m_len = %u",
> -					 map->m_len);
> -			err = -EFSCORRUPTED;
> -			goto errout;
> -		}
> -		/* Don't mark unwritten if the extent has been zeroed out. */
> -		path = ext4_find_extent(inode, map->m_lblk, path, flags);
> -		if (IS_ERR(path))
> -			return path;
> -		depth = ext_depth(inode);
> -		if (ext4_ext_is_unwritten(path[depth].p_ext))
> -			map->m_flags |= EXT4_MAP_UNWRITTEN;
> -		goto out;
> -	}
>  	/* IO end_io complete, convert the filled extent to written */
>  	if (flags & EXT4_GET_BLOCKS_CONVERT) {
>  		path = ext4_convert_unwritten_extents_endio(handle, inode,
> @@ -4006,7 +3978,6 @@ ext4_ext_handle_unwritten_extents(handle_t *handle, struct inode *inode,
>  		goto errout;
>  	}
>  
> -out:
>  	map->m_flags |= EXT4_MAP_NEW;
>  map_out:
>  	map->m_flags |= EXT4_MAP_MAPPED;
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 67fe7d0f47e3..2e79b09fe2f0 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -588,7 +588,6 @@ static int ext4_map_query_blocks(handle_t *handle, struct inode *inode,
>  static int ext4_map_create_blocks(handle_t *handle, struct inode *inode,
>  				  struct ext4_map_blocks *map, int flags)
>  {
> -	struct extent_status es;
>  	unsigned int status;
>  	int err, retval = 0;
>  
> @@ -649,16 +648,6 @@ static int ext4_map_create_blocks(handle_t *handle, struct inode *inode,
>  			return err;
>  	}
>  
> -	/*
> -	 * If the extent has been zeroed out, we don't need to update
> -	 * extent status tree.
> -	 */
> -	if (flags & EXT4_GET_BLOCKS_SPLIT_NOMERGE &&
> -	    ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es, &map->m_seq)) {
> -		if (ext4_es_is_written(&es))
> -			return retval;
> -	}
> -
>  	status = map->m_flags & EXT4_MAP_UNWRITTEN ?
>  			EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
>  	ext4_es_insert_extent(inode, map->m_lblk, map->m_len, map->m_pblk,



  reply	other threads:[~2025-12-31  7:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23  1:17 [PATCH -next v2 0/7] ext4: defer unwritten splitting until I/O completion Zhang Yi
2025-12-23  1:17 ` [PATCH -next v2 1/7] ext4: use reserved metadata blocks when splitting extent on endio Zhang Yi
2025-12-31  7:34   ` Baokun Li
2026-01-03 13:42   ` Ojaswin Mujoo
2026-01-05  1:17     ` Zhang Yi
2025-12-23  1:17 ` [PATCH -next v2 2/7] ext4: don't split extent before submitting I/O Zhang Yi
2025-12-31  7:35   ` Baokun Li
2026-01-03 13:47   ` Ojaswin Mujoo
2025-12-23  1:17 ` [PATCH -next v2 3/7] ext4: avoid starting handle when dio writing an unwritten extent Zhang Yi
2025-12-31  7:36   ` Baokun Li
2026-01-03 14:06   ` Ojaswin Mujoo
2025-12-23  1:17 ` [PATCH -next v2 4/7] ext4: remove useless ext4_iomap_overwrite_ops Zhang Yi
2025-12-31  7:40   ` Baokun Li
2026-01-03 14:14   ` Ojaswin Mujoo
2025-12-23  1:18 ` [PATCH -next v2 5/7] ext4: remove unused unwritten parameter in ext4_dio_write_iter() Zhang Yi
2025-12-31  7:42   ` Baokun Li
2026-01-03 14:16   ` Ojaswin Mujoo
2025-12-23  1:18 ` [PATCH -next v2 6/7] ext4: simply the mapping query logic in ext4_iomap_begin() Zhang Yi
2025-12-31  7:46   ` Baokun Li
2026-01-03 14:17   ` Ojaswin Mujoo
2026-01-04 13:00   ` Markus Elfring
2026-01-05  1:18     ` Zhang Yi
2025-12-23  1:18 ` [PATCH -next v2 7/7] ext4: remove EXT4_GET_BLOCKS_IO_CREATE_EXT Zhang Yi
2025-12-31  7:55   ` Baokun Li [this message]
2026-01-03 14:20   ` Ojaswin Mujoo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=474927ab-e7e1-47a1-9704-ba057580519c@huawei.com \
    --to=libaokun1@huawei.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=tytso@mit.edu \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yi.zhang@huaweicloud.com \
    --cc=yizhang089@gmail.com \
    --cc=yukuai@fnnas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®