kernel/fs/vnode.c
/*
 * Return VNode to cached pool.
 */
Return VNode to cached pool.
Return VNode to cached pool .
void VNodePut(struct VNode *vnode) {
  if (vnode == NULL) {
    Warn("VNodePut null");
    return;
  }
  vnode->reference_cnt--;
  if (vnode->superblock != NULL) {  
    vnode->superblock->reference_cnt--;
  } else {
    Warn("vnode->superblock null");
  }
  if (vnode->reference_cnt == 0) {
    if ((vnode->flags & V_ROOT) == 0) {
      vnode->flags |= V_FREE;
      LIST_ADD_TAIL(&vnode_free_list, vnode, vnode_entry);
    }
    vnode->superblock = NULL;
    vnode->flags = 0;
  }
  vnode->busy = 0;
  TaskWakeupAll(&vnode->rendez);
}
void VNodePut ( struct VNode * vnode ) { if ( vnode == NULL ) { Warn ( " " ) ; return ; } vnode -> reference_cnt -- ; if ( vnode -> superblock != NULL ) { vnode -> superblock -> reference_cnt -- ; } else { Warn ( " " ) ; } if ( vnode -> reference_cnt == 0 ) { if ( ( vnode -> flags & V_ROOT ) == 0 ) { vnode -> flags |= V_FREE ; LIST_ADD_TAIL ( & vnode_free_list , vnode , vnode_entry ) ; } vnode -> superblock = NULL ; vnode -> flags = 0 ; } vnode -> busy = 0 ; TaskWakeupAll ( & vnode -> rendez ) ; }
Return VNode to cached pool.
Return VNode to cached pool .
// FIXME: IF vnode->link_count == 0,  delete entries in cache. /*
    
    if (vnode->nlink == 0) {
      
      // Thought we removed vnode->vfs ??????????
      vnode->vfs->remove(vnode);
    }  
*/ // FIXME: may want to reinstate: decrement sb ref count 