From patchwork Tue Oct 11 12:17:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13003931 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 13E2CC4332F for ; Tue, 11 Oct 2022 12:17:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229741AbiJKMRb (ORCPT ); Tue, 11 Oct 2022 08:17:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229656AbiJKMRZ (ORCPT ); Tue, 11 Oct 2022 08:17:25 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05FF15755F for ; Tue, 11 Oct 2022 05:17:24 -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 sin.source.kernel.org (Postfix) with ESMTPS id 51BCFCE16C5 for ; Tue, 11 Oct 2022 12:17:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A099C433D7 for ; Tue, 11 Oct 2022 12:17:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665490641; bh=6zdh+oXTjm2mZHvnq1SUvQWAIouArWQfCqPI9wvwWto=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gKkGDgz2wXqpFUcKEPOMp2DqWRii+rfnHaWU1lgboqwjhYdCcCAi6Jx0WeWjubGjR UAGajmH5zYyH3R/+ehEUn2Z3+AX7WL9FXzVEKZ+VGvO8gSJi2i8NkbtHq7nYqnJaEo oYqyXZJdfBEsRDR+Pv369F0Ew6QHZjmkvQN2enxpiWLQVi2TpWGRD45Cosmrs9LCqF mChQcRMi50hjD/EphH2i8kBJ5cW7EiUUn02KWq5re763wFWia7FBSto0qltqAsCWOB V7MnHMdDtxxKGLk3bljKZ4uaYUAOGPa937rtdiI5WjCsC1wrd2vmixvd7LRNnEX128 LNIVcFMLRoXQg== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 10/19] btrfs: remove checks for a 0 inode number during backref walking Date: Tue, 11 Oct 2022 13:17:00 +0100 Message-Id: <9747bdb0d51eb0b2c28b823154ee17f2ebf77963.1665490018.git.fdmanana@suse.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Filipe Manana When doing backref walking to determine if an extent is shared, we are testing if the inode number, stored in the 'inum' field of struct share_check, is 0. However that can never be case, since the all instances of the structure are created at btrfs_is_data_extent_shared(), which always initializes it with the inode number from a fs tree (and the number for any inode from any tree can never be 0). So remove the checks. Signed-off-by: Filipe Manana --- fs/btrfs/backref.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 4757f9af948a..f4010ce66e21 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1033,7 +1033,7 @@ static int add_inline_refs(const struct btrfs_fs_info *fs_info, key.type = BTRFS_EXTENT_DATA_KEY; key.offset = btrfs_extent_data_ref_offset(leaf, dref); - if (sc && sc->inum && key.objectid != sc->inum && + if (sc && key.objectid != sc->inum && !sc->have_delayed_delete_refs) { ret = BACKREF_FOUND_SHARED; break; @@ -1134,7 +1134,7 @@ static int add_keyed_refs(struct btrfs_root *extent_root, key.type = BTRFS_EXTENT_DATA_KEY; key.offset = btrfs_extent_data_ref_offset(leaf, dref); - if (sc && sc->inum && key.objectid != sc->inum && + if (sc && key.objectid != sc->inum && !sc->have_delayed_delete_refs) { ret = BACKREF_FOUND_SHARED; break;