From owner-freebsd-hackers Sun Nov 5 3: 9: 1 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from salmon.maths.tcd.ie (salmon.maths.tcd.ie [134.226.81.11]) by hub.freebsd.org (Postfix) with SMTP id 9A1C337B4CF; Sun, 5 Nov 2000 03:08:53 -0800 (PST) Received: from walton.maths.tcd.ie by salmon.maths.tcd.ie with SMTP id ; 5 Nov 2000 11:08:40 +0000 (GMT) To: Doug Ambrisko Cc: John Hay , Mike Smith , Danny Braniss , freebsd-hackers@FreeBSD.ORG Subject: Re: dhcp boot was: Re: diskless workstation In-Reply-To: Your message of "Sat, 04 Nov 2000 12:37:16 PST." <200011042037.MAA63521@whistle.com> Date: Sun, 05 Nov 2000 11:08:38 +0000 From: Ian Dowse Message-ID: <200011051108.aa63419@salmon.maths.tcd.ie> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In message <200011042037.MAA63521@whistle.com>, Doug Ambrisko writes: >| to the kernel's output. I had a look at the pxe code in >| /sys/boot/i386/libi386/pxe.c where pxeboot is built from and in >| /sys/i386/i386/autoconf.c which is the kernel side and it looks like >| they don't do anything about swap. There is a /* XXX set up swap? */ >| placeholder though. :-) > >Yep looks like you're right, I just tried it on 4.2-BETA it worked in >4.1.1. Swap is now broken ... sigh this is going to be a problem. I >guess the only thing you might be able to do in the interim is to do a >vnconfig of a file and then mount that as swap. I think the vnconfig >man pages describes this. Hopefully it works over NFS. The diskless setup we use here is based on a compiled-in MFS root rather than an NFS root, so we couldn't use the bootp code to enable NFS swap. Our solution was a modification to swapon() to enable direct swapping to NFS regular files. This results in the same swaponvp() call that the bootp code would use (at the time we implemented this, swapping over NFS via vnconfig was extremely unreliable; I think things are much better now). The patch we use is below. Ian Index: vm_swap.c =================================================================== RCS file: /FreeBSD/FreeBSD-CVS/src/sys/vm/vm_swap.c,v retrieving revision 1.96 diff -u -r1.96 vm_swap.c --- vm_swap.c 2000/01/25 17:49:12 1.96 +++ vm_swap.c 2000/11/05 11:04:34 @@ -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 majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message