From 30294a2fe894bc1a3c71faf29e54f52dcbffc67e Mon Sep 17 00:00:00 2001 From: Matthias Koenig Date: Wed, 18 Jul 2007 16:15:45 +0200 Subject: [PATCH] mkswap: default to V1 in any case mkswap(8) enforces to use v0 swap format when pagesize > 16kB. (use case might be ppc64 with CONFIG_PPC_64K_PAGES). As version 0 swap is not supported anymore by recent kernels, the behaviour in this case is rather strange. Here is a testcase: for i in 4 8 16 32 64; do mkswap -p `expr $i \* 1024` ./swap.file; done Setting up swapspace version 1, size = 4294963 kB Using user-specified page size 8192, instead of the system values 4096/4096 Setting up swapspace version 1, size = 4294959 kB Using user-specified page size 16384, instead of the system values 4096/4096 Setting up swapspace version 1, size = 4294950 kB Using user-specified page size 32768, instead of the system values 4096/4096 Setting up swapspace version 0, size = 4294934 kB Using user-specified page size 65536, instead of the system values 4096/4096 Setting up swapspace version 0, size = 4294901 kB Signed-off-by: Matthias Koenig Signed-off-by: Karel Zak --- disk-utils/mkswap.8 | 2 ++ disk-utils/mkswap.c | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/disk-utils/mkswap.8 b/disk-utils/mkswap.8 index 539d6489..f4661c24 100644 --- a/disk-utils/mkswap.8 +++ b/disk-utils/mkswap.8 @@ -154,6 +154,8 @@ preferable, in case you have a boot loader or disk label there. If you need to use both 2.0 and 2.2 kernels, use the \-v0 option when creating the swapspace. +Version 0 (-v0) swap space format is no longer supported in 2.5+ kernels. + .SH "SEE ALSO" .BR fdisk (8), .BR swapon (8) diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index 8cafd8f6..fdd3e0d7 100644 --- a/disk-utils/mkswap.c +++ b/disk-utils/mkswap.c @@ -617,9 +617,7 @@ main(int argc, char ** argv) { version = 1; else /* use version 1 as default, if possible */ - if (PAGES <= V0_MAX_PAGES && PAGES > V1_MAX_PAGES) - version = 0; - else if (linux_version_code() < MAKE_VERSION(2,1,117)) + if (linux_version_code() < MAKE_VERSION(2,1,117)) version = 0; else if (pagesize < 2048) version = 0; -- 2.39.5