btrfs: rely on owning_root field in btrfs_add_delayed_tree_ref to detect CHUNK_ROOT
authorNikolay Borisov <nborisov@suse.com>
Tue, 12 Oct 2021 08:21:34 +0000 (11:21 +0300)
committerDavid Sterba <dsterba@suse.com>
Tue, 26 Oct 2021 17:08:06 +0000 (19:08 +0200)
The real_root field is going to be used only by ref-verify tool so limit
its use outside of it. Blocks belonging to the chunk root will always
have it as an owner so the check is equivalent.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/delayed-ref.c

index 53a8016..1547058 100644 (file)
@@ -906,7 +906,7 @@ int btrfs_add_delayed_tree_ref(struct btrfs_trans_handle *trans,
        u64 parent = generic_ref->parent;
        u8 ref_type;
 
-       is_system = (generic_ref->real_root == BTRFS_CHUNK_TREE_OBJECTID);
+       is_system = (generic_ref->tree_ref.owning_root == BTRFS_CHUNK_TREE_OBJECTID);
 
        ASSERT(generic_ref->type == BTRFS_REF_METADATA && generic_ref->action);
        BUG_ON(extent_op && extent_op->is_data);