From: Filipe Manana Date: Tue, 11 Oct 2022 12:16:59 +0000 (+0100) Subject: btrfs: remove checks for a root with id 0 during backref walking X-Git-Tag: v6.2-rc1~143^2~217 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c902421927ff602954d2ecc7bd6e71b255d29387;p=thirdparty%2Fkernel%2Flinux.git btrfs: remove checks for a root with id 0 during backref walking When doing backref walking to determine if an extent is shared, we are testing the root_objectid of the given share_check struct is 0, but that is an impossible case, since btrfs_is_data_extent_shared() always initializes the root_objectid field with the id of the given root, and no root can have an objectid of 0. So remove those checks. Signed-off-by: Filipe Manana Signed-off-by: David Sterba --- diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 18374a6d05bdf..abac2e942e8b7 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -719,8 +719,7 @@ static int resolve_indirect_refs(struct btrfs_fs_info *fs_info, continue; } - if (sc && sc->root_objectid && - ref->root_id != sc->root_objectid) { + if (sc && ref->root_id != sc->root_objectid) { free_pref(ref); ret = BACKREF_FOUND_SHARED; goto out; @@ -1348,8 +1347,7 @@ again: * and would retain their original ref->count < 0. */ if (roots && ref->count && ref->root_id && ref->parent == 0) { - if (sc && sc->root_objectid && - ref->root_id != sc->root_objectid) { + if (sc && ref->root_id != sc->root_objectid) { ret = BACKREF_FOUND_SHARED; goto out; }