diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-06-25 16:01:31 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:03 -0400 |
commit | 079899c2384023cd8efcd3806680b4f1d2abbd54 (patch) | |
tree | d5d6d44f92b600f2fd3e5066bdcd5812e58cbf14 | |
parent | e7a84565bcdb239caad29ccbe559ef978090ac7e (diff) |
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: Chris Mason <chris.mason@oracle.com>
-rw-r--r-- | fs/btrfs/extent-tree.c | 2 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a9b3a25a45b7..dc3c03c6612d 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -1438,7 +1438,6 @@ static int pin_down_bytes(struct btrfs_root *root, u64 bytenr, u32 num_bytes, | |||
1438 | int err = 0; | 1438 | int err = 0; |
1439 | 1439 | ||
1440 | if (!pending) { | 1440 | if (!pending) { |
1441 | #if 0 | ||
1442 | struct extent_buffer *buf; | 1441 | struct extent_buffer *buf; |
1443 | buf = btrfs_find_tree_block(root, bytenr, num_bytes); | 1442 | buf = btrfs_find_tree_block(root, bytenr, num_bytes); |
1444 | if (buf) { | 1443 | if (buf) { |
@@ -1460,7 +1459,6 @@ static int pin_down_bytes(struct btrfs_root *root, u64 bytenr, u32 num_bytes, | |||
1460 | } | 1459 | } |
1461 | free_extent_buffer(buf); | 1460 | free_extent_buffer(buf); |
1462 | } | 1461 | } |
1463 | #endif | ||
1464 | update_pinned_extents(root, bytenr, num_bytes, 1); | 1462 | update_pinned_extents(root, bytenr, num_bytes, 1); |
1465 | } else { | 1463 | } else { |
1466 | set_extent_bits(&root->fs_info->pending_del, | 1464 | set_extent_bits(&root->fs_info->pending_del, |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index bd15cdcaba95..40a5f53cb040 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -2808,10 +2808,15 @@ struct extent_buffer *find_extent_buffer(struct extent_io_tree *tree, | |||
2808 | goto lru_add; | 2808 | goto lru_add; |
2809 | 2809 | ||
2810 | for (i = 0; i < num_pages; i++, index++) { | 2810 | for (i = 0; i < num_pages; i++, index++) { |
2811 | p = find_lock_page(mapping, index); | 2811 | p = find_get_page(mapping, index); |
2812 | if (!p) { | 2812 | if (!p) { |
2813 | goto fail; | 2813 | goto fail; |
2814 | } | 2814 | } |
2815 | if (TestSetPageLocked(p)) { | ||
2816 | page_cache_release(p); | ||
2817 | goto fail; | ||
2818 | } | ||
2819 | |||
2815 | set_page_extent_mapped(p); | 2820 | set_page_extent_mapped(p); |
2816 | mark_page_accessed(p); | 2821 | mark_page_accessed(p); |
2817 | 2822 | ||