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 0CCA28017D for ; Tue, 10 Nov 2026 21:26:28 +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 6AALP6Uw018775; Wed, 11 Nov 2026 00:25:08 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AALP6Uw018775 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1794345911; bh=oBV6WEiA/aKNvEeQmyz0joBGFi/o4BxXSk4dWpXpc1w=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe; b=mW5H7kP3s7ekF9pJMKqkrfIp9y2DaYUd4jaLjMjRuCvGzgb7nHsT8fPSMoCp9evER jkbrVpC+8V8c5L4ZaDBRuPKTMVs5Tugel6x1f+I+y4xTBMYME+L6J5Um/314QDAgLt Y0ELKcWFqdSr3RD0TrwTsqg1tmV6MGAuGOErBXJh5SMV3JEbPHtct5vZijFZms4fHl S/dVvNhqUpJYnLKV8kzWf+hRl9XEPwyteWM/s6jRHoPoEqsaFaPPHZ6/GxO+bD5GyL 8KstMkfA7FEf8/Ps6YtlBSTA4vyJU8KzrrcCyDXPY+TsUFvpmDAacz+vCcsXsU6Dty q6ErfJyhMZ4VQ== Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AALP4hw018767 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 11 Nov 2026 00:25:04 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AALP4hw018767 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="LBaCwOeU" Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4ba078f26f4so4931115e9.2 for ; Tue, 10 Nov 2026 13:25:04 -0800 (PST) X-Gm-Message-State: APuU4Z822vskNH9CIegS/23SMysl7oN6YZeudXb+Iq1U5iRX52yh8amU 0/fAFoI47HqVNU29tmpgAwjJiFE0a8iGbHkX8oztUSbb6C6kyROw/6p6suwUscCMS3VAOaiFp9m BRb4SbgeqdM5Thqi+NfEiXb1B1FjZKb/emzsIoQ8b5Pk6sabZv3wsHg== X-Gm-Gg: AYBFou2fByvIhPglY4hP47HPDm2bOrVHqr0TuOMLGVP2h+sgENQsaiee8lPtSG0Lavw jdiWHXUHvXnJl1jOfeO9rc5BcsGsfQ9XlyVH4HsSrEGlV5SMlLiHsfLj6a0R0qXc1HwKBbBfS6l +VWDckfKd+TkTEHlSM/lJ7ctBIRNgrbtBxu1jXsMKcbJSTwANNZvnRwkf+R02jsBF1R7tNg7o+7 dTEcM8Pn5ecyABAqplMDISWDN+yVsg20t50koYOVBUEmdqwPAS1zlNgACYft+DHTZeJ2n3o/o1Q Rv77jDT10g== X-Received: by 2002:a05:600c:a012:b0:4ab:c447:49df with SMTP id 5b1f17b1804b1-4ba09377779mr5453135e9.23.1794345904248; Tue, 10 Nov 2026 13:25:04 -0800 (PST) X-Received: by 2002:a05:600c:a012:b0:4ab:c447:49df with SMTP id 5b1f17b1804b1-4ba09377779mr5452965e9.23.1794345903889; Tue, 10 Nov 2026 13:25:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794345903; cv=none; d=google.com; s=arc-20260327; b=HITuYgb2OjaD6FC/6c0EhVpizQptLwCVRAf8QWJF39JTAq95tfEZvOPxUacHFk68TJ 743mxq3acJ4AA6oQSUWeNVku9y7trFxmGLpqZoNm/yvndgsJ297brfNnZAxGlgsJUDCo 4vqZ1E6TLGkEA76Mti4/ujEB1CrZfl48aZeZCGt4C9zqH6j3OJzLosRIQUNDtR+AnIz3 ET+2/LXlPX/xmnMnkASuKHpCU6Fb2hVBIHbqgf2BSMRo9IDXknN+4ptcVG492pSQHlYy HioGF7esdr+VLyUb31v9QD00hgJfhEgsMaTBnGmSb3vq1VbsWnc1OyDHyfHOvb/62ncr dSzA== 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=tCChyDnBmQorDfCUVblxjAqEE+fbUAzX6QZWJ1tz6Hk=; fh=ozrYJQ1t3QIP6s65KBq5xgJxiFM2qf+5wwn3ABTusyU=; b=HYmj7wc3U+W8tJ/N3+DXS53hYojeNrWZwq2m2sLTlBQgDznGe12idZYwIiOe+i4u4c NhjU4gnXVtu4NavtsfuoMeLVatejG4DKQ4f3OUw44dH3iA1Hxdc5gZZFTzkN+61U0DFx K2obAyIcciHzZbSz97XKPzloPHrK908T1B/QmpeC3no6AEWPVJJfwQ3og3lUVBaKxUbK EgzXgNMIR4jevrLlBvvM3JNJ7FsecMeBo7Hi3GFkMMwiCqb8pUQcr4yY/N+MoJtrHa9k wayO1KnWOQnyjG8v6C8b29a7othJUyi/8/Eww55SQa348w94cny68sI/yci8RkFiIglw LcFQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=LBaCwOeU; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:4f78:6441:d0f1:22af 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 5b1f17b1804b1-4ba01ff858csor6554165e9.14.2026.11.10.13.25.03 for (Google Transport Security); Tue, 10 Nov 2026 13:25:03 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:4f78:6441:d0f1:22af as permitted sender) client-ip=2a06:5b06:b600:300:4f78:6441:d0f1:22af; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=LBaCwOeU; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:4f78:6441:d0f1:22af 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=1794345903; x=1794950703; 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=tCChyDnBmQorDfCUVblxjAqEE+fbUAzX6QZWJ1tz6Hk=; b=LBaCwOeU8COwD8P1GLrVhFQKRGuXnbKs3EaWl1RVWz+hwtu+K78BPx/6pEI7NmQdLX PWvR7YzQbbNOxODGfc5rL0xzadyNNVSbJQ/6GuepXQw//PkGQyHLi/c7Jt8jbuCPFQFN qYP0Eja1Ycefo0dXHFTjjqONO0qNkFnbo2U6ETUjeYuwZ4XKWNETXtGgzsRQDwubAGzp IphwSNeH2wek5XaoBESMWu1dWMnNCvgOtRJStQOuYPrc9JN1PqwNETrQFYNTk8pq2nfE GvMgQsR0Or8zHk9nKZFwiibBm+pllPpQzNx+CH9Hpc2C6DQGvmIxt/TDbPTdUI2w19t7 7OPA== X-Received: by 2002:a05:600c:6308:b0:4a1:a2c0:7b73 with SMTP id 5b1f17b1804b1-4ba09381ed4mr6139965e9.30.1794345903371; Tue, 10 Nov 2026 13:25:03 -0800 (PST) Received: from athena.sw.ru ([2a06:5b06:b600:300:4f78:6441:d0f1:22af]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49835d2c05dsm7051999f8f.25.2026.11.10.13.25.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 13:25:02 -0800 (PST) From: "Denis V. Lunev" To: khorenko@virtuozzo.com Date: Tue, 10 Nov 2026 22:24:57 +0100 Message-ID: <20261110212459.3158424-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 0/2] 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 1) and xfs (patch 2). The walk is read-only, under the shared inode lock of the balloon, which keeps fallocate, truncate and extent moves away from it, so no block can be freed and reused under the discard. Physically adjacent extents are merged into one discard, so that the device below gets whole clusters. A balloon inflated before this series is released by the next FITRIM, no userspace change is needed. The ploop side is openvz/ploop.ovz PR 519: tests for this, and fixes of the ploop-balloon discard options found on the way: https://bitbucket.org/openvz/ploop.ovz/pull-requests/519 Tested on 6.12.0-211.52.1.22.19.vz10 rebuilt with this series, alone and together with the VSTOR-154159 max_discard_segments fixes: - ploop and qcow2 images with ext4 and xfs: write 2G, remove it without a trim, inflate the balloon over the free space, ploop-balloon discard. Stock: the image keeps mapping the removed 2G. Patched: the image maps about as much as when it was created, a kept file is intact, fsck and ploop check / qemu-img check are clean; - fstrim -o/-l discards only the part of the balloon in the range, a repeated discard changes nothing, and data written over the space of a deflated balloon reads back intact; - test_ploop_balloon.py from PR 519: green on ploop and qcow2 with pytest -n 10. On the stock kernel only the test for the space under the balloon fails. Not covered: a read-only mount (the pass is skipped there), 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. Denis V. Lunev (2): ext4: discard the balloon on FITRIM xfs: discard the balloon on FITRIM fs/ext4/mballoc.c | 99 +++++++++++++++++++++++++++++++++++++++- fs/xfs/xfs_discard.c | 106 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 204 insertions(+), 1 deletion(-) -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel