Skip to contentSkip to conversation

Hibernation: Add mass swap allocation routine.

PATCH In review Nigel Cunningham 1 participant 1 message May 26, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/5 Hibernation: Add mass swap allocation routine.

Add a routine to allocate swap from a device en masse. This is only for use by the in-kernel implementation, not uswsusp.

---
 kernel/power/swap.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
kernel/power/swap.c +13 -0
index e555b6c..550c1ed 100644
@@ -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
Signature · 1 line
1.7.0.4