In message <[EMAIL PROTECTED]>, David Gilbert write
s:
>Is it not possible (or has nobody done it) to swap with the current
>diskless boot?
I do remember some problem with PXE and swap, but I forget the
details or if it was resolved. The diskless setup that we have
locally uses an MFS root image in the kernel instead of an NFS
root, which meant that we couldn't use DHCP tags to configure swap.
Our solution was a small patch that allows swapon(8) to configure
direct swapping to NFS regular files. This does the same thing as
the DHCP swap tags, but is much more controllable - the rc scripts
can do something like:
swap=/swap/swapfile
rm -f $swap
truncate -s 30M $swap
swapon $swap
The patch (against RELENG_4) is below; I wonder should this just
be committed? We have certainly found it quite useful.
Ian
Index: vm_swap.c
===================================================================
RCS file: /FreeBSD/FreeBSD-CVS/src/sys/vm/vm_swap.c,v
retrieving revision 1.96.2.1
diff -u -r1.96.2.1 vm_swap.c
--- vm_swap.c 2000/10/13 07:13:23 1.96.2.1
+++ vm_swap.c 2001/07/13 23:12:10
@@ -202,10 +202,14 @@
NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
- vn_isdisk(vp, &error);
-
- if (!error)
+ if (vn_isdisk(vp, &error))
error = swaponvp(p, vp, vp->v_rdev, 0);
+ else if (vp->v_type == VREG && vp->v_tag == VT_NFS) {
+ struct vattr attr;
+ error = VOP_GETATTR(vp, &attr, p->p_ucred, p);
+ if (!error)
+ error = swaponvp(p, vp, NODEV, attr.va_size/DEV_BSIZE);
+ }
if (error)
vrele(vp);
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message