aboutsummaryrefslogtreecommitdiff
path: root/fs/buffer.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2005-05-05 16:15:47 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-05 16:36:41 -0700
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 bc75f2e7b27..6f2c3303a44 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,
}
if (test_clear_buffer_dirty(bh)) {
mark_buffer_async_write(bh);
- get_bh(bh);
last_bh = bh;
} else {
unlock_buffer(bh);
@@ -1839,20 +1838,19 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
*/
BUG_ON(PageWriteback(page));
set_page_writeback(page);
- unlock_page(page);
do {
struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) {
submit_bh(WRITE, bh);
nr_underway++;
- put_bh(bh);
if (bh == last_bh)
break;
}
bh = next;
} while (bh != head);
bh = head;
+ unlock_page(page);
err = 0;
done:
@@ -1894,7 +1892,6 @@ recover:
if (buffer_mapped(bh) && buffer_dirty(bh)) {
lock_buffer(bh);
mark_buffer_async_write(bh);
- get_bh(bh);
last_bh = bh;
} else {
/*
@@ -1914,7 +1911,6 @@ recover:
clear_buffer_dirty(bh);
submit_bh(WRITE, bh);
nr_underway++;
- put_bh(bh);
if (bh == last_bh)
break;
}