OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: no-reply@sashiko.virtuozzo.com
To: Alexander Ivanov <alexander.ivanov@virtuozzo.com>, den@openvz.org
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v5 3/3] dm-qcow2: truncate unused tail of image on suspend
Date: Sat, 10 Oct 2026 12:53:19 +0000	[thread overview]
Message-ID: <010701a125dffffd-895a244a-90e6-498e-8dab-7d734446d920-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261010124642.927044-4-alexander.ivanov@virtuozzo.com>

> On postsuspend we truncate the image file only down to
> file_preallocated_area_start, i.e. we drop preallocations only.
> Clusters at the end of the file freed by discard (refcount dropped
> to zero) are never given back, so the file size never shrinks.
> 
> Add qcow2_calc_used_end(), which scans refcount blocks backward from
> file_preallocated_area_start and returns the end of the last cluster
> with non-zero refcount. Refcount ranges with no allocated refblock
> are skipped at once. Metadata pages are taken from md cache or read
> synchronously. This is called on suspended device after md writeback,
> so R1 and R2 can't change under us.
> 
> Truncate the file to the used end. Skip the scan if md writeback
> failed, as refcounts on disk are stale then, and fall back to the old
> behaviour on scan error.
> 
> Close and reload to RO go through postsuspend too: on remove,
> __dm_destroy() suspends the live table if it isn't suspended yet,
> and on table swap do_resume() suspends the old (RW) table before
> dm_swap_table(). So the tail is given back in these cases as well.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-148171
> Feature: dm-qcow2: block device over QCOW2 files driver
> 
> Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261010124642.927044-1-alexander.ivanov@virtuozzo.com?part=3


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-10-10 12:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10 12:46 [Devel] [PATCH hci-8.1 v5 0/3] " Alexander Ivanov
2026-10-10 12:46 ` [Devel] [PATCH hci-8.1 v5 1/3] dm-qcow2: add qcow2_md_page_read_sync() helper Alexander Ivanov
2026-10-10 12:51   ` no-reply
2026-10-10 12:46 ` [Devel] [PATCH hci-8.1 v5 2/3] dm-qcow2: drop duplicate prefix from QC_ERR/QC_INFO messages Alexander Ivanov
2026-10-10 12:50   ` no-reply
2026-10-10 12:46 ` [Devel] [PATCH hci-8.1 v5 3/3] dm-qcow2: truncate unused tail of image on suspend Alexander Ivanov
2026-10-10 12:53   ` no-reply [this message]
2026-10-12  9:35   ` Andrey Zhadchenko
2026-10-12  9:59 ` [Devel] [PATCH hci-8.1 v5 0/3] " Andrey Zhadchenko

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=010701a125dffffd-895a244a-90e6-498e-8dab-7d734446d920-000000@eu-central-1.amazonses.com \
    --to=no-reply@sashiko.virtuozzo.com \
    --cc=alexander.ivanov@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=devel@openvz.org \
    /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