Allocate space in the allocated storage for the header of the image.
Signed-off-by: Nigel Cunningham <[email protected]>
kernel/power/suspend_swap.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/kernel/power/suspend_swap.c b/kernel/power/suspend_swap.c
index 7f16bea..8e4221d 100644
--- a/kernel/power/suspend_swap.c
+++ b/kernel/power/suspend_swap.c
@@ -329,3 +329,34 @@ static int prepare_signature(dev_t bdev,
return 0;
}
+static int swapwriter_allocate_storage(int space_requested);
+
+static int swapwriter_allocate_header_space(int space_requested)
+{
+ int i;
+
+ if (!swapextents.size)
+ swapwriter_allocate_storage(space_requested);
+
+ suspend_extent_state_goto_start(&suspend_writer_posn);
+ suspend_bio_ops.forward_one_page(); /* To first page */
+
+ for (i = 0; i < space_requested; i++) {
+ if (suspend_bio_ops.forward_one_page()) {
+ printk("Out of space while seeking to allocate "
+ "header pages,\n");
+ header_pages_allocated = i;
+ return -ENOSPC;
+ }
+
+ }
+
+ header_pages_allocated = space_requested;
+
+ /* The end of header pages will be the start of pageset 2;
+ * we are now sitting on the first pageset2 page. */
+ suspend_extent_state_save(&suspend_writer_posn,
+ &suspend_writer_posn_save[2]);
+ return 0;
+}
+
--
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]