Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

writeback: fix break condition

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>

authored by

Federico Cuello and committed by
Linus Torvalds
89e12190 6c597963

+16 -13
+16 -13
mm/page-writeback.c
··· 1051 1051 } 1052 1052 } 1053 1053 1054 - if (nr_to_write > 0) 1054 + if (nr_to_write > 0) { 1055 1055 nr_to_write--; 1056 - else if (wbc->sync_mode == WB_SYNC_NONE) { 1057 - /* 1058 - * We stop writing back only if we are not 1059 - * doing integrity sync. In case of integrity 1060 - * sync we have to keep going because someone 1061 - * may be concurrently dirtying pages, and we 1062 - * might have synced a lot of newly appeared 1063 - * dirty pages, but have not synced all of the 1064 - * old dirty pages. 1065 - */ 1066 - done = 1; 1067 - break; 1056 + if (nr_to_write == 0 && 1057 + wbc->sync_mode == WB_SYNC_NONE) { 1058 + /* 1059 + * We stop writing back only if we are 1060 + * not doing integrity sync. In case of 1061 + * integrity sync we have to keep going 1062 + * because someone may be concurrently 1063 + * dirtying pages, and we might have 1064 + * synced a lot of newly appeared dirty 1065 + * pages, but have not synced all of the 1066 + * old dirty pages. 1067 + */ 1068 + done = 1; 1069 + break; 1070 + } 1068 1071 } 1069 1072 1070 1073 if (wbc->nonblocking && bdi_write_congested(bdi)) {