From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 2C12980777 for ; Thu, 8 Oct 2026 14:05:10 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 698E3tOt024541; Thu, 8 Oct 2026 17:03:55 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 698E3tOt024541 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="i+74WSA7" Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 698E3eKJ024499 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 8 Oct 2026 17:03:40 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 698E3eKJ024499 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-48c46582442so2787665f8f.0 for ; Thu, 08 Oct 2026 07:03:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvByiZjgeuGBA6jmcgFiElfD1DtIXCtEubXggvkoLopUbm17hK/FZqg3lzrLYlEIemzZcx/18Hg==@openvz.org X-Gm-Message-State: AFq9FYIy8vnOKZae9F5o9dq+c6dxHvI+QHLc8EOeq7cBWOJgVURscCmj DEfJINgRongdFFhqGn8QyApswsOjTeJSNpCgwKI6JuNT9papJ0ClsqZaQPqD1TcUYDubNkp5ZGP MnQiOvY73zn5NPdQ011wtNPoem3gYsu24I6yMBtkOSsl2xm5uRNleDA== X-Gm-Gg: AYBFou1EYDq+bEavpCczFcMgfUZMMMQ6W48zU5THA97hESsyYaFp4wXLcSJ8ZxkKay7 cZPgjRp3W+fEgrEoM2qJv68oQRF4taq8pYny9GU6ha8dy9oGTSSvQGT8emJjinyW84TZEUbsk3z DLtmh7CWG6shSb+5SiDN1MCCjdStw5XFgp43iYRbk7mnrPJIPf9+Vup4GtxqlmrxeQGlMn6tsPi kl9IabePE8niscGsSt+aUK+mGqvJSyKKaP0RQb4VVCHEJwzAxNLrK7rLMp2momG4YknNMN13Ksq hWlT+i936lcCf0UJ2GZ4TTjIQJeLoBINaZKY416ecTAlUnmkO8Ya5UccDejqy5CexUSRIYiMBHE ADL6UDb1BhMa6SOjmix2O6lbR1Xc= X-Received: by 2002:a05:6000:230f:b0:48c:7f53:960c with SMTP id ffacd0b85a97d-48c7f539971mr5432932f8f.10.1791468218911; Thu, 08 Oct 2026 07:03:38 -0700 (PDT) X-Received: by 2002:a05:6000:230f:b0:48c:7f53:960c with SMTP id ffacd0b85a97d-48c7f539971mr5432797f8f.10.1791468217950; Thu, 08 Oct 2026 07:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1791468217; cv=none; d=google.com; s=arc-20260327; b=bSfkGkEYF76kYSJJY+cUQzpqOlbtEN2+Xjn1cSTs+7V+YSwMRDpkvkS6tiN7qvoBwW ME40Q2+tby6RY1H8VNC6gVg8TBx39g5qRdSRzruQK0vu/jGyC7pbbomwHTVCbTPOTYto mVBTVp0nB9fKIiFFzITQsUzsPhTpH9NNa6Ka9hQWj4scSZaB7o3Ron5aKsKjiCJmybIL jRNj6S1XPg2BLDBWEvGaKZteSp8T8KpYUO0CRirZ82QSH8ym/ZVERUmEp4TJF9xzr00a FUGp0Dgrl3+qdpJQ2QqfjQAIbX+qDhZu3ViIb8iCDukv9lVSV+8kkVEEyEMxCZ7FrK27 Ww8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=WlCHfIj2q2Bv2mdkQKzPNIJqKAZEYfZlIZnXJLxXSbs=; fh=jiFD8gjZllyls1UFJ+1kA4uyOnjRU7bVpV3P+S6CTV8=; b=AXhjGsHbk9rUjeLWEG2Pb5vo+i2JKEIk4zVMVmkFyZIOb2Xh3ybH7tS4GP4lBa94po l5pkcuNhv1ohP/K93zuYdfxMbbbgXBJcwVUqNjs2U337Tzpe+Py72H/AF4I1ygZruqAp QDsSd4po86eLEvV9MHlaAb/GYNa31bHv9FLpu7guiSPXEulZcVmA8rqG5WYWNTnsPk22 3I/FTMp31nNUE8Ky1wPRBm6Pe2yj1GaCF33EVy4nVmBk+BvCTgYxCl3wPGEbGvo2F+QP BblgZ++ETTmv9Ga484iUWfuQl2rCON89kUG8rlubPcchvK9/wkVzlZVAx7Glfc4u1mnP mCcw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=i+74WSA7; spf=pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=alexander.ivanov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-48c72498376si10504286f8f.281.2026.10.08.07.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2026 07:03:37 -0700 (PDT) Received-SPF: pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=i+74WSA7; spf=pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=alexander.ivanov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=WlCHfIj2q2Bv2mdkQKzPNIJqKAZEYfZlIZnXJLxXSbs=; b=i+74WSA7wHon b2wcJ+CtY2NtRLqyjg2ki/xXHyiQMi3d/LyaGv+HDIQg+Wv3zm0wGVmrEgUS04ul6k9B52v+Nz5jL OtDIJq0q1Ly511xa5IaA7tU9M43mGG6IRhZblnm7H7lZm1+uQ+MnivXlRNVXZX8+QEAnMVKr2/iHg 4r0AzRCwR1VEMHcyYfU9CsnF71kZvsEH5c31YOHxojM2Pi0BE3IpH5NvNPgkQvOE9F+cQ4L5aq3QG HX0F27WIVwIUimPk4aYDMHhq5TpJpdYJaAvXkBnkfZZjG7/H75CcDfcac415HY+ydTC02IR+vGC17 VZnkuPgAI+njIBrhErKS/w==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=sky) by relay.virtuozzo.com with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1xEofN-00FAkW-0b; Thu, 08 Oct 2026 16:03:34 +0200 From: Alexander Ivanov To: den@openvz.org Date: Thu, 8 Oct 2026 16:03:28 +0200 Message-ID: <20261008140333.614909-1-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v3 0/5] dm-ploop: truncate unused tail of top delta on suspend X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org 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