summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorFederico Cuello <fedux@lugmen.org.ar>2009-02-11 13:04:39 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2009-02-17 09:28:50 -0800
commit65fb1622e4714a7fdb3cbef2607660664e765586 (patch)
tree6275b85b67f733dae6acfc2c0f61c152c22b3a83 /mm
parent66c85494570396661479ba51e17964b2c82b6f39 (diff)
writeback: fix break condition
commit 89e1219004b3657cc014521663eeef0744f1c99d upstream. Commit dcf6a79dda5cc2a2bec183e50d829030c0972aaa ("write-back: fix nr_to_write counter") fixed nr_to_write counter, but didn't set the break condition properly. If nr_to_write == 0 after being decremented it will loop one more time before setting done = 1 and breaking the loop. [akpm@linux-foundation.org: coding-style fixes] Cc: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Acked-by: Nick Piggin <npiggin@suse.de> 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.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 0c4100e1f177..5270591a2958 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -981,20 +981,23 @@ continue_unlock:
}
}
- if (nr_to_write > 0)
+ if (nr_to_write > 0) {
nr_to_write--;
- else if (wbc->sync_mode == WB_SYNC_NONE) {
- /*
- * We stop writing back only if we are not
- * doing integrity sync. In case of integrity
- * sync we have to keep going because someone
- * may be concurrently dirtying pages, and we
- * might have synced a lot of newly appeared
- * dirty pages, but have not synced all of the
- * old dirty pages.
- */
- done = 1;
- break;
+ if (nr_to_write == 0 &&
+ wbc->sync_mode == WB_SYNC_NONE) {
+ /*
+ * We stop writing back only if we are
+ * not doing integrity sync. In case of
+ * integrity sync we have to keep going
+ * because someone may be concurrently
+ * dirtying pages, and we might have
+ * synced a lot of newly appeared dirty
+ * pages, but have not synced all of the
+ * old dirty pages.
+ */
+ done = 1;
+ break;
+ }
}
if (wbc->nonblocking && bdi_write_congested(bdi)) {