Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274654
b: refs/heads/master
c: 7e355b8
h: refs/heads/master
v: v3
  • Loading branch information
Josef Bacik committed Oct 19, 2011
1 parent e40e2e5 commit 933e675
Show file tree
Hide file tree
Showing 2 changed files with 16 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: 36ba022ac0b748dd543f43430b03198e899426c9
refs/heads/master: 7e355b83efa80e5f5821591c13c17649594d82ac
15 changes: 15 additions & 0 deletions trunk/fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3510,6 +3510,20 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
u64 profile = btrfs_get_alloc_profile(root, 0);
u64 avail;

/*
* If we have a lot of space that's pinned, don't bother doing
* the overcommit dance yet and just commit the transaction.
*/
avail = (space_info->total_bytes - space_info->bytes_used) * 8;
do_div(avail, 10);
if (space_info->bytes_pinned >= avail && flush && !trans &&
!committed) {
space_info->flush = 1;
flushing = true;
spin_unlock(&space_info->lock);
goto commit;
}

spin_lock(&root->fs_info->free_chunk_lock);
avail = root->fs_info->free_chunk_space;

Expand Down Expand Up @@ -3581,6 +3595,7 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
if (trans)
goto out;

commit:
ret = -ENOSPC;
if (committed)
goto out;
Expand Down

0 comments on commit 933e675

Please sign in to comment.