From: sashiko-bot@kernel.org
To: "Xing Ma" <maxing.lan@bytedance.com>, linux-ext4@vger.kernel.org
Cc: tytso@mit.edu
Subject: Re: [PATCH v2 2/2] ext4: track truncated block range in ext4_truncate() for fast commit
Date: Mon, 30 Nov 2026 17:54:53 +0000 [thread overview]
Message-ID: <sashiko-outbox-241754@kernel.org> (raw)
In-Reply-To: <20261201013742.1563067-3-maxing.lan@bytedance.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] ext4: missing ES hole entry in ext4_truncate() forces fast
commit fallback
--
commit 1366fe063363ad292213a9db24e8bfd6ed620257
Author: Xing Ma <maxing.lan@bytedance.com>
ext4: track truncated block range in ext4_truncate() for fast commit
This commit calls ext4_fc_track_range() in ext4_truncate() so that fast
commit tracks the truncated logical block range from start_lblk to
EXT_MAX_BLOCKS - 1.
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 07a62d8569d31..22560318d2348 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -5608,6 +5608,15 @@ int ext4_truncate(struct inode *inode)
> if (err)
> goto out_stop;
>
> + if (!ext4_handle_is_aborted(handle)) {
> + ext4_lblk_t start_lblk;
> +
> + start_lblk = inode->i_size > 0 ?
> + (inode->i_size - 1) >> inode->i_blkbits : 0;
> + ext4_fc_track_range(handle, inode, start_lblk,
> + EXT_MAX_BLOCKS - 1);
> + }
[Severity: Medium]
Does tracking [start_lblk, EXT_MAX_BLOCKS - 1] here cause
ext4_fc_snapshot_inode_data() to fail with -EAGAIN instead of emitting
EXT4_FC_TAG_DEL_RANGE?
Unlike ext4_punch_hole(), which inserts an EXTENT_STATUS_HOLE entry into
i_es_tree after removing extents, ext4_ext_truncate() only removes extent
status entries in [last_block, EXT_MAX_BLOCKS - 1]:
fs/ext4/extents.c:ext4_ext_truncate() {
...
last_block = (inode->i_size + sb->s_blocksize - 1)
>> EXT4_BLOCK_SIZE_BITS(sb);
ext4_es_remove_extent(inode, last_block, EXT_MAX_BLOCKS - last_block);
...
}
When ext4_fc_snapshot_inode_data() walks the tracked range and reaches
last_block, ext4_es_lookup_extent() finds no extent status entry and
returns 0, which records EXT4_FC_SNAP_ERR_ES_MISS and aborts the fast
commit into a full journal commit via jbd2_fc_end_commit_fallback().
This also causes a same-size ftruncate() followed by fsync() to fall back
to a full commit even when no blocks existed beyond i_size.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261201013742.1563067-1-maxing.lan@bytedance.com?part=2
next prev parent reply other threads:[~2026-11-30 17:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 17:37 [PATCH v2 0/2] ext4: fix fast commit orphan inode replay and truncate range tracking Xing Ma
2026-11-30 17:37 ` [PATCH v2 1/2] ext4: fall back to full commit for unlinked or orphan inodes in fast commit Xing Ma
2026-11-30 17:37 ` [PATCH v2 2/2] ext4: track truncated block range in ext4_truncate() for " Xing Ma
2026-11-30 17:54 ` sashiko-bot [this message]
2026-11-30 17:54 ` [PATCH v2 0/2] ext4: fix fast commit orphan inode replay and truncate range tracking 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-241754@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=maxing.lan@bytedance.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox