summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2009-01-06 14:39:10 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-24 16:36:27 -0800
commit65cdf4090b2a70726bed638e7c41bb3f952d0076 (patch)
treeee3a581f4c299ef009bb456731260566b339ee66 /mm
parentcb0083692dfdd1a33b538b093f5e35b3802b41ef (diff)
mm: write_cache_pages optimise page cleaning
commit 515f4a037fb9ab736f8bad733fcd2ffd350cf265 upstream. In write_cache_pages, if we get stuck behind another process that is cleaning pages, we will be forced to wait for them to finish, then perform our own writeout (if it was redirtied during the long wait), then wait for that. If a page under writeout is still clean, we can skip waiting for it (if we're part of a data integrity sync, we'll be waiting for all writeout pages afterwards, so we'll still be waiting for the other guy's write that's cleaned the page). Signed-off-by: Nick Piggin <npiggin@suse.de> Cc: Chris Mason <chris.mason@oracle.com> Cc: Dave Chinner <david@fromorbit.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'mm')
-rw-r--r--mm/page-writeback.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 5b3f4c9cffe3..d69548daf3b2 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -948,11 +948,20 @@ continue_unlock:
goto continue_unlock;
}
- if (wbc->sync_mode != WB_SYNC_NONE)
- wait_on_page_writeback(page);
+ if (!PageDirty(page)) {
+ /* someone wrote it for us */
+ goto continue_unlock;
+ }
+
+ if (PageWriteback(page)) {
+ if (wbc->sync_mode != WB_SYNC_NONE)
+ wait_on_page_writeback(page);
+ else
+ goto continue_unlock;
+ }
- if (PageWriteback(page) ||
- !clear_page_dirty_for_io(page))
+ BUG_ON(PageWriteback(page));
+ if (!clear_page_dirty_for_io(page))
goto continue_unlock;
ret = (*writepage)(page, wbc, data);