diff options
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ctree.c | 20 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 4 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 24 |
3 files changed, 23 insertions, 25 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index aeab453b8e24..44ee5d2e52a4 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -280,9 +280,9 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans, | |||
280 | 280 | ||
281 | WARN_ON(btrfs_header_generation(buf) > trans->transid); | 281 | WARN_ON(btrfs_header_generation(buf) > trans->transid); |
282 | if (new_root_objectid == BTRFS_TREE_RELOC_OBJECTID) | 282 | if (new_root_objectid == BTRFS_TREE_RELOC_OBJECTID) |
283 | ret = btrfs_inc_ref(trans, root, cow, 1, 1); | 283 | ret = btrfs_inc_ref(trans, root, cow, 1); |
284 | else | 284 | else |
285 | ret = btrfs_inc_ref(trans, root, cow, 0, 1); | 285 | ret = btrfs_inc_ref(trans, root, cow, 0); |
286 | 286 | ||
287 | if (ret) | 287 | if (ret) |
288 | return ret; | 288 | return ret; |
@@ -1035,14 +1035,14 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans, | |||
1035 | if ((owner == root->root_key.objectid || | 1035 | if ((owner == root->root_key.objectid || |
1036 | root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) && | 1036 | root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID) && |
1037 | !(flags & BTRFS_BLOCK_FLAG_FULL_BACKREF)) { | 1037 | !(flags & BTRFS_BLOCK_FLAG_FULL_BACKREF)) { |
1038 | ret = btrfs_inc_ref(trans, root, buf, 1, 1); | 1038 | ret = btrfs_inc_ref(trans, root, buf, 1); |
1039 | BUG_ON(ret); /* -ENOMEM */ | 1039 | BUG_ON(ret); /* -ENOMEM */ |
1040 | 1040 | ||
1041 | if (root->root_key.objectid == | 1041 | if (root->root_key.objectid == |
1042 | BTRFS_TREE_RELOC_OBJECTID) { | 1042 | BTRFS_TREE_RELOC_OBJECTID) { |
1043 | ret = btrfs_dec_ref(trans, root, buf, 0, 1); | 1043 | ret = btrfs_dec_ref(trans, root, buf, 0); |
1044 | BUG_ON(ret); /* -ENOMEM */ | 1044 | BUG_ON(ret); /* -ENOMEM */ |
1045 | ret = btrfs_inc_ref(trans, root, cow, 1, 1); | 1045 | ret = btrfs_inc_ref(trans, root, cow, 1); |
1046 | BUG_ON(ret); /* -ENOMEM */ | 1046 | BUG_ON(ret); /* -ENOMEM */ |
1047 | } | 1047 | } |
1048 | new_flags |= BTRFS_BLOCK_FLAG_FULL_BACKREF; | 1048 | new_flags |= BTRFS_BLOCK_FLAG_FULL_BACKREF; |
@@ -1050,9 +1050,9 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans, | |||
1050 | 1050 | ||
1051 | if (root->root_key.objectid == | 1051 | if (root->root_key.objectid == |
1052 | BTRFS_TREE_RELOC_OBJECTID) | 1052 | BTRFS_TREE_RELOC_OBJECTID) |
1053 | ret = btrfs_inc_ref(trans, root, cow, 1, 1); | 1053 | ret = btrfs_inc_ref(trans, root, cow, 1); |
1054 | else | 1054 | else |
1055 | ret = btrfs_inc_ref(trans, root, cow, 0, 1); | 1055 | ret = btrfs_inc_ref(trans, root, cow, 0); |
1056 | BUG_ON(ret); /* -ENOMEM */ | 1056 | BUG_ON(ret); /* -ENOMEM */ |
1057 | } | 1057 | } |
1058 | if (new_flags != 0) { | 1058 | if (new_flags != 0) { |
@@ -1069,11 +1069,11 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans, | |||
1069 | if (flags & BTRFS_BLOCK_FLAG_FULL_BACKREF) { | 1069 | if (flags & BTRFS_BLOCK_FLAG_FULL_BACKREF) { |
1070 | if (root->root_key.objectid == | 1070 | if (root->root_key.objectid == |
1071 | BTRFS_TREE_RELOC_OBJECTID) | 1071 | BTRFS_TREE_RELOC_OBJECTID) |
1072 | ret = btrfs_inc_ref(trans, root, cow, 1, 1); | 1072 | ret = btrfs_inc_ref(trans, root, cow, 1); |
1073 | else | 1073 | else |
1074 | ret = btrfs_inc_ref(trans, root, cow, 0, 1); | 1074 | ret = btrfs_inc_ref(trans, root, cow, 0); |
1075 | BUG_ON(ret); /* -ENOMEM */ | 1075 | BUG_ON(ret); /* -ENOMEM */ |
1076 | ret = btrfs_dec_ref(trans, root, buf, 1, 1); | 1076 | ret = btrfs_dec_ref(trans, root, buf, 1); |
1077 | BUG_ON(ret); /* -ENOMEM */ | 1077 | BUG_ON(ret); /* -ENOMEM */ |
1078 | } | 1078 | } |
1079 | clean_tree_block(trans, root, buf); | 1079 | clean_tree_block(trans, root, buf); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index be91397f4e92..8e29b614fe93 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -3326,9 +3326,9 @@ int btrfs_reserve_extent(struct btrfs_root *root, u64 num_bytes, | |||
3326 | u64 min_alloc_size, u64 empty_size, u64 hint_byte, | 3326 | u64 min_alloc_size, u64 empty_size, u64 hint_byte, |
3327 | struct btrfs_key *ins, int is_data, int delalloc); | 3327 | struct btrfs_key *ins, int is_data, int delalloc); |
3328 | int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 3328 | int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
3329 | struct extent_buffer *buf, int full_backref, int no_quota); | 3329 | struct extent_buffer *buf, int full_backref); |
3330 | int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 3330 | int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
3331 | struct extent_buffer *buf, int full_backref, int no_quota); | 3331 | struct extent_buffer *buf, int full_backref); |
3332 | int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans, | 3332 | int btrfs_set_disk_extent_flags(struct btrfs_trans_handle *trans, |
3333 | struct btrfs_root *root, | 3333 | struct btrfs_root *root, |
3334 | u64 bytenr, u64 num_bytes, u64 flags, | 3334 | u64 bytenr, u64 num_bytes, u64 flags, |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 813537f362f9..591893fe58cb 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -3057,7 +3057,7 @@ out: | |||
3057 | static int __btrfs_mod_ref(struct btrfs_trans_handle *trans, | 3057 | static int __btrfs_mod_ref(struct btrfs_trans_handle *trans, |
3058 | struct btrfs_root *root, | 3058 | struct btrfs_root *root, |
3059 | struct extent_buffer *buf, | 3059 | struct extent_buffer *buf, |
3060 | int full_backref, int inc, int no_quota) | 3060 | int full_backref, int inc) |
3061 | { | 3061 | { |
3062 | u64 bytenr; | 3062 | u64 bytenr; |
3063 | u64 num_bytes; | 3063 | u64 num_bytes; |
@@ -3111,7 +3111,7 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans, | |||
3111 | key.offset -= btrfs_file_extent_offset(buf, fi); | 3111 | key.offset -= btrfs_file_extent_offset(buf, fi); |
3112 | ret = process_func(trans, root, bytenr, num_bytes, | 3112 | ret = process_func(trans, root, bytenr, num_bytes, |
3113 | parent, ref_root, key.objectid, | 3113 | parent, ref_root, key.objectid, |
3114 | key.offset, no_quota); | 3114 | key.offset, 1); |
3115 | if (ret) | 3115 | if (ret) |
3116 | goto fail; | 3116 | goto fail; |
3117 | } else { | 3117 | } else { |
@@ -3119,7 +3119,7 @@ static int __btrfs_mod_ref(struct btrfs_trans_handle *trans, | |||
3119 | num_bytes = btrfs_level_size(root, level - 1); | 3119 | num_bytes = btrfs_level_size(root, level - 1); |
3120 | ret = process_func(trans, root, bytenr, num_bytes, | 3120 | ret = process_func(trans, root, bytenr, num_bytes, |
3121 | parent, ref_root, level - 1, 0, | 3121 | parent, ref_root, level - 1, 0, |
3122 | no_quota); | 3122 | 1); |
3123 | if (ret) | 3123 | if (ret) |
3124 | goto fail; | 3124 | goto fail; |
3125 | } | 3125 | } |
@@ -3130,15 +3130,15 @@ fail: | |||
3130 | } | 3130 | } |
3131 | 3131 | ||
3132 | int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 3132 | int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
3133 | struct extent_buffer *buf, int full_backref, int no_quota) | 3133 | struct extent_buffer *buf, int full_backref) |
3134 | { | 3134 | { |
3135 | return __btrfs_mod_ref(trans, root, buf, full_backref, 1, no_quota); | 3135 | return __btrfs_mod_ref(trans, root, buf, full_backref, 1); |
3136 | } | 3136 | } |
3137 | 3137 | ||
3138 | int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, | 3138 | int btrfs_dec_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, |
3139 | struct extent_buffer *buf, int full_backref, int no_quota) | 3139 | struct extent_buffer *buf, int full_backref) |
3140 | { | 3140 | { |
3141 | return __btrfs_mod_ref(trans, root, buf, full_backref, 0, no_quota); | 3141 | return __btrfs_mod_ref(trans, root, buf, full_backref, 0); |
3142 | } | 3142 | } |
3143 | 3143 | ||
3144 | static int write_one_cache_group(struct btrfs_trans_handle *trans, | 3144 | static int write_one_cache_group(struct btrfs_trans_handle *trans, |
@@ -7532,9 +7532,9 @@ static noinline int walk_down_proc(struct btrfs_trans_handle *trans, | |||
7532 | /* wc->stage == UPDATE_BACKREF */ | 7532 | /* wc->stage == UPDATE_BACKREF */ |
7533 | if (!(wc->flags[level] & flag)) { | 7533 | if (!(wc->flags[level] & flag)) { |
7534 | BUG_ON(!path->locks[level]); | 7534 | BUG_ON(!path->locks[level]); |
7535 | ret = btrfs_inc_ref(trans, root, eb, 1, wc->for_reloc); | 7535 | ret = btrfs_inc_ref(trans, root, eb, 1); |
7536 | BUG_ON(ret); /* -ENOMEM */ | 7536 | BUG_ON(ret); /* -ENOMEM */ |
7537 | ret = btrfs_dec_ref(trans, root, eb, 0, wc->for_reloc); | 7537 | ret = btrfs_dec_ref(trans, root, eb, 0); |
7538 | BUG_ON(ret); /* -ENOMEM */ | 7538 | BUG_ON(ret); /* -ENOMEM */ |
7539 | ret = btrfs_set_disk_extent_flags(trans, root, eb->start, | 7539 | ret = btrfs_set_disk_extent_flags(trans, root, eb->start, |
7540 | eb->len, flag, | 7540 | eb->len, flag, |
@@ -7769,11 +7769,9 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans, | |||
7769 | if (wc->refs[level] == 1) { | 7769 | if (wc->refs[level] == 1) { |
7770 | if (level == 0) { | 7770 | if (level == 0) { |
7771 | if (wc->flags[level] & BTRFS_BLOCK_FLAG_FULL_BACKREF) | 7771 | if (wc->flags[level] & BTRFS_BLOCK_FLAG_FULL_BACKREF) |
7772 | ret = btrfs_dec_ref(trans, root, eb, 1, | 7772 | ret = btrfs_dec_ref(trans, root, eb, 1); |
7773 | wc->for_reloc); | ||
7774 | else | 7773 | else |
7775 | ret = btrfs_dec_ref(trans, root, eb, 0, | 7774 | ret = btrfs_dec_ref(trans, root, eb, 0); |
7776 | wc->for_reloc); | ||
7777 | BUG_ON(ret); /* -ENOMEM */ | 7775 | BUG_ON(ret); /* -ENOMEM */ |
7778 | } | 7776 | } |
7779 | /* make block locked assertion in clean_tree_block happy */ | 7777 | /* make block locked assertion in clean_tree_block happy */ |