Btrfs: remove lockdep magic from btrfs_next_leaf
Before the reader/writer locks, btrfs_next_leaf needed to keep the path blocking to avoid making lockdep upset. Now that btrfs_next_leaf only takes read locks, this isn't required. Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
@@ -4169,21 +4169,12 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
|
|||||||
u32 nritems;
|
u32 nritems;
|
||||||
int ret;
|
int ret;
|
||||||
int old_spinning = path->leave_spinning;
|
int old_spinning = path->leave_spinning;
|
||||||
int force_blocking = 0;
|
|
||||||
int next_rw_lock = 0;
|
int next_rw_lock = 0;
|
||||||
|
|
||||||
nritems = btrfs_header_nritems(path->nodes[0]);
|
nritems = btrfs_header_nritems(path->nodes[0]);
|
||||||
if (nritems == 0)
|
if (nritems == 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/*
|
|
||||||
* we take the blocks in an order that upsets lockdep. Using
|
|
||||||
* blocking mode is the only way around it.
|
|
||||||
*/
|
|
||||||
#ifdef CONFIG_DEBUG_LOCK_ALLOC
|
|
||||||
force_blocking = 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
btrfs_item_key_to_cpu(path->nodes[0], &key, nritems - 1);
|
btrfs_item_key_to_cpu(path->nodes[0], &key, nritems - 1);
|
||||||
again:
|
again:
|
||||||
level = 1;
|
level = 1;
|
||||||
@@ -4192,8 +4183,6 @@ again:
|
|||||||
btrfs_release_path(path);
|
btrfs_release_path(path);
|
||||||
|
|
||||||
path->keep_locks = 1;
|
path->keep_locks = 1;
|
||||||
|
|
||||||
if (!force_blocking)
|
|
||||||
path->leave_spinning = 1;
|
path->leave_spinning = 1;
|
||||||
|
|
||||||
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
||||||
@@ -4255,19 +4244,11 @@ again:
|
|||||||
if (!ret) {
|
if (!ret) {
|
||||||
btrfs_set_path_blocking(path);
|
btrfs_set_path_blocking(path);
|
||||||
btrfs_tree_read_lock(next);
|
btrfs_tree_read_lock(next);
|
||||||
if (!force_blocking) {
|
|
||||||
btrfs_clear_path_blocking(path, next,
|
btrfs_clear_path_blocking(path, next,
|
||||||
BTRFS_READ_LOCK);
|
BTRFS_READ_LOCK);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (force_blocking) {
|
|
||||||
btrfs_set_lock_blocking_rw(next,
|
|
||||||
BTRFS_READ_LOCK);
|
|
||||||
next_rw_lock = BTRFS_READ_LOCK_BLOCKING;
|
|
||||||
} else {
|
|
||||||
next_rw_lock = BTRFS_READ_LOCK;
|
next_rw_lock = BTRFS_READ_LOCK;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
path->slots[level] = slot;
|
path->slots[level] = slot;
|
||||||
@@ -4300,19 +4281,12 @@ again:
|
|||||||
if (!ret) {
|
if (!ret) {
|
||||||
btrfs_set_path_blocking(path);
|
btrfs_set_path_blocking(path);
|
||||||
btrfs_tree_read_lock(next);
|
btrfs_tree_read_lock(next);
|
||||||
if (!force_blocking)
|
|
||||||
btrfs_clear_path_blocking(path, next,
|
btrfs_clear_path_blocking(path, next,
|
||||||
BTRFS_READ_LOCK);
|
BTRFS_READ_LOCK);
|
||||||
}
|
}
|
||||||
if (force_blocking) {
|
|
||||||
btrfs_set_lock_blocking_rw(next,
|
|
||||||
BTRFS_READ_LOCK);
|
|
||||||
next_rw_lock = BTRFS_READ_LOCK_BLOCKING;
|
|
||||||
} else {
|
|
||||||
next_rw_lock = BTRFS_READ_LOCK;
|
next_rw_lock = BTRFS_READ_LOCK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
done:
|
done:
|
||||||
unlock_up(path, 0, 1);
|
unlock_up(path, 0, 1);
|
||||||
|
Reference in New Issue
Block a user