lkml.org 
[lkml]   [2006]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[Suspend2][ 15/35] [Suspend2] Allocate filewriter storage.
Date
Allocate storage for the body of the image, preserving any existing
allocation for the header. This routine will never shrink the amount
allocated.

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

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

diff --git a/kernel/power/suspend_file.c b/kernel/power/suspend_file.c
index 6b04eb5..cdc0261 100644
--- a/kernel/power/suspend_file.c
+++ b/kernel/power/suspend_file.c
@@ -448,3 +448,35 @@ static int filewriter_allocate_header_sp
return 0;
}

+static int filewriter_allocate_storage(int space_requested)
+{
+ int result = 0, prev_header_pages;
+ int blocks_to_get = (space_requested << devinfo.bmap_shift) -
+ block_chain.size;
+
+ /* Only release_storage reduces the size */
+ if (blocks_to_get < 1)
+ return 0;
+
+ main_pages = space_requested;
+
+ populate_block_list();
+
+ suspend_message(SUSPEND_WRITER, SUSPEND_MEDIUM, 0,
+ "Finished with block_chain.size == %d.\n",
+ block_chain.size);
+
+ if (block_chain.size < (header_pages + main_pages)) {
+ printk("Block chain size (%d) < header pages (%d) + main pages (%d) (=%d).\n",
+ block_chain.size,
+ header_pages, main_pages,
+ header_pages + main_pages);
+ result = -ENOSPC;
+ }
+
+ prev_header_pages = header_pages;
+ header_pages = 0;
+ filewriter_allocate_header_space(prev_header_pages);
+ 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-27 01:06    [W:0.157 / U:4.760 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site