From nobody Mon Sep 29 21:07:44 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 C80C7C25B0D for ; Tue, 16 Aug 2022 04:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233290AbiHPExn (ORCPT ); Tue, 16 Aug 2022 00:53:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233406AbiHPEvD (ORCPT ); Tue, 16 Aug 2022 00:51:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60DD319D0CC; Mon, 15 Aug 2022 13:47:51 -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 43DE8B811A1; Mon, 15 Aug 2022 20:47:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75873C433D6; Mon, 15 Aug 2022 20:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596468; bh=EIPYijl4Se4bdHxPFEfibCB6GdCDR6ErOFNJQlW7fSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rV4pzvM4UGQTD/1PWaNli5TIP17vwkLI8kqLj9jIYhddijk4MrCg7mfU6XwEEROfu 21ZaqaMg05pyUtgO05AtOZcqMe2QTRUcpNcUwuYwWe29WSo12IdBHg79O3FsPhwp49 5+6Qkuf7tZloizWvEG4Bm6/d+NQ/jvd9E0d6rEQU= 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.19 1090/1157] btrfs: zoned: disable metadata overcommit for zoned Date: Mon, 15 Aug 2022 20:07:26 +0200 Message-Id: <20220815180523.804051380@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 2dd8754cb990..f301149c7597 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -349,7 +349,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