[Suspend2][ 12/20] [Suspend2] Recalculate image contents.

Nigel Cunningham
2006-06-26T23:29:21Z

Calculate anew which pages should be saved, and which pageset they should
belong to.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

kernel/power/prepare_image.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/kernel/power/prepare_image.c b/kernel/power/prepare_image.c
index c85ce6b..6b3f2c9 100644
--- a/kernel/power/prepare_image.c
+++ b/kernel/power/prepare_image.c
@@ -362,3 +362,35 @@ static int amount_needed(int use_image_s
return max1;
}

+/* suspend_recalculate_image_contents
+ *
+ * Eaten is the number of pages which have been eaten.
+ * Pagedirincluded is the number of pages which have been allocated for the pagedir.
+ */
+void suspend_recalculate_image_contents(int atomic_copy)
+{
+ struct pageset_sizes_result result;
+
+ clear_dyn_pageflags(pageset1_map);
+ if (!atomic_copy) {
+ int pfn;
+ BITMAP_FOR_EACH_SET(pageset2_map, pfn)
+ ClearPagePageset1Copy(pfn_to_page(pfn));
+ /* Need to call this before getting pageset1_size! */
+ suspend_mark_pages_for_pageset2();
+ }
+ BUG_ON(in_atomic() && !irqs_disabled());
+ result = count_data_pages();
+ pageset1_sizelow = result.size1low;
+ pageset2_sizelow = result.size2low;
+ pagedir1.lastpageset_size = pagedir1.pageset_size = result.size1;
+ pagedir2.lastpageset_size = pagedir2.pageset_size = result.size2;
+
+ if (!atomic_copy) {
+ storage_available = suspend_active_writer->storage_available();
+ display_stats(1, 0);
+ }
+ BUG_ON(in_atomic() && !irqs_disabled());
+ return;