Patch for inode SLIST conversion

Matthew Dillon dillon at apollo.backplane.com
Mon Jan 21 10:40:33 PST 2008


    I think the concept is a perfectly good programming abstraction, though
    I have to again caution that it can result in fairly fragile code.  It's
    definitely not needed for UFS's inode hash because the chain lengths
    are so short.

    Going back to your token patch... lets simplify it.  Get rid of
    lwkt_staleref() and lwkt_initstale() entirely.  Build the semantics
    SOLELY out of lwkt_is_stale().  The definition of lwkt_is_stale() would
    be:

    * Returns 0 if the token in question had not been temporarily acquired
      while we were blocked since our last lwkt_gettoken(), lwkt_gettokref(),
      or lwkt_is_stale() call.

    * Returns non-zero if it was.

    How do you detect the situation?  Really simple I think.  Augment
    the lwkt_token structure with a pointer to the last lwkt_tokref that
    acquired it.  Get rid of the 64 bit generation counter, it isn't needed.

    lwkt_token {
	...
	struct lwkt_tokref *lastref;
    }

    Whenever a token is acquired (_lwkt_gettokref()) is called lastref is
    set to the tokref.  Whenever a token is released lastref is set to NULL.

    The special case of the thread scheduler reacquiring the token with
    lwkt_getalltokens() would NULL the field out if lastref != tokref,
    and otherwise leave the field intact.

    What do you think?

							-Matt






More information about the Kernel mailing list