Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 128967
b: refs/heads/master
c: cf74982
h: refs/heads/master
i:
  128965: 0b5c8f8
  128963: 423c544
  128959: 877dc98
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed Oct 1, 2008
1 parent 2f14c04 commit 048b101
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 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: 83afeac42c5680b0b70d64fb8c4724cf05483fc2
refs/heads/master: cf749823857230017c86504bfdc70524f929ba96
15 changes: 13 additions & 2 deletions trunk/fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans,
u64 thresh;
u64 start;
u64 num_bytes;
int ret = 0;
int ret = 0, waited = 0;

flags = reduce_alloc_profile(extent_root, flags);

Expand All @@ -1530,7 +1530,18 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans,
space_info->bytes_reserved + alloc_bytes) < thresh)
goto out;

mutex_lock(&extent_root->fs_info->chunk_mutex);
while (!mutex_trylock(&extent_root->fs_info->chunk_mutex)) {
if (!force)
goto out;
mutex_unlock(&extent_root->fs_info->alloc_mutex);
cond_resched();
mutex_lock(&extent_root->fs_info->alloc_mutex);
waited = 1;
}

if (waited && space_info->full)
goto out_unlock;

ret = btrfs_alloc_chunk(trans, extent_root, &start, &num_bytes, flags);
if (ret == -ENOSPC) {
printk("space info full %Lu\n", flags);
Expand Down

0 comments on commit 048b101

Please sign in to comment.