summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_swap.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-11-22 15:27:09 +0000
committerphk <phk@FreeBSD.org>1999-11-22 15:27:09 +0000
commit84a3f8a8d21de924b8372e826881b466497db886 (patch)
treebf5082d1d9058492f5fc54c39ff2476a89d2b5fd /sys/vm/vm_swap.c
parentf01ff83295bf29fffa5baa1c21c6474eeb227794 (diff)
downloadFreeBSD-src-84a3f8a8d21de924b8372e826881b466497db886.zip
FreeBSD-src-84a3f8a8d21de924b8372e826881b466497db886.tar.gz
Isolate the swapdev_vp "not quite" vnode in the only source file which
needs it now that /dev/drum is gone. Reviewed by: eivind, peter
Diffstat (limited to 'sys/vm/vm_swap.c')
-rw-r--r--sys/vm/vm_swap.c39
1 files changed, 4 insertions, 35 deletions
diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c
index 4231fc2..d0f2f26 100644
--- a/sys/vm/vm_swap.c
+++ b/sys/vm/vm_swap.c
@@ -63,7 +63,6 @@
#endif
static struct swdevt should_be_malloced[NSWAPDEV];
static struct swdevt *swdevt = should_be_malloced;
-struct vnode *swapdev_vp;
static int nswap; /* first block after the interleaved devs */
static int nswdev = NSWAPDEV;
int vm_swap_size;
@@ -162,7 +161,6 @@ swapon(p, uap)
struct swapon_args *uap;
{
register struct vnode *vp;
- dev_t dev;
struct nameidata nd;
int error;
@@ -177,33 +175,11 @@ swapon(p, uap)
vp = nd.ni_vp;
- switch (vp->v_type) {
- case VBLK:
- dev = vp->v_rdev;
- if (devsw(dev) == NULL) {
- error = ENXIO;
- break;
- }
- error = swaponvp(p, vp, dev, 0);
- break;
- case VCHR:
- /*
- * For now, we disallow swapping to regular files.
- * It requires logical->physcal block translation
- * support in the swap pager before it will work.
- */
+ if (!vn_isdisk(vp))
error = ENOTBLK;
- break;
-#if 0
- error = VOP_GETATTR(vp, &attr, p->p_ucred, p);
- if (!error)
- error = swaponvp(p, vp, NODEV, attr.va_size / DEV_BSIZE);
- break;
-#endif
- default:
- error = EINVAL;
- break;
- }
+
+ if (!error)
+ error = swaponvp(p, vp, vp->v_rdev, 0);
if (error)
vrele(vp);
@@ -296,12 +272,5 @@ swaponvp(p, vp, dev, nblks)
vm_swap_size += blk;
}
- if (!swapdev_vp) {
- error = getnewvnode(VT_NON, (struct mount *) 0,
- spec_vnodeop_p, &swapdev_vp);
- if (error)
- panic("Cannot get vnode for swapdev");
- swapdev_vp->v_type = VBLK;
- }
return (0);
}
OpenPOWER on IntegriCloud