From: no-reply@sashiko.virtuozzo.com
To: "Denis V. Lunev" <den@openvz.org>, khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v3 4/5] ext4: discard the balloon on FITRIM
Date: Wed, 11 Nov 2026 11:40:07 +0000 [thread overview]
Message-ID: <010701a1ca687d6a-f3414a67-a3da-4e28-9335-27dddf79886e-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261111113135.4023555-5-den@openvz.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] ext4: FITRIM balloon discard merges only logically contiguous extents
--
commit 5d29cebdec45f399e32530ba7c9295bebaf3a2e6
Author: Denis V. Lunev <den@openvz.org>
ext4: discard the balloon on FITRIM
This commit makes ext4_trim_fs() walk the balloon inode after the free
space and discard its unwritten extents that fall into the requested
range. Physically adjacent extents are merged into one discard, and long
runs are discarded in chunks with checks for fatal signals and freezing.
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
[ ... ]
> +static int ext4_trim_balloon(struct super_block *sb, ext4_fsblk_t start,
> + ext4_fsblk_t end, ext4_fsblk_t minblocks)
> +{
[ ... ]
> + unwritten = err > 0 && (map.m_flags & EXT4_MAP_UNWRITTEN);
> + if (unwritten && run_len && run_pblk + run_len == map.m_pblk) {
> + run_len += map.m_len;
> + continue;
> + }
> +
> + ret = ext4_trim_balloon_run(sb, run_pblk, run_len, start, end,
> + minblocks);
> + if (ret)
> + break;
> + run_pblk = map.m_pblk;
> + run_len = unwritten ? map.m_len : 0;
[Severity: Low]
The commit message says "Physically adjacent extents are merged into one
discard, otherwise every cut at the unwritten extent length limit leaves a
partly covered cluster of the image below." Is that description accurate
for what ext4_trim_balloon() does?
When the walk meets a hole or a written extent, the code takes the
non-merge path above. It calls ext4_trim_balloon_run() on the pending run
and then sets run_len to 0. The next unwritten extent then starts a new run
even if its m_pblk equals the end of the previous run:
unwritten extent A (pblk P .. P+n-1)
hole / written extent in the logical range
unwritten extent B (pblk P+n ..)
A and B are physically adjacent but are discarded as two separate runs.
The boundary cluster can then be left partly covered, which is the case the
merging is meant to avoid.
Only extents that are consecutive in logical order and also physically
adjacent are merged. The common case, a split at the unwritten extent
length limit, is handled correctly. Could the commit message be reworded
to say that logically consecutive, physically adjacent extents are merged?
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261111113135.4023555-1-den@openvz.org?part=4
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next prev parent reply other threads:[~2026-11-11 11:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 11:31 [Devel] [PATCH hci-8.1 v3 0/5] ext4, xfs: " Denis V. Lunev
2026-11-11 11:31 ` [Devel] [PATCH hci-8.1 v3 1/5] ms/xfs: don't skip free extents in later batches of a whole-AG FITRIM Denis V. Lunev
2026-11-11 11:35 ` no-reply
2026-11-12 12:07 ` Konstantin Khorenko
2026-11-11 11:31 ` [Devel] [PATCH hci-8.1 v3 2/5] ms/xfs: don't skip free extents of the longest length in " Denis V. Lunev
2026-11-11 11:35 ` no-reply
2026-11-12 12:07 ` Konstantin Khorenko
2026-11-11 11:31 ` [Devel] [PATCH hci-8.1 v3 3/5] xfs: release the balloon inode when xfs_balloon_get() refuses it Denis V. Lunev
2026-11-11 11:35 ` no-reply
2026-11-12 12:07 ` Konstantin Khorenko
2026-11-11 11:31 ` [Devel] [PATCH hci-8.1 v3 4/5] ext4: discard the balloon on FITRIM Denis V. Lunev
2026-11-11 11:40 ` no-reply [this message]
2026-11-12 12:07 ` Konstantin Khorenko
2026-11-11 11:31 ` [Devel] [PATCH hci-8.1 v3 5/5] xfs: " Denis V. Lunev
2026-11-11 11:40 ` no-reply
2026-11-12 12:07 ` Konstantin Khorenko
2026-11-12 12:07 ` [Devel] [PATCH hci-8.1 v3 0/5] ext4, " Konstantin Khorenko
2026-11-12 12:08 ` Konstantin Khorenko
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=010701a1ca687d6a-f3414a67-a3da-4e28-9335-27dddf79886e-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=den@openvz.org \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.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