Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 223080
b: refs/heads/master
c: 83a50de
h: refs/heads/master
v: v3
  • Loading branch information
Chris Mason committed Dec 14, 2010
1 parent f0de87f commit ce79f30
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 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: cd02dca56442e1504fd6bc5b96f7f1870162b266
refs/heads/master: 83a50de97fe96aca82389e061862ed760ece2283
20 changes: 19 additions & 1 deletion trunk/fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4943,6 +4943,25 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
btrfs_get_block_group(block_group);
search_start = block_group->key.objectid;

/*
* this can happen if we end up cycling through all the
* raid types, but we want to make sure we only allocate
* for the proper type.
*/
if (!block_group_bits(block_group, data)) {
u64 extra = BTRFS_BLOCK_GROUP_DUP |
BTRFS_BLOCK_GROUP_RAID1 |
BTRFS_BLOCK_GROUP_RAID10;

/*
* if they asked for extra copies and this block group
* doesn't provide them, bail. This does allow us to
* fill raid0 from raid1.
*/
if ((data & extra) && !(block_group->flags & extra))
goto loop;
}

have_block_group:
if (unlikely(block_group->cached == BTRFS_CACHE_NO)) {
u64 free_percent;
Expand Down Expand Up @@ -8273,7 +8292,6 @@ int btrfs_read_block_groups(struct btrfs_root *root)
break;
if (ret != 0)
goto error;

leaf = path->nodes[0];
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
cache = kzalloc(sizeof(*cache), GFP_NOFS);
Expand Down

0 comments on commit ce79f30

Please sign in to comment.