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 BA5AB815CF 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 6ABBVkPK027647; Wed, 11 Nov 2026 14:31:47 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ABBVkPK027647 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1794396712; bh=8VZ230/jLrq/ur/A08mPMMnwrz5IVZzY2L1C9Ds6u+A=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=Ak2dBlEn2U2AiR5bbP5C63t+EmkWiTaiixKbBoujOFUrL+saLdcv8hv2/jUyXH8RT zWM4lHB42Il7HbZdjPowJY0GE09xdnAhDyKZ5ZyQEi7tf1xqAzIbVWP458oYlPveTI mfVjvoE0bl+Z3YieqGRKVE3ZXHTJAF+R3207moBON7pEklr5PVUqPw/9Frpst9Afxw n05NGPea7hu9yH1GT5hKExpOW9sAMGbp7JQk4IZ8a9tLAkyZBWy+bNz/HWZGbcT585 HqVipPjz0EPr19RhEQmYzkiNx1lHYS1ArUQMArOz6k46wrc2Xtp70Kq99AMHG+DxjX a48hw3wlwuJSg== 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 6ABBVeqR027620 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Wed, 11 Nov 2026 14:31:40 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ABBVeqR027620 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="UeGlC/jn" Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4a359b714f8so23578055e9.2 for ; Wed, 11 Nov 2026 03:31:40 -0800 (PST) X-Gm-Message-State: APuU4Z97eC/3TaNad2m3AoMzkQcWagsyVraNxEYQT99738WwwsK1CWwi va/Uf0cezBXE7F5qRnaHMSxcVzQf2Llsr2+bMwUc/crT7x/RTR58th2zjN86b2eujypaeK60f4v du9tUxkI/2vxlxkd0cc6fmsVwt6AYemVZg191nn64ioOEDOR1hw0vRQ== X-Gm-Gg: AYBFou2dNDBwPUNmWlu2zdNxk1g5kreJzXXNs0LLkqF1WvcXSmAo5sb1qKtHYRqs4L0 t0tgmWS0+Jy8HKWpTNUcr/qY6ZGOjR0PWvN/vnD1N1oBgF4ZRz58XUa6h6C9PpHjwMgadNYaFZI adFikiI6bXam0dFS31KkwDX/75zck6jj/fdkYlZhEBXgbEClRQsR25fTyCaFmokSbl9GMwTYU6u j8Tl3yhdTTcnYo9980JHpebQt+fxZQEKyVE4hzMW8sRFg1+yUKBXd8aMVZrvNsLtnW3KCQ8YiQE boL3elSwJQ== X-Received: by 2002:a05:600c:8b31:b0:4a1:dadf:9876 with SMTP id 5b1f17b1804b1-4ba0938e3aamr35011795e9.23.1794396699982; Wed, 11 Nov 2026 03:31:39 -0800 (PST) X-Received: by 2002:a05:600c:8b31:b0:4a1:dadf:9876 with SMTP id 5b1f17b1804b1-4ba0938e3aamr35011385e9.23.1794396699530; Wed, 11 Nov 2026 03:31:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794396699; cv=none; d=google.com; s=arc-20260327; b=j1Z2qkS+em4qvv5HMe0BxyG+8VT+MOwkkisldTeg6d0ucW+Wo2ygs2XDIDL0DITajL jykq0p7a8xNCwj7sxvzn2yk2JXeGPjbw0huUrd2SvNgOIVbbO+HNeDxGFWcGXAe0enqx JyDnzxpbu6CjDNsIUJZJjP/kXjTXBdcB/oWkxzGSLREV7XUoOD+m/IDrw4QspmULLvY5 Qx8jvbhqaSAqex1vaZ9mTmtjX1LD9EH7MVvd76sKIop/6W0k+vV/fSrTb/uSi/Pe65mX ybrW+bs7HuFijzm3oRm8vCLmDT2cQdGieEq6N4dmEZ0T0B6oIXpRgmGKGGdf4N/ccPs+ dVXg== 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=OmlPQgh4h55MWUIPqQK3xoKgztJ2l10KtAPOQI1GGHg=; fh=WpT6aB7RBAGHZeWZzqAr71yzRFbPTYkPWKsRagLn48Q=; b=NBRNwKDzA/tFK1jcl94xHVtICecvu9mLFMgthOtFV3sym2HZZtEoFYMo1EpsSLaeED y/fbGnPimTGMS9vhR6SdNgMgfE4MAx/maIs0lBR6Vn3HWEfVQLcaMtI+TAYdfJBHj+q4 TM4JsJaEu6kU/wDqkVq6nt8sv1zhQfHhGS0h+BR3+jS5iK0Yj2kYkZ62CLLOknoKI8X7 wTt4rzZyTvZRDDbTAH11pc3dZxP37gvQCaXkIMKq+8V2wOW3olKHfXflrQfyw9MdXL6k MdGtNkMr43+zuDDZLOGyhrHfpEqxu/Mz7j+qaEeRlg4tCZKfUM4GJCmidGDwTmrTJrYZ cwXA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b="UeGlC/jn"; 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-4ba01ff1aeesor9695565e9.14.2026.11.11.03.31.39 for (Google Transport Security); Wed, 11 Nov 2026 03:31:39 -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="UeGlC/jn"; 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=1794396699; x=1795001499; 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=OmlPQgh4h55MWUIPqQK3xoKgztJ2l10KtAPOQI1GGHg=; b=UeGlC/jn0VITWGAHoOANrQ37Y/hVzDh6WgvqY/8o06q1tV5dIDT7ZCuLBzjOCV/hC3 pObHWCfabAflA7sfk3l0rbTkDfWkFadsaGzUKejryqyzvwtehTvY3lP3UQcnpStoVjX7 XgDgU9NRvj6eETxIHOGrMd/vQc1HUVIieiVERHBQu8adrzRNFvIjAQd/GMBm2Kz99Lh9 S/xWifmJob7kBw1QZm8bIYQR7NI2Dm5wso34vOYTgpkct1wq4JTmvAHTvP1wgUfa89WD xskvuiKCM+vMsBn1MeGUIeMVLLyTOhoNz1IT+Qrnwz/TiCYfFWxLuQ/U4p21bAp+Dmnx UGJg== X-Received: by 2002:a05:600c:474f:b0:4a2:a6e:80f5 with SMTP id 5b1f17b1804b1-4ba09379d3fmr37327625e9.11.1794396699019; 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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2026 03:31:38 -0800 (PST) From: "Denis V. Lunev" To: khorenko@virtuozzo.com Date: Wed, 11 Nov 2026 12:31:31 +0100 Message-ID: <20261111113135.4023555-2-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 1/5] ms/xfs: don't skip free extents in later batches of 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 A whole-device FITRIM walks every AG but the last by length, in batches. xfs_trim_gather_extents() saves the record to restart from in tcur->start. But tcur->start is also the start of the range to trim. Later batches therefore never discard the free extents below that block. Save the restart record in a new restart_bno field. Cc: stable@vger.kernel.org # v6.10 Fixes: b0ffe661fab4 ("xfs: fix performance problems when fstrimming a subset of a fragmented AG") Signed-off-by: Daejun Park Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino (cherry picked from commit 595e67d7261673d03c96950ffbb2e545c00376ed) https://virtuozzo.atlassian.net/browse/VSTOR-153590 Feature: fix ms/xfs Signed-off-by: Denis V. Lunev --- Notes: A clean cherry-pick of mainline 595e67d72616 (v7.4-rc2), no changes. hci-8.1 has the RHEL backport of b0ffe661fab4 it fixes. fs/xfs/xfs_discard.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c index 93943e698eea..41c98f9abde1 100644 --- a/fs/xfs/xfs_discard.c +++ b/fs/xfs/xfs_discard.c @@ -181,6 +181,8 @@ struct xfs_trim_cur { xfs_agblock_t end; xfs_extlen_t minlen; bool by_bno; + /* restart point (with count) for the by-length walk */ + xfs_agblock_t restart_bno; }; static int @@ -226,14 +228,15 @@ 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->start == 0) { + } 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 */ cur = xfs_cntbt_init_cursor(mp, tp, agbp, pag); - error = xfs_alloc_lookup_le(cur, tcur->start, tcur->count, &i); + error = xfs_alloc_lookup_le(cur, tcur->restart_bno, + tcur->count, &i); } if (error) goto out_del_cursor; @@ -263,9 +266,15 @@ xfs_trim_gather_extents( if (--batch <= 0) { /* * Update the cursor to point at this extent so we - * restart the next batch from this extent. + * restart the next batch from this extent. The + * by-length walk does not visit extents in block + * order, so it must keep the start of the range and + * restart from restart_bno instead. */ - tcur->start = fbno; + if (tcur->by_bno) + tcur->start = fbno; + else + tcur->restart_bno = fbno; tcur->count = flen; break; } @@ -368,6 +377,7 @@ xfs_trim_perag_extents( .start = start, .end = end, .minlen = minlen, + .restart_bno = NULLAGBLOCK, }; int error = 0; -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel