btrfs: decentralize transaction aborts in create_reloc_root()

Decentralize transaction aborts in create_reloc_root(), so that it is
obvious which call failed and what caused the transaction abort.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Johannes Thumshirn
2026-06-22 10:22:24 +02:00
committed by David Sterba
parent 3dc22abc21
commit 9e37d187e1

View File

@@ -719,21 +719,19 @@ static struct btrfs_root *create_reloc_root(struct btrfs_trans_handle *trans,
ret = btrfs_insert_root(trans, fs_info->tree_root,
&root_key, root_item);
if (ret)
goto abort;
if (unlikely(ret)) {
btrfs_abort_transaction(trans, ret);
return ERR_PTR(ret);
}
reloc_root = btrfs_read_tree_root(fs_info->tree_root, &root_key);
if (IS_ERR(reloc_root)) {
ret = PTR_ERR(reloc_root);
goto abort;
btrfs_abort_transaction(trans, PTR_ERR(reloc_root));
return ERR_CAST(reloc_root);
}
set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state);
btrfs_set_root_last_trans(reloc_root, trans->transid);
return reloc_root;
abort:
btrfs_abort_transaction(trans, ret);
return ERR_PTR(ret);
}
/*