From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 86ED38017D for ; Wed, 11 Nov 2026 11:33:04 +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 6ABBVe4c027624; Wed, 11 Nov 2026 14:31:42 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ABBVe4c027624 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1794396705; bh=xXEXjRtxCT4tdqDf/u2PMEnOCIfl1sdwSbV9A/BECT0=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe; b=rwu74Wg1dq00B3Vde8peX26BRdBf8KDCgI2xWw0dAcE+BxFCk8SkREQn7nL5WvmBR 3U+lf2q+x1YNRmGjkey9JksYzheKMfWuhCfgR0wkg4XNJqtdLDZNSGuX2K6Tgmf6En UxKeLm4bpCHo3Gig7NlXCEKT7U8C0u2XpzR+MfLO4orhK6jT2vR4mPdZUc601Fyflh 56KxFy2EWLcoJ5jMzsrfgodUlDEdAt8yyd+v5O/v1bunro4e84+IwYaAYgVqdxKYNt VK8VOqJo1rjx3vuMcEaqsXFSe29soe0gC231jYXe3vUX03kITQKoPxTshpblc2hWdb IypelWuOadEeA== 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 6ABBVd15027616 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 11 Nov 2026 14:31:39 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ABBVd15027616 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="PxWK8fob" Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-48e4d1e29f3so2956818f8f.3 for ; Wed, 11 Nov 2026 03:31:39 -0800 (PST) X-Gm-Message-State: APuU4Z8D5u9VYh/9Md2h7AFpt0NgG0Y8AAEc2UFrjnrUh5+r6gBim6dK E6BHh+uyn2qD5sS+iX2cjLHdFSCx3o7sjH2Jxdf/bvEoo5ORG1TPdxR/wTsPJwbme4u/AWZrcoT jxTQAaav+BxbL3Vi4JkfSUMlnSnJV4GqWl2GohqJR0WqFWSNOg73XAA== X-Gm-Gg: AYBFou22HuUT9UZtWRezTUFQcubCPKwB0nyAXn86Vde9+g89rwdTOvbebUMf5PISwUL P1iVnpjgxXs/hy2WTd2jMy+1RQcd795fpDxu8+yNx7FfwtN4FOo13ghny7ozcWhf4ovKCXB0qsU kkcdcqMvU5o7UU+Bts9u7ygWoZojfGjX0v5iI7B16HTYqv79IeIzlv3uApSMEx1JDAuyiaGUokT TCYKELJLAdFueLcK5rFMRytO1HZkRLjpoUB6t7AkXbEuMRpfXEcFJHtfYcTfUUPQBRo0vcL56Ez QSfnoAkEZQ== X-Received: by 2002:a05:600c:a4d:b0:4a1:9661:14b5 with SMTP id 5b1f17b1804b1-4ba0938e39emr40412945e9.29.1794396699213; Wed, 11 Nov 2026 03:31:39 -0800 (PST) X-Received: by 2002:a05:600c:a4d:b0:4a1:9661:14b5 with SMTP id 5b1f17b1804b1-4ba0938e39emr40412415e9.29.1794396698846; Wed, 11 Nov 2026 03:31:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794396698; cv=none; d=google.com; s=arc-20260327; b=Fit480ucx6ZvhdtzlKinHz3ThtU6D4B3mx2zRSRtW+keWfVCJKjS2liEGuCDA1Md8g e7lzVE1w2rE/HUFIF+X278uhdwf1iR7fa1MtYws74L53i2wS7OvzbLs+0dNvbVjE/jWQ sJYlfnNQhva/FScxeabdU8thCGPbSlKJ3S0YHt1FFJBnvr8apKRE0lD3idvVHTKPVowT X/8YmcnX4dJdxpyA0SQH4j9tsQAtRHaP5J3dTzaqlhzVePC54z9dXRa4INco4y8BMGpu nngloMenl4p3lDuOZJXYBzPoJA2XYvts8hovw1jeuF+28OhYMwCc8/XTxrRMrZ7ztnca ya+w== 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=+g6fHOMR9n6tGevUH6WzQBjHcJKDCPfVPRE1piBDS60=; fh=WpT6aB7RBAGHZeWZzqAr71yzRFbPTYkPWKsRagLn48Q=; b=oh5rJjzPFkjTBPzNDO7Jky3qn2bZgeiWLk9CIBfihxfw9G/HbxBOTbETRAVzcokeSD yxLjswfvO+W1r1He9PlTMRLlX1/rkDAtofs31VNhtWrOzTbzQKwJO/UdHpkWzg1WHlDM xJkx0n7Wf+QYwRcRB5ujkIDiirrzlCoflUQPP3dtlNDevPq4UCj82eUiqJMlc+A12MA/ CLSCqBKtzDDDikT5Nwl0NfZCKNhBcEiST1+BvPN+i4lGZJfj6kf5vjxow86rutgncRiL AhNC0x3Vmhzkn1/RNZwuxToqGmqScIrnOD+iiffVz0rPslkSq/b94tsMSICq2mbS8ANq i+FA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=PxWK8fob; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:c3:490a:ca77:c5a4 as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-49833f48eddsor1051806f8f.13.2026.11.11.03.31.38 for (Google Transport Security); Wed, 11 Nov 2026 03:31:38 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:c3:490a:ca77:c5a4 as permitted sender) client-ip=2a06:5b06:b600:300:c3:490a:ca77:c5a4; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=PxWK8fob; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:c3:490a:ca77:c5a4 as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1794396698; x=1795001498; darn=openvz.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=+g6fHOMR9n6tGevUH6WzQBjHcJKDCPfVPRE1piBDS60=; b=PxWK8fobMbg1PawIAMgHL+RPQc0QTnYawnYHtmM1pZogOvNlvrE7/tMswvsLMJ7l2/ ZEygJcVXcnvAaGEvRr/2TltR9AkfxPBrZtlbE/XvA4WC8dw4IzcNKn/DNZS2EiYJBVOq UeUWMOb9C+asii4FZ2DLAAVkzl50FzDGRiTtK1jIFLfUIkb1cwjKRgX7yUb8lmSkOwMc qdiNCkKs9Jvw0nRYfb4kAxYLjcXG3iSlUUpk4jfVPSlKTJNyNLiXqNI/5pPgEcRi4x+L BIKOZB10bOO924B6ovPPyXdnMNpOogz9DtmjHbZYAchcECHfKyZ5ywU9vW5TBqeDGmRh 7lqg== X-Received: by 2002:a05:600c:6994:b0:4a2:150f:1609 with SMTP id 5b1f17b1804b1-4ba09364b87mr40346625e9.8.1794396698250; Wed, 11 Nov 2026 03:31:38 -0800 (PST) Received: from athena.sw.ru ([2a06:5b06:b600:300:c3:490a:ca77:c5a4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4ba08ddbe68sm88679885e9.0.2026.11.11.03.31.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2026 03:31:37 -0800 (PST) From: "Denis V. Lunev" To: khorenko@virtuozzo.com Date: Wed, 11 Nov 2026 12:31:30 +0100 Message-ID: <20261111113135.4023555-1-den@openvz.org> 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] ext4, xfs: discard the balloon on FITRIM 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 The balloon holds filesystem space that never carries data, but its blocks are allocated, so FITRIM walks past them, and inflating the balloon is a plain fallocate() that does not discard either. Once the balloon is inflated over the blocks of removed files, e.g. on an online shrink of a Container disk, the ploop or qcow2 image keeps those clusters mapped for good, and compaction, which is FITRIM, does not give them back (VSTOR-153590). This series makes FITRIM discard the unwritten extents of the balloon after the free space, on ext4 (patch 4) and xfs (patch 5). The walk holds the inode locks of the balloon exclusively, after waiting for direct I/O and flushing its page cache, as punch hole does, so no block can be freed, reused or written under the discard. Physically adjacent extents are merged, so that the device below gets whole clusters, and a long run is discarded in interruptible chunks. A balloon inflated before this series is released by the next FITRIM, no userspace change is needed. Patch 3 fixes an inode reference leak in xfs_balloon_get() that FITRIM would now hit too. Patches 1 and 2 are mainline fixes of the xfs FITRIM free space walk, merged for 7.4-rc2 with Cc: stable. hci-8.1 carries the RHEL backport of b0ffe661fab4 ("xfs: fix performance problems when fstrimming a subset of a fragmented AG") and has both bugs. The ploop tests ran into the second one: of several free extents of the longest length in an AG only one is discarded, so whether FITRIM gives the space back depends on where xfs put the files. The first one makes later batches of a whole-AG walk skip the free extents below the block they restart from. The ploop side is a stack of openvz/ploop.ovz PRs, 523, 520, 521 and 519. PR 519 holds the tests for this series and goes in after it: https://bitbucket.org/openvz/ploop.ovz/pull-requests/519 Changes since v2 (https://lore.virtuozzo.com/kernel/20261110222756.3236854-1-den@openvz.org/): - add the mainline xfs FITRIM fixes as patches 1 and 2; - skip an empty balloon before taking its locks. A non-empty one is still walked whole on every FITRIM, whatever the range; the notes in patches 4 and 5 say why (Sashiko); - xfs: convert minlen to sectors in 64 bits (Sashiko). Tested on 6.12.0-211.52.1.22.19.vz10 rebuilt with this series and the VSTOR-154159 max_discard_segments fixes: - test_ploop_balloon.py of PR 519 on ploop and qcow2 images with ext4 and xfs is green, dmesg is clean. It covers discarding the space under a balloon inflated over removed data, deflating it and writing over it, online and offline shrink, and free runs a few clusters long released by a default discard. The xfs case of the last one fails on v2 of this series, without patches 1 and 2, on both image formats; - the fstrim time and SIGKILL checks of v2 were not repeated: the walk itself did not change. Not covered: ext4 bigalloc, a realtime xfs balloon (skipped). On ploop1 discard works on whole clusters, so up to two clusters at the ends of each contiguous piece of the balloon stay mapped, as do pieces shorter than the FITRIM minimum length. Daejun Park (2): ms/xfs: don't skip free extents in later batches of a whole-AG FITRIM ms/xfs: don't skip free extents of the longest length in a whole-AG FITRIM Denis V. Lunev (3): xfs: release the balloon inode when xfs_balloon_get() refuses it ext4: discard the balloon on FITRIM xfs: discard the balloon on FITRIM fs/ext4/mballoc.c | 126 ++++++++++++++++++++++++++++++++ fs/xfs/xfs_discard.c | 170 +++++++++++++++++++++++++++++++++++++++++-- fs/xfs/xfs_super.c | 4 +- 3 files changed, 291 insertions(+), 9 deletions(-) -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel