From: sashiko-bot@kernel.org
To: "Ojaswin Mujoo" <ojaswin@linux.ibm.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH v2 08/13] ext4: add tracking for unwritten to-be-converted ranges in iomap buffered path
Date: Fri, 27 Nov 2026 18:30:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-238082@kernel.org> (raw)
In-Reply-To: <20261127-ext4-endio-zero-bug-v2-8-4106968e4d15@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ext4: per-ioend CONVERT_PENDING marking in
ext4_iomap_mark_convert_pending() defeats ioend merging
--
commit 9d1e415d8a4e8a5c3f447bfed5eca35a56fe39f4
Author: Ojaswin Mujoo <ojaswin@linux.ibm.com>
ext4: add tracking for unwritten to-be-converted ranges in iomap buffered path
This commit marks unwritten ioend ranges as convert-pending in the extent
status tree before writeback bio submission and clears that state on
completion error.
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 2031b1dd70694..947c20d081c6b 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4575,6 +4575,38 @@ static ssize_t ext4_iomap_writeback_range(struct iomap_writepage_ctx *wpc,
> return ret;
> }
>
> +/*
> + * Mark the unwritten blocks covered by @ioend as convert pending in the extent
> + * status tree.
> + */
> +static int ext4_iomap_mark_convert_pending(struct inode *inode,
> + struct iomap_ioend *ioend)
> +{
> + u8 blkbits = inode->i_blkbits;
> + ext4_lblk_t lblk = ioend->io_offset >> blkbits;
> + unsigned int len = EXT4_MAX_BLOCKS(ioend->io_size, ioend->io_offset,
> + blkbits);
> + struct ext4_map_blocks map;
> + int ret;
> +
> + while (len) {
> + map.m_lblk = lblk;
> + map.m_len = len;
> + ret = ext4_map_blocks(NULL, inode, &map,
> + EXT4_GET_BLOCKS_CONVERT_PENDING |
> + EXT4_GET_BLOCKS_IO_SUBMIT |
> + EXT4_EX_NOCACHE);
> + if (ret < 0)
> + return ret;
> + /* Blocks under writeback cannot be a hole. */
> + if (WARN_ON_ONCE(!ret))
> + return -EFSCORRUPTED;
> + lblk += ret;
> + len -= ret;
> + }
> + return 0;
> +}
> +
> static int ext4_iomap_writeback_submit(struct iomap_writepage_ctx *wpc,
> int error)
> {
> @@ -4584,6 +4616,15 @@ static int ext4_iomap_writeback_submit(struct iomap_writepage_ctx *wpc,
> unsigned int blocksize = i_blocksize(inode);
> loff_t pstart, plen;
>
> + /*
> + * The unwritten blocks are about to be written. Mark them convert
> + * pending before the I/O is submitted so that endio doesn't zeroout the
> + * range.
> + */
> + if (!error && (ioend->io_flags & IOMAP_IOEND_UNWRITTEN) &&
> + ioend->io_size)
> + error = ext4_iomap_mark_convert_pending(inode, ioend);
[Severity: Medium]
Does marking each individual ioend as EXTENT_STATUS_CONVERT_PENDING on
submission defeat ioend merging during I/O completion?
When writeback of a contiguous unwritten extent spans multiple ioend bios,
ext4_iomap_mark_convert_pending() runs per ioend and splits the cached
extent in i_es_tree into separate EXTENT_STATUS_CONVERT_PENDING entries,
because ext4_es_can_be_merged() returns 0 for convert-pending extents.
Although ext4_iomap_end_io() later merges contiguous completed ioends via
iomap_ioend_try_merge(), ext4_convert_unwritten_extents() ->
ext4_map_blocks() looks up i_es_tree first and clamps map.m_len to the
first unmerged entry's es_len. In ext4_split_convert_extents(), map->m_len
no longer matches the full on-disk extent length ee_len, which skips the
in-place conversion fast path and forces ext4_split_extent() and re-merging
under i_data_sem for every pre-merge bio range.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127-ext4-endio-zero-bug-v2-0-4106968e4d15@linux.ibm.com?part=8
next prev parent reply other threads:[~2026-11-27 18:30 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 15:10 [PATCH v2 00/13] ext4: fix endio zeroout corruption by tracking to-be-converted unwritten IOs Ojaswin Mujoo
2026-11-27 15:10 ` [PATCH v2 01/13] ext4: disable zeroout fallback in ext4_split_extent() Ojaswin Mujoo
2026-11-27 15:10 ` [PATCH v2 02/13] ext4: introduce CONVERT_PENDING extent status type Ojaswin Mujoo
2026-11-27 15:58 ` sashiko-bot
2026-11-27 15:10 ` [PATCH v2 03/13] ext4: preserve convert pending extents when adding unwrit extents to es cache Ojaswin Mujoo
2026-12-01 12:54 ` Zhang Yi
2026-11-27 15:10 ` [PATCH v2 04/13] ext4: add es helper to convert unwrit to convert pending without changing i_es_seq Ojaswin Mujoo
2026-11-27 16:46 ` sashiko-bot
2026-11-27 15:10 ` [PATCH v2 05/13] ext4: add support to track convert pending ranges in ext4_map_blocks() Ojaswin Mujoo
2026-11-27 17:19 ` sashiko-bot
2026-11-27 15:10 ` [PATCH v2 06/13] ext4: add tracking for unwritten to-be-converted ranges in dio write path Ojaswin Mujoo
2026-11-27 17:48 ` sashiko-bot
2026-11-27 15:10 ` [PATCH v2 07/13] ext4: add tracking for unwritten to-be-converted ranges in non iomap buffered path Ojaswin Mujoo
2026-11-27 18:17 ` sashiko-bot
2026-11-27 15:10 ` [PATCH v2 08/13] ext4: add tracking for unwritten to-be-converted ranges in " Ojaswin Mujoo
2026-11-27 18:30 ` sashiko-bot [this message]
2026-11-27 15:10 ` [PATCH v2 09/13] ext4: don't zeroout if conv pending ranges are present Ojaswin Mujoo
2026-11-27 15:10 ` [PATCH v2 10/13] ext4: add tracepoints for extent split and convert Ojaswin Mujoo
2026-11-27 15:10 ` [PATCH v2 11/13] ext4: update extent status cache when zeroing extents Ojaswin Mujoo
2026-11-27 19:32 ` sashiko-bot
2026-11-27 15:10 ` [PATCH v2 12/13] ext4: don't drop the extents in case extent split fails Ojaswin Mujoo
2026-11-27 15:11 ` [PATCH v2 13/13] ext4: re-enable zeroout fallback Ojaswin Mujoo
2026-11-27 20:20 ` sashiko-bot
2026-11-27 20:20 ` [PATCH v2 00/13] ext4: fix endio zeroout corruption by tracking to-be-converted unwritten IOs sashiko-bot
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=sashiko-outbox-238082@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tytso@mit.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.