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 7ADA8803F7 for ; Wed, 11 Nov 2026 11:33:11 +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 6ABBVs0N027655; Wed, 11 Nov 2026 14:31:55 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ABBVs0N027655 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1794396718; bh=AfvVpEpOo6ghWZEs9U22eNulJ+EDO37duRS6RSCIpKg=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=uB7h13iUZIzAsacEdrJF5hENbzDbYsABhs0KC7cSfBycm86rEcOEIx6mn+/L6kwJJ G17ml16bO5/nE/dJ8K6nWtA9Q088cKK62+8Po5OAOnNYmqKV8491DWNJkHWlPijCu5 cnVaPvTzZXBIDsUawxZCV+gbP3M/F6Pw9iW58fSO0+7c6F9CETOm5N37tNrj+dR3r4 idWu0f1/LdDvIfPHkaJimlrHibgDBaw7EHmYjz0QIbI0tG1winywbfNBFBxm1El2A5 zSC1Q1cF6eDLjYHucpqW+jFhaVgy0cMHX2RX6GoOqCmCxe0SUDxQ30yJSV4khyFvXD Z8l9YYiIJT8PA== 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 6ABBVgm9027627 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 11 Nov 2026 14:31:42 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ABBVgm9027627 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="VPDIkXL2" Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4a1fdde384cso20225315e9.3 for ; Wed, 11 Nov 2026 03:31:42 -0800 (PST) X-Gm-Message-State: APuU4Z/5ah/h8wUVOyA8rO3fKKRAsfmfb2FtCZuIlGZnWXVtg8dCs5Lw NnuN9JJZ22FnS0msh3FLAY4uCMznXUkI7Su9ZkJkcEurtJi2nFE9iCTdGbWPyVh9oq6utAO2ISe V7gnPuZFbwYBlJSiMXAlJHxWCk+05c+UofOKcoF8bM/2F2Tp5xy+glg== X-Gm-Gg: AYBFou3PAqCqVCG6DiIH5oc4xYlI9ufFWeKomJqrij/cITWkngSdgs9FVVd2lEAjHl7 uNQV1pEXc2XLcJvf5ie4uLONFklXqfUuVk21UBU9JJd9lwwF4kEIVYM3GA9FrXk5YqEe02r4bV1 bfdAcYhDMFfITIdheD5Jk9iHQFF/xSXaMcyK8gol/EjlAJ1fpgxCFeKEqPzwvFfUiU72Q/1K8+f 3hSCJCr/Qz2tIL9uM78E6rNJhoZQ6I5SAWOXL9MKZaUwhDN08lVSOPHDP75jC1C94I38xOhe2d5 gmuSbKjsQA== X-Received: by 2002:a05:600c:3e87:b0:4b7:6a8b:9df2 with SMTP id 5b1f17b1804b1-4ba0936f37bmr36739855e9.25.1794396700973; Wed, 11 Nov 2026 03:31:40 -0800 (PST) X-Received: by 2002:a05:600c:3e87:b0:4b7:6a8b:9df2 with SMTP id 5b1f17b1804b1-4ba0936f37bmr36739195e9.25.1794396700369; Wed, 11 Nov 2026 03:31:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794396700; cv=none; d=google.com; s=arc-20260327; b=q6wHKKGJxsMjYse5cnWw39j7c1RfaZJH0KRmbvbCME+62tfBX3bP/MW0tyn29thb3K 20dJnPKPzGxSxl6nVwiUc3ZtuwglcW0lS2F9s9LikRXnCEGPOmnFU52+mcJAZ95p+W0m a6P76VvVJ5TcK3o8mfVke7zZlK3bR06v6N8A9rz/fkeWJ2F3lshcNQeyZX2G66f0pXDr hrUhcHQ29XQDMv/Lb/HG/9SXCa3WXp2ClO0uuzN4SvEUGijqTj0NPihAJmu8d72nBURd h3AaHlkhsE18aMXvkU+3cJ7XfzIUfvLw8npA5oIr5RcdVuEIxD5Id2AGq91yse8JvuBd B2/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=mNMF5R5cahvDyci7jaXhLAgryz/RVERVc+64o0lcBH8=; fh=WpT6aB7RBAGHZeWZzqAr71yzRFbPTYkPWKsRagLn48Q=; b=XuwG7+O3ysU/yGiDT9N8WWfBgmEaCku5RlNTeXUyTFySWBUXGGV9/Xgilz/FgOsUhA BVCLUyzM1v2KalEFsfyFHMGWUjnXIEqf1oXapz9Jl89/IwcMvEDFlOzb6xzwO8qT18Dq FD9WAbsNtkXE0+WmkmYcJIPAirOuRV57iQPLtNV8KC04w2Pue/Ml4qd9jZL6e+ZdObeF kStXj2BJGDkINwnZUfUVDOD6DvWEGEmKhKqM2FRz8WpijoqmR37E6P4i5L8z/AKfhL0W f9TxLl1J/ZrDM/dVxreMA0Sr8iyl6rWsUcXw2pjs5oIMvray5x4Wx5wGlesQM3xdtbxb hnCw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b=VPDIkXL2; 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 5b1f17b1804b1-4ba01fff195sor9018185e9.17.2026.11.11.03.31.40 for (Google Transport Security); Wed, 11 Nov 2026 03:31:40 -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=VPDIkXL2; 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=1794396700; x=1795001500; darn=openvz.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=mNMF5R5cahvDyci7jaXhLAgryz/RVERVc+64o0lcBH8=; b=VPDIkXL2knXctfLb+oSCPG8MZBE9KfxCSWJ9nDDGrSsJY9s26bcJbGQc9MTjV9Z81p ulz/TeuFyg6WsMeYICfysFUMZb6FJdumiRJpKHBG25pRzFDcgVNSivIKC0PK3wjpuq3P 784m1w5n4H3ZC/B2TPgxk9vtOEEa4+lpFmpoinK6sh5mXX62fvV9agPPMy86xmlJGjux t/vRDi7lT208Mth/axTJ4nT92lJOaqK212iC5dKhpz4nXdTT0+t6T8JEjg8Bw21vxTdP 5Ne9/lirqL8Os0lQoqnDLWdJtFKvq0GJarU0dVMNZFI2scvFMUmzEeVAygd6y/1L2VFN 15Ow== X-Received: by 2002:a05:600d:82d3:b0:4a2:1612:6367 with SMTP id 5b1f17b1804b1-4ba09365bb9mr39900455e9.15.1794396699831; Wed, 11 Nov 2026 03:31:39 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2026 03:31:39 -0800 (PST) From: "Denis V. Lunev" To: khorenko@virtuozzo.com Date: Wed, 11 Nov 2026 12:31:32 +0100 Message-ID: <20261111113135.4023555-3-den@openvz.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261111113135.4023555-1-den@openvz.org> References: <20261111113135.4023555-1-den@openvz.org> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v3 2/5] ms/xfs: don't skip free extents of the longest length in a whole-AG 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 From: Daejun Park Since commit a66d636385d6 ("xfs: fix fstrim offset calculations"), the by-length walk of an AG in FITRIM starts with xfs_alloc_lookup_ge(cur, 0, pagf_longest) and walks down. The lookup lands on the longest free extent with the lowest block number. The other free extents of that length sort after it and are never discarded. Start every by-length batch with xfs_alloc_lookup_le() at restart_bno. Suggested-by: Dave Chinner Link: https://lore.kernel.org/r/ZgiJWxVcVwag0fIP@dread.disaster.area Cc: stable@vger.kernel.org Fixes: a66d636385d6 ("xfs: fix fstrim offset calculations") Signed-off-by: Daejun Park Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino (cherry picked from commit 5745f4f10a1a16aa5bb020acc38afa33f2d5ff99) https://virtuozzo.atlassian.net/browse/VSTOR-153590 Feature: fix ms/xfs Signed-off-by: Denis V. Lunev --- Notes: A clean cherry-pick of mainline 5745f4f10a1a (v7.4-rc2) on top of patch 1, no changes. This is the bug the ploop tests hit on xfs: one of several free extents of the longest length discarded. fs/xfs/xfs_discard.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c index 41c98f9abde1..a6c43e4fdec3 100644 --- a/fs/xfs/xfs_discard.c +++ b/fs/xfs/xfs_discard.c @@ -228,12 +228,12 @@ xfs_trim_gather_extents( error = xfs_alloc_lookup_le(cur, tcur->start, 0, &i); if (!error && !i) error = xfs_alloc_lookup_ge(cur, tcur->start, 0, &i); - } else if (tcur->restart_bno == NULLAGBLOCK) { - /* first time through a by-len starts with max length */ - cur = xfs_cntbt_init_cursor(mp, tp, agbp, pag); - error = xfs_alloc_lookup_ge(cur, 0, tcur->count, &i); } else { - /* nth time through a by-len starts where we left off */ + /* + * A by-len walk starts at the last record of the longest + * length (restart_bno is NULLAGBLOCK until the first batch + * ends) and then where the previous batch stopped. + */ cur = xfs_cntbt_init_cursor(mp, tp, agbp, pag); error = xfs_alloc_lookup_le(cur, tcur->restart_bno, tcur->count, &i); -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel