From: "Denis V. Lunev" <den@openvz.org>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 0/2] ext4, xfs: discard the balloon on FITRIM
Date: Tue, 10 Nov 2026 22:24:57 +0100 [thread overview]
Message-ID: <20261110212459.3158424-1-den@openvz.org> (raw)
The balloon holds filesystem space that never carries data, but its
blocks are allocated, so FITRIM walks past them, and inflating the
balloon is a plain fallocate() that does not discard either. Once the
balloon is inflated over the blocks of removed files, e.g. on an online
shrink of a Container disk, the ploop or qcow2 image keeps those
clusters mapped for good, and compaction, which is FITRIM, does not
give them back (VSTOR-153590).
This series makes FITRIM discard the unwritten extents of the balloon
after the free space, on ext4 (patch 1) and xfs (patch 2). The walk is
read-only, under the shared inode lock of the balloon, which keeps
fallocate, truncate and extent moves away from it, so no block can be
freed and reused under the discard. Physically adjacent extents are
merged into one discard, so that the device below gets whole clusters.
A balloon inflated before this series is released by the next FITRIM,
no userspace change is needed.
The ploop side is openvz/ploop.ovz PR 519: tests for this, and fixes of
the ploop-balloon discard options found on the way:
https://bitbucket.org/openvz/ploop.ovz/pull-requests/519
Tested on 6.12.0-211.52.1.22.19.vz10 rebuilt with this series, alone
and together with the VSTOR-154159 max_discard_segments fixes:
- ploop and qcow2 images with ext4 and xfs: write 2G, remove it without
a trim, inflate the balloon over the free space, ploop-balloon
discard. Stock: the image keeps mapping the removed 2G. Patched: the
image maps about as much as when it was created, a kept file is
intact, fsck and ploop check / qemu-img check are clean;
- fstrim -o/-l discards only the part of the balloon in the range, a
repeated discard changes nothing, and data written over the space of
a deflated balloon reads back intact;
- test_ploop_balloon.py from PR 519: green on ploop and qcow2 with
pytest -n 10. On the stock kernel only the test for the space under
the balloon fails.
Not covered: a read-only mount (the pass is skipped there), ext4
bigalloc, a realtime xfs balloon (skipped). On ploop1, discard works on
whole clusters, so up to two clusters at the ends of each contiguous
piece of the balloon stay mapped.
Denis V. Lunev (2):
ext4: discard the balloon on FITRIM
xfs: discard the balloon on FITRIM
fs/ext4/mballoc.c | 99 +++++++++++++++++++++++++++++++++++++++-
fs/xfs/xfs_discard.c | 106 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 204 insertions(+), 1 deletion(-)
--
2.53.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next reply other threads:[~2026-11-10 21:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 21:24 Denis V. Lunev [this message]
2026-11-10 21:24 ` [Devel] [PATCH hci-8.1 1/2] ext4: " Denis V. Lunev
2026-11-10 21:34 ` no-reply
2026-11-10 21:24 ` [Devel] [PATCH hci-8.1 2/2] xfs: " Denis V. Lunev
2026-11-10 21:31 ` no-reply
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=20261110212459.3158424-1-den@openvz.org \
--to=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 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.