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 3923580726 for ; Thu, 8 Oct 2026 07:40:06 +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 6987cnOd021048; Thu, 8 Oct 2026 10:38:50 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6987cnOd021048 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="GlOxfRRO" Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6987ci2r021015 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Thu, 8 Oct 2026 10:38:44 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6987ci2r021015 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4a17e77c5b1so15079415e9.1 for ; Thu, 08 Oct 2026 00:38:44 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBwBzSbsy2R8i9qXfKOGhBgN+OyfXc5eLexlwkUKNtlsxRA+gHs8UO9nUdrIawoHS4FDse6w7g==@openvz.org X-Gm-Message-State: AFuF++lMMbYbBrHEXmNExnnBhlOrgaOi6rXzkKkdXV/SoEXItQAFLjw4 pJkWf0XgmuiLLCJ60I6Roxo2WBW6NNgBeatocGeNzNjOgQxX3T0x14EZw+ahpJ9wOKuEXSc9K0/ 11dLr7V7eq4vmgeyQg1mODnYx5ZY/KAx12/t4Bz3033vhEDgzjh8ZOw== X-Gm-Gg: AYBFou36/qfdx+st4JQgy1imygbYyh1baRqbB8fVBOw47OkZDEbXPuJcbwAyZUiLNLG EzQUkaufqfsHfGwxxK1rbPEGTrLZa2ufcAm4MkHGop4oGDSo5/ftJdfC3rzkO9DPjS5PHU0Jgpp vsCL5cY09dyUlFsmjX5jGnmh7PTO4xrm/qTZ5XrP8esOyiFybhVkUES9ra1uJ8HTG0WWurvxzR5 +OvacwsrQJaN3DhbqlhBlgJEsYp5JolTif0ZZ6basZyzoTqmcFu5KWfkTVa1SVZ0zYGH85eMplt 8FpASR7Gp5siI3HescnyQpmBQAZG46pxGqn+/yGxmDvITTjowNEB606FnNwmz347SiECVLaNk6L 0u9/v1M+lQYUPdjEYhb4wUocC3p8= X-Received: by 2002:a05:600c:3e0a:b0:4a1:6c79:fd31 with SMTP id 5b1f17b1804b1-4a180459354mr74377815e9.12.1791445124410; Thu, 08 Oct 2026 00:38:44 -0700 (PDT) X-Received: by 2002:a05:600c:3e0a:b0:4a1:6c79:fd31 with SMTP id 5b1f17b1804b1-4a180459354mr74377355e9.12.1791445123822; Thu, 08 Oct 2026 00:38:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1791445123; cv=none; d=google.com; s=arc-20260327; b=YGJUpSqwFSjv09eccc1QUSLMuXE+mSoHlkOYW8f8J+d8fGVc96p7OKQwL1n+hiwiU4 J0whzmmTbV74Ct/lsTNu8iKlEVpUNh1mCPT0I9GC+O2OEauEYx7jh+B8l+rWR2j36PKa AE3qg9XF2YwtG4qjs8aN1+rabVUsTBves49G5zE2eXCwQfaYkpSOBTTWcnYqgKflQnTU HPkhtxDssPMbyaHMN33Jk0VXSJe6wLdDhBrfZNwj9uhsoqELrbmuZwg3LiH95/AtGS2d 2FDC5vsqRsK1zr2Pk6gCaJRvNGN2lDn5lEiW6H8V1mJqCopkR+r8Jr+Pjqs2OmeIsSVV jr/g== 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=jysyEW8OnVM8eMPdhMU/xKpteczRpFciQOORnpyd5L0=; fh=iR+h9bi3Bh9zMcmhT/g9qNPJn2rboPnO22cA9JfMqyc=; b=r5oVZTpBAe08PE73QFUM/a8juOkL2VSNqwiHbfcxnQHYaOra+pKGitEh40wuMEipW2 4jMGqW95uDjfYF0rcjD3g2MhcVO7zW6Pqs0VkwwbVpOAyipHOJqtEMWNsqfg3HpFXwcv QF/TKNzUHazOQnTt6rP/xzY2D23wfiIWmvIwT+kl+pcC1CotnrdhLEF8U4D7owkKWZxy Y3e2W8QcgR4EZ/SSXBakXaBWQXgx0nb06axYYOppn6rY0iZKc+Mv3JotD2uQnsuzFqcH ofK5f8FAsjihHz3zcZ+hScHylDniPHC+g9ckWlHvcl/ktZX1r9vmQxK84KBXr2AtjdKz +i4w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=GlOxfRRO; 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-48c724b4b0csi9010829f8f.431.2026.10.08.00.38.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2026 00:38:43 -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=GlOxfRRO; 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=jysyEW8OnVM8eMPdhMU/xKpteczRpFciQOORnpyd5L0=; b=GlOxfRROvuR+ 3lEi78ILnfnY4mTBzAfHNAf7LXohstcb42E1OLv1XOd5m2G+8yEa+sAqG0fOwr9zcNrXXmTqx+clq rhqjtpZbLXY+KJ85k8zgwNe4n/KZdzMcK14+IYbi9onabAZkhwQorJbL+GTjlqHGbSkSxzRgfTBg5 EQH5ekfEDXeHGGkj7D6Bll6j/XK/hZFtfRHDR5+YYrc+ZBpzC6YW+AlCduxlo7e7xUv+G6DwIJEqP SDluKxQEKxjfarB5hY4jNVFSmjMCBlE/vDRDTVf+u8L+bMCJaFrqXm7g3EOtFDBAuITe38gGkxsG+ OnfpkiPQ8SvoAktnABxkKQ==; 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 1xEiet-007naT-2a; Thu, 08 Oct 2026 09:38:41 +0200 From: Alexander Ivanov To: den@virtuozzo.com Date: Thu, 8 Oct 2026 09:38:30 +0200 Message-ID: <20261008073837.510678-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 v2 0/6] truncate unused tail of images 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 an image freed by discard are never given back, so the image file never shrinks. Truncate the unused tail of the top image on suspend in both dm-qcow2 and dm-ploop, so that userspace doesn't have to do it by hand. dm-qcow2 (patches 1-2) finds the end of the last cluster with nonzero refcount by scanning refcount blocks backward and truncates the image to it on postsuspend. dm-ploop needs more 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. Patches 3-4 fix a raw delta handling bug and factor out ploop_read_delta(), patch 5 reloads all the metadata in ploop_preresume(), and patch 6 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 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 (6): dm-qcow2: add qcow2_md_page_read_sync() helper dm-qcow2: truncate unused tail of image on suspend 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 | 229 +++++++++++++++++++++++++++++++++-- drivers/md/dm-ploop-map.c | 26 +++- drivers/md/dm-ploop-target.c | 100 +++++++++++---- drivers/md/dm-ploop.h | 8 +- drivers/md/dm-qcow2-map.c | 53 ++++++++ drivers/md/dm-qcow2-target.c | 48 +++++++- drivers/md/dm-qcow2.h | 3 + 7 files changed, 421 insertions(+), 46 deletions(-) -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel