Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 361948
b: refs/heads/master
c: 835d974
h: refs/heads/master
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed Mar 21, 2013
1 parent f1ee247 commit ec1fd55
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 7 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: d763448286377b8a0e3f179372e9e292bef3c337
refs/heads/master: 835d974fabfa9bff4d173ad03c054ac2f673263f
35 changes: 30 additions & 5 deletions trunk/fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,21 +257,26 @@ static int exclude_super_stripes(struct btrfs_root *root,
cache->bytes_super += stripe_len;
ret = add_excluded_extent(root, cache->key.objectid,
stripe_len);
BUG_ON(ret); /* -ENOMEM */
if (ret)
return ret;
}

for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) {
bytenr = btrfs_sb_offset(i);
ret = btrfs_rmap_block(&root->fs_info->mapping_tree,
cache->key.objectid, bytenr,
0, &logical, &nr, &stripe_len);
BUG_ON(ret); /* -ENOMEM */
if (ret)
return ret;

while (nr--) {
cache->bytes_super += stripe_len;
ret = add_excluded_extent(root, logical[nr],
stripe_len);
BUG_ON(ret); /* -ENOMEM */
if (ret) {
kfree(logical);
return ret;
}
}

kfree(logical);
Expand Down Expand Up @@ -7964,7 +7969,17 @@ int btrfs_read_block_groups(struct btrfs_root *root)
* info has super bytes accounted for, otherwise we'll think
* we have more space than we actually do.
*/
exclude_super_stripes(root, cache);
ret = exclude_super_stripes(root, cache);
if (ret) {
/*
* We may have excluded something, so call this just in
* case.
*/
free_excluded_extents(root, cache);
kfree(cache->free_space_ctl);
kfree(cache);
goto error;
}

/*
* check for two cases, either we are full, and therefore
Expand Down Expand Up @@ -8106,7 +8121,17 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans,

cache->last_byte_to_unpin = (u64)-1;
cache->cached = BTRFS_CACHE_FINISHED;
exclude_super_stripes(root, cache);
ret = exclude_super_stripes(root, cache);
if (ret) {
/*
* We may have excluded something, so call this just in
* case.
*/
free_excluded_extents(root, cache);
kfree(cache->free_space_ctl);
kfree(cache);
return ret;
}

add_new_free_space(cache, root->fs_info, chunk_offset,
chunk_offset + size);
Expand Down
13 changes: 12 additions & 1 deletion trunk/fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -4935,7 +4935,18 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree,
em = lookup_extent_mapping(em_tree, chunk_start, 1);
read_unlock(&em_tree->lock);

BUG_ON(!em || em->start != chunk_start);
if (!em) {
printk(KERN_ERR "btrfs: couldn't find em for chunk %Lu\n",
chunk_start);
return -EIO;
}

if (em->start != chunk_start) {
printk(KERN_ERR "btrfs: bad chunk start, em=%Lu, wanted=%Lu\n",
em->start, chunk_start);
free_extent_map(em);
return -EIO;
}
map = (struct map_lookup *)em->bdev;

length = em->len;
Expand Down

0 comments on commit ec1fd55

Please sign in to comment.