aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/relocation.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2011-08-30 12:34:28 -0400
committerJosef Bacik <josef@redhat.com>2011-10-19 15:12:44 -0400
commit4a92b1b8d2810db4ea0c34616b94c0b3810fa027 (patch)
treedd01cff1987b8178be84f8b750951497b7f525a7 /fs/btrfs/relocation.c
parentd02c9955ded7fc56dd1edc987558b084ccb03eb4 (diff)
Btrfs: stop passing a trans handle all around the reservation code
The only thing that we need to have a trans handle for is in reserve_metadata_bytes and thats to know how much flushing we can do. So instead of passing it around, just check current->journal_info for a trans_handle so we know if we can commit a transaction to try and free up space or not. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r--fs/btrfs/relocation.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index fd9ac66434b0..3ab67409f90f 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2041,8 +2041,8 @@ 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(trans, root, rc->block_rsv, 2044 ret = btrfs_block_rsv_check(root, rc->block_rsv, min_reserved,
2045 min_reserved, 0, 0); 2045 0, 0);
2046 if (ret) { 2046 if (ret) {
2047 BUG_ON(ret != -EAGAIN); 2047 BUG_ON(ret != -EAGAIN);
2048 ret = btrfs_commit_transaction(trans, root); 2048 ret = btrfs_commit_transaction(trans, root);
@@ -2152,8 +2152,7 @@ int prepare_to_merge(struct reloc_control *rc, int err)
2152again: 2152again:
2153 if (!err) { 2153 if (!err) {
2154 num_bytes = rc->merging_rsv_size; 2154 num_bytes = rc->merging_rsv_size;
2155 ret = btrfs_block_rsv_add(NULL, root, rc->block_rsv, 2155 ret = btrfs_block_rsv_add(root, rc->block_rsv, num_bytes);
2156 num_bytes);
2157 if (ret) 2156 if (ret)
2158 err = ret; 2157 err = ret;
2159 } 2158 }
@@ -2427,7 +2426,7 @@ static int reserve_metadata_space(struct btrfs_trans_handle *trans,
2427 num_bytes = calcu_metadata_size(rc, node, 1) * 2; 2426 num_bytes = calcu_metadata_size(rc, node, 1) * 2;
2428 2427
2429 trans->block_rsv = rc->block_rsv; 2428 trans->block_rsv = rc->block_rsv;
2430 ret = btrfs_block_rsv_add(trans, root, rc->block_rsv, num_bytes); 2429 ret = btrfs_block_rsv_add(root, rc->block_rsv, num_bytes);
2431 if (ret) { 2430 if (ret) {
2432 if (ret == -EAGAIN) 2431 if (ret == -EAGAIN)
2433 rc->commit_transaction = 1; 2432 rc->commit_transaction = 1;
@@ -3645,7 +3644,7 @@ int prepare_to_relocate(struct reloc_control *rc)
3645 * btrfs_init_reloc_root will use them when there 3644 * btrfs_init_reloc_root will use them when there
3646 * is no reservation in transaction handle. 3645 * is no reservation in transaction handle.
3647 */ 3646 */
3648 ret = btrfs_block_rsv_add(NULL, rc->extent_root, rc->block_rsv, 3647 ret = btrfs_block_rsv_add(rc->extent_root, rc->block_rsv,
3649 rc->extent_root->nodesize * 256); 3648 rc->extent_root->nodesize * 256);
3650 if (ret) 3649 if (ret)
3651 return ret; 3650 return ret;
@@ -3774,8 +3773,8 @@ restart:
3774 } 3773 }
3775 } 3774 }
3776 3775
3777 ret = btrfs_block_rsv_check(trans, rc->extent_root, 3776 ret = btrfs_block_rsv_check(rc->extent_root, rc->block_rsv, 0,
3778 rc->block_rsv, 0, 5, 0); 3777 5, 0);
3779 if (ret < 0) { 3778 if (ret < 0) {
3780 if (ret != -EAGAIN) { 3779 if (ret != -EAGAIN) {
3781 err = ret; 3780 err = ret;