From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45260502558 for ; Fri, 18 Sep 2026 17:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.148 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789751939; cv=none; b=sH0NfDpbFaqTOxOrOQWYSQLt4l1hH/Ck+hiBmtNHaUiGSXoRV4BhmZl6SvMOFVWfNNk8Y7c0AElrRiCeycJLO8e/UPyD5y2BIqRjRf3AbE4MfXb9ZfCprlkegHkv/5A623Rdi7yUD0SqusDAsz9tMDsS6a8L73unwIETkC+jOsc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789751939; c=relaxed/simple; bh=Zdl0y9NzdjV929NUjPBawED7mIDitPEqLNfoUdwLw8o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=i3BbPQ45NIyt6GW93PXq33UVD8gCOjuMfEImXjnu7m71h2SITxgA7NAuguufjfHxhTFqTaKW50fjTdVgjPuCVXjPm1NV0yYqIw0HErqvbBHtrZ8Q4y9I/iLmosgG1/f1UtBr95IiOjI6jnvHeJGqP0JJX0VDgn79mriHg7DyUAs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bur.io; spf=pass smtp.mailfrom=bur.io; dkim=pass (2048-bit key) header.d=bur.io header.i=@bur.io header.b=t6iabnvQ; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=fYz0cb/B; arc=none smtp.client-ip=202.12.124.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bur.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bur.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bur.io header.i=@bur.io header.b="t6iabnvQ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="fYz0cb/B" Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.stl.internal (Postfix) with ESMTP id 280231D000AB; Fri, 18 Sep 2026 13:18:55 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Fri, 18 Sep 2026 13:18:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bur.io; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1789751935; x=1789838335; bh=/bFUISVaW4 wX+yJ2Y2SJRJXloX/6gn/GjCYKXsq7wPE=; b=t6iabnvQQcOvZtfbICezzTrOZS Pz84l0i8GzeetYaav3Po7Vu3iQJauSIez6iFjdb/fu3GCaMu6y2J3+di0t8W9CUI gvalsZ9xFc8CcRsheaJsdf3Da7kSW5HXpzn+bqg2l6vsfj3RQ2hzGZhSOX5rAOF4 CeJEg71/cDpLI6PfyMSE5+rwh0UgrPtLTavxLm5+ZJP86U9g+1uwY0ZCaGhn7g7v YJGl05GRXIfVELqt6aQMQQFesfaJTAQKDCVM1bGOpLrpAS3gmfc5L0Sv4FXHpAzc hTj2VuWqAivDcPMC85MyTixRUi4IGBOzUe1H/dulJrXf4WCa2y8vIfDNK27A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1789751935; x=1789838335; bh=/bFUISVaW4wX+yJ2Y2SJRJXloX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qyaklr31lDdGJW7Row X-ME-Proxy: Feedback-ID: i083147f8:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 18 Sep 2026 13:18:54 -0400 (EDT) Date: Fri, 18 Sep 2026 10:19:06 -0700 From: Boris Burkov To: fdmanana@kernel.org Cc: linux-btrfs@vger.kernel.org Subject: Re: [PATCH 1/3] btrfs: clear BTRFS_ROOT_IN_TRANS_SETUP on early exit from record_root_in_trans() Message-ID: <20260918171906.GB2900089@zen.localdomain> References: <410734082c3a544458920efe7be7a39222424aeb.1789734245.git.fdmanana@suse.com> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <410734082c3a544458920efe7be7a39222424aeb.1789734245.git.fdmanana@suse.com> On Fri, Sep 18, 2026 at 01:28:09PM +0100, fdmanana@kernel.org wrote: > From: Filipe Manana > > If we exit early because the transaction that last used the root already > matches the current transaction, we leave the BTRFS_ROOT_IN_TRANS_SETUP > bit set in the root (which we just set right before the exit). While this > does not cause any functional issue, it makes callers of > btrfs_record_root_in_trans() always lock fs_info->reloc_mutex and call I found "always" kind of confusing here. It's until one succeeds and clears the bit right? It kind of makes it sound like it leaks it forever. > record_root_in_trans() for nothing, causing unnecessary lock contention. > One caller of btrfs_record_root_in_trans() is start_transaction(), used to > start new transaction or joining an existing one, which is a hot path. > > So clear BTRFS_ROOT_IN_TRANS_SETUP on early exit. > > Assisted-by: LLM > Signed-off-by: Filipe Manana > --- > fs/btrfs/transaction.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c > index ca114235bbe1..c1555621ae4e 100644 > --- a/fs/btrfs/transaction.c > +++ b/fs/btrfs/transaction.c > @@ -432,6 +432,7 @@ static int record_root_in_trans(struct btrfs_trans_handle *trans, > spin_lock(&fs_info->fs_roots_radix_lock); > if (btrfs_get_root_last_trans(root) == trans->transid && !force) { > spin_unlock(&fs_info->fs_roots_radix_lock); > + clear_bit(BTRFS_ROOT_IN_TRANS_SETUP, &root->state); > return 0; > } > radix_tree_tag_set(&fs_info->fs_roots_radix, > -- > 2.47.2 >