]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
writeback: fix break condition
authorFederico Cuello <fedux@lugmen.org.ar>
Wed, 11 Feb 2009 21:04:39 +0000 (13:04 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Feb 2009 22:25:37 +0000 (14:25 -0800)
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>
mm/page-writeback.c

index c17005e73974f780143b5ea8e7f353b37b1a75cb..6106a5c7ed44d0f8f134a32d4e21834835e7f4c3 100644 (file)
@@ -1051,20 +1051,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)) {