Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Dec 1999 16:12:16 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        freebsd-current@FreeBSD.ORG
Subject:   Proposed patch to fix VN device (again)
Message-ID:  <199912280012.QAA34430@apollo.backplane.com>

next in thread | raw e-mail | index | archive | help
    Sigh.  Ok, I've fixed the VN device.  Again.  It looks like the removal of
    /dev/drum removed a little too much.  We need the device infrastructure
    to support the VN device's use of swap backing store.

    This patch below is a commit candidate.  It could use a review, then I'll
    commit it.

						-Matt


Index: swap_pager.h
===================================================================
RCS file: /home/ncvs/src/sys/vm/swap_pager.h,v
retrieving revision 1.27
diff -u -r1.27 swap_pager.h
--- swap_pager.h	1999/11/18 06:55:40	1.27
+++ swap_pager.h	1999/12/27 23:59:49
@@ -106,6 +106,7 @@
 
 /* choose underlying swap device and queue up I/O */
 struct buf;
+struct vnode *vm_swap_makevnode __P((void));
 void swstrategy __P((struct buf *bp));	/* probably needs to move elsewhere */
 
 #endif
Index: vm_swap.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_swap.c,v
retrieving revision 1.93
diff -u -r1.93 vm_swap.c
--- vm_swap.c	1999/12/15 23:02:35	1.93
+++ vm_swap.c	1999/12/28 00:05:55
@@ -68,6 +68,42 @@
 static int nswdev = NSWAPDEV;
 int vm_swap_size;
 
+#define CDEV_MAJOR	4
+
+static struct cdevsw sw_cdevsw = {
+	/* open */	nullopen,
+	/* close */	nullclose,
+	/* read */	noread,
+	/* write */	nowrite,
+	/* ioctl */	noioctl,
+	/* poll */	nopoll,
+	/* mmap */	nommap,
+	/* strategy */	swstrategy,
+	/* name */	"sw",
+	/* maj */	CDEV_MAJOR,
+	/* dump */	nodump,
+	/* psize */	nopsize,
+	/* flags */	D_DISK,
+	/* bmaj */	-1
+};
+
+struct vnode *
+vm_swap_makevnode(void)
+{
+	struct vnode *vp = NULL;
+
+	if (getnewvnode(VT_NON, NULL, spec_vnodeop_p, &vp)) {
+		panic("Cannot get vnode for swapdev");
+		return(NULL);
+	}
+	vp->v_rdev = make_dev(&sw_cdevsw, 1, UID_ROOT, GID_KMEM, 
+		0640, "swapdev");
+	vp->v_rdev->si_bsize_phys = PAGE_SIZE;
+	vp->v_rdev->si_bsize_best = PAGE_SIZE;
+	vp->v_type = VCHR;
+	return(vp);
+}
+
 /*
  *	swstrategy:
  *
Index: swap_pager.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/swap_pager.c,v
retrieving revision 1.129
diff -u -r1.129 swap_pager.c
--- swap_pager.c	1999/11/22 15:27:09	1.129
+++ swap_pager.c	1999/12/28 00:01:24
@@ -329,10 +329,7 @@
 
 	swhash_mask = n - 1;
 
-	n = getnewvnode(VT_NON, NULL, spec_vnodeop_p, &swapdev_vp);
-	if (n)
-		panic("Cannot get vnode for swapdev");
-	swapdev_vp->v_type = VBLK;
+	swapdev_vp = vm_swap_makevnode();
 }
 
 /*
Index: /usr/src/sys/conf/majors
===================================================================
RCS file: /home/ncvs/src/sys/conf/majors,v
retrieving revision 1.94
diff -u -r1.94 majors
--- majors	1999/12/17 19:56:39	1.94
+++ majors	1999/12/27 23:27:37
@@ -21,7 +21,7 @@
 1	ctty		/dev/tty
 2	mm		/dev/mem,kmem,etc
 3	wd		ST506 disk controller (with IDE extensions)
-4	was:swap	/dev/drum
+4	swap		/dev/drum
 5	pts		pseudo tty "tty" half
 6	ptc		pseudo tty "master" half
 7	log		system log


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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