aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--fs/btrfs/ctree.h3
-rw-r--r--fs/btrfs/extent-tree.c16
-rw-r--r--fs/btrfs/inode.c9
3 files changed, 9 insertions, 19 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 80b6486fd5e6..edccc948e877 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2466,8 +2466,7 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
2466 struct btrfs_root *root, 2466 struct btrfs_root *root,
2467 u64 num_bytes, u64 min_alloc_size, 2467 u64 num_bytes, u64 min_alloc_size,
2468 u64 empty_size, u64 hint_byte, 2468 u64 empty_size, u64 hint_byte,
2469 u64 search_end, struct btrfs_key *ins, 2469 struct btrfs_key *ins, u64 data);
2470 u64 data);
2471int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, 2470int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
2472 struct extent_buffer *buf, int full_backref, int for_cow); 2471 struct extent_buffer *buf, int full_backref, int for_cow);
2473int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, 2472int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
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);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 892b34785ccc..bb268193d85d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -634,8 +634,7 @@ retry:
634 ret = btrfs_reserve_extent(trans, root, 634 ret = btrfs_reserve_extent(trans, root,
635 async_extent->compressed_size, 635 async_extent->compressed_size,
636 async_extent->compressed_size, 636 async_extent->compressed_size,
637 0, alloc_hint, 637 0, alloc_hint, &ins, 1);
638 (u64)-1, &ins, 1);
639 btrfs_end_transaction(trans, root); 638 btrfs_end_transaction(trans, root);
640 639
641 if (ret) { 640 if (ret) {
@@ -838,7 +837,7 @@ static noinline int cow_file_range(struct inode *inode,
838 cur_alloc_size = disk_num_bytes; 837 cur_alloc_size = disk_num_bytes;
839 ret = btrfs_reserve_extent(trans, root, cur_alloc_size, 838 ret = btrfs_reserve_extent(trans, root, cur_alloc_size,
840 root->sectorsize, 0, alloc_hint, 839 root->sectorsize, 0, alloc_hint,
841 (u64)-1, &ins, 1); 840 &ins, 1);
842 BUG_ON(ret); 841 BUG_ON(ret);
843 842
844 em = alloc_extent_map(); 843 em = alloc_extent_map();
@@ -5414,7 +5413,7 @@ static struct extent_map *btrfs_new_extent_direct(struct inode *inode,
5414 5413
5415 alloc_hint = get_extent_allocation_hint(inode, start, len); 5414 alloc_hint = get_extent_allocation_hint(inode, start, len);
5416 ret = btrfs_reserve_extent(trans, root, len, root->sectorsize, 0, 5415 ret = btrfs_reserve_extent(trans, root, len, root->sectorsize, 0,
5417 alloc_hint, (u64)-1, &ins, 1); 5416 alloc_hint, &ins, 1);
5418 if (ret) { 5417 if (ret) {
5419 em = ERR_PTR(ret); 5418 em = ERR_PTR(ret);
5420 goto out; 5419 goto out;
@@ -7315,7 +7314,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
7315 } 7314 }
7316 7315
7317 ret = btrfs_reserve_extent(trans, root, num_bytes, min_size, 7316 ret = btrfs_reserve_extent(trans, root, num_bytes, min_size,
7318 0, *alloc_hint, (u64)-1, &ins, 1); 7317 0, *alloc_hint, &ins, 1);
7319 if (ret) { 7318 if (ret) {
7320 if (own_trans) 7319 if (own_trans)
7321 btrfs_end_transaction(trans, root); 7320 btrfs_end_transaction(trans, root);