aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/relocation.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2010-10-29 09:27:49 -0400
committerChris Mason <chris.mason@oracle.com>2010-10-29 09:27:49 -0400
commit6b5b817f103450444f3f658a498f435d92a197e5 (patch)
tree2896588127c4dd6c2867ef09e7e3cdd83391f8ae /fs/btrfs/relocation.c
parent8216ef866df1119fd5a72372b8b29bce49c18590 (diff)
parente9bb7f10d3617304ef94ff7aa8fefbce3078f08b (diff)
Merge branch 'bug-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-work
Conflicts: fs/btrfs/extent-tree.c Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r--fs/btrfs/relocation.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index af339eee55b8..fd0714475db7 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -179,8 +179,6 @@ struct reloc_control {
179 u64 search_start; 179 u64 search_start;
180 u64 extents_found; 180 u64 extents_found;
181 181
182 int block_rsv_retries;
183
184 unsigned int stage:8; 182 unsigned int stage:8;
185 unsigned int create_reloc_tree:1; 183 unsigned int create_reloc_tree:1;
186 unsigned int merge_reloc_tree:1; 184 unsigned int merge_reloc_tree:1;
@@ -2134,7 +2132,6 @@ int prepare_to_merge(struct reloc_control *rc, int err)
2134 LIST_HEAD(reloc_roots); 2132 LIST_HEAD(reloc_roots);
2135 u64 num_bytes = 0; 2133 u64 num_bytes = 0;
2136 int ret; 2134 int ret;
2137 int retries = 0;
2138 2135
2139 mutex_lock(&root->fs_info->trans_mutex); 2136 mutex_lock(&root->fs_info->trans_mutex);
2140 rc->merging_rsv_size += root->nodesize * (BTRFS_MAX_LEVEL - 1) * 2; 2137 rc->merging_rsv_size += root->nodesize * (BTRFS_MAX_LEVEL - 1) * 2;
@@ -2144,7 +2141,7 @@ again:
2144 if (!err) { 2141 if (!err) {
2145 num_bytes = rc->merging_rsv_size; 2142 num_bytes = rc->merging_rsv_size;
2146 ret = btrfs_block_rsv_add(NULL, root, rc->block_rsv, 2143 ret = btrfs_block_rsv_add(NULL, root, rc->block_rsv,
2147 num_bytes, &retries); 2144 num_bytes);
2148 if (ret) 2145 if (ret)
2149 err = ret; 2146 err = ret;
2150 } 2147 }
@@ -2156,7 +2153,6 @@ again:
2156 btrfs_end_transaction(trans, rc->extent_root); 2153 btrfs_end_transaction(trans, rc->extent_root);
2157 btrfs_block_rsv_release(rc->extent_root, 2154 btrfs_block_rsv_release(rc->extent_root,
2158 rc->block_rsv, num_bytes); 2155 rc->block_rsv, num_bytes);
2159 retries = 0;
2160 goto again; 2156 goto again;
2161 } 2157 }
2162 } 2158 }
@@ -2406,15 +2402,13 @@ static int reserve_metadata_space(struct btrfs_trans_handle *trans,
2406 num_bytes = calcu_metadata_size(rc, node, 1) * 2; 2402 num_bytes = calcu_metadata_size(rc, node, 1) * 2;
2407 2403
2408 trans->block_rsv = rc->block_rsv; 2404 trans->block_rsv = rc->block_rsv;
2409 ret = btrfs_block_rsv_add(trans, root, rc->block_rsv, num_bytes, 2405 ret = btrfs_block_rsv_add(trans, root, rc->block_rsv, num_bytes);
2410 &rc->block_rsv_retries);
2411 if (ret) { 2406 if (ret) {
2412 if (ret == -EAGAIN) 2407 if (ret == -EAGAIN)
2413 rc->commit_transaction = 1; 2408 rc->commit_transaction = 1;
2414 return ret; 2409 return ret;
2415 } 2410 }
2416 2411
2417 rc->block_rsv_retries = 0;
2418 return 0; 2412 return 0;
2419} 2413}
2420 2414
@@ -3615,8 +3609,7 @@ int prepare_to_relocate(struct reloc_control *rc)
3615 * is no reservation in transaction handle. 3609 * is no reservation in transaction handle.
3616 */ 3610 */
3617 ret = btrfs_block_rsv_add(NULL, rc->extent_root, rc->block_rsv, 3611 ret = btrfs_block_rsv_add(NULL, rc->extent_root, rc->block_rsv,
3618 rc->extent_root->nodesize * 256, 3612 rc->extent_root->nodesize * 256);
3619 &rc->block_rsv_retries);
3620 if (ret) 3613 if (ret)
3621 return ret; 3614 return ret;
3622 3615
@@ -3628,7 +3621,6 @@ int prepare_to_relocate(struct reloc_control *rc)
3628 rc->extents_found = 0; 3621 rc->extents_found = 0;
3629 rc->nodes_relocated = 0; 3622 rc->nodes_relocated = 0;
3630 rc->merging_rsv_size = 0; 3623 rc->merging_rsv_size = 0;
3631 rc->block_rsv_retries = 0;
3632 3624
3633 rc->create_reloc_tree = 1; 3625 rc->create_reloc_tree = 1;
3634 set_reloc_control(rc); 3626 set_reloc_control(rc);