aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r--fs/btrfs/extent-tree.c11
1 files changed, 0 insertions, 11 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 6880a271975a..15d62a9214b7 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -166,7 +166,6 @@ static int add_new_free_space(struct btrfs_block_group_cache *block_group,
166 u64 extent_start, extent_end, size; 166 u64 extent_start, extent_end, size;
167 int ret; 167 int ret;
168 168
169 mutex_lock(&info->pinned_mutex);
170 while (start < end) { 169 while (start < end) {
171 ret = find_first_extent_bit(&info->pinned_extents, start, 170 ret = find_first_extent_bit(&info->pinned_extents, start,
172 &extent_start, &extent_end, 171 &extent_start, &extent_end,
@@ -192,7 +191,6 @@ static int add_new_free_space(struct btrfs_block_group_cache *block_group,
192 ret = btrfs_add_free_space(block_group, start, size); 191 ret = btrfs_add_free_space(block_group, start, size);
193 BUG_ON(ret); 192 BUG_ON(ret);
194 } 193 }
195 mutex_unlock(&info->pinned_mutex);
196 194
197 return 0; 195 return 0;
198} 196}
@@ -2047,7 +2045,6 @@ int btrfs_update_pinned_extents(struct btrfs_root *root,
2047 struct btrfs_block_group_cache *cache; 2045 struct btrfs_block_group_cache *cache;
2048 struct btrfs_fs_info *fs_info = root->fs_info; 2046 struct btrfs_fs_info *fs_info = root->fs_info;
2049 2047
2050 WARN_ON(!mutex_is_locked(&root->fs_info->pinned_mutex));
2051 if (pin) { 2048 if (pin) {
2052 set_extent_dirty(&fs_info->pinned_extents, 2049 set_extent_dirty(&fs_info->pinned_extents,
2053 bytenr, bytenr + num - 1, GFP_NOFS); 2050 bytenr, bytenr + num - 1, GFP_NOFS);
@@ -2055,7 +2052,6 @@ int btrfs_update_pinned_extents(struct btrfs_root *root,
2055 clear_extent_dirty(&fs_info->pinned_extents, 2052 clear_extent_dirty(&fs_info->pinned_extents,
2056 bytenr, bytenr + num - 1, GFP_NOFS); 2053 bytenr, bytenr + num - 1, GFP_NOFS);
2057 } 2054 }
2058 mutex_unlock(&root->fs_info->pinned_mutex);
2059 2055
2060 while (num > 0) { 2056 while (num > 0) {
2061 cache = btrfs_lookup_block_group(fs_info, bytenr); 2057 cache = btrfs_lookup_block_group(fs_info, bytenr);
@@ -2127,7 +2123,6 @@ int btrfs_copy_pinned(struct btrfs_root *root, struct extent_io_tree *copy)
2127 struct extent_io_tree *pinned_extents = &root->fs_info->pinned_extents; 2123 struct extent_io_tree *pinned_extents = &root->fs_info->pinned_extents;
2128 int ret; 2124 int ret;
2129 2125
2130 mutex_lock(&root->fs_info->pinned_mutex);
2131 while (1) { 2126 while (1) {
2132 ret = find_first_extent_bit(pinned_extents, last, 2127 ret = find_first_extent_bit(pinned_extents, last,
2133 &start, &end, EXTENT_DIRTY); 2128 &start, &end, EXTENT_DIRTY);
@@ -2136,7 +2131,6 @@ int btrfs_copy_pinned(struct btrfs_root *root, struct extent_io_tree *copy)
2136 set_extent_dirty(copy, start, end, GFP_NOFS); 2131 set_extent_dirty(copy, start, end, GFP_NOFS);
2137 last = end + 1; 2132 last = end + 1;
2138 } 2133 }
2139 mutex_unlock(&root->fs_info->pinned_mutex);
2140 return 0; 2134 return 0;
2141} 2135}
2142 2136
@@ -2149,7 +2143,6 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans,
2149 int ret; 2143 int ret;
2150 2144
2151 while (1) { 2145 while (1) {
2152 mutex_lock(&root->fs_info->pinned_mutex);
2153 ret = find_first_extent_bit(unpin, 0, &start, &end, 2146 ret = find_first_extent_bit(unpin, 0, &start, &end,
2154 EXTENT_DIRTY); 2147 EXTENT_DIRTY);
2155 if (ret) 2148 if (ret)
@@ -2163,7 +2156,6 @@ int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans,
2163 2156
2164 cond_resched(); 2157 cond_resched();
2165 } 2158 }
2166 mutex_unlock(&root->fs_info->pinned_mutex);
2167 return ret; 2159 return ret;
2168} 2160}
2169 2161
@@ -2205,7 +2197,6 @@ static int pin_down_bytes(struct btrfs_trans_handle *trans,
2205 free_extent_buffer(buf); 2197 free_extent_buffer(buf);
2206pinit: 2198pinit:
2207 btrfs_set_path_blocking(path); 2199 btrfs_set_path_blocking(path);
2208 mutex_lock(&root->fs_info->pinned_mutex);
2209 /* unlocks the pinned mutex */ 2200 /* unlocks the pinned mutex */
2210 btrfs_update_pinned_extents(root, bytenr, num_bytes, 1); 2201 btrfs_update_pinned_extents(root, bytenr, num_bytes, 1);
2211 2202
@@ -2511,8 +2502,6 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans,
2511 */ 2502 */
2512 if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID && 2503 if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID &&
2513 owner_objectid < BTRFS_FIRST_FREE_OBJECTID) { 2504 owner_objectid < BTRFS_FIRST_FREE_OBJECTID) {
2514 mutex_lock(&root->fs_info->pinned_mutex);
2515
2516 /* unlocks the pinned mutex */ 2505 /* unlocks the pinned mutex */
2517 btrfs_update_pinned_extents(root, bytenr, num_bytes, 1); 2506 btrfs_update_pinned_extents(root, bytenr, num_bytes, 1);
2518 update_reserved_extents(root, bytenr, num_bytes, 0); 2507 update_reserved_extents(root, bytenr, num_bytes, 0);