[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251213022008.1766912-8-yi.zhang@huaweicloud.com>
Date: Sat, 13 Dec 2025 10:20:08 +0800
From: Zhang Yi <yi.zhang@...weicloud.com>
To: linux-ext4@...r.kernel.org
Cc: 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,
yi.zhang@...weicloud.com,
yizhang089@...il.com,
libaokun1@...wei.com,
yangerkun@...wei.com,
yukuai@...as.com
Subject: [PATCH -next 7/7] ext4: remove EXT4_GET_BLOCKS_IO_CREATE_EXT
From: Zhang Yi <yi.zhang@...wei.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@...wei.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 39348ee46e5c..fa579e857baf 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,
--
2.46.1
Powered by blists - more mailing lists