diff options
author | pjd <pjd@FreeBSD.org> | 2007-04-15 18:07:14 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2007-04-15 18:07:14 +0000 |
commit | 00b37c4ca7f2e444a9f37c43bfdebb90316178f7 (patch) | |
tree | f084abd3c64af099f90ea1664669010b4c47adab /etc/rc.d/zfs | |
parent | b5e55a3e625a62f1197ab5bc63b321849db9c852 (diff) | |
download | FreeBSD-src-00b37c4ca7f2e444a9f37c43bfdebb90316178f7.zip FreeBSD-src-00b37c4ca7f2e444a9f37c43bfdebb90316178f7.tar.gz |
When org.freebsd:swap property is set to 'on' on a ZVOL, use is as a swap
device.
Discussed with: des
Diffstat (limited to 'etc/rc.d/zfs')
-rw-r--r-- | etc/rc.d/zfs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/etc/rc.d/zfs b/etc/rc.d/zfs index 896fdff..6bed826 100644 --- a/etc/rc.d/zfs +++ b/etc/rc.d/zfs @@ -23,10 +23,28 @@ zfs_start() if [ ! -r /etc/zfs/exports ]; then touch /etc/zfs/exports fi + # Enable swap on ZVOLs with property org.freebsd:swap=on. + zfs list -H -o org.freebsd:swap,name -t volume | \ + while read state name; do + case "${state}" in + [oO][nN]) + swapon /dev/zvol/${name} + ;; + esac + done } zfs_stop() { + # Disable swap on ZVOLs with property org.freebsd:swap=on. + zfs list -H -o org.freebsd:swap,name -t volume | \ + while read state name; do + case "${state}" in + [oO][nN]) + swapoff /dev/zvol/${name} + ;; + esac + done zfs unshare -a zfs unmount -a zfs volfini |