From: Yang Erkun <yangerkun@huawei.com>
To: linux-ext4@vger.kernel.org, tytso@mit.edu,
adilger.kernel@dilger.ca, jack@suse.cz
Cc: yi.zhang@huawei.com, libaokun1@huawei.com, yangerkun@huawei.com,
yangerkun@huaweicloud.com
Subject: [PATCH v2 1/4] ext4: remove useless code in ext4_map_create_blocks
Date: Tue, 4 Nov 2025 21:17:47 +0800 [thread overview]
Message-ID: <20251104131750.1581541-1-yangerkun@huawei.com> (raw)
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>
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
next reply other threads:[~2025-11-04 13:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-04 13:17 Yang Erkun [this message]
2025-11-04 13:17 ` [PATCH v2 2/4] ext4: rename EXT4_GET_BLOCKS_PRE_IO Yang Erkun
2025-11-04 14:06 ` Zhang Yi
2025-11-04 14:32 ` Jan Kara
2025-11-04 13:17 ` [PATCH v2 3/4] ext4: cleanup for ext4_map_blocks Yang Erkun
2025-11-04 14:36 ` Jan Kara
2025-11-04 13:17 ` [PATCH v2 4/4] ext4: order mode should not take effect for DIO Yang Erkun
2025-11-04 15:07 ` Jan Kara
2025-11-07 11:54 ` yangerkun
2025-11-04 14:28 ` [PATCH v2 1/4] ext4: remove useless code in ext4_map_create_blocks Jan Kara
2025-11-05 1:39 ` yangerkun
2025-11-05 10:20 ` Jan Kara
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=20251104131750.1581541-1-yangerkun@huawei.com \
--to=yangerkun@huawei.com \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=libaokun1@huawei.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=yangerkun@huaweicloud.com \
--cc=yi.zhang@huawei.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