diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/ctree.h | 1 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 1 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 11 | ||||
-rw-r--r-- | fs/btrfs/tree-log.c | 4 |
4 files changed, 1 insertions, 16 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 527744561f93..aaa049b8e134 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -728,7 +728,6 @@ struct btrfs_fs_info { | |||
728 | struct mutex tree_log_mutex; | 728 | struct mutex tree_log_mutex; |
729 | struct mutex transaction_kthread_mutex; | 729 | struct mutex transaction_kthread_mutex; |
730 | struct mutex cleaner_mutex; | 730 | struct mutex cleaner_mutex; |
731 | struct mutex pinned_mutex; | ||
732 | struct mutex chunk_mutex; | 731 | struct mutex chunk_mutex; |
733 | struct mutex drop_mutex; | 732 | struct mutex drop_mutex; |
734 | struct mutex volume_mutex; | 733 | struct mutex volume_mutex; |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 1747dfd18654..ea59ebfa505d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1647,7 +1647,6 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1647 | mutex_init(&fs_info->ordered_operations_mutex); | 1647 | mutex_init(&fs_info->ordered_operations_mutex); |
1648 | mutex_init(&fs_info->tree_log_mutex); | 1648 | mutex_init(&fs_info->tree_log_mutex); |
1649 | mutex_init(&fs_info->drop_mutex); | 1649 | mutex_init(&fs_info->drop_mutex); |
1650 | mutex_init(&fs_info->pinned_mutex); | ||
1651 | mutex_init(&fs_info->chunk_mutex); | 1650 | mutex_init(&fs_info->chunk_mutex); |
1652 | mutex_init(&fs_info->transaction_kthread_mutex); | 1651 | mutex_init(&fs_info->transaction_kthread_mutex); |
1653 | mutex_init(&fs_info->cleaner_mutex); | 1652 | mutex_init(&fs_info->cleaner_mutex); |
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); |
2206 | pinit: | 2198 | pinit: |
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); |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index fc9b87a7975b..2871609641f5 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -262,11 +262,9 @@ static int process_one_buffer(struct btrfs_root *log, | |||
262 | struct extent_buffer *eb, | 262 | struct extent_buffer *eb, |
263 | struct walk_control *wc, u64 gen) | 263 | struct walk_control *wc, u64 gen) |
264 | { | 264 | { |
265 | if (wc->pin) { | 265 | if (wc->pin) |
266 | mutex_lock(&log->fs_info->pinned_mutex); | ||
267 | btrfs_update_pinned_extents(log->fs_info->extent_root, | 266 | btrfs_update_pinned_extents(log->fs_info->extent_root, |
268 | eb->start, eb->len, 1); | 267 | eb->start, eb->len, 1); |
269 | } | ||
270 | 268 | ||
271 | if (btrfs_buffer_uptodate(eb, gen)) { | 269 | if (btrfs_buffer_uptodate(eb, gen)) { |
272 | if (wc->write) | 270 | if (wc->write) |