aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ctree.h2
-rw-r--r--fs/btrfs/extent-tree.c37
2 files changed, 20 insertions, 19 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 4272fbb08732..78b9d457d723 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3065,7 +3065,7 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
3065 struct btrfs_root *root, 3065 struct btrfs_root *root,
3066 u64 num_bytes, u64 min_alloc_size, 3066 u64 num_bytes, u64 min_alloc_size,
3067 u64 empty_size, u64 hint_byte, 3067 u64 empty_size, u64 hint_byte,
3068 struct btrfs_key *ins, u64 data); 3068 struct btrfs_key *ins, int is_data);
3069int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, 3069int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
3070 struct extent_buffer *buf, int full_backref, int for_cow); 3070 struct extent_buffer *buf, int full_backref, int for_cow);
3071int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, 3071int 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 039a77162817..2305b5c5cf00 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5876,7 +5876,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
5876 struct btrfs_root *orig_root, 5876 struct btrfs_root *orig_root,
5877 u64 num_bytes, u64 empty_size, 5877 u64 num_bytes, u64 empty_size,
5878 u64 hint_byte, struct btrfs_key *ins, 5878 u64 hint_byte, struct btrfs_key *ins,
5879 u64 data) 5879 u64 flags)
5880{ 5880{
5881 int ret = 0; 5881 int ret = 0;
5882 struct btrfs_root *root = orig_root->fs_info->extent_root; 5882 struct btrfs_root *root = orig_root->fs_info->extent_root;
@@ -5887,8 +5887,8 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
5887 int empty_cluster = 2 * 1024 * 1024; 5887 int empty_cluster = 2 * 1024 * 1024;
5888 struct btrfs_space_info *space_info; 5888 struct btrfs_space_info *space_info;
5889 int loop = 0; 5889 int loop = 0;
5890 int index = __get_raid_index(data); 5890 int index = __get_raid_index(flags);
5891 int alloc_type = (data & BTRFS_BLOCK_GROUP_DATA) ? 5891 int alloc_type = (flags & BTRFS_BLOCK_GROUP_DATA) ?
5892 RESERVE_ALLOC_NO_ACCOUNT : RESERVE_ALLOC; 5892 RESERVE_ALLOC_NO_ACCOUNT : RESERVE_ALLOC;
5893 bool found_uncached_bg = false; 5893 bool found_uncached_bg = false;
5894 bool failed_cluster_refill = false; 5894 bool failed_cluster_refill = false;
@@ -5901,11 +5901,11 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
5901 ins->objectid = 0; 5901 ins->objectid = 0;
5902 ins->offset = 0; 5902 ins->offset = 0;
5903 5903
5904 trace_find_free_extent(orig_root, num_bytes, empty_size, data); 5904 trace_find_free_extent(orig_root, num_bytes, empty_size, flags);
5905 5905
5906 space_info = __find_space_info(root->fs_info, data); 5906 space_info = __find_space_info(root->fs_info, flags);
5907 if (!space_info) { 5907 if (!space_info) {
5908 btrfs_err(root->fs_info, "No space info for %llu", data); 5908 btrfs_err(root->fs_info, "No space info for %llu", flags);
5909 return -ENOSPC; 5909 return -ENOSPC;
5910 } 5910 }
5911 5911
@@ -5916,13 +5916,13 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
5916 if (btrfs_mixed_space_info(space_info)) 5916 if (btrfs_mixed_space_info(space_info))
5917 use_cluster = false; 5917 use_cluster = false;
5918 5918
5919 if (data & BTRFS_BLOCK_GROUP_METADATA && use_cluster) { 5919 if (flags & BTRFS_BLOCK_GROUP_METADATA && use_cluster) {
5920 last_ptr = &root->fs_info->meta_alloc_cluster; 5920 last_ptr = &root->fs_info->meta_alloc_cluster;
5921 if (!btrfs_test_opt(root, SSD)) 5921 if (!btrfs_test_opt(root, SSD))
5922 empty_cluster = 64 * 1024; 5922 empty_cluster = 64 * 1024;
5923 } 5923 }
5924 5924
5925 if ((data & BTRFS_BLOCK_GROUP_DATA) && use_cluster && 5925 if ((flags & BTRFS_BLOCK_GROUP_DATA) && use_cluster &&
5926 btrfs_test_opt(root, SSD)) { 5926 btrfs_test_opt(root, SSD)) {
5927 last_ptr = &root->fs_info->data_alloc_cluster; 5927 last_ptr = &root->fs_info->data_alloc_cluster;
5928 } 5928 }
@@ -5951,7 +5951,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
5951 * However if we are re-searching with an ideal block group 5951 * However if we are re-searching with an ideal block group
5952 * picked out then we don't care that the block group is cached. 5952 * picked out then we don't care that the block group is cached.
5953 */ 5953 */
5954 if (block_group && block_group_bits(block_group, data) && 5954 if (block_group && block_group_bits(block_group, flags) &&
5955 block_group->cached != BTRFS_CACHE_NO) { 5955 block_group->cached != BTRFS_CACHE_NO) {
5956 down_read(&space_info->groups_sem); 5956 down_read(&space_info->groups_sem);
5957 if (list_empty(&block_group->list) || 5957 if (list_empty(&block_group->list) ||
@@ -5989,7 +5989,7 @@ search:
5989 * raid types, but we want to make sure we only allocate 5989 * raid types, but we want to make sure we only allocate
5990 * for the proper type. 5990 * for the proper type.
5991 */ 5991 */
5992 if (!block_group_bits(block_group, data)) { 5992 if (!block_group_bits(block_group, flags)) {
5993 u64 extra = BTRFS_BLOCK_GROUP_DUP | 5993 u64 extra = BTRFS_BLOCK_GROUP_DUP |
5994 BTRFS_BLOCK_GROUP_RAID1 | 5994 BTRFS_BLOCK_GROUP_RAID1 |
5995 BTRFS_BLOCK_GROUP_RAID5 | 5995 BTRFS_BLOCK_GROUP_RAID5 |
@@ -6001,7 +6001,7 @@ search:
6001 * doesn't provide them, bail. This does allow us to 6001 * doesn't provide them, bail. This does allow us to
6002 * fill raid0 from raid1. 6002 * fill raid0 from raid1.
6003 */ 6003 */
6004 if ((data & extra) && !(block_group->flags & extra)) 6004 if ((flags & extra) && !(block_group->flags & extra))
6005 goto loop; 6005 goto loop;
6006 } 6006 }
6007 6007
@@ -6032,7 +6032,7 @@ have_block_group:
6032 if (used_block_group != block_group && 6032 if (used_block_group != block_group &&
6033 (!used_block_group || 6033 (!used_block_group ||
6034 used_block_group->ro || 6034 used_block_group->ro ||
6035 !block_group_bits(used_block_group, data))) { 6035 !block_group_bits(used_block_group, flags))) {
6036 used_block_group = block_group; 6036 used_block_group = block_group;
6037 goto refill_cluster; 6037 goto refill_cluster;
6038 } 6038 }
@@ -6228,7 +6228,7 @@ loop:
6228 index = 0; 6228 index = 0;
6229 loop++; 6229 loop++;
6230 if (loop == LOOP_ALLOC_CHUNK) { 6230 if (loop == LOOP_ALLOC_CHUNK) {
6231 ret = do_chunk_alloc(trans, root, data, 6231 ret = do_chunk_alloc(trans, root, flags,
6232 CHUNK_ALLOC_FORCE); 6232 CHUNK_ALLOC_FORCE);
6233 /* 6233 /*
6234 * Do not bail out on ENOSPC since we 6234 * Do not bail out on ENOSPC since we
@@ -6306,16 +6306,17 @@ int btrfs_reserve_extent(struct btrfs_trans_handle *trans,
6306 struct btrfs_root *root, 6306 struct btrfs_root *root,
6307 u64 num_bytes, u64 min_alloc_size, 6307 u64 num_bytes, u64 min_alloc_size,
6308 u64 empty_size, u64 hint_byte, 6308 u64 empty_size, u64 hint_byte,
6309 struct btrfs_key *ins, u64 data) 6309 struct btrfs_key *ins, int is_data)
6310{ 6310{
6311 bool final_tried = false; 6311 bool final_tried = false;
6312 u64 flags;
6312 int ret; 6313 int ret;
6313 6314
6314 data = btrfs_get_alloc_profile(root, data); 6315 flags = btrfs_get_alloc_profile(root, is_data);
6315again: 6316again:
6316 WARN_ON(num_bytes < root->sectorsize); 6317 WARN_ON(num_bytes < root->sectorsize);
6317 ret = find_free_extent(trans, root, num_bytes, empty_size, 6318 ret = find_free_extent(trans, root, num_bytes, empty_size,
6318 hint_byte, ins, data); 6319 hint_byte, ins, flags);
6319 6320
6320 if (ret == -ENOSPC) { 6321 if (ret == -ENOSPC) {
6321 if (!final_tried) { 6322 if (!final_tried) {
@@ -6328,9 +6329,9 @@ again:
6328 } else if (btrfs_test_opt(root, ENOSPC_DEBUG)) { 6329 } else if (btrfs_test_opt(root, ENOSPC_DEBUG)) {
6329 struct btrfs_space_info *sinfo; 6330 struct btrfs_space_info *sinfo;
6330 6331
6331 sinfo = __find_space_info(root->fs_info, data); 6332 sinfo = __find_space_info(root->fs_info, flags);
6332 btrfs_err(root->fs_info, "allocation failed flags %llu, wanted %llu", 6333 btrfs_err(root->fs_info, "allocation failed flags %llu, wanted %llu",
6333 (unsigned long long)data, 6334 (unsigned long long)flags,
6334 (unsigned long long)num_bytes); 6335 (unsigned long long)num_bytes);
6335 if (sinfo) 6336 if (sinfo)
6336 dump_space_info(sinfo, num_bytes, 1); 6337 dump_space_info(sinfo, num_bytes, 1);