From owner-freebsd-current Mon Dec 27 19:24:43 1999 Delivered-To: freebsd-current@freebsd.org Received: from overcee.netplex.com.au (overcee.netplex.com.au [202.12.86.7]) by hub.freebsd.org (Postfix) with ESMTP id 667D115304 for ; Mon, 27 Dec 1999 19:24:39 -0800 (PST) (envelope-from peter@netplex.com.au) Received: from netplex.com.au (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id 70DE41CA0; Tue, 28 Dec 1999 11:24:33 +0800 (WST) (envelope-from peter@netplex.com.au) X-Mailer: exmh version 2.1.1 10/15/1999 To: dg@root.com Cc: Poul-Henning Kamp , Matthew Dillon , freebsd-current@FreeBSD.ORG Subject: Re: Proposed patch to fix VN device (again) In-Reply-To: Message from David Greenman of "Mon, 27 Dec 1999 18:58:41 PST." <199912280258.SAA12518@implode.root.com> Date: Tue, 28 Dec 1999 11:24:33 +0800 From: Peter Wemm Message-Id: <19991228032433.70DE41CA0@overcee.netplex.com.au> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG David Greenman wrote: > I've heard from both of you that you think the other is wrong. This isn't > very helpful, however, in finding the correct solution. What I'd like to hear > from both of you is the reasons why swap is better as a device, or not. There > seems to be some unstated architectural philosophy that needs to be stated > before any informed decision can be made about what is the right direction to > go in. The problem is that swapdev_vp needs to handle VOP_STRATEGY(), and swapdev_vp is incorrectly being pointed at spec_vnops. Here is a proposed (UNTESTED!) clean fix: 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 03:22:08 @@ -199,6 +199,32 @@ static daddr_t swp_pager_meta_ctl __P((vm_object_t, vm_pindex_t, int)); /* + * Handle a VOP_STRATEGY() on swapdev_vp + */ + +static int +swapdev_strategy(ap) + struct vop_strategy_args /* { + struct vnode *a_vp; + struct buf *a_bp; + } */ *ap; +{ + struct buf *bp; + + bp = ap->a_bp; + return swstrategy(bp); +} + +vop_t **swapdev_vnodeop_p; +static struct vnodeopv_entry_desc swapdev_vnodeop_entries[] = { + { &vop_strategy_desc, (vop_t *) swapdev_strategy }, + { NULL, NULL } +}; +static struct vnodeopv_desc swapdev_vnodeop_opv_desc = + { &swapdev_vnodeop_p, swapdev_vnodeop_entries }; +VNODEOP_SET(swapdev_vnodeop_opv_desc); + +/* * SWP_SIZECHECK() - update swap_pager_full indication * * update the swap_pager_almost_full indication and warn when we are @@ -329,7 +355,7 @@ swhash_mask = n - 1; - n = getnewvnode(VT_NON, NULL, spec_vnodeop_p, &swapdev_vp); + n = getnewvnode(VT_NON, NULL, swapdev_vnodeop_p, &swapdev_vp); if (n) panic("Cannot get vnode for swapdev"); swapdev_vp->v_type = VBLK; After this, flushchainbuf() on a bp that is bound to swapdev_vp should do the right thing. There is still no need at all to redirect this via a fake device. I'll be testing this shortly, but I wanted to get an alternative in before the arms race truely turned nuclear. Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message