public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] ext4: remove useless code in ext4_map_create_blocks
@ 2025-11-07 11:58 Yang Erkun
  2025-11-07 11:58 ` [PATCH v3 2/3] ext4: rename EXT4_GET_BLOCKS_PRE_IO Yang Erkun
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Yang Erkun @ 2025-11-07 11:58 UTC (permalink / raw)
  To: linux-ext4, tytso, adilger.kernel, jack
  Cc: yi.zhang, libaokun1, yangerkun, yangerkun

IO path with EXT4_GET_BLOCKS_PRE_IO means dio within i_size or
dioread_nolock buffer writeback, they all means we need a unwritten
extent(or this extent has already been initialized), and the split won't
zero the range we really write. So this check seems useless. Besides,
even if we repeatedly execute ext4_es_insert_extent, there won't
actually be any issues.

Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Yang Erkun <yangerkun@huawei.com>
---
 fs/ext4/inode.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index e99306a8f47c..e8bac93ca668 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -583,7 +583,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;
 
@@ -644,16 +643,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_PRE_IO &&
-	    ext4_es_lookup_extent(inode, map->m_lblk, NULL, &es)) {
-		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.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-11-13 11:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-07 11:58 [PATCH v3 1/3] ext4: remove useless code in ext4_map_create_blocks Yang Erkun
2025-11-07 11:58 ` [PATCH v3 2/3] ext4: rename EXT4_GET_BLOCKS_PRE_IO Yang Erkun
2025-11-08  1:49   ` Baokun Li
2025-11-07 11:58 ` [PATCH v3 3/3] ext4: cleanup for ext4_map_blocks Yang Erkun
2025-11-08  1:54   ` Baokun Li
2025-11-08  1:46 ` [PATCH v3 1/3] ext4: remove useless code in ext4_map_create_blocks Baokun Li
2025-11-12  4:46 ` Zhang Yi
2025-11-12  8:30   ` yangerkun
2025-11-13 11:27   ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox