Adding the --perist option which is specified with --add-ramdisk-swap
or --add-temp-swap, to make the swap space created, permanent after the
pool resize is completed.

Signed-off-by: Avantika Mathur <mat...@us.ibm.com>
---
Index: libhugetlbfs/hugeadm.c
===================================================================
--- libhugetlbfs.orig/hugeadm.c	2009-06-29 01:57:01.000000000 -0700
+++ libhugetlbfs/hugeadm.c	2009-06-29 02:06:23.000000000 -0700
@@ -93,6 +93,8 @@
 	CONT("size is 5 huge pages. Optional arg sets size to 'count' huge pages");
 	OPTION("--add-ramdisk-swap", "Specified with --pool-pages-min to create");
 	CONT("swap space on ramdisks. By default, swap is removed after the resize.");
+	OPTION("--persist", "Specified with --add-temp-swap or --add-ramdisk-swap");
+	CONT("options to make swap space persist after the resize.");
 	OPTION("--enable-zone-movable", "Use ZONE_MOVABLE for huge pages");
 	OPTION("--disable-zone-movable", "Do not use ZONE_MOVABLE for huge pages");
 	OPTION("--create-mounts", "Creates a mount point for each available");
@@ -129,6 +131,7 @@
 int opt_movable = -1;
 int opt_temp_swap = 0;
 int opt_ramdisk_swap = 0;
+int opt_swap_persist = 0;
 int verbose_level = VERBOSITY_DEFAULT;
 
 void setup_environment(char *var, char *val)
@@ -212,6 +215,7 @@
 #define LONG_SWAP		('s' << 8)
 #define LONG_SWAP_DISK		(LONG_SWAP|'d')
 #define LONG_SWAP_RAMDISK	(LONG_SWAP|'r')
+#define LONG_SWAP_PERSIST	(LONG_SWAP|'p')
 
 #define LONG_PAGE	('P' << 8)
 #define LONG_PAGE_SIZES	(LONG_PAGE|'s')
@@ -895,7 +899,7 @@
 		get_pool_size(page_size, &pools[pos]);
 	}
 
-	if (min > min_orig) {
+	if (min > min_orig && !opt_swap_persist) {
 		if (opt_temp_swap)
 			rem_temp_swap();
 		else if (opt_ramdisk_swap)
@@ -976,6 +980,7 @@
 		{"hard", no_argument, NULL, LONG_HARD},
 		{"add-temp-swap", optional_argument, NULL, LONG_SWAP_DISK},
 		{"add-ramdisk-swap", no_argument, NULL, LONG_SWAP_RAMDISK},
+		{"persist", no_argument, NULL, LONG_SWAP_PERSIST},
 		{"create-mounts", no_argument, NULL, LONG_CREATE_MOUNTS},
 		{"create-user-mounts", required_argument, NULL, LONG_CREATE_USER_MOUNTS},
 		{"create-group-mounts", required_argument, NULL, LONG_CREATE_GROUP_MOUNTS},
@@ -1042,6 +1047,9 @@
 			opt_ramdisk_swap = 1;
 			break;
 
+		case LONG_SWAP_PERSIST:
+			opt_swap_persist = 1;
+
 		case LONG_LIST_ALL_MOUNTS:
 			opt_list_mounts = 1;
 			break;
Index: libhugetlbfs/man/hugeadm.8
===================================================================
--- libhugetlbfs.orig/man/hugeadm.8	2009-06-29 02:07:04.000000000 -0700
+++ libhugetlbfs/man/hugeadm.8	2009-06-29 02:10:35.000000000 -0700
@@ -171,6 +171,13 @@
 Swap is only created for a positive resize, and by default is removed once
 the resize operation is completed.
 
+.TP
+.B --persist
+
+This option is specified with the --add-temp-swap or --add-ramdisk-swap to
+make the swap space persist after the resize operation is completed.  The swap
+spaces can later be removed manually using the swapoff command.
+
 .PP
 The following options affect the verbosity of libhugetlbfs.
 
------------------------------------------------------------------------------
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to