Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274613
b: refs/heads/master
c: 13553e5
h: refs/heads/master
i:
  274611: f71648f
v: v3
  • Loading branch information
Josef Bacik committed Oct 19, 2011
1 parent e9e61be commit 6d53a35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 26 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: dabdb6408cb801644fa613c7432da012640b348c
refs/heads/master: 13553e5221d6901a33b3f2157a389de085c161fe
29 changes: 4 additions & 25 deletions trunk/fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3708,7 +3708,6 @@ int btrfs_block_rsv_check(struct btrfs_trans_handle *trans,
u64 min_reserved, int min_factor)
{
u64 num_bytes = 0;
int commit_trans = 0;
int ret = -ENOSPC;

if (!block_rsv)
Expand All @@ -3720,13 +3719,12 @@ int btrfs_block_rsv_check(struct btrfs_trans_handle *trans,
if (min_reserved > num_bytes)
num_bytes = min_reserved;

if (block_rsv->reserved >= num_bytes) {
if (block_rsv->reserved >= num_bytes)
ret = 0;
} else {
else
num_bytes -= block_rsv->reserved;
commit_trans = 1;
}
spin_unlock(&block_rsv->lock);

if (!ret)
return 0;

Expand All @@ -3736,26 +3734,7 @@ int btrfs_block_rsv_check(struct btrfs_trans_handle *trans,
return 0;
}

if (commit_trans) {
struct btrfs_space_info *sinfo = block_rsv->space_info;

if (trans)
return -EAGAIN;

spin_lock(&sinfo->lock);
if (sinfo->bytes_pinned < num_bytes) {
spin_unlock(&sinfo->lock);
return -ENOSPC;
}
spin_unlock(&sinfo->lock);

trans = btrfs_join_transaction(root);
BUG_ON(IS_ERR(trans));
ret = btrfs_commit_transaction(trans, root);
return 0;
}

return -ENOSPC;
return ret;
}

int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src_rsv,
Expand Down

0 comments on commit 6d53a35

Please sign in to comment.