[Suspend2][ 21/28] [Suspend2] Get swapwriter image storage needed.



Return the amount of space in the image header needed for swapwriter
configuration info.

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

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

diff --git a/kernel/power/suspend_swap.c b/kernel/power/suspend_swap.c
index 3589b63..ba6ed75 100644
--- a/kernel/power/suspend_swap.c
+++ b/kernel/power/suspend_swap.c
@@ -847,3 +847,28 @@ static int swapwriter_print_debug_stats(
return len;
}

+/*
+ * Storage needed
+ *
+ * Returns amount of space in the swap header required
+ * for the swapwriter's data. This ignores the links between
+ * pages, which we factor in when allocating the space.
+ *
+ * We ensure the space is allocated, but actually save the
+ * data from write_header_init and therefore don't also define a
+ * save_config_info routine.
+ */
+static unsigned long swapwriter_storage_needed(void)
+{
+ int i, result;
+ result = sizeof(suspend_writer_posn_save) + sizeof(devinfo);
+
+ for (i = 0; i < MAX_SWAPFILES; i++) {
+ result += 3 * sizeof(int);
+ result += (2 * sizeof(unsigned long) *
+ (block_chain[i].allocs - block_chain[i].frees));
+ }
+
+ 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: Allocating costs across a period of time
    ... The following allocates the amount to each month on the basis of the days in the month and a rate per day determined by dividing the amount to be allocated by the total number of days: ... Dim Date1 As Date, Date2 As Date ... Dim StartMonthDays As Long, EndMonthDays As Long ... >I am writing a procedure that involves allocating a series of costs over>a ...
    (microsoft.public.word.vba.general)
  • Re: Conditional MDX Staement
    ... aggregation of the 2 measures. ... This would mean allocating the amount for ... measure1 to all descendants of prduct.level1 and allocating the amount for ...
    (microsoft.public.sqlserver.olap)
  • Re: Finding Restore Point
    ... >>But in practice the amount of allocated space does directly impact how far ... SR checkpoints can be different sizes - therefore you ... Allocating a certain ... > amount of disk space to SR will allow X number of checkpoints - not how far ...
    (microsoft.public.windowsxp.general)
  • Re: U Area Removal
    ... the amount of data we have stored in each process' U ... > I propose to remove the ability to swap the U area, allocating p_stats ...
    (freebsd-arch)