aboutsummaryrefslogtreecommitdiffstats
path: root/fs/buffer.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2005-05-05 19:15:47 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-05 19:36:41 -0400
commit05937baae9fc27b64bcd4378da7d2b14edf7931c (patch)
tree415bec7602a12a94ae4bc9b1aa512a1d55bb957d /fs/buffer.c
parentad576e63e0c8b274a8558b8e05a6d0526e804dc0 (diff)
[PATCH] __block_write_full_page speedup
Remove all those get_bh()'s and put_bh()'s by extending lock_page() to cover the troublesome regions. (get_bh() and put_bh() happen every time whereas contention on a page's lock in there happens basically never). Cc: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/buffer.c')
-rw-r--r--fs/buffer.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index bc75f2e7b274..6f2c3303a443 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1826,7 +1826,6 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
1826 } 1826 }
1827 if (test_clear_buffer_dirty(bh)) { 1827 if (test_clear_buffer_dirty(bh)) {
1828 mark_buffer_async_write(bh); 1828 mark_buffer_async_write(bh);
1829 get_bh(bh);
1830 last_bh = bh; 1829 last_bh = bh;
1831 } else { 1830 } else {
1832 unlock_buffer(bh); 1831 unlock_buffer(bh);
@@ -1839,20 +1838,19 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
1839 */ 1838 */
1840 BUG_ON(PageWriteback(page)); 1839 BUG_ON(PageWriteback(page));
1841 set_page_writeback(page); 1840 set_page_writeback(page);
1842 unlock_page(page);
1843 1841
1844 do { 1842 do {
1845 struct buffer_head *next = bh->b_this_page; 1843 struct buffer_head *next = bh->b_this_page;
1846 if (buffer_async_write(bh)) { 1844 if (buffer_async_write(bh)) {
1847 submit_bh(WRITE, bh); 1845 submit_bh(WRITE, bh);
1848 nr_underway++; 1846 nr_underway++;
1849 put_bh(bh);
1850 if (bh == last_bh) 1847 if (bh == last_bh)
1851 break; 1848 break;
1852 } 1849 }
1853 bh = next; 1850 bh = next;
1854 } while (bh != head); 1851 } while (bh != head);
1855 bh = head; 1852 bh = head;
1853 unlock_page(page);
1856 1854
1857 err = 0; 1855 err = 0;
1858done: 1856done:
@@ -1894,7 +1892,6 @@ recover:
1894 if (buffer_mapped(bh) && buffer_dirty(bh)) { 1892 if (buffer_mapped(bh) && buffer_dirty(bh)) {
1895 lock_buffer(bh); 1893 lock_buffer(bh);
1896 mark_buffer_async_write(bh); 1894 mark_buffer_async_write(bh);
1897 get_bh(bh);
1898 last_bh = bh; 1895 last_bh = bh;
1899 } else { 1896 } else {
1900 /* 1897 /*
@@ -1914,7 +1911,6 @@ recover:
1914 clear_buffer_dirty(bh); 1911 clear_buffer_dirty(bh);
1915 submit_bh(WRITE, bh); 1912 submit_bh(WRITE, bh);
1916 nr_underway++; 1913 nr_underway++;
1917 put_bh(bh);
1918 if (bh == last_bh) 1914 if (bh == last_bh)
1919 break; 1915 break;
1920 } 1916 }