aboutsummaryrefslogtreecommitdiff
path: root/mm/readahead.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2007-10-16 01:24:40 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 09:42:53 -0700
commit001281881067a5998384c6669bc8dbbbab8456c4 (patch)
tree6229d16c737782a36795354b218c74d4d2749752 /mm/readahead.c
parent557ed1fa2620dc119adb86b34c614e152a629a80 (diff)
mm: use lockless radix-tree probe
Probing pages and radix_tree_tagged are lockless operations with the lockless radix-tree. Convert these users to RCU locking rather than using tree_lock. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/readahead.c')
-rw-r--r--mm/readahead.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/readahead.c b/mm/readahead.c
index fc52f9f1b80..c5c8981469e 100644
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@ -149,20 +149,19 @@ __do_page_cache_readahead(struct address_space *mapping, struct file *filp,
/*
* Preallocate as many pages as we will need.
*/
- read_lock_irq(&mapping->tree_lock);
for (page_idx = 0; page_idx < nr_to_read; page_idx++) {
pgoff_t page_offset = offset + page_idx;
if (page_offset > end_index)
break;
+ rcu_read_lock();
page = radix_tree_lookup(&mapping->page_tree, page_offset);
+ rcu_read_unlock();
if (page)
continue;
- read_unlock_irq(&mapping->tree_lock);
page = page_cache_alloc_cold(mapping);
- read_lock_irq(&mapping->tree_lock);
if (!page)
break;
page->index = page_offset;
@@ -171,7 +170,6 @@ __do_page_cache_readahead(struct address_space *mapping, struct file *filp,
SetPageReadahead(page);
ret++;
}
- read_unlock_irq(&mapping->tree_lock);
/*
* Now start the IO. We ignore I/O errors - if the page is not