When org.freebsd:swap property is set to 'on' on a ZVOL, use is as a swap

device.

Discussed with:	des
This commit is contained in:
Pawel Jakub Dawidek 2007-04-15 18:07:14 +00:00
parent db8086c4fa
commit 2c9c9b9f7f

View File

@ -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