aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2012-01-18 10:56:06 -0500
committerChris Mason <chris.mason@oracle.com>2012-03-26 14:42:51 -0400
commit81c9ad237c604adec79fd4d4034264c6669e0ab3 (patch)
tree673fe5a1c491d43fae6f4309aa699b4e328d534e /fs/btrfs/extent-tree.c
parent285ff5af6ce358e73f53b55c9efadd4335f4c2ff (diff)
Btrfs: remove search_start and search_end from find_free_extent and callers
We have been passing nothing but (u64)-1 to find_free_extent for search_end in all of the callers, so it's completely useless, and we've always been passing 0 in as search_start, so just remove them as function arguments and move search_start into find_free_extent. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index eccef6c06237..9b7e7682fda0 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5277,7 +5277,6 @@ enum btrfs_loop_type {
5277static noinline int find_free_extent(struct btrfs_trans_handle *trans, 5277static noinline int find_free_extent(struct btrfs_trans_handle *trans,
5278 struct btrfs_root *orig_root, 5278 struct btrfs_root *orig_root,
5279 u64 num_bytes, u64 empty_size, 5279 u64 num_bytes, u64 empty_size,
5280 u64 search_start, u64 search_end,
5281 u64 hint_byte, struct btrfs_key *ins, 5280 u64 hint_byte, struct btrfs_key *ins,
5282 u64 data) 5281 u64 data)
5283{ 5282{
@@ -5286,6 +5285,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
5286 struct btrfs_free_cluster *last_ptr = NULL; 5285 struct btrfs_free_cluster *last_ptr = NULL;
5287 struct btrfs_block_group_cache *block_group = NULL; 5286 struct btrfs_block_group_cache *block_group = NULL;
5288 struct btrfs_block_group_cache *used_block_group; 5287 struct btrfs_block_group_cache *used_block_group;
5288 u64 search_start = 0;
5289 int empty_cluster = 2 * 1024 * 1024; 5289 int empty_cluster = 2 * 1024 * 1024;
5290 int allowed_chunk_alloc = 0; 5290 int allowed_chunk_alloc = 0;
5291 int done_chunk_alloc = 0; 5291 int done_chunk_alloc = 0;
@@ -5569,11 +5569,6 @@ unclustered_alloc:
5569 } 5569 }
5570checks: 5570checks:
5571 search_start = stripe_align(root, offset); 5571 search_start = stripe_align(root, offset);
5572 /* move on to the next group */
5573 if (search_start + num_bytes >= search_end) {
5574 btrfs_add_free_space(used_block_group, offset, num_bytes);
5575 goto loop;
5576 }
5577 5572
5578 /* move on to the next group */ 5573 /* move on to the next group */
5579 if (search_start + num_bytes > 5574 if (search_start + num_bytes >
@@ -5721,12 +5716,10 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
5721 struct btrfs_root *root, 5716 struct btrfs_root *root,
5722 u64 num_bytes, u64 min_alloc_size, 5717 u64 num_bytes, u64 min_alloc_size,
5723 u64 empty_size, u64 hint_byte, 5718 u64 empty_size, u64 hint_byte,
5724 u64 search_end, struct btrfs_key *ins, 5719 struct btrfs_key *ins, u64 data)
5725 u64 data)
5726{ 5720{
5727 bool final_tried = false; 5721 bool final_tried = false;
5728 int ret; 5722 int ret;
5729 u64 search_start = 0;
5730 5723
5731 data = btrfs_get_alloc_profile(root, data); 5724 data = btrfs_get_alloc_profile(root, data);
5732again: 5725again:
@@ -5741,8 +5734,7 @@ again:
5741 5734
5742 WARN_ON(num_bytes < root->sectorsize); 5735 WARN_ON(num_bytes < root->sectorsize);
5743 ret = find_free_extent(trans, root, num_bytes, empty_size, 5736 ret = find_free_extent(trans, root, num_bytes, empty_size,
5744 search_start, search_end, hint_byte, 5737 hint_byte, ins, data);
5745 ins, data);
5746 5738
5747 if (ret == -ENOSPC) { 5739 if (ret == -ENOSPC) {
5748 if (!final_tried) { 5740 if (!final_tried) {
@@ -6137,7 +6129,7 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
6137 return ERR_CAST(block_rsv); 6129 return ERR_CAST(block_rsv);
6138 6130
6139 ret = btrfs_reserve_extent(trans, root, blocksize, blocksize, 6131 ret = btrfs_reserve_extent(trans, root, blocksize, blocksize,
6140 empty_size, hint, (u64)-1, &ins, 0); 6132 empty_size, hint, &ins, 0);
6141 if (ret) { 6133 if (ret) {
6142 unuse_block_rsv(root->fs_info, block_rsv, blocksize); 6134 unuse_block_rsv(root->fs_info, block_rsv, blocksize);
6143 return ERR_PTR(ret); 6135 return ERR_PTR(ret);