From patchwork Thu Oct 29 23:57:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Burkov X-Patchwork-Id: 11867921 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6A20C2D0A3 for ; Thu, 29 Oct 2020 23:58:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 74BF32076A for ; Thu, 29 Oct 2020 23:58:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bur.io header.i=@bur.io header.b="Q122rEUh"; dkim=temperror (0-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="mBs7HhKw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726048AbgJ2X6f (ORCPT ); Thu, 29 Oct 2020 19:58:35 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:49729 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbgJ2X6e (ORCPT ); Thu, 29 Oct 2020 19:58:34 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 3A1305C00DD; Thu, 29 Oct 2020 19:58:33 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 29 Oct 2020 19:58:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bur.io; h=from :to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=fm2; bh=jpS/w6iqmvKNHpceFjPc/umWEP efzVobPQYltFIFD/A=; b=Q122rEUhYWzlxK+7kEVVqnh4XiMKFM5wxok6J0lyT4 xoxCcffS6Tnr6vxmHaqYnDgrCJKJlBzRbZNk6psmwFw3hDl7ZzRTGeNkHTkIGAVL VTGGjgyeg8Fjk8o+5aHu42QfPB8luBO+goxkq736C+oe27d7bo9kmBEcSyhq4bxz FPs53MdkAqk131QULGpc9ixlaJKSqrvaeF3Lr/clGI4SjbWGkfhWzR8Daq9ATMw8 G0KEBDDAKnU9nxwVonNDkcEDXbwvZB6P1HZKSyU3yeP1J5/1c2fwEimLQOkNKpwI MvVlYEuxlWK3pSWAMdQ9azPde0Gde62AeTL4wlyn3uHw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=jpS/w6iqmvKNHpceFjPc/umWEPefzVobPQYltFIFD/A=; b=mBs7HhKw TL0aZrMSN0SXITkzYXuBKh7Z11E8b6f1KHR3IXcaGj7yk91CGKrRFTFyJUMya032 +/dFvlmSbaxApOM3nJzUX5nFyoYWqb4CmRqcWjGHJSlUCjb2vbZHXj4EOza/9yOr oI9dPAQfuNr2E2fe55QMPR+xB7Llgu9fPlyX8k+dCzjK7T8LWLFPiYeRelAEMqEq 1PafbenYJz6iewZWn3SnD4UCDZroLJcwQjwxcK9z3NMZdn6xex4PyjmQGZELXM7b qzkBbzZ5ynVDRBitlltDyyaq+5dcFZ1heXUBMNWZzYDs93tW0PcvwFsr8lyiLELO nV+V1ogH4uAN5g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrleeggdduiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpeeuohhrihhsuceuuhhrkhhovhcuoegsohhrihhssegsuhhrrdhi oheqnecuggftrfgrthhtvghrnhepieeuffeuvdeiueejhfehiefgkeevudejjeejffevvd ehtddufeeihfekgeeuheelnecukfhppeduieefrdduudegrddufedvrdefnecuvehluhhs thgvrhfuihiivgepkeenucfrrghrrghmpehmrghilhhfrhhomhepsghorhhishessghurh drihho X-ME-Proxy: Received: from localhost (unknown [163.114.132.3]) by mail.messagingengine.com (Postfix) with ESMTPA id C83CC3280066; Thu, 29 Oct 2020 19:58:32 -0400 (EDT) From: Boris Burkov To: linux-btrfs@vger.kernel.org, kernel-team@fb.com Subject: [PATCH v6 10/10] btrfs: skip space_cache v1 setup when not using it Date: Thu, 29 Oct 2020 16:57:57 -0700 Message-Id: <97ff859cf0df9b5db6313df215fa62754213fb4b.1604015464.git.boris@bur.io> X-Mailer: git-send-email 2.24.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org If we are not using space cache v1, we should not create the free space object or free space inodes. This comes up when we delete the existing free space objects/inodes when migrating to v2, only to see them get recreated for every dirtied block group. Signed-off-by: Boris Burkov --- fs/btrfs/block-group.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 2dde5c6f1da8..13a16158f4c7 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -2374,6 +2374,9 @@ static int cache_save_setup(struct btrfs_block_group *block_group, int retries = 0; int ret = 0; + if (!btrfs_test_opt(fs_info, SPACE_CACHE)) + return 0; + /* * If this block group is smaller than 100 megs don't bother caching the * block group.