mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
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 Reviewed by: wblock (man page only), ngie MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D8126
This commit is contained in:
parent
e5e40621d1
commit
7627b33010
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=307755
|
@ -12,7 +12,7 @@
|
||||||
name="swaplate"
|
name="swaplate"
|
||||||
desc="Setup late swap space"
|
desc="Setup late swap space"
|
||||||
start_cmd='/sbin/swapon -aLq'
|
start_cmd='/sbin/swapon -aLq'
|
||||||
stop_cmd='/sbin/swapoff -aq'
|
stop_cmd='/sbin/swapoff -aLq'
|
||||||
|
|
||||||
load_rc_config swap
|
load_rc_config swap
|
||||||
run_rc_command "$1"
|
run_rc_command "$1"
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
.\" @(#)swapon.8 8.1 (Berkeley) 6/5/93
|
.\" @(#)swapon.8 8.1 (Berkeley) 6/5/93
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd October 2, 2016
|
.Dd October 21, 2016
|
||||||
.Dt SWAPON 8
|
.Dt SWAPON 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
|
@ -98,6 +98,12 @@ will be removed, unless their
|
||||||
.Dq noauto
|
.Dq noauto
|
||||||
option is also set.
|
option is also set.
|
||||||
If the
|
If the
|
||||||
|
.Fl L
|
||||||
|
option is specified,
|
||||||
|
only swap devices with the
|
||||||
|
.Dq late
|
||||||
|
option will be removed.
|
||||||
|
If the
|
||||||
.Fl q
|
.Fl q
|
||||||
option is used,
|
option is used,
|
||||||
informational messages will not be
|
informational messages will not be
|
||||||
|
|
|
@ -176,6 +176,10 @@ main(int argc, char **argv)
|
||||||
strstr(fsp->fs_mntops, "late") &&
|
strstr(fsp->fs_mntops, "late") &&
|
||||||
late == 0)
|
late == 0)
|
||||||
continue;
|
continue;
|
||||||
|
if (which_prog == SWAPOFF &&
|
||||||
|
strstr(fsp->fs_mntops, "late") == NULL &&
|
||||||
|
late != 0)
|
||||||
|
continue;
|
||||||
swfile = swap_on_off(fsp->fs_spec, 1,
|
swfile = swap_on_off(fsp->fs_spec, 1,
|
||||||
fsp->fs_mntops);
|
fsp->fs_mntops);
|
||||||
if (swfile == NULL) {
|
if (swfile == NULL) {
|
||||||
|
|
Loading…
Reference in a new issue