All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
To: den@openvz.org
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 v3 0/5] dm-ploop: truncate unused tail of top delta on suspend
Date: Thu,  8 Oct 2026 16:03:28 +0200	[thread overview]
Message-ID: <20261008140333.614909-1-alexander.ivanov@virtuozzo.com> (raw)

Preallocated space and clusters at the end of the top delta freed by
discard are never given back, so the delta file never shrinks. This
series makes dm-ploop truncate the unused tail of the top delta on
suspend, so that userspace doesn't have to do it by hand.

This needs some preparation. On "dmsetup reload" the new ploop reads
metadata in ploop_ctr(), while IO still goes through the old one, so
after resume it may work with outdated BAT and file sizes.

Patch 1 fixes a lost wakeup of the allocator thread, which may leave
a preallocation request pending forever, so waiting for it on suspend
would hang. Patch 2 fixes raw and empty delta handling, patch 3
factors out ploop_read_delta(), patch 4 reloads all the metadata in
ploop_preresume(), and patch 5 truncates the top delta to the end of
the last used cluster (BAT area, mapped cluster or format extension)
on postsuspend.

The corresponding ploop userspace changes:
https://bitbucket.org/openvz/ploop.ovz/pull-requests/486

https://virtuozzo.atlassian.net/browse/VSTOR-148171

v3:
- Split from the common series with dm-qcow2: dm-qcow2 patches are
  sent as a separate series. Patches 3-6 of v2 are patches 2-5 now.
- Patch 1: new patch.
- Patch 2: also skip applying the mappings of an empty delta, as BAT
  iterators can't handle nr_be == 0.
- Patch 4: wait for inflight_md on postsuspend, as data bios are
  completed before BAT writeback is finished, and use wake_up() for
  inflight_md_wq; reload metadata under memalloc_noio_save(), as the
  device is suspended; restore m_Sig, m_Type and m_Sectors on reload
  failure.
- Patch 5: don't truncate anything if m_FormatExtensionOffset is not
  cluster-aligned or out of range; truncate under memalloc_noio_save().

v2:
- Add dm-ploop support (patches 3-6), as requested in v1 review.
- dm-qcow2: move get_md_page_sync() to a separate patch as
  qcow2_md_page_read_sync() and use it in qcow2_parse_header() as well.
- dm-qcow2: start the refcount scan below file_preallocated_area_start
  instead of the end of the file, and truncate to the used end directly
  instead of min(file_preallocated_area_start, used end).

Alexander Ivanov (5):
  dm-ploop: fix lost wakeup in ploop_allocator()
  dm-ploop: set delta is_raw before applying its mappings
  dm-ploop: factor out ploop_read_delta() from ploop_add_delta()
  dm-ploop: reload metadata on resume
  dm-ploop: truncate unused tail of top delta on suspend

 drivers/md/dm-ploop-bat.c    | 260 +++++++++++++++++++++++++++++++++--
 drivers/md/dm-ploop-map.c    |  77 +++++++----
 drivers/md/dm-ploop-target.c | 122 ++++++++++++----
 drivers/md/dm-ploop.h        |   8 +-
 4 files changed, 403 insertions(+), 64 deletions(-)

-- 
2.53.0

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

             reply	other threads:[~2026-10-08 14:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 14:03 Alexander Ivanov [this message]
2026-10-08 14:03 ` [Devel] [PATCH hci-8.1 v3 1/5] dm-ploop: fix lost wakeup in ploop_allocator() Alexander Ivanov
2026-10-08 14:07   ` no-reply
2026-10-08 16:51   ` Denis V. Lunev
2026-10-08 14:03 ` [Devel] [PATCH hci-8.1 v3 2/5] dm-ploop: set delta is_raw before applying its mappings Alexander Ivanov
2026-10-08 14:09   ` no-reply
2026-10-08 16:51   ` Denis V. Lunev
2026-10-09  6:28   ` Alexander Ivanov
2026-10-08 14:03 ` [Devel] [PATCH hci-8.1 v3 3/5] dm-ploop: factor out ploop_read_delta() from ploop_add_delta() Alexander Ivanov
2026-10-08 14:08   ` no-reply
2026-10-08 16:51   ` Denis V. Lunev
2026-10-08 14:03 ` [Devel] [PATCH hci-8.1 v3 4/5] dm-ploop: reload metadata on resume Alexander Ivanov
2026-10-08 14:18   ` no-reply
2026-10-08 16:51   ` Denis V. Lunev
2026-10-08 14:03 ` [Devel] [PATCH hci-8.1 v3 5/5] dm-ploop: truncate unused tail of top delta on suspend Alexander Ivanov
2026-10-08 14:15   ` no-reply
2026-10-08 16:51   ` Denis V. Lunev

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=20261008140333.614909-1-alexander.ivanov@virtuozzo.com \
    --to=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 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.