summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/relocation.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-10-18 12:15:48 -0400
committerJosef Bacik <josef@redhat.com>2011-10-19 15:12:59 -0400
commit36ba022ac0b748dd543f43430b03198e899426c9 (patch)
tree3175872760ac769cde046b3ac43900fc42856bb8 /fs/btrfs/relocation.c
parent3880a1b46d87a6b030c31889875befc745d95dff (diff)
Btrfs: seperate out btrfs_block_rsv_check out into 2 different functions
Currently btrfs_block_rsv_check does 2 things, it will either refill a block reserve like in the truncate or refill case, or it will check to see if there is enough space in the global reserve and possibly refill it. However because of overcommit we could be well overcommitting ourselves just to try and refill the global reserve, when really we should just be committing the transaction. So breack this out into btrfs_block_rsv_refill and btrfs_block_rsv_check. Refill will try to reserve more metadata if it can and btrfs_block_rsv_check will not, it will only tell you if the factor of the total space is still reserved. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r--fs/btrfs/relocation.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 7fa090fa0d39..10af6a0e0865 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2041,8 +2041,7 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc,
2041 BUG_ON(IS_ERR(trans)); 2041 BUG_ON(IS_ERR(trans));
2042 trans->block_rsv = rc->block_rsv; 2042 trans->block_rsv = rc->block_rsv;
2043 2043
2044 ret = btrfs_block_rsv_check(root, rc->block_rsv, min_reserved, 2044 ret = btrfs_block_rsv_refill(root, rc->block_rsv, min_reserved);
2045 0, 0);
2046 if (ret) { 2045 if (ret) {
2047 BUG_ON(ret != -EAGAIN); 2046 BUG_ON(ret != -EAGAIN);
2048 ret = btrfs_commit_transaction(trans, root); 2047 ret = btrfs_commit_transaction(trans, root);
@@ -3774,8 +3773,7 @@ restart:
3774 } 3773 }
3775 } 3774 }
3776 3775
3777 ret = btrfs_block_rsv_check(rc->extent_root, rc->block_rsv, 0, 3776 ret = btrfs_block_rsv_check(rc->extent_root, rc->block_rsv, 5);
3778 5, 0);
3779 if (ret < 0) { 3777 if (ret < 0) {
3780 if (ret != -EAGAIN) { 3778 if (ret != -EAGAIN) {
3781 err = ret; 3779 err = ret;