Commit 6a9fb468 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: make caching_thread use btrfs_find_next_key

extent-tree.c has a find_next_key that just walks up the path to find
the next key, but it is used for both the caching stuff and the snapshot
delete stuff.  The snapshot deletion stuff is special so it can't really
use btrfs_find_next_key, but the caching thread stuff can.  We just need
to fix btrfs_find_next_key to deal with ->skip_locking and then it works
exactly the same as the private find_next_key helper.
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent caa4efaf
...@@ -5623,7 +5623,7 @@ int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path, ...@@ -5623,7 +5623,7 @@ int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path,
int slot; int slot;
struct extent_buffer *c; struct extent_buffer *c;
WARN_ON(!path->keep_locks); WARN_ON(!path->keep_locks && !path->skip_locking);
while (level < BTRFS_MAX_LEVEL) { while (level < BTRFS_MAX_LEVEL) {
if (!path->nodes[level]) if (!path->nodes[level])
return 1; return 1;
...@@ -5639,7 +5639,7 @@ int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path, ...@@ -5639,7 +5639,7 @@ int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path,
!path->nodes[level + 1]) !path->nodes[level + 1])
return 1; return 1;
if (path->locks[level + 1]) { if (path->locks[level + 1] || path->skip_locking) {
level++; level++;
continue; continue;
} }
......
...@@ -331,7 +331,7 @@ static int load_extent_tree_free(struct btrfs_caching_control *caching_ctl) ...@@ -331,7 +331,7 @@ static int load_extent_tree_free(struct btrfs_caching_control *caching_ctl)
if (path->slots[0] < nritems) { if (path->slots[0] < nritems) {
btrfs_item_key_to_cpu(leaf, &key, path->slots[0]); btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
} else { } else {
ret = find_next_key(path, 0, &key); ret = btrfs_find_next_key(extent_root, path, &key, 0, 0);
if (ret) if (ret)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment