* [PATCH 3/5] Hibernation: Add mass swap allocation routine.
@ 2010-05-26 7:10 Nigel Cunningham
0 siblings, 0 replies; only message in thread
From: Nigel Cunningham @ 2010-05-26 7:10 UTC (permalink / raw)
To: Rafael J. Wysocki, pm list, LKML, TuxOnIce-devel
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 e555b6c..550c1ed 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -187,6 +187,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 entres had been
--
1.7.0.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-05-26 7:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-26 7:10 [PATCH 3/5] Hibernation: Add mass swap allocation routine Nigel Cunningham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox