Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360395
b: refs/heads/master
c: c6b305a
h: refs/heads/master
i:
  360393: 9f5055e
  360391: be6d46c
v: v3
  • Loading branch information
Josef Bacik committed Feb 20, 2013
1 parent 5896051 commit e1e6d1e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2ab28f322f9896782da904f5942f3873432addc8
refs/heads/master: c6b305a89b1903d63652691ad5eb9f05aa0326b8
7 changes: 7 additions & 0 deletions trunk/fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3570,6 +3570,10 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans,
int wait_for_alloc = 0;
int ret = 0;

/* Don't re-enter if we're already allocating a chunk */
if (trans->allocating_chunk)
return -ENOSPC;

space_info = __find_space_info(extent_root->fs_info, flags);
if (!space_info) {
ret = update_space_info(extent_root->fs_info, flags,
Expand Down Expand Up @@ -3612,6 +3616,8 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans,
goto again;
}

trans->allocating_chunk = true;

/*
* If we have mixed data/metadata chunks we want to make sure we keep
* allocating mixed chunks instead of individual chunks.
Expand All @@ -3638,6 +3644,7 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans,
check_system_chunk(trans, extent_root, flags);

ret = btrfs_alloc_chunk(trans, extent_root, flags);
trans->allocating_chunk = false;
if (ret < 0 && ret != -ENOSPC)
goto out;

Expand Down
1 change: 1 addition & 0 deletions trunk/fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ start_transaction(struct btrfs_root *root, u64 num_items, int type,
h->qgroup_reserved = qgroup_reserved;
h->delayed_ref_elem.seq = 0;
h->type = type;
h->allocating_chunk = false;
INIT_LIST_HEAD(&h->qgroup_ref_list);
INIT_LIST_HEAD(&h->new_bgs);

Expand Down
1 change: 1 addition & 0 deletions trunk/fs/btrfs/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct btrfs_trans_handle {
struct btrfs_block_rsv *orig_rsv;
short aborted;
short adding_csums;
bool allocating_chunk;
enum btrfs_trans_type type;
/*
* this root is only needed to validate that the root passed to
Expand Down

0 comments on commit e1e6d1e

Please sign in to comment.