[Suspend2][ 05/20] [Suspend2] Get the amount of storage needed for the image proper.

From: Nigel Cunningham
Date: Mon Jun 26 2006 - 18:34:30 EST


Calculate the amount of storage required for the image proper, possibly
taking into account the expected compression ratio and possibly also
ignoring the extra pagedir1 allowance.

Signed-off-by: Nigel Cunningham <nigel@xxxxxxxxxxxx>

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

diff --git a/kernel/power/prepare_image.c b/kernel/power/prepare_image.c
index 271f904..9f1eb74 100644
--- a/kernel/power/prepare_image.c
+++ b/kernel/power/prepare_image.c
@@ -107,3 +107,16 @@ static void get_extra_pd1_allowance(void
MIN_EXTRA_PAGES_ALLOWANCE);
}

+/*
+ * Amount of storage needed, possibly taking into account the
+ * expected compression ratio and possibly also ignoring our
+ * allowance for extra pages.
+ */
+static long main_storage_needed(int use_ecr,
+ int ignore_extra_pd1_allow)
+{
+ return ((pagedir1.pageset_size + pagedir2.pageset_size +
+ (ignore_extra_pd1_allow ? 0 : extra_pd1_pages_allowance)) *
+ (use_ecr ? suspend_expected_compression_ratio() : 100) / 100);
+}
+

--
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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/