Read a set of pages from storage. The portion will normally be the same
size as was written, but may be smaller if suspending is being aborted or
the user suspended to ram instead of powering off.
Signed-off-by: Nigel Cunningham <[email protected]>
kernel/power/io.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/kernel/power/io.c b/kernel/power/io.c
index fd20324..dade1fc 100644
--- a/kernel/power/io.c
+++ b/kernel/power/io.c
@@ -364,3 +364,60 @@ int write_pageset(struct pagedir *pagedi
return error;
}
+/* read_pageset()
+ *
+ * Description: Read a pageset from disk.
+ * Arguments: pagedir: Pointer to the pagedir to be saved.
+ * whichtowrite: Controls what debugging output is printed.
+ * overwrittenpagesonly: Whether to read the whole pageset or
+ * only part.
+ * Returns: Zero on success or -1 on failure.
+ */
+
+static int read_pageset(struct pagedir *pagedir, int whichtoread,
+ int overwrittenpagesonly)
+{
+ int result = 0, base = 0, start_time, end_time;
+ int finish_at = pagedir->pageset_size;
+ int barmax = pagedir1.pageset_size + pagedir2.pageset_size;
+ dyn_pageflags_t *pageflags;
+
+ if (whichtoread == 1) {
+ suspend_prepare_status(CLEAR_BAR,
+ "Reading kernel & process data...");
+ pageflags = &pageset1_copy_map;
+ } else {
+ suspend_prepare_status(DONT_CLEAR_BAR, "Reading caches...");
+ if (overwrittenpagesonly)
+ barmax = finish_at = min(pagedir1.pageset_size,
+ pagedir2.pageset_size);
+ else {
+ base = pagedir1.pageset_size;
+ }
+ pageflags = &pageset2_map;
+ }
+
+ start_time = jiffies;
+
+ if (rw_init_modules(0, whichtoread)) {
+ suspend_active_writer->invalidate_image();
+ result = 1;
+ } else
+ result = do_rw_loop(0, finish_at, pageflags, base, barmax);
+
+ if (rw_cleanup_modules(READ)) {
+ abort_suspend("Failed to cleanup after reading.");
+ result = 1;
+ }
+
+ /* Statistics */
+ end_time=jiffies;
+
+ if ((end_time - start_time) && (!test_result_state(SUSPEND_ABORTED))) {
+ suspend_io_time[1][0] += finish_at,
+ suspend_io_time[1][1] += (end_time - start_time);
+ }
+
+ return result;
+}
+
--
Nigel Cunningham nigel at suspend2 dot net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]