Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332600
b: refs/heads/master
c: 44734ed
h: refs/heads/master
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed Oct 9, 2012
1 parent e1857a1 commit 8fd941a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 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: f0bd95ea72644cbf9210606f6f8edfce13d65d47
refs/heads/master: 44734ed1ca0c2e66479cedbf773627a9b5a31364
34 changes: 6 additions & 28 deletions trunk/fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3907,7 +3907,6 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
int flush_state = FLUSH_DELAYED_ITEMS_NR;
int ret = 0;
bool flushing = false;
bool committed = false;

again:
ret = 0;
Expand Down Expand Up @@ -3970,33 +3969,12 @@ static int reserve_metadata_bytes(struct btrfs_root *root,
(orig_bytes * 2);
}

if (ret) {
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 && !committed) {
space_info->flush = 1;
flushing = true;
spin_unlock(&space_info->lock);
ret = may_commit_transaction(root, space_info,
orig_bytes, 1);
if (ret)
goto out;
committed = true;
goto again;
}

if (can_overcommit(root, space_info, orig_bytes, flush)) {
space_info->bytes_may_use += orig_bytes;
trace_btrfs_space_reservation(root->fs_info,
"space_info", space_info->flags, orig_bytes, 1);
ret = 0;
}
if (ret && can_overcommit(root, space_info, orig_bytes, flush)) {
space_info->bytes_may_use += orig_bytes;
trace_btrfs_space_reservation(root->fs_info, "space_info",
space_info->flags, orig_bytes,
1);
ret = 0;
}

/*
Expand Down

0 comments on commit 8fd941a

Please sign in to comment.