Commit 079899c2 authored by Chris Mason's avatar Chris Mason

Btrfs: Change find_extent_buffer to use TestSetPageLocked

This makes it possible for callers to check for extent_buffers in cache
without deadlocking against any btree locks held.
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent e7a84565
...@@ -1438,7 +1438,6 @@ static int pin_down_bytes(struct btrfs_root *root, u64 bytenr, u32 num_bytes, ...@@ -1438,7 +1438,6 @@ static int pin_down_bytes(struct btrfs_root *root, u64 bytenr, u32 num_bytes,
int err = 0; int err = 0;
if (!pending) { if (!pending) {
#if 0
struct extent_buffer *buf; struct extent_buffer *buf;
buf = btrfs_find_tree_block(root, bytenr, num_bytes); buf = btrfs_find_tree_block(root, bytenr, num_bytes);
if (buf) { if (buf) {
...@@ -1460,7 +1459,6 @@ static int pin_down_bytes(struct btrfs_root *root, u64 bytenr, u32 num_bytes, ...@@ -1460,7 +1459,6 @@ static int pin_down_bytes(struct btrfs_root *root, u64 bytenr, u32 num_bytes,
} }
free_extent_buffer(buf); free_extent_buffer(buf);
} }
#endif
update_pinned_extents(root, bytenr, num_bytes, 1); update_pinned_extents(root, bytenr, num_bytes, 1);
} else { } else {
set_extent_bits(&root->fs_info->pending_del, set_extent_bits(&root->fs_info->pending_del,
......
...@@ -2808,10 +2808,15 @@ struct extent_buffer *find_extent_buffer(struct extent_io_tree *tree, ...@@ -2808,10 +2808,15 @@ struct extent_buffer *find_extent_buffer(struct extent_io_tree *tree,
goto lru_add; goto lru_add;
for (i = 0; i < num_pages; i++, index++) { for (i = 0; i < num_pages; i++, index++) {
p = find_lock_page(mapping, index); p = find_get_page(mapping, index);
if (!p) { if (!p) {
goto fail; goto fail;
} }
if (TestSetPageLocked(p)) {
page_cache_release(p);
goto fail;
}
set_page_extent_mapped(p); set_page_extent_mapped(p);
mark_page_accessed(p); mark_page_accessed(p);
......
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