Suspend 2 merge: 15/51: Disable pdflush during suspend.

Nigel Cunningham
2004-11-24T14:03:46Z

Here we disable pdflush once we've finished syncing data to disk. We
might be writing to a swap file, and don't want to corrupt the user's
disk by writing invalid data to their superblock.

diff -ruN 504-disable-pdflush-during-suspend-old/mm/page-writeback.c 504-disable-pdflush-during-suspend-new/mm/page-writeback.c
--- 504-disable-pdflush-during-suspend-old/mm/page-writeback.c 2004-11-03 21:54:16.000000000 +1100
+++ 504-disable-pdflush-during-suspend-new/mm/page-writeback.c 2004-11-04 16:27:40.000000000 +1100
@@ -29,6 +29,7 @@
#include <linux/sysctl.h>
#include <linux/cpu.h>
#include <linux/syscalls.h>
+#include <linux/suspend.h>

/*
* The maximum number of pages to writeout in a single bdflush/kupdate
@@ -369,6 +370,12 @@
.for_kupdate = 1,
};

+ if (test_suspend_state(SUSPEND_DISABLE_SYNCING)) {
+ start_jif = jiffies;
+ next_jif = start_jif + (dirty_writeback_centisecs * HZ) / 100;
+ goto out;
+ }
+
sync_supers();

get_writeback_state(&wbs);
@@ -389,6 +396,8 @@
}
nr_to_write -= MAX_WRITEBACK_PAGES - wbc.nr_to_write;
}
+
+out:
if (time_before(next_jif, jiffies + HZ))
next_jif = jiffies + HZ;
if (dirty_writeback_centisecs)