Home | History | Annotate | Line # | Download | only in genfs
layer_subr.c revision 1.13
      1  1.13   thorpej /*	$NetBSD: layer_subr.c,v 1.13 2003/06/29 18:43:32 thorpej Exp $	*/
      2   1.1  wrstuden 
      3   1.1  wrstuden /*
      4   1.1  wrstuden  * Copyright (c) 1999 National Aeronautics & Space Administration
      5   1.1  wrstuden  * All rights reserved.
      6   1.1  wrstuden  *
      7   1.1  wrstuden  * This software was written by William Studenmund of the
      8   1.8       wiz  * Numerical Aerospace Simulation Facility, NASA Ames Research Center.
      9   1.1  wrstuden  *
     10   1.1  wrstuden  * Redistribution and use in source and binary forms, with or without
     11   1.1  wrstuden  * modification, are permitted provided that the following conditions
     12   1.1  wrstuden  * are met:
     13   1.1  wrstuden  * 1. Redistributions of source code must retain the above copyright
     14   1.1  wrstuden  *    notice, this list of conditions and the following disclaimer.
     15   1.1  wrstuden  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1  wrstuden  *    notice, this list of conditions and the following disclaimer in the
     17   1.1  wrstuden  *    documentation and/or other materials provided with the distribution.
     18   1.5     soren  * 3. Neither the name of the National Aeronautics & Space Administration
     19   1.1  wrstuden  *    nor the names of its contributors may be used to endorse or promote
     20   1.1  wrstuden  *    products derived from this software without specific prior written
     21   1.1  wrstuden  *    permission.
     22   1.1  wrstuden  *
     23   1.1  wrstuden  * THIS SOFTWARE IS PROVIDED BY THE NATIONAL AERONAUTICS & SPACE ADMINISTRATION
     24   1.1  wrstuden  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     25   1.1  wrstuden  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     26   1.1  wrstuden  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ADMINISTRATION OR CONTRIB-
     27   1.1  wrstuden  * UTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
     28   1.1  wrstuden  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     29   1.1  wrstuden  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     30   1.1  wrstuden  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     31   1.1  wrstuden  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     32   1.1  wrstuden  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     33   1.1  wrstuden  * POSSIBILITY OF SUCH DAMAGE.
     34   1.1  wrstuden  */
     35   1.1  wrstuden /*
     36   1.1  wrstuden  * Copyright (c) 1992, 1993
     37   1.1  wrstuden  *	The Regents of the University of California.  All rights reserved.
     38   1.1  wrstuden  *
     39   1.1  wrstuden  * This code is derived from software donated to Berkeley by
     40   1.1  wrstuden  * Jan-Simon Pendry.
     41   1.1  wrstuden  *
     42   1.1  wrstuden  * Redistribution and use in source and binary forms, with or without
     43   1.1  wrstuden  * modification, are permitted provided that the following conditions
     44   1.1  wrstuden  * are met:
     45   1.1  wrstuden  * 1. Redistributions of source code must retain the above copyright
     46   1.1  wrstuden  *    notice, this list of conditions and the following disclaimer.
     47   1.1  wrstuden  * 2. Redistributions in binary form must reproduce the above copyright
     48   1.1  wrstuden  *    notice, this list of conditions and the following disclaimer in the
     49   1.1  wrstuden  *    documentation and/or other materials provided with the distribution.
     50   1.1  wrstuden  * 3. All advertising materials mentioning features or use of this software
     51   1.1  wrstuden  *    must display the following acknowledgement:
     52   1.1  wrstuden  *	This product includes software developed by the University of
     53   1.1  wrstuden  *	California, Berkeley and its contributors.
     54   1.1  wrstuden  * 4. Neither the name of the University nor the names of its contributors
     55   1.1  wrstuden  *    may be used to endorse or promote products derived from this software
     56   1.1  wrstuden  *    without specific prior written permission.
     57   1.1  wrstuden  *
     58   1.1  wrstuden  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     59   1.1  wrstuden  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     60   1.1  wrstuden  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     61   1.1  wrstuden  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     62   1.1  wrstuden  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     63   1.1  wrstuden  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     64   1.1  wrstuden  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     65   1.1  wrstuden  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     66   1.1  wrstuden  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     67   1.1  wrstuden  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     68   1.1  wrstuden  * SUCH DAMAGE.
     69   1.1  wrstuden  *
     70   1.1  wrstuden  *	from: Id: lofs_subr.c,v 1.11 1992/05/30 10:05:43 jsp Exp
     71   1.1  wrstuden  *	@(#)null_subr.c	8.7 (Berkeley) 5/14/95
     72   1.1  wrstuden  */
     73   1.9     lukem 
     74   1.9     lukem #include <sys/cdefs.h>
     75  1.13   thorpej __KERNEL_RCSID(0, "$NetBSD: layer_subr.c,v 1.13 2003/06/29 18:43:32 thorpej Exp $");
     76   1.1  wrstuden 
     77   1.1  wrstuden #include <sys/param.h>
     78   1.1  wrstuden #include <sys/systm.h>
     79   1.1  wrstuden #include <sys/proc.h>
     80   1.1  wrstuden #include <sys/time.h>
     81   1.1  wrstuden #include <sys/vnode.h>
     82   1.1  wrstuden #include <sys/mount.h>
     83   1.1  wrstuden #include <sys/namei.h>
     84   1.1  wrstuden #include <sys/malloc.h>
     85   1.1  wrstuden #include <miscfs/specfs/specdev.h>
     86   1.1  wrstuden #include <miscfs/genfs/layer.h>
     87   1.1  wrstuden #include <miscfs/genfs/layer_extern.h>
     88   1.1  wrstuden 
     89   1.1  wrstuden #define	NLAYERNODECACHE 16
     90   1.1  wrstuden 
     91   1.1  wrstuden /*
     92   1.1  wrstuden  * layer cache:
     93   1.1  wrstuden  * Each cache entry holds a reference to the lower vnode
     94   1.1  wrstuden  * along with a pointer to the alias vnode.  When an
     95   1.1  wrstuden  * entry is added the lower vnode is VREF'd.  When the
     96   1.1  wrstuden  * alias is removed the lower vnode is vrele'd.
     97   1.1  wrstuden  */
     98   1.1  wrstuden 
     99   1.1  wrstuden /*
    100   1.1  wrstuden  * Initialise cache headers
    101   1.1  wrstuden  */
    102   1.1  wrstuden void
    103   1.1  wrstuden layerfs_init()
    104   1.1  wrstuden {
    105   1.6  jdolecek #ifdef LAYERFS_DIAGNOSTIC
    106   1.6  jdolecek 	printf("layerfs_init\n");		/* printed during system boot */
    107   1.6  jdolecek #endif
    108   1.6  jdolecek }
    109   1.1  wrstuden 
    110   1.6  jdolecek /*
    111   1.6  jdolecek  * Free global resources of layerfs.
    112   1.6  jdolecek  */
    113   1.6  jdolecek void
    114   1.6  jdolecek layerfs_done()
    115   1.6  jdolecek {
    116   1.1  wrstuden #ifdef LAYERFS_DIAGNOSTIC
    117   1.6  jdolecek 	printf("layerfs_done\n");		/* printed on layerfs detach */
    118   1.1  wrstuden #endif
    119   1.1  wrstuden }
    120   1.1  wrstuden 
    121   1.1  wrstuden /*
    122   1.1  wrstuden  * Return a locked, VREF'ed alias for lower vnode if already exists, else 0.
    123   1.1  wrstuden  */
    124   1.1  wrstuden struct vnode *
    125   1.1  wrstuden layer_node_find(mp, lowervp)
    126   1.1  wrstuden 	struct mount *mp;
    127   1.1  wrstuden 	struct vnode *lowervp;
    128   1.1  wrstuden {
    129   1.1  wrstuden 	struct layer_mount *lmp = MOUNTTOLAYERMOUNT(mp);
    130   1.1  wrstuden 	struct layer_node_hashhead *hd;
    131   1.1  wrstuden 	struct layer_node *a;
    132   1.1  wrstuden 	struct vnode *vp;
    133   1.1  wrstuden 
    134   1.1  wrstuden 	/*
    135   1.1  wrstuden 	 * Find hash base, and then search the (two-way) linked
    136   1.1  wrstuden 	 * list looking for a layer_node structure which is referencing
    137   1.1  wrstuden 	 * the lower vnode.  If found, the increment the layer_node
    138   1.1  wrstuden 	 * reference count (but NOT the lower vnode's VREF counter)
    139   1.1  wrstuden 	 * and return the vnode locked.
    140   1.1  wrstuden 	 */
    141   1.1  wrstuden 	hd = LAYER_NHASH(lmp, lowervp);
    142   1.1  wrstuden loop:
    143   1.2  wrstuden 	simple_lock(&lmp->layerm_hashlock);
    144   1.1  wrstuden 	for (a = hd->lh_first; a != 0; a = a->layer_hash.le_next) {
    145   1.1  wrstuden 		if (a->layer_lowervp == lowervp && LAYERTOV(a)->v_mount == mp) {
    146   1.1  wrstuden 			vp = LAYERTOV(a);
    147   1.2  wrstuden 			simple_unlock(&lmp->layerm_hashlock);
    148   1.1  wrstuden 			/*
    149   1.1  wrstuden 			 * We must be careful here as the fact the lower
    150   1.1  wrstuden 			 * vnode is locked will imply vp is locked unless
    151   1.1  wrstuden 			 * someone has decided to start vclean'ing either
    152   1.1  wrstuden 			 * vp or lowervp.
    153   1.1  wrstuden 			 *
    154   1.1  wrstuden 			 * So we try for an exclusive, recursive lock
    155   1.1  wrstuden 			 * on the upper vnode. If it fails, vcleaning
    156   1.1  wrstuden 			 * is in progress (so when we try again, we'll
    157   1.1  wrstuden 			 * fail). If it succeeds, we now have double
    158   1.1  wrstuden 			 * locked the bottom node. So we do an explicit
    159   1.1  wrstuden 			 * VOP_UNLOCK on it to keep the counts right. Note
    160   1.1  wrstuden 			 * that we will end up with the upper node and
    161   1.1  wrstuden 			 * the lower node locked once.
    162   1.1  wrstuden 			 */
    163  1.13   thorpej 			if (vget(vp, LK_EXCLUSIVE | LK_CANRECURSE)) {
    164   1.1  wrstuden 				printf ("layer_node_find: vget failed.\n");
    165   1.1  wrstuden 				goto loop;
    166   1.1  wrstuden 			};
    167   1.1  wrstuden 			VOP_UNLOCK(lowervp, 0);
    168   1.1  wrstuden 			return (vp);
    169   1.1  wrstuden 		}
    170   1.1  wrstuden 	}
    171   1.1  wrstuden 
    172   1.2  wrstuden 	simple_unlock(&lmp->layerm_hashlock);
    173   1.1  wrstuden 	return NULL;
    174   1.1  wrstuden }
    175   1.1  wrstuden 
    176   1.1  wrstuden 
    177   1.1  wrstuden /*
    178   1.1  wrstuden  * Make a new layer_node node.
    179   1.1  wrstuden  * Vp is the alias vnode, lowervp is the lower vnode.
    180   1.1  wrstuden  * Maintain a reference to lowervp.
    181   1.1  wrstuden  */
    182   1.1  wrstuden int
    183   1.1  wrstuden layer_node_alloc(mp, lowervp, vpp)
    184   1.1  wrstuden 	struct mount *mp;
    185   1.1  wrstuden 	struct vnode *lowervp;
    186   1.1  wrstuden 	struct vnode **vpp;
    187   1.1  wrstuden {
    188   1.1  wrstuden 	struct layer_mount *lmp = MOUNTTOLAYERMOUNT(mp);
    189   1.1  wrstuden 	struct layer_node_hashhead *hd;
    190   1.1  wrstuden 	struct layer_node *xp;
    191   1.1  wrstuden 	struct vnode *vp, *nvp;
    192   1.1  wrstuden 	int error;
    193   1.1  wrstuden 	extern int (**dead_vnodeop_p) __P((void *));
    194   1.1  wrstuden 
    195   1.1  wrstuden 	if ((error = getnewvnode(lmp->layerm_tag, mp, lmp->layerm_vnodeop_p,
    196   1.1  wrstuden 			&vp)) != 0)
    197   1.1  wrstuden 		return (error);
    198   1.1  wrstuden 	vp->v_type = lowervp->v_type;
    199   1.3  wrstuden 	vp->v_flag |= VLAYER;
    200   1.1  wrstuden 
    201  1.11     enami 	xp = malloc(lmp->layerm_size, M_TEMP, M_WAITOK);
    202   1.1  wrstuden 	if (vp->v_type == VBLK || vp->v_type == VCHR) {
    203   1.1  wrstuden 		MALLOC(vp->v_specinfo, struct specinfo *,
    204   1.1  wrstuden 		    sizeof(struct specinfo), M_VNODE, M_WAITOK);
    205   1.4  wrstuden 		vp->v_hashchain = NULL;
    206   1.1  wrstuden 		vp->v_rdev = lowervp->v_rdev;
    207   1.1  wrstuden 	}
    208   1.1  wrstuden 
    209   1.1  wrstuden 	vp->v_data = xp;
    210   1.1  wrstuden 	xp->layer_vnode = vp;
    211   1.1  wrstuden 	xp->layer_lowervp = lowervp;
    212   1.1  wrstuden 	xp->layer_flags = 0;
    213   1.1  wrstuden 	/*
    214   1.1  wrstuden 	 * Before we insert our new node onto the hash chains,
    215   1.1  wrstuden 	 * check to see if someone else has beaten us to it.
    216   1.1  wrstuden 	 * (We could have slept in MALLOC.)
    217   1.1  wrstuden 	 */
    218   1.1  wrstuden 	if ((nvp = layer_node_find(mp, lowervp)) != NULL) {
    219   1.1  wrstuden 		*vpp = nvp;
    220   1.1  wrstuden 
    221   1.1  wrstuden 		/* free the substructures we've allocated. */
    222   1.1  wrstuden 		FREE(xp, M_TEMP);
    223   1.1  wrstuden 		if (vp->v_type == VBLK || vp->v_type == VCHR)
    224   1.1  wrstuden 			FREE(vp->v_specinfo, M_VNODE);
    225   1.1  wrstuden 
    226   1.1  wrstuden 		vp->v_type = VBAD;		/* node is discarded */
    227   1.1  wrstuden 		vp->v_op = dead_vnodeop_p;	/* so ops will still work */
    228   1.1  wrstuden 		vrele(vp);			/* get rid of it. */
    229   1.1  wrstuden 		return (0);
    230   1.1  wrstuden 	}
    231   1.1  wrstuden 
    232   1.2  wrstuden 	simple_lock(&lmp->layerm_hashlock);
    233   1.1  wrstuden 
    234   1.1  wrstuden 	/*
    235   1.1  wrstuden 	 * Now lock the new node. We rely on the fact that we were passed
    236   1.1  wrstuden 	 * a locked vnode. If the lower node is exporting a struct lock
    237   1.1  wrstuden 	 * (v_vnlock != NULL) then we just set the upper v_vnlock to the
    238   1.1  wrstuden 	 * lower one, and both are now locked. If the lower node is exporting
    239   1.1  wrstuden 	 * NULL, then we copy that up and manually lock the upper node.
    240   1.1  wrstuden 	 *
    241   1.1  wrstuden 	 * LAYERFS_UPPERLOCK already has the test, so we use it after copying
    242   1.1  wrstuden 	 * up the v_vnlock from below.
    243   1.1  wrstuden 	 */
    244   1.1  wrstuden 
    245   1.1  wrstuden 	vp->v_vnlock = lowervp->v_vnlock;
    246   1.1  wrstuden 	LAYERFS_UPPERLOCK(vp, LK_EXCLUSIVE, error);
    247   1.1  wrstuden 
    248   1.1  wrstuden 	if (error) {
    249   1.1  wrstuden 		/*
    250   1.1  wrstuden 		 * How did we get a locking error? The node just came off
    251   1.1  wrstuden 		 * of the free list, and we're the only routine which
    252   1.1  wrstuden 		 * knows it's there...
    253   1.1  wrstuden 		 */
    254   1.1  wrstuden 		vp->v_vnlock = &vp->v_lock;
    255   1.1  wrstuden 		*vpp = NULL;
    256   1.1  wrstuden 
    257   1.1  wrstuden 		/* free the substructures we've allocated. */
    258   1.1  wrstuden 		FREE(xp, M_TEMP);
    259   1.1  wrstuden 		if (vp->v_type == VBLK || vp->v_type == VCHR)
    260   1.1  wrstuden 			FREE(vp->v_specinfo, M_VNODE);
    261   1.1  wrstuden 
    262   1.1  wrstuden 		vp->v_type = VBAD;		/* node is discarded */
    263   1.1  wrstuden 		vp->v_op = dead_vnodeop_p;	/* so ops will still work */
    264   1.1  wrstuden 		vrele(vp);			/* get rid of it. */
    265   1.1  wrstuden 		return (error);
    266   1.1  wrstuden 	}
    267   1.1  wrstuden 	/*
    268   1.1  wrstuden 	 * NetBSD used to do an inlined checkalias here. We do not, as
    269   1.1  wrstuden 	 * we never flag device nodes as being aliased. The lowervp
    270   1.1  wrstuden 	 * node will, when appropriate, be flaged as an alias.
    271   1.1  wrstuden 	 */
    272   1.1  wrstuden 
    273   1.1  wrstuden 	*vpp = vp;
    274   1.1  wrstuden 	VREF(lowervp);	/* Take into account reference held in layer_node */
    275   1.1  wrstuden 	hd = LAYER_NHASH(lmp, lowervp);
    276   1.1  wrstuden 	LIST_INSERT_HEAD(hd, xp, layer_hash);
    277   1.7       chs 	uvm_vnp_setsize(vp, 0);
    278   1.2  wrstuden 	simple_unlock(&lmp->layerm_hashlock);
    279   1.1  wrstuden 	return (0);
    280   1.1  wrstuden }
    281   1.1  wrstuden 
    282   1.1  wrstuden 
    283   1.1  wrstuden /*
    284   1.1  wrstuden  * Try to find an existing layer_node vnode refering
    285   1.1  wrstuden  * to it, otherwise make a new layer_node vnode which
    286   1.1  wrstuden  * contains a reference to the lower vnode.
    287   1.1  wrstuden  *
    288   1.1  wrstuden  * >>> we assume that the lower node is already locked upon entry, so we
    289   1.1  wrstuden  * propagate the lock state to upper node <<
    290   1.1  wrstuden  */
    291   1.1  wrstuden int
    292   1.1  wrstuden layer_node_create(mp, lowervp, newvpp)
    293   1.1  wrstuden 	struct mount *mp;
    294   1.1  wrstuden 	struct vnode *lowervp;
    295   1.1  wrstuden 	struct vnode **newvpp;
    296   1.1  wrstuden {
    297   1.1  wrstuden 	struct vnode *aliasvp;
    298   1.1  wrstuden 	struct layer_mount *lmp = MOUNTTOLAYERMOUNT(mp);
    299   1.1  wrstuden 
    300   1.1  wrstuden 	if ((aliasvp = layer_node_find(mp, lowervp)) != NULL) {
    301   1.1  wrstuden 		/*
    302   1.1  wrstuden 		 * layer_node_find has taken another reference
    303   1.1  wrstuden 		 * to the alias vnode and moved the lock holding to
    304   1.1  wrstuden 		 * aliasvp
    305   1.1  wrstuden 		 */
    306   1.1  wrstuden #ifdef LAYERFS_DIAGNOSTIC
    307   1.1  wrstuden 		vprint("layer_node_create: exists", aliasvp);
    308   1.1  wrstuden #endif
    309   1.1  wrstuden 	} else {
    310   1.1  wrstuden 		int error;
    311   1.1  wrstuden 
    312   1.1  wrstuden 		/*
    313   1.1  wrstuden 		 * Get new vnode.
    314   1.1  wrstuden 		 */
    315   1.1  wrstuden #ifdef LAYERFS_DIAGNOSTIC
    316   1.1  wrstuden 		printf("layer_node_create: create new alias vnode\n");
    317   1.1  wrstuden #endif
    318   1.1  wrstuden 
    319   1.1  wrstuden 		/*
    320   1.1  wrstuden 		 * Make new vnode reference the layer_node.
    321   1.1  wrstuden 		 */
    322   1.1  wrstuden 		if ((error = (lmp->layerm_alloc)(mp, lowervp, &aliasvp)) != 0)
    323   1.1  wrstuden 			return error;
    324   1.1  wrstuden 
    325   1.1  wrstuden 		/*
    326   1.1  wrstuden 		 * aliasvp is already VREF'd by getnewvnode()
    327   1.1  wrstuden 		 */
    328   1.1  wrstuden 	}
    329   1.1  wrstuden 
    330   1.1  wrstuden 	/*
    331   1.1  wrstuden 	 * Now that we have VREF'd the upper vnode, release the reference
    332   1.1  wrstuden 	 * to the lower node. The existance of the layer_node retains one
    333   1.1  wrstuden 	 * reference to the lower node.
    334   1.1  wrstuden 	 */
    335   1.1  wrstuden 	vrele(lowervp);
    336   1.1  wrstuden 
    337   1.1  wrstuden #ifdef DIAGNOSTIC
    338   1.1  wrstuden 	if (lowervp->v_usecount < 1) {
    339   1.1  wrstuden 		/* Should never happen... */
    340   1.1  wrstuden 		vprint("layer_node_create: alias", aliasvp);
    341   1.1  wrstuden 		vprint("layer_node_create: lower", lowervp);
    342   1.1  wrstuden 		panic("layer_node_create: lower has 0 usecount.");
    343   1.1  wrstuden 	};
    344   1.1  wrstuden #endif
    345   1.1  wrstuden 
    346   1.1  wrstuden #ifdef LAYERFS_DIAGNOSTIC
    347   1.1  wrstuden 	vprint("layer_node_create: alias", aliasvp);
    348   1.1  wrstuden #endif
    349   1.1  wrstuden 	*newvpp = aliasvp;
    350   1.1  wrstuden 	return (0);
    351   1.1  wrstuden }
    352   1.1  wrstuden 
    353   1.1  wrstuden struct vnode *
    354   1.1  wrstuden layer_checkvp(vp, fil, lno)
    355   1.1  wrstuden 	struct vnode *vp;
    356   1.1  wrstuden 	char *fil;
    357   1.1  wrstuden 	int lno;
    358   1.1  wrstuden {
    359   1.1  wrstuden 	struct layer_node *a = VTOLAYER(vp);
    360   1.1  wrstuden #ifdef notyet
    361   1.1  wrstuden 	/*
    362   1.1  wrstuden 	 * Can't do this check because vop_reclaim runs
    363   1.1  wrstuden 	 * with a funny vop vector.
    364   1.1  wrstuden 	 *
    365   1.1  wrstuden 	 * WRS - no it doesnt...
    366   1.1  wrstuden 	 */
    367   1.1  wrstuden 	if (vp->v_op != layer_vnodeop_p) {
    368   1.1  wrstuden 		printf ("layer_checkvp: on non-layer-node\n");
    369   1.1  wrstuden #ifdef notyet
    370   1.1  wrstuden 		while (layer_checkvp_barrier) /*WAIT*/ ;
    371   1.1  wrstuden #endif
    372   1.1  wrstuden 		panic("layer_checkvp");
    373   1.1  wrstuden 	};
    374   1.1  wrstuden #endif
    375   1.1  wrstuden 	if (a->layer_lowervp == NULL) {
    376   1.1  wrstuden 		/* Should never happen */
    377   1.1  wrstuden 		int i; u_long *p;
    378   1.1  wrstuden 		printf("vp = %p, ZERO ptr\n", vp);
    379   1.1  wrstuden 		for (p = (u_long *) a, i = 0; i < 8; i++)
    380   1.1  wrstuden 			printf(" %lx", p[i]);
    381   1.1  wrstuden 		printf("\n");
    382   1.1  wrstuden 		/* wait for debugger */
    383   1.1  wrstuden 		panic("layer_checkvp");
    384   1.1  wrstuden 	}
    385   1.1  wrstuden 	if (a->layer_lowervp->v_usecount < 1) {
    386   1.1  wrstuden 		int i; u_long *p;
    387   1.1  wrstuden 		printf("vp = %p, unref'ed lowervp\n", vp);
    388   1.1  wrstuden 		for (p = (u_long *) a, i = 0; i < 8; i++)
    389   1.1  wrstuden 			printf(" %lx", p[i]);
    390   1.1  wrstuden 		printf("\n");
    391   1.1  wrstuden 		/* wait for debugger */
    392   1.1  wrstuden 		panic ("layer with unref'ed lowervp");
    393   1.1  wrstuden 	};
    394   1.1  wrstuden #ifdef notnow
    395   1.1  wrstuden 	printf("layer %p/%d -> %p/%d [%s, %d]\n",
    396   1.1  wrstuden 	        LAYERTOV(a), LAYERTOV(a)->v_usecount,
    397   1.1  wrstuden 		a->layer_lowervp, a->layer_lowervp->v_usecount,
    398   1.1  wrstuden 		fil, lno);
    399   1.1  wrstuden #endif
    400   1.1  wrstuden 	return a->layer_lowervp;
    401   1.1  wrstuden }
    402