lkml.org 
[lkml]   [2010]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 04/22] Hibernation: Add mass swap allocation routine
Date
Add a routine to allocate swap from a device en masse. This is only
for use by the in-kernel implementation, not uswsusp.

Signed-off-by: Nigel Cunningham <nigel@tuxonice.net>
---
kernel/power/swap.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 587f851..cebf91c 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -188,6 +188,19 @@ sector_t alloc_swapdev_block(int swap)
return 0;
}

+int alloc_swapdev_blocks(int needed)
+{
+ int i;
+
+ for (i = 0; i < needed; i++) {
+ sector_t res = alloc_swapdev_block(root_swap);
+ if (!res)
+ break;
+ }
+
+ return i;
+}
+
/**
* free_all_swap_pages - free swap pages allocated for saving image data.
* It also frees the extents used to register which swap entries had been
--
1.7.0.4


\
 
 \ /
  Last update: 2010-09-27 20:09    [W:0.191 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site