diff options
-rw-r--r-- | fs/btrfs/ctree.c | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 0ad48e782d37..011cab3aca8d 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -4169,21 +4169,12 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path) | |||
4169 | u32 nritems; | 4169 | u32 nritems; |
4170 | int ret; | 4170 | int ret; |
4171 | int old_spinning = path->leave_spinning; | 4171 | int old_spinning = path->leave_spinning; |
4172 | int force_blocking = 0; | ||
4173 | int next_rw_lock = 0; | 4172 | int next_rw_lock = 0; |
4174 | 4173 | ||
4175 | nritems = btrfs_header_nritems(path->nodes[0]); | 4174 | nritems = btrfs_header_nritems(path->nodes[0]); |
4176 | if (nritems == 0) | 4175 | if (nritems == 0) |
4177 | return 1; | 4176 | return 1; |
4178 | 4177 | ||
4179 | /* | ||
4180 | * we take the blocks in an order that upsets lockdep. Using | ||
4181 | * blocking mode is the only way around it. | ||
4182 | */ | ||
4183 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
4184 | force_blocking = 1; | ||
4185 | #endif | ||
4186 | |||
4187 | btrfs_item_key_to_cpu(path->nodes[0], &key, nritems - 1); | 4178 | btrfs_item_key_to_cpu(path->nodes[0], &key, nritems - 1); |
4188 | again: | 4179 | again: |
4189 | level = 1; | 4180 | level = 1; |
@@ -4192,9 +4183,7 @@ again: | |||
4192 | btrfs_release_path(path); | 4183 | btrfs_release_path(path); |
4193 | 4184 | ||
4194 | path->keep_locks = 1; | 4185 | path->keep_locks = 1; |
4195 | 4186 | path->leave_spinning = 1; | |
4196 | if (!force_blocking) | ||
4197 | path->leave_spinning = 1; | ||
4198 | 4187 | ||
4199 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); | 4188 | ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); |
4200 | path->keep_locks = 0; | 4189 | path->keep_locks = 0; |
@@ -4255,18 +4244,10 @@ again: | |||
4255 | if (!ret) { | 4244 | if (!ret) { |
4256 | btrfs_set_path_blocking(path); | 4245 | btrfs_set_path_blocking(path); |
4257 | btrfs_tree_read_lock(next); | 4246 | btrfs_tree_read_lock(next); |
4258 | if (!force_blocking) { | 4247 | btrfs_clear_path_blocking(path, next, |
4259 | btrfs_clear_path_blocking(path, next, | ||
4260 | BTRFS_READ_LOCK); | 4248 | BTRFS_READ_LOCK); |
4261 | } | ||
4262 | } | ||
4263 | if (force_blocking) { | ||
4264 | btrfs_set_lock_blocking_rw(next, | ||
4265 | BTRFS_READ_LOCK); | ||
4266 | next_rw_lock = BTRFS_READ_LOCK_BLOCKING; | ||
4267 | } else { | ||
4268 | next_rw_lock = BTRFS_READ_LOCK; | ||
4269 | } | 4249 | } |
4250 | next_rw_lock = BTRFS_READ_LOCK; | ||
4270 | } | 4251 | } |
4271 | break; | 4252 | break; |
4272 | } | 4253 | } |
@@ -4300,17 +4281,10 @@ again: | |||
4300 | if (!ret) { | 4281 | if (!ret) { |
4301 | btrfs_set_path_blocking(path); | 4282 | btrfs_set_path_blocking(path); |
4302 | btrfs_tree_read_lock(next); | 4283 | btrfs_tree_read_lock(next); |
4303 | if (!force_blocking) | 4284 | btrfs_clear_path_blocking(path, next, |
4304 | btrfs_clear_path_blocking(path, next, | ||
4305 | BTRFS_READ_LOCK); | 4285 | BTRFS_READ_LOCK); |
4306 | } | 4286 | } |
4307 | if (force_blocking) { | 4287 | next_rw_lock = BTRFS_READ_LOCK; |
4308 | btrfs_set_lock_blocking_rw(next, | ||
4309 | BTRFS_READ_LOCK); | ||
4310 | next_rw_lock = BTRFS_READ_LOCK_BLOCKING; | ||
4311 | } else { | ||
4312 | next_rw_lock = BTRFS_READ_LOCK; | ||
4313 | } | ||
4314 | } | 4288 | } |
4315 | } | 4289 | } |
4316 | ret = 0; | 4290 | ret = 0; |