[BACK]Return to layer_subr.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / miscfs / genfs

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/miscfs/genfs/layer_subr.c between version 1.21.20.1 and 1.21.20.2

version 1.21.20.1, 2007/11/06 23:33:18 version 1.21.20.2, 2008/01/09 01:57:02
Line 77  __KERNEL_RCSID(0, "$NetBSD$");
Line 77  __KERNEL_RCSID(0, "$NetBSD$");
 #include <sys/vnode.h>  #include <sys/vnode.h>
 #include <sys/mount.h>  #include <sys/mount.h>
 #include <sys/namei.h>  #include <sys/namei.h>
   #include <sys/kmem.h>
 #include <sys/malloc.h>  #include <sys/malloc.h>
   
 #include <miscfs/specfs/specdev.h>  #include <miscfs/specfs/specdev.h>
 #include <miscfs/genfs/layer.h>  #include <miscfs/genfs/layer.h>
 #include <miscfs/genfs/layer_extern.h>  #include <miscfs/genfs/layer_extern.h>
Line 157  loop:
Line 159  loop:
                          * the layer vp's lock separately afterward, but only                           * the layer vp's lock separately afterward, but only
                          * if it does not share the lower vp's lock.                           * if it does not share the lower vp's lock.
                          */                           */
                           mutex_enter(&vp->v_interlock);
                         mutex_exit(&lmp->layerm_hashlock);                          mutex_exit(&lmp->layerm_hashlock);
                         error = vget(vp, 0);                          error = vget(vp, LK_INTERLOCK);
                         if (error) {                          if (error) {
                                 mutex_enter(&lmp->layerm_hashlock);                                  mutex_enter(&lmp->layerm_hashlock);
                                 goto loop;                                  goto loop;
Line 189  layer_node_alloc(mp, lowervp, vpp)
Line 192  layer_node_alloc(mp, lowervp, vpp)
         int error;          int error;
         extern int (**dead_vnodeop_p)(void *);          extern int (**dead_vnodeop_p)(void *);
   
         if ((error = getnewvnode(lmp->layerm_tag, mp, lmp->layerm_vnodeop_p,          error = getnewvnode(lmp->layerm_tag, mp, lmp->layerm_vnodeop_p, &vp);
                         &vp)) != 0)          if (error != 0)
                 return (error);                  return (error);
         vp->v_type = lowervp->v_type;          vp->v_type = lowervp->v_type;
         simple_lock(&vp->v_interlock);          mutex_enter(&vp->v_interlock);
         vp->v_iflag |= VI_LAYER;          vp->v_iflag |= VI_LAYER;
         simple_unlock(&vp->v_interlock);          mutex_exit(&vp->v_interlock);
   
         xp = malloc(lmp->layerm_size, M_TEMP, M_WAITOK);          xp = kmem_alloc(lmp->layerm_size, KM_SLEEP);
           if (xp == NULL) {
                   ungetnewvnode(vp);
                   return ENOMEM;
           }
         if (vp->v_type == VBLK || vp->v_type == VCHR) {          if (vp->v_type == VBLK || vp->v_type == VCHR) {
                 MALLOC(vp->v_specinfo, struct specinfo *,                  MALLOC(vp->v_specinfo, struct specinfo *,
                     sizeof(struct specinfo), M_VNODE, M_WAITOK);                      sizeof(struct specinfo), M_VNODE, M_WAITOK);
Line 206  layer_node_alloc(mp, lowervp, vpp)
Line 213  layer_node_alloc(mp, lowervp, vpp)
         }          }
   
         vp->v_data = xp;          vp->v_data = xp;
           vp->v_vflag = (vp->v_vflag & ~VV_MPSAFE) |
               (lowervp->v_vflag & VV_MPSAFE);
         xp->layer_vnode = vp;          xp->layer_vnode = vp;
         xp->layer_lowervp = lowervp;          xp->layer_lowervp = lowervp;
         xp->layer_flags = 0;          xp->layer_flags = 0;
Line 220  layer_node_alloc(mp, lowervp, vpp)
Line 229  layer_node_alloc(mp, lowervp, vpp)
                 *vpp = nvp;                  *vpp = nvp;
   
                 /* free the substructures we've allocated. */                  /* free the substructures we've allocated. */
                 FREE(xp, M_TEMP);                  kmem_free(xp, lmp->layerm_size);
                 if (vp->v_type == VBLK || vp->v_type == VCHR)                  if (vp->v_type == VBLK || vp->v_type == VCHR)
                         FREE(vp->v_specinfo, M_VNODE);                          FREE(vp->v_specinfo, M_VNODE);
   

Legend:
Removed from v.1.21.20.1  
changed lines
  Added in v.1.21.20.2

CVSweb <webmaster@jp.NetBSD.org>