Gitweb:
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=45726cb43d11b288c58243a26010f397054222f0
Commit: 45726cb43d11b288c58243a26010f397054222f0
Parent: 001281881067a5998384c6669bc8dbbbab8456c4
Author: Nick Piggin <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 16 01:24:41 2007 -0700
Committer: Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Oct 16 09:42:53 2007 -0700
mm: improve find_lock_page
find_lock_page does not need to recheck ->index because if the page is in
the
right mapping then the index must be the same. Also, tree_lock does not
need
to be retaken after the page is locked in order to test that ->mapping has
not
changed, because holding the page lock pins its mapping.
Signed-off-by: Nick Piggin <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
mm/filemap.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/mm/filemap.c b/mm/filemap.c
index b436cbb..7989c44 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -621,26 +621,27 @@ struct page *find_lock_page(struct address_space *mapping,
{
struct page *page;
- read_lock_irq(&mapping->tree_lock);
repeat:
+ read_lock_irq(&mapping->tree_lock);
page = radix_tree_lookup(&mapping->page_tree, offset);
if (page) {
page_cache_get(page);
if (TestSetPageLocked(page)) {
read_unlock_irq(&mapping->tree_lock);
__lock_page(page);
- read_lock_irq(&mapping->tree_lock);
/* Has the page been truncated while we slept? */
- if (unlikely(page->mapping != mapping ||
- page->index != offset)) {
+ if (unlikely(page->mapping != mapping)) {
unlock_page(page);
page_cache_release(page);
goto repeat;
}
+ VM_BUG_ON(page->index != offset);
+ goto out;
}
}
read_unlock_irq(&mapping->tree_lock);
+out:
return page;
}
EXPORT_SYMBOL(find_lock_page);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html