btrfs-progs: convert: improve error hanling of init_btrfs
authorDavid Sterba <dsterba@suse.com>
Tue, 23 Aug 2016 17:24:48 +0000 (19:24 +0200)
committerDavid Sterba <dsterba@suse.com>
Wed, 24 Aug 2016 12:37:36 +0000 (14:37 +0200)
Replace BUG_ONs and verbosely report the errors.

Signed-off-by: David Sterba <dsterba@suse.com>
btrfs-convert.c

index 66f62e8..d2ff517 100644 (file)
@@ -1298,7 +1298,11 @@ static int init_btrfs(struct btrfs_mkfs_config *cfg, struct btrfs_root *root,
        fs_info->avoid_sys_chunk_alloc = 1;
        fs_info->avoid_meta_chunk_alloc = 1;
        trans = btrfs_start_transaction(root, 1);
-       BUG_ON(!trans);
+       if (!trans) {
+               error("unable to start transaction");
+               ret = -EINVAL;
+               goto err;
+       }
        ret = btrfs_fix_block_accounting(trans, root);
        if (ret)
                goto err;