Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360418
b: refs/heads/master
c: 0448748
h: refs/heads/master
v: v3
  • Loading branch information
Josef Bacik committed Feb 20, 2013
1 parent 58e9a20 commit d924519
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 87533c475187c1420794a2e164bc67a7974f1327
refs/heads/master: 0448748849ef7c593be40e2c1404f7974bd3aac6
32 changes: 22 additions & 10 deletions trunk/fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -3825,12 +3825,6 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
if (ret)
goto error;

ret = btrfs_make_block_group(trans, extent_root, 0, type,
BTRFS_FIRST_CHUNK_TREE_OBJECTID,
start, num_bytes);
if (ret)
goto error;

for (i = 0; i < map->num_stripes; ++i) {
struct btrfs_device *device;
u64 dev_offset;
Expand All @@ -3842,15 +3836,33 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
info->chunk_root->root_key.objectid,
BTRFS_FIRST_CHUNK_TREE_OBJECTID,
start, dev_offset, stripe_size);
if (ret) {
btrfs_abort_transaction(trans, extent_root, ret);
goto error;
}
if (ret)
goto error_dev_extent;
}

ret = btrfs_make_block_group(trans, extent_root, 0, type,
BTRFS_FIRST_CHUNK_TREE_OBJECTID,
start, num_bytes);
if (ret) {
i = map->num_stripes - 1;
goto error_dev_extent;
}

kfree(devices_info);
return 0;

error_dev_extent:
for (; i >= 0; i--) {
struct btrfs_device *device;
int err;

device = map->stripes[i].dev;
err = btrfs_free_dev_extent(trans, device, start);
if (err) {
btrfs_abort_transaction(trans, extent_root, err);
break;
}
}
error:
kfree(map);
kfree(devices_info);
Expand Down

0 comments on commit d924519

Please sign in to comment.