From: no-reply@sashiko.virtuozzo.com
To: Vasileios Anagnostoulis <vasileios.anagnostoulis@virtuozzo.com>,
Konstantin Khorenko <khorenko@virtuozzo.com>,
"Denis V. Lunev" <den@openvz.org>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.2] dm-qcow2: report the unit L2 can unmap as discard granularity
Date: Tue, 1 Dec 2026 00:13:08 +0000 [thread overview]
Message-ID: <010701a22ef2b7c2-fce9ea7e-abed-41d0-9799-ffa943bbdb2c-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261125-br-vstor-154496-v1-1-dd8d86661647@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] dm-qcow2: larger discard_granularity stops fstrim reclaiming
sub-unit extents
--
commit f99effe256258fbc884b886dfde94f2336c8f3b2
Author: Vasileios Anagnostoulis <vasileios.anagnostoulis@virtuozzo.com>
dm-qcow2: report the unit L2 can unmap as discard granularity
The patch changes qcow2_io_hints() to report the L2 unmap unit as discard_granularity. That unit is the subcluster with extended_l2 and the cluster otherwise. Before, it reported the host filesystem block size.
> diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c
> index d445bfe1232a6..a343266fb1beb 100644
> --- a/drivers/md/dm-qcow2-target.c
> +++ b/drivers/md/dm-qcow2-target.c
> @@ -1117,10 +1117,15 @@ static void qcow2_io_hints(struct dm_target *ti, struct queue_limits *limits)
> if (sb->s_bdev)
> block_size = bdev_logical_block_size(sb->s_bdev);
> /*
> - * Even if this is less than discard_granularity of bdev,
> - * we can free a block on filesystem.
> + * Report the unit L2 can unmap: the subcluster with extended L2,
> + * the cluster otherwise. The block layer aligns discard split
> + * points to this granularity only; with a smaller one, a long
> + * discard that starts mid-cluster is split at the same offset
> + * inside every cluster, and the (sub)cluster under each split is
> + * covered only in part by both pieces, so neither unmaps it.
> */
> - limits->discard_granularity = sb->s_blocksize;
> + limits->discard_granularity = qcow2->ext_l2 ? qcow2->subclu_size :
> + qcow2->clu_size;
[Severity: Low]
Does this change drop host block reclaim for free extents smaller than the new granularity?
discard_granularity is also the minimum trim size that filesystems use. For example, ext4_trim_fs() raises minlen to the granularity, so free extents shorter than one cluster (or one subcluster with extended_l2) no longer reach dm-qcow2. Before the patch, such extents reached issue_discard(). It punched the host blocks even though L2 was not updated. With 1M clusters and no extended_l2, free runs under 1M are no longer reclaimed on the host.
The removed comment said the 4K granularity was deliberate ("we can free a block on filesystem"). Neither the new comment nor the commit message mentions this cost. Could they state that the trade-off is intended?
Carry the trailer below into the next revision and Sashiko will not review this patch again.
Reviewed-by: Sashiko <no-reply@sashiko.virtuozzo.com>
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261125-br-vstor-154496-v1-1-dd8d86661647@virtuozzo.com?part=1
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
prev parent reply other threads:[~2026-12-01 0:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 11:16 Vasileios Anagnostoulis
2026-11-25 18:17 ` Denis V. Lunev
2026-12-01 0:13 ` no-reply [this message]
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=010701a22ef2b7c2-fce9ea7e-abed-41d0-9799-ffa943bbdb2c-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=den@openvz.org \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.com \
--cc=vasileios.anagnostoulis@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