tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Vnode API cleanup pass 1



This is the first pass to cleanup the vnode API.  It basically moves
some functions and defines out of global scope to make it easier to
work on the vnode life cycle supporting functions.

1) with the attached diff:

 - The following defines and functions become private to vfs_vnode.c:

       VC_MASK, VC_LOCK, DOCLOSE, VI_IANCTREDO and VI_INACTNOW

       vclean() and vrelel()

 - Function vrecycle() looses its unused lwp argument.


   We now have vtryget(), vget() and vref() to get a reference,
   vrele() and vrele_async() to drop a reference and
   vrevoke(), vgone() and vrecycle() to drop (possible active) nodes.

   With these changes v_usecount will not be changed outside of
   vfs_vnode.c so this is a first small step to clean up some messy
   parts of the vnode life cycle.


 * We could also pass down REVOKEALL to vrevoke() and replace vgone(vp)
   with vrevoke(vp, 0) but I prefer to later implement vrevoke()
   using vgone().

 * As I don't see the race in uipc_usrreq.c I'm not really confident it
   is ok to unlock the interlock here.


2) while here I propose to remove vtryget(), it is responsible for
   ugly hacks and it doesn't look that effective:

   It is currently used by the name cache where some entries have
   a ~ 100% hit rate while the overall hit rate is between 5% and 15%.

   It saves us two out of ~ ten atomic operations per lookup cycle.

   If we want to keep it we should change v_usecount to a function

   unsigned
   vusecount(vnode_t *vp)
   {
        return v_usecount & MASK;
   }


Comments or objections anyone?

--
J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig 
(Germany)

Attachment: vnapi.diff
Description: Binary data







Home | Main Index | Thread Index | Old Index