Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3259397rwb; Mon, 15 Aug 2022 22:33:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR6ocdx5UqCBCNPnSBIkJgPLN2g5W/EAtSbNrSL4FiDMI7dWNfE4faGo1sW0l9q3TR1BZrj7 X-Received: by 2002:a63:5064:0:b0:41b:b1db:cb61 with SMTP id q36-20020a635064000000b0041bb1dbcb61mr16411539pgl.67.1660627988953; Mon, 15 Aug 2022 22:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660627988; cv=none; d=google.com; s=arc-20160816; b=zkmywLkJi/WKAIqmuI8ZarosEfYzcmXevjwr7kXE7n9J0VeisHHC/AVm4UOHZ6KM0H UQFOar5u//RWjDgB3Dm2VwNqIbAMPJWMyBVBEgzVypAyVD8KmD4hpS0WhexEWGJiTobE H00cfAHvETJ19NfXUP6eWbj1U4iRIbzWKBfgnaYk7qhBrmp42IYarrv8ZttTNbE7fzhO q8urIKu4PvNf5D4UU3gCqq4izLJ7u7rjeKPONmDAUWhHySevF0BZmV0hHh6zcdY/vSbb SU1p/7bp3stkuKjnyyEoMR+uCZv480gDTDxgq82hSYsUKjgTiGgg2DDPwLd/JKCZR8rE iJiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b8lUqIMoyujJQUXrM33JkipanGRiQcmaOi6Z9mFYMfc=; b=RM765yMrTg1VXeEye7ZuUREkm7faSlMa/dnusteqeFjOlZWTNJaTzlgdkZQzNRpMHR uSIqia45qLG+qtG5Mv+pO7K7CXBX4ehLW9mvdNXNzENrOC4LRQ+W4xJ+VrI1xXhD48DE CI5o6h6K3SVN7PlAb395RYoHdVhoEfmfX2cdd+gaQfGQARH9LnWQRhaOhDQCE7FZ8kp9 vTJYdy2F8Cmu7QqJsYLYWoevjQ/osmUR9SnJTAqqkFfPv/kgjPTsi1uTXXzQ8U0/b5XP sB/bkVpXetEKCuR7HLjBM7Ma9SsvWAflMBkNNZKURnxZTKStejppVRgFuTqwvDvUXjPi zGdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rV4pzvM4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 10-20020a630d4a000000b0041cce668ab4si12433141pgn.443.2022.08.15.22.32.58; Mon, 15 Aug 2022 22:33:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rV4pzvM4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233285AbiHPExl (ORCPT + 99 others); Tue, 16 Aug 2022 00:53:41 -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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; used = btrfs_space_info_used(space_info, true); - avail = calc_available_free_space(fs_info, space_info, flush); + if (btrfs_is_zoned(fs_info) && (space_info->flags & BTRFS_BLOCK_GROUP_METADATA)) + avail = 0; + else + avail = calc_available_free_space(fs_info, space_info, flush); if (used + bytes < space_info->total_bytes + avail) return 1; -- 2.35.1