diff options
author | phk <phk@FreeBSD.org> | 1996-10-27 22:31:00 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1996-10-27 22:31:00 +0000 |
commit | ffa9f8feccafae487e7029e4d5a8a39a1da2a370 (patch) | |
tree | 556f6d7836cdc65973aab9dcf56cbb955895d4be | |
parent | b7bce82d8a979b2e12440611754145b3c18b68cb (diff) | |
download | FreeBSD-src-ffa9f8feccafae487e7029e4d5a8a39a1da2a370.zip FreeBSD-src-ffa9f8feccafae487e7029e4d5a8a39a1da2a370.tar.gz |
The way we get a vnode for swapdev is not quite kosher. In particular
it breaks in the DEVFS_ROOT case. replicate a bit too much of bdevvp()
in here to circumvent the problem. The real problem is the magic that
lives in bdevsw[1].
-rw-r--r-- | sys/vm/vm_swap.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index c033872..1bc3e90 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)vm_swap.c 8.5 (Berkeley) 2/17/94 - * $Id: vm_swap.c,v 1.38 1996/03/28 15:40:17 bde Exp $ + * $Id: vm_swap.c,v 1.39 1996/07/12 04:12:25 bde Exp $ */ #include <sys/param.h> @@ -282,9 +282,23 @@ swaponvp(p, vp, dev, nblks) vm_swap_size += blk; } - if (!swapdev_vp && bdevvp(swapdev, &swapdev_vp)) - panic("Cannot get vnode for swapdev"); - + if (!swapdev_vp) { + struct vnode *vp; + struct vnode *nvp; + + error = getnewvnode(VT_NON, (struct mount *) 0, + spec_vnodeop_p, &nvp); + if (error) + panic("Cannot get vnode for swapdev"); + vp = nvp; + vp->v_type = VBLK; + if ((nvp = checkalias(vp, swapdev, + (struct mount *) 0))) { + vput(vp); + vp = nvp; + } + swapdev_vp = vp; + } return (0); } |