Commit a1aed524 authored by Christoph Hellwig's avatar Christoph Hellwig

[XFS] use find_trylock_page in the I/O code

SGI Modid: 2.5.x-xfs:slinx:133725a
parent a508db13
...@@ -135,17 +135,14 @@ probe_unmapped_page( ...@@ -135,17 +135,14 @@ probe_unmapped_page(
struct page *page; struct page *page;
int ret = 0; int ret = 0;
page = find_get_page(mapping, index); page = find_trylock_page(mapping, index);
if (!page) if (!page)
return 0; return 0;
if (PageWriteback(page) || TestSetPageLocked(page)) { if (PageWriteback(page))
page_cache_release(page); goto out;
return 0;
}
if (page->mapping && PageDirty(page)) { if (page->mapping && PageDirty(page)) {
if (!page_has_buffers(page)) { if (page_has_buffers(page)) {
ret = PAGE_CACHE_SIZE;
} else {
struct buffer_head *bh, *head; struct buffer_head *bh, *head;
bh = head = page_buffers(page); bh = head = page_buffers(page);
do { do {
...@@ -156,11 +153,12 @@ probe_unmapped_page( ...@@ -156,11 +153,12 @@ probe_unmapped_page(
if (ret >= pg_offset) if (ret >= pg_offset)
break; break;
} while ((bh = bh->b_this_page) != head); } while ((bh = bh->b_this_page) != head);
} } else
ret = PAGE_CACHE_SIZE;
} }
out:
unlock_page(page); unlock_page(page);
page_cache_release(page);
return ret; return ret;
} }
...@@ -214,13 +212,12 @@ probe_page( ...@@ -214,13 +212,12 @@ probe_page(
{ {
struct page *page; struct page *page;
page = find_get_page(inode->i_mapping, index); page = find_trylock_page(inode->i_mapping, index);
if (!page) if (!page)
return NULL; return NULL;
if (PageWriteback(page) || TestSetPageLocked(page)) { if (PageWriteback(page))
page_cache_release(page); goto out;
return NULL;
}
if (page->mapping && page_has_buffers(page)) { if (page->mapping && page_has_buffers(page)) {
struct buffer_head *bh, *head; struct buffer_head *bh, *head;
...@@ -230,8 +227,9 @@ probe_page( ...@@ -230,8 +227,9 @@ probe_page(
return page; return page;
} while ((bh = bh->b_this_page) != head); } while ((bh = bh->b_this_page) != head);
} }
out:
unlock_page(page); unlock_page(page);
page_cache_release(page);
return NULL; return NULL;
} }
...@@ -319,8 +317,6 @@ convert_page( ...@@ -319,8 +317,6 @@ convert_page(
} else { } else {
unlock_page(page); unlock_page(page);
} }
page_cache_release(page);
} }
/* /*
......
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