From nobody Fri Oct 24 20:23:59 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDC61C00140 for ; Mon, 15 Aug 2022 23:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353601AbiHOXfg (ORCPT ); Mon, 15 Aug 2022 19:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346106AbiHOXaT (ORCPT ); Mon, 15 Aug 2022 19:30:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3365FBB939; Mon, 15 Aug 2022 13:08:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 125B5B80EA8; Mon, 15 Aug 2022 20:08:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44273C433D7; Mon, 15 Aug 2022 20:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594080; bh=5n/75u9yLbFTG8wLPL2EQWKA9GGqPhXQKNdg9xemZ4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BXnOuT5KFe0eONja7kHiiV0eSjnpUJjAIK1p3HXtFWi4dt0cWsGn5WnEqSPhjKT3z AlgEUcNhaDKm/jZME0tb4j4FlJUaAAS1T8ZIdSXNcvKK8G4HrJa/azTxeoxaJFkVc1 jadc/TbQn385Xggq8fOqiCVbjn/WHbTCihT/SJdk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naohiro Aota , Johannes Thumshirn , David Sterba , Sasha Levin Subject: [PATCH 5.18 1023/1095] btrfs: zoned: disable metadata overcommit for zoned Date: Mon, 15 Aug 2022 20:07:02 +0200 Message-Id: <20220815180511.403729523@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Naohiro Aota [ Upstream commit 79417d040f4f77b19c701bccc23013b9cdac358d ] The metadata overcommit makes the space reservation flexible but it is also harmful to active zone tracking. Since we cannot finish a block group from the metadata allocation context, we might not activate a new block group and might not be able to actually write out the overcommit reservations. So, disable metadata overcommit for zoned filesystems. We will ensure the reservations are under active_total_bytes in the following patches. CC: stable@vger.kernel.org # 5.16+ Fixes: afba2bc036b0 ("btrfs: zoned: implement active zone tracking") Signed-off-by: Naohiro Aota Reviewed-by: Johannes Thumshirn Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/space-info.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index b87931a458eb..56a7c99fc03e 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -340,7 +340,10 @@ int btrfs_can_overcommit(struct btrfs_fs_info *fs_info, return 0; =20 used =3D btrfs_space_info_used(space_info, true); - avail =3D calc_available_free_space(fs_info, space_info, flush); + if (btrfs_is_zoned(fs_info) && (space_info->flags & BTRFS_BLOCK_GROUP_MET= ADATA)) + avail =3D 0; + else + avail =3D calc_available_free_space(fs_info, space_info, flush); =20 if (used + bytes < space_info->total_bytes + avail) return 1; --=20 2.35.1