Skip to content

Commit 9e37d18

Browse files
morbidrsakdave
authored andcommitted
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>
1 parent 3dc22ab commit 9e37d18

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

fs/btrfs/relocation.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -719,21 +719,19 @@ static struct btrfs_root *create_reloc_root(struct btrfs_trans_handle *trans,
719719

720720
ret = btrfs_insert_root(trans, fs_info->tree_root,
721721
&root_key, root_item);
722-
if (ret)
723-
goto abort;
722+
if (unlikely(ret)) {
723+
btrfs_abort_transaction(trans, ret);
724+
return ERR_PTR(ret);
725+
}
724726

725727
reloc_root = btrfs_read_tree_root(fs_info->tree_root, &root_key);
726728
if (IS_ERR(reloc_root)) {
727-
ret = PTR_ERR(reloc_root);
728-
goto abort;
729+
btrfs_abort_transaction(trans, PTR_ERR(reloc_root));
730+
return ERR_CAST(reloc_root);
729731
}
730732
set_bit(BTRFS_ROOT_SHAREABLE, &reloc_root->state);
731733
btrfs_set_root_last_trans(reloc_root, trans->transid);
732734
return reloc_root;
733-
734-
abort:
735-
btrfs_abort_transaction(trans, ret);
736-
return ERR_PTR(ret);
737735
}
738736

739737
/*

0 commit comments

Comments
 (0)