From patchwork Fri Sep 8 12:09:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13377400 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 5EA3AEE7FE0 for ; Fri, 8 Sep 2023 12:09:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243190AbjIHMJi (ORCPT ); Fri, 8 Sep 2023 08:09:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243164AbjIHMJh (ORCPT ); Fri, 8 Sep 2023 08:09:37 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 777AA1BC5 for ; Fri, 8 Sep 2023 05:09:34 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98D1DC433C7 for ; Fri, 8 Sep 2023 12:09:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694174974; bh=0GMofqGbIZJ8DFuHdu7AWlye8IftUAHMKFaODoGNy/A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZP75v1cU/jKq9MdJ6TRonmHw4BsdM244maLjG98icZujP9Q8gyLv9JyYgFOrveTh3 qgVbuc7YGXlu0kg74pvdeBokXOZRv/CY+pDDuEIe+CANixlrocWDna6IrfgW6IyPjC skzDrrvUPBUaR4vTIzcskuuNB3xeho7Iid6fvntHT6Arl4twxDWH1CKKmM5AJA0E4G XsbXw8XnUb5tYzsC4RJyFJi61JqOFcIU9fuYK54d3BVQVE/yZDDG9EN8PRobiazcKM fbi/6FuLV5xJ9aDuwp6q3ZFdTTeJY1ZVagC7VxYmNEl8K9uyD5W7/lltFa82TIdaAc DUOune7y9AN6w== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 07/21] btrfs: remove redundant BUG_ON() from __btrfs_inc_extent_ref() Date: Fri, 8 Sep 2023 13:09:09 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Filipe Manana At __btrfs_inc_extent_ref() we are doing a BUG_ON() if we are dealing with a tree block reference that has a reference count that is different from 1, but we have already dealt with this case at run_delayed_tree_ref(), making it useless. So remove the BUG_ON(). Signed-off-by: Filipe Manana Reviewed-by: Josef Bacik --- fs/btrfs/extent-tree.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 8fca9c2b8917..cf503f2972a1 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -1514,15 +1514,14 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, btrfs_release_path(path); /* now insert the actual backref */ - if (owner < BTRFS_FIRST_FREE_OBJECTID) { - BUG_ON(refs_to_add != 1); + if (owner < BTRFS_FIRST_FREE_OBJECTID) ret = insert_tree_block_ref(trans, path, bytenr, parent, root_objectid); - } else { + else ret = insert_extent_data_ref(trans, path, bytenr, parent, root_objectid, owner, offset, refs_to_add); - } + if (ret) btrfs_abort_transaction(trans, ret); out: