aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/extent_io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-06-25 16:01:31 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:03 -0400
commit079899c2384023cd8efcd3806680b4f1d2abbd54 (patch)
treed5d6d44f92b600f2fd3e5066bdcd5812e58cbf14 /fs/btrfs/extent_io.c
parente7a84565bcdb239caad29ccbe559ef978090ac7e (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>
Diffstat (limited to 'fs/btrfs/extent_io.c')
-rw-r--r--fs/btrfs/extent_io.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index bd15cdcaba9..40a5f53cb04 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,
goto lru_add;
for (i = 0; i < num_pages; i++, index++) {
- p = find_lock_page(mapping, index);
+ p = find_get_page(mapping, index);
if (!p) {
goto fail;
}
+ if (TestSetPageLocked(p)) {
+ page_cache_release(p);
+ goto fail;
+ }
+
set_page_extent_mapped(p);
mark_page_accessed(p);