Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 05 Nov 2000 11:08:38 +0000
From:      Ian Dowse <iedowse@maths.tcd.ie>
To:        Doug Ambrisko <ambrisko@whistle.com>
Cc:        John Hay <jhay@icomtek.csir.co.za>, Mike Smith <msmith@FreeBSD.ORG>, Danny Braniss <danny@cs.huji.ac.il>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: dhcp boot was: Re: diskless workstation 
Message-ID:   <200011051108.aa63419@salmon.maths.tcd.ie>
In-Reply-To: Your message of "Sat, 04 Nov 2000 12:37:16 PST." <200011042037.MAA63521@whistle.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi? <200011051108.aa63419>