summaryrefslogtreecommitdiffstats
path: root/sbin/swapon
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2016-11-19 20:02:49 +0000
committerjilles <jilles@FreeBSD.org>2016-11-19 20:02:49 +0000
commit75a916c33691089f9ca0865599d97970b3fb2bf2 (patch)
treeee1a443de4cf46d46746bbc3091617d64585d152 /sbin/swapon
parent2bef79c42458a75efcdbd2c915ca20b6b7d7f862 (diff)
downloadFreeBSD-src-75a916c33691089f9ca0865599d97970b3fb2bf2.zip
FreeBSD-src-75a916c33691089f9ca0865599d97970b3fb2bf2.tar.gz
MFC r307755: swapoff: Remove only late devices with -aL.
Currently, '/etc/rc.d/swaplate stop' removes all swap devices. This can be very slow and may not even be possible if there is a lot of swap space in use. However, removing swap devices is only needed for late swap devices that may depend on daemons that subsequent shutdown steps stop. Normal swap devices such as hard disk partitions will remain available throughout the shutdown process and need not be removed. In swapoff, interpret -aL to remove late swap devices only, and use this in etc/rc.d/swaplate. The meaning of -aL in swapon remains unchanged (add all swap devices, both normal and late). PR: 187081
Diffstat (limited to 'sbin/swapon')
-rw-r--r--sbin/swapon/swapon.88
-rw-r--r--sbin/swapon/swapon.c4
2 files changed, 11 insertions, 1 deletions
diff --git a/sbin/swapon/swapon.8 b/sbin/swapon/swapon.8
index ffce7d9..51bee68 100644
--- a/sbin/swapon/swapon.8
+++ b/sbin/swapon/swapon.8
@@ -28,7 +28,7 @@
.\" @(#)swapon.8 8.1 (Berkeley) 6/5/93
.\" $FreeBSD$
.\"
-.Dd October 2, 2016
+.Dd October 21, 2016
.Dt SWAPON 8
.Os
.Sh NAME
@@ -98,6 +98,12 @@ will be removed, unless their
.Dq noauto
option is also set.
If the
+.Fl L
+option is specified,
+only swap devices with the
+.Dq late
+option will be removed.
+If the
.Fl q
option is used,
informational messages will not be
diff --git a/sbin/swapon/swapon.c b/sbin/swapon/swapon.c
index e34cfcf..052fbc7 100644
--- a/sbin/swapon/swapon.c
+++ b/sbin/swapon/swapon.c
@@ -176,6 +176,10 @@ main(int argc, char **argv)
strstr(fsp->fs_mntops, "late") &&
late == 0)
continue;
+ if (which_prog == SWAPOFF &&
+ strstr(fsp->fs_mntops, "late") == NULL &&
+ late != 0)
+ continue;
swfile = swap_on_off(fsp->fs_spec, 1,
fsp->fs_mntops);
if (swfile == NULL) {
OpenPOWER on IntegriCloud